@ericbutera/kaleido 0.4.1 → 0.4.3
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 +999 -956
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMutation as Bs, useInfiniteQuery as Qs, useSuspenseQuery as Ws, useQuery as Hs, QueryClient as Ys, MutationCache as Gs } from "@tanstack/react-query";
|
|
2
|
-
import { QueryClientProvider as
|
|
2
|
+
import { QueryClientProvider as Wa } from "@tanstack/react-query";
|
|
3
3
|
import B, { useState as ae, useRef as Ks, useEffect as Se, useMemo as Xt, createContext as Js, useContext as es } from "react";
|
|
4
4
|
import { Outlet as ts, useSearchParams as vt, useLocation as Be, Navigate as lt, Link as he, useNavigate as Ie } from "react-router-dom";
|
|
5
5
|
import re from "react-hot-toast";
|
|
@@ -13,16 +13,16 @@ function ar() {
|
|
|
13
13
|
Nt = 1;
|
|
14
14
|
var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
15
15
|
function s(r, n, a) {
|
|
16
|
-
var
|
|
17
|
-
if (a !== void 0 && (
|
|
16
|
+
var o = null;
|
|
17
|
+
if (a !== void 0 && (o = "" + a), n.key !== void 0 && (o = "" + n.key), "key" in n) {
|
|
18
18
|
a = {};
|
|
19
|
-
for (var
|
|
20
|
-
|
|
19
|
+
for (var d in n)
|
|
20
|
+
d !== "key" && (a[d] = n[d]);
|
|
21
21
|
} else a = n;
|
|
22
22
|
return n = a.ref, {
|
|
23
23
|
$$typeof: t,
|
|
24
24
|
type: r,
|
|
25
|
-
key:
|
|
25
|
+
key: o,
|
|
26
26
|
ref: n !== void 0 ? n : null,
|
|
27
27
|
props: a
|
|
28
28
|
};
|
|
@@ -43,7 +43,7 @@ function ir() {
|
|
|
43
43
|
return "Fragment";
|
|
44
44
|
case N:
|
|
45
45
|
return "Profiler";
|
|
46
|
-
case
|
|
46
|
+
case R:
|
|
47
47
|
return "StrictMode";
|
|
48
48
|
case A:
|
|
49
49
|
return "Suspense";
|
|
@@ -60,7 +60,7 @@ function ir() {
|
|
|
60
60
|
return "Portal";
|
|
61
61
|
case S:
|
|
62
62
|
return p.displayName || "Context";
|
|
63
|
-
case
|
|
63
|
+
case _:
|
|
64
64
|
return (p._context.displayName || "Context") + ".Consumer";
|
|
65
65
|
case U:
|
|
66
66
|
var k = p.render;
|
|
@@ -88,11 +88,11 @@ function ir() {
|
|
|
88
88
|
}
|
|
89
89
|
if (k) {
|
|
90
90
|
k = console;
|
|
91
|
-
var
|
|
92
|
-
return
|
|
91
|
+
var T = k.error, P = typeof Symbol == "function" && Symbol.toStringTag && p[Symbol.toStringTag] || p.constructor.name || "Object";
|
|
92
|
+
return T.call(
|
|
93
93
|
k,
|
|
94
94
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
95
|
-
|
|
95
|
+
P
|
|
96
96
|
), e(p);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -114,42 +114,42 @@ function ir() {
|
|
|
114
114
|
function a() {
|
|
115
115
|
return Error("react-stack-top-frame");
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function o(p) {
|
|
118
118
|
if (H.call(p, "key")) {
|
|
119
119
|
var k = Object.getOwnPropertyDescriptor(p, "key").get;
|
|
120
120
|
if (k && k.isReactWarning) return !1;
|
|
121
121
|
}
|
|
122
122
|
return p.key !== void 0;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
function
|
|
124
|
+
function d(p, k) {
|
|
125
|
+
function T() {
|
|
126
126
|
ve || (ve = !0, console.error(
|
|
127
127
|
"%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)",
|
|
128
128
|
k
|
|
129
129
|
));
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
get:
|
|
131
|
+
T.isReactWarning = !0, Object.defineProperty(p, "key", {
|
|
132
|
+
get: T,
|
|
133
133
|
configurable: !0
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function l() {
|
|
137
137
|
var p = t(this.type);
|
|
138
138
|
return ee[p] || (ee[p] = !0, console.error(
|
|
139
139
|
"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."
|
|
140
140
|
)), p = this.props.ref, p !== void 0 ? p : null;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
var Z =
|
|
142
|
+
function c(p, k, T, P, se, ue) {
|
|
143
|
+
var Z = T.ref;
|
|
144
144
|
return p = {
|
|
145
145
|
$$typeof: g,
|
|
146
146
|
type: p,
|
|
147
147
|
key: k,
|
|
148
|
-
props:
|
|
149
|
-
_owner:
|
|
148
|
+
props: T,
|
|
149
|
+
_owner: P
|
|
150
150
|
}, (Z !== void 0 ? Z : null) !== null ? Object.defineProperty(p, "ref", {
|
|
151
151
|
enumerable: !1,
|
|
152
|
-
get:
|
|
152
|
+
get: l
|
|
153
153
|
}) : Object.defineProperty(p, "ref", { enumerable: !1, value: null }), p._store = {}, Object.defineProperty(p._store, "validated", {
|
|
154
154
|
configurable: !1,
|
|
155
155
|
enumerable: !1,
|
|
@@ -169,16 +169,16 @@ function ir() {
|
|
|
169
169
|
configurable: !1,
|
|
170
170
|
enumerable: !1,
|
|
171
171
|
writable: !0,
|
|
172
|
-
value:
|
|
172
|
+
value: ue
|
|
173
173
|
}), Object.freeze && (Object.freeze(p.props), Object.freeze(p)), p;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function u(p, k, T, P, se, ue) {
|
|
176
176
|
var Z = k.children;
|
|
177
177
|
if (Z !== void 0)
|
|
178
|
-
if (
|
|
178
|
+
if (P)
|
|
179
179
|
if (G(Z)) {
|
|
180
|
-
for (
|
|
181
|
-
f(Z[
|
|
180
|
+
for (P = 0; P < Z.length; P++)
|
|
181
|
+
f(Z[P]);
|
|
182
182
|
Object.freeze && Object.freeze(Z);
|
|
183
183
|
} else
|
|
184
184
|
console.error(
|
|
@@ -190,34 +190,34 @@ function ir() {
|
|
|
190
190
|
var je = Object.keys(k).filter(function(Vs) {
|
|
191
191
|
return Vs !== "key";
|
|
192
192
|
});
|
|
193
|
-
|
|
193
|
+
P = 0 < je.length ? "{key: someKey, " + je.join(": ..., ") + ": ...}" : "{key: someKey}", z[Z + P] || (je = 0 < je.length ? "{" + je.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
194
194
|
`A props object containing a "key" prop is being spread into JSX:
|
|
195
195
|
let props = %s;
|
|
196
196
|
<%s {...props} />
|
|
197
197
|
React keys must be passed directly to JSX without using spread:
|
|
198
198
|
let props = %s;
|
|
199
199
|
<%s key={someKey} {...props} />`,
|
|
200
|
-
|
|
200
|
+
P,
|
|
201
201
|
Z,
|
|
202
202
|
je,
|
|
203
203
|
Z
|
|
204
|
-
), z[Z +
|
|
204
|
+
), z[Z + P] = !0);
|
|
205
205
|
}
|
|
206
|
-
if (Z = null,
|
|
207
|
-
|
|
206
|
+
if (Z = null, T !== void 0 && (s(T), Z = "" + T), o(k) && (s(k.key), Z = "" + k.key), "key" in k) {
|
|
207
|
+
T = {};
|
|
208
208
|
for (var at in k)
|
|
209
|
-
at !== "key" && (
|
|
210
|
-
} else
|
|
211
|
-
return Z &&
|
|
212
|
-
|
|
209
|
+
at !== "key" && (T[at] = k[at]);
|
|
210
|
+
} else T = k;
|
|
211
|
+
return Z && d(
|
|
212
|
+
T,
|
|
213
213
|
typeof p == "function" ? p.displayName || p.name || "Unknown" : p
|
|
214
|
-
),
|
|
214
|
+
), c(
|
|
215
215
|
p,
|
|
216
216
|
Z,
|
|
217
|
-
|
|
217
|
+
T,
|
|
218
218
|
n(),
|
|
219
219
|
se,
|
|
220
|
-
|
|
220
|
+
ue
|
|
221
221
|
);
|
|
222
222
|
}
|
|
223
223
|
function f(p) {
|
|
@@ -226,7 +226,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
226
226
|
function h(p) {
|
|
227
227
|
return typeof p == "object" && p !== null && p.$$typeof === g;
|
|
228
228
|
}
|
|
229
|
-
var m = B, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), b = /* @__PURE__ */ Symbol.for("react.portal"), v = /* @__PURE__ */ Symbol.for("react.fragment"),
|
|
229
|
+
var m = B, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), b = /* @__PURE__ */ Symbol.for("react.portal"), v = /* @__PURE__ */ Symbol.for("react.fragment"), R = /* @__PURE__ */ Symbol.for("react.strict_mode"), N = /* @__PURE__ */ Symbol.for("react.profiler"), _ = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), U = /* @__PURE__ */ Symbol.for("react.forward_ref"), A = /* @__PURE__ */ Symbol.for("react.suspense"), V = /* @__PURE__ */ Symbol.for("react.suspense_list"), W = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), X = /* @__PURE__ */ Symbol.for("react.activity"), M = /* @__PURE__ */ Symbol.for("react.client.reference"), L = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, G = Array.isArray, D = console.createTask ? console.createTask : function() {
|
|
230
230
|
return null;
|
|
231
231
|
};
|
|
232
232
|
m = {
|
|
@@ -238,25 +238,25 @@ React keys must be passed directly to JSX without using spread:
|
|
|
238
238
|
m,
|
|
239
239
|
a
|
|
240
240
|
)(), J = D(r(a)), z = {};
|
|
241
|
-
$e.Fragment = v, $e.jsx = function(p, k,
|
|
242
|
-
var
|
|
243
|
-
return
|
|
241
|
+
$e.Fragment = v, $e.jsx = function(p, k, T) {
|
|
242
|
+
var P = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
243
|
+
return u(
|
|
244
244
|
p,
|
|
245
245
|
k,
|
|
246
|
-
|
|
246
|
+
T,
|
|
247
247
|
!1,
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
P ? Error("react-stack-top-frame") : ie,
|
|
249
|
+
P ? D(r(p)) : J
|
|
250
250
|
);
|
|
251
|
-
}, $e.jsxs = function(p, k,
|
|
252
|
-
var
|
|
253
|
-
return
|
|
251
|
+
}, $e.jsxs = function(p, k, T) {
|
|
252
|
+
var P = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
253
|
+
return u(
|
|
254
254
|
p,
|
|
255
255
|
k,
|
|
256
|
-
|
|
256
|
+
T,
|
|
257
257
|
!0,
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
P ? Error("react-stack-top-frame") : ie,
|
|
259
|
+
P ? D(r(p)) : J
|
|
260
260
|
);
|
|
261
261
|
};
|
|
262
262
|
})()), $e;
|
|
@@ -273,14 +273,14 @@ function lr(t) {
|
|
|
273
273
|
function cr() {
|
|
274
274
|
return /* @__PURE__ */ i.jsx("header", { className: "bg-base-300 p-4", children: /* @__PURE__ */ i.jsx("div", { className: "container mx-auto font-semibold", children: "Kaleido" }) });
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function dr() {
|
|
277
277
|
return /* @__PURE__ */ i.jsx("div", { className: "text-sm text-muted", children: "No admin navigation provided." });
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function ur() {
|
|
280
280
|
return He.SiteNavigation ?? cr;
|
|
281
281
|
}
|
|
282
282
|
function fr() {
|
|
283
|
-
return He.AdminNav ??
|
|
283
|
+
return He.AdminNav ?? dr;
|
|
284
284
|
}
|
|
285
285
|
function ss({
|
|
286
286
|
icon: t,
|
|
@@ -290,7 +290,7 @@ function ss({
|
|
|
290
290
|
to: n,
|
|
291
291
|
error: a
|
|
292
292
|
}) {
|
|
293
|
-
const
|
|
293
|
+
const o = /* @__PURE__ */ i.jsxs("div", { className: "stat bg-base-100 shadow", children: [
|
|
294
294
|
a && /* @__PURE__ */ i.jsx("div", { className: "stat-figure", children: /* @__PURE__ */ i.jsx("div", { className: "tooltip tooltip-left", "data-tip": a, children: /* @__PURE__ */ i.jsx(
|
|
295
295
|
"span",
|
|
296
296
|
{
|
|
@@ -306,7 +306,7 @@ function ss({
|
|
|
306
306
|
/* @__PURE__ */ i.jsx("div", { className: "stat-value", children: a ? "—" : s ?? "—" }),
|
|
307
307
|
r && /* @__PURE__ */ i.jsx("div", { className: "stat-desc", children: r })
|
|
308
308
|
] });
|
|
309
|
-
return n ? /* @__PURE__ */ i.jsx("a", { href: n, className: "block", children:
|
|
309
|
+
return n ? /* @__PURE__ */ i.jsx("a", { href: n, className: "block", children: o }) : o;
|
|
310
310
|
}
|
|
311
311
|
const hr = {
|
|
312
312
|
auth: "Auth",
|
|
@@ -335,7 +335,7 @@ function rs({
|
|
|
335
335
|
title: t,
|
|
336
336
|
children: e
|
|
337
337
|
}) {
|
|
338
|
-
const s =
|
|
338
|
+
const s = ur(), r = fr();
|
|
339
339
|
return /* @__PURE__ */ i.jsxs("div", { className: "min-h-screen bg-base-200", children: [
|
|
340
340
|
/* @__PURE__ */ i.jsx(s, {}),
|
|
341
341
|
/* @__PURE__ */ i.jsxs("div", { className: "container mx-auto p-6", children: [
|
|
@@ -376,7 +376,7 @@ function os() {
|
|
|
376
376
|
);
|
|
377
377
|
return Ze.useUpdateFeatureFlag();
|
|
378
378
|
}
|
|
379
|
-
const
|
|
379
|
+
const Aa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
380
380
|
__proto__: null,
|
|
381
381
|
FLAG_API_CLIENTS: yr,
|
|
382
382
|
FLAG_OAUTH: as,
|
|
@@ -387,19 +387,19 @@ const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
387
387
|
useUpdateFeatureFlag: os
|
|
388
388
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
389
389
|
function vr() {
|
|
390
|
-
const { data: t = [], isLoading: e, refetch: s } = xt(), r = os(), [n, a] = ae({}),
|
|
391
|
-
const
|
|
392
|
-
if (!
|
|
393
|
-
const
|
|
394
|
-
a((
|
|
390
|
+
const { data: t = [], isLoading: e, refetch: s } = xt(), r = os(), [n, a] = ae({}), o = async (d) => {
|
|
391
|
+
const l = t.find((u) => u.feature_key === d);
|
|
392
|
+
if (!l) return;
|
|
393
|
+
const c = !l.enabled;
|
|
394
|
+
a((u) => ({ ...u, [d]: !0 }));
|
|
395
395
|
try {
|
|
396
|
-
await r.mutateAsync({ key:
|
|
397
|
-
} catch (
|
|
398
|
-
console.error("Failed to update feature flag",
|
|
396
|
+
await r.mutateAsync({ key: d, enabled: c }), s && await s();
|
|
397
|
+
} catch (u) {
|
|
398
|
+
console.error("Failed to update feature flag", u), re.error("Failed to update feature flag");
|
|
399
399
|
} finally {
|
|
400
|
-
a((
|
|
401
|
-
const f = { ...
|
|
402
|
-
return delete f[
|
|
400
|
+
a((u) => {
|
|
401
|
+
const f = { ...u };
|
|
402
|
+
return delete f[d], f;
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
};
|
|
@@ -408,23 +408,23 @@ function vr() {
|
|
|
408
408
|
/* @__PURE__ */ i.jsx("h1", { className: "text-2xl font-bold", children: "Feature Flags" }),
|
|
409
409
|
/* @__PURE__ */ i.jsx("p", { className: "text-sm text-base-content/60 mt-1", children: "Configure which features are enabled in the application" })
|
|
410
410
|
] }) }),
|
|
411
|
-
/* @__PURE__ */ i.jsx("div", { className: "bg-base-100 rounded-lg shadow", children: /* @__PURE__ */ i.jsx("div", { className: "divide-y", children: t.map((
|
|
412
|
-
const
|
|
411
|
+
/* @__PURE__ */ i.jsx("div", { className: "bg-base-100 rounded-lg shadow", children: /* @__PURE__ */ i.jsx("div", { className: "divide-y", children: t.map((d) => {
|
|
412
|
+
const l = d.enabled, c = !!n[d.feature_key];
|
|
413
413
|
return /* @__PURE__ */ i.jsxs(
|
|
414
414
|
"div",
|
|
415
415
|
{
|
|
416
|
-
className: `p-4 flex items-center justify-between ${
|
|
416
|
+
className: `p-4 flex items-center justify-between ${c ? "bg-warning/10" : ""}`,
|
|
417
417
|
children: [
|
|
418
418
|
/* @__PURE__ */ i.jsx("div", { className: "flex-1", children: /* @__PURE__ */ i.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
419
|
-
/* @__PURE__ */ i.jsx("h3", { className: "font-semibold text-lg", children:
|
|
420
|
-
|
|
419
|
+
/* @__PURE__ */ i.jsx("h3", { className: "font-semibold text-lg", children: d.feature_key }),
|
|
420
|
+
c && /* @__PURE__ */ i.jsx("span", { className: "badge badge-warning badge-sm", children: "saving" })
|
|
421
421
|
] }) }),
|
|
422
422
|
/* @__PURE__ */ i.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
423
423
|
/* @__PURE__ */ i.jsx(
|
|
424
424
|
"span",
|
|
425
425
|
{
|
|
426
|
-
className: `text-sm font-medium ${
|
|
427
|
-
children:
|
|
426
|
+
className: `text-sm font-medium ${l ? "text-success" : "text-base-content/50"}`,
|
|
427
|
+
children: l ? "Enabled" : "Disabled"
|
|
428
428
|
}
|
|
429
429
|
),
|
|
430
430
|
/* @__PURE__ */ i.jsx(
|
|
@@ -432,14 +432,14 @@ function vr() {
|
|
|
432
432
|
{
|
|
433
433
|
type: "checkbox",
|
|
434
434
|
className: "toggle toggle-success",
|
|
435
|
-
checked:
|
|
436
|
-
onChange: () =>
|
|
435
|
+
checked: l,
|
|
436
|
+
onChange: () => o(d.feature_key)
|
|
437
437
|
}
|
|
438
438
|
)
|
|
439
439
|
] })
|
|
440
440
|
]
|
|
441
441
|
},
|
|
442
|
-
|
|
442
|
+
d.feature_key
|
|
443
443
|
);
|
|
444
444
|
}) }) })
|
|
445
445
|
] });
|
|
@@ -472,18 +472,18 @@ function br({
|
|
|
472
472
|
isSubmitting: r,
|
|
473
473
|
isSaving: n = !1,
|
|
474
474
|
uploadProgress: a,
|
|
475
|
-
onSave:
|
|
476
|
-
onClose:
|
|
477
|
-
onCancel:
|
|
478
|
-
children:
|
|
479
|
-
maxWidth:
|
|
475
|
+
onSave: o,
|
|
476
|
+
onClose: d,
|
|
477
|
+
onCancel: l,
|
|
478
|
+
children: c,
|
|
479
|
+
maxWidth: u = "2xl",
|
|
480
480
|
submitLabel: f = "Save",
|
|
481
481
|
cancelLabel: h = "Cancel"
|
|
482
482
|
}) {
|
|
483
483
|
if (!t) return null;
|
|
484
484
|
const m = r || n, g = () => {
|
|
485
|
-
m || (
|
|
486
|
-
}, b = `max-w-${
|
|
485
|
+
m || (l && l(), d());
|
|
486
|
+
}, b = `max-w-${u}`;
|
|
487
487
|
return /* @__PURE__ */ i.jsx("div", { className: "modal modal-open", onClick: g, children: /* @__PURE__ */ i.jsxs(
|
|
488
488
|
"div",
|
|
489
489
|
{
|
|
@@ -511,8 +511,8 @@ function br({
|
|
|
511
511
|
}
|
|
512
512
|
)
|
|
513
513
|
] }),
|
|
514
|
-
/* @__PURE__ */ i.jsxs("form", { onSubmit: s((v) =>
|
|
515
|
-
|
|
514
|
+
/* @__PURE__ */ i.jsxs("form", { onSubmit: s((v) => o(v, { onClose: d })), children: [
|
|
515
|
+
c,
|
|
516
516
|
/* @__PURE__ */ i.jsxs("div", { className: "modal-action", children: [
|
|
517
517
|
/* @__PURE__ */ i.jsx(
|
|
518
518
|
"button",
|
|
@@ -578,7 +578,7 @@ var Fr = /^\s+/;
|
|
|
578
578
|
function $r(t) {
|
|
579
579
|
return t && t.slice(0, Lr(t) + 1).replace(Fr, "");
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function dt(t) {
|
|
582
582
|
var e = typeof t;
|
|
583
583
|
return t != null && (e == "object" || e == "function");
|
|
584
584
|
}
|
|
@@ -588,9 +588,9 @@ function At(t) {
|
|
|
588
588
|
return t;
|
|
589
589
|
if (Ir(t))
|
|
590
590
|
return St;
|
|
591
|
-
if (
|
|
591
|
+
if (dt(t)) {
|
|
592
592
|
var e = typeof t.valueOf == "function" ? t.valueOf() : t;
|
|
593
|
-
t =
|
|
593
|
+
t = dt(e) ? e + "" : e;
|
|
594
594
|
}
|
|
595
595
|
if (typeof t != "string")
|
|
596
596
|
return t === 0 ? t : +t;
|
|
@@ -602,59 +602,59 @@ var it = function() {
|
|
|
602
602
|
return ls.Date.now();
|
|
603
603
|
}, qr = "Expected a function", Vr = Math.max, Br = Math.min;
|
|
604
604
|
function Qr(t, e, s) {
|
|
605
|
-
var r, n, a,
|
|
605
|
+
var r, n, a, o, d, l, c = 0, u = !1, f = !1, h = !0;
|
|
606
606
|
if (typeof t != "function")
|
|
607
607
|
throw new TypeError(qr);
|
|
608
|
-
e = At(e) || 0,
|
|
608
|
+
e = At(e) || 0, dt(s) && (u = !!s.leading, f = "maxWait" in s, a = f ? Vr(At(s.maxWait) || 0, e) : a, h = "trailing" in s ? !!s.trailing : h);
|
|
609
609
|
function m(A) {
|
|
610
610
|
var V = r, W = n;
|
|
611
|
-
return r = n = void 0,
|
|
611
|
+
return r = n = void 0, c = A, o = t.apply(W, V), o;
|
|
612
612
|
}
|
|
613
613
|
function g(A) {
|
|
614
|
-
return
|
|
614
|
+
return c = A, d = setTimeout(R, e), u ? m(A) : o;
|
|
615
615
|
}
|
|
616
616
|
function b(A) {
|
|
617
|
-
var V = A -
|
|
617
|
+
var V = A - l, W = A - c, Y = e - V;
|
|
618
618
|
return f ? Br(Y, a - W) : Y;
|
|
619
619
|
}
|
|
620
620
|
function v(A) {
|
|
621
|
-
var V = A -
|
|
622
|
-
return
|
|
621
|
+
var V = A - l, W = A - c;
|
|
622
|
+
return l === void 0 || V >= e || V < 0 || f && W >= a;
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function R() {
|
|
625
625
|
var A = it();
|
|
626
626
|
if (v(A))
|
|
627
627
|
return N(A);
|
|
628
|
-
|
|
628
|
+
d = setTimeout(R, b(A));
|
|
629
629
|
}
|
|
630
630
|
function N(A) {
|
|
631
|
-
return
|
|
631
|
+
return d = void 0, h && r ? m(A) : (r = n = void 0, o);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
|
|
633
|
+
function _() {
|
|
634
|
+
d !== void 0 && clearTimeout(d), c = 0, r = l = n = d = void 0;
|
|
635
635
|
}
|
|
636
636
|
function S() {
|
|
637
|
-
return
|
|
637
|
+
return d === void 0 ? o : N(it());
|
|
638
638
|
}
|
|
639
639
|
function U() {
|
|
640
640
|
var A = it(), V = v(A);
|
|
641
|
-
if (r = arguments, n = this,
|
|
642
|
-
if (
|
|
643
|
-
return g(
|
|
641
|
+
if (r = arguments, n = this, l = A, V) {
|
|
642
|
+
if (d === void 0)
|
|
643
|
+
return g(l);
|
|
644
644
|
if (f)
|
|
645
|
-
return clearTimeout(
|
|
645
|
+
return clearTimeout(d), d = setTimeout(R, e), m(l);
|
|
646
646
|
}
|
|
647
|
-
return
|
|
647
|
+
return d === void 0 && (d = setTimeout(R, e)), o;
|
|
648
648
|
}
|
|
649
|
-
return U.cancel =
|
|
649
|
+
return U.cancel = _, U.flush = S, U;
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function Ra(t, e) {
|
|
652
652
|
const s = e?.defaultPage ?? 1, r = e?.defaultPerPage ?? 25, n = {};
|
|
653
653
|
t.page !== void 0 && t.page !== null && t.page !== s && (n.page = Number(t.page)), t.per_page !== void 0 && t.per_page !== null && t.per_page !== r && (n.per_page = Number(t.per_page));
|
|
654
654
|
const a = {};
|
|
655
655
|
t.sort_by && (a.sort_by = String(t.sort_by)), t.sort_order && (a.sort_order = String(t.sort_order));
|
|
656
|
-
const
|
|
657
|
-
return Object.keys(n).length && (
|
|
656
|
+
const o = t.q ?? t.q, d = {};
|
|
657
|
+
return Object.keys(n).length && (d.pagination = n), o != null && String(o) !== "" && (d.q = o), Object.keys(a).length && (d.sort = a), d;
|
|
658
658
|
}
|
|
659
659
|
function Rt(t, e) {
|
|
660
660
|
const s = {};
|
|
@@ -668,7 +668,7 @@ function We(t) {
|
|
|
668
668
|
r != null && e.set(s, String(r));
|
|
669
669
|
}), e;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function ds({
|
|
672
672
|
page: t,
|
|
673
673
|
perPage: e,
|
|
674
674
|
total: s,
|
|
@@ -676,42 +676,42 @@ function us({
|
|
|
676
676
|
className: n = "",
|
|
677
677
|
visiblePages: a = 5
|
|
678
678
|
}) {
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
const
|
|
682
|
-
m !== t && m >= 1 && m <=
|
|
683
|
-
},
|
|
679
|
+
const o = Math.max(1, Math.ceil(s / e));
|
|
680
|
+
if (o <= 1) return null;
|
|
681
|
+
const d = (m) => {
|
|
682
|
+
m !== t && m >= 1 && m <= o && r(m);
|
|
683
|
+
}, l = (m) => /* @__PURE__ */ i.jsx(
|
|
684
684
|
"button",
|
|
685
685
|
{
|
|
686
686
|
className: `join-item btn ${m === t ? "btn-active" : ""}`,
|
|
687
|
-
onClick: () =>
|
|
687
|
+
onClick: () => d(m),
|
|
688
688
|
children: m
|
|
689
689
|
},
|
|
690
690
|
m
|
|
691
|
-
),
|
|
692
|
-
let
|
|
693
|
-
|
|
694
|
-
let f =
|
|
695
|
-
f >
|
|
691
|
+
), c = Math.max(1, Math.min(a, o));
|
|
692
|
+
let u = t - Math.floor(c / 2);
|
|
693
|
+
u < 1 && (u = 1);
|
|
694
|
+
let f = u + c - 1;
|
|
695
|
+
f > o && (f = o, u = Math.max(1, f - c + 1));
|
|
696
696
|
const h = [];
|
|
697
|
-
for (let m =
|
|
697
|
+
for (let m = u; m <= f; m++) h.push(m);
|
|
698
698
|
return /* @__PURE__ */ i.jsx("div", { className: `flex justify-center ${n}`, children: /* @__PURE__ */ i.jsxs("div", { className: "join", children: [
|
|
699
699
|
/* @__PURE__ */ i.jsx(
|
|
700
700
|
"button",
|
|
701
701
|
{
|
|
702
702
|
className: "join-item btn",
|
|
703
703
|
disabled: t === 1,
|
|
704
|
-
onClick: () =>
|
|
704
|
+
onClick: () => d(t - 1),
|
|
705
705
|
children: "«"
|
|
706
706
|
}
|
|
707
707
|
),
|
|
708
|
-
h.map((m) =>
|
|
708
|
+
h.map((m) => l(m)),
|
|
709
709
|
/* @__PURE__ */ i.jsx(
|
|
710
710
|
"button",
|
|
711
711
|
{
|
|
712
712
|
className: "join-item btn",
|
|
713
|
-
disabled: t ===
|
|
714
|
-
onClick: () =>
|
|
713
|
+
disabled: t === o,
|
|
714
|
+
onClick: () => d(t + 1),
|
|
715
715
|
children: "»"
|
|
716
716
|
}
|
|
717
717
|
)
|
|
@@ -724,19 +724,19 @@ function bt({
|
|
|
724
724
|
useQuery: r,
|
|
725
725
|
renderFilters: n,
|
|
726
726
|
columns: a,
|
|
727
|
-
emptyMessage:
|
|
728
|
-
onRowClick:
|
|
729
|
-
paginationType:
|
|
727
|
+
emptyMessage: o = "No items found.",
|
|
728
|
+
onRowClick: d,
|
|
729
|
+
paginationType: l = "pages"
|
|
730
730
|
}) {
|
|
731
|
-
const [
|
|
731
|
+
const [c, u] = vt(), f = Rt(c), { data: h, isLoading: m, raw: g } = r(f), b = g?.metadata?.total ?? 0, v = f.page ?? 1, R = f.per_page ?? 20, [N, _] = ae(f), S = Ks(f);
|
|
732
732
|
Se(() => {
|
|
733
|
-
JSON.stringify(f) !== JSON.stringify(S.current) && (
|
|
733
|
+
JSON.stringify(f) !== JSON.stringify(S.current) && (_(f), S.current = f);
|
|
734
734
|
}, [f]);
|
|
735
735
|
const U = Xt(
|
|
736
736
|
() => Qr((L) => {
|
|
737
|
-
|
|
737
|
+
u(We(L));
|
|
738
738
|
}, 300),
|
|
739
|
-
[
|
|
739
|
+
[u]
|
|
740
740
|
);
|
|
741
741
|
Se(() => () => U.cancel(), [U]);
|
|
742
742
|
const A = (L, H) => {
|
|
@@ -746,7 +746,7 @@ function bt({
|
|
|
746
746
|
// Reset to page 1 when filters change
|
|
747
747
|
page: 1
|
|
748
748
|
};
|
|
749
|
-
|
|
749
|
+
_(G), U(G);
|
|
750
750
|
}, V = (L) => {
|
|
751
751
|
const H = {
|
|
752
752
|
...N,
|
|
@@ -754,15 +754,15 @@ function bt({
|
|
|
754
754
|
// Reset to page 1 when filters change
|
|
755
755
|
page: 1
|
|
756
756
|
};
|
|
757
|
-
|
|
757
|
+
_(H), U(H);
|
|
758
758
|
}, W = () => {
|
|
759
|
-
U.cancel(),
|
|
759
|
+
U.cancel(), u(We(N));
|
|
760
760
|
}, Y = () => {
|
|
761
761
|
const L = Rt(new URLSearchParams());
|
|
762
|
-
|
|
762
|
+
_(L), U.cancel(), u(We(L));
|
|
763
763
|
}, X = (L) => {
|
|
764
764
|
const H = { ...f, page: L };
|
|
765
|
-
|
|
765
|
+
u(We(H));
|
|
766
766
|
}, M = t || e || n;
|
|
767
767
|
return /* @__PURE__ */ i.jsx("div", { className: "card bg-base-100 shadow-xl", children: /* @__PURE__ */ i.jsxs("div", { className: "card-body", children: [
|
|
768
768
|
M && /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [
|
|
@@ -792,15 +792,15 @@ function bt({
|
|
|
792
792
|
] })
|
|
793
793
|
] })
|
|
794
794
|
] }),
|
|
795
|
-
m ? /* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center py-10", children: /* @__PURE__ */ i.jsx("span", { className: "loading loading-spinner loading-lg" }) }) : h.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "text-center py-8", children:
|
|
795
|
+
m ? /* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center py-10", children: /* @__PURE__ */ i.jsx("span", { className: "loading loading-spinner loading-lg" }) }) : h.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "text-center py-8", children: o }) : /* @__PURE__ */ i.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ i.jsxs("table", { className: "table table-zebra w-full", children: [
|
|
796
796
|
/* @__PURE__ */ i.jsx("thead", { children: /* @__PURE__ */ i.jsx("tr", { children: a.map((L) => /* @__PURE__ */ i.jsx("th", { className: L.className, children: typeof L.header == "function" ? L.header(f, A, V) : L.header }, L.key)) }) }),
|
|
797
797
|
/* @__PURE__ */ i.jsx("tbody", { children: h.map((L, H) => {
|
|
798
798
|
const G = L.id !== void 0 ? String(L.id) : `row-${H}`;
|
|
799
799
|
return /* @__PURE__ */ i.jsx(
|
|
800
800
|
"tr",
|
|
801
801
|
{
|
|
802
|
-
className:
|
|
803
|
-
onClick: () =>
|
|
802
|
+
className: d ? "cursor-pointer hover:bg-base-200" : "",
|
|
803
|
+
onClick: () => d?.(L),
|
|
804
804
|
children: a.map((D) => /* @__PURE__ */ i.jsx(
|
|
805
805
|
"td",
|
|
806
806
|
{
|
|
@@ -814,11 +814,11 @@ function bt({
|
|
|
814
814
|
);
|
|
815
815
|
}) })
|
|
816
816
|
] }) }),
|
|
817
|
-
|
|
818
|
-
|
|
817
|
+
l !== "none" && /* @__PURE__ */ i.jsx("div", { className: "mt-4", children: /* @__PURE__ */ i.jsx(
|
|
818
|
+
ds,
|
|
819
819
|
{
|
|
820
820
|
page: v,
|
|
821
|
-
perPage:
|
|
821
|
+
perPage: R,
|
|
822
822
|
total: b,
|
|
823
823
|
onPageChange: X
|
|
824
824
|
}
|
|
@@ -831,9 +831,9 @@ function Wr({
|
|
|
831
831
|
}) {
|
|
832
832
|
return !Array.isArray(t) || t.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: `alert alert-error mb-4 ${e}`.trim(), children: /* @__PURE__ */ i.jsx("ul", { className: "list-disc list-inside", children: t.map((s, r) => /* @__PURE__ */ i.jsx("li", { children: s }, r)) }) });
|
|
833
833
|
}
|
|
834
|
-
var Hr = Object.defineProperty, Ge = Object.getOwnPropertySymbols,
|
|
834
|
+
var Hr = Object.defineProperty, Ge = Object.getOwnPropertySymbols, us = Object.prototype.hasOwnProperty, fs = Object.prototype.propertyIsEnumerable, Pt = (t, e, s) => e in t ? Hr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, ut = (t, e) => {
|
|
835
835
|
for (var s in e || (e = {}))
|
|
836
|
-
|
|
836
|
+
us.call(e, s) && Pt(t, s, e[s]);
|
|
837
837
|
if (Ge)
|
|
838
838
|
for (var s of Ge(e))
|
|
839
839
|
fs.call(e, s) && Pt(t, s, e[s]);
|
|
@@ -841,7 +841,7 @@ var Hr = Object.defineProperty, Ge = Object.getOwnPropertySymbols, ds = Object.p
|
|
|
841
841
|
}, ft = (t, e) => {
|
|
842
842
|
var s = {};
|
|
843
843
|
for (var r in t)
|
|
844
|
-
|
|
844
|
+
us.call(t, r) && e.indexOf(r) < 0 && (s[r] = t[r]);
|
|
845
845
|
if (t != null && Ge)
|
|
846
846
|
for (var r of Ge(t))
|
|
847
847
|
e.indexOf(r) < 0 && fs.call(t, r) && (s[r] = t[r]);
|
|
@@ -855,19 +855,19 @@ var xe;
|
|
|
855
855
|
// error correction level, data codeword bytes, and mask number.
|
|
856
856
|
// This is a low-level API that most users should not use directly.
|
|
857
857
|
// A mid-level API is the encodeSegments() function.
|
|
858
|
-
constructor(
|
|
859
|
-
if (this.version =
|
|
858
|
+
constructor(l, c, u, f) {
|
|
859
|
+
if (this.version = l, this.errorCorrectionLevel = c, this.modules = [], this.isFunction = [], l < I.MIN_VERSION || l > I.MAX_VERSION)
|
|
860
860
|
throw new RangeError("Version value out of range");
|
|
861
861
|
if (f < -1 || f > 7)
|
|
862
862
|
throw new RangeError("Mask value out of range");
|
|
863
|
-
this.size =
|
|
863
|
+
this.size = l * 4 + 17;
|
|
864
864
|
let h = [];
|
|
865
865
|
for (let g = 0; g < this.size; g++)
|
|
866
866
|
h.push(!1);
|
|
867
867
|
for (let g = 0; g < this.size; g++)
|
|
868
868
|
this.modules.push(h.slice()), this.isFunction.push(h.slice());
|
|
869
869
|
this.drawFunctionPatterns();
|
|
870
|
-
const m = this.addEccAndInterleave(
|
|
870
|
+
const m = this.addEccAndInterleave(u);
|
|
871
871
|
if (this.drawCodewords(m), f == -1) {
|
|
872
872
|
let g = 1e9;
|
|
873
873
|
for (let b = 0; b < 8; b++) {
|
|
@@ -884,17 +884,17 @@ var xe;
|
|
|
884
884
|
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
|
885
885
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
886
886
|
// ecl argument if it can be done without increasing the version.
|
|
887
|
-
static encodeText(
|
|
888
|
-
const
|
|
889
|
-
return I.encodeSegments(
|
|
887
|
+
static encodeText(l, c) {
|
|
888
|
+
const u = t.QrSegment.makeSegments(l);
|
|
889
|
+
return I.encodeSegments(u, c);
|
|
890
890
|
}
|
|
891
891
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
892
892
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
893
893
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
894
894
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
895
|
-
static encodeBinary(
|
|
896
|
-
const
|
|
897
|
-
return I.encodeSegments([
|
|
895
|
+
static encodeBinary(l, c) {
|
|
896
|
+
const u = t.QrSegment.makeBytes(l);
|
|
897
|
+
return I.encodeSegments([u], c);
|
|
898
898
|
}
|
|
899
899
|
/*-- Static factory functions (mid level) --*/
|
|
900
900
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -906,43 +906,43 @@ var xe;
|
|
|
906
906
|
// This function allows the user to create a custom sequence of segments that switches
|
|
907
907
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
908
908
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
909
|
-
static encodeSegments(
|
|
910
|
-
if (!(I.MIN_VERSION <=
|
|
909
|
+
static encodeSegments(l, c, u = 1, f = 40, h = -1, m = !0) {
|
|
910
|
+
if (!(I.MIN_VERSION <= u && u <= f && f <= I.MAX_VERSION) || h < -1 || h > 7)
|
|
911
911
|
throw new RangeError("Invalid value");
|
|
912
912
|
let g, b;
|
|
913
|
-
for (g =
|
|
914
|
-
const
|
|
915
|
-
if (S <=
|
|
913
|
+
for (g = u; ; g++) {
|
|
914
|
+
const _ = I.getNumDataCodewords(g, c) * 8, S = o.getTotalBits(l, g);
|
|
915
|
+
if (S <= _) {
|
|
916
916
|
b = S;
|
|
917
917
|
break;
|
|
918
918
|
}
|
|
919
919
|
if (g >= f)
|
|
920
920
|
throw new RangeError("Data too long");
|
|
921
921
|
}
|
|
922
|
-
for (const
|
|
923
|
-
m && b <= I.getNumDataCodewords(g,
|
|
922
|
+
for (const _ of [I.Ecc.MEDIUM, I.Ecc.QUARTILE, I.Ecc.HIGH])
|
|
923
|
+
m && b <= I.getNumDataCodewords(g, _) * 8 && (c = _);
|
|
924
924
|
let v = [];
|
|
925
|
-
for (const
|
|
926
|
-
s(
|
|
927
|
-
for (const S of
|
|
925
|
+
for (const _ of l) {
|
|
926
|
+
s(_.mode.modeBits, 4, v), s(_.numChars, _.mode.numCharCountBits(g), v);
|
|
927
|
+
for (const S of _.getData())
|
|
928
928
|
v.push(S);
|
|
929
929
|
}
|
|
930
930
|
n(v.length == b);
|
|
931
|
-
const
|
|
932
|
-
n(v.length <=
|
|
933
|
-
for (let
|
|
934
|
-
s(
|
|
931
|
+
const R = I.getNumDataCodewords(g, c) * 8;
|
|
932
|
+
n(v.length <= R), s(0, Math.min(4, R - v.length), v), s(0, (8 - v.length % 8) % 8, v), n(v.length % 8 == 0);
|
|
933
|
+
for (let _ = 236; v.length < R; _ ^= 253)
|
|
934
|
+
s(_, 8, v);
|
|
935
935
|
let N = [];
|
|
936
936
|
for (; N.length * 8 < v.length; )
|
|
937
937
|
N.push(0);
|
|
938
|
-
return v.forEach((
|
|
938
|
+
return v.forEach((_, S) => N[S >>> 3] |= _ << 7 - (S & 7)), new I(g, c, N, h);
|
|
939
939
|
}
|
|
940
940
|
/*-- Accessor methods --*/
|
|
941
941
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
942
942
|
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
|
943
943
|
// If the given coordinates are out of bounds, then false (light) is returned.
|
|
944
|
-
getModule(
|
|
945
|
-
return 0 <=
|
|
944
|
+
getModule(l, c) {
|
|
945
|
+
return 0 <= l && l < this.size && 0 <= c && c < this.size && this.modules[c][l];
|
|
946
946
|
}
|
|
947
947
|
// Modified to expose modules for easy access
|
|
948
948
|
getModules() {
|
|
@@ -951,23 +951,23 @@ var xe;
|
|
|
951
951
|
/*-- Private helper methods for constructor: Drawing function modules --*/
|
|
952
952
|
// Reads this object's version field, and draws and marks all function modules.
|
|
953
953
|
drawFunctionPatterns() {
|
|
954
|
-
for (let
|
|
955
|
-
this.setFunctionModule(6,
|
|
954
|
+
for (let u = 0; u < this.size; u++)
|
|
955
|
+
this.setFunctionModule(6, u, u % 2 == 0), this.setFunctionModule(u, 6, u % 2 == 0);
|
|
956
956
|
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
957
|
-
const
|
|
958
|
-
for (let
|
|
959
|
-
for (let f = 0; f <
|
|
960
|
-
|
|
957
|
+
const l = this.getAlignmentPatternPositions(), c = l.length;
|
|
958
|
+
for (let u = 0; u < c; u++)
|
|
959
|
+
for (let f = 0; f < c; f++)
|
|
960
|
+
u == 0 && f == 0 || u == 0 && f == c - 1 || u == c - 1 && f == 0 || this.drawAlignmentPattern(l[u], l[f]);
|
|
961
961
|
this.drawFormatBits(0), this.drawVersion();
|
|
962
962
|
}
|
|
963
963
|
// Draws two copies of the format bits (with its own error correction code)
|
|
964
964
|
// based on the given mask and this object's error correction level field.
|
|
965
|
-
drawFormatBits(
|
|
966
|
-
const
|
|
967
|
-
let
|
|
965
|
+
drawFormatBits(l) {
|
|
966
|
+
const c = this.errorCorrectionLevel.formatBits << 3 | l;
|
|
967
|
+
let u = c;
|
|
968
968
|
for (let h = 0; h < 10; h++)
|
|
969
|
-
|
|
970
|
-
const f = (
|
|
969
|
+
u = u << 1 ^ (u >>> 9) * 1335;
|
|
970
|
+
const f = (c << 10 | u) ^ 21522;
|
|
971
971
|
n(f >>> 15 == 0);
|
|
972
972
|
for (let h = 0; h <= 5; h++)
|
|
973
973
|
this.setFunctionModule(8, h, r(f, h));
|
|
@@ -985,144 +985,144 @@ var xe;
|
|
|
985
985
|
drawVersion() {
|
|
986
986
|
if (this.version < 7)
|
|
987
987
|
return;
|
|
988
|
-
let
|
|
989
|
-
for (let
|
|
990
|
-
|
|
991
|
-
const
|
|
992
|
-
n(
|
|
993
|
-
for (let
|
|
994
|
-
const f = r(
|
|
988
|
+
let l = this.version;
|
|
989
|
+
for (let u = 0; u < 12; u++)
|
|
990
|
+
l = l << 1 ^ (l >>> 11) * 7973;
|
|
991
|
+
const c = this.version << 12 | l;
|
|
992
|
+
n(c >>> 18 == 0);
|
|
993
|
+
for (let u = 0; u < 18; u++) {
|
|
994
|
+
const f = r(c, u), h = this.size - 11 + u % 3, m = Math.floor(u / 3);
|
|
995
995
|
this.setFunctionModule(h, m, f), this.setFunctionModule(m, h, f);
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
// Draws a 9*9 finder pattern including the border separator,
|
|
999
999
|
// with the center module at (x, y). Modules can be out of bounds.
|
|
1000
|
-
drawFinderPattern(
|
|
1001
|
-
for (let
|
|
1000
|
+
drawFinderPattern(l, c) {
|
|
1001
|
+
for (let u = -4; u <= 4; u++)
|
|
1002
1002
|
for (let f = -4; f <= 4; f++) {
|
|
1003
|
-
const h = Math.max(Math.abs(f), Math.abs(
|
|
1003
|
+
const h = Math.max(Math.abs(f), Math.abs(u)), m = l + f, g = c + u;
|
|
1004
1004
|
0 <= m && m < this.size && 0 <= g && g < this.size && this.setFunctionModule(m, g, h != 2 && h != 4);
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
// Draws a 5*5 alignment pattern, with the center module
|
|
1008
1008
|
// at (x, y). All modules must be in bounds.
|
|
1009
|
-
drawAlignmentPattern(
|
|
1010
|
-
for (let
|
|
1009
|
+
drawAlignmentPattern(l, c) {
|
|
1010
|
+
for (let u = -2; u <= 2; u++)
|
|
1011
1011
|
for (let f = -2; f <= 2; f++)
|
|
1012
|
-
this.setFunctionModule(
|
|
1012
|
+
this.setFunctionModule(l + f, c + u, Math.max(Math.abs(f), Math.abs(u)) != 1);
|
|
1013
1013
|
}
|
|
1014
1014
|
// Sets the color of a module and marks it as a function module.
|
|
1015
1015
|
// Only used by the constructor. Coordinates must be in bounds.
|
|
1016
|
-
setFunctionModule(
|
|
1017
|
-
this.modules[
|
|
1016
|
+
setFunctionModule(l, c, u) {
|
|
1017
|
+
this.modules[c][l] = u, this.isFunction[c][l] = !0;
|
|
1018
1018
|
}
|
|
1019
1019
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
|
1020
1020
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
1021
1021
|
// codewords appended to it, based on this object's version and error correction level.
|
|
1022
|
-
addEccAndInterleave(
|
|
1023
|
-
const
|
|
1024
|
-
if (
|
|
1022
|
+
addEccAndInterleave(l) {
|
|
1023
|
+
const c = this.version, u = this.errorCorrectionLevel;
|
|
1024
|
+
if (l.length != I.getNumDataCodewords(c, u))
|
|
1025
1025
|
throw new RangeError("Invalid argument");
|
|
1026
|
-
const f = I.NUM_ERROR_CORRECTION_BLOCKS[
|
|
1026
|
+
const f = I.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c], h = I.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c], m = Math.floor(I.getNumRawDataModules(c) / 8), g = f - m % f, b = Math.floor(m / f);
|
|
1027
1027
|
let v = [];
|
|
1028
|
-
const
|
|
1029
|
-
for (let
|
|
1030
|
-
let U =
|
|
1028
|
+
const R = I.reedSolomonComputeDivisor(h);
|
|
1029
|
+
for (let _ = 0, S = 0; _ < f; _++) {
|
|
1030
|
+
let U = l.slice(S, S + b - h + (_ < g ? 0 : 1));
|
|
1031
1031
|
S += U.length;
|
|
1032
|
-
const A = I.reedSolomonComputeRemainder(U,
|
|
1033
|
-
|
|
1032
|
+
const A = I.reedSolomonComputeRemainder(U, R);
|
|
1033
|
+
_ < g && U.push(0), v.push(U.concat(A));
|
|
1034
1034
|
}
|
|
1035
1035
|
let N = [];
|
|
1036
|
-
for (let
|
|
1036
|
+
for (let _ = 0; _ < v[0].length; _++)
|
|
1037
1037
|
v.forEach((S, U) => {
|
|
1038
|
-
(
|
|
1038
|
+
(_ != b - h || U >= g) && N.push(S[_]);
|
|
1039
1039
|
});
|
|
1040
1040
|
return n(N.length == m), N;
|
|
1041
1041
|
}
|
|
1042
1042
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
1043
1043
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
1044
|
-
drawCodewords(
|
|
1045
|
-
if (
|
|
1044
|
+
drawCodewords(l) {
|
|
1045
|
+
if (l.length != Math.floor(I.getNumRawDataModules(this.version) / 8))
|
|
1046
1046
|
throw new RangeError("Invalid argument");
|
|
1047
|
-
let
|
|
1048
|
-
for (let
|
|
1049
|
-
|
|
1047
|
+
let c = 0;
|
|
1048
|
+
for (let u = this.size - 1; u >= 1; u -= 2) {
|
|
1049
|
+
u == 6 && (u = 5);
|
|
1050
1050
|
for (let f = 0; f < this.size; f++)
|
|
1051
1051
|
for (let h = 0; h < 2; h++) {
|
|
1052
|
-
const m =
|
|
1053
|
-
!this.isFunction[b][m] &&
|
|
1052
|
+
const m = u - h, b = (u + 1 & 2) == 0 ? this.size - 1 - f : f;
|
|
1053
|
+
!this.isFunction[b][m] && c < l.length * 8 && (this.modules[b][m] = r(l[c >>> 3], 7 - (c & 7)), c++);
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
|
-
n(
|
|
1056
|
+
n(c == l.length * 8);
|
|
1057
1057
|
}
|
|
1058
1058
|
// XORs the codeword modules in this QR Code with the given mask pattern.
|
|
1059
1059
|
// The function modules must be marked and the codeword bits must be drawn
|
|
1060
1060
|
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
|
1061
1061
|
// the same mask value a second time will undo the mask. A final well-formed
|
|
1062
1062
|
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
|
1063
|
-
applyMask(
|
|
1064
|
-
if (
|
|
1063
|
+
applyMask(l) {
|
|
1064
|
+
if (l < 0 || l > 7)
|
|
1065
1065
|
throw new RangeError("Mask value out of range");
|
|
1066
|
-
for (let
|
|
1067
|
-
for (let
|
|
1066
|
+
for (let c = 0; c < this.size; c++)
|
|
1067
|
+
for (let u = 0; u < this.size; u++) {
|
|
1068
1068
|
let f;
|
|
1069
|
-
switch (
|
|
1069
|
+
switch (l) {
|
|
1070
1070
|
case 0:
|
|
1071
|
-
f = (
|
|
1071
|
+
f = (u + c) % 2 == 0;
|
|
1072
1072
|
break;
|
|
1073
1073
|
case 1:
|
|
1074
|
-
f =
|
|
1074
|
+
f = c % 2 == 0;
|
|
1075
1075
|
break;
|
|
1076
1076
|
case 2:
|
|
1077
|
-
f =
|
|
1077
|
+
f = u % 3 == 0;
|
|
1078
1078
|
break;
|
|
1079
1079
|
case 3:
|
|
1080
|
-
f = (
|
|
1080
|
+
f = (u + c) % 3 == 0;
|
|
1081
1081
|
break;
|
|
1082
1082
|
case 4:
|
|
1083
|
-
f = (Math.floor(
|
|
1083
|
+
f = (Math.floor(u / 3) + Math.floor(c / 2)) % 2 == 0;
|
|
1084
1084
|
break;
|
|
1085
1085
|
case 5:
|
|
1086
|
-
f =
|
|
1086
|
+
f = u * c % 2 + u * c % 3 == 0;
|
|
1087
1087
|
break;
|
|
1088
1088
|
case 6:
|
|
1089
|
-
f = (
|
|
1089
|
+
f = (u * c % 2 + u * c % 3) % 2 == 0;
|
|
1090
1090
|
break;
|
|
1091
1091
|
case 7:
|
|
1092
|
-
f = ((
|
|
1092
|
+
f = ((u + c) % 2 + u * c % 3) % 2 == 0;
|
|
1093
1093
|
break;
|
|
1094
1094
|
default:
|
|
1095
1095
|
throw new Error("Unreachable");
|
|
1096
1096
|
}
|
|
1097
|
-
!this.isFunction[
|
|
1097
|
+
!this.isFunction[c][u] && f && (this.modules[c][u] = !this.modules[c][u]);
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
1101
1101
|
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
|
1102
1102
|
getPenaltyScore() {
|
|
1103
|
-
let
|
|
1103
|
+
let l = 0;
|
|
1104
1104
|
for (let h = 0; h < this.size; h++) {
|
|
1105
1105
|
let m = !1, g = 0, b = [0, 0, 0, 0, 0, 0, 0];
|
|
1106
1106
|
for (let v = 0; v < this.size; v++)
|
|
1107
|
-
this.modules[h][v] == m ? (g++, g == 5 ?
|
|
1108
|
-
|
|
1107
|
+
this.modules[h][v] == m ? (g++, g == 5 ? l += I.PENALTY_N1 : g > 5 && l++) : (this.finderPenaltyAddHistory(g, b), m || (l += this.finderPenaltyCountPatterns(b) * I.PENALTY_N3), m = this.modules[h][v], g = 1);
|
|
1108
|
+
l += this.finderPenaltyTerminateAndCount(m, g, b) * I.PENALTY_N3;
|
|
1109
1109
|
}
|
|
1110
1110
|
for (let h = 0; h < this.size; h++) {
|
|
1111
1111
|
let m = !1, g = 0, b = [0, 0, 0, 0, 0, 0, 0];
|
|
1112
1112
|
for (let v = 0; v < this.size; v++)
|
|
1113
|
-
this.modules[v][h] == m ? (g++, g == 5 ?
|
|
1114
|
-
|
|
1113
|
+
this.modules[v][h] == m ? (g++, g == 5 ? l += I.PENALTY_N1 : g > 5 && l++) : (this.finderPenaltyAddHistory(g, b), m || (l += this.finderPenaltyCountPatterns(b) * I.PENALTY_N3), m = this.modules[v][h], g = 1);
|
|
1114
|
+
l += this.finderPenaltyTerminateAndCount(m, g, b) * I.PENALTY_N3;
|
|
1115
1115
|
}
|
|
1116
1116
|
for (let h = 0; h < this.size - 1; h++)
|
|
1117
1117
|
for (let m = 0; m < this.size - 1; m++) {
|
|
1118
1118
|
const g = this.modules[h][m];
|
|
1119
|
-
g == this.modules[h][m + 1] && g == this.modules[h + 1][m] && g == this.modules[h + 1][m + 1] && (
|
|
1119
|
+
g == this.modules[h][m + 1] && g == this.modules[h + 1][m] && g == this.modules[h + 1][m + 1] && (l += I.PENALTY_N2);
|
|
1120
1120
|
}
|
|
1121
|
-
let
|
|
1121
|
+
let c = 0;
|
|
1122
1122
|
for (const h of this.modules)
|
|
1123
|
-
|
|
1124
|
-
const
|
|
1125
|
-
return n(0 <= f && f <= 9),
|
|
1123
|
+
c = h.reduce((m, g) => m + (g ? 1 : 0), c);
|
|
1124
|
+
const u = this.size * this.size, f = Math.ceil(Math.abs(c * 20 - u * 10) / u) - 1;
|
|
1125
|
+
return n(0 <= f && f <= 9), l += f * I.PENALTY_N4, n(0 <= l && l <= 2568888), l;
|
|
1126
1126
|
}
|
|
1127
1127
|
/*-- Private helper functions --*/
|
|
1128
1128
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
@@ -1132,83 +1132,83 @@ var xe;
|
|
|
1132
1132
|
if (this.version == 1)
|
|
1133
1133
|
return [];
|
|
1134
1134
|
{
|
|
1135
|
-
const
|
|
1136
|
-
let
|
|
1137
|
-
for (let f = this.size - 7;
|
|
1138
|
-
|
|
1139
|
-
return
|
|
1135
|
+
const l = Math.floor(this.version / 7) + 2, c = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (l * 2 - 2)) * 2;
|
|
1136
|
+
let u = [6];
|
|
1137
|
+
for (let f = this.size - 7; u.length < l; f -= c)
|
|
1138
|
+
u.splice(1, 0, f);
|
|
1139
|
+
return u;
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
|
1143
1143
|
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
|
1144
1144
|
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
|
1145
|
-
static getNumRawDataModules(
|
|
1146
|
-
if (
|
|
1145
|
+
static getNumRawDataModules(l) {
|
|
1146
|
+
if (l < I.MIN_VERSION || l > I.MAX_VERSION)
|
|
1147
1147
|
throw new RangeError("Version number out of range");
|
|
1148
|
-
let
|
|
1149
|
-
if (
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1148
|
+
let c = (16 * l + 128) * l + 64;
|
|
1149
|
+
if (l >= 2) {
|
|
1150
|
+
const u = Math.floor(l / 7) + 2;
|
|
1151
|
+
c -= (25 * u - 10) * u - 55, l >= 7 && (c -= 36);
|
|
1152
1152
|
}
|
|
1153
|
-
return n(208 <=
|
|
1153
|
+
return n(208 <= c && c <= 29648), c;
|
|
1154
1154
|
}
|
|
1155
1155
|
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
|
1156
1156
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
1157
1157
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
1158
|
-
static getNumDataCodewords(
|
|
1159
|
-
return Math.floor(I.getNumRawDataModules(
|
|
1158
|
+
static getNumDataCodewords(l, c) {
|
|
1159
|
+
return Math.floor(I.getNumRawDataModules(l) / 8) - I.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l] * I.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l];
|
|
1160
1160
|
}
|
|
1161
1161
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
1162
1162
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
1163
|
-
static reedSolomonComputeDivisor(
|
|
1164
|
-
if (
|
|
1163
|
+
static reedSolomonComputeDivisor(l) {
|
|
1164
|
+
if (l < 1 || l > 255)
|
|
1165
1165
|
throw new RangeError("Degree out of range");
|
|
1166
|
-
let
|
|
1167
|
-
for (let f = 0; f <
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
let
|
|
1171
|
-
for (let f = 0; f <
|
|
1172
|
-
for (let h = 0; h <
|
|
1173
|
-
|
|
1174
|
-
|
|
1166
|
+
let c = [];
|
|
1167
|
+
for (let f = 0; f < l - 1; f++)
|
|
1168
|
+
c.push(0);
|
|
1169
|
+
c.push(1);
|
|
1170
|
+
let u = 1;
|
|
1171
|
+
for (let f = 0; f < l; f++) {
|
|
1172
|
+
for (let h = 0; h < c.length; h++)
|
|
1173
|
+
c[h] = I.reedSolomonMultiply(c[h], u), h + 1 < c.length && (c[h] ^= c[h + 1]);
|
|
1174
|
+
u = I.reedSolomonMultiply(u, 2);
|
|
1175
1175
|
}
|
|
1176
|
-
return
|
|
1176
|
+
return c;
|
|
1177
1177
|
}
|
|
1178
1178
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
|
1179
|
-
static reedSolomonComputeRemainder(
|
|
1180
|
-
let
|
|
1181
|
-
for (const f of
|
|
1182
|
-
const h = f ^
|
|
1183
|
-
|
|
1179
|
+
static reedSolomonComputeRemainder(l, c) {
|
|
1180
|
+
let u = c.map((f) => 0);
|
|
1181
|
+
for (const f of l) {
|
|
1182
|
+
const h = f ^ u.shift();
|
|
1183
|
+
u.push(0), c.forEach((m, g) => u[g] ^= I.reedSolomonMultiply(m, h));
|
|
1184
1184
|
}
|
|
1185
|
-
return
|
|
1185
|
+
return u;
|
|
1186
1186
|
}
|
|
1187
1187
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
|
1188
1188
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
1189
|
-
static reedSolomonMultiply(
|
|
1190
|
-
if (
|
|
1189
|
+
static reedSolomonMultiply(l, c) {
|
|
1190
|
+
if (l >>> 8 || c >>> 8)
|
|
1191
1191
|
throw new RangeError("Byte out of range");
|
|
1192
|
-
let
|
|
1192
|
+
let u = 0;
|
|
1193
1193
|
for (let f = 7; f >= 0; f--)
|
|
1194
|
-
|
|
1195
|
-
return n(
|
|
1194
|
+
u = u << 1 ^ (u >>> 7) * 285, u ^= (c >>> f & 1) * l;
|
|
1195
|
+
return n(u >>> 8 == 0), u;
|
|
1196
1196
|
}
|
|
1197
1197
|
// Can only be called immediately after a light run is added, and
|
|
1198
1198
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
|
1199
|
-
finderPenaltyCountPatterns(
|
|
1200
|
-
const
|
|
1201
|
-
n(
|
|
1202
|
-
const
|
|
1203
|
-
return (
|
|
1199
|
+
finderPenaltyCountPatterns(l) {
|
|
1200
|
+
const c = l[1];
|
|
1201
|
+
n(c <= this.size * 3);
|
|
1202
|
+
const u = c > 0 && l[2] == c && l[3] == c * 3 && l[4] == c && l[5] == c;
|
|
1203
|
+
return (u && l[0] >= c * 4 && l[6] >= c ? 1 : 0) + (u && l[6] >= c * 4 && l[0] >= c ? 1 : 0);
|
|
1204
1204
|
}
|
|
1205
1205
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
|
1206
|
-
finderPenaltyTerminateAndCount(
|
|
1207
|
-
return
|
|
1206
|
+
finderPenaltyTerminateAndCount(l, c, u) {
|
|
1207
|
+
return l && (this.finderPenaltyAddHistory(c, u), c = 0), c += this.size, this.finderPenaltyAddHistory(c, u), this.finderPenaltyCountPatterns(u);
|
|
1208
1208
|
}
|
|
1209
1209
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
|
1210
|
-
finderPenaltyAddHistory(
|
|
1211
|
-
|
|
1210
|
+
finderPenaltyAddHistory(l, c) {
|
|
1211
|
+
c[0] == 0 && (l += this.size), c.pop(), c.unshift(l);
|
|
1212
1212
|
}
|
|
1213
1213
|
};
|
|
1214
1214
|
e.MIN_VERSION = 1, e.MAX_VERSION = 40, e.PENALTY_N1 = 3, e.PENALTY_N2 = 3, e.PENALTY_N3 = 40, e.PENALTY_N4 = 10, e.ECC_CODEWORDS_PER_BLOCK = [
|
|
@@ -1234,17 +1234,17 @@ var xe;
|
|
|
1234
1234
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
|
1235
1235
|
// High
|
|
1236
1236
|
], t.QrCode = e;
|
|
1237
|
-
function s(
|
|
1238
|
-
if (
|
|
1237
|
+
function s(d, l, c) {
|
|
1238
|
+
if (l < 0 || l > 31 || d >>> l)
|
|
1239
1239
|
throw new RangeError("Value out of range");
|
|
1240
|
-
for (let
|
|
1241
|
-
|
|
1240
|
+
for (let u = l - 1; u >= 0; u--)
|
|
1241
|
+
c.push(d >>> u & 1);
|
|
1242
1242
|
}
|
|
1243
|
-
function r(
|
|
1244
|
-
return (
|
|
1243
|
+
function r(d, l) {
|
|
1244
|
+
return (d >>> l & 1) != 0;
|
|
1245
1245
|
}
|
|
1246
|
-
function n(
|
|
1247
|
-
if (!
|
|
1246
|
+
function n(d) {
|
|
1247
|
+
if (!d)
|
|
1248
1248
|
throw new Error("Assertion error");
|
|
1249
1249
|
}
|
|
1250
1250
|
const a = class q {
|
|
@@ -1252,76 +1252,76 @@ var xe;
|
|
|
1252
1252
|
// Creates a new QR Code segment with the given attributes and data.
|
|
1253
1253
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
1254
1254
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
1255
|
-
constructor(
|
|
1256
|
-
if (this.mode =
|
|
1255
|
+
constructor(l, c, u) {
|
|
1256
|
+
if (this.mode = l, this.numChars = c, this.bitData = u, c < 0)
|
|
1257
1257
|
throw new RangeError("Invalid argument");
|
|
1258
|
-
this.bitData =
|
|
1258
|
+
this.bitData = u.slice();
|
|
1259
1259
|
}
|
|
1260
1260
|
/*-- Static factory functions (mid level) --*/
|
|
1261
1261
|
// Returns a segment representing the given binary data encoded in
|
|
1262
1262
|
// byte mode. All input byte arrays are acceptable. Any text string
|
|
1263
1263
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
1264
|
-
static makeBytes(
|
|
1265
|
-
let
|
|
1266
|
-
for (const
|
|
1267
|
-
s(
|
|
1268
|
-
return new q(q.Mode.BYTE,
|
|
1264
|
+
static makeBytes(l) {
|
|
1265
|
+
let c = [];
|
|
1266
|
+
for (const u of l)
|
|
1267
|
+
s(u, 8, c);
|
|
1268
|
+
return new q(q.Mode.BYTE, l.length, c);
|
|
1269
1269
|
}
|
|
1270
1270
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
1271
|
-
static makeNumeric(
|
|
1272
|
-
if (!q.isNumeric(
|
|
1271
|
+
static makeNumeric(l) {
|
|
1272
|
+
if (!q.isNumeric(l))
|
|
1273
1273
|
throw new RangeError("String contains non-numeric characters");
|
|
1274
|
-
let
|
|
1275
|
-
for (let
|
|
1276
|
-
const f = Math.min(
|
|
1277
|
-
s(parseInt(
|
|
1274
|
+
let c = [];
|
|
1275
|
+
for (let u = 0; u < l.length; ) {
|
|
1276
|
+
const f = Math.min(l.length - u, 3);
|
|
1277
|
+
s(parseInt(l.substring(u, u + f), 10), f * 3 + 1, c), u += f;
|
|
1278
1278
|
}
|
|
1279
|
-
return new q(q.Mode.NUMERIC,
|
|
1279
|
+
return new q(q.Mode.NUMERIC, l.length, c);
|
|
1280
1280
|
}
|
|
1281
1281
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
1282
1282
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
1283
1283
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
1284
|
-
static makeAlphanumeric(
|
|
1285
|
-
if (!q.isAlphanumeric(
|
|
1284
|
+
static makeAlphanumeric(l) {
|
|
1285
|
+
if (!q.isAlphanumeric(l))
|
|
1286
1286
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
1287
|
-
let
|
|
1288
|
-
for (
|
|
1289
|
-
let f = q.ALPHANUMERIC_CHARSET.indexOf(
|
|
1290
|
-
f += q.ALPHANUMERIC_CHARSET.indexOf(
|
|
1287
|
+
let c = [], u;
|
|
1288
|
+
for (u = 0; u + 2 <= l.length; u += 2) {
|
|
1289
|
+
let f = q.ALPHANUMERIC_CHARSET.indexOf(l.charAt(u)) * 45;
|
|
1290
|
+
f += q.ALPHANUMERIC_CHARSET.indexOf(l.charAt(u + 1)), s(f, 11, c);
|
|
1291
1291
|
}
|
|
1292
|
-
return
|
|
1292
|
+
return u < l.length && s(q.ALPHANUMERIC_CHARSET.indexOf(l.charAt(u)), 6, c), new q(q.Mode.ALPHANUMERIC, l.length, c);
|
|
1293
1293
|
}
|
|
1294
1294
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
1295
1295
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
1296
|
-
static makeSegments(
|
|
1297
|
-
return
|
|
1296
|
+
static makeSegments(l) {
|
|
1297
|
+
return l == "" ? [] : q.isNumeric(l) ? [q.makeNumeric(l)] : q.isAlphanumeric(l) ? [q.makeAlphanumeric(l)] : [q.makeBytes(q.toUtf8ByteArray(l))];
|
|
1298
1298
|
}
|
|
1299
1299
|
// Returns a segment representing an Extended Channel Interpretation
|
|
1300
1300
|
// (ECI) designator with the given assignment value.
|
|
1301
|
-
static makeEci(
|
|
1302
|
-
let
|
|
1303
|
-
if (
|
|
1301
|
+
static makeEci(l) {
|
|
1302
|
+
let c = [];
|
|
1303
|
+
if (l < 0)
|
|
1304
1304
|
throw new RangeError("ECI assignment value out of range");
|
|
1305
|
-
if (
|
|
1306
|
-
s(
|
|
1307
|
-
else if (
|
|
1308
|
-
s(2, 2,
|
|
1309
|
-
else if (
|
|
1310
|
-
s(6, 3,
|
|
1305
|
+
if (l < 128)
|
|
1306
|
+
s(l, 8, c);
|
|
1307
|
+
else if (l < 16384)
|
|
1308
|
+
s(2, 2, c), s(l, 14, c);
|
|
1309
|
+
else if (l < 1e6)
|
|
1310
|
+
s(6, 3, c), s(l, 21, c);
|
|
1311
1311
|
else
|
|
1312
1312
|
throw new RangeError("ECI assignment value out of range");
|
|
1313
|
-
return new q(q.Mode.ECI, 0,
|
|
1313
|
+
return new q(q.Mode.ECI, 0, c);
|
|
1314
1314
|
}
|
|
1315
1315
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
1316
1316
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
1317
|
-
static isNumeric(
|
|
1318
|
-
return q.NUMERIC_REGEX.test(
|
|
1317
|
+
static isNumeric(l) {
|
|
1318
|
+
return q.NUMERIC_REGEX.test(l);
|
|
1319
1319
|
}
|
|
1320
1320
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
1321
1321
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
1322
1322
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
1323
|
-
static isAlphanumeric(
|
|
1324
|
-
return q.ALPHANUMERIC_REGEX.test(
|
|
1323
|
+
static isAlphanumeric(l) {
|
|
1324
|
+
return q.ALPHANUMERIC_REGEX.test(l);
|
|
1325
1325
|
}
|
|
1326
1326
|
/*-- Methods --*/
|
|
1327
1327
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -1330,27 +1330,27 @@ var xe;
|
|
|
1330
1330
|
}
|
|
1331
1331
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
|
1332
1332
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
1333
|
-
static getTotalBits(
|
|
1334
|
-
let
|
|
1335
|
-
for (const f of
|
|
1336
|
-
const h = f.mode.numCharCountBits(
|
|
1333
|
+
static getTotalBits(l, c) {
|
|
1334
|
+
let u = 0;
|
|
1335
|
+
for (const f of l) {
|
|
1336
|
+
const h = f.mode.numCharCountBits(c);
|
|
1337
1337
|
if (f.numChars >= 1 << h)
|
|
1338
1338
|
return 1 / 0;
|
|
1339
|
-
|
|
1339
|
+
u += 4 + h + f.bitData.length;
|
|
1340
1340
|
}
|
|
1341
|
-
return
|
|
1341
|
+
return u;
|
|
1342
1342
|
}
|
|
1343
1343
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
1344
|
-
static toUtf8ByteArray(
|
|
1345
|
-
|
|
1346
|
-
let
|
|
1347
|
-
for (let
|
|
1348
|
-
|
|
1349
|
-
return
|
|
1344
|
+
static toUtf8ByteArray(l) {
|
|
1345
|
+
l = encodeURI(l);
|
|
1346
|
+
let c = [];
|
|
1347
|
+
for (let u = 0; u < l.length; u++)
|
|
1348
|
+
l.charAt(u) != "%" ? c.push(l.charCodeAt(u)) : (c.push(parseInt(l.substring(u + 1, u + 3), 16)), u += 2);
|
|
1349
|
+
return c;
|
|
1350
1350
|
}
|
|
1351
1351
|
};
|
|
1352
1352
|
a.NUMERIC_REGEX = /^[0-9]*$/, a.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, a.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
1353
|
-
let
|
|
1353
|
+
let o = a;
|
|
1354
1354
|
t.QrSegment = a;
|
|
1355
1355
|
})(xe || (xe = {}));
|
|
1356
1356
|
((t) => {
|
|
@@ -1393,22 +1393,22 @@ function xs(t, e = 0) {
|
|
|
1393
1393
|
const s = [];
|
|
1394
1394
|
return t.forEach(function(r, n) {
|
|
1395
1395
|
let a = null;
|
|
1396
|
-
r.forEach(function(
|
|
1397
|
-
if (!
|
|
1396
|
+
r.forEach(function(o, d) {
|
|
1397
|
+
if (!o && a !== null) {
|
|
1398
1398
|
s.push(
|
|
1399
|
-
`M${a + e} ${n + e}h${
|
|
1399
|
+
`M${a + e} ${n + e}h${d - a}v1H${a + e}z`
|
|
1400
1400
|
), a = null;
|
|
1401
1401
|
return;
|
|
1402
1402
|
}
|
|
1403
|
-
if (
|
|
1404
|
-
if (!
|
|
1403
|
+
if (d === r.length - 1) {
|
|
1404
|
+
if (!o)
|
|
1405
1405
|
return;
|
|
1406
|
-
a === null ? s.push(`M${
|
|
1407
|
-
`M${a + e},${n + e} h${
|
|
1406
|
+
a === null ? s.push(`M${d + e},${n + e} h1v1H${d + e}z`) : s.push(
|
|
1407
|
+
`M${a + e},${n + e} h${d + 1 - a}v1H${a + e}z`
|
|
1408
1408
|
);
|
|
1409
1409
|
return;
|
|
1410
1410
|
}
|
|
1411
|
-
|
|
1411
|
+
o && a === null && (a = d);
|
|
1412
1412
|
});
|
|
1413
1413
|
}), s.join("");
|
|
1414
1414
|
}
|
|
@@ -1418,14 +1418,14 @@ function bs(t, e) {
|
|
|
1418
1418
|
function Xr(t, e, s, r) {
|
|
1419
1419
|
if (r == null)
|
|
1420
1420
|
return null;
|
|
1421
|
-
const n = t.length + s * 2, a = Math.floor(e * Jr),
|
|
1421
|
+
const n = t.length + s * 2, a = Math.floor(e * Jr), o = n / e, d = (r.width || a) * o, l = (r.height || a) * o, c = r.x == null ? t.length / 2 - d / 2 : r.x * o, u = r.y == null ? t.length / 2 - l / 2 : r.y * o, f = r.opacity == null ? 1 : r.opacity;
|
|
1422
1422
|
let h = null;
|
|
1423
1423
|
if (r.excavate) {
|
|
1424
|
-
let g = Math.floor(
|
|
1425
|
-
h = { x: g, y: b, w: v, h:
|
|
1424
|
+
let g = Math.floor(c), b = Math.floor(u), v = Math.ceil(d + c - g), R = Math.ceil(l + u - b);
|
|
1425
|
+
h = { x: g, y: b, w: v, h: R };
|
|
1426
1426
|
}
|
|
1427
1427
|
const m = r.crossOrigin;
|
|
1428
|
-
return { x:
|
|
1428
|
+
return { x: c, y: u, h: l, w: d, excavation: h, opacity: f, crossOrigin: m };
|
|
1429
1429
|
}
|
|
1430
1430
|
function en(t, e) {
|
|
1431
1431
|
return e != null ? Math.max(Math.floor(e), 0) : t ? Gr : Kr;
|
|
@@ -1437,10 +1437,10 @@ function _s({
|
|
|
1437
1437
|
includeMargin: r,
|
|
1438
1438
|
marginSize: n,
|
|
1439
1439
|
imageSettings: a,
|
|
1440
|
-
size:
|
|
1441
|
-
boostLevel:
|
|
1440
|
+
size: o,
|
|
1441
|
+
boostLevel: d
|
|
1442
1442
|
}) {
|
|
1443
|
-
let
|
|
1443
|
+
let l = B.useMemo(() => {
|
|
1444
1444
|
const g = (Array.isArray(t) ? t : [t]).reduce((b, v) => (b.push(...Ee.QrSegment.makeSegments(v)), b), []);
|
|
1445
1445
|
return Ee.QrCode.encodeSegments(
|
|
1446
1446
|
g,
|
|
@@ -1448,14 +1448,14 @@ function _s({
|
|
|
1448
1448
|
s,
|
|
1449
1449
|
void 0,
|
|
1450
1450
|
void 0,
|
|
1451
|
-
|
|
1451
|
+
d
|
|
1452
1452
|
);
|
|
1453
|
-
}, [t, e, s,
|
|
1454
|
-
const { cells:
|
|
1455
|
-
let m =
|
|
1453
|
+
}, [t, e, s, d]);
|
|
1454
|
+
const { cells: c, margin: u, numCells: f, calculatedImageSettings: h } = B.useMemo(() => {
|
|
1455
|
+
let m = l.getModules();
|
|
1456
1456
|
const g = en(r, n), b = m.length + g * 2, v = Xr(
|
|
1457
1457
|
m,
|
|
1458
|
-
|
|
1458
|
+
o,
|
|
1459
1459
|
g,
|
|
1460
1460
|
a
|
|
1461
1461
|
);
|
|
@@ -1465,11 +1465,11 @@ function _s({
|
|
|
1465
1465
|
numCells: b,
|
|
1466
1466
|
calculatedImageSettings: v
|
|
1467
1467
|
};
|
|
1468
|
-
}, [
|
|
1468
|
+
}, [l, o, a, r, n]);
|
|
1469
1469
|
return {
|
|
1470
|
-
qrcode:
|
|
1471
|
-
margin:
|
|
1472
|
-
cells:
|
|
1470
|
+
qrcode: l,
|
|
1471
|
+
margin: u,
|
|
1472
|
+
cells: c,
|
|
1473
1473
|
numCells: f,
|
|
1474
1474
|
calculatedImageSettings: h
|
|
1475
1475
|
};
|
|
@@ -1486,11 +1486,11 @@ var tn = (function() {
|
|
|
1486
1486
|
const r = e, {
|
|
1487
1487
|
value: n,
|
|
1488
1488
|
size: a = hs,
|
|
1489
|
-
level:
|
|
1490
|
-
bgColor:
|
|
1491
|
-
fgColor:
|
|
1492
|
-
includeMargin:
|
|
1493
|
-
minVersion:
|
|
1489
|
+
level: o = ms,
|
|
1490
|
+
bgColor: d = ps,
|
|
1491
|
+
fgColor: l = gs,
|
|
1492
|
+
includeMargin: c = ys,
|
|
1493
|
+
minVersion: u = vs,
|
|
1494
1494
|
boostLevel: f,
|
|
1495
1495
|
marginSize: h,
|
|
1496
1496
|
imageSettings: m
|
|
@@ -1505,24 +1505,24 @@ var tn = (function() {
|
|
|
1505
1505
|
"boostLevel",
|
|
1506
1506
|
"marginSize",
|
|
1507
1507
|
"imageSettings"
|
|
1508
|
-
]), { style: v } = b,
|
|
1508
|
+
]), { style: v } = b, R = ft(b, ["style"]), N = m?.src, _ = B.useRef(null), S = B.useRef(null), U = B.useCallback(
|
|
1509
1509
|
(G) => {
|
|
1510
|
-
|
|
1510
|
+
_.current = G, typeof s == "function" ? s(G) : s && (s.current = G);
|
|
1511
1511
|
},
|
|
1512
1512
|
[s]
|
|
1513
1513
|
), [A, V] = B.useState(!1), { margin: W, cells: Y, numCells: X, calculatedImageSettings: M } = _s({
|
|
1514
1514
|
value: n,
|
|
1515
|
-
level:
|
|
1516
|
-
minVersion:
|
|
1515
|
+
level: o,
|
|
1516
|
+
minVersion: u,
|
|
1517
1517
|
boostLevel: f,
|
|
1518
|
-
includeMargin:
|
|
1518
|
+
includeMargin: c,
|
|
1519
1519
|
marginSize: h,
|
|
1520
1520
|
imageSettings: m,
|
|
1521
1521
|
size: a
|
|
1522
1522
|
});
|
|
1523
1523
|
B.useEffect(() => {
|
|
1524
|
-
if (
|
|
1525
|
-
const G =
|
|
1524
|
+
if (_.current != null) {
|
|
1525
|
+
const G = _.current, D = G.getContext("2d");
|
|
1526
1526
|
if (!D)
|
|
1527
1527
|
return;
|
|
1528
1528
|
let ve = Y;
|
|
@@ -1534,9 +1534,9 @@ var tn = (function() {
|
|
|
1534
1534
|
const J = window.devicePixelRatio || 1;
|
|
1535
1535
|
G.height = G.width = a * J;
|
|
1536
1536
|
const z = a / X * J;
|
|
1537
|
-
D.scale(z, z), D.fillStyle =
|
|
1538
|
-
p.forEach(function(
|
|
1539
|
-
|
|
1537
|
+
D.scale(z, z), D.fillStyle = d, D.fillRect(0, 0, X, X), D.fillStyle = l, tn ? D.fill(new Path2D(xs(ve, W))) : Y.forEach(function(p, k) {
|
|
1538
|
+
p.forEach(function(T, P) {
|
|
1539
|
+
T && D.fillRect(P + W, k + W, 1, 1);
|
|
1540
1540
|
});
|
|
1541
1541
|
}), M && (D.globalAlpha = M.opacity), ie && D.drawImage(
|
|
1542
1542
|
ee,
|
|
@@ -1549,7 +1549,7 @@ var tn = (function() {
|
|
|
1549
1549
|
}), B.useEffect(() => {
|
|
1550
1550
|
V(!1);
|
|
1551
1551
|
}, [N]);
|
|
1552
|
-
const L =
|
|
1552
|
+
const L = ut({ height: a, width: a }, v);
|
|
1553
1553
|
let H = null;
|
|
1554
1554
|
return N != null && (H = /* @__PURE__ */ B.createElement(
|
|
1555
1555
|
"img",
|
|
@@ -1565,13 +1565,13 @@ var tn = (function() {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
)), /* @__PURE__ */ B.createElement(B.Fragment, null, /* @__PURE__ */ B.createElement(
|
|
1567
1567
|
"canvas",
|
|
1568
|
-
|
|
1568
|
+
ut({
|
|
1569
1569
|
style: L,
|
|
1570
1570
|
height: a,
|
|
1571
1571
|
width: a,
|
|
1572
1572
|
ref: U,
|
|
1573
1573
|
role: "img"
|
|
1574
|
-
},
|
|
1574
|
+
}, R)
|
|
1575
1575
|
), H);
|
|
1576
1576
|
}
|
|
1577
1577
|
);
|
|
@@ -1581,11 +1581,11 @@ var ws = B.forwardRef(
|
|
|
1581
1581
|
const r = e, {
|
|
1582
1582
|
value: n,
|
|
1583
1583
|
size: a = hs,
|
|
1584
|
-
level:
|
|
1585
|
-
bgColor:
|
|
1586
|
-
fgColor:
|
|
1587
|
-
includeMargin:
|
|
1588
|
-
minVersion:
|
|
1584
|
+
level: o = ms,
|
|
1585
|
+
bgColor: d = ps,
|
|
1586
|
+
fgColor: l = gs,
|
|
1587
|
+
includeMargin: c = ys,
|
|
1588
|
+
minVersion: u = vs,
|
|
1589
1589
|
boostLevel: f,
|
|
1590
1590
|
title: h,
|
|
1591
1591
|
marginSize: m,
|
|
@@ -1602,37 +1602,37 @@ var ws = B.forwardRef(
|
|
|
1602
1602
|
"title",
|
|
1603
1603
|
"marginSize",
|
|
1604
1604
|
"imageSettings"
|
|
1605
|
-
]), { margin: v, cells:
|
|
1605
|
+
]), { margin: v, cells: R, numCells: N, calculatedImageSettings: _ } = _s({
|
|
1606
1606
|
value: n,
|
|
1607
|
-
level:
|
|
1608
|
-
minVersion:
|
|
1607
|
+
level: o,
|
|
1608
|
+
minVersion: u,
|
|
1609
1609
|
boostLevel: f,
|
|
1610
|
-
includeMargin:
|
|
1610
|
+
includeMargin: c,
|
|
1611
1611
|
marginSize: m,
|
|
1612
1612
|
imageSettings: g,
|
|
1613
1613
|
size: a
|
|
1614
1614
|
});
|
|
1615
|
-
let S =
|
|
1616
|
-
g != null &&
|
|
1617
|
-
|
|
1618
|
-
|
|
1615
|
+
let S = R, U = null;
|
|
1616
|
+
g != null && _ != null && (_.excavation != null && (S = bs(
|
|
1617
|
+
R,
|
|
1618
|
+
_.excavation
|
|
1619
1619
|
)), U = /* @__PURE__ */ B.createElement(
|
|
1620
1620
|
"image",
|
|
1621
1621
|
{
|
|
1622
1622
|
href: g.src,
|
|
1623
|
-
height:
|
|
1624
|
-
width:
|
|
1625
|
-
x:
|
|
1626
|
-
y:
|
|
1623
|
+
height: _.h,
|
|
1624
|
+
width: _.w,
|
|
1625
|
+
x: _.x + v,
|
|
1626
|
+
y: _.y + v,
|
|
1627
1627
|
preserveAspectRatio: "none",
|
|
1628
|
-
opacity:
|
|
1629
|
-
crossOrigin:
|
|
1628
|
+
opacity: _.opacity,
|
|
1629
|
+
crossOrigin: _.crossOrigin
|
|
1630
1630
|
}
|
|
1631
1631
|
));
|
|
1632
1632
|
const A = xs(S, v);
|
|
1633
1633
|
return /* @__PURE__ */ B.createElement(
|
|
1634
1634
|
"svg",
|
|
1635
|
-
|
|
1635
|
+
ut({
|
|
1636
1636
|
height: a,
|
|
1637
1637
|
width: a,
|
|
1638
1638
|
viewBox: `0 0 ${N} ${N}`,
|
|
@@ -1643,12 +1643,12 @@ var ws = B.forwardRef(
|
|
|
1643
1643
|
/* @__PURE__ */ B.createElement(
|
|
1644
1644
|
"path",
|
|
1645
1645
|
{
|
|
1646
|
-
fill:
|
|
1646
|
+
fill: d,
|
|
1647
1647
|
d: `M0,0 h${N}v${N}H0z`,
|
|
1648
1648
|
shapeRendering: "crispEdges"
|
|
1649
1649
|
}
|
|
1650
1650
|
),
|
|
1651
|
-
/* @__PURE__ */ B.createElement("path", { fill:
|
|
1651
|
+
/* @__PURE__ */ B.createElement("path", { fill: l, d: A, shapeRendering: "crispEdges" }),
|
|
1652
1652
|
U
|
|
1653
1653
|
);
|
|
1654
1654
|
}
|
|
@@ -1662,17 +1662,17 @@ const rn = (t, e = "qr-code", s = 4) => {
|
|
|
1662
1662
|
/<svg(\s+)/,
|
|
1663
1663
|
'<svg xmlns="http://www.w3.org/2000/svg" '
|
|
1664
1664
|
));
|
|
1665
|
-
const a = r.getAttribute("width") ? parseInt(r.getAttribute("width"), 10) : r.clientWidth || 200,
|
|
1665
|
+
const a = r.getAttribute("width") ? parseInt(r.getAttribute("width"), 10) : r.clientWidth || 200, o = r.getAttribute("height") ? parseInt(r.getAttribute("height"), 10) : r.clientHeight || a, d = Math.round(a * s), l = Math.round(o * s);
|
|
1666
1666
|
/viewBox=/.test(n) || (n = n.replace(
|
|
1667
1667
|
/<svg(\s+)/,
|
|
1668
|
-
`<svg viewBox="0 0 ${a} ${
|
|
1669
|
-
)), /width="[^"]*"/.test(n) ? n = n.replace(/width="[^"]*"/, `width="${
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1672
|
-
const
|
|
1668
|
+
`<svg viewBox="0 0 ${a} ${o}" `
|
|
1669
|
+
)), /width="[^"]*"/.test(n) ? n = n.replace(/width="[^"]*"/, `width="${d}"`) : n = n.replace(/<svg(\s+)/, `<svg width="${d}" `), /height="[^"]*"/.test(n) ? n = n.replace(/height="[^"]*"/, `height="${l}"`) : n = n.replace(/<svg(\s+)/, `<svg height="${l}" `);
|
|
1670
|
+
const c = document.createElement("canvas");
|
|
1671
|
+
c.width = d, c.height = l;
|
|
1672
|
+
const u = c.getContext("2d"), f = new Image();
|
|
1673
1673
|
f.onload = () => {
|
|
1674
|
-
|
|
1675
|
-
const h =
|
|
1674
|
+
u?.drawImage(f, 0, 0, c.width, c.height);
|
|
1675
|
+
const h = c.toDataURL("image/png"), m = document.createElement("a");
|
|
1676
1676
|
m.download = `${e}.png`, m.href = h, m.click();
|
|
1677
1677
|
}, f.src = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(n)));
|
|
1678
1678
|
};
|
|
@@ -1684,10 +1684,10 @@ function nn({
|
|
|
1684
1684
|
filenameBase: n,
|
|
1685
1685
|
showDownloads: a = !0
|
|
1686
1686
|
}) {
|
|
1687
|
-
const
|
|
1687
|
+
const o = n || e.replace(/[^a-z0-9_-]/gi, "-").slice(0, 40) || "qr-code";
|
|
1688
1688
|
return /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col items-start ", children: [
|
|
1689
1689
|
/* @__PURE__ */ i.jsx("div", { className: "bg-base-100 p-4 rounded-lg", children: /* @__PURE__ */ i.jsx(ws, { id: t, value: e, size: s, level: r }) }),
|
|
1690
|
-
a && /* @__PURE__ */ i.jsx("div", { className: "join justify-center self-center", children: /* @__PURE__ */ i.jsx(an, { id: t, fileBase:
|
|
1690
|
+
a && /* @__PURE__ */ i.jsx("div", { className: "join justify-center self-center", children: /* @__PURE__ */ i.jsx(an, { id: t, fileBase: o }) })
|
|
1691
1691
|
] });
|
|
1692
1692
|
}
|
|
1693
1693
|
function an({ id: t, fileBase: e }) {
|
|
@@ -1718,13 +1718,13 @@ function an({ id: t, fileBase: e }) {
|
|
|
1718
1718
|
)
|
|
1719
1719
|
] });
|
|
1720
1720
|
}
|
|
1721
|
-
const
|
|
1721
|
+
const Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1722
1722
|
__proto__: null,
|
|
1723
1723
|
AlertCard: xr,
|
|
1724
1724
|
GenericFormModal: br,
|
|
1725
1725
|
GenericList: bt,
|
|
1726
1726
|
ModalErrors: Wr,
|
|
1727
|
-
Pagination:
|
|
1727
|
+
Pagination: ds,
|
|
1728
1728
|
QRCodeGenerator: nn
|
|
1729
1729
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1730
1730
|
function De(t) {
|
|
@@ -1761,28 +1761,28 @@ var $;
|
|
|
1761
1761
|
}
|
|
1762
1762
|
t.assertNever = s, t.arrayToEnum = (n) => {
|
|
1763
1763
|
const a = {};
|
|
1764
|
-
for (const
|
|
1765
|
-
a[
|
|
1764
|
+
for (const o of n)
|
|
1765
|
+
a[o] = o;
|
|
1766
1766
|
return a;
|
|
1767
1767
|
}, t.getValidEnumValues = (n) => {
|
|
1768
|
-
const a = t.objectKeys(n).filter((
|
|
1769
|
-
for (const
|
|
1770
|
-
|
|
1771
|
-
return t.objectValues(
|
|
1768
|
+
const a = t.objectKeys(n).filter((d) => typeof n[n[d]] != "number"), o = {};
|
|
1769
|
+
for (const d of a)
|
|
1770
|
+
o[d] = n[d];
|
|
1771
|
+
return t.objectValues(o);
|
|
1772
1772
|
}, t.objectValues = (n) => t.objectKeys(n).map(function(a) {
|
|
1773
1773
|
return n[a];
|
|
1774
1774
|
}), t.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
|
|
1775
1775
|
const a = [];
|
|
1776
|
-
for (const
|
|
1777
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
1776
|
+
for (const o in n)
|
|
1777
|
+
Object.prototype.hasOwnProperty.call(n, o) && a.push(o);
|
|
1778
1778
|
return a;
|
|
1779
1779
|
}, t.find = (n, a) => {
|
|
1780
|
-
for (const
|
|
1781
|
-
if (a(
|
|
1782
|
-
return
|
|
1780
|
+
for (const o of n)
|
|
1781
|
+
if (a(o))
|
|
1782
|
+
return o;
|
|
1783
1783
|
}, t.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
|
|
1784
1784
|
function r(n, a = " | ") {
|
|
1785
|
-
return n.map((
|
|
1785
|
+
return n.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
|
|
1786
1786
|
}
|
|
1787
1787
|
t.joinValues = r, t.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
1788
1788
|
})($ || ($ = {}));
|
|
@@ -1794,7 +1794,7 @@ var Tt;
|
|
|
1794
1794
|
// second overwrites first
|
|
1795
1795
|
});
|
|
1796
1796
|
})(Tt || (Tt = {}));
|
|
1797
|
-
const
|
|
1797
|
+
const w = $.arrayToEnum([
|
|
1798
1798
|
"string",
|
|
1799
1799
|
"nan",
|
|
1800
1800
|
"number",
|
|
@@ -1818,23 +1818,23 @@ const _ = $.arrayToEnum([
|
|
|
1818
1818
|
]), fe = (t) => {
|
|
1819
1819
|
switch (typeof t) {
|
|
1820
1820
|
case "undefined":
|
|
1821
|
-
return
|
|
1821
|
+
return w.undefined;
|
|
1822
1822
|
case "string":
|
|
1823
|
-
return
|
|
1823
|
+
return w.string;
|
|
1824
1824
|
case "number":
|
|
1825
|
-
return Number.isNaN(t) ?
|
|
1825
|
+
return Number.isNaN(t) ? w.nan : w.number;
|
|
1826
1826
|
case "boolean":
|
|
1827
|
-
return
|
|
1827
|
+
return w.boolean;
|
|
1828
1828
|
case "function":
|
|
1829
|
-
return
|
|
1829
|
+
return w.function;
|
|
1830
1830
|
case "bigint":
|
|
1831
|
-
return
|
|
1831
|
+
return w.bigint;
|
|
1832
1832
|
case "symbol":
|
|
1833
|
-
return
|
|
1833
|
+
return w.symbol;
|
|
1834
1834
|
case "object":
|
|
1835
|
-
return Array.isArray(t) ?
|
|
1835
|
+
return Array.isArray(t) ? w.array : t === null ? w.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? w.promise : typeof Map < "u" && t instanceof Map ? w.map : typeof Set < "u" && t instanceof Set ? w.set : typeof Date < "u" && t instanceof Date ? w.date : w.object;
|
|
1836
1836
|
default:
|
|
1837
|
-
return
|
|
1837
|
+
return w.unknown;
|
|
1838
1838
|
}
|
|
1839
1839
|
}, y = $.arrayToEnum([
|
|
1840
1840
|
"invalid_type",
|
|
@@ -1854,7 +1854,7 @@ const _ = $.arrayToEnum([
|
|
|
1854
1854
|
"not_multiple_of",
|
|
1855
1855
|
"not_finite"
|
|
1856
1856
|
]);
|
|
1857
|
-
class
|
|
1857
|
+
class de extends Error {
|
|
1858
1858
|
get errors() {
|
|
1859
1859
|
return this.issues;
|
|
1860
1860
|
}
|
|
@@ -1871,27 +1871,27 @@ class ue extends Error {
|
|
|
1871
1871
|
const s = e || function(a) {
|
|
1872
1872
|
return a.message;
|
|
1873
1873
|
}, r = { _errors: [] }, n = (a) => {
|
|
1874
|
-
for (const
|
|
1875
|
-
if (
|
|
1876
|
-
|
|
1877
|
-
else if (
|
|
1878
|
-
n(
|
|
1879
|
-
else if (
|
|
1880
|
-
n(
|
|
1881
|
-
else if (
|
|
1882
|
-
r._errors.push(s(
|
|
1874
|
+
for (const o of a.issues)
|
|
1875
|
+
if (o.code === "invalid_union")
|
|
1876
|
+
o.unionErrors.map(n);
|
|
1877
|
+
else if (o.code === "invalid_return_type")
|
|
1878
|
+
n(o.returnTypeError);
|
|
1879
|
+
else if (o.code === "invalid_arguments")
|
|
1880
|
+
n(o.argumentsError);
|
|
1881
|
+
else if (o.path.length === 0)
|
|
1882
|
+
r._errors.push(s(o));
|
|
1883
1883
|
else {
|
|
1884
|
-
let
|
|
1885
|
-
for (;
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1884
|
+
let d = r, l = 0;
|
|
1885
|
+
for (; l < o.path.length; ) {
|
|
1886
|
+
const c = o.path[l];
|
|
1887
|
+
l === o.path.length - 1 ? (d[c] = d[c] || { _errors: [] }, d[c]._errors.push(s(o))) : d[c] = d[c] || { _errors: [] }, d = d[c], l++;
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
1890
|
};
|
|
1891
1891
|
return n(this), r;
|
|
1892
1892
|
}
|
|
1893
1893
|
static assert(e) {
|
|
1894
|
-
if (!(e instanceof
|
|
1894
|
+
if (!(e instanceof de))
|
|
1895
1895
|
throw new Error(`Not a ZodError: ${e}`);
|
|
1896
1896
|
}
|
|
1897
1897
|
toString() {
|
|
@@ -1917,12 +1917,12 @@ class ue extends Error {
|
|
|
1917
1917
|
return this.flatten();
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
|
-
|
|
1920
|
+
de.create = (t) => new de(t);
|
|
1921
1921
|
const ht = (t, e) => {
|
|
1922
1922
|
let s;
|
|
1923
1923
|
switch (t.code) {
|
|
1924
1924
|
case y.invalid_type:
|
|
1925
|
-
t.received ===
|
|
1925
|
+
t.received === w.undefined ? s = "Required" : s = `Expected ${t.expected}, received ${t.received}`;
|
|
1926
1926
|
break;
|
|
1927
1927
|
case y.invalid_literal:
|
|
1928
1928
|
s = `Invalid literal value, expected ${JSON.stringify(t.expected, $.jsonStringifyReplacer)}`;
|
|
@@ -1979,7 +1979,7 @@ function ln() {
|
|
|
1979
1979
|
return on;
|
|
1980
1980
|
}
|
|
1981
1981
|
const cn = (t) => {
|
|
1982
|
-
const { data: e, path: s, errorMaps: r, issueData: n } = t, a = [...s, ...n.path || []],
|
|
1982
|
+
const { data: e, path: s, errorMaps: r, issueData: n } = t, a = [...s, ...n.path || []], o = {
|
|
1983
1983
|
...n,
|
|
1984
1984
|
path: a
|
|
1985
1985
|
};
|
|
@@ -1989,14 +1989,14 @@ const cn = (t) => {
|
|
|
1989
1989
|
path: a,
|
|
1990
1990
|
message: n.message
|
|
1991
1991
|
};
|
|
1992
|
-
let
|
|
1993
|
-
const
|
|
1994
|
-
for (const
|
|
1995
|
-
|
|
1992
|
+
let d = "";
|
|
1993
|
+
const l = r.filter((c) => !!c).slice().reverse();
|
|
1994
|
+
for (const c of l)
|
|
1995
|
+
d = c(o, { data: e, defaultError: d }).message;
|
|
1996
1996
|
return {
|
|
1997
1997
|
...n,
|
|
1998
1998
|
path: a,
|
|
1999
|
-
message:
|
|
1999
|
+
message: d
|
|
2000
2000
|
};
|
|
2001
2001
|
};
|
|
2002
2002
|
function x(t, e) {
|
|
@@ -2039,10 +2039,10 @@ class te {
|
|
|
2039
2039
|
static async mergeObjectAsync(e, s) {
|
|
2040
2040
|
const r = [];
|
|
2041
2041
|
for (const n of s) {
|
|
2042
|
-
const a = await n.key,
|
|
2042
|
+
const a = await n.key, o = await n.value;
|
|
2043
2043
|
r.push({
|
|
2044
2044
|
key: a,
|
|
2045
|
-
value:
|
|
2045
|
+
value: o
|
|
2046
2046
|
});
|
|
2047
2047
|
}
|
|
2048
2048
|
return te.mergeObjectSync(e, r);
|
|
@@ -2050,10 +2050,10 @@ class te {
|
|
|
2050
2050
|
static mergeObjectSync(e, s) {
|
|
2051
2051
|
const r = {};
|
|
2052
2052
|
for (const n of s) {
|
|
2053
|
-
const { key: a, value:
|
|
2054
|
-
if (a.status === "aborted" ||
|
|
2053
|
+
const { key: a, value: o } = n;
|
|
2054
|
+
if (a.status === "aborted" || o.status === "aborted")
|
|
2055
2055
|
return C;
|
|
2056
|
-
a.status === "dirty" && e.dirty(),
|
|
2056
|
+
a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || n.alwaysSet) && (r[a.value] = o.value);
|
|
2057
2057
|
}
|
|
2058
2058
|
return { status: e.value, value: r };
|
|
2059
2059
|
}
|
|
@@ -2083,7 +2083,7 @@ const Mt = (t, e) => {
|
|
|
2083
2083
|
get error() {
|
|
2084
2084
|
if (this._error)
|
|
2085
2085
|
return this._error;
|
|
2086
|
-
const s = new
|
|
2086
|
+
const s = new de(t.common.issues);
|
|
2087
2087
|
return this._error = s, this._error;
|
|
2088
2088
|
}
|
|
2089
2089
|
};
|
|
@@ -2094,9 +2094,9 @@ function O(t) {
|
|
|
2094
2094
|
const { errorMap: e, invalid_type_error: s, required_error: r, description: n } = t;
|
|
2095
2095
|
if (e && (s || r))
|
|
2096
2096
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
2097
|
-
return e ? { errorMap: e, description: n } : { errorMap: (
|
|
2098
|
-
const { message:
|
|
2099
|
-
return
|
|
2097
|
+
return e ? { errorMap: e, description: n } : { errorMap: (o, d) => {
|
|
2098
|
+
const { message: l } = t;
|
|
2099
|
+
return o.code === "invalid_enum_value" ? { message: l ?? d.defaultError } : typeof d.data > "u" ? { message: l ?? r ?? d.defaultError } : o.code !== "invalid_type" ? { message: d.defaultError } : { message: l ?? s ?? d.defaultError };
|
|
2100
2100
|
}, description: n };
|
|
2101
2101
|
}
|
|
2102
2102
|
class F {
|
|
@@ -2216,11 +2216,11 @@ class F {
|
|
|
2216
2216
|
refine(e, s) {
|
|
2217
2217
|
const r = (n) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(n) : s;
|
|
2218
2218
|
return this._refinement((n, a) => {
|
|
2219
|
-
const
|
|
2219
|
+
const o = e(n), d = () => a.addIssue({
|
|
2220
2220
|
code: y.custom,
|
|
2221
2221
|
...r(n)
|
|
2222
2222
|
});
|
|
2223
|
-
return typeof Promise < "u" &&
|
|
2223
|
+
return typeof Promise < "u" && o instanceof Promise ? o.then((l) => l ? !0 : (d(), !1)) : o ? !0 : (d(), !1);
|
|
2224
2224
|
});
|
|
2225
2225
|
}
|
|
2226
2226
|
refinement(e, s) {
|
|
@@ -2317,7 +2317,7 @@ class F {
|
|
|
2317
2317
|
return this.safeParse(null).success;
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
|
-
const
|
|
2320
|
+
const dn = /^c[^\s-]{8,}$/i, un = /^[0-9a-z]+$/, fn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, hn = /^[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, mn = /^[a-z0-9_-]{21}$/i, pn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, gn = /^[-+]?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)?)??$/, yn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, vn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
2321
2321
|
let ot;
|
|
2322
2322
|
const xn = /^(?:(?: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])$/, bn = /^(?:(?: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])$/, _n = /^(([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]))$/, wn = /^(([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])$/, jn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Nn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Cs = "((\\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])))", kn = new RegExp(`^${Cs}$`);
|
|
2323
2323
|
function Es(t) {
|
|
@@ -2355,11 +2355,11 @@ function Rn(t, e) {
|
|
|
2355
2355
|
}
|
|
2356
2356
|
class ce extends F {
|
|
2357
2357
|
_parse(e) {
|
|
2358
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
2358
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== w.string) {
|
|
2359
2359
|
const a = this._getOrReturnCtx(e);
|
|
2360
2360
|
return x(a, {
|
|
2361
2361
|
code: y.invalid_type,
|
|
2362
|
-
expected:
|
|
2362
|
+
expected: w.string,
|
|
2363
2363
|
received: a.parsedType
|
|
2364
2364
|
}), C;
|
|
2365
2365
|
}
|
|
@@ -2385,15 +2385,15 @@ class ce extends F {
|
|
|
2385
2385
|
message: a.message
|
|
2386
2386
|
}), r.dirty());
|
|
2387
2387
|
else if (a.kind === "length") {
|
|
2388
|
-
const
|
|
2389
|
-
(
|
|
2388
|
+
const o = e.data.length > a.value, d = e.data.length < a.value;
|
|
2389
|
+
(o || d) && (n = this._getOrReturnCtx(e, n), o ? x(n, {
|
|
2390
2390
|
code: y.too_big,
|
|
2391
2391
|
maximum: a.value,
|
|
2392
2392
|
type: "string",
|
|
2393
2393
|
inclusive: !0,
|
|
2394
2394
|
exact: !0,
|
|
2395
2395
|
message: a.message
|
|
2396
|
-
}) :
|
|
2396
|
+
}) : d && x(n, {
|
|
2397
2397
|
code: y.too_small,
|
|
2398
2398
|
minimum: a.value,
|
|
2399
2399
|
type: "string",
|
|
@@ -2426,13 +2426,13 @@ class ce extends F {
|
|
|
2426
2426
|
message: a.message
|
|
2427
2427
|
}), r.dirty());
|
|
2428
2428
|
else if (a.kind === "cuid")
|
|
2429
|
-
|
|
2429
|
+
dn.test(e.data) || (n = this._getOrReturnCtx(e, n), x(n, {
|
|
2430
2430
|
validation: "cuid",
|
|
2431
2431
|
code: y.invalid_string,
|
|
2432
2432
|
message: a.message
|
|
2433
2433
|
}), r.dirty());
|
|
2434
2434
|
else if (a.kind === "cuid2")
|
|
2435
|
-
|
|
2435
|
+
un.test(e.data) || (n = this._getOrReturnCtx(e, n), x(n, {
|
|
2436
2436
|
validation: "cuid2",
|
|
2437
2437
|
code: y.invalid_string,
|
|
2438
2438
|
message: a.message
|
|
@@ -2737,19 +2737,19 @@ ce.create = (t) => new ce({
|
|
|
2737
2737
|
...O(t)
|
|
2738
2738
|
});
|
|
2739
2739
|
function Pn(t, e) {
|
|
2740
|
-
const s = (t.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, n = s > r ? s : r, a = Number.parseInt(t.toFixed(n).replace(".", "")),
|
|
2741
|
-
return a %
|
|
2740
|
+
const s = (t.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, n = s > r ? s : r, a = Number.parseInt(t.toFixed(n).replace(".", "")), o = Number.parseInt(e.toFixed(n).replace(".", ""));
|
|
2741
|
+
return a % o / 10 ** n;
|
|
2742
2742
|
}
|
|
2743
2743
|
class be extends F {
|
|
2744
2744
|
constructor() {
|
|
2745
2745
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
2746
2746
|
}
|
|
2747
2747
|
_parse(e) {
|
|
2748
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
2748
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== w.number) {
|
|
2749
2749
|
const a = this._getOrReturnCtx(e);
|
|
2750
2750
|
return x(a, {
|
|
2751
2751
|
code: y.invalid_type,
|
|
2752
|
-
expected:
|
|
2752
|
+
expected: w.number,
|
|
2753
2753
|
received: a.parsedType
|
|
2754
2754
|
}), C;
|
|
2755
2755
|
}
|
|
@@ -2923,7 +2923,7 @@ class _e extends F {
|
|
|
2923
2923
|
} catch {
|
|
2924
2924
|
return this._getInvalidInput(e);
|
|
2925
2925
|
}
|
|
2926
|
-
if (this._getType(e) !==
|
|
2926
|
+
if (this._getType(e) !== w.bigint)
|
|
2927
2927
|
return this._getInvalidInput(e);
|
|
2928
2928
|
let r;
|
|
2929
2929
|
const n = new te();
|
|
@@ -2951,7 +2951,7 @@ class _e extends F {
|
|
|
2951
2951
|
const s = this._getOrReturnCtx(e);
|
|
2952
2952
|
return x(s, {
|
|
2953
2953
|
code: y.invalid_type,
|
|
2954
|
-
expected:
|
|
2954
|
+
expected: w.bigint,
|
|
2955
2955
|
received: s.parsedType
|
|
2956
2956
|
}), C;
|
|
2957
2957
|
}
|
|
@@ -3047,11 +3047,11 @@ _e.create = (t) => new _e({
|
|
|
3047
3047
|
});
|
|
3048
3048
|
class Je extends F {
|
|
3049
3049
|
_parse(e) {
|
|
3050
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
3050
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== w.boolean) {
|
|
3051
3051
|
const r = this._getOrReturnCtx(e);
|
|
3052
3052
|
return x(r, {
|
|
3053
3053
|
code: y.invalid_type,
|
|
3054
|
-
expected:
|
|
3054
|
+
expected: w.boolean,
|
|
3055
3055
|
received: r.parsedType
|
|
3056
3056
|
}), C;
|
|
3057
3057
|
}
|
|
@@ -3065,11 +3065,11 @@ Je.create = (t) => new Je({
|
|
|
3065
3065
|
});
|
|
3066
3066
|
class Re extends F {
|
|
3067
3067
|
_parse(e) {
|
|
3068
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
3068
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== w.date) {
|
|
3069
3069
|
const a = this._getOrReturnCtx(e);
|
|
3070
3070
|
return x(a, {
|
|
3071
3071
|
code: y.invalid_type,
|
|
3072
|
-
expected:
|
|
3072
|
+
expected: w.date,
|
|
3073
3073
|
received: a.parsedType
|
|
3074
3074
|
}), C;
|
|
3075
3075
|
}
|
|
@@ -3143,11 +3143,11 @@ Re.create = (t) => new Re({
|
|
|
3143
3143
|
});
|
|
3144
3144
|
class Lt extends F {
|
|
3145
3145
|
_parse(e) {
|
|
3146
|
-
if (this._getType(e) !==
|
|
3146
|
+
if (this._getType(e) !== w.symbol) {
|
|
3147
3147
|
const r = this._getOrReturnCtx(e);
|
|
3148
3148
|
return x(r, {
|
|
3149
3149
|
code: y.invalid_type,
|
|
3150
|
-
expected:
|
|
3150
|
+
expected: w.symbol,
|
|
3151
3151
|
received: r.parsedType
|
|
3152
3152
|
}), C;
|
|
3153
3153
|
}
|
|
@@ -3160,11 +3160,11 @@ Lt.create = (t) => new Lt({
|
|
|
3160
3160
|
});
|
|
3161
3161
|
class Ft extends F {
|
|
3162
3162
|
_parse(e) {
|
|
3163
|
-
if (this._getType(e) !==
|
|
3163
|
+
if (this._getType(e) !== w.undefined) {
|
|
3164
3164
|
const r = this._getOrReturnCtx(e);
|
|
3165
3165
|
return x(r, {
|
|
3166
3166
|
code: y.invalid_type,
|
|
3167
|
-
expected:
|
|
3167
|
+
expected: w.undefined,
|
|
3168
3168
|
received: r.parsedType
|
|
3169
3169
|
}), C;
|
|
3170
3170
|
}
|
|
@@ -3177,11 +3177,11 @@ Ft.create = (t) => new Ft({
|
|
|
3177
3177
|
});
|
|
3178
3178
|
class $t extends F {
|
|
3179
3179
|
_parse(e) {
|
|
3180
|
-
if (this._getType(e) !==
|
|
3180
|
+
if (this._getType(e) !== w.null) {
|
|
3181
3181
|
const r = this._getOrReturnCtx(e);
|
|
3182
3182
|
return x(r, {
|
|
3183
3183
|
code: y.invalid_type,
|
|
3184
|
-
expected:
|
|
3184
|
+
expected: w.null,
|
|
3185
3185
|
received: r.parsedType
|
|
3186
3186
|
}), C;
|
|
3187
3187
|
}
|
|
@@ -3221,7 +3221,7 @@ class ge extends F {
|
|
|
3221
3221
|
const s = this._getOrReturnCtx(e);
|
|
3222
3222
|
return x(s, {
|
|
3223
3223
|
code: y.invalid_type,
|
|
3224
|
-
expected:
|
|
3224
|
+
expected: w.never,
|
|
3225
3225
|
received: s.parsedType
|
|
3226
3226
|
}), C;
|
|
3227
3227
|
}
|
|
@@ -3232,11 +3232,11 @@ ge.create = (t) => new ge({
|
|
|
3232
3232
|
});
|
|
3233
3233
|
class zt extends F {
|
|
3234
3234
|
_parse(e) {
|
|
3235
|
-
if (this._getType(e) !==
|
|
3235
|
+
if (this._getType(e) !== w.undefined) {
|
|
3236
3236
|
const r = this._getOrReturnCtx(e);
|
|
3237
3237
|
return x(r, {
|
|
3238
3238
|
code: y.invalid_type,
|
|
3239
|
-
expected:
|
|
3239
|
+
expected: w.void,
|
|
3240
3240
|
received: r.parsedType
|
|
3241
3241
|
}), C;
|
|
3242
3242
|
}
|
|
@@ -3250,18 +3250,18 @@ zt.create = (t) => new zt({
|
|
|
3250
3250
|
class oe extends F {
|
|
3251
3251
|
_parse(e) {
|
|
3252
3252
|
const { ctx: s, status: r } = this._processInputParams(e), n = this._def;
|
|
3253
|
-
if (s.parsedType !==
|
|
3253
|
+
if (s.parsedType !== w.array)
|
|
3254
3254
|
return x(s, {
|
|
3255
3255
|
code: y.invalid_type,
|
|
3256
|
-
expected:
|
|
3256
|
+
expected: w.array,
|
|
3257
3257
|
received: s.parsedType
|
|
3258
3258
|
}), C;
|
|
3259
3259
|
if (n.exactLength !== null) {
|
|
3260
|
-
const
|
|
3261
|
-
(
|
|
3262
|
-
code:
|
|
3263
|
-
minimum:
|
|
3264
|
-
maximum:
|
|
3260
|
+
const o = s.data.length > n.exactLength.value, d = s.data.length < n.exactLength.value;
|
|
3261
|
+
(o || d) && (x(s, {
|
|
3262
|
+
code: o ? y.too_big : y.too_small,
|
|
3263
|
+
minimum: d ? n.exactLength.value : void 0,
|
|
3264
|
+
maximum: o ? n.exactLength.value : void 0,
|
|
3265
3265
|
type: "array",
|
|
3266
3266
|
inclusive: !0,
|
|
3267
3267
|
exact: !0,
|
|
@@ -3283,8 +3283,8 @@ class oe extends F {
|
|
|
3283
3283
|
exact: !1,
|
|
3284
3284
|
message: n.maxLength.message
|
|
3285
3285
|
}), r.dirty()), s.common.async)
|
|
3286
|
-
return Promise.all([...s.data].map((
|
|
3287
|
-
const a = [...s.data].map((
|
|
3286
|
+
return Promise.all([...s.data].map((o, d) => n.type._parseAsync(new pe(s, o, s.path, d)))).then((o) => te.mergeArray(r, o));
|
|
3287
|
+
const a = [...s.data].map((o, d) => n.type._parseSync(new pe(s, o, s.path, d)));
|
|
3288
3288
|
return te.mergeArray(r, a);
|
|
3289
3289
|
}
|
|
3290
3290
|
get element() {
|
|
@@ -3347,67 +3347,67 @@ class Q extends F {
|
|
|
3347
3347
|
return this._cached = { shape: e, keys: s }, this._cached;
|
|
3348
3348
|
}
|
|
3349
3349
|
_parse(e) {
|
|
3350
|
-
if (this._getType(e) !==
|
|
3351
|
-
const
|
|
3352
|
-
return x(
|
|
3350
|
+
if (this._getType(e) !== w.object) {
|
|
3351
|
+
const c = this._getOrReturnCtx(e);
|
|
3352
|
+
return x(c, {
|
|
3353
3353
|
code: y.invalid_type,
|
|
3354
|
-
expected:
|
|
3355
|
-
received:
|
|
3354
|
+
expected: w.object,
|
|
3355
|
+
received: c.parsedType
|
|
3356
3356
|
}), C;
|
|
3357
3357
|
}
|
|
3358
|
-
const { status: r, ctx: n } = this._processInputParams(e), { shape: a, keys:
|
|
3358
|
+
const { status: r, ctx: n } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), d = [];
|
|
3359
3359
|
if (!(this._def.catchall instanceof ge && this._def.unknownKeys === "strip"))
|
|
3360
|
-
for (const
|
|
3361
|
-
|
|
3362
|
-
const
|
|
3363
|
-
for (const
|
|
3364
|
-
const
|
|
3365
|
-
|
|
3366
|
-
key: { status: "valid", value:
|
|
3367
|
-
value:
|
|
3368
|
-
alwaysSet:
|
|
3360
|
+
for (const c in n.data)
|
|
3361
|
+
o.includes(c) || d.push(c);
|
|
3362
|
+
const l = [];
|
|
3363
|
+
for (const c of o) {
|
|
3364
|
+
const u = a[c], f = n.data[c];
|
|
3365
|
+
l.push({
|
|
3366
|
+
key: { status: "valid", value: c },
|
|
3367
|
+
value: u._parse(new pe(n, f, n.path, c)),
|
|
3368
|
+
alwaysSet: c in n.data
|
|
3369
3369
|
});
|
|
3370
3370
|
}
|
|
3371
3371
|
if (this._def.catchall instanceof ge) {
|
|
3372
|
-
const
|
|
3373
|
-
if (
|
|
3374
|
-
for (const
|
|
3375
|
-
|
|
3376
|
-
key: { status: "valid", value:
|
|
3377
|
-
value: { status: "valid", value: n.data[
|
|
3372
|
+
const c = this._def.unknownKeys;
|
|
3373
|
+
if (c === "passthrough")
|
|
3374
|
+
for (const u of d)
|
|
3375
|
+
l.push({
|
|
3376
|
+
key: { status: "valid", value: u },
|
|
3377
|
+
value: { status: "valid", value: n.data[u] }
|
|
3378
3378
|
});
|
|
3379
|
-
else if (
|
|
3380
|
-
|
|
3379
|
+
else if (c === "strict")
|
|
3380
|
+
d.length > 0 && (x(n, {
|
|
3381
3381
|
code: y.unrecognized_keys,
|
|
3382
|
-
keys:
|
|
3382
|
+
keys: d
|
|
3383
3383
|
}), r.dirty());
|
|
3384
|
-
else if (
|
|
3384
|
+
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
3385
3385
|
} else {
|
|
3386
|
-
const
|
|
3387
|
-
for (const
|
|
3388
|
-
const f = n.data[
|
|
3389
|
-
|
|
3390
|
-
key: { status: "valid", value:
|
|
3391
|
-
value:
|
|
3392
|
-
new pe(n, f, n.path,
|
|
3386
|
+
const c = this._def.catchall;
|
|
3387
|
+
for (const u of d) {
|
|
3388
|
+
const f = n.data[u];
|
|
3389
|
+
l.push({
|
|
3390
|
+
key: { status: "valid", value: u },
|
|
3391
|
+
value: c._parse(
|
|
3392
|
+
new pe(n, f, n.path, u)
|
|
3393
3393
|
//, ctx.child(key), value, getParsedType(value)
|
|
3394
3394
|
),
|
|
3395
|
-
alwaysSet:
|
|
3395
|
+
alwaysSet: u in n.data
|
|
3396
3396
|
});
|
|
3397
3397
|
}
|
|
3398
3398
|
}
|
|
3399
3399
|
return n.common.async ? Promise.resolve().then(async () => {
|
|
3400
|
-
const
|
|
3401
|
-
for (const
|
|
3402
|
-
const f = await
|
|
3403
|
-
|
|
3400
|
+
const c = [];
|
|
3401
|
+
for (const u of l) {
|
|
3402
|
+
const f = await u.key, h = await u.value;
|
|
3403
|
+
c.push({
|
|
3404
3404
|
key: f,
|
|
3405
3405
|
value: h,
|
|
3406
|
-
alwaysSet:
|
|
3406
|
+
alwaysSet: u.alwaysSet
|
|
3407
3407
|
});
|
|
3408
3408
|
}
|
|
3409
|
-
return
|
|
3410
|
-
}).then((
|
|
3409
|
+
return c;
|
|
3410
|
+
}).then((c) => te.mergeObjectSync(r, c)) : te.mergeObjectSync(r, l);
|
|
3411
3411
|
}
|
|
3412
3412
|
get shape() {
|
|
3413
3413
|
return this._def.shape();
|
|
@@ -3627,21 +3627,21 @@ class Xe extends F {
|
|
|
3627
3627
|
_parse(e) {
|
|
3628
3628
|
const { ctx: s } = this._processInputParams(e), r = this._def.options;
|
|
3629
3629
|
function n(a) {
|
|
3630
|
-
for (const
|
|
3631
|
-
if (
|
|
3632
|
-
return
|
|
3633
|
-
for (const
|
|
3634
|
-
if (
|
|
3635
|
-
return s.common.issues.push(...
|
|
3636
|
-
const
|
|
3630
|
+
for (const d of a)
|
|
3631
|
+
if (d.result.status === "valid")
|
|
3632
|
+
return d.result;
|
|
3633
|
+
for (const d of a)
|
|
3634
|
+
if (d.result.status === "dirty")
|
|
3635
|
+
return s.common.issues.push(...d.ctx.common.issues), d.result;
|
|
3636
|
+
const o = a.map((d) => new de(d.ctx.common.issues));
|
|
3637
3637
|
return x(s, {
|
|
3638
3638
|
code: y.invalid_union,
|
|
3639
|
-
unionErrors:
|
|
3639
|
+
unionErrors: o
|
|
3640
3640
|
}), C;
|
|
3641
3641
|
}
|
|
3642
3642
|
if (s.common.async)
|
|
3643
3643
|
return Promise.all(r.map(async (a) => {
|
|
3644
|
-
const
|
|
3644
|
+
const o = {
|
|
3645
3645
|
...s,
|
|
3646
3646
|
common: {
|
|
3647
3647
|
...s.common,
|
|
@@ -3653,37 +3653,37 @@ class Xe extends F {
|
|
|
3653
3653
|
result: await a._parseAsync({
|
|
3654
3654
|
data: s.data,
|
|
3655
3655
|
path: s.path,
|
|
3656
|
-
parent:
|
|
3656
|
+
parent: o
|
|
3657
3657
|
}),
|
|
3658
|
-
ctx:
|
|
3658
|
+
ctx: o
|
|
3659
3659
|
};
|
|
3660
3660
|
})).then(n);
|
|
3661
3661
|
{
|
|
3662
3662
|
let a;
|
|
3663
|
-
const
|
|
3664
|
-
for (const
|
|
3665
|
-
const
|
|
3663
|
+
const o = [];
|
|
3664
|
+
for (const l of r) {
|
|
3665
|
+
const c = {
|
|
3666
3666
|
...s,
|
|
3667
3667
|
common: {
|
|
3668
3668
|
...s.common,
|
|
3669
3669
|
issues: []
|
|
3670
3670
|
},
|
|
3671
3671
|
parent: null
|
|
3672
|
-
},
|
|
3672
|
+
}, u = l._parseSync({
|
|
3673
3673
|
data: s.data,
|
|
3674
3674
|
path: s.path,
|
|
3675
|
-
parent:
|
|
3675
|
+
parent: c
|
|
3676
3676
|
});
|
|
3677
|
-
if (
|
|
3678
|
-
return
|
|
3679
|
-
|
|
3677
|
+
if (u.status === "valid")
|
|
3678
|
+
return u;
|
|
3679
|
+
u.status === "dirty" && !a && (a = { result: u, ctx: c }), c.common.issues.length && o.push(c.common.issues);
|
|
3680
3680
|
}
|
|
3681
3681
|
if (a)
|
|
3682
3682
|
return s.common.issues.push(...a.ctx.common.issues), a.result;
|
|
3683
|
-
const
|
|
3683
|
+
const d = o.map((l) => new de(l));
|
|
3684
3684
|
return x(s, {
|
|
3685
3685
|
code: y.invalid_union,
|
|
3686
|
-
unionErrors:
|
|
3686
|
+
unionErrors: d
|
|
3687
3687
|
}), C;
|
|
3688
3688
|
}
|
|
3689
3689
|
}
|
|
@@ -3700,35 +3700,35 @@ function mt(t, e) {
|
|
|
3700
3700
|
const s = fe(t), r = fe(e);
|
|
3701
3701
|
if (t === e)
|
|
3702
3702
|
return { valid: !0, data: t };
|
|
3703
|
-
if (s ===
|
|
3704
|
-
const n = $.objectKeys(e), a = $.objectKeys(t).filter((
|
|
3705
|
-
for (const
|
|
3706
|
-
const
|
|
3707
|
-
if (!
|
|
3703
|
+
if (s === w.object && r === w.object) {
|
|
3704
|
+
const n = $.objectKeys(e), a = $.objectKeys(t).filter((d) => n.indexOf(d) !== -1), o = { ...t, ...e };
|
|
3705
|
+
for (const d of a) {
|
|
3706
|
+
const l = mt(t[d], e[d]);
|
|
3707
|
+
if (!l.valid)
|
|
3708
3708
|
return { valid: !1 };
|
|
3709
|
-
|
|
3709
|
+
o[d] = l.data;
|
|
3710
3710
|
}
|
|
3711
|
-
return { valid: !0, data:
|
|
3712
|
-
} else if (s ===
|
|
3711
|
+
return { valid: !0, data: o };
|
|
3712
|
+
} else if (s === w.array && r === w.array) {
|
|
3713
3713
|
if (t.length !== e.length)
|
|
3714
3714
|
return { valid: !1 };
|
|
3715
3715
|
const n = [];
|
|
3716
3716
|
for (let a = 0; a < t.length; a++) {
|
|
3717
|
-
const
|
|
3718
|
-
if (!
|
|
3717
|
+
const o = t[a], d = e[a], l = mt(o, d);
|
|
3718
|
+
if (!l.valid)
|
|
3719
3719
|
return { valid: !1 };
|
|
3720
|
-
n.push(
|
|
3720
|
+
n.push(l.data);
|
|
3721
3721
|
}
|
|
3722
3722
|
return { valid: !0, data: n };
|
|
3723
|
-
} else return s ===
|
|
3723
|
+
} else return s === w.date && r === w.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
3724
3724
|
}
|
|
3725
3725
|
class et extends F {
|
|
3726
3726
|
_parse(e) {
|
|
3727
|
-
const { status: s, ctx: r } = this._processInputParams(e), n = (a,
|
|
3728
|
-
if (Ot(a) || Ot(
|
|
3727
|
+
const { status: s, ctx: r } = this._processInputParams(e), n = (a, o) => {
|
|
3728
|
+
if (Ot(a) || Ot(o))
|
|
3729
3729
|
return C;
|
|
3730
|
-
const
|
|
3731
|
-
return
|
|
3730
|
+
const d = mt(a.value, o.value);
|
|
3731
|
+
return d.valid ? ((It(a) || It(o)) && s.dirty(), { status: s.value, value: d.data }) : (x(r, {
|
|
3732
3732
|
code: y.invalid_intersection_types
|
|
3733
3733
|
}), C);
|
|
3734
3734
|
};
|
|
@@ -3743,7 +3743,7 @@ class et extends F {
|
|
|
3743
3743
|
path: r.path,
|
|
3744
3744
|
parent: r
|
|
3745
3745
|
})
|
|
3746
|
-
]).then(([a,
|
|
3746
|
+
]).then(([a, o]) => n(a, o)) : n(this._def.left._parseSync({
|
|
3747
3747
|
data: r.data,
|
|
3748
3748
|
path: r.path,
|
|
3749
3749
|
parent: r
|
|
@@ -3763,10 +3763,10 @@ et.create = (t, e, s) => new et({
|
|
|
3763
3763
|
class we extends F {
|
|
3764
3764
|
_parse(e) {
|
|
3765
3765
|
const { status: s, ctx: r } = this._processInputParams(e);
|
|
3766
|
-
if (r.parsedType !==
|
|
3766
|
+
if (r.parsedType !== w.array)
|
|
3767
3767
|
return x(r, {
|
|
3768
3768
|
code: y.invalid_type,
|
|
3769
|
-
expected:
|
|
3769
|
+
expected: w.array,
|
|
3770
3770
|
received: r.parsedType
|
|
3771
3771
|
}), C;
|
|
3772
3772
|
if (r.data.length < this._def.items.length)
|
|
@@ -3784,11 +3784,11 @@ class we extends F {
|
|
|
3784
3784
|
exact: !1,
|
|
3785
3785
|
type: "array"
|
|
3786
3786
|
}), s.dirty());
|
|
3787
|
-
const a = [...r.data].map((
|
|
3788
|
-
const
|
|
3789
|
-
return
|
|
3790
|
-
}).filter((
|
|
3791
|
-
return r.common.async ? Promise.all(a).then((
|
|
3787
|
+
const a = [...r.data].map((o, d) => {
|
|
3788
|
+
const l = this._def.items[d] || this._def.rest;
|
|
3789
|
+
return l ? l._parse(new pe(r, o, r.path, d)) : null;
|
|
3790
|
+
}).filter((o) => !!o);
|
|
3791
|
+
return r.common.async ? Promise.all(a).then((o) => te.mergeArray(s, o)) : te.mergeArray(s, a);
|
|
3792
3792
|
}
|
|
3793
3793
|
get items() {
|
|
3794
3794
|
return this._def.items;
|
|
@@ -3819,36 +3819,36 @@ class Zt extends F {
|
|
|
3819
3819
|
}
|
|
3820
3820
|
_parse(e) {
|
|
3821
3821
|
const { status: s, ctx: r } = this._processInputParams(e);
|
|
3822
|
-
if (r.parsedType !==
|
|
3822
|
+
if (r.parsedType !== w.map)
|
|
3823
3823
|
return x(r, {
|
|
3824
3824
|
code: y.invalid_type,
|
|
3825
|
-
expected:
|
|
3825
|
+
expected: w.map,
|
|
3826
3826
|
received: r.parsedType
|
|
3827
3827
|
}), C;
|
|
3828
|
-
const n = this._def.keyType, a = this._def.valueType,
|
|
3829
|
-
key: n._parse(new pe(r,
|
|
3830
|
-
value: a._parse(new pe(r,
|
|
3828
|
+
const n = this._def.keyType, a = this._def.valueType, o = [...r.data.entries()].map(([d, l], c) => ({
|
|
3829
|
+
key: n._parse(new pe(r, d, r.path, [c, "key"])),
|
|
3830
|
+
value: a._parse(new pe(r, l, r.path, [c, "value"]))
|
|
3831
3831
|
}));
|
|
3832
3832
|
if (r.common.async) {
|
|
3833
|
-
const
|
|
3833
|
+
const d = /* @__PURE__ */ new Map();
|
|
3834
3834
|
return Promise.resolve().then(async () => {
|
|
3835
|
-
for (const
|
|
3836
|
-
const
|
|
3837
|
-
if (
|
|
3835
|
+
for (const l of o) {
|
|
3836
|
+
const c = await l.key, u = await l.value;
|
|
3837
|
+
if (c.status === "aborted" || u.status === "aborted")
|
|
3838
3838
|
return C;
|
|
3839
|
-
(
|
|
3839
|
+
(c.status === "dirty" || u.status === "dirty") && s.dirty(), d.set(c.value, u.value);
|
|
3840
3840
|
}
|
|
3841
|
-
return { status: s.value, value:
|
|
3841
|
+
return { status: s.value, value: d };
|
|
3842
3842
|
});
|
|
3843
3843
|
} else {
|
|
3844
|
-
const
|
|
3845
|
-
for (const
|
|
3846
|
-
const
|
|
3847
|
-
if (
|
|
3844
|
+
const d = /* @__PURE__ */ new Map();
|
|
3845
|
+
for (const l of o) {
|
|
3846
|
+
const c = l.key, u = l.value;
|
|
3847
|
+
if (c.status === "aborted" || u.status === "aborted")
|
|
3848
3848
|
return C;
|
|
3849
|
-
(
|
|
3849
|
+
(c.status === "dirty" || u.status === "dirty") && s.dirty(), d.set(c.value, u.value);
|
|
3850
3850
|
}
|
|
3851
|
-
return { status: s.value, value:
|
|
3851
|
+
return { status: s.value, value: d };
|
|
3852
3852
|
}
|
|
3853
3853
|
}
|
|
3854
3854
|
}
|
|
@@ -3861,10 +3861,10 @@ Zt.create = (t, e, s) => new Zt({
|
|
|
3861
3861
|
class Ve extends F {
|
|
3862
3862
|
_parse(e) {
|
|
3863
3863
|
const { status: s, ctx: r } = this._processInputParams(e);
|
|
3864
|
-
if (r.parsedType !==
|
|
3864
|
+
if (r.parsedType !== w.set)
|
|
3865
3865
|
return x(r, {
|
|
3866
3866
|
code: y.invalid_type,
|
|
3867
|
-
expected:
|
|
3867
|
+
expected: w.set,
|
|
3868
3868
|
received: r.parsedType
|
|
3869
3869
|
}), C;
|
|
3870
3870
|
const n = this._def;
|
|
@@ -3884,17 +3884,17 @@ class Ve extends F {
|
|
|
3884
3884
|
message: n.maxSize.message
|
|
3885
3885
|
}), s.dirty());
|
|
3886
3886
|
const a = this._def.valueType;
|
|
3887
|
-
function l
|
|
3888
|
-
const
|
|
3889
|
-
for (const
|
|
3890
|
-
if (
|
|
3887
|
+
function o(l) {
|
|
3888
|
+
const c = /* @__PURE__ */ new Set();
|
|
3889
|
+
for (const u of l) {
|
|
3890
|
+
if (u.status === "aborted")
|
|
3891
3891
|
return C;
|
|
3892
|
-
|
|
3892
|
+
u.status === "dirty" && s.dirty(), c.add(u.value);
|
|
3893
3893
|
}
|
|
3894
|
-
return { status: s.value, value:
|
|
3894
|
+
return { status: s.value, value: c };
|
|
3895
3895
|
}
|
|
3896
|
-
const
|
|
3897
|
-
return r.common.async ? Promise.all(
|
|
3896
|
+
const d = [...r.data.values()].map((l, c) => a._parse(new pe(r, l, r.path, c)));
|
|
3897
|
+
return r.common.async ? Promise.all(d).then((l) => o(l)) : o(d);
|
|
3898
3898
|
}
|
|
3899
3899
|
min(e, s) {
|
|
3900
3900
|
return new Ve({
|
|
@@ -4022,7 +4022,7 @@ Pe.create = Ss;
|
|
|
4022
4022
|
class Bt extends F {
|
|
4023
4023
|
_parse(e) {
|
|
4024
4024
|
const s = $.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
4025
|
-
if (r.parsedType !==
|
|
4025
|
+
if (r.parsedType !== w.string && r.parsedType !== w.number) {
|
|
4026
4026
|
const n = $.objectValues(s);
|
|
4027
4027
|
return x(r, {
|
|
4028
4028
|
expected: $.joinValues(n),
|
|
@@ -4055,13 +4055,13 @@ class tt extends F {
|
|
|
4055
4055
|
}
|
|
4056
4056
|
_parse(e) {
|
|
4057
4057
|
const { ctx: s } = this._processInputParams(e);
|
|
4058
|
-
if (s.parsedType !==
|
|
4058
|
+
if (s.parsedType !== w.promise && s.common.async === !1)
|
|
4059
4059
|
return x(s, {
|
|
4060
4060
|
code: y.invalid_type,
|
|
4061
|
-
expected:
|
|
4061
|
+
expected: w.promise,
|
|
4062
4062
|
received: s.parsedType
|
|
4063
4063
|
}), C;
|
|
4064
|
-
const r = s.parsedType ===
|
|
4064
|
+
const r = s.parsedType === w.promise ? s.data : Promise.resolve(s.data);
|
|
4065
4065
|
return ne(r.then((n) => this._def.type.parseAsync(n, {
|
|
4066
4066
|
path: s.path,
|
|
4067
4067
|
errorMap: s.common.contextualErrorMap
|
|
@@ -4082,73 +4082,73 @@ class Te extends F {
|
|
|
4082
4082
|
}
|
|
4083
4083
|
_parse(e) {
|
|
4084
4084
|
const { status: s, ctx: r } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
4085
|
-
addIssue: (
|
|
4086
|
-
x(r,
|
|
4085
|
+
addIssue: (o) => {
|
|
4086
|
+
x(r, o), o.fatal ? s.abort() : s.dirty();
|
|
4087
4087
|
},
|
|
4088
4088
|
get path() {
|
|
4089
4089
|
return r.path;
|
|
4090
4090
|
}
|
|
4091
4091
|
};
|
|
4092
4092
|
if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
|
|
4093
|
-
const
|
|
4093
|
+
const o = n.transform(r.data, a);
|
|
4094
4094
|
if (r.common.async)
|
|
4095
|
-
return Promise.resolve(
|
|
4095
|
+
return Promise.resolve(o).then(async (d) => {
|
|
4096
4096
|
if (s.value === "aborted")
|
|
4097
4097
|
return C;
|
|
4098
|
-
const
|
|
4099
|
-
data:
|
|
4098
|
+
const l = await this._def.schema._parseAsync({
|
|
4099
|
+
data: d,
|
|
4100
4100
|
path: r.path,
|
|
4101
4101
|
parent: r
|
|
4102
4102
|
});
|
|
4103
|
-
return
|
|
4103
|
+
return l.status === "aborted" ? C : l.status === "dirty" || s.value === "dirty" ? ze(l.value) : l;
|
|
4104
4104
|
});
|
|
4105
4105
|
{
|
|
4106
4106
|
if (s.value === "aborted")
|
|
4107
4107
|
return C;
|
|
4108
|
-
const
|
|
4109
|
-
data:
|
|
4108
|
+
const d = this._def.schema._parseSync({
|
|
4109
|
+
data: o,
|
|
4110
4110
|
path: r.path,
|
|
4111
4111
|
parent: r
|
|
4112
4112
|
});
|
|
4113
|
-
return
|
|
4113
|
+
return d.status === "aborted" ? C : d.status === "dirty" || s.value === "dirty" ? ze(d.value) : d;
|
|
4114
4114
|
}
|
|
4115
4115
|
}
|
|
4116
4116
|
if (n.type === "refinement") {
|
|
4117
|
-
const
|
|
4118
|
-
const
|
|
4117
|
+
const o = (d) => {
|
|
4118
|
+
const l = n.refinement(d, a);
|
|
4119
4119
|
if (r.common.async)
|
|
4120
|
-
return Promise.resolve(
|
|
4121
|
-
if (
|
|
4120
|
+
return Promise.resolve(l);
|
|
4121
|
+
if (l instanceof Promise)
|
|
4122
4122
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
4123
|
-
return
|
|
4123
|
+
return d;
|
|
4124
4124
|
};
|
|
4125
4125
|
if (r.common.async === !1) {
|
|
4126
|
-
const
|
|
4126
|
+
const d = this._def.schema._parseSync({
|
|
4127
4127
|
data: r.data,
|
|
4128
4128
|
path: r.path,
|
|
4129
4129
|
parent: r
|
|
4130
4130
|
});
|
|
4131
|
-
return
|
|
4131
|
+
return d.status === "aborted" ? C : (d.status === "dirty" && s.dirty(), o(d.value), { status: s.value, value: d.value });
|
|
4132
4132
|
} else
|
|
4133
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((
|
|
4133
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((d) => d.status === "aborted" ? C : (d.status === "dirty" && s.dirty(), o(d.value).then(() => ({ status: s.value, value: d.value }))));
|
|
4134
4134
|
}
|
|
4135
4135
|
if (n.type === "transform")
|
|
4136
4136
|
if (r.common.async === !1) {
|
|
4137
|
-
const
|
|
4137
|
+
const o = this._def.schema._parseSync({
|
|
4138
4138
|
data: r.data,
|
|
4139
4139
|
path: r.path,
|
|
4140
4140
|
parent: r
|
|
4141
4141
|
});
|
|
4142
|
-
if (!Ae(
|
|
4142
|
+
if (!Ae(o))
|
|
4143
4143
|
return C;
|
|
4144
|
-
const
|
|
4145
|
-
if (
|
|
4144
|
+
const d = n.transform(o.value, a);
|
|
4145
|
+
if (d instanceof Promise)
|
|
4146
4146
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
4147
|
-
return { status: s.value, value:
|
|
4147
|
+
return { status: s.value, value: d };
|
|
4148
4148
|
} else
|
|
4149
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((
|
|
4149
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => Ae(o) ? Promise.resolve(n.transform(o.value, a)).then((d) => ({
|
|
4150
4150
|
status: s.value,
|
|
4151
|
-
value:
|
|
4151
|
+
value: d
|
|
4152
4152
|
})) : C);
|
|
4153
4153
|
$.assertNever(n);
|
|
4154
4154
|
}
|
|
@@ -4167,7 +4167,7 @@ Te.createWithPreprocess = (t, e, s) => new Te({
|
|
|
4167
4167
|
});
|
|
4168
4168
|
class me extends F {
|
|
4169
4169
|
_parse(e) {
|
|
4170
|
-
return this._getType(e) ===
|
|
4170
|
+
return this._getType(e) === w.undefined ? ne(void 0) : this._def.innerType._parse(e);
|
|
4171
4171
|
}
|
|
4172
4172
|
unwrap() {
|
|
4173
4173
|
return this._def.innerType;
|
|
@@ -4180,7 +4180,7 @@ me.create = (t, e) => new me({
|
|
|
4180
4180
|
});
|
|
4181
4181
|
class Oe extends F {
|
|
4182
4182
|
_parse(e) {
|
|
4183
|
-
return this._getType(e) ===
|
|
4183
|
+
return this._getType(e) === w.null ? ne(null) : this._def.innerType._parse(e);
|
|
4184
4184
|
}
|
|
4185
4185
|
unwrap() {
|
|
4186
4186
|
return this._def.innerType;
|
|
@@ -4195,7 +4195,7 @@ class pt extends F {
|
|
|
4195
4195
|
_parse(e) {
|
|
4196
4196
|
const { ctx: s } = this._processInputParams(e);
|
|
4197
4197
|
let r = s.data;
|
|
4198
|
-
return s.parsedType ===
|
|
4198
|
+
return s.parsedType === w.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
|
|
4199
4199
|
data: r,
|
|
4200
4200
|
path: s.path,
|
|
4201
4201
|
parent: s
|
|
@@ -4230,7 +4230,7 @@ class gt extends F {
|
|
|
4230
4230
|
status: "valid",
|
|
4231
4231
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
4232
4232
|
get error() {
|
|
4233
|
-
return new
|
|
4233
|
+
return new de(r.common.issues);
|
|
4234
4234
|
},
|
|
4235
4235
|
input: r.data
|
|
4236
4236
|
})
|
|
@@ -4238,7 +4238,7 @@ class gt extends F {
|
|
|
4238
4238
|
status: "valid",
|
|
4239
4239
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
4240
4240
|
get error() {
|
|
4241
|
-
return new
|
|
4241
|
+
return new de(r.common.issues);
|
|
4242
4242
|
},
|
|
4243
4243
|
input: r.data
|
|
4244
4244
|
})
|
|
@@ -4256,11 +4256,11 @@ gt.create = (t, e) => new gt({
|
|
|
4256
4256
|
});
|
|
4257
4257
|
class Qt extends F {
|
|
4258
4258
|
_parse(e) {
|
|
4259
|
-
if (this._getType(e) !==
|
|
4259
|
+
if (this._getType(e) !== w.nan) {
|
|
4260
4260
|
const r = this._getOrReturnCtx(e);
|
|
4261
4261
|
return x(r, {
|
|
4262
4262
|
code: y.invalid_type,
|
|
4263
|
-
expected:
|
|
4263
|
+
expected: w.nan,
|
|
4264
4264
|
received: r.parsedType
|
|
4265
4265
|
}), C;
|
|
4266
4266
|
}
|
|
@@ -4377,10 +4377,10 @@ const st = {
|
|
|
4377
4377
|
});
|
|
4378
4378
|
function Mn({ setSelectedTask: t }) {
|
|
4379
4379
|
const e = (r) => {
|
|
4380
|
-
const { data: n, raw: a, isLoading:
|
|
4380
|
+
const { data: n, raw: a, isLoading: o } = Ns(r);
|
|
4381
4381
|
return {
|
|
4382
4382
|
data: n ?? [],
|
|
4383
|
-
isLoading:
|
|
4383
|
+
isLoading: o,
|
|
4384
4384
|
raw: a
|
|
4385
4385
|
};
|
|
4386
4386
|
}, s = [
|
|
@@ -4466,8 +4466,8 @@ function Mn({ setSelectedTask: t }) {
|
|
|
4466
4466
|
className: "input input-sm input-bordered w-40",
|
|
4467
4467
|
value: r.from_date ? r.from_date.split("T")[0] : "",
|
|
4468
4468
|
onChange: (a) => {
|
|
4469
|
-
const
|
|
4470
|
-
n("from_date",
|
|
4469
|
+
const o = a.target.value ? new Date(a.target.value).toISOString() : void 0;
|
|
4470
|
+
n("from_date", o);
|
|
4471
4471
|
}
|
|
4472
4472
|
}
|
|
4473
4473
|
),
|
|
@@ -4479,8 +4479,8 @@ function Mn({ setSelectedTask: t }) {
|
|
|
4479
4479
|
className: "input input-sm input-bordered w-40",
|
|
4480
4480
|
value: r.to_date ? r.to_date.split("T")[0] : "",
|
|
4481
4481
|
onChange: (a) => {
|
|
4482
|
-
const
|
|
4483
|
-
n("to_date",
|
|
4482
|
+
const o = a.target.value ? new Date(a.target.value).toISOString() : void 0;
|
|
4483
|
+
n("to_date", o);
|
|
4484
4484
|
}
|
|
4485
4485
|
}
|
|
4486
4486
|
)
|
|
@@ -4499,7 +4499,7 @@ function Ln({ selectedTask: t, setSelectedTask: e }) {
|
|
|
4499
4499
|
className: "modal modal-open",
|
|
4500
4500
|
role: "dialog",
|
|
4501
4501
|
onClick: () => e(null),
|
|
4502
|
-
children: /* @__PURE__ */ i.jsxs("div", { className: "modal-box max-w-3xl", onClick: (
|
|
4502
|
+
children: /* @__PURE__ */ i.jsxs("div", { className: "modal-box max-w-3xl", onClick: (o) => o.stopPropagation(), children: [
|
|
4503
4503
|
/* @__PURE__ */ i.jsxs("h3", { className: "font-bold text-lg", children: [
|
|
4504
4504
|
"Task #",
|
|
4505
4505
|
t.id,
|
|
@@ -4552,13 +4552,13 @@ function Ln({ selectedTask: t, setSelectedTask: e }) {
|
|
|
4552
4552
|
/* @__PURE__ */ i.jsxs("div", { className: "mt-4 w-full", children: [
|
|
4553
4553
|
/* @__PURE__ */ i.jsx("strong", { children: "Payload:" }),
|
|
4554
4554
|
/* @__PURE__ */ i.jsx("pre", { className: "w-full max-w-full bg-base-200 p-2 rounded max-h-48 overflow-auto whitespace-pre text-xs mt-1", children: (() => {
|
|
4555
|
-
const
|
|
4556
|
-
if (
|
|
4555
|
+
const o = a;
|
|
4556
|
+
if (o == null) return "—";
|
|
4557
4557
|
try {
|
|
4558
|
-
const
|
|
4559
|
-
return JSON.stringify(
|
|
4558
|
+
const d = typeof o == "string" ? JSON.parse(o) : o;
|
|
4559
|
+
return JSON.stringify(d ?? "—", null, 2);
|
|
4560
4560
|
} catch {
|
|
4561
|
-
return typeof
|
|
4561
|
+
return typeof o == "string" ? o : JSON.stringify(o);
|
|
4562
4562
|
}
|
|
4563
4563
|
})() })
|
|
4564
4564
|
] }),
|
|
@@ -4637,11 +4637,11 @@ function Ht(t) {
|
|
|
4637
4637
|
}
|
|
4638
4638
|
function Un({ onCreateUser: t, onSelectUser: e }) {
|
|
4639
4639
|
const s = (n) => {
|
|
4640
|
-
const { data: a, raw:
|
|
4640
|
+
const { data: a, raw: o, isLoading: d } = Ps(n);
|
|
4641
4641
|
return {
|
|
4642
4642
|
data: a ?? [],
|
|
4643
|
-
isLoading:
|
|
4644
|
-
raw:
|
|
4643
|
+
isLoading: d,
|
|
4644
|
+
raw: o
|
|
4645
4645
|
};
|
|
4646
4646
|
}, r = [
|
|
4647
4647
|
{ key: "id", header: "ID" },
|
|
@@ -4697,7 +4697,7 @@ function Un({ onCreateUser: t, onSelectUser: e }) {
|
|
|
4697
4697
|
placeholder: "Search name or email",
|
|
4698
4698
|
className: "input input-sm input-bordered w-56",
|
|
4699
4699
|
value: n.q || "",
|
|
4700
|
-
onChange: (
|
|
4700
|
+
onChange: (o) => a("q", o.target.value)
|
|
4701
4701
|
}
|
|
4702
4702
|
),
|
|
4703
4703
|
/* @__PURE__ */ i.jsxs(
|
|
@@ -4705,7 +4705,7 @@ function Un({ onCreateUser: t, onSelectUser: e }) {
|
|
|
4705
4705
|
{
|
|
4706
4706
|
className: "select select-sm select-bordered w-40",
|
|
4707
4707
|
value: n.disabled || "",
|
|
4708
|
-
onChange: (
|
|
4708
|
+
onChange: (o) => a("disabled", o.target.value),
|
|
4709
4709
|
children: [
|
|
4710
4710
|
/* @__PURE__ */ i.jsx("option", { value: "", children: "All Statuses" }),
|
|
4711
4711
|
/* @__PURE__ */ i.jsx("option", { value: "false", children: "Active" }),
|
|
@@ -4720,10 +4720,10 @@ function Un({ onCreateUser: t, onSelectUser: e }) {
|
|
|
4720
4720
|
}
|
|
4721
4721
|
function rt(t, e, s = "An error occurred", r = !0) {
|
|
4722
4722
|
const n = t;
|
|
4723
|
-
if (n?.errors && Object.entries(n.errors).forEach(([a,
|
|
4723
|
+
if (n?.errors && Object.entries(n.errors).forEach(([a, o]) => {
|
|
4724
4724
|
e(a, {
|
|
4725
4725
|
type: "server",
|
|
4726
|
-
message:
|
|
4726
|
+
message: o[0]
|
|
4727
4727
|
});
|
|
4728
4728
|
}), r) {
|
|
4729
4729
|
const a = n?.message || s;
|
|
@@ -4743,17 +4743,17 @@ function zn(t) {
|
|
|
4743
4743
|
return t ? !!(t.disabled ?? t.is_disabled ?? t.active === !1) : !1;
|
|
4744
4744
|
}
|
|
4745
4745
|
function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
4746
|
-
const r = Dn(e), a = Ts(t === "edit" ? r : null).data ?? e,
|
|
4746
|
+
const r = Dn(e), a = Ts(t === "edit" ? r : null).data ?? e, o = Os(), d = Is(), l = Ms(), c = Ls(), u = Fs(), [f, h] = ae(!1), {
|
|
4747
4747
|
register: m,
|
|
4748
4748
|
handleSubmit: g,
|
|
4749
4749
|
reset: b,
|
|
4750
4750
|
setError: v,
|
|
4751
|
-
formState: { errors:
|
|
4751
|
+
formState: { errors: R, isSubmitting: N }
|
|
4752
4752
|
} = Le({
|
|
4753
4753
|
defaultValues: Yt
|
|
4754
|
-
}),
|
|
4754
|
+
}), _ = t !== null, S = t === "create";
|
|
4755
4755
|
Se(() => {
|
|
4756
|
-
if (
|
|
4756
|
+
if (_) {
|
|
4757
4757
|
if (S) {
|
|
4758
4758
|
b(Yt), h(!1);
|
|
4759
4759
|
return;
|
|
@@ -4765,26 +4765,26 @@ function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
|
4765
4765
|
is_admin: !!a?.is_admin
|
|
4766
4766
|
}), h(zn(a));
|
|
4767
4767
|
}
|
|
4768
|
-
}, [a, S,
|
|
4768
|
+
}, [a, S, _, b]);
|
|
4769
4769
|
const A = Xt(
|
|
4770
|
-
() =>
|
|
4770
|
+
() => o.isPending || d.isPending || l.isPending || c.isPending || u.isPending,
|
|
4771
4771
|
[
|
|
4772
|
-
l.isPending,
|
|
4773
|
-
d.isPending,
|
|
4774
|
-
u.isPending,
|
|
4775
4772
|
o.isPending,
|
|
4776
|
-
|
|
4773
|
+
u.isPending,
|
|
4774
|
+
c.isPending,
|
|
4775
|
+
l.isPending,
|
|
4776
|
+
d.isPending
|
|
4777
4777
|
]
|
|
4778
4778
|
) || N;
|
|
4779
|
-
if (!
|
|
4779
|
+
if (!_ || !S && !r) return null;
|
|
4780
4780
|
const V = async (M) => {
|
|
4781
4781
|
try {
|
|
4782
|
-
S ? (await
|
|
4782
|
+
S ? (await o.mutateAsync({
|
|
4783
4783
|
email: M.email,
|
|
4784
4784
|
name: M.name || void 0,
|
|
4785
4785
|
password: M.password || void 0,
|
|
4786
4786
|
is_admin: M.is_admin
|
|
4787
|
-
}), re.success("User created")) : (await
|
|
4787
|
+
}), re.success("User created")) : (await d.mutateAsync({
|
|
4788
4788
|
id: r,
|
|
4789
4789
|
data: {
|
|
4790
4790
|
email: M.email,
|
|
@@ -4798,21 +4798,21 @@ function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
|
4798
4798
|
}, W = async () => {
|
|
4799
4799
|
if (r)
|
|
4800
4800
|
try {
|
|
4801
|
-
await
|
|
4801
|
+
await l.mutateAsync({ id: r }), re.success("Password reset email sent");
|
|
4802
4802
|
} catch (M) {
|
|
4803
4803
|
console.error("Failed to send password reset email", M), re.error("Failed to send password reset email");
|
|
4804
4804
|
}
|
|
4805
4805
|
}, Y = async () => {
|
|
4806
4806
|
if (r)
|
|
4807
4807
|
try {
|
|
4808
|
-
await
|
|
4808
|
+
await c.mutateAsync({ id: r }), re.success("Confirmation email sent");
|
|
4809
4809
|
} catch (M) {
|
|
4810
4810
|
console.error("Failed to send confirmation email", M), re.error("Failed to send confirmation email");
|
|
4811
4811
|
}
|
|
4812
4812
|
}, X = async () => {
|
|
4813
4813
|
if (r)
|
|
4814
4814
|
try {
|
|
4815
|
-
await
|
|
4815
|
+
await u.mutateAsync({
|
|
4816
4816
|
id: r,
|
|
4817
4817
|
disabled: !0
|
|
4818
4818
|
}), h(!0), re.success("User account disabled");
|
|
@@ -4837,7 +4837,7 @@ function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
|
4837
4837
|
disabled: A
|
|
4838
4838
|
}
|
|
4839
4839
|
),
|
|
4840
|
-
|
|
4840
|
+
R.email && /* @__PURE__ */ i.jsx("span", { className: "text-error text-sm mt-1", children: typeof R.email.message == "string" ? R.email.message : "Invalid email" })
|
|
4841
4841
|
] }),
|
|
4842
4842
|
/* @__PURE__ */ i.jsxs("label", { className: "form-control w-full", children: [
|
|
4843
4843
|
/* @__PURE__ */ i.jsx("span", { className: "label-text", children: "Name" }),
|
|
@@ -4850,7 +4850,7 @@ function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
|
4850
4850
|
disabled: A
|
|
4851
4851
|
}
|
|
4852
4852
|
),
|
|
4853
|
-
|
|
4853
|
+
R.name && /* @__PURE__ */ i.jsx("span", { className: "text-error text-sm mt-1", children: typeof R.name.message == "string" ? R.name.message : "Invalid name" })
|
|
4854
4854
|
] }),
|
|
4855
4855
|
S && /* @__PURE__ */ i.jsxs("label", { className: "form-control w-full", children: [
|
|
4856
4856
|
/* @__PURE__ */ i.jsx("span", { className: "label-text", children: "Temporary Password (optional)" }),
|
|
@@ -4863,7 +4863,7 @@ function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
|
4863
4863
|
disabled: A
|
|
4864
4864
|
}
|
|
4865
4865
|
),
|
|
4866
|
-
|
|
4866
|
+
R.password && /* @__PURE__ */ i.jsx("span", { className: "text-error text-sm mt-1", children: typeof R.password.message == "string" ? R.password.message : "Invalid password" })
|
|
4867
4867
|
] }),
|
|
4868
4868
|
/* @__PURE__ */ i.jsxs("label", { className: "label cursor-pointer justify-start gap-2", children: [
|
|
4869
4869
|
/* @__PURE__ */ i.jsx(
|
|
@@ -4934,14 +4934,14 @@ function Zn({ mode: t, selectedUser: e, onClose: s }) {
|
|
|
4934
4934
|
function qn() {
|
|
4935
4935
|
const [t, e] = ae(null), [s, r] = ae(null), n = () => {
|
|
4936
4936
|
e(null), r("create");
|
|
4937
|
-
}, a = (
|
|
4938
|
-
e(
|
|
4939
|
-
},
|
|
4937
|
+
}, a = (d) => {
|
|
4938
|
+
e(d), r("edit");
|
|
4939
|
+
}, o = () => {
|
|
4940
4940
|
e(null), r(null);
|
|
4941
4941
|
};
|
|
4942
4942
|
return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
4943
4943
|
/* @__PURE__ */ i.jsx(Un, { onCreateUser: n, onSelectUser: a }),
|
|
4944
|
-
/* @__PURE__ */ i.jsx(Zn, { mode: s, selectedUser: t, onClose:
|
|
4944
|
+
/* @__PURE__ */ i.jsx(Zn, { mode: s, selectedUser: t, onClose: o })
|
|
4945
4945
|
] });
|
|
4946
4946
|
}
|
|
4947
4947
|
const wt = Js(null);
|
|
@@ -4977,7 +4977,7 @@ function Bn() {
|
|
|
4977
4977
|
const t = le(), { user: e, isLoading: s } = t.useCurrentUser(), r = Be();
|
|
4978
4978
|
return s ? /* @__PURE__ */ i.jsx("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ i.jsx("span", { className: "loading loading-spinner loading-lg" }) }) : e ? e.is_admin ? /* @__PURE__ */ i.jsx(ts, {}) : /* @__PURE__ */ i.jsx(lt, { to: "/", replace: !0 }) : /* @__PURE__ */ i.jsx(lt, { to: "/login", state: { from: r } });
|
|
4979
4979
|
}
|
|
4980
|
-
const
|
|
4980
|
+
const Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4981
4981
|
__proto__: null,
|
|
4982
4982
|
Dashboard: gr,
|
|
4983
4983
|
FeatureFlags: vr,
|
|
@@ -4995,8 +4995,8 @@ function jt() {
|
|
|
4995
4995
|
return {
|
|
4996
4996
|
user: n.user ?? null,
|
|
4997
4997
|
isLoading: n.isLoading,
|
|
4998
|
-
signIn: async (a,
|
|
4999
|
-
signUp: async (a,
|
|
4998
|
+
signIn: async (a, o) => e.mutateAsync({ email: a, password: o }),
|
|
4999
|
+
signUp: async (a, o, d) => s.mutateAsync({ email: a, password: o, name: d ?? "" }),
|
|
5000
5000
|
signOut: async () => r.mutateAsync(),
|
|
5001
5001
|
completeOAuthLogin: async (a) => {
|
|
5002
5002
|
try {
|
|
@@ -5021,18 +5021,19 @@ function Qn({
|
|
|
5021
5021
|
return s ? /* @__PURE__ */ i.jsx("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ i.jsx("span", { className: "loading loading-spinner loading-lg" }) }) : e ? /* @__PURE__ */ i.jsx(i.Fragment, { children: t }) : /* @__PURE__ */ i.jsx(lt, { to: "/login", state: { from: r } });
|
|
5022
5022
|
}
|
|
5023
5023
|
function Wn() {
|
|
5024
|
-
const
|
|
5024
|
+
const t = Be(), e = new URLSearchParams(t.search), s = t.state?.email ?? e.get("email") ?? "";
|
|
5025
5025
|
return /* @__PURE__ */ i.jsxs(ye, { children: [
|
|
5026
5026
|
/* @__PURE__ */ i.jsxs("h2", { className: "card-title text-2xl mb-4", children: [
|
|
5027
5027
|
/* @__PURE__ */ i.jsx(Me, { icon: Xs }),
|
|
5028
5028
|
"Check Your Email"
|
|
5029
5029
|
] }),
|
|
5030
5030
|
/* @__PURE__ */ i.jsxs("div", { className: "mt-4 text-sm text-center", children: [
|
|
5031
|
-
/* @__PURE__ */ i.jsxs("p", { children: [
|
|
5032
|
-
"We've sent a confirmation link to
|
|
5033
|
-
|
|
5031
|
+
s ? /* @__PURE__ */ i.jsxs("p", { children: [
|
|
5032
|
+
"We've sent a confirmation link to",
|
|
5033
|
+
" ",
|
|
5034
|
+
/* @__PURE__ */ i.jsx("strong", { children: s }),
|
|
5034
5035
|
"."
|
|
5035
|
-
] }),
|
|
5036
|
+
] }) : /* @__PURE__ */ i.jsx("p", { children: "If your registration succeeded, we've sent a confirmation link to your email address." }),
|
|
5036
5037
|
/* @__PURE__ */ i.jsx("p", { className: "mt-2", children: "Click the link in the email to activate your account." })
|
|
5037
5038
|
] }),
|
|
5038
5039
|
/* @__PURE__ */ i.jsx("div", { className: "divider" }),
|
|
@@ -5040,8 +5041,8 @@ function Wn() {
|
|
|
5040
5041
|
/* @__PURE__ */ i.jsx(
|
|
5041
5042
|
he,
|
|
5042
5043
|
{
|
|
5043
|
-
to: "/resend-confirmation",
|
|
5044
|
-
state: { email:
|
|
5044
|
+
to: s ? `/resend-confirmation?email=${encodeURIComponent(s)}` : "/resend-confirmation",
|
|
5045
|
+
state: s ? { email: s } : null,
|
|
5045
5046
|
className: "btn join-item",
|
|
5046
5047
|
title: "Didn't receive the email?",
|
|
5047
5048
|
children: "Resend Confirmation"
|
|
@@ -5083,23 +5084,23 @@ function Yn() {
|
|
|
5083
5084
|
formState: { errors: r, isSubmitting: n }
|
|
5084
5085
|
} = Le({
|
|
5085
5086
|
defaultValues: { email: "", password: "" }
|
|
5086
|
-
}), a = Ie(),
|
|
5087
|
+
}), a = Ie(), o = Be(), { useLoginUser: d, useCurrentUser: l } = le(), { oauthEnabled: c, registrationEnabled: u, OAuthButton: f } = $s(), h = d(), { user: m } = l();
|
|
5087
5088
|
Se(() => {
|
|
5088
|
-
m && Us(a,
|
|
5089
|
-
}, [m, a,
|
|
5089
|
+
m && Us(a, o);
|
|
5090
|
+
}, [m, a, o]);
|
|
5090
5091
|
const g = async (b) => {
|
|
5091
5092
|
try {
|
|
5092
5093
|
await h.mutateAsync(b, s), a("/");
|
|
5093
5094
|
} catch (v) {
|
|
5094
|
-
const
|
|
5095
|
-
if (
|
|
5095
|
+
const R = v?.response?.status;
|
|
5096
|
+
if (R == 401)
|
|
5096
5097
|
s("root", {
|
|
5097
5098
|
type: "server",
|
|
5098
5099
|
message: "Invalid email or password"
|
|
5099
5100
|
});
|
|
5100
|
-
else if (
|
|
5101
|
-
const N = v?.response?.data,
|
|
5102
|
-
s("root", { type: "server", message:
|
|
5101
|
+
else if (R == 422) {
|
|
5102
|
+
const N = v?.response?.data, _ = N && (N.error || N.message) || "Too many login attempts. Please try again later.";
|
|
5103
|
+
s("root", { type: "server", message: _ });
|
|
5103
5104
|
} else {
|
|
5104
5105
|
const N = v?.response?.data ?? v;
|
|
5105
5106
|
rt(N, s, "Failed to sign in");
|
|
@@ -5156,7 +5157,7 @@ function Yn() {
|
|
|
5156
5157
|
)
|
|
5157
5158
|
] })
|
|
5158
5159
|
] }),
|
|
5159
|
-
|
|
5160
|
+
c && f && /* @__PURE__ */ i.jsx(f, { text: "Sign in with Google" }),
|
|
5160
5161
|
/* @__PURE__ */ i.jsx("div", { className: "divider" }),
|
|
5161
5162
|
/* @__PURE__ */ i.jsxs("div", { className: "join w-full justify-center", children: [
|
|
5162
5163
|
/* @__PURE__ */ i.jsx(he, { className: "btn join-item", to: "/", children: "Home" }),
|
|
@@ -5165,7 +5166,7 @@ function Yn() {
|
|
|
5165
5166
|
{
|
|
5166
5167
|
className: "btn join-item",
|
|
5167
5168
|
to: "/signup",
|
|
5168
|
-
hidden: !
|
|
5169
|
+
hidden: !u,
|
|
5169
5170
|
children: "Create Account"
|
|
5170
5171
|
}
|
|
5171
5172
|
),
|
|
@@ -5180,46 +5181,71 @@ function Gn() {
|
|
|
5180
5181
|
}, [t, s]), /* @__PURE__ */ i.jsx("div", { children: "Processing OAuth callback..." });
|
|
5181
5182
|
}
|
|
5182
5183
|
function Kn() {
|
|
5183
|
-
const
|
|
5184
|
-
|
|
5185
|
-
|
|
5184
|
+
const t = Be(), e = new URLSearchParams(t.search), s = t.state?.email ?? e.get("email") ?? void 0, {
|
|
5185
|
+
register: r,
|
|
5186
|
+
handleSubmit: n,
|
|
5187
|
+
setError: a,
|
|
5188
|
+
formState: { errors: o, isSubmitting: d }
|
|
5189
|
+
} = Le({
|
|
5190
|
+
defaultValues: { email: s ?? "" }
|
|
5191
|
+
}), { useResendConfirmationEmail: l } = le(), c = l(), u = Ie(), f = async (h) => {
|
|
5186
5192
|
try {
|
|
5187
|
-
await
|
|
5188
|
-
} catch {
|
|
5193
|
+
await c.mutateAsync(h, a), u(`/confirm-email?email=${encodeURIComponent(h.email)}`);
|
|
5194
|
+
} catch (m) {
|
|
5195
|
+
const g = m?.response?.data;
|
|
5196
|
+
a("root", {
|
|
5197
|
+
type: "server",
|
|
5198
|
+
message: g?.error ?? g?.message ?? "Failed to resend confirmation email"
|
|
5199
|
+
});
|
|
5189
5200
|
}
|
|
5190
5201
|
};
|
|
5191
5202
|
return /* @__PURE__ */ i.jsxs(ye, { children: [
|
|
5192
5203
|
/* @__PURE__ */ i.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Resend Confirmation" }),
|
|
5193
|
-
/* @__PURE__ */ i.jsxs("form", { onSubmit:
|
|
5204
|
+
/* @__PURE__ */ i.jsxs("form", { onSubmit: n(f), children: [
|
|
5205
|
+
o.root && /* @__PURE__ */ i.jsx("div", { role: "alert", className: "alert alert-warning alert-soft mb-4", children: /* @__PURE__ */ i.jsx("span", { children: o.root.message }) }),
|
|
5194
5206
|
/* @__PURE__ */ i.jsx("label", { className: "label", children: "Email" }),
|
|
5195
5207
|
/* @__PURE__ */ i.jsx(
|
|
5196
5208
|
"input",
|
|
5197
5209
|
{
|
|
5198
5210
|
type: "email",
|
|
5199
|
-
className:
|
|
5200
|
-
...
|
|
5211
|
+
className: `input input-bordered w-full ${o.email ? "input-error" : ""}`,
|
|
5212
|
+
...r("email", {
|
|
5213
|
+
required: "Email is required",
|
|
5214
|
+
pattern: {
|
|
5215
|
+
value: /^[^@\s]+@[^@\s]+\.[^@\s]+$/,
|
|
5216
|
+
message: "Invalid email address"
|
|
5217
|
+
}
|
|
5218
|
+
})
|
|
5201
5219
|
}
|
|
5202
5220
|
),
|
|
5203
|
-
/* @__PURE__ */ i.jsx("
|
|
5221
|
+
o.email && /* @__PURE__ */ i.jsx("span", { className: "text-error text-sm", children: o.email.message }),
|
|
5222
|
+
/* @__PURE__ */ i.jsx(
|
|
5223
|
+
"button",
|
|
5224
|
+
{
|
|
5225
|
+
className: "btn btn-primary mt-4",
|
|
5226
|
+
disabled: d || c.isPending,
|
|
5227
|
+
children: d || c.isPending ? "Sending..." : "Resend"
|
|
5228
|
+
}
|
|
5229
|
+
)
|
|
5204
5230
|
] })
|
|
5205
5231
|
] });
|
|
5206
5232
|
}
|
|
5207
5233
|
function Jn() {
|
|
5208
|
-
const { register: t, handleSubmit: e } = Le({ defaultValues: { token: "", password: "" } }), { useResetPassword: s } = le(), r = s(), n = Ie(), [a] = vt(),
|
|
5234
|
+
const { register: t, handleSubmit: e } = Le({ defaultValues: { token: "", password: "" } }), { useResetPassword: s } = le(), r = s(), n = Ie(), [a] = vt(), o = a.get("token") || void 0, d = async (l) => {
|
|
5209
5235
|
try {
|
|
5210
|
-
await r.mutateAsync(
|
|
5236
|
+
await r.mutateAsync(l), n("/");
|
|
5211
5237
|
} catch {
|
|
5212
5238
|
}
|
|
5213
5239
|
};
|
|
5214
5240
|
return /* @__PURE__ */ i.jsxs(ye, { children: [
|
|
5215
5241
|
/* @__PURE__ */ i.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Reset Password" }),
|
|
5216
|
-
/* @__PURE__ */ i.jsxs("form", { onSubmit: e(
|
|
5242
|
+
/* @__PURE__ */ i.jsxs("form", { onSubmit: e(d), children: [
|
|
5217
5243
|
/* @__PURE__ */ i.jsx(
|
|
5218
5244
|
"input",
|
|
5219
5245
|
{
|
|
5220
5246
|
type: "hidden",
|
|
5221
5247
|
...t("token"),
|
|
5222
|
-
defaultValue:
|
|
5248
|
+
defaultValue: o
|
|
5223
5249
|
}
|
|
5224
5250
|
),
|
|
5225
5251
|
/* @__PURE__ */ i.jsx("label", { className: "label", children: "New password" }),
|
|
@@ -5262,17 +5288,24 @@ function ea({
|
|
|
5262
5288
|
}
|
|
5263
5289
|
);
|
|
5264
5290
|
}
|
|
5265
|
-
function ta(
|
|
5291
|
+
function ta(t) {
|
|
5292
|
+
return t?.response?.status ?? null;
|
|
5293
|
+
}
|
|
5294
|
+
function sa(t) {
|
|
5295
|
+
const e = t?.response?.data;
|
|
5296
|
+
return e?.error ?? e?.message ?? null;
|
|
5297
|
+
}
|
|
5298
|
+
function ra({ redirectUrl: t = "" }) {
|
|
5266
5299
|
const {
|
|
5267
5300
|
register: e,
|
|
5268
5301
|
handleSubmit: s,
|
|
5269
5302
|
setError: r,
|
|
5270
5303
|
watch: n,
|
|
5271
|
-
formState: { errors: a, isSubmitting:
|
|
5304
|
+
formState: { errors: a, isSubmitting: o }
|
|
5272
5305
|
} = Le({
|
|
5273
5306
|
defaultValues: { name: "", email: "", password: "", confirmPassword: "" }
|
|
5274
|
-
}),
|
|
5275
|
-
if (m(null), !
|
|
5307
|
+
}), d = Ie(), l = ct(ns), c = ct(as), { useRegisterUser: u } = le(), f = u(), [h, m] = ae(null), g = async (b) => {
|
|
5308
|
+
if (m(null), !l) {
|
|
5276
5309
|
m("Registrations are temporarily disabled");
|
|
5277
5310
|
return;
|
|
5278
5311
|
}
|
|
@@ -5284,9 +5317,19 @@ function ta({ redirectUrl: t = "" }) {
|
|
|
5284
5317
|
return;
|
|
5285
5318
|
}
|
|
5286
5319
|
try {
|
|
5287
|
-
await f.mutateAsync(b, r),
|
|
5320
|
+
await f.mutateAsync(b, r), d(`/confirm-email?email=${encodeURIComponent(b.email)}`);
|
|
5288
5321
|
} catch (v) {
|
|
5289
|
-
|
|
5322
|
+
const R = ta(v), N = sa(v), _ = N?.toLowerCase() ?? "";
|
|
5323
|
+
if (R === 409 || _.includes("already") || _.includes("in use")) {
|
|
5324
|
+
r("email", {
|
|
5325
|
+
type: "server",
|
|
5326
|
+
message: "An account with this email already exists."
|
|
5327
|
+
}), m(
|
|
5328
|
+
"An account with this email already exists. Sign in instead or reset your password."
|
|
5329
|
+
);
|
|
5330
|
+
return;
|
|
5331
|
+
}
|
|
5332
|
+
rt(v, r, "Failed to register account", !1), m(N ?? "Failed to register account");
|
|
5290
5333
|
}
|
|
5291
5334
|
};
|
|
5292
5335
|
return /* @__PURE__ */ i.jsxs(ye, { children: [
|
|
@@ -5371,12 +5414,12 @@ function ta({ redirectUrl: t = "" }) {
|
|
|
5371
5414
|
{
|
|
5372
5415
|
type: "submit",
|
|
5373
5416
|
className: "btn btn-primary w-full mt-4",
|
|
5374
|
-
disabled:
|
|
5375
|
-
children:
|
|
5417
|
+
disabled: o || !l,
|
|
5418
|
+
children: o ? "Creating Account…" : "Sign Up"
|
|
5376
5419
|
}
|
|
5377
5420
|
)
|
|
5378
5421
|
] }) }),
|
|
5379
|
-
|
|
5422
|
+
c && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
5380
5423
|
/* @__PURE__ */ i.jsx("div", { className: "divider", children: "OR" }),
|
|
5381
5424
|
/* @__PURE__ */ i.jsx(
|
|
5382
5425
|
ea,
|
|
@@ -5386,7 +5429,7 @@ function ta({ redirectUrl: t = "" }) {
|
|
|
5386
5429
|
}
|
|
5387
5430
|
)
|
|
5388
5431
|
] }),
|
|
5389
|
-
!
|
|
5432
|
+
!l && /* @__PURE__ */ i.jsx("div", { className: "mt-4 text-center text-sm text-neutral-content-500", children: "Registrations are currently disabled. If you need an account, please contact an administrator." }),
|
|
5390
5433
|
/* @__PURE__ */ i.jsx("div", { className: "divider" }),
|
|
5391
5434
|
/* @__PURE__ */ i.jsxs("div", { className: "join w-full justify-center", children: [
|
|
5392
5435
|
/* @__PURE__ */ i.jsx(he, { className: "btn join-item", to: "/", children: "Home" }),
|
|
@@ -5395,25 +5438,25 @@ function ta({ redirectUrl: t = "" }) {
|
|
|
5395
5438
|
] })
|
|
5396
5439
|
] });
|
|
5397
5440
|
}
|
|
5398
|
-
function
|
|
5399
|
-
const t = Ie(), [e] = vt(), [s, r] = ae(!1), [n, a] = ae(null), [
|
|
5400
|
-
if (!
|
|
5441
|
+
function na() {
|
|
5442
|
+
const t = Ie(), [e] = vt(), [s, r] = ae(!1), [n, a] = ae(null), [o, d] = ae(!1), { useVerifyEmail: l } = le(), c = l(), u = e.get("token"), f = async () => {
|
|
5443
|
+
if (!u) {
|
|
5401
5444
|
a("No token provided.");
|
|
5402
5445
|
return;
|
|
5403
5446
|
}
|
|
5404
5447
|
r(!0);
|
|
5405
5448
|
try {
|
|
5406
|
-
await
|
|
5449
|
+
await c.mutateAsync(u), re.success("Email verified! You can now log in."), t("/login");
|
|
5407
5450
|
} catch (h) {
|
|
5408
5451
|
const m = h?.response?.data, g = m?.error || m?.message || h?.message || "Verification failed.", b = String(g).toLowerCase();
|
|
5409
|
-
(b.includes("invalid") || b.includes("expired")) &&
|
|
5452
|
+
(b.includes("invalid") || b.includes("expired")) && d(!0), a(String(g));
|
|
5410
5453
|
} finally {
|
|
5411
5454
|
r(!1);
|
|
5412
5455
|
}
|
|
5413
5456
|
};
|
|
5414
5457
|
return Se(() => {
|
|
5415
|
-
|
|
5416
|
-
}, [
|
|
5458
|
+
u && f();
|
|
5459
|
+
}, [u]), /* @__PURE__ */ i.jsxs(ye, { children: [
|
|
5417
5460
|
/* @__PURE__ */ i.jsx("h2", { className: "text-2xl font-bold mb-4", children: "Verify Email" }),
|
|
5418
5461
|
/* @__PURE__ */ i.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
5419
5462
|
/* @__PURE__ */ i.jsx(
|
|
@@ -5421,12 +5464,12 @@ function sa() {
|
|
|
5421
5464
|
{
|
|
5422
5465
|
className: "btn btn-primary",
|
|
5423
5466
|
onClick: f,
|
|
5424
|
-
disabled: s ||
|
|
5467
|
+
disabled: s || o,
|
|
5425
5468
|
children: s ? "Verifying…" : "Verify"
|
|
5426
5469
|
}
|
|
5427
5470
|
),
|
|
5428
5471
|
n && /* @__PURE__ */ i.jsx("div", { className: "text-sm text-center text-error mt-2", children: n }),
|
|
5429
|
-
|
|
5472
|
+
o && /* @__PURE__ */ i.jsxs("div", { className: "mt-2 flex flex-col items-center gap-2", children: [
|
|
5430
5473
|
/* @__PURE__ */ i.jsx("p", { className: "text-sm mb-2", children: "Token is invalid or expired. Request a new confirmation email." }),
|
|
5431
5474
|
/* @__PURE__ */ i.jsx(
|
|
5432
5475
|
"button",
|
|
@@ -5440,7 +5483,7 @@ function sa() {
|
|
|
5440
5483
|
] })
|
|
5441
5484
|
] });
|
|
5442
5485
|
}
|
|
5443
|
-
const
|
|
5486
|
+
const Ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5444
5487
|
__proto__: null,
|
|
5445
5488
|
AuthLayout: ye,
|
|
5446
5489
|
AuthProvider: Vn,
|
|
@@ -5451,15 +5494,15 @@ const Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5451
5494
|
ProtectedRoute: Qn,
|
|
5452
5495
|
ResendConfirmation: Kn,
|
|
5453
5496
|
Reset: Jn,
|
|
5454
|
-
SignUp:
|
|
5455
|
-
Verify:
|
|
5497
|
+
SignUp: ra,
|
|
5498
|
+
Verify: na,
|
|
5456
5499
|
handleFormError: rt,
|
|
5457
5500
|
redirectToOrigin: Us,
|
|
5458
5501
|
useAuth: jt,
|
|
5459
5502
|
useAuthApi: le,
|
|
5460
5503
|
useAuthConfig: $s
|
|
5461
5504
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5462
|
-
function
|
|
5505
|
+
function La({
|
|
5463
5506
|
label: t,
|
|
5464
5507
|
field: e,
|
|
5465
5508
|
params: s,
|
|
@@ -5467,9 +5510,9 @@ function Ia({
|
|
|
5467
5510
|
setFilters: n,
|
|
5468
5511
|
className: a = ""
|
|
5469
5512
|
}) {
|
|
5470
|
-
const
|
|
5513
|
+
const o = s.sort_by, d = s.sort_order, l = o === e, c = l ? d === "asc" ? rr : nr : sr, u = () => {
|
|
5471
5514
|
let f = "asc";
|
|
5472
|
-
|
|
5515
|
+
l && d === "asc" && (f = "desc"), n ? n({
|
|
5473
5516
|
sort_by: e,
|
|
5474
5517
|
sort_order: f
|
|
5475
5518
|
}) : (r("sort_by", e), r("sort_order", f));
|
|
@@ -5478,21 +5521,21 @@ function Ia({
|
|
|
5478
5521
|
"div",
|
|
5479
5522
|
{
|
|
5480
5523
|
className: `cursor-pointer hover:bg-base-200 transition-colors flex items-center gap-2 select-none ${a}`,
|
|
5481
|
-
onClick:
|
|
5524
|
+
onClick: u,
|
|
5482
5525
|
children: [
|
|
5483
5526
|
t,
|
|
5484
5527
|
/* @__PURE__ */ i.jsx(
|
|
5485
5528
|
Me,
|
|
5486
5529
|
{
|
|
5487
|
-
icon:
|
|
5488
|
-
className:
|
|
5530
|
+
icon: c,
|
|
5531
|
+
className: l ? "text-primary" : "text-base-content/30"
|
|
5489
5532
|
}
|
|
5490
5533
|
)
|
|
5491
5534
|
]
|
|
5492
5535
|
}
|
|
5493
5536
|
);
|
|
5494
5537
|
}
|
|
5495
|
-
const
|
|
5538
|
+
const aa = {
|
|
5496
5539
|
tasks: (t) => {
|
|
5497
5540
|
if (!t.tasks)
|
|
5498
5541
|
throw new Error(
|
|
@@ -5515,12 +5558,12 @@ const ra = {
|
|
|
5515
5558
|
Rs(t.users);
|
|
5516
5559
|
}
|
|
5517
5560
|
};
|
|
5518
|
-
function
|
|
5561
|
+
function ia(t) {
|
|
5519
5562
|
const e = Array.from(new Set(t.features));
|
|
5520
5563
|
for (const s of e)
|
|
5521
|
-
|
|
5564
|
+
aa[s](t.adapters);
|
|
5522
5565
|
}
|
|
5523
|
-
function
|
|
5566
|
+
function oa(t) {
|
|
5524
5567
|
const e = {
|
|
5525
5568
|
listPath: t.featureFlags?.listPath ?? "/feature-flags",
|
|
5526
5569
|
adminListPath: t.featureFlags?.adminListPath ?? "/admin/feature-flags",
|
|
@@ -5565,7 +5608,7 @@ function aa(t) {
|
|
|
5565
5608
|
}
|
|
5566
5609
|
};
|
|
5567
5610
|
}
|
|
5568
|
-
function
|
|
5611
|
+
function la(t) {
|
|
5569
5612
|
const e = {
|
|
5570
5613
|
listPath: t.tasks?.listPath ?? "/admin/tasks",
|
|
5571
5614
|
detailPath: t.tasks?.detailPath ?? "/admin/tasks/{id}"
|
|
@@ -5611,7 +5654,7 @@ function ia(t) {
|
|
|
5611
5654
|
}
|
|
5612
5655
|
};
|
|
5613
5656
|
}
|
|
5614
|
-
function
|
|
5657
|
+
function ca(t) {
|
|
5615
5658
|
const e = {
|
|
5616
5659
|
listPath: t.users?.listPath ?? "/admin/users",
|
|
5617
5660
|
detailPath: t.users?.detailPath ?? "/admin/users/{id}",
|
|
@@ -5681,7 +5724,7 @@ function oa(t) {
|
|
|
5681
5724
|
);
|
|
5682
5725
|
return {
|
|
5683
5726
|
mutateAsync: async ({ id: n, data: a }) => {
|
|
5684
|
-
const
|
|
5727
|
+
const o = await r.mutateAsync({
|
|
5685
5728
|
params: { path: { id: Number(n) } },
|
|
5686
5729
|
body: a
|
|
5687
5730
|
});
|
|
@@ -5689,7 +5732,7 @@ function oa(t) {
|
|
|
5689
5732
|
queryKey: ["get", e.listPath]
|
|
5690
5733
|
}), s.invalidateQueries({
|
|
5691
5734
|
queryKey: ["get", e.detailPath]
|
|
5692
|
-
}),
|
|
5735
|
+
}), o;
|
|
5693
5736
|
},
|
|
5694
5737
|
isPending: r.isPending
|
|
5695
5738
|
};
|
|
@@ -5734,18 +5777,18 @@ function oa(t) {
|
|
|
5734
5777
|
}
|
|
5735
5778
|
function Ds(t) {
|
|
5736
5779
|
const e = {
|
|
5737
|
-
featureFlags:
|
|
5738
|
-
tasks:
|
|
5780
|
+
featureFlags: oa(t),
|
|
5781
|
+
tasks: la(t)
|
|
5739
5782
|
};
|
|
5740
|
-
return t.users && (e.users =
|
|
5783
|
+
return t.users && (e.users = ca(t)), e;
|
|
5741
5784
|
}
|
|
5742
5785
|
function Ne(t, e, s) {
|
|
5743
5786
|
if (!e) return;
|
|
5744
5787
|
const r = t?.response?.data;
|
|
5745
5788
|
if (r?.errors && typeof r.errors == "object") {
|
|
5746
5789
|
Object.entries(r.errors).forEach(([n, a]) => {
|
|
5747
|
-
const
|
|
5748
|
-
e(n, { type: "server", message:
|
|
5790
|
+
const o = Array.isArray(a) ? String(a[0] ?? s) : s;
|
|
5791
|
+
e(n, { type: "server", message: o });
|
|
5749
5792
|
});
|
|
5750
5793
|
return;
|
|
5751
5794
|
}
|
|
@@ -5776,16 +5819,16 @@ function zs(t) {
|
|
|
5776
5819
|
e.loginPath
|
|
5777
5820
|
);
|
|
5778
5821
|
return {
|
|
5779
|
-
mutateAsync: async (
|
|
5822
|
+
mutateAsync: async (o, d) => {
|
|
5780
5823
|
try {
|
|
5781
|
-
await a.mutateAsync({ body:
|
|
5824
|
+
await a.mutateAsync({ body: o }), await Promise.all([
|
|
5782
5825
|
n.invalidateQueries({ queryKey: s }),
|
|
5783
5826
|
n.invalidateQueries({ queryKey: r }),
|
|
5784
5827
|
n.refetchQueries({ queryKey: s }),
|
|
5785
5828
|
n.refetchQueries({ queryKey: r })
|
|
5786
5829
|
]);
|
|
5787
|
-
} catch (
|
|
5788
|
-
throw Ne(
|
|
5830
|
+
} catch (l) {
|
|
5831
|
+
throw Ne(l, d, "Login failed"), l;
|
|
5789
5832
|
}
|
|
5790
5833
|
},
|
|
5791
5834
|
isPending: a.isPending
|
|
@@ -5797,11 +5840,11 @@ function zs(t) {
|
|
|
5797
5840
|
e.registerPath
|
|
5798
5841
|
);
|
|
5799
5842
|
return {
|
|
5800
|
-
mutateAsync: async (a,
|
|
5843
|
+
mutateAsync: async (a, o) => {
|
|
5801
5844
|
try {
|
|
5802
5845
|
await n.mutateAsync({ body: a });
|
|
5803
|
-
} catch (
|
|
5804
|
-
throw Ne(
|
|
5846
|
+
} catch (d) {
|
|
5847
|
+
throw Ne(d, o, "Registration failed"), d;
|
|
5805
5848
|
}
|
|
5806
5849
|
},
|
|
5807
5850
|
isPending: n.isPending
|
|
@@ -5813,11 +5856,11 @@ function zs(t) {
|
|
|
5813
5856
|
e.forgotPath
|
|
5814
5857
|
);
|
|
5815
5858
|
return {
|
|
5816
|
-
mutateAsync: async (a,
|
|
5859
|
+
mutateAsync: async (a, o) => {
|
|
5817
5860
|
try {
|
|
5818
5861
|
await n.mutateAsync({ body: { email: a } });
|
|
5819
|
-
} catch (
|
|
5820
|
-
throw Ne(
|
|
5862
|
+
} catch (d) {
|
|
5863
|
+
throw Ne(d, o, "Failed to send reset email"), d;
|
|
5821
5864
|
}
|
|
5822
5865
|
},
|
|
5823
5866
|
isPending: n.isPending
|
|
@@ -5829,11 +5872,11 @@ function zs(t) {
|
|
|
5829
5872
|
e.resetPath
|
|
5830
5873
|
);
|
|
5831
5874
|
return {
|
|
5832
|
-
mutateAsync: async (a,
|
|
5875
|
+
mutateAsync: async (a, o) => {
|
|
5833
5876
|
try {
|
|
5834
5877
|
await n.mutateAsync({ body: a });
|
|
5835
|
-
} catch (
|
|
5836
|
-
throw Ne(
|
|
5878
|
+
} catch (d) {
|
|
5879
|
+
throw Ne(d, o, "Reset failed"), d;
|
|
5837
5880
|
}
|
|
5838
5881
|
},
|
|
5839
5882
|
isPending: n.isPending
|
|
@@ -5845,11 +5888,11 @@ function zs(t) {
|
|
|
5845
5888
|
e.verifyPath
|
|
5846
5889
|
);
|
|
5847
5890
|
return {
|
|
5848
|
-
mutateAsync: async (a,
|
|
5891
|
+
mutateAsync: async (a, o) => {
|
|
5849
5892
|
try {
|
|
5850
5893
|
await n.mutateAsync({ params: { path: { token: a } } });
|
|
5851
|
-
} catch (
|
|
5852
|
-
throw Ne(
|
|
5894
|
+
} catch (d) {
|
|
5895
|
+
throw Ne(d, o, "Verification failed"), d;
|
|
5853
5896
|
}
|
|
5854
5897
|
},
|
|
5855
5898
|
isPending: n.isPending
|
|
@@ -5861,11 +5904,11 @@ function zs(t) {
|
|
|
5861
5904
|
e.resendConfirmationPath
|
|
5862
5905
|
);
|
|
5863
5906
|
return {
|
|
5864
|
-
mutateAsync: async (a,
|
|
5907
|
+
mutateAsync: async (a, o) => {
|
|
5865
5908
|
try {
|
|
5866
5909
|
await n.mutateAsync({ body: a });
|
|
5867
|
-
} catch (
|
|
5868
|
-
throw Ne(
|
|
5910
|
+
} catch (d) {
|
|
5911
|
+
throw Ne(d, o, "Resend failed"), d;
|
|
5869
5912
|
}
|
|
5870
5913
|
},
|
|
5871
5914
|
isPending: n.isPending
|
|
@@ -5878,9 +5921,9 @@ function zs(t) {
|
|
|
5878
5921
|
{
|
|
5879
5922
|
options: { enabled: !0, retry: !1 }
|
|
5880
5923
|
}
|
|
5881
|
-
), a = n.isLoading && !n.isError,
|
|
5924
|
+
), a = n.isLoading && !n.isError, o = n.error?.response?.status, d = n.isError && o === 401 ? null : n.data ?? null;
|
|
5882
5925
|
return {
|
|
5883
|
-
user: t.mapCurrentUser ? t.mapCurrentUser(
|
|
5926
|
+
user: t.mapCurrentUser ? t.mapCurrentUser(d) : d,
|
|
5884
5927
|
isLoading: a,
|
|
5885
5928
|
isError: n.isError
|
|
5886
5929
|
};
|
|
@@ -5911,12 +5954,12 @@ function zs(t) {
|
|
|
5911
5954
|
}
|
|
5912
5955
|
};
|
|
5913
5956
|
}
|
|
5914
|
-
const
|
|
5957
|
+
const Fa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5915
5958
|
__proto__: null,
|
|
5916
5959
|
createKaleidoOpenApiAdapters: Ds,
|
|
5917
5960
|
createKaleidoOpenApiAuthClient: zs
|
|
5918
5961
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5919
|
-
function
|
|
5962
|
+
function da(t) {
|
|
5920
5963
|
return t ? {
|
|
5921
5964
|
id: t.id ?? t.pid,
|
|
5922
5965
|
email: t.email,
|
|
@@ -5925,7 +5968,7 @@ function la(t) {
|
|
|
5925
5968
|
is_admin: t.is_admin
|
|
5926
5969
|
} : null;
|
|
5927
5970
|
}
|
|
5928
|
-
class
|
|
5971
|
+
class ua {
|
|
5929
5972
|
authClient = null;
|
|
5930
5973
|
configure(e) {
|
|
5931
5974
|
const s = [];
|
|
@@ -5936,13 +5979,13 @@ class ca {
|
|
|
5936
5979
|
toast: e.toast,
|
|
5937
5980
|
users: e.adminUsers ? {} : void 0
|
|
5938
5981
|
});
|
|
5939
|
-
s.length > 0 &&
|
|
5982
|
+
s.length > 0 && ia({
|
|
5940
5983
|
features: s,
|
|
5941
5984
|
adapters: r
|
|
5942
5985
|
}), this.authClient = e.auth ? zs({
|
|
5943
5986
|
api: e.api,
|
|
5944
5987
|
useQueryClient: e.useQueryClient,
|
|
5945
|
-
mapCurrentUser: e.mapCurrentUser ??
|
|
5988
|
+
mapCurrentUser: e.mapCurrentUser ?? da
|
|
5946
5989
|
}) : null;
|
|
5947
5990
|
}
|
|
5948
5991
|
createAuthApiClient() {
|
|
@@ -5956,34 +5999,34 @@ class ca {
|
|
|
5956
5999
|
return jt();
|
|
5957
6000
|
}
|
|
5958
6001
|
}
|
|
5959
|
-
const
|
|
5960
|
-
function
|
|
6002
|
+
const $a = new ua(), fa = /\{[^{}]+\}/g, ha = () => typeof process == "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici;
|
|
6003
|
+
function ma() {
|
|
5961
6004
|
return Math.random().toString(36).slice(2, 11);
|
|
5962
6005
|
}
|
|
5963
|
-
function
|
|
6006
|
+
function pa(t) {
|
|
5964
6007
|
let {
|
|
5965
6008
|
baseUrl: e = "",
|
|
5966
6009
|
Request: s = globalThis.Request,
|
|
5967
6010
|
fetch: r = globalThis.fetch,
|
|
5968
6011
|
querySerializer: n,
|
|
5969
6012
|
bodySerializer: a,
|
|
5970
|
-
pathSerializer:
|
|
5971
|
-
headers:
|
|
5972
|
-
requestInitExt:
|
|
5973
|
-
...
|
|
6013
|
+
pathSerializer: o,
|
|
6014
|
+
headers: d,
|
|
6015
|
+
requestInitExt: l = void 0,
|
|
6016
|
+
...c
|
|
5974
6017
|
} = { ...t };
|
|
5975
|
-
|
|
5976
|
-
const
|
|
6018
|
+
l = ha() ? l : void 0, e = Jt(e);
|
|
6019
|
+
const u = [];
|
|
5977
6020
|
async function f(h, m) {
|
|
5978
6021
|
const {
|
|
5979
6022
|
baseUrl: g,
|
|
5980
6023
|
fetch: b = r,
|
|
5981
6024
|
Request: v = s,
|
|
5982
|
-
headers:
|
|
6025
|
+
headers: R,
|
|
5983
6026
|
params: N = {},
|
|
5984
|
-
parseAs:
|
|
6027
|
+
parseAs: _ = "json",
|
|
5985
6028
|
querySerializer: S,
|
|
5986
|
-
bodySerializer: U = a ??
|
|
6029
|
+
bodySerializer: U = a ?? ya,
|
|
5987
6030
|
pathSerializer: A,
|
|
5988
6031
|
body: V,
|
|
5989
6032
|
middleware: W = [],
|
|
@@ -5996,59 +6039,59 @@ function ha(t) {
|
|
|
5996
6039
|
...typeof n == "object" ? n : {},
|
|
5997
6040
|
...S
|
|
5998
6041
|
}));
|
|
5999
|
-
const L = A ||
|
|
6042
|
+
const L = A || o || ga, H = V === void 0 ? void 0 : U(
|
|
6000
6043
|
V,
|
|
6001
6044
|
// Note: we declare mergeHeaders() both here and below because it’s a bit of a chicken-or-egg situation:
|
|
6002
6045
|
// bodySerializer() needs all headers so we aren’t dropping ones set by the user, however,
|
|
6003
6046
|
// the result of this ALSO sets the lowest-priority content-type header. So we re-merge below,
|
|
6004
6047
|
// setting the content-type at the very beginning to be overwritten.
|
|
6005
6048
|
// Lastly, based on the way headers work, it’s not a simple “present-or-not” check becauase null intentionally un-sets headers.
|
|
6006
|
-
Kt(
|
|
6049
|
+
Kt(d, R, N.header)
|
|
6007
6050
|
), G = Kt(
|
|
6008
6051
|
// with no body, we should not to set Content-Type
|
|
6009
6052
|
H === void 0 || // if serialized body is FormData; browser will correctly set Content-Type & boundary expression
|
|
6010
6053
|
H instanceof FormData ? {} : {
|
|
6011
6054
|
"Content-Type": "application/json"
|
|
6012
6055
|
},
|
|
6013
|
-
|
|
6014
|
-
|
|
6056
|
+
d,
|
|
6057
|
+
R,
|
|
6015
6058
|
N.header
|
|
6016
|
-
), D = [...
|
|
6059
|
+
), D = [...u, ...W], ve = {
|
|
6017
6060
|
redirect: "follow",
|
|
6018
|
-
...
|
|
6061
|
+
...c,
|
|
6019
6062
|
...Y,
|
|
6020
6063
|
body: H,
|
|
6021
6064
|
headers: G
|
|
6022
6065
|
};
|
|
6023
6066
|
let ee, ie, J = new v(
|
|
6024
|
-
|
|
6067
|
+
va(h, { baseUrl: X, params: N, querySerializer: M, pathSerializer: L }),
|
|
6025
6068
|
ve
|
|
6026
6069
|
), z;
|
|
6027
|
-
for (const
|
|
6028
|
-
|
|
6070
|
+
for (const T in Y)
|
|
6071
|
+
T in J || (J[T] = Y[T]);
|
|
6029
6072
|
if (D.length) {
|
|
6030
|
-
ee =
|
|
6073
|
+
ee = ma(), ie = Object.freeze({
|
|
6031
6074
|
baseUrl: X,
|
|
6032
6075
|
fetch: b,
|
|
6033
|
-
parseAs:
|
|
6076
|
+
parseAs: _,
|
|
6034
6077
|
querySerializer: M,
|
|
6035
6078
|
bodySerializer: U,
|
|
6036
6079
|
pathSerializer: L
|
|
6037
6080
|
});
|
|
6038
|
-
for (const
|
|
6039
|
-
if (
|
|
6040
|
-
const
|
|
6081
|
+
for (const T of D)
|
|
6082
|
+
if (T && typeof T == "object" && typeof T.onRequest == "function") {
|
|
6083
|
+
const P = await T.onRequest({
|
|
6041
6084
|
request: J,
|
|
6042
6085
|
schemaPath: h,
|
|
6043
6086
|
params: N,
|
|
6044
6087
|
options: ie,
|
|
6045
6088
|
id: ee
|
|
6046
6089
|
});
|
|
6047
|
-
if (
|
|
6048
|
-
if (
|
|
6049
|
-
J =
|
|
6050
|
-
else if (
|
|
6051
|
-
z =
|
|
6090
|
+
if (P)
|
|
6091
|
+
if (P instanceof v)
|
|
6092
|
+
J = P;
|
|
6093
|
+
else if (P instanceof Response) {
|
|
6094
|
+
z = P;
|
|
6052
6095
|
break;
|
|
6053
6096
|
} else
|
|
6054
6097
|
throw new Error("onRequest: must return new Request() or Response() when modifying the request");
|
|
@@ -6056,16 +6099,16 @@ function ha(t) {
|
|
|
6056
6099
|
}
|
|
6057
6100
|
if (!z) {
|
|
6058
6101
|
try {
|
|
6059
|
-
z = await b(J,
|
|
6060
|
-
} catch (
|
|
6061
|
-
let
|
|
6102
|
+
z = await b(J, l);
|
|
6103
|
+
} catch (T) {
|
|
6104
|
+
let P = T;
|
|
6062
6105
|
if (D.length)
|
|
6063
6106
|
for (let se = D.length - 1; se >= 0; se--) {
|
|
6064
|
-
const
|
|
6065
|
-
if (
|
|
6066
|
-
const Z = await
|
|
6107
|
+
const ue = D[se];
|
|
6108
|
+
if (ue && typeof ue == "object" && typeof ue.onError == "function") {
|
|
6109
|
+
const Z = await ue.onError({
|
|
6067
6110
|
request: J,
|
|
6068
|
-
error:
|
|
6111
|
+
error: P,
|
|
6069
6112
|
schemaPath: h,
|
|
6070
6113
|
params: N,
|
|
6071
6114
|
options: ie,
|
|
@@ -6073,25 +6116,25 @@ function ha(t) {
|
|
|
6073
6116
|
});
|
|
6074
6117
|
if (Z) {
|
|
6075
6118
|
if (Z instanceof Response) {
|
|
6076
|
-
|
|
6119
|
+
P = void 0, z = Z;
|
|
6077
6120
|
break;
|
|
6078
6121
|
}
|
|
6079
6122
|
if (Z instanceof Error) {
|
|
6080
|
-
|
|
6123
|
+
P = Z;
|
|
6081
6124
|
continue;
|
|
6082
6125
|
}
|
|
6083
6126
|
throw new Error("onError: must return new Response() or instance of Error");
|
|
6084
6127
|
}
|
|
6085
6128
|
}
|
|
6086
6129
|
}
|
|
6087
|
-
if (
|
|
6088
|
-
throw
|
|
6130
|
+
if (P)
|
|
6131
|
+
throw P;
|
|
6089
6132
|
}
|
|
6090
6133
|
if (D.length)
|
|
6091
|
-
for (let
|
|
6092
|
-
const
|
|
6093
|
-
if (
|
|
6094
|
-
const se = await
|
|
6134
|
+
for (let T = D.length - 1; T >= 0; T--) {
|
|
6135
|
+
const P = D[T];
|
|
6136
|
+
if (P && typeof P == "object" && typeof P.onResponse == "function") {
|
|
6137
|
+
const se = await P.onResponse({
|
|
6095
6138
|
request: J,
|
|
6096
6139
|
response: z,
|
|
6097
6140
|
schemaPath: h,
|
|
@@ -6112,13 +6155,13 @@ function ha(t) {
|
|
|
6112
6155
|
return z.ok ? { data: void 0, response: z } : { error: void 0, response: z };
|
|
6113
6156
|
if (z.ok)
|
|
6114
6157
|
return { data: await (async () => {
|
|
6115
|
-
if (
|
|
6158
|
+
if (_ === "stream")
|
|
6116
6159
|
return z.body;
|
|
6117
|
-
if (
|
|
6118
|
-
const
|
|
6119
|
-
return
|
|
6160
|
+
if (_ === "json" && !p) {
|
|
6161
|
+
const P = await z.text();
|
|
6162
|
+
return P ? JSON.parse(P) : void 0;
|
|
6120
6163
|
}
|
|
6121
|
-
return await z[
|
|
6164
|
+
return await z[_]();
|
|
6122
6165
|
})(), response: z };
|
|
6123
6166
|
let k = await z.text();
|
|
6124
6167
|
try {
|
|
@@ -6169,14 +6212,14 @@ function ha(t) {
|
|
|
6169
6212
|
if (m) {
|
|
6170
6213
|
if (typeof m != "object" || !("onRequest" in m || "onResponse" in m || "onError" in m))
|
|
6171
6214
|
throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");
|
|
6172
|
-
|
|
6215
|
+
u.push(m);
|
|
6173
6216
|
}
|
|
6174
6217
|
},
|
|
6175
6218
|
/** Unregister middleware */
|
|
6176
6219
|
eject(...h) {
|
|
6177
6220
|
for (const m of h) {
|
|
6178
|
-
const g =
|
|
6179
|
-
g !== -1 &&
|
|
6221
|
+
const g = u.indexOf(m);
|
|
6222
|
+
g !== -1 && u.splice(g, 1);
|
|
6180
6223
|
}
|
|
6181
6224
|
}
|
|
6182
6225
|
};
|
|
@@ -6199,23 +6242,23 @@ function Zs(t, e, s) {
|
|
|
6199
6242
|
matrix: ";"
|
|
6200
6243
|
}[s.style] || "&";
|
|
6201
6244
|
if (s.style !== "deepObject" && s.explode === !1) {
|
|
6202
|
-
for (const
|
|
6203
|
-
r.push(
|
|
6204
|
-
const
|
|
6245
|
+
for (const d in e)
|
|
6246
|
+
r.push(d, s.allowReserved === !0 ? e[d] : encodeURIComponent(e[d]));
|
|
6247
|
+
const o = r.join(",");
|
|
6205
6248
|
switch (s.style) {
|
|
6206
6249
|
case "form":
|
|
6207
|
-
return `${t}=${
|
|
6250
|
+
return `${t}=${o}`;
|
|
6208
6251
|
case "label":
|
|
6209
|
-
return `.${
|
|
6252
|
+
return `.${o}`;
|
|
6210
6253
|
case "matrix":
|
|
6211
|
-
return `;${t}=${
|
|
6254
|
+
return `;${t}=${o}`;
|
|
6212
6255
|
default:
|
|
6213
|
-
return
|
|
6256
|
+
return o;
|
|
6214
6257
|
}
|
|
6215
6258
|
}
|
|
6216
|
-
for (const
|
|
6217
|
-
const
|
|
6218
|
-
r.push(nt(
|
|
6259
|
+
for (const o in e) {
|
|
6260
|
+
const d = s.style === "deepObject" ? `${t}[${o}]` : o;
|
|
6261
|
+
r.push(nt(d, e[o], s));
|
|
6219
6262
|
}
|
|
6220
6263
|
const a = r.join(n);
|
|
6221
6264
|
return s.style === "label" || s.style === "matrix" ? `${n}${a}` : a;
|
|
@@ -6224,18 +6267,18 @@ function qs(t, e, s) {
|
|
|
6224
6267
|
if (!Array.isArray(e))
|
|
6225
6268
|
return "";
|
|
6226
6269
|
if (s.explode === !1) {
|
|
6227
|
-
const a = { form: ",", spaceDelimited: "%20", pipeDelimited: "|" }[s.style] || ",",
|
|
6270
|
+
const a = { form: ",", spaceDelimited: "%20", pipeDelimited: "|" }[s.style] || ",", o = (s.allowReserved === !0 ? e : e.map((d) => encodeURIComponent(d))).join(a);
|
|
6228
6271
|
switch (s.style) {
|
|
6229
6272
|
case "simple":
|
|
6230
|
-
return
|
|
6273
|
+
return o;
|
|
6231
6274
|
case "label":
|
|
6232
|
-
return `.${
|
|
6275
|
+
return `.${o}`;
|
|
6233
6276
|
case "matrix":
|
|
6234
|
-
return `;${t}=${
|
|
6277
|
+
return `;${t}=${o}`;
|
|
6235
6278
|
// case "spaceDelimited":
|
|
6236
6279
|
// case "pipeDelimited":
|
|
6237
6280
|
default:
|
|
6238
|
-
return `${t}=${
|
|
6281
|
+
return `${t}=${o}`;
|
|
6239
6282
|
}
|
|
6240
6283
|
}
|
|
6241
6284
|
const r = { simple: ",", label: ".", matrix: ";" }[s.style] || "&", n = [];
|
|
@@ -6280,33 +6323,33 @@ function Gt(t) {
|
|
|
6280
6323
|
return r.join("&");
|
|
6281
6324
|
};
|
|
6282
6325
|
}
|
|
6283
|
-
function
|
|
6326
|
+
function ga(t, e) {
|
|
6284
6327
|
let s = t;
|
|
6285
|
-
for (const r of t.match(
|
|
6286
|
-
let n = r.substring(1, r.length - 1), a = !1,
|
|
6287
|
-
if (n.endsWith("*") && (a = !0, n = n.substring(0, n.length - 1)), n.startsWith(".") ? (
|
|
6328
|
+
for (const r of t.match(fa) ?? []) {
|
|
6329
|
+
let n = r.substring(1, r.length - 1), a = !1, o = "simple";
|
|
6330
|
+
if (n.endsWith("*") && (a = !0, n = n.substring(0, n.length - 1)), n.startsWith(".") ? (o = "label", n = n.substring(1)) : n.startsWith(";") && (o = "matrix", n = n.substring(1)), !e || e[n] === void 0 || e[n] === null)
|
|
6288
6331
|
continue;
|
|
6289
|
-
const
|
|
6290
|
-
if (Array.isArray(
|
|
6291
|
-
s = s.replace(r, qs(n,
|
|
6332
|
+
const d = e[n];
|
|
6333
|
+
if (Array.isArray(d)) {
|
|
6334
|
+
s = s.replace(r, qs(n, d, { style: o, explode: a }));
|
|
6292
6335
|
continue;
|
|
6293
6336
|
}
|
|
6294
|
-
if (typeof
|
|
6295
|
-
s = s.replace(r, Zs(n,
|
|
6337
|
+
if (typeof d == "object") {
|
|
6338
|
+
s = s.replace(r, Zs(n, d, { style: o, explode: a }));
|
|
6296
6339
|
continue;
|
|
6297
6340
|
}
|
|
6298
|
-
if (
|
|
6299
|
-
s = s.replace(r, `;${nt(n,
|
|
6341
|
+
if (o === "matrix") {
|
|
6342
|
+
s = s.replace(r, `;${nt(n, d)}`);
|
|
6300
6343
|
continue;
|
|
6301
6344
|
}
|
|
6302
|
-
s = s.replace(r,
|
|
6345
|
+
s = s.replace(r, o === "label" ? `.${encodeURIComponent(d)}` : encodeURIComponent(d));
|
|
6303
6346
|
}
|
|
6304
6347
|
return s;
|
|
6305
6348
|
}
|
|
6306
|
-
function
|
|
6349
|
+
function ya(t, e) {
|
|
6307
6350
|
return t instanceof FormData ? t : e && (e.get instanceof Function ? e.get("Content-Type") ?? e.get("content-type") : e["Content-Type"] ?? e["content-type"]) === "application/x-www-form-urlencoded" ? new URLSearchParams(t).toString() : JSON.stringify(t);
|
|
6308
6351
|
}
|
|
6309
|
-
function
|
|
6352
|
+
function va(t, e) {
|
|
6310
6353
|
let s = `${e.baseUrl}${t}`;
|
|
6311
6354
|
e.params?.path && (s = e.pathSerializer(s, e.params.path));
|
|
6312
6355
|
let r = e.querySerializer(e.params.query ?? {});
|
|
@@ -6322,8 +6365,8 @@ function Kt(...t) {
|
|
|
6322
6365
|
if (a === null)
|
|
6323
6366
|
e.delete(n);
|
|
6324
6367
|
else if (Array.isArray(a))
|
|
6325
|
-
for (const
|
|
6326
|
-
e.append(n,
|
|
6368
|
+
for (const o of a)
|
|
6369
|
+
e.append(n, o);
|
|
6327
6370
|
else a !== void 0 && e.set(n, a);
|
|
6328
6371
|
}
|
|
6329
6372
|
return e;
|
|
@@ -6331,66 +6374,66 @@ function Kt(...t) {
|
|
|
6331
6374
|
function Jt(t) {
|
|
6332
6375
|
return t.endsWith("/") ? t.substring(0, t.length - 1) : t;
|
|
6333
6376
|
}
|
|
6334
|
-
function
|
|
6377
|
+
function xa(t) {
|
|
6335
6378
|
const e = async ({
|
|
6336
6379
|
queryKey: [r, n, a],
|
|
6337
|
-
signal:
|
|
6380
|
+
signal: o
|
|
6338
6381
|
}) => {
|
|
6339
|
-
const
|
|
6340
|
-
if (
|
|
6341
|
-
throw
|
|
6342
|
-
return f.status === 204 || f.headers.get("Content-Length") === "0" ?
|
|
6343
|
-
}, s = (r, n, ...[a,
|
|
6382
|
+
const d = r.toUpperCase(), l = t[d], { data: c, error: u, response: f } = await l(n, { signal: o, ...a });
|
|
6383
|
+
if (u)
|
|
6384
|
+
throw u;
|
|
6385
|
+
return f.status === 204 || f.headers.get("Content-Length") === "0" ? c ?? null : c;
|
|
6386
|
+
}, s = (r, n, ...[a, o]) => ({
|
|
6344
6387
|
queryKey: a === void 0 ? [r, n] : [r, n, a],
|
|
6345
6388
|
queryFn: e,
|
|
6346
|
-
...
|
|
6389
|
+
...o
|
|
6347
6390
|
});
|
|
6348
6391
|
return {
|
|
6349
6392
|
queryOptions: s,
|
|
6350
|
-
useQuery: (r, n, ...[a,
|
|
6351
|
-
useSuspenseQuery: (r, n, ...[a,
|
|
6352
|
-
useInfiniteQuery: (r, n, a,
|
|
6353
|
-
const { pageParamName:
|
|
6393
|
+
useQuery: (r, n, ...[a, o, d]) => Hs(s(r, n, a, o), d),
|
|
6394
|
+
useSuspenseQuery: (r, n, ...[a, o, d]) => Ws(s(r, n, a, o), d),
|
|
6395
|
+
useInfiniteQuery: (r, n, a, o, d) => {
|
|
6396
|
+
const { pageParamName: l = "cursor", ...c } = o, { queryKey: u } = s(r, n, a);
|
|
6354
6397
|
return Qs(
|
|
6355
6398
|
{
|
|
6356
|
-
queryKey:
|
|
6399
|
+
queryKey: u,
|
|
6357
6400
|
queryFn: async ({ queryKey: [f, h, m], pageParam: g = 0, signal: b }) => {
|
|
6358
|
-
const v = f.toUpperCase(),
|
|
6401
|
+
const v = f.toUpperCase(), R = t[v], N = {
|
|
6359
6402
|
...m,
|
|
6360
6403
|
signal: b,
|
|
6361
6404
|
params: {
|
|
6362
6405
|
...m?.params || {},
|
|
6363
6406
|
query: {
|
|
6364
6407
|
...m?.params?.query,
|
|
6365
|
-
[
|
|
6408
|
+
[l]: g
|
|
6366
6409
|
}
|
|
6367
6410
|
}
|
|
6368
|
-
}, { data:
|
|
6411
|
+
}, { data: _, error: S } = await R(h, N);
|
|
6369
6412
|
if (S)
|
|
6370
6413
|
throw S;
|
|
6371
|
-
return
|
|
6414
|
+
return _;
|
|
6372
6415
|
},
|
|
6373
|
-
...
|
|
6416
|
+
...c
|
|
6374
6417
|
},
|
|
6375
|
-
|
|
6418
|
+
d
|
|
6376
6419
|
);
|
|
6377
6420
|
},
|
|
6378
|
-
useMutation: (r, n, a,
|
|
6421
|
+
useMutation: (r, n, a, o) => Bs(
|
|
6379
6422
|
{
|
|
6380
6423
|
mutationKey: [r, n],
|
|
6381
|
-
mutationFn: async (
|
|
6382
|
-
const
|
|
6424
|
+
mutationFn: async (d) => {
|
|
6425
|
+
const l = r.toUpperCase(), c = t[l], { data: u, error: f } = await c(n, d);
|
|
6383
6426
|
if (f)
|
|
6384
6427
|
throw f;
|
|
6385
|
-
return
|
|
6428
|
+
return u;
|
|
6386
6429
|
},
|
|
6387
6430
|
...a
|
|
6388
6431
|
},
|
|
6389
|
-
|
|
6432
|
+
o
|
|
6390
6433
|
)
|
|
6391
6434
|
};
|
|
6392
6435
|
}
|
|
6393
|
-
function
|
|
6436
|
+
function ba(t) {
|
|
6394
6437
|
if (t?.status === "error") return t;
|
|
6395
6438
|
const e = t?.response?.data;
|
|
6396
6439
|
return {
|
|
@@ -6399,7 +6442,7 @@ function va(t) {
|
|
|
6399
6442
|
errors: e?.errors || void 0
|
|
6400
6443
|
};
|
|
6401
6444
|
}
|
|
6402
|
-
function
|
|
6445
|
+
function Ua() {
|
|
6403
6446
|
return new Ys({
|
|
6404
6447
|
defaultOptions: {
|
|
6405
6448
|
queries: {
|
|
@@ -6410,13 +6453,13 @@ function Fa() {
|
|
|
6410
6453
|
},
|
|
6411
6454
|
mutationCache: new Gs({
|
|
6412
6455
|
onError: (t) => {
|
|
6413
|
-
const e =
|
|
6456
|
+
const e = ba(t);
|
|
6414
6457
|
!e.errors && e.message && re.error(e.message), console.error(`[Mutation Error] ${e.message}`, e.errors);
|
|
6415
6458
|
}
|
|
6416
6459
|
})
|
|
6417
6460
|
});
|
|
6418
6461
|
}
|
|
6419
|
-
const
|
|
6462
|
+
const _a = async (t, e) => {
|
|
6420
6463
|
const s = await fetch(t, { ...e || {}, credentials: "include" });
|
|
6421
6464
|
let r;
|
|
6422
6465
|
if ((s.headers.get?.("content-type") || "").includes("application/json"))
|
|
@@ -6427,24 +6470,24 @@ const xa = async (t, e) => {
|
|
|
6427
6470
|
if (!s.ok) {
|
|
6428
6471
|
let a = s.statusText || "Request failed";
|
|
6429
6472
|
if (typeof r == "object" && r !== null && "message" in r) {
|
|
6430
|
-
const
|
|
6431
|
-
typeof
|
|
6473
|
+
const d = r.message;
|
|
6474
|
+
typeof d == "string" && (a = d);
|
|
6432
6475
|
}
|
|
6433
|
-
const
|
|
6434
|
-
throw
|
|
6476
|
+
const o = new Error(a);
|
|
6477
|
+
throw o.response = { status: s.status, data: r }, o;
|
|
6435
6478
|
}
|
|
6436
6479
|
return s;
|
|
6437
6480
|
};
|
|
6438
|
-
function
|
|
6439
|
-
return
|
|
6481
|
+
function Da(t) {
|
|
6482
|
+
return pa({
|
|
6440
6483
|
baseUrl: t.baseUrl,
|
|
6441
|
-
fetch: t.fetch ??
|
|
6484
|
+
fetch: t.fetch ?? _a
|
|
6442
6485
|
});
|
|
6443
6486
|
}
|
|
6444
|
-
function
|
|
6445
|
-
return
|
|
6487
|
+
function za(t) {
|
|
6488
|
+
return xa(t);
|
|
6446
6489
|
}
|
|
6447
|
-
function
|
|
6490
|
+
function Za(t, e) {
|
|
6448
6491
|
const s = {};
|
|
6449
6492
|
e.defaults && Object.assign(s, e.defaults);
|
|
6450
6493
|
for (const [r, n] of Object.entries(t || {}))
|
|
@@ -6462,12 +6505,12 @@ function Da(t, e) {
|
|
|
6462
6505
|
}
|
|
6463
6506
|
return s;
|
|
6464
6507
|
}
|
|
6465
|
-
const
|
|
6508
|
+
const qa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6466
6509
|
__proto__: null,
|
|
6467
6510
|
configureTasks: js,
|
|
6468
6511
|
useTask: ks,
|
|
6469
6512
|
useTasks: Ns
|
|
6470
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
6513
|
+
}, Symbol.toStringTag, { value: "Module" })), Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6471
6514
|
__proto__: null,
|
|
6472
6515
|
configureUsers: Rs,
|
|
6473
6516
|
useCreateUser: Os,
|
|
@@ -6480,28 +6523,28 @@ const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
6480
6523
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6481
6524
|
export {
|
|
6482
6525
|
bt as GenericList,
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6526
|
+
ds as Pagination,
|
|
6527
|
+
Wa as QueryClientProvider,
|
|
6528
|
+
La as SortHeader,
|
|
6529
|
+
Ia as admin,
|
|
6530
|
+
Ma as auth,
|
|
6531
|
+
Ra as buildApiQuery,
|
|
6532
|
+
Oa as components,
|
|
6533
|
+
ia as configureKaleido,
|
|
6534
|
+
za as createClient,
|
|
6535
|
+
Da as createFetchClient,
|
|
6493
6536
|
Ds as createKaleidoOpenApiAdapters,
|
|
6494
6537
|
zs as createKaleidoOpenApiAuthClient,
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6538
|
+
$a as default,
|
|
6539
|
+
Aa as featureFlags,
|
|
6540
|
+
_a as fetchWithCredentials,
|
|
6541
|
+
ba as handleApiError,
|
|
6542
|
+
$a as kaleido,
|
|
6543
|
+
Ua as newQueryClient,
|
|
6544
|
+
Fa as openapi,
|
|
6502
6545
|
Rt as parseParams,
|
|
6503
|
-
|
|
6546
|
+
qa as tasks,
|
|
6504
6547
|
We as toSearchParams,
|
|
6505
|
-
|
|
6506
|
-
|
|
6548
|
+
Va as users,
|
|
6549
|
+
Za as validateParams
|
|
6507
6550
|
};
|