@ericbutera/kaleido 0.1.0 → 0.1.8
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/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
|
|
1
|
+
import F, { createContext as dr, useContext as Mt, useEffect as Ie, useState as de, useRef as ur, useMemo as fr } from "react";
|
|
2
|
+
import Lt from "react-hot-toast";
|
|
3
|
+
import { faEnvelope as hr, faRightToBracket as mr, faStore as pr, faSort as gr, faSortUp as vr, faSortDown as yr } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
+
import { FontAwesomeIcon as Le } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { useLocation as it, Link as se, useNavigate as ke, useSearchParams as ot } from "react-router-dom";
|
|
6
|
+
import { useForm as $e } from "react-hook-form";
|
|
7
|
+
var De = { exports: {} }, Se = {};
|
|
8
|
+
var ut;
|
|
9
|
+
function xr() {
|
|
10
|
+
if (ut) return Se;
|
|
11
|
+
ut = 1;
|
|
12
12
|
var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
13
13
|
function t(s, n, a) {
|
|
14
|
-
var
|
|
15
|
-
if (a !== void 0 && (
|
|
14
|
+
var d = null;
|
|
15
|
+
if (a !== void 0 && (d = "" + a), n.key !== void 0 && (d = "" + n.key), "key" in n) {
|
|
16
16
|
a = {};
|
|
17
17
|
for (var u in n)
|
|
18
18
|
u !== "key" && (a[u] = n[u]);
|
|
@@ -20,24 +20,24 @@ function yr() {
|
|
|
20
20
|
return n = a.ref, {
|
|
21
21
|
$$typeof: r,
|
|
22
22
|
type: s,
|
|
23
|
-
key:
|
|
23
|
+
key: d,
|
|
24
24
|
ref: n !== void 0 ? n : null,
|
|
25
25
|
props: a
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return Se.Fragment = e, Se.jsx = t, Se.jsxs = t, Se;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
function
|
|
33
|
-
return
|
|
30
|
+
var Re = {};
|
|
31
|
+
var ft;
|
|
32
|
+
function _r() {
|
|
33
|
+
return ft || (ft = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
34
34
|
function r(m) {
|
|
35
35
|
if (m == null) return null;
|
|
36
36
|
if (typeof m == "function")
|
|
37
|
-
return m.$$typeof ===
|
|
37
|
+
return m.$$typeof === q ? null : m.displayName || m.name || null;
|
|
38
38
|
if (typeof m == "string") return m;
|
|
39
39
|
switch (m) {
|
|
40
|
-
case
|
|
40
|
+
case _:
|
|
41
41
|
return "Fragment";
|
|
42
42
|
case R:
|
|
43
43
|
return "Profiler";
|
|
@@ -47,18 +47,18 @@ function vr() {
|
|
|
47
47
|
return "Suspense";
|
|
48
48
|
case B:
|
|
49
49
|
return "SuspenseList";
|
|
50
|
-
case
|
|
50
|
+
case ce:
|
|
51
51
|
return "Activity";
|
|
52
52
|
}
|
|
53
53
|
if (typeof m == "object")
|
|
54
54
|
switch (typeof m.tag == "number" && console.error(
|
|
55
55
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
56
56
|
), m.$$typeof) {
|
|
57
|
-
case
|
|
57
|
+
case w:
|
|
58
58
|
return "Portal";
|
|
59
59
|
case I:
|
|
60
60
|
return m.displayName || "Context";
|
|
61
|
-
case
|
|
61
|
+
case k:
|
|
62
62
|
return (m._context.displayName || "Context") + ".Consumer";
|
|
63
63
|
case L:
|
|
64
64
|
var E = m.render;
|
|
@@ -95,7 +95,7 @@ function vr() {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
function s(m) {
|
|
98
|
-
if (m ===
|
|
98
|
+
if (m === _) return "<>";
|
|
99
99
|
if (typeof m == "object" && m !== null && m.$$typeof === G)
|
|
100
100
|
return "<...>";
|
|
101
101
|
try {
|
|
@@ -112,8 +112,8 @@ function vr() {
|
|
|
112
112
|
function a() {
|
|
113
113
|
return Error("react-stack-top-frame");
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
115
|
+
function d(m) {
|
|
116
|
+
if (Y.call(m, "key")) {
|
|
117
117
|
var E = Object.getOwnPropertyDescriptor(m, "key").get;
|
|
118
118
|
if (E && E.isReactWarning) return !1;
|
|
119
119
|
}
|
|
@@ -121,7 +121,7 @@ function vr() {
|
|
|
121
121
|
}
|
|
122
122
|
function u(m, E) {
|
|
123
123
|
function $() {
|
|
124
|
-
|
|
124
|
+
je || (je = !0, console.error(
|
|
125
125
|
"%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)",
|
|
126
126
|
E
|
|
127
127
|
));
|
|
@@ -133,19 +133,19 @@ function vr() {
|
|
|
133
133
|
}
|
|
134
134
|
function i() {
|
|
135
135
|
var m = r(this.type);
|
|
136
|
-
return
|
|
136
|
+
return te[m] || (te[m] = !0, console.error(
|
|
137
137
|
"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."
|
|
138
138
|
)), m = this.props.ref, m !== void 0 ? m : null;
|
|
139
139
|
}
|
|
140
|
-
function o(m, E, $, D,
|
|
141
|
-
var
|
|
140
|
+
function o(m, E, $, D, Ze, Qe) {
|
|
141
|
+
var V = $.ref;
|
|
142
142
|
return m = {
|
|
143
|
-
$$typeof:
|
|
143
|
+
$$typeof: v,
|
|
144
144
|
type: m,
|
|
145
145
|
key: E,
|
|
146
146
|
props: $,
|
|
147
147
|
_owner: D
|
|
148
|
-
}, (
|
|
148
|
+
}, (V !== void 0 ? V : null) !== null ? Object.defineProperty(m, "ref", {
|
|
149
149
|
enumerable: !1,
|
|
150
150
|
get: i
|
|
151
151
|
}) : Object.defineProperty(m, "ref", { enumerable: !1, value: null }), m._store = {}, Object.defineProperty(m._store, "validated", {
|
|
@@ -162,33 +162,33 @@ function vr() {
|
|
|
162
162
|
configurable: !1,
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
writable: !0,
|
|
165
|
-
value:
|
|
165
|
+
value: Ze
|
|
166
166
|
}), Object.defineProperty(m, "_debugTask", {
|
|
167
167
|
configurable: !1,
|
|
168
168
|
enumerable: !1,
|
|
169
169
|
writable: !0,
|
|
170
|
-
value:
|
|
170
|
+
value: Qe
|
|
171
171
|
}), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
var
|
|
175
|
-
if (
|
|
173
|
+
function c(m, E, $, D, Ze, Qe) {
|
|
174
|
+
var V = E.children;
|
|
175
|
+
if (V !== void 0)
|
|
176
176
|
if (D)
|
|
177
|
-
if (
|
|
178
|
-
for (D = 0; D <
|
|
179
|
-
f(
|
|
180
|
-
Object.freeze && Object.freeze(
|
|
177
|
+
if (Q(V)) {
|
|
178
|
+
for (D = 0; D < V.length; D++)
|
|
179
|
+
f(V[D]);
|
|
180
|
+
Object.freeze && Object.freeze(V);
|
|
181
181
|
} else
|
|
182
182
|
console.error(
|
|
183
183
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
184
184
|
);
|
|
185
|
-
else f(
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
var
|
|
189
|
-
return
|
|
185
|
+
else f(V);
|
|
186
|
+
if (Y.call(E, "key")) {
|
|
187
|
+
V = r(m);
|
|
188
|
+
var pe = Object.keys(E).filter(function(cr) {
|
|
189
|
+
return cr !== "key";
|
|
190
190
|
});
|
|
191
|
-
D = 0 <
|
|
191
|
+
D = 0 < pe.length ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}", Ce[V + D] || (pe = 0 < pe.length ? "{" + pe.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
192
192
|
`A props object containing a "key" prop is being spread into JSX:
|
|
193
193
|
let props = %s;
|
|
194
194
|
<%s {...props} />
|
|
@@ -196,35 +196,35 @@ React keys must be passed directly to JSX without using spread:
|
|
|
196
196
|
let props = %s;
|
|
197
197
|
<%s key={someKey} {...props} />`,
|
|
198
198
|
D,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
),
|
|
199
|
+
V,
|
|
200
|
+
pe,
|
|
201
|
+
V
|
|
202
|
+
), Ce[V + D] = !0);
|
|
203
203
|
}
|
|
204
|
-
if (
|
|
204
|
+
if (V = null, $ !== void 0 && (t($), V = "" + $), d(E) && (t(E.key), V = "" + E.key), "key" in E) {
|
|
205
205
|
$ = {};
|
|
206
|
-
for (var
|
|
207
|
-
|
|
206
|
+
for (var He in E)
|
|
207
|
+
He !== "key" && ($[He] = E[He]);
|
|
208
208
|
} else $ = E;
|
|
209
|
-
return
|
|
209
|
+
return V && u(
|
|
210
210
|
$,
|
|
211
211
|
typeof m == "function" ? m.displayName || m.name || "Unknown" : m
|
|
212
212
|
), o(
|
|
213
213
|
m,
|
|
214
|
-
|
|
214
|
+
V,
|
|
215
215
|
$,
|
|
216
216
|
n(),
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
Ze,
|
|
218
|
+
Qe
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
function f(m) {
|
|
222
222
|
h(m) ? m._store && (m._store.validated = 1) : typeof m == "object" && m !== null && m.$$typeof === G && (m._payload.status === "fulfilled" ? h(m._payload.value) && m._payload.value._store && (m._payload.value._store.validated = 1) : m._store && (m._store.validated = 1));
|
|
223
223
|
}
|
|
224
224
|
function h(m) {
|
|
225
|
-
return typeof m == "object" && m !== null && m.$$typeof ===
|
|
225
|
+
return typeof m == "object" && m !== null && m.$$typeof === v;
|
|
226
226
|
}
|
|
227
|
-
var p =
|
|
227
|
+
var p = F, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), M = /* @__PURE__ */ Symbol.for("react.strict_mode"), R = /* @__PURE__ */ Symbol.for("react.profiler"), k = /* @__PURE__ */ Symbol.for("react.consumer"), I = /* @__PURE__ */ Symbol.for("react.context"), L = /* @__PURE__ */ Symbol.for("react.forward_ref"), O = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), W = /* @__PURE__ */ Symbol.for("react.memo"), G = /* @__PURE__ */ Symbol.for("react.lazy"), ce = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), P = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, Q = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
228
228
|
return null;
|
|
229
229
|
};
|
|
230
230
|
p = {
|
|
@@ -232,40 +232,40 @@ React keys must be passed directly to JSX without using spread:
|
|
|
232
232
|
return m();
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
|
-
var
|
|
235
|
+
var je, te = {}, Ne = p.react_stack_bottom_frame.bind(
|
|
236
236
|
p,
|
|
237
237
|
a
|
|
238
|
-
)(),
|
|
239
|
-
|
|
238
|
+
)(), Ee = U(s(a)), Ce = {};
|
|
239
|
+
Re.Fragment = _, Re.jsx = function(m, E, $) {
|
|
240
240
|
var D = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
241
|
-
return
|
|
241
|
+
return c(
|
|
242
242
|
m,
|
|
243
243
|
E,
|
|
244
244
|
$,
|
|
245
245
|
!1,
|
|
246
|
-
D ? Error("react-stack-top-frame") :
|
|
247
|
-
D ?
|
|
246
|
+
D ? Error("react-stack-top-frame") : Ne,
|
|
247
|
+
D ? U(s(m)) : Ee
|
|
248
248
|
);
|
|
249
|
-
},
|
|
249
|
+
}, Re.jsxs = function(m, E, $) {
|
|
250
250
|
var D = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
251
|
-
return
|
|
251
|
+
return c(
|
|
252
252
|
m,
|
|
253
253
|
E,
|
|
254
254
|
$,
|
|
255
255
|
!0,
|
|
256
|
-
D ? Error("react-stack-top-frame") :
|
|
257
|
-
D ?
|
|
256
|
+
D ? Error("react-stack-top-frame") : Ne,
|
|
257
|
+
D ? U(s(m)) : Ee
|
|
258
258
|
);
|
|
259
259
|
};
|
|
260
|
-
})()),
|
|
260
|
+
})()), Re;
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
function
|
|
264
|
-
return
|
|
262
|
+
var ht;
|
|
263
|
+
function br() {
|
|
264
|
+
return ht || (ht = 1, process.env.NODE_ENV === "production" ? De.exports = xr() : De.exports = _r()), De.exports;
|
|
265
265
|
}
|
|
266
|
-
var
|
|
267
|
-
const
|
|
268
|
-
function
|
|
266
|
+
var l = br();
|
|
267
|
+
const lt = dr(null);
|
|
268
|
+
function wr({
|
|
269
269
|
client: r,
|
|
270
270
|
config: e = {},
|
|
271
271
|
children: t
|
|
@@ -275,127 +275,145 @@ function xr({
|
|
|
275
275
|
registrationEnabled: !0,
|
|
276
276
|
OAuthButton: void 0
|
|
277
277
|
}, ...e };
|
|
278
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ l.jsx(lt.Provider, { value: { client: r, config: n }, children: t });
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
const r =
|
|
280
|
+
function oe() {
|
|
281
|
+
const r = Mt(lt);
|
|
282
282
|
if (!r)
|
|
283
283
|
throw new Error(
|
|
284
284
|
"useAuthApi must be used within AuthProvider. Wrap your app with <AuthProvider client={yourApiClient}>"
|
|
285
285
|
);
|
|
286
286
|
return r.client;
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
const r =
|
|
288
|
+
function $t() {
|
|
289
|
+
const r = Mt(lt);
|
|
290
290
|
if (!r)
|
|
291
291
|
throw new Error(
|
|
292
292
|
"useAuthConfig must be used within AuthProvider. Wrap your app with <AuthProvider client={yourApiClient}>"
|
|
293
293
|
);
|
|
294
294
|
return r.config;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function ct(r, e, t = "An error occurred", s = !0) {
|
|
297
297
|
const n = r;
|
|
298
|
-
if (n?.errors && Object.entries(n.errors).forEach(([a,
|
|
298
|
+
if (n?.errors && Object.entries(n.errors).forEach(([a, d]) => {
|
|
299
299
|
e(a, {
|
|
300
300
|
type: "server",
|
|
301
|
-
message:
|
|
301
|
+
message: d[0]
|
|
302
302
|
});
|
|
303
303
|
}), s) {
|
|
304
304
|
const a = n?.message || t;
|
|
305
|
-
|
|
305
|
+
Lt.error(a);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function Zt(r, e, t = "/") {
|
|
309
309
|
const s = new URLSearchParams(e.search), n = s.get("origin") || s.get("redirect");
|
|
310
310
|
r(n || t, { replace: !0 });
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return /* @__PURE__ */
|
|
312
|
+
function le({ children: r }) {
|
|
313
|
+
return /* @__PURE__ */ l.jsx("div", { className: "min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/10 to-secondary/10", children: /* @__PURE__ */ l.jsx("div", { className: "card bg-base-100 shadow-soft hover:shadow-medium transition-shadow border border-base-300 w-full max-w-md mx-4", children: /* @__PURE__ */ l.jsx("div", { className: "card-body p-8", children: r }) }) });
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
315
|
+
function kr() {
|
|
316
|
+
const e = it().state.email;
|
|
317
|
+
return /* @__PURE__ */ l.jsxs(le, { children: [
|
|
318
|
+
/* @__PURE__ */ l.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
319
|
+
/* @__PURE__ */ l.jsx(Le, { icon: hr }),
|
|
320
|
+
"Check Your Email"
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ l.jsxs("div", { className: "mt-4 text-sm text-center", children: [
|
|
323
|
+
/* @__PURE__ */ l.jsxs("p", { children: [
|
|
324
|
+
"We've sent a confirmation link to ",
|
|
325
|
+
/* @__PURE__ */ l.jsx("strong", { children: e }),
|
|
326
|
+
"."
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ l.jsx("p", { className: "mt-2", children: "Click the link in the email to activate your account." })
|
|
329
|
+
] }),
|
|
330
|
+
/* @__PURE__ */ l.jsx("div", { className: "divider" }),
|
|
331
|
+
/* @__PURE__ */ l.jsxs("div", { className: "join w-full justify-center", children: [
|
|
332
|
+
/* @__PURE__ */ l.jsx(
|
|
333
|
+
se,
|
|
334
|
+
{
|
|
335
|
+
to: "/resend-confirmation",
|
|
336
|
+
state: { email: e },
|
|
337
|
+
className: "btn join-item",
|
|
338
|
+
title: "Didn't receive the email?",
|
|
339
|
+
children: "Resend Confirmation"
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ l.jsx(se, { to: "/", className: "btn join-item", children: "Home" })
|
|
343
|
+
] })
|
|
326
344
|
] });
|
|
327
345
|
}
|
|
328
|
-
function
|
|
329
|
-
const { register: r, handleSubmit: e } =
|
|
346
|
+
function jr() {
|
|
347
|
+
const { register: r, handleSubmit: e } = $e({
|
|
330
348
|
defaultValues: { email: "" }
|
|
331
|
-
}), { useForgotPassword: t } =
|
|
349
|
+
}), { useForgotPassword: t } = oe(), s = t(), n = async (a) => {
|
|
332
350
|
try {
|
|
333
351
|
await s.mutateAsync(a.email);
|
|
334
352
|
} catch {
|
|
335
353
|
}
|
|
336
354
|
};
|
|
337
|
-
return /* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ l.jsxs(le, { children: [
|
|
356
|
+
/* @__PURE__ */ l.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Forgot Password" }),
|
|
357
|
+
/* @__PURE__ */ l.jsxs("form", { onSubmit: e(n), children: [
|
|
358
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", children: "Email" }),
|
|
359
|
+
/* @__PURE__ */ l.jsx(
|
|
342
360
|
"input",
|
|
343
361
|
{
|
|
344
362
|
className: "input input-bordered w-full",
|
|
345
363
|
...r("email", { required: !0 })
|
|
346
364
|
}
|
|
347
365
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ l.jsx("button", { className: "btn btn-primary mt-4", children: "Send Reset" })
|
|
349
367
|
] })
|
|
350
368
|
] });
|
|
351
369
|
}
|
|
352
|
-
function
|
|
370
|
+
function Nr() {
|
|
353
371
|
const {
|
|
354
372
|
register: r,
|
|
355
373
|
handleSubmit: e,
|
|
356
374
|
setError: t,
|
|
357
375
|
formState: { errors: s, isSubmitting: n }
|
|
358
|
-
} =
|
|
376
|
+
} = $e({
|
|
359
377
|
defaultValues: { email: "", password: "" }
|
|
360
|
-
}), a =
|
|
361
|
-
|
|
362
|
-
p &&
|
|
363
|
-
}, [p, a,
|
|
364
|
-
const
|
|
378
|
+
}), a = ke(), d = it(), { useLoginUser: u, useCurrentUser: i } = oe(), { oauthEnabled: o, registrationEnabled: c, OAuthButton: f } = $t(), h = u(), { user: p } = i();
|
|
379
|
+
Ie(() => {
|
|
380
|
+
p && Zt(a, d);
|
|
381
|
+
}, [p, a, d]);
|
|
382
|
+
const v = async (w) => {
|
|
365
383
|
try {
|
|
366
|
-
await h.mutateAsync(
|
|
367
|
-
} catch (
|
|
368
|
-
const M =
|
|
384
|
+
await h.mutateAsync(w, t), a("/");
|
|
385
|
+
} catch (_) {
|
|
386
|
+
const M = _?.response?.status;
|
|
369
387
|
if (M == 401)
|
|
370
388
|
t("root", {
|
|
371
389
|
type: "server",
|
|
372
390
|
message: "Invalid email or password"
|
|
373
391
|
});
|
|
374
392
|
else if (M == 422) {
|
|
375
|
-
const R =
|
|
376
|
-
t("root", { type: "server", message:
|
|
393
|
+
const R = _?.response?.data, k = R && (R.error || R.message) || "Too many login attempts. Please try again later.";
|
|
394
|
+
t("root", { type: "server", message: k });
|
|
377
395
|
} else {
|
|
378
|
-
const R =
|
|
379
|
-
|
|
396
|
+
const R = _?.response?.data ?? _;
|
|
397
|
+
ct(R, t, "Failed to sign in");
|
|
380
398
|
}
|
|
381
399
|
}
|
|
382
400
|
};
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
401
|
+
return /* @__PURE__ */ l.jsxs(le, { children: [
|
|
402
|
+
/* @__PURE__ */ l.jsxs("div", { className: "text-center mb-6", children: [
|
|
403
|
+
/* @__PURE__ */ l.jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 bg-primary/10 rounded-full mb-4", children: /* @__PURE__ */ l.jsx(
|
|
404
|
+
Le,
|
|
387
405
|
{
|
|
388
|
-
icon:
|
|
406
|
+
icon: mr,
|
|
389
407
|
className: "text-3xl text-primary"
|
|
390
408
|
}
|
|
391
409
|
) }),
|
|
392
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ l.jsx("h2", { className: "text-3xl font-bold mb-2", children: "Welcome Back" })
|
|
393
411
|
] }),
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
s.root && /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ l.jsxs("form", { onSubmit: e(v), children: [
|
|
413
|
+
s.root && /* @__PURE__ */ l.jsx("div", { className: "alert alert-error alert-soft mb-4", children: /* @__PURE__ */ l.jsx("span", { children: s.root.message }) }),
|
|
414
|
+
/* @__PURE__ */ l.jsxs("fieldset", { className: "fieldset", children: [
|
|
415
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", htmlFor: "login-email", children: /* @__PURE__ */ l.jsx("span", { className: "label-text", children: "Email" }) }),
|
|
416
|
+
/* @__PURE__ */ l.jsx(
|
|
399
417
|
"input",
|
|
400
418
|
{
|
|
401
419
|
id: "login-email",
|
|
@@ -405,9 +423,9 @@ function kr() {
|
|
|
405
423
|
...r("email", { required: "Email is required" })
|
|
406
424
|
}
|
|
407
425
|
),
|
|
408
|
-
s.email && /* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
/* @__PURE__ */
|
|
426
|
+
s.email && /* @__PURE__ */ l.jsx("span", { className: "text-error text-sm", children: s.email.message }),
|
|
427
|
+
/* @__PURE__ */ l.jsx("label", { className: "label mt-4", htmlFor: "login-password", children: /* @__PURE__ */ l.jsx("span", { className: "label-text", children: "Password" }) }),
|
|
428
|
+
/* @__PURE__ */ l.jsx(
|
|
411
429
|
"input",
|
|
412
430
|
{
|
|
413
431
|
id: "login-password",
|
|
@@ -418,8 +436,8 @@ function kr() {
|
|
|
418
436
|
...r("password", { required: "Password is required" })
|
|
419
437
|
}
|
|
420
438
|
),
|
|
421
|
-
s.password && /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
439
|
+
s.password && /* @__PURE__ */ l.jsx("span", { className: "text-error text-sm", children: s.password.message }),
|
|
440
|
+
/* @__PURE__ */ l.jsx(
|
|
423
441
|
"button",
|
|
424
442
|
{
|
|
425
443
|
type: "submit",
|
|
@@ -430,168 +448,285 @@ function kr() {
|
|
|
430
448
|
)
|
|
431
449
|
] })
|
|
432
450
|
] }),
|
|
433
|
-
o && f && /* @__PURE__ */
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
|
|
451
|
+
o && f && /* @__PURE__ */ l.jsx(f, { text: "Sign in with Google" }),
|
|
452
|
+
/* @__PURE__ */ l.jsx("div", { className: "divider" }),
|
|
453
|
+
/* @__PURE__ */ l.jsxs("div", { className: "join w-full justify-center", children: [
|
|
454
|
+
/* @__PURE__ */ l.jsx(se, { className: "btn join-item", to: "/", children: "Home" }),
|
|
455
|
+
/* @__PURE__ */ l.jsx(
|
|
456
|
+
se,
|
|
439
457
|
{
|
|
440
458
|
className: "btn join-item",
|
|
441
459
|
to: "/signup",
|
|
442
|
-
hidden: !
|
|
460
|
+
hidden: !c,
|
|
443
461
|
children: "Create Account"
|
|
444
462
|
}
|
|
445
463
|
),
|
|
446
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ l.jsx(se, { className: "btn join-item", to: "/forgot-password", children: "Forgot password" })
|
|
447
465
|
] })
|
|
448
466
|
] });
|
|
449
467
|
}
|
|
450
|
-
function
|
|
451
|
-
const r =
|
|
452
|
-
return
|
|
468
|
+
function Er() {
|
|
469
|
+
const r = ke(), { useTokenRefresh: e } = oe(), t = e?.();
|
|
470
|
+
return Ie(() => {
|
|
453
471
|
t?.mutateAsync?.().finally(() => r("/"));
|
|
454
|
-
}, [r, t]), /* @__PURE__ */
|
|
472
|
+
}, [r, t]), /* @__PURE__ */ l.jsx("div", { children: "Processing OAuth callback..." });
|
|
455
473
|
}
|
|
456
|
-
function
|
|
457
|
-
const { register:
|
|
458
|
-
defaultValues: { email: "" }
|
|
459
|
-
}), { useResendConfirmationEmail:
|
|
474
|
+
function Cr() {
|
|
475
|
+
const e = it().state?.email, { register: t, handleSubmit: s } = $e({
|
|
476
|
+
defaultValues: { email: e ?? "" }
|
|
477
|
+
}), { useResendConfirmationEmail: n } = oe(), a = n(), d = ke(), u = async (i) => {
|
|
460
478
|
try {
|
|
461
|
-
await
|
|
479
|
+
await a.mutateAsync(i), d("/confirm-email", { state: { email: i.email } });
|
|
462
480
|
} catch {
|
|
463
481
|
}
|
|
464
482
|
};
|
|
465
|
-
return /* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
/* @__PURE__ */
|
|
483
|
+
return /* @__PURE__ */ l.jsxs(le, { children: [
|
|
484
|
+
/* @__PURE__ */ l.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Resend Confirmation" }),
|
|
485
|
+
/* @__PURE__ */ l.jsxs("form", { onSubmit: s(u), children: [
|
|
486
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", children: "Email" }),
|
|
487
|
+
/* @__PURE__ */ l.jsx(
|
|
470
488
|
"input",
|
|
471
489
|
{
|
|
490
|
+
type: "email",
|
|
472
491
|
className: "input input-bordered w-full",
|
|
473
|
-
...
|
|
492
|
+
...t("email", { required: !0 })
|
|
474
493
|
}
|
|
475
494
|
),
|
|
476
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ l.jsx("button", { className: "btn btn-primary mt-4", children: "Resend" })
|
|
477
496
|
] })
|
|
478
497
|
] });
|
|
479
498
|
}
|
|
480
|
-
function
|
|
481
|
-
const { register: r, handleSubmit: e } =
|
|
499
|
+
function Sr() {
|
|
500
|
+
const { register: r, handleSubmit: e } = $e({ defaultValues: { token: "", password: "" } }), { useResetPassword: t } = oe(), s = t(), n = ke(), [a] = ot(), d = a.get("token") || void 0, u = async (i) => {
|
|
482
501
|
try {
|
|
483
502
|
await s.mutateAsync(i), n("/");
|
|
484
503
|
} catch {
|
|
485
504
|
}
|
|
486
505
|
};
|
|
487
|
-
return /* @__PURE__ */
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ l.jsxs(le, { children: [
|
|
507
|
+
/* @__PURE__ */ l.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Reset Password" }),
|
|
508
|
+
/* @__PURE__ */ l.jsxs("form", { onSubmit: e(u), children: [
|
|
509
|
+
/* @__PURE__ */ l.jsx(
|
|
491
510
|
"input",
|
|
492
511
|
{
|
|
493
512
|
type: "hidden",
|
|
494
513
|
...r("token"),
|
|
495
|
-
defaultValue:
|
|
514
|
+
defaultValue: d
|
|
496
515
|
}
|
|
497
516
|
),
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", children: "New password" }),
|
|
518
|
+
/* @__PURE__ */ l.jsx(
|
|
500
519
|
"input",
|
|
501
520
|
{
|
|
502
521
|
className: "input input-bordered w-full",
|
|
503
522
|
...r("password", { required: !0 })
|
|
504
523
|
}
|
|
505
524
|
),
|
|
506
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ l.jsx("button", { className: "btn btn-primary mt-4", children: "Reset" })
|
|
507
526
|
] })
|
|
508
527
|
] });
|
|
509
528
|
}
|
|
510
|
-
function
|
|
511
|
-
const {
|
|
529
|
+
function Rr({ redirectUrl: r = "" }) {
|
|
530
|
+
const {
|
|
531
|
+
register: e,
|
|
532
|
+
handleSubmit: t,
|
|
533
|
+
setError: s,
|
|
534
|
+
watch: n,
|
|
535
|
+
formState: { errors: a, isSubmitting: d }
|
|
536
|
+
} = $e({
|
|
537
|
+
defaultValues: { name: "", email: "", password: "", confirmPassword: "" }
|
|
538
|
+
}), u = ke(), i = !1, { useRegisterUser: o } = oe(), c = o(), [f, h] = de(null), p = async (v) => {
|
|
539
|
+
if (h(null), v.password !== v.confirmPassword) {
|
|
540
|
+
s("confirmPassword", {
|
|
541
|
+
type: "manual",
|
|
542
|
+
message: "Passwords do not match"
|
|
543
|
+
});
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
512
546
|
try {
|
|
513
|
-
await
|
|
514
|
-
} catch (
|
|
515
|
-
|
|
516
|
-
i?.response?.data ?? i,
|
|
517
|
-
t,
|
|
518
|
-
"Failed to register"
|
|
519
|
-
);
|
|
547
|
+
await c.mutateAsync(v, s), u("/confirm-email", { state: { email: v.email } });
|
|
548
|
+
} catch (w) {
|
|
549
|
+
ct(w, s, "Failed to register account", !1);
|
|
520
550
|
}
|
|
521
551
|
};
|
|
522
|
-
return /* @__PURE__ */
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
552
|
+
return /* @__PURE__ */ l.jsxs(le, { children: [
|
|
553
|
+
/* @__PURE__ */ l.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
554
|
+
/* @__PURE__ */ l.jsx(Le, { icon: pr, className: "text-primary mr-2" }),
|
|
555
|
+
"Sign Up"
|
|
556
|
+
] }),
|
|
557
|
+
f && /* @__PURE__ */ l.jsx("div", { role: "alert", className: "alert alert-warning alert-soft mb-4", children: /* @__PURE__ */ l.jsx("span", { children: f }) }),
|
|
558
|
+
/* @__PURE__ */ l.jsx("form", { onSubmit: t(p), children: /* @__PURE__ */ l.jsxs("fieldset", { className: "fieldset", children: [
|
|
559
|
+
/* @__PURE__ */ l.jsx("legend", { className: "fieldset-legend", children: "Account Details" }),
|
|
560
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", htmlFor: "signup-name", children: /* @__PURE__ */ l.jsx("span", { className: "label-text", children: "Name" }) }),
|
|
561
|
+
/* @__PURE__ */ l.jsx(
|
|
529
562
|
"input",
|
|
530
563
|
{
|
|
531
|
-
|
|
532
|
-
|
|
564
|
+
id: "signup-name",
|
|
565
|
+
type: "text",
|
|
566
|
+
placeholder: "Your Name",
|
|
567
|
+
className: `input input-bordered w-full ${a.name ? "input-error" : ""}`,
|
|
568
|
+
...e("name", {
|
|
569
|
+
required: "Name is required",
|
|
570
|
+
minLength: {
|
|
571
|
+
value: 2,
|
|
572
|
+
message: "Name must be at least 2 characters"
|
|
573
|
+
}
|
|
574
|
+
})
|
|
533
575
|
}
|
|
534
576
|
),
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */
|
|
577
|
+
a.name && /* @__PURE__ */ l.jsx("span", { className: "text-error text-sm", children: a.name.message }),
|
|
578
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", htmlFor: "signup-email", children: /* @__PURE__ */ l.jsx("span", { className: "label-text", children: "Email" }) }),
|
|
579
|
+
/* @__PURE__ */ l.jsx(
|
|
537
580
|
"input",
|
|
538
581
|
{
|
|
539
|
-
|
|
540
|
-
|
|
582
|
+
id: "signup-email",
|
|
583
|
+
type: "email",
|
|
584
|
+
placeholder: "email@example.com",
|
|
585
|
+
className: `input input-bordered w-full ${a.email ? "input-error" : ""}`,
|
|
586
|
+
...e("email", {
|
|
587
|
+
required: "Email is required",
|
|
588
|
+
pattern: {
|
|
589
|
+
value: /^[^@\s]+@[^@\s]+\.[^@\s]+$/,
|
|
590
|
+
message: "Invalid email address"
|
|
591
|
+
}
|
|
592
|
+
})
|
|
593
|
+
}
|
|
594
|
+
),
|
|
595
|
+
a.email && /* @__PURE__ */ l.jsx("span", { className: "text-error text-sm", children: a.email.message }),
|
|
596
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", htmlFor: "signup-password", children: /* @__PURE__ */ l.jsx("span", { className: "label-text", children: "Password" }) }),
|
|
597
|
+
/* @__PURE__ */ l.jsx(
|
|
598
|
+
"input",
|
|
599
|
+
{
|
|
600
|
+
id: "signup-password",
|
|
601
|
+
type: "password",
|
|
602
|
+
placeholder: "••••••••",
|
|
603
|
+
className: `input input-bordered w-full ${a.password ? "input-error" : ""}`,
|
|
604
|
+
...e("password", {
|
|
605
|
+
required: "Password is required",
|
|
606
|
+
minLength: {
|
|
607
|
+
value: 6,
|
|
608
|
+
message: "Password must be at least 6 characters"
|
|
609
|
+
}
|
|
610
|
+
})
|
|
611
|
+
}
|
|
612
|
+
),
|
|
613
|
+
a.password && /* @__PURE__ */ l.jsx("span", { className: "text-error text-sm", children: a.password.message }),
|
|
614
|
+
/* @__PURE__ */ l.jsx("label", { className: "label", htmlFor: "signup-confirm", children: /* @__PURE__ */ l.jsx("span", { className: "label-text", children: "Confirm Password" }) }),
|
|
615
|
+
/* @__PURE__ */ l.jsx(
|
|
616
|
+
"input",
|
|
617
|
+
{
|
|
618
|
+
id: "signup-confirm",
|
|
619
|
+
type: "password",
|
|
620
|
+
placeholder: "Confirm password",
|
|
621
|
+
className: `input input-bordered w-full ${a.confirmPassword ? "input-error" : ""}`,
|
|
622
|
+
...e("confirmPassword", {
|
|
623
|
+
required: "Please confirm password",
|
|
624
|
+
validate: (v) => v === n("password") || "Passwords do not match"
|
|
625
|
+
})
|
|
541
626
|
}
|
|
542
627
|
),
|
|
543
|
-
/* @__PURE__ */
|
|
628
|
+
a.confirmPassword && /* @__PURE__ */ l.jsx("span", { className: "text-error text-sm", children: a.confirmPassword.message }),
|
|
629
|
+
/* @__PURE__ */ l.jsx(
|
|
630
|
+
"button",
|
|
631
|
+
{
|
|
632
|
+
type: "submit",
|
|
633
|
+
className: "btn btn-primary w-full mt-4",
|
|
634
|
+
disabled: d || !1,
|
|
635
|
+
children: d ? "Creating Account…" : "Sign Up"
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
] }) }),
|
|
639
|
+
i,
|
|
640
|
+
!1,
|
|
641
|
+
/* @__PURE__ */ l.jsx("div", { className: "divider" }),
|
|
642
|
+
/* @__PURE__ */ l.jsxs("div", { className: "join w-full justify-center", children: [
|
|
643
|
+
/* @__PURE__ */ l.jsx(se, { className: "btn join-item", to: "/", children: "Home" }),
|
|
644
|
+
/* @__PURE__ */ l.jsx(se, { to: "/login", className: "btn join-item", children: "Login" }),
|
|
645
|
+
/* @__PURE__ */ l.jsx(se, { to: "/forgot-password", className: "btn join-item", children: "Forgot Password" })
|
|
544
646
|
] })
|
|
545
647
|
] });
|
|
546
648
|
}
|
|
547
|
-
function
|
|
548
|
-
const r =
|
|
649
|
+
function Ar() {
|
|
650
|
+
const r = ke(), [e] = ot(), [t, s] = de(!1), [n, a] = de(null), [d, u] = de(!1), { useVerifyEmail: i } = oe(), o = i(), c = e.get("token"), f = async () => {
|
|
651
|
+
if (!c) {
|
|
652
|
+
a("No token provided.");
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
s(!0);
|
|
549
656
|
try {
|
|
550
|
-
|
|
551
|
-
} catch {
|
|
657
|
+
await o.mutateAsync(c), Lt.success("Email verified! You can now log in."), r("/login");
|
|
658
|
+
} catch (h) {
|
|
659
|
+
const p = h?.response?.data, v = p?.error || p?.message || h?.message || "Verification failed.", w = String(v).toLowerCase();
|
|
660
|
+
(w.includes("invalid") || w.includes("expired")) && u(!0), a(String(v));
|
|
661
|
+
} finally {
|
|
662
|
+
s(!1);
|
|
552
663
|
}
|
|
553
664
|
};
|
|
554
|
-
return
|
|
555
|
-
|
|
556
|
-
|
|
665
|
+
return Ie(() => {
|
|
666
|
+
c && f();
|
|
667
|
+
}, [c]), /* @__PURE__ */ l.jsxs(le, { children: [
|
|
668
|
+
/* @__PURE__ */ l.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Verify Email" }),
|
|
669
|
+
/* @__PURE__ */ l.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
670
|
+
/* @__PURE__ */ l.jsx(
|
|
671
|
+
"button",
|
|
672
|
+
{
|
|
673
|
+
className: "btn btn-primary",
|
|
674
|
+
onClick: f,
|
|
675
|
+
disabled: t || d,
|
|
676
|
+
children: t ? "Verifying…" : "Verify"
|
|
677
|
+
}
|
|
678
|
+
),
|
|
679
|
+
n && /* @__PURE__ */ l.jsx("div", { className: "text-sm text-center text-error mt-2", children: n }),
|
|
680
|
+
d && /* @__PURE__ */ l.jsxs("div", { className: "mt-2 flex flex-col items-center gap-2", children: [
|
|
681
|
+
/* @__PURE__ */ l.jsx("p", { className: "text-sm mb-2", children: "Token is invalid or expired. Request a new confirmation email." }),
|
|
682
|
+
/* @__PURE__ */ l.jsx(
|
|
683
|
+
"button",
|
|
684
|
+
{
|
|
685
|
+
className: "btn btn-secondary",
|
|
686
|
+
onClick: () => r("/resend-confirmation"),
|
|
687
|
+
children: "Resend Confirmation"
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
] })
|
|
691
|
+
] })
|
|
557
692
|
] });
|
|
558
693
|
}
|
|
559
|
-
const
|
|
694
|
+
const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
560
695
|
__proto__: null,
|
|
561
|
-
AuthLayout:
|
|
562
|
-
AuthProvider:
|
|
563
|
-
ConfirmEmail:
|
|
564
|
-
ForgotPassword:
|
|
565
|
-
Login:
|
|
566
|
-
OAuthCallback:
|
|
567
|
-
ResendConfirmation:
|
|
568
|
-
Reset:
|
|
569
|
-
SignUp:
|
|
570
|
-
Verify:
|
|
571
|
-
handleFormError:
|
|
572
|
-
redirectToOrigin:
|
|
573
|
-
useAuthApi:
|
|
574
|
-
useAuthConfig:
|
|
696
|
+
AuthLayout: le,
|
|
697
|
+
AuthProvider: wr,
|
|
698
|
+
ConfirmEmail: kr,
|
|
699
|
+
ForgotPassword: jr,
|
|
700
|
+
Login: Nr,
|
|
701
|
+
OAuthCallback: Er,
|
|
702
|
+
ResendConfirmation: Cr,
|
|
703
|
+
Reset: Sr,
|
|
704
|
+
SignUp: Rr,
|
|
705
|
+
Verify: Ar,
|
|
706
|
+
handleFormError: ct,
|
|
707
|
+
redirectToOrigin: Zt,
|
|
708
|
+
useAuthApi: oe,
|
|
709
|
+
useAuthConfig: $t
|
|
575
710
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
576
|
-
function
|
|
711
|
+
function Dt({
|
|
577
712
|
title: r,
|
|
578
713
|
children: e
|
|
579
714
|
}) {
|
|
580
|
-
return /* @__PURE__ */
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ l.jsxs("div", { className: "p-6", children: [
|
|
716
|
+
/* @__PURE__ */ l.jsx("div", { className: "mb-6", children: /* @__PURE__ */ l.jsx("div", { className: "text-2xl font-bold", children: r }) }),
|
|
717
|
+
/* @__PURE__ */ l.jsx("div", { children: e })
|
|
583
718
|
] });
|
|
584
719
|
}
|
|
585
|
-
function
|
|
720
|
+
function Tr({
|
|
586
721
|
icon: r,
|
|
587
722
|
title: e,
|
|
588
723
|
message: t,
|
|
589
724
|
action: s
|
|
590
725
|
}) {
|
|
591
|
-
return /* @__PURE__ */
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
r && /* @__PURE__ */
|
|
594
|
-
|
|
726
|
+
return /* @__PURE__ */ l.jsx("div", { className: "min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/10 to-secondary/10", children: /* @__PURE__ */ l.jsx("div", { className: "card bg-base-100 shadow-soft hover:shadow-medium transition-shadow border border-base-300 w-full max-w-md mx-4", children: /* @__PURE__ */ l.jsxs("div", { className: "card-body p-8", children: [
|
|
727
|
+
/* @__PURE__ */ l.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
728
|
+
r && /* @__PURE__ */ l.jsx(
|
|
729
|
+
Le,
|
|
595
730
|
{
|
|
596
731
|
icon: r,
|
|
597
732
|
className: "text-neutral-content-300 mb-4"
|
|
@@ -599,48 +734,48 @@ function Rr({
|
|
|
599
734
|
),
|
|
600
735
|
e
|
|
601
736
|
] }),
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
s && /* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ l.jsx("div", { className: "mt-4 text-sm text-center", children: t }),
|
|
738
|
+
s && /* @__PURE__ */ l.jsx("div", { children: s })
|
|
604
739
|
] }) }) });
|
|
605
740
|
}
|
|
606
|
-
function
|
|
741
|
+
function Or({
|
|
607
742
|
isOpen: r,
|
|
608
743
|
title: e,
|
|
609
744
|
handleSubmit: t,
|
|
610
745
|
isSubmitting: s,
|
|
611
746
|
isSaving: n = !1,
|
|
612
747
|
uploadProgress: a,
|
|
613
|
-
onSave:
|
|
748
|
+
onSave: d,
|
|
614
749
|
onClose: u,
|
|
615
750
|
onCancel: i,
|
|
616
751
|
children: o,
|
|
617
|
-
maxWidth:
|
|
752
|
+
maxWidth: c = "2xl",
|
|
618
753
|
submitLabel: f = "Save",
|
|
619
754
|
cancelLabel: h = "Cancel"
|
|
620
755
|
}) {
|
|
621
756
|
if (!r) return null;
|
|
622
|
-
const p = s || n,
|
|
757
|
+
const p = s || n, v = () => {
|
|
623
758
|
p || (i && i(), u());
|
|
624
|
-
},
|
|
625
|
-
return /* @__PURE__ */
|
|
759
|
+
}, w = `max-w-${c}`;
|
|
760
|
+
return /* @__PURE__ */ l.jsx("div", { className: "modal modal-open", onClick: v, children: /* @__PURE__ */ l.jsxs(
|
|
626
761
|
"div",
|
|
627
762
|
{
|
|
628
|
-
className: `modal-box ${
|
|
629
|
-
onClick: (
|
|
763
|
+
className: `modal-box ${w}`,
|
|
764
|
+
onClick: (_) => _.stopPropagation(),
|
|
630
765
|
children: [
|
|
631
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ l.jsxs("h3", { className: "font-bold text-lg mb-4", children: [
|
|
632
767
|
e,
|
|
633
|
-
p && /* @__PURE__ */
|
|
768
|
+
p && /* @__PURE__ */ l.jsx("span", { className: "loading loading-spinner loading-xs ml-2" })
|
|
634
769
|
] }),
|
|
635
|
-
a !== void 0 && a > 0 && a < 100 && /* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
770
|
+
a !== void 0 && a > 0 && a < 100 && /* @__PURE__ */ l.jsxs("div", { className: "mb-4", children: [
|
|
771
|
+
/* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
772
|
+
/* @__PURE__ */ l.jsx("span", { className: "text-sm", children: "Uploading..." }),
|
|
773
|
+
/* @__PURE__ */ l.jsxs("span", { className: "text-sm font-semibold", children: [
|
|
639
774
|
a,
|
|
640
775
|
"%"
|
|
641
776
|
] })
|
|
642
777
|
] }),
|
|
643
|
-
/* @__PURE__ */
|
|
778
|
+
/* @__PURE__ */ l.jsx(
|
|
644
779
|
"progress",
|
|
645
780
|
{
|
|
646
781
|
className: "progress progress-primary w-full",
|
|
@@ -649,27 +784,27 @@ function Ar({
|
|
|
649
784
|
}
|
|
650
785
|
)
|
|
651
786
|
] }),
|
|
652
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ l.jsxs("form", { onSubmit: t((_) => d(_, { onClose: u })), children: [
|
|
653
788
|
o,
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ l.jsxs("div", { className: "modal-action", children: [
|
|
790
|
+
/* @__PURE__ */ l.jsx(
|
|
656
791
|
"button",
|
|
657
792
|
{
|
|
658
793
|
type: "button",
|
|
659
794
|
className: "btn btn-ghost",
|
|
660
|
-
onClick:
|
|
795
|
+
onClick: v,
|
|
661
796
|
disabled: p,
|
|
662
797
|
children: h
|
|
663
798
|
}
|
|
664
799
|
),
|
|
665
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ l.jsxs(
|
|
666
801
|
"button",
|
|
667
802
|
{
|
|
668
803
|
type: "submit",
|
|
669
804
|
className: "btn btn-primary",
|
|
670
805
|
disabled: p,
|
|
671
806
|
children: [
|
|
672
|
-
p && /* @__PURE__ */
|
|
807
|
+
p && /* @__PURE__ */ l.jsx("span", { className: "loading loading-spinner loading-xs" }),
|
|
673
808
|
f
|
|
674
809
|
]
|
|
675
810
|
}
|
|
@@ -680,133 +815,133 @@ function Ar({
|
|
|
680
815
|
}
|
|
681
816
|
) });
|
|
682
817
|
}
|
|
683
|
-
var
|
|
684
|
-
function
|
|
685
|
-
var e =
|
|
818
|
+
var Pr = typeof global == "object" && global && global.Object === Object && global, Ir = typeof self == "object" && self && self.Object === Object && self, Ft = Pr || Ir || Function("return this")(), ze = Ft.Symbol, zt = Object.prototype, Mr = zt.hasOwnProperty, Lr = zt.toString, Ae = ze ? ze.toStringTag : void 0;
|
|
819
|
+
function $r(r) {
|
|
820
|
+
var e = Mr.call(r, Ae), t = r[Ae];
|
|
686
821
|
try {
|
|
687
|
-
r[
|
|
822
|
+
r[Ae] = void 0;
|
|
688
823
|
var s = !0;
|
|
689
824
|
} catch {
|
|
690
825
|
}
|
|
691
|
-
var n =
|
|
692
|
-
return s && (e ? r[
|
|
693
|
-
}
|
|
694
|
-
var Lr = Object.prototype, $r = Lr.toString;
|
|
695
|
-
function Zr(r) {
|
|
696
|
-
return $r.call(r);
|
|
826
|
+
var n = Lr.call(r);
|
|
827
|
+
return s && (e ? r[Ae] = t : delete r[Ae]), n;
|
|
697
828
|
}
|
|
698
|
-
var
|
|
829
|
+
var Zr = Object.prototype, Dr = Zr.toString;
|
|
699
830
|
function Fr(r) {
|
|
700
|
-
return
|
|
831
|
+
return Dr.call(r);
|
|
701
832
|
}
|
|
833
|
+
var zr = "[object Null]", Ur = "[object Undefined]", mt = ze ? ze.toStringTag : void 0;
|
|
702
834
|
function Vr(r) {
|
|
703
|
-
return r
|
|
835
|
+
return r == null ? r === void 0 ? Ur : zr : mt && mt in Object(r) ? $r(r) : Fr(r);
|
|
704
836
|
}
|
|
705
|
-
var Ur = "[object Symbol]";
|
|
706
837
|
function Br(r) {
|
|
707
|
-
return
|
|
838
|
+
return r != null && typeof r == "object";
|
|
708
839
|
}
|
|
709
|
-
var Wr =
|
|
710
|
-
function
|
|
711
|
-
|
|
840
|
+
var Wr = "[object Symbol]";
|
|
841
|
+
function qr(r) {
|
|
842
|
+
return typeof r == "symbol" || Br(r) && Vr(r) == Wr;
|
|
843
|
+
}
|
|
844
|
+
var Yr = /\s/;
|
|
845
|
+
function Qr(r) {
|
|
846
|
+
for (var e = r.length; e-- && Yr.test(r.charAt(e)); )
|
|
712
847
|
;
|
|
713
848
|
return e;
|
|
714
849
|
}
|
|
715
|
-
var
|
|
716
|
-
function
|
|
717
|
-
return r && r.slice(0,
|
|
850
|
+
var Hr = /^\s+/;
|
|
851
|
+
function Gr(r) {
|
|
852
|
+
return r && r.slice(0, Qr(r) + 1).replace(Hr, "");
|
|
718
853
|
}
|
|
719
|
-
function
|
|
854
|
+
function Xe(r) {
|
|
720
855
|
var e = typeof r;
|
|
721
856
|
return r != null && (e == "object" || e == "function");
|
|
722
857
|
}
|
|
723
|
-
var
|
|
724
|
-
function
|
|
858
|
+
var pt = NaN, Jr = /^[-+]0x[0-9a-f]+$/i, Xr = /^0b[01]+$/i, Kr = /^0o[0-7]+$/i, es = parseInt;
|
|
859
|
+
function gt(r) {
|
|
725
860
|
if (typeof r == "number")
|
|
726
861
|
return r;
|
|
727
|
-
if (
|
|
728
|
-
return
|
|
729
|
-
if (
|
|
862
|
+
if (qr(r))
|
|
863
|
+
return pt;
|
|
864
|
+
if (Xe(r)) {
|
|
730
865
|
var e = typeof r.valueOf == "function" ? r.valueOf() : r;
|
|
731
|
-
r =
|
|
866
|
+
r = Xe(e) ? e + "" : e;
|
|
732
867
|
}
|
|
733
868
|
if (typeof r != "string")
|
|
734
869
|
return r === 0 ? r : +r;
|
|
735
|
-
r =
|
|
736
|
-
var t =
|
|
737
|
-
return t ||
|
|
870
|
+
r = Gr(r);
|
|
871
|
+
var t = Xr.test(r);
|
|
872
|
+
return t || Kr.test(r) ? es(r.slice(2), t ? 2 : 8) : Jr.test(r) ? pt : +r;
|
|
738
873
|
}
|
|
739
|
-
var
|
|
740
|
-
return
|
|
741
|
-
},
|
|
742
|
-
function
|
|
743
|
-
var s, n, a,
|
|
874
|
+
var Ge = function() {
|
|
875
|
+
return Ft.Date.now();
|
|
876
|
+
}, ts = "Expected a function", rs = Math.max, ss = Math.min;
|
|
877
|
+
function ns(r, e, t) {
|
|
878
|
+
var s, n, a, d, u, i, o = 0, c = !1, f = !1, h = !0;
|
|
744
879
|
if (typeof r != "function")
|
|
745
|
-
throw new TypeError(
|
|
746
|
-
e =
|
|
880
|
+
throw new TypeError(ts);
|
|
881
|
+
e = gt(e) || 0, Xe(t) && (c = !!t.leading, f = "maxWait" in t, a = f ? rs(gt(t.maxWait) || 0, e) : a, h = "trailing" in t ? !!t.trailing : h);
|
|
747
882
|
function p(O) {
|
|
748
883
|
var B = s, W = n;
|
|
749
|
-
return s = n = void 0, o = O,
|
|
884
|
+
return s = n = void 0, o = O, d = r.apply(W, B), d;
|
|
750
885
|
}
|
|
751
|
-
function
|
|
752
|
-
return o = O, u = setTimeout(M, e),
|
|
886
|
+
function v(O) {
|
|
887
|
+
return o = O, u = setTimeout(M, e), c ? p(O) : d;
|
|
753
888
|
}
|
|
754
|
-
function
|
|
889
|
+
function w(O) {
|
|
755
890
|
var B = O - i, W = O - o, G = e - B;
|
|
756
|
-
return f ?
|
|
891
|
+
return f ? ss(G, a - W) : G;
|
|
757
892
|
}
|
|
758
|
-
function
|
|
893
|
+
function _(O) {
|
|
759
894
|
var B = O - i, W = O - o;
|
|
760
895
|
return i === void 0 || B >= e || B < 0 || f && W >= a;
|
|
761
896
|
}
|
|
762
897
|
function M() {
|
|
763
|
-
var O =
|
|
764
|
-
if (
|
|
898
|
+
var O = Ge();
|
|
899
|
+
if (_(O))
|
|
765
900
|
return R(O);
|
|
766
|
-
u = setTimeout(M,
|
|
901
|
+
u = setTimeout(M, w(O));
|
|
767
902
|
}
|
|
768
903
|
function R(O) {
|
|
769
|
-
return u = void 0, h && s ? p(O) : (s = n = void 0,
|
|
904
|
+
return u = void 0, h && s ? p(O) : (s = n = void 0, d);
|
|
770
905
|
}
|
|
771
|
-
function
|
|
906
|
+
function k() {
|
|
772
907
|
u !== void 0 && clearTimeout(u), o = 0, s = i = n = u = void 0;
|
|
773
908
|
}
|
|
774
909
|
function I() {
|
|
775
|
-
return u === void 0 ?
|
|
910
|
+
return u === void 0 ? d : R(Ge());
|
|
776
911
|
}
|
|
777
912
|
function L() {
|
|
778
|
-
var O =
|
|
913
|
+
var O = Ge(), B = _(O);
|
|
779
914
|
if (s = arguments, n = this, i = O, B) {
|
|
780
915
|
if (u === void 0)
|
|
781
|
-
return
|
|
916
|
+
return v(i);
|
|
782
917
|
if (f)
|
|
783
918
|
return clearTimeout(u), u = setTimeout(M, e), p(i);
|
|
784
919
|
}
|
|
785
|
-
return u === void 0 && (u = setTimeout(M, e)),
|
|
920
|
+
return u === void 0 && (u = setTimeout(M, e)), d;
|
|
786
921
|
}
|
|
787
|
-
return L.cancel =
|
|
922
|
+
return L.cancel = k, L.flush = I, L;
|
|
788
923
|
}
|
|
789
|
-
function
|
|
924
|
+
function en(r, e) {
|
|
790
925
|
const t = e?.defaultPage ?? 1, s = e?.defaultPerPage ?? 25, n = {};
|
|
791
926
|
r.page !== void 0 && r.page !== null && r.page !== t && (n.page = Number(r.page)), r.per_page !== void 0 && r.per_page !== null && r.per_page !== s && (n.per_page = Number(r.per_page));
|
|
792
927
|
const a = {};
|
|
793
928
|
r.sort_by && (a.sort_by = String(r.sort_by)), r.sort_order && (a.sort_order = String(r.sort_order));
|
|
794
|
-
const
|
|
795
|
-
return Object.keys(n).length && (u.pagination = n),
|
|
929
|
+
const d = r.q ?? r.q, u = {};
|
|
930
|
+
return Object.keys(n).length && (u.pagination = n), d != null && String(d) !== "" && (u.q = d), Object.keys(a).length && (u.sort = a), u;
|
|
796
931
|
}
|
|
797
|
-
function
|
|
932
|
+
function vt(r, e) {
|
|
798
933
|
const t = {};
|
|
799
934
|
for (const [s, n] of r.entries())
|
|
800
935
|
t[s] = n;
|
|
801
936
|
return t;
|
|
802
937
|
}
|
|
803
|
-
function
|
|
938
|
+
function Fe(r) {
|
|
804
939
|
const e = new URLSearchParams();
|
|
805
940
|
return Object.entries(r || {}).forEach(([t, s]) => {
|
|
806
941
|
s != null && e.set(t, String(s));
|
|
807
942
|
}), e;
|
|
808
943
|
}
|
|
809
|
-
function
|
|
944
|
+
function Ut({
|
|
810
945
|
page: r,
|
|
811
946
|
perPage: e,
|
|
812
947
|
total: t,
|
|
@@ -814,11 +949,11 @@ function zt({
|
|
|
814
949
|
className: n = "",
|
|
815
950
|
visiblePages: a = 5
|
|
816
951
|
}) {
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
952
|
+
const d = Math.max(1, Math.ceil(t / e));
|
|
953
|
+
if (d <= 1) return null;
|
|
819
954
|
const u = (p) => {
|
|
820
|
-
p !== r && p >= 1 && p <=
|
|
821
|
-
}, i = (p) => /* @__PURE__ */
|
|
955
|
+
p !== r && p >= 1 && p <= d && s(p);
|
|
956
|
+
}, i = (p) => /* @__PURE__ */ l.jsx(
|
|
822
957
|
"button",
|
|
823
958
|
{
|
|
824
959
|
className: `join-item btn ${p === r ? "btn-active" : ""}`,
|
|
@@ -826,15 +961,15 @@ function zt({
|
|
|
826
961
|
children: p
|
|
827
962
|
},
|
|
828
963
|
p
|
|
829
|
-
), o = Math.max(1, Math.min(a,
|
|
830
|
-
let
|
|
831
|
-
|
|
832
|
-
let f =
|
|
833
|
-
f >
|
|
964
|
+
), o = Math.max(1, Math.min(a, d));
|
|
965
|
+
let c = r - Math.floor(o / 2);
|
|
966
|
+
c < 1 && (c = 1);
|
|
967
|
+
let f = c + o - 1;
|
|
968
|
+
f > d && (f = d, c = Math.max(1, f - o + 1));
|
|
834
969
|
const h = [];
|
|
835
|
-
for (let p =
|
|
836
|
-
return /* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
970
|
+
for (let p = c; p <= f; p++) h.push(p);
|
|
971
|
+
return /* @__PURE__ */ l.jsx("div", { className: `flex justify-center ${n}`, children: /* @__PURE__ */ l.jsxs("div", { className: "join", children: [
|
|
972
|
+
/* @__PURE__ */ l.jsx(
|
|
838
973
|
"button",
|
|
839
974
|
{
|
|
840
975
|
className: "join-item btn",
|
|
@@ -844,74 +979,74 @@ function zt({
|
|
|
844
979
|
}
|
|
845
980
|
),
|
|
846
981
|
h.map((p) => i(p)),
|
|
847
|
-
/* @__PURE__ */
|
|
982
|
+
/* @__PURE__ */ l.jsx(
|
|
848
983
|
"button",
|
|
849
984
|
{
|
|
850
985
|
className: "join-item btn",
|
|
851
|
-
disabled: r ===
|
|
986
|
+
disabled: r === d,
|
|
852
987
|
onClick: () => u(r + 1),
|
|
853
988
|
children: "»"
|
|
854
989
|
}
|
|
855
990
|
)
|
|
856
991
|
] }) });
|
|
857
992
|
}
|
|
858
|
-
function
|
|
993
|
+
function Vt({
|
|
859
994
|
title: r,
|
|
860
995
|
actions: e,
|
|
861
996
|
paramsSchema: t,
|
|
862
997
|
useQuery: s,
|
|
863
998
|
renderFilters: n,
|
|
864
999
|
columns: a,
|
|
865
|
-
emptyMessage:
|
|
1000
|
+
emptyMessage: d = "No items found.",
|
|
866
1001
|
onRowClick: u,
|
|
867
1002
|
paginationType: i = "pages"
|
|
868
1003
|
}) {
|
|
869
|
-
const [o,
|
|
870
|
-
|
|
871
|
-
JSON.stringify(f) !== JSON.stringify(I.current) && (
|
|
1004
|
+
const [o, c] = ot(), f = vt(o), { data: h, isLoading: p, raw: v } = s(f), w = v?.metadata?.total ?? 0, _ = f.page ?? 1, M = f.per_page ?? 20, [R, k] = de(f), I = ur(f);
|
|
1005
|
+
Ie(() => {
|
|
1006
|
+
JSON.stringify(f) !== JSON.stringify(I.current) && (k(f), I.current = f);
|
|
872
1007
|
}, [f]);
|
|
873
|
-
const L =
|
|
874
|
-
() =>
|
|
875
|
-
|
|
1008
|
+
const L = fr(
|
|
1009
|
+
() => ns((P) => {
|
|
1010
|
+
c(Fe(P));
|
|
876
1011
|
}, 300),
|
|
877
|
-
[
|
|
1012
|
+
[c]
|
|
878
1013
|
);
|
|
879
|
-
|
|
880
|
-
const O = (P,
|
|
881
|
-
const
|
|
1014
|
+
Ie(() => () => L.cancel(), [L]);
|
|
1015
|
+
const O = (P, Y) => {
|
|
1016
|
+
const Q = {
|
|
882
1017
|
...R,
|
|
883
|
-
[P]:
|
|
1018
|
+
[P]: Y === "" ? void 0 : Y,
|
|
884
1019
|
// Reset to page 1 when filters change
|
|
885
1020
|
page: 1
|
|
886
1021
|
};
|
|
887
|
-
|
|
1022
|
+
k(Q), L(Q);
|
|
888
1023
|
}, B = (P) => {
|
|
889
|
-
const
|
|
1024
|
+
const Y = {
|
|
890
1025
|
...R,
|
|
891
1026
|
...P,
|
|
892
1027
|
// Reset to page 1 when filters change
|
|
893
1028
|
page: 1
|
|
894
1029
|
};
|
|
895
|
-
|
|
1030
|
+
k(Y), L(Y);
|
|
896
1031
|
}, W = () => {
|
|
897
|
-
L.cancel(),
|
|
1032
|
+
L.cancel(), c(Fe(R));
|
|
898
1033
|
}, G = () => {
|
|
899
|
-
const P =
|
|
900
|
-
|
|
901
|
-
},
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
},
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
-
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
r && /* @__PURE__ */
|
|
909
|
-
e && /* @__PURE__ */
|
|
1034
|
+
const P = vt(new URLSearchParams());
|
|
1035
|
+
k(P), L.cancel(), c(Fe(P));
|
|
1036
|
+
}, ce = (P) => {
|
|
1037
|
+
const Y = { ...f, page: P };
|
|
1038
|
+
c(Fe(Y));
|
|
1039
|
+
}, q = r || e || n;
|
|
1040
|
+
return /* @__PURE__ */ l.jsx("div", { className: "card bg-base-100 shadow-xl", children: /* @__PURE__ */ l.jsxs("div", { className: "card-body", children: [
|
|
1041
|
+
q && /* @__PURE__ */ l.jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [
|
|
1042
|
+
/* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1043
|
+
r && /* @__PURE__ */ l.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ l.jsx("h2", { className: "card-title m-0 text-2xl font-bold", children: r }) }),
|
|
1044
|
+
e && /* @__PURE__ */ l.jsx("div", { className: "flex items-center gap-3", children: e })
|
|
910
1045
|
] }),
|
|
911
|
-
n && /* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
/* @__PURE__ */
|
|
1046
|
+
n && /* @__PURE__ */ l.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2 bg-base-200/50 p-2 rounded-lg w-full", children: [
|
|
1047
|
+
/* @__PURE__ */ l.jsx("div", { className: "flex flex-wrap gap-2 justify-end flex-1", children: n(R, O) }),
|
|
1048
|
+
/* @__PURE__ */ l.jsxs("div", { className: "join", children: [
|
|
1049
|
+
/* @__PURE__ */ l.jsx(
|
|
915
1050
|
"button",
|
|
916
1051
|
{
|
|
917
1052
|
className: "join-item btn btn-sm btn-neutral",
|
|
@@ -919,7 +1054,7 @@ function Ft({
|
|
|
919
1054
|
children: "Search"
|
|
920
1055
|
}
|
|
921
1056
|
),
|
|
922
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ l.jsx(
|
|
923
1058
|
"button",
|
|
924
1059
|
{
|
|
925
1060
|
className: "join-item btn btn-sm btn-ghost border-base-300",
|
|
@@ -930,62 +1065,62 @@ function Ft({
|
|
|
930
1065
|
] })
|
|
931
1066
|
] })
|
|
932
1067
|
] }),
|
|
933
|
-
p ? /* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
936
|
-
const
|
|
937
|
-
return /* @__PURE__ */
|
|
1068
|
+
p ? /* @__PURE__ */ l.jsx("div", { className: "flex justify-center items-center py-10", children: /* @__PURE__ */ l.jsx("span", { className: "loading loading-spinner loading-lg" }) }) : h.length === 0 ? /* @__PURE__ */ l.jsx("div", { className: "text-center py-8", children: d }) : /* @__PURE__ */ l.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ l.jsxs("table", { className: "table table-zebra w-full", children: [
|
|
1069
|
+
/* @__PURE__ */ l.jsx("thead", { children: /* @__PURE__ */ l.jsx("tr", { children: a.map((P) => /* @__PURE__ */ l.jsx("th", { className: P.className, children: typeof P.header == "function" ? P.header(f, O, B) : P.header }, P.key)) }) }),
|
|
1070
|
+
/* @__PURE__ */ l.jsx("tbody", { children: h.map((P, Y) => {
|
|
1071
|
+
const Q = P.id !== void 0 ? String(P.id) : `row-${Y}`;
|
|
1072
|
+
return /* @__PURE__ */ l.jsx(
|
|
938
1073
|
"tr",
|
|
939
1074
|
{
|
|
940
1075
|
className: u ? "cursor-pointer hover:bg-base-200" : "",
|
|
941
1076
|
onClick: () => u?.(P),
|
|
942
|
-
children: a.map((
|
|
1077
|
+
children: a.map((U) => /* @__PURE__ */ l.jsx(
|
|
943
1078
|
"td",
|
|
944
1079
|
{
|
|
945
|
-
className:
|
|
946
|
-
children:
|
|
1080
|
+
className: U.className,
|
|
1081
|
+
children: U.render ? U.render(P) : P[U.key]
|
|
947
1082
|
},
|
|
948
|
-
`${
|
|
1083
|
+
`${Q}-${U.key}`
|
|
949
1084
|
))
|
|
950
1085
|
},
|
|
951
|
-
|
|
1086
|
+
Q
|
|
952
1087
|
);
|
|
953
1088
|
}) })
|
|
954
1089
|
] }) }),
|
|
955
|
-
i !== "none" && /* @__PURE__ */
|
|
956
|
-
|
|
1090
|
+
i !== "none" && /* @__PURE__ */ l.jsx("div", { className: "mt-4", children: /* @__PURE__ */ l.jsx(
|
|
1091
|
+
Ut,
|
|
957
1092
|
{
|
|
958
|
-
page:
|
|
1093
|
+
page: _,
|
|
959
1094
|
perPage: M,
|
|
960
|
-
total:
|
|
961
|
-
onPageChange:
|
|
1095
|
+
total: w,
|
|
1096
|
+
onPageChange: ce
|
|
962
1097
|
}
|
|
963
1098
|
) })
|
|
964
1099
|
] }) });
|
|
965
1100
|
}
|
|
966
|
-
function
|
|
1101
|
+
function as({
|
|
967
1102
|
errors: r,
|
|
968
1103
|
className: e = ""
|
|
969
1104
|
}) {
|
|
970
|
-
return !Array.isArray(r) || r.length === 0 ? null : /* @__PURE__ */
|
|
1105
|
+
return !Array.isArray(r) || r.length === 0 ? null : /* @__PURE__ */ l.jsx("div", { className: `alert alert-error mb-4 ${e}`.trim(), children: /* @__PURE__ */ l.jsx("ul", { className: "list-disc list-inside", children: r.map((t, s) => /* @__PURE__ */ l.jsx("li", { children: t }, s)) }) });
|
|
971
1106
|
}
|
|
972
|
-
var
|
|
1107
|
+
var is = Object.defineProperty, Ue = Object.getOwnPropertySymbols, Bt = Object.prototype.hasOwnProperty, Wt = Object.prototype.propertyIsEnumerable, yt = (r, e, t) => e in r ? is(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Ke = (r, e) => {
|
|
973
1108
|
for (var t in e || (e = {}))
|
|
974
|
-
|
|
975
|
-
if (
|
|
976
|
-
for (var t of
|
|
977
|
-
|
|
1109
|
+
Bt.call(e, t) && yt(r, t, e[t]);
|
|
1110
|
+
if (Ue)
|
|
1111
|
+
for (var t of Ue(e))
|
|
1112
|
+
Wt.call(e, t) && yt(r, t, e[t]);
|
|
978
1113
|
return r;
|
|
979
|
-
},
|
|
1114
|
+
}, et = (r, e) => {
|
|
980
1115
|
var t = {};
|
|
981
1116
|
for (var s in r)
|
|
982
|
-
|
|
983
|
-
if (r != null &&
|
|
984
|
-
for (var s of
|
|
985
|
-
e.indexOf(s) < 0 &&
|
|
1117
|
+
Bt.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
|
|
1118
|
+
if (r != null && Ue)
|
|
1119
|
+
for (var s of Ue(r))
|
|
1120
|
+
e.indexOf(s) < 0 && Wt.call(r, s) && (t[s] = r[s]);
|
|
986
1121
|
return t;
|
|
987
1122
|
};
|
|
988
|
-
var
|
|
1123
|
+
var ue;
|
|
989
1124
|
((r) => {
|
|
990
1125
|
const e = class S {
|
|
991
1126
|
/*-- Constructor (low level) and fields --*/
|
|
@@ -993,25 +1128,25 @@ var ce;
|
|
|
993
1128
|
// error correction level, data codeword bytes, and mask number.
|
|
994
1129
|
// This is a low-level API that most users should not use directly.
|
|
995
1130
|
// A mid-level API is the encodeSegments() function.
|
|
996
|
-
constructor(i, o,
|
|
1131
|
+
constructor(i, o, c, f) {
|
|
997
1132
|
if (this.version = i, this.errorCorrectionLevel = o, this.modules = [], this.isFunction = [], i < S.MIN_VERSION || i > S.MAX_VERSION)
|
|
998
1133
|
throw new RangeError("Version value out of range");
|
|
999
1134
|
if (f < -1 || f > 7)
|
|
1000
1135
|
throw new RangeError("Mask value out of range");
|
|
1001
1136
|
this.size = i * 4 + 17;
|
|
1002
1137
|
let h = [];
|
|
1003
|
-
for (let
|
|
1138
|
+
for (let v = 0; v < this.size; v++)
|
|
1004
1139
|
h.push(!1);
|
|
1005
|
-
for (let
|
|
1140
|
+
for (let v = 0; v < this.size; v++)
|
|
1006
1141
|
this.modules.push(h.slice()), this.isFunction.push(h.slice());
|
|
1007
1142
|
this.drawFunctionPatterns();
|
|
1008
|
-
const p = this.addEccAndInterleave(
|
|
1143
|
+
const p = this.addEccAndInterleave(c);
|
|
1009
1144
|
if (this.drawCodewords(p), f == -1) {
|
|
1010
|
-
let
|
|
1011
|
-
for (let
|
|
1012
|
-
this.applyMask(
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1145
|
+
let v = 1e9;
|
|
1146
|
+
for (let w = 0; w < 8; w++) {
|
|
1147
|
+
this.applyMask(w), this.drawFormatBits(w);
|
|
1148
|
+
const _ = this.getPenaltyScore();
|
|
1149
|
+
_ < v && (f = w, v = _), this.applyMask(w);
|
|
1015
1150
|
}
|
|
1016
1151
|
}
|
|
1017
1152
|
n(0 <= f && f <= 7), this.mask = f, this.applyMask(f), this.drawFormatBits(f), this.isFunction = [];
|
|
@@ -1023,16 +1158,16 @@ var ce;
|
|
|
1023
1158
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
1024
1159
|
// ecl argument if it can be done without increasing the version.
|
|
1025
1160
|
static encodeText(i, o) {
|
|
1026
|
-
const
|
|
1027
|
-
return S.encodeSegments(
|
|
1161
|
+
const c = r.QrSegment.makeSegments(i);
|
|
1162
|
+
return S.encodeSegments(c, o);
|
|
1028
1163
|
}
|
|
1029
1164
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
1030
1165
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
1031
1166
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
1032
1167
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
1033
1168
|
static encodeBinary(i, o) {
|
|
1034
|
-
const
|
|
1035
|
-
return S.encodeSegments([
|
|
1169
|
+
const c = r.QrSegment.makeBytes(i);
|
|
1170
|
+
return S.encodeSegments([c], o);
|
|
1036
1171
|
}
|
|
1037
1172
|
/*-- Static factory functions (mid level) --*/
|
|
1038
1173
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -1044,36 +1179,36 @@ var ce;
|
|
|
1044
1179
|
// This function allows the user to create a custom sequence of segments that switches
|
|
1045
1180
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
1046
1181
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
1047
|
-
static encodeSegments(i, o,
|
|
1048
|
-
if (!(S.MIN_VERSION <=
|
|
1182
|
+
static encodeSegments(i, o, c = 1, f = 40, h = -1, p = !0) {
|
|
1183
|
+
if (!(S.MIN_VERSION <= c && c <= f && f <= S.MAX_VERSION) || h < -1 || h > 7)
|
|
1049
1184
|
throw new RangeError("Invalid value");
|
|
1050
|
-
let
|
|
1051
|
-
for (
|
|
1052
|
-
const
|
|
1053
|
-
if (I <=
|
|
1054
|
-
|
|
1185
|
+
let v, w;
|
|
1186
|
+
for (v = c; ; v++) {
|
|
1187
|
+
const k = S.getNumDataCodewords(v, o) * 8, I = d.getTotalBits(i, v);
|
|
1188
|
+
if (I <= k) {
|
|
1189
|
+
w = I;
|
|
1055
1190
|
break;
|
|
1056
1191
|
}
|
|
1057
|
-
if (
|
|
1192
|
+
if (v >= f)
|
|
1058
1193
|
throw new RangeError("Data too long");
|
|
1059
1194
|
}
|
|
1060
|
-
for (const
|
|
1061
|
-
p &&
|
|
1062
|
-
let
|
|
1063
|
-
for (const
|
|
1064
|
-
t(
|
|
1065
|
-
for (const I of
|
|
1066
|
-
|
|
1195
|
+
for (const k of [S.Ecc.MEDIUM, S.Ecc.QUARTILE, S.Ecc.HIGH])
|
|
1196
|
+
p && w <= S.getNumDataCodewords(v, k) * 8 && (o = k);
|
|
1197
|
+
let _ = [];
|
|
1198
|
+
for (const k of i) {
|
|
1199
|
+
t(k.mode.modeBits, 4, _), t(k.numChars, k.mode.numCharCountBits(v), _);
|
|
1200
|
+
for (const I of k.getData())
|
|
1201
|
+
_.push(I);
|
|
1067
1202
|
}
|
|
1068
|
-
n(
|
|
1069
|
-
const M = S.getNumDataCodewords(
|
|
1070
|
-
n(
|
|
1071
|
-
for (let
|
|
1072
|
-
t(
|
|
1203
|
+
n(_.length == w);
|
|
1204
|
+
const M = S.getNumDataCodewords(v, o) * 8;
|
|
1205
|
+
n(_.length <= M), t(0, Math.min(4, M - _.length), _), t(0, (8 - _.length % 8) % 8, _), n(_.length % 8 == 0);
|
|
1206
|
+
for (let k = 236; _.length < M; k ^= 253)
|
|
1207
|
+
t(k, 8, _);
|
|
1073
1208
|
let R = [];
|
|
1074
|
-
for (; R.length * 8 <
|
|
1209
|
+
for (; R.length * 8 < _.length; )
|
|
1075
1210
|
R.push(0);
|
|
1076
|
-
return
|
|
1211
|
+
return _.forEach((k, I) => R[I >>> 3] |= k << 7 - (I & 7)), new S(v, o, R, h);
|
|
1077
1212
|
}
|
|
1078
1213
|
/*-- Accessor methods --*/
|
|
1079
1214
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
@@ -1089,23 +1224,23 @@ var ce;
|
|
|
1089
1224
|
/*-- Private helper methods for constructor: Drawing function modules --*/
|
|
1090
1225
|
// Reads this object's version field, and draws and marks all function modules.
|
|
1091
1226
|
drawFunctionPatterns() {
|
|
1092
|
-
for (let
|
|
1093
|
-
this.setFunctionModule(6,
|
|
1227
|
+
for (let c = 0; c < this.size; c++)
|
|
1228
|
+
this.setFunctionModule(6, c, c % 2 == 0), this.setFunctionModule(c, 6, c % 2 == 0);
|
|
1094
1229
|
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
1095
1230
|
const i = this.getAlignmentPatternPositions(), o = i.length;
|
|
1096
|
-
for (let
|
|
1231
|
+
for (let c = 0; c < o; c++)
|
|
1097
1232
|
for (let f = 0; f < o; f++)
|
|
1098
|
-
|
|
1233
|
+
c == 0 && f == 0 || c == 0 && f == o - 1 || c == o - 1 && f == 0 || this.drawAlignmentPattern(i[c], i[f]);
|
|
1099
1234
|
this.drawFormatBits(0), this.drawVersion();
|
|
1100
1235
|
}
|
|
1101
1236
|
// Draws two copies of the format bits (with its own error correction code)
|
|
1102
1237
|
// based on the given mask and this object's error correction level field.
|
|
1103
1238
|
drawFormatBits(i) {
|
|
1104
1239
|
const o = this.errorCorrectionLevel.formatBits << 3 | i;
|
|
1105
|
-
let
|
|
1240
|
+
let c = o;
|
|
1106
1241
|
for (let h = 0; h < 10; h++)
|
|
1107
|
-
|
|
1108
|
-
const f = (o << 10 |
|
|
1242
|
+
c = c << 1 ^ (c >>> 9) * 1335;
|
|
1243
|
+
const f = (o << 10 | c) ^ 21522;
|
|
1109
1244
|
n(f >>> 15 == 0);
|
|
1110
1245
|
for (let h = 0; h <= 5; h++)
|
|
1111
1246
|
this.setFunctionModule(8, h, s(f, h));
|
|
@@ -1124,56 +1259,56 @@ var ce;
|
|
|
1124
1259
|
if (this.version < 7)
|
|
1125
1260
|
return;
|
|
1126
1261
|
let i = this.version;
|
|
1127
|
-
for (let
|
|
1262
|
+
for (let c = 0; c < 12; c++)
|
|
1128
1263
|
i = i << 1 ^ (i >>> 11) * 7973;
|
|
1129
1264
|
const o = this.version << 12 | i;
|
|
1130
1265
|
n(o >>> 18 == 0);
|
|
1131
|
-
for (let
|
|
1132
|
-
const f = s(o,
|
|
1266
|
+
for (let c = 0; c < 18; c++) {
|
|
1267
|
+
const f = s(o, c), h = this.size - 11 + c % 3, p = Math.floor(c / 3);
|
|
1133
1268
|
this.setFunctionModule(h, p, f), this.setFunctionModule(p, h, f);
|
|
1134
1269
|
}
|
|
1135
1270
|
}
|
|
1136
1271
|
// Draws a 9*9 finder pattern including the border separator,
|
|
1137
1272
|
// with the center module at (x, y). Modules can be out of bounds.
|
|
1138
1273
|
drawFinderPattern(i, o) {
|
|
1139
|
-
for (let
|
|
1274
|
+
for (let c = -4; c <= 4; c++)
|
|
1140
1275
|
for (let f = -4; f <= 4; f++) {
|
|
1141
|
-
const h = Math.max(Math.abs(f), Math.abs(
|
|
1142
|
-
0 <= p && p < this.size && 0 <=
|
|
1276
|
+
const h = Math.max(Math.abs(f), Math.abs(c)), p = i + f, v = o + c;
|
|
1277
|
+
0 <= p && p < this.size && 0 <= v && v < this.size && this.setFunctionModule(p, v, h != 2 && h != 4);
|
|
1143
1278
|
}
|
|
1144
1279
|
}
|
|
1145
1280
|
// Draws a 5*5 alignment pattern, with the center module
|
|
1146
1281
|
// at (x, y). All modules must be in bounds.
|
|
1147
1282
|
drawAlignmentPattern(i, o) {
|
|
1148
|
-
for (let
|
|
1283
|
+
for (let c = -2; c <= 2; c++)
|
|
1149
1284
|
for (let f = -2; f <= 2; f++)
|
|
1150
|
-
this.setFunctionModule(i + f, o +
|
|
1285
|
+
this.setFunctionModule(i + f, o + c, Math.max(Math.abs(f), Math.abs(c)) != 1);
|
|
1151
1286
|
}
|
|
1152
1287
|
// Sets the color of a module and marks it as a function module.
|
|
1153
1288
|
// Only used by the constructor. Coordinates must be in bounds.
|
|
1154
|
-
setFunctionModule(i, o,
|
|
1155
|
-
this.modules[o][i] =
|
|
1289
|
+
setFunctionModule(i, o, c) {
|
|
1290
|
+
this.modules[o][i] = c, this.isFunction[o][i] = !0;
|
|
1156
1291
|
}
|
|
1157
1292
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
|
1158
1293
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
1159
1294
|
// codewords appended to it, based on this object's version and error correction level.
|
|
1160
1295
|
addEccAndInterleave(i) {
|
|
1161
|
-
const o = this.version,
|
|
1162
|
-
if (i.length != S.getNumDataCodewords(o,
|
|
1296
|
+
const o = this.version, c = this.errorCorrectionLevel;
|
|
1297
|
+
if (i.length != S.getNumDataCodewords(o, c))
|
|
1163
1298
|
throw new RangeError("Invalid argument");
|
|
1164
|
-
const f = S.NUM_ERROR_CORRECTION_BLOCKS[
|
|
1165
|
-
let
|
|
1299
|
+
const f = S.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][o], h = S.ECC_CODEWORDS_PER_BLOCK[c.ordinal][o], p = Math.floor(S.getNumRawDataModules(o) / 8), v = f - p % f, w = Math.floor(p / f);
|
|
1300
|
+
let _ = [];
|
|
1166
1301
|
const M = S.reedSolomonComputeDivisor(h);
|
|
1167
|
-
for (let
|
|
1168
|
-
let L = i.slice(I, I +
|
|
1302
|
+
for (let k = 0, I = 0; k < f; k++) {
|
|
1303
|
+
let L = i.slice(I, I + w - h + (k < v ? 0 : 1));
|
|
1169
1304
|
I += L.length;
|
|
1170
1305
|
const O = S.reedSolomonComputeRemainder(L, M);
|
|
1171
|
-
|
|
1306
|
+
k < v && L.push(0), _.push(L.concat(O));
|
|
1172
1307
|
}
|
|
1173
1308
|
let R = [];
|
|
1174
|
-
for (let
|
|
1175
|
-
|
|
1176
|
-
(
|
|
1309
|
+
for (let k = 0; k < _[0].length; k++)
|
|
1310
|
+
_.forEach((I, L) => {
|
|
1311
|
+
(k != w - h || L >= v) && R.push(I[k]);
|
|
1177
1312
|
});
|
|
1178
1313
|
return n(R.length == p), R;
|
|
1179
1314
|
}
|
|
@@ -1183,12 +1318,12 @@ var ce;
|
|
|
1183
1318
|
if (i.length != Math.floor(S.getNumRawDataModules(this.version) / 8))
|
|
1184
1319
|
throw new RangeError("Invalid argument");
|
|
1185
1320
|
let o = 0;
|
|
1186
|
-
for (let
|
|
1187
|
-
|
|
1321
|
+
for (let c = this.size - 1; c >= 1; c -= 2) {
|
|
1322
|
+
c == 6 && (c = 5);
|
|
1188
1323
|
for (let f = 0; f < this.size; f++)
|
|
1189
1324
|
for (let h = 0; h < 2; h++) {
|
|
1190
|
-
const p =
|
|
1191
|
-
!this.isFunction[
|
|
1325
|
+
const p = c - h, w = (c + 1 & 2) == 0 ? this.size - 1 - f : f;
|
|
1326
|
+
!this.isFunction[w][p] && o < i.length * 8 && (this.modules[w][p] = s(i[o >>> 3], 7 - (o & 7)), o++);
|
|
1192
1327
|
}
|
|
1193
1328
|
}
|
|
1194
1329
|
n(o == i.length * 8);
|
|
@@ -1202,37 +1337,37 @@ var ce;
|
|
|
1202
1337
|
if (i < 0 || i > 7)
|
|
1203
1338
|
throw new RangeError("Mask value out of range");
|
|
1204
1339
|
for (let o = 0; o < this.size; o++)
|
|
1205
|
-
for (let
|
|
1340
|
+
for (let c = 0; c < this.size; c++) {
|
|
1206
1341
|
let f;
|
|
1207
1342
|
switch (i) {
|
|
1208
1343
|
case 0:
|
|
1209
|
-
f = (
|
|
1344
|
+
f = (c + o) % 2 == 0;
|
|
1210
1345
|
break;
|
|
1211
1346
|
case 1:
|
|
1212
1347
|
f = o % 2 == 0;
|
|
1213
1348
|
break;
|
|
1214
1349
|
case 2:
|
|
1215
|
-
f =
|
|
1350
|
+
f = c % 3 == 0;
|
|
1216
1351
|
break;
|
|
1217
1352
|
case 3:
|
|
1218
|
-
f = (
|
|
1353
|
+
f = (c + o) % 3 == 0;
|
|
1219
1354
|
break;
|
|
1220
1355
|
case 4:
|
|
1221
|
-
f = (Math.floor(
|
|
1356
|
+
f = (Math.floor(c / 3) + Math.floor(o / 2)) % 2 == 0;
|
|
1222
1357
|
break;
|
|
1223
1358
|
case 5:
|
|
1224
|
-
f =
|
|
1359
|
+
f = c * o % 2 + c * o % 3 == 0;
|
|
1225
1360
|
break;
|
|
1226
1361
|
case 6:
|
|
1227
|
-
f = (
|
|
1362
|
+
f = (c * o % 2 + c * o % 3) % 2 == 0;
|
|
1228
1363
|
break;
|
|
1229
1364
|
case 7:
|
|
1230
|
-
f = ((
|
|
1365
|
+
f = ((c + o) % 2 + c * o % 3) % 2 == 0;
|
|
1231
1366
|
break;
|
|
1232
1367
|
default:
|
|
1233
1368
|
throw new Error("Unreachable");
|
|
1234
1369
|
}
|
|
1235
|
-
!this.isFunction[o][
|
|
1370
|
+
!this.isFunction[o][c] && f && (this.modules[o][c] = !this.modules[o][c]);
|
|
1236
1371
|
}
|
|
1237
1372
|
}
|
|
1238
1373
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
@@ -1240,26 +1375,26 @@ var ce;
|
|
|
1240
1375
|
getPenaltyScore() {
|
|
1241
1376
|
let i = 0;
|
|
1242
1377
|
for (let h = 0; h < this.size; h++) {
|
|
1243
|
-
let p = !1,
|
|
1244
|
-
for (let
|
|
1245
|
-
this.modules[h][
|
|
1246
|
-
i += this.finderPenaltyTerminateAndCount(p,
|
|
1378
|
+
let p = !1, v = 0, w = [0, 0, 0, 0, 0, 0, 0];
|
|
1379
|
+
for (let _ = 0; _ < this.size; _++)
|
|
1380
|
+
this.modules[h][_] == p ? (v++, v == 5 ? i += S.PENALTY_N1 : v > 5 && i++) : (this.finderPenaltyAddHistory(v, w), p || (i += this.finderPenaltyCountPatterns(w) * S.PENALTY_N3), p = this.modules[h][_], v = 1);
|
|
1381
|
+
i += this.finderPenaltyTerminateAndCount(p, v, w) * S.PENALTY_N3;
|
|
1247
1382
|
}
|
|
1248
1383
|
for (let h = 0; h < this.size; h++) {
|
|
1249
|
-
let p = !1,
|
|
1250
|
-
for (let
|
|
1251
|
-
this.modules[
|
|
1252
|
-
i += this.finderPenaltyTerminateAndCount(p,
|
|
1384
|
+
let p = !1, v = 0, w = [0, 0, 0, 0, 0, 0, 0];
|
|
1385
|
+
for (let _ = 0; _ < this.size; _++)
|
|
1386
|
+
this.modules[_][h] == p ? (v++, v == 5 ? i += S.PENALTY_N1 : v > 5 && i++) : (this.finderPenaltyAddHistory(v, w), p || (i += this.finderPenaltyCountPatterns(w) * S.PENALTY_N3), p = this.modules[_][h], v = 1);
|
|
1387
|
+
i += this.finderPenaltyTerminateAndCount(p, v, w) * S.PENALTY_N3;
|
|
1253
1388
|
}
|
|
1254
1389
|
for (let h = 0; h < this.size - 1; h++)
|
|
1255
1390
|
for (let p = 0; p < this.size - 1; p++) {
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1391
|
+
const v = this.modules[h][p];
|
|
1392
|
+
v == this.modules[h][p + 1] && v == this.modules[h + 1][p] && v == this.modules[h + 1][p + 1] && (i += S.PENALTY_N2);
|
|
1258
1393
|
}
|
|
1259
1394
|
let o = 0;
|
|
1260
1395
|
for (const h of this.modules)
|
|
1261
|
-
o = h.reduce((p,
|
|
1262
|
-
const
|
|
1396
|
+
o = h.reduce((p, v) => p + (v ? 1 : 0), o);
|
|
1397
|
+
const c = this.size * this.size, f = Math.ceil(Math.abs(o * 20 - c * 10) / c) - 1;
|
|
1263
1398
|
return n(0 <= f && f <= 9), i += f * S.PENALTY_N4, n(0 <= i && i <= 2568888), i;
|
|
1264
1399
|
}
|
|
1265
1400
|
/*-- Private helper functions --*/
|
|
@@ -1271,10 +1406,10 @@ var ce;
|
|
|
1271
1406
|
return [];
|
|
1272
1407
|
{
|
|
1273
1408
|
const i = Math.floor(this.version / 7) + 2, o = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (i * 2 - 2)) * 2;
|
|
1274
|
-
let
|
|
1275
|
-
for (let f = this.size - 7;
|
|
1276
|
-
|
|
1277
|
-
return
|
|
1409
|
+
let c = [6];
|
|
1410
|
+
for (let f = this.size - 7; c.length < i; f -= o)
|
|
1411
|
+
c.splice(1, 0, f);
|
|
1412
|
+
return c;
|
|
1278
1413
|
}
|
|
1279
1414
|
}
|
|
1280
1415
|
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
|
@@ -1285,8 +1420,8 @@ var ce;
|
|
|
1285
1420
|
throw new RangeError("Version number out of range");
|
|
1286
1421
|
let o = (16 * i + 128) * i + 64;
|
|
1287
1422
|
if (i >= 2) {
|
|
1288
|
-
const
|
|
1289
|
-
o -= (25 *
|
|
1423
|
+
const c = Math.floor(i / 7) + 2;
|
|
1424
|
+
o -= (25 * c - 10) * c - 55, i >= 7 && (o -= 36);
|
|
1290
1425
|
}
|
|
1291
1426
|
return n(208 <= o && o <= 29648), o;
|
|
1292
1427
|
}
|
|
@@ -1305,44 +1440,44 @@ var ce;
|
|
|
1305
1440
|
for (let f = 0; f < i - 1; f++)
|
|
1306
1441
|
o.push(0);
|
|
1307
1442
|
o.push(1);
|
|
1308
|
-
let
|
|
1443
|
+
let c = 1;
|
|
1309
1444
|
for (let f = 0; f < i; f++) {
|
|
1310
1445
|
for (let h = 0; h < o.length; h++)
|
|
1311
|
-
o[h] = S.reedSolomonMultiply(o[h],
|
|
1312
|
-
|
|
1446
|
+
o[h] = S.reedSolomonMultiply(o[h], c), h + 1 < o.length && (o[h] ^= o[h + 1]);
|
|
1447
|
+
c = S.reedSolomonMultiply(c, 2);
|
|
1313
1448
|
}
|
|
1314
1449
|
return o;
|
|
1315
1450
|
}
|
|
1316
1451
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
|
1317
1452
|
static reedSolomonComputeRemainder(i, o) {
|
|
1318
|
-
let
|
|
1453
|
+
let c = o.map((f) => 0);
|
|
1319
1454
|
for (const f of i) {
|
|
1320
|
-
const h = f ^
|
|
1321
|
-
|
|
1455
|
+
const h = f ^ c.shift();
|
|
1456
|
+
c.push(0), o.forEach((p, v) => c[v] ^= S.reedSolomonMultiply(p, h));
|
|
1322
1457
|
}
|
|
1323
|
-
return
|
|
1458
|
+
return c;
|
|
1324
1459
|
}
|
|
1325
1460
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
|
1326
1461
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
1327
1462
|
static reedSolomonMultiply(i, o) {
|
|
1328
1463
|
if (i >>> 8 || o >>> 8)
|
|
1329
1464
|
throw new RangeError("Byte out of range");
|
|
1330
|
-
let
|
|
1465
|
+
let c = 0;
|
|
1331
1466
|
for (let f = 7; f >= 0; f--)
|
|
1332
|
-
|
|
1333
|
-
return n(
|
|
1467
|
+
c = c << 1 ^ (c >>> 7) * 285, c ^= (o >>> f & 1) * i;
|
|
1468
|
+
return n(c >>> 8 == 0), c;
|
|
1334
1469
|
}
|
|
1335
1470
|
// Can only be called immediately after a light run is added, and
|
|
1336
1471
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
|
1337
1472
|
finderPenaltyCountPatterns(i) {
|
|
1338
1473
|
const o = i[1];
|
|
1339
1474
|
n(o <= this.size * 3);
|
|
1340
|
-
const
|
|
1341
|
-
return (
|
|
1475
|
+
const c = o > 0 && i[2] == o && i[3] == o * 3 && i[4] == o && i[5] == o;
|
|
1476
|
+
return (c && i[0] >= o * 4 && i[6] >= o ? 1 : 0) + (c && i[6] >= o * 4 && i[0] >= o ? 1 : 0);
|
|
1342
1477
|
}
|
|
1343
1478
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
|
1344
|
-
finderPenaltyTerminateAndCount(i, o,
|
|
1345
|
-
return i && (this.finderPenaltyAddHistory(o,
|
|
1479
|
+
finderPenaltyTerminateAndCount(i, o, c) {
|
|
1480
|
+
return i && (this.finderPenaltyAddHistory(o, c), o = 0), o += this.size, this.finderPenaltyAddHistory(o, c), this.finderPenaltyCountPatterns(c);
|
|
1346
1481
|
}
|
|
1347
1482
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
|
1348
1483
|
finderPenaltyAddHistory(i, o) {
|
|
@@ -1375,8 +1510,8 @@ var ce;
|
|
|
1375
1510
|
function t(u, i, o) {
|
|
1376
1511
|
if (i < 0 || i > 31 || u >>> i)
|
|
1377
1512
|
throw new RangeError("Value out of range");
|
|
1378
|
-
for (let
|
|
1379
|
-
o.push(u >>>
|
|
1513
|
+
for (let c = i - 1; c >= 0; c--)
|
|
1514
|
+
o.push(u >>> c & 1);
|
|
1380
1515
|
}
|
|
1381
1516
|
function s(u, i) {
|
|
1382
1517
|
return (u >>> i & 1) != 0;
|
|
@@ -1390,10 +1525,10 @@ var ce;
|
|
|
1390
1525
|
// Creates a new QR Code segment with the given attributes and data.
|
|
1391
1526
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
1392
1527
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
1393
|
-
constructor(i, o,
|
|
1394
|
-
if (this.mode = i, this.numChars = o, this.bitData =
|
|
1528
|
+
constructor(i, o, c) {
|
|
1529
|
+
if (this.mode = i, this.numChars = o, this.bitData = c, o < 0)
|
|
1395
1530
|
throw new RangeError("Invalid argument");
|
|
1396
|
-
this.bitData =
|
|
1531
|
+
this.bitData = c.slice();
|
|
1397
1532
|
}
|
|
1398
1533
|
/*-- Static factory functions (mid level) --*/
|
|
1399
1534
|
// Returns a segment representing the given binary data encoded in
|
|
@@ -1401,8 +1536,8 @@ var ce;
|
|
|
1401
1536
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
1402
1537
|
static makeBytes(i) {
|
|
1403
1538
|
let o = [];
|
|
1404
|
-
for (const
|
|
1405
|
-
t(
|
|
1539
|
+
for (const c of i)
|
|
1540
|
+
t(c, 8, o);
|
|
1406
1541
|
return new Z(Z.Mode.BYTE, i.length, o);
|
|
1407
1542
|
}
|
|
1408
1543
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
@@ -1410,9 +1545,9 @@ var ce;
|
|
|
1410
1545
|
if (!Z.isNumeric(i))
|
|
1411
1546
|
throw new RangeError("String contains non-numeric characters");
|
|
1412
1547
|
let o = [];
|
|
1413
|
-
for (let
|
|
1414
|
-
const f = Math.min(i.length -
|
|
1415
|
-
t(parseInt(i.substring(
|
|
1548
|
+
for (let c = 0; c < i.length; ) {
|
|
1549
|
+
const f = Math.min(i.length - c, 3);
|
|
1550
|
+
t(parseInt(i.substring(c, c + f), 10), f * 3 + 1, o), c += f;
|
|
1416
1551
|
}
|
|
1417
1552
|
return new Z(Z.Mode.NUMERIC, i.length, o);
|
|
1418
1553
|
}
|
|
@@ -1422,12 +1557,12 @@ var ce;
|
|
|
1422
1557
|
static makeAlphanumeric(i) {
|
|
1423
1558
|
if (!Z.isAlphanumeric(i))
|
|
1424
1559
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
1425
|
-
let o = [],
|
|
1426
|
-
for (
|
|
1427
|
-
let f = Z.ALPHANUMERIC_CHARSET.indexOf(i.charAt(
|
|
1428
|
-
f += Z.ALPHANUMERIC_CHARSET.indexOf(i.charAt(
|
|
1560
|
+
let o = [], c;
|
|
1561
|
+
for (c = 0; c + 2 <= i.length; c += 2) {
|
|
1562
|
+
let f = Z.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)) * 45;
|
|
1563
|
+
f += Z.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c + 1)), t(f, 11, o);
|
|
1429
1564
|
}
|
|
1430
|
-
return
|
|
1565
|
+
return c < i.length && t(Z.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)), 6, o), new Z(Z.Mode.ALPHANUMERIC, i.length, o);
|
|
1431
1566
|
}
|
|
1432
1567
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
1433
1568
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
@@ -1469,28 +1604,28 @@ var ce;
|
|
|
1469
1604
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
|
1470
1605
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
1471
1606
|
static getTotalBits(i, o) {
|
|
1472
|
-
let
|
|
1607
|
+
let c = 0;
|
|
1473
1608
|
for (const f of i) {
|
|
1474
1609
|
const h = f.mode.numCharCountBits(o);
|
|
1475
1610
|
if (f.numChars >= 1 << h)
|
|
1476
1611
|
return 1 / 0;
|
|
1477
|
-
|
|
1612
|
+
c += 4 + h + f.bitData.length;
|
|
1478
1613
|
}
|
|
1479
|
-
return
|
|
1614
|
+
return c;
|
|
1480
1615
|
}
|
|
1481
1616
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
1482
1617
|
static toUtf8ByteArray(i) {
|
|
1483
1618
|
i = encodeURI(i);
|
|
1484
1619
|
let o = [];
|
|
1485
|
-
for (let
|
|
1486
|
-
i.charAt(
|
|
1620
|
+
for (let c = 0; c < i.length; c++)
|
|
1621
|
+
i.charAt(c) != "%" ? o.push(i.charCodeAt(c)) : (o.push(parseInt(i.substring(c + 1, c + 3), 16)), c += 2);
|
|
1487
1622
|
return o;
|
|
1488
1623
|
}
|
|
1489
1624
|
};
|
|
1490
1625
|
a.NUMERIC_REGEX = /^[0-9]*$/, a.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, a.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
1491
|
-
let
|
|
1626
|
+
let d = a;
|
|
1492
1627
|
r.QrSegment = a;
|
|
1493
|
-
})(
|
|
1628
|
+
})(ue || (ue = {}));
|
|
1494
1629
|
((r) => {
|
|
1495
1630
|
((e) => {
|
|
1496
1631
|
const t = class {
|
|
@@ -1502,7 +1637,7 @@ var ce;
|
|
|
1502
1637
|
};
|
|
1503
1638
|
t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), e.Ecc = t;
|
|
1504
1639
|
})(r.QrCode || (r.QrCode = {}));
|
|
1505
|
-
})(
|
|
1640
|
+
})(ue || (ue = {}));
|
|
1506
1641
|
((r) => {
|
|
1507
1642
|
((e) => {
|
|
1508
1643
|
const t = class {
|
|
@@ -1519,120 +1654,120 @@ var ce;
|
|
|
1519
1654
|
};
|
|
1520
1655
|
t.NUMERIC = new t(1, [10, 12, 14]), t.ALPHANUMERIC = new t(2, [9, 11, 13]), t.BYTE = new t(4, [8, 16, 16]), t.KANJI = new t(8, [8, 10, 12]), t.ECI = new t(7, [0, 0, 0]), e.Mode = t;
|
|
1521
1656
|
})(r.QrSegment || (r.QrSegment = {}));
|
|
1522
|
-
})(
|
|
1523
|
-
var
|
|
1524
|
-
var
|
|
1525
|
-
L:
|
|
1526
|
-
M:
|
|
1527
|
-
Q:
|
|
1528
|
-
H:
|
|
1529
|
-
},
|
|
1530
|
-
function
|
|
1657
|
+
})(ue || (ue = {}));
|
|
1658
|
+
var ve = ue;
|
|
1659
|
+
var os = {
|
|
1660
|
+
L: ve.QrCode.Ecc.LOW,
|
|
1661
|
+
M: ve.QrCode.Ecc.MEDIUM,
|
|
1662
|
+
Q: ve.QrCode.Ecc.QUARTILE,
|
|
1663
|
+
H: ve.QrCode.Ecc.HIGH
|
|
1664
|
+
}, qt = 128, Yt = "L", Qt = "#FFFFFF", Ht = "#000000", Gt = !1, Jt = 1, ls = 4, cs = 0, ds = 0.1;
|
|
1665
|
+
function Xt(r, e = 0) {
|
|
1531
1666
|
const t = [];
|
|
1532
1667
|
return r.forEach(function(s, n) {
|
|
1533
1668
|
let a = null;
|
|
1534
|
-
s.forEach(function(
|
|
1535
|
-
if (!
|
|
1669
|
+
s.forEach(function(d, u) {
|
|
1670
|
+
if (!d && a !== null) {
|
|
1536
1671
|
t.push(
|
|
1537
1672
|
`M${a + e} ${n + e}h${u - a}v1H${a + e}z`
|
|
1538
1673
|
), a = null;
|
|
1539
1674
|
return;
|
|
1540
1675
|
}
|
|
1541
1676
|
if (u === s.length - 1) {
|
|
1542
|
-
if (!
|
|
1677
|
+
if (!d)
|
|
1543
1678
|
return;
|
|
1544
1679
|
a === null ? t.push(`M${u + e},${n + e} h1v1H${u + e}z`) : t.push(
|
|
1545
1680
|
`M${a + e},${n + e} h${u + 1 - a}v1H${a + e}z`
|
|
1546
1681
|
);
|
|
1547
1682
|
return;
|
|
1548
1683
|
}
|
|
1549
|
-
|
|
1684
|
+
d && a === null && (a = u);
|
|
1550
1685
|
});
|
|
1551
1686
|
}), t.join("");
|
|
1552
1687
|
}
|
|
1553
|
-
function
|
|
1688
|
+
function Kt(r, e) {
|
|
1554
1689
|
return r.slice().map((t, s) => s < e.y || s >= e.y + e.h ? t : t.map((n, a) => a < e.x || a >= e.x + e.w ? n : !1));
|
|
1555
1690
|
}
|
|
1556
|
-
function
|
|
1691
|
+
function us(r, e, t, s) {
|
|
1557
1692
|
if (s == null)
|
|
1558
1693
|
return null;
|
|
1559
|
-
const n = r.length + t * 2, a = Math.floor(e *
|
|
1694
|
+
const n = r.length + t * 2, a = Math.floor(e * ds), d = n / e, u = (s.width || a) * d, i = (s.height || a) * d, o = s.x == null ? r.length / 2 - u / 2 : s.x * d, c = s.y == null ? r.length / 2 - i / 2 : s.y * d, f = s.opacity == null ? 1 : s.opacity;
|
|
1560
1695
|
let h = null;
|
|
1561
1696
|
if (s.excavate) {
|
|
1562
|
-
let
|
|
1563
|
-
h = { x:
|
|
1697
|
+
let v = Math.floor(o), w = Math.floor(c), _ = Math.ceil(u + o - v), M = Math.ceil(i + c - w);
|
|
1698
|
+
h = { x: v, y: w, w: _, h: M };
|
|
1564
1699
|
}
|
|
1565
1700
|
const p = s.crossOrigin;
|
|
1566
|
-
return { x: o, y:
|
|
1701
|
+
return { x: o, y: c, h: i, w: u, excavation: h, opacity: f, crossOrigin: p };
|
|
1567
1702
|
}
|
|
1568
|
-
function
|
|
1569
|
-
return e != null ? Math.max(Math.floor(e), 0) : r ?
|
|
1703
|
+
function fs(r, e) {
|
|
1704
|
+
return e != null ? Math.max(Math.floor(e), 0) : r ? ls : cs;
|
|
1570
1705
|
}
|
|
1571
|
-
function
|
|
1706
|
+
function er({
|
|
1572
1707
|
value: r,
|
|
1573
1708
|
level: e,
|
|
1574
1709
|
minVersion: t,
|
|
1575
1710
|
includeMargin: s,
|
|
1576
1711
|
marginSize: n,
|
|
1577
1712
|
imageSettings: a,
|
|
1578
|
-
size:
|
|
1713
|
+
size: d,
|
|
1579
1714
|
boostLevel: u
|
|
1580
1715
|
}) {
|
|
1581
|
-
let i =
|
|
1582
|
-
const
|
|
1583
|
-
return
|
|
1584
|
-
|
|
1585
|
-
|
|
1716
|
+
let i = F.useMemo(() => {
|
|
1717
|
+
const v = (Array.isArray(r) ? r : [r]).reduce((w, _) => (w.push(...ve.QrSegment.makeSegments(_)), w), []);
|
|
1718
|
+
return ve.QrCode.encodeSegments(
|
|
1719
|
+
v,
|
|
1720
|
+
os[e],
|
|
1586
1721
|
t,
|
|
1587
1722
|
void 0,
|
|
1588
1723
|
void 0,
|
|
1589
1724
|
u
|
|
1590
1725
|
);
|
|
1591
1726
|
}, [r, e, t, u]);
|
|
1592
|
-
const { cells: o, margin:
|
|
1727
|
+
const { cells: o, margin: c, numCells: f, calculatedImageSettings: h } = F.useMemo(() => {
|
|
1593
1728
|
let p = i.getModules();
|
|
1594
|
-
const
|
|
1729
|
+
const v = fs(s, n), w = p.length + v * 2, _ = us(
|
|
1595
1730
|
p,
|
|
1596
|
-
|
|
1597
|
-
|
|
1731
|
+
d,
|
|
1732
|
+
v,
|
|
1598
1733
|
a
|
|
1599
1734
|
);
|
|
1600
1735
|
return {
|
|
1601
1736
|
cells: p,
|
|
1602
|
-
margin:
|
|
1603
|
-
numCells:
|
|
1604
|
-
calculatedImageSettings:
|
|
1737
|
+
margin: v,
|
|
1738
|
+
numCells: w,
|
|
1739
|
+
calculatedImageSettings: _
|
|
1605
1740
|
};
|
|
1606
|
-
}, [i,
|
|
1741
|
+
}, [i, d, a, s, n]);
|
|
1607
1742
|
return {
|
|
1608
1743
|
qrcode: i,
|
|
1609
|
-
margin:
|
|
1744
|
+
margin: c,
|
|
1610
1745
|
cells: o,
|
|
1611
1746
|
numCells: f,
|
|
1612
1747
|
calculatedImageSettings: h
|
|
1613
1748
|
};
|
|
1614
1749
|
}
|
|
1615
|
-
var
|
|
1750
|
+
var hs = (function() {
|
|
1616
1751
|
try {
|
|
1617
1752
|
new Path2D().addPath(new Path2D());
|
|
1618
1753
|
} catch {
|
|
1619
1754
|
return !1;
|
|
1620
1755
|
}
|
|
1621
1756
|
return !0;
|
|
1622
|
-
})(),
|
|
1757
|
+
})(), ms = F.forwardRef(
|
|
1623
1758
|
function(e, t) {
|
|
1624
1759
|
const s = e, {
|
|
1625
1760
|
value: n,
|
|
1626
|
-
size: a =
|
|
1627
|
-
level:
|
|
1628
|
-
bgColor: u =
|
|
1629
|
-
fgColor: i =
|
|
1630
|
-
includeMargin: o =
|
|
1631
|
-
minVersion:
|
|
1761
|
+
size: a = qt,
|
|
1762
|
+
level: d = Yt,
|
|
1763
|
+
bgColor: u = Qt,
|
|
1764
|
+
fgColor: i = Ht,
|
|
1765
|
+
includeMargin: o = Gt,
|
|
1766
|
+
minVersion: c = Jt,
|
|
1632
1767
|
boostLevel: f,
|
|
1633
1768
|
marginSize: h,
|
|
1634
1769
|
imageSettings: p
|
|
1635
|
-
} = s,
|
|
1770
|
+
} = s, w = et(s, [
|
|
1636
1771
|
"value",
|
|
1637
1772
|
"size",
|
|
1638
1773
|
"level",
|
|
@@ -1643,53 +1778,53 @@ var us = (function() {
|
|
|
1643
1778
|
"boostLevel",
|
|
1644
1779
|
"marginSize",
|
|
1645
1780
|
"imageSettings"
|
|
1646
|
-
]), { style:
|
|
1647
|
-
(
|
|
1648
|
-
|
|
1781
|
+
]), { style: _ } = w, M = et(w, ["style"]), R = p?.src, k = F.useRef(null), I = F.useRef(null), L = F.useCallback(
|
|
1782
|
+
(Q) => {
|
|
1783
|
+
k.current = Q, typeof t == "function" ? t(Q) : t && (t.current = Q);
|
|
1649
1784
|
},
|
|
1650
1785
|
[t]
|
|
1651
|
-
), [O, B] =
|
|
1786
|
+
), [O, B] = F.useState(!1), { margin: W, cells: G, numCells: ce, calculatedImageSettings: q } = er({
|
|
1652
1787
|
value: n,
|
|
1653
|
-
level:
|
|
1654
|
-
minVersion:
|
|
1788
|
+
level: d,
|
|
1789
|
+
minVersion: c,
|
|
1655
1790
|
boostLevel: f,
|
|
1656
1791
|
includeMargin: o,
|
|
1657
1792
|
marginSize: h,
|
|
1658
1793
|
imageSettings: p,
|
|
1659
1794
|
size: a
|
|
1660
1795
|
});
|
|
1661
|
-
|
|
1662
|
-
if (
|
|
1663
|
-
const
|
|
1664
|
-
if (!
|
|
1796
|
+
F.useEffect(() => {
|
|
1797
|
+
if (k.current != null) {
|
|
1798
|
+
const Q = k.current, U = Q.getContext("2d");
|
|
1799
|
+
if (!U)
|
|
1665
1800
|
return;
|
|
1666
|
-
let
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1801
|
+
let je = G;
|
|
1802
|
+
const te = I.current, Ne = q != null && te !== null && te.complete && te.naturalHeight !== 0 && te.naturalWidth !== 0;
|
|
1803
|
+
Ne && q.excavation != null && (je = Kt(
|
|
1669
1804
|
G,
|
|
1670
|
-
|
|
1805
|
+
q.excavation
|
|
1671
1806
|
));
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1807
|
+
const Ee = window.devicePixelRatio || 1;
|
|
1808
|
+
Q.height = Q.width = a * Ee;
|
|
1809
|
+
const Ce = a / ce * Ee;
|
|
1810
|
+
U.scale(Ce, Ce), U.fillStyle = u, U.fillRect(0, 0, ce, ce), U.fillStyle = i, hs ? U.fill(new Path2D(Xt(je, W))) : G.forEach(function(m, E) {
|
|
1676
1811
|
m.forEach(function($, D) {
|
|
1677
|
-
$ &&
|
|
1812
|
+
$ && U.fillRect(D + W, E + W, 1, 1);
|
|
1678
1813
|
});
|
|
1679
|
-
}),
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1814
|
+
}), q && (U.globalAlpha = q.opacity), Ne && U.drawImage(
|
|
1815
|
+
te,
|
|
1816
|
+
q.x + W,
|
|
1817
|
+
q.y + W,
|
|
1818
|
+
q.w,
|
|
1819
|
+
q.h
|
|
1685
1820
|
);
|
|
1686
1821
|
}
|
|
1687
|
-
}),
|
|
1822
|
+
}), F.useEffect(() => {
|
|
1688
1823
|
B(!1);
|
|
1689
1824
|
}, [R]);
|
|
1690
|
-
const P =
|
|
1691
|
-
let
|
|
1692
|
-
return R != null && (
|
|
1825
|
+
const P = Ke({ height: a, width: a }, _);
|
|
1826
|
+
let Y = null;
|
|
1827
|
+
return R != null && (Y = /* @__PURE__ */ F.createElement(
|
|
1693
1828
|
"img",
|
|
1694
1829
|
{
|
|
1695
1830
|
src: R,
|
|
@@ -1699,36 +1834,36 @@ var us = (function() {
|
|
|
1699
1834
|
B(!0);
|
|
1700
1835
|
},
|
|
1701
1836
|
ref: I,
|
|
1702
|
-
crossOrigin:
|
|
1837
|
+
crossOrigin: q?.crossOrigin
|
|
1703
1838
|
}
|
|
1704
|
-
)), /* @__PURE__ */
|
|
1839
|
+
)), /* @__PURE__ */ F.createElement(F.Fragment, null, /* @__PURE__ */ F.createElement(
|
|
1705
1840
|
"canvas",
|
|
1706
|
-
|
|
1841
|
+
Ke({
|
|
1707
1842
|
style: P,
|
|
1708
1843
|
height: a,
|
|
1709
1844
|
width: a,
|
|
1710
1845
|
ref: L,
|
|
1711
1846
|
role: "img"
|
|
1712
1847
|
}, M)
|
|
1713
|
-
),
|
|
1848
|
+
), Y);
|
|
1714
1849
|
}
|
|
1715
1850
|
);
|
|
1716
|
-
|
|
1717
|
-
var
|
|
1851
|
+
ms.displayName = "QRCodeCanvas";
|
|
1852
|
+
var tr = F.forwardRef(
|
|
1718
1853
|
function(e, t) {
|
|
1719
1854
|
const s = e, {
|
|
1720
1855
|
value: n,
|
|
1721
|
-
size: a =
|
|
1722
|
-
level:
|
|
1723
|
-
bgColor: u =
|
|
1724
|
-
fgColor: i =
|
|
1725
|
-
includeMargin: o =
|
|
1726
|
-
minVersion:
|
|
1856
|
+
size: a = qt,
|
|
1857
|
+
level: d = Yt,
|
|
1858
|
+
bgColor: u = Qt,
|
|
1859
|
+
fgColor: i = Ht,
|
|
1860
|
+
includeMargin: o = Gt,
|
|
1861
|
+
minVersion: c = Jt,
|
|
1727
1862
|
boostLevel: f,
|
|
1728
1863
|
title: h,
|
|
1729
1864
|
marginSize: p,
|
|
1730
|
-
imageSettings:
|
|
1731
|
-
} = s,
|
|
1865
|
+
imageSettings: v
|
|
1866
|
+
} = s, w = et(s, [
|
|
1732
1867
|
"value",
|
|
1733
1868
|
"size",
|
|
1734
1869
|
"level",
|
|
@@ -1740,45 +1875,45 @@ var Kt = z.forwardRef(
|
|
|
1740
1875
|
"title",
|
|
1741
1876
|
"marginSize",
|
|
1742
1877
|
"imageSettings"
|
|
1743
|
-
]), { margin:
|
|
1878
|
+
]), { margin: _, cells: M, numCells: R, calculatedImageSettings: k } = er({
|
|
1744
1879
|
value: n,
|
|
1745
|
-
level:
|
|
1746
|
-
minVersion:
|
|
1880
|
+
level: d,
|
|
1881
|
+
minVersion: c,
|
|
1747
1882
|
boostLevel: f,
|
|
1748
1883
|
includeMargin: o,
|
|
1749
1884
|
marginSize: p,
|
|
1750
|
-
imageSettings:
|
|
1885
|
+
imageSettings: v,
|
|
1751
1886
|
size: a
|
|
1752
1887
|
});
|
|
1753
1888
|
let I = M, L = null;
|
|
1754
|
-
|
|
1889
|
+
v != null && k != null && (k.excavation != null && (I = Kt(
|
|
1755
1890
|
M,
|
|
1756
|
-
|
|
1757
|
-
)), L = /* @__PURE__ */
|
|
1891
|
+
k.excavation
|
|
1892
|
+
)), L = /* @__PURE__ */ F.createElement(
|
|
1758
1893
|
"image",
|
|
1759
1894
|
{
|
|
1760
|
-
href:
|
|
1761
|
-
height:
|
|
1762
|
-
width:
|
|
1763
|
-
x:
|
|
1764
|
-
y:
|
|
1895
|
+
href: v.src,
|
|
1896
|
+
height: k.h,
|
|
1897
|
+
width: k.w,
|
|
1898
|
+
x: k.x + _,
|
|
1899
|
+
y: k.y + _,
|
|
1765
1900
|
preserveAspectRatio: "none",
|
|
1766
|
-
opacity:
|
|
1767
|
-
crossOrigin:
|
|
1901
|
+
opacity: k.opacity,
|
|
1902
|
+
crossOrigin: k.crossOrigin
|
|
1768
1903
|
}
|
|
1769
1904
|
));
|
|
1770
|
-
const O =
|
|
1771
|
-
return /* @__PURE__ */
|
|
1905
|
+
const O = Xt(I, _);
|
|
1906
|
+
return /* @__PURE__ */ F.createElement(
|
|
1772
1907
|
"svg",
|
|
1773
|
-
|
|
1908
|
+
Ke({
|
|
1774
1909
|
height: a,
|
|
1775
1910
|
width: a,
|
|
1776
1911
|
viewBox: `0 0 ${R} ${R}`,
|
|
1777
1912
|
ref: t,
|
|
1778
1913
|
role: "img"
|
|
1779
|
-
},
|
|
1780
|
-
!!h && /* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1914
|
+
}, w),
|
|
1915
|
+
!!h && /* @__PURE__ */ F.createElement("title", null, h),
|
|
1916
|
+
/* @__PURE__ */ F.createElement(
|
|
1782
1917
|
"path",
|
|
1783
1918
|
{
|
|
1784
1919
|
fill: u,
|
|
@@ -1786,13 +1921,13 @@ var Kt = z.forwardRef(
|
|
|
1786
1921
|
shapeRendering: "crispEdges"
|
|
1787
1922
|
}
|
|
1788
1923
|
),
|
|
1789
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ F.createElement("path", { fill: i, d: O, shapeRendering: "crispEdges" }),
|
|
1790
1925
|
L
|
|
1791
1926
|
);
|
|
1792
1927
|
}
|
|
1793
1928
|
);
|
|
1794
|
-
|
|
1795
|
-
const
|
|
1929
|
+
tr.displayName = "QRCodeSVG";
|
|
1930
|
+
const ps = (r, e = "qr-code", t = 4) => {
|
|
1796
1931
|
const s = document.getElementById(r);
|
|
1797
1932
|
if (!s) return;
|
|
1798
1933
|
let n = new XMLSerializer().serializeToString(s);
|
|
@@ -1800,21 +1935,21 @@ const hs = (r, e = "qr-code", t = 4) => {
|
|
|
1800
1935
|
/<svg(\s+)/,
|
|
1801
1936
|
'<svg xmlns="http://www.w3.org/2000/svg" '
|
|
1802
1937
|
));
|
|
1803
|
-
const a = s.getAttribute("width") ? parseInt(s.getAttribute("width"), 10) : s.clientWidth || 200,
|
|
1938
|
+
const a = s.getAttribute("width") ? parseInt(s.getAttribute("width"), 10) : s.clientWidth || 200, d = s.getAttribute("height") ? parseInt(s.getAttribute("height"), 10) : s.clientHeight || a, u = Math.round(a * t), i = Math.round(d * t);
|
|
1804
1939
|
/viewBox=/.test(n) || (n = n.replace(
|
|
1805
1940
|
/<svg(\s+)/,
|
|
1806
|
-
`<svg viewBox="0 0 ${a} ${
|
|
1941
|
+
`<svg viewBox="0 0 ${a} ${d}" `
|
|
1807
1942
|
)), /width="[^"]*"/.test(n) ? n = n.replace(/width="[^"]*"/, `width="${u}"`) : n = n.replace(/<svg(\s+)/, `<svg width="${u}" `), /height="[^"]*"/.test(n) ? n = n.replace(/height="[^"]*"/, `height="${i}"`) : n = n.replace(/<svg(\s+)/, `<svg height="${i}" `);
|
|
1808
1943
|
const o = document.createElement("canvas");
|
|
1809
1944
|
o.width = u, o.height = i;
|
|
1810
|
-
const
|
|
1945
|
+
const c = o.getContext("2d"), f = new Image();
|
|
1811
1946
|
f.onload = () => {
|
|
1812
|
-
|
|
1947
|
+
c?.drawImage(f, 0, 0, o.width, o.height);
|
|
1813
1948
|
const h = o.toDataURL("image/png"), p = document.createElement("a");
|
|
1814
1949
|
p.download = `${e}.png`, p.href = h, p.click();
|
|
1815
1950
|
}, f.src = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(n)));
|
|
1816
1951
|
};
|
|
1817
|
-
function
|
|
1952
|
+
function gs({
|
|
1818
1953
|
id: r = "qr-code",
|
|
1819
1954
|
value: e,
|
|
1820
1955
|
size: t = 200,
|
|
@@ -1822,16 +1957,16 @@ function ms({
|
|
|
1822
1957
|
filenameBase: n,
|
|
1823
1958
|
showDownloads: a = !0
|
|
1824
1959
|
}) {
|
|
1825
|
-
const
|
|
1826
|
-
return /* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
a && /* @__PURE__ */
|
|
1960
|
+
const d = n || e.replace(/[^a-z0-9_-]/gi, "-").slice(0, 40) || "qr-code";
|
|
1961
|
+
return /* @__PURE__ */ l.jsxs("div", { className: "flex flex-col items-start ", children: [
|
|
1962
|
+
/* @__PURE__ */ l.jsx("div", { className: "bg-base-100 p-4 rounded-lg", children: /* @__PURE__ */ l.jsx(tr, { id: r, value: e, size: t, level: s }) }),
|
|
1963
|
+
a && /* @__PURE__ */ l.jsx("div", { className: "join justify-center self-center", children: /* @__PURE__ */ l.jsx(vs, { id: r, fileBase: d }) })
|
|
1829
1964
|
] });
|
|
1830
1965
|
}
|
|
1831
|
-
function
|
|
1832
|
-
const [t, s] =
|
|
1833
|
-
return /* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
1966
|
+
function vs({ id: r, fileBase: e }) {
|
|
1967
|
+
const [t, s] = de(8), n = (a) => a === 8 ? "large" : a === 4 ? "medium" : "small";
|
|
1968
|
+
return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
1969
|
+
/* @__PURE__ */ l.jsxs(
|
|
1835
1970
|
"select",
|
|
1836
1971
|
{
|
|
1837
1972
|
className: "select join-item",
|
|
@@ -1839,24 +1974,24 @@ function ps({ id: r, fileBase: e }) {
|
|
|
1839
1974
|
onChange: (a) => s(Number(a.target.value)),
|
|
1840
1975
|
"aria-label": "Download scale",
|
|
1841
1976
|
children: [
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
1977
|
+
/* @__PURE__ */ l.jsx("option", { value: 8, children: "Large" }),
|
|
1978
|
+
/* @__PURE__ */ l.jsx("option", { value: 4, children: "Medium" }),
|
|
1979
|
+
/* @__PURE__ */ l.jsx("option", { value: 2, children: "Small" })
|
|
1845
1980
|
]
|
|
1846
1981
|
}
|
|
1847
1982
|
),
|
|
1848
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ l.jsx(
|
|
1849
1984
|
"button",
|
|
1850
1985
|
{
|
|
1851
1986
|
className: "btn btn-secondary join-item",
|
|
1852
|
-
onClick: () =>
|
|
1987
|
+
onClick: () => ps(r, `${e}-${n(t)}`, t),
|
|
1853
1988
|
title: `Download ${t}x`,
|
|
1854
1989
|
children: "Download"
|
|
1855
1990
|
}
|
|
1856
1991
|
)
|
|
1857
1992
|
] });
|
|
1858
1993
|
}
|
|
1859
|
-
function
|
|
1994
|
+
function Oe(r) {
|
|
1860
1995
|
if (!r) return "";
|
|
1861
1996
|
try {
|
|
1862
1997
|
return new Date(r).toLocaleString();
|
|
@@ -1876,40 +2011,40 @@ var T;
|
|
|
1876
2011
|
}
|
|
1877
2012
|
r.assertNever = t, r.arrayToEnum = (n) => {
|
|
1878
2013
|
const a = {};
|
|
1879
|
-
for (const
|
|
1880
|
-
a[
|
|
2014
|
+
for (const d of n)
|
|
2015
|
+
a[d] = d;
|
|
1881
2016
|
return a;
|
|
1882
2017
|
}, r.getValidEnumValues = (n) => {
|
|
1883
|
-
const a = r.objectKeys(n).filter((u) => typeof n[n[u]] != "number"),
|
|
2018
|
+
const a = r.objectKeys(n).filter((u) => typeof n[n[u]] != "number"), d = {};
|
|
1884
2019
|
for (const u of a)
|
|
1885
|
-
|
|
1886
|
-
return r.objectValues(
|
|
2020
|
+
d[u] = n[u];
|
|
2021
|
+
return r.objectValues(d);
|
|
1887
2022
|
}, r.objectValues = (n) => r.objectKeys(n).map(function(a) {
|
|
1888
2023
|
return n[a];
|
|
1889
2024
|
}), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
1890
2025
|
const a = [];
|
|
1891
|
-
for (const
|
|
1892
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
2026
|
+
for (const d in n)
|
|
2027
|
+
Object.prototype.hasOwnProperty.call(n, d) && a.push(d);
|
|
1893
2028
|
return a;
|
|
1894
2029
|
}, r.find = (n, a) => {
|
|
1895
|
-
for (const
|
|
1896
|
-
if (a(
|
|
1897
|
-
return
|
|
2030
|
+
for (const d of n)
|
|
2031
|
+
if (a(d))
|
|
2032
|
+
return d;
|
|
1898
2033
|
}, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
|
|
1899
2034
|
function s(n, a = " | ") {
|
|
1900
|
-
return n.map((
|
|
2035
|
+
return n.map((d) => typeof d == "string" ? `'${d}'` : d).join(a);
|
|
1901
2036
|
}
|
|
1902
2037
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
1903
2038
|
})(T || (T = {}));
|
|
1904
|
-
var
|
|
2039
|
+
var xt;
|
|
1905
2040
|
(function(r) {
|
|
1906
2041
|
r.mergeShapes = (e, t) => ({
|
|
1907
2042
|
...e,
|
|
1908
2043
|
...t
|
|
1909
2044
|
// second overwrites first
|
|
1910
2045
|
});
|
|
1911
|
-
})(
|
|
1912
|
-
const
|
|
2046
|
+
})(xt || (xt = {}));
|
|
2047
|
+
const x = T.arrayToEnum([
|
|
1913
2048
|
"string",
|
|
1914
2049
|
"nan",
|
|
1915
2050
|
"number",
|
|
@@ -1930,26 +2065,26 @@ const _ = T.arrayToEnum([
|
|
|
1930
2065
|
"never",
|
|
1931
2066
|
"map",
|
|
1932
2067
|
"set"
|
|
1933
|
-
]),
|
|
2068
|
+
]), re = (r) => {
|
|
1934
2069
|
switch (typeof r) {
|
|
1935
2070
|
case "undefined":
|
|
1936
|
-
return
|
|
2071
|
+
return x.undefined;
|
|
1937
2072
|
case "string":
|
|
1938
|
-
return
|
|
2073
|
+
return x.string;
|
|
1939
2074
|
case "number":
|
|
1940
|
-
return Number.isNaN(r) ?
|
|
2075
|
+
return Number.isNaN(r) ? x.nan : x.number;
|
|
1941
2076
|
case "boolean":
|
|
1942
|
-
return
|
|
2077
|
+
return x.boolean;
|
|
1943
2078
|
case "function":
|
|
1944
|
-
return
|
|
2079
|
+
return x.function;
|
|
1945
2080
|
case "bigint":
|
|
1946
|
-
return
|
|
2081
|
+
return x.bigint;
|
|
1947
2082
|
case "symbol":
|
|
1948
|
-
return
|
|
2083
|
+
return x.symbol;
|
|
1949
2084
|
case "object":
|
|
1950
|
-
return Array.isArray(r) ?
|
|
2085
|
+
return Array.isArray(r) ? x.array : r === null ? x.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? x.promise : typeof Map < "u" && r instanceof Map ? x.map : typeof Set < "u" && r instanceof Set ? x.set : typeof Date < "u" && r instanceof Date ? x.date : x.object;
|
|
1951
2086
|
default:
|
|
1952
|
-
return
|
|
2087
|
+
return x.unknown;
|
|
1953
2088
|
}
|
|
1954
2089
|
}, g = T.arrayToEnum([
|
|
1955
2090
|
"invalid_type",
|
|
@@ -1986,20 +2121,20 @@ class ee extends Error {
|
|
|
1986
2121
|
const t = e || function(a) {
|
|
1987
2122
|
return a.message;
|
|
1988
2123
|
}, s = { _errors: [] }, n = (a) => {
|
|
1989
|
-
for (const
|
|
1990
|
-
if (
|
|
1991
|
-
|
|
1992
|
-
else if (
|
|
1993
|
-
n(
|
|
1994
|
-
else if (
|
|
1995
|
-
n(
|
|
1996
|
-
else if (
|
|
1997
|
-
s._errors.push(t(
|
|
2124
|
+
for (const d of a.issues)
|
|
2125
|
+
if (d.code === "invalid_union")
|
|
2126
|
+
d.unionErrors.map(n);
|
|
2127
|
+
else if (d.code === "invalid_return_type")
|
|
2128
|
+
n(d.returnTypeError);
|
|
2129
|
+
else if (d.code === "invalid_arguments")
|
|
2130
|
+
n(d.argumentsError);
|
|
2131
|
+
else if (d.path.length === 0)
|
|
2132
|
+
s._errors.push(t(d));
|
|
1998
2133
|
else {
|
|
1999
2134
|
let u = s, i = 0;
|
|
2000
|
-
for (; i <
|
|
2001
|
-
const o =
|
|
2002
|
-
i ===
|
|
2135
|
+
for (; i < d.path.length; ) {
|
|
2136
|
+
const o = d.path[i];
|
|
2137
|
+
i === d.path.length - 1 ? (u[o] = u[o] || { _errors: [] }, u[o]._errors.push(t(d))) : u[o] = u[o] || { _errors: [] }, u = u[o], i++;
|
|
2003
2138
|
}
|
|
2004
2139
|
}
|
|
2005
2140
|
};
|
|
@@ -2033,11 +2168,11 @@ class ee extends Error {
|
|
|
2033
2168
|
}
|
|
2034
2169
|
}
|
|
2035
2170
|
ee.create = (r) => new ee(r);
|
|
2036
|
-
const
|
|
2171
|
+
const tt = (r, e) => {
|
|
2037
2172
|
let t;
|
|
2038
2173
|
switch (r.code) {
|
|
2039
2174
|
case g.invalid_type:
|
|
2040
|
-
r.received ===
|
|
2175
|
+
r.received === x.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
2041
2176
|
break;
|
|
2042
2177
|
case g.invalid_literal:
|
|
2043
2178
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, T.jsonStringifyReplacer)}`;
|
|
@@ -2089,12 +2224,12 @@ const et = (r, e) => {
|
|
|
2089
2224
|
}
|
|
2090
2225
|
return { message: t };
|
|
2091
2226
|
};
|
|
2092
|
-
let
|
|
2093
|
-
function
|
|
2094
|
-
return
|
|
2227
|
+
let ys = tt;
|
|
2228
|
+
function xs() {
|
|
2229
|
+
return ys;
|
|
2095
2230
|
}
|
|
2096
|
-
const
|
|
2097
|
-
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []],
|
|
2231
|
+
const _s = (r) => {
|
|
2232
|
+
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], d = {
|
|
2098
2233
|
...n,
|
|
2099
2234
|
path: a
|
|
2100
2235
|
};
|
|
@@ -2107,15 +2242,15 @@ const vs = (r) => {
|
|
|
2107
2242
|
let u = "";
|
|
2108
2243
|
const i = s.filter((o) => !!o).slice().reverse();
|
|
2109
2244
|
for (const o of i)
|
|
2110
|
-
u = o(
|
|
2245
|
+
u = o(d, { data: e, defaultError: u }).message;
|
|
2111
2246
|
return {
|
|
2112
2247
|
...n,
|
|
2113
2248
|
path: a,
|
|
2114
2249
|
message: u
|
|
2115
2250
|
};
|
|
2116
2251
|
};
|
|
2117
|
-
function
|
|
2118
|
-
const t =
|
|
2252
|
+
function y(r, e) {
|
|
2253
|
+
const t = xs(), s = _s({
|
|
2119
2254
|
issueData: e,
|
|
2120
2255
|
data: r.data,
|
|
2121
2256
|
path: r.path,
|
|
@@ -2126,7 +2261,7 @@ function v(r, e) {
|
|
|
2126
2261
|
// then schema-bound map if available
|
|
2127
2262
|
t,
|
|
2128
2263
|
// then global override map
|
|
2129
|
-
t ===
|
|
2264
|
+
t === tt ? void 0 : tt
|
|
2130
2265
|
// then global default map
|
|
2131
2266
|
].filter((n) => !!n)
|
|
2132
2267
|
});
|
|
@@ -2154,10 +2289,10 @@ class H {
|
|
|
2154
2289
|
static async mergeObjectAsync(e, t) {
|
|
2155
2290
|
const s = [];
|
|
2156
2291
|
for (const n of t) {
|
|
2157
|
-
const a = await n.key,
|
|
2292
|
+
const a = await n.key, d = await n.value;
|
|
2158
2293
|
s.push({
|
|
2159
2294
|
key: a,
|
|
2160
|
-
value:
|
|
2295
|
+
value: d
|
|
2161
2296
|
});
|
|
2162
2297
|
}
|
|
2163
2298
|
return H.mergeObjectSync(e, s);
|
|
@@ -2165,17 +2300,17 @@ class H {
|
|
|
2165
2300
|
static mergeObjectSync(e, t) {
|
|
2166
2301
|
const s = {};
|
|
2167
2302
|
for (const n of t) {
|
|
2168
|
-
const { key: a, value:
|
|
2169
|
-
if (a.status === "aborted" ||
|
|
2303
|
+
const { key: a, value: d } = n;
|
|
2304
|
+
if (a.status === "aborted" || d.status === "aborted")
|
|
2170
2305
|
return j;
|
|
2171
|
-
a.status === "dirty" && e.dirty(),
|
|
2306
|
+
a.status === "dirty" && e.dirty(), d.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof d.value < "u" || n.alwaysSet) && (s[a.value] = d.value);
|
|
2172
2307
|
}
|
|
2173
2308
|
return { status: e.value, value: s };
|
|
2174
2309
|
}
|
|
2175
2310
|
}
|
|
2176
2311
|
const j = Object.freeze({
|
|
2177
2312
|
status: "aborted"
|
|
2178
|
-
}),
|
|
2313
|
+
}), Pe = (r) => ({ status: "dirty", value: r }), J = (r) => ({ status: "valid", value: r }), _t = (r) => r.status === "aborted", bt = (r) => r.status === "dirty", ye = (r) => r.status === "valid", Ve = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
2179
2314
|
var b;
|
|
2180
2315
|
(function(r) {
|
|
2181
2316
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -2188,8 +2323,8 @@ class ae {
|
|
|
2188
2323
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
2189
2324
|
}
|
|
2190
2325
|
}
|
|
2191
|
-
const
|
|
2192
|
-
if (
|
|
2326
|
+
const wt = (r, e) => {
|
|
2327
|
+
if (ye(e))
|
|
2193
2328
|
return { success: !0, data: e.value };
|
|
2194
2329
|
if (!r.common.issues.length)
|
|
2195
2330
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -2209,9 +2344,9 @@ function C(r) {
|
|
|
2209
2344
|
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
|
|
2210
2345
|
if (e && (t || s))
|
|
2211
2346
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
2212
|
-
return e ? { errorMap: e, description: n } : { errorMap: (
|
|
2347
|
+
return e ? { errorMap: e, description: n } : { errorMap: (d, u) => {
|
|
2213
2348
|
const { message: i } = r;
|
|
2214
|
-
return
|
|
2349
|
+
return d.code === "invalid_enum_value" ? { message: i ?? u.defaultError } : typeof u.data > "u" ? { message: i ?? s ?? u.defaultError } : d.code !== "invalid_type" ? { message: u.defaultError } : { message: i ?? t ?? u.defaultError };
|
|
2215
2350
|
}, description: n };
|
|
2216
2351
|
}
|
|
2217
2352
|
class A {
|
|
@@ -2219,13 +2354,13 @@ class A {
|
|
|
2219
2354
|
return this._def.description;
|
|
2220
2355
|
}
|
|
2221
2356
|
_getType(e) {
|
|
2222
|
-
return
|
|
2357
|
+
return re(e.data);
|
|
2223
2358
|
}
|
|
2224
2359
|
_getOrReturnCtx(e, t) {
|
|
2225
2360
|
return t || {
|
|
2226
2361
|
common: e.parent.common,
|
|
2227
2362
|
data: e.data,
|
|
2228
|
-
parsedType:
|
|
2363
|
+
parsedType: re(e.data),
|
|
2229
2364
|
schemaErrorMap: this._def.errorMap,
|
|
2230
2365
|
path: e.path,
|
|
2231
2366
|
parent: e.parent
|
|
@@ -2237,7 +2372,7 @@ class A {
|
|
|
2237
2372
|
ctx: {
|
|
2238
2373
|
common: e.parent.common,
|
|
2239
2374
|
data: e.data,
|
|
2240
|
-
parsedType:
|
|
2375
|
+
parsedType: re(e.data),
|
|
2241
2376
|
schemaErrorMap: this._def.errorMap,
|
|
2242
2377
|
path: e.path,
|
|
2243
2378
|
parent: e.parent
|
|
@@ -2246,7 +2381,7 @@ class A {
|
|
|
2246
2381
|
}
|
|
2247
2382
|
_parseSync(e) {
|
|
2248
2383
|
const t = this._parse(e);
|
|
2249
|
-
if (
|
|
2384
|
+
if (Ve(t))
|
|
2250
2385
|
throw new Error("Synchronous parse encountered promise.");
|
|
2251
2386
|
return t;
|
|
2252
2387
|
}
|
|
@@ -2271,9 +2406,9 @@ class A {
|
|
|
2271
2406
|
schemaErrorMap: this._def.errorMap,
|
|
2272
2407
|
parent: null,
|
|
2273
2408
|
data: e,
|
|
2274
|
-
parsedType:
|
|
2409
|
+
parsedType: re(e)
|
|
2275
2410
|
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
2276
|
-
return
|
|
2411
|
+
return wt(s, n);
|
|
2277
2412
|
}
|
|
2278
2413
|
"~validate"(e) {
|
|
2279
2414
|
const t = {
|
|
@@ -2285,12 +2420,12 @@ class A {
|
|
|
2285
2420
|
schemaErrorMap: this._def.errorMap,
|
|
2286
2421
|
parent: null,
|
|
2287
2422
|
data: e,
|
|
2288
|
-
parsedType:
|
|
2423
|
+
parsedType: re(e)
|
|
2289
2424
|
};
|
|
2290
2425
|
if (!this["~standard"].async)
|
|
2291
2426
|
try {
|
|
2292
2427
|
const s = this._parseSync({ data: e, path: [], parent: t });
|
|
2293
|
-
return
|
|
2428
|
+
return ye(s) ? {
|
|
2294
2429
|
value: s.value
|
|
2295
2430
|
} : {
|
|
2296
2431
|
issues: t.common.issues
|
|
@@ -2301,7 +2436,7 @@ class A {
|
|
|
2301
2436
|
async: !0
|
|
2302
2437
|
};
|
|
2303
2438
|
}
|
|
2304
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((s) =>
|
|
2439
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((s) => ye(s) ? {
|
|
2305
2440
|
value: s.value
|
|
2306
2441
|
} : {
|
|
2307
2442
|
issues: t.common.issues
|
|
@@ -2324,25 +2459,25 @@ class A {
|
|
|
2324
2459
|
schemaErrorMap: this._def.errorMap,
|
|
2325
2460
|
parent: null,
|
|
2326
2461
|
data: e,
|
|
2327
|
-
parsedType:
|
|
2328
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (
|
|
2329
|
-
return
|
|
2462
|
+
parsedType: re(e)
|
|
2463
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (Ve(n) ? n : Promise.resolve(n));
|
|
2464
|
+
return wt(s, a);
|
|
2330
2465
|
}
|
|
2331
2466
|
refine(e, t) {
|
|
2332
2467
|
const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
2333
2468
|
return this._refinement((n, a) => {
|
|
2334
|
-
const
|
|
2469
|
+
const d = e(n), u = () => a.addIssue({
|
|
2335
2470
|
code: g.custom,
|
|
2336
2471
|
...s(n)
|
|
2337
2472
|
});
|
|
2338
|
-
return typeof Promise < "u" &&
|
|
2473
|
+
return typeof Promise < "u" && d instanceof Promise ? d.then((i) => i ? !0 : (u(), !1)) : d ? !0 : (u(), !1);
|
|
2339
2474
|
});
|
|
2340
2475
|
}
|
|
2341
2476
|
refinement(e, t) {
|
|
2342
2477
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
2343
2478
|
}
|
|
2344
2479
|
_refinement(e) {
|
|
2345
|
-
return new
|
|
2480
|
+
return new be({
|
|
2346
2481
|
schema: this,
|
|
2347
2482
|
typeName: N.ZodEffects,
|
|
2348
2483
|
effect: { type: "refinement", refinement: e }
|
|
@@ -2362,7 +2497,7 @@ class A {
|
|
|
2362
2497
|
return ne.create(this, this._def);
|
|
2363
2498
|
}
|
|
2364
2499
|
nullable() {
|
|
2365
|
-
return
|
|
2500
|
+
return we.create(this, this._def);
|
|
2366
2501
|
}
|
|
2367
2502
|
nullish() {
|
|
2368
2503
|
return this.nullable().optional();
|
|
@@ -2371,16 +2506,16 @@ class A {
|
|
|
2371
2506
|
return X.create(this);
|
|
2372
2507
|
}
|
|
2373
2508
|
promise() {
|
|
2374
|
-
return
|
|
2509
|
+
return Ye.create(this, this._def);
|
|
2375
2510
|
}
|
|
2376
2511
|
or(e) {
|
|
2377
|
-
return
|
|
2512
|
+
return We.create([this, e], this._def);
|
|
2378
2513
|
}
|
|
2379
2514
|
and(e) {
|
|
2380
|
-
return
|
|
2515
|
+
return qe.create(this, e, this._def);
|
|
2381
2516
|
}
|
|
2382
2517
|
transform(e) {
|
|
2383
|
-
return new
|
|
2518
|
+
return new be({
|
|
2384
2519
|
...C(this._def),
|
|
2385
2520
|
schema: this,
|
|
2386
2521
|
typeName: N.ZodEffects,
|
|
@@ -2389,7 +2524,7 @@ class A {
|
|
|
2389
2524
|
}
|
|
2390
2525
|
default(e) {
|
|
2391
2526
|
const t = typeof e == "function" ? e : () => e;
|
|
2392
|
-
return new
|
|
2527
|
+
return new st({
|
|
2393
2528
|
...C(this._def),
|
|
2394
2529
|
innerType: this,
|
|
2395
2530
|
defaultValue: t,
|
|
@@ -2397,7 +2532,7 @@ class A {
|
|
|
2397
2532
|
});
|
|
2398
2533
|
}
|
|
2399
2534
|
brand() {
|
|
2400
|
-
return new
|
|
2535
|
+
return new Vs({
|
|
2401
2536
|
typeName: N.ZodBranded,
|
|
2402
2537
|
type: this,
|
|
2403
2538
|
...C(this._def)
|
|
@@ -2405,7 +2540,7 @@ class A {
|
|
|
2405
2540
|
}
|
|
2406
2541
|
catch(e) {
|
|
2407
2542
|
const t = typeof e == "function" ? e : () => e;
|
|
2408
|
-
return new
|
|
2543
|
+
return new nt({
|
|
2409
2544
|
...C(this._def),
|
|
2410
2545
|
innerType: this,
|
|
2411
2546
|
catchValue: t,
|
|
@@ -2420,10 +2555,10 @@ class A {
|
|
|
2420
2555
|
});
|
|
2421
2556
|
}
|
|
2422
2557
|
pipe(e) {
|
|
2423
|
-
return
|
|
2558
|
+
return dt.create(this, e);
|
|
2424
2559
|
}
|
|
2425
2560
|
readonly() {
|
|
2426
|
-
return
|
|
2561
|
+
return at.create(this);
|
|
2427
2562
|
}
|
|
2428
2563
|
isOptional() {
|
|
2429
2564
|
return this.safeParse(void 0).success;
|
|
@@ -2432,28 +2567,28 @@ class A {
|
|
|
2432
2567
|
return this.safeParse(null).success;
|
|
2433
2568
|
}
|
|
2434
2569
|
}
|
|
2435
|
-
const
|
|
2436
|
-
let
|
|
2437
|
-
const
|
|
2438
|
-
function
|
|
2570
|
+
const bs = /^c[^\s-]{8,}$/i, ws = /^[0-9a-z]+$/, ks = /^[0-9A-HJKMNP-TV-Z]{26}$/i, js = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ns = /^[a-z0-9_-]{21}$/i, Es = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Cs = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ss = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Rs = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
2571
|
+
let Je;
|
|
2572
|
+
const As = /^(?:(?: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])$/, Ts = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Os = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ps = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Is = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ms = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, rr = "((\\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])))", Ls = new RegExp(`^${rr}$`);
|
|
2573
|
+
function sr(r) {
|
|
2439
2574
|
let e = "[0-5]\\d";
|
|
2440
2575
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
2441
2576
|
const t = r.precision ? "+" : "?";
|
|
2442
2577
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
2443
2578
|
}
|
|
2444
|
-
function
|
|
2445
|
-
return new RegExp(`^${
|
|
2579
|
+
function $s(r) {
|
|
2580
|
+
return new RegExp(`^${sr(r)}$`);
|
|
2446
2581
|
}
|
|
2447
|
-
function
|
|
2448
|
-
let e = `${
|
|
2582
|
+
function Zs(r) {
|
|
2583
|
+
let e = `${rr}T${sr(r)}`;
|
|
2449
2584
|
const t = [];
|
|
2450
2585
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
2451
2586
|
}
|
|
2452
|
-
function
|
|
2453
|
-
return !!((e === "v4" || !e) &&
|
|
2587
|
+
function Ds(r, e) {
|
|
2588
|
+
return !!((e === "v4" || !e) && As.test(r) || (e === "v6" || !e) && Os.test(r));
|
|
2454
2589
|
}
|
|
2455
|
-
function
|
|
2456
|
-
if (!
|
|
2590
|
+
function Fs(r, e) {
|
|
2591
|
+
if (!Es.test(r))
|
|
2457
2592
|
return !1;
|
|
2458
2593
|
try {
|
|
2459
2594
|
const [t] = r.split(".");
|
|
@@ -2465,16 +2600,16 @@ function Zs(r, e) {
|
|
|
2465
2600
|
return !1;
|
|
2466
2601
|
}
|
|
2467
2602
|
}
|
|
2468
|
-
function
|
|
2469
|
-
return !!((e === "v4" || !e) &&
|
|
2603
|
+
function zs(r, e) {
|
|
2604
|
+
return !!((e === "v4" || !e) && Ts.test(r) || (e === "v6" || !e) && Ps.test(r));
|
|
2470
2605
|
}
|
|
2471
2606
|
class K extends A {
|
|
2472
2607
|
_parse(e) {
|
|
2473
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
2608
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== x.string) {
|
|
2474
2609
|
const a = this._getOrReturnCtx(e);
|
|
2475
|
-
return
|
|
2610
|
+
return y(a, {
|
|
2476
2611
|
code: g.invalid_type,
|
|
2477
|
-
expected:
|
|
2612
|
+
expected: x.string,
|
|
2478
2613
|
received: a.parsedType
|
|
2479
2614
|
}), j;
|
|
2480
2615
|
}
|
|
@@ -2482,7 +2617,7 @@ class K extends A {
|
|
|
2482
2617
|
let n;
|
|
2483
2618
|
for (const a of this._def.checks)
|
|
2484
2619
|
if (a.kind === "min")
|
|
2485
|
-
e.data.length < a.value && (n = this._getOrReturnCtx(e, n),
|
|
2620
|
+
e.data.length < a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2486
2621
|
code: g.too_small,
|
|
2487
2622
|
minimum: a.value,
|
|
2488
2623
|
type: "string",
|
|
@@ -2491,7 +2626,7 @@ class K extends A {
|
|
|
2491
2626
|
message: a.message
|
|
2492
2627
|
}), s.dirty());
|
|
2493
2628
|
else if (a.kind === "max")
|
|
2494
|
-
e.data.length > a.value && (n = this._getOrReturnCtx(e, n),
|
|
2629
|
+
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2495
2630
|
code: g.too_big,
|
|
2496
2631
|
maximum: a.value,
|
|
2497
2632
|
type: "string",
|
|
@@ -2500,15 +2635,15 @@ class K extends A {
|
|
|
2500
2635
|
message: a.message
|
|
2501
2636
|
}), s.dirty());
|
|
2502
2637
|
else if (a.kind === "length") {
|
|
2503
|
-
const
|
|
2504
|
-
(
|
|
2638
|
+
const d = e.data.length > a.value, u = e.data.length < a.value;
|
|
2639
|
+
(d || u) && (n = this._getOrReturnCtx(e, n), d ? y(n, {
|
|
2505
2640
|
code: g.too_big,
|
|
2506
2641
|
maximum: a.value,
|
|
2507
2642
|
type: "string",
|
|
2508
2643
|
inclusive: !0,
|
|
2509
2644
|
exact: !0,
|
|
2510
2645
|
message: a.message
|
|
2511
|
-
}) : u &&
|
|
2646
|
+
}) : u && y(n, {
|
|
2512
2647
|
code: g.too_small,
|
|
2513
2648
|
minimum: a.value,
|
|
2514
2649
|
type: "string",
|
|
@@ -2517,43 +2652,43 @@ class K extends A {
|
|
|
2517
2652
|
message: a.message
|
|
2518
2653
|
}), s.dirty());
|
|
2519
2654
|
} else if (a.kind === "email")
|
|
2520
|
-
|
|
2655
|
+
Ss.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2521
2656
|
validation: "email",
|
|
2522
2657
|
code: g.invalid_string,
|
|
2523
2658
|
message: a.message
|
|
2524
2659
|
}), s.dirty());
|
|
2525
2660
|
else if (a.kind === "emoji")
|
|
2526
|
-
|
|
2661
|
+
Je || (Je = new RegExp(Rs, "u")), Je.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2527
2662
|
validation: "emoji",
|
|
2528
2663
|
code: g.invalid_string,
|
|
2529
2664
|
message: a.message
|
|
2530
2665
|
}), s.dirty());
|
|
2531
2666
|
else if (a.kind === "uuid")
|
|
2532
|
-
|
|
2667
|
+
js.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2533
2668
|
validation: "uuid",
|
|
2534
2669
|
code: g.invalid_string,
|
|
2535
2670
|
message: a.message
|
|
2536
2671
|
}), s.dirty());
|
|
2537
2672
|
else if (a.kind === "nanoid")
|
|
2538
|
-
|
|
2673
|
+
Ns.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2539
2674
|
validation: "nanoid",
|
|
2540
2675
|
code: g.invalid_string,
|
|
2541
2676
|
message: a.message
|
|
2542
2677
|
}), s.dirty());
|
|
2543
2678
|
else if (a.kind === "cuid")
|
|
2544
|
-
|
|
2679
|
+
bs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2545
2680
|
validation: "cuid",
|
|
2546
2681
|
code: g.invalid_string,
|
|
2547
2682
|
message: a.message
|
|
2548
2683
|
}), s.dirty());
|
|
2549
2684
|
else if (a.kind === "cuid2")
|
|
2550
|
-
|
|
2685
|
+
ws.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2551
2686
|
validation: "cuid2",
|
|
2552
2687
|
code: g.invalid_string,
|
|
2553
2688
|
message: a.message
|
|
2554
2689
|
}), s.dirty());
|
|
2555
2690
|
else if (a.kind === "ulid")
|
|
2556
|
-
|
|
2691
|
+
ks.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2557
2692
|
validation: "ulid",
|
|
2558
2693
|
code: g.invalid_string,
|
|
2559
2694
|
message: a.message
|
|
@@ -2562,61 +2697,61 @@ class K extends A {
|
|
|
2562
2697
|
try {
|
|
2563
2698
|
new URL(e.data);
|
|
2564
2699
|
} catch {
|
|
2565
|
-
n = this._getOrReturnCtx(e, n),
|
|
2700
|
+
n = this._getOrReturnCtx(e, n), y(n, {
|
|
2566
2701
|
validation: "url",
|
|
2567
2702
|
code: g.invalid_string,
|
|
2568
2703
|
message: a.message
|
|
2569
2704
|
}), s.dirty();
|
|
2570
2705
|
}
|
|
2571
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
2706
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2572
2707
|
validation: "regex",
|
|
2573
2708
|
code: g.invalid_string,
|
|
2574
2709
|
message: a.message
|
|
2575
|
-
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n),
|
|
2710
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2576
2711
|
code: g.invalid_string,
|
|
2577
2712
|
validation: { includes: a.value, position: a.position },
|
|
2578
2713
|
message: a.message
|
|
2579
|
-
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n),
|
|
2714
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2580
2715
|
code: g.invalid_string,
|
|
2581
2716
|
validation: { startsWith: a.value },
|
|
2582
2717
|
message: a.message
|
|
2583
|
-
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n),
|
|
2718
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2584
2719
|
code: g.invalid_string,
|
|
2585
2720
|
validation: { endsWith: a.value },
|
|
2586
2721
|
message: a.message
|
|
2587
|
-
}), s.dirty()) : a.kind === "datetime" ?
|
|
2722
|
+
}), s.dirty()) : a.kind === "datetime" ? Zs(a).test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2588
2723
|
code: g.invalid_string,
|
|
2589
2724
|
validation: "datetime",
|
|
2590
2725
|
message: a.message
|
|
2591
|
-
}), s.dirty()) : a.kind === "date" ?
|
|
2726
|
+
}), s.dirty()) : a.kind === "date" ? Ls.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2592
2727
|
code: g.invalid_string,
|
|
2593
2728
|
validation: "date",
|
|
2594
2729
|
message: a.message
|
|
2595
|
-
}), s.dirty()) : a.kind === "time" ?
|
|
2730
|
+
}), s.dirty()) : a.kind === "time" ? $s(a).test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2596
2731
|
code: g.invalid_string,
|
|
2597
2732
|
validation: "time",
|
|
2598
2733
|
message: a.message
|
|
2599
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
2734
|
+
}), s.dirty()) : a.kind === "duration" ? Cs.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2600
2735
|
validation: "duration",
|
|
2601
2736
|
code: g.invalid_string,
|
|
2602
2737
|
message: a.message
|
|
2603
|
-
}), s.dirty()) : a.kind === "ip" ?
|
|
2738
|
+
}), s.dirty()) : a.kind === "ip" ? Ds(e.data, a.version) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2604
2739
|
validation: "ip",
|
|
2605
2740
|
code: g.invalid_string,
|
|
2606
2741
|
message: a.message
|
|
2607
|
-
}), s.dirty()) : a.kind === "jwt" ?
|
|
2742
|
+
}), s.dirty()) : a.kind === "jwt" ? Fs(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2608
2743
|
validation: "jwt",
|
|
2609
2744
|
code: g.invalid_string,
|
|
2610
2745
|
message: a.message
|
|
2611
|
-
}), s.dirty()) : a.kind === "cidr" ?
|
|
2746
|
+
}), s.dirty()) : a.kind === "cidr" ? zs(e.data, a.version) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2612
2747
|
validation: "cidr",
|
|
2613
2748
|
code: g.invalid_string,
|
|
2614
2749
|
message: a.message
|
|
2615
|
-
}), s.dirty()) : a.kind === "base64" ?
|
|
2750
|
+
}), s.dirty()) : a.kind === "base64" ? Is.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2616
2751
|
validation: "base64",
|
|
2617
2752
|
code: g.invalid_string,
|
|
2618
2753
|
message: a.message
|
|
2619
|
-
}), s.dirty()) : a.kind === "base64url" ?
|
|
2754
|
+
}), s.dirty()) : a.kind === "base64url" ? Ms.test(e.data) || (n = this._getOrReturnCtx(e, n), y(n, {
|
|
2620
2755
|
validation: "base64url",
|
|
2621
2756
|
code: g.invalid_string,
|
|
2622
2757
|
message: a.message
|
|
@@ -2851,50 +2986,50 @@ K.create = (r) => new K({
|
|
|
2851
2986
|
coerce: r?.coerce ?? !1,
|
|
2852
2987
|
...C(r)
|
|
2853
2988
|
});
|
|
2854
|
-
function
|
|
2855
|
-
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = Number.parseInt(r.toFixed(n).replace(".", "")),
|
|
2856
|
-
return a %
|
|
2989
|
+
function Us(r, e) {
|
|
2990
|
+
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = Number.parseInt(r.toFixed(n).replace(".", "")), d = Number.parseInt(e.toFixed(n).replace(".", ""));
|
|
2991
|
+
return a % d / 10 ** n;
|
|
2857
2992
|
}
|
|
2858
|
-
class
|
|
2993
|
+
class fe extends A {
|
|
2859
2994
|
constructor() {
|
|
2860
2995
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
2861
2996
|
}
|
|
2862
2997
|
_parse(e) {
|
|
2863
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
2998
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== x.number) {
|
|
2864
2999
|
const a = this._getOrReturnCtx(e);
|
|
2865
|
-
return
|
|
3000
|
+
return y(a, {
|
|
2866
3001
|
code: g.invalid_type,
|
|
2867
|
-
expected:
|
|
3002
|
+
expected: x.number,
|
|
2868
3003
|
received: a.parsedType
|
|
2869
3004
|
}), j;
|
|
2870
3005
|
}
|
|
2871
3006
|
let s;
|
|
2872
3007
|
const n = new H();
|
|
2873
3008
|
for (const a of this._def.checks)
|
|
2874
|
-
a.kind === "int" ? T.isInteger(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
3009
|
+
a.kind === "int" ? T.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2875
3010
|
code: g.invalid_type,
|
|
2876
3011
|
expected: "integer",
|
|
2877
3012
|
received: "float",
|
|
2878
3013
|
message: a.message
|
|
2879
|
-
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3014
|
+
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2880
3015
|
code: g.too_small,
|
|
2881
3016
|
minimum: a.value,
|
|
2882
3017
|
type: "number",
|
|
2883
3018
|
inclusive: a.inclusive,
|
|
2884
3019
|
exact: !1,
|
|
2885
3020
|
message: a.message
|
|
2886
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3021
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2887
3022
|
code: g.too_big,
|
|
2888
3023
|
maximum: a.value,
|
|
2889
3024
|
type: "number",
|
|
2890
3025
|
inclusive: a.inclusive,
|
|
2891
3026
|
exact: !1,
|
|
2892
3027
|
message: a.message
|
|
2893
|
-
}), n.dirty()) : a.kind === "multipleOf" ?
|
|
3028
|
+
}), n.dirty()) : a.kind === "multipleOf" ? Us(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2894
3029
|
code: g.not_multiple_of,
|
|
2895
3030
|
multipleOf: a.value,
|
|
2896
3031
|
message: a.message
|
|
2897
|
-
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
3032
|
+
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), y(s, {
|
|
2898
3033
|
code: g.not_finite,
|
|
2899
3034
|
message: a.message
|
|
2900
3035
|
}), n.dirty()) : T.assertNever(a);
|
|
@@ -2913,7 +3048,7 @@ class de extends A {
|
|
|
2913
3048
|
return this.setLimit("max", e, !1, b.toString(t));
|
|
2914
3049
|
}
|
|
2915
3050
|
setLimit(e, t, s, n) {
|
|
2916
|
-
return new
|
|
3051
|
+
return new fe({
|
|
2917
3052
|
...this._def,
|
|
2918
3053
|
checks: [
|
|
2919
3054
|
...this._def.checks,
|
|
@@ -2927,7 +3062,7 @@ class de extends A {
|
|
|
2927
3062
|
});
|
|
2928
3063
|
}
|
|
2929
3064
|
_addCheck(e) {
|
|
2930
|
-
return new
|
|
3065
|
+
return new fe({
|
|
2931
3066
|
...this._def,
|
|
2932
3067
|
checks: [...this._def.checks, e]
|
|
2933
3068
|
});
|
|
@@ -3021,13 +3156,13 @@ class de extends A {
|
|
|
3021
3156
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
3022
3157
|
}
|
|
3023
3158
|
}
|
|
3024
|
-
|
|
3159
|
+
fe.create = (r) => new fe({
|
|
3025
3160
|
checks: [],
|
|
3026
3161
|
typeName: N.ZodNumber,
|
|
3027
3162
|
coerce: r?.coerce || !1,
|
|
3028
3163
|
...C(r)
|
|
3029
3164
|
});
|
|
3030
|
-
class
|
|
3165
|
+
class he extends A {
|
|
3031
3166
|
constructor() {
|
|
3032
3167
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
3033
3168
|
}
|
|
@@ -3038,24 +3173,24 @@ class ue extends A {
|
|
|
3038
3173
|
} catch {
|
|
3039
3174
|
return this._getInvalidInput(e);
|
|
3040
3175
|
}
|
|
3041
|
-
if (this._getType(e) !==
|
|
3176
|
+
if (this._getType(e) !== x.bigint)
|
|
3042
3177
|
return this._getInvalidInput(e);
|
|
3043
3178
|
let s;
|
|
3044
3179
|
const n = new H();
|
|
3045
3180
|
for (const a of this._def.checks)
|
|
3046
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3181
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
3047
3182
|
code: g.too_small,
|
|
3048
3183
|
type: "bigint",
|
|
3049
3184
|
minimum: a.value,
|
|
3050
3185
|
inclusive: a.inclusive,
|
|
3051
3186
|
message: a.message
|
|
3052
|
-
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s),
|
|
3187
|
+
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
3053
3188
|
code: g.too_big,
|
|
3054
3189
|
type: "bigint",
|
|
3055
3190
|
maximum: a.value,
|
|
3056
3191
|
inclusive: a.inclusive,
|
|
3057
3192
|
message: a.message
|
|
3058
|
-
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s),
|
|
3193
|
+
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), y(s, {
|
|
3059
3194
|
code: g.not_multiple_of,
|
|
3060
3195
|
multipleOf: a.value,
|
|
3061
3196
|
message: a.message
|
|
@@ -3064,9 +3199,9 @@ class ue extends A {
|
|
|
3064
3199
|
}
|
|
3065
3200
|
_getInvalidInput(e) {
|
|
3066
3201
|
const t = this._getOrReturnCtx(e);
|
|
3067
|
-
return
|
|
3202
|
+
return y(t, {
|
|
3068
3203
|
code: g.invalid_type,
|
|
3069
|
-
expected:
|
|
3204
|
+
expected: x.bigint,
|
|
3070
3205
|
received: t.parsedType
|
|
3071
3206
|
}), j;
|
|
3072
3207
|
}
|
|
@@ -3083,7 +3218,7 @@ class ue extends A {
|
|
|
3083
3218
|
return this.setLimit("max", e, !1, b.toString(t));
|
|
3084
3219
|
}
|
|
3085
3220
|
setLimit(e, t, s, n) {
|
|
3086
|
-
return new
|
|
3221
|
+
return new he({
|
|
3087
3222
|
...this._def,
|
|
3088
3223
|
checks: [
|
|
3089
3224
|
...this._def.checks,
|
|
@@ -3097,7 +3232,7 @@ class ue extends A {
|
|
|
3097
3232
|
});
|
|
3098
3233
|
}
|
|
3099
3234
|
_addCheck(e) {
|
|
3100
|
-
return new
|
|
3235
|
+
return new he({
|
|
3101
3236
|
...this._def,
|
|
3102
3237
|
checks: [...this._def.checks, e]
|
|
3103
3238
|
});
|
|
@@ -3154,57 +3289,57 @@ class ue extends A {
|
|
|
3154
3289
|
return e;
|
|
3155
3290
|
}
|
|
3156
3291
|
}
|
|
3157
|
-
|
|
3292
|
+
he.create = (r) => new he({
|
|
3158
3293
|
checks: [],
|
|
3159
3294
|
typeName: N.ZodBigInt,
|
|
3160
3295
|
coerce: r?.coerce ?? !1,
|
|
3161
3296
|
...C(r)
|
|
3162
3297
|
});
|
|
3163
|
-
class
|
|
3298
|
+
class Be extends A {
|
|
3164
3299
|
_parse(e) {
|
|
3165
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
3300
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== x.boolean) {
|
|
3166
3301
|
const s = this._getOrReturnCtx(e);
|
|
3167
|
-
return
|
|
3302
|
+
return y(s, {
|
|
3168
3303
|
code: g.invalid_type,
|
|
3169
|
-
expected:
|
|
3304
|
+
expected: x.boolean,
|
|
3170
3305
|
received: s.parsedType
|
|
3171
3306
|
}), j;
|
|
3172
3307
|
}
|
|
3173
3308
|
return J(e.data);
|
|
3174
3309
|
}
|
|
3175
3310
|
}
|
|
3176
|
-
|
|
3311
|
+
Be.create = (r) => new Be({
|
|
3177
3312
|
typeName: N.ZodBoolean,
|
|
3178
3313
|
coerce: r?.coerce || !1,
|
|
3179
3314
|
...C(r)
|
|
3180
3315
|
});
|
|
3181
|
-
class
|
|
3316
|
+
class xe extends A {
|
|
3182
3317
|
_parse(e) {
|
|
3183
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
3318
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== x.date) {
|
|
3184
3319
|
const a = this._getOrReturnCtx(e);
|
|
3185
|
-
return
|
|
3320
|
+
return y(a, {
|
|
3186
3321
|
code: g.invalid_type,
|
|
3187
|
-
expected:
|
|
3322
|
+
expected: x.date,
|
|
3188
3323
|
received: a.parsedType
|
|
3189
3324
|
}), j;
|
|
3190
3325
|
}
|
|
3191
3326
|
if (Number.isNaN(e.data.getTime())) {
|
|
3192
3327
|
const a = this._getOrReturnCtx(e);
|
|
3193
|
-
return
|
|
3328
|
+
return y(a, {
|
|
3194
3329
|
code: g.invalid_date
|
|
3195
3330
|
}), j;
|
|
3196
3331
|
}
|
|
3197
3332
|
const s = new H();
|
|
3198
3333
|
let n;
|
|
3199
3334
|
for (const a of this._def.checks)
|
|
3200
|
-
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n),
|
|
3335
|
+
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
3201
3336
|
code: g.too_small,
|
|
3202
3337
|
message: a.message,
|
|
3203
3338
|
inclusive: !0,
|
|
3204
3339
|
exact: !1,
|
|
3205
3340
|
minimum: a.value,
|
|
3206
3341
|
type: "date"
|
|
3207
|
-
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n),
|
|
3342
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), y(n, {
|
|
3208
3343
|
code: g.too_big,
|
|
3209
3344
|
message: a.message,
|
|
3210
3345
|
inclusive: !0,
|
|
@@ -3218,7 +3353,7 @@ class ye extends A {
|
|
|
3218
3353
|
};
|
|
3219
3354
|
}
|
|
3220
3355
|
_addCheck(e) {
|
|
3221
|
-
return new
|
|
3356
|
+
return new xe({
|
|
3222
3357
|
...this._def,
|
|
3223
3358
|
checks: [...this._def.checks, e]
|
|
3224
3359
|
});
|
|
@@ -3250,64 +3385,64 @@ class ye extends A {
|
|
|
3250
3385
|
return e != null ? new Date(e) : null;
|
|
3251
3386
|
}
|
|
3252
3387
|
}
|
|
3253
|
-
|
|
3388
|
+
xe.create = (r) => new xe({
|
|
3254
3389
|
checks: [],
|
|
3255
3390
|
coerce: r?.coerce || !1,
|
|
3256
3391
|
typeName: N.ZodDate,
|
|
3257
3392
|
...C(r)
|
|
3258
3393
|
});
|
|
3259
|
-
class
|
|
3394
|
+
class kt extends A {
|
|
3260
3395
|
_parse(e) {
|
|
3261
|
-
if (this._getType(e) !==
|
|
3396
|
+
if (this._getType(e) !== x.symbol) {
|
|
3262
3397
|
const s = this._getOrReturnCtx(e);
|
|
3263
|
-
return
|
|
3398
|
+
return y(s, {
|
|
3264
3399
|
code: g.invalid_type,
|
|
3265
|
-
expected:
|
|
3400
|
+
expected: x.symbol,
|
|
3266
3401
|
received: s.parsedType
|
|
3267
3402
|
}), j;
|
|
3268
3403
|
}
|
|
3269
3404
|
return J(e.data);
|
|
3270
3405
|
}
|
|
3271
3406
|
}
|
|
3272
|
-
|
|
3407
|
+
kt.create = (r) => new kt({
|
|
3273
3408
|
typeName: N.ZodSymbol,
|
|
3274
3409
|
...C(r)
|
|
3275
3410
|
});
|
|
3276
|
-
class
|
|
3411
|
+
class jt extends A {
|
|
3277
3412
|
_parse(e) {
|
|
3278
|
-
if (this._getType(e) !==
|
|
3413
|
+
if (this._getType(e) !== x.undefined) {
|
|
3279
3414
|
const s = this._getOrReturnCtx(e);
|
|
3280
|
-
return
|
|
3415
|
+
return y(s, {
|
|
3281
3416
|
code: g.invalid_type,
|
|
3282
|
-
expected:
|
|
3417
|
+
expected: x.undefined,
|
|
3283
3418
|
received: s.parsedType
|
|
3284
3419
|
}), j;
|
|
3285
3420
|
}
|
|
3286
3421
|
return J(e.data);
|
|
3287
3422
|
}
|
|
3288
3423
|
}
|
|
3289
|
-
|
|
3424
|
+
jt.create = (r) => new jt({
|
|
3290
3425
|
typeName: N.ZodUndefined,
|
|
3291
3426
|
...C(r)
|
|
3292
3427
|
});
|
|
3293
|
-
class
|
|
3428
|
+
class Nt extends A {
|
|
3294
3429
|
_parse(e) {
|
|
3295
|
-
if (this._getType(e) !==
|
|
3430
|
+
if (this._getType(e) !== x.null) {
|
|
3296
3431
|
const s = this._getOrReturnCtx(e);
|
|
3297
|
-
return
|
|
3432
|
+
return y(s, {
|
|
3298
3433
|
code: g.invalid_type,
|
|
3299
|
-
expected:
|
|
3434
|
+
expected: x.null,
|
|
3300
3435
|
received: s.parsedType
|
|
3301
3436
|
}), j;
|
|
3302
3437
|
}
|
|
3303
3438
|
return J(e.data);
|
|
3304
3439
|
}
|
|
3305
3440
|
}
|
|
3306
|
-
|
|
3441
|
+
Nt.create = (r) => new Nt({
|
|
3307
3442
|
typeName: N.ZodNull,
|
|
3308
3443
|
...C(r)
|
|
3309
3444
|
});
|
|
3310
|
-
class
|
|
3445
|
+
class Et extends A {
|
|
3311
3446
|
constructor() {
|
|
3312
3447
|
super(...arguments), this._any = !0;
|
|
3313
3448
|
}
|
|
@@ -3315,11 +3450,11 @@ class Nt extends A {
|
|
|
3315
3450
|
return J(e.data);
|
|
3316
3451
|
}
|
|
3317
3452
|
}
|
|
3318
|
-
|
|
3453
|
+
Et.create = (r) => new Et({
|
|
3319
3454
|
typeName: N.ZodAny,
|
|
3320
3455
|
...C(r)
|
|
3321
3456
|
});
|
|
3322
|
-
class
|
|
3457
|
+
class Ct extends A {
|
|
3323
3458
|
constructor() {
|
|
3324
3459
|
super(...arguments), this._unknown = !0;
|
|
3325
3460
|
}
|
|
@@ -3327,16 +3462,16 @@ class Et extends A {
|
|
|
3327
3462
|
return J(e.data);
|
|
3328
3463
|
}
|
|
3329
3464
|
}
|
|
3330
|
-
|
|
3465
|
+
Ct.create = (r) => new Ct({
|
|
3331
3466
|
typeName: N.ZodUnknown,
|
|
3332
3467
|
...C(r)
|
|
3333
3468
|
});
|
|
3334
3469
|
class ie extends A {
|
|
3335
3470
|
_parse(e) {
|
|
3336
3471
|
const t = this._getOrReturnCtx(e);
|
|
3337
|
-
return
|
|
3472
|
+
return y(t, {
|
|
3338
3473
|
code: g.invalid_type,
|
|
3339
|
-
expected:
|
|
3474
|
+
expected: x.never,
|
|
3340
3475
|
received: t.parsedType
|
|
3341
3476
|
}), j;
|
|
3342
3477
|
}
|
|
@@ -3345,52 +3480,52 @@ ie.create = (r) => new ie({
|
|
|
3345
3480
|
typeName: N.ZodNever,
|
|
3346
3481
|
...C(r)
|
|
3347
3482
|
});
|
|
3348
|
-
class
|
|
3483
|
+
class St extends A {
|
|
3349
3484
|
_parse(e) {
|
|
3350
|
-
if (this._getType(e) !==
|
|
3485
|
+
if (this._getType(e) !== x.undefined) {
|
|
3351
3486
|
const s = this._getOrReturnCtx(e);
|
|
3352
|
-
return
|
|
3487
|
+
return y(s, {
|
|
3353
3488
|
code: g.invalid_type,
|
|
3354
|
-
expected:
|
|
3489
|
+
expected: x.void,
|
|
3355
3490
|
received: s.parsedType
|
|
3356
3491
|
}), j;
|
|
3357
3492
|
}
|
|
3358
3493
|
return J(e.data);
|
|
3359
3494
|
}
|
|
3360
3495
|
}
|
|
3361
|
-
|
|
3496
|
+
St.create = (r) => new St({
|
|
3362
3497
|
typeName: N.ZodVoid,
|
|
3363
3498
|
...C(r)
|
|
3364
3499
|
});
|
|
3365
3500
|
class X extends A {
|
|
3366
3501
|
_parse(e) {
|
|
3367
3502
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
3368
|
-
if (t.parsedType !==
|
|
3369
|
-
return
|
|
3503
|
+
if (t.parsedType !== x.array)
|
|
3504
|
+
return y(t, {
|
|
3370
3505
|
code: g.invalid_type,
|
|
3371
|
-
expected:
|
|
3506
|
+
expected: x.array,
|
|
3372
3507
|
received: t.parsedType
|
|
3373
3508
|
}), j;
|
|
3374
3509
|
if (n.exactLength !== null) {
|
|
3375
|
-
const
|
|
3376
|
-
(
|
|
3377
|
-
code:
|
|
3510
|
+
const d = t.data.length > n.exactLength.value, u = t.data.length < n.exactLength.value;
|
|
3511
|
+
(d || u) && (y(t, {
|
|
3512
|
+
code: d ? g.too_big : g.too_small,
|
|
3378
3513
|
minimum: u ? n.exactLength.value : void 0,
|
|
3379
|
-
maximum:
|
|
3514
|
+
maximum: d ? n.exactLength.value : void 0,
|
|
3380
3515
|
type: "array",
|
|
3381
3516
|
inclusive: !0,
|
|
3382
3517
|
exact: !0,
|
|
3383
3518
|
message: n.exactLength.message
|
|
3384
3519
|
}), s.dirty());
|
|
3385
3520
|
}
|
|
3386
|
-
if (n.minLength !== null && t.data.length < n.minLength.value && (
|
|
3521
|
+
if (n.minLength !== null && t.data.length < n.minLength.value && (y(t, {
|
|
3387
3522
|
code: g.too_small,
|
|
3388
3523
|
minimum: n.minLength.value,
|
|
3389
3524
|
type: "array",
|
|
3390
3525
|
inclusive: !0,
|
|
3391
3526
|
exact: !1,
|
|
3392
3527
|
message: n.minLength.message
|
|
3393
|
-
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (
|
|
3528
|
+
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (y(t, {
|
|
3394
3529
|
code: g.too_big,
|
|
3395
3530
|
maximum: n.maxLength.value,
|
|
3396
3531
|
type: "array",
|
|
@@ -3398,8 +3533,8 @@ class X extends A {
|
|
|
3398
3533
|
exact: !1,
|
|
3399
3534
|
message: n.maxLength.message
|
|
3400
3535
|
}), s.dirty()), t.common.async)
|
|
3401
|
-
return Promise.all([...t.data].map((
|
|
3402
|
-
const a = [...t.data].map((
|
|
3536
|
+
return Promise.all([...t.data].map((d, u) => n.type._parseAsync(new ae(t, d, t.path, u)))).then((d) => H.mergeArray(s, d));
|
|
3537
|
+
const a = [...t.data].map((d, u) => n.type._parseSync(new ae(t, d, t.path, u)));
|
|
3403
3538
|
return H.mergeArray(s, a);
|
|
3404
3539
|
}
|
|
3405
3540
|
get element() {
|
|
@@ -3435,23 +3570,23 @@ X.create = (r, e) => new X({
|
|
|
3435
3570
|
typeName: N.ZodArray,
|
|
3436
3571
|
...C(e)
|
|
3437
3572
|
});
|
|
3438
|
-
function
|
|
3439
|
-
if (r instanceof
|
|
3573
|
+
function ge(r) {
|
|
3574
|
+
if (r instanceof z) {
|
|
3440
3575
|
const e = {};
|
|
3441
3576
|
for (const t in r.shape) {
|
|
3442
3577
|
const s = r.shape[t];
|
|
3443
|
-
e[t] = ne.create(
|
|
3578
|
+
e[t] = ne.create(ge(s));
|
|
3444
3579
|
}
|
|
3445
|
-
return new
|
|
3580
|
+
return new z({
|
|
3446
3581
|
...r._def,
|
|
3447
3582
|
shape: () => e
|
|
3448
3583
|
});
|
|
3449
3584
|
} else return r instanceof X ? new X({
|
|
3450
3585
|
...r._def,
|
|
3451
|
-
type:
|
|
3452
|
-
}) : r instanceof ne ? ne.create(
|
|
3586
|
+
type: ge(r.element)
|
|
3587
|
+
}) : r instanceof ne ? ne.create(ge(r.unwrap())) : r instanceof we ? we.create(ge(r.unwrap())) : r instanceof me ? me.create(r.items.map((e) => ge(e))) : r;
|
|
3453
3588
|
}
|
|
3454
|
-
class
|
|
3589
|
+
class z extends A {
|
|
3455
3590
|
constructor() {
|
|
3456
3591
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
3457
3592
|
}
|
|
@@ -3462,63 +3597,63 @@ class F extends A {
|
|
|
3462
3597
|
return this._cached = { shape: e, keys: t }, this._cached;
|
|
3463
3598
|
}
|
|
3464
3599
|
_parse(e) {
|
|
3465
|
-
if (this._getType(e) !==
|
|
3600
|
+
if (this._getType(e) !== x.object) {
|
|
3466
3601
|
const o = this._getOrReturnCtx(e);
|
|
3467
|
-
return
|
|
3602
|
+
return y(o, {
|
|
3468
3603
|
code: g.invalid_type,
|
|
3469
|
-
expected:
|
|
3604
|
+
expected: x.object,
|
|
3470
3605
|
received: o.parsedType
|
|
3471
3606
|
}), j;
|
|
3472
3607
|
}
|
|
3473
|
-
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys:
|
|
3608
|
+
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: d } = this._getCached(), u = [];
|
|
3474
3609
|
if (!(this._def.catchall instanceof ie && this._def.unknownKeys === "strip"))
|
|
3475
3610
|
for (const o in n.data)
|
|
3476
|
-
|
|
3611
|
+
d.includes(o) || u.push(o);
|
|
3477
3612
|
const i = [];
|
|
3478
|
-
for (const o of
|
|
3479
|
-
const
|
|
3613
|
+
for (const o of d) {
|
|
3614
|
+
const c = a[o], f = n.data[o];
|
|
3480
3615
|
i.push({
|
|
3481
3616
|
key: { status: "valid", value: o },
|
|
3482
|
-
value:
|
|
3617
|
+
value: c._parse(new ae(n, f, n.path, o)),
|
|
3483
3618
|
alwaysSet: o in n.data
|
|
3484
3619
|
});
|
|
3485
3620
|
}
|
|
3486
3621
|
if (this._def.catchall instanceof ie) {
|
|
3487
3622
|
const o = this._def.unknownKeys;
|
|
3488
3623
|
if (o === "passthrough")
|
|
3489
|
-
for (const
|
|
3624
|
+
for (const c of u)
|
|
3490
3625
|
i.push({
|
|
3491
|
-
key: { status: "valid", value:
|
|
3492
|
-
value: { status: "valid", value: n.data[
|
|
3626
|
+
key: { status: "valid", value: c },
|
|
3627
|
+
value: { status: "valid", value: n.data[c] }
|
|
3493
3628
|
});
|
|
3494
3629
|
else if (o === "strict")
|
|
3495
|
-
u.length > 0 && (
|
|
3630
|
+
u.length > 0 && (y(n, {
|
|
3496
3631
|
code: g.unrecognized_keys,
|
|
3497
3632
|
keys: u
|
|
3498
3633
|
}), s.dirty());
|
|
3499
3634
|
else if (o !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
3500
3635
|
} else {
|
|
3501
3636
|
const o = this._def.catchall;
|
|
3502
|
-
for (const
|
|
3503
|
-
const f = n.data[
|
|
3637
|
+
for (const c of u) {
|
|
3638
|
+
const f = n.data[c];
|
|
3504
3639
|
i.push({
|
|
3505
|
-
key: { status: "valid", value:
|
|
3640
|
+
key: { status: "valid", value: c },
|
|
3506
3641
|
value: o._parse(
|
|
3507
|
-
new ae(n, f, n.path,
|
|
3642
|
+
new ae(n, f, n.path, c)
|
|
3508
3643
|
//, ctx.child(key), value, getParsedType(value)
|
|
3509
3644
|
),
|
|
3510
|
-
alwaysSet:
|
|
3645
|
+
alwaysSet: c in n.data
|
|
3511
3646
|
});
|
|
3512
3647
|
}
|
|
3513
3648
|
}
|
|
3514
3649
|
return n.common.async ? Promise.resolve().then(async () => {
|
|
3515
3650
|
const o = [];
|
|
3516
|
-
for (const
|
|
3517
|
-
const f = await
|
|
3651
|
+
for (const c of i) {
|
|
3652
|
+
const f = await c.key, h = await c.value;
|
|
3518
3653
|
o.push({
|
|
3519
3654
|
key: f,
|
|
3520
3655
|
value: h,
|
|
3521
|
-
alwaysSet:
|
|
3656
|
+
alwaysSet: c.alwaysSet
|
|
3522
3657
|
});
|
|
3523
3658
|
}
|
|
3524
3659
|
return o;
|
|
@@ -3528,7 +3663,7 @@ class F extends A {
|
|
|
3528
3663
|
return this._def.shape();
|
|
3529
3664
|
}
|
|
3530
3665
|
strict(e) {
|
|
3531
|
-
return b.errToObj, new
|
|
3666
|
+
return b.errToObj, new z({
|
|
3532
3667
|
...this._def,
|
|
3533
3668
|
unknownKeys: "strict",
|
|
3534
3669
|
...e !== void 0 ? {
|
|
@@ -3544,13 +3679,13 @@ class F extends A {
|
|
|
3544
3679
|
});
|
|
3545
3680
|
}
|
|
3546
3681
|
strip() {
|
|
3547
|
-
return new
|
|
3682
|
+
return new z({
|
|
3548
3683
|
...this._def,
|
|
3549
3684
|
unknownKeys: "strip"
|
|
3550
3685
|
});
|
|
3551
3686
|
}
|
|
3552
3687
|
passthrough() {
|
|
3553
|
-
return new
|
|
3688
|
+
return new z({
|
|
3554
3689
|
...this._def,
|
|
3555
3690
|
unknownKeys: "passthrough"
|
|
3556
3691
|
});
|
|
@@ -3573,7 +3708,7 @@ class F extends A {
|
|
|
3573
3708
|
// }) as any;
|
|
3574
3709
|
// };
|
|
3575
3710
|
extend(e) {
|
|
3576
|
-
return new
|
|
3711
|
+
return new z({
|
|
3577
3712
|
...this._def,
|
|
3578
3713
|
shape: () => ({
|
|
3579
3714
|
...this._def.shape(),
|
|
@@ -3587,7 +3722,7 @@ class F extends A {
|
|
|
3587
3722
|
* upgrade if you are experiencing issues.
|
|
3588
3723
|
*/
|
|
3589
3724
|
merge(e) {
|
|
3590
|
-
return new
|
|
3725
|
+
return new z({
|
|
3591
3726
|
unknownKeys: e._def.unknownKeys,
|
|
3592
3727
|
catchall: e._def.catchall,
|
|
3593
3728
|
shape: () => ({
|
|
@@ -3657,7 +3792,7 @@ class F extends A {
|
|
|
3657
3792
|
// return merged;
|
|
3658
3793
|
// }
|
|
3659
3794
|
catchall(e) {
|
|
3660
|
-
return new
|
|
3795
|
+
return new z({
|
|
3661
3796
|
...this._def,
|
|
3662
3797
|
catchall: e
|
|
3663
3798
|
});
|
|
@@ -3666,7 +3801,7 @@ class F extends A {
|
|
|
3666
3801
|
const t = {};
|
|
3667
3802
|
for (const s of T.objectKeys(e))
|
|
3668
3803
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
3669
|
-
return new
|
|
3804
|
+
return new z({
|
|
3670
3805
|
...this._def,
|
|
3671
3806
|
shape: () => t
|
|
3672
3807
|
});
|
|
@@ -3675,7 +3810,7 @@ class F extends A {
|
|
|
3675
3810
|
const t = {};
|
|
3676
3811
|
for (const s of T.objectKeys(this.shape))
|
|
3677
3812
|
e[s] || (t[s] = this.shape[s]);
|
|
3678
|
-
return new
|
|
3813
|
+
return new z({
|
|
3679
3814
|
...this._def,
|
|
3680
3815
|
shape: () => t
|
|
3681
3816
|
});
|
|
@@ -3684,7 +3819,7 @@ class F extends A {
|
|
|
3684
3819
|
* @deprecated
|
|
3685
3820
|
*/
|
|
3686
3821
|
deepPartial() {
|
|
3687
|
-
return
|
|
3822
|
+
return ge(this);
|
|
3688
3823
|
}
|
|
3689
3824
|
partial(e) {
|
|
3690
3825
|
const t = {};
|
|
@@ -3692,7 +3827,7 @@ class F extends A {
|
|
|
3692
3827
|
const n = this.shape[s];
|
|
3693
3828
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
3694
3829
|
}
|
|
3695
|
-
return new
|
|
3830
|
+
return new z({
|
|
3696
3831
|
...this._def,
|
|
3697
3832
|
shape: () => t
|
|
3698
3833
|
});
|
|
@@ -3708,37 +3843,37 @@ class F extends A {
|
|
|
3708
3843
|
a = a._def.innerType;
|
|
3709
3844
|
t[s] = a;
|
|
3710
3845
|
}
|
|
3711
|
-
return new
|
|
3846
|
+
return new z({
|
|
3712
3847
|
...this._def,
|
|
3713
3848
|
shape: () => t
|
|
3714
3849
|
});
|
|
3715
3850
|
}
|
|
3716
3851
|
keyof() {
|
|
3717
|
-
return
|
|
3852
|
+
return nr(T.objectKeys(this.shape));
|
|
3718
3853
|
}
|
|
3719
3854
|
}
|
|
3720
|
-
|
|
3855
|
+
z.create = (r, e) => new z({
|
|
3721
3856
|
shape: () => r,
|
|
3722
3857
|
unknownKeys: "strip",
|
|
3723
3858
|
catchall: ie.create(),
|
|
3724
3859
|
typeName: N.ZodObject,
|
|
3725
3860
|
...C(e)
|
|
3726
3861
|
});
|
|
3727
|
-
|
|
3862
|
+
z.strictCreate = (r, e) => new z({
|
|
3728
3863
|
shape: () => r,
|
|
3729
3864
|
unknownKeys: "strict",
|
|
3730
3865
|
catchall: ie.create(),
|
|
3731
3866
|
typeName: N.ZodObject,
|
|
3732
3867
|
...C(e)
|
|
3733
3868
|
});
|
|
3734
|
-
|
|
3869
|
+
z.lazycreate = (r, e) => new z({
|
|
3735
3870
|
shape: r,
|
|
3736
3871
|
unknownKeys: "strip",
|
|
3737
3872
|
catchall: ie.create(),
|
|
3738
3873
|
typeName: N.ZodObject,
|
|
3739
3874
|
...C(e)
|
|
3740
3875
|
});
|
|
3741
|
-
class
|
|
3876
|
+
class We extends A {
|
|
3742
3877
|
_parse(e) {
|
|
3743
3878
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
3744
3879
|
function n(a) {
|
|
@@ -3748,15 +3883,15 @@ class Ve extends A {
|
|
|
3748
3883
|
for (const u of a)
|
|
3749
3884
|
if (u.result.status === "dirty")
|
|
3750
3885
|
return t.common.issues.push(...u.ctx.common.issues), u.result;
|
|
3751
|
-
const
|
|
3752
|
-
return
|
|
3886
|
+
const d = a.map((u) => new ee(u.ctx.common.issues));
|
|
3887
|
+
return y(t, {
|
|
3753
3888
|
code: g.invalid_union,
|
|
3754
|
-
unionErrors:
|
|
3889
|
+
unionErrors: d
|
|
3755
3890
|
}), j;
|
|
3756
3891
|
}
|
|
3757
3892
|
if (t.common.async)
|
|
3758
3893
|
return Promise.all(s.map(async (a) => {
|
|
3759
|
-
const
|
|
3894
|
+
const d = {
|
|
3760
3895
|
...t,
|
|
3761
3896
|
common: {
|
|
3762
3897
|
...t.common,
|
|
@@ -3768,14 +3903,14 @@ class Ve extends A {
|
|
|
3768
3903
|
result: await a._parseAsync({
|
|
3769
3904
|
data: t.data,
|
|
3770
3905
|
path: t.path,
|
|
3771
|
-
parent:
|
|
3906
|
+
parent: d
|
|
3772
3907
|
}),
|
|
3773
|
-
ctx:
|
|
3908
|
+
ctx: d
|
|
3774
3909
|
};
|
|
3775
3910
|
})).then(n);
|
|
3776
3911
|
{
|
|
3777
3912
|
let a;
|
|
3778
|
-
const
|
|
3913
|
+
const d = [];
|
|
3779
3914
|
for (const i of s) {
|
|
3780
3915
|
const o = {
|
|
3781
3916
|
...t,
|
|
@@ -3784,19 +3919,19 @@ class Ve extends A {
|
|
|
3784
3919
|
issues: []
|
|
3785
3920
|
},
|
|
3786
3921
|
parent: null
|
|
3787
|
-
},
|
|
3922
|
+
}, c = i._parseSync({
|
|
3788
3923
|
data: t.data,
|
|
3789
3924
|
path: t.path,
|
|
3790
3925
|
parent: o
|
|
3791
3926
|
});
|
|
3792
|
-
if (
|
|
3793
|
-
return
|
|
3794
|
-
|
|
3927
|
+
if (c.status === "valid")
|
|
3928
|
+
return c;
|
|
3929
|
+
c.status === "dirty" && !a && (a = { result: c, ctx: o }), o.common.issues.length && d.push(o.common.issues);
|
|
3795
3930
|
}
|
|
3796
3931
|
if (a)
|
|
3797
3932
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
3798
|
-
const u =
|
|
3799
|
-
return
|
|
3933
|
+
const u = d.map((i) => new ee(i));
|
|
3934
|
+
return y(t, {
|
|
3800
3935
|
code: g.invalid_union,
|
|
3801
3936
|
unionErrors: u
|
|
3802
3937
|
}), j;
|
|
@@ -3806,44 +3941,44 @@ class Ve extends A {
|
|
|
3806
3941
|
return this._def.options;
|
|
3807
3942
|
}
|
|
3808
3943
|
}
|
|
3809
|
-
|
|
3944
|
+
We.create = (r, e) => new We({
|
|
3810
3945
|
options: r,
|
|
3811
3946
|
typeName: N.ZodUnion,
|
|
3812
3947
|
...C(e)
|
|
3813
3948
|
});
|
|
3814
|
-
function
|
|
3815
|
-
const t =
|
|
3949
|
+
function rt(r, e) {
|
|
3950
|
+
const t = re(r), s = re(e);
|
|
3816
3951
|
if (r === e)
|
|
3817
3952
|
return { valid: !0, data: r };
|
|
3818
|
-
if (t ===
|
|
3819
|
-
const n = T.objectKeys(e), a = T.objectKeys(r).filter((u) => n.indexOf(u) !== -1),
|
|
3953
|
+
if (t === x.object && s === x.object) {
|
|
3954
|
+
const n = T.objectKeys(e), a = T.objectKeys(r).filter((u) => n.indexOf(u) !== -1), d = { ...r, ...e };
|
|
3820
3955
|
for (const u of a) {
|
|
3821
|
-
const i =
|
|
3956
|
+
const i = rt(r[u], e[u]);
|
|
3822
3957
|
if (!i.valid)
|
|
3823
3958
|
return { valid: !1 };
|
|
3824
|
-
|
|
3959
|
+
d[u] = i.data;
|
|
3825
3960
|
}
|
|
3826
|
-
return { valid: !0, data:
|
|
3827
|
-
} else if (t ===
|
|
3961
|
+
return { valid: !0, data: d };
|
|
3962
|
+
} else if (t === x.array && s === x.array) {
|
|
3828
3963
|
if (r.length !== e.length)
|
|
3829
3964
|
return { valid: !1 };
|
|
3830
3965
|
const n = [];
|
|
3831
3966
|
for (let a = 0; a < r.length; a++) {
|
|
3832
|
-
const
|
|
3967
|
+
const d = r[a], u = e[a], i = rt(d, u);
|
|
3833
3968
|
if (!i.valid)
|
|
3834
3969
|
return { valid: !1 };
|
|
3835
3970
|
n.push(i.data);
|
|
3836
3971
|
}
|
|
3837
3972
|
return { valid: !0, data: n };
|
|
3838
|
-
} else return t ===
|
|
3973
|
+
} else return t === x.date && s === x.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
3839
3974
|
}
|
|
3840
|
-
class
|
|
3975
|
+
class qe extends A {
|
|
3841
3976
|
_parse(e) {
|
|
3842
|
-
const { status: t, ctx: s } = this._processInputParams(e), n = (a,
|
|
3843
|
-
if (_t(a) || _t(
|
|
3977
|
+
const { status: t, ctx: s } = this._processInputParams(e), n = (a, d) => {
|
|
3978
|
+
if (_t(a) || _t(d))
|
|
3844
3979
|
return j;
|
|
3845
|
-
const u =
|
|
3846
|
-
return u.valid ? ((
|
|
3980
|
+
const u = rt(a.value, d.value);
|
|
3981
|
+
return u.valid ? ((bt(a) || bt(d)) && t.dirty(), { status: t.value, value: u.data }) : (y(s, {
|
|
3847
3982
|
code: g.invalid_intersection_types
|
|
3848
3983
|
}), j);
|
|
3849
3984
|
};
|
|
@@ -3858,7 +3993,7 @@ class Ue extends A {
|
|
|
3858
3993
|
path: s.path,
|
|
3859
3994
|
parent: s
|
|
3860
3995
|
})
|
|
3861
|
-
]).then(([a,
|
|
3996
|
+
]).then(([a, d]) => n(a, d)) : n(this._def.left._parseSync({
|
|
3862
3997
|
data: s.data,
|
|
3863
3998
|
path: s.path,
|
|
3864
3999
|
parent: s
|
|
@@ -3869,63 +4004,63 @@ class Ue extends A {
|
|
|
3869
4004
|
}));
|
|
3870
4005
|
}
|
|
3871
4006
|
}
|
|
3872
|
-
|
|
4007
|
+
qe.create = (r, e, t) => new qe({
|
|
3873
4008
|
left: r,
|
|
3874
4009
|
right: e,
|
|
3875
4010
|
typeName: N.ZodIntersection,
|
|
3876
4011
|
...C(t)
|
|
3877
4012
|
});
|
|
3878
|
-
class
|
|
4013
|
+
class me extends A {
|
|
3879
4014
|
_parse(e) {
|
|
3880
4015
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3881
|
-
if (s.parsedType !==
|
|
3882
|
-
return
|
|
4016
|
+
if (s.parsedType !== x.array)
|
|
4017
|
+
return y(s, {
|
|
3883
4018
|
code: g.invalid_type,
|
|
3884
|
-
expected:
|
|
4019
|
+
expected: x.array,
|
|
3885
4020
|
received: s.parsedType
|
|
3886
4021
|
}), j;
|
|
3887
4022
|
if (s.data.length < this._def.items.length)
|
|
3888
|
-
return
|
|
4023
|
+
return y(s, {
|
|
3889
4024
|
code: g.too_small,
|
|
3890
4025
|
minimum: this._def.items.length,
|
|
3891
4026
|
inclusive: !0,
|
|
3892
4027
|
exact: !1,
|
|
3893
4028
|
type: "array"
|
|
3894
4029
|
}), j;
|
|
3895
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
4030
|
+
!this._def.rest && s.data.length > this._def.items.length && (y(s, {
|
|
3896
4031
|
code: g.too_big,
|
|
3897
4032
|
maximum: this._def.items.length,
|
|
3898
4033
|
inclusive: !0,
|
|
3899
4034
|
exact: !1,
|
|
3900
4035
|
type: "array"
|
|
3901
4036
|
}), t.dirty());
|
|
3902
|
-
const a = [...s.data].map((
|
|
4037
|
+
const a = [...s.data].map((d, u) => {
|
|
3903
4038
|
const i = this._def.items[u] || this._def.rest;
|
|
3904
|
-
return i ? i._parse(new ae(s,
|
|
3905
|
-
}).filter((
|
|
3906
|
-
return s.common.async ? Promise.all(a).then((
|
|
4039
|
+
return i ? i._parse(new ae(s, d, s.path, u)) : null;
|
|
4040
|
+
}).filter((d) => !!d);
|
|
4041
|
+
return s.common.async ? Promise.all(a).then((d) => H.mergeArray(t, d)) : H.mergeArray(t, a);
|
|
3907
4042
|
}
|
|
3908
4043
|
get items() {
|
|
3909
4044
|
return this._def.items;
|
|
3910
4045
|
}
|
|
3911
4046
|
rest(e) {
|
|
3912
|
-
return new
|
|
4047
|
+
return new me({
|
|
3913
4048
|
...this._def,
|
|
3914
4049
|
rest: e
|
|
3915
4050
|
});
|
|
3916
4051
|
}
|
|
3917
4052
|
}
|
|
3918
|
-
|
|
4053
|
+
me.create = (r, e) => {
|
|
3919
4054
|
if (!Array.isArray(r))
|
|
3920
4055
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
3921
|
-
return new
|
|
4056
|
+
return new me({
|
|
3922
4057
|
items: r,
|
|
3923
4058
|
typeName: N.ZodTuple,
|
|
3924
4059
|
rest: null,
|
|
3925
4060
|
...C(e)
|
|
3926
4061
|
});
|
|
3927
4062
|
};
|
|
3928
|
-
class
|
|
4063
|
+
class Rt extends A {
|
|
3929
4064
|
get keySchema() {
|
|
3930
4065
|
return this._def.keyType;
|
|
3931
4066
|
}
|
|
@@ -3934,63 +4069,63 @@ class St extends A {
|
|
|
3934
4069
|
}
|
|
3935
4070
|
_parse(e) {
|
|
3936
4071
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3937
|
-
if (s.parsedType !==
|
|
3938
|
-
return
|
|
4072
|
+
if (s.parsedType !== x.map)
|
|
4073
|
+
return y(s, {
|
|
3939
4074
|
code: g.invalid_type,
|
|
3940
|
-
expected:
|
|
4075
|
+
expected: x.map,
|
|
3941
4076
|
received: s.parsedType
|
|
3942
4077
|
}), j;
|
|
3943
|
-
const n = this._def.keyType, a = this._def.valueType,
|
|
4078
|
+
const n = this._def.keyType, a = this._def.valueType, d = [...s.data.entries()].map(([u, i], o) => ({
|
|
3944
4079
|
key: n._parse(new ae(s, u, s.path, [o, "key"])),
|
|
3945
4080
|
value: a._parse(new ae(s, i, s.path, [o, "value"]))
|
|
3946
4081
|
}));
|
|
3947
4082
|
if (s.common.async) {
|
|
3948
4083
|
const u = /* @__PURE__ */ new Map();
|
|
3949
4084
|
return Promise.resolve().then(async () => {
|
|
3950
|
-
for (const i of
|
|
3951
|
-
const o = await i.key,
|
|
3952
|
-
if (o.status === "aborted" ||
|
|
4085
|
+
for (const i of d) {
|
|
4086
|
+
const o = await i.key, c = await i.value;
|
|
4087
|
+
if (o.status === "aborted" || c.status === "aborted")
|
|
3953
4088
|
return j;
|
|
3954
|
-
(o.status === "dirty" ||
|
|
4089
|
+
(o.status === "dirty" || c.status === "dirty") && t.dirty(), u.set(o.value, c.value);
|
|
3955
4090
|
}
|
|
3956
4091
|
return { status: t.value, value: u };
|
|
3957
4092
|
});
|
|
3958
4093
|
} else {
|
|
3959
4094
|
const u = /* @__PURE__ */ new Map();
|
|
3960
|
-
for (const i of
|
|
3961
|
-
const o = i.key,
|
|
3962
|
-
if (o.status === "aborted" ||
|
|
4095
|
+
for (const i of d) {
|
|
4096
|
+
const o = i.key, c = i.value;
|
|
4097
|
+
if (o.status === "aborted" || c.status === "aborted")
|
|
3963
4098
|
return j;
|
|
3964
|
-
(o.status === "dirty" ||
|
|
4099
|
+
(o.status === "dirty" || c.status === "dirty") && t.dirty(), u.set(o.value, c.value);
|
|
3965
4100
|
}
|
|
3966
4101
|
return { status: t.value, value: u };
|
|
3967
4102
|
}
|
|
3968
4103
|
}
|
|
3969
4104
|
}
|
|
3970
|
-
|
|
4105
|
+
Rt.create = (r, e, t) => new Rt({
|
|
3971
4106
|
valueType: e,
|
|
3972
4107
|
keyType: r,
|
|
3973
4108
|
typeName: N.ZodMap,
|
|
3974
4109
|
...C(t)
|
|
3975
4110
|
});
|
|
3976
|
-
class
|
|
4111
|
+
class Me extends A {
|
|
3977
4112
|
_parse(e) {
|
|
3978
4113
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3979
|
-
if (s.parsedType !==
|
|
3980
|
-
return
|
|
4114
|
+
if (s.parsedType !== x.set)
|
|
4115
|
+
return y(s, {
|
|
3981
4116
|
code: g.invalid_type,
|
|
3982
|
-
expected:
|
|
4117
|
+
expected: x.set,
|
|
3983
4118
|
received: s.parsedType
|
|
3984
4119
|
}), j;
|
|
3985
4120
|
const n = this._def;
|
|
3986
|
-
n.minSize !== null && s.data.size < n.minSize.value && (
|
|
4121
|
+
n.minSize !== null && s.data.size < n.minSize.value && (y(s, {
|
|
3987
4122
|
code: g.too_small,
|
|
3988
4123
|
minimum: n.minSize.value,
|
|
3989
4124
|
type: "set",
|
|
3990
4125
|
inclusive: !0,
|
|
3991
4126
|
exact: !1,
|
|
3992
4127
|
message: n.minSize.message
|
|
3993
|
-
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (
|
|
4128
|
+
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (y(s, {
|
|
3994
4129
|
code: g.too_big,
|
|
3995
4130
|
maximum: n.maxSize.value,
|
|
3996
4131
|
type: "set",
|
|
@@ -3999,26 +4134,26 @@ class Oe extends A {
|
|
|
3999
4134
|
message: n.maxSize.message
|
|
4000
4135
|
}), t.dirty());
|
|
4001
4136
|
const a = this._def.valueType;
|
|
4002
|
-
function
|
|
4137
|
+
function d(i) {
|
|
4003
4138
|
const o = /* @__PURE__ */ new Set();
|
|
4004
|
-
for (const
|
|
4005
|
-
if (
|
|
4139
|
+
for (const c of i) {
|
|
4140
|
+
if (c.status === "aborted")
|
|
4006
4141
|
return j;
|
|
4007
|
-
|
|
4142
|
+
c.status === "dirty" && t.dirty(), o.add(c.value);
|
|
4008
4143
|
}
|
|
4009
4144
|
return { status: t.value, value: o };
|
|
4010
4145
|
}
|
|
4011
4146
|
const u = [...s.data.values()].map((i, o) => a._parse(new ae(s, i, s.path, o)));
|
|
4012
|
-
return s.common.async ? Promise.all(u).then((i) =>
|
|
4147
|
+
return s.common.async ? Promise.all(u).then((i) => d(i)) : d(u);
|
|
4013
4148
|
}
|
|
4014
4149
|
min(e, t) {
|
|
4015
|
-
return new
|
|
4150
|
+
return new Me({
|
|
4016
4151
|
...this._def,
|
|
4017
4152
|
minSize: { value: e, message: b.toString(t) }
|
|
4018
4153
|
});
|
|
4019
4154
|
}
|
|
4020
4155
|
max(e, t) {
|
|
4021
|
-
return new
|
|
4156
|
+
return new Me({
|
|
4022
4157
|
...this._def,
|
|
4023
4158
|
maxSize: { value: e, message: b.toString(t) }
|
|
4024
4159
|
});
|
|
@@ -4030,14 +4165,14 @@ class Oe extends A {
|
|
|
4030
4165
|
return this.min(1, e);
|
|
4031
4166
|
}
|
|
4032
4167
|
}
|
|
4033
|
-
|
|
4168
|
+
Me.create = (r, e) => new Me({
|
|
4034
4169
|
valueType: r,
|
|
4035
4170
|
minSize: null,
|
|
4036
4171
|
maxSize: null,
|
|
4037
4172
|
typeName: N.ZodSet,
|
|
4038
4173
|
...C(e)
|
|
4039
4174
|
});
|
|
4040
|
-
class
|
|
4175
|
+
class At extends A {
|
|
4041
4176
|
get schema() {
|
|
4042
4177
|
return this._def.getter();
|
|
4043
4178
|
}
|
|
@@ -4046,16 +4181,16 @@ class Rt extends A {
|
|
|
4046
4181
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
4047
4182
|
}
|
|
4048
4183
|
}
|
|
4049
|
-
|
|
4184
|
+
At.create = (r, e) => new At({
|
|
4050
4185
|
getter: r,
|
|
4051
4186
|
typeName: N.ZodLazy,
|
|
4052
4187
|
...C(e)
|
|
4053
4188
|
});
|
|
4054
|
-
class
|
|
4189
|
+
class Tt extends A {
|
|
4055
4190
|
_parse(e) {
|
|
4056
4191
|
if (e.data !== this._def.value) {
|
|
4057
4192
|
const t = this._getOrReturnCtx(e);
|
|
4058
|
-
return
|
|
4193
|
+
return y(t, {
|
|
4059
4194
|
received: t.data,
|
|
4060
4195
|
code: g.invalid_literal,
|
|
4061
4196
|
expected: this._def.value
|
|
@@ -4067,23 +4202,23 @@ class At extends A {
|
|
|
4067
4202
|
return this._def.value;
|
|
4068
4203
|
}
|
|
4069
4204
|
}
|
|
4070
|
-
|
|
4205
|
+
Tt.create = (r, e) => new Tt({
|
|
4071
4206
|
value: r,
|
|
4072
4207
|
typeName: N.ZodLiteral,
|
|
4073
4208
|
...C(e)
|
|
4074
4209
|
});
|
|
4075
|
-
function
|
|
4076
|
-
return new
|
|
4210
|
+
function nr(r, e) {
|
|
4211
|
+
return new _e({
|
|
4077
4212
|
values: r,
|
|
4078
4213
|
typeName: N.ZodEnum,
|
|
4079
4214
|
...C(e)
|
|
4080
4215
|
});
|
|
4081
4216
|
}
|
|
4082
|
-
class
|
|
4217
|
+
class _e extends A {
|
|
4083
4218
|
_parse(e) {
|
|
4084
4219
|
if (typeof e.data != "string") {
|
|
4085
4220
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
4086
|
-
return
|
|
4221
|
+
return y(t, {
|
|
4087
4222
|
expected: T.joinValues(s),
|
|
4088
4223
|
received: t.parsedType,
|
|
4089
4224
|
code: g.invalid_type
|
|
@@ -4091,7 +4226,7 @@ class ve extends A {
|
|
|
4091
4226
|
}
|
|
4092
4227
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
4093
4228
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
4094
|
-
return
|
|
4229
|
+
return y(t, {
|
|
4095
4230
|
received: t.data,
|
|
4096
4231
|
code: g.invalid_enum_value,
|
|
4097
4232
|
options: s
|
|
@@ -4121,25 +4256,25 @@ class ve extends A {
|
|
|
4121
4256
|
return e;
|
|
4122
4257
|
}
|
|
4123
4258
|
extract(e, t = this._def) {
|
|
4124
|
-
return
|
|
4259
|
+
return _e.create(e, {
|
|
4125
4260
|
...this._def,
|
|
4126
4261
|
...t
|
|
4127
4262
|
});
|
|
4128
4263
|
}
|
|
4129
4264
|
exclude(e, t = this._def) {
|
|
4130
|
-
return
|
|
4265
|
+
return _e.create(this.options.filter((s) => !e.includes(s)), {
|
|
4131
4266
|
...this._def,
|
|
4132
4267
|
...t
|
|
4133
4268
|
});
|
|
4134
4269
|
}
|
|
4135
4270
|
}
|
|
4136
|
-
|
|
4137
|
-
class
|
|
4271
|
+
_e.create = nr;
|
|
4272
|
+
class Ot extends A {
|
|
4138
4273
|
_parse(e) {
|
|
4139
4274
|
const t = T.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
4140
|
-
if (s.parsedType !==
|
|
4275
|
+
if (s.parsedType !== x.string && s.parsedType !== x.number) {
|
|
4141
4276
|
const n = T.objectValues(t);
|
|
4142
|
-
return
|
|
4277
|
+
return y(s, {
|
|
4143
4278
|
expected: T.joinValues(n),
|
|
4144
4279
|
received: s.parsedType,
|
|
4145
4280
|
code: g.invalid_type
|
|
@@ -4147,7 +4282,7 @@ class Tt extends A {
|
|
|
4147
4282
|
}
|
|
4148
4283
|
if (this._cache || (this._cache = new Set(T.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
4149
4284
|
const n = T.objectValues(t);
|
|
4150
|
-
return
|
|
4285
|
+
return y(s, {
|
|
4151
4286
|
received: s.data,
|
|
4152
4287
|
code: g.invalid_enum_value,
|
|
4153
4288
|
options: n
|
|
@@ -4159,36 +4294,36 @@ class Tt extends A {
|
|
|
4159
4294
|
return this._def.values;
|
|
4160
4295
|
}
|
|
4161
4296
|
}
|
|
4162
|
-
|
|
4297
|
+
Ot.create = (r, e) => new Ot({
|
|
4163
4298
|
values: r,
|
|
4164
4299
|
typeName: N.ZodNativeEnum,
|
|
4165
4300
|
...C(e)
|
|
4166
4301
|
});
|
|
4167
|
-
class
|
|
4302
|
+
class Ye extends A {
|
|
4168
4303
|
unwrap() {
|
|
4169
4304
|
return this._def.type;
|
|
4170
4305
|
}
|
|
4171
4306
|
_parse(e) {
|
|
4172
4307
|
const { ctx: t } = this._processInputParams(e);
|
|
4173
|
-
if (t.parsedType !==
|
|
4174
|
-
return
|
|
4308
|
+
if (t.parsedType !== x.promise && t.common.async === !1)
|
|
4309
|
+
return y(t, {
|
|
4175
4310
|
code: g.invalid_type,
|
|
4176
|
-
expected:
|
|
4311
|
+
expected: x.promise,
|
|
4177
4312
|
received: t.parsedType
|
|
4178
4313
|
}), j;
|
|
4179
|
-
const s = t.parsedType ===
|
|
4314
|
+
const s = t.parsedType === x.promise ? t.data : Promise.resolve(t.data);
|
|
4180
4315
|
return J(s.then((n) => this._def.type.parseAsync(n, {
|
|
4181
4316
|
path: t.path,
|
|
4182
4317
|
errorMap: t.common.contextualErrorMap
|
|
4183
4318
|
})));
|
|
4184
4319
|
}
|
|
4185
4320
|
}
|
|
4186
|
-
|
|
4321
|
+
Ye.create = (r, e) => new Ye({
|
|
4187
4322
|
type: r,
|
|
4188
4323
|
typeName: N.ZodPromise,
|
|
4189
4324
|
...C(e)
|
|
4190
4325
|
});
|
|
4191
|
-
class
|
|
4326
|
+
class be extends A {
|
|
4192
4327
|
innerType() {
|
|
4193
4328
|
return this._def.schema;
|
|
4194
4329
|
}
|
|
@@ -4197,17 +4332,17 @@ class _e extends A {
|
|
|
4197
4332
|
}
|
|
4198
4333
|
_parse(e) {
|
|
4199
4334
|
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
4200
|
-
addIssue: (
|
|
4201
|
-
|
|
4335
|
+
addIssue: (d) => {
|
|
4336
|
+
y(s, d), d.fatal ? t.abort() : t.dirty();
|
|
4202
4337
|
},
|
|
4203
4338
|
get path() {
|
|
4204
4339
|
return s.path;
|
|
4205
4340
|
}
|
|
4206
4341
|
};
|
|
4207
4342
|
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
4208
|
-
const
|
|
4343
|
+
const d = n.transform(s.data, a);
|
|
4209
4344
|
if (s.common.async)
|
|
4210
|
-
return Promise.resolve(
|
|
4345
|
+
return Promise.resolve(d).then(async (u) => {
|
|
4211
4346
|
if (t.value === "aborted")
|
|
4212
4347
|
return j;
|
|
4213
4348
|
const i = await this._def.schema._parseAsync({
|
|
@@ -4215,21 +4350,21 @@ class _e extends A {
|
|
|
4215
4350
|
path: s.path,
|
|
4216
4351
|
parent: s
|
|
4217
4352
|
});
|
|
4218
|
-
return i.status === "aborted" ? j : i.status === "dirty" || t.value === "dirty" ?
|
|
4353
|
+
return i.status === "aborted" ? j : i.status === "dirty" || t.value === "dirty" ? Pe(i.value) : i;
|
|
4219
4354
|
});
|
|
4220
4355
|
{
|
|
4221
4356
|
if (t.value === "aborted")
|
|
4222
4357
|
return j;
|
|
4223
4358
|
const u = this._def.schema._parseSync({
|
|
4224
|
-
data:
|
|
4359
|
+
data: d,
|
|
4225
4360
|
path: s.path,
|
|
4226
4361
|
parent: s
|
|
4227
4362
|
});
|
|
4228
|
-
return u.status === "aborted" ? j : u.status === "dirty" || t.value === "dirty" ?
|
|
4363
|
+
return u.status === "aborted" ? j : u.status === "dirty" || t.value === "dirty" ? Pe(u.value) : u;
|
|
4229
4364
|
}
|
|
4230
4365
|
}
|
|
4231
4366
|
if (n.type === "refinement") {
|
|
4232
|
-
const
|
|
4367
|
+
const d = (u) => {
|
|
4233
4368
|
const i = n.refinement(u, a);
|
|
4234
4369
|
if (s.common.async)
|
|
4235
4370
|
return Promise.resolve(i);
|
|
@@ -4243,38 +4378,38 @@ class _e extends A {
|
|
|
4243
4378
|
path: s.path,
|
|
4244
4379
|
parent: s
|
|
4245
4380
|
});
|
|
4246
|
-
return u.status === "aborted" ? j : (u.status === "dirty" && t.dirty(),
|
|
4381
|
+
return u.status === "aborted" ? j : (u.status === "dirty" && t.dirty(), d(u.value), { status: t.value, value: u.value });
|
|
4247
4382
|
} else
|
|
4248
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((u) => u.status === "aborted" ? j : (u.status === "dirty" && t.dirty(),
|
|
4383
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((u) => u.status === "aborted" ? j : (u.status === "dirty" && t.dirty(), d(u.value).then(() => ({ status: t.value, value: u.value }))));
|
|
4249
4384
|
}
|
|
4250
4385
|
if (n.type === "transform")
|
|
4251
4386
|
if (s.common.async === !1) {
|
|
4252
|
-
const
|
|
4387
|
+
const d = this._def.schema._parseSync({
|
|
4253
4388
|
data: s.data,
|
|
4254
4389
|
path: s.path,
|
|
4255
4390
|
parent: s
|
|
4256
4391
|
});
|
|
4257
|
-
if (!
|
|
4392
|
+
if (!ye(d))
|
|
4258
4393
|
return j;
|
|
4259
|
-
const u = n.transform(
|
|
4394
|
+
const u = n.transform(d.value, a);
|
|
4260
4395
|
if (u instanceof Promise)
|
|
4261
4396
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
4262
4397
|
return { status: t.value, value: u };
|
|
4263
4398
|
} else
|
|
4264
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((
|
|
4399
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((d) => ye(d) ? Promise.resolve(n.transform(d.value, a)).then((u) => ({
|
|
4265
4400
|
status: t.value,
|
|
4266
4401
|
value: u
|
|
4267
4402
|
})) : j);
|
|
4268
4403
|
T.assertNever(n);
|
|
4269
4404
|
}
|
|
4270
4405
|
}
|
|
4271
|
-
|
|
4406
|
+
be.create = (r, e, t) => new be({
|
|
4272
4407
|
schema: r,
|
|
4273
4408
|
typeName: N.ZodEffects,
|
|
4274
4409
|
effect: e,
|
|
4275
4410
|
...C(t)
|
|
4276
4411
|
});
|
|
4277
|
-
|
|
4412
|
+
be.createWithPreprocess = (r, e, t) => new be({
|
|
4278
4413
|
schema: e,
|
|
4279
4414
|
effect: { type: "preprocess", transform: r },
|
|
4280
4415
|
typeName: N.ZodEffects,
|
|
@@ -4282,7 +4417,7 @@ _e.createWithPreprocess = (r, e, t) => new _e({
|
|
|
4282
4417
|
});
|
|
4283
4418
|
class ne extends A {
|
|
4284
4419
|
_parse(e) {
|
|
4285
|
-
return this._getType(e) ===
|
|
4420
|
+
return this._getType(e) === x.undefined ? J(void 0) : this._def.innerType._parse(e);
|
|
4286
4421
|
}
|
|
4287
4422
|
unwrap() {
|
|
4288
4423
|
return this._def.innerType;
|
|
@@ -4293,24 +4428,24 @@ ne.create = (r, e) => new ne({
|
|
|
4293
4428
|
typeName: N.ZodOptional,
|
|
4294
4429
|
...C(e)
|
|
4295
4430
|
});
|
|
4296
|
-
class
|
|
4431
|
+
class we extends A {
|
|
4297
4432
|
_parse(e) {
|
|
4298
|
-
return this._getType(e) ===
|
|
4433
|
+
return this._getType(e) === x.null ? J(null) : this._def.innerType._parse(e);
|
|
4299
4434
|
}
|
|
4300
4435
|
unwrap() {
|
|
4301
4436
|
return this._def.innerType;
|
|
4302
4437
|
}
|
|
4303
4438
|
}
|
|
4304
|
-
|
|
4439
|
+
we.create = (r, e) => new we({
|
|
4305
4440
|
innerType: r,
|
|
4306
4441
|
typeName: N.ZodNullable,
|
|
4307
4442
|
...C(e)
|
|
4308
4443
|
});
|
|
4309
|
-
class
|
|
4444
|
+
class st extends A {
|
|
4310
4445
|
_parse(e) {
|
|
4311
4446
|
const { ctx: t } = this._processInputParams(e);
|
|
4312
4447
|
let s = t.data;
|
|
4313
|
-
return t.parsedType ===
|
|
4448
|
+
return t.parsedType === x.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
4314
4449
|
data: s,
|
|
4315
4450
|
path: t.path,
|
|
4316
4451
|
parent: t
|
|
@@ -4320,13 +4455,13 @@ class rt extends A {
|
|
|
4320
4455
|
return this._def.innerType;
|
|
4321
4456
|
}
|
|
4322
4457
|
}
|
|
4323
|
-
|
|
4458
|
+
st.create = (r, e) => new st({
|
|
4324
4459
|
innerType: r,
|
|
4325
4460
|
typeName: N.ZodDefault,
|
|
4326
4461
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
4327
4462
|
...C(e)
|
|
4328
4463
|
});
|
|
4329
|
-
class
|
|
4464
|
+
class nt extends A {
|
|
4330
4465
|
_parse(e) {
|
|
4331
4466
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
4332
4467
|
...t,
|
|
@@ -4341,7 +4476,7 @@ class st extends A {
|
|
|
4341
4476
|
...s
|
|
4342
4477
|
}
|
|
4343
4478
|
});
|
|
4344
|
-
return
|
|
4479
|
+
return Ve(n) ? n.then((a) => ({
|
|
4345
4480
|
status: "valid",
|
|
4346
4481
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
4347
4482
|
get error() {
|
|
@@ -4363,30 +4498,30 @@ class st extends A {
|
|
|
4363
4498
|
return this._def.innerType;
|
|
4364
4499
|
}
|
|
4365
4500
|
}
|
|
4366
|
-
|
|
4501
|
+
nt.create = (r, e) => new nt({
|
|
4367
4502
|
innerType: r,
|
|
4368
4503
|
typeName: N.ZodCatch,
|
|
4369
4504
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
4370
4505
|
...C(e)
|
|
4371
4506
|
});
|
|
4372
|
-
class
|
|
4507
|
+
class Pt extends A {
|
|
4373
4508
|
_parse(e) {
|
|
4374
|
-
if (this._getType(e) !==
|
|
4509
|
+
if (this._getType(e) !== x.nan) {
|
|
4375
4510
|
const s = this._getOrReturnCtx(e);
|
|
4376
|
-
return
|
|
4511
|
+
return y(s, {
|
|
4377
4512
|
code: g.invalid_type,
|
|
4378
|
-
expected:
|
|
4513
|
+
expected: x.nan,
|
|
4379
4514
|
received: s.parsedType
|
|
4380
4515
|
}), j;
|
|
4381
4516
|
}
|
|
4382
4517
|
return { status: "valid", value: e.data };
|
|
4383
4518
|
}
|
|
4384
4519
|
}
|
|
4385
|
-
|
|
4520
|
+
Pt.create = (r) => new Pt({
|
|
4386
4521
|
typeName: N.ZodNaN,
|
|
4387
4522
|
...C(r)
|
|
4388
4523
|
});
|
|
4389
|
-
class
|
|
4524
|
+
class Vs extends A {
|
|
4390
4525
|
_parse(e) {
|
|
4391
4526
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
4392
4527
|
return this._def.type._parse({
|
|
@@ -4399,7 +4534,7 @@ class Fs extends A {
|
|
|
4399
4534
|
return this._def.type;
|
|
4400
4535
|
}
|
|
4401
4536
|
}
|
|
4402
|
-
class
|
|
4537
|
+
class dt extends A {
|
|
4403
4538
|
_parse(e) {
|
|
4404
4539
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
4405
4540
|
if (s.common.async)
|
|
@@ -4409,7 +4544,7 @@ class ct extends A {
|
|
|
4409
4544
|
path: s.path,
|
|
4410
4545
|
parent: s
|
|
4411
4546
|
});
|
|
4412
|
-
return a.status === "aborted" ? j : a.status === "dirty" ? (t.dirty(),
|
|
4547
|
+
return a.status === "aborted" ? j : a.status === "dirty" ? (t.dirty(), Pe(a.value)) : this._def.out._parseAsync({
|
|
4413
4548
|
data: a.value,
|
|
4414
4549
|
path: s.path,
|
|
4415
4550
|
parent: s
|
|
@@ -4432,23 +4567,23 @@ class ct extends A {
|
|
|
4432
4567
|
}
|
|
4433
4568
|
}
|
|
4434
4569
|
static create(e, t) {
|
|
4435
|
-
return new
|
|
4570
|
+
return new dt({
|
|
4436
4571
|
in: e,
|
|
4437
4572
|
out: t,
|
|
4438
4573
|
typeName: N.ZodPipeline
|
|
4439
4574
|
});
|
|
4440
4575
|
}
|
|
4441
4576
|
}
|
|
4442
|
-
class
|
|
4577
|
+
class at extends A {
|
|
4443
4578
|
_parse(e) {
|
|
4444
|
-
const t = this._def.innerType._parse(e), s = (n) => (
|
|
4445
|
-
return
|
|
4579
|
+
const t = this._def.innerType._parse(e), s = (n) => (ye(n) && (n.value = Object.freeze(n.value)), n);
|
|
4580
|
+
return Ve(t) ? t.then((n) => s(n)) : s(t);
|
|
4446
4581
|
}
|
|
4447
4582
|
unwrap() {
|
|
4448
4583
|
return this._def.innerType;
|
|
4449
4584
|
}
|
|
4450
4585
|
}
|
|
4451
|
-
|
|
4586
|
+
at.create = (r, e) => new at({
|
|
4452
4587
|
innerType: r,
|
|
4453
4588
|
typeName: N.ZodReadonly,
|
|
4454
4589
|
...C(e)
|
|
@@ -4457,51 +4592,51 @@ var N;
|
|
|
4457
4592
|
(function(r) {
|
|
4458
4593
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
4459
4594
|
})(N || (N = {}));
|
|
4460
|
-
const
|
|
4461
|
-
de.create;
|
|
4462
|
-
ue.create;
|
|
4463
|
-
Fe.create;
|
|
4464
|
-
ye.create;
|
|
4465
|
-
ie.create;
|
|
4466
|
-
X.create;
|
|
4467
|
-
const Vs = F.create;
|
|
4468
|
-
Ve.create;
|
|
4469
|
-
Ue.create;
|
|
4595
|
+
const Te = K.create;
|
|
4470
4596
|
fe.create;
|
|
4471
|
-
|
|
4597
|
+
he.create;
|
|
4472
4598
|
Be.create;
|
|
4473
|
-
ne.create;
|
|
4474
4599
|
xe.create;
|
|
4475
|
-
|
|
4600
|
+
ie.create;
|
|
4601
|
+
X.create;
|
|
4602
|
+
const Bs = z.create;
|
|
4603
|
+
We.create;
|
|
4604
|
+
qe.create;
|
|
4605
|
+
me.create;
|
|
4606
|
+
_e.create;
|
|
4607
|
+
Ye.create;
|
|
4608
|
+
ne.create;
|
|
4609
|
+
we.create;
|
|
4610
|
+
const It = {
|
|
4476
4611
|
string: ((r) => K.create({ ...r, coerce: !0 })),
|
|
4477
|
-
number: ((r) =>
|
|
4478
|
-
boolean: ((r) =>
|
|
4612
|
+
number: ((r) => fe.create({ ...r, coerce: !0 })),
|
|
4613
|
+
boolean: ((r) => Be.create({
|
|
4479
4614
|
...r,
|
|
4480
4615
|
coerce: !0
|
|
4481
4616
|
})),
|
|
4482
|
-
bigint: ((r) =>
|
|
4483
|
-
date: ((r) =>
|
|
4484
|
-
},
|
|
4485
|
-
q:
|
|
4486
|
-
task_type:
|
|
4487
|
-
status:
|
|
4488
|
-
from_date:
|
|
4489
|
-
to_date:
|
|
4490
|
-
page:
|
|
4491
|
-
per_page:
|
|
4617
|
+
bigint: ((r) => he.create({ ...r, coerce: !0 })),
|
|
4618
|
+
date: ((r) => xe.create({ ...r, coerce: !0 }))
|
|
4619
|
+
}, Ws = Bs({
|
|
4620
|
+
q: Te().optional(),
|
|
4621
|
+
task_type: Te().optional(),
|
|
4622
|
+
status: Te().optional(),
|
|
4623
|
+
from_date: Te().optional(),
|
|
4624
|
+
to_date: Te().optional(),
|
|
4625
|
+
page: It.number().int().positive().default(1),
|
|
4626
|
+
per_page: It.number().int().positive().default(20)
|
|
4492
4627
|
});
|
|
4493
|
-
function
|
|
4628
|
+
function ar(r) {
|
|
4494
4629
|
return { data: [], isLoading: !1, raw: { metadata: { total: 0 } } };
|
|
4495
4630
|
}
|
|
4496
|
-
function
|
|
4631
|
+
function ir(r) {
|
|
4497
4632
|
return { data: null, isLoading: !1 };
|
|
4498
4633
|
}
|
|
4499
|
-
function
|
|
4634
|
+
function or({ setSelectedTask: r }) {
|
|
4500
4635
|
const e = (s) => {
|
|
4501
|
-
const { data: n, raw: a, isLoading:
|
|
4636
|
+
const { data: n, raw: a, isLoading: d } = ar();
|
|
4502
4637
|
return {
|
|
4503
4638
|
data: n ?? [],
|
|
4504
|
-
isLoading:
|
|
4639
|
+
isLoading: d,
|
|
4505
4640
|
raw: a
|
|
4506
4641
|
};
|
|
4507
4642
|
}, t = [
|
|
@@ -4511,7 +4646,7 @@ function ar({ setSelectedTask: r }) {
|
|
|
4511
4646
|
{
|
|
4512
4647
|
key: "attempts",
|
|
4513
4648
|
header: "Attempts",
|
|
4514
|
-
render: (s) => /* @__PURE__ */
|
|
4649
|
+
render: (s) => /* @__PURE__ */ l.jsxs("span", { children: [
|
|
4515
4650
|
s.attempts,
|
|
4516
4651
|
"/",
|
|
4517
4652
|
s.max_attempts
|
|
@@ -4521,24 +4656,24 @@ function ar({ setSelectedTask: r }) {
|
|
|
4521
4656
|
key: "error",
|
|
4522
4657
|
header: "Error",
|
|
4523
4658
|
className: "max-w-xs truncate",
|
|
4524
|
-
render: (s) => /* @__PURE__ */
|
|
4659
|
+
render: (s) => /* @__PURE__ */ l.jsx("span", { title: s.error || "", children: s.error })
|
|
4525
4660
|
},
|
|
4526
4661
|
{
|
|
4527
4662
|
key: "created_at",
|
|
4528
4663
|
header: "Created",
|
|
4529
|
-
render: (s) =>
|
|
4664
|
+
render: (s) => Oe(s.created_at)
|
|
4530
4665
|
}
|
|
4531
4666
|
];
|
|
4532
|
-
return /* @__PURE__ */
|
|
4533
|
-
|
|
4667
|
+
return /* @__PURE__ */ l.jsx(
|
|
4668
|
+
Vt,
|
|
4534
4669
|
{
|
|
4535
4670
|
title: "Background Tasks",
|
|
4536
|
-
paramsSchema:
|
|
4671
|
+
paramsSchema: Ws,
|
|
4537
4672
|
useQuery: e,
|
|
4538
4673
|
columns: t,
|
|
4539
4674
|
onRowClick: r,
|
|
4540
|
-
renderFilters: (s, n) => /* @__PURE__ */
|
|
4541
|
-
/* @__PURE__ */
|
|
4675
|
+
renderFilters: (s, n) => /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
4676
|
+
/* @__PURE__ */ l.jsx(
|
|
4542
4677
|
"input",
|
|
4543
4678
|
{
|
|
4544
4679
|
type: "search",
|
|
@@ -4548,38 +4683,38 @@ function ar({ setSelectedTask: r }) {
|
|
|
4548
4683
|
onChange: (a) => n("q", a.target.value)
|
|
4549
4684
|
}
|
|
4550
4685
|
),
|
|
4551
|
-
/* @__PURE__ */
|
|
4686
|
+
/* @__PURE__ */ l.jsxs(
|
|
4552
4687
|
"select",
|
|
4553
4688
|
{
|
|
4554
4689
|
className: "select select-sm select-bordered w-40",
|
|
4555
4690
|
value: s.task_type || "",
|
|
4556
4691
|
onChange: (a) => n("task_type", a.target.value),
|
|
4557
4692
|
children: [
|
|
4558
|
-
/* @__PURE__ */
|
|
4559
|
-
/* @__PURE__ */
|
|
4560
|
-
/* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4562
|
-
/* @__PURE__ */
|
|
4563
|
-
/* @__PURE__ */
|
|
4693
|
+
/* @__PURE__ */ l.jsx("option", { value: "", children: "All Types" }),
|
|
4694
|
+
/* @__PURE__ */ l.jsx("option", { value: "email_registration", children: "Email Registration" }),
|
|
4695
|
+
/* @__PURE__ */ l.jsx("option", { value: "email_password_reset", children: "Email Password Reset" }),
|
|
4696
|
+
/* @__PURE__ */ l.jsx("option", { value: "email_notification", children: "Email Notification" }),
|
|
4697
|
+
/* @__PURE__ */ l.jsx("option", { value: "resize_image", children: "Resize Image" }),
|
|
4698
|
+
/* @__PURE__ */ l.jsx("option", { value: "zip_import", children: "Zip Import" })
|
|
4564
4699
|
]
|
|
4565
4700
|
}
|
|
4566
4701
|
),
|
|
4567
|
-
/* @__PURE__ */
|
|
4702
|
+
/* @__PURE__ */ l.jsxs(
|
|
4568
4703
|
"select",
|
|
4569
4704
|
{
|
|
4570
4705
|
className: "select select-sm select-bordered w-40",
|
|
4571
4706
|
value: s.status || "",
|
|
4572
4707
|
onChange: (a) => n("status", a.target.value),
|
|
4573
4708
|
children: [
|
|
4574
|
-
/* @__PURE__ */
|
|
4575
|
-
/* @__PURE__ */
|
|
4576
|
-
/* @__PURE__ */
|
|
4577
|
-
/* @__PURE__ */
|
|
4578
|
-
/* @__PURE__ */
|
|
4709
|
+
/* @__PURE__ */ l.jsx("option", { value: "", children: "All Statuses" }),
|
|
4710
|
+
/* @__PURE__ */ l.jsx("option", { value: "pending", children: "Pending" }),
|
|
4711
|
+
/* @__PURE__ */ l.jsx("option", { value: "running", children: "Running" }),
|
|
4712
|
+
/* @__PURE__ */ l.jsx("option", { value: "completed", children: "Completed" }),
|
|
4713
|
+
/* @__PURE__ */ l.jsx("option", { value: "failed", children: "Failed" })
|
|
4579
4714
|
]
|
|
4580
4715
|
}
|
|
4581
4716
|
),
|
|
4582
|
-
/* @__PURE__ */
|
|
4717
|
+
/* @__PURE__ */ l.jsx(
|
|
4583
4718
|
"input",
|
|
4584
4719
|
{
|
|
4585
4720
|
type: "date",
|
|
@@ -4587,12 +4722,12 @@ function ar({ setSelectedTask: r }) {
|
|
|
4587
4722
|
className: "input input-sm input-bordered w-40",
|
|
4588
4723
|
value: s.from_date ? s.from_date.split("T")[0] : "",
|
|
4589
4724
|
onChange: (a) => {
|
|
4590
|
-
const
|
|
4591
|
-
n("from_date",
|
|
4725
|
+
const d = a.target.value ? new Date(a.target.value).toISOString() : void 0;
|
|
4726
|
+
n("from_date", d);
|
|
4592
4727
|
}
|
|
4593
4728
|
}
|
|
4594
4729
|
),
|
|
4595
|
-
/* @__PURE__ */
|
|
4730
|
+
/* @__PURE__ */ l.jsx(
|
|
4596
4731
|
"input",
|
|
4597
4732
|
{
|
|
4598
4733
|
type: "date",
|
|
@@ -4600,8 +4735,8 @@ function ar({ setSelectedTask: r }) {
|
|
|
4600
4735
|
className: "input input-sm input-bordered w-40",
|
|
4601
4736
|
value: s.to_date ? s.to_date.split("T")[0] : "",
|
|
4602
4737
|
onChange: (a) => {
|
|
4603
|
-
const
|
|
4604
|
-
n("to_date",
|
|
4738
|
+
const d = a.target.value ? new Date(a.target.value).toISOString() : void 0;
|
|
4739
|
+
n("to_date", d);
|
|
4605
4740
|
}
|
|
4606
4741
|
}
|
|
4607
4742
|
)
|
|
@@ -4610,108 +4745,108 @@ function ar({ setSelectedTask: r }) {
|
|
|
4610
4745
|
}
|
|
4611
4746
|
);
|
|
4612
4747
|
}
|
|
4613
|
-
function
|
|
4614
|
-
const s =
|
|
4748
|
+
function lr({ selectedTask: r, setSelectedTask: e }) {
|
|
4749
|
+
const s = ir(r?.id).data ?? null;
|
|
4615
4750
|
if (!r) return null;
|
|
4616
4751
|
const n = s?.payload ?? r.payload ?? null;
|
|
4617
|
-
return /* @__PURE__ */
|
|
4752
|
+
return /* @__PURE__ */ l.jsx(
|
|
4618
4753
|
"div",
|
|
4619
4754
|
{
|
|
4620
4755
|
className: "modal modal-open",
|
|
4621
4756
|
role: "dialog",
|
|
4622
4757
|
onClick: () => e(null),
|
|
4623
|
-
children: /* @__PURE__ */
|
|
4624
|
-
/* @__PURE__ */
|
|
4758
|
+
children: /* @__PURE__ */ l.jsxs("div", { className: "modal-box max-w-3xl", onClick: (a) => a.stopPropagation(), children: [
|
|
4759
|
+
/* @__PURE__ */ l.jsxs("h3", { className: "font-bold text-lg", children: [
|
|
4625
4760
|
"Task #",
|
|
4626
4761
|
r.id,
|
|
4627
4762
|
" — ",
|
|
4628
4763
|
r.task_type
|
|
4629
4764
|
] }),
|
|
4630
|
-
/* @__PURE__ */
|
|
4631
|
-
/* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4765
|
+
/* @__PURE__ */ l.jsxs("div", { className: "mt-4 grid grid-cols-2 gap-4 text-sm", children: [
|
|
4766
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4767
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Status:" }),
|
|
4633
4768
|
" ",
|
|
4634
4769
|
r.status
|
|
4635
4770
|
] }),
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4771
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4772
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Attempts:" }),
|
|
4638
4773
|
" ",
|
|
4639
4774
|
r.attempts,
|
|
4640
4775
|
"/",
|
|
4641
4776
|
r.max_attempts
|
|
4642
4777
|
] }),
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
4778
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4779
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Scheduled:" }),
|
|
4645
4780
|
" ",
|
|
4646
4781
|
r.scheduled_for ?? "—"
|
|
4647
4782
|
] }),
|
|
4648
|
-
/* @__PURE__ */
|
|
4649
|
-
/* @__PURE__ */
|
|
4783
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4784
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Started:" }),
|
|
4650
4785
|
" ",
|
|
4651
|
-
|
|
4786
|
+
Oe(r.started_at)
|
|
4652
4787
|
] }),
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
/* @__PURE__ */
|
|
4788
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4789
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Completed:" }),
|
|
4655
4790
|
" ",
|
|
4656
|
-
|
|
4791
|
+
Oe(r.completed_at)
|
|
4657
4792
|
] }),
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4794
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Created:" }),
|
|
4660
4795
|
" ",
|
|
4661
|
-
|
|
4796
|
+
Oe(r.created_at)
|
|
4662
4797
|
] }),
|
|
4663
|
-
/* @__PURE__ */
|
|
4664
|
-
/* @__PURE__ */
|
|
4798
|
+
/* @__PURE__ */ l.jsxs("div", { children: [
|
|
4799
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Updated:" }),
|
|
4665
4800
|
" ",
|
|
4666
|
-
|
|
4801
|
+
Oe(r.updated_at)
|
|
4667
4802
|
] }),
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
/* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ l.jsxs("div", { className: "col-span-2", children: [
|
|
4804
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Error:" }),
|
|
4805
|
+
/* @__PURE__ */ l.jsx("div", { className: "whitespace-pre-wrap", children: r.error ?? "—" })
|
|
4671
4806
|
] }),
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
/* @__PURE__ */
|
|
4674
|
-
/* @__PURE__ */
|
|
4807
|
+
/* @__PURE__ */ l.jsxs("div", { className: "col-span-2", children: [
|
|
4808
|
+
/* @__PURE__ */ l.jsx("strong", { children: "Payload:" }),
|
|
4809
|
+
/* @__PURE__ */ l.jsx("pre", { className: "bg-base-200 p-2 rounded max-h-48 overflow-auto text-xs", children: (() => {
|
|
4675
4810
|
const a = n;
|
|
4676
4811
|
if (a == null) return "—";
|
|
4677
4812
|
try {
|
|
4678
|
-
const
|
|
4679
|
-
return JSON.stringify(
|
|
4813
|
+
const d = typeof a == "string" ? JSON.parse(a) : a;
|
|
4814
|
+
return JSON.stringify(d ?? "—", null, 2);
|
|
4680
4815
|
} catch {
|
|
4681
4816
|
return typeof a == "string" ? a : JSON.stringify(a);
|
|
4682
4817
|
}
|
|
4683
4818
|
})() })
|
|
4684
4819
|
] })
|
|
4685
4820
|
] }),
|
|
4686
|
-
/* @__PURE__ */
|
|
4821
|
+
/* @__PURE__ */ l.jsx("div", { className: "modal-action", children: /* @__PURE__ */ l.jsx("button", { className: "btn", onClick: () => e(null), children: "Close" }) })
|
|
4687
4822
|
] })
|
|
4688
4823
|
}
|
|
4689
4824
|
);
|
|
4690
4825
|
}
|
|
4691
|
-
const
|
|
4826
|
+
const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4692
4827
|
__proto__: null,
|
|
4693
|
-
AdminLayout:
|
|
4694
|
-
AlertCard:
|
|
4695
|
-
GenericFormModal:
|
|
4696
|
-
GenericList:
|
|
4697
|
-
ModalErrors:
|
|
4698
|
-
Pagination:
|
|
4699
|
-
QRCodeGenerator:
|
|
4700
|
-
TasksList:
|
|
4701
|
-
TasksModal:
|
|
4828
|
+
AdminLayout: Dt,
|
|
4829
|
+
AlertCard: Tr,
|
|
4830
|
+
GenericFormModal: Or,
|
|
4831
|
+
GenericList: Vt,
|
|
4832
|
+
ModalErrors: as,
|
|
4833
|
+
Pagination: Ut,
|
|
4834
|
+
QRCodeGenerator: gs,
|
|
4835
|
+
TasksList: or,
|
|
4836
|
+
TasksModal: lr
|
|
4702
4837
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4703
|
-
function
|
|
4704
|
-
const [r, e] =
|
|
4705
|
-
return /* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
4707
|
-
/* @__PURE__ */
|
|
4838
|
+
function qs() {
|
|
4839
|
+
const [r, e] = de(null);
|
|
4840
|
+
return /* @__PURE__ */ l.jsxs(Dt, { title: "Tasks", children: [
|
|
4841
|
+
/* @__PURE__ */ l.jsx(or, { setSelectedTask: e }),
|
|
4842
|
+
/* @__PURE__ */ l.jsx(lr, { selectedTask: r, setSelectedTask: e })
|
|
4708
4843
|
] });
|
|
4709
4844
|
}
|
|
4710
|
-
const
|
|
4845
|
+
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4711
4846
|
__proto__: null,
|
|
4712
|
-
AdminTasks:
|
|
4847
|
+
AdminTasks: qs
|
|
4713
4848
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4714
|
-
function
|
|
4849
|
+
function an({
|
|
4715
4850
|
label: r,
|
|
4716
4851
|
field: e,
|
|
4717
4852
|
params: t,
|
|
@@ -4719,22 +4854,22 @@ function sn({
|
|
|
4719
4854
|
setFilters: n,
|
|
4720
4855
|
className: a = ""
|
|
4721
4856
|
}) {
|
|
4722
|
-
const
|
|
4857
|
+
const d = t.sort_by, u = t.sort_order, i = d === e, o = i ? u === "asc" ? vr : yr : gr, c = () => {
|
|
4723
4858
|
let f = "asc";
|
|
4724
4859
|
i && u === "asc" && (f = "desc"), n ? n({
|
|
4725
4860
|
sort_by: e,
|
|
4726
4861
|
sort_order: f
|
|
4727
4862
|
}) : (s("sort_by", e), s("sort_order", f));
|
|
4728
4863
|
};
|
|
4729
|
-
return /* @__PURE__ */
|
|
4864
|
+
return /* @__PURE__ */ l.jsxs(
|
|
4730
4865
|
"div",
|
|
4731
4866
|
{
|
|
4732
4867
|
className: `cursor-pointer hover:bg-base-200 transition-colors flex items-center gap-2 select-none ${a}`,
|
|
4733
|
-
onClick:
|
|
4868
|
+
onClick: c,
|
|
4734
4869
|
children: [
|
|
4735
4870
|
r,
|
|
4736
|
-
/* @__PURE__ */
|
|
4737
|
-
|
|
4871
|
+
/* @__PURE__ */ l.jsx(
|
|
4872
|
+
Le,
|
|
4738
4873
|
{
|
|
4739
4874
|
icon: o,
|
|
4740
4875
|
className: i ? "text-primary" : "text-base-content/30"
|
|
@@ -4744,13 +4879,13 @@ function sn({
|
|
|
4744
4879
|
}
|
|
4745
4880
|
);
|
|
4746
4881
|
}
|
|
4747
|
-
function
|
|
4882
|
+
function on() {
|
|
4748
4883
|
return {
|
|
4749
|
-
useList: (r) =>
|
|
4750
|
-
useGet: (r) =>
|
|
4884
|
+
useList: (r) => ar(),
|
|
4885
|
+
useGet: (r) => ir()
|
|
4751
4886
|
};
|
|
4752
4887
|
}
|
|
4753
|
-
function
|
|
4888
|
+
function ln(r, e) {
|
|
4754
4889
|
const t = {};
|
|
4755
4890
|
e.defaults && Object.assign(t, e.defaults);
|
|
4756
4891
|
for (const [s, n] of Object.entries(r || {}))
|
|
@@ -4769,19 +4904,19 @@ function an(r, e) {
|
|
|
4769
4904
|
return t;
|
|
4770
4905
|
}
|
|
4771
4906
|
export {
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4907
|
+
Dt as AdminLayout,
|
|
4908
|
+
wr as AuthProvider,
|
|
4909
|
+
Vt as GenericList,
|
|
4910
|
+
Ut as Pagination,
|
|
4911
|
+
an as SortHeader,
|
|
4912
|
+
Ks as auth,
|
|
4913
|
+
en as buildApiQuery,
|
|
4914
|
+
sn as components,
|
|
4915
|
+
nn as pages,
|
|
4916
|
+
vt as parseParams,
|
|
4917
|
+
Fe as toSearchParams,
|
|
4918
|
+
oe as useAuthApi,
|
|
4919
|
+
$t as useAuthConfig,
|
|
4920
|
+
on as useTasksApi,
|
|
4921
|
+
ln as validateParams
|
|
4787
4922
|
};
|