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