@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.
Files changed (71) hide show
  1. package/dist/{ConnectedDataExplorerComponent-Sd9Nxepm.js → ConnectedDataExplorerComponent-B3jU38aR.js} +4 -4
  2. package/dist/{ImageComparisonComponent-5Y_UPK-4.js → ImageComparisonComponent-CUfFulP7.js} +1 -1
  3. package/dist/{VegaLite-xEnU6x-s.js → VegaLite-CT_m2Gns.js} +7180 -6961
  4. package/dist/{_baseUniq-hectrKF-.js → _baseUniq-DVXzAxqW.js} +36 -36
  5. package/dist/{any-language-editor-CFSQwvzE.js → any-language-editor-Bm5ppbnQ.js} +1 -1
  6. package/dist/{architectureDiagram-NQ2NVSRB-CCXJjFvh.js → architectureDiagram-IEHRJDOE-Buq1PEDd.js} +894 -897
  7. package/dist/assets/{worker-Bfk1FrzG.js → save-worker-BIDtxCd1.js} +1724 -1604
  8. package/dist/assets/{save-worker-fI5ofStJ.js → worker-BcyuOSTi.js} +1649 -1076
  9. package/dist/assets/worker-Dz6PPEGc.js +4115 -0
  10. package/dist/{blockDiagram-PHRCVELO-BjyOlQ-1.js → blockDiagram-JOT3LUYC-Baj8O4gb.js} +522 -534
  11. package/dist/{c4Diagram-6F6E4RAY-Dekfu0nv.js → c4Diagram-VJAJSXHY-CBDfWUzS.js} +4 -4
  12. package/dist/{channel-3ZP1Ahsx.js → channel-Cy0SmgpI.js} +1 -1
  13. package/dist/{chunk-353BL4L5-DAFgStCL.js → chunk-4BMEZGHF-BnpEqs6S.js} +1 -1
  14. package/dist/{chunk-QEP2MXWD-B3Qy_0QF.js → chunk-A2AXSNBT-i8l7moUJ.js} +27 -30
  15. package/dist/chunk-AEK57VVT-BxuW_6WB.js +1416 -0
  16. package/dist/{chunk-67H74DCK-DZpdsEFc.js → chunk-D6G4REZN-DwIklRV0.js} +1 -1
  17. package/dist/chunk-RZ5BOZE2-CNoeotZt.js +24 -0
  18. package/dist/{chunk-AACKK3MU-B95hL8py.js → chunk-XZIHB7SX-Cr4T9caJ.js} +1 -1
  19. package/dist/{classDiagram-v2-O24JOBDK-CRnOnb_r.js → classDiagram-GIVACNV2-CbFkMOFI.js} +2 -2
  20. package/dist/{classDiagram-BGRH5UQR-CRnOnb_r.js → classDiagram-v2-COTLJTTW-CbFkMOFI.js} +2 -2
  21. package/dist/{clone-CFt3Dbsx.js → clone-BeXSGgDB.js} +1 -1
  22. package/dist/{dagre-FFZHY6LT-BCZYCsTf.js → dagre-OKDRZEBW-Bo2roBvL.js} +8 -8
  23. package/dist/{data-editor-DJm7TwNK.js → data-editor-Dnm_K2_c.js} +201 -213
  24. package/dist/{diagram-ZTM2IBQH-CZn2HwdK.js → diagram-SSKATNLV-6e7ZOneB.js} +3 -3
  25. package/dist/diagram-VNBRO52H-VcG5htt_.js +126 -0
  26. package/dist/{erDiagram-R3QVA2FD-CgONUTHE.js → erDiagram-Q7BY3M3F-DObb1KYA.js} +5 -6
  27. package/dist/{flowDiagram-PKI6S5ZS-Dk7_9UWG.js → flowDiagram-4HSFHLVR-BAvIkIMr.js} +278 -283
  28. package/dist/{ganttDiagram-EK5VF46D-CRpVp1Tv.js → ganttDiagram-APWFNJXF-BUabt1F7.js} +439 -453
  29. package/dist/{gitGraphDiagram-GW3U2K7C-C62qVSS0.js → gitGraphDiagram-7IBYFJ6S-Bs-H6FAX.js} +35 -35
  30. package/dist/{graph-Bmg6ThvY.js → graph-B7tbSSJp.js} +3 -3
  31. package/dist/{index-DjyV3XsQ.js → index-CiG5v3ld.js} +3 -3
  32. package/dist/{index-CpMCQprO.js → index-DI-1MlWW.js} +1 -1
  33. package/dist/{index-DOW7j8QD.js → index-DpepA-b-.js} +3 -6
  34. package/dist/{index-BmXq13zt.js → index-phTQQwAJ.js} +4 -4
  35. package/dist/{infoDiagram-RLU2ROGC-BxV_L_v4.js → infoDiagram-PH2N3AL5-7fwphtgP.js} +3 -5
  36. package/dist/journeyDiagram-U35MCT3I-C4s4ilvs.js +809 -0
  37. package/dist/{kanban-definition-ILFWEQ3N-Czy4NHmp.js → kanban-definition-NDS4AKOZ-DcxIaLdv.js} +39 -41
  38. package/dist/{layout-oDYqqouw.js → layout-v4OeDCTb.js} +49 -49
  39. package/dist/{linear-B2w8crqt.js → linear-xHimOevt.js} +22 -22
  40. package/dist/{main-WBPEOYUW.js → main-C7CuKeJY.js} +47637 -47530
  41. package/dist/main.js +1 -1
  42. package/dist/{mermaid-BrDUrAOA.js → mermaid-C9S7GU2b.js} +4855 -4927
  43. package/dist/min-BT9mkTQN.js +80 -0
  44. package/dist/{mindmap-definition-CZNETY7S-DwnN0Xtd.js → mindmap-definition-ALO5MXBD-CVFEcHZK.js} +3 -3
  45. package/dist/{pieDiagram-NIOCPIFQ-C6DftsTF.js → pieDiagram-IB7DONF6-Co1Ma8jK.js} +3 -3
  46. package/dist/{quadrantDiagram-2OG54O6I-D_F4-y3O.js → quadrantDiagram-7GDLP6J5-DQlP2K2y.js} +2 -2
  47. package/dist/{treemap-FKARHQ26-BdRtb6Jl.js → radar-MK3ICKWK-BhkTFShi.js} +2330 -2469
  48. package/dist/{react-plotly-DyGjmGkP.js → react-plotly-Bh6GaXqm.js} +1 -1
  49. package/dist/{requirementDiagram-SO3GGRV7-B0B6nUaZ.js → requirementDiagram-KVF5MWMF-BygiWyL4.js} +4 -5
  50. package/dist/{sankeyDiagram-4UZDY2LN-Dc9a_ZCf.js → sankeyDiagram-QLVOVGJD-Ch4TJi_X.js} +11 -11
  51. package/dist/{sequenceDiagram-ZIKVLSP4-CK0IGm4R.js → sequenceDiagram-X6HHIX6F-DuQdesWk.js} +149 -151
  52. package/dist/{slides-component-Dnp9jsH4.js → slides-component-BA1GLkbQ.js} +962 -969
  53. package/dist/stateDiagram-DGXRK772-CG6dTG8s.js +271 -0
  54. package/dist/{stateDiagram-v2-GD6S3NHB-z7eMLBFB.js → stateDiagram-v2-YXO3MK2T-ChBhvPue.js} +2 -2
  55. package/dist/style.css +1 -1
  56. package/dist/{time-CsAbaoLW.js → time-BImtLwbp.js} +2 -2
  57. package/dist/{timeline-definition-RI47OAVP-BClUsJ6N.js → timeline-definition-BDJGKUSR-DDxqWt73.js} +102 -99
  58. package/dist/{vega-component-B4kFG0mV.js → vega-component-ClHul7Ph.js} +21 -21
  59. package/dist/{xychartDiagram-H2YORKM3-DKa9A91j.js → xychartDiagram-VJFVF3MP-DsuROm2x.js} +375 -409
  60. package/package.json +42 -42
  61. package/dist/assets/worker-BldghCZh.js +0 -3752
  62. package/dist/chunk-6OLS64BW-Brmt-SZS.js +0 -1383
  63. package/dist/chunk-BFAMUDN2-BT75CqeT.js +0 -8
  64. package/dist/chunk-E2GYISFI-C0R6djsG.js +0 -19
  65. package/dist/chunk-SKB7J2MH-CW_LVmrE.js +0 -20
  66. package/dist/diagram-3EMPZRKU-K1apRbx_.js +0 -313
  67. package/dist/diagram-5UYTHUR4-CDt_HKgG.js +0 -137
  68. package/dist/index-pBmAzQJl.js +0 -235
  69. package/dist/journeyDiagram-EWQZEKCU-BmLTz9kg.js +0 -836
  70. package/dist/min-DrafC17d.js +0 -80
  71. package/dist/stateDiagram-XX37X6EN-BvfpfSgz.js +0 -264
@@ -1,185 +1,185 @@
1
- var Yt = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
2
- var tn = Yt((sn, Ue) => {
3
- const Xt = 1e10, Gt = 1e3;
4
- function me(t, e) {
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 Kt(t = {}) {
8
+ function br(t = {}) {
9
9
  let e = {};
10
- function r(m) {
11
- e = m;
10
+ function r(g) {
11
+ e = g;
12
12
  }
13
13
  let n = {};
14
- function s(m) {
15
- n.unregisterHandler && n.unregisterHandler(), n = m, n.registerHandler?.(Jt);
14
+ function s(g) {
15
+ n.unregisterHandler && n.unregisterHandler(), n = g, n.registerHandler?.(vr);
16
16
  }
17
17
  let a;
18
- function i(m) {
19
- if (typeof m == "function") {
20
- a = m;
18
+ function i(g) {
19
+ if (typeof g == "function") {
20
+ a = g;
21
21
  return;
22
22
  }
23
- a = (x, E) => {
24
- const T = m[x];
25
- if (T)
26
- return T(E);
27
- const I = m._;
28
- if (!I)
29
- throw new Error(`The requested method has no handler: ${x}`);
30
- return I(x, E);
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 = Gt } = t;
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 d = 0;
36
- function u() {
37
- return d <= Xt ? ++d : d = 0;
38
- }
39
- const h = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
40
- function S(m, ...x) {
41
- const E = x[0];
42
- return new Promise((T, I) => {
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 me(["send"], "make requests");
45
- const Z = u(), Xe = {
44
+ throw De(["send"], "make requests");
45
+ const J = d(), bt = {
46
46
  type: "request",
47
- id: Z,
48
- method: m,
47
+ id: J,
48
+ method: g,
49
49
  params: E
50
50
  };
51
- h.set(Z, { resolve: T, reject: I }), o !== 1 / 0 && b.set(Z, setTimeout(() => {
52
- b.delete(Z), I(new Error("RPC request timed out."));
53
- }, o)), e.onSend?.(Xe), n.send(Xe);
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 A = new Proxy(S, {
57
- get: (m, x, E) => x in m ? Reflect.get(m, x, E) : (T) => S(x, T)
58
- }), $ = A;
59
- function pe(m, ...x) {
60
- const E = x[0];
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 me(["send"], "send messages");
63
- const T = {
62
+ throw De(["send"], "send messages");
63
+ const N = {
64
64
  type: "message",
65
- id: m,
65
+ id: g,
66
66
  payload: E
67
67
  };
68
- e.onSend?.(T), n.send(T);
68
+ e.onSend?.(N), n.send(N);
69
69
  }
70
- const Je = new Proxy(pe, {
71
- get: (m, x, E) => x in m ? Reflect.get(m, x, E) : (T) => pe(x, T)
72
- }), Ye = Je, H = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Set();
73
- function Bt(m, x) {
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 me(["registerHandler"], "register message listeners");
76
- if (m === "*") {
77
- Te.add(x);
75
+ throw De(["registerHandler"], "register message listeners");
76
+ if (g === "*") {
77
+ rt.add(S);
78
78
  return;
79
79
  }
80
- H.has(m) || H.set(m, /* @__PURE__ */ new Set()), H.get(m)?.add(x);
80
+ te.has(g) || te.set(g, /* @__PURE__ */ new Set()), te.get(g)?.add(S);
81
81
  }
82
- function Wt(m, x) {
83
- if (m === "*") {
84
- Te.delete(x);
82
+ function gr(g, S) {
83
+ if (g === "*") {
84
+ rt.delete(S);
85
85
  return;
86
86
  }
87
- H.get(m)?.delete(x), H.get(m)?.size === 0 && H.delete(m);
87
+ te.get(g)?.delete(S), te.get(g)?.size === 0 && te.delete(g);
88
88
  }
89
- async function Jt(m) {
90
- if (e.onReceive?.(m), !("type" in m))
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 (m.type === "request") {
92
+ if (g.type === "request") {
93
93
  if (!n.send || !a)
94
- throw me(["send", "requestHandler"], "handle requests");
95
- const { id: x, method: E, params: T } = m;
96
- let I;
94
+ throw De(["send", "requestHandler"], "handle requests");
95
+ const { id: S, method: E, params: N } = g;
96
+ let F;
97
97
  try {
98
- I = {
98
+ F = {
99
99
  type: "response",
100
- id: x,
100
+ id: S,
101
101
  success: !0,
102
- payload: await a(E, T)
102
+ payload: await a(E, N)
103
103
  };
104
- } catch (Z) {
105
- if (!(Z instanceof Error))
106
- throw Z;
107
- I = {
104
+ } catch (J) {
105
+ if (!(J instanceof Error))
106
+ throw J;
107
+ F = {
108
108
  type: "response",
109
- id: x,
109
+ id: S,
110
110
  success: !1,
111
- error: Z.message
111
+ error: J.message
112
112
  };
113
113
  }
114
- e.onSend?.(I), n.send(I);
114
+ e.onSend?.(F), n.send(F);
115
115
  return;
116
116
  }
117
- if (m.type === "response") {
118
- const x = b.get(m.id);
119
- x != null && clearTimeout(x);
120
- const { resolve: E, reject: T } = h.get(m.id) ?? {};
121
- m.success ? E?.(m.payload) : T?.(new Error(m.error));
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 (m.type === "message") {
125
- for (const E of Te)
126
- E(m.id, m.payload);
127
- const x = H.get(m.id);
128
- if (!x)
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 x)
131
- E(m.payload);
130
+ for (const E of S)
131
+ E(g.payload);
132
132
  return;
133
133
  }
134
- throw new Error(`Unexpected RPC message type: ${m.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: A,
140
- requestProxy: $,
141
- send: Je,
142
- sendProxy: Ye,
143
- addMessageListener: Bt,
144
- removeMessageListener: Wt,
145
- proxy: { send: Ye, request: $ },
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 Qt(t) {
150
- return Kt(t);
149
+ function xr(t) {
150
+ return br(t);
151
151
  }
152
- const mt = "[transport-id]";
153
- function er(t, e) {
152
+ const Pt = "[transport-id]";
153
+ function Sr(t, e) {
154
154
  const { transportId: r } = e;
155
- return r != null ? { [mt]: r, data: t } : t;
155
+ return r != null ? { [Pt]: r, data: t } : t;
156
156
  }
157
- function tr(t, e) {
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[mt] !== r)
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 rr(t, e = {}) {
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(d) {
174
- i.postMessage(er(d, { transportId: r }));
173
+ send(c) {
174
+ i.postMessage(Sr(c, { transportId: r }));
175
175
  },
176
- registerHandler(d) {
177
- o = (u) => {
178
- const h = u.data, [b, S] = tr(h, {
176
+ registerHandler(c) {
177
+ o = (d) => {
178
+ const u = d.data, [w, x] = Tr(u, {
179
179
  transportId: r,
180
- filter: () => n?.(u)
180
+ filter: () => n?.(d)
181
181
  });
182
- b || d(S);
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 nr(t) {
191
- return rr(self, t);
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 ae = {
199
+ const _e = {
194
200
  NOOP: () => {
195
201
  }
196
- }, yt = (t, e) => {
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) => yt(`${t}.${n}`, e),
205
- disabled: (n = !0) => n ? _e : e
210
+ get: (n) => Ct(`${t}.${n}`, e),
211
+ disabled: (n = !0) => n ? Ue : e
206
212
  };
207
- }, ve = {
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) => yt(t, ve),
224
- disabled: (t = !0) => t ? _e : ve
225
- }, _e = {
226
- debug: () => ae.NOOP,
227
- log: () => ae.NOOP,
228
- warn: () => ae.NOOP,
229
- error: () => ae.NOOP,
230
- trace: () => ae.NOOP,
231
- get: () => _e,
232
- disabled: () => _e
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 sr() {
235
- return typeof window < "u" && window.Logger || ve;
240
+ function Rr() {
241
+ return typeof window < "u" && window.Logger || qe;
236
242
  }
237
- const de = sr(), Ae = (t) => new TextDecoder().decode(t);
238
- var w;
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" && Number.isFinite(s) && Math.floor(s) === s;
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
- })(w || (w = {}));
275
- var Ge;
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
- })(Ge || (Ge = {}));
283
- const f = w.arrayToEnum([
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
- ]), L = (t) => {
324
+ ]), B = (t) => {
305
325
  switch (typeof t) {
306
326
  case "undefined":
307
- return f.undefined;
327
+ return p.undefined;
308
328
  case "string":
309
- return f.string;
329
+ return p.string;
310
330
  case "number":
311
- return Number.isNaN(t) ? f.nan : f.number;
331
+ return isNaN(t) ? p.nan : p.number;
312
332
  case "boolean":
313
- return f.boolean;
333
+ return p.boolean;
314
334
  case "function":
315
- return f.function;
335
+ return p.function;
316
336
  case "bigint":
317
- return f.bigint;
337
+ return p.bigint;
318
338
  case "symbol":
319
- return f.symbol;
339
+ return p.symbol;
320
340
  case "object":
321
- return Array.isArray(t) ? f.array : t === null ? f.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? f.promise : typeof Map < "u" && t instanceof Map ? f.map : typeof Set < "u" && t instanceof Set ? f.set : typeof Date < "u" && t instanceof Date ? f.date : f.object;
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 f.unknown;
343
+ return p.unknown;
324
344
  }
325
- }, c = w.arrayToEnum([
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 F extends Error {
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, d = 0;
371
- for (; d < i.path.length; ) {
372
- const u = i.path[d];
373
- d === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(r(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], d++;
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 F))
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, w.jsonStringifyReplacer, 2);
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
- if (s.path.length > 0) {
396
- const a = s.path[0];
397
- r[a] = r[a] || [], r[a].push(e(s));
398
- } else
399
- n.push(e(s));
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
- F.create = (t) => new F(t);
407
- const Ie = (t, e) => {
422
+ C.create = (t) => new C(t);
423
+ const ye = (t, e) => {
408
424
  let r;
409
425
  switch (t.code) {
410
- case c.invalid_type:
411
- t.received === f.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${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 c.invalid_literal:
414
- r = `Invalid literal value, expected ${JSON.stringify(t.expected, w.jsonStringifyReplacer)}`;
429
+ case l.invalid_literal:
430
+ r = `Invalid literal value, expected ${JSON.stringify(t.expected, k.jsonStringifyReplacer)}`;
415
431
  break;
416
- case c.unrecognized_keys:
417
- r = `Unrecognized key(s) in object: ${w.joinValues(t.keys, ", ")}`;
432
+ case l.unrecognized_keys:
433
+ r = `Unrecognized key(s) in object: ${k.joinValues(t.keys, ", ")}`;
418
434
  break;
419
- case c.invalid_union:
435
+ case l.invalid_union:
420
436
  r = "Invalid input";
421
437
  break;
422
- case c.invalid_union_discriminator:
423
- r = `Invalid discriminator value. Expected ${w.joinValues(t.options)}`;
438
+ case l.invalid_union_discriminator:
439
+ r = `Invalid discriminator value. Expected ${k.joinValues(t.options)}`;
424
440
  break;
425
- case c.invalid_enum_value:
426
- r = `Invalid enum value. Expected ${w.joinValues(t.options)}, received '${t.received}'`;
441
+ case l.invalid_enum_value:
442
+ r = `Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;
427
443
  break;
428
- case c.invalid_arguments:
444
+ case l.invalid_arguments:
429
445
  r = "Invalid function arguments";
430
446
  break;
431
- case c.invalid_return_type:
447
+ case l.invalid_return_type:
432
448
  r = "Invalid function return type";
433
449
  break;
434
- case c.invalid_date:
450
+ case l.invalid_date:
435
451
  r = "Invalid date";
436
452
  break;
437
- case c.invalid_string:
438
- typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : w.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
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 c.too_small:
441
- t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
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 c.too_big:
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 c.custom:
462
+ case l.custom:
447
463
  r = "Invalid input";
448
464
  break;
449
- case c.invalid_intersection_types:
465
+ case l.invalid_intersection_types:
450
466
  r = "Intersection results could not be merged";
451
467
  break;
452
- case c.not_multiple_of:
468
+ case l.not_multiple_of:
453
469
  r = `Number must be a multiple of ${t.multipleOf}`;
454
470
  break;
455
- case c.not_finite:
471
+ case l.not_finite:
456
472
  r = "Number must be finite";
457
473
  break;
458
474
  default:
459
- r = e.defaultError, w.assertNever(t);
475
+ r = e.defaultError, k.assertNever(t);
460
476
  }
461
477
  return { message: r };
462
478
  };
463
- let ar = Ie;
464
- function ir() {
465
- return ar;
479
+ let It = ye;
480
+ function Cr(t) {
481
+ It = t;
482
+ }
483
+ function Be() {
484
+ return It;
466
485
  }
467
- const or = (t) => {
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 d = n.filter((u) => !!u).slice().reverse();
480
- for (const u of d)
481
- o = u(i, { data: e, defaultError: o }).message;
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 l(t, e) {
489
- const r = ir(), n = or({
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 === Ie ? void 0 : Ie
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 R {
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 R.mergeObjectSync(e, n);
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
- }), ce = (t) => ({ status: "dirty", value: t }), C = (t) => ({ status: "valid", value: t }), Ke = (t) => t.status === "aborted", Qe = (t) => t.status === "dirty", te = (t) => t.status === "valid", ke = (t) => typeof Promise < "u" && t instanceof Promise;
550
- var p;
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
- })(p || (p = {}));
554
- class q {
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 || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
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 et = (t, e) => {
563
- if (te(e))
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 F(t.common.issues);
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
- const { message: d } = t;
585
- return i.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: d ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: d ?? r ?? o.defaultError };
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 k {
617
+ class _ {
589
618
  get description() {
590
619
  return this._def.description;
591
620
  }
592
621
  _getType(e) {
593
- return L(e.data);
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: L(e.data),
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 R(),
636
+ status: new O(),
608
637
  ctx: {
609
638
  common: e.parent.common,
610
639
  data: e.data,
611
- parsedType: L(e.data),
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 (ke(r))
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
- const n = {
664
+ var n;
665
+ const s = {
636
666
  common: {
637
667
  issues: [],
638
- async: r?.async ?? !1,
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: L(e)
646
- }, s = this._parseSync({ data: e, path: n.path, parent: n });
647
- return et(n, s);
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
- const r = {
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: L(e)
690
+ parsedType: B(e)
660
691
  };
661
692
  if (!this["~standard"].async)
662
693
  try {
663
- const n = this._parseSync({ data: e, path: [], parent: r });
664
- return te(n) ? {
665
- value: n.value
694
+ const a = this._parseSync({ data: e, path: [], parent: s });
695
+ return oe(a) ? {
696
+ value: a.value
666
697
  } : {
667
- issues: r.common.issues
698
+ issues: s.common.issues
668
699
  };
669
- } catch (n) {
670
- n?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), r.common = {
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: r }).then((n) => te(n) ? {
676
- value: n.value
706
+ return this._parseAsync({ data: e, path: [], parent: s }).then((a) => oe(a) ? {
707
+ value: a.value
677
708
  } : {
678
- issues: r.common.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: L(e)
699
- }, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ke(s) ? s : Promise.resolve(s));
700
- return et(n, a);
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: c.custom,
737
+ code: l.custom,
707
738
  ...n(s)
708
739
  });
709
- return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
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 ne({
747
+ return new $({
717
748
  schema: this,
718
- typeName: g.ZodEffects,
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 V.create(this, this._def);
764
+ return L.create(this, this._def);
734
765
  }
735
766
  nullable() {
736
- return se.create(this, this._def);
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 P.create(this);
773
+ return Z.create(this);
743
774
  }
744
775
  promise() {
745
- return Se.create(this, this._def);
776
+ return ve.create(this, this._def);
746
777
  }
747
778
  or(e) {
748
- return xe.create([this, e], this._def);
779
+ return Re.create([this, e], this._def);
749
780
  }
750
781
  and(e) {
751
- return be.create(this, e, this._def);
782
+ return Ae.create(this, e, this._def);
752
783
  }
753
784
  transform(e) {
754
- return new ne({
785
+ return new $({
755
786
  ...v(this._def),
756
787
  schema: this,
757
- typeName: g.ZodEffects,
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 je({
794
+ return new Ze({
764
795
  ...v(this._def),
765
796
  innerType: this,
766
797
  defaultValue: r,
767
- typeName: g.ZodDefault
798
+ typeName: m.ZodDefault
768
799
  });
769
800
  }
770
801
  brand() {
771
- return new Cr({
772
- typeName: g.ZodBranded,
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: g.ZodCatch
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 ze.create(this, e);
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 dr = /^c[^\s-]{8,}$/i, cr = /^[0-9a-z]+$/, ur = /^[0-9A-HJKMNP-TV-Z]{26}$/i, lr = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, fr = /^[a-z0-9_-]{21}$/i, hr = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, pr = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, mr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, yr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
807
- let Ne;
808
- const gr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, vr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, _r = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, kr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, gt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", br = new RegExp(`^${gt}$`);
809
- function vt(t) {
810
- let e = "[0-5]\\d";
811
- t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
812
- const r = t.precision ? "+" : "?";
813
- return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
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 Sr(t) {
816
- return new RegExp(`^${vt(t)}$`);
844
+ function Kr(t) {
845
+ return new RegExp(`^${$t(t)}$`);
817
846
  }
818
- function Or(t) {
819
- let e = `${gt}T${vt(t)}`;
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 Er(t, e) {
824
- return !!((e === "v4" || !e) && gr.test(t) || (e === "v6" || !e) && _r.test(t));
852
+ function Gr(t, e) {
853
+ return !!((e === "v4" || !e) && qr.test(t) || (e === "v6" || !e) && Br.test(t));
825
854
  }
826
- function Tr(t, e) {
827
- if (!hr.test(t))
855
+ function Xr(t, e) {
856
+ if (!Lr.test(t))
828
857
  return !1;
829
858
  try {
830
- const [r] = t.split(".");
831
- if (!r)
832
- return !1;
833
- const n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
834
- return !(typeof s != "object" || s === null || "typ" in s && s?.typ !== "JWT" || !s.alg || e && s.alg !== e);
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 Nr(t, e) {
840
- return !!((e === "v4" || !e) && vr.test(t) || (e === "v6" || !e) && kr.test(t));
865
+ function Qr(t, e) {
866
+ return !!((e === "v4" || !e) && Ur.test(t) || (e === "v6" || !e) && Hr.test(t));
841
867
  }
842
- class D extends k {
868
+ class j extends _ {
843
869
  _parse(e) {
844
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
870
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
845
871
  const a = this._getOrReturnCtx(e);
846
- return l(a, {
847
- code: c.invalid_type,
848
- expected: f.string,
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 R();
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), l(s, {
857
- code: c.too_small,
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), l(s, {
866
- code: c.too_big,
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 ? l(s, {
876
- code: c.too_big,
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 && l(s, {
883
- code: c.too_small,
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
- mr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
917
+ Vr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
892
918
  validation: "email",
893
- code: c.invalid_string,
919
+ code: l.invalid_string,
894
920
  message: a.message
895
921
  }), n.dirty());
896
922
  else if (a.kind === "emoji")
897
- Ne || (Ne = new RegExp(yr, "u")), Ne.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
923
+ nt || (nt = new RegExp(zr, "u")), nt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
898
924
  validation: "emoji",
899
- code: c.invalid_string,
925
+ code: l.invalid_string,
900
926
  message: a.message
901
927
  }), n.dirty());
902
928
  else if (a.kind === "uuid")
903
- lr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
929
+ Fr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
904
930
  validation: "uuid",
905
- code: c.invalid_string,
931
+ code: l.invalid_string,
906
932
  message: a.message
907
933
  }), n.dirty());
908
934
  else if (a.kind === "nanoid")
909
- fr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
935
+ Mr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
910
936
  validation: "nanoid",
911
- code: c.invalid_string,
937
+ code: l.invalid_string,
912
938
  message: a.message
913
939
  }), n.dirty());
914
940
  else if (a.kind === "cuid")
915
- dr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
941
+ jr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
916
942
  validation: "cuid",
917
- code: c.invalid_string,
943
+ code: l.invalid_string,
918
944
  message: a.message
919
945
  }), n.dirty());
920
946
  else if (a.kind === "cuid2")
921
- cr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
947
+ Zr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
922
948
  validation: "cuid2",
923
- code: c.invalid_string,
949
+ code: l.invalid_string,
924
950
  message: a.message
925
951
  }), n.dirty());
926
952
  else if (a.kind === "ulid")
927
- ur.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
953
+ $r.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
928
954
  validation: "ulid",
929
- code: c.invalid_string,
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), l(s, {
962
+ s = this._getOrReturnCtx(e, s), f(s, {
937
963
  validation: "url",
938
- code: c.invalid_string,
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), l(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: c.invalid_string,
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), l(s, {
947
- code: c.invalid_string,
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), l(s, {
951
- code: c.invalid_string,
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), l(s, {
955
- code: c.invalid_string,
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" ? Or(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
959
- code: c.invalid_string,
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" ? br.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
963
- code: c.invalid_string,
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" ? Sr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
967
- code: c.invalid_string,
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" ? pr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
996
+ }), n.dirty()) : a.kind === "duration" ? Dr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
971
997
  validation: "duration",
972
- code: c.invalid_string,
998
+ code: l.invalid_string,
973
999
  message: a.message
974
- }), n.dirty()) : a.kind === "ip" ? Er(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
1000
+ }), n.dirty()) : a.kind === "ip" ? Gr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
975
1001
  validation: "ip",
976
- code: c.invalid_string,
1002
+ code: l.invalid_string,
977
1003
  message: a.message
978
- }), n.dirty()) : a.kind === "jwt" ? Tr(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), l(s, {
1004
+ }), n.dirty()) : a.kind === "jwt" ? Xr(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
979
1005
  validation: "jwt",
980
- code: c.invalid_string,
1006
+ code: l.invalid_string,
981
1007
  message: a.message
982
- }), n.dirty()) : a.kind === "cidr" ? Nr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
1008
+ }), n.dirty()) : a.kind === "cidr" ? Qr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
983
1009
  validation: "cidr",
984
- code: c.invalid_string,
1010
+ code: l.invalid_string,
985
1011
  message: a.message
986
- }), n.dirty()) : a.kind === "base64" ? wr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1012
+ }), n.dirty()) : a.kind === "base64" ? Wr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
987
1013
  validation: "base64",
988
- code: c.invalid_string,
1014
+ code: l.invalid_string,
989
1015
  message: a.message
990
- }), n.dirty()) : a.kind === "base64url" ? xr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1016
+ }), n.dirty()) : a.kind === "base64url" ? Jr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
991
1017
  validation: "base64url",
992
- code: c.invalid_string,
1018
+ code: l.invalid_string,
993
1019
  message: a.message
994
- }), n.dirty()) : w.assertNever(a);
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: c.invalid_string,
1001
- ...p.errToObj(n)
1026
+ code: l.invalid_string,
1027
+ ...h.errToObj(n)
1002
1028
  });
1003
1029
  }
1004
1030
  _addCheck(e) {
1005
- return new D({
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", ...p.errToObj(e) });
1037
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
1012
1038
  }
1013
1039
  url(e) {
1014
- return this._addCheck({ kind: "url", ...p.errToObj(e) });
1040
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
1015
1041
  }
1016
1042
  emoji(e) {
1017
- return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
1043
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
1018
1044
  }
1019
1045
  uuid(e) {
1020
- return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
1046
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
1021
1047
  }
1022
1048
  nanoid(e) {
1023
- return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
1049
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
1024
1050
  }
1025
1051
  cuid(e) {
1026
- return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
1052
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
1027
1053
  }
1028
1054
  cuid2(e) {
1029
- return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
1055
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
1030
1056
  }
1031
1057
  ulid(e) {
1032
- return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
1058
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
1033
1059
  }
1034
1060
  base64(e) {
1035
- return this._addCheck({ kind: "base64", ...p.errToObj(e) });
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
- ...p.errToObj(e)
1066
+ ...h.errToObj(e)
1041
1067
  });
1042
1068
  }
1043
1069
  jwt(e) {
1044
- return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
1070
+ return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
1045
1071
  }
1046
1072
  ip(e) {
1047
- return this._addCheck({ kind: "ip", ...p.errToObj(e) });
1073
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
1048
1074
  }
1049
1075
  cidr(e) {
1050
- return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
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 ?? !1,
1063
- local: e?.local ?? !1,
1064
- ...p.errToObj(e?.message)
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
- ...p.errToObj(e?.message)
1105
+ ...h.errToObj(e?.message)
1079
1106
  });
1080
1107
  }
1081
1108
  duration(e) {
1082
- return this._addCheck({ kind: "duration", ...p.errToObj(e) });
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
- ...p.errToObj(r)
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
- ...p.errToObj(r?.message)
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
- ...p.errToObj(r)
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
- ...p.errToObj(r)
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
- ...p.errToObj(r)
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
- ...p.errToObj(r)
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
- ...p.errToObj(r)
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, p.errToObj(e));
1165
+ return this.min(1, h.errToObj(e));
1139
1166
  }
1140
1167
  trim() {
1141
- return new D({
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 D({
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 D({
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
- D.create = (t) => new D({
1220
- checks: [],
1221
- typeName: g.ZodString,
1222
- coerce: t?.coerce ?? !1,
1223
- ...v(t)
1224
- });
1225
- function Rr(t, e) {
1226
- const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = Number.parseInt(t.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", ""));
1227
- return a % i / 10 ** s;
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 le extends k {
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) !== f.number) {
1264
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
1235
1265
  const a = this._getOrReturnCtx(e);
1236
- return l(a, {
1237
- code: c.invalid_type,
1238
- expected: f.number,
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 R();
1273
+ const s = new O();
1244
1274
  for (const a of this._def.checks)
1245
- a.kind === "int" ? w.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
1246
- code: c.invalid_type,
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), l(n, {
1251
- code: c.too_small,
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), l(n, {
1258
- code: c.too_big,
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" ? Rr(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
1265
- code: c.not_multiple_of,
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), l(n, {
1269
- code: c.not_finite,
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()) : w.assertNever(a);
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, p.toString(r));
1305
+ return this.setLimit("min", e, !0, h.toString(r));
1276
1306
  }
1277
1307
  gt(e, r) {
1278
- return this.setLimit("min", e, !1, p.toString(r));
1308
+ return this.setLimit("min", e, !1, h.toString(r));
1279
1309
  }
1280
1310
  lte(e, r) {
1281
- return this.setLimit("max", e, !0, p.toString(r));
1311
+ return this.setLimit("max", e, !0, h.toString(r));
1282
1312
  }
1283
1313
  lt(e, r) {
1284
- return this.setLimit("max", e, !1, p.toString(r));
1314
+ return this.setLimit("max", e, !1, h.toString(r));
1285
1315
  }
1286
1316
  setLimit(e, r, n, s) {
1287
- return new le({
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: p.toString(s)
1325
+ message: h.toString(s)
1296
1326
  }
1297
1327
  ]
1298
1328
  });
1299
1329
  }
1300
1330
  _addCheck(e) {
1301
- return new le({
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: p.toString(e)
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: p.toString(e)
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: p.toString(e)
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: p.toString(e)
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: p.toString(e)
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: p.toString(r)
1378
+ message: h.toString(r)
1349
1379
  });
1350
1380
  }
1351
1381
  finite(e) {
1352
1382
  return this._addCheck({
1353
1383
  kind: "finite",
1354
- message: p.toString(e)
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: p.toString(e)
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: p.toString(e)
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" && w.isInteger(e.value));
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
- le.create = (t) => new le({
1425
+ K.create = (t) => new K({
1396
1426
  checks: [],
1397
- typeName: g.ZodNumber,
1427
+ typeName: m.ZodNumber,
1398
1428
  coerce: t?.coerce || !1,
1399
1429
  ...v(t)
1400
1430
  });
1401
- class fe extends k {
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) !== f.bigint)
1442
+ if (this._getType(e) !== p.bigint)
1413
1443
  return this._getInvalidInput(e);
1414
1444
  let n;
1415
- const s = new R();
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), l(n, {
1418
- code: c.too_small,
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), l(n, {
1424
- code: c.too_big,
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), l(n, {
1430
- code: c.not_multiple_of,
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()) : w.assertNever(a);
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 l(r, {
1439
- code: c.invalid_type,
1440
- expected: f.bigint,
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, p.toString(r));
1475
+ return this.setLimit("min", e, !0, h.toString(r));
1446
1476
  }
1447
1477
  gt(e, r) {
1448
- return this.setLimit("min", e, !1, p.toString(r));
1478
+ return this.setLimit("min", e, !1, h.toString(r));
1449
1479
  }
1450
1480
  lte(e, r) {
1451
- return this.setLimit("max", e, !0, p.toString(r));
1481
+ return this.setLimit("max", e, !0, h.toString(r));
1452
1482
  }
1453
1483
  lt(e, r) {
1454
- return this.setLimit("max", e, !1, p.toString(r));
1484
+ return this.setLimit("max", e, !1, h.toString(r));
1455
1485
  }
1456
1486
  setLimit(e, r, n, s) {
1457
- return new fe({
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: p.toString(s)
1495
+ message: h.toString(s)
1466
1496
  }
1467
1497
  ]
1468
1498
  });
1469
1499
  }
1470
1500
  _addCheck(e) {
1471
- return new fe({
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: p.toString(e)
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: p.toString(e)
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: p.toString(e)
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: p.toString(e)
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: p.toString(r)
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
- fe.create = (t) => new fe({
1529
- checks: [],
1530
- typeName: g.ZodBigInt,
1531
- coerce: t?.coerce ?? !1,
1532
- ...v(t)
1533
- });
1534
- class tt extends k {
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) !== f.boolean) {
1569
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
1537
1570
  const n = this._getOrReturnCtx(e);
1538
- return l(n, {
1539
- code: c.invalid_type,
1540
- expected: f.boolean,
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 C(e.data);
1577
+ return A(e.data);
1545
1578
  }
1546
1579
  }
1547
- tt.create = (t) => new tt({
1548
- typeName: g.ZodBoolean,
1580
+ Ee.create = (t) => new Ee({
1581
+ typeName: m.ZodBoolean,
1549
1582
  coerce: t?.coerce || !1,
1550
1583
  ...v(t)
1551
1584
  });
1552
- class we extends k {
1585
+ class ce extends _ {
1553
1586
  _parse(e) {
1554
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
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 l(a, {
1557
- code: c.invalid_type,
1558
- expected: f.date,
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 (Number.isNaN(e.data.getTime())) {
1595
+ if (isNaN(e.data.getTime())) {
1563
1596
  const a = this._getOrReturnCtx(e);
1564
- return l(a, {
1565
- code: c.invalid_date
1597
+ return f(a, {
1598
+ code: l.invalid_date
1566
1599
  }), y;
1567
1600
  }
1568
- const n = new R();
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), l(s, {
1572
- code: c.too_small,
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), l(s, {
1579
- code: c.too_big,
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()) : w.assertNever(a);
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 we({
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: p.toString(r)
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: p.toString(r)
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
- we.create = (t) => new we({
1657
+ ce.create = (t) => new ce({
1625
1658
  checks: [],
1626
1659
  coerce: t?.coerce || !1,
1627
- typeName: g.ZodDate,
1660
+ typeName: m.ZodDate,
1628
1661
  ...v(t)
1629
1662
  });
1630
- class rt extends k {
1663
+ class Je extends _ {
1631
1664
  _parse(e) {
1632
- if (this._getType(e) !== f.symbol) {
1665
+ if (this._getType(e) !== p.symbol) {
1633
1666
  const n = this._getOrReturnCtx(e);
1634
- return l(n, {
1635
- code: c.invalid_type,
1636
- expected: f.symbol,
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 C(e.data);
1673
+ return A(e.data);
1641
1674
  }
1642
1675
  }
1643
- rt.create = (t) => new rt({
1644
- typeName: g.ZodSymbol,
1676
+ Je.create = (t) => new Je({
1677
+ typeName: m.ZodSymbol,
1645
1678
  ...v(t)
1646
1679
  });
1647
- class nt extends k {
1680
+ class Oe extends _ {
1648
1681
  _parse(e) {
1649
- if (this._getType(e) !== f.undefined) {
1682
+ if (this._getType(e) !== p.undefined) {
1650
1683
  const n = this._getOrReturnCtx(e);
1651
- return l(n, {
1652
- code: c.invalid_type,
1653
- expected: f.undefined,
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 C(e.data);
1690
+ return A(e.data);
1658
1691
  }
1659
1692
  }
1660
- nt.create = (t) => new nt({
1661
- typeName: g.ZodUndefined,
1693
+ Oe.create = (t) => new Oe({
1694
+ typeName: m.ZodUndefined,
1662
1695
  ...v(t)
1663
1696
  });
1664
- class st extends k {
1697
+ class Ne extends _ {
1665
1698
  _parse(e) {
1666
- if (this._getType(e) !== f.null) {
1699
+ if (this._getType(e) !== p.null) {
1667
1700
  const n = this._getOrReturnCtx(e);
1668
- return l(n, {
1669
- code: c.invalid_type,
1670
- expected: f.null,
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 C(e.data);
1707
+ return A(e.data);
1675
1708
  }
1676
1709
  }
1677
- st.create = (t) => new st({
1678
- typeName: g.ZodNull,
1710
+ Ne.create = (t) => new Ne({
1711
+ typeName: m.ZodNull,
1679
1712
  ...v(t)
1680
1713
  });
1681
- class at extends k {
1714
+ class ge extends _ {
1682
1715
  constructor() {
1683
1716
  super(...arguments), this._any = !0;
1684
1717
  }
1685
1718
  _parse(e) {
1686
- return C(e.data);
1719
+ return A(e.data);
1687
1720
  }
1688
1721
  }
1689
- at.create = (t) => new at({
1690
- typeName: g.ZodAny,
1722
+ ge.create = (t) => new ge({
1723
+ typeName: m.ZodAny,
1691
1724
  ...v(t)
1692
1725
  });
1693
- class it extends k {
1726
+ class ie extends _ {
1694
1727
  constructor() {
1695
1728
  super(...arguments), this._unknown = !0;
1696
1729
  }
1697
1730
  _parse(e) {
1698
- return C(e.data);
1731
+ return A(e.data);
1699
1732
  }
1700
1733
  }
1701
- it.create = (t) => new it({
1702
- typeName: g.ZodUnknown,
1734
+ ie.create = (t) => new ie({
1735
+ typeName: m.ZodUnknown,
1703
1736
  ...v(t)
1704
1737
  });
1705
- class U extends k {
1738
+ class W extends _ {
1706
1739
  _parse(e) {
1707
1740
  const r = this._getOrReturnCtx(e);
1708
- return l(r, {
1709
- code: c.invalid_type,
1710
- expected: f.never,
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
- U.create = (t) => new U({
1716
- typeName: g.ZodNever,
1748
+ W.create = (t) => new W({
1749
+ typeName: m.ZodNever,
1717
1750
  ...v(t)
1718
1751
  });
1719
- class ot extends k {
1752
+ class Ye extends _ {
1720
1753
  _parse(e) {
1721
- if (this._getType(e) !== f.undefined) {
1754
+ if (this._getType(e) !== p.undefined) {
1722
1755
  const n = this._getOrReturnCtx(e);
1723
- return l(n, {
1724
- code: c.invalid_type,
1725
- expected: f.void,
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 C(e.data);
1762
+ return A(e.data);
1730
1763
  }
1731
1764
  }
1732
- ot.create = (t) => new ot({
1733
- typeName: g.ZodVoid,
1765
+ Ye.create = (t) => new Ye({
1766
+ typeName: m.ZodVoid,
1734
1767
  ...v(t)
1735
1768
  });
1736
- class P extends k {
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 !== f.array)
1740
- return l(r, {
1741
- code: c.invalid_type,
1742
- expected: f.array,
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) && (l(r, {
1748
- code: i ? c.too_big : c.too_small,
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 && (l(r, {
1758
- code: c.too_small,
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 && (l(r, {
1765
- code: c.too_big,
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 q(r, i, r.path, o)))).then((i) => R.mergeArray(n, i));
1773
- const a = [...r.data].map((i, o) => s.type._parseSync(new q(r, i, r.path, o)));
1774
- return R.mergeArray(n, a);
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 P({
1813
+ return new Z({
1781
1814
  ...this._def,
1782
- minLength: { value: e, message: p.toString(r) }
1815
+ minLength: { value: e, message: h.toString(r) }
1783
1816
  });
1784
1817
  }
1785
1818
  max(e, r) {
1786
- return new P({
1819
+ return new Z({
1787
1820
  ...this._def,
1788
- maxLength: { value: e, message: p.toString(r) }
1821
+ maxLength: { value: e, message: h.toString(r) }
1789
1822
  });
1790
1823
  }
1791
1824
  length(e, r) {
1792
- return new P({
1825
+ return new Z({
1793
1826
  ...this._def,
1794
- exactLength: { value: e, message: p.toString(r) }
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
- P.create = (t, e) => new P({
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: g.ZodArray,
1839
+ typeName: m.ZodArray,
1807
1840
  ...v(e)
1808
1841
  });
1809
- function X(t) {
1810
- if (t instanceof O) {
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] = V.create(X(n));
1847
+ e[r] = L.create(le(n));
1815
1848
  }
1816
- return new O({
1849
+ return new T({
1817
1850
  ...t._def,
1818
1851
  shape: () => e
1819
1852
  });
1820
- } else return t instanceof P ? new P({
1853
+ } else return t instanceof Z ? new Z({
1821
1854
  ...t._def,
1822
- type: X(t.element)
1823
- }) : t instanceof V ? V.create(X(t.unwrap())) : t instanceof se ? se.create(X(t.unwrap())) : t instanceof Y ? Y.create(t.items.map((e) => X(e))) : t;
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 O extends k {
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 = w.objectKeys(e);
1833
- return this._cached = { shape: e, keys: r }, this._cached;
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) !== f.object) {
1837
- const u = this._getOrReturnCtx(e);
1838
- return l(u, {
1839
- code: c.invalid_type,
1840
- expected: f.object,
1841
- received: u.parsedType
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 U && this._def.unknownKeys === "strip"))
1846
- for (const u in s.data)
1847
- i.includes(u) || o.push(u);
1848
- const d = [];
1849
- for (const u of i) {
1850
- const h = a[u], b = s.data[u];
1851
- d.push({
1852
- key: { status: "valid", value: u },
1853
- value: h._parse(new q(s, b, s.path, u)),
1854
- alwaysSet: u in s.data
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 U) {
1858
- const u = this._def.unknownKeys;
1859
- if (u === "passthrough")
1860
- for (const h of o)
1861
- d.push({
1862
- key: { status: "valid", value: h },
1863
- value: { status: "valid", value: s.data[h] }
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 (u === "strict")
1866
- o.length > 0 && (l(s, {
1867
- code: c.unrecognized_keys,
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 (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1903
+ else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1871
1904
  } else {
1872
- const u = this._def.catchall;
1873
- for (const h of o) {
1874
- const b = s.data[h];
1875
- d.push({
1876
- key: { status: "valid", value: h },
1877
- value: u._parse(
1878
- new q(s, b, s.path, h)
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: h in s.data
1914
+ alwaysSet: u in s.data
1882
1915
  });
1883
1916
  }
1884
1917
  }
1885
1918
  return s.common.async ? Promise.resolve().then(async () => {
1886
- const u = [];
1887
- for (const h of d) {
1888
- const b = await h.key, S = await h.value;
1889
- u.push({
1890
- key: b,
1891
- value: S,
1892
- alwaysSet: h.alwaysSet
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 u;
1896
- }).then((u) => R.mergeObjectSync(n, u)) : R.mergeObjectSync(n, d);
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 p.errToObj, new O({
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
- const s = this._def.errorMap?.(r, n).message ?? n.defaultError;
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: p.errToObj(e).message ?? s
1943
+ message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : c
1910
1944
  } : {
1911
- message: s
1945
+ message: c
1912
1946
  };
1913
1947
  }
1914
1948
  } : {}
1915
1949
  });
1916
1950
  }
1917
1951
  strip() {
1918
- return new O({
1952
+ return new T({
1919
1953
  ...this._def,
1920
1954
  unknownKeys: "strip"
1921
1955
  });
1922
1956
  }
1923
1957
  passthrough() {
1924
- return new O({
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 O({
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 O({
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: g.ZodObject
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 O({
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
- for (const n of w.objectKeys(e))
2072
+ return k.objectKeys(e).forEach((n) => {
2039
2073
  e[n] && this.shape[n] && (r[n] = this.shape[n]);
2040
- return new O({
2074
+ }), new T({
2041
2075
  ...this._def,
2042
2076
  shape: () => r
2043
2077
  });
2044
2078
  }
2045
2079
  omit(e) {
2046
2080
  const r = {};
2047
- for (const n of w.objectKeys(this.shape))
2081
+ return k.objectKeys(this.shape).forEach((n) => {
2048
2082
  e[n] || (r[n] = this.shape[n]);
2049
- return new O({
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 X(this);
2092
+ return le(this);
2059
2093
  }
2060
2094
  partial(e) {
2061
2095
  const r = {};
2062
- for (const n of w.objectKeys(this.shape)) {
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
- for (const n of w.objectKeys(this.shape))
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 V; )
2111
+ for (; a instanceof L; )
2079
2112
  a = a._def.innerType;
2080
2113
  r[n] = a;
2081
2114
  }
2082
- return new O({
2115
+ }), new T({
2083
2116
  ...this._def,
2084
2117
  shape: () => r
2085
2118
  });
2086
2119
  }
2087
2120
  keyof() {
2088
- return _t(w.objectKeys(this.shape));
2121
+ return Mt(k.objectKeys(this.shape));
2089
2122
  }
2090
2123
  }
2091
- O.create = (t, e) => new O({
2124
+ T.create = (t, e) => new T({
2092
2125
  shape: () => t,
2093
2126
  unknownKeys: "strip",
2094
- catchall: U.create(),
2095
- typeName: g.ZodObject,
2127
+ catchall: W.create(),
2128
+ typeName: m.ZodObject,
2096
2129
  ...v(e)
2097
2130
  });
2098
- O.strictCreate = (t, e) => new O({
2131
+ T.strictCreate = (t, e) => new T({
2099
2132
  shape: () => t,
2100
2133
  unknownKeys: "strict",
2101
- catchall: U.create(),
2102
- typeName: g.ZodObject,
2134
+ catchall: W.create(),
2135
+ typeName: m.ZodObject,
2103
2136
  ...v(e)
2104
2137
  });
2105
- O.lazycreate = (t, e) => new O({
2138
+ T.lazycreate = (t, e) => new T({
2106
2139
  shape: t,
2107
2140
  unknownKeys: "strip",
2108
- catchall: U.create(),
2109
- typeName: g.ZodObject,
2141
+ catchall: W.create(),
2142
+ typeName: m.ZodObject,
2110
2143
  ...v(e)
2111
2144
  });
2112
- class xe extends k {
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 F(o.ctx.common.issues));
2123
- return l(r, {
2124
- code: c.invalid_union,
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 d of n) {
2151
- const u = {
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
- }, h = d._parseSync({
2191
+ }, u = c._parseSync({
2159
2192
  data: r.data,
2160
2193
  path: r.path,
2161
- parent: u
2194
+ parent: d
2162
2195
  });
2163
- if (h.status === "valid")
2164
- return h;
2165
- h.status === "dirty" && !a && (a = { result: h, ctx: u }), u.common.issues.length && i.push(u.common.issues);
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((d) => new F(d));
2170
- return l(r, {
2171
- code: c.invalid_union,
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
- xe.create = (t, e) => new xe({
2213
+ Re.create = (t, e) => new Re({
2181
2214
  options: t,
2182
- typeName: g.ZodUnion,
2215
+ typeName: m.ZodUnion,
2183
2216
  ...v(e)
2184
2217
  });
2185
- function Pe(t, e) {
2186
- const r = L(t), n = L(e);
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 === f.object && n === f.object) {
2190
- const s = w.objectKeys(e), a = w.objectKeys(t).filter((o) => s.indexOf(o) !== -1), i = { ...t, ...e };
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 d = Pe(t[o], e[o]);
2193
- if (!d.valid)
2288
+ const c = dt(t[o], e[o]);
2289
+ if (!c.valid)
2194
2290
  return { valid: !1 };
2195
- i[o] = d.data;
2291
+ i[o] = c.data;
2196
2292
  }
2197
2293
  return { valid: !0, data: i };
2198
- } else if (r === f.array && n === f.array) {
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], d = Pe(i, o);
2204
- if (!d.valid)
2299
+ const i = t[a], o = e[a], c = dt(i, o);
2300
+ if (!c.valid)
2205
2301
  return { valid: !1 };
2206
- s.push(d.data);
2302
+ s.push(c.data);
2207
2303
  }
2208
2304
  return { valid: !0, data: s };
2209
- } else return r === f.date && n === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2305
+ } else return r === p.date && n === p.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2210
2306
  }
2211
- class be extends k {
2307
+ class Ae extends _ {
2212
2308
  _parse(e) {
2213
2309
  const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
2214
- if (Ke(a) || Ke(i))
2310
+ if (ot(a) || ot(i))
2215
2311
  return y;
2216
- const o = Pe(a.value, i.value);
2217
- return o.valid ? ((Qe(a) || Qe(i)) && r.dirty(), { status: r.value, value: o.data }) : (l(n, {
2218
- code: c.invalid_intersection_types
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
- be.create = (t, e, r) => new be({
2339
+ Ae.create = (t, e, r) => new Ae({
2244
2340
  left: t,
2245
2341
  right: e,
2246
- typeName: g.ZodIntersection,
2342
+ typeName: m.ZodIntersection,
2247
2343
  ...v(r)
2248
2344
  });
2249
- class Y extends k {
2345
+ class V extends _ {
2250
2346
  _parse(e) {
2251
2347
  const { status: r, ctx: n } = this._processInputParams(e);
2252
- if (n.parsedType !== f.array)
2253
- return l(n, {
2254
- code: c.invalid_type,
2255
- expected: f.array,
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 l(n, {
2260
- code: c.too_small,
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 && (l(n, {
2267
- code: c.too_big,
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 d = this._def.items[o] || this._def.rest;
2275
- return d ? d._parse(new q(n, i, n.path, o)) : null;
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) => R.mergeArray(r, i)) : R.mergeArray(r, a);
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 Y({
2379
+ return new V({
2284
2380
  ...this._def,
2285
2381
  rest: e
2286
2382
  });
2287
2383
  }
2288
2384
  }
2289
- Y.create = (t, e) => {
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 Y({
2388
+ return new V({
2293
2389
  items: t,
2294
- typeName: g.ZodTuple,
2390
+ typeName: m.ZodTuple,
2295
2391
  rest: null,
2296
2392
  ...v(e)
2297
2393
  });
2298
2394
  };
2299
- class dt extends k {
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 !== f.map)
2309
- return l(n, {
2310
- code: c.invalid_type,
2311
- expected: f.map,
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, d], u) => ({
2315
- key: s._parse(new q(n, o, n.path, [u, "key"])),
2316
- value: a._parse(new q(n, d, n.path, [u, "value"]))
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 d of i) {
2322
- const u = await d.key, h = await d.value;
2323
- if (u.status === "aborted" || h.status === "aborted")
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
- (u.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(u.value, h.value);
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 d of i) {
2332
- const u = d.key, h = d.value;
2333
- if (u.status === "aborted" || h.status === "aborted")
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
- (u.status === "dirty" || h.status === "dirty") && r.dirty(), o.set(u.value, h.value);
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
- dt.create = (t, e, r) => new dt({
2478
+ Ke.create = (t, e, r) => new Ke({
2342
2479
  valueType: e,
2343
2480
  keyType: t,
2344
- typeName: g.ZodMap,
2481
+ typeName: m.ZodMap,
2345
2482
  ...v(r)
2346
2483
  });
2347
- class he extends k {
2484
+ class de extends _ {
2348
2485
  _parse(e) {
2349
2486
  const { status: r, ctx: n } = this._processInputParams(e);
2350
- if (n.parsedType !== f.set)
2351
- return l(n, {
2352
- code: c.invalid_type,
2353
- expected: f.set,
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 && (l(n, {
2358
- code: c.too_small,
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 && (l(n, {
2365
- code: c.too_big,
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(d) {
2374
- const u = /* @__PURE__ */ new Set();
2375
- for (const h of d) {
2376
- if (h.status === "aborted")
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
- h.status === "dirty" && r.dirty(), u.add(h.value);
2515
+ u.status === "dirty" && r.dirty(), d.add(u.value);
2379
2516
  }
2380
- return { status: r.value, value: u };
2517
+ return { status: r.value, value: d };
2381
2518
  }
2382
- const o = [...n.data.values()].map((d, u) => a._parse(new q(n, d, n.path, u)));
2383
- return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
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 he({
2523
+ return new de({
2387
2524
  ...this._def,
2388
- minSize: { value: e, message: p.toString(r) }
2525
+ minSize: { value: e, message: h.toString(r) }
2389
2526
  });
2390
2527
  }
2391
2528
  max(e, r) {
2392
- return new he({
2529
+ return new de({
2393
2530
  ...this._def,
2394
- maxSize: { value: e, message: p.toString(r) }
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
- he.create = (t, e) => new he({
2541
+ de.create = (t, e) => new de({
2405
2542
  valueType: t,
2406
2543
  minSize: null,
2407
2544
  maxSize: null,
2408
- typeName: g.ZodSet,
2545
+ typeName: m.ZodSet,
2409
2546
  ...v(e)
2410
2547
  });
2411
- class ct extends k {
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
- ct.create = (t, e) => new ct({
2658
+ Ce.create = (t, e) => new Ce({
2421
2659
  getter: t,
2422
- typeName: g.ZodLazy,
2660
+ typeName: m.ZodLazy,
2423
2661
  ...v(e)
2424
2662
  });
2425
- class ut extends k {
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 l(r, {
2667
+ return f(r, {
2430
2668
  received: r.data,
2431
- code: c.invalid_literal,
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
- ut.create = (t, e) => new ut({
2679
+ Ie.create = (t, e) => new Ie({
2442
2680
  value: t,
2443
- typeName: g.ZodLiteral,
2681
+ typeName: m.ZodLiteral,
2444
2682
  ...v(e)
2445
2683
  });
2446
- function _t(t, e) {
2447
- return new re({
2684
+ function Mt(t, e) {
2685
+ return new X({
2448
2686
  values: t,
2449
- typeName: g.ZodEnum,
2687
+ typeName: m.ZodEnum,
2450
2688
  ...v(e)
2451
2689
  });
2452
2690
  }
2453
- class re extends k {
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 l(r, {
2458
- expected: w.joinValues(n),
2698
+ return f(r, {
2699
+ expected: k.joinValues(n),
2459
2700
  received: r.parsedType,
2460
- code: c.invalid_type
2701
+ code: l.invalid_type
2461
2702
  }), y;
2462
2703
  }
2463
- if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
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 l(r, {
2706
+ return f(r, {
2466
2707
  received: r.data,
2467
- code: c.invalid_enum_value,
2708
+ code: l.invalid_enum_value,
2468
2709
  options: n
2469
2710
  }), y;
2470
2711
  }
2471
- return C(e.data);
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 re.create(e, {
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 re.create(this.options.filter((n) => !e.includes(n)), {
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
- re.create = _t;
2508
- class lt extends k {
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 = w.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2511
- if (n.parsedType !== f.string && n.parsedType !== f.number) {
2512
- const s = w.objectValues(r);
2513
- return l(n, {
2514
- expected: w.joinValues(s),
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: c.invalid_type
2761
+ code: l.invalid_type
2517
2762
  }), y;
2518
2763
  }
2519
- if (this._cache || (this._cache = new Set(w.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2520
- const s = w.objectValues(r);
2521
- return l(n, {
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: c.invalid_enum_value,
2768
+ code: l.invalid_enum_value,
2524
2769
  options: s
2525
2770
  }), y;
2526
2771
  }
2527
- return C(e.data);
2772
+ return A(e.data);
2528
2773
  }
2529
2774
  get enum() {
2530
2775
  return this._def.values;
2531
2776
  }
2532
2777
  }
2533
- lt.create = (t, e) => new lt({
2778
+ xe = /* @__PURE__ */ new WeakMap();
2779
+ je.create = (t, e) => new je({
2534
2780
  values: t,
2535
- typeName: g.ZodNativeEnum,
2781
+ typeName: m.ZodNativeEnum,
2536
2782
  ...v(e)
2537
2783
  });
2538
- class Se extends k {
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 !== f.promise && r.common.async === !1)
2545
- return l(r, {
2546
- code: c.invalid_type,
2547
- expected: f.promise,
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 === f.promise ? r.data : Promise.resolve(r.data);
2551
- return C(n.then((s) => this._def.type.parseAsync(s, {
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
- Se.create = (t, e) => new Se({
2803
+ ve.create = (t, e) => new ve({
2558
2804
  type: t,
2559
- typeName: g.ZodPromise,
2805
+ typeName: m.ZodPromise,
2560
2806
  ...v(e)
2561
2807
  });
2562
- class ne extends k {
2808
+ class $ extends _ {
2563
2809
  innerType() {
2564
2810
  return this._def.schema;
2565
2811
  }
2566
2812
  sourceType() {
2567
- return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
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
- l(n, i), i.fatal ? r.abort() : r.dirty();
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 d = await this._def.schema._parseAsync({
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 d.status === "aborted" ? y : d.status === "dirty" || r.value === "dirty" ? ce(d.value) : d;
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" ? ce(o.value) : o;
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 d = s.refinement(o, a);
2850
+ const c = s.refinement(o, a);
2605
2851
  if (n.common.async)
2606
- return Promise.resolve(d);
2607
- if (d instanceof Promise)
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 (!te(i))
2629
- return y;
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) => te(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({
2636
- status: r.value,
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
- ne.create = (t, e, r) => new ne({
2885
+ $.create = (t, e, r) => new $({
2643
2886
  schema: t,
2644
- typeName: g.ZodEffects,
2887
+ typeName: m.ZodEffects,
2645
2888
  effect: e,
2646
2889
  ...v(r)
2647
2890
  });
2648
- ne.createWithPreprocess = (t, e, r) => new ne({
2891
+ $.createWithPreprocess = (t, e, r) => new $({
2649
2892
  schema: e,
2650
2893
  effect: { type: "preprocess", transform: t },
2651
- typeName: g.ZodEffects,
2894
+ typeName: m.ZodEffects,
2652
2895
  ...v(r)
2653
2896
  });
2654
- class V extends k {
2897
+ class L extends _ {
2655
2898
  _parse(e) {
2656
- return this._getType(e) === f.undefined ? C(void 0) : this._def.innerType._parse(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
- V.create = (t, e) => new V({
2905
+ L.create = (t, e) => new L({
2663
2906
  innerType: t,
2664
- typeName: g.ZodOptional,
2907
+ typeName: m.ZodOptional,
2665
2908
  ...v(e)
2666
2909
  });
2667
- class se extends k {
2910
+ class Q extends _ {
2668
2911
  _parse(e) {
2669
- return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(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
- se.create = (t, e) => new se({
2918
+ Q.create = (t, e) => new Q({
2676
2919
  innerType: t,
2677
- typeName: g.ZodNullable,
2920
+ typeName: m.ZodNullable,
2678
2921
  ...v(e)
2679
2922
  });
2680
- class je extends k {
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 === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
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
- je.create = (t, e) => new je({
2937
+ Ze.create = (t, e) => new Ze({
2695
2938
  innerType: t,
2696
- typeName: g.ZodDefault,
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 k {
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 ke(s) ? s.then((a) => ({
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 F(n.common.issues);
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 F(n.common.issues);
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: g.ZodCatch,
2982
+ typeName: m.ZodCatch,
2740
2983
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2741
2984
  ...v(e)
2742
2985
  });
2743
- class ft extends k {
2986
+ class Ge extends _ {
2744
2987
  _parse(e) {
2745
- if (this._getType(e) !== f.nan) {
2988
+ if (this._getType(e) !== p.nan) {
2746
2989
  const n = this._getOrReturnCtx(e);
2747
- return l(n, {
2748
- code: c.invalid_type,
2749
- expected: f.nan,
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
- ft.create = (t) => new ft({
2757
- typeName: g.ZodNaN,
2999
+ Ge.create = (t) => new Ge({
3000
+ typeName: m.ZodNaN,
2758
3001
  ...v(t)
2759
3002
  });
2760
- class Cr extends k {
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 ze extends k {
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(), ce(a.value)) : this._def.out._parseAsync({
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 ze({
3050
+ return new Me({
2807
3051
  in: e,
2808
3052
  out: r,
2809
- typeName: g.ZodPipeline
3053
+ typeName: m.ZodPipeline
2810
3054
  });
2811
3055
  }
2812
3056
  }
2813
- class Fe extends k {
3057
+ class Fe extends _ {
2814
3058
  _parse(e) {
2815
- const r = this._def.innerType._parse(e), n = (s) => (te(s) && (s.value = Object.freeze(s.value)), s);
2816
- return ke(r) ? r.then((s) => n(s)) : n(r);
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: g.ZodReadonly,
3068
+ typeName: m.ZodReadonly,
2825
3069
  ...v(e)
2826
3070
  });
2827
- var g;
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
- })(g || (g = {}));
2831
- const kt = D.create;
2832
- U.create;
2833
- P.create;
2834
- const wt = O.create;
2835
- xe.create;
2836
- be.create;
2837
- Y.create;
2838
- re.create;
2839
- Se.create;
2840
- V.create;
2841
- se.create;
2842
- const Ze = wt({
2843
- detail: kt()
2844
- }), xt = wt({
2845
- error: kt()
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
- function Ar(t) {
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 = Ze.safeParse(t.cause);
2852
- return e.success ? e.data.detail : Ir(t.message);
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 = Ze.safeParse(t);
3241
+ const e = lt.safeParse(t);
2856
3242
  if (e.success)
2857
3243
  return e.data.detail;
2858
- const r = xt.safeParse(t);
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 Ir(t) {
2869
- const e = Pr(t);
3254
+ function Dn(t) {
3255
+ const e = Vn(t);
2870
3256
  if (!e)
2871
3257
  return t;
2872
- const r = Ze.safeParse(e);
3258
+ const r = lt.safeParse(e);
2873
3259
  if (r.success)
2874
3260
  return r.data.detail;
2875
- const n = xt.safeParse(e);
3261
+ const n = qt.safeParse(e);
2876
3262
  return n.success ? n.data.error : t;
2877
3263
  }
2878
- function Pr(t) {
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
- const jr = "marimo-transport";
2886
- function ue(t) {
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 ie = "notebook.py", oe = "/marimo", M = {
2890
- NOTEBOOK_FILENAME: ie,
2891
- HOME_DIR: oe,
3279
+ const we = "notebook.py", ke = "/marimo", ae = {
3280
+ NOTEBOOK_FILENAME: we,
3281
+ HOME_DIR: ke,
2892
3282
  createHomeDir: (t) => {
2893
- const e = ue(t);
3283
+ const e = Se(t);
2894
3284
  try {
2895
- e.mkdirTree(oe);
3285
+ e.mkdirTree(ke);
2896
3286
  } catch {
2897
3287
  }
2898
- e.chdir(oe);
3288
+ e.chdir(ke);
2899
3289
  },
2900
3290
  mountFS: (t) => {
2901
- ue(t).mount(t.FS.filesystems.IDBFS, { root: "." }, oe);
3291
+ Se(t).mount(t.FS.filesystems.IDBFS, { root: "." }, ke);
2902
3292
  },
2903
3293
  populateFilesToMemory: async (t) => {
2904
- await ht(t, !0);
3294
+ await Et(t, !0);
2905
3295
  },
2906
3296
  persistFilesToRemote: async (t) => {
2907
- await ht(t, !1);
3297
+ await Et(t, !1);
2908
3298
  },
2909
3299
  readNotebook: (t) => {
2910
- const e = ue(t), r = `${oe}/${ie}`;
2911
- return Ae(e.readFile(r));
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 = ue(e), a = (i) => {
3304
+ const { pyodide: e, filename: r, code: n } = t, s = Se(e), a = (i) => {
2915
3305
  try {
2916
- return Ae(s.readFile(i));
3306
+ return at(s.readFile(i));
2917
3307
  } catch {
2918
3308
  return null;
2919
3309
  }
2920
3310
  };
2921
- if (r && r !== ie) {
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(ie, n), {
3319
+ return s.writeFile(we, n), {
2930
3320
  code: n,
2931
- filename: ie
3321
+ filename: we
2932
3322
  };
2933
3323
  }
2934
3324
  };
2935
- function ht(t, e) {
3325
+ function Et(t, e) {
2936
3326
  return new Promise((r, n) => {
2937
- ue(t).syncfs(e, (s) => {
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 $r = Object.defineProperty, _ = (t, e) => $r(t, "name", { value: e, configurable: !0 }), bt = ((t) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(t, { get: (e, r) => (typeof require < "u" ? require : e)[r] }) : t)(function(t) {
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 St(t) {
3340
+ function Wt(t) {
2951
3341
  return !isNaN(parseFloat(t)) && isFinite(t);
2952
3342
  }
2953
- _(St, "_isNumber");
2954
- function z(t) {
3343
+ b(Wt, "_isNumber");
3344
+ function ee(t) {
2955
3345
  return t.charAt(0).toUpperCase() + t.substring(1);
2956
3346
  }
2957
- _(z, "_capitalize");
2958
- function Ee(t) {
3347
+ b(ee, "_capitalize");
3348
+ function tt(t) {
2959
3349
  return function() {
2960
3350
  return this[t];
2961
3351
  };
2962
3352
  }
2963
- _(Ee, "_getter");
2964
- var G = ["isConstructor", "isEval", "isNative", "isToplevel"], K = ["columnNumber", "lineNumber"], Q = ["fileName", "functionName", "source"], Fr = ["args"], Zr = ["evalOrigin"], ye = G.concat(K, Q, Fr, Zr);
2965
- function N(t) {
2966
- if (t) for (var e = 0; e < ye.length; e++) t[ye[e]] !== void 0 && this["set" + z(ye[e])](t[ye[e]]);
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
- _(N, "StackFrame");
2969
- N.prototype = { getArgs: function() {
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 N) this.evalOrigin = t;
2978
- else if (t instanceof Object) this.evalOrigin = new N(t);
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
- N.fromString = _(function(t) {
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], d = i[2], u = i[3];
2987
- return new N({ functionName: n, args: s || void 0, fileName: o, lineNumber: d || void 0, columnNumber: u || void 0 });
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 (B = 0; B < G.length; B++) N.prototype["get" + z(G[B])] = Ee(G[B]), N.prototype["set" + z(G[B])] = /* @__PURE__ */ function(t) {
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
- }(G[B]);
2994
- var B;
2995
- for (W = 0; W < K.length; W++) N.prototype["get" + z(K[W])] = Ee(K[W]), N.prototype["set" + z(K[W])] = /* @__PURE__ */ function(t) {
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 (!St(e)) throw new TypeError(t + " must be a Number");
3387
+ if (!Wt(e)) throw new TypeError(t + " must be a Number");
2998
3388
  this[t] = Number(e);
2999
3389
  };
3000
- }(K[W]);
3001
- var W;
3002
- for (J = 0; J < Q.length; J++) N.prototype["get" + z(Q[J])] = Ee(Q[J]), N.prototype["set" + z(Q[J])] = /* @__PURE__ */ function(t) {
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
- }(Q[J]);
3007
- var J, Re = N;
3008
- function Ot() {
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: _(function(r) {
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: _(function(r) {
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: _(function(r) {
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), d = i && a || void 0, u = ["eval", "<anonymous>"].indexOf(o[0]) > -1 ? void 0 : o[0];
3028
- return new Re({ functionName: d, fileName: u, lineNumber: o[1], columnNumber: o[2], source: s });
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: _(function(r) {
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 Re({ functionName: s });
3037
- var a = /((.*".+"[^@]*)?[^@]*)(?:@)/, i = s.match(a), o = i && i[1] ? i[1] : void 0, d = this.extractLocation(s.replace(a, ""));
3038
- return new Re({ functionName: o, fileName: d[0], lineNumber: d[1], columnNumber: d[2], source: s });
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
- _(Ot, "ErrorStackParser");
3043
- var Lr = new Ot(), Mr = Lr, j = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && !process.browser, Et = j && typeof Ue < "u" && typeof Ue.exports < "u" && typeof bt < "u" && typeof __dirname < "u", Dr = j && !Et, Vr = typeof Deno < "u", Tt = !j && !Vr, qr = Tt && typeof window == "object" && typeof document == "object" && typeof document.createElement == "function" && "sessionStorage" in window && typeof importScripts != "function", Ur = Tt && typeof importScripts == "function" && typeof self == "object";
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 Nt, Le, Rt, pt, He;
3046
- async function Be() {
3047
- if (!j || (Nt = (await import("./__vite-browser-external-CPvbk0mb.js")).default, pt = await import("./__vite-browser-external-CPvbk0mb.js"), He = await import("./__vite-browser-external-CPvbk0mb.js"), Rt = (await import("./__vite-browser-external-CPvbk0mb.js")).default, Le = await import("./__vite-browser-external-CPvbk0mb.js"), We = Le.sep, typeof bt < "u")) return;
3048
- let t = pt, e = await import("./__vite-browser-external-CPvbk0mb.js"), r = await import("./__vite-browser-external-CPvbk0mb.js"), n = await import("./__vite-browser-external-CPvbk0mb.js"), s = { fs: t, crypto: e, ws: r, child_process: n };
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
- _(Be, "initNodeModules");
3054
- function Ct(t, e) {
3055
- return Le.resolve(e || ".", t);
3443
+ b(vt, "initNodeModules");
3444
+ function Qt(t, e) {
3445
+ return ut.resolve(e || ".", t);
3056
3446
  }
3057
- _(Ct, "node_resolvePath");
3058
- function At(t, e) {
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
- _(At, "browser_resolvePath");
3062
- var Me;
3063
- j ? Me = Ct : Me = At;
3064
- var We;
3065
- j || (We = "/");
3066
- function It(t, e) {
3067
- return t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? { response: fetch(t) } : { binary: He.readFile(t).then((r) => new Uint8Array(r.buffer, r.byteOffset, r.byteLength)) };
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
- _(It, "node_getBinaryResponse");
3070
- function Pt(t, e) {
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
- _(Pt, "browser_getBinaryResponse");
3075
- var Oe;
3076
- j ? Oe = It : Oe = Pt;
3077
- async function jt(t, e) {
3078
- let { response: r, binary: n } = Oe(t, e);
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
- _(jt, "loadBinaryFile");
3085
- var ge;
3086
- if (qr) ge = _(async (t) => await import(t), "loadScript");
3087
- else if (Ur) ge = _(async (t) => {
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 (j) ge = $t;
3485
+ else if (z) ze = sr;
3096
3486
  else throw new Error("Cannot determine runtime environment");
3097
- async function $t(t) {
3098
- t.startsWith("file://") && (t = t.slice(7)), t.includes("://") ? Rt.runInThisContext(await (await fetch(t)).text()) : await import(Nt.pathToFileURL(t).href);
3099
- }
3100
- _($t, "nodeLoadScript");
3101
- async function Ft(t) {
3102
- if (j) {
3103
- await Be();
3104
- let e = await He.readFile(t, { encoding: "utf8" });
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
- _(Ft, "loadLockFile");
3109
- async function Zt() {
3110
- if (Et) return __dirname;
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 = Mr.parse(t)[0].fileName;
3118
- if (j && !e.startsWith("file://") && (e = `file://${e}`), Dr) {
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(We);
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
- _(Zt, "calculateDirname");
3127
- function Lt(t) {
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 d = s.getLocalSet(a), u = await s.getRemoteSet(a), h = i ? u : d, b = i ? d : u;
3134
- await s.reconcile(a, h, b), o(null);
3135
- } catch (d) {
3136
- o(d);
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(h) {
3141
- return h !== "." && h !== "..";
3530
+ function o(u) {
3531
+ return u !== "." && u !== "..";
3142
3532
  }
3143
- _(o, "isRealDir");
3144
- function d(h) {
3145
- return (b) => n.join2(h, b);
3533
+ b(o, "isRealDir");
3534
+ function c(u) {
3535
+ return (w) => n.join2(u, w);
3146
3536
  }
3147
- _(d, "toAbsolute");
3148
- let u = e.readdir(a.mountpoint).filter(o).map(d(a.mountpoint));
3149
- for (; u.length; ) {
3150
- let h = u.pop(), b = e.stat(h);
3151
- e.isDir(b.mode) && u.push.apply(u, e.readdir(h).filter(o).map(d(h))), i[h] = { timestamp: b.mtime, mode: b.mode };
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 zr(a.opts.fileSystemHandle);
3156
- for (let [d, u] of o) d !== "." && (i[n.join2(a.mountpoint, d)] = { timestamp: u.kind === "file" ? new Date((await u.getFile()).lastModified) : /* @__PURE__ */ new Date(), mode: u.kind === "file" ? s.FILE_MODE : s.DIR_MODE });
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 d = a.get(n.dirname(i)), u = e.isFile(o.mode) ? await d.getFileHandle(n.basename(i), { create: !0 }) : await d.getDirectoryHandle(n.basename(i), { create: !0 });
3181
- if (u.kind === "file") {
3182
- let h = await u.createWritable();
3183
- await h.write(o.contents), await h.close();
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, u);
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 d = 0, u = [];
3190
- Object.keys(i.entries).forEach(function(S) {
3191
- let A = i.entries[S], $ = o.entries[S];
3192
- (!$ || e.isFile(A.mode) && A.timestamp.getTime() > $.timestamp.getTime()) && (u.push(S), d++);
3193
- }), u.sort();
3194
- let h = [];
3195
- if (Object.keys(o.entries).forEach(function(S) {
3196
- i.entries[S] || (h.push(S), d++);
3197
- }), h.sort().reverse(), !d) return;
3198
- let b = i.type === "remote" ? i.handles : o.handles;
3199
- for (let S of u) {
3200
- let A = n.normalize(S.replace(a.mountpoint, "/")).substring(1);
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 $ = b.get(A), pe = await s.loadRemoteEntry($);
3203
- s.storeLocalEntry(S, pe);
3592
+ let q = w.get(P), Le = await s.loadRemoteEntry(q);
3593
+ s.storeLocalEntry(x, Le);
3204
3594
  } else {
3205
- let $ = s.loadLocalEntry(S);
3206
- await s.storeRemoteEntry(b, A, $);
3595
+ let q = s.loadLocalEntry(x);
3596
+ await s.storeRemoteEntry(w, P, q);
3207
3597
  }
3208
3598
  }
3209
- for (let S of h) if (o.type === "local") s.removeLocalEntry(S);
3599
+ for (let x of u) if (o.type === "local") s.removeLocalEntry(x);
3210
3600
  else {
3211
- let A = n.normalize(S.replace(a.mountpoint, "/")).substring(1);
3212
- await s.removeRemoteEntry(b, A);
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
- _(Lt, "initializeNativeFS");
3218
- var zr = _(async (t) => {
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
- _(r, "collect"), await r(t);
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 Mt(t) {
3233
- let e = { noImageDecoding: !0, noAudioDecoding: !0, noWasmDecoding: !1, preRun: zt(t), quit(r, n) {
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: Ht(t.indexURL) };
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
- _(Mt, "createSettings");
3239
- function Dt(t) {
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
- _(Dt, "createHomeDirectory");
3251
- function Vt(t) {
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
- _(Vt, "setEnvironment");
3257
- function qt(t) {
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
- _(qt, "callFsInitHook");
3268
- function Ut(t) {
3269
- let e = jt(t);
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
- _(Ut, "installStdlib");
3284
- function zt(t) {
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", [...qt(t.fsInit), Ut(e), Dt(t.env.HOME), Vt(t.env), Lt];
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
- _(zt, "getFileSystemInitializationFuncs");
3289
- function Ht(t) {
3678
+ b(pr, "getFileSystemInitializationFuncs");
3679
+ function hr(t) {
3290
3680
  if (typeof WasmOffsetConverter < "u") return;
3291
- let { binary: e, response: r } = Oe(t + "pyodide.asm.wasm");
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
- _(Ht, "getInstantiateWasmFunc");
3306
- var De = "0.27.7";
3307
- async function Ve(t = {}) {
3695
+ b(hr, "getInstantiateWasmFunc");
3696
+ var pt = "0.27.5";
3697
+ async function ht(t = {}) {
3308
3698
  var e, r;
3309
- await Be();
3310
- let n = t.indexURL || await Zt();
3311
- n = Me(n), n.endsWith("/") || (n += "/"), t.indexURL = n;
3312
- let s = { fullStdLib: !1, jsglobals: globalThis, stdin: globalThis.prompt ? globalThis.prompt : void 0, lockFileURL: n + "pyodide-lock.json", args: [], env: {}, packageCacheDir: n, packages: [], enableRunUntilComplete: !0, checkAPIVersion: !0, BUILD_ID: "e94377f5ce7dcf67e0417b69a0016733c2cfb6b4622ee8c490a6f17eb58e863b" }, a = Object.assign(s, t);
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 = Mt(a), o = i.API;
3315
- if (o.lockFilePromise = Ft(a.lockFileURL), typeof _createPyodideModule != "function") {
3316
- let S = `${a.indexURL}pyodide.asm.js`;
3317
- await ge(S);
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 d;
3709
+ let c;
3320
3710
  if (t._loadSnapshot) {
3321
- let S = await t._loadSnapshot;
3322
- ArrayBuffer.isView(S) ? d = S : d = new Uint8Array(S), i.noInitialRun = !0, i.INITIAL_MEMORY = d.length;
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 u = await _createPyodideModule(i);
3714
+ let d = await _createPyodideModule(i);
3325
3715
  if (i.exited) throw i.exited.toThrow;
3326
- if (t.pyproxyToStringRepr && o.setPyProxyToStringMethod(!0), o.version !== De && a.checkAPIVersion) throw new Error(`Pyodide version does not match: '${De}' <==> '${o.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);
3327
- u.locateFile = (S) => {
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 h;
3331
- d && (h = o.restoreSnapshot(d));
3332
- let b = o.finalizeBootstrap(h, t._snapshotDeserializer);
3333
- return o.sys.path.insert(0, ""), b.version.includes("dev") || o.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${b.version}/full/`), o._pyodide.set_excepthook(), await o.packageIndexReady, o.initializeStreams(a.stdin, a.stdout, a.stderr), b;
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
- class Br {
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 ee = new Br();
3381
- globalThis.t = ee;
3382
- const Wr = !1;
3383
- class Jr {
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 Hr(this.pyodide, "Pyodide not loaded"), this.pyodide;
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 (!Ve)
3778
+ if (!ht)
3393
3779
  throw new Error("loadPyodide is not defined");
3394
- const r = ee.startSpan("loadPyodide");
3780
+ const r = R.startSpan("loadPyodide");
3395
3781
  try {
3396
- const n = await Ve({
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: Wr,
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 de.error("Failed to load Pyodide", n), n;
3801
+ throw Y.error("Failed to load Pyodide", n), n;
3416
3802
  }
3417
3803
  }
3418
3804
  async mountFilesystem(e) {
3419
- const r = ee.startSpan("mountFilesystem");
3420
- return M.createHomeDir(this.requirePyodide), M.mountFS(this.requirePyodide), await M.populateFilesToMemory(this.requirePyodide), r.end("ok"), M.initNotebookCode({
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 = ee.startSpan("startSession.runPython"), d = n || M.NOTEBOOK_FILENAME, [u, h, b] = this.requirePyodide.runPython(
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="${d}",
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("${d}", "r") as f:
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 S = new Set(b.toJs());
3460
- return this.loadNotebookDeps(r, S).then(() => h(i.runtime.auto_instantiate)), u;
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 = ee.startSpan("pyodide.loadPackage");
3860
+ let a = R.startSpan("pyodide.loadPackage");
3475
3861
  await n.loadPackagesFromImports(e, {
3476
- errorCallback: de.error,
3477
- messageCallback: de.log
3478
- }), a.end(), a = ee.startSpan("micropip.install");
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
- de.error("Failed to load packages from micropip", o);
3877
+ Y.error("Failed to load packages from micropip", o);
3492
3878
  }), a.end();
3493
3879
  }
3494
3880
  }
3495
- async function Yr(t) {
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 Jr();
3888
+ return new ts();
3503
3889
  }
3504
3890
  }
3505
- const Xr = !1;
3506
- function Gr(t) {
3507
- return t.includes("dev") && Xr ? "dev" : `v${De}`;
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
- async function Kr() {
3911
+ const Nt = R.startSpan("worker:init");
3912
+ async function is() {
3510
3913
  try {
3511
- const t = en(), e = Gr(t), r = await Yr(t);
3512
- self.controller = r, self.pyodide = await r.bootstrap({
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
- }), await r.mountFilesystem?.({
3516
- code: "",
3517
- filename: null
3518
- }), qe.send.initialized({});
3920
+ });
3519
3921
  } catch (t) {
3520
- de.error("Error bootstrapping", t), qe.send.initializedError({ error: Ar(t) });
3922
+ Y.error("Error bootstrapping", t), H.send.initializedError({
3923
+ error: Ut(t)
3924
+ });
3521
3925
  }
3522
3926
  }
3523
- const Ce = Kr(), Qr = {
3524
- readFile: async (t) => (await Ce, Ae(self.pyodide.FS.readFile(t))),
3525
- readNotebook: async () => (await Ce, M.readNotebook(self.pyodide)),
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 Ce, await self.pyodide.runPython(`
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), M.NOTEBOOK_FILENAME), await M.persistFilesToRemote(self.pyodide);
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
- }, qe = Qt({
3534
- transport: nr({
3535
- transportId: jr
4093
+ }, H = xr({
4094
+ transport: Or({
4095
+ transportId: zn
3536
4096
  }),
3537
- requestHandler: Qr
4097
+ requestHandler: os
3538
4098
  });
3539
- qe.send("ready", {});
3540
- function en() {
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 tn();
4117
+ export default ls();