@abduljebar/text-editor 1.1.3 → 1.2.0
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 +1246 -1531
- package/dist/index.umd.cjs +26 -59
- 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 Yt, Italic as qt, 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 S:
|
|
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 C:
|
|
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,363 @@ 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 Y = Object.keys(g).filter(function(Lt) {
|
|
203
|
+
return Lt !== "key";
|
|
204
204
|
});
|
|
205
|
-
|
|
205
|
+
x = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", Le[T + x] || (Y = 0 < Y.length ? "{" + Y.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
|
+
Y,
|
|
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"), S = Symbol.for("react.profiler"), C = 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, S = U.tagName.toLowerCase();
|
|
298
|
+
if (["h1", "h2", "p", "div"].includes(S)) {
|
|
299
|
+
S === "h1" || S === "h2" ? (b = S, l.push(`formatBlock:${S}`)) : (S === "p" || S === "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(Yt, { size: 18 }),
|
|
325
|
+
title: "Bold"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "italic",
|
|
329
|
+
command: "italic",
|
|
330
|
+
icon: /* @__PURE__ */ p.jsx(qt, { 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"
|
|
374
|
+
},
|
|
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"
|
|
427
382
|
},
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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
|
|
423
|
+
${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"}`,
|
|
424
|
+
children: l.icon
|
|
425
|
+
},
|
|
426
|
+
l.id
|
|
427
|
+
);
|
|
428
|
+
}) }),
|
|
429
|
+
o && /* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2 mt-2 sm:mt-0", children: [
|
|
430
|
+
/* @__PURE__ */ p.jsxs(
|
|
431
|
+
"button",
|
|
432
|
+
{
|
|
433
|
+
onClick: t,
|
|
434
|
+
disabled: !i,
|
|
435
|
+
title: "Save Document",
|
|
436
|
+
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",
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ p.jsx(Vt, { size: 16 }),
|
|
439
|
+
/* @__PURE__ */ p.jsx("span", { children: "Save" })
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
),
|
|
443
|
+
/* @__PURE__ */ p.jsxs(
|
|
444
|
+
"button",
|
|
445
|
+
{
|
|
446
|
+
onClick: n,
|
|
447
|
+
title: "Export as HTML",
|
|
448
|
+
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",
|
|
449
|
+
children: [
|
|
450
|
+
/* @__PURE__ */ p.jsx(Wt, { size: 16 }),
|
|
451
|
+
/* @__PURE__ */ p.jsx("span", { children: "Export" })
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
/* @__PURE__ */ p.jsxs(
|
|
456
|
+
"button",
|
|
457
|
+
{
|
|
458
|
+
onClick: r,
|
|
459
|
+
title: "Clear Editor",
|
|
460
|
+
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",
|
|
461
|
+
children: [
|
|
462
|
+
/* @__PURE__ */ p.jsx(Bt, { size: 16 }),
|
|
463
|
+
/* @__PURE__ */ p.jsx("span", { children: "Clear" })
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
)
|
|
467
|
+
] })
|
|
468
|
+
] });
|
|
469
|
+
}, ln = ({
|
|
470
|
+
wordCount: e,
|
|
471
|
+
characterCount: t,
|
|
472
|
+
hasUnsavedChanges: n
|
|
473
|
+
}) => /* @__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: [
|
|
474
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
475
|
+
"Words: ",
|
|
476
|
+
/* @__PURE__ */ p.jsx("strong", { className: "text-gray-800", children: e })
|
|
477
|
+
] }),
|
|
478
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
479
|
+
"Characters: ",
|
|
480
|
+
/* @__PURE__ */ p.jsx("strong", { className: "text-gray-800", children: t })
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
483
|
+
"Status: ",
|
|
484
|
+
/* @__PURE__ */ p.jsx("strong", { className: n ? "text-orange-600" : "text-green-600", children: n ? "Unsaved Changes" : "Saved" })
|
|
485
|
+
] })
|
|
486
|
+
] }) });
|
|
439
487
|
function a(e, t, n) {
|
|
440
|
-
function r(
|
|
441
|
-
var
|
|
442
|
-
Object.defineProperty(
|
|
443
|
-
value:
|
|
488
|
+
function r(s, f) {
|
|
489
|
+
var d;
|
|
490
|
+
Object.defineProperty(s, "_zod", {
|
|
491
|
+
value: s._zod ?? {},
|
|
444
492
|
enumerable: !1
|
|
445
|
-
}), (
|
|
446
|
-
for (const
|
|
447
|
-
|
|
448
|
-
|
|
493
|
+
}), (d = s._zod).traits ?? (d.traits = /* @__PURE__ */ new Set()), s._zod.traits.add(e), t(s, f);
|
|
494
|
+
for (const h in c.prototype)
|
|
495
|
+
h in s || Object.defineProperty(s, h, { value: c.prototype[h].bind(s) });
|
|
496
|
+
s._zod.constr = c, s._zod.def = f;
|
|
449
497
|
}
|
|
450
498
|
const o = n?.Parent ?? Object;
|
|
451
499
|
class i extends o {
|
|
452
500
|
}
|
|
453
501
|
Object.defineProperty(i, "name", { value: e });
|
|
454
|
-
function s
|
|
455
|
-
var
|
|
456
|
-
const
|
|
457
|
-
r(
|
|
458
|
-
for (const
|
|
459
|
-
|
|
460
|
-
return
|
|
502
|
+
function c(s) {
|
|
503
|
+
var f;
|
|
504
|
+
const d = n?.Parent ? new i() : this;
|
|
505
|
+
r(d, s), (f = d._zod).deferred ?? (f.deferred = []);
|
|
506
|
+
for (const h of d._zod.deferred)
|
|
507
|
+
h();
|
|
508
|
+
return d;
|
|
461
509
|
}
|
|
462
|
-
return Object.defineProperty(
|
|
463
|
-
value: (
|
|
464
|
-
}), Object.defineProperty(
|
|
510
|
+
return Object.defineProperty(c, "init", { value: r }), Object.defineProperty(c, Symbol.hasInstance, {
|
|
511
|
+
value: (s) => n?.Parent && s instanceof n.Parent ? !0 : s?._zod?.traits?.has(e)
|
|
512
|
+
}), Object.defineProperty(c, "name", { value: e }), c;
|
|
465
513
|
}
|
|
466
|
-
class
|
|
514
|
+
class J extends Error {
|
|
467
515
|
constructor() {
|
|
468
516
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
469
517
|
}
|
|
470
518
|
}
|
|
471
|
-
class
|
|
519
|
+
class ht extends Error {
|
|
472
520
|
constructor(t) {
|
|
473
521
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
474
522
|
}
|
|
475
523
|
}
|
|
476
|
-
const
|
|
524
|
+
const mt = {};
|
|
477
525
|
function M(e) {
|
|
478
|
-
return
|
|
526
|
+
return mt;
|
|
479
527
|
}
|
|
480
|
-
function
|
|
528
|
+
function dn(e) {
|
|
481
529
|
const t = Object.values(e).filter((r) => typeof r == "number");
|
|
482
530
|
return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
|
|
483
531
|
}
|
|
484
|
-
function
|
|
532
|
+
function ze(e, t) {
|
|
485
533
|
return typeof t == "bigint" ? t.toString() : t;
|
|
486
534
|
}
|
|
487
|
-
function
|
|
535
|
+
function xe(e) {
|
|
488
536
|
return {
|
|
489
537
|
get value() {
|
|
490
538
|
{
|
|
@@ -494,30 +542,30 @@ function je(e) {
|
|
|
494
542
|
}
|
|
495
543
|
};
|
|
496
544
|
}
|
|
497
|
-
function
|
|
545
|
+
function Te(e) {
|
|
498
546
|
return e == null;
|
|
499
547
|
}
|
|
500
|
-
function
|
|
548
|
+
function Ae(e) {
|
|
501
549
|
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
502
550
|
return e.slice(t, n);
|
|
503
551
|
}
|
|
504
|
-
function
|
|
552
|
+
function fn(e, t) {
|
|
505
553
|
const n = (e.toString().split(".")[1] || "").length, r = t.toString();
|
|
506
554
|
let o = (r.split(".")[1] || "").length;
|
|
507
555
|
if (o === 0 && /\d?e-\d?/.test(r)) {
|
|
508
|
-
const
|
|
509
|
-
|
|
556
|
+
const f = r.match(/\d?e-(\d?)/);
|
|
557
|
+
f?.[1] && (o = Number.parseInt(f[1]));
|
|
510
558
|
}
|
|
511
|
-
const i = n > o ? n : o,
|
|
512
|
-
return
|
|
559
|
+
const i = n > o ? n : o, c = Number.parseInt(e.toFixed(i).replace(".", "")), s = Number.parseInt(t.toFixed(i).replace(".", ""));
|
|
560
|
+
return c % s / 10 ** i;
|
|
513
561
|
}
|
|
514
|
-
const
|
|
562
|
+
const We = Symbol("evaluating");
|
|
515
563
|
function w(e, t, n) {
|
|
516
564
|
let r;
|
|
517
565
|
Object.defineProperty(e, t, {
|
|
518
566
|
get() {
|
|
519
|
-
if (r !==
|
|
520
|
-
return r === void 0 && (r =
|
|
567
|
+
if (r !== We)
|
|
568
|
+
return r === void 0 && (r = We, r = n()), r;
|
|
521
569
|
},
|
|
522
570
|
set(o) {
|
|
523
571
|
Object.defineProperty(e, t, {
|
|
@@ -544,15 +592,15 @@ function B(...e) {
|
|
|
544
592
|
}
|
|
545
593
|
return Object.defineProperties({}, t);
|
|
546
594
|
}
|
|
547
|
-
function
|
|
595
|
+
function Be(e) {
|
|
548
596
|
return JSON.stringify(e);
|
|
549
597
|
}
|
|
550
|
-
const
|
|
598
|
+
const pt = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
551
599
|
};
|
|
552
|
-
function
|
|
600
|
+
function ue(e) {
|
|
553
601
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
554
602
|
}
|
|
555
|
-
const
|
|
603
|
+
const hn = xe(() => {
|
|
556
604
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
557
605
|
return !1;
|
|
558
606
|
try {
|
|
@@ -562,20 +610,20 @@ const $n = je(() => {
|
|
|
562
610
|
return !1;
|
|
563
611
|
}
|
|
564
612
|
});
|
|
565
|
-
function
|
|
566
|
-
if (
|
|
613
|
+
function X(e) {
|
|
614
|
+
if (ue(e) === !1)
|
|
567
615
|
return !1;
|
|
568
616
|
const t = e.constructor;
|
|
569
617
|
if (t === void 0)
|
|
570
618
|
return !0;
|
|
571
619
|
const n = t.prototype;
|
|
572
|
-
return !(
|
|
620
|
+
return !(ue(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
573
621
|
}
|
|
574
|
-
function
|
|
575
|
-
return
|
|
622
|
+
function _t(e) {
|
|
623
|
+
return X(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
576
624
|
}
|
|
577
|
-
const
|
|
578
|
-
function
|
|
625
|
+
const mn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
626
|
+
function fe(e) {
|
|
579
627
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
580
628
|
}
|
|
581
629
|
function L(e, t, n) {
|
|
@@ -595,17 +643,17 @@ function m(e) {
|
|
|
595
643
|
}
|
|
596
644
|
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
597
645
|
}
|
|
598
|
-
function
|
|
646
|
+
function pn(e) {
|
|
599
647
|
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
600
648
|
}
|
|
601
|
-
const
|
|
649
|
+
const _n = {
|
|
602
650
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
603
651
|
int32: [-2147483648, 2147483647],
|
|
604
652
|
uint32: [0, 4294967295],
|
|
605
653
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
606
654
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
607
655
|
};
|
|
608
|
-
function
|
|
656
|
+
function gn(e, t) {
|
|
609
657
|
const n = e._zod.def, r = B(e._zod.def, {
|
|
610
658
|
get shape() {
|
|
611
659
|
const o = {};
|
|
@@ -620,7 +668,7 @@ function Tn(e, t) {
|
|
|
620
668
|
});
|
|
621
669
|
return L(e, r);
|
|
622
670
|
}
|
|
623
|
-
function
|
|
671
|
+
function vn(e, t) {
|
|
624
672
|
const n = e._zod.def, r = B(e._zod.def, {
|
|
625
673
|
get shape() {
|
|
626
674
|
const o = { ...e._zod.def.shape };
|
|
@@ -635,8 +683,8 @@ function Sn(e, t) {
|
|
|
635
683
|
});
|
|
636
684
|
return L(e, r);
|
|
637
685
|
}
|
|
638
|
-
function
|
|
639
|
-
if (!
|
|
686
|
+
function bn(e, t) {
|
|
687
|
+
if (!X(t))
|
|
640
688
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
641
689
|
const n = e._zod.def.checks;
|
|
642
690
|
if (n && n.length > 0)
|
|
@@ -650,8 +698,8 @@ function In(e, t) {
|
|
|
650
698
|
});
|
|
651
699
|
return L(e, o);
|
|
652
700
|
}
|
|
653
|
-
function
|
|
654
|
-
if (!
|
|
701
|
+
function wn(e, t) {
|
|
702
|
+
if (!X(t))
|
|
655
703
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
656
704
|
const n = {
|
|
657
705
|
...e._zod.def,
|
|
@@ -663,7 +711,7 @@ function jn(e, t) {
|
|
|
663
711
|
};
|
|
664
712
|
return L(e, n);
|
|
665
713
|
}
|
|
666
|
-
function
|
|
714
|
+
function kn(e, t) {
|
|
667
715
|
const n = B(e._zod.def, {
|
|
668
716
|
get shape() {
|
|
669
717
|
const r = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
@@ -677,49 +725,49 @@ function An(e, t) {
|
|
|
677
725
|
});
|
|
678
726
|
return L(e, n);
|
|
679
727
|
}
|
|
680
|
-
function
|
|
728
|
+
function zn(e, t, n) {
|
|
681
729
|
const r = B(t._zod.def, {
|
|
682
730
|
get shape() {
|
|
683
731
|
const o = t._zod.def.shape, i = { ...o };
|
|
684
732
|
if (n)
|
|
685
|
-
for (const
|
|
686
|
-
if (!(
|
|
687
|
-
throw new Error(`Unrecognized key: "${
|
|
688
|
-
n[
|
|
733
|
+
for (const c in n) {
|
|
734
|
+
if (!(c in o))
|
|
735
|
+
throw new Error(`Unrecognized key: "${c}"`);
|
|
736
|
+
n[c] && (i[c] = e ? new e({
|
|
689
737
|
type: "optional",
|
|
690
|
-
innerType: o[
|
|
691
|
-
}) : o[
|
|
738
|
+
innerType: o[c]
|
|
739
|
+
}) : o[c]);
|
|
692
740
|
}
|
|
693
741
|
else
|
|
694
|
-
for (const
|
|
695
|
-
i[
|
|
742
|
+
for (const c in o)
|
|
743
|
+
i[c] = e ? new e({
|
|
696
744
|
type: "optional",
|
|
697
|
-
innerType: o[
|
|
698
|
-
}) : o[
|
|
745
|
+
innerType: o[c]
|
|
746
|
+
}) : o[c];
|
|
699
747
|
return W(this, "shape", i), i;
|
|
700
748
|
},
|
|
701
749
|
checks: []
|
|
702
750
|
});
|
|
703
751
|
return L(t, r);
|
|
704
752
|
}
|
|
705
|
-
function
|
|
753
|
+
function yn(e, t, n) {
|
|
706
754
|
const r = B(t._zod.def, {
|
|
707
755
|
get shape() {
|
|
708
756
|
const o = t._zod.def.shape, i = { ...o };
|
|
709
757
|
if (n)
|
|
710
|
-
for (const
|
|
711
|
-
if (!(
|
|
712
|
-
throw new Error(`Unrecognized key: "${
|
|
713
|
-
n[
|
|
758
|
+
for (const c in n) {
|
|
759
|
+
if (!(c in i))
|
|
760
|
+
throw new Error(`Unrecognized key: "${c}"`);
|
|
761
|
+
n[c] && (i[c] = new e({
|
|
714
762
|
type: "nonoptional",
|
|
715
|
-
innerType: o[
|
|
763
|
+
innerType: o[c]
|
|
716
764
|
}));
|
|
717
765
|
}
|
|
718
766
|
else
|
|
719
|
-
for (const
|
|
720
|
-
i[
|
|
767
|
+
for (const c in o)
|
|
768
|
+
i[c] = new e({
|
|
721
769
|
type: "nonoptional",
|
|
722
|
-
innerType: o[
|
|
770
|
+
innerType: o[c]
|
|
723
771
|
});
|
|
724
772
|
return W(this, "shape", i), i;
|
|
725
773
|
},
|
|
@@ -727,7 +775,7 @@ function On(e, t, n) {
|
|
|
727
775
|
});
|
|
728
776
|
return L(t, r);
|
|
729
777
|
}
|
|
730
|
-
function
|
|
778
|
+
function q(e, t = 0) {
|
|
731
779
|
if (e.aborted === !0)
|
|
732
780
|
return !0;
|
|
733
781
|
for (let n = t; n < e.issues.length; n++)
|
|
@@ -735,27 +783,27 @@ function J(e, t = 0) {
|
|
|
735
783
|
return !0;
|
|
736
784
|
return !1;
|
|
737
785
|
}
|
|
738
|
-
function
|
|
786
|
+
function gt(e, t) {
|
|
739
787
|
return t.map((n) => {
|
|
740
788
|
var r;
|
|
741
789
|
return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
|
|
742
790
|
});
|
|
743
791
|
}
|
|
744
|
-
function
|
|
792
|
+
function re(e) {
|
|
745
793
|
return typeof e == "string" ? e : e?.message;
|
|
746
794
|
}
|
|
747
795
|
function V(e, t, n) {
|
|
748
796
|
const r = { ...e, path: e.path ?? [] };
|
|
749
797
|
if (!e.message) {
|
|
750
|
-
const o =
|
|
798
|
+
const o = re(e.inst?._zod.def?.error?.(e)) ?? re(t?.error?.(e)) ?? re(n.customError?.(e)) ?? re(n.localeError?.(e)) ?? "Invalid input";
|
|
751
799
|
r.message = o;
|
|
752
800
|
}
|
|
753
801
|
return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
|
|
754
802
|
}
|
|
755
|
-
function
|
|
803
|
+
function je(e) {
|
|
756
804
|
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
757
805
|
}
|
|
758
|
-
function
|
|
806
|
+
function K(...e) {
|
|
759
807
|
const [t, n, r] = e;
|
|
760
808
|
return typeof t == "string" ? {
|
|
761
809
|
message: t,
|
|
@@ -764,122 +812,122 @@ function te(...e) {
|
|
|
764
812
|
inst: r
|
|
765
813
|
} : { ...t };
|
|
766
814
|
}
|
|
767
|
-
const
|
|
815
|
+
const vt = (e, t) => {
|
|
768
816
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
769
817
|
value: e._zod,
|
|
770
818
|
enumerable: !1
|
|
771
819
|
}), Object.defineProperty(e, "issues", {
|
|
772
820
|
value: t,
|
|
773
821
|
enumerable: !1
|
|
774
|
-
}), e.message = JSON.stringify(t,
|
|
822
|
+
}), e.message = JSON.stringify(t, ze, 2), Object.defineProperty(e, "toString", {
|
|
775
823
|
value: () => e.message,
|
|
776
824
|
enumerable: !1
|
|
777
825
|
});
|
|
778
|
-
},
|
|
779
|
-
function
|
|
826
|
+
}, bt = a("$ZodError", vt), wt = a("$ZodError", vt, { Parent: Error });
|
|
827
|
+
function $n(e, t = (n) => n.message) {
|
|
780
828
|
const n = {}, r = [];
|
|
781
829
|
for (const o of e.issues)
|
|
782
830
|
o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
|
|
783
831
|
return { formErrors: r, fieldErrors: n };
|
|
784
832
|
}
|
|
785
|
-
function
|
|
833
|
+
function Zn(e, t) {
|
|
786
834
|
const n = t || function(i) {
|
|
787
835
|
return i.message;
|
|
788
836
|
}, 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(
|
|
837
|
+
for (const c of i.issues)
|
|
838
|
+
if (c.code === "invalid_union" && c.errors.length)
|
|
839
|
+
c.errors.map((s) => o({ issues: s }));
|
|
840
|
+
else if (c.code === "invalid_key")
|
|
841
|
+
o({ issues: c.issues });
|
|
842
|
+
else if (c.code === "invalid_element")
|
|
843
|
+
o({ issues: c.issues });
|
|
844
|
+
else if (c.path.length === 0)
|
|
845
|
+
r._errors.push(n(c));
|
|
798
846
|
else {
|
|
799
|
-
let
|
|
800
|
-
for (;
|
|
801
|
-
const
|
|
802
|
-
|
|
847
|
+
let s = r, f = 0;
|
|
848
|
+
for (; f < c.path.length; ) {
|
|
849
|
+
const d = c.path[f];
|
|
850
|
+
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
851
|
}
|
|
804
852
|
}
|
|
805
853
|
};
|
|
806
854
|
return o(e), r;
|
|
807
855
|
}
|
|
808
|
-
const
|
|
809
|
-
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 },
|
|
810
|
-
if (
|
|
811
|
-
throw new
|
|
812
|
-
if (
|
|
813
|
-
const
|
|
814
|
-
throw
|
|
856
|
+
const Ie = (e) => (t, n, r, o) => {
|
|
857
|
+
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, c = t._zod.run({ value: n, issues: [] }, i);
|
|
858
|
+
if (c instanceof Promise)
|
|
859
|
+
throw new J();
|
|
860
|
+
if (c.issues.length) {
|
|
861
|
+
const s = new (o?.Err ?? e)(c.issues.map((f) => V(f, i, M())));
|
|
862
|
+
throw pt(s, o?.callee), s;
|
|
815
863
|
}
|
|
816
|
-
return
|
|
817
|
-
},
|
|
864
|
+
return c.value;
|
|
865
|
+
}, Se = (e) => async (t, n, r, o) => {
|
|
818
866
|
const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
819
|
-
let
|
|
820
|
-
if (
|
|
821
|
-
const
|
|
822
|
-
throw
|
|
867
|
+
let c = t._zod.run({ value: n, issues: [] }, i);
|
|
868
|
+
if (c instanceof Promise && (c = await c), c.issues.length) {
|
|
869
|
+
const s = new (o?.Err ?? e)(c.issues.map((f) => V(f, i, M())));
|
|
870
|
+
throw pt(s, o?.callee), s;
|
|
823
871
|
}
|
|
824
|
-
return
|
|
825
|
-
},
|
|
872
|
+
return c.value;
|
|
873
|
+
}, he = (e) => (t, n, r) => {
|
|
826
874
|
const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
|
|
827
875
|
if (i instanceof Promise)
|
|
828
|
-
throw new
|
|
876
|
+
throw new J();
|
|
829
877
|
return i.issues.length ? {
|
|
830
878
|
success: !1,
|
|
831
|
-
error: new (e ??
|
|
879
|
+
error: new (e ?? bt)(i.issues.map((c) => V(c, o, M())))
|
|
832
880
|
} : { success: !0, data: i.value };
|
|
833
|
-
},
|
|
881
|
+
}, En = /* @__PURE__ */ he(wt), me = (e) => async (t, n, r) => {
|
|
834
882
|
const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
835
883
|
let i = t._zod.run({ value: n, issues: [] }, o);
|
|
836
884
|
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
837
885
|
success: !1,
|
|
838
|
-
error: new e(i.issues.map((
|
|
886
|
+
error: new e(i.issues.map((c) => V(c, o, M())))
|
|
839
887
|
} : { success: !0, data: i.value };
|
|
840
|
-
},
|
|
888
|
+
}, xn = /* @__PURE__ */ me(wt), Tn = (e) => (t, n, r) => {
|
|
841
889
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
842
|
-
return
|
|
843
|
-
},
|
|
890
|
+
return Ie(e)(t, n, o);
|
|
891
|
+
}, An = (e) => (t, n, r) => Ie(e)(t, n, r), jn = (e) => async (t, n, r) => {
|
|
844
892
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
845
|
-
return
|
|
846
|
-
},
|
|
893
|
+
return Se(e)(t, n, o);
|
|
894
|
+
}, In = (e) => async (t, n, r) => Se(e)(t, n, r), Sn = (e) => (t, n, r) => {
|
|
847
895
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
848
|
-
return
|
|
849
|
-
},
|
|
896
|
+
return he(e)(t, n, o);
|
|
897
|
+
}, Cn = (e) => (t, n, r) => he(e)(t, n, r), On = (e) => async (t, n, r) => {
|
|
850
898
|
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
851
|
-
return
|
|
852
|
-
},
|
|
853
|
-
function
|
|
854
|
-
return new RegExp(
|
|
899
|
+
return me(e)(t, n, o);
|
|
900
|
+
}, 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})$/, Ye = (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})+$";
|
|
901
|
+
function Yn() {
|
|
902
|
+
return new RegExp(Bn, "u");
|
|
855
903
|
}
|
|
856
|
-
const
|
|
857
|
-
function
|
|
904
|
+
const qn = /^(?:(?: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}$`);
|
|
905
|
+
function yt(e) {
|
|
858
906
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
859
907
|
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
908
|
}
|
|
861
|
-
function
|
|
862
|
-
return new RegExp(`^${
|
|
909
|
+
function tr(e) {
|
|
910
|
+
return new RegExp(`^${yt(e)}$`);
|
|
863
911
|
}
|
|
864
|
-
function
|
|
865
|
-
const t =
|
|
912
|
+
function nr(e) {
|
|
913
|
+
const t = yt({ precision: e.precision }), n = ["Z"];
|
|
866
914
|
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
867
915
|
const r = `${t}(?:${n.join("|")})`;
|
|
868
|
-
return new RegExp(`^${
|
|
916
|
+
return new RegExp(`^${zt}T(?:${r})$`);
|
|
869
917
|
}
|
|
870
|
-
const
|
|
918
|
+
const rr = (e) => {
|
|
871
919
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
872
920
|
return new RegExp(`^${t}$`);
|
|
873
|
-
},
|
|
921
|
+
}, or = /^-?\d+$/, ir = /^-?\d+(?:\.\d+)?/, cr = /^(?:true|false)$/i, sr = /^[^A-Z]*$/, ar = /^[^a-z]*$/, I = /* @__PURE__ */ a("$ZodCheck", (e, t) => {
|
|
874
922
|
var n;
|
|
875
923
|
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
876
|
-
}),
|
|
924
|
+
}), $t = {
|
|
877
925
|
number: "number",
|
|
878
926
|
bigint: "bigint",
|
|
879
927
|
object: "date"
|
|
880
|
-
},
|
|
881
|
-
|
|
882
|
-
const n =
|
|
928
|
+
}, Zt = /* @__PURE__ */ a("$ZodCheckLessThan", (e, t) => {
|
|
929
|
+
I.init(e, t);
|
|
930
|
+
const n = $t[typeof t.value];
|
|
883
931
|
e._zod.onattach.push((r) => {
|
|
884
932
|
const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
885
933
|
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
@@ -894,9 +942,9 @@ const mr = (e) => {
|
|
|
894
942
|
continue: !t.abort
|
|
895
943
|
});
|
|
896
944
|
};
|
|
897
|
-
}),
|
|
898
|
-
|
|
899
|
-
const n =
|
|
945
|
+
}), Et = /* @__PURE__ */ a("$ZodCheckGreaterThan", (e, t) => {
|
|
946
|
+
I.init(e, t);
|
|
947
|
+
const n = $t[typeof t.value];
|
|
900
948
|
e._zod.onattach.push((r) => {
|
|
901
949
|
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
902
950
|
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
@@ -911,14 +959,14 @@ const mr = (e) => {
|
|
|
911
959
|
continue: !t.abort
|
|
912
960
|
});
|
|
913
961
|
};
|
|
914
|
-
}),
|
|
915
|
-
|
|
962
|
+
}), ur = /* @__PURE__ */ a("$ZodCheckMultipleOf", (e, t) => {
|
|
963
|
+
I.init(e, t), e._zod.onattach.push((n) => {
|
|
916
964
|
var r;
|
|
917
965
|
(r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
|
|
918
966
|
}), e._zod.check = (n) => {
|
|
919
967
|
if (typeof n.value != typeof t.value)
|
|
920
968
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
921
|
-
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) :
|
|
969
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : fn(n.value, t.value) === 0) || n.issues.push({
|
|
922
970
|
origin: typeof n.value,
|
|
923
971
|
code: "not_multiple_of",
|
|
924
972
|
divisor: t.value,
|
|
@@ -927,37 +975,37 @@ const mr = (e) => {
|
|
|
927
975
|
continue: !t.abort
|
|
928
976
|
});
|
|
929
977
|
};
|
|
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
|
|
978
|
+
}), lr = /* @__PURE__ */ a("$ZodCheckNumberFormat", (e, t) => {
|
|
979
|
+
I.init(e, t), t.format = t.format || "float64";
|
|
980
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = _n[t.format];
|
|
981
|
+
e._zod.onattach.push((c) => {
|
|
982
|
+
const s = c._zod.bag;
|
|
983
|
+
s.format = t.format, s.minimum = o, s.maximum = i, n && (s.pattern = or);
|
|
984
|
+
}), e._zod.check = (c) => {
|
|
985
|
+
const s = c.value;
|
|
938
986
|
if (n) {
|
|
939
|
-
if (!Number.isInteger(
|
|
940
|
-
|
|
987
|
+
if (!Number.isInteger(s)) {
|
|
988
|
+
c.issues.push({
|
|
941
989
|
expected: r,
|
|
942
990
|
format: t.format,
|
|
943
991
|
code: "invalid_type",
|
|
944
992
|
continue: !1,
|
|
945
|
-
input:
|
|
993
|
+
input: s,
|
|
946
994
|
inst: e
|
|
947
995
|
});
|
|
948
996
|
return;
|
|
949
997
|
}
|
|
950
|
-
if (!Number.isSafeInteger(
|
|
951
|
-
|
|
952
|
-
input:
|
|
998
|
+
if (!Number.isSafeInteger(s)) {
|
|
999
|
+
s > 0 ? c.issues.push({
|
|
1000
|
+
input: s,
|
|
953
1001
|
code: "too_big",
|
|
954
1002
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
955
1003
|
note: "Integers must be within the safe integer range.",
|
|
956
1004
|
inst: e,
|
|
957
1005
|
origin: r,
|
|
958
1006
|
continue: !t.abort
|
|
959
|
-
}) :
|
|
960
|
-
input:
|
|
1007
|
+
}) : c.issues.push({
|
|
1008
|
+
input: s,
|
|
961
1009
|
code: "too_small",
|
|
962
1010
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
963
1011
|
note: "Integers must be within the safe integer range.",
|
|
@@ -968,27 +1016,27 @@ const mr = (e) => {
|
|
|
968
1016
|
return;
|
|
969
1017
|
}
|
|
970
1018
|
}
|
|
971
|
-
|
|
1019
|
+
s < o && c.issues.push({
|
|
972
1020
|
origin: "number",
|
|
973
|
-
input:
|
|
1021
|
+
input: s,
|
|
974
1022
|
code: "too_small",
|
|
975
1023
|
minimum: o,
|
|
976
1024
|
inclusive: !0,
|
|
977
1025
|
inst: e,
|
|
978
1026
|
continue: !t.abort
|
|
979
|
-
}),
|
|
1027
|
+
}), s > i && c.issues.push({
|
|
980
1028
|
origin: "number",
|
|
981
|
-
input:
|
|
1029
|
+
input: s,
|
|
982
1030
|
code: "too_big",
|
|
983
1031
|
maximum: i,
|
|
984
1032
|
inst: e
|
|
985
1033
|
});
|
|
986
1034
|
};
|
|
987
|
-
}),
|
|
1035
|
+
}), dr = /* @__PURE__ */ a("$ZodCheckMaxLength", (e, t) => {
|
|
988
1036
|
var n;
|
|
989
|
-
|
|
1037
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
990
1038
|
const o = r.value;
|
|
991
|
-
return !
|
|
1039
|
+
return !Te(o) && o.length !== void 0;
|
|
992
1040
|
}), e._zod.onattach.push((r) => {
|
|
993
1041
|
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
994
1042
|
t.maximum < o && (r._zod.bag.maximum = t.maximum);
|
|
@@ -996,9 +1044,9 @@ const mr = (e) => {
|
|
|
996
1044
|
const o = r.value;
|
|
997
1045
|
if (o.length <= t.maximum)
|
|
998
1046
|
return;
|
|
999
|
-
const
|
|
1047
|
+
const c = je(o);
|
|
1000
1048
|
r.issues.push({
|
|
1001
|
-
origin:
|
|
1049
|
+
origin: c,
|
|
1002
1050
|
code: "too_big",
|
|
1003
1051
|
maximum: t.maximum,
|
|
1004
1052
|
inclusive: !0,
|
|
@@ -1007,11 +1055,11 @@ const mr = (e) => {
|
|
|
1007
1055
|
continue: !t.abort
|
|
1008
1056
|
});
|
|
1009
1057
|
};
|
|
1010
|
-
}),
|
|
1058
|
+
}), fr = /* @__PURE__ */ a("$ZodCheckMinLength", (e, t) => {
|
|
1011
1059
|
var n;
|
|
1012
|
-
|
|
1060
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1013
1061
|
const o = r.value;
|
|
1014
|
-
return !
|
|
1062
|
+
return !Te(o) && o.length !== void 0;
|
|
1015
1063
|
}), e._zod.onattach.push((r) => {
|
|
1016
1064
|
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1017
1065
|
t.minimum > o && (r._zod.bag.minimum = t.minimum);
|
|
@@ -1019,9 +1067,9 @@ const mr = (e) => {
|
|
|
1019
1067
|
const o = r.value;
|
|
1020
1068
|
if (o.length >= t.minimum)
|
|
1021
1069
|
return;
|
|
1022
|
-
const
|
|
1070
|
+
const c = je(o);
|
|
1023
1071
|
r.issues.push({
|
|
1024
|
-
origin:
|
|
1072
|
+
origin: c,
|
|
1025
1073
|
code: "too_small",
|
|
1026
1074
|
minimum: t.minimum,
|
|
1027
1075
|
inclusive: !0,
|
|
@@ -1030,11 +1078,11 @@ const mr = (e) => {
|
|
|
1030
1078
|
continue: !t.abort
|
|
1031
1079
|
});
|
|
1032
1080
|
};
|
|
1033
|
-
}),
|
|
1081
|
+
}), hr = /* @__PURE__ */ a("$ZodCheckLengthEquals", (e, t) => {
|
|
1034
1082
|
var n;
|
|
1035
|
-
|
|
1083
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1036
1084
|
const o = r.value;
|
|
1037
|
-
return !
|
|
1085
|
+
return !Te(o) && o.length !== void 0;
|
|
1038
1086
|
}), e._zod.onattach.push((r) => {
|
|
1039
1087
|
const o = r._zod.bag;
|
|
1040
1088
|
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
@@ -1042,10 +1090,10 @@ const mr = (e) => {
|
|
|
1042
1090
|
const o = r.value, i = o.length;
|
|
1043
1091
|
if (i === t.length)
|
|
1044
1092
|
return;
|
|
1045
|
-
const
|
|
1093
|
+
const c = je(o), s = i > t.length;
|
|
1046
1094
|
r.issues.push({
|
|
1047
|
-
origin:
|
|
1048
|
-
...
|
|
1095
|
+
origin: c,
|
|
1096
|
+
...s ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
1049
1097
|
inclusive: !0,
|
|
1050
1098
|
exact: !0,
|
|
1051
1099
|
input: r.value,
|
|
@@ -1053,9 +1101,9 @@ const mr = (e) => {
|
|
|
1053
1101
|
continue: !t.abort
|
|
1054
1102
|
});
|
|
1055
1103
|
};
|
|
1056
|
-
}),
|
|
1104
|
+
}), pe = /* @__PURE__ */ a("$ZodCheckStringFormat", (e, t) => {
|
|
1057
1105
|
var n, r;
|
|
1058
|
-
|
|
1106
|
+
I.init(e, t), e._zod.onattach.push((o) => {
|
|
1059
1107
|
const i = o._zod.bag;
|
|
1060
1108
|
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
1061
1109
|
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
|
|
@@ -1070,8 +1118,8 @@ const mr = (e) => {
|
|
|
1070
1118
|
});
|
|
1071
1119
|
}) : (r = e._zod).check ?? (r.check = () => {
|
|
1072
1120
|
});
|
|
1073
|
-
}),
|
|
1074
|
-
|
|
1121
|
+
}), mr = /* @__PURE__ */ a("$ZodCheckRegex", (e, t) => {
|
|
1122
|
+
pe.init(e, t), e._zod.check = (n) => {
|
|
1075
1123
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1076
1124
|
origin: "string",
|
|
1077
1125
|
code: "invalid_format",
|
|
@@ -1082,13 +1130,13 @@ const mr = (e) => {
|
|
|
1082
1130
|
continue: !t.abort
|
|
1083
1131
|
});
|
|
1084
1132
|
};
|
|
1085
|
-
}),
|
|
1086
|
-
t.pattern ?? (t.pattern =
|
|
1087
|
-
}),
|
|
1088
|
-
t.pattern ?? (t.pattern =
|
|
1089
|
-
}),
|
|
1090
|
-
|
|
1091
|
-
const n =
|
|
1133
|
+
}), pr = /* @__PURE__ */ a("$ZodCheckLowerCase", (e, t) => {
|
|
1134
|
+
t.pattern ?? (t.pattern = sr), pe.init(e, t);
|
|
1135
|
+
}), _r = /* @__PURE__ */ a("$ZodCheckUpperCase", (e, t) => {
|
|
1136
|
+
t.pattern ?? (t.pattern = ar), pe.init(e, t);
|
|
1137
|
+
}), gr = /* @__PURE__ */ a("$ZodCheckIncludes", (e, t) => {
|
|
1138
|
+
I.init(e, t);
|
|
1139
|
+
const n = fe(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1092
1140
|
t.pattern = r, e._zod.onattach.push((o) => {
|
|
1093
1141
|
const i = o._zod.bag;
|
|
1094
1142
|
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
@@ -1103,9 +1151,9 @@ const mr = (e) => {
|
|
|
1103
1151
|
continue: !t.abort
|
|
1104
1152
|
});
|
|
1105
1153
|
};
|
|
1106
|
-
}),
|
|
1107
|
-
|
|
1108
|
-
const n = new RegExp(`^${
|
|
1154
|
+
}), vr = /* @__PURE__ */ a("$ZodCheckStartsWith", (e, t) => {
|
|
1155
|
+
I.init(e, t);
|
|
1156
|
+
const n = new RegExp(`^${fe(t.prefix)}.*`);
|
|
1109
1157
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1110
1158
|
const o = r._zod.bag;
|
|
1111
1159
|
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
@@ -1120,9 +1168,9 @@ const mr = (e) => {
|
|
|
1120
1168
|
continue: !t.abort
|
|
1121
1169
|
});
|
|
1122
1170
|
};
|
|
1123
|
-
}),
|
|
1124
|
-
|
|
1125
|
-
const n = new RegExp(`.*${
|
|
1171
|
+
}), br = /* @__PURE__ */ a("$ZodCheckEndsWith", (e, t) => {
|
|
1172
|
+
I.init(e, t);
|
|
1173
|
+
const n = new RegExp(`.*${fe(t.suffix)}$`);
|
|
1126
1174
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1127
1175
|
const o = r._zod.bag;
|
|
1128
1176
|
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
@@ -1137,12 +1185,12 @@ const mr = (e) => {
|
|
|
1137
1185
|
continue: !t.abort
|
|
1138
1186
|
});
|
|
1139
1187
|
};
|
|
1140
|
-
}),
|
|
1141
|
-
|
|
1188
|
+
}), wr = /* @__PURE__ */ a("$ZodCheckOverwrite", (e, t) => {
|
|
1189
|
+
I.init(e, t), e._zod.check = (n) => {
|
|
1142
1190
|
n.value = t.tx(n.value);
|
|
1143
1191
|
};
|
|
1144
1192
|
});
|
|
1145
|
-
class
|
|
1193
|
+
class kr {
|
|
1146
1194
|
constructor(t = []) {
|
|
1147
1195
|
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1148
1196
|
}
|
|
@@ -1155,9 +1203,9 @@ class Ar {
|
|
|
1155
1203
|
return;
|
|
1156
1204
|
}
|
|
1157
1205
|
const r = t.split(`
|
|
1158
|
-
`).filter((
|
|
1159
|
-
for (const
|
|
1160
|
-
this.content.push(
|
|
1206
|
+
`).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);
|
|
1207
|
+
for (const c of i)
|
|
1208
|
+
this.content.push(c);
|
|
1161
1209
|
}
|
|
1162
1210
|
compile() {
|
|
1163
1211
|
const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
|
|
@@ -1165,13 +1213,13 @@ class Ar {
|
|
|
1165
1213
|
`));
|
|
1166
1214
|
}
|
|
1167
1215
|
}
|
|
1168
|
-
const
|
|
1216
|
+
const zr = {
|
|
1169
1217
|
major: 4,
|
|
1170
1218
|
minor: 1,
|
|
1171
1219
|
patch: 11
|
|
1172
|
-
},
|
|
1220
|
+
}, Z = /* @__PURE__ */ a("$ZodType", (e, t) => {
|
|
1173
1221
|
var n;
|
|
1174
|
-
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version =
|
|
1222
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = zr;
|
|
1175
1223
|
const r = [...e._zod.def.checks ?? []];
|
|
1176
1224
|
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
1177
1225
|
for (const o of r)
|
|
@@ -1182,69 +1230,69 @@ const Cr = {
|
|
|
1182
1230
|
e._zod.run = e._zod.parse;
|
|
1183
1231
|
});
|
|
1184
1232
|
else {
|
|
1185
|
-
const o = (
|
|
1186
|
-
let
|
|
1187
|
-
for (const
|
|
1188
|
-
if (
|
|
1189
|
-
if (!
|
|
1233
|
+
const o = (c, s, f) => {
|
|
1234
|
+
let d = q(c), h;
|
|
1235
|
+
for (const v of s) {
|
|
1236
|
+
if (v._zod.def.when) {
|
|
1237
|
+
if (!v._zod.def.when(c))
|
|
1190
1238
|
continue;
|
|
1191
|
-
} else if (
|
|
1239
|
+
} else if (d)
|
|
1192
1240
|
continue;
|
|
1193
|
-
const
|
|
1194
|
-
if (
|
|
1195
|
-
throw new
|
|
1196
|
-
if (
|
|
1197
|
-
|
|
1198
|
-
await
|
|
1241
|
+
const _ = c.issues.length, l = v._zod.check(c);
|
|
1242
|
+
if (l instanceof Promise && f?.async === !1)
|
|
1243
|
+
throw new J();
|
|
1244
|
+
if (h || l instanceof Promise)
|
|
1245
|
+
h = (h ?? Promise.resolve()).then(async () => {
|
|
1246
|
+
await l, c.issues.length !== _ && (d || (d = q(c, _)));
|
|
1199
1247
|
});
|
|
1200
1248
|
else {
|
|
1201
|
-
if (
|
|
1249
|
+
if (c.issues.length === _)
|
|
1202
1250
|
continue;
|
|
1203
|
-
|
|
1251
|
+
d || (d = q(c, _));
|
|
1204
1252
|
}
|
|
1205
1253
|
}
|
|
1206
|
-
return
|
|
1207
|
-
}, i = (
|
|
1208
|
-
if (
|
|
1209
|
-
return
|
|
1210
|
-
const
|
|
1211
|
-
if (
|
|
1212
|
-
if (
|
|
1213
|
-
throw new
|
|
1214
|
-
return
|
|
1254
|
+
return h ? h.then(() => c) : c;
|
|
1255
|
+
}, i = (c, s, f) => {
|
|
1256
|
+
if (q(c))
|
|
1257
|
+
return c.aborted = !0, c;
|
|
1258
|
+
const d = o(s, r, f);
|
|
1259
|
+
if (d instanceof Promise) {
|
|
1260
|
+
if (f.async === !1)
|
|
1261
|
+
throw new J();
|
|
1262
|
+
return d.then((h) => e._zod.parse(h, f));
|
|
1215
1263
|
}
|
|
1216
|
-
return e._zod.parse(
|
|
1264
|
+
return e._zod.parse(d, f);
|
|
1217
1265
|
};
|
|
1218
|
-
e._zod.run = (
|
|
1219
|
-
if (
|
|
1220
|
-
return e._zod.parse(
|
|
1221
|
-
if (
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1266
|
+
e._zod.run = (c, s) => {
|
|
1267
|
+
if (s.skipChecks)
|
|
1268
|
+
return e._zod.parse(c, s);
|
|
1269
|
+
if (s.direction === "backward") {
|
|
1270
|
+
const d = e._zod.parse({ value: c.value, issues: [] }, { ...s, skipChecks: !0 });
|
|
1271
|
+
return d instanceof Promise ? d.then((h) => i(h, c, s)) : i(d, c, s);
|
|
1224
1272
|
}
|
|
1225
|
-
const
|
|
1226
|
-
if (
|
|
1227
|
-
if (
|
|
1228
|
-
throw new
|
|
1229
|
-
return
|
|
1273
|
+
const f = e._zod.parse(c, s);
|
|
1274
|
+
if (f instanceof Promise) {
|
|
1275
|
+
if (s.async === !1)
|
|
1276
|
+
throw new J();
|
|
1277
|
+
return f.then((d) => o(d, r, s));
|
|
1230
1278
|
}
|
|
1231
|
-
return o(
|
|
1279
|
+
return o(f, r, s);
|
|
1232
1280
|
};
|
|
1233
1281
|
}
|
|
1234
1282
|
e["~standard"] = {
|
|
1235
1283
|
validate: (o) => {
|
|
1236
1284
|
try {
|
|
1237
|
-
const i =
|
|
1285
|
+
const i = En(e, o);
|
|
1238
1286
|
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
1239
1287
|
} catch {
|
|
1240
|
-
return
|
|
1288
|
+
return xn(e, o).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
|
|
1241
1289
|
}
|
|
1242
1290
|
},
|
|
1243
1291
|
vendor: "zod",
|
|
1244
1292
|
version: 1
|
|
1245
1293
|
};
|
|
1246
|
-
}),
|
|
1247
|
-
|
|
1294
|
+
}), Ce = /* @__PURE__ */ a("$ZodString", (e, t) => {
|
|
1295
|
+
Z.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? rr(e._zod.bag), e._zod.parse = (n, r) => {
|
|
1248
1296
|
if (t.coerce)
|
|
1249
1297
|
try {
|
|
1250
1298
|
n.value = String(n.value);
|
|
@@ -1257,11 +1305,11 @@ const Cr = {
|
|
|
1257
1305
|
inst: e
|
|
1258
1306
|
}), n;
|
|
1259
1307
|
};
|
|
1260
|
-
}),
|
|
1261
|
-
|
|
1262
|
-
}),
|
|
1263
|
-
t.pattern ?? (t.pattern =
|
|
1264
|
-
}),
|
|
1308
|
+
}), k = /* @__PURE__ */ a("$ZodStringFormat", (e, t) => {
|
|
1309
|
+
pe.init(e, t), Ce.init(e, t);
|
|
1310
|
+
}), yr = /* @__PURE__ */ a("$ZodGUID", (e, t) => {
|
|
1311
|
+
t.pattern ?? (t.pattern = Vn), k.init(e, t);
|
|
1312
|
+
}), $r = /* @__PURE__ */ a("$ZodUUID", (e, t) => {
|
|
1265
1313
|
if (t.version) {
|
|
1266
1314
|
const r = {
|
|
1267
1315
|
v1: 1,
|
|
@@ -1275,21 +1323,21 @@ const Cr = {
|
|
|
1275
1323
|
}[t.version];
|
|
1276
1324
|
if (r === void 0)
|
|
1277
1325
|
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
1278
|
-
t.pattern ?? (t.pattern =
|
|
1326
|
+
t.pattern ?? (t.pattern = Ye(r));
|
|
1279
1327
|
} else
|
|
1280
|
-
t.pattern ?? (t.pattern =
|
|
1281
|
-
|
|
1282
|
-
}),
|
|
1283
|
-
t.pattern ?? (t.pattern =
|
|
1284
|
-
}),
|
|
1285
|
-
|
|
1328
|
+
t.pattern ?? (t.pattern = Ye());
|
|
1329
|
+
k.init(e, t);
|
|
1330
|
+
}), Zr = /* @__PURE__ */ a("$ZodEmail", (e, t) => {
|
|
1331
|
+
t.pattern ?? (t.pattern = Wn), k.init(e, t);
|
|
1332
|
+
}), Er = /* @__PURE__ */ a("$ZodURL", (e, t) => {
|
|
1333
|
+
k.init(e, t), e._zod.check = (n) => {
|
|
1286
1334
|
try {
|
|
1287
1335
|
const r = n.value.trim(), o = new URL(r);
|
|
1288
1336
|
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
|
|
1289
1337
|
code: "invalid_format",
|
|
1290
1338
|
format: "url",
|
|
1291
1339
|
note: "Invalid hostname",
|
|
1292
|
-
pattern:
|
|
1340
|
+
pattern: Kn.source,
|
|
1293
1341
|
input: n.value,
|
|
1294
1342
|
inst: e,
|
|
1295
1343
|
continue: !t.abort
|
|
@@ -1313,35 +1361,35 @@ const Cr = {
|
|
|
1313
1361
|
});
|
|
1314
1362
|
}
|
|
1315
1363
|
};
|
|
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 =
|
|
1364
|
+
}), xr = /* @__PURE__ */ a("$ZodEmoji", (e, t) => {
|
|
1365
|
+
t.pattern ?? (t.pattern = Yn()), k.init(e, t);
|
|
1366
|
+
}), Tr = /* @__PURE__ */ a("$ZodNanoID", (e, t) => {
|
|
1367
|
+
t.pattern ?? (t.pattern = Fn), k.init(e, t);
|
|
1368
|
+
}), Ar = /* @__PURE__ */ a("$ZodCUID", (e, t) => {
|
|
1369
|
+
t.pattern ?? (t.pattern = Pn), k.init(e, t);
|
|
1370
|
+
}), jr = /* @__PURE__ */ a("$ZodCUID2", (e, t) => {
|
|
1371
|
+
t.pattern ?? (t.pattern = Nn), k.init(e, t);
|
|
1372
|
+
}), Ir = /* @__PURE__ */ a("$ZodULID", (e, t) => {
|
|
1373
|
+
t.pattern ?? (t.pattern = Dn), k.init(e, t);
|
|
1374
|
+
}), Sr = /* @__PURE__ */ a("$ZodXID", (e, t) => {
|
|
1375
|
+
t.pattern ?? (t.pattern = Un), k.init(e, t);
|
|
1376
|
+
}), Cr = /* @__PURE__ */ a("$ZodKSUID", (e, t) => {
|
|
1377
|
+
t.pattern ?? (t.pattern = Ln), k.init(e, t);
|
|
1378
|
+
}), Or = /* @__PURE__ */ a("$ZodISODateTime", (e, t) => {
|
|
1379
|
+
t.pattern ?? (t.pattern = nr(t)), k.init(e, t);
|
|
1380
|
+
}), Rr = /* @__PURE__ */ a("$ZodISODate", (e, t) => {
|
|
1381
|
+
t.pattern ?? (t.pattern = er), k.init(e, t);
|
|
1382
|
+
}), Pr = /* @__PURE__ */ a("$ZodISOTime", (e, t) => {
|
|
1383
|
+
t.pattern ?? (t.pattern = tr(t)), k.init(e, t);
|
|
1384
|
+
}), Nr = /* @__PURE__ */ a("$ZodISODuration", (e, t) => {
|
|
1385
|
+
t.pattern ?? (t.pattern = Mn), k.init(e, t);
|
|
1386
|
+
}), Dr = /* @__PURE__ */ a("$ZodIPv4", (e, t) => {
|
|
1387
|
+
t.pattern ?? (t.pattern = qn), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1340
1388
|
const r = n._zod.bag;
|
|
1341
1389
|
r.format = "ipv4";
|
|
1342
1390
|
});
|
|
1343
|
-
}),
|
|
1344
|
-
t.pattern ?? (t.pattern =
|
|
1391
|
+
}), Ur = /* @__PURE__ */ a("$ZodIPv6", (e, t) => {
|
|
1392
|
+
t.pattern ?? (t.pattern = Jn), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1345
1393
|
const r = n._zod.bag;
|
|
1346
1394
|
r.format = "ipv6";
|
|
1347
1395
|
}), e._zod.check = (n) => {
|
|
@@ -1357,10 +1405,10 @@ const Cr = {
|
|
|
1357
1405
|
});
|
|
1358
1406
|
}
|
|
1359
1407
|
};
|
|
1360
|
-
}),
|
|
1361
|
-
t.pattern ?? (t.pattern =
|
|
1362
|
-
}),
|
|
1363
|
-
t.pattern ?? (t.pattern =
|
|
1408
|
+
}), Lr = /* @__PURE__ */ a("$ZodCIDRv4", (e, t) => {
|
|
1409
|
+
t.pattern ?? (t.pattern = Gn), k.init(e, t);
|
|
1410
|
+
}), Fr = /* @__PURE__ */ a("$ZodCIDRv6", (e, t) => {
|
|
1411
|
+
t.pattern ?? (t.pattern = Hn), k.init(e, t), e._zod.check = (n) => {
|
|
1364
1412
|
const r = n.value.split("/");
|
|
1365
1413
|
try {
|
|
1366
1414
|
if (r.length !== 2)
|
|
@@ -1368,10 +1416,10 @@ const Cr = {
|
|
|
1368
1416
|
const [o, i] = r;
|
|
1369
1417
|
if (!i)
|
|
1370
1418
|
throw new Error();
|
|
1371
|
-
const
|
|
1372
|
-
if (`${
|
|
1419
|
+
const c = Number(i);
|
|
1420
|
+
if (`${c}` !== i)
|
|
1373
1421
|
throw new Error();
|
|
1374
|
-
if (
|
|
1422
|
+
if (c < 0 || c > 128)
|
|
1375
1423
|
throw new Error();
|
|
1376
1424
|
new URL(`http://[${o}]`);
|
|
1377
1425
|
} catch {
|
|
@@ -1385,7 +1433,7 @@ const Cr = {
|
|
|
1385
1433
|
}
|
|
1386
1434
|
};
|
|
1387
1435
|
});
|
|
1388
|
-
function
|
|
1436
|
+
function xt(e) {
|
|
1389
1437
|
if (e === "")
|
|
1390
1438
|
return !0;
|
|
1391
1439
|
if (e.length % 4 !== 0)
|
|
@@ -1396,11 +1444,11 @@ function Ot(e) {
|
|
|
1396
1444
|
return !1;
|
|
1397
1445
|
}
|
|
1398
1446
|
}
|
|
1399
|
-
const
|
|
1400
|
-
t.pattern ?? (t.pattern =
|
|
1447
|
+
const Mr = /* @__PURE__ */ a("$ZodBase64", (e, t) => {
|
|
1448
|
+
t.pattern ?? (t.pattern = Xn), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1401
1449
|
n._zod.bag.contentEncoding = "base64";
|
|
1402
1450
|
}), e._zod.check = (n) => {
|
|
1403
|
-
|
|
1451
|
+
xt(n.value) || n.issues.push({
|
|
1404
1452
|
code: "invalid_format",
|
|
1405
1453
|
format: "base64",
|
|
1406
1454
|
input: n.value,
|
|
@@ -1409,17 +1457,17 @@ const Qr = /* @__PURE__ */ a("$ZodBase64", (e, t) => {
|
|
|
1409
1457
|
});
|
|
1410
1458
|
};
|
|
1411
1459
|
});
|
|
1412
|
-
function
|
|
1413
|
-
if (!
|
|
1460
|
+
function Vr(e) {
|
|
1461
|
+
if (!kt.test(e))
|
|
1414
1462
|
return !1;
|
|
1415
1463
|
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
1416
|
-
return
|
|
1464
|
+
return xt(n);
|
|
1417
1465
|
}
|
|
1418
|
-
const
|
|
1419
|
-
t.pattern ?? (t.pattern =
|
|
1466
|
+
const Wr = /* @__PURE__ */ a("$ZodBase64URL", (e, t) => {
|
|
1467
|
+
t.pattern ?? (t.pattern = kt), k.init(e, t), e._zod.onattach.push((n) => {
|
|
1420
1468
|
n._zod.bag.contentEncoding = "base64url";
|
|
1421
1469
|
}), e._zod.check = (n) => {
|
|
1422
|
-
|
|
1470
|
+
Vr(n.value) || n.issues.push({
|
|
1423
1471
|
code: "invalid_format",
|
|
1424
1472
|
format: "base64url",
|
|
1425
1473
|
input: n.value,
|
|
@@ -1427,10 +1475,10 @@ const to = /* @__PURE__ */ a("$ZodBase64URL", (e, t) => {
|
|
|
1427
1475
|
continue: !t.abort
|
|
1428
1476
|
});
|
|
1429
1477
|
};
|
|
1430
|
-
}),
|
|
1431
|
-
t.pattern ?? (t.pattern =
|
|
1478
|
+
}), Br = /* @__PURE__ */ a("$ZodE164", (e, t) => {
|
|
1479
|
+
t.pattern ?? (t.pattern = Qn), k.init(e, t);
|
|
1432
1480
|
});
|
|
1433
|
-
function
|
|
1481
|
+
function Yr(e, t = null) {
|
|
1434
1482
|
try {
|
|
1435
1483
|
const n = e.split(".");
|
|
1436
1484
|
if (n.length !== 3)
|
|
@@ -1444,9 +1492,9 @@ function ro(e, t = null) {
|
|
|
1444
1492
|
return !1;
|
|
1445
1493
|
}
|
|
1446
1494
|
}
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1449
|
-
|
|
1495
|
+
const qr = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
1496
|
+
k.init(e, t), e._zod.check = (n) => {
|
|
1497
|
+
Yr(n.value, t.alg) || n.issues.push({
|
|
1450
1498
|
code: "invalid_format",
|
|
1451
1499
|
format: "jwt",
|
|
1452
1500
|
input: n.value,
|
|
@@ -1454,8 +1502,8 @@ const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
|
1454
1502
|
continue: !t.abort
|
|
1455
1503
|
});
|
|
1456
1504
|
};
|
|
1457
|
-
}),
|
|
1458
|
-
|
|
1505
|
+
}), Tt = /* @__PURE__ */ a("$ZodNumber", (e, t) => {
|
|
1506
|
+
Z.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? ir, e._zod.parse = (n, r) => {
|
|
1459
1507
|
if (t.coerce)
|
|
1460
1508
|
try {
|
|
1461
1509
|
n.value = Number(n.value);
|
|
@@ -1473,10 +1521,10 @@ const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
|
1473
1521
|
...i ? { received: i } : {}
|
|
1474
1522
|
}), n;
|
|
1475
1523
|
};
|
|
1476
|
-
}),
|
|
1477
|
-
|
|
1478
|
-
}),
|
|
1479
|
-
|
|
1524
|
+
}), Jr = /* @__PURE__ */ a("$ZodNumber", (e, t) => {
|
|
1525
|
+
lr.init(e, t), Tt.init(e, t);
|
|
1526
|
+
}), Gr = /* @__PURE__ */ a("$ZodBoolean", (e, t) => {
|
|
1527
|
+
Z.init(e, t), e._zod.pattern = cr, e._zod.parse = (n, r) => {
|
|
1480
1528
|
if (t.coerce)
|
|
1481
1529
|
try {
|
|
1482
1530
|
n.value = !!n.value;
|
|
@@ -1490,21 +1538,21 @@ const oo = /* @__PURE__ */ a("$ZodJWT", (e, t) => {
|
|
|
1490
1538
|
inst: e
|
|
1491
1539
|
}), n;
|
|
1492
1540
|
};
|
|
1493
|
-
}),
|
|
1494
|
-
|
|
1495
|
-
}),
|
|
1496
|
-
|
|
1541
|
+
}), Hr = /* @__PURE__ */ a("$ZodUnknown", (e, t) => {
|
|
1542
|
+
Z.init(e, t), e._zod.parse = (n) => n;
|
|
1543
|
+
}), Xr = /* @__PURE__ */ a("$ZodNever", (e, t) => {
|
|
1544
|
+
Z.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
|
|
1497
1545
|
expected: "never",
|
|
1498
1546
|
code: "invalid_type",
|
|
1499
1547
|
input: n.value,
|
|
1500
1548
|
inst: e
|
|
1501
1549
|
}), n);
|
|
1502
1550
|
});
|
|
1503
|
-
function
|
|
1504
|
-
e.issues.length && t.issues.push(
|
|
1551
|
+
function qe(e, t, n) {
|
|
1552
|
+
e.issues.length && t.issues.push(...gt(n, e.issues)), t.value[n] = e.value;
|
|
1505
1553
|
}
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1554
|
+
const Kr = /* @__PURE__ */ a("$ZodArray", (e, t) => {
|
|
1555
|
+
Z.init(e, t), e._zod.parse = (n, r) => {
|
|
1508
1556
|
const o = n.value;
|
|
1509
1557
|
if (!Array.isArray(o))
|
|
1510
1558
|
return n.issues.push({
|
|
@@ -1515,25 +1563,25 @@ const uo = /* @__PURE__ */ a("$ZodArray", (e, t) => {
|
|
|
1515
1563
|
}), n;
|
|
1516
1564
|
n.value = Array(o.length);
|
|
1517
1565
|
const i = [];
|
|
1518
|
-
for (let
|
|
1519
|
-
const
|
|
1520
|
-
value:
|
|
1566
|
+
for (let c = 0; c < o.length; c++) {
|
|
1567
|
+
const s = o[c], f = t.element._zod.run({
|
|
1568
|
+
value: s,
|
|
1521
1569
|
issues: []
|
|
1522
1570
|
}, r);
|
|
1523
|
-
|
|
1571
|
+
f instanceof Promise ? i.push(f.then((d) => qe(d, n, c))) : qe(f, n, c);
|
|
1524
1572
|
}
|
|
1525
1573
|
return i.length ? Promise.all(i).then(() => n) : n;
|
|
1526
1574
|
};
|
|
1527
1575
|
});
|
|
1528
|
-
function
|
|
1529
|
-
e.issues.length && t.issues.push(
|
|
1576
|
+
function le(e, t, n, r) {
|
|
1577
|
+
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
1578
|
}
|
|
1531
|
-
function
|
|
1579
|
+
function At(e) {
|
|
1532
1580
|
const t = Object.keys(e.shape);
|
|
1533
1581
|
for (const r of t)
|
|
1534
1582
|
if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
|
|
1535
1583
|
throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
|
|
1536
|
-
const n =
|
|
1584
|
+
const n = pn(e.shape);
|
|
1537
1585
|
return {
|
|
1538
1586
|
...e,
|
|
1539
1587
|
keys: t,
|
|
@@ -1542,186 +1590,186 @@ function Pt(e) {
|
|
|
1542
1590
|
optionalKeys: new Set(n)
|
|
1543
1591
|
};
|
|
1544
1592
|
}
|
|
1545
|
-
function
|
|
1546
|
-
const
|
|
1547
|
-
for (const
|
|
1548
|
-
if (
|
|
1593
|
+
function jt(e, t, n, r, o, i) {
|
|
1594
|
+
const c = [], s = o.keySet, f = o.catchall._zod, d = f.def.type;
|
|
1595
|
+
for (const h of Object.keys(t)) {
|
|
1596
|
+
if (s.has(h))
|
|
1549
1597
|
continue;
|
|
1550
|
-
if (
|
|
1551
|
-
|
|
1598
|
+
if (d === "never") {
|
|
1599
|
+
c.push(h);
|
|
1552
1600
|
continue;
|
|
1553
1601
|
}
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1602
|
+
const v = f.run({ value: t[h], issues: [] }, r);
|
|
1603
|
+
v instanceof Promise ? e.push(v.then((_) => le(_, n, h, t))) : le(v, n, h, t);
|
|
1556
1604
|
}
|
|
1557
|
-
return
|
|
1605
|
+
return c.length && n.issues.push({
|
|
1558
1606
|
code: "unrecognized_keys",
|
|
1559
|
-
keys:
|
|
1607
|
+
keys: c,
|
|
1560
1608
|
input: t,
|
|
1561
1609
|
inst: i
|
|
1562
1610
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1563
1611
|
}
|
|
1564
|
-
const
|
|
1565
|
-
if (
|
|
1566
|
-
const
|
|
1612
|
+
const Qr = /* @__PURE__ */ a("$ZodObject", (e, t) => {
|
|
1613
|
+
if (Z.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1614
|
+
const s = t.shape;
|
|
1567
1615
|
Object.defineProperty(t, "shape", {
|
|
1568
1616
|
get: () => {
|
|
1569
|
-
const
|
|
1617
|
+
const f = { ...s };
|
|
1570
1618
|
return Object.defineProperty(t, "shape", {
|
|
1571
|
-
value:
|
|
1572
|
-
}),
|
|
1619
|
+
value: f
|
|
1620
|
+
}), f;
|
|
1573
1621
|
}
|
|
1574
1622
|
});
|
|
1575
1623
|
}
|
|
1576
|
-
const r =
|
|
1624
|
+
const r = xe(() => At(t));
|
|
1577
1625
|
w(e._zod, "propValues", () => {
|
|
1578
|
-
const
|
|
1579
|
-
for (const
|
|
1580
|
-
const
|
|
1581
|
-
if (
|
|
1582
|
-
d
|
|
1583
|
-
for (const
|
|
1584
|
-
d
|
|
1626
|
+
const s = t.shape, f = {};
|
|
1627
|
+
for (const d in s) {
|
|
1628
|
+
const h = s[d]._zod;
|
|
1629
|
+
if (h.values) {
|
|
1630
|
+
f[d] ?? (f[d] = /* @__PURE__ */ new Set());
|
|
1631
|
+
for (const v of h.values)
|
|
1632
|
+
f[d].add(v);
|
|
1585
1633
|
}
|
|
1586
1634
|
}
|
|
1587
|
-
return
|
|
1588
|
-
});
|
|
1589
|
-
const o =
|
|
1590
|
-
let
|
|
1591
|
-
e._zod.parse = (
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1594
|
-
if (!o(
|
|
1595
|
-
return
|
|
1635
|
+
return f;
|
|
1636
|
+
});
|
|
1637
|
+
const o = ue, i = t.catchall;
|
|
1638
|
+
let c;
|
|
1639
|
+
e._zod.parse = (s, f) => {
|
|
1640
|
+
c ?? (c = r.value);
|
|
1641
|
+
const d = s.value;
|
|
1642
|
+
if (!o(d))
|
|
1643
|
+
return s.issues.push({
|
|
1596
1644
|
expected: "object",
|
|
1597
1645
|
code: "invalid_type",
|
|
1598
|
-
input:
|
|
1646
|
+
input: d,
|
|
1599
1647
|
inst: e
|
|
1600
|
-
}),
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1603
|
-
for (const
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1648
|
+
}), s;
|
|
1649
|
+
s.value = {};
|
|
1650
|
+
const h = [], v = c.shape;
|
|
1651
|
+
for (const _ of c.keys) {
|
|
1652
|
+
const b = v[_]._zod.run({ value: d[_], issues: [] }, f);
|
|
1653
|
+
b instanceof Promise ? h.push(b.then((R) => le(R, s, _, d))) : le(b, s, _, d);
|
|
1606
1654
|
}
|
|
1607
|
-
return i ?
|
|
1655
|
+
return i ? jt(h, d, s, f, r.value, e) : h.length ? Promise.all(h).then(() => s) : s;
|
|
1608
1656
|
};
|
|
1609
|
-
}),
|
|
1610
|
-
|
|
1611
|
-
const n = e._zod.parse, r =
|
|
1612
|
-
const
|
|
1613
|
-
const
|
|
1614
|
-
return `shape[${
|
|
1657
|
+
}), eo = /* @__PURE__ */ a("$ZodObjectJIT", (e, t) => {
|
|
1658
|
+
Qr.init(e, t);
|
|
1659
|
+
const n = e._zod.parse, r = xe(() => At(t)), o = (_) => {
|
|
1660
|
+
const l = new kr(["shape", "payload", "ctx"]), b = r.value, R = (C) => {
|
|
1661
|
+
const A = Be(C);
|
|
1662
|
+
return `shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`;
|
|
1615
1663
|
};
|
|
1616
|
-
|
|
1617
|
-
const
|
|
1618
|
-
let
|
|
1619
|
-
for (const
|
|
1620
|
-
C
|
|
1621
|
-
|
|
1622
|
-
for (const
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
if (${
|
|
1626
|
-
payload.issues = payload.issues.concat(${
|
|
1664
|
+
l.write("const input = payload.value;");
|
|
1665
|
+
const j = /* @__PURE__ */ Object.create(null);
|
|
1666
|
+
let U = 0;
|
|
1667
|
+
for (const C of b.keys)
|
|
1668
|
+
j[C] = `key_${U++}`;
|
|
1669
|
+
l.write("const newResult = {};");
|
|
1670
|
+
for (const C of b.keys) {
|
|
1671
|
+
const A = j[C], N = Be(C);
|
|
1672
|
+
l.write(`const ${A} = ${R(C)};`), l.write(`
|
|
1673
|
+
if (${A}.issues.length) {
|
|
1674
|
+
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
1627
1675
|
...iss,
|
|
1628
|
-
path: iss.path ? [${
|
|
1676
|
+
path: iss.path ? [${N}, ...iss.path] : [${N}]
|
|
1629
1677
|
})));
|
|
1630
1678
|
}
|
|
1631
1679
|
|
|
1632
1680
|
|
|
1633
|
-
if (${
|
|
1634
|
-
if (${
|
|
1635
|
-
newResult[${
|
|
1681
|
+
if (${A}.value === undefined) {
|
|
1682
|
+
if (${N} in input) {
|
|
1683
|
+
newResult[${N}] = undefined;
|
|
1636
1684
|
}
|
|
1637
1685
|
} else {
|
|
1638
|
-
newResult[${
|
|
1686
|
+
newResult[${N}] = ${A}.value;
|
|
1639
1687
|
}
|
|
1640
1688
|
|
|
1641
1689
|
`);
|
|
1642
1690
|
}
|
|
1643
|
-
|
|
1644
|
-
const
|
|
1645
|
-
return (
|
|
1691
|
+
l.write("payload.value = newResult;"), l.write("return payload;");
|
|
1692
|
+
const S = l.compile();
|
|
1693
|
+
return (C, A) => S(_, C, A);
|
|
1646
1694
|
};
|
|
1647
1695
|
let i;
|
|
1648
|
-
const
|
|
1649
|
-
let
|
|
1650
|
-
e._zod.parse = (
|
|
1651
|
-
|
|
1652
|
-
const
|
|
1653
|
-
return
|
|
1696
|
+
const c = ue, s = !mt.jitless, d = s && hn.value, h = t.catchall;
|
|
1697
|
+
let v;
|
|
1698
|
+
e._zod.parse = (_, l) => {
|
|
1699
|
+
v ?? (v = r.value);
|
|
1700
|
+
const b = _.value;
|
|
1701
|
+
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
1702
|
expected: "object",
|
|
1655
1703
|
code: "invalid_type",
|
|
1656
|
-
input:
|
|
1704
|
+
input: b,
|
|
1657
1705
|
inst: e
|
|
1658
|
-
}),
|
|
1706
|
+
}), _);
|
|
1659
1707
|
};
|
|
1660
1708
|
});
|
|
1661
|
-
function
|
|
1709
|
+
function Je(e, t, n, r) {
|
|
1662
1710
|
for (const i of e)
|
|
1663
1711
|
if (i.issues.length === 0)
|
|
1664
1712
|
return t.value = i.value, t;
|
|
1665
|
-
const o = e.filter((i) => !
|
|
1713
|
+
const o = e.filter((i) => !q(i));
|
|
1666
1714
|
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
1667
1715
|
code: "invalid_union",
|
|
1668
1716
|
input: t.value,
|
|
1669
1717
|
inst: n,
|
|
1670
|
-
errors: e.map((i) => i.issues.map((
|
|
1718
|
+
errors: e.map((i) => i.issues.map((c) => V(c, r, M())))
|
|
1671
1719
|
}), t);
|
|
1672
1720
|
}
|
|
1673
|
-
const
|
|
1674
|
-
|
|
1721
|
+
const to = /* @__PURE__ */ a("$ZodUnion", (e, t) => {
|
|
1722
|
+
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
1723
|
if (t.options.every((o) => o._zod.values))
|
|
1676
1724
|
return new Set(t.options.flatMap((o) => Array.from(o._zod.values)));
|
|
1677
1725
|
}), w(e._zod, "pattern", () => {
|
|
1678
1726
|
if (t.options.every((o) => o._zod.pattern)) {
|
|
1679
1727
|
const o = t.options.map((i) => i._zod.pattern);
|
|
1680
|
-
return new RegExp(`^(${o.map((i) =>
|
|
1728
|
+
return new RegExp(`^(${o.map((i) => Ae(i.source)).join("|")})$`);
|
|
1681
1729
|
}
|
|
1682
1730
|
});
|
|
1683
1731
|
const n = t.options.length === 1, r = t.options[0]._zod.run;
|
|
1684
1732
|
e._zod.parse = (o, i) => {
|
|
1685
1733
|
if (n)
|
|
1686
1734
|
return r(o, i);
|
|
1687
|
-
let
|
|
1688
|
-
const
|
|
1689
|
-
for (const
|
|
1690
|
-
const
|
|
1735
|
+
let c = !1;
|
|
1736
|
+
const s = [];
|
|
1737
|
+
for (const f of t.options) {
|
|
1738
|
+
const d = f._zod.run({
|
|
1691
1739
|
value: o.value,
|
|
1692
1740
|
issues: []
|
|
1693
1741
|
}, i);
|
|
1694
|
-
if (
|
|
1695
|
-
|
|
1742
|
+
if (d instanceof Promise)
|
|
1743
|
+
s.push(d), c = !0;
|
|
1696
1744
|
else {
|
|
1697
|
-
if (
|
|
1698
|
-
return
|
|
1699
|
-
|
|
1745
|
+
if (d.issues.length === 0)
|
|
1746
|
+
return d;
|
|
1747
|
+
s.push(d);
|
|
1700
1748
|
}
|
|
1701
1749
|
}
|
|
1702
|
-
return
|
|
1750
|
+
return c ? Promise.all(s).then((f) => Je(f, o, e, i)) : Je(s, o, e, i);
|
|
1703
1751
|
};
|
|
1704
|
-
}),
|
|
1705
|
-
|
|
1706
|
-
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r),
|
|
1707
|
-
return i instanceof Promise ||
|
|
1752
|
+
}), no = /* @__PURE__ */ a("$ZodIntersection", (e, t) => {
|
|
1753
|
+
Z.init(e, t), e._zod.parse = (n, r) => {
|
|
1754
|
+
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), c = t.right._zod.run({ value: o, issues: [] }, r);
|
|
1755
|
+
return i instanceof Promise || c instanceof Promise ? Promise.all([i, c]).then(([f, d]) => Ge(n, f, d)) : Ge(n, i, c);
|
|
1708
1756
|
};
|
|
1709
1757
|
});
|
|
1710
|
-
function
|
|
1758
|
+
function ye(e, t) {
|
|
1711
1759
|
if (e === t)
|
|
1712
1760
|
return { valid: !0, data: e };
|
|
1713
1761
|
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
1714
1762
|
return { valid: !0, data: e };
|
|
1715
|
-
if (
|
|
1763
|
+
if (X(e) && X(t)) {
|
|
1716
1764
|
const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
|
|
1717
1765
|
for (const i of r) {
|
|
1718
|
-
const
|
|
1719
|
-
if (!
|
|
1766
|
+
const c = ye(e[i], t[i]);
|
|
1767
|
+
if (!c.valid)
|
|
1720
1768
|
return {
|
|
1721
1769
|
valid: !1,
|
|
1722
|
-
mergeErrorPath: [i, ...
|
|
1770
|
+
mergeErrorPath: [i, ...c.mergeErrorPath]
|
|
1723
1771
|
};
|
|
1724
|
-
o[i] =
|
|
1772
|
+
o[i] = c.data;
|
|
1725
1773
|
}
|
|
1726
1774
|
return { valid: !0, data: o };
|
|
1727
1775
|
}
|
|
@@ -1730,94 +1778,94 @@ function xe(e, t) {
|
|
|
1730
1778
|
return { valid: !1, mergeErrorPath: [] };
|
|
1731
1779
|
const n = [];
|
|
1732
1780
|
for (let r = 0; r < e.length; r++) {
|
|
1733
|
-
const o = e[r], i = t[r],
|
|
1734
|
-
if (!
|
|
1781
|
+
const o = e[r], i = t[r], c = ye(o, i);
|
|
1782
|
+
if (!c.valid)
|
|
1735
1783
|
return {
|
|
1736
1784
|
valid: !1,
|
|
1737
|
-
mergeErrorPath: [r, ...
|
|
1785
|
+
mergeErrorPath: [r, ...c.mergeErrorPath]
|
|
1738
1786
|
};
|
|
1739
|
-
n.push(
|
|
1787
|
+
n.push(c.data);
|
|
1740
1788
|
}
|
|
1741
1789
|
return { valid: !0, data: n };
|
|
1742
1790
|
}
|
|
1743
1791
|
return { valid: !1, mergeErrorPath: [] };
|
|
1744
1792
|
}
|
|
1745
|
-
function
|
|
1746
|
-
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues),
|
|
1793
|
+
function Ge(e, t, n) {
|
|
1794
|
+
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), q(e))
|
|
1747
1795
|
return e;
|
|
1748
|
-
const r =
|
|
1796
|
+
const r = ye(t.value, n.value);
|
|
1749
1797
|
if (!r.valid)
|
|
1750
1798
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
|
|
1751
1799
|
return e.value = r.data, e;
|
|
1752
1800
|
}
|
|
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(
|
|
1801
|
+
const ro = /* @__PURE__ */ a("$ZodEnum", (e, t) => {
|
|
1802
|
+
Z.init(e, t);
|
|
1803
|
+
const n = dn(t.entries), r = new Set(n);
|
|
1804
|
+
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) => {
|
|
1805
|
+
const c = o.value;
|
|
1806
|
+
return r.has(c) || o.issues.push({
|
|
1759
1807
|
code: "invalid_value",
|
|
1760
1808
|
values: n,
|
|
1761
|
-
input:
|
|
1809
|
+
input: c,
|
|
1762
1810
|
inst: e
|
|
1763
1811
|
}), o;
|
|
1764
1812
|
};
|
|
1765
|
-
}),
|
|
1766
|
-
|
|
1813
|
+
}), oo = /* @__PURE__ */ a("$ZodTransform", (e, t) => {
|
|
1814
|
+
Z.init(e, t), e._zod.parse = (n, r) => {
|
|
1767
1815
|
if (r.direction === "backward")
|
|
1768
|
-
throw new
|
|
1816
|
+
throw new ht(e.constructor.name);
|
|
1769
1817
|
const o = t.transform(n.value, n);
|
|
1770
1818
|
if (r.async)
|
|
1771
|
-
return (o instanceof Promise ? o : Promise.resolve(o)).then((
|
|
1819
|
+
return (o instanceof Promise ? o : Promise.resolve(o)).then((c) => (n.value = c, n));
|
|
1772
1820
|
if (o instanceof Promise)
|
|
1773
|
-
throw new
|
|
1821
|
+
throw new J();
|
|
1774
1822
|
return n.value = o, n;
|
|
1775
1823
|
};
|
|
1776
1824
|
});
|
|
1777
|
-
function
|
|
1825
|
+
function He(e, t) {
|
|
1778
1826
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
1779
1827
|
}
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1828
|
+
const io = /* @__PURE__ */ a("$ZodOptional", (e, t) => {
|
|
1829
|
+
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
1830
|
const n = t.innerType._zod.pattern;
|
|
1783
|
-
return n ? new RegExp(`^(${
|
|
1831
|
+
return n ? new RegExp(`^(${Ae(n.source)})?$`) : void 0;
|
|
1784
1832
|
}), e._zod.parse = (n, r) => {
|
|
1785
1833
|
if (t.innerType._zod.optin === "optional") {
|
|
1786
1834
|
const o = t.innerType._zod.run(n, r);
|
|
1787
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1835
|
+
return o instanceof Promise ? o.then((i) => He(i, n.value)) : He(o, n.value);
|
|
1788
1836
|
}
|
|
1789
1837
|
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
1790
1838
|
};
|
|
1791
|
-
}),
|
|
1792
|
-
|
|
1839
|
+
}), co = /* @__PURE__ */ a("$ZodNullable", (e, t) => {
|
|
1840
|
+
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
1841
|
const n = t.innerType._zod.pattern;
|
|
1794
|
-
return n ? new RegExp(`^(${
|
|
1842
|
+
return n ? new RegExp(`^(${Ae(n.source)}|null)$`) : void 0;
|
|
1795
1843
|
}), 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
|
-
|
|
1844
|
+
}), so = /* @__PURE__ */ a("$ZodDefault", (e, t) => {
|
|
1845
|
+
Z.init(e, t), e._zod.optin = "optional", w(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
1798
1846
|
if (r.direction === "backward")
|
|
1799
1847
|
return t.innerType._zod.run(n, r);
|
|
1800
1848
|
if (n.value === void 0)
|
|
1801
1849
|
return n.value = t.defaultValue, n;
|
|
1802
1850
|
const o = t.innerType._zod.run(n, r);
|
|
1803
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1851
|
+
return o instanceof Promise ? o.then((i) => Xe(i, t)) : Xe(o, t);
|
|
1804
1852
|
};
|
|
1805
1853
|
});
|
|
1806
|
-
function
|
|
1854
|
+
function Xe(e, t) {
|
|
1807
1855
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
1808
1856
|
}
|
|
1809
|
-
const
|
|
1810
|
-
|
|
1811
|
-
}),
|
|
1812
|
-
|
|
1857
|
+
const ao = /* @__PURE__ */ a("$ZodPrefault", (e, t) => {
|
|
1858
|
+
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));
|
|
1859
|
+
}), uo = /* @__PURE__ */ a("$ZodNonOptional", (e, t) => {
|
|
1860
|
+
Z.init(e, t), w(e._zod, "values", () => {
|
|
1813
1861
|
const n = t.innerType._zod.values;
|
|
1814
1862
|
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
1815
1863
|
}), e._zod.parse = (n, r) => {
|
|
1816
1864
|
const o = t.innerType._zod.run(n, r);
|
|
1817
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1865
|
+
return o instanceof Promise ? o.then((i) => Ke(i, e)) : Ke(o, e);
|
|
1818
1866
|
};
|
|
1819
1867
|
});
|
|
1820
|
-
function
|
|
1868
|
+
function Ke(e, t) {
|
|
1821
1869
|
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
1822
1870
|
code: "invalid_type",
|
|
1823
1871
|
expected: "nonoptional",
|
|
@@ -1825,15 +1873,15 @@ function nt(e, t) {
|
|
|
1825
1873
|
inst: t
|
|
1826
1874
|
}), e;
|
|
1827
1875
|
}
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1876
|
+
const lo = /* @__PURE__ */ a("$ZodCatch", (e, t) => {
|
|
1877
|
+
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
1878
|
if (r.direction === "backward")
|
|
1831
1879
|
return t.innerType._zod.run(n, r);
|
|
1832
1880
|
const o = t.innerType._zod.run(n, r);
|
|
1833
1881
|
return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
1834
1882
|
...n,
|
|
1835
1883
|
error: {
|
|
1836
|
-
issues: i.issues.map((
|
|
1884
|
+
issues: i.issues.map((c) => V(c, r, M()))
|
|
1837
1885
|
},
|
|
1838
1886
|
input: n.value
|
|
1839
1887
|
}), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
|
|
@@ -1844,39 +1892,39 @@ const zo = /* @__PURE__ */ a("$ZodCatch", (e, t) => {
|
|
|
1844
1892
|
input: n.value
|
|
1845
1893
|
}), n.issues = []), n);
|
|
1846
1894
|
};
|
|
1847
|
-
}),
|
|
1848
|
-
|
|
1895
|
+
}), fo = /* @__PURE__ */ a("$ZodPipe", (e, t) => {
|
|
1896
|
+
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
1897
|
if (r.direction === "backward") {
|
|
1850
1898
|
const i = t.out._zod.run(n, r);
|
|
1851
|
-
return i instanceof Promise ? i.then((
|
|
1899
|
+
return i instanceof Promise ? i.then((c) => oe(c, t.in, r)) : oe(i, t.in, r);
|
|
1852
1900
|
}
|
|
1853
1901
|
const o = t.in._zod.run(n, r);
|
|
1854
|
-
return o instanceof Promise ? o.then((i) =>
|
|
1902
|
+
return o instanceof Promise ? o.then((i) => oe(i, t.out, r)) : oe(o, t.out, r);
|
|
1855
1903
|
};
|
|
1856
1904
|
});
|
|
1857
|
-
function
|
|
1905
|
+
function oe(e, t, n) {
|
|
1858
1906
|
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
1859
1907
|
}
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1908
|
+
const ho = /* @__PURE__ */ a("$ZodReadonly", (e, t) => {
|
|
1909
|
+
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
1910
|
if (r.direction === "backward")
|
|
1863
1911
|
return t.innerType._zod.run(n, r);
|
|
1864
1912
|
const o = t.innerType._zod.run(n, r);
|
|
1865
|
-
return o instanceof Promise ? o.then(
|
|
1913
|
+
return o instanceof Promise ? o.then(Qe) : Qe(o);
|
|
1866
1914
|
};
|
|
1867
1915
|
});
|
|
1868
|
-
function
|
|
1916
|
+
function Qe(e) {
|
|
1869
1917
|
return e.value = Object.freeze(e.value), e;
|
|
1870
1918
|
}
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1919
|
+
const mo = /* @__PURE__ */ a("$ZodCustom", (e, t) => {
|
|
1920
|
+
I.init(e, t), Z.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
|
|
1873
1921
|
const r = n.value, o = t.fn(r);
|
|
1874
1922
|
if (o instanceof Promise)
|
|
1875
|
-
return o.then((i) =>
|
|
1876
|
-
|
|
1923
|
+
return o.then((i) => et(i, n, r, e));
|
|
1924
|
+
et(o, n, r, e);
|
|
1877
1925
|
};
|
|
1878
1926
|
});
|
|
1879
|
-
function
|
|
1927
|
+
function et(e, t, n, r) {
|
|
1880
1928
|
if (!e) {
|
|
1881
1929
|
const o = {
|
|
1882
1930
|
code: "custom",
|
|
@@ -1888,10 +1936,10 @@ function ot(e, t, n, r) {
|
|
|
1888
1936
|
continue: !r._zod.def.abort
|
|
1889
1937
|
// params: inst._zod.def.params,
|
|
1890
1938
|
};
|
|
1891
|
-
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(
|
|
1939
|
+
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(K(o));
|
|
1892
1940
|
}
|
|
1893
1941
|
}
|
|
1894
|
-
class
|
|
1942
|
+
class po {
|
|
1895
1943
|
constructor() {
|
|
1896
1944
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
1897
1945
|
}
|
|
@@ -1925,17 +1973,17 @@ class Eo {
|
|
|
1925
1973
|
return this._map.has(t);
|
|
1926
1974
|
}
|
|
1927
1975
|
}
|
|
1928
|
-
function
|
|
1929
|
-
return new
|
|
1976
|
+
function _o() {
|
|
1977
|
+
return new po();
|
|
1930
1978
|
}
|
|
1931
|
-
const
|
|
1932
|
-
function
|
|
1979
|
+
const ie = /* @__PURE__ */ _o();
|
|
1980
|
+
function go(e, t) {
|
|
1933
1981
|
return new e({
|
|
1934
1982
|
type: "string",
|
|
1935
1983
|
...m(t)
|
|
1936
1984
|
});
|
|
1937
1985
|
}
|
|
1938
|
-
function
|
|
1986
|
+
function vo(e, t) {
|
|
1939
1987
|
return new e({
|
|
1940
1988
|
type: "string",
|
|
1941
1989
|
format: "email",
|
|
@@ -1944,7 +1992,7 @@ function So(e, t) {
|
|
|
1944
1992
|
...m(t)
|
|
1945
1993
|
});
|
|
1946
1994
|
}
|
|
1947
|
-
function
|
|
1995
|
+
function tt(e, t) {
|
|
1948
1996
|
return new e({
|
|
1949
1997
|
type: "string",
|
|
1950
1998
|
format: "guid",
|
|
@@ -1953,7 +2001,7 @@ function it(e, t) {
|
|
|
1953
2001
|
...m(t)
|
|
1954
2002
|
});
|
|
1955
2003
|
}
|
|
1956
|
-
function
|
|
2004
|
+
function bo(e, t) {
|
|
1957
2005
|
return new e({
|
|
1958
2006
|
type: "string",
|
|
1959
2007
|
format: "uuid",
|
|
@@ -1962,7 +2010,7 @@ function Io(e, t) {
|
|
|
1962
2010
|
...m(t)
|
|
1963
2011
|
});
|
|
1964
2012
|
}
|
|
1965
|
-
function
|
|
2013
|
+
function wo(e, t) {
|
|
1966
2014
|
return new e({
|
|
1967
2015
|
type: "string",
|
|
1968
2016
|
format: "uuid",
|
|
@@ -1972,7 +2020,7 @@ function jo(e, t) {
|
|
|
1972
2020
|
...m(t)
|
|
1973
2021
|
});
|
|
1974
2022
|
}
|
|
1975
|
-
function
|
|
2023
|
+
function ko(e, t) {
|
|
1976
2024
|
return new e({
|
|
1977
2025
|
type: "string",
|
|
1978
2026
|
format: "uuid",
|
|
@@ -1982,7 +2030,7 @@ function Ao(e, t) {
|
|
|
1982
2030
|
...m(t)
|
|
1983
2031
|
});
|
|
1984
2032
|
}
|
|
1985
|
-
function
|
|
2033
|
+
function zo(e, t) {
|
|
1986
2034
|
return new e({
|
|
1987
2035
|
type: "string",
|
|
1988
2036
|
format: "uuid",
|
|
@@ -1992,7 +2040,7 @@ function Co(e, t) {
|
|
|
1992
2040
|
...m(t)
|
|
1993
2041
|
});
|
|
1994
2042
|
}
|
|
1995
|
-
function
|
|
2043
|
+
function yo(e, t) {
|
|
1996
2044
|
return new e({
|
|
1997
2045
|
type: "string",
|
|
1998
2046
|
format: "url",
|
|
@@ -2001,7 +2049,7 @@ function Oo(e, t) {
|
|
|
2001
2049
|
...m(t)
|
|
2002
2050
|
});
|
|
2003
2051
|
}
|
|
2004
|
-
function
|
|
2052
|
+
function $o(e, t) {
|
|
2005
2053
|
return new e({
|
|
2006
2054
|
type: "string",
|
|
2007
2055
|
format: "emoji",
|
|
@@ -2010,7 +2058,7 @@ function Ro(e, t) {
|
|
|
2010
2058
|
...m(t)
|
|
2011
2059
|
});
|
|
2012
2060
|
}
|
|
2013
|
-
function
|
|
2061
|
+
function Zo(e, t) {
|
|
2014
2062
|
return new e({
|
|
2015
2063
|
type: "string",
|
|
2016
2064
|
format: "nanoid",
|
|
@@ -2019,7 +2067,7 @@ function Po(e, t) {
|
|
|
2019
2067
|
...m(t)
|
|
2020
2068
|
});
|
|
2021
2069
|
}
|
|
2022
|
-
function
|
|
2070
|
+
function Eo(e, t) {
|
|
2023
2071
|
return new e({
|
|
2024
2072
|
type: "string",
|
|
2025
2073
|
format: "cuid",
|
|
@@ -2028,7 +2076,7 @@ function No(e, t) {
|
|
|
2028
2076
|
...m(t)
|
|
2029
2077
|
});
|
|
2030
2078
|
}
|
|
2031
|
-
function
|
|
2079
|
+
function xo(e, t) {
|
|
2032
2080
|
return new e({
|
|
2033
2081
|
type: "string",
|
|
2034
2082
|
format: "cuid2",
|
|
@@ -2037,7 +2085,7 @@ function Do(e, t) {
|
|
|
2037
2085
|
...m(t)
|
|
2038
2086
|
});
|
|
2039
2087
|
}
|
|
2040
|
-
function
|
|
2088
|
+
function To(e, t) {
|
|
2041
2089
|
return new e({
|
|
2042
2090
|
type: "string",
|
|
2043
2091
|
format: "ulid",
|
|
@@ -2046,7 +2094,7 @@ function Uo(e, t) {
|
|
|
2046
2094
|
...m(t)
|
|
2047
2095
|
});
|
|
2048
2096
|
}
|
|
2049
|
-
function
|
|
2097
|
+
function Ao(e, t) {
|
|
2050
2098
|
return new e({
|
|
2051
2099
|
type: "string",
|
|
2052
2100
|
format: "xid",
|
|
@@ -2055,7 +2103,7 @@ function Fo(e, t) {
|
|
|
2055
2103
|
...m(t)
|
|
2056
2104
|
});
|
|
2057
2105
|
}
|
|
2058
|
-
function
|
|
2106
|
+
function jo(e, t) {
|
|
2059
2107
|
return new e({
|
|
2060
2108
|
type: "string",
|
|
2061
2109
|
format: "ksuid",
|
|
@@ -2064,7 +2112,7 @@ function Lo(e, t) {
|
|
|
2064
2112
|
...m(t)
|
|
2065
2113
|
});
|
|
2066
2114
|
}
|
|
2067
|
-
function
|
|
2115
|
+
function Io(e, t) {
|
|
2068
2116
|
return new e({
|
|
2069
2117
|
type: "string",
|
|
2070
2118
|
format: "ipv4",
|
|
@@ -2073,7 +2121,7 @@ function Mo(e, t) {
|
|
|
2073
2121
|
...m(t)
|
|
2074
2122
|
});
|
|
2075
2123
|
}
|
|
2076
|
-
function
|
|
2124
|
+
function So(e, t) {
|
|
2077
2125
|
return new e({
|
|
2078
2126
|
type: "string",
|
|
2079
2127
|
format: "ipv6",
|
|
@@ -2082,7 +2130,7 @@ function Vo(e, t) {
|
|
|
2082
2130
|
...m(t)
|
|
2083
2131
|
});
|
|
2084
2132
|
}
|
|
2085
|
-
function
|
|
2133
|
+
function Co(e, t) {
|
|
2086
2134
|
return new e({
|
|
2087
2135
|
type: "string",
|
|
2088
2136
|
format: "cidrv4",
|
|
@@ -2091,7 +2139,7 @@ function Wo(e, t) {
|
|
|
2091
2139
|
...m(t)
|
|
2092
2140
|
});
|
|
2093
2141
|
}
|
|
2094
|
-
function
|
|
2142
|
+
function Oo(e, t) {
|
|
2095
2143
|
return new e({
|
|
2096
2144
|
type: "string",
|
|
2097
2145
|
format: "cidrv6",
|
|
@@ -2100,7 +2148,7 @@ function Bo(e, t) {
|
|
|
2100
2148
|
...m(t)
|
|
2101
2149
|
});
|
|
2102
2150
|
}
|
|
2103
|
-
function
|
|
2151
|
+
function Ro(e, t) {
|
|
2104
2152
|
return new e({
|
|
2105
2153
|
type: "string",
|
|
2106
2154
|
format: "base64",
|
|
@@ -2109,7 +2157,7 @@ function Yo(e, t) {
|
|
|
2109
2157
|
...m(t)
|
|
2110
2158
|
});
|
|
2111
2159
|
}
|
|
2112
|
-
function
|
|
2160
|
+
function Po(e, t) {
|
|
2113
2161
|
return new e({
|
|
2114
2162
|
type: "string",
|
|
2115
2163
|
format: "base64url",
|
|
@@ -2118,7 +2166,7 @@ function Ho(e, t) {
|
|
|
2118
2166
|
...m(t)
|
|
2119
2167
|
});
|
|
2120
2168
|
}
|
|
2121
|
-
function
|
|
2169
|
+
function No(e, t) {
|
|
2122
2170
|
return new e({
|
|
2123
2171
|
type: "string",
|
|
2124
2172
|
format: "e164",
|
|
@@ -2127,7 +2175,7 @@ function Jo(e, t) {
|
|
|
2127
2175
|
...m(t)
|
|
2128
2176
|
});
|
|
2129
2177
|
}
|
|
2130
|
-
function
|
|
2178
|
+
function Do(e, t) {
|
|
2131
2179
|
return new e({
|
|
2132
2180
|
type: "string",
|
|
2133
2181
|
format: "jwt",
|
|
@@ -2136,7 +2184,7 @@ function Go(e, t) {
|
|
|
2136
2184
|
...m(t)
|
|
2137
2185
|
});
|
|
2138
2186
|
}
|
|
2139
|
-
function
|
|
2187
|
+
function Uo(e, t) {
|
|
2140
2188
|
return new e({
|
|
2141
2189
|
type: "string",
|
|
2142
2190
|
format: "datetime",
|
|
@@ -2147,7 +2195,7 @@ function qo(e, t) {
|
|
|
2147
2195
|
...m(t)
|
|
2148
2196
|
});
|
|
2149
2197
|
}
|
|
2150
|
-
function
|
|
2198
|
+
function Lo(e, t) {
|
|
2151
2199
|
return new e({
|
|
2152
2200
|
type: "string",
|
|
2153
2201
|
format: "date",
|
|
@@ -2155,7 +2203,7 @@ function Xo(e, t) {
|
|
|
2155
2203
|
...m(t)
|
|
2156
2204
|
});
|
|
2157
2205
|
}
|
|
2158
|
-
function
|
|
2206
|
+
function Fo(e, t) {
|
|
2159
2207
|
return new e({
|
|
2160
2208
|
type: "string",
|
|
2161
2209
|
format: "time",
|
|
@@ -2164,7 +2212,7 @@ function Ko(e, t) {
|
|
|
2164
2212
|
...m(t)
|
|
2165
2213
|
});
|
|
2166
2214
|
}
|
|
2167
|
-
function
|
|
2215
|
+
function Mo(e, t) {
|
|
2168
2216
|
return new e({
|
|
2169
2217
|
type: "string",
|
|
2170
2218
|
format: "duration",
|
|
@@ -2172,14 +2220,14 @@ function Qo(e, t) {
|
|
|
2172
2220
|
...m(t)
|
|
2173
2221
|
});
|
|
2174
2222
|
}
|
|
2175
|
-
function
|
|
2223
|
+
function Vo(e, t) {
|
|
2176
2224
|
return new e({
|
|
2177
2225
|
type: "number",
|
|
2178
2226
|
checks: [],
|
|
2179
2227
|
...m(t)
|
|
2180
2228
|
});
|
|
2181
2229
|
}
|
|
2182
|
-
function
|
|
2230
|
+
function Wo(e, t) {
|
|
2183
2231
|
return new e({
|
|
2184
2232
|
type: "number",
|
|
2185
2233
|
check: "number_format",
|
|
@@ -2188,148 +2236,148 @@ function ti(e, t) {
|
|
|
2188
2236
|
...m(t)
|
|
2189
2237
|
});
|
|
2190
2238
|
}
|
|
2191
|
-
function
|
|
2239
|
+
function Bo(e, t) {
|
|
2192
2240
|
return new e({
|
|
2193
2241
|
type: "boolean",
|
|
2194
2242
|
...m(t)
|
|
2195
2243
|
});
|
|
2196
2244
|
}
|
|
2197
|
-
function
|
|
2245
|
+
function Yo(e) {
|
|
2198
2246
|
return new e({
|
|
2199
2247
|
type: "unknown"
|
|
2200
2248
|
});
|
|
2201
2249
|
}
|
|
2202
|
-
function
|
|
2250
|
+
function qo(e, t) {
|
|
2203
2251
|
return new e({
|
|
2204
2252
|
type: "never",
|
|
2205
2253
|
...m(t)
|
|
2206
2254
|
});
|
|
2207
2255
|
}
|
|
2208
|
-
function
|
|
2209
|
-
return new
|
|
2256
|
+
function nt(e, t) {
|
|
2257
|
+
return new Zt({
|
|
2210
2258
|
check: "less_than",
|
|
2211
2259
|
...m(t),
|
|
2212
2260
|
value: e,
|
|
2213
2261
|
inclusive: !1
|
|
2214
2262
|
});
|
|
2215
2263
|
}
|
|
2216
|
-
function
|
|
2217
|
-
return new
|
|
2264
|
+
function we(e, t) {
|
|
2265
|
+
return new Zt({
|
|
2218
2266
|
check: "less_than",
|
|
2219
2267
|
...m(t),
|
|
2220
2268
|
value: e,
|
|
2221
2269
|
inclusive: !0
|
|
2222
2270
|
});
|
|
2223
2271
|
}
|
|
2224
|
-
function
|
|
2225
|
-
return new
|
|
2272
|
+
function rt(e, t) {
|
|
2273
|
+
return new Et({
|
|
2226
2274
|
check: "greater_than",
|
|
2227
2275
|
...m(t),
|
|
2228
2276
|
value: e,
|
|
2229
2277
|
inclusive: !1
|
|
2230
2278
|
});
|
|
2231
2279
|
}
|
|
2232
|
-
function
|
|
2233
|
-
return new
|
|
2280
|
+
function ke(e, t) {
|
|
2281
|
+
return new Et({
|
|
2234
2282
|
check: "greater_than",
|
|
2235
2283
|
...m(t),
|
|
2236
2284
|
value: e,
|
|
2237
2285
|
inclusive: !0
|
|
2238
2286
|
});
|
|
2239
2287
|
}
|
|
2240
|
-
function
|
|
2241
|
-
return new
|
|
2288
|
+
function ot(e, t) {
|
|
2289
|
+
return new ur({
|
|
2242
2290
|
check: "multiple_of",
|
|
2243
2291
|
...m(t),
|
|
2244
2292
|
value: e
|
|
2245
2293
|
});
|
|
2246
2294
|
}
|
|
2247
|
-
function
|
|
2248
|
-
return new
|
|
2295
|
+
function It(e, t) {
|
|
2296
|
+
return new dr({
|
|
2249
2297
|
check: "max_length",
|
|
2250
2298
|
...m(t),
|
|
2251
2299
|
maximum: e
|
|
2252
2300
|
});
|
|
2253
2301
|
}
|
|
2254
|
-
function
|
|
2255
|
-
return new
|
|
2302
|
+
function de(e, t) {
|
|
2303
|
+
return new fr({
|
|
2256
2304
|
check: "min_length",
|
|
2257
2305
|
...m(t),
|
|
2258
2306
|
minimum: e
|
|
2259
2307
|
});
|
|
2260
2308
|
}
|
|
2261
|
-
function
|
|
2262
|
-
return new
|
|
2309
|
+
function St(e, t) {
|
|
2310
|
+
return new hr({
|
|
2263
2311
|
check: "length_equals",
|
|
2264
2312
|
...m(t),
|
|
2265
2313
|
length: e
|
|
2266
2314
|
});
|
|
2267
2315
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return new
|
|
2316
|
+
function Jo(e, t) {
|
|
2317
|
+
return new mr({
|
|
2270
2318
|
check: "string_format",
|
|
2271
2319
|
format: "regex",
|
|
2272
2320
|
...m(t),
|
|
2273
2321
|
pattern: e
|
|
2274
2322
|
});
|
|
2275
2323
|
}
|
|
2276
|
-
function
|
|
2277
|
-
return new
|
|
2324
|
+
function Go(e) {
|
|
2325
|
+
return new pr({
|
|
2278
2326
|
check: "string_format",
|
|
2279
2327
|
format: "lowercase",
|
|
2280
2328
|
...m(e)
|
|
2281
2329
|
});
|
|
2282
2330
|
}
|
|
2283
|
-
function
|
|
2284
|
-
return new
|
|
2331
|
+
function Ho(e) {
|
|
2332
|
+
return new _r({
|
|
2285
2333
|
check: "string_format",
|
|
2286
2334
|
format: "uppercase",
|
|
2287
2335
|
...m(e)
|
|
2288
2336
|
});
|
|
2289
2337
|
}
|
|
2290
|
-
function
|
|
2291
|
-
return new
|
|
2338
|
+
function Xo(e, t) {
|
|
2339
|
+
return new gr({
|
|
2292
2340
|
check: "string_format",
|
|
2293
2341
|
format: "includes",
|
|
2294
2342
|
...m(t),
|
|
2295
2343
|
includes: e
|
|
2296
2344
|
});
|
|
2297
2345
|
}
|
|
2298
|
-
function
|
|
2299
|
-
return new
|
|
2346
|
+
function Ko(e, t) {
|
|
2347
|
+
return new vr({
|
|
2300
2348
|
check: "string_format",
|
|
2301
2349
|
format: "starts_with",
|
|
2302
2350
|
...m(t),
|
|
2303
2351
|
prefix: e
|
|
2304
2352
|
});
|
|
2305
2353
|
}
|
|
2306
|
-
function
|
|
2307
|
-
return new
|
|
2354
|
+
function Qo(e, t) {
|
|
2355
|
+
return new br({
|
|
2308
2356
|
check: "string_format",
|
|
2309
2357
|
format: "ends_with",
|
|
2310
2358
|
...m(t),
|
|
2311
2359
|
suffix: e
|
|
2312
2360
|
});
|
|
2313
2361
|
}
|
|
2314
|
-
function
|
|
2315
|
-
return new
|
|
2362
|
+
function Q(e) {
|
|
2363
|
+
return new wr({
|
|
2316
2364
|
check: "overwrite",
|
|
2317
2365
|
tx: e
|
|
2318
2366
|
});
|
|
2319
2367
|
}
|
|
2320
|
-
function
|
|
2321
|
-
return
|
|
2368
|
+
function ei(e) {
|
|
2369
|
+
return Q((t) => t.normalize(e));
|
|
2322
2370
|
}
|
|
2323
|
-
function
|
|
2324
|
-
return
|
|
2371
|
+
function ti() {
|
|
2372
|
+
return Q((e) => e.trim());
|
|
2325
2373
|
}
|
|
2326
|
-
function
|
|
2327
|
-
return
|
|
2374
|
+
function ni() {
|
|
2375
|
+
return Q((e) => e.toLowerCase());
|
|
2328
2376
|
}
|
|
2329
|
-
function
|
|
2330
|
-
return
|
|
2377
|
+
function ri() {
|
|
2378
|
+
return Q((e) => e.toUpperCase());
|
|
2331
2379
|
}
|
|
2332
|
-
function
|
|
2380
|
+
function oi(e, t, n) {
|
|
2333
2381
|
return new e({
|
|
2334
2382
|
type: "array",
|
|
2335
2383
|
element: t,
|
|
@@ -2339,7 +2387,7 @@ function pi(e, t, n) {
|
|
|
2339
2387
|
...m(n)
|
|
2340
2388
|
});
|
|
2341
2389
|
}
|
|
2342
|
-
function
|
|
2390
|
+
function ii(e, t, n) {
|
|
2343
2391
|
return new e({
|
|
2344
2392
|
type: "custom",
|
|
2345
2393
|
check: "custom",
|
|
@@ -2347,67 +2395,67 @@ function gi(e, t, n) {
|
|
|
2347
2395
|
...m(n)
|
|
2348
2396
|
});
|
|
2349
2397
|
}
|
|
2350
|
-
function
|
|
2351
|
-
const t =
|
|
2398
|
+
function ci(e) {
|
|
2399
|
+
const t = si((n) => (n.addIssue = (r) => {
|
|
2352
2400
|
if (typeof r == "string")
|
|
2353
|
-
n.issues.push(
|
|
2401
|
+
n.issues.push(K(r, n.value, t._zod.def));
|
|
2354
2402
|
else {
|
|
2355
2403
|
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(
|
|
2404
|
+
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
2405
|
}
|
|
2358
2406
|
}, e(n.value, n)));
|
|
2359
2407
|
return t;
|
|
2360
2408
|
}
|
|
2361
|
-
function
|
|
2362
|
-
const n = new
|
|
2409
|
+
function si(e, t) {
|
|
2410
|
+
const n = new I({
|
|
2363
2411
|
check: "custom",
|
|
2364
2412
|
...m(t)
|
|
2365
2413
|
});
|
|
2366
2414
|
return n._zod.check = e, n;
|
|
2367
2415
|
}
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2416
|
+
const ai = /* @__PURE__ */ a("ZodISODateTime", (e, t) => {
|
|
2417
|
+
Or.init(e, t), z.init(e, t);
|
|
2370
2418
|
});
|
|
2371
|
-
function
|
|
2372
|
-
return
|
|
2419
|
+
function ui(e) {
|
|
2420
|
+
return Uo(ai, e);
|
|
2373
2421
|
}
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2422
|
+
const li = /* @__PURE__ */ a("ZodISODate", (e, t) => {
|
|
2423
|
+
Rr.init(e, t), z.init(e, t);
|
|
2376
2424
|
});
|
|
2377
|
-
function
|
|
2378
|
-
return
|
|
2425
|
+
function di(e) {
|
|
2426
|
+
return Lo(li, e);
|
|
2379
2427
|
}
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2428
|
+
const fi = /* @__PURE__ */ a("ZodISOTime", (e, t) => {
|
|
2429
|
+
Pr.init(e, t), z.init(e, t);
|
|
2382
2430
|
});
|
|
2383
|
-
function
|
|
2384
|
-
return
|
|
2431
|
+
function hi(e) {
|
|
2432
|
+
return Fo(fi, e);
|
|
2385
2433
|
}
|
|
2386
|
-
const
|
|
2387
|
-
|
|
2434
|
+
const mi = /* @__PURE__ */ a("ZodISODuration", (e, t) => {
|
|
2435
|
+
Nr.init(e, t), z.init(e, t);
|
|
2388
2436
|
});
|
|
2389
|
-
function
|
|
2390
|
-
return
|
|
2437
|
+
function pi(e) {
|
|
2438
|
+
return Mo(mi, e);
|
|
2391
2439
|
}
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2440
|
+
const _i = (e, t) => {
|
|
2441
|
+
bt.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2394
2442
|
format: {
|
|
2395
|
-
value: (n) =>
|
|
2443
|
+
value: (n) => Zn(e, n)
|
|
2396
2444
|
// enumerable: false,
|
|
2397
2445
|
},
|
|
2398
2446
|
flatten: {
|
|
2399
|
-
value: (n) =>
|
|
2447
|
+
value: (n) => $n(e, n)
|
|
2400
2448
|
// enumerable: false,
|
|
2401
2449
|
},
|
|
2402
2450
|
addIssue: {
|
|
2403
2451
|
value: (n) => {
|
|
2404
|
-
e.issues.push(n), e.message = JSON.stringify(e.issues,
|
|
2452
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, ze, 2);
|
|
2405
2453
|
}
|
|
2406
2454
|
// enumerable: false,
|
|
2407
2455
|
},
|
|
2408
2456
|
addIssues: {
|
|
2409
2457
|
value: (n) => {
|
|
2410
|
-
e.issues.push(...n), e.message = JSON.stringify(e.issues,
|
|
2458
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, ze, 2);
|
|
2411
2459
|
}
|
|
2412
2460
|
// enumerable: false,
|
|
2413
2461
|
},
|
|
@@ -2418,156 +2466,156 @@ const xi = (e, t) => {
|
|
|
2418
2466
|
// enumerable: false,
|
|
2419
2467
|
}
|
|
2420
2468
|
});
|
|
2421
|
-
},
|
|
2469
|
+
}, O = a("ZodError", _i, {
|
|
2422
2470
|
Parent: Error
|
|
2423
|
-
}),
|
|
2471
|
+
}), gi = /* @__PURE__ */ Ie(O), vi = /* @__PURE__ */ Se(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__ */ Sn(O), Ei = /* @__PURE__ */ Cn(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
2472
|
checks: [
|
|
2425
2473
|
...t.checks ?? [],
|
|
2426
2474
|
...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
|
|
2427
2475
|
]
|
|
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) =>
|
|
2476
|
+
})), 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
2477
|
const r = e.clone();
|
|
2430
|
-
return
|
|
2478
|
+
return ie.add(r, { description: n }), r;
|
|
2431
2479
|
}, Object.defineProperty(e, "description", {
|
|
2432
2480
|
get() {
|
|
2433
|
-
return
|
|
2481
|
+
return ie.get(e)?.description;
|
|
2434
2482
|
},
|
|
2435
2483
|
configurable: !0
|
|
2436
2484
|
}), e.meta = (...n) => {
|
|
2437
2485
|
if (n.length === 0)
|
|
2438
|
-
return
|
|
2486
|
+
return ie.get(e);
|
|
2439
2487
|
const r = e.clone();
|
|
2440
|
-
return
|
|
2441
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2442
|
-
|
|
2488
|
+
return ie.add(r, n[0]), r;
|
|
2489
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Ct = /* @__PURE__ */ a("_ZodString", (e, t) => {
|
|
2490
|
+
Ce.init(e, t), E.init(e, t);
|
|
2443
2491
|
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
|
-
|
|
2492
|
+
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(St(...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());
|
|
2493
|
+
}), Ai = /* @__PURE__ */ a("ZodString", (e, t) => {
|
|
2494
|
+
Ce.init(e, t), Ct.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(Yi, n)), e.emoji = (n) => e.check($o(Si, 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(Ci, 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(So(Li, n)), e.cidrv4 = (n) => e.check(Co(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
2495
|
});
|
|
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
|
-
|
|
2496
|
+
function ce(e) {
|
|
2497
|
+
return go(Ai, e);
|
|
2498
|
+
}
|
|
2499
|
+
const z = /* @__PURE__ */ a("ZodStringFormat", (e, t) => {
|
|
2500
|
+
k.init(e, t), Ct.init(e, t);
|
|
2501
|
+
}), ji = /* @__PURE__ */ a("ZodEmail", (e, t) => {
|
|
2502
|
+
Zr.init(e, t), z.init(e, t);
|
|
2503
|
+
}), it = /* @__PURE__ */ a("ZodGUID", (e, t) => {
|
|
2504
|
+
yr.init(e, t), z.init(e, t);
|
|
2505
|
+
}), se = /* @__PURE__ */ a("ZodUUID", (e, t) => {
|
|
2506
|
+
$r.init(e, t), z.init(e, t);
|
|
2507
|
+
}), Ii = /* @__PURE__ */ a("ZodURL", (e, t) => {
|
|
2508
|
+
Er.init(e, t), z.init(e, t);
|
|
2509
|
+
}), Si = /* @__PURE__ */ a("ZodEmoji", (e, t) => {
|
|
2510
|
+
xr.init(e, t), z.init(e, t);
|
|
2511
|
+
}), Ci = /* @__PURE__ */ a("ZodNanoID", (e, t) => {
|
|
2512
|
+
Tr.init(e, t), z.init(e, t);
|
|
2513
|
+
}), Oi = /* @__PURE__ */ a("ZodCUID", (e, t) => {
|
|
2514
|
+
Ar.init(e, t), z.init(e, t);
|
|
2515
|
+
}), Ri = /* @__PURE__ */ a("ZodCUID2", (e, t) => {
|
|
2516
|
+
jr.init(e, t), z.init(e, t);
|
|
2517
|
+
}), Pi = /* @__PURE__ */ a("ZodULID", (e, t) => {
|
|
2518
|
+
Ir.init(e, t), z.init(e, t);
|
|
2519
|
+
}), Ni = /* @__PURE__ */ a("ZodXID", (e, t) => {
|
|
2520
|
+
Sr.init(e, t), z.init(e, t);
|
|
2521
|
+
}), Di = /* @__PURE__ */ a("ZodKSUID", (e, t) => {
|
|
2522
|
+
Cr.init(e, t), z.init(e, t);
|
|
2523
|
+
}), Ui = /* @__PURE__ */ a("ZodIPv4", (e, t) => {
|
|
2524
|
+
Dr.init(e, t), z.init(e, t);
|
|
2525
|
+
}), Li = /* @__PURE__ */ a("ZodIPv6", (e, t) => {
|
|
2526
|
+
Ur.init(e, t), z.init(e, t);
|
|
2527
|
+
}), Fi = /* @__PURE__ */ a("ZodCIDRv4", (e, t) => {
|
|
2528
|
+
Lr.init(e, t), z.init(e, t);
|
|
2529
|
+
}), Mi = /* @__PURE__ */ a("ZodCIDRv6", (e, t) => {
|
|
2530
|
+
Fr.init(e, t), z.init(e, t);
|
|
2531
|
+
}), Vi = /* @__PURE__ */ a("ZodBase64", (e, t) => {
|
|
2532
|
+
Mr.init(e, t), z.init(e, t);
|
|
2533
|
+
}), Wi = /* @__PURE__ */ a("ZodBase64URL", (e, t) => {
|
|
2534
|
+
Wr.init(e, t), z.init(e, t);
|
|
2535
|
+
}), Bi = /* @__PURE__ */ a("ZodE164", (e, t) => {
|
|
2536
|
+
Br.init(e, t), z.init(e, t);
|
|
2537
|
+
}), Yi = /* @__PURE__ */ a("ZodJWT", (e, t) => {
|
|
2538
|
+
qr.init(e, t), z.init(e, t);
|
|
2539
|
+
}), Ot = /* @__PURE__ */ a("ZodNumber", (e, t) => {
|
|
2540
|
+
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
2541
|
const n = e._zod.bag;
|
|
2494
2542
|
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
2543
|
});
|
|
2496
|
-
function
|
|
2497
|
-
return
|
|
2544
|
+
function ct(e) {
|
|
2545
|
+
return Vo(Ot, e);
|
|
2498
2546
|
}
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2547
|
+
const qi = /* @__PURE__ */ a("ZodNumberFormat", (e, t) => {
|
|
2548
|
+
Jr.init(e, t), Ot.init(e, t);
|
|
2501
2549
|
});
|
|
2502
|
-
function
|
|
2503
|
-
return
|
|
2550
|
+
function st(e) {
|
|
2551
|
+
return Wo(qi, e);
|
|
2504
2552
|
}
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2553
|
+
const Ji = /* @__PURE__ */ a("ZodBoolean", (e, t) => {
|
|
2554
|
+
Gr.init(e, t), E.init(e, t);
|
|
2507
2555
|
});
|
|
2508
|
-
function
|
|
2509
|
-
return
|
|
2556
|
+
function at(e) {
|
|
2557
|
+
return Bo(Ji, e);
|
|
2510
2558
|
}
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2559
|
+
const Gi = /* @__PURE__ */ a("ZodUnknown", (e, t) => {
|
|
2560
|
+
Hr.init(e, t), E.init(e, t);
|
|
2513
2561
|
});
|
|
2514
|
-
function
|
|
2515
|
-
return
|
|
2562
|
+
function ut() {
|
|
2563
|
+
return Yo(Gi);
|
|
2516
2564
|
}
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2565
|
+
const Hi = /* @__PURE__ */ a("ZodNever", (e, t) => {
|
|
2566
|
+
Xr.init(e, t), E.init(e, t);
|
|
2519
2567
|
});
|
|
2520
|
-
function
|
|
2521
|
-
return
|
|
2568
|
+
function Xi(e) {
|
|
2569
|
+
return qo(Hi, e);
|
|
2522
2570
|
}
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2571
|
+
const Ki = /* @__PURE__ */ a("ZodArray", (e, t) => {
|
|
2572
|
+
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(St(n, r)), e.unwrap = () => e.element;
|
|
2525
2573
|
});
|
|
2526
|
-
function
|
|
2527
|
-
return
|
|
2574
|
+
function Qi(e, t) {
|
|
2575
|
+
return oi(Ki, e, t);
|
|
2528
2576
|
}
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2577
|
+
const ec = /* @__PURE__ */ a("ZodObject", (e, t) => {
|
|
2578
|
+
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
2579
|
});
|
|
2532
|
-
function
|
|
2580
|
+
function $e(e, t) {
|
|
2533
2581
|
const n = {
|
|
2534
2582
|
type: "object",
|
|
2535
2583
|
shape: e ?? {},
|
|
2536
2584
|
...m(t)
|
|
2537
2585
|
};
|
|
2538
|
-
return new
|
|
2586
|
+
return new ec(n);
|
|
2539
2587
|
}
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2588
|
+
const tc = /* @__PURE__ */ a("ZodUnion", (e, t) => {
|
|
2589
|
+
to.init(e, t), E.init(e, t), e.options = t.options;
|
|
2542
2590
|
});
|
|
2543
|
-
function
|
|
2544
|
-
return new
|
|
2591
|
+
function nc(e, t) {
|
|
2592
|
+
return new tc({
|
|
2545
2593
|
type: "union",
|
|
2546
2594
|
options: e,
|
|
2547
2595
|
...m(t)
|
|
2548
2596
|
});
|
|
2549
2597
|
}
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2598
|
+
const rc = /* @__PURE__ */ a("ZodIntersection", (e, t) => {
|
|
2599
|
+
no.init(e, t), E.init(e, t);
|
|
2552
2600
|
});
|
|
2553
|
-
function
|
|
2554
|
-
return new
|
|
2601
|
+
function oc(e, t) {
|
|
2602
|
+
return new rc({
|
|
2555
2603
|
type: "intersection",
|
|
2556
2604
|
left: e,
|
|
2557
2605
|
right: t
|
|
2558
2606
|
});
|
|
2559
2607
|
}
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2608
|
+
const Ze = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
2609
|
+
ro.init(e, t), E.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
2562
2610
|
const n = new Set(Object.keys(t.entries));
|
|
2563
2611
|
e.extract = (r, o) => {
|
|
2564
2612
|
const i = {};
|
|
2565
|
-
for (const
|
|
2566
|
-
if (n.has(
|
|
2567
|
-
i[
|
|
2613
|
+
for (const c of r)
|
|
2614
|
+
if (n.has(c))
|
|
2615
|
+
i[c] = t.entries[c];
|
|
2568
2616
|
else
|
|
2569
|
-
throw new Error(`Key ${
|
|
2570
|
-
return new
|
|
2617
|
+
throw new Error(`Key ${c} not found in enum`);
|
|
2618
|
+
return new Ze({
|
|
2571
2619
|
...t,
|
|
2572
2620
|
checks: [],
|
|
2573
2621
|
...m(o),
|
|
@@ -2575,12 +2623,12 @@ const Se = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
|
2575
2623
|
});
|
|
2576
2624
|
}, e.exclude = (r, o) => {
|
|
2577
2625
|
const i = { ...t.entries };
|
|
2578
|
-
for (const
|
|
2579
|
-
if (n.has(
|
|
2580
|
-
delete i[
|
|
2626
|
+
for (const c of r)
|
|
2627
|
+
if (n.has(c))
|
|
2628
|
+
delete i[c];
|
|
2581
2629
|
else
|
|
2582
|
-
throw new Error(`Key ${
|
|
2583
|
-
return new
|
|
2630
|
+
throw new Error(`Key ${c} not found in enum`);
|
|
2631
|
+
return new Ze({
|
|
2584
2632
|
...t,
|
|
2585
2633
|
checks: [],
|
|
2586
2634
|
...m(o),
|
|
@@ -2588,618 +2636,179 @@ const Se = /* @__PURE__ */ a("ZodEnum", (e, t) => {
|
|
|
2588
2636
|
});
|
|
2589
2637
|
};
|
|
2590
2638
|
});
|
|
2591
|
-
function
|
|
2639
|
+
function Oe(e, t) {
|
|
2592
2640
|
const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
|
|
2593
|
-
return new
|
|
2641
|
+
return new Ze({
|
|
2594
2642
|
type: "enum",
|
|
2595
2643
|
entries: n,
|
|
2596
2644
|
...m(t)
|
|
2597
2645
|
});
|
|
2598
2646
|
}
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2647
|
+
const ic = /* @__PURE__ */ a("ZodTransform", (e, t) => {
|
|
2648
|
+
oo.init(e, t), E.init(e, t), e._zod.parse = (n, r) => {
|
|
2601
2649
|
if (r.direction === "backward")
|
|
2602
|
-
throw new
|
|
2650
|
+
throw new ht(e.constructor.name);
|
|
2603
2651
|
n.addIssue = (i) => {
|
|
2604
2652
|
if (typeof i == "string")
|
|
2605
|
-
n.issues.push(
|
|
2653
|
+
n.issues.push(K(i, n.value, t));
|
|
2606
2654
|
else {
|
|
2607
|
-
const
|
|
2608
|
-
|
|
2655
|
+
const c = i;
|
|
2656
|
+
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
2657
|
}
|
|
2610
2658
|
};
|
|
2611
2659
|
const o = t.transform(n.value, n);
|
|
2612
2660
|
return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
|
|
2613
2661
|
};
|
|
2614
2662
|
});
|
|
2615
|
-
function
|
|
2616
|
-
return new
|
|
2663
|
+
function cc(e) {
|
|
2664
|
+
return new ic({
|
|
2617
2665
|
type: "transform",
|
|
2618
2666
|
transform: e
|
|
2619
2667
|
});
|
|
2620
2668
|
}
|
|
2621
|
-
const
|
|
2622
|
-
|
|
2669
|
+
const Rt = /* @__PURE__ */ a("ZodOptional", (e, t) => {
|
|
2670
|
+
io.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2623
2671
|
});
|
|
2624
|
-
function
|
|
2625
|
-
return new
|
|
2672
|
+
function lt(e) {
|
|
2673
|
+
return new Rt({
|
|
2626
2674
|
type: "optional",
|
|
2627
2675
|
innerType: e
|
|
2628
2676
|
});
|
|
2629
2677
|
}
|
|
2630
|
-
const
|
|
2631
|
-
|
|
2678
|
+
const sc = /* @__PURE__ */ a("ZodNullable", (e, t) => {
|
|
2679
|
+
co.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2632
2680
|
});
|
|
2633
|
-
function
|
|
2634
|
-
return new
|
|
2681
|
+
function dt(e) {
|
|
2682
|
+
return new sc({
|
|
2635
2683
|
type: "nullable",
|
|
2636
2684
|
innerType: e
|
|
2637
2685
|
});
|
|
2638
2686
|
}
|
|
2639
|
-
const
|
|
2640
|
-
|
|
2687
|
+
const ac = /* @__PURE__ */ a("ZodDefault", (e, t) => {
|
|
2688
|
+
so.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
2641
2689
|
});
|
|
2642
|
-
function
|
|
2643
|
-
return new
|
|
2690
|
+
function uc(e, t) {
|
|
2691
|
+
return new ac({
|
|
2644
2692
|
type: "default",
|
|
2645
2693
|
innerType: e,
|
|
2646
2694
|
get defaultValue() {
|
|
2647
|
-
return typeof t == "function" ? t() :
|
|
2695
|
+
return typeof t == "function" ? t() : _t(t);
|
|
2648
2696
|
}
|
|
2649
2697
|
});
|
|
2650
2698
|
}
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2699
|
+
const lc = /* @__PURE__ */ a("ZodPrefault", (e, t) => {
|
|
2700
|
+
ao.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2653
2701
|
});
|
|
2654
|
-
function
|
|
2655
|
-
return new
|
|
2702
|
+
function dc(e, t) {
|
|
2703
|
+
return new lc({
|
|
2656
2704
|
type: "prefault",
|
|
2657
2705
|
innerType: e,
|
|
2658
2706
|
get defaultValue() {
|
|
2659
|
-
return typeof t == "function" ? t() :
|
|
2707
|
+
return typeof t == "function" ? t() : _t(t);
|
|
2660
2708
|
}
|
|
2661
2709
|
});
|
|
2662
2710
|
}
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2711
|
+
const Pt = /* @__PURE__ */ a("ZodNonOptional", (e, t) => {
|
|
2712
|
+
uo.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2665
2713
|
});
|
|
2666
|
-
function
|
|
2667
|
-
return new
|
|
2714
|
+
function fc(e, t) {
|
|
2715
|
+
return new Pt({
|
|
2668
2716
|
type: "nonoptional",
|
|
2669
2717
|
innerType: e,
|
|
2670
2718
|
...m(t)
|
|
2671
2719
|
});
|
|
2672
2720
|
}
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2721
|
+
const hc = /* @__PURE__ */ a("ZodCatch", (e, t) => {
|
|
2722
|
+
lo.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
2675
2723
|
});
|
|
2676
|
-
function
|
|
2677
|
-
return new
|
|
2724
|
+
function mc(e, t) {
|
|
2725
|
+
return new hc({
|
|
2678
2726
|
type: "catch",
|
|
2679
2727
|
innerType: e,
|
|
2680
2728
|
catchValue: typeof t == "function" ? t : () => t
|
|
2681
2729
|
});
|
|
2682
2730
|
}
|
|
2683
|
-
const
|
|
2684
|
-
|
|
2731
|
+
const pc = /* @__PURE__ */ a("ZodPipe", (e, t) => {
|
|
2732
|
+
fo.init(e, t), E.init(e, t), e.in = t.in, e.out = t.out;
|
|
2685
2733
|
});
|
|
2686
|
-
function
|
|
2687
|
-
return new
|
|
2734
|
+
function ft(e, t) {
|
|
2735
|
+
return new pc({
|
|
2688
2736
|
type: "pipe",
|
|
2689
2737
|
in: e,
|
|
2690
2738
|
out: t
|
|
2691
2739
|
// ...util.normalizeParams(params),
|
|
2692
2740
|
});
|
|
2693
2741
|
}
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2742
|
+
const _c = /* @__PURE__ */ a("ZodReadonly", (e, t) => {
|
|
2743
|
+
ho.init(e, t), E.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
2696
2744
|
});
|
|
2697
|
-
function
|
|
2698
|
-
return new
|
|
2745
|
+
function gc(e) {
|
|
2746
|
+
return new _c({
|
|
2699
2747
|
type: "readonly",
|
|
2700
2748
|
innerType: e
|
|
2701
2749
|
});
|
|
2702
2750
|
}
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2751
|
+
const vc = /* @__PURE__ */ a("ZodCustom", (e, t) => {
|
|
2752
|
+
mo.init(e, t), E.init(e, t);
|
|
2705
2753
|
});
|
|
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:
|
|
2754
|
+
function bc(e, t = {}) {
|
|
2755
|
+
return ii(vc, e, t);
|
|
2756
|
+
}
|
|
2757
|
+
function wc(e) {
|
|
2758
|
+
return ci(e);
|
|
2759
|
+
}
|
|
2760
|
+
const kc = $e({
|
|
2761
|
+
title: ce().min(1, "Title is required").max(200, "Title too long"),
|
|
2762
|
+
content: ce().min(1, "Content is required"),
|
|
2763
|
+
format: Oe(["html", "markdown"]).default("html"),
|
|
2764
|
+
metadata: $e({
|
|
2765
|
+
createdAt: ce().datetime(),
|
|
2766
|
+
updatedAt: ce().datetime(),
|
|
2767
|
+
wordCount: ct().min(0),
|
|
2768
|
+
characterCount: ct().min(0)
|
|
2721
2769
|
}).optional()
|
|
2722
2770
|
});
|
|
2723
|
-
|
|
2724
|
-
includeStyles:
|
|
2725
|
-
includeMeta:
|
|
2726
|
-
format:
|
|
2771
|
+
$e({
|
|
2772
|
+
includeStyles: at().default(!0),
|
|
2773
|
+
includeMeta: at().default(!0),
|
|
2774
|
+
format: Oe(["html", "txt"]).default("html")
|
|
2727
2775
|
});
|
|
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({
|
|
2776
|
+
const zc = (e = "") => {
|
|
2777
|
+
const [t, n] = ae({
|
|
3169
2778
|
content: e,
|
|
3170
2779
|
title: "Untitled Document",
|
|
3171
2780
|
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
3172
2781
|
characterCount: e.length,
|
|
3173
2782
|
hasUnsavedChanges: !1
|
|
3174
|
-
}), r =
|
|
3175
|
-
|
|
3176
|
-
r.current && e !== t.content && (r.current.innerHTML = e, n((
|
|
3177
|
-
...
|
|
2783
|
+
}), r = Mt(null);
|
|
2784
|
+
Ee(() => {
|
|
2785
|
+
r.current && e !== t.content && (r.current.innerHTML = e, n((h) => ({
|
|
2786
|
+
...h,
|
|
3178
2787
|
content: e,
|
|
3179
2788
|
wordCount: e.trim() ? e.trim().split(/\s+/).length : 0,
|
|
3180
2789
|
characterCount: e.length
|
|
3181
2790
|
})));
|
|
3182
2791
|
}, [e]);
|
|
3183
|
-
const o =
|
|
3184
|
-
const
|
|
3185
|
-
n((
|
|
3186
|
-
...
|
|
3187
|
-
content:
|
|
3188
|
-
wordCount:
|
|
3189
|
-
characterCount:
|
|
2792
|
+
const o = P((h) => {
|
|
2793
|
+
const v = h.trim() ? h.trim().split(/\s+/).length : 0, _ = h.length;
|
|
2794
|
+
n((l) => ({
|
|
2795
|
+
...l,
|
|
2796
|
+
content: h,
|
|
2797
|
+
wordCount: v,
|
|
2798
|
+
characterCount: _,
|
|
3190
2799
|
hasUnsavedChanges: !0
|
|
3191
2800
|
}));
|
|
3192
|
-
}, []), i =
|
|
3193
|
-
n((
|
|
3194
|
-
...
|
|
3195
|
-
title:
|
|
2801
|
+
}, []), i = P((h) => {
|
|
2802
|
+
n((v) => ({
|
|
2803
|
+
...v,
|
|
2804
|
+
title: h,
|
|
3196
2805
|
hasUnsavedChanges: !0
|
|
3197
2806
|
}));
|
|
3198
|
-
}, []),
|
|
3199
|
-
document.execCommand(
|
|
3200
|
-
}, []),
|
|
2807
|
+
}, []), c = P((h, v) => {
|
|
2808
|
+
document.execCommand(h, !1, v), r.current?.focus();
|
|
2809
|
+
}, []), s = P(() => {
|
|
3201
2810
|
try {
|
|
3202
|
-
return { success: !0, data:
|
|
2811
|
+
return { success: !0, data: kc.parse({
|
|
3203
2812
|
title: t.title,
|
|
3204
2813
|
content: t.content,
|
|
3205
2814
|
metadata: {
|
|
@@ -3209,22 +2818,22 @@ const _t = {
|
|
|
3209
2818
|
characterCount: t.characterCount
|
|
3210
2819
|
}
|
|
3211
2820
|
}) };
|
|
3212
|
-
} catch (
|
|
3213
|
-
return { success: !1, error:
|
|
2821
|
+
} catch (h) {
|
|
2822
|
+
return { success: !1, error: h instanceof Error ? h.message : "Validation failed" };
|
|
3214
2823
|
}
|
|
3215
|
-
}, [t]),
|
|
3216
|
-
(
|
|
3217
|
-
const
|
|
3218
|
-
if (!
|
|
3219
|
-
throw new Error(
|
|
3220
|
-
const { data:
|
|
3221
|
-
let
|
|
2824
|
+
}, [t]), f = P(
|
|
2825
|
+
(h = { includeStyles: !0, includeMeta: !0 }) => {
|
|
2826
|
+
const v = s();
|
|
2827
|
+
if (!v.success)
|
|
2828
|
+
throw new Error(v.error);
|
|
2829
|
+
const { data: _ } = v;
|
|
2830
|
+
let l = `<!DOCTYPE html>
|
|
3222
2831
|
<html>
|
|
3223
2832
|
<head>
|
|
3224
2833
|
<meta charset="UTF-8">
|
|
3225
2834
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3226
|
-
<title>${
|
|
3227
|
-
return
|
|
2835
|
+
<title>${_?.title}</title>`;
|
|
2836
|
+
return h.includeStyles && (l += `
|
|
3228
2837
|
<style>
|
|
3229
2838
|
body {
|
|
3230
2839
|
font-family: Arial, sans-serif;
|
|
@@ -3238,24 +2847,24 @@ const _t = {
|
|
|
3238
2847
|
border-radius: 8px;
|
|
3239
2848
|
background: white;
|
|
3240
2849
|
}
|
|
3241
|
-
</style>`),
|
|
2850
|
+
</style>`), l += `
|
|
3242
2851
|
</head>
|
|
3243
|
-
<body>`,
|
|
2852
|
+
<body>`, h.includeMeta && (l += `
|
|
3244
2853
|
<div class="document-meta">
|
|
3245
|
-
<h1>${
|
|
3246
|
-
<p><small>Created: ${new Date(
|
|
3247
|
-
Words: ${
|
|
3248
|
-
Characters: ${
|
|
2854
|
+
<h1>${_?.title}</h1>
|
|
2855
|
+
<p><small>Created: ${new Date(_?.metadata.createdAt ?? "").toLocaleString()} |
|
|
2856
|
+
Words: ${_?.metadata.wordCount} |
|
|
2857
|
+
Characters: ${_?.metadata.characterCount}</small></p>
|
|
3249
2858
|
<hr>
|
|
3250
|
-
</div>`),
|
|
2859
|
+
</div>`), l += `
|
|
3251
2860
|
<div class="editor-content">
|
|
3252
|
-
${
|
|
2861
|
+
${_?.content}
|
|
3253
2862
|
</div>
|
|
3254
2863
|
</body>
|
|
3255
|
-
</html>`,
|
|
2864
|
+
</html>`, l;
|
|
3256
2865
|
},
|
|
3257
|
-
[
|
|
3258
|
-
),
|
|
2866
|
+
[s]
|
|
2867
|
+
), d = P(() => {
|
|
3259
2868
|
n({
|
|
3260
2869
|
content: "",
|
|
3261
2870
|
title: "Untitled Document",
|
|
@@ -3269,13 +2878,119 @@ const _t = {
|
|
|
3269
2878
|
editorRef: r,
|
|
3270
2879
|
updateContent: o,
|
|
3271
2880
|
updateTitle: i,
|
|
3272
|
-
executeCommand:
|
|
3273
|
-
getValidationResult:
|
|
3274
|
-
exportToHTML:
|
|
3275
|
-
clearEditor:
|
|
2881
|
+
executeCommand: c,
|
|
2882
|
+
getValidationResult: s,
|
|
2883
|
+
exportToHTML: f,
|
|
2884
|
+
clearEditor: d
|
|
3276
2885
|
};
|
|
2886
|
+
}, Zc = ({
|
|
2887
|
+
initialContent: e = "",
|
|
2888
|
+
onSave: t,
|
|
2889
|
+
onExport: n,
|
|
2890
|
+
onChange: r,
|
|
2891
|
+
showButtons: o = !1,
|
|
2892
|
+
showSaveTitle: i = !1,
|
|
2893
|
+
showStatusBar: c = !1
|
|
2894
|
+
}) => {
|
|
2895
|
+
const {
|
|
2896
|
+
editorState: s,
|
|
2897
|
+
editorRef: f,
|
|
2898
|
+
updateContent: d,
|
|
2899
|
+
updateTitle: h,
|
|
2900
|
+
executeCommand: v,
|
|
2901
|
+
getValidationResult: _,
|
|
2902
|
+
exportToHTML: l,
|
|
2903
|
+
clearEditor: b
|
|
2904
|
+
} = zc(e), [R, j] = ae(!1);
|
|
2905
|
+
Ee(() => {
|
|
2906
|
+
if (r)
|
|
2907
|
+
try {
|
|
2908
|
+
const $ = l({ includeStyles: !1, includeMeta: !1 });
|
|
2909
|
+
r(s.content, $, s.title);
|
|
2910
|
+
} catch {
|
|
2911
|
+
const F = `<!DOCTYPE html><html><body>${s.content}</body></html>`;
|
|
2912
|
+
r(s.content, F, s.title);
|
|
2913
|
+
}
|
|
2914
|
+
}, [s.content, s.title, r, l]);
|
|
2915
|
+
const U = P(() => {
|
|
2916
|
+
if (_().success) {
|
|
2917
|
+
const F = l();
|
|
2918
|
+
t?.(s.content, F);
|
|
2919
|
+
} else
|
|
2920
|
+
j(!0), setTimeout(() => j(!1), 3e3);
|
|
2921
|
+
}, [s.content, _, l, t]), S = P(() => {
|
|
2922
|
+
try {
|
|
2923
|
+
const $ = l();
|
|
2924
|
+
n?.($);
|
|
2925
|
+
const F = new Blob([$], { type: "text/html" }), ee = URL.createObjectURL(F), D = document.createElement("a");
|
|
2926
|
+
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);
|
|
2927
|
+
} catch ($) {
|
|
2928
|
+
alert(
|
|
2929
|
+
"Export failed: " + ($ instanceof Error ? $.message : "Unknown error")
|
|
2930
|
+
);
|
|
2931
|
+
}
|
|
2932
|
+
}, [l, s.title, n]), C = P(() => {
|
|
2933
|
+
confirm(
|
|
2934
|
+
"Are you sure you want to clear the editor? All unsaved changes will be lost."
|
|
2935
|
+
) && b();
|
|
2936
|
+
}, [b]), A = P(
|
|
2937
|
+
($) => {
|
|
2938
|
+
d($);
|
|
2939
|
+
},
|
|
2940
|
+
[d]
|
|
2941
|
+
), N = P(
|
|
2942
|
+
($) => {
|
|
2943
|
+
h($);
|
|
2944
|
+
},
|
|
2945
|
+
[h]
|
|
2946
|
+
);
|
|
2947
|
+
return /* @__PURE__ */ p.jsxs("div", { className: "w-full max-w-6xl mx-auto bg-white rounded-xl shadow-lg overflow-hidden", children: [
|
|
2948
|
+
i && /* @__PURE__ */ p.jsxs("div", { className: "p-6 border-b border-gray-200 bg-gray-50", children: [
|
|
2949
|
+
/* @__PURE__ */ p.jsx(
|
|
2950
|
+
"input",
|
|
2951
|
+
{
|
|
2952
|
+
type: "text",
|
|
2953
|
+
className: "w-full bg-transparent text-2xl font-bold text-gray-800 outline-none placeholder-gray-400",
|
|
2954
|
+
value: s.title,
|
|
2955
|
+
onChange: ($) => N($.target.value),
|
|
2956
|
+
placeholder: "Document Title"
|
|
2957
|
+
}
|
|
2958
|
+
),
|
|
2959
|
+
R && /* @__PURE__ */ p.jsx("div", { className: "text-red-600 text-sm mt-2 animate-fadeIn", children: "Please add content before saving" })
|
|
2960
|
+
] }),
|
|
2961
|
+
/* @__PURE__ */ p.jsx(
|
|
2962
|
+
un,
|
|
2963
|
+
{
|
|
2964
|
+
onCommand: v,
|
|
2965
|
+
onSave: U,
|
|
2966
|
+
onExport: S,
|
|
2967
|
+
showButtons: o,
|
|
2968
|
+
onClear: C,
|
|
2969
|
+
hasUnsavedChanges: s.hasUnsavedChanges
|
|
2970
|
+
}
|
|
2971
|
+
),
|
|
2972
|
+
/* @__PURE__ */ p.jsx(
|
|
2973
|
+
"div",
|
|
2974
|
+
{
|
|
2975
|
+
ref: f,
|
|
2976
|
+
className: "editor-content min-h-[500px] p-8 border-none outline-none resize-none text-gray-700 leading-relaxed prose max-w-none",
|
|
2977
|
+
contentEditable: !0,
|
|
2978
|
+
onInput: ($) => A($.currentTarget.innerHTML),
|
|
2979
|
+
onBlur: ($) => A($.currentTarget.innerHTML),
|
|
2980
|
+
suppressContentEditableWarning: !0
|
|
2981
|
+
}
|
|
2982
|
+
),
|
|
2983
|
+
c && /* @__PURE__ */ p.jsx(
|
|
2984
|
+
ln,
|
|
2985
|
+
{
|
|
2986
|
+
wordCount: s.wordCount,
|
|
2987
|
+
characterCount: s.characterCount,
|
|
2988
|
+
hasUnsavedChanges: s.hasUnsavedChanges
|
|
2989
|
+
}
|
|
2990
|
+
)
|
|
2991
|
+
] });
|
|
3277
2992
|
};
|
|
3278
2993
|
export {
|
|
3279
|
-
|
|
3280
|
-
|
|
2994
|
+
Zc as TextEditor,
|
|
2995
|
+
zc as useTextEditor
|
|
3281
2996
|
};
|