@abduljebar/text-editor 1.1.3 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts.map +1 -1
- package/dist/components/TextEditor.d.ts.map +1 -1
- package/dist/components/Toolbar.d.ts +2 -0
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1261 -1529
- package/dist/index.umd.cjs +42 -58
- package/dist/store/editor.store.d.ts +1 -0
- package/dist/store/editor.store.d.ts.map +1 -1
- package/package.json +81 -81
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Save as
|
|
3
|
-
var
|
|
1
|
+
import Ft, { useState as ae, useEffect as Ee, useRef as Mt, useCallback as P } from "react";
|
|
2
|
+
import { Save as Vt, FileDown as Wt, Trash2 as Bt, Bold as qt, Italic as Yt, Underline as Jt, Strikethrough as Gt, List as Ht, ListOrdered as Xt, Heading1 as Kt, Heading2 as Qt, Type as en, AlignLeft as tn, AlignCenter as nn, AlignRight as rn, Link as on } from "lucide-react";
|
|
3
|
+
var ne = { exports: {} }, G = {};
|
|
4
4
|
/**
|
|
5
5
|
* @license React
|
|
6
6
|
* react-jsx-runtime.production.js
|
|
@@ -10,29 +10,29 @@ var oe = { exports: {} }, X = {};
|
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
|
|
13
|
+
var Fe;
|
|
14
|
+
function cn() {
|
|
15
|
+
if (Fe) return G;
|
|
16
|
+
Fe = 1;
|
|
17
17
|
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
18
18
|
function n(r, o, i) {
|
|
19
|
-
var
|
|
20
|
-
if (i !== void 0 && (
|
|
19
|
+
var c = null;
|
|
20
|
+
if (i !== void 0 && (c = "" + i), o.key !== void 0 && (c = "" + o.key), "key" in o) {
|
|
21
21
|
i = {};
|
|
22
|
-
for (var
|
|
23
|
-
|
|
22
|
+
for (var s in o)
|
|
23
|
+
s !== "key" && (i[s] = o[s]);
|
|
24
24
|
} else i = o;
|
|
25
25
|
return o = i.ref, {
|
|
26
26
|
$$typeof: e,
|
|
27
27
|
type: r,
|
|
28
|
-
key:
|
|
28
|
+
key: c,
|
|
29
29
|
ref: o !== void 0 ? o : null,
|
|
30
30
|
props: i
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return G.Fragment = t, G.jsx = n, G.jsxs = n, G;
|
|
34
34
|
}
|
|
35
|
-
var
|
|
35
|
+
var H = {};
|
|
36
36
|
/**
|
|
37
37
|
* @license React
|
|
38
38
|
* react-jsx-runtime.development.js
|
|
@@ -42,47 +42,47 @@ var K = {};
|
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
44
|
*/
|
|
45
|
-
var
|
|
46
|
-
function
|
|
47
|
-
return
|
|
45
|
+
var Me;
|
|
46
|
+
function sn() {
|
|
47
|
+
return Me || (Me = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
48
|
function e(u) {
|
|
49
49
|
if (u == null) return null;
|
|
50
50
|
if (typeof u == "function")
|
|
51
|
-
return u.$$typeof ===
|
|
51
|
+
return u.$$typeof === Dt ? null : u.displayName || u.name || null;
|
|
52
52
|
if (typeof u == "string") return u;
|
|
53
53
|
switch (u) {
|
|
54
|
-
case
|
|
54
|
+
case j:
|
|
55
55
|
return "Fragment";
|
|
56
|
-
case
|
|
56
|
+
case C:
|
|
57
57
|
return "Profiler";
|
|
58
|
-
case
|
|
58
|
+
case U:
|
|
59
59
|
return "StrictMode";
|
|
60
|
-
case
|
|
60
|
+
case $:
|
|
61
61
|
return "Suspense";
|
|
62
|
-
case
|
|
62
|
+
case F:
|
|
63
63
|
return "SuspenseList";
|
|
64
|
-
case
|
|
64
|
+
case Nt:
|
|
65
65
|
return "Activity";
|
|
66
66
|
}
|
|
67
67
|
if (typeof u == "object")
|
|
68
68
|
switch (typeof u.tag == "number" && console.error(
|
|
69
69
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
70
|
), u.$$typeof) {
|
|
71
|
-
case
|
|
71
|
+
case R:
|
|
72
72
|
return "Portal";
|
|
73
|
-
case
|
|
73
|
+
case A:
|
|
74
74
|
return u.displayName || "Context";
|
|
75
|
-
case
|
|
75
|
+
case S:
|
|
76
76
|
return (u._context.displayName || "Context") + ".Consumer";
|
|
77
|
-
case
|
|
78
|
-
var
|
|
79
|
-
return u = u.displayName, u || (u =
|
|
80
|
-
case
|
|
81
|
-
return
|
|
82
|
-
case
|
|
83
|
-
|
|
77
|
+
case N:
|
|
78
|
+
var g = u.render;
|
|
79
|
+
return u = u.displayName, u || (u = g.displayName || g.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
|
|
80
|
+
case ee:
|
|
81
|
+
return g = u.displayName || null, g !== null ? g : e(u.type) || "Memo";
|
|
82
|
+
case D:
|
|
83
|
+
g = u._payload, u = u._init;
|
|
84
84
|
try {
|
|
85
|
-
return e(u(
|
|
85
|
+
return e(u(g));
|
|
86
86
|
} catch {
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -94,74 +94,74 @@ function fn() {
|
|
|
94
94
|
function n(u) {
|
|
95
95
|
try {
|
|
96
96
|
t(u);
|
|
97
|
-
var
|
|
97
|
+
var g = !1;
|
|
98
98
|
} catch {
|
|
99
|
-
|
|
99
|
+
g = !0;
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
var
|
|
104
|
-
return
|
|
105
|
-
|
|
101
|
+
if (g) {
|
|
102
|
+
g = console;
|
|
103
|
+
var y = g.error, x = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
|
|
104
|
+
return y.call(
|
|
105
|
+
g,
|
|
106
106
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
-
|
|
107
|
+
x
|
|
108
108
|
), t(u);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function r(u) {
|
|
112
|
-
if (u ===
|
|
113
|
-
if (typeof u == "object" && u !== null && u.$$typeof ===
|
|
112
|
+
if (u === j) return "<>";
|
|
113
|
+
if (typeof u == "object" && u !== null && u.$$typeof === D)
|
|
114
114
|
return "<...>";
|
|
115
115
|
try {
|
|
116
|
-
var
|
|
117
|
-
return
|
|
116
|
+
var g = e(u);
|
|
117
|
+
return g ? "<" + g + ">" : "<...>";
|
|
118
118
|
} catch {
|
|
119
119
|
return "<...>";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
function o() {
|
|
123
|
-
var u =
|
|
123
|
+
var u = _e.A;
|
|
124
124
|
return u === null ? null : u.getOwner();
|
|
125
125
|
}
|
|
126
126
|
function i() {
|
|
127
127
|
return Error("react-stack-top-frame");
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
var
|
|
132
|
-
if (
|
|
129
|
+
function c(u) {
|
|
130
|
+
if (Re.call(u, "key")) {
|
|
131
|
+
var g = Object.getOwnPropertyDescriptor(u, "key").get;
|
|
132
|
+
if (g && g.isReactWarning) return !1;
|
|
133
133
|
}
|
|
134
134
|
return u.key !== void 0;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
function
|
|
138
|
-
|
|
136
|
+
function s(u, g) {
|
|
137
|
+
function y() {
|
|
138
|
+
Pe || (Pe = !0, console.error(
|
|
139
139
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
|
-
|
|
140
|
+
g
|
|
141
141
|
));
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
get:
|
|
143
|
+
y.isReactWarning = !0, Object.defineProperty(u, "key", {
|
|
144
|
+
get: y,
|
|
145
145
|
configurable: !0
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function f() {
|
|
149
149
|
var u = e(this.type);
|
|
150
|
-
return
|
|
150
|
+
return Ne[u] || (Ne[u] = !0, console.error(
|
|
151
151
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
152
|
)), u = this.props.ref, u !== void 0 ? u : null;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
var
|
|
154
|
+
function d(u, g, y, x, te, ve) {
|
|
155
|
+
var T = y.ref;
|
|
156
156
|
return u = {
|
|
157
|
-
$$typeof:
|
|
157
|
+
$$typeof: b,
|
|
158
158
|
type: u,
|
|
159
|
-
key:
|
|
160
|
-
props:
|
|
161
|
-
_owner:
|
|
162
|
-
}, (
|
|
159
|
+
key: g,
|
|
160
|
+
props: y,
|
|
161
|
+
_owner: x
|
|
162
|
+
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(u, "ref", {
|
|
163
163
|
enumerable: !1,
|
|
164
|
-
get:
|
|
164
|
+
get: f
|
|
165
165
|
}) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
@@ -176,315 +176,362 @@ function fn() {
|
|
|
176
176
|
configurable: !1,
|
|
177
177
|
enumerable: !1,
|
|
178
178
|
writable: !0,
|
|
179
|
-
value:
|
|
179
|
+
value: te
|
|
180
180
|
}), Object.defineProperty(u, "_debugTask", {
|
|
181
181
|
configurable: !1,
|
|
182
182
|
enumerable: !1,
|
|
183
183
|
writable: !0,
|
|
184
|
-
value:
|
|
184
|
+
value: ve
|
|
185
185
|
}), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
for (
|
|
193
|
-
|
|
194
|
-
Object.freeze && Object.freeze(
|
|
187
|
+
function h(u, g, y, x, te, ve) {
|
|
188
|
+
var T = g.children;
|
|
189
|
+
if (T !== void 0)
|
|
190
|
+
if (x)
|
|
191
|
+
if (Ut(T)) {
|
|
192
|
+
for (x = 0; x < T.length; x++)
|
|
193
|
+
v(T[x]);
|
|
194
|
+
Object.freeze && Object.freeze(T);
|
|
195
195
|
} else
|
|
196
196
|
console.error(
|
|
197
197
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
198
|
);
|
|
199
|
-
else
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
var
|
|
203
|
-
return
|
|
199
|
+
else v(T);
|
|
200
|
+
if (Re.call(g, "key")) {
|
|
201
|
+
T = e(u);
|
|
202
|
+
var q = Object.keys(g).filter(function(Lt) {
|
|
203
|
+
return Lt !== "key";
|
|
204
204
|
});
|
|
205
|
-
|
|
205
|
+
x = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", Le[T + x] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
206
|
`A props object containing a "key" prop is being spread into JSX:
|
|
207
207
|
let props = %s;
|
|
208
208
|
<%s {...props} />
|
|
209
209
|
React keys must be passed directly to JSX without using spread:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s key={someKey} {...props} />`,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
),
|
|
212
|
+
x,
|
|
213
|
+
T,
|
|
214
|
+
q,
|
|
215
|
+
T
|
|
216
|
+
), Le[T + x] = !0);
|
|
217
217
|
}
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
for (var
|
|
221
|
-
|
|
222
|
-
} else
|
|
223
|
-
return
|
|
224
|
-
|
|
218
|
+
if (T = null, y !== void 0 && (n(y), T = "" + y), c(g) && (n(g.key), T = "" + g.key), "key" in g) {
|
|
219
|
+
y = {};
|
|
220
|
+
for (var be in g)
|
|
221
|
+
be !== "key" && (y[be] = g[be]);
|
|
222
|
+
} else y = g;
|
|
223
|
+
return T && s(
|
|
224
|
+
y,
|
|
225
225
|
typeof u == "function" ? u.displayName || u.name || "Unknown" : u
|
|
226
|
-
),
|
|
226
|
+
), d(
|
|
227
227
|
u,
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
T,
|
|
229
|
+
y,
|
|
230
230
|
o(),
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
te,
|
|
232
|
+
ve
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
|
|
235
|
+
function v(u) {
|
|
236
|
+
_(u) ? u._store && (u._store.validated = 1) : typeof u == "object" && u !== null && u.$$typeof === D && (u._payload.status === "fulfilled" ? _(u._payload.value) && u._payload.value._store && (u._payload.value._store.validated = 1) : u._store && (u._store.validated = 1));
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
return typeof u == "object" && u !== null && u.$$typeof ===
|
|
238
|
+
function _(u) {
|
|
239
|
+
return typeof u == "object" && u !== null && u.$$typeof === b;
|
|
240
240
|
}
|
|
241
|
-
var
|
|
241
|
+
var l = Ft, b = Symbol.for("react.transitional.element"), R = Symbol.for("react.portal"), j = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), A = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), ee = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), Nt = Symbol.for("react.activity"), Dt = Symbol.for("react.client.reference"), _e = l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Re = Object.prototype.hasOwnProperty, Ut = Array.isArray, ge = console.createTask ? console.createTask : function() {
|
|
242
242
|
return null;
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
l = {
|
|
245
245
|
react_stack_bottom_frame: function(u) {
|
|
246
246
|
return u();
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
var
|
|
250
|
-
|
|
249
|
+
var Pe, Ne = {}, De = l.react_stack_bottom_frame.bind(
|
|
250
|
+
l,
|
|
251
251
|
i
|
|
252
|
-
)(),
|
|
253
|
-
|
|
254
|
-
var
|
|
255
|
-
return
|
|
252
|
+
)(), Ue = ge(r(i)), Le = {};
|
|
253
|
+
H.Fragment = j, H.jsx = function(u, g, y) {
|
|
254
|
+
var x = 1e4 > _e.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return h(
|
|
256
256
|
u,
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
g,
|
|
258
|
+
y,
|
|
259
259
|
!1,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
x ? Error("react-stack-top-frame") : De,
|
|
261
|
+
x ? ge(r(u)) : Ue
|
|
262
262
|
);
|
|
263
|
-
},
|
|
264
|
-
var
|
|
265
|
-
return
|
|
263
|
+
}, H.jsxs = function(u, g, y) {
|
|
264
|
+
var x = 1e4 > _e.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return h(
|
|
266
266
|
u,
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
g,
|
|
268
|
+
y,
|
|
269
269
|
!0,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
x ? Error("react-stack-top-frame") : De,
|
|
271
|
+
x ? ge(r(u)) : Ue
|
|
272
272
|
);
|
|
273
273
|
};
|
|
274
|
-
})()),
|
|
275
|
-
}
|
|
276
|
-
var Ye;
|
|
277
|
-
function hn() {
|
|
278
|
-
return Ye || (Ye = 1, process.env.NODE_ENV === "production" ? oe.exports = dn() : oe.exports = fn()), oe.exports;
|
|
279
|
-
}
|
|
280
|
-
var _ = hn();
|
|
281
|
-
const He = (e) => {
|
|
282
|
-
let t;
|
|
283
|
-
const n = /* @__PURE__ */ new Set(), r = (l, f) => {
|
|
284
|
-
const h = typeof l == "function" ? l(t) : l;
|
|
285
|
-
if (!Object.is(h, t)) {
|
|
286
|
-
const p = t;
|
|
287
|
-
t = f ?? (typeof h != "object" || h === null) ? h : Object.assign({}, t, h), n.forEach((g) => g(t, p));
|
|
288
|
-
}
|
|
289
|
-
}, o = () => t, c = { setState: r, getState: o, getInitialState: () => d, subscribe: (l) => (n.add(l), () => n.delete(l)) }, d = t = e(r, o, c);
|
|
290
|
-
return c;
|
|
291
|
-
}, mn = ((e) => e ? He(e) : He), pn = (e) => e;
|
|
292
|
-
function gn(e, t = pn) {
|
|
293
|
-
const n = Q.useSyncExternalStore(
|
|
294
|
-
e.subscribe,
|
|
295
|
-
Q.useCallback(() => t(e.getState()), [e, t]),
|
|
296
|
-
Q.useCallback(() => t(e.getInitialState()), [e, t])
|
|
297
|
-
);
|
|
298
|
-
return Q.useDebugValue(n), n;
|
|
274
|
+
})()), H;
|
|
299
275
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return
|
|
303
|
-
}, vn = ((e) => _n);
|
|
304
|
-
function bn(e, t) {
|
|
305
|
-
let n;
|
|
306
|
-
try {
|
|
307
|
-
n = e();
|
|
308
|
-
} catch {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
getItem: (o) => {
|
|
313
|
-
var i;
|
|
314
|
-
const s = (d) => d === null ? null : JSON.parse(d, void 0), c = (i = n.getItem(o)) != null ? i : null;
|
|
315
|
-
return c instanceof Promise ? c.then(s) : s(c);
|
|
316
|
-
},
|
|
317
|
-
setItem: (o, i) => n.setItem(o, JSON.stringify(i, void 0)),
|
|
318
|
-
removeItem: (o) => n.removeItem(o)
|
|
319
|
-
};
|
|
276
|
+
var Ve;
|
|
277
|
+
function an() {
|
|
278
|
+
return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? ne.exports = cn() : ne.exports = sn()), ne.exports;
|
|
320
279
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
280
|
+
var p = an();
|
|
281
|
+
const un = ({
|
|
282
|
+
onCommand: e,
|
|
283
|
+
onSave: t,
|
|
284
|
+
onExport: n,
|
|
285
|
+
onClear: r,
|
|
286
|
+
showButtons: o = !1,
|
|
287
|
+
hasUnsavedChanges: i
|
|
288
|
+
}) => {
|
|
289
|
+
const [c, s] = ae([]), [f, d] = ae("p"), h = () => {
|
|
290
|
+
const l = [];
|
|
291
|
+
let b = "p";
|
|
292
|
+
document.queryCommandState("bold") && l.push("bold"), document.queryCommandState("italic") && l.push("italic"), document.queryCommandState("underline") && l.push("underline"), document.queryCommandState("strikeThrough") && l.push("strikeThrough"), document.queryCommandState("insertUnorderedList") && l.push("insertUnorderedList"), document.queryCommandState("insertOrderedList") && l.push("insertOrderedList"), document.queryCommandState("justifyLeft") && l.push("justifyLeft"), document.queryCommandState("justifyCenter") && l.push("justifyCenter"), document.queryCommandState("justifyRight") && l.push("justifyRight");
|
|
293
|
+
const R = window.getSelection();
|
|
294
|
+
if (R && R.rangeCount > 0) {
|
|
295
|
+
let j = R.getRangeAt(0).commonAncestorContainer;
|
|
296
|
+
for (; j && j.nodeType === Node.ELEMENT_NODE; ) {
|
|
297
|
+
const U = j, C = U.tagName.toLowerCase();
|
|
298
|
+
if (["h1", "h2", "p", "div"].includes(C)) {
|
|
299
|
+
C === "h1" || C === "h2" ? (b = C, l.push(`formatBlock:${C}`)) : (C === "p" || C === "div" && !b) && (b = "p");
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
j = U.parentNode;
|
|
330
303
|
}
|
|
304
|
+
}
|
|
305
|
+
d(b), s(l);
|
|
306
|
+
};
|
|
307
|
+
Ee(() => {
|
|
308
|
+
const l = () => {
|
|
309
|
+
h();
|
|
310
|
+
}, b = () => {
|
|
311
|
+
setTimeout(h, 10);
|
|
331
312
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
then(r) {
|
|
335
|
-
return this;
|
|
336
|
-
},
|
|
337
|
-
catch(r) {
|
|
338
|
-
return Ze(r)(n);
|
|
339
|
-
}
|
|
313
|
+
return document.addEventListener("selectionchange", l), document.addEventListener("click", b), document.addEventListener("keyup", b), () => {
|
|
314
|
+
document.removeEventListener("selectionchange", l), document.removeEventListener("click", b), document.removeEventListener("keyup", b);
|
|
340
315
|
};
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
if (i.migrate) {
|
|
392
|
-
const $ = i.migrate(
|
|
393
|
-
k.state,
|
|
394
|
-
k.version
|
|
395
|
-
);
|
|
396
|
-
return $ instanceof Promise ? $.then((z) => [!0, z]) : [!0, $];
|
|
397
|
-
}
|
|
398
|
-
console.error(
|
|
399
|
-
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
400
|
-
);
|
|
401
|
-
} else
|
|
402
|
-
return [!1, k.state];
|
|
403
|
-
return [!1, void 0];
|
|
404
|
-
}).then((k) => {
|
|
405
|
-
var $;
|
|
406
|
-
const [z, P] = k;
|
|
407
|
-
if (g = i.merge(
|
|
408
|
-
P,
|
|
409
|
-
($ = r()) != null ? $ : p
|
|
410
|
-
), n(g, !0), z)
|
|
411
|
-
return f();
|
|
412
|
-
}).then(() => {
|
|
413
|
-
N?.(g, void 0), g = r(), s = !0, d.forEach((k) => k(g));
|
|
414
|
-
}).catch((k) => {
|
|
415
|
-
N?.(void 0, k);
|
|
416
|
-
});
|
|
417
|
-
};
|
|
418
|
-
return o.persist = {
|
|
419
|
-
setOptions: (b) => {
|
|
420
|
-
i = {
|
|
421
|
-
...i,
|
|
422
|
-
...b
|
|
423
|
-
}, b.storage && (l = b.storage);
|
|
316
|
+
}, []);
|
|
317
|
+
const v = () => {
|
|
318
|
+
const l = prompt("Enter URL:");
|
|
319
|
+
l && e("createLink", l);
|
|
320
|
+
}, _ = [
|
|
321
|
+
{
|
|
322
|
+
id: "bold",
|
|
323
|
+
command: "bold",
|
|
324
|
+
icon: /* @__PURE__ */ p.jsx(qt, { size: 18 }),
|
|
325
|
+
title: "Bold"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "italic",
|
|
329
|
+
command: "italic",
|
|
330
|
+
icon: /* @__PURE__ */ p.jsx(Yt, { size: 18 }),
|
|
331
|
+
title: "Italic"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: "underline",
|
|
335
|
+
command: "underline",
|
|
336
|
+
icon: /* @__PURE__ */ p.jsx(Jt, { size: 18 }),
|
|
337
|
+
title: "Underline"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "strikeThrough",
|
|
341
|
+
command: "strikeThrough",
|
|
342
|
+
icon: /* @__PURE__ */ p.jsx(Gt, { size: 18 }),
|
|
343
|
+
title: "Strikethrough"
|
|
344
|
+
},
|
|
345
|
+
{ id: "separator-1", separator: !0 },
|
|
346
|
+
{
|
|
347
|
+
id: "unordered-list",
|
|
348
|
+
command: "insertUnorderedList",
|
|
349
|
+
icon: /* @__PURE__ */ p.jsx(Ht, { size: 18 }),
|
|
350
|
+
title: "Bullet List"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
id: "ordered-list",
|
|
354
|
+
command: "insertOrderedList",
|
|
355
|
+
icon: /* @__PURE__ */ p.jsx(Xt, { size: 18 }),
|
|
356
|
+
title: "Numbered List"
|
|
357
|
+
},
|
|
358
|
+
{ id: "separator-2", separator: !0 },
|
|
359
|
+
{
|
|
360
|
+
id: "heading-1",
|
|
361
|
+
command: "formatBlock",
|
|
362
|
+
value: "h1",
|
|
363
|
+
icon: /* @__PURE__ */ p.jsx(Kt, { size: 18 }),
|
|
364
|
+
title: "Heading 1",
|
|
365
|
+
isActive: f === "h1"
|
|
424
366
|
},
|
|
425
|
-
|
|
426
|
-
|
|
367
|
+
{
|
|
368
|
+
id: "heading-2",
|
|
369
|
+
command: "formatBlock",
|
|
370
|
+
value: "h2",
|
|
371
|
+
icon: /* @__PURE__ */ p.jsx(Qt, { size: 18 }),
|
|
372
|
+
title: "Heading 2",
|
|
373
|
+
isActive: f === "h2"
|
|
427
374
|
},
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
375
|
+
{
|
|
376
|
+
id: "paragraph",
|
|
377
|
+
command: "formatBlock",
|
|
378
|
+
value: "p",
|
|
379
|
+
icon: /* @__PURE__ */ p.jsx(en, { size: 18 }),
|
|
380
|
+
title: "Paragraph",
|
|
381
|
+
isActive: f === "p"
|
|
382
|
+
},
|
|
383
|
+
{ id: "separator-3", separator: !0 },
|
|
384
|
+
{
|
|
385
|
+
id: "align-left",
|
|
386
|
+
command: "justifyLeft",
|
|
387
|
+
icon: /* @__PURE__ */ p.jsx(tn, { size: 18 }),
|
|
388
|
+
title: "Align Left"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: "align-center",
|
|
392
|
+
command: "justifyCenter",
|
|
393
|
+
icon: /* @__PURE__ */ p.jsx(nn, { size: 18 }),
|
|
394
|
+
title: "Center"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
id: "align-right",
|
|
398
|
+
command: "justifyRight",
|
|
399
|
+
icon: /* @__PURE__ */ p.jsx(rn, { size: 18 }),
|
|
400
|
+
title: "Align Right"
|
|
401
|
+
},
|
|
402
|
+
{ id: "separator-4", separator: !0 },
|
|
403
|
+
{
|
|
404
|
+
id: "link",
|
|
405
|
+
command: "createLink",
|
|
406
|
+
icon: /* @__PURE__ */ p.jsx(on, { size: 18 }),
|
|
407
|
+
title: "Insert Link",
|
|
408
|
+
onClick: v
|
|
409
|
+
}
|
|
410
|
+
];
|
|
411
|
+
return /* @__PURE__ */ p.jsxs("div", { className: "flex flex-wrap justify-between items-center p-3 bg-gray-50 border-b border-gray-200", children: [
|
|
412
|
+
/* @__PURE__ */ p.jsx("div", { className: "flex flex-wrap items-center gap-1", children: _.map((l) => {
|
|
413
|
+
if ("separator" in l)
|
|
414
|
+
return /* @__PURE__ */ p.jsx("div", { className: "w-px h-6 bg-gray-300 mx-2" }, l.id);
|
|
415
|
+
const b = l.isActive !== void 0 ? l.isActive : c.includes(l.command);
|
|
416
|
+
return /* @__PURE__ */ p.jsx(
|
|
417
|
+
"button",
|
|
418
|
+
{
|
|
419
|
+
onClick: () => l.onClick ? l.onClick() : e(l.command, l.value),
|
|
420
|
+
title: l.title,
|
|
421
|
+
type: "button",
|
|
422
|
+
className: `w-9 h-9 flex items-center justify-center rounded-md border transition-colors duration-200 ${b ? "bg-blue-100 text-blue-600 border-blue-300 hover:bg-blue-200" : "bg-white border-gray-300 text-gray-700 hover:bg-gray-100"}`,
|
|
423
|
+
children: l.icon
|
|
424
|
+
},
|
|
425
|
+
l.id
|
|
426
|
+
);
|
|
427
|
+
}) }),
|
|
428
|
+
o && /* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2 mt-2 sm:mt-0", children: [
|
|
429
|
+
/* @__PURE__ */ p.jsxs(
|
|
430
|
+
"button",
|
|
431
|
+
{
|
|
432
|
+
onClick: t,
|
|
433
|
+
disabled: !i,
|
|
434
|
+
title: "Save Document",
|
|
435
|
+
className: "flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:bg-blue-300 disabled:cursor-not-allowed transition-colors duration-200",
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ p.jsx(Vt, { size: 16 }),
|
|
438
|
+
/* @__PURE__ */ p.jsx("span", { children: "Save" })
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
/* @__PURE__ */ p.jsxs(
|
|
443
|
+
"button",
|
|
444
|
+
{
|
|
445
|
+
onClick: n,
|
|
446
|
+
title: "Export as HTML",
|
|
447
|
+
className: "flex items-center gap-2 px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 transition-colors duration-200",
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ p.jsx(Wt, { size: 16 }),
|
|
450
|
+
/* @__PURE__ */ p.jsx("span", { children: "Export" })
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
/* @__PURE__ */ p.jsxs(
|
|
455
|
+
"button",
|
|
456
|
+
{
|
|
457
|
+
onClick: r,
|
|
458
|
+
title: "Clear Editor",
|
|
459
|
+
className: "flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-md hover:bg-red-700 transition-colors duration-200",
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ p.jsx(Bt, { size: 16 }),
|
|
462
|
+
/* @__PURE__ */ p.jsx("span", { children: "Clear" })
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
] })
|
|
467
|
+
] });
|
|
468
|
+
}, ln = ({
|
|
469
|
+
wordCount: e,
|
|
470
|
+
characterCount: t,
|
|
471
|
+
hasUnsavedChanges: n
|
|
472
|
+
}) => /* @__PURE__ */ p.jsx("div", { className: "flex justify-between items-center px-5 py-3 bg-gray-50 border-t border-gray-200 text-sm text-gray-600", children: /* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-6", children: [
|
|
473
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
474
|
+
"Words: ",
|
|
475
|
+
/* @__PURE__ */ p.jsx("strong", { className: "text-gray-800", children: e })
|
|
476
|
+
] }),
|
|
477
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
478
|
+
"Characters: ",
|
|
479
|
+
/* @__PURE__ */ p.jsx("strong", { className: "text-gray-800", children: t })
|
|
480
|
+
] }),
|
|
481
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
482
|
+
"Status: ",
|
|
483
|
+
/* @__PURE__ */ p.jsx("strong", { className: n ? "text-orange-600" : "text-green-600", children: n ? "Unsaved Changes" : "Saved" })
|
|
484
|
+
] })
|
|
485
|
+
] }) });
|
|
439
486
|
function a(e, t, n) {
|
|
440
|
-
function r(
|
|
441
|
-
var
|
|
442
|
-
Object.defineProperty(
|
|
443
|
-
value:
|
|
487
|
+
function r(s, f) {
|
|
488
|
+
var d;
|
|
489
|
+
Object.defineProperty(s, "_zod", {
|
|
490
|
+
value: s._zod ?? {},
|
|
444
491
|
enumerable: !1
|
|
445
|
-
}), (
|
|
446
|
-
for (const
|
|
447
|
-
|
|
448
|
-
|
|
492
|
+
}), (d = s._zod).traits ?? (d.traits = /* @__PURE__ */ new Set()), s._zod.traits.add(e), t(s, f);
|
|
493
|
+
for (const h in c.prototype)
|
|
494
|
+
h in s || Object.defineProperty(s, h, { value: c.prototype[h].bind(s) });
|
|
495
|
+
s._zod.constr = c, s._zod.def = f;
|
|
449
496
|
}
|
|
450
497
|
const o = n?.Parent ?? Object;
|
|
451
498
|
class i extends o {
|
|
452
499
|
}
|
|
453
500
|
Object.defineProperty(i, "name", { value: e });
|
|
454
|
-
function s
|
|
455
|
-
var
|
|
456
|
-
const
|
|
457
|
-
r(
|
|
458
|
-
for (const
|
|
459
|
-
|
|
460
|
-
return
|
|
501
|
+
function c(s) {
|
|
502
|
+
var f;
|
|
503
|
+
const d = n?.Parent ? new i() : this;
|
|
504
|
+
r(d, s), (f = d._zod).deferred ?? (f.deferred = []);
|
|
505
|
+
for (const h of d._zod.deferred)
|
|
506
|
+
h();
|
|
507
|
+
return d;
|
|
461
508
|
}
|
|
462
|
-
return Object.defineProperty(
|
|
463
|
-
value: (
|
|
464
|
-
}), Object.defineProperty(
|
|
509
|
+
return Object.defineProperty(c, "init", { value: r }), Object.defineProperty(c, Symbol.hasInstance, {
|
|
510
|
+
value: (s) => n?.Parent && s instanceof n.Parent ? !0 : s?._zod?.traits?.has(e)
|
|
511
|
+
}), Object.defineProperty(c, "name", { value: e }), c;
|
|
465
512
|
}
|
|
466
|
-
class
|
|
513
|
+
class J extends Error {
|
|
467
514
|
constructor() {
|
|
468
515
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
469
516
|
}
|
|
470
517
|
}
|
|
471
|
-
class
|
|
518
|
+
class ht extends Error {
|
|
472
519
|
constructor(t) {
|
|
473
520
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
474
521
|
}
|
|
475
522
|
}
|
|
476
|
-
const
|
|
523
|
+
const mt = {};
|
|
477
524
|
function M(e) {
|
|
478
|
-
return
|
|
525
|
+
return mt;
|
|
479
526
|
}
|
|
480
|
-
function
|
|
527
|
+
function dn(e) {
|
|
481
528
|
const t = Object.values(e).filter((r) => typeof r == "number");
|
|
482
529
|
return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
|
|
483
530
|
}
|
|
484
|
-
function
|
|
531
|
+
function ze(e, t) {
|
|
485
532
|
return typeof t == "bigint" ? t.toString() : t;
|
|
486
533
|
}
|
|
487
|
-
function
|
|
534
|
+
function xe(e) {
|
|
488
535
|
return {
|
|
489
536
|
get value() {
|
|
490
537
|
{
|
|
@@ -494,30 +541,30 @@ function je(e) {
|
|
|
494
541
|
}
|
|
495
542
|
};
|
|
496
543
|
}
|
|
497
|
-
function
|
|
544
|
+
function Te(e) {
|
|
498
545
|
return e == null;
|
|
499
546
|
}
|
|
500
|
-
function
|
|
547
|
+
function Ae(e) {
|
|
501
548
|
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
502
549
|
return e.slice(t, n);
|
|
503
550
|
}
|
|
504
|
-
function
|
|
551
|
+
function fn(e, t) {
|
|
505
552
|
const n = (e.toString().split(".")[1] || "").length, r = t.toString();
|
|
506
553
|
let o = (r.split(".")[1] || "").length;
|
|
507
554
|
if (o === 0 && /\d?e-\d?/.test(r)) {
|
|
508
|
-
const
|
|
509
|
-
|
|
555
|
+
const f = r.match(/\d?e-(\d?)/);
|
|
556
|
+
f?.[1] && (o = Number.parseInt(f[1]));
|
|
510
557
|
}
|
|
511
|
-
const i = n > o ? n : o,
|
|
512
|
-
return
|
|
558
|
+
const i = n > o ? n : o, c = Number.parseInt(e.toFixed(i).replace(".", "")), s = Number.parseInt(t.toFixed(i).replace(".", ""));
|
|
559
|
+
return c % s / 10 ** i;
|
|
513
560
|
}
|
|
514
|
-
const
|
|
561
|
+
const We = Symbol("evaluating");
|
|
515
562
|
function w(e, t, n) {
|
|
516
563
|
let r;
|
|
517
564
|
Object.defineProperty(e, t, {
|
|
518
565
|
get() {
|
|
519
|
-
if (r !==
|
|
520
|
-
return r === void 0 && (r =
|
|
566
|
+
if (r !== We)
|
|
567
|
+
return r === void 0 && (r = We, r = n()), r;
|
|
521
568
|
},
|
|
522
569
|
set(o) {
|
|
523
570
|
Object.defineProperty(e, t, {
|
|
@@ -544,15 +591,15 @@ function B(...e) {
|
|
|
544
591
|
}
|
|
545
592
|
return Object.defineProperties({}, t);
|
|
546
593
|
}
|
|
547
|
-
function
|
|
594
|
+
function Be(e) {
|
|
548
595
|
return JSON.stringify(e);
|
|
549
596
|
}
|
|
550
|
-
const
|
|
597
|
+
const pt = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
551
598
|
};
|
|
552
|
-
function
|
|
599
|
+
function ue(e) {
|
|
553
600
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
554
601
|
}
|
|
555
|
-
const
|
|
602
|
+
const hn = xe(() => {
|
|
556
603
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
557
604
|
return !1;
|
|
558
605
|
try {
|
|
@@ -562,20 +609,20 @@ const $n = je(() => {
|
|
|
562
609
|
return !1;
|
|
563
610
|
}
|
|
564
611
|
});
|
|
565
|
-
function
|
|
566
|
-
if (
|
|
612
|
+
function X(e) {
|
|
613
|
+
if (ue(e) === !1)
|
|
567
614
|
return !1;
|
|
568
615
|
const t = e.constructor;
|
|
569
616
|
if (t === void 0)
|
|
570
617
|
return !0;
|
|
571
618
|
const n = t.prototype;
|
|
572
|
-
return !(
|
|
619
|
+
return !(ue(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
573
620
|
}
|
|
574
|
-
function
|
|
575
|
-
return
|
|
621
|
+
function _t(e) {
|
|
622
|
+
return X(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
576
623
|
}
|
|
577
|
-
const
|
|
578
|
-
function
|
|
624
|
+
const mn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
625
|
+
function fe(e) {
|
|
579
626
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
580
627
|
}
|
|
581
628
|
function L(e, t, n) {
|
|
@@ -595,17 +642,17 @@ function m(e) {
|
|
|
595
642
|
}
|
|
596
643
|
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
597
644
|
}
|
|
598
|
-
function
|
|
645
|
+
function pn(e) {
|
|
599
646
|
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
600
647
|
}
|
|
601
|
-
const
|
|
648
|
+
const _n = {
|
|
602
649
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
603
650
|
int32: [-2147483648, 2147483647],
|
|
604
651
|
uint32: [0, 4294967295],
|
|
605
652
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
606
653
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
607
654
|
};
|
|
608
|
-
function
|
|
655
|
+
function gn(e, t) {
|
|
609
656
|
const n = e._zod.def, r = B(e._zod.def, {
|
|
610
657
|
get shape() {
|
|
611
658
|
const o = {};
|
|
@@ -620,7 +667,7 @@ function Tn(e, t) {
|
|
|
620
667
|
});
|
|
621
668
|
return L(e, r);
|
|
622
669
|
}
|
|
623
|
-
function
|
|
670
|
+
function vn(e, t) {
|
|
624
671
|
const n = e._zod.def, r = B(e._zod.def, {
|
|
625
672
|
get shape() {
|
|
626
673
|
const o = { ...e._zod.def.shape };
|
|
@@ -635,8 +682,8 @@ function Sn(e, t) {
|
|
|
635
682
|
});
|
|
636
683
|
return L(e, r);
|
|
637
684
|
}
|
|
638
|
-
function
|
|
639
|
-
if (!
|
|
685
|
+
function bn(e, t) {
|
|
686
|
+
if (!X(t))
|
|
640
687
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
641
688
|
const n = e._zod.def.checks;
|
|
642
689
|
if (n && n.length > 0)
|
|
@@ -650,8 +697,8 @@ function In(e, t) {
|
|
|
650
697
|
});
|
|
651
698
|
return L(e, o);
|
|
652
699
|
}
|
|
653
|
-
function
|
|
654
|
-
if (!
|
|
700
|
+
function wn(e, t) {
|
|
701
|
+
if (!X(t))
|
|
655
702
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
656
703
|
const n = {
|
|
657
704
|
...e._zod.def,
|
|
@@ -663,7 +710,7 @@ function jn(e, t) {
|
|
|
663
710
|
};
|
|
664
711
|
return L(e, n);
|
|
665
712
|
}
|
|
666
|
-
function
|
|
713
|
+
function kn(e, t) {
|
|
667
714
|
const n = B(e._zod.def, {
|
|
668
715
|
get shape() {
|
|
669
716
|
const r = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
@@ -677,49 +724,49 @@ function An(e, t) {
|
|
|
677
724
|
});
|
|
678
725
|
return L(e, n);
|
|
679
726
|
}
|
|
680
|
-
function
|
|
727
|
+
function zn(e, t, n) {
|
|
681
728
|
const r = B(t._zod.def, {
|
|
682
729
|
get shape() {
|
|
683
730
|
const o = t._zod.def.shape, i = { ...o };
|
|
684
731
|
if (n)
|
|
685
|
-
for (const
|
|
686
|
-
if (!(
|
|
687
|
-
throw new Error(`Unrecognized key: "${
|
|
688
|
-
n[
|
|
732
|
+
for (const c in n) {
|
|
733
|
+
if (!(c in o))
|
|
734
|
+
throw new Error(`Unrecognized key: "${c}"`);
|
|
735
|
+
n[c] && (i[c] = e ? new e({
|
|
689
736
|
type: "optional",
|
|
690
|
-
innerType: o[
|
|
691
|
-
}) : o[
|
|
737
|
+
innerType: o[c]
|
|
738
|
+
}) : o[c]);
|
|
692
739
|
}
|
|
693
740
|
else
|
|
694
|
-
for (const
|
|
695
|
-
i[
|
|
741
|
+
for (const c in o)
|
|
742
|
+
i[c] = e ? new e({
|
|
696
743
|
type: "optional",
|
|
697
|
-
innerType: o[
|
|
698
|
-
}) : o[
|
|
744
|
+
innerType: o[c]
|
|
745
|
+
}) : o[c];
|
|
699
746
|
return W(this, "shape", i), i;
|
|
700
747
|
},
|
|
701
748
|
checks: []
|
|
702
749
|
});
|
|
703
750
|
return L(t, r);
|
|
704
751
|
}
|
|
705
|
-
function
|
|
752
|
+
function yn(e, t, n) {
|
|
706
753
|
const r = B(t._zod.def, {
|
|
707
754
|
get shape() {
|
|
708
755
|
const o = t._zod.def.shape, i = { ...o };
|
|
709
756
|
if (n)
|
|
710
|
-
for (const
|
|
711
|
-
if (!(
|
|
712
|
-
throw new Error(`Unrecognized key: "${
|
|
713
|
-
n[
|
|
757
|
+
for (const c in n) {
|
|
758
|
+
if (!(c in i))
|
|
759
|
+
throw new Error(`Unrecognized key: "${c}"`);
|
|
760
|
+
n[c] && (i[c] = new e({
|
|
714
761
|
type: "nonoptional",
|
|
715
|
-
innerType: o[
|
|
762
|
+
innerType: o[c]
|
|
716
763
|
}));
|
|
717
764
|
}
|
|
718
765
|
else
|
|
719
|
-
for (const
|
|
720
|
-
i[
|
|
766
|
+
for (const c in o)
|
|
767
|
+
i[c] = new e({
|
|
721
768
|
type: "nonoptional",
|
|
722
|
-
innerType: o[
|
|
769
|
+
innerType: o[c]
|
|
723
770
|
});
|
|
724
771
|
return W(this, "shape", i), i;
|
|
725
772
|
},
|
|
@@ -727,7 +774,7 @@ function On(e, t, n) {
|
|
|
727
774
|
});
|
|
728
775
|
return L(t, r);
|
|
729
776
|
}
|
|
730
|
-
function
|
|
777
|
+
function Y(e, t = 0) {
|
|
731
778
|
if (e.aborted === !0)
|
|
732
779
|
return !0;
|
|
733
780
|
for (let n = t; n < e.issues.length; n++)
|
|
@@ -735,27 +782,27 @@ function J(e, t = 0) {
|
|
|
735
782
|
return !0;
|
|
736
783
|
return !1;
|
|
737
784
|
}
|
|
738
|
-
function
|
|
785
|
+
function gt(e, t) {
|
|
739
786
|
return t.map((n) => {
|
|
740
787
|
var r;
|
|
741
788
|
return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
|
|
742
789
|
});
|
|
743
790
|
}
|
|
744
|
-
function
|
|
791
|
+
function re(e) {
|
|
745
792
|
return typeof e == "string" ? e : e?.message;
|
|
746
793
|
}
|
|
747
794
|
function V(e, t, n) {
|
|
748
795
|
const r = { ...e, path: e.path ?? [] };
|
|
749
796
|
if (!e.message) {
|
|
750
|
-
const o =
|
|
797
|
+
const o = re(e.inst?._zod.def?.error?.(e)) ?? re(t?.error?.(e)) ?? re(n.customError?.(e)) ?? re(n.localeError?.(e)) ?? "Invalid input";
|
|
751
798
|
r.message = o;
|
|
752
799
|
}
|
|
753
800
|
return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
|
|
754
801
|
}
|
|
755
|
-
function
|
|
802
|
+
function je(e) {
|
|
756
803
|
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
757
804
|
}
|
|
758
|
-
function
|
|
805
|
+
function K(...e) {
|
|
759
806
|
const [t, n, r] = e;
|
|
760
807
|
return typeof t == "string" ? {
|
|
761
808
|
message: t,
|
|
@@ -764,122 +811,122 @@ function te(...e) {
|
|
|
764
811
|
inst: r
|
|
765
812
|
} : { ...t };
|
|
766
813
|
}
|
|
767
|
-
const
|
|
814
|
+
const vt = (e, t) => {
|
|
768
815
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
769
816
|
value: e._zod,
|
|
770
817
|
enumerable: !1
|
|
771
818
|
}), Object.defineProperty(e, "issues", {
|
|
772
819
|
value: t,
|
|
773
820
|
enumerable: !1
|
|
774
|
-
}), e.message = JSON.stringify(t,
|
|
821
|
+
}), e.message = JSON.stringify(t, ze, 2), Object.defineProperty(e, "toString", {
|
|
775
822
|
value: () => e.message,
|
|
776
823
|
enumerable: !1
|
|
777
824
|
});
|
|
778
|
-
},
|
|
779
|
-
function
|
|
825
|
+
}, bt = a("$ZodError", vt), wt = a("$ZodError", vt, { Parent: Error });
|
|
826
|
+
function $n(e, t = (n) => n.message) {
|
|
780
827
|
const n = {}, r = [];
|
|
781
828
|
for (const o of e.issues)
|
|
782
829
|
o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
|
|
783
830
|
return { formErrors: r, fieldErrors: n };
|
|
784
831
|
}
|
|
785
|
-
function
|
|
832
|
+
function Zn(e, t) {
|
|
786
833
|
const n = t || function(i) {
|
|
787
834
|
return i.message;
|
|
788
835
|
}, r = { _errors: [] }, o = (i) => {
|
|
789
|
-
for (const
|
|
790
|
-
if (
|
|
791
|
-
|
|
792
|
-
else if (
|
|
793
|
-
o({ issues:
|
|
794
|
-
else if (
|
|
795
|
-
o({ issues:
|
|
796
|
-
else if (
|
|
797
|
-
r._errors.push(n(
|
|
836
|
+
for (const c of i.issues)
|
|
837
|
+
if (c.code === "invalid_union" && c.errors.length)
|
|
838
|
+
c.errors.map((s) => o({ issues: s }));
|
|
839
|
+
else if (c.code === "invalid_key")
|
|
840
|
+
o({ issues: c.issues });
|
|
841
|
+
else if (c.code === "invalid_element")
|
|
842
|
+
o({ issues: c.issues });
|
|
843
|
+
else if (c.path.length === 0)
|
|
844
|
+
r._errors.push(n(c));
|
|
798
845
|
else {
|
|
799
|
-
let
|
|
800
|
-
for (;
|
|
801
|
-
const
|
|
802
|
-
|
|
846
|
+
let s = r, f = 0;
|
|
847
|
+
for (; f < c.path.length; ) {
|
|
848
|
+
const d = c.path[f];
|
|
849
|
+
f === c.path.length - 1 ? (s[d] = s[d] || { _errors: [] }, s[d]._errors.push(n(c))) : s[d] = s[d] || { _errors: [] }, s = s[d], f++;
|
|
803
850
|
}
|
|
804
851
|
}
|
|
805
852
|
};
|
|
806
853
|
return o(e), r;
|
|
807
854
|
}
|
|
808
|
-
const
|
|
809
|
-
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 },
|
|
810
|
-
if (
|
|
811
|
-
throw new
|
|
812
|
-
if (
|
|
813
|
-
const
|
|
814
|
-
throw
|
|
855
|
+
const Ie = (e) => (t, n, r, o) => {
|
|
856
|
+
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, c = t._zod.run({ value: n, issues: [] }, i);
|
|
857
|
+
if (c instanceof Promise)
|
|
858
|
+
throw new J();
|
|
859
|
+
if (c.issues.length) {
|
|
860
|
+
const s = new (o?.Err ?? e)(c.issues.map((f) => V(f, i, M())));
|
|
861
|
+
throw pt(s, o?.callee), s;
|
|
815
862
|
}
|
|
816
|
-
return
|
|
817
|
-
},
|
|
863
|
+
return c.value;
|
|
864
|
+
}, Ce = (e) => async (t, n, r, o) => {
|
|
818
865
|
const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
819
|
-
let
|
|
820
|
-
if (
|
|
821
|
-
const
|
|
822
|
-
throw
|
|
866
|
+
let c = t._zod.run({ value: n, issues: [] }, i);
|
|
867
|
+
if (c instanceof Promise && (c = await c), c.issues.length) {
|
|
868
|
+
const s = new (o?.Err ?? e)(c.issues.map((f) => V(f, i, M())));
|
|
869
|
+
throw pt(s, o?.callee), s;
|
|
823
870
|
}
|
|
824
|
-
return
|
|
825
|
-
},
|
|
871
|
+
return c.value;
|
|
872
|
+
}, he = (e) => (t, n, r) => {
|
|
826
873
|
const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
|
|
827
874
|
if (i instanceof Promise)
|
|
828
|
-
throw new
|
|
875
|
+
throw new J();
|
|
829
876
|
return i.issues.length ? {
|
|
830
877
|
success: !1,
|
|
831
|
-
error: new (e ??
|
|
878
|
+
error: new (e ?? bt)(i.issues.map((c) => V(c, o, M())))
|
|
832
879
|
} : { success: !0, data: i.value };
|
|
833
|
-
},
|
|
880
|
+
}, En = /* @__PURE__ */ he(wt), me = (e) => async (t, n, r) => {
|
|
834
881
|
const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
835
882
|
let i = t._zod.run({ value: n, issues: [] }, o);
|
|
836
883
|
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
837
884
|
success: !1,
|
|
838
|
-
error: new e(i.issues.map((
|
|
885
|
+
error: new e(i.issues.map((c) => V(c, o, M())))
|
|
839
886
|
} : { success: !0, data: i.value };
|
|
840
|
-
},
|
|
887
|
+
}, xn = /* @__PURE__ */ me(wt), Tn = (e) => (t, n, r) => {
|
|
841
888
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
842
|
-
return
|
|
843
|
-
},
|
|
889
|
+
return Ie(e)(t, n, o);
|
|
890
|
+
}, An = (e) => (t, n, r) => Ie(e)(t, n, r), jn = (e) => async (t, n, r) => {
|
|
844
891
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
845
|
-
return
|
|
846
|
-
},
|
|
892
|
+
return Ce(e)(t, n, o);
|
|
893
|
+
}, In = (e) => async (t, n, r) => Ce(e)(t, n, r), Cn = (e) => (t, n, r) => {
|
|
847
894
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
848
|
-
return
|
|
849
|
-
},
|
|
895
|
+
return he(e)(t, n, o);
|
|
896
|
+
}, Sn = (e) => (t, n, r) => he(e)(t, n, r), On = (e) => async (t, n, r) => {
|
|
850
897
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
851
|
-
return
|
|
852
|
-
},
|
|
853
|
-
function
|
|
854
|
-
return new RegExp(
|
|
898
|
+
return me(e)(t, n, o);
|
|
899
|
+
}, Rn = (e) => async (t, n, r) => me(e)(t, n, r), Pn = /^[cC][^\s-]{8,}$/, Nn = /^[0-9a-z]+$/, Dn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Un = /^[0-9a-vA-V]{20}$/, Ln = /^[A-Za-z0-9]{27}$/, Fn = /^[a-zA-Z0-9_-]{21}$/, Mn = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Vn = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, qe = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Wn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Bn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
900
|
+
function qn() {
|
|
901
|
+
return new RegExp(Bn, "u");
|
|
855
902
|
}
|
|
856
|
-
const
|
|
857
|
-
function
|
|
903
|
+
const Yn = /^(?:(?: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])$/, Jn = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Gn = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Hn = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Xn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, kt = /^[A-Za-z0-9_-]*$/, Kn = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/, Qn = /^\+(?:[0-9]){6,14}[0-9]$/, zt = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", er = /* @__PURE__ */ new RegExp(`^${zt}$`);
|
|
904
|
+
function yt(e) {
|
|
858
905
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
859
906
|
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
860
907
|
}
|
|
861
|
-
function
|
|
862
|
-
return new RegExp(`^${
|
|
908
|
+
function tr(e) {
|
|
909
|
+
return new RegExp(`^${yt(e)}$`);
|
|
863
910
|
}
|
|
864
|
-
function
|
|
865
|
-
const t =
|
|
911
|
+
function nr(e) {
|
|
912
|
+
const t = yt({ precision: e.precision }), n = ["Z"];
|
|
866
913
|
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
867
914
|
const r = `${t}(?:${n.join("|")})`;
|
|
868
|
-
return new RegExp(`^${
|
|
915
|
+
return new RegExp(`^${zt}T(?:${r})$`);
|
|
869
916
|
}
|
|
870
|
-
const
|
|
917
|
+
const rr = (e) => {
|
|
871
918
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
872
919
|
return new RegExp(`^${t}$`);
|
|
873
|
-
},
|
|
920
|
+
}, or = /^-?\d+$/, ir = /^-?\d+(?:\.\d+)?/, cr = /^(?:true|false)$/i, sr = /^[^A-Z]*$/, ar = /^[^a-z]*$/, I = /* @__PURE__ */ a("$ZodCheck", (e, t) => {
|
|
874
921
|
var n;
|
|
875
922
|
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
876
|
-
}),
|
|
923
|
+
}), $t = {
|
|
877
924
|
number: "number",
|
|
878
925
|
bigint: "bigint",
|
|
879
926
|
object: "date"
|
|
880
|
-
},
|
|
881
|
-
|
|
882
|
-
const n =
|
|
927
|
+
}, Zt = /* @__PURE__ */ a("$ZodCheckLessThan", (e, t) => {
|
|
928
|
+
I.init(e, t);
|
|
929
|
+
const n = $t[typeof t.value];
|
|
883
930
|
e._zod.onattach.push((r) => {
|
|
884
931
|
const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
885
932
|
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
@@ -894,9 +941,9 @@ const mr = (e) => {
|
|
|
894
941
|
continue: !t.abort
|
|
895
942
|
});
|
|
896
943
|
};
|
|
897
|
-
}),
|
|
898
|
-
|
|
899
|
-
const n =
|
|
944
|
+
}), Et = /* @__PURE__ */ a("$ZodCheckGreaterThan", (e, t) => {
|
|
945
|
+
I.init(e, t);
|
|
946
|
+
const n = $t[typeof t.value];
|
|
900
947
|
e._zod.onattach.push((r) => {
|
|
901
948
|
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
902
949
|
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
@@ -911,14 +958,14 @@ const mr = (e) => {
|
|
|
911
958
|
continue: !t.abort
|
|
912
959
|
});
|
|
913
960
|
};
|
|
914
|
-
}),
|
|
915
|
-
|
|
961
|
+
}), ur = /* @__PURE__ */ a("$ZodCheckMultipleOf", (e, t) => {
|
|
962
|
+
I.init(e, t), e._zod.onattach.push((n) => {
|
|
916
963
|
var r;
|
|
917
964
|
(r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
|
|
918
965
|
}), e._zod.check = (n) => {
|
|
919
966
|
if (typeof n.value != typeof t.value)
|
|
920
967
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
921
|
-
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) :
|
|
968
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : fn(n.value, t.value) === 0) || n.issues.push({
|
|
922
969
|
origin: typeof n.value,
|
|
923
970
|
code: "not_multiple_of",
|
|
924
971
|
divisor: t.value,
|
|
@@ -927,37 +974,37 @@ const mr = (e) => {
|
|
|
927
974
|
continue: !t.abort
|
|
928
975
|
});
|
|
929
976
|
};
|
|
930
|
-
}),
|
|
931
|
-
|
|
932
|
-
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] =
|
|
933
|
-
e._zod.onattach.push((
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
}), e._zod.check = (
|
|
937
|
-
const
|
|
977
|
+
}), lr = /* @__PURE__ */ a("$ZodCheckNumberFormat", (e, t) => {
|
|
978
|
+
I.init(e, t), t.format = t.format || "float64";
|
|
979
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = _n[t.format];
|
|
980
|
+
e._zod.onattach.push((c) => {
|
|
981
|
+
const s = c._zod.bag;
|
|
982
|
+
s.format = t.format, s.minimum = o, s.maximum = i, n && (s.pattern = or);
|
|
983
|
+
}), e._zod.check = (c) => {
|
|
984
|
+
const s = c.value;
|
|
938
985
|
if (n) {
|
|
939
|
-
if (!Number.isInteger(
|
|
940
|
-
|
|
986
|
+
if (!Number.isInteger(s)) {
|
|
987
|
+
c.issues.push({
|
|
941
988
|
expected: r,
|
|
942
989
|
format: t.format,
|
|
943
990
|
code: "invalid_type",
|
|
944
991
|
continue: !1,
|
|
945
|
-
input:
|
|
992
|
+
input: s,
|
|
946
993
|
inst: e
|
|
947
994
|
});
|
|
948
995
|
return;
|
|
949
996
|
}
|
|
950
|
-
if (!Number.isSafeInteger(
|
|
951
|
-
|
|
952
|
-
input:
|
|
997
|
+
if (!Number.isSafeInteger(s)) {
|
|
998
|
+
s > 0 ? c.issues.push({
|
|
999
|
+
input: s,
|
|
953
1000
|
code: "too_big",
|
|
954
1001
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
955
1002
|
note: "Integers must be within the safe integer range.",
|
|
956
1003
|
inst: e,
|
|
957
1004
|
origin: r,
|
|
958
1005
|
continue: !t.abort
|
|
959
|
-
}) :
|
|
960
|
-
input:
|
|
1006
|
+
}) : c.issues.push({
|
|
1007
|
+
input: s,
|
|
961
1008
|
code: "too_small",
|
|
962
1009
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
963
1010
|
note: "Integers must be within the safe integer range.",
|
|
@@ -968,27 +1015,27 @@ const mr = (e) => {
|
|
|
968
1015
|
return;
|
|
969
1016
|
}
|
|
970
1017
|
}
|
|
971
|
-
|
|
1018
|
+
s < o && c.issues.push({
|
|
972
1019
|
origin: "number",
|
|
973
|
-
input:
|
|
1020
|
+
input: s,
|
|
974
1021
|
code: "too_small",
|
|
975
1022
|
minimum: o,
|
|
976
1023
|
inclusive: !0,
|
|
977
1024
|
inst: e,
|
|
978
1025
|
continue: !t.abort
|
|
979
|
-
}),
|
|
1026
|
+
}), s > i && c.issues.push({
|
|
980
1027
|
origin: "number",
|
|
981
|
-
input:
|
|
1028
|
+
input: s,
|
|
982
1029
|
code: "too_big",
|
|
983
1030
|
maximum: i,
|
|
984
1031
|
inst: e
|
|
985
1032
|
});
|
|
986
1033
|
};
|
|
987
|
-
}),
|
|
1034
|
+
}), dr = /* @__PURE__ */ a("$ZodCheckMaxLength", (e, t) => {
|
|
988
1035
|
var n;
|
|
989
|
-
|
|
1036
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
990
1037
|
const o = r.value;
|
|
991
|
-
return !
|
|
1038
|
+
return !Te(o) && o.length !== void 0;
|
|
992
1039
|
}), e._zod.onattach.push((r) => {
|
|
993
1040
|
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
994
1041
|
t.maximum < o && (r._zod.bag.maximum = t.maximum);
|
|
@@ -996,9 +1043,9 @@ const mr = (e) => {
|
|
|
996
1043
|
const o = r.value;
|
|
997
1044
|
if (o.length <= t.maximum)
|
|
998
1045
|
return;
|
|
999
|
-
const
|
|
1046
|
+
const c = je(o);
|
|
1000
1047
|
r.issues.push({
|
|
1001
|
-
origin:
|
|
1048
|
+
origin: c,
|
|
1002
1049
|
code: "too_big",
|
|
1003
1050
|
maximum: t.maximum,
|
|
1004
1051
|
inclusive: !0,
|
|
@@ -1007,11 +1054,11 @@ const mr = (e) => {
|
|
|
1007
1054
|
continue: !t.abort
|
|
1008
1055
|
});
|
|
1009
1056
|
};
|
|
1010
|
-
}),
|
|
1057
|
+
}), fr = /* @__PURE__ */ a("$ZodCheckMinLength", (e, t) => {
|
|
1011
1058
|
var n;
|
|
1012
|
-
|
|
1059
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1013
1060
|
const o = r.value;
|
|
1014
|
-
return !
|
|
1061
|
+
return !Te(o) && o.length !== void 0;
|
|
1015
1062
|
}), e._zod.onattach.push((r) => {
|
|
1016
1063
|
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1017
1064
|
t.minimum > o && (r._zod.bag.minimum = t.minimum);
|
|
@@ -1019,9 +1066,9 @@ const mr = (e) => {
|
|
|
1019
1066
|
const o = r.value;
|
|
1020
1067
|
if (o.length >= t.minimum)
|
|
1021
1068
|
return;
|
|
1022
|
-
const
|
|
1069
|
+
const c = je(o);
|
|
1023
1070
|
r.issues.push({
|
|
1024
|
-
origin:
|
|
1071
|
+
origin: c,
|
|
1025
1072
|
code: "too_small",
|
|
1026
1073
|
minimum: t.minimum,
|
|
1027
1074
|
inclusive: !0,
|
|
@@ -1030,11 +1077,11 @@ const mr = (e) => {
|
|
|
1030
1077
|
continue: !t.abort
|
|
1031
1078
|
});
|
|
1032
1079
|
};
|
|
1033
|
-
}),
|
|
1080
|
+
}), hr = /* @__PURE__ */ a("$ZodCheckLengthEquals", (e, t) => {
|
|
1034
1081
|
var n;
|
|
1035
|
-
|
|
1082
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1036
1083
|
const o = r.value;
|
|
1037
|
-
return !
|
|
1084
|
+
return !Te(o) && o.length !== void 0;
|
|
1038
1085
|
}), e._zod.onattach.push((r) => {
|
|
1039
1086
|
const o = r._zod.bag;
|
|
1040
1087
|
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
@@ -1042,10 +1089,10 @@ const mr = (e) => {
|
|
|
1042
1089
|
const o = r.value, i = o.length;
|
|
1043
1090
|
if (i === t.length)
|
|
1044
1091
|
return;
|
|
1045
|
-
const
|
|
1092
|
+
const c = je(o), s = i > t.length;
|
|
1046
1093
|
r.issues.push({
|
|
1047
|
-
origin:
|
|
1048
|
-
...
|
|
1094
|
+
origin: c,
|
|
1095
|
+
...s ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
1049
1096
|
inclusive: !0,
|
|
1050
1097
|
exact: !0,
|
|
1051
1098
|
input: r.value,
|
|
@@ -1053,9 +1100,9 @@ const mr = (e) => {
|
|
|
1053
1100
|
continue: !t.abort
|
|
1054
1101
|
});
|
|
1055
1102
|
};
|
|
1056
|
-
}),
|
|
1103
|
+
}), pe = /* @__PURE__ */ a("$ZodCheckStringFormat", (e, t) => {
|
|
1057
1104
|
var n, r;
|
|
1058
|
-
|
|
1105
|
+
I.init(e, t), e._zod.onattach.push((o) => {
|
|
1059
1106
|
const i = o._zod.bag;
|
|
1060
1107
|
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
1061
1108
|
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
|
|
@@ -1070,8 +1117,8 @@ const mr = (e) => {
|
|
|
1070
1117
|
});
|
|
1071
1118
|
}) : (r = e._zod).check ?? (r.check = () => {
|
|
1072
1119
|
});
|
|
1073
|
-
}),
|
|
1074
|
-
|
|
1120
|
+
}), mr = /* @__PURE__ */ a("$ZodCheckRegex", (e, t) => {
|
|
1121
|
+
pe.init(e, t), e._zod.check = (n) => {
|
|
1075
1122
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1076
1123
|
origin: "string",
|
|
1077
1124
|
code: "invalid_format",
|
|
@@ -1082,13 +1129,13 @@ const mr = (e) => {
|
|
|
1082
1129
|
continue: !t.abort
|
|
1083
1130
|
});
|
|
1084
1131
|
};
|
|
1085
|
-
}),
|
|
1086
|
-
t.pattern ?? (t.pattern =
|
|
1087
|
-
}),
|
|
1088
|
-
t.pattern ?? (t.pattern =
|
|
1089
|
-
}),
|
|
1090
|
-
|
|
1091
|
-
const n =
|
|
1132
|
+
}), pr = /* @__PURE__ */ a("$ZodCheckLowerCase", (e, t) => {
|
|
1133
|
+
t.pattern ?? (t.pattern = sr), pe.init(e, t);
|
|
1134
|
+
}), _r = /* @__PURE__ */ a("$ZodCheckUpperCase", (e, t) => {
|
|
1135
|
+
t.pattern ?? (t.pattern = ar), pe.init(e, t);
|
|
1136
|
+
}), gr = /* @__PURE__ */ a("$ZodCheckIncludes", (e, t) => {
|
|
1137
|
+
I.init(e, t);
|
|
1138
|
+
const n = fe(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1092
1139
|
t.pattern = r, e._zod.onattach.push((o) => {
|
|
1093
1140
|
const i = o._zod.bag;
|
|
1094
1141
|
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
@@ -1103,9 +1150,9 @@ const mr = (e) => {
|
|
|
1103
1150
|
continue: !t.abort
|
|
1104
1151
|
});
|
|
1105
1152
|
};
|
|
1106
|
-
}),
|
|
1107
|
-
|
|
1108
|
-
const n = new RegExp(`^${
|
|
1153
|
+
}), vr = /* @__PURE__ */ a("$ZodCheckStartsWith", (e, t) => {
|
|
1154
|
+
I.init(e, t);
|
|
1155
|
+
const n = new RegExp(`^${fe(t.prefix)}.*`);
|
|
1109
1156
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1110
1157
|
const o = r._zod.bag;
|
|
1111
1158
|
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
@@ -1120,9 +1167,9 @@ const mr = (e) => {
|
|
|
1120
1167
|
continue: !t.abort
|
|
1121
1168
|
});
|
|
1122
1169
|
};
|
|
1123
|
-
}),
|
|
1124
|
-
|
|
1125
|
-
const n = new RegExp(`.*${
|
|
1170
|
+
}), br = /* @__PURE__ */ a("$ZodCheckEndsWith", (e, t) => {
|
|
1171
|
+
I.init(e, t);
|
|
1172
|
+
const n = new RegExp(`.*${fe(t.suffix)}$`);
|
|
1126
1173
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1127
1174
|
const o = r._zod.bag;
|
|
1128
1175
|
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
@@ -1137,12 +1184,12 @@ const mr = (e) => {
|
|
|
1137
1184
|
continue: !t.abort
|
|
1138
1185
|
});
|
|
1139
1186
|
};
|
|
1140
|
-
}),
|
|
1141
|
-
|
|
1187
|
+
}), wr = /* @__PURE__ */ a("$ZodCheckOverwrite", (e, t) => {
|
|
1188
|
+
I.init(e, t), e._zod.check = (n) => {
|
|
1142
1189
|
n.value = t.tx(n.value);
|
|
1143
1190
|
};
|
|
1144
1191
|
});
|
|
1145
|
-
class
|
|
1192
|
+
class kr {
|
|
1146
1193
|
constructor(t = []) {
|
|
1147
1194
|
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1148
1195
|
}
|
|
@@ -1155,9 +1202,9 @@ class Ar {
|
|
|
1155
1202
|
return;
|
|
1156
1203
|
}
|
|
1157
1204
|
const r = t.split(`
|
|
1158
|
-
`).filter((
|
|
1159
|
-
for (const
|
|
1160
|
-
this.content.push(
|
|
1205
|
+
`).filter((c) => c), o = Math.min(...r.map((c) => c.length - c.trimStart().length)), i = r.map((c) => c.slice(o)).map((c) => " ".repeat(this.indent * 2) + c);
|
|
1206
|
+
for (const c of i)
|
|
1207
|
+
this.content.push(c);
|
|
1161
1208
|
}
|
|
1162
1209
|
compile() {
|
|
1163
1210
|
const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
|
|
@@ -1165,13 +1212,13 @@ class Ar {
|
|
|
1165
1212
|
`));
|
|
1166
1213
|
}
|
|
1167
1214
|
}
|
|
1168
|
-
const
|
|
1215
|
+
const zr = {
|
|
1169
1216
|
major: 4,
|
|
1170
1217
|
minor: 1,
|
|
1171
1218
|
patch: 11
|
|
1172
|
-
},
|
|
1219
|
+
}, Z = /* @__PURE__ */ a("$ZodType", (e, t) => {
|
|
1173
1220
|
var n;
|
|
1174
|
-
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version =
|
|
1221
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = zr;
|
|
1175
1222
|
const r = [...e._zod.def.checks ?? []];
|
|
1176
1223
|
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
1177
1224
|
for (const o of r)
|
|
@@ -1182,69 +1229,69 @@ const Cr = {
|
|
|
1182
1229
|
e._zod.run = e._zod.parse;
|
|
1183
1230
|
});
|
|
1184
1231
|
else {
|
|
1185
|
-
const o = (
|
|
1186
|
-
let
|
|
1187
|
-
for (const
|
|
1188
|
-
if (
|
|
1189
|
-
if (!
|
|
1232
|
+
const o = (c, s, f) => {
|
|
1233
|
+
let d = Y(c), h;
|
|
1234
|
+
for (const v of s) {
|
|
1235
|
+
if (v._zod.def.when) {
|
|
1236
|
+
if (!v._zod.def.when(c))
|
|
1190
1237
|
continue;
|
|
1191
|
-
} else if (
|
|
1238
|
+
} else if (d)
|
|
1192
1239
|
continue;
|
|
1193
|
-
const
|
|
1194
|
-
if (
|
|
1195
|
-
throw new
|
|
1196
|
-
if (
|
|
1197
|
-
|
|
1198
|
-
await
|
|
1240
|
+
const _ = c.issues.length, l = v._zod.check(c);
|
|
1241
|
+
if (l instanceof Promise && f?.async === !1)
|
|
1242
|
+
throw new J();
|
|
1243
|
+
if (h || l instanceof Promise)
|
|
1244
|
+
h = (h ?? Promise.resolve()).then(async () => {
|
|
1245
|
+
await l, c.issues.length !== _ && (d || (d = Y(c, _)));
|
|
1199
1246
|
});
|
|
1200
1247
|
else {
|
|
1201
|
-
if (
|
|
1248
|
+
if (c.issues.length === _)
|
|
1202
1249
|
continue;
|
|
1203
|
-
|
|
1250
|
+
d || (d = Y(c, _));
|
|
1204
1251
|
}
|
|
1205
1252
|
}
|
|
1206
|
-
return
|
|
1207
|
-
}, i = (
|
|
1208
|
-
if (
|
|
1209
|
-
return
|
|
1210
|
-
const
|
|
1211
|
-
if (
|
|
1212
|
-
if (
|
|
1213
|
-
throw new
|
|
1214
|
-
return
|
|
1253
|
+
return h ? h.then(() => c) : c;
|
|
1254
|
+
}, i = (c, s, f) => {
|
|
1255
|
+
if (Y(c))
|
|
1256
|
+
return c.aborted = !0, c;
|
|
1257
|
+
const d = o(s, r, f);
|
|
1258
|
+
if (d instanceof Promise) {
|
|
1259
|
+
if (f.async === !1)
|
|
1260
|
+
throw new J();
|
|
1261
|
+
return d.then((h) => e._zod.parse(h, f));
|
|
1215
1262
|
}
|
|
1216
|
-
return e._zod.parse(
|
|
1263
|
+
return e._zod.parse(d, f);
|
|
1217
1264
|
};
|
|
1218
|
-
e._zod.run = (
|
|
1219
|
-
if (
|
|
1220
|
-
return e._zod.parse(
|
|
1221
|
-
if (
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1265
|
+
e._zod.run = (c, s) => {
|
|
1266
|
+
if (s.skipChecks)
|
|
1267
|
+
return e._zod.parse(c, s);
|
|
1268
|
+
if (s.direction === "backward") {
|
|
1269
|
+
const d = e._zod.parse({ value: c.value, issues: [] }, { ...s, skipChecks: !0 });
|
|
1270
|
+
return d instanceof Promise ? d.then((h) => i(h, c, s)) : i(d, c, s);
|
|
1224
1271
|
}
|
|
1225
|
-
const
|
|
1226
|
-
if (
|
|
1227
|
-
if (
|
|
1228
|
-
throw new
|
|
1229
|
-
return
|
|
1272
|
+
const f = e._zod.parse(c, s);
|
|
1273
|
+
if (f instanceof Promise) {
|
|
1274
|
+
if (s.async === !1)
|
|
1275
|
+
throw new J();
|
|
1276
|
+
return f.then((d) => o(d, r, s));
|
|
1230
1277
|
}
|
|
1231
|
-
return o(
|
|
1278
|
+
return o(f, r, s);
|
|
1232
1279
|
};
|
|
1233
1280
|
}
|
|
1234
1281
|
e["~standard"] = {
|
|
1235
1282
|
validate: (o) => {
|
|
1236
1283
|
try {
|
|
1237
|
-
const i =
|
|
1284
|
+
const i = En(e, o);
|
|
1238
1285
|
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
1239
1286
|
} catch {
|
|
1240
|
-
return
|
|
1287
|
+
return xn(e, o).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
|
|
1241
1288
|
}
|
|
1242
1289
|
},
|
|
1243
1290
|
vendor: "zod",
|
|
1244
1291
|
version: 1
|
|
1245
1292
|
};
|
|
1246
|
-
}),
|
|
1247
|
-
|
|
1293
|
+
}), Se = /* @__PURE__ */ a("$ZodString", (e, t) => {
|
|
1294
|
+
Z.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? rr(e._zod.bag), e._zod.parse = (n, r) => {
|
|
1248
1295
|
if (t.coerce)
|
|
1249
1296
|
try {
|
|
1250
1297
|
n.value = String(n.value);
|
|
@@ -1257,11 +1304,11 @@ const Cr = {
|
|
|
1257
1304
|
inst: e
|
|
1258
1305
|
}), n;
|
|
1259
1306
|
};
|
|
1260
|
-
}),
|
|
1261
|
-
|
|
1262
|
-
}),
|
|
1263
|
-
t.pattern ?? (t.pattern =
|
|
1264
|
-
}),
|
|
1307
|
+
}), k = /* @__PURE__ */ a("$ZodStringFormat", (e, t) => {
|
|
1308
|
+
pe.init(e, t), Se.init(e, t);
|
|
1309
|
+
}), yr = /* @__PURE__ */ a("$ZodGUID", (e, t) => {
|
|
1310
|
+
t.pattern ?? (t.pattern = Vn), k.init(e, t);
|
|
1311
|
+
}), $r = /* @__PURE__ */ a("$ZodUUID", (e, t) => {
|
|
1265
1312
|
if (t.version) {
|
|
1266
1313
|
const r = {
|
|
1267
1314
|
v1: 1,
|
|
@@ -1278,18 +1325,18 @@ const Cr = {
|
|
|
1278
1325
|
t.pattern ?? (t.pattern = qe(r));
|
|
1279
1326
|
} else
|
|
1280
1327
|
t.pattern ?? (t.pattern = qe());
|
|
1281
|
-
|
|
1282
|
-
}),
|
|
1283
|
-
t.pattern ?? (t.pattern =
|
|
1284
|
-
}),
|
|
1285
|
-
|
|
1328
|
+
k.init(e, t);
|
|
1329
|
+
}), Zr = /* @__PURE__ */ a("$ZodEmail", (e, t) => {
|
|
1330
|
+
t.pattern ?? (t.pattern = Wn), k.init(e, t);
|
|
1331
|
+
}), Er = /* @__PURE__ */ a("$ZodURL", (e, t) => {
|
|
1332
|
+
k.init(e, t), e._zod.check = (n) => {
|
|
1286
1333
|
try {
|
|
1287
1334
|
const r = n.value.trim(), o = new URL(r);
|
|
1288
1335
|
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
|
|
1289
1336
|
code: "invalid_format",
|
|
1290
1337
|
format: "url",
|
|
1291
1338
|
note: "Invalid hostname",
|
|
1292
|
-
pattern:
|
|
1339
|
+
pattern: Kn.source,
|
|
1293
1340
|
input: n.value,
|
|
1294
1341
|
inst: e,
|
|
1295
1342
|
continue: !t.abort
|
|
@@ -1313,35 +1360,35 @@ const Cr = {
|
|
|
1313
1360
|
});
|
|
1314
1361
|
}
|
|
1315
1362
|
};
|
|
1316
|
-
}),
|
|
1317
|
-
t.pattern ?? (t.pattern =
|
|
1318
|
-
}),
|
|
1319
|
-
t.pattern ?? (t.pattern =
|
|
1320
|
-
}),
|
|
1321
|
-
t.pattern ?? (t.pattern =
|
|
1322
|
-
}),
|
|
1323
|
-
t.pattern ?? (t.pattern =
|
|
1324
|
-
}),
|
|
1325
|
-
t.pattern ?? (t.pattern =
|
|
1326
|
-
}),
|
|
1327
|
-
t.pattern ?? (t.pattern =
|
|
1328
|
-
}),
|
|
1329
|
-
t.pattern ?? (t.pattern =
|
|
1330
|
-
}),
|
|
1331
|
-
t.pattern ?? (t.pattern =
|
|
1332
|
-
}),
|
|
1333
|
-
t.pattern ?? (t.pattern =
|
|
1334
|
-
}),
|
|
1335
|
-
t.pattern ?? (t.pattern =
|
|
1336
|
-
}),
|
|
1337
|
-
t.pattern ?? (t.pattern =
|
|
1338
|
-
}),
|
|
1339
|
-
t.pattern ?? (t.pattern =
|
|
1363
|
+
}), xr = /* @__PURE__ */ a("$ZodEmoji", (e, t) => {
|
|
1364
|
+
t.pattern ?? (t.pattern = qn()), k.init(e, t);
|
|
1365
|
+
}), Tr = /* @__PURE__ */ a("$ZodNanoID", (e, t) => {
|
|
1366
|
+
t.pattern ?? (t.pattern = Fn), k.init(e, t);
|
|
1367
|
+
}), Ar = /* @__PURE__ */ a("$ZodCUID", (e, t) => {
|
|
1368
|
+
t.pattern ?? (t.pattern = Pn), k.init(e, t);
|
|
1369
|
+
}), jr = /* @__PURE__ */ a("$ZodCUID2", (e, t) => {
|
|
1370
|
+
t.pattern ?? (t.pattern = Nn), k.init(e, t);
|
|
1371
|
+
}), Ir = /* @__PURE__ */ a("$ZodULID", (e, t) => {
|
|
1372
|
+
t.pattern ?? (t.pattern = Dn), k.init(e, t);
|
|
1373
|
+
}), Cr = /* @__PURE__ */ a("$ZodXID", (e, t) => {
|
|
1374
|
+
t.pattern ?? (t.pattern = Un), k.init(e, t);
|
|
1375
|
+
}), Sr = /* @__PURE__ */ a("$ZodKSUID", (e, t) => {
|
|
1376
|
+
t.pattern ?? (t.pattern = Ln), k.init(e, t);
|
|
1377
|
+
}), Or = /* @__PURE__ */ a("$ZodISODateTime", (e, t) => {
|
|
1378
|
+
t.pattern ?? (t.pattern = nr(t)), k.init(e, t);
|
|
1379
|
+
}), Rr = /* @__PURE__ */ a("$ZodISODate", (e, t) => {
|
|
1380
|
+
t.pattern ?? (t.pattern = er), k.init(e, t);
|
|
1381
|
+
}), Pr = /* @__PURE__ */ a("$ZodISOTime", (e, t) => {
|
|
1382
|
+
t.pattern ?? (t.pattern = tr(t)), k.init(e, t);
|
|
1383
|
+
}), Nr = /* @__PURE__ */ a("$ZodISODuration", (e, t) => {
|
|
1384
|
+
t.pattern ?? (t.pattern = Mn), k.init(e, t);
|
|
1385
|
+
}), Dr = /* @__PURE__ */ a("$ZodIPv4", (e, t) => {
|
|
1386
|
+
t.pattern ?? (t.pattern = Yn), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1340
1387
|
const r = n._zod.bag;
|
|
1341
1388
|
r.format = "ipv4";
|
|
1342
1389
|
});
|
|
1343
|
-
}),
|
|
1344
|
-
t.pattern ?? (t.pattern =
|
|
1390
|
+
}), Ur = /* @__PURE__ */ a("$ZodIPv6", (e, t) => {
|
|
1391
|
+
t.pattern ?? (t.pattern = Jn), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1345
1392
|
const r = n._zod.bag;
|
|
1346
1393
|
r.format = "ipv6";
|
|
1347
1394
|
}), e._zod.check = (n) => {
|
|
@@ -1357,10 +1404,10 @@ const Cr = {
|
|
|
1357
1404
|
});
|
|
1358
1405
|
}
|
|
1359
1406
|
};
|
|
1360
|
-
}),
|
|
1361
|
-
t.pattern ?? (t.pattern =
|
|
1362
|
-
}),
|
|
1363
|
-
t.pattern ?? (t.pattern =
|
|
1407
|
+
}), Lr = /* @__PURE__ */ a("$ZodCIDRv4", (e, t) => {
|
|
1408
|
+
t.pattern ?? (t.pattern = Gn), k.init(e, t);
|
|
1409
|
+
}), Fr = /* @__PURE__ */ a("$ZodCIDRv6", (e, t) => {
|
|
1410
|
+
t.pattern ?? (t.pattern = Hn), k.init(e, t), e._zod.check = (n) => {
|
|
1364
1411
|
const r = n.value.split("/");
|
|
1365
1412
|
try {
|
|
1366
1413
|
if (r.length !== 2)
|
|
@@ -1368,10 +1415,10 @@ const Cr = {
|
|
|
1368
1415
|
const [o, i] = r;
|
|
1369
1416
|
if (!i)
|
|
1370
1417
|
throw new Error();
|
|
1371
|
-
const
|
|
1372
|
-
if (`${
|
|
1418
|
+
const c = Number(i);
|
|
1419
|
+
if (`${c}` !== i)
|
|
1373
1420
|
throw new Error();
|
|
1374
|
-
if (
|
|
1421
|
+
if (c < 0 || c > 128)
|
|
1375
1422
|
throw new Error();
|
|
1376
1423
|
new URL(`http://[${o}]`);
|
|
1377
1424
|
} catch {
|
|
@@ -1385,7 +1432,7 @@ const Cr = {
|
|
|
1385
1432
|
}
|
|
1386
1433
|
};
|
|
1387
1434
|
});
|
|
1388
|
-
function
|
|
1435
|
+
function xt(e) {
|
|
1389
1436
|
if (e === "")
|
|
1390
1437
|
return !0;
|
|
1391
1438
|
if (e.length % 4 !== 0)
|
|
@@ -1396,11 +1443,11 @@ function Ot(e) {
|
|
|
1396
1443
|
return !1;
|
|
1397
1444
|
}
|
|
1398
1445
|
}
|
|
1399
|
-
const
|
|
1400
|
-
t.pattern ?? (t.pattern =
|
|
1446
|
+
const Mr = /* @__PURE__ */ a("$ZodBase64", (e, t) => {
|
|
1447
|
+
t.pattern ?? (t.pattern = Xn), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1401
1448
|
n._zod.bag.contentEncoding = "base64";
|
|
1402
1449
|
}), e._zod.check = (n) => {
|
|
1403
|
-
|
|
1450
|
+
xt(n.value) || n.issues.push({
|
|
1404
1451
|
code: "invalid_format",
|
|
1405
1452
|
format: "base64",
|
|
1406
1453
|
input: n.value,
|
|
@@ -1409,17 +1456,17 @@ const Qr = /* @__PURE__ */ a("$ZodBase64", (e, t) => {
|
|
|
1409
1456
|
});
|
|
1410
1457
|
};
|
|
1411
1458
|
});
|
|
1412
|
-
function
|
|
1413
|
-
if (!
|
|
1459
|
+
function Vr(e) {
|
|
1460
|
+
if (!kt.test(e))
|
|
1414
1461
|
return !1;
|
|
1415
1462
|
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
1416
|
-
return
|
|
1463
|
+
return xt(n);
|
|
1417
1464
|
}
|
|
1418
|
-
const
|
|
1419
|
-
t.pattern ?? (t.pattern =
|
|
1465
|
+
const Wr = /* @__PURE__ */ a("$ZodBase64URL", (e, t) => {
|
|
1466
|
+
t.pattern ?? (t.pattern = kt), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1420
1467
|
n._zod.bag.contentEncoding = "base64url";
|
|
1421
1468
|
}), e._zod.check = (n) => {
|
|
1422
|
-
|
|
1469
|
+
Vr(n.value) || n.issues.push({
|
|
1423
1470
|
code: "invalid_format",
|
|
1424
1471
|
format: "base64url",
|
|
1425
1472
|
input: n.value,
|
|
@@ -1427,10 +1474,10 @@ const to = /* @__PURE__ */ a("$ZodBase64URL", (e, t) => {
|
|
|
1427
1474
|
continue: !t.abort
|
|
1428
1475
|
});
|
|
1429
1476
|
};
|
|
1430
|
-
}),
|
|
1431
|
-
t.pattern ?? (t.pattern =
|
|
1477
|
+
}), Br = /* @__PURE__ */ a("$ZodE164", (e, t) => {
|
|
1478
|
+
t.pattern ?? (t.pattern = Qn), k.init(e, t);
|
|
1432
1479
|
});
|
|
1433
|
-
function
|
|
1480
|
+
function qr(e, t = null) {
|
|
1434
1481
|
try {
|
|
1435
1482
|
const n = e.split(".");
|
|
1436
1483
|
if (n.length !== 3)
|
|
@@ -1444,9 +1491,9 @@ function ro(e, t = null) {
|
|
|
1444
1491
|
return !1;
|
|
1445
1492
|
}
|
|
1446
1493
|
}
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1449
|
-
|
|
1494
|
+
const Yr = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
1495
|
+
k.init(e, t), e._zod.check = (n) => {
|
|
1496
|
+
qr(n.value, t.alg) || n.issues.push({
|
|
1450
1497
|
code: "invalid_format",
|
|
1451
1498
|
format: "jwt",
|
|
1452
1499
|
input: n.value,
|
|
@@ -1454,8 +1501,8 @@ const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
|
1454
1501
|
continue: !t.abort
|
|
1455
1502
|
});
|
|
1456
1503
|
};
|
|
1457
|
-
}),
|
|
1458
|
-
|
|
1504
|
+
}), Tt = /* @__PURE__ */ a("$ZodNumber", (e, t) => {
|
|
1505
|
+
Z.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? ir, e._zod.parse = (n, r) => {
|
|
1459
1506
|
if (t.coerce)
|
|
1460
1507
|
try {
|
|
1461
1508
|
n.value = Number(n.value);
|
|
@@ -1473,10 +1520,10 @@ const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
|
1473
1520
|
...i ? { received: i } : {}
|
|
1474
1521
|
}), n;
|
|
1475
1522
|
};
|
|
1476
|
-
}),
|
|
1477
|
-
|
|
1478
|
-
}),
|
|
1479
|
-
|
|
1523
|
+
}), Jr = /* @__PURE__ */ a("$ZodNumber", (e, t) => {
|
|
1524
|
+
lr.init(e, t), Tt.init(e, t);
|
|
1525
|
+
}), Gr = /* @__PURE__ */ a("$ZodBoolean", (e, t) => {
|
|
1526
|
+
Z.init(e, t), e._zod.pattern = cr, e._zod.parse = (n, r) => {
|
|
1480
1527
|
if (t.coerce)
|
|
1481
1528
|
try {
|
|
1482
1529
|
n.value = !!n.value;
|
|
@@ -1490,21 +1537,21 @@ const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
|
1490
1537
|
inst: e
|
|
1491
1538
|
}), n;
|
|
1492
1539
|
};
|
|
1493
|
-
}),
|
|
1494
|
-
|
|
1495
|
-
}),
|
|
1496
|
-
|
|
1540
|
+
}), Hr = /* @__PURE__ */ a("$ZodUnknown", (e, t) => {
|
|
1541
|
+
Z.init(e, t), e._zod.parse = (n) => n;
|
|
1542
|
+
}), Xr = /* @__PURE__ */ a("$ZodNever", (e, t) => {
|
|
1543
|
+
Z.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
|
|
1497
1544
|
expected: "never",
|
|
1498
1545
|
code: "invalid_type",
|
|
1499
1546
|
input: n.value,
|
|
1500
1547
|
inst: e
|
|
1501
1548
|
}), n);
|
|
1502
1549
|
});
|
|
1503
|
-
function
|
|
1504
|
-
e.issues.length && t.issues.push(
|
|
1550
|
+
function Ye(e, t, n) {
|
|
1551
|
+
e.issues.length && t.issues.push(...gt(n, e.issues)), t.value[n] = e.value;
|
|
1505
1552
|
}
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1553
|
+
const Kr = /* @__PURE__ */ a("$ZodArray", (e, t) => {
|
|
1554
|
+
Z.init(e, t), e._zod.parse = (n, r) => {
|
|
1508
1555
|
const o = n.value;
|
|
1509
1556
|
if (!Array.isArray(o))
|
|
1510
1557
|
return n.issues.push({
|
|
@@ -1515,25 +1562,25 @@ const uo = /* @__PURE__ */ a("$ZodArray", (e, t) => {
|
|
|
1515
1562
|
}), n;
|
|
1516
1563
|
n.value = Array(o.length);
|
|
1517
1564
|
const i = [];
|
|
1518
|
-
for (let
|
|
1519
|
-
const
|
|
1520
|
-
value:
|
|
1565
|
+
for (let c = 0; c < o.length; c++) {
|
|
1566
|
+
const s = o[c], f = t.element._zod.run({
|
|
1567
|
+
value: s,
|
|
1521
1568
|
issues: []
|
|
1522
1569
|
}, r);
|
|
1523
|
-
|
|
1570
|
+
f instanceof Promise ? i.push(f.then((d) => Ye(d, n, c))) : Ye(f, n, c);
|
|
1524
1571
|
}
|
|
1525
1572
|
return i.length ? Promise.all(i).then(() => n) : n;
|
|
1526
1573
|
};
|
|
1527
1574
|
});
|
|
1528
|
-
function
|
|
1529
|
-
e.issues.length && t.issues.push(
|
|
1575
|
+
function le(e, t, n, r) {
|
|
1576
|
+
e.issues.length && t.issues.push(...gt(n, e.issues)), e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
1530
1577
|
}
|
|
1531
|
-
function
|
|
1578
|
+
function At(e) {
|
|
1532
1579
|
const t = Object.keys(e.shape);
|
|
1533
1580
|
for (const r of t)
|
|
1534
1581
|
if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
|
|
1535
1582
|
throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
|
|
1536
|
-
const n =
|
|
1583
|
+
const n = pn(e.shape);
|
|
1537
1584
|
return {
|
|
1538
1585
|
...e,
|
|
1539
1586
|
keys: t,
|
|
@@ -1542,186 +1589,186 @@ function Pt(e) {
|
|
|
1542
1589
|
optionalKeys: new Set(n)
|
|
1543
1590
|
};
|
|
1544
1591
|
}
|
|
1545
|
-
function
|
|
1546
|
-
const
|
|
1547
|
-
for (const
|
|
1548
|
-
if (
|
|
1592
|
+
function jt(e, t, n, r, o, i) {
|
|
1593
|
+
const c = [], s = o.keySet, f = o.catchall._zod, d = f.def.type;
|
|
1594
|
+
for (const h of Object.keys(t)) {
|
|
1595
|
+
if (s.has(h))
|
|
1549
1596
|
continue;
|
|
1550
|
-
if (
|
|
1551
|
-
|
|
1597
|
+
if (d === "never") {
|
|
1598
|
+
c.push(h);
|
|
1552
1599
|
continue;
|
|
1553
1600
|
}
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1601
|
+
const v = f.run({ value: t[h], issues: [] }, r);
|
|
1602
|
+
v instanceof Promise ? e.push(v.then((_) => le(_, n, h, t))) : le(v, n, h, t);
|
|
1556
1603
|
}
|
|
1557
|
-
return
|
|
1604
|
+
return c.length && n.issues.push({
|
|
1558
1605
|
code: "unrecognized_keys",
|
|
1559
|
-
keys:
|
|
1606
|
+
keys: c,
|
|
1560
1607
|
input: t,
|
|
1561
1608
|
inst: i
|
|
1562
1609
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1563
1610
|
}
|
|
1564
|
-
const
|
|
1565
|
-
if (
|
|
1566
|
-
const
|
|
1611
|
+
const Qr = /* @__PURE__ */ a("$ZodObject", (e, t) => {
|
|
1612
|
+
if (Z.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1613
|
+
const s = t.shape;
|
|
1567
1614
|
Object.defineProperty(t, "shape", {
|
|
1568
1615
|
get: () => {
|
|
1569
|
-
const
|
|
1616
|
+
const f = { ...s };
|
|
1570
1617
|
return Object.defineProperty(t, "shape", {
|
|
1571
|
-
value:
|
|
1572
|
-
}),
|
|
1618
|
+
value: f
|
|
1619
|
+
}), f;
|
|
1573
1620
|
}
|
|
1574
1621
|
});
|
|
1575
1622
|
}
|
|
1576
|
-
const r =
|
|
1623
|
+
const r = xe(() => At(t));
|
|
1577
1624
|
w(e._zod, "propValues", () => {
|
|
1578
|
-
const
|
|
1579
|
-
for (const
|
|
1580
|
-
const
|
|
1581
|
-
if (
|
|
1582
|
-
d
|
|
1583
|
-
for (const
|
|
1584
|
-
d
|
|
1625
|
+
const s = t.shape, f = {};
|
|
1626
|
+
for (const d in s) {
|
|
1627
|
+
const h = s[d]._zod;
|
|
1628
|
+
if (h.values) {
|
|
1629
|
+
f[d] ?? (f[d] = /* @__PURE__ */ new Set());
|
|
1630
|
+
for (const v of h.values)
|
|
1631
|
+
f[d].add(v);
|
|
1585
1632
|
}
|
|
1586
1633
|
}
|
|
1587
|
-
return
|
|
1588
|
-
});
|
|
1589
|
-
const o =
|
|
1590
|
-
let
|
|
1591
|
-
e._zod.parse = (
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1594
|
-
if (!o(
|
|
1595
|
-
return
|
|
1634
|
+
return f;
|
|
1635
|
+
});
|
|
1636
|
+
const o = ue, i = t.catchall;
|
|
1637
|
+
let c;
|
|
1638
|
+
e._zod.parse = (s, f) => {
|
|
1639
|
+
c ?? (c = r.value);
|
|
1640
|
+
const d = s.value;
|
|
1641
|
+
if (!o(d))
|
|
1642
|
+
return s.issues.push({
|
|
1596
1643
|
expected: "object",
|
|
1597
1644
|
code: "invalid_type",
|
|
1598
|
-
input:
|
|
1645
|
+
input: d,
|
|
1599
1646
|
inst: e
|
|
1600
|
-
}),
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1603
|
-
for (const
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1647
|
+
}), s;
|
|
1648
|
+
s.value = {};
|
|
1649
|
+
const h = [], v = c.shape;
|
|
1650
|
+
for (const _ of c.keys) {
|
|
1651
|
+
const b = v[_]._zod.run({ value: d[_], issues: [] }, f);
|
|
1652
|
+
b instanceof Promise ? h.push(b.then((R) => le(R, s, _, d))) : le(b, s, _, d);
|
|
1606
1653
|
}
|
|
1607
|
-
return i ?
|
|
1654
|
+
return i ? jt(h, d, s, f, r.value, e) : h.length ? Promise.all(h).then(() => s) : s;
|
|
1608
1655
|
};
|
|
1609
|
-
}),
|
|
1610
|
-
|
|
1611
|
-
const n = e._zod.parse, r =
|
|
1612
|
-
const
|
|
1613
|
-
const
|
|
1614
|
-
return `shape[${
|
|
1656
|
+
}), eo = /* @__PURE__ */ a("$ZodObjectJIT", (e, t) => {
|
|
1657
|
+
Qr.init(e, t);
|
|
1658
|
+
const n = e._zod.parse, r = xe(() => At(t)), o = (_) => {
|
|
1659
|
+
const l = new kr(["shape", "payload", "ctx"]), b = r.value, R = (S) => {
|
|
1660
|
+
const A = Be(S);
|
|
1661
|
+
return `shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`;
|
|
1615
1662
|
};
|
|
1616
|
-
|
|
1617
|
-
const
|
|
1618
|
-
let
|
|
1619
|
-
for (const
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
for (const
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
if (${
|
|
1626
|
-
payload.issues = payload.issues.concat(${
|
|
1663
|
+
l.write("const input = payload.value;");
|
|
1664
|
+
const j = /* @__PURE__ */ Object.create(null);
|
|
1665
|
+
let U = 0;
|
|
1666
|
+
for (const S of b.keys)
|
|
1667
|
+
j[S] = `key_${U++}`;
|
|
1668
|
+
l.write("const newResult = {};");
|
|
1669
|
+
for (const S of b.keys) {
|
|
1670
|
+
const A = j[S], N = Be(S);
|
|
1671
|
+
l.write(`const ${A} = ${R(S)};`), l.write(`
|
|
1672
|
+
if (${A}.issues.length) {
|
|
1673
|
+
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
1627
1674
|
...iss,
|
|
1628
|
-
path: iss.path ? [${
|
|
1675
|
+
path: iss.path ? [${N}, ...iss.path] : [${N}]
|
|
1629
1676
|
})));
|
|
1630
1677
|
}
|
|
1631
1678
|
|
|
1632
1679
|
|
|
1633
|
-
if (${
|
|
1634
|
-
if (${
|
|
1635
|
-
newResult[${
|
|
1680
|
+
if (${A}.value === undefined) {
|
|
1681
|
+
if (${N} in input) {
|
|
1682
|
+
newResult[${N}] = undefined;
|
|
1636
1683
|
}
|
|
1637
1684
|
} else {
|
|
1638
|
-
newResult[${
|
|
1685
|
+
newResult[${N}] = ${A}.value;
|
|
1639
1686
|
}
|
|
1640
1687
|
|
|
1641
1688
|
`);
|
|
1642
1689
|
}
|
|
1643
|
-
|
|
1644
|
-
const
|
|
1645
|
-
return (
|
|
1690
|
+
l.write("payload.value = newResult;"), l.write("return payload;");
|
|
1691
|
+
const C = l.compile();
|
|
1692
|
+
return (S, A) => C(_, S, A);
|
|
1646
1693
|
};
|
|
1647
1694
|
let i;
|
|
1648
|
-
const
|
|
1649
|
-
let
|
|
1650
|
-
e._zod.parse = (
|
|
1651
|
-
|
|
1652
|
-
const
|
|
1653
|
-
return
|
|
1695
|
+
const c = ue, s = !mt.jitless, d = s && hn.value, h = t.catchall;
|
|
1696
|
+
let v;
|
|
1697
|
+
e._zod.parse = (_, l) => {
|
|
1698
|
+
v ?? (v = r.value);
|
|
1699
|
+
const b = _.value;
|
|
1700
|
+
return c(b) ? s && d && l?.async === !1 && l.jitless !== !0 ? (i || (i = o(t.shape)), _ = i(_, l), h ? jt([], b, _, l, v, e) : _) : n(_, l) : (_.issues.push({
|
|
1654
1701
|
expected: "object",
|
|
1655
1702
|
code: "invalid_type",
|
|
1656
|
-
input:
|
|
1703
|
+
input: b,
|
|
1657
1704
|
inst: e
|
|
1658
|
-
}),
|
|
1705
|
+
}), _);
|
|
1659
1706
|
};
|
|
1660
1707
|
});
|
|
1661
|
-
function
|
|
1708
|
+
function Je(e, t, n, r) {
|
|
1662
1709
|
for (const i of e)
|
|
1663
1710
|
if (i.issues.length === 0)
|
|
1664
1711
|
return t.value = i.value, t;
|
|
1665
|
-
const o = e.filter((i) => !
|
|
1712
|
+
const o = e.filter((i) => !Y(i));
|
|
1666
1713
|
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
1667
1714
|
code: "invalid_union",
|
|
1668
1715
|
input: t.value,
|
|
1669
1716
|
inst: n,
|
|
1670
|
-
errors: e.map((i) => i.issues.map((
|
|
1717
|
+
errors: e.map((i) => i.issues.map((c) => V(c, r, M())))
|
|
1671
1718
|
}), t);
|
|
1672
1719
|
}
|
|
1673
|
-
const
|
|
1674
|
-
|
|
1720
|
+
const to = /* @__PURE__ */ a("$ZodUnion", (e, t) => {
|
|
1721
|
+
Z.init(e, t), w(e._zod, "optin", () => t.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), w(e._zod, "optout", () => t.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), w(e._zod, "values", () => {
|
|
1675
1722
|
if (t.options.every((o) => o._zod.values))
|
|
1676
1723
|
return new Set(t.options.flatMap((o) => Array.from(o._zod.values)));
|
|
1677
1724
|
}), w(e._zod, "pattern", () => {
|
|
1678
1725
|
if (t.options.every((o) => o._zod.pattern)) {
|
|
1679
1726
|
const o = t.options.map((i) => i._zod.pattern);
|
|
1680
|
-
return new RegExp(`^(${o.map((i) =>
|
|
1727
|
+
return new RegExp(`^(${o.map((i) => Ae(i.source)).join("|")})$`);
|
|
1681
1728
|
}
|
|
1682
1729
|
});
|
|
1683
1730
|
const n = t.options.length === 1, r = t.options[0]._zod.run;
|
|
1684
1731
|
e._zod.parse = (o, i) => {
|
|
1685
1732
|
if (n)
|
|
1686
1733
|
return r(o, i);
|
|
1687
|
-
let
|
|
1688
|
-
const
|
|
1689
|
-
for (const
|
|
1690
|
-
const
|
|
1734
|
+
let c = !1;
|
|
1735
|
+
const s = [];
|
|
1736
|
+
for (const f of t.options) {
|
|
1737
|
+
const d = f._zod.run({
|
|
1691
1738
|
value: o.value,
|
|
1692
1739
|
issues: []
|
|
1693
1740
|
}, i);
|
|
1694
|
-
if (
|
|
1695
|
-
|
|
1741
|
+
if (d instanceof Promise)
|
|
1742
|
+
s.push(d), c = !0;
|
|
1696
1743
|
else {
|
|
1697
|
-
if (
|
|
1698
|
-
return
|
|
1699
|
-
|
|
1744
|
+
if (d.issues.length === 0)
|
|
1745
|
+
return d;
|
|
1746
|
+
s.push(d);
|
|
1700
1747
|
}
|
|
1701
1748
|
}
|
|
1702
|
-
return
|
|
1749
|
+
return c ? Promise.all(s).then((f) => Je(f, o, e, i)) : Je(s, o, e, i);
|
|
1703
1750
|
};
|
|
1704
|
-
}),
|
|
1705
|
-
|
|
1706
|
-
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r),
|
|
1707
|
-
return i instanceof Promise ||
|
|
1751
|
+
}), no = /* @__PURE__ */ a("$ZodIntersection", (e, t) => {
|
|
1752
|
+
Z.init(e, t), e._zod.parse = (n, r) => {
|
|
1753
|
+
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), c = t.right._zod.run({ value: o, issues: [] }, r);
|
|
1754
|
+
return i instanceof Promise || c instanceof Promise ? Promise.all([i, c]).then(([f, d]) => Ge(n, f, d)) : Ge(n, i, c);
|
|
1708
1755
|
};
|
|
1709
1756
|
});
|
|
1710
|
-
function
|
|
1757
|
+
function ye(e, t) {
|
|
1711
1758
|
if (e === t)
|
|
1712
1759
|
return { valid: !0, data: e };
|
|
1713
1760
|
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
1714
1761
|
return { valid: !0, data: e };
|
|
1715
|
-
if (
|
|
1762
|
+
if (X(e) && X(t)) {
|
|
1716
1763
|
const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
|
|
1717
1764
|
for (const i of r) {
|
|
1718
|
-
const
|
|
1719
|
-
if (!
|
|
1765
|
+
const c = ye(e[i], t[i]);
|
|
1766
|
+
if (!c.valid)
|
|
1720
1767
|
return {
|
|
1721
1768
|
valid: !1,
|
|
1722
|
-
mergeErrorPath: [i, ...
|
|
1769
|
+
mergeErrorPath: [i, ...c.mergeErrorPath]
|
|
1723
1770
|
};
|
|
1724
|
-
o[i] =
|
|
1771
|
+
o[i] = c.data;
|
|
1725
1772
|
}
|
|
1726
1773
|
return { valid: !0, data: o };
|
|
1727
1774
|
}
|
|
@@ -1730,94 +1777,94 @@ function xe(e, t) {
|
|
|
1730
1777
|
return { valid: !1, mergeErrorPath: [] };
|
|
1731
1778
|
const n = [];
|
|
1732
1779
|
for (let r = 0; r < e.length; r++) {
|
|
1733
|
-
const o = e[r], i = t[r],
|
|
1734
|
-
if (!
|
|
1780
|
+
const o = e[r], i = t[r], c = ye(o, i);
|
|
1781
|
+
if (!c.valid)
|
|
1735
1782
|
return {
|
|
1736
1783
|
valid: !1,
|
|
1737
|
-
mergeErrorPath: [r, ...
|
|
1784
|
+
mergeErrorPath: [r, ...c.mergeErrorPath]
|
|
1738
1785
|
};
|
|
1739
|
-
n.push(
|
|
1786
|
+
n.push(c.data);
|
|
1740
1787
|
}
|
|
1741
1788
|
return { valid: !0, data: n };
|
|
1742
1789
|
}
|
|
1743
1790
|
return { valid: !1, mergeErrorPath: [] };
|
|
1744
1791
|
}
|
|
1745
|
-
function
|
|
1746
|
-
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues),
|
|
1792
|
+
function Ge(e, t, n) {
|
|
1793
|
+
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), Y(e))
|
|
1747
1794
|
return e;
|
|
1748
|
-
const r =
|
|
1795
|
+
const r = ye(t.value, n.value);
|
|
1749
1796
|
if (!r.valid)
|
|
1750
1797
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
|
|
1751
1798
|
return e.value = r.data, e;
|
|
1752
1799
|
}
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1755
|
-
const n =
|
|
1756
|
-
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) =>
|
|
1757
|
-
const
|
|
1758
|
-
return r.has(
|
|
1800
|
+
const ro = /* @__PURE__ */ a("$ZodEnum", (e, t) => {
|
|
1801
|
+
Z.init(e, t);
|
|
1802
|
+
const n = dn(t.entries), r = new Set(n);
|
|
1803
|
+
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => mn.has(typeof o)).map((o) => typeof o == "string" ? fe(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
1804
|
+
const c = o.value;
|
|
1805
|
+
return r.has(c) || o.issues.push({
|
|
1759
1806
|
code: "invalid_value",
|
|
1760
1807
|
values: n,
|
|
1761
|
-
input:
|
|
1808
|
+
input: c,
|
|
1762
1809
|
inst: e
|
|
1763
1810
|
}), o;
|
|
1764
1811
|
};
|
|
1765
|
-
}),
|
|
1766
|
-
|
|
1812
|
+
}), oo = /* @__PURE__ */ a("$ZodTransform", (e, t) => {
|
|
1813
|
+
Z.init(e, t), e._zod.parse = (n, r) => {
|
|
1767
1814
|
if (r.direction === "backward")
|
|
1768
|
-
throw new
|
|
1815
|
+
throw new ht(e.constructor.name);
|
|
1769
1816
|
const o = t.transform(n.value, n);
|
|
1770
1817
|
if (r.async)
|
|
1771
|
-
return (o instanceof Promise ? o : Promise.resolve(o)).then((
|
|
1818
|
+
return (o instanceof Promise ? o : Promise.resolve(o)).then((c) => (n.value = c, n));
|
|
1772
1819
|
if (o instanceof Promise)
|
|
1773
|
-
throw new
|
|
1820
|
+
throw new J();
|
|
1774
1821
|
return n.value = o, n;
|
|
1775
1822
|
};
|
|
1776
1823
|
});
|
|
1777
|
-
function
|
|
1824
|
+
function He(e, t) {
|
|
1778
1825
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
1779
1826
|
}
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1827
|
+
const io = /* @__PURE__ */ a("$ZodOptional", (e, t) => {
|
|
1828
|
+
Z.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", w(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), w(e._zod, "pattern", () => {
|
|
1782
1829
|
const n = t.innerType._zod.pattern;
|
|
1783
|
-
return n ? new RegExp(`^(${
|
|
1830
|
+
return n ? new RegExp(`^(${Ae(n.source)})?$`) : void 0;
|
|
1784
1831
|
}), e._zod.parse = (n, r) => {
|
|
1785
1832
|
if (t.innerType._zod.optin === "optional") {
|
|
1786
1833
|
const o = t.innerType._zod.run(n, r);
|
|
1787
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1834
|
+
return o instanceof Promise ? o.then((i) => He(i, n.value)) : He(o, n.value);
|
|
1788
1835
|
}
|
|
1789
1836
|
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
1790
1837
|
};
|
|
1791
|
-
}),
|
|
1792
|
-
|
|
1838
|
+
}), co = /* @__PURE__ */ a("$ZodNullable", (e, t) => {
|
|
1839
|
+
Z.init(e, t), w(e._zod, "optin", () => t.innerType._zod.optin), w(e._zod, "optout", () => t.innerType._zod.optout), w(e._zod, "pattern", () => {
|
|
1793
1840
|
const n = t.innerType._zod.pattern;
|
|
1794
|
-
return n ? new RegExp(`^(${
|
|
1841
|
+
return n ? new RegExp(`^(${Ae(n.source)}|null)$`) : void 0;
|
|
1795
1842
|
}), w(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, r) => n.value === null ? n : t.innerType._zod.run(n, r);
|
|
1796
|
-
}),
|
|
1797
|
-
|
|
1843
|
+
}), so = /* @__PURE__ */ a("$ZodDefault", (e, t) => {
|
|
1844
|
+
Z.init(e, t), e._zod.optin = "optional", w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
1798
1845
|
if (r.direction === "backward")
|
|
1799
1846
|
return t.innerType._zod.run(n, r);
|
|
1800
1847
|
if (n.value === void 0)
|
|
1801
1848
|
return n.value = t.defaultValue, n;
|
|
1802
1849
|
const o = t.innerType._zod.run(n, r);
|
|
1803
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1850
|
+
return o instanceof Promise ? o.then((i) => Xe(i, t)) : Xe(o, t);
|
|
1804
1851
|
};
|
|
1805
1852
|
});
|
|
1806
|
-
function
|
|
1853
|
+
function Xe(e, t) {
|
|
1807
1854
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
1808
1855
|
}
|
|
1809
|
-
const
|
|
1810
|
-
|
|
1811
|
-
}),
|
|
1812
|
-
|
|
1856
|
+
const ao = /* @__PURE__ */ a("$ZodPrefault", (e, t) => {
|
|
1857
|
+
Z.init(e, t), e._zod.optin = "optional", w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => (r.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, r));
|
|
1858
|
+
}), uo = /* @__PURE__ */ a("$ZodNonOptional", (e, t) => {
|
|
1859
|
+
Z.init(e, t), w(e._zod, "values", () => {
|
|
1813
1860
|
const n = t.innerType._zod.values;
|
|
1814
1861
|
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
1815
1862
|
}), e._zod.parse = (n, r) => {
|
|
1816
1863
|
const o = t.innerType._zod.run(n, r);
|
|
1817
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1864
|
+
return o instanceof Promise ? o.then((i) => Ke(i, e)) : Ke(o, e);
|
|
1818
1865
|
};
|
|
1819
1866
|
});
|
|
1820
|
-
function
|
|
1867
|
+
function Ke(e, t) {
|
|
1821
1868
|
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
1822
1869
|
code: "invalid_type",
|
|
1823
1870
|
expected: "nonoptional",
|
|
@@ -1825,15 +1872,15 @@ function nt(e, t) {
|
|
|
1825
1872
|
inst: t
|
|
1826
1873
|
}), e;
|
|
1827
1874
|
}
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1875
|
+
const lo = /* @__PURE__ */ a("$ZodCatch", (e, t) => {
|
|
1876
|
+
Z.init(e, t), w(e._zod, "optin", () => t.innerType._zod.optin), w(e._zod, "optout", () => t.innerType._zod.optout), w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
1830
1877
|
if (r.direction === "backward")
|
|
1831
1878
|
return t.innerType._zod.run(n, r);
|
|
1832
1879
|
const o = t.innerType._zod.run(n, r);
|
|
1833
1880
|
return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
1834
1881
|
...n,
|
|
1835
1882
|
error: {
|
|
1836
|
-
issues: i.issues.map((
|
|
1883
|
+
issues: i.issues.map((c) => V(c, r, M()))
|
|
1837
1884
|
},
|
|
1838
1885
|
input: n.value
|
|
1839
1886
|
}), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
|
|
@@ -1844,39 +1891,39 @@ const zo = /* @__PURE__ */ a("$ZodCatch", (e, t) => {
|
|
|
1844
1891
|
input: n.value
|
|
1845
1892
|
}), n.issues = []), n);
|
|
1846
1893
|
};
|
|
1847
|
-
}),
|
|
1848
|
-
|
|
1894
|
+
}), fo = /* @__PURE__ */ a("$ZodPipe", (e, t) => {
|
|
1895
|
+
Z.init(e, t), w(e._zod, "values", () => t.in._zod.values), w(e._zod, "optin", () => t.in._zod.optin), w(e._zod, "optout", () => t.out._zod.optout), w(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
|
|
1849
1896
|
if (r.direction === "backward") {
|
|
1850
1897
|
const i = t.out._zod.run(n, r);
|
|
1851
|
-
return i instanceof Promise ? i.then((
|
|
1898
|
+
return i instanceof Promise ? i.then((c) => oe(c, t.in, r)) : oe(i, t.in, r);
|
|
1852
1899
|
}
|
|
1853
1900
|
const o = t.in._zod.run(n, r);
|
|
1854
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1901
|
+
return o instanceof Promise ? o.then((i) => oe(i, t.out, r)) : oe(o, t.out, r);
|
|
1855
1902
|
};
|
|
1856
1903
|
});
|
|
1857
|
-
function
|
|
1904
|
+
function oe(e, t, n) {
|
|
1858
1905
|
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
1859
1906
|
}
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1907
|
+
const ho = /* @__PURE__ */ a("$ZodReadonly", (e, t) => {
|
|
1908
|
+
Z.init(e, t), w(e._zod, "propValues", () => t.innerType._zod.propValues), w(e._zod, "values", () => t.innerType._zod.values), w(e._zod, "optin", () => t.innerType._zod.optin), w(e._zod, "optout", () => t.innerType._zod.optout), e._zod.parse = (n, r) => {
|
|
1862
1909
|
if (r.direction === "backward")
|
|
1863
1910
|
return t.innerType._zod.run(n, r);
|
|
1864
1911
|
const o = t.innerType._zod.run(n, r);
|
|
1865
|
-
return o instanceof Promise ? o.then(
|
|
1912
|
+
return o instanceof Promise ? o.then(Qe) : Qe(o);
|
|
1866
1913
|
};
|
|
1867
1914
|
});
|
|
1868
|
-
function
|
|
1915
|
+
function Qe(e) {
|
|
1869
1916
|
return e.value = Object.freeze(e.value), e;
|
|
1870
1917
|
}
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1918
|
+
const mo = /* @__PURE__ */ a("$ZodCustom", (e, t) => {
|
|
1919
|
+
I.init(e, t), Z.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
|
|
1873
1920
|
const r = n.value, o = t.fn(r);
|
|
1874
1921
|
if (o instanceof Promise)
|
|
1875
|
-
return o.then((i) =>
|
|
1876
|
-
|
|
1922
|
+
return o.then((i) => et(i, n, r, e));
|
|
1923
|
+
et(o, n, r, e);
|
|
1877
1924
|
};
|
|
1878
1925
|
});
|
|
1879
|
-
function
|
|
1926
|
+
function et(e, t, n, r) {
|
|
1880
1927
|
if (!e) {
|
|
1881
1928
|
const o = {
|
|
1882
1929
|
code: "custom",
|
|
@@ -1888,10 +1935,10 @@ function ot(e, t, n, r) {
|
|
|
1888
1935
|
continue: !r._zod.def.abort
|
|
1889
1936
|
// params: inst._zod.def.params,
|
|
1890
1937
|
};
|
|
1891
|
-
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(
|
|
1938
|
+
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(K(o));
|
|
1892
1939
|
}
|
|
1893
1940
|
}
|
|
1894
|
-
class
|
|
1941
|
+
class po {
|
|
1895
1942
|
constructor() {
|
|
1896
1943
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
1897
1944
|
}
|
|
@@ -1925,17 +1972,17 @@ class Eo {
|
|
|
1925
1972
|
return this._map.has(t);
|
|
1926
1973
|
}
|
|
1927
1974
|
}
|
|
1928
|
-
function
|
|
1929
|
-
return new
|
|
1975
|
+
function _o() {
|
|
1976
|
+
return new po();
|
|
1930
1977
|
}
|
|
1931
|
-
const
|
|
1932
|
-
function
|
|
1978
|
+
const ie = /* @__PURE__ */ _o();
|
|
1979
|
+
function go(e, t) {
|
|
1933
1980
|
return new e({
|
|
1934
1981
|
type: "string",
|
|
1935
1982
|
...m(t)
|
|
1936
1983
|
});
|
|
1937
1984
|
}
|
|
1938
|
-
function
|
|
1985
|
+
function vo(e, t) {
|
|
1939
1986
|
return new e({
|
|
1940
1987
|
type: "string",
|
|
1941
1988
|
format: "email",
|
|
@@ -1944,7 +1991,7 @@ function So(e, t) {
|
|
|
1944
1991
|
...m(t)
|
|
1945
1992
|
});
|
|
1946
1993
|
}
|
|
1947
|
-
function
|
|
1994
|
+
function tt(e, t) {
|
|
1948
1995
|
return new e({
|
|
1949
1996
|
type: "string",
|
|
1950
1997
|
format: "guid",
|
|
@@ -1953,7 +2000,7 @@ function it(e, t) {
|
|
|
1953
2000
|
...m(t)
|
|
1954
2001
|
});
|
|
1955
2002
|
}
|
|
1956
|
-
function
|
|
2003
|
+
function bo(e, t) {
|
|
1957
2004
|
return new e({
|
|
1958
2005
|
type: "string",
|
|
1959
2006
|
format: "uuid",
|
|
@@ -1962,7 +2009,7 @@ function Io(e, t) {
|
|
|
1962
2009
|
...m(t)
|
|
1963
2010
|
});
|
|
1964
2011
|
}
|
|
1965
|
-
function
|
|
2012
|
+
function wo(e, t) {
|
|
1966
2013
|
return new e({
|
|
1967
2014
|
type: "string",
|
|
1968
2015
|
format: "uuid",
|
|
@@ -1972,7 +2019,7 @@ function jo(e, t) {
|
|
|
1972
2019
|
...m(t)
|
|
1973
2020
|
});
|
|
1974
2021
|
}
|
|
1975
|
-
function
|
|
2022
|
+
function ko(e, t) {
|
|
1976
2023
|
return new e({
|
|
1977
2024
|
type: "string",
|
|
1978
2025
|
format: "uuid",
|
|
@@ -1982,7 +2029,7 @@ function Ao(e, t) {
|
|
|
1982
2029
|
...m(t)
|
|
1983
2030
|
});
|
|
1984
2031
|
}
|
|
1985
|
-
function
|
|
2032
|
+
function zo(e, t) {
|
|
1986
2033
|
return new e({
|
|
1987
2034
|
type: "string",
|
|
1988
2035
|
format: "uuid",
|
|
@@ -1992,7 +2039,7 @@ function Co(e, t) {
|
|
|
1992
2039
|
...m(t)
|
|
1993
2040
|
});
|
|
1994
2041
|
}
|
|
1995
|
-
function
|
|
2042
|
+
function yo(e, t) {
|
|
1996
2043
|
return new e({
|
|
1997
2044
|
type: "string",
|
|
1998
2045
|
format: "url",
|
|
@@ -2001,7 +2048,7 @@ function Oo(e, t) {
|
|
|
2001
2048
|
...m(t)
|
|
2002
2049
|
});
|
|
2003
2050
|
}
|
|
2004
|
-
function
|
|
2051
|
+
function $o(e, t) {
|
|
2005
2052
|
return new e({
|
|
2006
2053
|
type: "string",
|
|
2007
2054
|
format: "emoji",
|
|
@@ -2010,7 +2057,7 @@ function Ro(e, t) {
|
|
|
2010
2057
|
...m(t)
|
|
2011
2058
|
});
|
|
2012
2059
|
}
|
|
2013
|
-
function
|
|
2060
|
+
function Zo(e, t) {
|
|
2014
2061
|
return new e({
|
|
2015
2062
|
type: "string",
|
|
2016
2063
|
format: "nanoid",
|
|
@@ -2019,7 +2066,7 @@ function Po(e, t) {
|
|
|
2019
2066
|
...m(t)
|
|
2020
2067
|
});
|
|
2021
2068
|
}
|
|
2022
|
-
function
|
|
2069
|
+
function Eo(e, t) {
|
|
2023
2070
|
return new e({
|
|
2024
2071
|
type: "string",
|
|
2025
2072
|
format: "cuid",
|
|
@@ -2028,7 +2075,7 @@ function No(e, t) {
|
|
|
2028
2075
|
...m(t)
|
|
2029
2076
|
});
|
|
2030
2077
|
}
|
|
2031
|
-
function
|
|
2078
|
+
function xo(e, t) {
|
|
2032
2079
|
return new e({
|
|
2033
2080
|
type: "string",
|
|
2034
2081
|
format: "cuid2",
|
|
@@ -2037,7 +2084,7 @@ function Do(e, t) {
|
|
|
2037
2084
|
...m(t)
|
|
2038
2085
|
});
|
|
2039
2086
|
}
|
|
2040
|
-
function
|
|
2087
|
+
function To(e, t) {
|
|
2041
2088
|
return new e({
|
|
2042
2089
|
type: "string",
|
|
2043
2090
|
format: "ulid",
|
|
@@ -2046,7 +2093,7 @@ function Uo(e, t) {
|
|
|
2046
2093
|
...m(t)
|
|
2047
2094
|
});
|
|
2048
2095
|
}
|
|
2049
|
-
function
|
|
2096
|
+
function Ao(e, t) {
|
|
2050
2097
|
return new e({
|
|
2051
2098
|
type: "string",
|
|
2052
2099
|
format: "xid",
|
|
@@ -2055,7 +2102,7 @@ function Fo(e, t) {
|
|
|
2055
2102
|
...m(t)
|
|
2056
2103
|
});
|
|
2057
2104
|
}
|
|
2058
|
-
function
|
|
2105
|
+
function jo(e, t) {
|
|
2059
2106
|
return new e({
|
|
2060
2107
|
type: "string",
|
|
2061
2108
|
format: "ksuid",
|
|
@@ -2064,7 +2111,7 @@ function Lo(e, t) {
|
|
|
2064
2111
|
...m(t)
|
|
2065
2112
|
});
|
|
2066
2113
|
}
|
|
2067
|
-
function
|
|
2114
|
+
function Io(e, t) {
|
|
2068
2115
|
return new e({
|
|
2069
2116
|
type: "string",
|
|
2070
2117
|
format: "ipv4",
|
|
@@ -2073,7 +2120,7 @@ function Mo(e, t) {
|
|
|
2073
2120
|
...m(t)
|
|
2074
2121
|
});
|
|
2075
2122
|
}
|
|
2076
|
-
function
|
|
2123
|
+
function Co(e, t) {
|
|
2077
2124
|
return new e({
|
|
2078
2125
|
type: "string",
|
|
2079
2126
|
format: "ipv6",
|
|
@@ -2082,7 +2129,7 @@ function Vo(e, t) {
|
|
|
2082
2129
|
...m(t)
|
|
2083
2130
|
});
|
|
2084
2131
|
}
|
|
2085
|
-
function
|
|
2132
|
+
function So(e, t) {
|
|
2086
2133
|
return new e({
|
|
2087
2134
|
type: "string",
|
|
2088
2135
|
format: "cidrv4",
|
|
@@ -2091,7 +2138,7 @@ function Wo(e, t) {
|
|
|
2091
2138
|
...m(t)
|
|
2092
2139
|
});
|
|
2093
2140
|
}
|
|
2094
|
-
function
|
|
2141
|
+
function Oo(e, t) {
|
|
2095
2142
|
return new e({
|
|
2096
2143
|
type: "string",
|
|
2097
2144
|
format: "cidrv6",
|
|
@@ -2100,7 +2147,7 @@ function Bo(e, t) {
|
|
|
2100
2147
|
...m(t)
|
|
2101
2148
|
});
|
|
2102
2149
|
}
|
|
2103
|
-
function
|
|
2150
|
+
function Ro(e, t) {
|
|
2104
2151
|
return new e({
|
|
2105
2152
|
type: "string",
|
|
2106
2153
|
format: "base64",
|
|
@@ -2109,7 +2156,7 @@ function Yo(e, t) {
|
|
|
2109
2156
|
...m(t)
|
|
2110
2157
|
});
|
|
2111
2158
|
}
|
|
2112
|
-
function
|
|
2159
|
+
function Po(e, t) {
|
|
2113
2160
|
return new e({
|
|
2114
2161
|
type: "string",
|
|
2115
2162
|
format: "base64url",
|
|
@@ -2118,7 +2165,7 @@ function Ho(e, t) {
|
|
|
2118
2165
|
...m(t)
|
|
2119
2166
|
});
|
|
2120
2167
|
}
|
|
2121
|
-
function
|
|
2168
|
+
function No(e, t) {
|
|
2122
2169
|
return new e({
|
|
2123
2170
|
type: "string",
|
|
2124
2171
|
format: "e164",
|
|
@@ -2127,7 +2174,7 @@ function Jo(e, t) {
|
|
|
2127
2174
|
...m(t)
|
|
2128
2175
|
});
|
|
2129
2176
|
}
|
|
2130
|
-
function
|
|
2177
|
+
function Do(e, t) {
|
|
2131
2178
|
return new e({
|
|
2132
2179
|
type: "string",
|
|
2133
2180
|
format: "jwt",
|
|
@@ -2136,7 +2183,7 @@ function Go(e, t) {
|
|
|
2136
2183
|
...m(t)
|
|
2137
2184
|
});
|
|
2138
2185
|
}
|
|
2139
|
-
function
|
|
2186
|
+
function Uo(e, t) {
|
|
2140
2187
|
return new e({
|
|
2141
2188
|
type: "string",
|
|
2142
2189
|
format: "datetime",
|
|
@@ -2147,7 +2194,7 @@ function qo(e, t) {
|
|
|
2147
2194
|
...m(t)
|
|
2148
2195
|
});
|
|
2149
2196
|
}
|
|
2150
|
-
function
|
|
2197
|
+
function Lo(e, t) {
|
|
2151
2198
|
return new e({
|
|
2152
2199
|
type: "string",
|
|
2153
2200
|
format: "date",
|
|
@@ -2155,7 +2202,7 @@ function Xo(e, t) {
|
|
|
2155
2202
|
...m(t)
|
|
2156
2203
|
});
|
|
2157
2204
|
}
|
|
2158
|
-
function
|
|
2205
|
+
function Fo(e, t) {
|
|
2159
2206
|
return new e({
|
|
2160
2207
|
type: "string",
|
|
2161
2208
|
format: "time",
|
|
@@ -2164,7 +2211,7 @@ function Ko(e, t) {
|
|
|
2164
2211
|
...m(t)
|
|
2165
2212
|
});
|
|
2166
2213
|
}
|
|
2167
|
-
function
|
|
2214
|
+
function Mo(e, t) {
|
|
2168
2215
|
return new e({
|
|
2169
2216
|
type: "string",
|
|
2170
2217
|
format: "duration",
|
|
@@ -2172,14 +2219,14 @@ function Qo(e, t) {
|
|
|
2172
2219
|
...m(t)
|
|
2173
2220
|
});
|
|
2174
2221
|
}
|
|
2175
|
-
function
|
|
2222
|
+
function Vo(e, t) {
|
|
2176
2223
|
return new e({
|
|
2177
2224
|
type: "number",
|
|
2178
2225
|
checks: [],
|
|
2179
2226
|
...m(t)
|
|
2180
2227
|
});
|
|
2181
2228
|
}
|
|
2182
|
-
function
|
|
2229
|
+
function Wo(e, t) {
|
|
2183
2230
|
return new e({
|
|
2184
2231
|
type: "number",
|
|
2185
2232
|
check: "number_format",
|
|
@@ -2188,148 +2235,148 @@ function ti(e, t) {
|
|
|
2188
2235
|
...m(t)
|
|
2189
2236
|
});
|
|
2190
2237
|
}
|
|
2191
|
-
function
|
|
2238
|
+
function Bo(e, t) {
|
|
2192
2239
|
return new e({
|
|
2193
2240
|
type: "boolean",
|
|
2194
2241
|
...m(t)
|
|
2195
2242
|
});
|
|
2196
2243
|
}
|
|
2197
|
-
function
|
|
2244
|
+
function qo(e) {
|
|
2198
2245
|
return new e({
|
|
2199
2246
|
type: "unknown"
|
|
2200
2247
|
});
|
|
2201
2248
|
}
|
|
2202
|
-
function
|
|
2249
|
+
function Yo(e, t) {
|
|
2203
2250
|
return new e({
|
|
2204
2251
|
type: "never",
|
|
2205
2252
|
...m(t)
|
|
2206
2253
|
});
|
|
2207
2254
|
}
|
|
2208
|
-
function
|
|
2209
|
-
return new
|
|
2255
|
+
function nt(e, t) {
|
|
2256
|
+
return new Zt({
|
|
2210
2257
|
check: "less_than",
|
|
2211
2258
|
...m(t),
|
|
2212
2259
|
value: e,
|
|
2213
2260
|
inclusive: !1
|
|
2214
2261
|
});
|
|
2215
2262
|
}
|
|
2216
|
-
function
|
|
2217
|
-
return new
|
|
2263
|
+
function we(e, t) {
|
|
2264
|
+
return new Zt({
|
|
2218
2265
|
check: "less_than",
|
|
2219
2266
|
...m(t),
|
|
2220
2267
|
value: e,
|
|
2221
2268
|
inclusive: !0
|
|
2222
2269
|
});
|
|
2223
2270
|
}
|
|
2224
|
-
function
|
|
2225
|
-
return new
|
|
2271
|
+
function rt(e, t) {
|
|
2272
|
+
return new Et({
|
|
2226
2273
|
check: "greater_than",
|
|
2227
2274
|
...m(t),
|
|
2228
2275
|
value: e,
|
|
2229
2276
|
inclusive: !1
|
|
2230
2277
|
});
|
|
2231
2278
|
}
|
|
2232
|
-
function
|
|
2233
|
-
return new
|
|
2279
|
+
function ke(e, t) {
|
|
2280
|
+
return new Et({
|
|
2234
2281
|
check: "greater_than",
|
|
2235
2282
|
...m(t),
|
|
2236
2283
|
value: e,
|
|
2237
2284
|
inclusive: !0
|
|
2238
2285
|
});
|
|
2239
2286
|
}
|
|
2240
|
-
function
|
|
2241
|
-
return new
|
|
2287
|
+
function ot(e, t) {
|
|
2288
|
+
return new ur({
|
|
2242
2289
|
check: "multiple_of",
|
|
2243
2290
|
...m(t),
|
|
2244
2291
|
value: e
|
|
2245
2292
|
});
|
|
2246
2293
|
}
|
|
2247
|
-
function
|
|
2248
|
-
return new
|
|
2294
|
+
function It(e, t) {
|
|
2295
|
+
return new dr({
|
|
2249
2296
|
check: "max_length",
|
|
2250
2297
|
...m(t),
|
|
2251
2298
|
maximum: e
|
|
2252
2299
|
});
|
|
2253
2300
|
}
|
|
2254
|
-
function
|
|
2255
|
-
return new
|
|
2301
|
+
function de(e, t) {
|
|
2302
|
+
return new fr({
|
|
2256
2303
|
check: "min_length",
|
|
2257
2304
|
...m(t),
|
|
2258
2305
|
minimum: e
|
|
2259
2306
|
});
|
|
2260
2307
|
}
|
|
2261
|
-
function
|
|
2262
|
-
return new
|
|
2308
|
+
function Ct(e, t) {
|
|
2309
|
+
return new hr({
|
|
2263
2310
|
check: "length_equals",
|
|
2264
2311
|
...m(t),
|
|
2265
2312
|
length: e
|
|
2266
2313
|
});
|
|
2267
2314
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return new
|
|
2315
|
+
function Jo(e, t) {
|
|
2316
|
+
return new mr({
|
|
2270
2317
|
check: "string_format",
|
|
2271
2318
|
format: "regex",
|
|
2272
2319
|
...m(t),
|
|
2273
2320
|
pattern: e
|
|
2274
2321
|
});
|
|
2275
2322
|
}
|
|
2276
|
-
function
|
|
2277
|
-
return new
|
|
2323
|
+
function Go(e) {
|
|
2324
|
+
return new pr({
|
|
2278
2325
|
check: "string_format",
|
|
2279
2326
|
format: "lowercase",
|
|
2280
2327
|
...m(e)
|
|
2281
2328
|
});
|
|
2282
2329
|
}
|
|
2283
|
-
function
|
|
2284
|
-
return new
|
|
2330
|
+
function Ho(e) {
|
|
2331
|
+
return new _r({
|
|
2285
2332
|
check: "string_format",
|
|
2286
2333
|
format: "uppercase",
|
|
2287
2334
|
...m(e)
|
|
2288
2335
|
});
|
|
2289
2336
|
}
|
|
2290
|
-
function
|
|
2291
|
-
return new
|
|
2337
|
+
function Xo(e, t) {
|
|
2338
|
+
return new gr({
|
|
2292
2339
|
check: "string_format",
|
|
2293
2340
|
format: "includes",
|
|
2294
2341
|
...m(t),
|
|
2295
2342
|
includes: e
|
|
2296
2343
|
});
|
|
2297
2344
|
}
|
|
2298
|
-
function
|
|
2299
|
-
return new
|
|
2345
|
+
function Ko(e, t) {
|
|
2346
|
+
return new vr({
|
|
2300
2347
|
check: "string_format",
|
|
2301
2348
|
format: "starts_with",
|
|
2302
2349
|
...m(t),
|
|
2303
2350
|
prefix: e
|
|
2304
2351
|
});
|
|
2305
2352
|
}
|
|
2306
|
-
function
|
|
2307
|
-
return new
|
|
2353
|
+
function Qo(e, t) {
|
|
2354
|
+
return new br({
|
|
2308
2355
|
check: "string_format",
|
|
2309
2356
|
format: "ends_with",
|
|
2310
2357
|
...m(t),
|
|
2311
2358
|
suffix: e
|
|
2312
2359
|
});
|
|
2313
2360
|
}
|
|
2314
|
-
function
|
|
2315
|
-
return new
|
|
2361
|
+
function Q(e) {
|
|
2362
|
+
return new wr({
|
|
2316
2363
|
check: "overwrite",
|
|
2317
2364
|
tx: e
|
|
2318
2365
|
});
|
|
2319
2366
|
}
|
|
2320
|
-
function
|
|
2321
|
-
return
|
|
2367
|
+
function ei(e) {
|
|
2368
|
+
return Q((t) => t.normalize(e));
|
|
2322
2369
|
}
|
|
2323
|
-
function
|
|
2324
|
-
return
|
|
2370
|
+
function ti() {
|
|
2371
|
+
return Q((e) => e.trim());
|
|
2325
2372
|
}
|
|
2326
|
-
function
|
|
2327
|
-
return
|
|
2373
|
+
function ni() {
|
|
2374
|
+
return Q((e) => e.toLowerCase());
|
|
2328
2375
|
}
|
|
2329
|
-
function
|
|
2330
|
-
return
|
|
2376
|
+
function ri() {
|
|
2377
|
+
return Q((e) => e.toUpperCase());
|
|
2331
2378
|
}
|
|
2332
|
-
function
|
|
2379
|
+
function oi(e, t, n) {
|
|
2333
2380
|
return new e({
|
|
2334
2381
|
type: "array",
|
|
2335
2382
|
element: t,
|
|
@@ -2339,7 +2386,7 @@ function pi(e, t, n) {
|
|
|
2339
2386
|
...m(n)
|
|
2340
2387
|
});
|
|
2341
2388
|
}
|
|
2342
|
-
function
|
|
2389
|
+
function ii(e, t, n) {
|
|
2343
2390
|
return new e({
|
|
2344
2391
|
type: "custom",
|
|
2345
2392
|
check: "custom",
|
|
@@ -2347,67 +2394,67 @@ function gi(e, t, n) {
|
|
|
2347
2394
|
...m(n)
|
|
2348
2395
|
});
|
|
2349
2396
|
}
|
|
2350
|
-
function
|
|
2351
|
-
const t =
|
|
2397
|
+
function ci(e) {
|
|
2398
|
+
const t = si((n) => (n.addIssue = (r) => {
|
|
2352
2399
|
if (typeof r == "string")
|
|
2353
|
-
n.issues.push(
|
|
2400
|
+
n.issues.push(K(r, n.value, t._zod.def));
|
|
2354
2401
|
else {
|
|
2355
2402
|
const o = r;
|
|
2356
|
-
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(
|
|
2403
|
+
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(K(o));
|
|
2357
2404
|
}
|
|
2358
2405
|
}, e(n.value, n)));
|
|
2359
2406
|
return t;
|
|
2360
2407
|
}
|
|
2361
|
-
function
|
|
2362
|
-
const n = new
|
|
2408
|
+
function si(e, t) {
|
|
2409
|
+
const n = new I({
|
|
2363
2410
|
check: "custom",
|
|
2364
2411
|
...m(t)
|
|
2365
2412
|
});
|
|
2366
2413
|
return n._zod.check = e, n;
|
|
2367
2414
|
}
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2415
|
+
const ai = /* @__PURE__ */ a("ZodISODateTime", (e, t) => {
|
|
2416
|
+
Or.init(e, t), z.init(e, t);
|
|
2370
2417
|
});
|
|
2371
|
-
function
|
|
2372
|
-
return
|
|
2418
|
+
function ui(e) {
|
|
2419
|
+
return Uo(ai, e);
|
|
2373
2420
|
}
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2421
|
+
const li = /* @__PURE__ */ a("ZodISODate", (e, t) => {
|
|
2422
|
+
Rr.init(e, t), z.init(e, t);
|
|
2376
2423
|
});
|
|
2377
|
-
function
|
|
2378
|
-
return
|
|
2424
|
+
function di(e) {
|
|
2425
|
+
return Lo(li, e);
|
|
2379
2426
|
}
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2427
|
+
const fi = /* @__PURE__ */ a("ZodISOTime", (e, t) => {
|
|
2428
|
+
Pr.init(e, t), z.init(e, t);
|
|
2382
2429
|
});
|
|
2383
|
-
function
|
|
2384
|
-
return
|
|
2430
|
+
function hi(e) {
|
|
2431
|
+
return Fo(fi, e);
|
|
2385
2432
|
}
|
|
2386
|
-
const
|
|
2387
|
-
|
|
2433
|
+
const mi = /* @__PURE__ */ a("ZodISODuration", (e, t) => {
|
|
2434
|
+
Nr.init(e, t), z.init(e, t);
|
|
2388
2435
|
});
|
|
2389
|
-
function
|
|
2390
|
-
return
|
|
2436
|
+
function pi(e) {
|
|
2437
|
+
return Mo(mi, e);
|
|
2391
2438
|
}
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2439
|
+
const _i = (e, t) => {
|
|
2440
|
+
bt.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2394
2441
|
format: {
|
|
2395
|
-
value: (n) =>
|
|
2442
|
+
value: (n) => Zn(e, n)
|
|
2396
2443
|
// enumerable: false,
|
|
2397
2444
|
},
|
|
2398
2445
|
flatten: {
|
|
2399
|
-
value: (n) =>
|
|
2446
|
+
value: (n) => $n(e, n)
|
|
2400
2447
|
// enumerable: false,
|
|
2401
2448
|
},
|
|
2402
2449
|
addIssue: {
|
|
2403
2450
|
value: (n) => {
|
|
2404
|
-
e.issues.push(n), e.message = JSON.stringify(e.issues,
|
|
2451
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, ze, 2);
|
|
2405
2452
|
}
|
|
2406
2453
|
// enumerable: false,
|
|
2407
2454
|
},
|
|
2408
2455
|
addIssues: {
|
|
2409
2456
|
value: (n) => {
|
|
2410
|
-
e.issues.push(...n), e.message = JSON.stringify(e.issues,
|
|
2457
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, ze, 2);
|
|
2411
2458
|
}
|
|
2412
2459
|
// enumerable: false,
|
|
2413
2460
|
},
|
|
@@ -2418,156 +2465,156 @@ const xi = (e, t) => {
|
|
|
2418
2465
|
// enumerable: false,
|
|
2419
2466
|
}
|
|
2420
2467
|
});
|
|
2421
|
-
},
|
|
2468
|
+
}, O = a("ZodError", _i, {
|
|
2422
2469
|
Parent: Error
|
|
2423
|
-
}),
|
|
2470
|
+
}), gi = /* @__PURE__ */ Ie(O), vi = /* @__PURE__ */ Ce(O), bi = /* @__PURE__ */ he(O), wi = /* @__PURE__ */ me(O), ki = /* @__PURE__ */ Tn(O), zi = /* @__PURE__ */ An(O), yi = /* @__PURE__ */ jn(O), $i = /* @__PURE__ */ In(O), Zi = /* @__PURE__ */ Cn(O), Ei = /* @__PURE__ */ Sn(O), xi = /* @__PURE__ */ On(O), Ti = /* @__PURE__ */ Rn(O), E = /* @__PURE__ */ a("ZodType", (e, t) => (Z.init(e, t), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(B(t, {
|
|
2424
2471
|
checks: [
|
|
2425
2472
|
...t.checks ?? [],
|
|
2426
2473
|
...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
|
|
2427
2474
|
]
|
|
2428
|
-
})), e.clone = (n, r) => L(e, n, r), e.brand = () => e, e.register = ((n, r) => (n.add(e, r), e)), e.parse = (n, r) =>
|
|
2475
|
+
})), e.clone = (n, r) => L(e, n, r), e.brand = () => e, e.register = ((n, r) => (n.add(e, r), e)), e.parse = (n, r) => gi(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => bi(e, n, r), e.parseAsync = async (n, r) => vi(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => wi(e, n, r), e.spa = e.safeParseAsync, e.encode = (n, r) => ki(e, n, r), e.decode = (n, r) => zi(e, n, r), e.encodeAsync = async (n, r) => yi(e, n, r), e.decodeAsync = async (n, r) => $i(e, n, r), e.safeEncode = (n, r) => Zi(e, n, r), e.safeDecode = (n, r) => Ei(e, n, r), e.safeEncodeAsync = async (n, r) => xi(e, n, r), e.safeDecodeAsync = async (n, r) => Ti(e, n, r), e.refine = (n, r) => e.check(bc(n, r)), e.superRefine = (n) => e.check(wc(n)), e.overwrite = (n) => e.check(Q(n)), e.optional = () => lt(e), e.nullable = () => dt(e), e.nullish = () => lt(dt(e)), e.nonoptional = (n) => fc(e, n), e.array = () => Qi(e), e.or = (n) => nc([e, n]), e.and = (n) => oc(e, n), e.transform = (n) => ft(e, cc(n)), e.default = (n) => uc(e, n), e.prefault = (n) => dc(e, n), e.catch = (n) => mc(e, n), e.pipe = (n) => ft(e, n), e.readonly = () => gc(e), e.describe = (n) => {
|
|
2429
2476
|
const r = e.clone();
|
|
2430
|
-
return
|
|
2477
|
+
return ie.add(r, { description: n }), r;
|
|
2431
2478
|
}, Object.defineProperty(e, "description", {
|
|
2432
2479
|
get() {
|
|
2433
|
-
return
|
|
2480
|
+
return ie.get(e)?.description;
|
|
2434
2481
|
},
|
|
2435
2482
|
configurable: !0
|
|
2436
2483
|
}), e.meta = (...n) => {
|
|
2437
2484
|
if (n.length === 0)
|
|
2438
|
-
return
|
|
2485
|
+
return ie.get(e);
|
|
2439
2486
|
const r = e.clone();
|
|
2440
|
-
return
|
|
2441
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2442
|
-
|
|
2487
|
+
return ie.add(r, n[0]), r;
|
|
2488
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), St = /* @__PURE__ */ a("_ZodString", (e, t) => {
|
|
2489
|
+
Se.init(e, t), E.init(e, t);
|
|
2443
2490
|
const n = e._zod.bag;
|
|
2444
|
-
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(
|
|
2445
|
-
}),
|
|
2446
|
-
|
|
2491
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(Jo(...r)), e.includes = (...r) => e.check(Xo(...r)), e.startsWith = (...r) => e.check(Ko(...r)), e.endsWith = (...r) => e.check(Qo(...r)), e.min = (...r) => e.check(de(...r)), e.max = (...r) => e.check(It(...r)), e.length = (...r) => e.check(Ct(...r)), e.nonempty = (...r) => e.check(de(1, ...r)), e.lowercase = (r) => e.check(Go(r)), e.uppercase = (r) => e.check(Ho(r)), e.trim = () => e.check(ti()), e.normalize = (...r) => e.check(ei(...r)), e.toLowerCase = () => e.check(ni()), e.toUpperCase = () => e.check(ri());
|
|
2492
|
+
}), Ai = /* @__PURE__ */ a("ZodString", (e, t) => {
|
|
2493
|
+
Se.init(e, t), St.init(e, t), e.email = (n) => e.check(vo(ji, n)), e.url = (n) => e.check(yo(Ii, n)), e.jwt = (n) => e.check(Do(qi, n)), e.emoji = (n) => e.check($o(Ci, n)), e.guid = (n) => e.check(tt(it, n)), e.uuid = (n) => e.check(bo(se, n)), e.uuidv4 = (n) => e.check(wo(se, n)), e.uuidv6 = (n) => e.check(ko(se, n)), e.uuidv7 = (n) => e.check(zo(se, n)), e.nanoid = (n) => e.check(Zo(Si, n)), e.guid = (n) => e.check(tt(it, n)), e.cuid = (n) => e.check(Eo(Oi, n)), e.cuid2 = (n) => e.check(xo(Ri, n)), e.ulid = (n) => e.check(To(Pi, n)), e.base64 = (n) => e.check(Ro(Vi, n)), e.base64url = (n) => e.check(Po(Wi, n)), e.xid = (n) => e.check(Ao(Ni, n)), e.ksuid = (n) => e.check(jo(Di, n)), e.ipv4 = (n) => e.check(Io(Ui, n)), e.ipv6 = (n) => e.check(Co(Li, n)), e.cidrv4 = (n) => e.check(So(Fi, n)), e.cidrv6 = (n) => e.check(Oo(Mi, n)), e.e164 = (n) => e.check(No(Bi, n)), e.datetime = (n) => e.check(ui(n)), e.date = (n) => e.check(di(n)), e.time = (n) => e.check(hi(n)), e.duration = (n) => e.check(pi(n));
|
|
2447
2494
|
});
|
|
2448
|
-
function
|
|
2449
|
-
return
|
|
2450
|
-
}
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2453
|
-
}),
|
|
2454
|
-
|
|
2455
|
-
}),
|
|
2456
|
-
|
|
2457
|
-
}),
|
|
2458
|
-
|
|
2459
|
-
}),
|
|
2460
|
-
|
|
2461
|
-
}),
|
|
2462
|
-
|
|
2463
|
-
}),
|
|
2464
|
-
|
|
2465
|
-
}),
|
|
2466
|
-
|
|
2467
|
-
}),
|
|
2468
|
-
|
|
2469
|
-
}),
|
|
2470
|
-
|
|
2471
|
-
}),
|
|
2472
|
-
|
|
2473
|
-
}),
|
|
2474
|
-
|
|
2475
|
-
}),
|
|
2476
|
-
|
|
2477
|
-
}),
|
|
2478
|
-
|
|
2479
|
-
}),
|
|
2480
|
-
|
|
2481
|
-
}),
|
|
2482
|
-
|
|
2483
|
-
}),
|
|
2484
|
-
|
|
2485
|
-
}),
|
|
2486
|
-
|
|
2487
|
-
}),
|
|
2488
|
-
|
|
2489
|
-
}),
|
|
2490
|
-
|
|
2491
|
-
}),
|
|
2492
|
-
|
|
2495
|
+
function ce(e) {
|
|
2496
|
+
return go(Ai, e);
|
|
2497
|
+
}
|
|
2498
|
+
const z = /* @__PURE__ */ a("ZodStringFormat", (e, t) => {
|
|
2499
|
+
k.init(e, t), St.init(e, t);
|
|
2500
|
+
}), ji = /* @__PURE__ */ a("ZodEmail", (e, t) => {
|
|
2501
|
+
Zr.init(e, t), z.init(e, t);
|
|
2502
|
+
}), it = /* @__PURE__ */ a("ZodGUID", (e, t) => {
|
|
2503
|
+
yr.init(e, t), z.init(e, t);
|
|
2504
|
+
}), se = /* @__PURE__ */ a("ZodUUID", (e, t) => {
|
|
2505
|
+
$r.init(e, t), z.init(e, t);
|
|
2506
|
+
}), Ii = /* @__PURE__ */ a("ZodURL", (e, t) => {
|
|
2507
|
+
Er.init(e, t), z.init(e, t);
|
|
2508
|
+
}), Ci = /* @__PURE__ */ a("ZodEmoji", (e, t) => {
|
|
2509
|
+
xr.init(e, t), z.init(e, t);
|
|
2510
|
+
}), Si = /* @__PURE__ */ a("ZodNanoID", (e, t) => {
|
|
2511
|
+
Tr.init(e, t), z.init(e, t);
|
|
2512
|
+
}), Oi = /* @__PURE__ */ a("ZodCUID", (e, t) => {
|
|
2513
|
+
Ar.init(e, t), z.init(e, t);
|
|
2514
|
+
}), Ri = /* @__PURE__ */ a("ZodCUID2", (e, t) => {
|
|
2515
|
+
jr.init(e, t), z.init(e, t);
|
|
2516
|
+
}), Pi = /* @__PURE__ */ a("ZodULID", (e, t) => {
|
|
2517
|
+
Ir.init(e, t), z.init(e, t);
|
|
2518
|
+
}), Ni = /* @__PURE__ */ a("ZodXID", (e, t) => {
|
|
2519
|
+
Cr.init(e, t), z.init(e, t);
|
|
2520
|
+
}), Di = /* @__PURE__ */ a("ZodKSUID", (e, t) => {
|
|
2521
|
+
Sr.init(e, t), z.init(e, t);
|
|
2522
|
+
}), Ui = /* @__PURE__ */ a("ZodIPv4", (e, t) => {
|
|
2523
|
+
Dr.init(e, t), z.init(e, t);
|
|
2524
|
+
}), Li = /* @__PURE__ */ a("ZodIPv6", (e, t) => {
|
|
2525
|
+
Ur.init(e, t), z.init(e, t);
|
|
2526
|
+
}), Fi = /* @__PURE__ */ a("ZodCIDRv4", (e, t) => {
|
|
2527
|
+
Lr.init(e, t), z.init(e, t);
|
|
2528
|
+
}), Mi = /* @__PURE__ */ a("ZodCIDRv6", (e, t) => {
|
|
2529
|
+
Fr.init(e, t), z.init(e, t);
|
|
2530
|
+
}), Vi = /* @__PURE__ */ a("ZodBase64", (e, t) => {
|
|
2531
|
+
Mr.init(e, t), z.init(e, t);
|
|
2532
|
+
}), Wi = /* @__PURE__ */ a("ZodBase64URL", (e, t) => {
|
|
2533
|
+
Wr.init(e, t), z.init(e, t);
|
|
2534
|
+
}), Bi = /* @__PURE__ */ a("ZodE164", (e, t) => {
|
|
2535
|
+
Br.init(e, t), z.init(e, t);
|
|
2536
|
+
}), qi = /* @__PURE__ */ a("ZodJWT", (e, t) => {
|
|
2537
|
+
Yr.init(e, t), z.init(e, t);
|
|
2538
|
+
}), Ot = /* @__PURE__ */ a("ZodNumber", (e, t) => {
|
|
2539
|
+
Tt.init(e, t), E.init(e, t), e.gt = (r, o) => e.check(rt(r, o)), e.gte = (r, o) => e.check(ke(r, o)), e.min = (r, o) => e.check(ke(r, o)), e.lt = (r, o) => e.check(nt(r, o)), e.lte = (r, o) => e.check(we(r, o)), e.max = (r, o) => e.check(we(r, o)), e.int = (r) => e.check(st(r)), e.safe = (r) => e.check(st(r)), e.positive = (r) => e.check(rt(0, r)), e.nonnegative = (r) => e.check(ke(0, r)), e.negative = (r) => e.check(nt(0, r)), e.nonpositive = (r) => e.check(we(0, r)), e.multipleOf = (r, o) => e.check(ot(r, o)), e.step = (r, o) => e.check(ot(r, o)), e.finite = () => e;
|
|
2493
2540
|
const n = e._zod.bag;
|
|
2494
2541
|
e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
|
|
2495
2542
|
});
|
|
2496
|
-
function
|
|
2497
|
-
return
|
|
2543
|
+
function ct(e) {
|
|
2544
|
+
return Vo(Ot, e);
|
|
2498
2545
|
}
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2546
|
+
const Yi = /* @__PURE__ */ a("ZodNumberFormat", (e, t) => {
|
|
2547
|
+
Jr.init(e, t), Ot.init(e, t);
|
|
2501
2548
|
});
|
|
2502
|
-
function
|
|
2503
|
-
return
|
|
2549
|
+
function st(e) {
|
|
2550
|
+
return Wo(Yi, e);
|
|
2504
2551
|
}
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2552
|
+
const Ji = /* @__PURE__ */ a("ZodBoolean", (e, t) => {
|
|
2553
|
+
Gr.init(e, t), E.init(e, t);
|
|
2507
2554
|
});
|
|
2508
|
-
function
|
|
2509
|
-
return
|
|
2555
|
+
function at(e) {
|
|
2556
|
+
return Bo(Ji, e);
|
|
2510
2557
|
}
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2558
|
+
const Gi = /* @__PURE__ */ a("ZodUnknown", (e, t) => {
|
|
2559
|
+
Hr.init(e, t), E.init(e, t);
|
|
2513
2560
|
});
|
|
2514
|
-
function
|
|
2515
|
-
return
|
|
2561
|
+
function ut() {
|
|
2562
|
+
return qo(Gi);
|
|
2516
2563
|
}
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2564
|
+
const Hi = /* @__PURE__ */ a("ZodNever", (e, t) => {
|
|
2565
|
+
Xr.init(e, t), E.init(e, t);
|
|
2519
2566
|
});
|
|
2520
|
-
function
|
|
2521
|
-
return
|
|
2567
|
+
function Xi(e) {
|
|
2568
|
+
return Yo(Hi, e);
|
|
2522
2569
|
}
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2570
|
+
const Ki = /* @__PURE__ */ a("ZodArray", (e, t) => {
|
|
2571
|
+
Kr.init(e, t), E.init(e, t), e.element = t.element, e.min = (n, r) => e.check(de(n, r)), e.nonempty = (n) => e.check(de(1, n)), e.max = (n, r) => e.check(It(n, r)), e.length = (n, r) => e.check(Ct(n, r)), e.unwrap = () => e.element;
|
|
2525
2572
|
});
|
|
2526
|
-
function
|
|
2527
|
-
return
|
|
2573
|
+
function Qi(e, t) {
|
|
2574
|
+
return oi(Ki, e, t);
|
|
2528
2575
|
}
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2576
|
+
const ec = /* @__PURE__ */ a("ZodObject", (e, t) => {
|
|
2577
|
+
eo.init(e, t), E.init(e, t), w(e, "shape", () => t.shape), e.keyof = () => Oe(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ut() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ut() }), e.strict = () => e.clone({ ...e._zod.def, catchall: Xi() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => bn(e, n), e.safeExtend = (n) => wn(e, n), e.merge = (n) => kn(e, n), e.pick = (n) => gn(e, n), e.omit = (n) => vn(e, n), e.partial = (...n) => zn(Rt, e, n[0]), e.required = (...n) => yn(Pt, e, n[0]);
|
|
2531
2578
|
});
|
|
2532
|
-
function
|
|
2579
|
+
function $e(e, t) {
|
|
2533
2580
|
const n = {
|
|
2534
2581
|
type: "object",
|
|
2535
2582
|
shape: e ?? {},
|
|
2536
2583
|
...m(t)
|
|
2537
2584
|
};
|
|
2538
|
-
return new
|
|
2585
|
+
return new ec(n);
|
|
2539
2586
|
}
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2587
|
+
const tc = /* @__PURE__ */ a("ZodUnion", (e, t) => {
|
|
2588
|
+
to.init(e, t), E.init(e, t), e.options = t.options;
|
|
2542
2589
|
});
|
|
2543
|
-
function
|
|
2544
|
-
return new
|
|
2590
|
+
function nc(e, t) {
|
|
2591
|
+
return new tc({
|
|
2545
2592
|
type: "union",
|
|
2546
2593
|
options: e,
|
|
2547
2594
|
...m(t)
|
|
2548
2595
|
});
|
|
2549
2596
|
}
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2597
|
+
const rc = /* @__PURE__ */ a("ZodIntersection", (e, t) => {
|
|
2598
|
+
no.init(e, t), E.init(e, t);
|
|
2552
2599
|
});
|
|
2553
|
-
function
|
|
2554
|
-
return new
|
|
2600
|
+
function oc(e, t) {
|
|
2601
|
+
return new rc({
|
|
2555
2602
|
type: "intersection",
|
|
2556
2603
|
left: e,
|
|
2557
2604
|
right: t
|
|
2558
2605
|
});
|
|
2559
2606
|
}
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2607
|
+
const Ze = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
2608
|
+
ro.init(e, t), E.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
2562
2609
|
const n = new Set(Object.keys(t.entries));
|
|
2563
2610
|
e.extract = (r, o) => {
|
|
2564
2611
|
const i = {};
|
|
2565
|
-
for (const
|
|
2566
|
-
if (n.has(
|
|
2567
|
-
i[
|
|
2612
|
+
for (const c of r)
|
|
2613
|
+
if (n.has(c))
|
|
2614
|
+
i[c] = t.entries[c];
|
|
2568
2615
|
else
|
|
2569
|
-
throw new Error(`Key ${
|
|
2570
|
-
return new
|
|
2616
|
+
throw new Error(`Key ${c} not found in enum`);
|
|
2617
|
+
return new Ze({
|
|
2571
2618
|
...t,
|
|
2572
2619
|
checks: [],
|
|
2573
2620
|
...m(o),
|
|
@@ -2575,12 +2622,12 @@ const Se = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
|
2575
2622
|
});
|
|
2576
2623
|
}, e.exclude = (r, o) => {
|
|
2577
2624
|
const i = { ...t.entries };
|
|
2578
|
-
for (const
|
|
2579
|
-
if (n.has(
|
|
2580
|
-
delete i[
|
|
2625
|
+
for (const c of r)
|
|
2626
|
+
if (n.has(c))
|
|
2627
|
+
delete i[c];
|
|
2581
2628
|
else
|
|
2582
|
-
throw new Error(`Key ${
|
|
2583
|
-
return new
|
|
2629
|
+
throw new Error(`Key ${c} not found in enum`);
|
|
2630
|
+
return new Ze({
|
|
2584
2631
|
...t,
|
|
2585
2632
|
checks: [],
|
|
2586
2633
|
...m(o),
|
|
@@ -2588,618 +2635,179 @@ const Se = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
|
2588
2635
|
});
|
|
2589
2636
|
};
|
|
2590
2637
|
});
|
|
2591
|
-
function
|
|
2638
|
+
function Oe(e, t) {
|
|
2592
2639
|
const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
|
|
2593
|
-
return new
|
|
2640
|
+
return new Ze({
|
|
2594
2641
|
type: "enum",
|
|
2595
2642
|
entries: n,
|
|
2596
2643
|
...m(t)
|
|
2597
2644
|
});
|
|
2598
2645
|
}
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2646
|
+
const ic = /* @__PURE__ */ a("ZodTransform", (e, t) => {
|
|
2647
|
+
oo.init(e, t), E.init(e, t), e._zod.parse = (n, r) => {
|
|
2601
2648
|
if (r.direction === "backward")
|
|
2602
|
-
throw new
|
|
2649
|
+
throw new ht(e.constructor.name);
|
|
2603
2650
|
n.addIssue = (i) => {
|
|
2604
2651
|
if (typeof i == "string")
|
|
2605
|
-
n.issues.push(
|
|
2652
|
+
n.issues.push(K(i, n.value, t));
|
|
2606
2653
|
else {
|
|
2607
|
-
const
|
|
2608
|
-
|
|
2654
|
+
const c = i;
|
|
2655
|
+
c.fatal && (c.continue = !1), c.code ?? (c.code = "custom"), c.input ?? (c.input = n.value), c.inst ?? (c.inst = e), n.issues.push(K(c));
|
|
2609
2656
|
}
|
|
2610
2657
|
};
|
|
2611
2658
|
const o = t.transform(n.value, n);
|
|
2612
2659
|
return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
|
|
2613
2660
|
};
|
|
2614
2661
|
});
|
|
2615
|
-
function
|
|
2616
|
-
return new
|
|
2662
|
+
function cc(e) {
|
|
2663
|
+
return new ic({
|
|
2617
2664
|
type: "transform",
|
|
2618
2665
|
transform: e
|
|
2619
2666
|
});
|
|
2620
2667
|
}
|
|
2621
|
-
const
|
|
2622
|
-
|
|
2668
|
+
const Rt = /* @__PURE__ */ a("ZodOptional", (e, t) => {
|
|
2669
|
+
io.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2623
2670
|
});
|
|
2624
|
-
function
|
|
2625
|
-
return new
|
|
2671
|
+
function lt(e) {
|
|
2672
|
+
return new Rt({
|
|
2626
2673
|
type: "optional",
|
|
2627
2674
|
innerType: e
|
|
2628
2675
|
});
|
|
2629
2676
|
}
|
|
2630
|
-
const
|
|
2631
|
-
|
|
2677
|
+
const sc = /* @__PURE__ */ a("ZodNullable", (e, t) => {
|
|
2678
|
+
co.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2632
2679
|
});
|
|
2633
|
-
function
|
|
2634
|
-
return new
|
|
2680
|
+
function dt(e) {
|
|
2681
|
+
return new sc({
|
|
2635
2682
|
type: "nullable",
|
|
2636
2683
|
innerType: e
|
|
2637
2684
|
});
|
|
2638
2685
|
}
|
|
2639
|
-
const
|
|
2640
|
-
|
|
2686
|
+
const ac = /* @__PURE__ */ a("ZodDefault", (e, t) => {
|
|
2687
|
+
so.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
2641
2688
|
});
|
|
2642
|
-
function
|
|
2643
|
-
return new
|
|
2689
|
+
function uc(e, t) {
|
|
2690
|
+
return new ac({
|
|
2644
2691
|
type: "default",
|
|
2645
2692
|
innerType: e,
|
|
2646
2693
|
get defaultValue() {
|
|
2647
|
-
return typeof t == "function" ? t() :
|
|
2694
|
+
return typeof t == "function" ? t() : _t(t);
|
|
2648
2695
|
}
|
|
2649
2696
|
});
|
|
2650
2697
|
}
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2698
|
+
const lc = /* @__PURE__ */ a("ZodPrefault", (e, t) => {
|
|
2699
|
+
ao.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2653
2700
|
});
|
|
2654
|
-
function
|
|
2655
|
-
return new
|
|
2701
|
+
function dc(e, t) {
|
|
2702
|
+
return new lc({
|
|
2656
2703
|
type: "prefault",
|
|
2657
2704
|
innerType: e,
|
|
2658
2705
|
get defaultValue() {
|
|
2659
|
-
return typeof t == "function" ? t() :
|
|
2706
|
+
return typeof t == "function" ? t() : _t(t);
|
|
2660
2707
|
}
|
|
2661
2708
|
});
|
|
2662
2709
|
}
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2710
|
+
const Pt = /* @__PURE__ */ a("ZodNonOptional", (e, t) => {
|
|
2711
|
+
uo.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2665
2712
|
});
|
|
2666
|
-
function
|
|
2667
|
-
return new
|
|
2713
|
+
function fc(e, t) {
|
|
2714
|
+
return new Pt({
|
|
2668
2715
|
type: "nonoptional",
|
|
2669
2716
|
innerType: e,
|
|
2670
2717
|
...m(t)
|
|
2671
2718
|
});
|
|
2672
2719
|
}
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2720
|
+
const hc = /* @__PURE__ */ a("ZodCatch", (e, t) => {
|
|
2721
|
+
lo.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
2675
2722
|
});
|
|
2676
|
-
function
|
|
2677
|
-
return new
|
|
2723
|
+
function mc(e, t) {
|
|
2724
|
+
return new hc({
|
|
2678
2725
|
type: "catch",
|
|
2679
2726
|
innerType: e,
|
|
2680
2727
|
catchValue: typeof t == "function" ? t : () => t
|
|
2681
2728
|
});
|
|
2682
2729
|
}
|
|
2683
|
-
const
|
|
2684
|
-
|
|
2730
|
+
const pc = /* @__PURE__ */ a("ZodPipe", (e, t) => {
|
|
2731
|
+
fo.init(e, t), E.init(e, t), e.in = t.in, e.out = t.out;
|
|
2685
2732
|
});
|
|
2686
|
-
function
|
|
2687
|
-
return new
|
|
2733
|
+
function ft(e, t) {
|
|
2734
|
+
return new pc({
|
|
2688
2735
|
type: "pipe",
|
|
2689
2736
|
in: e,
|
|
2690
2737
|
out: t
|
|
2691
2738
|
// ...util.normalizeParams(params),
|
|
2692
2739
|
});
|
|
2693
2740
|
}
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2741
|
+
const _c = /* @__PURE__ */ a("ZodReadonly", (e, t) => {
|
|
2742
|
+
ho.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2696
2743
|
});
|
|
2697
|
-
function
|
|
2698
|
-
return new
|
|
2744
|
+
function gc(e) {
|
|
2745
|
+
return new _c({
|
|
2699
2746
|
type: "readonly",
|
|
2700
2747
|
innerType: e
|
|
2701
2748
|
});
|
|
2702
2749
|
}
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2750
|
+
const vc = /* @__PURE__ */ a("ZodCustom", (e, t) => {
|
|
2751
|
+
mo.init(e, t), E.init(e, t);
|
|
2705
2752
|
});
|
|
2706
|
-
function
|
|
2707
|
-
return
|
|
2708
|
-
}
|
|
2709
|
-
function
|
|
2710
|
-
return
|
|
2711
|
-
}
|
|
2712
|
-
const
|
|
2713
|
-
title:
|
|
2714
|
-
content:
|
|
2715
|
-
format:
|
|
2716
|
-
metadata:
|
|
2717
|
-
createdAt:
|
|
2718
|
-
updatedAt:
|
|
2719
|
-
wordCount:
|
|
2720
|
-
characterCount:
|
|
2753
|
+
function bc(e, t = {}) {
|
|
2754
|
+
return ii(vc, e, t);
|
|
2755
|
+
}
|
|
2756
|
+
function wc(e) {
|
|
2757
|
+
return ci(e);
|
|
2758
|
+
}
|
|
2759
|
+
const kc = $e({
|
|
2760
|
+
title: ce().min(1, "Title is required").max(200, "Title too long"),
|
|
2761
|
+
content: ce().min(1, "Content is required"),
|
|
2762
|
+
format: Oe(["html", "markdown"]).default("html"),
|
|
2763
|
+
metadata: $e({
|
|
2764
|
+
createdAt: ce().datetime(),
|
|
2765
|
+
updatedAt: ce().datetime(),
|
|
2766
|
+
wordCount: ct().min(0),
|
|
2767
|
+
characterCount: ct().min(0)
|
|
2721
2768
|
}).optional()
|
|
2722
2769
|
});
|
|
2723
|
-
|
|
2724
|
-
includeStyles:
|
|
2725
|
-
includeMeta:
|
|
2726
|
-
format:
|
|
2770
|
+
$e({
|
|
2771
|
+
includeStyles: at().default(!0),
|
|
2772
|
+
includeMeta: at().default(!0),
|
|
2773
|
+
format: Oe(["html", "txt"]).default("html")
|
|
2727
2774
|
});
|
|
2728
|
-
const
|
|
2729
|
-
|
|
2730
|
-
title: "Untitled Document",
|
|
2731
|
-
wordCount: 0,
|
|
2732
|
-
characterCount: 0,
|
|
2733
|
-
hasUnsavedChanges: !1,
|
|
2734
|
-
activeFormats: []
|
|
2735
|
-
}, As = (e) => ({
|
|
2736
|
-
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
2737
|
-
characterCount: e.length
|
|
2738
|
-
}), Bt = vn()(
|
|
2739
|
-
kn(
|
|
2740
|
-
(e, t) => ({
|
|
2741
|
-
..._t,
|
|
2742
|
-
updateContent: (n) => {
|
|
2743
|
-
const r = As(n);
|
|
2744
|
-
e({
|
|
2745
|
-
content: n,
|
|
2746
|
-
...r,
|
|
2747
|
-
hasUnsavedChanges: !0
|
|
2748
|
-
});
|
|
2749
|
-
},
|
|
2750
|
-
updateTitle: (n) => {
|
|
2751
|
-
e({
|
|
2752
|
-
title: n,
|
|
2753
|
-
hasUnsavedChanges: !0
|
|
2754
|
-
});
|
|
2755
|
-
},
|
|
2756
|
-
setActiveFormats: (n) => {
|
|
2757
|
-
e({ activeFormats: n });
|
|
2758
|
-
},
|
|
2759
|
-
clearEditor: () => {
|
|
2760
|
-
e({
|
|
2761
|
-
..._t,
|
|
2762
|
-
content: "",
|
|
2763
|
-
title: "Untitled Document"
|
|
2764
|
-
});
|
|
2765
|
-
},
|
|
2766
|
-
setHasUnsavedChanges: (n) => {
|
|
2767
|
-
e({ hasUnsavedChanges: n });
|
|
2768
|
-
},
|
|
2769
|
-
executeCommand: (n, r) => {
|
|
2770
|
-
document.execCommand(n, !1, r);
|
|
2771
|
-
const o = document.querySelector('[contenteditable="true"]');
|
|
2772
|
-
o && o.focus(), setTimeout(() => {
|
|
2773
|
-
t().updateActiveFormats();
|
|
2774
|
-
}, 10);
|
|
2775
|
-
},
|
|
2776
|
-
updateActiveFormats: () => {
|
|
2777
|
-
const n = [
|
|
2778
|
-
"bold",
|
|
2779
|
-
"italic",
|
|
2780
|
-
"underline",
|
|
2781
|
-
"strikeThrough",
|
|
2782
|
-
"justifyLeft",
|
|
2783
|
-
"justifyCenter",
|
|
2784
|
-
"justifyRight"
|
|
2785
|
-
], r = [];
|
|
2786
|
-
n.forEach((o) => {
|
|
2787
|
-
document.queryCommandState(o) && r.push(o);
|
|
2788
|
-
}), e({ activeFormats: r });
|
|
2789
|
-
},
|
|
2790
|
-
getValidationResult: () => {
|
|
2791
|
-
const n = t();
|
|
2792
|
-
try {
|
|
2793
|
-
return { success: !0, data: Wt.parse({
|
|
2794
|
-
title: n.title,
|
|
2795
|
-
content: n.content,
|
|
2796
|
-
metadata: {
|
|
2797
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2798
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2799
|
-
wordCount: n.wordCount,
|
|
2800
|
-
characterCount: n.characterCount
|
|
2801
|
-
}
|
|
2802
|
-
}) };
|
|
2803
|
-
} catch (r) {
|
|
2804
|
-
return { success: !1, error: r instanceof Error ? r.message : "Validation failed" };
|
|
2805
|
-
}
|
|
2806
|
-
},
|
|
2807
|
-
exportToHTML: (n = { includeStyles: !0, includeMeta: !0 }) => {
|
|
2808
|
-
const o = t().getValidationResult();
|
|
2809
|
-
if (!o.success)
|
|
2810
|
-
throw new Error(o.error);
|
|
2811
|
-
const { data: i } = o;
|
|
2812
|
-
let s = `<!DOCTYPE html>
|
|
2813
|
-
<html>
|
|
2814
|
-
<head>
|
|
2815
|
-
<meta charset="UTF-8">
|
|
2816
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2817
|
-
<title>${i?.title}</title>`;
|
|
2818
|
-
return n.includeStyles && (s += `
|
|
2819
|
-
<style>
|
|
2820
|
-
body {
|
|
2821
|
-
font-family: Arial, sans-serif;
|
|
2822
|
-
line-height: 1.6;
|
|
2823
|
-
margin: 40px;
|
|
2824
|
-
max-width: 800px;
|
|
2825
|
-
}
|
|
2826
|
-
.editor-content {
|
|
2827
|
-
border: 1px solid #ddd;
|
|
2828
|
-
padding: 20px;
|
|
2829
|
-
border-radius: 8px;
|
|
2830
|
-
background: white;
|
|
2831
|
-
}
|
|
2832
|
-
</style>`), s += `
|
|
2833
|
-
</head>
|
|
2834
|
-
<body>`, n.includeMeta && (s += `
|
|
2835
|
-
<div class="document-meta">
|
|
2836
|
-
<h1>${i?.title}</h1>
|
|
2837
|
-
<p><small>Created: ${new Date(i?.metadata.createdAt ?? "").toLocaleString()} |
|
|
2838
|
-
Words: ${i?.metadata.wordCount} |
|
|
2839
|
-
Characters: ${i?.metadata.characterCount}</small></p>
|
|
2840
|
-
<hr>
|
|
2841
|
-
</div>`), s += `
|
|
2842
|
-
<div class="editor-content">
|
|
2843
|
-
${i?.content}
|
|
2844
|
-
</div>
|
|
2845
|
-
</body>
|
|
2846
|
-
</html>`, s;
|
|
2847
|
-
}
|
|
2848
|
-
}),
|
|
2849
|
-
{
|
|
2850
|
-
name: "editor-storage",
|
|
2851
|
-
partialize: (e) => ({
|
|
2852
|
-
content: e.content,
|
|
2853
|
-
title: e.title,
|
|
2854
|
-
wordCount: e.wordCount,
|
|
2855
|
-
characterCount: e.characterCount
|
|
2856
|
-
})
|
|
2857
|
-
}
|
|
2858
|
-
)
|
|
2859
|
-
), Cs = ({
|
|
2860
|
-
onSave: e,
|
|
2861
|
-
onExport: t,
|
|
2862
|
-
onClear: n,
|
|
2863
|
-
showButtons: r = !1
|
|
2864
|
-
}) => {
|
|
2865
|
-
const {
|
|
2866
|
-
activeFormats: o,
|
|
2867
|
-
hasUnsavedChanges: i,
|
|
2868
|
-
executeCommand: s,
|
|
2869
|
-
updateActiveFormats: c
|
|
2870
|
-
} = Bt();
|
|
2871
|
-
Ie(() => {
|
|
2872
|
-
const h = () => {
|
|
2873
|
-
c();
|
|
2874
|
-
};
|
|
2875
|
-
return document.addEventListener("selectionchange", h), () => document.removeEventListener("selectionchange", h);
|
|
2876
|
-
}, [c]);
|
|
2877
|
-
const d = () => {
|
|
2878
|
-
const h = prompt("Enter URL:");
|
|
2879
|
-
h && s("createLink", h);
|
|
2880
|
-
}, l = (h) => {
|
|
2881
|
-
s("formatBlock", h);
|
|
2882
|
-
}, f = [
|
|
2883
|
-
{
|
|
2884
|
-
id: "bold",
|
|
2885
|
-
command: "bold",
|
|
2886
|
-
icon: /* @__PURE__ */ _.jsx(Xt, { size: 18 }),
|
|
2887
|
-
title: "Bold",
|
|
2888
|
-
onClick: () => s("bold")
|
|
2889
|
-
},
|
|
2890
|
-
{
|
|
2891
|
-
id: "italic",
|
|
2892
|
-
command: "italic",
|
|
2893
|
-
icon: /* @__PURE__ */ _.jsx(Kt, { size: 18 }),
|
|
2894
|
-
title: "Italic",
|
|
2895
|
-
onClick: () => s("italic")
|
|
2896
|
-
},
|
|
2897
|
-
{
|
|
2898
|
-
id: "underline",
|
|
2899
|
-
command: "underline",
|
|
2900
|
-
icon: /* @__PURE__ */ _.jsx(Qt, { size: 18 }),
|
|
2901
|
-
title: "Underline",
|
|
2902
|
-
onClick: () => s("underline")
|
|
2903
|
-
},
|
|
2904
|
-
{
|
|
2905
|
-
id: "strikeThrough",
|
|
2906
|
-
command: "strikeThrough",
|
|
2907
|
-
icon: /* @__PURE__ */ _.jsx(en, { size: 18 }),
|
|
2908
|
-
title: "Strikethrough",
|
|
2909
|
-
onClick: () => s("strikeThrough")
|
|
2910
|
-
},
|
|
2911
|
-
{ id: "separator-1", separator: !0 },
|
|
2912
|
-
{
|
|
2913
|
-
id: "unordered-list",
|
|
2914
|
-
command: "insertUnorderedList",
|
|
2915
|
-
icon: /* @__PURE__ */ _.jsx(tn, { size: 18 }),
|
|
2916
|
-
title: "Bullet List",
|
|
2917
|
-
onClick: () => s("insertUnorderedList")
|
|
2918
|
-
},
|
|
2919
|
-
{
|
|
2920
|
-
id: "ordered-list",
|
|
2921
|
-
command: "insertOrderedList",
|
|
2922
|
-
icon: /* @__PURE__ */ _.jsx(nn, { size: 18 }),
|
|
2923
|
-
title: "Numbered List",
|
|
2924
|
-
onClick: () => s("insertOrderedList")
|
|
2925
|
-
},
|
|
2926
|
-
{ id: "separator-2", separator: !0 },
|
|
2927
|
-
{
|
|
2928
|
-
id: "heading-1",
|
|
2929
|
-
command: "formatBlock",
|
|
2930
|
-
value: "h1",
|
|
2931
|
-
icon: /* @__PURE__ */ _.jsx(rn, { size: 18 }),
|
|
2932
|
-
title: "Heading 1",
|
|
2933
|
-
onClick: () => l("<h1>")
|
|
2934
|
-
},
|
|
2935
|
-
{
|
|
2936
|
-
id: "heading-2",
|
|
2937
|
-
command: "formatBlock",
|
|
2938
|
-
value: "h2",
|
|
2939
|
-
icon: /* @__PURE__ */ _.jsx(on, { size: 18 }),
|
|
2940
|
-
title: "Heading 2",
|
|
2941
|
-
onClick: () => l("<h2>")
|
|
2942
|
-
},
|
|
2943
|
-
{
|
|
2944
|
-
id: "paragraph",
|
|
2945
|
-
command: "formatBlock",
|
|
2946
|
-
value: "p",
|
|
2947
|
-
icon: /* @__PURE__ */ _.jsx(sn, { size: 18 }),
|
|
2948
|
-
title: "Paragraph",
|
|
2949
|
-
onClick: () => l("<p>")
|
|
2950
|
-
},
|
|
2951
|
-
{ id: "separator-3", separator: !0 },
|
|
2952
|
-
{
|
|
2953
|
-
id: "align-left",
|
|
2954
|
-
command: "justifyLeft",
|
|
2955
|
-
icon: /* @__PURE__ */ _.jsx(cn, { size: 18 }),
|
|
2956
|
-
title: "Align Left",
|
|
2957
|
-
onClick: () => s("justifyLeft")
|
|
2958
|
-
},
|
|
2959
|
-
{
|
|
2960
|
-
id: "align-center",
|
|
2961
|
-
command: "justifyCenter",
|
|
2962
|
-
icon: /* @__PURE__ */ _.jsx(an, { size: 18 }),
|
|
2963
|
-
title: "Center",
|
|
2964
|
-
onClick: () => s("justifyCenter")
|
|
2965
|
-
},
|
|
2966
|
-
{
|
|
2967
|
-
id: "align-right",
|
|
2968
|
-
command: "justifyRight",
|
|
2969
|
-
icon: /* @__PURE__ */ _.jsx(un, { size: 18 }),
|
|
2970
|
-
title: "Align Right",
|
|
2971
|
-
onClick: () => s("justifyRight")
|
|
2972
|
-
},
|
|
2973
|
-
{ id: "separator-4", separator: !0 },
|
|
2974
|
-
{
|
|
2975
|
-
id: "link",
|
|
2976
|
-
command: "createLink",
|
|
2977
|
-
icon: /* @__PURE__ */ _.jsx(ln, { size: 18 }),
|
|
2978
|
-
title: "Insert Link",
|
|
2979
|
-
onClick: d
|
|
2980
|
-
}
|
|
2981
|
-
];
|
|
2982
|
-
return /* @__PURE__ */ _.jsxs("div", { className: "flex flex-wrap justify-between items-center p-3 bg-gray-50 border-b border-gray-200", children: [
|
|
2983
|
-
/* @__PURE__ */ _.jsx("div", { className: "flex flex-wrap items-center gap-1", children: f.map((h) => {
|
|
2984
|
-
if ("separator" in h)
|
|
2985
|
-
return /* @__PURE__ */ _.jsx("div", { className: "w-px h-6 bg-gray-300 mx-2" }, h.id);
|
|
2986
|
-
const p = o.includes(h.command);
|
|
2987
|
-
return /* @__PURE__ */ _.jsx(
|
|
2988
|
-
"button",
|
|
2989
|
-
{
|
|
2990
|
-
onClick: h.onClick,
|
|
2991
|
-
title: h.title,
|
|
2992
|
-
type: "button",
|
|
2993
|
-
className: `w-9 h-9 flex items-center justify-center rounded-md border transition-colors duration-200
|
|
2994
|
-
${p ? "bg-blue-100 text-blue-600 border-blue-300 hover:bg-blue-200" : "bg-white border-gray-300 text-gray-700 hover:bg-gray-100"}`,
|
|
2995
|
-
children: h.icon
|
|
2996
|
-
},
|
|
2997
|
-
h.id
|
|
2998
|
-
);
|
|
2999
|
-
}) }),
|
|
3000
|
-
r && /* @__PURE__ */ _.jsxs("div", { className: "flex items-center gap-2 mt-2 sm:mt-0", children: [
|
|
3001
|
-
/* @__PURE__ */ _.jsxs(
|
|
3002
|
-
"button",
|
|
3003
|
-
{
|
|
3004
|
-
onClick: e,
|
|
3005
|
-
disabled: !i,
|
|
3006
|
-
title: "Save Document",
|
|
3007
|
-
className: "flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:bg-blue-300 disabled:cursor-not-allowed transition-colors duration-200",
|
|
3008
|
-
children: [
|
|
3009
|
-
/* @__PURE__ */ _.jsx(Jt, { size: 16 }),
|
|
3010
|
-
/* @__PURE__ */ _.jsx("span", { children: "Save" })
|
|
3011
|
-
]
|
|
3012
|
-
}
|
|
3013
|
-
),
|
|
3014
|
-
/* @__PURE__ */ _.jsxs(
|
|
3015
|
-
"button",
|
|
3016
|
-
{
|
|
3017
|
-
onClick: t,
|
|
3018
|
-
title: "Export as HTML",
|
|
3019
|
-
className: "flex items-center gap-2 px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 transition-colors duration-200",
|
|
3020
|
-
children: [
|
|
3021
|
-
/* @__PURE__ */ _.jsx(Gt, { size: 16 }),
|
|
3022
|
-
/* @__PURE__ */ _.jsx("span", { children: "Export" })
|
|
3023
|
-
]
|
|
3024
|
-
}
|
|
3025
|
-
),
|
|
3026
|
-
/* @__PURE__ */ _.jsxs(
|
|
3027
|
-
"button",
|
|
3028
|
-
{
|
|
3029
|
-
onClick: n,
|
|
3030
|
-
title: "Clear Editor",
|
|
3031
|
-
className: "flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-md hover:bg-red-700 transition-colors duration-200",
|
|
3032
|
-
children: [
|
|
3033
|
-
/* @__PURE__ */ _.jsx(qt, { size: 16 }),
|
|
3034
|
-
/* @__PURE__ */ _.jsx("span", { children: "Clear" })
|
|
3035
|
-
]
|
|
3036
|
-
}
|
|
3037
|
-
)
|
|
3038
|
-
] })
|
|
3039
|
-
] });
|
|
3040
|
-
}, Os = ({
|
|
3041
|
-
wordCount: e,
|
|
3042
|
-
characterCount: t,
|
|
3043
|
-
hasUnsavedChanges: n
|
|
3044
|
-
}) => /* @__PURE__ */ _.jsx("div", { className: "flex justify-between items-center px-5 py-3 bg-gray-50 border-t border-gray-200 text-sm text-gray-600", children: /* @__PURE__ */ _.jsxs("div", { className: "flex items-center gap-6", children: [
|
|
3045
|
-
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
3046
|
-
"Words: ",
|
|
3047
|
-
/* @__PURE__ */ _.jsx("strong", { className: "text-gray-800", children: e })
|
|
3048
|
-
] }),
|
|
3049
|
-
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
3050
|
-
"Characters: ",
|
|
3051
|
-
/* @__PURE__ */ _.jsx("strong", { className: "text-gray-800", children: t })
|
|
3052
|
-
] }),
|
|
3053
|
-
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
3054
|
-
"Status: ",
|
|
3055
|
-
/* @__PURE__ */ _.jsx("strong", { className: n ? "text-orange-600" : "text-green-600", children: n ? "Unsaved Changes" : "Saved" })
|
|
3056
|
-
] })
|
|
3057
|
-
] }) }), Ns = ({
|
|
3058
|
-
initialContent: e = "",
|
|
3059
|
-
onSave: t,
|
|
3060
|
-
onExport: n,
|
|
3061
|
-
onChange: r,
|
|
3062
|
-
// Add onChange prop
|
|
3063
|
-
showButtons: o = !1,
|
|
3064
|
-
// Add option to hide toolbar
|
|
3065
|
-
showSaveTitle: i = !1,
|
|
3066
|
-
// Add option to hide title section
|
|
3067
|
-
showStatusBar: s = !1
|
|
3068
|
-
// Add option to hide status bar
|
|
3069
|
-
}) => {
|
|
3070
|
-
const c = vt(null), [d, l] = bt(!1), {
|
|
3071
|
-
content: f,
|
|
3072
|
-
title: h,
|
|
3073
|
-
wordCount: p,
|
|
3074
|
-
characterCount: g,
|
|
3075
|
-
hasUnsavedChanges: T,
|
|
3076
|
-
updateContent: b,
|
|
3077
|
-
updateTitle: C,
|
|
3078
|
-
getValidationResult: N,
|
|
3079
|
-
exportToHTML: k,
|
|
3080
|
-
clearEditor: $,
|
|
3081
|
-
setHasUnsavedChanges: z
|
|
3082
|
-
} = Bt();
|
|
3083
|
-
Ie(() => {
|
|
3084
|
-
c.current && e && e !== f && (c.current.innerHTML = e, b(e), z(!1));
|
|
3085
|
-
}, [e, f, b, z]);
|
|
3086
|
-
const P = F(
|
|
3087
|
-
(E) => {
|
|
3088
|
-
if (b(E), z(!0), r) {
|
|
3089
|
-
const D = k();
|
|
3090
|
-
r(E, D);
|
|
3091
|
-
}
|
|
3092
|
-
},
|
|
3093
|
-
[b, z, r, k]
|
|
3094
|
-
), _e = F(
|
|
3095
|
-
(E) => {
|
|
3096
|
-
if (C(E), z(!0), r) {
|
|
3097
|
-
const D = k();
|
|
3098
|
-
r(f, D, E);
|
|
3099
|
-
}
|
|
3100
|
-
},
|
|
3101
|
-
[C, z, r, k, f]
|
|
3102
|
-
), ve = () => {
|
|
3103
|
-
if (N().success) {
|
|
3104
|
-
const D = k();
|
|
3105
|
-
t?.(f, D), z(!1);
|
|
3106
|
-
} else
|
|
3107
|
-
l(!0), setTimeout(() => l(!1), 3e3);
|
|
3108
|
-
}, be = () => {
|
|
3109
|
-
try {
|
|
3110
|
-
const E = k();
|
|
3111
|
-
n?.(E);
|
|
3112
|
-
const D = new Blob([E], { type: "text/html" }), Y = URL.createObjectURL(D), U = document.createElement("a");
|
|
3113
|
-
U.href = Y, U.download = `${h.replace(/\s+/g, "_")}.html`, document.body.appendChild(U), U.click(), document.body.removeChild(U), URL.revokeObjectURL(Y);
|
|
3114
|
-
} catch (E) {
|
|
3115
|
-
alert(
|
|
3116
|
-
"Export failed: " + (E instanceof Error ? E.message : "Unknown error")
|
|
3117
|
-
);
|
|
3118
|
-
}
|
|
3119
|
-
}, q = () => {
|
|
3120
|
-
confirm(
|
|
3121
|
-
"Are you sure you want to clear the editor? All unsaved changes will be lost."
|
|
3122
|
-
) && ($(), c.current && (c.current.innerHTML = ""), r && r("", ""));
|
|
3123
|
-
};
|
|
3124
|
-
return /* @__PURE__ */ _.jsxs("div", { className: "w-full max-w-6xl mx-auto bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden", children: [
|
|
3125
|
-
i && /* @__PURE__ */ _.jsxs("div", { className: "p-6 border-b border-gray-200 bg-gray-50 rounded-t-xl", children: [
|
|
3126
|
-
/* @__PURE__ */ _.jsx(
|
|
3127
|
-
"input",
|
|
3128
|
-
{
|
|
3129
|
-
type: "text",
|
|
3130
|
-
className: "w-full bg-transparent text-2xl font-bold text-gray-800 placeholder-gray-500 outline-none border-none focus:ring-0",
|
|
3131
|
-
value: h,
|
|
3132
|
-
onChange: (E) => _e(E.target.value),
|
|
3133
|
-
placeholder: "Document Title"
|
|
3134
|
-
}
|
|
3135
|
-
),
|
|
3136
|
-
d && /* @__PURE__ */ _.jsx("div", { className: "mt-2 px-3 py-2 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm animate-pulse", children: "Please add content before saving" })
|
|
3137
|
-
] }),
|
|
3138
|
-
/* @__PURE__ */ _.jsx(
|
|
3139
|
-
Cs,
|
|
3140
|
-
{
|
|
3141
|
-
onSave: ve,
|
|
3142
|
-
onExport: be,
|
|
3143
|
-
onClear: q,
|
|
3144
|
-
showButtons: o
|
|
3145
|
-
}
|
|
3146
|
-
),
|
|
3147
|
-
/* @__PURE__ */ _.jsx(
|
|
3148
|
-
"div",
|
|
3149
|
-
{
|
|
3150
|
-
ref: c,
|
|
3151
|
-
className: `min-h-[500px] p-8 prose max-w-none border-none outline-none resize-none text-gray-700 leading-relaxed bg-white focus:bg-gray-50 transition-colors duration-200 ${i ? "rounded-t-xl" : ""} ${o ? "border-t-0" : ""}`,
|
|
3152
|
-
contentEditable: !0,
|
|
3153
|
-
onInput: (E) => P(E.currentTarget.innerHTML),
|
|
3154
|
-
onFocus: (E) => E.currentTarget.classList.add("bg-gray-50"),
|
|
3155
|
-
onBlur: (E) => E.currentTarget.classList.remove("bg-gray-50")
|
|
3156
|
-
}
|
|
3157
|
-
),
|
|
3158
|
-
s && /* @__PURE__ */ _.jsx(
|
|
3159
|
-
Os,
|
|
3160
|
-
{
|
|
3161
|
-
wordCount: p,
|
|
3162
|
-
characterCount: g,
|
|
3163
|
-
hasUnsavedChanges: T
|
|
3164
|
-
}
|
|
3165
|
-
)
|
|
3166
|
-
] });
|
|
3167
|
-
}, Ds = (e = "") => {
|
|
3168
|
-
const [t, n] = bt({
|
|
2775
|
+
const zc = (e = "") => {
|
|
2776
|
+
const [t, n] = ae({
|
|
3169
2777
|
content: e,
|
|
3170
2778
|
title: "Untitled Document",
|
|
3171
2779
|
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
3172
2780
|
characterCount: e.length,
|
|
3173
2781
|
hasUnsavedChanges: !1
|
|
3174
|
-
}), r =
|
|
3175
|
-
|
|
3176
|
-
r.current && e !== t.content && (r.current.innerHTML = e, n((
|
|
3177
|
-
...
|
|
2782
|
+
}), r = Mt(null);
|
|
2783
|
+
Ee(() => {
|
|
2784
|
+
r.current && e !== t.content && (r.current.innerHTML = e, n((h) => ({
|
|
2785
|
+
...h,
|
|
3178
2786
|
content: e,
|
|
3179
2787
|
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
3180
2788
|
characterCount: e.length
|
|
3181
2789
|
})));
|
|
3182
2790
|
}, [e]);
|
|
3183
|
-
const o =
|
|
3184
|
-
const
|
|
3185
|
-
n((
|
|
3186
|
-
...
|
|
3187
|
-
content:
|
|
3188
|
-
wordCount:
|
|
3189
|
-
characterCount:
|
|
2791
|
+
const o = P((h) => {
|
|
2792
|
+
const v = h.trim() ? h.trim().split(/\s+/).length : 0, _ = h.length;
|
|
2793
|
+
n((l) => ({
|
|
2794
|
+
...l,
|
|
2795
|
+
content: h,
|
|
2796
|
+
wordCount: v,
|
|
2797
|
+
characterCount: _,
|
|
3190
2798
|
hasUnsavedChanges: !0
|
|
3191
2799
|
}));
|
|
3192
|
-
}, []), i =
|
|
3193
|
-
n((
|
|
3194
|
-
...
|
|
3195
|
-
title:
|
|
2800
|
+
}, []), i = P((h) => {
|
|
2801
|
+
n((v) => ({
|
|
2802
|
+
...v,
|
|
2803
|
+
title: h,
|
|
3196
2804
|
hasUnsavedChanges: !0
|
|
3197
2805
|
}));
|
|
3198
|
-
}, []),
|
|
3199
|
-
document.execCommand(
|
|
3200
|
-
}, []),
|
|
2806
|
+
}, []), c = P((h, v) => {
|
|
2807
|
+
document.execCommand(h, !1, v), r.current?.focus();
|
|
2808
|
+
}, []), s = P(() => {
|
|
3201
2809
|
try {
|
|
3202
|
-
return { success: !0, data:
|
|
2810
|
+
return { success: !0, data: kc.parse({
|
|
3203
2811
|
title: t.title,
|
|
3204
2812
|
content: t.content,
|
|
3205
2813
|
metadata: {
|
|
@@ -3209,22 +2817,22 @@ const _t = {
|
|
|
3209
2817
|
characterCount: t.characterCount
|
|
3210
2818
|
}
|
|
3211
2819
|
}) };
|
|
3212
|
-
} catch (
|
|
3213
|
-
return { success: !1, error:
|
|
2820
|
+
} catch (h) {
|
|
2821
|
+
return { success: !1, error: h instanceof Error ? h.message : "Validation failed" };
|
|
3214
2822
|
}
|
|
3215
|
-
}, [t]),
|
|
3216
|
-
(
|
|
3217
|
-
const
|
|
3218
|
-
if (!
|
|
3219
|
-
throw new Error(
|
|
3220
|
-
const { data:
|
|
3221
|
-
let
|
|
2823
|
+
}, [t]), f = P(
|
|
2824
|
+
(h = { includeStyles: !0, includeMeta: !0 }) => {
|
|
2825
|
+
const v = s();
|
|
2826
|
+
if (!v.success)
|
|
2827
|
+
throw new Error(v.error);
|
|
2828
|
+
const { data: _ } = v;
|
|
2829
|
+
let l = `<!DOCTYPE html>
|
|
3222
2830
|
<html>
|
|
3223
2831
|
<head>
|
|
3224
2832
|
<meta charset="UTF-8">
|
|
3225
2833
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3226
|
-
<title>${
|
|
3227
|
-
return
|
|
2834
|
+
<title>${_?.title}</title>`;
|
|
2835
|
+
return h.includeStyles && (l += `
|
|
3228
2836
|
<style>
|
|
3229
2837
|
body {
|
|
3230
2838
|
font-family: Arial, sans-serif;
|
|
@@ -3238,24 +2846,24 @@ const _t = {
|
|
|
3238
2846
|
border-radius: 8px;
|
|
3239
2847
|
background: white;
|
|
3240
2848
|
}
|
|
3241
|
-
</style>`),
|
|
2849
|
+
</style>`), l += `
|
|
3242
2850
|
</head>
|
|
3243
|
-
<body>`,
|
|
2851
|
+
<body>`, h.includeMeta && (l += `
|
|
3244
2852
|
<div class="document-meta">
|
|
3245
|
-
<h1>${
|
|
3246
|
-
<p><small>Created: ${new Date(
|
|
3247
|
-
Words: ${
|
|
3248
|
-
Characters: ${
|
|
2853
|
+
<h1>${_?.title}</h1>
|
|
2854
|
+
<p><small>Created: ${new Date(_?.metadata.createdAt ?? "").toLocaleString()} |
|
|
2855
|
+
Words: ${_?.metadata.wordCount} |
|
|
2856
|
+
Characters: ${_?.metadata.characterCount}</small></p>
|
|
3249
2857
|
<hr>
|
|
3250
|
-
</div>`),
|
|
2858
|
+
</div>`), l += `
|
|
3251
2859
|
<div class="editor-content">
|
|
3252
|
-
${
|
|
2860
|
+
${_?.content}
|
|
3253
2861
|
</div>
|
|
3254
2862
|
</body>
|
|
3255
|
-
</html>`,
|
|
2863
|
+
</html>`, l;
|
|
3256
2864
|
},
|
|
3257
|
-
[
|
|
3258
|
-
),
|
|
2865
|
+
[s]
|
|
2866
|
+
), d = P(() => {
|
|
3259
2867
|
n({
|
|
3260
2868
|
content: "",
|
|
3261
2869
|
title: "Untitled Document",
|
|
@@ -3269,13 +2877,137 @@ const _t = {
|
|
|
3269
2877
|
editorRef: r,
|
|
3270
2878
|
updateContent: o,
|
|
3271
2879
|
updateTitle: i,
|
|
3272
|
-
executeCommand:
|
|
3273
|
-
getValidationResult:
|
|
3274
|
-
exportToHTML:
|
|
3275
|
-
clearEditor:
|
|
2880
|
+
executeCommand: c,
|
|
2881
|
+
getValidationResult: s,
|
|
2882
|
+
exportToHTML: f,
|
|
2883
|
+
clearEditor: d
|
|
3276
2884
|
};
|
|
2885
|
+
}, Zc = ({
|
|
2886
|
+
initialContent: e = "",
|
|
2887
|
+
onSave: t,
|
|
2888
|
+
onExport: n,
|
|
2889
|
+
onChange: r,
|
|
2890
|
+
showButtons: o = !1,
|
|
2891
|
+
showSaveTitle: i = !1,
|
|
2892
|
+
showStatusBar: c = !1
|
|
2893
|
+
}) => {
|
|
2894
|
+
const {
|
|
2895
|
+
editorState: s,
|
|
2896
|
+
editorRef: f,
|
|
2897
|
+
updateContent: d,
|
|
2898
|
+
updateTitle: h,
|
|
2899
|
+
executeCommand: v,
|
|
2900
|
+
getValidationResult: _,
|
|
2901
|
+
exportToHTML: l,
|
|
2902
|
+
clearEditor: b
|
|
2903
|
+
} = zc(e), [R, j] = ae(!1);
|
|
2904
|
+
Ee(() => {
|
|
2905
|
+
if (r)
|
|
2906
|
+
try {
|
|
2907
|
+
const $ = l({ includeStyles: !1, includeMeta: !1 });
|
|
2908
|
+
r(s.content, $, s.title);
|
|
2909
|
+
} catch {
|
|
2910
|
+
const F = `<!DOCTYPE html><html><body>${s.content}</body></html>`;
|
|
2911
|
+
r(s.content, F, s.title);
|
|
2912
|
+
}
|
|
2913
|
+
}, [s.content, s.title, r, l]);
|
|
2914
|
+
const U = P(() => {
|
|
2915
|
+
if (_().success) {
|
|
2916
|
+
const F = l();
|
|
2917
|
+
t?.(s.content, F);
|
|
2918
|
+
} else
|
|
2919
|
+
j(!0), setTimeout(() => j(!1), 3e3);
|
|
2920
|
+
}, [s.content, _, l, t]), C = P(() => {
|
|
2921
|
+
try {
|
|
2922
|
+
const $ = l();
|
|
2923
|
+
n?.($);
|
|
2924
|
+
const F = new Blob([$], { type: "text/html" }), ee = URL.createObjectURL(F), D = document.createElement("a");
|
|
2925
|
+
D.href = ee, D.download = `${s.title.replace(/\s+/g, "_") || "document"}.html`, document.body.appendChild(D), D.click(), document.body.removeChild(D), URL.revokeObjectURL(ee);
|
|
2926
|
+
} catch ($) {
|
|
2927
|
+
alert(
|
|
2928
|
+
"Export failed: " + ($ instanceof Error ? $.message : "Unknown error")
|
|
2929
|
+
);
|
|
2930
|
+
}
|
|
2931
|
+
}, [l, s.title, n]), S = P(() => {
|
|
2932
|
+
confirm(
|
|
2933
|
+
"Are you sure you want to clear the editor? All unsaved changes will be lost."
|
|
2934
|
+
) && b();
|
|
2935
|
+
}, [b]), A = P(
|
|
2936
|
+
($) => {
|
|
2937
|
+
d($);
|
|
2938
|
+
},
|
|
2939
|
+
[d]
|
|
2940
|
+
), N = P(
|
|
2941
|
+
($) => {
|
|
2942
|
+
h($);
|
|
2943
|
+
},
|
|
2944
|
+
[h]
|
|
2945
|
+
);
|
|
2946
|
+
return /* @__PURE__ */ p.jsxs("div", { className: "w-full max-w-6xl mx-auto bg-white rounded-xl shadow-lg overflow-hidden", children: [
|
|
2947
|
+
i && /* @__PURE__ */ p.jsxs("div", { className: "p-6 border-b border-gray-200 bg-gray-50", children: [
|
|
2948
|
+
/* @__PURE__ */ p.jsx(
|
|
2949
|
+
"input",
|
|
2950
|
+
{
|
|
2951
|
+
type: "text",
|
|
2952
|
+
className: "w-full bg-transparent text-2xl font-bold text-gray-800 outline-none placeholder-gray-400",
|
|
2953
|
+
value: s.title,
|
|
2954
|
+
onChange: ($) => N($.target.value),
|
|
2955
|
+
placeholder: "Document Title"
|
|
2956
|
+
}
|
|
2957
|
+
),
|
|
2958
|
+
R && /* @__PURE__ */ p.jsx("div", { className: "text-red-600 text-sm mt-2 animate-fadeIn", children: "Please add content before saving" })
|
|
2959
|
+
] }),
|
|
2960
|
+
/* @__PURE__ */ p.jsx(
|
|
2961
|
+
un,
|
|
2962
|
+
{
|
|
2963
|
+
onCommand: v,
|
|
2964
|
+
onSave: U,
|
|
2965
|
+
onExport: C,
|
|
2966
|
+
showButtons: o,
|
|
2967
|
+
onClear: S,
|
|
2968
|
+
hasUnsavedChanges: s.hasUnsavedChanges
|
|
2969
|
+
}
|
|
2970
|
+
),
|
|
2971
|
+
/* @__PURE__ */ p.jsx(
|
|
2972
|
+
"div",
|
|
2973
|
+
{
|
|
2974
|
+
ref: f,
|
|
2975
|
+
className: `min-h-[500px] p-8 border-none outline-none resize-none text-gray-700 leading-relaxed prose max-w-none\r
|
|
2976
|
+
/* Heading styles */\r
|
|
2977
|
+
[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:mt-6 [&_h1]:mb-4 [&_h1]:text-gray-800 [&_h1]:border-b [&_h1]:pb-2\r
|
|
2978
|
+
[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:mt-5 [&_h2]:mb-3 [&_h2]:text-gray-800\r
|
|
2979
|
+
[&_h3]:text-xl [&_h3]:font-bold [&_h3]:mt-4 [&_h3]:mb-2 [&_h3]:text-gray-800\r
|
|
2980
|
+
/* Paragraph styles */\r
|
|
2981
|
+
[&_p]:mb-4 [&_p]:text-gray-700 [&_p]:leading-relaxed\r
|
|
2982
|
+
/* List styles */\r
|
|
2983
|
+
[&_ul]:list-disc [&_ul]:list-inside [&_ul]:mb-4 [&_ul]:ml-4 [&_ul]:space-y-1\r
|
|
2984
|
+
[&_ol]:list-decimal [&_ol]:list-inside [&_ol]:mb-4 [&_ol]:ml-4 [&_ol]:space-y-1\r
|
|
2985
|
+
[&_li]:mb-1\r
|
|
2986
|
+
/* Link styles */\r
|
|
2987
|
+
[&_a]:text-blue-600 [&_a]:hover:text-blue-800 [&_a]:underline [&_a]:transition-colors\r
|
|
2988
|
+
/* Blockquote styles */\r
|
|
2989
|
+
[&_blockquote]:border-l-4 [&_blockquote]:border-blue-500 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:text-gray-600 [&_blockquote]:my-4\r
|
|
2990
|
+
/* Code styles */\r
|
|
2991
|
+
[&_code]:bg-gray-100 [&_code]:px-2 [&_code]:py-1 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono\r
|
|
2992
|
+
[&_pre]:bg-gray-800 [&_pre]:text-gray-100 [&_pre]:p-4 [&_pre]:rounded-lg [&_pre]:overflow-x-auto [&_pre]:my-4\r
|
|
2993
|
+
[&_pre_code]:bg-transparent [&_pre_code]:text-inherit [&_pre_code]:p-0`,
|
|
2994
|
+
contentEditable: !0,
|
|
2995
|
+
onInput: ($) => A($.currentTarget.innerHTML),
|
|
2996
|
+
onBlur: ($) => A($.currentTarget.innerHTML),
|
|
2997
|
+
suppressContentEditableWarning: !0
|
|
2998
|
+
}
|
|
2999
|
+
),
|
|
3000
|
+
c && /* @__PURE__ */ p.jsx(
|
|
3001
|
+
ln,
|
|
3002
|
+
{
|
|
3003
|
+
wordCount: s.wordCount,
|
|
3004
|
+
characterCount: s.characterCount,
|
|
3005
|
+
hasUnsavedChanges: s.hasUnsavedChanges
|
|
3006
|
+
}
|
|
3007
|
+
)
|
|
3008
|
+
] });
|
|
3277
3009
|
};
|
|
3278
3010
|
export {
|
|
3279
|
-
|
|
3280
|
-
|
|
3011
|
+
Zc as TextEditor,
|
|
3012
|
+
zc as useTextEditor
|
|
3281
3013
|
};
|