@opennsw/jsonforms-renderers 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +70 -1
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +1970 -1380
- package/package.json +1 -1
package/dist/renderers.es.js
CHANGED
|
@@ -1,50 +1,128 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useContext as
|
|
6
|
-
import { rankWith as
|
|
7
|
-
import { useJsonForms as
|
|
8
|
-
import { Box as
|
|
9
|
-
import { ChevronDownIcon as
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
function
|
|
1
|
+
var Qr = Object.defineProperty;
|
|
2
|
+
var en = (e, r, t) => r in e ? Qr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
+
var Vt = (e, r, t) => en(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { jsx as s, jsxs as p, Fragment as Ae } from "react/jsx-runtime";
|
|
5
|
+
import { useContext as At, createContext as St, useMemo as Se, useEffect as ye, useState as Y, useRef as he, useCallback as Be, useEffectEvent as ur } from "react";
|
|
6
|
+
import { defaultTranslator as nt, getControlPath as tn, isVisible as dr, composePaths as rn, toDataPath as fr, Resolve as Xe, createLabelDescriptionFrom as nn, getI18nKey as on, rankWith as ue, isStringControl as sn, or as pt, isNumberControl as ln, isIntegerControl as an, isBooleanControl as cn, isEnumControl as pr, isOneOfControl as hr, schemaMatches as _e, isDateControl as un, isDateTimeControl as dn, isTimeControl as fn, deriveLabelForUISchemaElement as pn, getI18nKeyPrefixBySchema as hn, uiTypeIs as ot, and as mr, not as mn, optionIs as gn, update as yn, createDefaultValue as bn, isObjectArrayControl as vn, isPrimitiveArrayControl as wn } from "@jsonforms/core";
|
|
7
|
+
import { useJsonForms as Ne, withJsonFormsControlProps as Ee, JsonFormsDispatch as Qe, withJsonFormsArrayControlProps as En, withJsonFormsLayoutProps as st } from "@jsonforms/react";
|
|
8
|
+
import { Box as N, Flex as L, Text as h, TextField as Fe, Checkbox as xn, RadioGroup as Wt, ScrollArea as gr, Select as lt, Spinner as Je, Button as Re, Heading as tt, Progress as Tn, Callout as gt, Tabs as at, Card as yr, Tooltip as rt, IconButton as Ze, Table as Me } from "@radix-ui/themes";
|
|
9
|
+
import { ChevronDownIcon as br, ChevronLeftIcon as An, ChevronRightIcon as Sn, CheckIcon as Rn, ExclamationTriangleIcon as ht, FileTextIcon as Cn, DownloadIcon as Rt, CheckCircledIcon as On, Cross2Icon as Ct, UploadIcon as Ge, TrashIcon as kn, PlusIcon as In } from "@radix-ui/react-icons";
|
|
10
|
+
import vr from "dayjs";
|
|
11
|
+
const wr = St(null);
|
|
12
|
+
function qs({
|
|
13
13
|
children: e,
|
|
14
14
|
onUpload: r,
|
|
15
15
|
getDownloadUrl: t
|
|
16
16
|
}) {
|
|
17
17
|
const n = { onUpload: r, getDownloadUrl: t };
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ s(wr.Provider, { value: n, children: e });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function Dn() {
|
|
21
|
+
return At(wr);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const Er = St(null);
|
|
24
|
+
function Ks({
|
|
25
25
|
children: e,
|
|
26
26
|
services: r
|
|
27
27
|
}) {
|
|
28
|
-
const t =
|
|
29
|
-
return /* @__PURE__ */
|
|
28
|
+
const t = Se(() => r, [r]);
|
|
29
|
+
return /* @__PURE__ */ s(Er.Provider, { value: t, children: e });
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const r =
|
|
31
|
+
function Nn(e) {
|
|
32
|
+
const r = At(Er);
|
|
33
33
|
return !r || !e ? null : r[e] ?? null;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const xr = St(null);
|
|
36
|
+
function Tr() {
|
|
37
|
+
return At(xr);
|
|
38
|
+
}
|
|
39
|
+
function Ys({ children: e, ...r }) {
|
|
40
|
+
return /* @__PURE__ */ s(xr.Provider, { value: r, children: e });
|
|
41
|
+
}
|
|
42
|
+
function Ln(e) {
|
|
43
|
+
var t;
|
|
44
|
+
if (!e || typeof e != "object") return !1;
|
|
45
|
+
const r = e;
|
|
46
|
+
return r.type === "Categorization" && ((t = r.options) == null ? void 0 : t.variant) === "stepper";
|
|
47
|
+
}
|
|
48
|
+
function zn(e) {
|
|
49
|
+
return e.elements.filter((r) => r.type === "Category");
|
|
50
|
+
}
|
|
51
|
+
function ut(e, r, t, n, i = "") {
|
|
52
|
+
if (t && e.rule && !dr(e, r, i, t, n)) return [];
|
|
53
|
+
if (e.type === "Control") return [e];
|
|
54
|
+
const o = e.elements;
|
|
55
|
+
return Array.isArray(o) ? o.flatMap((l) => ut(l, r, t, n, i)) : [];
|
|
56
|
+
}
|
|
57
|
+
function Ot(e, r = "") {
|
|
58
|
+
return rn(r, fr(e.scope));
|
|
59
|
+
}
|
|
60
|
+
function Mn(e, r) {
|
|
61
|
+
return e === r || e.startsWith(`${r}.`);
|
|
62
|
+
}
|
|
63
|
+
function Fn(e, r, t = fr(e.scope), n = nt) {
|
|
64
|
+
const i = Xe.schema(r, e.scope, r), o = nn(e, i).text;
|
|
65
|
+
return n(on(i, e, t, "label"), o);
|
|
66
|
+
}
|
|
67
|
+
function $n(e, r, t, n = "", i = nt) {
|
|
68
|
+
const o = r.map((l) => tn(l));
|
|
69
|
+
return e.map((l) => ({ control: l, path: Ot(l, n) })).filter(({ path: l }) => o.some((a) => Mn(a, l))).map(({ control: l, path: a }) => ({ path: a, label: Fn(l, t, a, i) }));
|
|
70
|
+
}
|
|
71
|
+
function Pn(e, r, t = "") {
|
|
72
|
+
const n = e.map((i) => Ar(r, Ot(i, t))).find((i) => Array.isArray(i) && i.length > 0);
|
|
73
|
+
return n ? { kind: "items", count: n.length } : { kind: "fields", count: e.length };
|
|
74
|
+
}
|
|
75
|
+
function Un(e, r, t = "") {
|
|
76
|
+
return e.some((n) => {
|
|
77
|
+
const i = Ar(r, Ot(n, t));
|
|
78
|
+
return i != null && i !== "" && !(Array.isArray(i) && i.length === 0);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function Ar(e, r) {
|
|
82
|
+
return r.split(".").reduce((t, n) => {
|
|
83
|
+
if (!(t == null || typeof t != "object"))
|
|
84
|
+
return t[n];
|
|
85
|
+
}, e);
|
|
86
|
+
}
|
|
87
|
+
const jn = {
|
|
88
|
+
back: "Back",
|
|
89
|
+
continue: "Continue",
|
|
90
|
+
stepOf: "Step {step} of {total}",
|
|
91
|
+
review: "Review and Submit",
|
|
92
|
+
navLabel: "Form steps",
|
|
93
|
+
progressLabel: "Progress through the form",
|
|
94
|
+
noteDone: "Done",
|
|
95
|
+
noteToFix: "{count} to fix",
|
|
96
|
+
noteItem: "{count} item added",
|
|
97
|
+
noteItems: "{count} items added",
|
|
98
|
+
noteField: "{count} field",
|
|
99
|
+
noteFields: "{count} fields",
|
|
100
|
+
noteReview: "Check and submit",
|
|
101
|
+
missingFields: "Complete these fields to continue:",
|
|
102
|
+
incompleteSteps: "Some steps are not complete yet:",
|
|
103
|
+
reviewHint: "Check your answers below, then submit.",
|
|
104
|
+
edit: "Edit",
|
|
105
|
+
editStep: "Edit {step}"
|
|
106
|
+
};
|
|
107
|
+
function _n(e, r, t) {
|
|
108
|
+
return (e ?? nt)(`stepper.${r}`, jn[r], t).replace(
|
|
109
|
+
/\{(\w+)\}/g,
|
|
110
|
+
(i, o) => t && o in t ? String(t[o]) : i
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
const Le = (e, r, t, n = void 0) => {
|
|
114
|
+
ye(() => {
|
|
37
115
|
e === !1 && t(r, n);
|
|
38
116
|
}, [e, r, t, n]);
|
|
39
|
-
},
|
|
40
|
-
function
|
|
117
|
+
}, Ht = /* @__PURE__ */ new WeakMap();
|
|
118
|
+
function Vn(e) {
|
|
41
119
|
if (!e || typeof e != "object") return !1;
|
|
42
|
-
const r =
|
|
120
|
+
const r = Ht.get(e);
|
|
43
121
|
if (r !== void 0) return r;
|
|
44
|
-
const t =
|
|
45
|
-
return
|
|
122
|
+
const t = Ye(e, e, /* @__PURE__ */ new Set());
|
|
123
|
+
return Ht.set(e, t), t;
|
|
46
124
|
}
|
|
47
|
-
function
|
|
125
|
+
function Wn(e, r) {
|
|
48
126
|
if (!r.startsWith("#/")) return;
|
|
49
127
|
const t = r.slice(2).split("/");
|
|
50
128
|
let n = e;
|
|
@@ -54,7 +132,7 @@ function jr(e, r) {
|
|
|
54
132
|
}
|
|
55
133
|
return n && typeof n == "object" ? n : void 0;
|
|
56
134
|
}
|
|
57
|
-
function
|
|
135
|
+
function Ye(e, r, t) {
|
|
58
136
|
if (!e || typeof e != "object" || t.has(e)) return !1;
|
|
59
137
|
t.add(e);
|
|
60
138
|
const n = e;
|
|
@@ -62,41 +140,41 @@ function _e(e, r, t) {
|
|
|
62
140
|
for (const i of ["allOf", "anyOf", "oneOf"]) {
|
|
63
141
|
const o = n[i];
|
|
64
142
|
if (Array.isArray(o))
|
|
65
|
-
for (const
|
|
66
|
-
if (!
|
|
67
|
-
const a =
|
|
68
|
-
if (Array.isArray(a.required) && a.required.length > 0 ||
|
|
143
|
+
for (const l of o) {
|
|
144
|
+
if (!l || typeof l != "object") continue;
|
|
145
|
+
const a = l;
|
|
146
|
+
if (Array.isArray(a.required) && a.required.length > 0 || Ye(a, r, t)) return !0;
|
|
69
147
|
}
|
|
70
148
|
}
|
|
71
149
|
if (typeof n.$ref == "string") {
|
|
72
|
-
const i =
|
|
73
|
-
if (i &&
|
|
150
|
+
const i = Wn(r, n.$ref);
|
|
151
|
+
if (i && Ye(i, r, t)) return !0;
|
|
74
152
|
}
|
|
75
153
|
for (const i of ["then", "else", "not", "contains", "additionalProperties", "items"]) {
|
|
76
154
|
const o = n[i];
|
|
77
|
-
if (o && typeof o == "object" && !Array.isArray(o) &&
|
|
155
|
+
if (o && typeof o == "object" && !Array.isArray(o) && Ye(o, r, t))
|
|
78
156
|
return !0;
|
|
79
157
|
}
|
|
80
158
|
if (Array.isArray(n.items)) {
|
|
81
159
|
for (const i of n.items)
|
|
82
|
-
if (
|
|
160
|
+
if (Ye(i, r, t)) return !0;
|
|
83
161
|
}
|
|
84
162
|
for (const i of ["properties", "patternProperties", "$defs", "definitions"]) {
|
|
85
163
|
const o = n[i];
|
|
86
164
|
if (!(!o || typeof o != "object")) {
|
|
87
|
-
for (const
|
|
88
|
-
if (
|
|
165
|
+
for (const l of Object.values(o))
|
|
166
|
+
if (Ye(l, r, t)) return !0;
|
|
89
167
|
}
|
|
90
168
|
}
|
|
91
169
|
return !1;
|
|
92
170
|
}
|
|
93
|
-
function
|
|
171
|
+
function Hn(e, r) {
|
|
94
172
|
const t = structuredClone(e ?? {});
|
|
95
173
|
if (!r) return t;
|
|
96
174
|
const n = r.split(".");
|
|
97
175
|
let i = t;
|
|
98
|
-
for (let
|
|
99
|
-
const a = n[
|
|
176
|
+
for (let l = 0; l < n.length - 1; l++) {
|
|
177
|
+
const a = n[l];
|
|
100
178
|
if (i == null || typeof i != "object") return t;
|
|
101
179
|
const c = i[a];
|
|
102
180
|
if (c == null || typeof c != "object") return t;
|
|
@@ -105,32 +183,32 @@ function Vr(e, r) {
|
|
|
105
183
|
const o = n[n.length - 1];
|
|
106
184
|
return i != null && typeof i == "object" && delete i[o], t;
|
|
107
185
|
}
|
|
108
|
-
function
|
|
186
|
+
function Bn(e) {
|
|
109
187
|
const r = e.lastIndexOf(".");
|
|
110
188
|
return r === -1 ? "" : "/" + e.slice(0, r).split(".").join("/");
|
|
111
189
|
}
|
|
112
|
-
function
|
|
190
|
+
function Xn(e) {
|
|
113
191
|
if (!e) return "";
|
|
114
192
|
const r = e.lastIndexOf(".");
|
|
115
193
|
return r === -1 ? e : e.slice(r + 1);
|
|
116
194
|
}
|
|
117
|
-
function
|
|
195
|
+
function qn(e, r) {
|
|
118
196
|
var t;
|
|
119
|
-
return e.keyword !== "required" && e.keyword !== "dependencies" || ((t = e.params) == null ? void 0 : t.missingProperty) !==
|
|
197
|
+
return e.keyword !== "required" && e.keyword !== "dependencies" || ((t = e.params) == null ? void 0 : t.missingProperty) !== Xn(r) ? !1 : (e.instancePath ?? "") === Bn(r);
|
|
120
198
|
}
|
|
121
|
-
function
|
|
199
|
+
function Kn(e, r, t) {
|
|
122
200
|
if (!e || !t) return !1;
|
|
123
|
-
const n =
|
|
201
|
+
const n = Hn(r, e);
|
|
124
202
|
t(n);
|
|
125
203
|
const i = t.errors;
|
|
126
|
-
return i != null && i.length ? i.some((o) =>
|
|
204
|
+
return i != null && i.length ? i.some((o) => qn(o, e)) : !1;
|
|
127
205
|
}
|
|
128
|
-
function
|
|
206
|
+
function Ce(e, r = !1, t = !0) {
|
|
129
207
|
var a, c, u;
|
|
130
|
-
const n =
|
|
131
|
-
return
|
|
208
|
+
const n = Ne(), i = (a = n.core) == null ? void 0 : a.data, o = (c = n.core) == null ? void 0 : c.validator, l = (u = n.core) == null ? void 0 : u.schema;
|
|
209
|
+
return Se(() => t ? r ? !0 : Vn(l) ? Kn(e, i, o) : !1 : !1, [t, r, e, i, o, l]);
|
|
132
210
|
}
|
|
133
|
-
const
|
|
211
|
+
const Oe = (e, r) => {
|
|
134
212
|
if (!e) return "";
|
|
135
213
|
const t = r || "This field";
|
|
136
214
|
return e.split(`
|
|
@@ -139,175 +217,175 @@ const Re = (e, r) => {
|
|
|
139
217
|
return i === "is a required property" ? `${t} is required` : i.startsWith("must be > ") ? `${t} must be greater than ${i.slice(10)}` : i.startsWith("must be >= ") ? `${t} must be at least ${i.slice(11)}` : i.startsWith("must be multiple of ") ? `${t} must be a multiple of ${i.slice(20)}` : n;
|
|
140
218
|
}).join(`
|
|
141
219
|
`);
|
|
142
|
-
},
|
|
220
|
+
}, Yn = ({
|
|
143
221
|
data: e,
|
|
144
222
|
handleChange: r,
|
|
145
223
|
path: t,
|
|
146
224
|
label: n,
|
|
147
225
|
required: i,
|
|
148
226
|
errors: o,
|
|
149
|
-
uischema:
|
|
227
|
+
uischema: l,
|
|
150
228
|
schema: a,
|
|
151
229
|
enabled: c,
|
|
152
230
|
visible: u = !0
|
|
153
231
|
}) => {
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
const d =
|
|
232
|
+
var f;
|
|
233
|
+
Le(u, t, r);
|
|
234
|
+
const d = Ce(t, i, u);
|
|
157
235
|
if (u === !1)
|
|
158
236
|
return null;
|
|
159
|
-
const
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
237
|
+
const m = o.length === 0;
|
|
238
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
239
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
162
240
|
n,
|
|
163
241
|
" ",
|
|
164
|
-
d && /* @__PURE__ */
|
|
242
|
+
d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
165
243
|
] }),
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
|
|
244
|
+
/* @__PURE__ */ s(
|
|
245
|
+
Fe.Root,
|
|
168
246
|
{
|
|
169
247
|
value: e || "",
|
|
170
|
-
onChange: (
|
|
248
|
+
onChange: (g) => r(t, g.target.value === "" ? void 0 : g.target.value),
|
|
171
249
|
disabled: !c,
|
|
172
|
-
placeholder: (
|
|
173
|
-
color:
|
|
250
|
+
placeholder: (f = l.options) == null ? void 0 : f.placeholder,
|
|
251
|
+
color: m ? void 0 : "red",
|
|
174
252
|
id: t
|
|
175
253
|
}
|
|
176
254
|
),
|
|
177
|
-
!
|
|
178
|
-
a.description && /* @__PURE__ */
|
|
255
|
+
!m && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
|
|
256
|
+
a.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: a.description })
|
|
179
257
|
] }) });
|
|
180
|
-
},
|
|
258
|
+
}, Gn = ue(1, sn), Jn = Ee(Yn), Zn = /* @__PURE__ */ new Set(["-", "+", "e", "E"]), Qn = ({
|
|
181
259
|
data: e,
|
|
182
260
|
handleChange: r,
|
|
183
261
|
path: t,
|
|
184
262
|
label: n,
|
|
185
263
|
required: i,
|
|
186
264
|
errors: o,
|
|
187
|
-
uischema:
|
|
265
|
+
uischema: l,
|
|
188
266
|
schema: a,
|
|
189
267
|
enabled: c,
|
|
190
268
|
visible: u = !0
|
|
191
269
|
}) => {
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
const d =
|
|
270
|
+
var C;
|
|
271
|
+
Le(u, t, r);
|
|
272
|
+
const d = Ce(t, i, u);
|
|
195
273
|
if (u === !1)
|
|
196
274
|
return null;
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
275
|
+
const m = o.length === 0, f = typeof a.exclusiveMinimum == "number" ? a.exclusiveMinimum : void 0, g = typeof a.minimum == "number" ? a.minimum : void 0, E = f ?? g, v = E !== void 0 && E >= 0, z = typeof a.multipleOf == "number" ? a.multipleOf : a.type === "integer" ? 1 : void 0, R = (A) => {
|
|
276
|
+
if (A === "") {
|
|
199
277
|
r(t, void 0);
|
|
200
278
|
return;
|
|
201
279
|
}
|
|
202
|
-
const
|
|
203
|
-
isNaN(
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
if (!
|
|
208
|
-
const
|
|
209
|
-
/[-+eE]/.test(
|
|
280
|
+
const T = Number(A);
|
|
281
|
+
isNaN(T) || r(t, T);
|
|
282
|
+
}, j = (A) => {
|
|
283
|
+
v && Zn.has(A.key) && A.preventDefault();
|
|
284
|
+
}, S = (A) => {
|
|
285
|
+
if (!v) return;
|
|
286
|
+
const T = A.clipboardData.getData("text");
|
|
287
|
+
/[-+eE]/.test(T) && A.preventDefault();
|
|
210
288
|
};
|
|
211
|
-
return /* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
290
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
213
291
|
n,
|
|
214
292
|
" ",
|
|
215
|
-
d && /* @__PURE__ */
|
|
293
|
+
d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
216
294
|
] }),
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
|
|
295
|
+
/* @__PURE__ */ s(
|
|
296
|
+
Fe.Root,
|
|
219
297
|
{
|
|
220
298
|
type: "number",
|
|
221
299
|
value: e ?? "",
|
|
222
|
-
onChange: (
|
|
223
|
-
onKeyDown:
|
|
224
|
-
onPaste:
|
|
225
|
-
min:
|
|
226
|
-
step:
|
|
300
|
+
onChange: (A) => R(A.target.value),
|
|
301
|
+
onKeyDown: j,
|
|
302
|
+
onPaste: S,
|
|
303
|
+
min: E,
|
|
304
|
+
step: z,
|
|
227
305
|
disabled: !c,
|
|
228
|
-
placeholder: (
|
|
229
|
-
color:
|
|
306
|
+
placeholder: (C = l.options) == null ? void 0 : C.placeholder,
|
|
307
|
+
color: m ? void 0 : "red",
|
|
230
308
|
id: t
|
|
231
309
|
}
|
|
232
310
|
),
|
|
233
|
-
!
|
|
234
|
-
a.description && /* @__PURE__ */
|
|
311
|
+
!m && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
|
|
312
|
+
a.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: a.description })
|
|
235
313
|
] }) });
|
|
236
|
-
},
|
|
314
|
+
}, eo = ue(2, pt(ln, an)), to = Ee(Qn), ro = ({
|
|
237
315
|
data: e,
|
|
238
316
|
handleChange: r,
|
|
239
317
|
path: t,
|
|
240
318
|
label: n,
|
|
241
319
|
required: i,
|
|
242
320
|
errors: o,
|
|
243
|
-
schema:
|
|
321
|
+
schema: l,
|
|
244
322
|
enabled: a,
|
|
245
323
|
visible: c = !0
|
|
246
324
|
}) => {
|
|
247
|
-
|
|
248
|
-
const u =
|
|
325
|
+
Le(c, t, r);
|
|
326
|
+
const u = Ce(t, i, c);
|
|
249
327
|
if (c === !1)
|
|
250
328
|
return null;
|
|
251
329
|
const d = o.length === 0;
|
|
252
|
-
return /* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
|
|
330
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
331
|
+
/* @__PURE__ */ p(L, { gap: "2", align: "center", children: [
|
|
332
|
+
/* @__PURE__ */ s(
|
|
333
|
+
xn,
|
|
256
334
|
{
|
|
257
335
|
checked: !!e,
|
|
258
|
-
onCheckedChange: (
|
|
336
|
+
onCheckedChange: (m) => r(t, m === !0),
|
|
259
337
|
disabled: !a,
|
|
260
338
|
id: t
|
|
261
339
|
}
|
|
262
340
|
),
|
|
263
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", htmlFor: t, children: [
|
|
264
342
|
n,
|
|
265
343
|
" ",
|
|
266
344
|
u && "*"
|
|
267
345
|
] })
|
|
268
346
|
] }),
|
|
269
|
-
!d && /* @__PURE__ */
|
|
270
|
-
|
|
347
|
+
!d && /* @__PURE__ */ s(h, { color: "red", size: "1", className: "block mt-1", children: Oe(o, n) }),
|
|
348
|
+
l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", className: "block mt-1", children: l.description })
|
|
271
349
|
] });
|
|
272
|
-
},
|
|
350
|
+
}, no = ue(2, cn), oo = Ee(ro), io = ({
|
|
273
351
|
data: e,
|
|
274
352
|
handleChange: r,
|
|
275
353
|
path: t,
|
|
276
354
|
label: n,
|
|
277
355
|
required: i,
|
|
278
356
|
errors: o,
|
|
279
|
-
schema:
|
|
357
|
+
schema: l,
|
|
280
358
|
enabled: a,
|
|
281
359
|
visible: c = !0
|
|
282
360
|
}) => {
|
|
283
|
-
|
|
284
|
-
const u =
|
|
361
|
+
Le(c, t, r);
|
|
362
|
+
const u = Ce(t, i, c);
|
|
285
363
|
if (c === !1)
|
|
286
364
|
return null;
|
|
287
365
|
const d = o.length === 0;
|
|
288
|
-
let
|
|
289
|
-
|
|
290
|
-
value:
|
|
291
|
-
label:
|
|
366
|
+
let m = [];
|
|
367
|
+
l.enum ? m = l.enum.map((g) => ({ value: g, label: String(g) })) : l.oneOf && (m = l.oneOf.map((g) => ({
|
|
368
|
+
value: g.const,
|
|
369
|
+
label: g.title || String(g.const)
|
|
292
370
|
})));
|
|
293
|
-
const
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
371
|
+
const f = e;
|
|
372
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
373
|
+
/* @__PURE__ */ p(h, { as: "div", size: "2", weight: "bold", children: [
|
|
296
374
|
n,
|
|
297
375
|
" ",
|
|
298
|
-
u && /* @__PURE__ */
|
|
376
|
+
u && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
299
377
|
] }),
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
|
|
378
|
+
/* @__PURE__ */ s(
|
|
379
|
+
Wt.Root,
|
|
302
380
|
{
|
|
303
|
-
value:
|
|
304
|
-
onValueChange: (
|
|
305
|
-
const
|
|
306
|
-
|
|
381
|
+
value: f !== void 0 ? String(f) : "",
|
|
382
|
+
onValueChange: (g) => {
|
|
383
|
+
const E = m.find((v) => String(v.value) === g);
|
|
384
|
+
E && r(t, E.value);
|
|
307
385
|
},
|
|
308
386
|
disabled: !a,
|
|
309
|
-
children: /* @__PURE__ */
|
|
310
|
-
|
|
387
|
+
children: /* @__PURE__ */ s(
|
|
388
|
+
L,
|
|
311
389
|
{
|
|
312
390
|
direction: "row",
|
|
313
391
|
style: {
|
|
@@ -315,109 +393,109 @@ const Re = (e, r) => {
|
|
|
315
393
|
columnGap: "clamp(14px, 3vw, 36px)",
|
|
316
394
|
rowGap: "clamp(8px, 1.6vw, 14px)"
|
|
317
395
|
},
|
|
318
|
-
children:
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
] }, String(
|
|
396
|
+
children: m.map((g) => /* @__PURE__ */ p(L, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
|
|
397
|
+
/* @__PURE__ */ s(Wt.Item, { value: String(g.value) }),
|
|
398
|
+
/* @__PURE__ */ s(h, { size: "2", color: a ? void 0 : "gray", children: g.label })
|
|
399
|
+
] }, String(g.value)))
|
|
322
400
|
}
|
|
323
401
|
)
|
|
324
402
|
}
|
|
325
403
|
),
|
|
326
|
-
!d && /* @__PURE__ */
|
|
327
|
-
|
|
404
|
+
!d && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
|
|
405
|
+
l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: l.description })
|
|
328
406
|
] }) });
|
|
329
|
-
},
|
|
407
|
+
}, so = (e, r, t) => {
|
|
330
408
|
var i;
|
|
331
|
-
return
|
|
332
|
-
},
|
|
409
|
+
return pt(pr, hr)(e, r, t) && ((i = e == null ? void 0 : e.options) == null ? void 0 : i.format) === "radio" ? 3 : -1;
|
|
410
|
+
}, lo = Ee(io), ao = ({
|
|
333
411
|
data: e,
|
|
334
412
|
handleChange: r,
|
|
335
413
|
path: t,
|
|
336
414
|
label: n,
|
|
337
415
|
required: i,
|
|
338
416
|
errors: o,
|
|
339
|
-
schema:
|
|
417
|
+
schema: l,
|
|
340
418
|
uischema: a,
|
|
341
419
|
enabled: c,
|
|
342
420
|
visible: u = !0
|
|
343
421
|
}) => {
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
const d =
|
|
347
|
-
if (
|
|
348
|
-
if (!
|
|
349
|
-
const
|
|
350
|
-
|
|
422
|
+
var le, ve, ne, ae;
|
|
423
|
+
Le(u, t, r);
|
|
424
|
+
const d = Ce(t, i, u), m = ((le = a.options) == null ? void 0 : le.autocomplete) === !0, [f, g] = Y(!1), [E, v] = Y(""), [z, R] = Y(0), j = he(null);
|
|
425
|
+
if (ye(() => {
|
|
426
|
+
if (!m || !f) return;
|
|
427
|
+
const $ = (Z) => {
|
|
428
|
+
j.current && !j.current.contains(Z.target) && g(!1);
|
|
351
429
|
};
|
|
352
|
-
return document.addEventListener("mousedown",
|
|
353
|
-
}, [
|
|
430
|
+
return document.addEventListener("mousedown", $), () => document.removeEventListener("mousedown", $);
|
|
431
|
+
}, [m, f]), u === !1)
|
|
354
432
|
return null;
|
|
355
|
-
const
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
return { value: String(
|
|
433
|
+
const S = l.type === "object", C = S ? ((ve = l.properties) == null ? void 0 : ve.value) ?? {} : l;
|
|
434
|
+
let A = [];
|
|
435
|
+
C.enum ? A = C.enum.map(($) => ({ value: String($), label: String($), raw: $ })) : C.oneOf && (A = C.oneOf.map(($) => {
|
|
436
|
+
const Z = $.const;
|
|
437
|
+
return { value: String(Z), label: $.title || String(Z), raw: Z };
|
|
360
438
|
}));
|
|
361
|
-
const
|
|
362
|
-
r(t,
|
|
439
|
+
const T = S ? typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? { value: e } : e ?? void 0 : void 0, W = S ? T == null ? void 0 : T.value : e, U = T == null ? void 0 : T.label, F = W != null ? String(W) : "", M = U ?? ((ne = A.find(($) => $.value === F)) == null ? void 0 : ne.label) ?? "", x = ((ae = a.options) == null ? void 0 : ae.placeholder) || "Select an option", te = S && F !== "" && !A.some(($) => $.value === F), H = o ? Oe(o, n) : te ? `"${M || F}" is no longer an available option` : "", J = H === "", B = ($) => {
|
|
440
|
+
r(t, S ? { value: $.raw, label: $.label } : $.value);
|
|
363
441
|
};
|
|
364
|
-
if (
|
|
365
|
-
const
|
|
366
|
-
_
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
},
|
|
370
|
-
(
|
|
442
|
+
if (m) {
|
|
443
|
+
const $ = f ? A.filter((_) => _.label.toLowerCase().includes(E.toLowerCase())) : A, Z = Math.min(z, $.length - 1), I = (_) => {
|
|
444
|
+
B(_), g(!1);
|
|
445
|
+
}, re = (_) => {
|
|
446
|
+
_.stopPropagation(), r(t, void 0), v("");
|
|
447
|
+
}, Q = (_) => {
|
|
448
|
+
(_.key === "Enter" || _.key === " ") && re(_);
|
|
371
449
|
};
|
|
372
|
-
return /* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
451
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
374
452
|
n,
|
|
375
453
|
" ",
|
|
376
|
-
d && /* @__PURE__ */
|
|
454
|
+
d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
377
455
|
] }),
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
|
|
456
|
+
/* @__PURE__ */ p("div", { ref: j, style: { position: "relative" }, children: [
|
|
457
|
+
/* @__PURE__ */ s(
|
|
458
|
+
Fe.Root,
|
|
381
459
|
{
|
|
382
460
|
id: t,
|
|
383
|
-
value:
|
|
384
|
-
placeholder:
|
|
461
|
+
value: f ? E : M,
|
|
462
|
+
placeholder: x,
|
|
385
463
|
disabled: !c,
|
|
386
|
-
style:
|
|
387
|
-
onChange: (
|
|
388
|
-
|
|
464
|
+
style: J ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
465
|
+
onChange: (_) => {
|
|
466
|
+
v(_.target.value), R(0), f || g(!0);
|
|
389
467
|
},
|
|
390
468
|
onFocus: () => {
|
|
391
|
-
c && !
|
|
469
|
+
c && !f && (v(""), R(0), g(!0));
|
|
392
470
|
},
|
|
393
|
-
onKeyDown: (
|
|
394
|
-
|
|
471
|
+
onKeyDown: (_) => {
|
|
472
|
+
_.key === "Escape" ? g(!1) : _.key === "ArrowDown" ? (_.preventDefault(), f ? R((b) => Math.min(b + 1, $.length - 1)) : (v(""), g(!0))) : _.key === "ArrowUp" ? (_.preventDefault(), f && R((b) => Math.max(b - 1, 0))) : _.key === "Enter" && f && $[Z] && (_.preventDefault(), I($[Z]));
|
|
395
473
|
},
|
|
396
|
-
children: /* @__PURE__ */
|
|
397
|
-
|
|
474
|
+
children: /* @__PURE__ */ s(Fe.Slot, { side: "right", children: /* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
|
|
475
|
+
F && c && /* @__PURE__ */ s(
|
|
398
476
|
"span",
|
|
399
477
|
{
|
|
400
478
|
role: "button",
|
|
401
479
|
tabIndex: 0,
|
|
402
|
-
onMouseDown: (
|
|
403
|
-
onClick:
|
|
404
|
-
onKeyDown:
|
|
480
|
+
onMouseDown: (_) => _.preventDefault(),
|
|
481
|
+
onClick: re,
|
|
482
|
+
onKeyDown: Q,
|
|
405
483
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
406
484
|
"aria-label": "Clear selection",
|
|
407
485
|
children: "×"
|
|
408
486
|
}
|
|
409
487
|
),
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
-
|
|
488
|
+
/* @__PURE__ */ s(
|
|
489
|
+
br,
|
|
412
490
|
{
|
|
413
|
-
style: { transform:
|
|
491
|
+
style: { transform: f ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
414
492
|
}
|
|
415
493
|
)
|
|
416
494
|
] }) })
|
|
417
495
|
}
|
|
418
496
|
),
|
|
419
|
-
|
|
420
|
-
|
|
497
|
+
f && /* @__PURE__ */ s(
|
|
498
|
+
N,
|
|
421
499
|
{
|
|
422
500
|
style: {
|
|
423
501
|
position: "absolute",
|
|
@@ -431,101 +509,122 @@ const Re = (e, r) => {
|
|
|
431
509
|
border: "1px solid var(--gray-a6)",
|
|
432
510
|
overflow: "hidden"
|
|
433
511
|
},
|
|
434
|
-
children: /* @__PURE__ */
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
512
|
+
children: /* @__PURE__ */ s(gr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ p(N, { p: "1", children: [
|
|
513
|
+
$.length === 0 && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "No results found." }) }),
|
|
514
|
+
$.map((_, b) => /* @__PURE__ */ s(
|
|
515
|
+
N,
|
|
438
516
|
{
|
|
439
517
|
px: "3",
|
|
440
518
|
py: "2",
|
|
441
|
-
onMouseDown: (
|
|
442
|
-
onClick: () =>
|
|
443
|
-
onMouseEnter: () =>
|
|
519
|
+
onMouseDown: (O) => O.preventDefault(),
|
|
520
|
+
onClick: () => I(_),
|
|
521
|
+
onMouseEnter: () => R(b),
|
|
444
522
|
style: {
|
|
445
523
|
cursor: "pointer",
|
|
446
524
|
borderRadius: "var(--radius-2)",
|
|
447
|
-
backgroundColor:
|
|
525
|
+
backgroundColor: b === Z ? "var(--accent-4)" : _.value === F ? "var(--accent-3)" : void 0
|
|
448
526
|
},
|
|
449
|
-
children: /* @__PURE__ */
|
|
527
|
+
children: /* @__PURE__ */ s(h, { size: "2", children: _.label })
|
|
450
528
|
},
|
|
451
|
-
|
|
529
|
+
_.value
|
|
452
530
|
))
|
|
453
531
|
] }) })
|
|
454
532
|
}
|
|
455
533
|
)
|
|
456
534
|
] }),
|
|
457
|
-
!
|
|
458
|
-
|
|
535
|
+
!J && /* @__PURE__ */ s(h, { color: "red", size: "1", children: H }),
|
|
536
|
+
l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: l.description })
|
|
459
537
|
] }) });
|
|
460
538
|
}
|
|
461
|
-
return /* @__PURE__ */
|
|
462
|
-
/* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
540
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
463
541
|
n,
|
|
464
542
|
" ",
|
|
465
|
-
d && /* @__PURE__ */
|
|
543
|
+
d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
466
544
|
] }),
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
|
|
545
|
+
/* @__PURE__ */ p(
|
|
546
|
+
lt.Root,
|
|
469
547
|
{
|
|
470
|
-
value:
|
|
471
|
-
onValueChange: (
|
|
472
|
-
const
|
|
473
|
-
|
|
548
|
+
value: F,
|
|
549
|
+
onValueChange: ($) => {
|
|
550
|
+
const Z = A.find((I) => I.value === $);
|
|
551
|
+
Z && B(Z);
|
|
474
552
|
},
|
|
475
553
|
disabled: !c,
|
|
476
554
|
children: [
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ s(lt.Trigger, { placeholder: x, color: J ? void 0 : "red", id: t, children: S && U ? U : void 0 }),
|
|
556
|
+
/* @__PURE__ */ s(lt.Content, { children: A.map(($) => /* @__PURE__ */ s(lt.Item, { value: $.value, children: $.label }, $.value)) })
|
|
479
557
|
]
|
|
480
558
|
}
|
|
481
559
|
),
|
|
482
|
-
!
|
|
483
|
-
|
|
560
|
+
!J && /* @__PURE__ */ s(h, { color: "red", size: "1", children: H }),
|
|
561
|
+
l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: l.description })
|
|
484
562
|
] }) });
|
|
485
|
-
},
|
|
563
|
+
}, co = ue(2, pt(pr, hr)), uo = ue(
|
|
486
564
|
3,
|
|
487
|
-
|
|
565
|
+
_e((e) => {
|
|
488
566
|
var t;
|
|
489
567
|
if (e.type !== "object" || e["x-search"] !== void 0) return !1;
|
|
490
568
|
const r = (t = e.properties) == null ? void 0 : t.value;
|
|
491
569
|
return Array.isArray(r == null ? void 0 : r.enum) || Array.isArray(r == null ? void 0 : r.oneOf);
|
|
492
570
|
})
|
|
493
|
-
),
|
|
494
|
-
today: (e) =>
|
|
495
|
-
},
|
|
496
|
-
function
|
|
497
|
-
const n = { ...
|
|
498
|
-
return e.replace(
|
|
571
|
+
), Bt = Ee(ao), Sr = /\{([A-Za-z0-9_]+)(?:\(([^(){}]*)\))?\}/g, fo = {
|
|
572
|
+
today: (e) => vr().format(e || "YYYY-MM-DD")
|
|
573
|
+
}, po = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint", Xt = (e, r) => Object.prototype.hasOwnProperty.call(e, r);
|
|
574
|
+
function mt(e, r, t = {}) {
|
|
575
|
+
const n = { ...fo, ...t };
|
|
576
|
+
return e.replace(Sr, (i, o, l) => {
|
|
499
577
|
let a;
|
|
500
|
-
if (
|
|
501
|
-
if (!
|
|
578
|
+
if (l === void 0) {
|
|
579
|
+
if (!Xt(r, o)) return i;
|
|
502
580
|
a = r[o];
|
|
503
581
|
} else {
|
|
504
|
-
if (!
|
|
582
|
+
if (!Xt(n, o)) return i;
|
|
505
583
|
try {
|
|
506
|
-
a = n[o](
|
|
584
|
+
a = n[o](l);
|
|
507
585
|
} catch {
|
|
508
586
|
return i;
|
|
509
587
|
}
|
|
510
588
|
}
|
|
511
|
-
return a == null ? "" :
|
|
589
|
+
return a == null ? "" : po(a) ? String(a) : i;
|
|
512
590
|
});
|
|
513
591
|
}
|
|
514
|
-
function
|
|
592
|
+
function kt(e) {
|
|
515
593
|
const r = [];
|
|
516
594
|
let t = 0;
|
|
517
|
-
for (const n of e.matchAll(
|
|
595
|
+
for (const n of e.matchAll(Sr))
|
|
518
596
|
n.index > t && r.push(e.slice(t, n.index)), r.push(n[2] === void 0 ? { name: n[1] } : { name: n[1], arg: n[2] }), t = n.index + n[0].length;
|
|
519
597
|
return t < e.length && r.push(e.slice(t)), r;
|
|
520
598
|
}
|
|
521
|
-
function
|
|
599
|
+
function qt(e) {
|
|
600
|
+
if (!e || typeof e != "object") return;
|
|
601
|
+
const r = e["x-search"];
|
|
602
|
+
return typeof (r == null ? void 0 : r.service) == "string" && r.service !== "" ? r.service : void 0;
|
|
603
|
+
}
|
|
604
|
+
function Rr(e) {
|
|
605
|
+
if (qt(e)) return e;
|
|
606
|
+
if (e.type === "array") {
|
|
607
|
+
const r = e.items;
|
|
608
|
+
if (r && !Array.isArray(r) && qt(r)) return r;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
const ho = ue(
|
|
612
|
+
4,
|
|
613
|
+
_e((e) => {
|
|
614
|
+
const r = Rr(e);
|
|
615
|
+
if (!r) return !1;
|
|
616
|
+
const t = r.type;
|
|
617
|
+
return t === "string" || t === "object";
|
|
618
|
+
})
|
|
619
|
+
);
|
|
620
|
+
function mo(e) {
|
|
522
621
|
if (typeof e == "string" && e.length > 0) return e;
|
|
523
622
|
if (e && typeof e == "object" && typeof e.value == "string") {
|
|
524
623
|
const r = e.value;
|
|
525
624
|
return r.length > 0 ? r : void 0;
|
|
526
625
|
}
|
|
527
626
|
}
|
|
528
|
-
function
|
|
627
|
+
function go(e) {
|
|
529
628
|
if (typeof e == "string") return e.length > 0 ? { parent: e } : void 0;
|
|
530
629
|
if (!e || typeof e != "object") return;
|
|
531
630
|
const r = Object.entries(e);
|
|
@@ -535,195 +634,298 @@ function pn(e) {
|
|
|
535
634
|
typeof o == "string" && o.length > 0 ? t[i] = o : n.push(i);
|
|
536
635
|
return n.length > 0 && console.warn(`x-search.dependsOn: ignoring invalid entries [${n.join(", ")}]`), Object.keys(t).length === 0 ? (console.warn("x-search.dependsOn: map has no valid entries; search will not fetch until fixed"), {}) : t;
|
|
537
636
|
}
|
|
538
|
-
function
|
|
637
|
+
function yo(e, r, t) {
|
|
539
638
|
const n = {};
|
|
540
639
|
for (const [i, o] of Object.entries(e))
|
|
541
|
-
n[i] =
|
|
640
|
+
n[i] = mo(Xe.data(r, t ? `${t}.${o}` : o));
|
|
542
641
|
return n;
|
|
543
642
|
}
|
|
544
|
-
function
|
|
545
|
-
|
|
643
|
+
function Kt(e) {
|
|
644
|
+
if (typeof e == "string" && e.length > 0) return { value: e };
|
|
645
|
+
if (e && typeof e == "object" && typeof e.value == "string") {
|
|
646
|
+
const r = e;
|
|
647
|
+
return { value: r.value, label: r.label };
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
function yt(e, r) {
|
|
651
|
+
return r ? { ...e, name: mt(r, e) } : e;
|
|
546
652
|
}
|
|
547
|
-
const
|
|
653
|
+
const bo = {
|
|
548
654
|
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
549
655
|
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
550
656
|
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
551
|
-
},
|
|
657
|
+
}, vo = ({
|
|
552
658
|
data: e,
|
|
553
659
|
handleChange: r,
|
|
554
660
|
path: t,
|
|
555
661
|
label: n,
|
|
556
662
|
required: i,
|
|
557
663
|
errors: o,
|
|
558
|
-
enabled:
|
|
664
|
+
enabled: l,
|
|
559
665
|
visible: a = !0,
|
|
560
666
|
schema: c,
|
|
561
667
|
uischema: u
|
|
562
668
|
}) => {
|
|
563
|
-
var
|
|
564
|
-
const d =
|
|
669
|
+
var $t, Pt, Ut, jt;
|
|
670
|
+
const d = c.type === "array", m = Rr(c) ?? c, f = m["x-search"] ?? {
|
|
565
671
|
service: "",
|
|
566
672
|
displayTemplate: ""
|
|
567
|
-
},
|
|
568
|
-
var
|
|
569
|
-
const
|
|
570
|
-
if (!
|
|
571
|
-
const
|
|
572
|
-
return { parentValues:
|
|
573
|
-
}, [
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
673
|
+
}, g = f.service ?? "", E = f.mode ?? "large-paginated-list", v = bo[E], z = (v == null ? void 0 : v.fetchOnOpen) ?? !1, R = typeof f.displayTemplate == "string" ? f.displayTemplate : "", j = Ne(), S = t.split(".").slice(0, -1).join("."), { parentValues: C, parentValuesKey: A, missingParent: T } = Se(() => {
|
|
674
|
+
var we;
|
|
675
|
+
const w = go(f.dependsOn);
|
|
676
|
+
if (!w) return { parentValues: void 0, parentValuesKey: "", missingParent: !1 };
|
|
677
|
+
const P = yo(w, (we = j.core) == null ? void 0 : we.data, S), oe = Object.keys(P).length === 0 || Object.values(P).some((ze) => !ze);
|
|
678
|
+
return { parentValues: P, parentValuesKey: JSON.stringify(P), missingParent: oe };
|
|
679
|
+
}, [f.dependsOn, ($t = j.core) == null ? void 0 : $t.data, S]), W = Se(() => C ? { ...f.params, ...C } : f.params, [C, A, f.params]), U = Nn(g), F = m.type === "object", M = typeof c.maxItems == "number" ? c.maxItems : void 0, x = Se(() => {
|
|
680
|
+
if (d)
|
|
681
|
+
return Array.isArray(e) ? e.map(Kt).filter((P) => !!P) : [];
|
|
682
|
+
const w = Kt(F || typeof e == "string" ? e : void 0);
|
|
683
|
+
return w ? [w] : [];
|
|
684
|
+
}, [e, d, F]), te = d || (Pt = x[0]) == null ? void 0 : Pt.value, H = d || (Ut = x[0]) == null ? void 0 : Ut.label, J = Se(() => new Set(x.map((w) => w.value)), [x]), B = x.length > 0, le = he({}), [ve, ne] = Y(0), ae = Se(() => {
|
|
685
|
+
const w = {};
|
|
686
|
+
for (const P of x)
|
|
687
|
+
w[P.value] = P.label || le.current[P.value] || P.value;
|
|
688
|
+
return w;
|
|
689
|
+
}, [x, ve]), $ = d && M !== void 0 && x.length >= M, Z = g ? U ? v ? R ? null : "x-search.displayTemplate is required." : `Invalid x-search.mode "${E}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${g}" is not registered.` : "Search not configured.", I = l !== !1, re = !o || o.length === 0, [Q, _] = Y(!1), [b, O] = Y(""), [V, G] = Y([]), [y, k] = Y(!1), [ee, se] = Y(!1), [ce, me] = Y(!1), [D, X] = Y(null), [de, K] = Y(void 0), q = he(void 0), xe = he(null), $e = he(null), et = he(null), fe = he(void 0), ke = he(void 0), qe = Be(
|
|
690
|
+
(w) => {
|
|
691
|
+
if (d) {
|
|
692
|
+
r(t, w.length > 0 ? w.map((oe) => F ? oe : oe.value) : void 0);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
const P = w[0];
|
|
696
|
+
if (!P) {
|
|
697
|
+
r(t, void 0);
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
r(t, F ? { value: P.value, label: P.label } : P.value);
|
|
701
|
+
},
|
|
702
|
+
[r, t, d, F]
|
|
703
|
+
);
|
|
704
|
+
ye(() => {
|
|
705
|
+
if (!C) return;
|
|
706
|
+
const w = ke.current;
|
|
707
|
+
if (ke.current = C, !w || !B) return;
|
|
708
|
+
Object.keys(C).some((oe) => w[oe] !== void 0 && w[oe] !== C[oe]) && r(t, void 0);
|
|
709
|
+
}, [A, B, r, t]), ye(() => {
|
|
710
|
+
var we, ze;
|
|
711
|
+
if (d) {
|
|
712
|
+
if (Z || F) return;
|
|
713
|
+
const Pe = x.filter((We) => !We.label && !le.current[We.value]);
|
|
714
|
+
if (Pe.length === 0 || !(U != null && U.resolve)) return;
|
|
715
|
+
let Ve = !1;
|
|
716
|
+
return Promise.all(
|
|
717
|
+
Pe.map(async (We) => {
|
|
718
|
+
try {
|
|
719
|
+
const _t = await U.resolve(We.value, W);
|
|
720
|
+
if (Ve || !_t) return;
|
|
721
|
+
le.current[We.value] = yt(_t, R).name;
|
|
722
|
+
} catch {
|
|
723
|
+
}
|
|
724
|
+
})
|
|
725
|
+
).then(() => {
|
|
726
|
+
Ve || ne((We) => We + 1);
|
|
727
|
+
}), () => {
|
|
728
|
+
Ve = !0;
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
if (Z) {
|
|
732
|
+
K(void 0), fe.current = void 0;
|
|
583
733
|
return;
|
|
584
734
|
}
|
|
585
|
-
if (!
|
|
586
|
-
|
|
735
|
+
if (!te) {
|
|
736
|
+
K(void 0), fe.current = void 0;
|
|
587
737
|
return;
|
|
588
738
|
}
|
|
589
|
-
if (((
|
|
590
|
-
if (
|
|
591
|
-
|
|
739
|
+
if (((we = fe.current) == null ? void 0 : we.value) === te && ((ze = fe.current) == null ? void 0 : ze.label) === H) return;
|
|
740
|
+
if (F && H) {
|
|
741
|
+
K({ id: te, name: H }), fe.current = { value: te, label: H };
|
|
592
742
|
return;
|
|
593
743
|
}
|
|
594
|
-
if (
|
|
595
|
-
|
|
744
|
+
if (K({ id: te, name: H ?? te }), !(U != null && U.resolve)) {
|
|
745
|
+
fe.current = { value: te, label: H };
|
|
596
746
|
return;
|
|
597
747
|
}
|
|
598
|
-
let
|
|
599
|
-
const
|
|
600
|
-
return
|
|
601
|
-
|
|
748
|
+
let w = !1;
|
|
749
|
+
const P = te, oe = H;
|
|
750
|
+
return U.resolve(P, W).then((Pe) => {
|
|
751
|
+
w || (Pe && K(yt(Pe, R)), fe.current = { value: P, label: oe });
|
|
602
752
|
}).catch(() => {
|
|
603
|
-
|
|
753
|
+
w || (fe.current = { value: P, label: oe });
|
|
604
754
|
}), () => {
|
|
605
|
-
|
|
755
|
+
w = !0;
|
|
606
756
|
};
|
|
607
|
-
}, [
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
757
|
+
}, [
|
|
758
|
+
Z,
|
|
759
|
+
te,
|
|
760
|
+
H,
|
|
761
|
+
F,
|
|
762
|
+
d,
|
|
763
|
+
x,
|
|
764
|
+
U,
|
|
765
|
+
W,
|
|
766
|
+
R
|
|
767
|
+
]);
|
|
768
|
+
const Ke = Be(
|
|
769
|
+
async (w, P = !1) => {
|
|
770
|
+
var we;
|
|
771
|
+
if (Z) return;
|
|
772
|
+
if (!U) {
|
|
773
|
+
X("Search service not configured.");
|
|
614
774
|
return;
|
|
615
775
|
}
|
|
616
|
-
(
|
|
617
|
-
const
|
|
618
|
-
|
|
776
|
+
(we = $e.current) == null || we.abort();
|
|
777
|
+
const oe = new AbortController();
|
|
778
|
+
$e.current = oe, P ? me(!0) : (se(!0), me(!1), X(null));
|
|
619
779
|
try {
|
|
620
|
-
const
|
|
621
|
-
query:
|
|
622
|
-
cursor:
|
|
623
|
-
signal:
|
|
624
|
-
params:
|
|
780
|
+
const ze = await U.search({
|
|
781
|
+
query: w,
|
|
782
|
+
cursor: P ? q.current : void 0,
|
|
783
|
+
signal: oe.signal,
|
|
784
|
+
params: W
|
|
625
785
|
});
|
|
626
|
-
if (
|
|
627
|
-
const
|
|
628
|
-
|
|
786
|
+
if (oe.signal.aborted) return;
|
|
787
|
+
const Pe = (ze.options ?? []).map((Ve) => yt(Ve, R));
|
|
788
|
+
G(P ? (Ve) => [...Ve, ...Pe] : Pe), q.current = ze.nextCursor, k(((v == null ? void 0 : v.paginated) ?? !1) && ze.nextCursor != null);
|
|
629
789
|
} catch {
|
|
630
|
-
if (
|
|
631
|
-
|
|
790
|
+
if (oe.signal.aborted) return;
|
|
791
|
+
X("Failed to load results. Please try again.");
|
|
632
792
|
} finally {
|
|
633
|
-
|
|
793
|
+
oe.signal.aborted || (P ? me(!1) : se(!1));
|
|
634
794
|
}
|
|
635
795
|
},
|
|
636
|
-
[
|
|
796
|
+
[Z, U, v == null ? void 0 : v.paginated, W, R]
|
|
637
797
|
);
|
|
638
|
-
|
|
639
|
-
if (!
|
|
640
|
-
const
|
|
641
|
-
|
|
798
|
+
ye(() => {
|
|
799
|
+
if (!Q) return;
|
|
800
|
+
const w = (P) => {
|
|
801
|
+
et.current && !et.current.contains(P.target) && _(!1);
|
|
642
802
|
};
|
|
643
|
-
return document.addEventListener("mousedown",
|
|
644
|
-
}, [
|
|
645
|
-
var
|
|
646
|
-
|
|
647
|
-
}, [
|
|
648
|
-
if (!
|
|
649
|
-
if (
|
|
650
|
-
|
|
803
|
+
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
804
|
+
}, [Q]), ye(() => {
|
|
805
|
+
var w;
|
|
806
|
+
Q || ((w = $e.current) == null || w.abort(), O(""), G([]), k(!1), X(null), se(!1), me(!1), q.current = void 0);
|
|
807
|
+
}, [Q]), ye(() => {
|
|
808
|
+
if (!Q) return;
|
|
809
|
+
if (T) {
|
|
810
|
+
G([]), k(!1), X(null), q.current = void 0;
|
|
651
811
|
return;
|
|
652
812
|
}
|
|
653
|
-
if (!
|
|
654
|
-
|
|
813
|
+
if (!b && !z) {
|
|
814
|
+
G([]), k(!1), X(null), q.current = void 0;
|
|
655
815
|
return;
|
|
656
816
|
}
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
return
|
|
660
|
-
|
|
661
|
-
},
|
|
662
|
-
|
|
817
|
+
xe.current && clearTimeout(xe.current);
|
|
818
|
+
const w = b ? 300 : 0;
|
|
819
|
+
return xe.current = setTimeout(() => {
|
|
820
|
+
G([]), k(!1), q.current = void 0, Ke(b);
|
|
821
|
+
}, w), () => {
|
|
822
|
+
xe.current && clearTimeout(xe.current);
|
|
663
823
|
};
|
|
664
|
-
}, [
|
|
665
|
-
const
|
|
824
|
+
}, [b, Q, z, Ke, T, A]), Le(a, t, r);
|
|
825
|
+
const it = Ce(t, i, a);
|
|
666
826
|
if (a === !1)
|
|
667
827
|
return null;
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
},
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
828
|
+
const zt = () => {
|
|
829
|
+
O(""), G([]), k(!1), X(null), q.current = void 0, _(!0);
|
|
830
|
+
}, Yr = (w) => {
|
|
831
|
+
if (d) {
|
|
832
|
+
const P = J.has(w.id);
|
|
833
|
+
if (!P && $) return;
|
|
834
|
+
const oe = P ? x.filter((we) => we.value !== w.id) : [...x, { value: w.id, label: w.name }];
|
|
835
|
+
P || (le.current[w.id] = w.name, ne((we) => we + 1)), qe(oe), O("");
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
qe([{ value: w.id, label: w.name }]), K(w), fe.current = { value: w.id, label: F ? w.name : void 0 }, _(!1);
|
|
839
|
+
}, Mt = (w) => {
|
|
840
|
+
w.stopPropagation(), r(t, void 0), K(void 0);
|
|
841
|
+
}, Ft = (w, P) => {
|
|
842
|
+
w.stopPropagation(), qe(x.filter((oe) => oe.value !== P));
|
|
843
|
+
}, Gr = (w) => {
|
|
844
|
+
(w.key === "Enter" || w.key === " ") && Mt(w);
|
|
845
|
+
}, Jr = ((jt = u == null ? void 0 : u.options) == null ? void 0 : jt.placeholder) ?? "Select an option", Zr = d ? "" : (de == null ? void 0 : de.name) ?? "";
|
|
846
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
847
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
679
848
|
n,
|
|
680
849
|
" ",
|
|
681
|
-
|
|
850
|
+
it && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
682
851
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
|
|
685
|
-
|
|
852
|
+
d && x.length > 0 && /* @__PURE__ */ s(L, { gap: "1", wrap: "wrap", mb: "1", children: x.map((w) => /* @__PURE__ */ p(
|
|
853
|
+
L,
|
|
854
|
+
{
|
|
855
|
+
align: "center",
|
|
856
|
+
gap: "1",
|
|
857
|
+
px: "2",
|
|
858
|
+
py: "1",
|
|
859
|
+
style: {
|
|
860
|
+
background: "var(--accent-3)",
|
|
861
|
+
borderRadius: "var(--radius-2)",
|
|
862
|
+
fontSize: "var(--font-size-1)"
|
|
863
|
+
},
|
|
864
|
+
children: [
|
|
865
|
+
/* @__PURE__ */ s(h, { size: "1", children: ae[w.value] ?? w.value }),
|
|
866
|
+
I && /* @__PURE__ */ s(
|
|
867
|
+
"span",
|
|
868
|
+
{
|
|
869
|
+
role: "button",
|
|
870
|
+
tabIndex: 0,
|
|
871
|
+
"aria-label": `Remove ${ae[w.value] ?? w.value}`,
|
|
872
|
+
onMouseDown: (P) => P.preventDefault(),
|
|
873
|
+
onClick: (P) => Ft(P, w.value),
|
|
874
|
+
onKeyDown: (P) => {
|
|
875
|
+
(P.key === "Enter" || P.key === " ") && Ft(P, w.value);
|
|
876
|
+
},
|
|
877
|
+
style: { lineHeight: 1, color: "var(--gray-11)", cursor: "pointer" },
|
|
878
|
+
children: "×"
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
]
|
|
882
|
+
},
|
|
883
|
+
w.value
|
|
884
|
+
)) }),
|
|
885
|
+
/* @__PURE__ */ p("div", { ref: et, style: { position: "relative" }, children: [
|
|
886
|
+
/* @__PURE__ */ s(
|
|
887
|
+
Fe.Root,
|
|
686
888
|
{
|
|
687
889
|
id: t,
|
|
688
|
-
value:
|
|
689
|
-
placeholder:
|
|
690
|
-
disabled: !
|
|
691
|
-
readOnly:
|
|
692
|
-
style:
|
|
693
|
-
onChange: (
|
|
694
|
-
|
|
890
|
+
value: Q ? b : Zr,
|
|
891
|
+
placeholder: Q && (v != null && v.searchable) ? "Search..." : Jr,
|
|
892
|
+
disabled: !I,
|
|
893
|
+
readOnly: Q && !(v != null && v.searchable) || d && !Q,
|
|
894
|
+
style: re ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
895
|
+
onChange: (w) => {
|
|
896
|
+
v != null && v.searchable && (O(w.target.value), Q || zt());
|
|
695
897
|
},
|
|
696
898
|
onFocus: () => {
|
|
697
|
-
|
|
899
|
+
I && !Q && zt();
|
|
698
900
|
},
|
|
699
|
-
onKeyDown: (
|
|
700
|
-
|
|
901
|
+
onKeyDown: (w) => {
|
|
902
|
+
w.key === "Escape" && _(!1);
|
|
701
903
|
},
|
|
702
|
-
children: /* @__PURE__ */
|
|
703
|
-
|
|
904
|
+
children: /* @__PURE__ */ s(Fe.Slot, { side: "right", children: /* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
|
|
905
|
+
B && I && /* @__PURE__ */ s(
|
|
704
906
|
"span",
|
|
705
907
|
{
|
|
706
908
|
role: "button",
|
|
707
909
|
tabIndex: 0,
|
|
708
|
-
onMouseDown: (
|
|
709
|
-
onClick:
|
|
710
|
-
onKeyDown:
|
|
910
|
+
onMouseDown: (w) => w.preventDefault(),
|
|
911
|
+
onClick: Mt,
|
|
912
|
+
onKeyDown: Gr,
|
|
711
913
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
712
914
|
"aria-label": "Clear selection",
|
|
713
915
|
children: "×"
|
|
714
916
|
}
|
|
715
917
|
),
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
|
|
918
|
+
/* @__PURE__ */ s(
|
|
919
|
+
br,
|
|
718
920
|
{
|
|
719
|
-
style: { transform:
|
|
921
|
+
style: { transform: Q ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
720
922
|
}
|
|
721
923
|
)
|
|
722
924
|
] }) })
|
|
723
925
|
}
|
|
724
926
|
),
|
|
725
|
-
|
|
726
|
-
|
|
927
|
+
Q && /* @__PURE__ */ s(
|
|
928
|
+
N,
|
|
727
929
|
{
|
|
728
930
|
style: {
|
|
729
931
|
position: "absolute",
|
|
@@ -737,153 +939,535 @@ const mn = {
|
|
|
737
939
|
border: "1px solid var(--gray-a6)",
|
|
738
940
|
overflow: "hidden"
|
|
739
941
|
},
|
|
740
|
-
children:
|
|
741
|
-
|
|
742
|
-
!
|
|
743
|
-
!
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
942
|
+
children: Z ? /* @__PURE__ */ s(N, { p: "3", children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: Z }) }) : /* @__PURE__ */ s(gr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ p(N, { p: "1", children: [
|
|
943
|
+
ee && /* @__PURE__ */ s(L, { justify: "center", p: "4", children: /* @__PURE__ */ s(Je, {}) }),
|
|
944
|
+
!ee && D && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(h, { size: "2", color: "red", children: D }) }),
|
|
945
|
+
!ee && !D && V.length === 0 && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: T ? "Select the related field first." : b || z ? "No results found." : "Type to search…" }) }),
|
|
946
|
+
V.map((w) => {
|
|
947
|
+
const P = J.has(w.id), oe = $ && !P;
|
|
948
|
+
return /* @__PURE__ */ s(
|
|
949
|
+
N,
|
|
950
|
+
{
|
|
951
|
+
px: "3",
|
|
952
|
+
py: "2",
|
|
953
|
+
onMouseDown: (we) => we.preventDefault(),
|
|
954
|
+
onClick: () => {
|
|
955
|
+
oe || Yr(w);
|
|
956
|
+
},
|
|
957
|
+
"aria-disabled": oe || void 0,
|
|
958
|
+
style: {
|
|
959
|
+
cursor: oe ? "not-allowed" : "pointer",
|
|
960
|
+
opacity: oe ? 0.5 : 1,
|
|
961
|
+
borderRadius: "var(--radius-2)",
|
|
962
|
+
backgroundColor: P ? "var(--accent-3)" : void 0
|
|
963
|
+
},
|
|
964
|
+
className: oe ? void 0 : "hover:bg-(--gray-3)",
|
|
965
|
+
children: /* @__PURE__ */ p(L, { align: "center", justify: "between", gap: "2", children: [
|
|
966
|
+
/* @__PURE__ */ s(h, { size: "2", children: w.name }),
|
|
967
|
+
d && P && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: "✓" })
|
|
968
|
+
] })
|
|
755
969
|
},
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
(f == null ? void 0 : f.paginated) && k && !pe && /* @__PURE__ */ l(M, { px: "3", py: "2", children: /* @__PURE__ */ l(
|
|
762
|
-
Ue,
|
|
970
|
+
w.id
|
|
971
|
+
);
|
|
972
|
+
}),
|
|
973
|
+
(v == null ? void 0 : v.paginated) && y && !ce && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(
|
|
974
|
+
Re,
|
|
763
975
|
{
|
|
764
976
|
variant: "ghost",
|
|
765
977
|
size: "1",
|
|
766
978
|
style: { width: "100%" },
|
|
767
|
-
onMouseDown: (
|
|
768
|
-
onClick: () => void
|
|
979
|
+
onMouseDown: (w) => w.preventDefault(),
|
|
980
|
+
onClick: () => void Ke(b, !0),
|
|
769
981
|
children: "Load more"
|
|
770
982
|
}
|
|
771
983
|
) }),
|
|
772
|
-
|
|
984
|
+
ce && /* @__PURE__ */ s(L, { justify: "center", p: "2", children: /* @__PURE__ */ s(Je, {}) })
|
|
773
985
|
] }) })
|
|
774
986
|
}
|
|
775
987
|
)
|
|
776
988
|
] }),
|
|
777
|
-
!
|
|
778
|
-
c.description && /* @__PURE__ */
|
|
989
|
+
!re && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
|
|
990
|
+
c.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: c.description })
|
|
779
991
|
] }) });
|
|
780
|
-
},
|
|
781
|
-
3,
|
|
782
|
-
ze((e) => {
|
|
783
|
-
const r = e["x-search"];
|
|
784
|
-
return (e.type === "string" || e.type === "object") && typeof (r == null ? void 0 : r.service) == "string" && r.service !== "";
|
|
785
|
-
})
|
|
786
|
-
), vn = (e) => {
|
|
992
|
+
}, wo = Ee(vo), Eo = (e) => {
|
|
787
993
|
if (e)
|
|
788
994
|
return /^\d{2}:\d{2}$/.test(e) ? `${e}:00` : e;
|
|
789
|
-
},
|
|
995
|
+
}, Yt = (e, r) => {
|
|
790
996
|
if (!e) return "";
|
|
791
997
|
const t = e.match(/^(\d{2}:\d{2})(:\d{2})?/);
|
|
792
998
|
return t ? r ? `${t[1]}${t[2] ?? ":00"}` : t[1] : e;
|
|
793
|
-
},
|
|
794
|
-
const
|
|
795
|
-
return /* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
999
|
+
}, xo = (e, r) => vr(`${e}T${r}`).format(), To = ({ path: e, label: r, required: t, errors: n, description: i, children: o }) => {
|
|
1000
|
+
const l = n.length === 0;
|
|
1001
|
+
return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
1002
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
|
|
797
1003
|
r,
|
|
798
1004
|
" ",
|
|
799
|
-
t && /* @__PURE__ */
|
|
1005
|
+
t && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
800
1006
|
] }),
|
|
801
1007
|
o,
|
|
802
|
-
!
|
|
803
|
-
i && /* @__PURE__ */
|
|
1008
|
+
!l && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(n, r) }),
|
|
1009
|
+
i && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: i })
|
|
804
1010
|
] }) });
|
|
805
|
-
},
|
|
1011
|
+
}, Ao = ({
|
|
806
1012
|
data: e,
|
|
807
1013
|
handleChange: r,
|
|
808
1014
|
path: t,
|
|
809
1015
|
label: n,
|
|
810
1016
|
required: i,
|
|
811
1017
|
errors: o,
|
|
812
|
-
schema:
|
|
1018
|
+
schema: l,
|
|
813
1019
|
uischema: a,
|
|
814
1020
|
enabled: c,
|
|
815
1021
|
visible: u = !0
|
|
816
1022
|
}) => {
|
|
817
|
-
var
|
|
818
|
-
|
|
1023
|
+
var A;
|
|
1024
|
+
ye(() => {
|
|
819
1025
|
u === !1 && r(t, void 0);
|
|
820
1026
|
}, [u, t, r]);
|
|
821
|
-
const d =
|
|
1027
|
+
const d = Ce(t, i, u);
|
|
822
1028
|
if (u === !1)
|
|
823
1029
|
return null;
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
826
|
-
return
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
|
|
1030
|
+
const m = o.length === 0, f = typeof e == "string" ? e : "", g = ((A = a == null ? void 0 : a.options) == null ? void 0 : A.showSeconds) === !0, E = g ? 1 : 60, v = (T) => /* @__PURE__ */ s(To, { path: t, label: n, required: d, errors: o, description: l.description, children: T });
|
|
1031
|
+
if (l.format === "time")
|
|
1032
|
+
return v(
|
|
1033
|
+
/* @__PURE__ */ s(
|
|
1034
|
+
Fe.Root,
|
|
829
1035
|
{
|
|
830
1036
|
type: "time",
|
|
831
|
-
step:
|
|
832
|
-
value:
|
|
833
|
-
onChange: (
|
|
1037
|
+
step: E,
|
|
1038
|
+
value: Yt(f, g),
|
|
1039
|
+
onChange: (T) => r(t, Eo(T.target.value)),
|
|
834
1040
|
disabled: !c,
|
|
835
|
-
color:
|
|
1041
|
+
color: m ? void 0 : "red",
|
|
836
1042
|
id: t
|
|
837
1043
|
}
|
|
838
1044
|
)
|
|
839
1045
|
);
|
|
840
|
-
const
|
|
841
|
-
if (!
|
|
1046
|
+
const z = l.format === "date-time", [R = "", j = ""] = f.split("T"), S = Yt(j, g), C = (T, W) => {
|
|
1047
|
+
if (!T) {
|
|
842
1048
|
r(t, void 0);
|
|
843
1049
|
return;
|
|
844
1050
|
}
|
|
845
|
-
r(t,
|
|
1051
|
+
r(t, z ? xo(T, W || "00:00") : T);
|
|
846
1052
|
};
|
|
847
|
-
return
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
|
|
1053
|
+
return v(
|
|
1054
|
+
/* @__PURE__ */ p(L, { gap: "2", align: "center", children: [
|
|
1055
|
+
/* @__PURE__ */ s(
|
|
1056
|
+
Fe.Root,
|
|
851
1057
|
{
|
|
852
1058
|
type: "date",
|
|
853
|
-
value:
|
|
1059
|
+
value: R,
|
|
854
1060
|
disabled: !c,
|
|
855
|
-
color:
|
|
856
|
-
onChange: (
|
|
1061
|
+
color: m ? void 0 : "red",
|
|
1062
|
+
onChange: (T) => C(T.target.value, S),
|
|
857
1063
|
id: t,
|
|
858
1064
|
style: { flex: 1 }
|
|
859
1065
|
}
|
|
860
1066
|
),
|
|
861
|
-
|
|
862
|
-
|
|
1067
|
+
z && /* @__PURE__ */ s(
|
|
1068
|
+
Fe.Root,
|
|
863
1069
|
{
|
|
864
1070
|
type: "time",
|
|
865
|
-
step:
|
|
866
|
-
value:
|
|
867
|
-
disabled: !c || !
|
|
868
|
-
color:
|
|
869
|
-
onChange: (
|
|
1071
|
+
step: E,
|
|
1072
|
+
value: S,
|
|
1073
|
+
disabled: !c || !R,
|
|
1074
|
+
color: m ? void 0 : "red",
|
|
1075
|
+
onChange: (T) => C(R, T.target.value),
|
|
870
1076
|
style: { flex: 1 }
|
|
871
1077
|
}
|
|
872
1078
|
)
|
|
873
1079
|
] })
|
|
874
1080
|
);
|
|
875
|
-
},
|
|
1081
|
+
}, So = ue(2, pt(un, dn, fn)), Ro = Ee(Ao), bt = "var(--form-steps-offset, 16px)", Co = (e) => e.enabled ? /* @__PURE__ */ s(Oo, { ...e }) : /* @__PURE__ */ s(Do, { ...e }), Oo = ({ uischema: e, schema: r, path: t, renderers: n, cells: i, enabled: o }) => {
|
|
1082
|
+
var _;
|
|
1083
|
+
const l = Ne(), a = l.core, c = Tr(), u = (a == null ? void 0 : a.schema) ?? r, d = a == null ? void 0 : a.data, m = a == null ? void 0 : a.ajv, f = l.config, g = (_ = l.i18n) == null ? void 0 : _.translate, E = (b, O) => _n(g, b, O), v = Cr(e, t), z = v.length, R = z, j = Se(
|
|
1084
|
+
() => [...(a == null ? void 0 : a.errors) ?? [], ...(a == null ? void 0 : a.additionalErrors) ?? []],
|
|
1085
|
+
[a == null ? void 0 : a.errors, a == null ? void 0 : a.additionalErrors]
|
|
1086
|
+
), S = Se(
|
|
1087
|
+
() => v.map(
|
|
1088
|
+
(b) => $n(ut(b, d, m, f, t), j, u, t, g)
|
|
1089
|
+
),
|
|
1090
|
+
// categories is rebuilt every render; its content follows uischema, data and rules.
|
|
1091
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1092
|
+
[e, t, d, m, f, j, u, g]
|
|
1093
|
+
), [C, A] = Y(0), [T, W] = Y(() => {
|
|
1094
|
+
const b = (V, G) => S[G].length === 0 && Un(ut(V, d, m, f, t), d, t), O = v.findIndex((V, G) => !b(V, G));
|
|
1095
|
+
return O === -1 ? R : O;
|
|
1096
|
+
}), [U, F] = Y(/* @__PURE__ */ new Set()), M = Math.min(C, R), x = M === R, te = ur(() => {
|
|
1097
|
+
var b;
|
|
1098
|
+
return (b = c == null ? void 0 : c.onStepChange) == null ? void 0 : b.call(c, { step: M, count: z, last: M === R });
|
|
1099
|
+
});
|
|
1100
|
+
ye(() => {
|
|
1101
|
+
te();
|
|
1102
|
+
}, [M, z, R]);
|
|
1103
|
+
const H = he(null), J = he(null), B = he(M);
|
|
1104
|
+
if (ye(() => {
|
|
1105
|
+
var V, G;
|
|
1106
|
+
if (B.current === M) return;
|
|
1107
|
+
B.current = M;
|
|
1108
|
+
const b = H.current, O = b && parseFloat(getComputedStyle(b).scrollMarginTop) || 0;
|
|
1109
|
+
b && b.getBoundingClientRect().top < O && ((V = b.scrollIntoView) == null || V.call(b, { block: "start", behavior: "smooth" })), (G = J.current) == null || G.focus({ preventScroll: !0 });
|
|
1110
|
+
}, [M]), !z) return null;
|
|
1111
|
+
const le = (b) => {
|
|
1112
|
+
b > T && b !== M || A(b);
|
|
1113
|
+
}, ve = () => {
|
|
1114
|
+
var O, V;
|
|
1115
|
+
if ((O = S[M]) != null && O.length) {
|
|
1116
|
+
F((G) => new Set(G).add(M)), (V = c == null ? void 0 : c.onInvalidStep) == null || V.call(c);
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
const b = Math.min(M + 1, R);
|
|
1120
|
+
A(b), W((G) => Math.max(G, b));
|
|
1121
|
+
}, ne = [...v.map((b) => kr(b, g)), E("review")], ae = ne.length, $ = (b) => {
|
|
1122
|
+
var O;
|
|
1123
|
+
return b === M ? "current" : b < z && ((O = S[b]) != null && O.length) && (U.has(b) || b < T) ? "error" : b < T || b < z && b < M ? "done" : "todo";
|
|
1124
|
+
}, Z = (b, O) => {
|
|
1125
|
+
var V;
|
|
1126
|
+
return O === "error" || O === "current" && U.has(b) ? ((V = S[b]) == null ? void 0 : V.length) ?? 0 : 0;
|
|
1127
|
+
}, I = (b, O) => {
|
|
1128
|
+
if (b === R) return E("noteReview");
|
|
1129
|
+
if (Z(b, O) > 0) return E("noteToFix", { count: Z(b, O) });
|
|
1130
|
+
if (O === "done") return E("noteDone");
|
|
1131
|
+
const V = Pn(ut(v[b], d, m, f, t), d, t), G = V.count === 1;
|
|
1132
|
+
return V.kind === "items" ? E(G ? "noteItem" : "noteItems", { count: V.count }) : E(G ? "noteField" : "noteFields", { count: V.count });
|
|
1133
|
+
}, re = x ? void 0 : No(v[M], g), Q = S.map((b, O) => ({ index: O, p: b })).filter(({ p: b }) => b.length).map(({ index: b, p: O }) => ({
|
|
1134
|
+
key: String(b),
|
|
1135
|
+
label: `${ne[b]}: ${O.map((V) => V.label).join(", ")}`,
|
|
1136
|
+
onClick: () => {
|
|
1137
|
+
F((V) => new Set(V).add(b)), le(b);
|
|
1138
|
+
}
|
|
1139
|
+
}));
|
|
1140
|
+
return /* @__PURE__ */ p(L, { ref: H, gap: "5", align: "start", style: { scrollMarginTop: bt }, children: [
|
|
1141
|
+
/* @__PURE__ */ s(
|
|
1142
|
+
N,
|
|
1143
|
+
{
|
|
1144
|
+
asChild: !0,
|
|
1145
|
+
display: { initial: "none", sm: "block" },
|
|
1146
|
+
p: "4",
|
|
1147
|
+
style: {
|
|
1148
|
+
...wt,
|
|
1149
|
+
flex: "0 0 248px",
|
|
1150
|
+
position: "sticky",
|
|
1151
|
+
top: bt,
|
|
1152
|
+
maxHeight: `calc(100vh - 2 * ${bt})`,
|
|
1153
|
+
overflowY: "auto"
|
|
1154
|
+
},
|
|
1155
|
+
children: /* @__PURE__ */ s("nav", { "aria-label": E("navLabel"), children: /* @__PURE__ */ s("ol", { style: { listStyle: "none", margin: 0, padding: 0 }, children: ne.map((b, O) => {
|
|
1156
|
+
const V = $(O);
|
|
1157
|
+
return /* @__PURE__ */ p("li", { style: { position: "relative" }, children: [
|
|
1158
|
+
O < ae - 1 && /* @__PURE__ */ s(
|
|
1159
|
+
"span",
|
|
1160
|
+
{
|
|
1161
|
+
"aria-hidden": !0,
|
|
1162
|
+
style: {
|
|
1163
|
+
position: "absolute",
|
|
1164
|
+
left: 21,
|
|
1165
|
+
top: 40,
|
|
1166
|
+
bottom: -4,
|
|
1167
|
+
width: 2,
|
|
1168
|
+
borderRadius: 1,
|
|
1169
|
+
background: V === "done" ? "var(--green-9)" : "var(--gray-a5)"
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
),
|
|
1173
|
+
/* @__PURE__ */ s(
|
|
1174
|
+
ko,
|
|
1175
|
+
{
|
|
1176
|
+
index: O,
|
|
1177
|
+
label: b,
|
|
1178
|
+
note: I(O, V),
|
|
1179
|
+
errorCount: Z(O, V),
|
|
1180
|
+
status: V,
|
|
1181
|
+
disabled: O > T,
|
|
1182
|
+
onSelect: () => le(O)
|
|
1183
|
+
}
|
|
1184
|
+
)
|
|
1185
|
+
] }, `${t}-step-${O}`);
|
|
1186
|
+
}) }) })
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ p(N, { style: { ...wt, flex: 1, minWidth: 0 }, children: [
|
|
1190
|
+
/* @__PURE__ */ p(N, { px: { initial: "4", sm: "6" }, pt: { initial: "4", sm: "5" }, pb: "4", children: [
|
|
1191
|
+
/* @__PURE__ */ s(
|
|
1192
|
+
h,
|
|
1193
|
+
{
|
|
1194
|
+
as: "p",
|
|
1195
|
+
size: "1",
|
|
1196
|
+
weight: "bold",
|
|
1197
|
+
color: "gray",
|
|
1198
|
+
style: { letterSpacing: "0.06em", textTransform: "uppercase" },
|
|
1199
|
+
children: E("stepOf", { step: M + 1, total: ae })
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
/* @__PURE__ */ s(tt, { ref: J, tabIndex: -1, size: "5", as: "h2", mt: "1", style: { outline: "none" }, children: ne[M] }),
|
|
1203
|
+
re && /* @__PURE__ */ s(h, { as: "p", size: "2", color: "gray", mt: "1", children: re }),
|
|
1204
|
+
/* @__PURE__ */ s(Tn, { value: (M + 1) / ae * 100, size: "1", mt: "4", "aria-label": E("progressLabel") })
|
|
1205
|
+
] }),
|
|
1206
|
+
/* @__PURE__ */ p(N, { px: { initial: "4", sm: "6" }, pb: "5", "data-form-review": x ? "" : void 0, children: [
|
|
1207
|
+
x && (Q.length ? /* @__PURE__ */ s(Gt, { title: E("incompleteSteps"), items: Q }) : /* @__PURE__ */ s(h, { as: "p", size: "2", color: "gray", mb: "5", children: E("reviewHint") })),
|
|
1208
|
+
v.map((b, O) => /* @__PURE__ */ p(N, { hidden: !(x || O === M), mb: x ? "6" : void 0, children: [
|
|
1209
|
+
x && /* @__PURE__ */ p(
|
|
1210
|
+
L,
|
|
1211
|
+
{
|
|
1212
|
+
justify: "between",
|
|
1213
|
+
align: "center",
|
|
1214
|
+
mb: "3",
|
|
1215
|
+
pb: "2",
|
|
1216
|
+
style: { borderBottom: "1px solid var(--gray-a4)" },
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ s(tt, { size: "3", as: "h3", children: ne[O] }),
|
|
1219
|
+
/* @__PURE__ */ s(
|
|
1220
|
+
Re,
|
|
1221
|
+
{
|
|
1222
|
+
type: "button",
|
|
1223
|
+
variant: "ghost",
|
|
1224
|
+
onClick: () => le(O),
|
|
1225
|
+
"aria-label": E("editStep", { step: ne[O] }),
|
|
1226
|
+
children: E("edit")
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1229
|
+
]
|
|
1230
|
+
}
|
|
1231
|
+
),
|
|
1232
|
+
!x && U.has(O) && S[O].length > 0 && /* @__PURE__ */ s(
|
|
1233
|
+
Gt,
|
|
1234
|
+
{
|
|
1235
|
+
title: E("missingFields"),
|
|
1236
|
+
items: S[O].map((G) => ({
|
|
1237
|
+
key: G.path,
|
|
1238
|
+
label: G.label,
|
|
1239
|
+
onClick: () => Io(G.path)
|
|
1240
|
+
}))
|
|
1241
|
+
}
|
|
1242
|
+
),
|
|
1243
|
+
/* @__PURE__ */ s(
|
|
1244
|
+
Or,
|
|
1245
|
+
{
|
|
1246
|
+
category: b,
|
|
1247
|
+
schema: r,
|
|
1248
|
+
path: t,
|
|
1249
|
+
renderers: n,
|
|
1250
|
+
cells: i,
|
|
1251
|
+
enabled: o && !x
|
|
1252
|
+
}
|
|
1253
|
+
)
|
|
1254
|
+
] }, `${t}-${O}`))
|
|
1255
|
+
] }),
|
|
1256
|
+
/* @__PURE__ */ p(
|
|
1257
|
+
L,
|
|
1258
|
+
{
|
|
1259
|
+
gap: "3",
|
|
1260
|
+
align: "center",
|
|
1261
|
+
wrap: "wrap",
|
|
1262
|
+
px: { initial: "4", sm: "6" },
|
|
1263
|
+
py: "4",
|
|
1264
|
+
style: {
|
|
1265
|
+
position: "sticky",
|
|
1266
|
+
bottom: 0,
|
|
1267
|
+
zIndex: 1,
|
|
1268
|
+
borderTop: "1px solid var(--gray-a5)",
|
|
1269
|
+
background: "var(--color-panel-solid)",
|
|
1270
|
+
borderRadius: "0 0 var(--radius-5) var(--radius-5)"
|
|
1271
|
+
},
|
|
1272
|
+
children: [
|
|
1273
|
+
M > 0 && /* @__PURE__ */ p(Re, { type: "button", variant: "ghost", color: "gray", size: "3", onClick: () => A(M - 1), children: [
|
|
1274
|
+
/* @__PURE__ */ s(An, {}),
|
|
1275
|
+
E("back")
|
|
1276
|
+
] }),
|
|
1277
|
+
/* @__PURE__ */ s(N, { flexGrow: "1" }),
|
|
1278
|
+
c == null ? void 0 : c.actions,
|
|
1279
|
+
M < R && /* @__PURE__ */ p(Re, { type: "button", size: "3", onClick: ve, children: [
|
|
1280
|
+
E("continue"),
|
|
1281
|
+
/* @__PURE__ */ s(Sn, {})
|
|
1282
|
+
] })
|
|
1283
|
+
]
|
|
1284
|
+
}
|
|
1285
|
+
)
|
|
1286
|
+
] })
|
|
1287
|
+
] });
|
|
1288
|
+
}, wt = {
|
|
1289
|
+
background: "var(--color-panel-solid)",
|
|
1290
|
+
border: "1px solid var(--gray-a4)",
|
|
1291
|
+
borderRadius: "var(--radius-5)",
|
|
1292
|
+
boxShadow: "var(--shadow-2)"
|
|
1293
|
+
};
|
|
1294
|
+
function ko({
|
|
1295
|
+
index: e,
|
|
1296
|
+
label: r,
|
|
1297
|
+
note: t,
|
|
1298
|
+
errorCount: n,
|
|
1299
|
+
status: i,
|
|
1300
|
+
disabled: o,
|
|
1301
|
+
onSelect: l
|
|
1302
|
+
}) {
|
|
1303
|
+
return /* @__PURE__ */ s(
|
|
1304
|
+
"button",
|
|
1305
|
+
{
|
|
1306
|
+
type: "button",
|
|
1307
|
+
onClick: l,
|
|
1308
|
+
disabled: o,
|
|
1309
|
+
"aria-current": i === "current" ? "step" : void 0,
|
|
1310
|
+
className: "w-full rounded-md disabled:cursor-default enabled:hover:bg-[var(--gray-a2)]",
|
|
1311
|
+
style: { border: 0, background: "transparent", cursor: "pointer", textAlign: "left", padding: "8px 8px 12px" },
|
|
1312
|
+
children: /* @__PURE__ */ p(L, { gap: "3", align: "start", children: [
|
|
1313
|
+
/* @__PURE__ */ s(
|
|
1314
|
+
L,
|
|
1315
|
+
{
|
|
1316
|
+
align: "center",
|
|
1317
|
+
justify: "center",
|
|
1318
|
+
"aria-hidden": !0,
|
|
1319
|
+
style: {
|
|
1320
|
+
width: 28,
|
|
1321
|
+
height: 28,
|
|
1322
|
+
flex: "0 0 28px",
|
|
1323
|
+
borderRadius: "50%",
|
|
1324
|
+
fontSize: 13,
|
|
1325
|
+
fontWeight: 600,
|
|
1326
|
+
...{
|
|
1327
|
+
done: { background: "var(--green-9)", color: "white" },
|
|
1328
|
+
current: {
|
|
1329
|
+
background: "var(--color-panel-solid)",
|
|
1330
|
+
color: "var(--accent-11)",
|
|
1331
|
+
boxShadow: "inset 0 0 0 2px var(--accent-9)"
|
|
1332
|
+
},
|
|
1333
|
+
error: { background: "var(--red-9)", color: "white" },
|
|
1334
|
+
todo: {
|
|
1335
|
+
background: "var(--color-panel-solid)",
|
|
1336
|
+
color: "var(--gray-11)",
|
|
1337
|
+
boxShadow: "inset 0 0 0 2px var(--gray-a6)"
|
|
1338
|
+
}
|
|
1339
|
+
}[i]
|
|
1340
|
+
},
|
|
1341
|
+
children: i === "done" ? /* @__PURE__ */ s(Rn, { width: 16, height: 16 }) : e + 1
|
|
1342
|
+
}
|
|
1343
|
+
),
|
|
1344
|
+
/* @__PURE__ */ p(N, { style: { minWidth: 0, flex: 1, paddingTop: 2 }, children: [
|
|
1345
|
+
/* @__PURE__ */ p(L, { align: "center", gap: "2", justify: "between", children: [
|
|
1346
|
+
/* @__PURE__ */ s(
|
|
1347
|
+
h,
|
|
1348
|
+
{
|
|
1349
|
+
size: "2",
|
|
1350
|
+
weight: i === "current" ? "bold" : "medium",
|
|
1351
|
+
style: { color: i === "current" ? "var(--accent-11)" : "var(--gray-12)" },
|
|
1352
|
+
children: r
|
|
1353
|
+
}
|
|
1354
|
+
),
|
|
1355
|
+
n > 0 && /* @__PURE__ */ s(
|
|
1356
|
+
L,
|
|
1357
|
+
{
|
|
1358
|
+
align: "center",
|
|
1359
|
+
justify: "center",
|
|
1360
|
+
"aria-hidden": !0,
|
|
1361
|
+
"data-testid": "step-error-count",
|
|
1362
|
+
style: {
|
|
1363
|
+
minWidth: 20,
|
|
1364
|
+
height: 20,
|
|
1365
|
+
padding: "0 6px",
|
|
1366
|
+
boxSizing: "border-box",
|
|
1367
|
+
borderRadius: 10,
|
|
1368
|
+
background: "var(--red-9)",
|
|
1369
|
+
color: "white",
|
|
1370
|
+
fontSize: 12,
|
|
1371
|
+
fontWeight: 600,
|
|
1372
|
+
lineHeight: 1,
|
|
1373
|
+
flexShrink: 0
|
|
1374
|
+
},
|
|
1375
|
+
children: n
|
|
1376
|
+
}
|
|
1377
|
+
)
|
|
1378
|
+
] }),
|
|
1379
|
+
/* @__PURE__ */ s(h, { as: "p", size: "1", color: n > 0 ? "red" : "gray", children: t })
|
|
1380
|
+
] })
|
|
1381
|
+
] })
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1385
|
+
function Io(e) {
|
|
1386
|
+
var t;
|
|
1387
|
+
const r = document.getElementById(e);
|
|
1388
|
+
(t = r == null ? void 0 : r.scrollIntoView) == null || t.call(r, { block: "center" }), r == null || r.focus();
|
|
1389
|
+
}
|
|
1390
|
+
function Gt({
|
|
1391
|
+
title: e,
|
|
1392
|
+
items: r
|
|
1393
|
+
}) {
|
|
1394
|
+
return /* @__PURE__ */ p(gt.Root, { color: "red", mb: "4", role: "alert", children: [
|
|
1395
|
+
/* @__PURE__ */ s(gt.Icon, { children: /* @__PURE__ */ s(ht, {}) }),
|
|
1396
|
+
/* @__PURE__ */ s(gt.Text, { children: e }),
|
|
1397
|
+
/* @__PURE__ */ s("ul", { style: { margin: 0, paddingLeft: 20 }, children: r.map((t) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(Re, { type: "button", variant: "ghost", color: "red", size: "1", onClick: t.onClick, children: t.label }) }, t.key)) })
|
|
1398
|
+
] });
|
|
1399
|
+
}
|
|
1400
|
+
const Do = ({ uischema: e, schema: r, path: t, renderers: n, cells: i }) => {
|
|
1401
|
+
var d;
|
|
1402
|
+
const o = (d = Ne().i18n) == null ? void 0 : d.translate, l = Tr(), a = Cr(e, t), c = a.length, u = ur(() => {
|
|
1403
|
+
var m;
|
|
1404
|
+
return (m = l == null ? void 0 : l.onStepChange) == null ? void 0 : m.call(l, { step: c, count: c, last: !0 });
|
|
1405
|
+
});
|
|
1406
|
+
return ye(() => {
|
|
1407
|
+
u();
|
|
1408
|
+
}, [c]), /* @__PURE__ */ s(L, { direction: "column", gap: "6", p: { initial: "4", sm: "6" }, style: wt, "data-form-review": "", children: a.map((m, f) => /* @__PURE__ */ p(N, { children: [
|
|
1409
|
+
/* @__PURE__ */ s(tt, { size: "3", as: "h3", mb: "3", children: kr(m, o) }),
|
|
1410
|
+
/* @__PURE__ */ s(
|
|
1411
|
+
Or,
|
|
1412
|
+
{
|
|
1413
|
+
category: m,
|
|
1414
|
+
schema: r,
|
|
1415
|
+
path: t,
|
|
1416
|
+
renderers: n,
|
|
1417
|
+
cells: i,
|
|
1418
|
+
enabled: !1
|
|
1419
|
+
}
|
|
1420
|
+
)
|
|
1421
|
+
] }, `${t}-${f}`)) });
|
|
1422
|
+
};
|
|
1423
|
+
function Cr(e, r) {
|
|
1424
|
+
var l, a;
|
|
1425
|
+
const t = Ne(), n = (l = t.core) == null ? void 0 : l.ajv, i = (a = t.core) == null ? void 0 : a.data, o = t.config;
|
|
1426
|
+
return zn(e).filter((c) => !c.rule || !n || dr(c, i, r, n, o));
|
|
1427
|
+
}
|
|
1428
|
+
function Or({
|
|
1429
|
+
category: e,
|
|
1430
|
+
schema: r,
|
|
1431
|
+
path: t,
|
|
1432
|
+
renderers: n,
|
|
1433
|
+
cells: i,
|
|
1434
|
+
enabled: o
|
|
1435
|
+
}) {
|
|
1436
|
+
return /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: e.elements.map((l, a) => /* @__PURE__ */ s(
|
|
1437
|
+
Qe,
|
|
1438
|
+
{
|
|
1439
|
+
uischema: l,
|
|
1440
|
+
schema: r,
|
|
1441
|
+
path: t,
|
|
1442
|
+
renderers: n,
|
|
1443
|
+
cells: i,
|
|
1444
|
+
enabled: o
|
|
1445
|
+
},
|
|
1446
|
+
`${t}-${a}`
|
|
1447
|
+
)) });
|
|
1448
|
+
}
|
|
1449
|
+
function kr(e, r) {
|
|
1450
|
+
return pn(e, r ?? nt) ?? e.label;
|
|
1451
|
+
}
|
|
1452
|
+
function No(e, r) {
|
|
1453
|
+
var i;
|
|
1454
|
+
const t = (i = e == null ? void 0 : e.options) == null ? void 0 : i.description;
|
|
1455
|
+
if (!e || !t) return;
|
|
1456
|
+
const n = hn(void 0, e);
|
|
1457
|
+
return (r ?? nt)(n ? `${n}.description` : t, t);
|
|
1458
|
+
}
|
|
1459
|
+
const Lo = ({
|
|
876
1460
|
uischema: e,
|
|
877
1461
|
schema: r,
|
|
878
1462
|
path: t,
|
|
879
1463
|
renderers: n,
|
|
880
1464
|
cells: i,
|
|
881
1465
|
enabled: o,
|
|
882
|
-
visible:
|
|
1466
|
+
visible: l = !0
|
|
883
1467
|
}) => {
|
|
884
1468
|
const c = e.elements;
|
|
885
|
-
return
|
|
886
|
-
|
|
1469
|
+
return l === !1 ? null : /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ s(
|
|
1470
|
+
Qe,
|
|
887
1471
|
{
|
|
888
1472
|
uischema: u,
|
|
889
1473
|
schema: r,
|
|
@@ -894,18 +1478,18 @@ const mn = {
|
|
|
894
1478
|
},
|
|
895
1479
|
`${t}-${d}`
|
|
896
1480
|
)) });
|
|
897
|
-
},
|
|
1481
|
+
}, zo = ue(1, ot("VerticalLayout")), Mo = ({
|
|
898
1482
|
uischema: e,
|
|
899
1483
|
schema: r,
|
|
900
1484
|
path: t,
|
|
901
1485
|
renderers: n,
|
|
902
1486
|
cells: i,
|
|
903
1487
|
enabled: o,
|
|
904
|
-
visible:
|
|
1488
|
+
visible: l = !0
|
|
905
1489
|
}) => {
|
|
906
1490
|
const c = e.elements;
|
|
907
|
-
return
|
|
908
|
-
|
|
1491
|
+
return l === !1 ? null : /* @__PURE__ */ s(L, { direction: "row", gap: "4", children: c.map((u, d) => /* @__PURE__ */ s(N, { style: { flex: 1 }, children: /* @__PURE__ */ s(
|
|
1492
|
+
Qe,
|
|
909
1493
|
{
|
|
910
1494
|
uischema: u,
|
|
911
1495
|
schema: r,
|
|
@@ -915,20 +1499,20 @@ const mn = {
|
|
|
915
1499
|
enabled: o
|
|
916
1500
|
}
|
|
917
1501
|
) }, `${t}-${d}`)) });
|
|
918
|
-
},
|
|
1502
|
+
}, Fo = ue(1, ot("HorizontalLayout")), $o = ({
|
|
919
1503
|
uischema: e,
|
|
920
1504
|
schema: r,
|
|
921
1505
|
path: t,
|
|
922
1506
|
renderers: n,
|
|
923
1507
|
cells: i,
|
|
924
1508
|
enabled: o,
|
|
925
|
-
visible:
|
|
1509
|
+
visible: l = !0
|
|
926
1510
|
}) => {
|
|
927
1511
|
const a = e, c = a.elements;
|
|
928
|
-
return
|
|
929
|
-
a.label && /* @__PURE__ */
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
|
|
1512
|
+
return l === !1 ? null : /* @__PURE__ */ p(N, { mb: "6", children: [
|
|
1513
|
+
a.label && /* @__PURE__ */ s(tt, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: a.label }),
|
|
1514
|
+
/* @__PURE__ */ s(L, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ s(
|
|
1515
|
+
Qe,
|
|
932
1516
|
{
|
|
933
1517
|
uischema: u,
|
|
934
1518
|
schema: r,
|
|
@@ -940,226 +1524,228 @@ const mn = {
|
|
|
940
1524
|
`${t}-${d}`
|
|
941
1525
|
)) })
|
|
942
1526
|
] });
|
|
943
|
-
},
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1527
|
+
}, Po = ue(1, ot("Group")), Uo = (e) => e.visible === !1 ? null : Ln(e.uischema) ? /* @__PURE__ */ s(
|
|
1528
|
+
Co,
|
|
1529
|
+
{
|
|
1530
|
+
uischema: e.uischema,
|
|
1531
|
+
schema: e.schema,
|
|
1532
|
+
path: e.path,
|
|
1533
|
+
renderers: e.renderers,
|
|
1534
|
+
cells: e.cells,
|
|
1535
|
+
enabled: e.enabled
|
|
1536
|
+
}
|
|
1537
|
+
) : /* @__PURE__ */ s(jo, { ...e }), jo = ({ uischema: e, schema: r, path: t, renderers: n, cells: i, enabled: o }) => {
|
|
952
1538
|
var m;
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
const
|
|
956
|
-
return /* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
|
|
1539
|
+
const a = e.elements.filter((f) => f.type === "Category"), [c, u] = Y(((m = a[0]) == null ? void 0 : m.label) || "");
|
|
1540
|
+
if (!a.length) return null;
|
|
1541
|
+
const d = a.find((f) => f.label === c) ? c : a[0].label;
|
|
1542
|
+
return /* @__PURE__ */ p(at.Root, { value: d, onValueChange: u, children: [
|
|
1543
|
+
/* @__PURE__ */ s(at.List, { children: a.map((f, g) => /* @__PURE__ */ s(at.Trigger, { value: f.label, children: f.label }, `${t}-${g}`)) }),
|
|
1544
|
+
/* @__PURE__ */ s(N, { pt: "3", children: a.map((f, g) => /* @__PURE__ */ s(at.Content, { value: f.label, children: /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: f.elements.map((E, v) => /* @__PURE__ */ s(
|
|
1545
|
+
Qe,
|
|
960
1546
|
{
|
|
961
|
-
uischema:
|
|
1547
|
+
uischema: E,
|
|
962
1548
|
schema: r,
|
|
963
1549
|
path: t,
|
|
964
1550
|
renderers: n,
|
|
965
1551
|
cells: i,
|
|
966
1552
|
enabled: o
|
|
967
1553
|
},
|
|
968
|
-
`${t}-${
|
|
969
|
-
)) }) }, `${t}-${
|
|
1554
|
+
`${t}-${g}-${v}`
|
|
1555
|
+
)) }) }, `${t}-${g}`)) })
|
|
970
1556
|
] });
|
|
971
|
-
},
|
|
972
|
-
function
|
|
1557
|
+
}, _o = ue(1, ot("Categorization"));
|
|
1558
|
+
function Ie(e) {
|
|
973
1559
|
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
|
|
974
1560
|
}
|
|
975
|
-
function
|
|
1561
|
+
function De(e) {
|
|
976
1562
|
const r = e.split(",").map((o) => o.trim()).filter(Boolean), t = r.filter((o) => o.startsWith(".")), i = (t.length > 0 ? t : r).map((o) => {
|
|
977
1563
|
if (o.endsWith("/*")) return o.split("/")[0].toUpperCase() + "S";
|
|
978
1564
|
if (o.startsWith(".")) return o.slice(1).toUpperCase();
|
|
979
|
-
const
|
|
980
|
-
return
|
|
1565
|
+
const l = o.split("/")[1];
|
|
1566
|
+
return l ? l.toUpperCase() : o;
|
|
981
1567
|
});
|
|
982
1568
|
return [...new Set(i)].join(", ");
|
|
983
1569
|
}
|
|
984
|
-
const
|
|
985
|
-
function
|
|
1570
|
+
const Vo = "image/png,image/jpeg,image/gif,image/webp,application/pdf,text/html,text/plain,.png,.jpg,.jpeg,.gif,.webp,.pdf,.html,.htm,.txt";
|
|
1571
|
+
function Ir(e, r) {
|
|
986
1572
|
return r.split(",").map((n) => n.trim()).filter(Boolean).some((n) => n === "*" || n === "*/*" ? !0 : n.endsWith("/*") ? (e.type ?? "").startsWith(n.slice(0, -1)) : n.startsWith(".") ? e.name.toLowerCase().endsWith(n.toLowerCase()) : e.type === n);
|
|
987
1573
|
}
|
|
988
|
-
function
|
|
989
|
-
const r = !!e.type, t =
|
|
990
|
-
return !r && !t ? !0 :
|
|
1574
|
+
function Wo(e) {
|
|
1575
|
+
const r = !!e.type, t = Et(e.name) !== void 0;
|
|
1576
|
+
return !r && !t ? !0 : Ir(e, Vo);
|
|
991
1577
|
}
|
|
992
|
-
function
|
|
1578
|
+
function Et(e) {
|
|
993
1579
|
const r = e.split(/[/\\]/).pop() ?? e, t = r.lastIndexOf(".");
|
|
994
1580
|
if (!(t <= 0 || t === r.length - 1))
|
|
995
1581
|
return r.slice(t);
|
|
996
1582
|
}
|
|
997
|
-
function
|
|
998
|
-
|
|
1583
|
+
function Ho(e, r, t) {
|
|
1584
|
+
Dr(new Blob([e], { type: t }), r);
|
|
999
1585
|
}
|
|
1000
|
-
function
|
|
1586
|
+
function Dr(e, r) {
|
|
1001
1587
|
const t = URL.createObjectURL(e), n = document.createElement("a");
|
|
1002
1588
|
n.href = t, n.download = r, n.click(), setTimeout(() => URL.revokeObjectURL(t), 0);
|
|
1003
1589
|
}
|
|
1004
|
-
async function
|
|
1590
|
+
async function Bo(e, r) {
|
|
1005
1591
|
const t = await fetch(e);
|
|
1006
1592
|
if (!t.ok) throw new Error(`Download failed (${t.status})`);
|
|
1007
|
-
|
|
1593
|
+
Dr(await t.blob(), r);
|
|
1008
1594
|
}
|
|
1009
|
-
function
|
|
1595
|
+
function Xo(e, r, t) {
|
|
1010
1596
|
const n = t.name || t.key;
|
|
1011
1597
|
if (!e) return n;
|
|
1012
|
-
const i =
|
|
1598
|
+
const i = It(e, r, n), o = Et(t.name ?? "") ?? Et(t.key);
|
|
1013
1599
|
return !o || i.toLowerCase().endsWith(o.toLowerCase()) ? i : `${i}${o}`;
|
|
1014
1600
|
}
|
|
1015
|
-
const
|
|
1016
|
-
function
|
|
1017
|
-
const t = Array.from(e, (n) =>
|
|
1601
|
+
const qo = /* @__PURE__ */ new Set(["/", "\\", "<", ">", ":", '"', "|", "?", "*"]), Ko = (e) => qo.has(e) || e.charCodeAt(0) < 32 || e.charCodeAt(0) === 127;
|
|
1602
|
+
function Yo(e, r) {
|
|
1603
|
+
const t = Array.from(e, (n) => Ko(n) ? "_" : n).join("").trim();
|
|
1018
1604
|
return t === "" || t.startsWith(".") ? r : t;
|
|
1019
1605
|
}
|
|
1020
|
-
function
|
|
1606
|
+
function It(e, r, t) {
|
|
1021
1607
|
const n = r !== null && typeof r == "object" && !Array.isArray(r) ? r : {};
|
|
1022
|
-
return
|
|
1608
|
+
return Yo(mt(e, n), t);
|
|
1023
1609
|
}
|
|
1024
|
-
function
|
|
1610
|
+
function Go(e) {
|
|
1025
1611
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
1026
1612
|
}
|
|
1027
|
-
const
|
|
1613
|
+
const Jo = ({
|
|
1028
1614
|
data: e,
|
|
1029
1615
|
handleChange: r,
|
|
1030
1616
|
path: t,
|
|
1031
1617
|
label: n,
|
|
1032
1618
|
required: i,
|
|
1033
1619
|
uischema: o,
|
|
1034
|
-
schema:
|
|
1620
|
+
schema: l,
|
|
1035
1621
|
enabled: a,
|
|
1036
1622
|
errors: c,
|
|
1037
1623
|
visible: u = !0
|
|
1038
1624
|
}) => {
|
|
1039
|
-
const d =
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
const
|
|
1043
|
-
return { name: (
|
|
1044
|
-
},
|
|
1045
|
-
var
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1048
|
-
const
|
|
1049
|
-
return
|
|
1050
|
-
},
|
|
1051
|
-
|
|
1052
|
-
},
|
|
1053
|
-
|
|
1054
|
-
if (!
|
|
1055
|
-
const
|
|
1056
|
-
return delete
|
|
1625
|
+
const d = Dn();
|
|
1626
|
+
Le(u, t, r);
|
|
1627
|
+
const m = Ce(t, i, u), f = !c || c.length === 0, g = (l == null ? void 0 : l["x-file"]) ?? {}, E = (o == null ? void 0 : o.options) ?? {}, v = g.maxFiles ?? E.maxFiles ?? 1, z = g.maxSize ?? E.maxSize ?? 5 * 1024 * 1024, R = g.accept ?? E.accept ?? "image/*,application/pdf", j = typeof g.fileName == "string" ? g.fileName : void 0, S = v > 1, C = a !== !1, [A, T] = Y(!1), [W, U] = Y(null), [F, M] = Y({}), [x, te] = Y({}), H = he(/* @__PURE__ */ new Set()), J = he(null), B = Go(e), le = B.length >= v, ve = (y) => {
|
|
1628
|
+
const k = x[y];
|
|
1629
|
+
return { name: (k == null ? void 0 : k.name) ?? y, type: k == null ? void 0 : k.type };
|
|
1630
|
+
}, ne = async (y) => {
|
|
1631
|
+
var se, ce;
|
|
1632
|
+
const k = (se = x[y]) == null ? void 0 : se.blobUrl;
|
|
1633
|
+
if (k) return k;
|
|
1634
|
+
const ee = await ((ce = d == null ? void 0 : d.getDownloadUrl) == null ? void 0 : ce.call(d, y));
|
|
1635
|
+
return ee == null ? void 0 : ee.url;
|
|
1636
|
+
}, ae = (y, k) => {
|
|
1637
|
+
M((ee) => ({ ...ee, [y]: k }));
|
|
1638
|
+
}, $ = (y) => {
|
|
1639
|
+
M((k) => {
|
|
1640
|
+
if (!k[y]) return k;
|
|
1641
|
+
const ee = { ...k };
|
|
1642
|
+
return delete ee[y], ee;
|
|
1057
1643
|
});
|
|
1058
1644
|
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1645
|
+
ye(() => () => {
|
|
1646
|
+
H.current.forEach((y) => URL.revokeObjectURL(y)), H.current.clear();
|
|
1061
1647
|
}, []);
|
|
1062
|
-
const
|
|
1063
|
-
async (
|
|
1064
|
-
if (
|
|
1065
|
-
|
|
1648
|
+
const Z = Be(
|
|
1649
|
+
async (y) => {
|
|
1650
|
+
if (U(null), B.length >= v) {
|
|
1651
|
+
U(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
|
|
1066
1652
|
return;
|
|
1067
1653
|
}
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1654
|
+
if (y.size > z) {
|
|
1655
|
+
U(`File exceeds the ${Ie(z)} limit.`);
|
|
1070
1656
|
return;
|
|
1071
1657
|
}
|
|
1072
|
-
if (!
|
|
1073
|
-
|
|
1658
|
+
if (!Ir(y, R)) {
|
|
1659
|
+
U(`Invalid type. Accepted: ${De(R)}`);
|
|
1074
1660
|
return;
|
|
1075
1661
|
}
|
|
1076
1662
|
if (!(d != null && d.onUpload)) {
|
|
1077
|
-
|
|
1663
|
+
U("Upload service not configured.");
|
|
1078
1664
|
return;
|
|
1079
1665
|
}
|
|
1080
1666
|
try {
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
const
|
|
1084
|
-
key:
|
|
1085
|
-
name:
|
|
1086
|
-
type:
|
|
1087
|
-
blobUrl:
|
|
1667
|
+
const k = await d.onUpload(y), ee = URL.createObjectURL(y);
|
|
1668
|
+
H.current.add(ee);
|
|
1669
|
+
const se = {
|
|
1670
|
+
key: k.key,
|
|
1671
|
+
name: k.name ?? y.name,
|
|
1672
|
+
type: y.type || void 0,
|
|
1673
|
+
blobUrl: ee
|
|
1088
1674
|
};
|
|
1089
|
-
|
|
1090
|
-
const
|
|
1091
|
-
r(t,
|
|
1675
|
+
te((me) => ({ ...me, [k.key]: se }));
|
|
1676
|
+
const ce = [...B, k.key];
|
|
1677
|
+
r(t, S ? ce : ce[0]);
|
|
1092
1678
|
} catch {
|
|
1093
|
-
|
|
1679
|
+
U("Upload failed. Please try again."), J.current && (J.current.value = "");
|
|
1094
1680
|
}
|
|
1095
1681
|
},
|
|
1096
|
-
[
|
|
1682
|
+
[B, v, z, R, d, t, r, S]
|
|
1097
1683
|
);
|
|
1098
1684
|
if (u === !1)
|
|
1099
1685
|
return null;
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
},
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1105
|
-
},
|
|
1106
|
-
var
|
|
1107
|
-
(
|
|
1108
|
-
},
|
|
1109
|
-
if (!
|
|
1110
|
-
|
|
1686
|
+
const I = (y) => {
|
|
1687
|
+
y.preventDefault(), y.stopPropagation(), !(!C || le) && T(y.type === "dragenter" || y.type === "dragover");
|
|
1688
|
+
}, re = (y) => {
|
|
1689
|
+
var k;
|
|
1690
|
+
y.preventDefault(), y.stopPropagation(), T(!1), !(!C || le) && (k = y.dataTransfer.files) != null && k[0] && Z(y.dataTransfer.files[0]);
|
|
1691
|
+
}, Q = (y) => {
|
|
1692
|
+
var k;
|
|
1693
|
+
(k = y.target.files) != null && k[0] && (Z(y.target.files[0]), y.target.value = "");
|
|
1694
|
+
}, _ = (y) => {
|
|
1695
|
+
if (!C) return;
|
|
1696
|
+
te((ee) => {
|
|
1111
1697
|
var me;
|
|
1112
|
-
const
|
|
1113
|
-
return
|
|
1114
|
-
}),
|
|
1115
|
-
const
|
|
1116
|
-
r(t,
|
|
1117
|
-
},
|
|
1118
|
-
var
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1122
|
-
(me = window.open(
|
|
1698
|
+
const se = { ...ee }, ce = (me = se[y]) == null ? void 0 : me.blobUrl;
|
|
1699
|
+
return ce && (URL.revokeObjectURL(ce), H.current.delete(ce)), delete se[y], se;
|
|
1700
|
+
}), $(y);
|
|
1701
|
+
const k = B.filter((ee) => ee !== y);
|
|
1702
|
+
r(t, S ? k.length > 0 ? k : void 0 : k[0]);
|
|
1703
|
+
}, b = async (y, k) => {
|
|
1704
|
+
var ce, me;
|
|
1705
|
+
y.preventDefault(), $(k);
|
|
1706
|
+
const ee = (ce = x[k]) == null ? void 0 : ce.blobUrl;
|
|
1707
|
+
if (ee) {
|
|
1708
|
+
(me = window.open(ee, "_blank", "noopener,noreferrer")) == null || me.focus();
|
|
1123
1709
|
return;
|
|
1124
1710
|
}
|
|
1125
|
-
const
|
|
1126
|
-
if (
|
|
1711
|
+
const se = window.open("", "_blank");
|
|
1712
|
+
if (se)
|
|
1127
1713
|
try {
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1714
|
+
const D = await ne(k);
|
|
1715
|
+
D ? se.location.href = D : (se.close(), ae(k, "Unable to open file."));
|
|
1130
1716
|
} catch {
|
|
1131
|
-
|
|
1717
|
+
se.close(), ae(k, "Unable to open file.");
|
|
1132
1718
|
}
|
|
1133
|
-
},
|
|
1134
|
-
|
|
1719
|
+
}, O = async (y, k) => {
|
|
1720
|
+
$(y);
|
|
1135
1721
|
try {
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1138
|
-
|
|
1722
|
+
const ee = await ne(y);
|
|
1723
|
+
if (!ee) {
|
|
1724
|
+
ae(y, "Unable to download file.");
|
|
1139
1725
|
return;
|
|
1140
1726
|
}
|
|
1141
|
-
await
|
|
1727
|
+
await Bo(ee, k);
|
|
1142
1728
|
} catch {
|
|
1143
|
-
|
|
1729
|
+
ae(y, "Unable to download file.");
|
|
1144
1730
|
}
|
|
1145
1731
|
};
|
|
1146
|
-
if (!
|
|
1147
|
-
const
|
|
1148
|
-
return /* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1732
|
+
if (!C && B.length === 0) return null;
|
|
1733
|
+
const V = v - B.length, G = C && !le;
|
|
1734
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
1735
|
+
/* @__PURE__ */ p(L, { align: "center", justify: "between", mb: "2", children: [
|
|
1736
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", children: [
|
|
1151
1737
|
n,
|
|
1152
|
-
|
|
1738
|
+
m && /* @__PURE__ */ s(h, { color: "red", children: " *" })
|
|
1153
1739
|
] }),
|
|
1154
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ s(h, { size: "1", color: "gray", children: S ? `Up to ${v} files · ${Ie(z)} each · ${De(R)}` : `${Ie(z)} · ${De(R)}` })
|
|
1155
1741
|
] }),
|
|
1156
|
-
|
|
1157
|
-
var
|
|
1158
|
-
const
|
|
1159
|
-
return /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1161
|
-
/* @__PURE__ */
|
|
1162
|
-
|
|
1742
|
+
B.map((y, k) => {
|
|
1743
|
+
var K;
|
|
1744
|
+
const ee = k + 1, se = (K = x[y]) == null ? void 0 : K.name, ce = Xo(j, { index: ee }, { name: se, key: y }), me = j ? ce : se ?? "Uploaded File", D = !!(j && se), X = F[y], de = Wo(ve(y));
|
|
1745
|
+
return /* @__PURE__ */ p(yr, { size: "2", variant: "surface", mb: "2", children: [
|
|
1746
|
+
/* @__PURE__ */ p(L, { align: "center", gap: "3", children: [
|
|
1747
|
+
/* @__PURE__ */ s(
|
|
1748
|
+
N,
|
|
1163
1749
|
{
|
|
1164
1750
|
style: {
|
|
1165
1751
|
background: "var(--blue-3)",
|
|
@@ -1168,12 +1754,12 @@ const Vn = ({
|
|
|
1168
1754
|
color: "var(--blue-9)",
|
|
1169
1755
|
flexShrink: 0
|
|
1170
1756
|
},
|
|
1171
|
-
children: /* @__PURE__ */
|
|
1757
|
+
children: /* @__PURE__ */ s(Cn, { width: "20", height: "20" })
|
|
1172
1758
|
}
|
|
1173
1759
|
),
|
|
1174
|
-
/* @__PURE__ */
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
|
|
1760
|
+
/* @__PURE__ */ p(N, { style: { flex: 1, overflow: "hidden" }, children: [
|
|
1761
|
+
/* @__PURE__ */ s(
|
|
1762
|
+
h,
|
|
1177
1763
|
{
|
|
1178
1764
|
size: "2",
|
|
1179
1765
|
weight: "bold",
|
|
@@ -1186,8 +1772,8 @@ const Vn = ({
|
|
|
1186
1772
|
children: me
|
|
1187
1773
|
}
|
|
1188
1774
|
),
|
|
1189
|
-
|
|
1190
|
-
|
|
1775
|
+
D && /* @__PURE__ */ s(
|
|
1776
|
+
h,
|
|
1191
1777
|
{
|
|
1192
1778
|
size: "1",
|
|
1193
1779
|
color: "gray",
|
|
@@ -1197,83 +1783,83 @@ const Vn = ({
|
|
|
1197
1783
|
textOverflow: "ellipsis",
|
|
1198
1784
|
whiteSpace: "nowrap"
|
|
1199
1785
|
},
|
|
1200
|
-
children:
|
|
1786
|
+
children: se
|
|
1201
1787
|
}
|
|
1202
1788
|
)
|
|
1203
1789
|
] }),
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
|
|
1206
|
-
/* @__PURE__ */
|
|
1207
|
-
|
|
1790
|
+
/* @__PURE__ */ p(L, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
|
|
1791
|
+
de && /* @__PURE__ */ s(Re, { variant: "soft", color: "blue", size: "1", onClick: (q) => void b(q, y), children: "View" }),
|
|
1792
|
+
/* @__PURE__ */ s(rt, { content: "Download", children: /* @__PURE__ */ s(
|
|
1793
|
+
Ze,
|
|
1208
1794
|
{
|
|
1209
1795
|
variant: "ghost",
|
|
1210
1796
|
color: "gray",
|
|
1211
1797
|
"aria-label": "Download",
|
|
1212
|
-
onClick: () => void
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1798
|
+
onClick: () => void O(y, ce),
|
|
1799
|
+
children: /* @__PURE__ */ s(Rt, {})
|
|
1214
1800
|
}
|
|
1215
1801
|
) }),
|
|
1216
|
-
/* @__PURE__ */
|
|
1217
|
-
|
|
1802
|
+
/* @__PURE__ */ s(On, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
|
|
1803
|
+
C && /* @__PURE__ */ s(Ze, { variant: "ghost", color: "gray", onClick: () => _(y), children: /* @__PURE__ */ s(Ct, {}) })
|
|
1218
1804
|
] })
|
|
1219
1805
|
] }),
|
|
1220
|
-
|
|
1221
|
-
] },
|
|
1806
|
+
X && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: X })
|
|
1807
|
+
] }, y);
|
|
1222
1808
|
}),
|
|
1223
|
-
|
|
1809
|
+
G && /* @__PURE__ */ p(
|
|
1224
1810
|
"div",
|
|
1225
1811
|
{
|
|
1226
1812
|
role: "button",
|
|
1227
1813
|
tabIndex: 0,
|
|
1228
1814
|
onClick: () => {
|
|
1229
|
-
var
|
|
1230
|
-
return (
|
|
1815
|
+
var y;
|
|
1816
|
+
return (y = J.current) == null ? void 0 : y.click();
|
|
1231
1817
|
},
|
|
1232
|
-
onKeyDown: (
|
|
1233
|
-
var
|
|
1234
|
-
(
|
|
1818
|
+
onKeyDown: (y) => {
|
|
1819
|
+
var k;
|
|
1820
|
+
(y.key === "Enter" || y.key === " ") && (y.preventDefault(), (k = J.current) == null || k.click());
|
|
1235
1821
|
},
|
|
1236
|
-
onDragEnter:
|
|
1237
|
-
onDragLeave:
|
|
1238
|
-
onDragOver:
|
|
1239
|
-
onDrop:
|
|
1822
|
+
onDragEnter: I,
|
|
1823
|
+
onDragLeave: I,
|
|
1824
|
+
onDragOver: I,
|
|
1825
|
+
onDrop: re,
|
|
1240
1826
|
style: { cursor: "pointer" },
|
|
1241
1827
|
className: [
|
|
1242
1828
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1243
1829
|
"transition-all duration-200 ease-in-out",
|
|
1244
|
-
|
|
1830
|
+
A ? "border-blue-500 bg-blue-50" : W ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
1245
1831
|
].join(" "),
|
|
1246
1832
|
children: [
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
] }) : /* @__PURE__ */
|
|
1253
|
-
/* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
/* @__PURE__ */
|
|
1256
|
-
|
|
1833
|
+
/* @__PURE__ */ s("input", { ref: J, type: "file", style: { display: "none" }, accept: R, onChange: Q }),
|
|
1834
|
+
/* @__PURE__ */ s(L, { direction: "column", align: "center", gap: "2", children: W ? /* @__PURE__ */ p(Ae, { children: [
|
|
1835
|
+
/* @__PURE__ */ s(ht, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
1836
|
+
/* @__PURE__ */ s(h, { size: "2", color: "red", weight: "medium", children: W }),
|
|
1837
|
+
/* @__PURE__ */ s(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
1838
|
+
] }) : /* @__PURE__ */ p(Ae, { children: [
|
|
1839
|
+
/* @__PURE__ */ s(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
1840
|
+
/* @__PURE__ */ s(h, { size: "2", weight: "medium", children: B.length > 0 ? `Add another file (${V} remaining)` : "Click to upload or drag and drop" }),
|
|
1841
|
+
/* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
|
|
1842
|
+
Ie(z),
|
|
1257
1843
|
" max · ",
|
|
1258
|
-
|
|
1844
|
+
De(R)
|
|
1259
1845
|
] })
|
|
1260
1846
|
] }) })
|
|
1261
1847
|
]
|
|
1262
1848
|
}
|
|
1263
1849
|
),
|
|
1264
|
-
|
|
1850
|
+
C && le && S && /* @__PURE__ */ p(h, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
1265
1851
|
"Maximum ",
|
|
1266
|
-
|
|
1852
|
+
v,
|
|
1267
1853
|
" files uploaded. Remove one to replace it."
|
|
1268
1854
|
] }),
|
|
1269
|
-
!
|
|
1855
|
+
!f && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Oe(c, n) })
|
|
1270
1856
|
] });
|
|
1271
|
-
},
|
|
1857
|
+
}, Zo = Ee(Jo), Qo = ue(
|
|
1272
1858
|
10,
|
|
1273
1859
|
// high rank to beat default array renderer
|
|
1274
|
-
|
|
1860
|
+
mr(
|
|
1275
1861
|
// Match both single-file (type: string) and multi-file (type: array)
|
|
1276
|
-
|
|
1862
|
+
_e((e) => {
|
|
1277
1863
|
if (e.type === "string" && e.format === "file") return !0;
|
|
1278
1864
|
if (e.type === "array") {
|
|
1279
1865
|
const r = e.items;
|
|
@@ -1283,19 +1869,19 @@ const Vn = ({
|
|
|
1283
1869
|
})
|
|
1284
1870
|
)
|
|
1285
1871
|
);
|
|
1286
|
-
function
|
|
1872
|
+
function Nr(e, r) {
|
|
1287
1873
|
return e !== !1 && r !== !0;
|
|
1288
1874
|
}
|
|
1289
|
-
class
|
|
1875
|
+
class xt extends Error {
|
|
1290
1876
|
}
|
|
1291
|
-
async function
|
|
1877
|
+
async function ei(e, r) {
|
|
1292
1878
|
const { read: t, utils: n } = await import("@e965/xlsx"), i = t(e, { type: "array", cellDates: !0 });
|
|
1293
1879
|
if (i.SheetNames.length === 0)
|
|
1294
|
-
throw new
|
|
1295
|
-
const o = r ?? i.SheetNames[0],
|
|
1296
|
-
if (!
|
|
1297
|
-
throw new
|
|
1298
|
-
const a = n.sheet_to_json(
|
|
1880
|
+
throw new xt("This file has no sheets.");
|
|
1881
|
+
const o = r ?? i.SheetNames[0], l = i.Sheets[o];
|
|
1882
|
+
if (!l)
|
|
1883
|
+
throw new xt(`This file doesn't have a sheet named "${o}".`);
|
|
1884
|
+
const a = n.sheet_to_json(l, { header: 1, raw: !0, defval: null });
|
|
1299
1885
|
return {
|
|
1300
1886
|
sheetName: o,
|
|
1301
1887
|
matrix: a,
|
|
@@ -1303,7 +1889,7 @@ async function Bn(e, r) {
|
|
|
1303
1889
|
colCount: Math.max(0, ...a.map((c) => c.length))
|
|
1304
1890
|
};
|
|
1305
1891
|
}
|
|
1306
|
-
function
|
|
1892
|
+
function ti(e) {
|
|
1307
1893
|
let r = e + 1, t = "";
|
|
1308
1894
|
for (; r > 0; ) {
|
|
1309
1895
|
const n = (r - 1) % 26;
|
|
@@ -1311,14 +1897,14 @@ function Xn(e) {
|
|
|
1311
1897
|
}
|
|
1312
1898
|
return t;
|
|
1313
1899
|
}
|
|
1314
|
-
class
|
|
1900
|
+
class be extends Error {
|
|
1315
1901
|
constructor(t, n) {
|
|
1316
1902
|
super(n ?? t);
|
|
1317
|
-
|
|
1903
|
+
Vt(this, "code");
|
|
1318
1904
|
this.code = t, this.name = "FormulaError";
|
|
1319
1905
|
}
|
|
1320
1906
|
}
|
|
1321
|
-
const
|
|
1907
|
+
const ri = [
|
|
1322
1908
|
// Logical
|
|
1323
1909
|
// IF is excluded here even though its native body is real, non-stub code —
|
|
1324
1910
|
// see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
|
|
@@ -1344,7 +1930,7 @@ const qn = [
|
|
|
1344
1930
|
// DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
|
|
1345
1931
|
"DATE",
|
|
1346
1932
|
"TODAY"
|
|
1347
|
-
],
|
|
1933
|
+
], ni = [
|
|
1348
1934
|
"MAX",
|
|
1349
1935
|
"MIN",
|
|
1350
1936
|
"MAXA",
|
|
@@ -1363,7 +1949,7 @@ const qn = [
|
|
|
1363
1949
|
"COUNTA",
|
|
1364
1950
|
// not present in fast-formula-parser's function table at all.
|
|
1365
1951
|
"UPPER"
|
|
1366
|
-
],
|
|
1952
|
+
], oi = ["YEAR", "MONTH", "DAY", "WEEKDAY"], ii = ["IF"], si = [
|
|
1367
1953
|
"CONCATENATE",
|
|
1368
1954
|
"CONCAT",
|
|
1369
1955
|
"LEN",
|
|
@@ -1374,24 +1960,24 @@ const qn = [
|
|
|
1374
1960
|
"MID",
|
|
1375
1961
|
"FIND",
|
|
1376
1962
|
"SEARCH"
|
|
1377
|
-
],
|
|
1378
|
-
...
|
|
1379
|
-
...
|
|
1380
|
-
...
|
|
1381
|
-
...
|
|
1382
|
-
...
|
|
1383
|
-
]),
|
|
1384
|
-
function
|
|
1385
|
-
const r = e.replace(
|
|
1386
|
-
|
|
1963
|
+
], li = /* @__PURE__ */ new Set([
|
|
1964
|
+
...ri,
|
|
1965
|
+
...ni,
|
|
1966
|
+
...oi,
|
|
1967
|
+
...si,
|
|
1968
|
+
...ii
|
|
1969
|
+
]), ai = /"(?:[^"]|"")*"/g, Jt = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
|
|
1970
|
+
function ci(e) {
|
|
1971
|
+
const r = e.replace(ai, (n) => " ".repeat(n.length));
|
|
1972
|
+
Jt.lastIndex = 0;
|
|
1387
1973
|
let t;
|
|
1388
|
-
for (; (t =
|
|
1974
|
+
for (; (t = Jt.exec(r)) !== null; ) {
|
|
1389
1975
|
const n = t[1].toUpperCase();
|
|
1390
|
-
if (!
|
|
1391
|
-
throw new
|
|
1976
|
+
if (!li.has(n))
|
|
1977
|
+
throw new be("NAME", `Function ${n} is not allowed.`);
|
|
1392
1978
|
}
|
|
1393
1979
|
}
|
|
1394
|
-
function
|
|
1980
|
+
function ui(e, r, t) {
|
|
1395
1981
|
let n = e;
|
|
1396
1982
|
if (n == null) throw t.NA;
|
|
1397
1983
|
if (typeof n == "object" && !(n instanceof t) && (n = r.retrieveRef(n)), n instanceof t) throw n;
|
|
@@ -1399,52 +1985,52 @@ function to(e, r, t) {
|
|
|
1399
1985
|
if (typeof n == "number") return n !== 0;
|
|
1400
1986
|
throw t.VALUE;
|
|
1401
1987
|
}
|
|
1402
|
-
function
|
|
1988
|
+
function Lr(e) {
|
|
1403
1989
|
return e !== null && typeof e == "object" && "value" in e ? e.value : e;
|
|
1404
1990
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const r =
|
|
1991
|
+
function He(e) {
|
|
1992
|
+
const r = Lr(e);
|
|
1407
1993
|
return Array.isArray(r) ? r.flat(1 / 0) : [r];
|
|
1408
1994
|
}
|
|
1409
|
-
function
|
|
1410
|
-
const r =
|
|
1995
|
+
function ie(e) {
|
|
1996
|
+
const r = Lr(e);
|
|
1411
1997
|
return Array.isArray(r) ? r.flat(1 / 0)[0] : r;
|
|
1412
1998
|
}
|
|
1413
|
-
function
|
|
1414
|
-
return e === void 0 ? void 0 :
|
|
1999
|
+
function ct(e) {
|
|
2000
|
+
return e === void 0 ? void 0 : ie(e);
|
|
1415
2001
|
}
|
|
1416
|
-
function
|
|
2002
|
+
function ge(e) {
|
|
1417
2003
|
return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1418
2004
|
}
|
|
1419
|
-
function
|
|
2005
|
+
function di(e, r) {
|
|
1420
2006
|
return e instanceof r ? e : new r(e.message || "#ERROR!");
|
|
1421
2007
|
}
|
|
1422
|
-
function
|
|
2008
|
+
function pe(e) {
|
|
1423
2009
|
return e.find((r) => r instanceof Error);
|
|
1424
2010
|
}
|
|
1425
|
-
function
|
|
2011
|
+
function fi(e, r) {
|
|
1426
2012
|
const t = (o) => {
|
|
1427
|
-
throw
|
|
1428
|
-
}, n = (o, { checkArgsForErrors:
|
|
1429
|
-
const c = a.flatMap(
|
|
1430
|
-
if (
|
|
1431
|
-
const d =
|
|
2013
|
+
throw di(o, r);
|
|
2014
|
+
}, n = (o, { checkArgsForErrors: l = !0 } = {}) => (...a) => {
|
|
2015
|
+
const c = a.flatMap(He);
|
|
2016
|
+
if (l) {
|
|
2017
|
+
const d = pe(c);
|
|
1432
2018
|
d && t(d);
|
|
1433
2019
|
}
|
|
1434
2020
|
const u = o(...c);
|
|
1435
2021
|
return u instanceof Error ? t(u) : u;
|
|
1436
|
-
}, i = (o, { toText:
|
|
1437
|
-
const c =
|
|
2022
|
+
}, i = (o, { toText: l = !1 } = {}) => (a) => {
|
|
2023
|
+
const c = ie(a), u = pe([c]);
|
|
1438
2024
|
u && t(u);
|
|
1439
|
-
const d = o(
|
|
2025
|
+
const d = o(l ? ge(c) : c);
|
|
1440
2026
|
return d instanceof Error ? t(d) : d;
|
|
1441
2027
|
};
|
|
1442
2028
|
return {
|
|
1443
2029
|
// valueIfTrue/valueIfFalse are passed through unretrieved (not
|
|
1444
2030
|
// dereferenced or type-checked here) — that's what makes
|
|
1445
2031
|
// `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
|
|
1446
|
-
IF: (o,
|
|
1447
|
-
const u =
|
|
2032
|
+
IF: (o, l, a, c) => {
|
|
2033
|
+
const u = ui(l, o, r);
|
|
1448
2034
|
if (a == null) throw r.NA;
|
|
1449
2035
|
return u ? a : c ?? !1;
|
|
1450
2036
|
},
|
|
@@ -1460,26 +2046,26 @@ function no(e, r) {
|
|
|
1460
2046
|
// which never checks for errors), so this skips the error propagation
|
|
1461
2047
|
// the other aggregates use.
|
|
1462
2048
|
COUNTA: n(e.COUNTA, { checkArgsForErrors: !1 }),
|
|
1463
|
-
LARGE: (o,
|
|
1464
|
-
const a =
|
|
2049
|
+
LARGE: (o, l) => {
|
|
2050
|
+
const a = He(o), c = ie(l), u = pe([...a, c]);
|
|
1465
2051
|
u && t(u);
|
|
1466
2052
|
const d = e.LARGE(a, c);
|
|
1467
2053
|
return d instanceof Error ? t(d) : d;
|
|
1468
2054
|
},
|
|
1469
|
-
SMALL: (o,
|
|
1470
|
-
const a =
|
|
2055
|
+
SMALL: (o, l) => {
|
|
2056
|
+
const a = He(o), c = ie(l), u = pe([...a, c]);
|
|
1471
2057
|
u && t(u);
|
|
1472
2058
|
const d = e.SMALL(a, c);
|
|
1473
2059
|
return d instanceof Error ? t(d) : d;
|
|
1474
2060
|
},
|
|
1475
|
-
PERMUT: (o,
|
|
1476
|
-
const a = [
|
|
2061
|
+
PERMUT: (o, l) => {
|
|
2062
|
+
const a = [ie(o), ie(l)], c = pe(a);
|
|
1477
2063
|
c && t(c);
|
|
1478
2064
|
const u = e.PERMUT(a[0], a[1]);
|
|
1479
2065
|
return u instanceof Error ? t(u) : u;
|
|
1480
2066
|
},
|
|
1481
|
-
PERMUTATIONA: (o,
|
|
1482
|
-
const a = [
|
|
2067
|
+
PERMUTATIONA: (o, l) => {
|
|
2068
|
+
const a = [ie(o), ie(l)], c = pe(a);
|
|
1483
2069
|
c && t(c);
|
|
1484
2070
|
const u = e.PERMUTATIONA(a[0], a[1]);
|
|
1485
2071
|
return u instanceof Error ? t(u) : u;
|
|
@@ -1490,40 +2076,40 @@ function no(e, r) {
|
|
|
1490
2076
|
// Excel's own default too) risks silently mis-ranking unsorted
|
|
1491
2077
|
// real-world data. Same scope decision as the hand-rolled engine this
|
|
1492
2078
|
// replaces, carried forward deliberately rather than dropped.
|
|
1493
|
-
MATCH: (o,
|
|
1494
|
-
const a =
|
|
2079
|
+
MATCH: (o, l) => {
|
|
2080
|
+
const a = ie(o), c = He(l), u = pe([a, ...c]);
|
|
1495
2081
|
u && t(u);
|
|
1496
2082
|
const d = e.MATCH(a, c, 0);
|
|
1497
2083
|
return d instanceof Error ? t(d) : d;
|
|
1498
2084
|
},
|
|
1499
2085
|
SWITCH: (...o) => {
|
|
1500
|
-
const
|
|
2086
|
+
const l = o.map(ie), a = pe(l);
|
|
1501
2087
|
a && t(a);
|
|
1502
|
-
const c = e.SWITCH(...
|
|
2088
|
+
const c = e.SWITCH(...l);
|
|
1503
2089
|
return c instanceof Error ? t(c) : c;
|
|
1504
2090
|
},
|
|
1505
|
-
SUBSTITUTE: (o,
|
|
1506
|
-
const u = [
|
|
1507
|
-
c !== void 0 && u.push(
|
|
1508
|
-
const d =
|
|
2091
|
+
SUBSTITUTE: (o, l, a, c) => {
|
|
2092
|
+
const u = [ge(ie(o)), ge(ie(l)), ge(ie(a))];
|
|
2093
|
+
c !== void 0 && u.push(ie(c));
|
|
2094
|
+
const d = pe(u);
|
|
1509
2095
|
d && t(d);
|
|
1510
|
-
const
|
|
1511
|
-
return y instanceof Error ? t(y) : y;
|
|
1512
|
-
},
|
|
1513
|
-
TEXTJOIN: (o, s, ...a) => {
|
|
1514
|
-
const c = ue(K(o)), u = K(s), d = a.flatMap(Fe).map(ue), y = se([c, u]);
|
|
1515
|
-
y && t(y);
|
|
1516
|
-
const m = e.TEXTJOIN(c, u, d);
|
|
2096
|
+
const m = e.SUBSTITUTE(...u);
|
|
1517
2097
|
return m instanceof Error ? t(m) : m;
|
|
1518
2098
|
},
|
|
2099
|
+
TEXTJOIN: (o, l, ...a) => {
|
|
2100
|
+
const c = ge(ie(o)), u = ie(l), d = a.flatMap(He).map(ge), m = pe([c, u]);
|
|
2101
|
+
m && t(m);
|
|
2102
|
+
const f = e.TEXTJOIN(c, u, d);
|
|
2103
|
+
return f instanceof Error ? t(f) : f;
|
|
2104
|
+
},
|
|
1519
2105
|
UPPER: i(e.UPPER),
|
|
1520
2106
|
// See DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL above for why these override
|
|
1521
2107
|
// fast-formula-parser's own (real, but broken-for-Date-cells) versions.
|
|
1522
2108
|
YEAR: i(e.YEAR),
|
|
1523
2109
|
MONTH: i(e.MONTH),
|
|
1524
2110
|
DAY: i(e.DAY),
|
|
1525
|
-
WEEKDAY: (o,
|
|
1526
|
-
const a =
|
|
2111
|
+
WEEKDAY: (o, l) => {
|
|
2112
|
+
const a = ie(o), c = ie(l), u = pe([a]);
|
|
1527
2113
|
u && t(u);
|
|
1528
2114
|
const d = e.WEEKDAY(a, c);
|
|
1529
2115
|
return d instanceof Error ? t(d) : d;
|
|
@@ -1538,53 +2124,53 @@ function no(e, r) {
|
|
|
1538
2124
|
// separator, matching Excel's own range-argument behavior — the native
|
|
1539
2125
|
// implementation instead inserts stray commas for a whole-range argument.
|
|
1540
2126
|
CONCATENATE: (...o) => {
|
|
1541
|
-
const
|
|
2127
|
+
const l = o.flatMap(He), a = pe(l);
|
|
1542
2128
|
a && t(a);
|
|
1543
|
-
const c = e.CONCATENATE(...
|
|
2129
|
+
const c = e.CONCATENATE(...l.map(ge));
|
|
1544
2130
|
return c instanceof Error ? t(c) : c;
|
|
1545
2131
|
},
|
|
1546
2132
|
CONCAT: (...o) => {
|
|
1547
|
-
const
|
|
2133
|
+
const l = o.flatMap(He), a = pe(l);
|
|
1548
2134
|
a && t(a);
|
|
1549
|
-
const c = e.CONCAT(...
|
|
2135
|
+
const c = e.CONCAT(...l.map(ge));
|
|
1550
2136
|
return c instanceof Error ? t(c) : c;
|
|
1551
2137
|
},
|
|
1552
2138
|
LEN: i(e.LEN, { toText: !0 }),
|
|
1553
2139
|
TRIM: i(e.TRIM, { toText: !0 }),
|
|
1554
2140
|
LOWER: i(e.LOWER, { toText: !0 }),
|
|
1555
|
-
LEFT: (o,
|
|
1556
|
-
const a =
|
|
2141
|
+
LEFT: (o, l) => {
|
|
2142
|
+
const a = ie(o), c = ct(l), u = pe([a]);
|
|
1557
2143
|
u && t(u);
|
|
1558
|
-
const d = e.LEFT(
|
|
2144
|
+
const d = e.LEFT(ge(a), c);
|
|
1559
2145
|
return d instanceof Error ? t(d) : d;
|
|
1560
2146
|
},
|
|
1561
|
-
RIGHT: (o,
|
|
1562
|
-
const a =
|
|
2147
|
+
RIGHT: (o, l) => {
|
|
2148
|
+
const a = ie(o), c = ct(l), u = pe([a]);
|
|
1563
2149
|
u && t(u);
|
|
1564
|
-
const d = e.RIGHT(
|
|
2150
|
+
const d = e.RIGHT(ge(a), c);
|
|
1565
2151
|
return d instanceof Error ? t(d) : d;
|
|
1566
2152
|
},
|
|
1567
|
-
MID: (o,
|
|
1568
|
-
const c =
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1571
|
-
return
|
|
2153
|
+
MID: (o, l, a) => {
|
|
2154
|
+
const c = ie(o), u = ie(l), d = ie(a), m = pe([c, u, d]);
|
|
2155
|
+
m && t(m);
|
|
2156
|
+
const f = e.MID(ge(c), u, d);
|
|
2157
|
+
return f instanceof Error ? t(f) : f;
|
|
1572
2158
|
},
|
|
1573
|
-
FIND: (o,
|
|
1574
|
-
const c =
|
|
1575
|
-
|
|
1576
|
-
const
|
|
1577
|
-
return
|
|
2159
|
+
FIND: (o, l, a) => {
|
|
2160
|
+
const c = ie(o), u = ie(l), d = ct(a), m = pe([c, u]);
|
|
2161
|
+
m && t(m);
|
|
2162
|
+
const f = e.FIND(ge(c), ge(u), d);
|
|
2163
|
+
return f instanceof Error ? t(f) : f;
|
|
1578
2164
|
},
|
|
1579
|
-
SEARCH: (o,
|
|
1580
|
-
const c =
|
|
1581
|
-
|
|
1582
|
-
const
|
|
1583
|
-
return
|
|
2165
|
+
SEARCH: (o, l, a) => {
|
|
2166
|
+
const c = ie(o), u = ie(l), d = ct(a), m = pe([c, u]);
|
|
2167
|
+
m && t(m);
|
|
2168
|
+
const f = e.SEARCH(ge(c), ge(u), d);
|
|
2169
|
+
return f instanceof Error ? t(f) : f;
|
|
1584
2170
|
}
|
|
1585
2171
|
};
|
|
1586
2172
|
}
|
|
1587
|
-
const
|
|
2173
|
+
const pi = {
|
|
1588
2174
|
"#REF!": "REF",
|
|
1589
2175
|
"#VALUE!": "VALUE",
|
|
1590
2176
|
"#DIV/0!": "DIV0",
|
|
@@ -1593,100 +2179,100 @@ const oo = {
|
|
|
1593
2179
|
"#NUM!": "NUM",
|
|
1594
2180
|
"#NULL!": "NULL"
|
|
1595
2181
|
};
|
|
1596
|
-
function
|
|
1597
|
-
return
|
|
2182
|
+
function Zt(e) {
|
|
2183
|
+
return pi[e.error] ?? "ERROR";
|
|
1598
2184
|
}
|
|
1599
|
-
function
|
|
1600
|
-
if (e instanceof
|
|
2185
|
+
function Qt(e, r) {
|
|
2186
|
+
if (e instanceof be) return e;
|
|
1601
2187
|
if (e instanceof r) {
|
|
1602
2188
|
const t = e.details;
|
|
1603
|
-
return t instanceof
|
|
2189
|
+
return t instanceof be ? t : t instanceof r ? new be(Zt(t), t.message) : new be(Zt(e), e.message);
|
|
1604
2190
|
}
|
|
1605
|
-
return new
|
|
2191
|
+
return new be("ERROR", e instanceof Error ? e.message : void 0);
|
|
1606
2192
|
}
|
|
1607
|
-
function
|
|
2193
|
+
function hi(e) {
|
|
1608
2194
|
return Math.max(0, ...e.map((r) => (r == null ? void 0 : r.length) ?? 0));
|
|
1609
2195
|
}
|
|
1610
|
-
function
|
|
2196
|
+
function mi(e) {
|
|
1611
2197
|
return (r) => {
|
|
1612
2198
|
const t = e[r.row - 1];
|
|
1613
2199
|
if (r.row < 1 || r.col < 1 || t == null || r.col - 1 >= t.length)
|
|
1614
|
-
throw new
|
|
2200
|
+
throw new be("REF");
|
|
1615
2201
|
const n = t[r.col - 1];
|
|
1616
2202
|
return n == null || n === "" ? null : n;
|
|
1617
2203
|
};
|
|
1618
2204
|
}
|
|
1619
|
-
function
|
|
2205
|
+
function gi(e) {
|
|
1620
2206
|
return (r) => {
|
|
1621
|
-
const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col), i = Math.max(r.from.row, r.to.row), o = Math.max(r.from.col, r.to.col),
|
|
1622
|
-
if (t > e.length || n >
|
|
1623
|
-
throw new
|
|
2207
|
+
const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col), i = Math.max(r.from.row, r.to.row), o = Math.max(r.from.col, r.to.col), l = hi(e);
|
|
2208
|
+
if (t > e.length || n > l)
|
|
2209
|
+
throw new be("REF");
|
|
1624
2210
|
const a = Math.min(i, e.length), c = [];
|
|
1625
2211
|
for (let u = t; u <= a; u++) {
|
|
1626
|
-
const d = e[u - 1],
|
|
2212
|
+
const d = e[u - 1], m = [];
|
|
1627
2213
|
if (d != null) {
|
|
1628
|
-
const
|
|
1629
|
-
for (let
|
|
1630
|
-
const
|
|
1631
|
-
|
|
2214
|
+
const f = Math.min(o, d.length);
|
|
2215
|
+
for (let g = n; g <= f; g++) {
|
|
2216
|
+
const E = d[g - 1];
|
|
2217
|
+
m.push(E == null || E === "" ? null : E);
|
|
1632
2218
|
}
|
|
1633
2219
|
}
|
|
1634
|
-
c.push(
|
|
2220
|
+
c.push(m);
|
|
1635
2221
|
}
|
|
1636
2222
|
return c;
|
|
1637
2223
|
};
|
|
1638
2224
|
}
|
|
1639
|
-
function
|
|
2225
|
+
function yi(e) {
|
|
1640
2226
|
if (e == null || e === "") return null;
|
|
1641
2227
|
if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
|
|
1642
2228
|
return e;
|
|
1643
|
-
throw new
|
|
2229
|
+
throw new be("VALUE");
|
|
1644
2230
|
}
|
|
1645
|
-
async function
|
|
1646
|
-
if (typeof e != "string") throw new
|
|
2231
|
+
async function zr(e, r) {
|
|
2232
|
+
if (typeof e != "string") throw new be("ERROR");
|
|
1647
2233
|
const t = e.trim();
|
|
1648
|
-
if (t === "") throw new
|
|
2234
|
+
if (t === "") throw new be("ERROR");
|
|
1649
2235
|
const n = t.startsWith("=") ? t.slice(1) : t;
|
|
1650
|
-
|
|
2236
|
+
ci(n);
|
|
1651
2237
|
const [i, o] = await Promise.all([
|
|
1652
2238
|
import("fast-formula-parser"),
|
|
1653
2239
|
import("@formulajs/formulajs")
|
|
1654
|
-
]),
|
|
2240
|
+
]), l = i.default ?? i, a = l.FormulaError, c = new l({
|
|
1655
2241
|
...r,
|
|
1656
2242
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- formulajs's own types are all `any`-typed; formulaFunctions.ts narrows the surface it actually calls.
|
|
1657
|
-
functions:
|
|
2243
|
+
functions: fi(o, a)
|
|
1658
2244
|
});
|
|
1659
2245
|
let u;
|
|
1660
2246
|
try {
|
|
1661
2247
|
u = c.parse(n, { row: 1, col: 1, sheet: "Sheet1" });
|
|
1662
2248
|
} catch (d) {
|
|
1663
|
-
throw
|
|
2249
|
+
throw Qt(d, a);
|
|
1664
2250
|
}
|
|
1665
2251
|
if (u instanceof a)
|
|
1666
|
-
throw
|
|
1667
|
-
return
|
|
2252
|
+
throw Qt(u, a);
|
|
2253
|
+
return yi(u);
|
|
1668
2254
|
}
|
|
1669
|
-
async function
|
|
1670
|
-
return
|
|
2255
|
+
async function bi(e, r) {
|
|
2256
|
+
return zr(r, { onCell: mi(e), onRange: gi(e) });
|
|
1671
2257
|
}
|
|
1672
|
-
const
|
|
1673
|
-
async function
|
|
2258
|
+
const er = -1;
|
|
2259
|
+
async function Mr(e, r) {
|
|
1674
2260
|
const t = Object.keys(e);
|
|
1675
|
-
return
|
|
2261
|
+
return zr(r, {
|
|
1676
2262
|
onVariable: (n) => {
|
|
1677
2263
|
const i = t.indexOf(n);
|
|
1678
|
-
return i === -1 ? null : { row:
|
|
2264
|
+
return i === -1 ? null : { row: er, col: i + 1 };
|
|
1679
2265
|
},
|
|
1680
2266
|
onCell: (n) => {
|
|
1681
|
-
if (n.row ===
|
|
1682
|
-
throw new
|
|
2267
|
+
if (n.row === er) return e[t[n.col - 1]] ?? null;
|
|
2268
|
+
throw new be("REF");
|
|
1683
2269
|
},
|
|
1684
2270
|
onRange: () => {
|
|
1685
|
-
throw new
|
|
2271
|
+
throw new be("REF");
|
|
1686
2272
|
}
|
|
1687
2273
|
});
|
|
1688
2274
|
}
|
|
1689
|
-
const
|
|
2275
|
+
const Fr = {
|
|
1690
2276
|
REF: "#REF!",
|
|
1691
2277
|
VALUE: "#VALUE!",
|
|
1692
2278
|
DIV0: "#DIV/0!",
|
|
@@ -1696,34 +2282,34 @@ const or = {
|
|
|
1696
2282
|
NUM: "#NUM!",
|
|
1697
2283
|
NULL: "#NULL!"
|
|
1698
2284
|
};
|
|
1699
|
-
function
|
|
1700
|
-
const r = e instanceof
|
|
1701
|
-
return
|
|
2285
|
+
function Dt(e) {
|
|
2286
|
+
const r = e instanceof be ? e.code : "ERROR";
|
|
2287
|
+
return Fr[r];
|
|
1702
2288
|
}
|
|
1703
|
-
async function
|
|
2289
|
+
async function vi(e, r) {
|
|
1704
2290
|
return e.length === 0 ? r.map((t) => ({
|
|
1705
2291
|
id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
|
|
1706
2292
|
label: (t == null ? void 0 : t.label) ?? "(unknown)",
|
|
1707
2293
|
value: null,
|
|
1708
|
-
error:
|
|
2294
|
+
error: Fr.ERROR
|
|
1709
2295
|
})) : Promise.all(
|
|
1710
2296
|
r.map(async (t) => {
|
|
1711
2297
|
try {
|
|
1712
2298
|
if (!t || typeof t.label != "string" || typeof t.expression != "string" || typeof t.id != "string")
|
|
1713
|
-
throw new
|
|
1714
|
-
return { id: t.id, label: t.label, value: await
|
|
2299
|
+
throw new be("ERROR");
|
|
2300
|
+
return { id: t.id, label: t.label, value: await bi(e, t.expression) };
|
|
1715
2301
|
} catch (n) {
|
|
1716
2302
|
return {
|
|
1717
2303
|
id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
|
|
1718
2304
|
label: (t == null ? void 0 : t.label) ?? "(unknown)",
|
|
1719
2305
|
value: null,
|
|
1720
|
-
error:
|
|
2306
|
+
error: Dt(n)
|
|
1721
2307
|
};
|
|
1722
2308
|
}
|
|
1723
2309
|
})
|
|
1724
2310
|
);
|
|
1725
2311
|
}
|
|
1726
|
-
function
|
|
2312
|
+
function tr(e) {
|
|
1727
2313
|
const r = /* @__PURE__ */ new Set();
|
|
1728
2314
|
for (const { id: t } of e) {
|
|
1729
2315
|
if (r.has(t)) return t;
|
|
@@ -1731,7 +2317,7 @@ function Dt(e) {
|
|
|
1731
2317
|
}
|
|
1732
2318
|
return null;
|
|
1733
2319
|
}
|
|
1734
|
-
function
|
|
2320
|
+
function $r(e) {
|
|
1735
2321
|
const { columnHeader: r, rowHeader: t, columns: n, rows: i } = e;
|
|
1736
2322
|
if (n !== void 0 && !Array.isArray(n))
|
|
1737
2323
|
return "columns must be an array of { id, label } objects.";
|
|
@@ -1741,150 +2327,150 @@ function ir(e) {
|
|
|
1741
2327
|
return "columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
|
|
1742
2328
|
if (i !== void 0 && i.length === 0)
|
|
1743
2329
|
return "rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
|
|
1744
|
-
const o = (d) => !!d && typeof d.id == "string" && d.id !== "" && typeof d.label == "string" && d.label !== "",
|
|
1745
|
-
if (
|
|
1746
|
-
return `columns[${
|
|
2330
|
+
const o = (d) => !!d && typeof d.id == "string" && d.id !== "" && typeof d.label == "string" && d.label !== "", l = n == null ? void 0 : n.findIndex((d) => !o(d));
|
|
2331
|
+
if (l != null && l !== -1)
|
|
2332
|
+
return `columns[${l}] must be a { id, label } object with non-empty string fields.`;
|
|
1747
2333
|
const a = i == null ? void 0 : i.findIndex((d) => !o(d));
|
|
1748
2334
|
if (a != null && a !== -1)
|
|
1749
2335
|
return `rows[${a}] must be a { id, label } object with non-empty string fields.`;
|
|
1750
2336
|
const c = !!n && n.length > 0, u = !!i && i.length > 0;
|
|
1751
2337
|
if (c) {
|
|
1752
|
-
const d =
|
|
2338
|
+
const d = tr(n);
|
|
1753
2339
|
if (d) return `duplicate column id "${d}" — every declared column id must be unique.`;
|
|
1754
2340
|
}
|
|
1755
2341
|
if (u) {
|
|
1756
|
-
const d =
|
|
2342
|
+
const d = tr(i);
|
|
1757
2343
|
if (d) return `duplicate row id "${d}" — every declared row id must be unique.`;
|
|
1758
2344
|
}
|
|
1759
2345
|
return r && t ? "columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape." : c && u ? "columns and rows cannot both be declared — pick one orientation for the persisted sheet shape." : r && !c ? "columnHeader is true but columns is missing or empty — declare the column list columnHeader positions map to." : t && !u ? "rowHeader is true but rows is missing or empty — declare the row list rowHeader positions map to." : null;
|
|
1760
2346
|
}
|
|
1761
|
-
function
|
|
1762
|
-
const t =
|
|
2347
|
+
function rr(e, r = {}) {
|
|
2348
|
+
const t = $r(r);
|
|
1763
2349
|
if (t) throw new Error(`x-spreadsheet: ${t}`);
|
|
1764
|
-
const { columnHeader: n, rowHeader: i, columns: o, rows:
|
|
1765
|
-
return o && o.length > 0 ?
|
|
2350
|
+
const { columnHeader: n, rowHeader: i, columns: o, rows: l } = r;
|
|
2351
|
+
return o && o.length > 0 ? wi(e, o, n === !0) : l && l.length > 0 ? Ei(e, l, i === !0) : e;
|
|
1766
2352
|
}
|
|
1767
|
-
function
|
|
2353
|
+
function wi(e, r, t) {
|
|
1768
2354
|
return (t ? e.slice(1) : e).map((i) => {
|
|
1769
2355
|
const o = /* @__PURE__ */ Object.create(null);
|
|
1770
|
-
return r.forEach((
|
|
1771
|
-
o[
|
|
2356
|
+
return r.forEach((l, a) => {
|
|
2357
|
+
o[l.id] = i[a] ?? null;
|
|
1772
2358
|
}), o;
|
|
1773
2359
|
});
|
|
1774
2360
|
}
|
|
1775
|
-
function
|
|
1776
|
-
const n = t ? 1 : 0, i = Math.max(0, ...e.map((
|
|
1777
|
-
return Array.from({ length: o }, (
|
|
2361
|
+
function Ei(e, r, t) {
|
|
2362
|
+
const n = t ? 1 : 0, i = Math.max(0, ...e.map((l) => l.length)), o = Math.max(0, i - n);
|
|
2363
|
+
return Array.from({ length: o }, (l, a) => {
|
|
1778
2364
|
const c = n + a, u = /* @__PURE__ */ Object.create(null);
|
|
1779
|
-
return r.forEach((d,
|
|
1780
|
-
var
|
|
1781
|
-
u[d.id] = ((
|
|
2365
|
+
return r.forEach((d, m) => {
|
|
2366
|
+
var f;
|
|
2367
|
+
u[d.id] = ((f = e[m]) == null ? void 0 : f[c]) ?? null;
|
|
1782
2368
|
}), u;
|
|
1783
2369
|
});
|
|
1784
2370
|
}
|
|
1785
|
-
function
|
|
2371
|
+
function Pr(e) {
|
|
1786
2372
|
return !Array.isArray(e[0]);
|
|
1787
2373
|
}
|
|
1788
|
-
function
|
|
2374
|
+
function xi(e) {
|
|
1789
2375
|
const r = /* @__PURE__ */ Object.create(null);
|
|
1790
2376
|
for (const { id: t, label: n, value: i, error: o } of e)
|
|
1791
2377
|
r[t] = o === void 0 ? { label: n, value: i } : { label: n, value: i, error: o };
|
|
1792
2378
|
return r;
|
|
1793
2379
|
}
|
|
1794
|
-
function
|
|
2380
|
+
function Tt(e, r) {
|
|
1795
2381
|
const t = (n) => n instanceof Date ? n.toISOString() : n ?? null;
|
|
1796
2382
|
return t(e) === t(r);
|
|
1797
2383
|
}
|
|
1798
|
-
function
|
|
2384
|
+
function Ti(e, r) {
|
|
1799
2385
|
const t = e ?? {}, n = r ?? {}, i = Object.keys(t);
|
|
1800
2386
|
return i.length !== Object.keys(n).length ? !1 : i.every((o) => {
|
|
1801
2387
|
if (!Object.prototype.hasOwnProperty.call(n, o)) return !1;
|
|
1802
|
-
const
|
|
1803
|
-
return
|
|
2388
|
+
const l = t[o], a = n[o];
|
|
2389
|
+
return l.label === a.label && l.error === a.error && Tt(l.value, a.value);
|
|
1804
2390
|
});
|
|
1805
2391
|
}
|
|
1806
|
-
function
|
|
2392
|
+
function Ai(e, r) {
|
|
1807
2393
|
if (e == null || r == null) return e === r;
|
|
1808
2394
|
const t = Array.isArray(e);
|
|
1809
2395
|
if (t !== Array.isArray(r)) return !1;
|
|
1810
2396
|
if (t) {
|
|
1811
|
-
const
|
|
1812
|
-
return
|
|
2397
|
+
const l = e, a = r;
|
|
2398
|
+
return l.length === a.length && l.every((c, u) => Tt(c, a[u]));
|
|
1813
2399
|
}
|
|
1814
2400
|
const n = e, i = r, o = Object.keys(n);
|
|
1815
|
-
return o.length !== Object.keys(i).length ? !1 : o.every((
|
|
2401
|
+
return o.length !== Object.keys(i).length ? !1 : o.every((l) => Object.prototype.hasOwnProperty.call(i, l) && Tt(n[l], i[l]));
|
|
1816
2402
|
}
|
|
1817
|
-
function
|
|
2403
|
+
function Si(e, r) {
|
|
1818
2404
|
if (e === r) return !0;
|
|
1819
2405
|
if (e == null || r == null) return !1;
|
|
1820
2406
|
const t = e, n = r;
|
|
1821
|
-
return t.length !== n.length ? !1 : t.every((i, o) =>
|
|
2407
|
+
return t.length !== n.length ? !1 : t.every((i, o) => Ai(i, n[o]));
|
|
1822
2408
|
}
|
|
1823
|
-
function
|
|
2409
|
+
function Ri(e) {
|
|
1824
2410
|
return e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1825
2411
|
}
|
|
1826
|
-
function
|
|
2412
|
+
function Ur(e, r) {
|
|
1827
2413
|
if (e.length === 0) return [];
|
|
1828
2414
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
1829
2415
|
for (const o of r ?? [])
|
|
1830
2416
|
n.has(o) || (n.add(o), t.push(o));
|
|
1831
2417
|
for (const o of e)
|
|
1832
|
-
for (const
|
|
1833
|
-
n.has(
|
|
2418
|
+
for (const l of Object.keys(o))
|
|
2419
|
+
n.has(l) || (n.add(l), t.push(l));
|
|
1834
2420
|
if (t.length === 0) return [];
|
|
1835
2421
|
const i = e.map(
|
|
1836
|
-
(o) => t.map((
|
|
1837
|
-
if (!Object.prototype.hasOwnProperty.call(o,
|
|
1838
|
-
const a = o[
|
|
1839
|
-
return
|
|
2422
|
+
(o) => t.map((l) => {
|
|
2423
|
+
if (!Object.prototype.hasOwnProperty.call(o, l)) return null;
|
|
2424
|
+
const a = o[l];
|
|
2425
|
+
return Ri(a) ? a : null;
|
|
1840
2426
|
})
|
|
1841
2427
|
);
|
|
1842
2428
|
return [t, ...i];
|
|
1843
2429
|
}
|
|
1844
|
-
function
|
|
2430
|
+
function Ci(e) {
|
|
1845
2431
|
const r = Math.max(0, ...e.map((t) => t.length));
|
|
1846
2432
|
return Array.from({ length: r }, (t, n) => e.map((i) => i[n] ?? null));
|
|
1847
2433
|
}
|
|
1848
|
-
const
|
|
1849
|
-
function
|
|
2434
|
+
const Oi = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", ki = 10 * 1024 * 1024, vt = 200, Ii = 50, Di = [];
|
|
2435
|
+
function nr(e) {
|
|
1850
2436
|
return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1851
2437
|
}
|
|
1852
|
-
const
|
|
2438
|
+
const Ni = ({
|
|
1853
2439
|
data: e,
|
|
1854
2440
|
handleChange: r,
|
|
1855
2441
|
path: t,
|
|
1856
2442
|
label: n,
|
|
1857
2443
|
required: i,
|
|
1858
2444
|
schema: o,
|
|
1859
|
-
enabled:
|
|
2445
|
+
enabled: l,
|
|
1860
2446
|
readonly: a,
|
|
1861
2447
|
errors: c,
|
|
1862
2448
|
visible: u = !0
|
|
1863
2449
|
}) => {
|
|
1864
|
-
|
|
1865
|
-
const d =
|
|
1866
|
-
() =>
|
|
1867
|
-
), [
|
|
1868
|
-
(
|
|
1869
|
-
if (!
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
|
|
2450
|
+
Le(u, t, r);
|
|
2451
|
+
const d = Ce(t, i, u), m = !c || c.length === 0, f = Nr(l, a), g = (o == null ? void 0 : o["x-spreadsheet"]) ?? {}, E = (o == null ? void 0 : o["x-evaluate"]) ?? Di, v = g.accept ?? Oi, z = g.maxSize ?? ki, R = g.columnHeader === !0, j = g.rowHeader === !0, S = g.columns, C = g.rows, A = Array.isArray(S) && S.length > 0, T = Array.isArray(C) && C.length > 0, W = $r({ columnHeader: R, rowHeader: j, columns: S, rows: C }), U = g.showSheet !== !1, F = g.sheetName, M = g.persistSheet !== !1, x = e ?? null, [te, H] = Y(
|
|
2452
|
+
() => x != null && x.sheet || Object.keys((x == null ? void 0 : x.derivations) ?? {}).length > 0 ? "ready" : "empty"
|
|
2453
|
+
), [J, B] = Y(null), [le, ve] = Y(!1), [ne, ae] = Y(null), [$, Z] = Y(null), I = he(null), re = he(null), Q = (x == null ? void 0 : x.sheet) ?? null, _ = Be(
|
|
2454
|
+
(D) => {
|
|
2455
|
+
if (!Pr(D)) return D;
|
|
2456
|
+
const X = T ? C : A ? S : void 0, de = Ur(
|
|
2457
|
+
D,
|
|
2458
|
+
X == null ? void 0 : X.map((K) => K.id)
|
|
1873
2459
|
);
|
|
1874
|
-
return
|
|
2460
|
+
return T ? Ci(de) : de;
|
|
1875
2461
|
},
|
|
1876
|
-
[
|
|
1877
|
-
),
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
Math.max(0, ...
|
|
1881
|
-
),
|
|
1882
|
-
return /* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
!
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
|
|
1887
|
-
var
|
|
2462
|
+
[A, T, S, C]
|
|
2463
|
+
), b = Se(() => ne ?? (Q ? _(Q) : null), [ne, Q, _]), O = (($ == null ? void 0 : $.matrix) === b ? $.derivations : null) ?? (x == null ? void 0 : x.derivations) ?? {}, V = b != null || x != null, G = Se(() => {
|
|
2464
|
+
const D = A ? 1 : 0, X = T ? 1 : 0, de = b ? b.slice(D) : [], K = de.slice(0, vt), q = Math.min(
|
|
2465
|
+
Ii,
|
|
2466
|
+
Math.max(0, ...K.map((fe) => Math.max(0, fe.length - X)))
|
|
2467
|
+
), xe = Array.from({ length: q }, (fe, ke) => ke + X), $e = "", et = T && !A;
|
|
2468
|
+
return /* @__PURE__ */ s(Ae, { children: b && U && /* @__PURE__ */ p(N, { mt: "3", children: [
|
|
2469
|
+
/* @__PURE__ */ s(N, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ p(Me.Root, { variant: "surface", size: "1", children: [
|
|
2470
|
+
!et && /* @__PURE__ */ s(Me.Header, { children: /* @__PURE__ */ p(Me.Row, { children: [
|
|
2471
|
+
/* @__PURE__ */ s(Me.ColumnHeaderCell, { children: $e }),
|
|
2472
|
+
xe.map((fe) => {
|
|
2473
|
+
var ke;
|
|
1888
2474
|
return (
|
|
1889
2475
|
// This row only renders when hasRows isn't the sole
|
|
1890
2476
|
// flag set (see suppressColumnHeaderRow) — so reaching
|
|
@@ -1892,227 +2478,227 @@ const Ao = ({
|
|
|
1892
2478
|
// looked up positionally — never read from the matrix
|
|
1893
2479
|
// cell itself, which only ever holds the id) or both
|
|
1894
2480
|
// are false (columnLetter fallback).
|
|
1895
|
-
/* @__PURE__ */
|
|
2481
|
+
/* @__PURE__ */ s(Me.ColumnHeaderCell, { children: A ? ((ke = S == null ? void 0 : S[fe]) == null ? void 0 : ke.label) ?? "" : ti(fe) }, fe)
|
|
1896
2482
|
);
|
|
1897
2483
|
})
|
|
1898
2484
|
] }) }),
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
var
|
|
1901
|
-
const
|
|
1902
|
-
return /* @__PURE__ */
|
|
1903
|
-
/* @__PURE__ */
|
|
1904
|
-
|
|
2485
|
+
/* @__PURE__ */ s(Me.Body, { children: K.map((fe, ke) => {
|
|
2486
|
+
var Ke;
|
|
2487
|
+
const qe = D + ke;
|
|
2488
|
+
return /* @__PURE__ */ p(Me.Row, { children: [
|
|
2489
|
+
/* @__PURE__ */ s(
|
|
2490
|
+
Me.RowHeaderCell,
|
|
1905
2491
|
{
|
|
1906
|
-
style:
|
|
1907
|
-
children:
|
|
2492
|
+
style: T ? { fontWeight: 700, background: "var(--gray-a3)" } : void 0,
|
|
2493
|
+
children: T ? ((Ke = C == null ? void 0 : C[qe]) == null ? void 0 : Ke.label) ?? "" : A ? "" : qe + 1
|
|
1908
2494
|
}
|
|
1909
2495
|
),
|
|
1910
|
-
|
|
1911
|
-
] },
|
|
2496
|
+
xe.map((it) => /* @__PURE__ */ s(Me.Cell, { children: nr(fe[it]) }, it))
|
|
2497
|
+
] }, ke);
|
|
1912
2498
|
}) })
|
|
1913
2499
|
] }) }),
|
|
1914
|
-
|
|
2500
|
+
de.length > vt && /* @__PURE__ */ p(h, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
|
|
1915
2501
|
"Showing first ",
|
|
1916
|
-
|
|
2502
|
+
vt,
|
|
1917
2503
|
" of ",
|
|
1918
|
-
|
|
2504
|
+
de.length,
|
|
1919
2505
|
" rows"
|
|
1920
2506
|
] })
|
|
1921
2507
|
] }) });
|
|
1922
|
-
}, [
|
|
1923
|
-
async (
|
|
1924
|
-
if (
|
|
1925
|
-
|
|
2508
|
+
}, [b, U, A, T, S, C]), y = Be(
|
|
2509
|
+
async (D) => {
|
|
2510
|
+
if (B(null), D.size > z) {
|
|
2511
|
+
B(`File exceeds the ${Ie(z)} limit.`);
|
|
1926
2512
|
return;
|
|
1927
2513
|
}
|
|
1928
|
-
if (!
|
|
1929
|
-
|
|
2514
|
+
if (!v.split(",").map((q) => q.trim()).some((q) => q === "*" || q === "*/*" ? !0 : q.endsWith("/*") ? D.type.startsWith(q.slice(0, -1)) : q.startsWith(".") ? D.name.toLowerCase().endsWith(q.toLowerCase()) : D.type === q)) {
|
|
2515
|
+
B(`Invalid type. Accepted: ${De(v)}`);
|
|
1930
2516
|
return;
|
|
1931
2517
|
}
|
|
1932
|
-
|
|
1933
|
-
let
|
|
2518
|
+
H("parsing");
|
|
2519
|
+
let K;
|
|
1934
2520
|
try {
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1937
|
-
} catch (
|
|
1938
|
-
|
|
1939
|
-
|
|
2521
|
+
const q = await D.arrayBuffer();
|
|
2522
|
+
K = (await ei(q, F)).matrix;
|
|
2523
|
+
} catch (q) {
|
|
2524
|
+
H("error"), B(
|
|
2525
|
+
q instanceof xt ? q.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
|
|
1940
2526
|
);
|
|
1941
2527
|
return;
|
|
1942
2528
|
}
|
|
1943
|
-
if (
|
|
2529
|
+
if (A || T)
|
|
1944
2530
|
try {
|
|
1945
|
-
|
|
1946
|
-
} catch (
|
|
1947
|
-
|
|
2531
|
+
K = _(rr(K, { columnHeader: R, rowHeader: j, columns: S, rows: C }));
|
|
2532
|
+
} catch (q) {
|
|
2533
|
+
H("error"), B(q instanceof Error ? q.message : "Failed to process this sheet.");
|
|
1948
2534
|
return;
|
|
1949
2535
|
}
|
|
1950
|
-
|
|
2536
|
+
re.current = (e == null ? void 0 : e.sheet) ?? null, ae(K), H("ready");
|
|
1951
2537
|
},
|
|
1952
|
-
[
|
|
2538
|
+
[v, z, F, e, R, j, S, C, A, T, _]
|
|
1953
2539
|
);
|
|
1954
|
-
if (
|
|
1955
|
-
|
|
1956
|
-
}, [
|
|
1957
|
-
if (
|
|
1958
|
-
let
|
|
1959
|
-
const
|
|
1960
|
-
|
|
1961
|
-
},
|
|
1962
|
-
if (
|
|
1963
|
-
|
|
2540
|
+
if (ye(() => {
|
|
2541
|
+
ne != null && Q != null && Q !== re.current && ae(null);
|
|
2542
|
+
}, [ne, Q]), ye(() => {
|
|
2543
|
+
if (W || E.length === 0 && !M) return;
|
|
2544
|
+
let D = !1;
|
|
2545
|
+
const X = (K) => {
|
|
2546
|
+
f && (Ti(x == null ? void 0 : x.derivations, K == null ? void 0 : K.derivations) && Si(x == null ? void 0 : x.sheet, K == null ? void 0 : K.sheet) || (re.current = (K == null ? void 0 : K.sheet) ?? null, r(t, K)));
|
|
2547
|
+
}, de = b ?? [];
|
|
2548
|
+
if (de.length === 0) {
|
|
2549
|
+
x != null && X(void 0);
|
|
1964
2550
|
return;
|
|
1965
2551
|
}
|
|
1966
|
-
return
|
|
1967
|
-
if (
|
|
1968
|
-
let
|
|
1969
|
-
if (
|
|
1970
|
-
if (
|
|
2552
|
+
return vi(de, E).then((K) => {
|
|
2553
|
+
if (D) return;
|
|
2554
|
+
let q;
|
|
2555
|
+
if (ne != null) {
|
|
2556
|
+
if (M)
|
|
1971
2557
|
try {
|
|
1972
|
-
|
|
1973
|
-
} catch (
|
|
1974
|
-
|
|
2558
|
+
q = rr(de, { columnHeader: A, rowHeader: T, columns: S, rows: C });
|
|
2559
|
+
} catch ($e) {
|
|
2560
|
+
B($e instanceof Error ? $e.message : "Failed to process this sheet.");
|
|
1975
2561
|
return;
|
|
1976
2562
|
}
|
|
1977
2563
|
} else
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
const
|
|
1981
|
-
|
|
2564
|
+
q = x == null ? void 0 : x.sheet;
|
|
2565
|
+
B(null);
|
|
2566
|
+
const xe = xi(K);
|
|
2567
|
+
Z({ matrix: de, derivations: xe }), X(q === void 0 ? { derivations: xe } : { sheet: q, derivations: xe });
|
|
1982
2568
|
}), () => {
|
|
1983
|
-
|
|
2569
|
+
D = !0;
|
|
1984
2570
|
};
|
|
1985
|
-
}, [
|
|
2571
|
+
}, [b, ne, E, f, M, A, T, S, C, W]), u === !1)
|
|
1986
2572
|
return null;
|
|
1987
|
-
if (
|
|
1988
|
-
return /* @__PURE__ */
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
2573
|
+
if (W)
|
|
2574
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
2575
|
+
/* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: n }),
|
|
2576
|
+
/* @__PURE__ */ p(h, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
1991
2577
|
"Invalid x-spreadsheet config: ",
|
|
1992
|
-
|
|
2578
|
+
W
|
|
1993
2579
|
] })
|
|
1994
2580
|
] });
|
|
1995
|
-
if (!
|
|
1996
|
-
const
|
|
1997
|
-
|
|
1998
|
-
},
|
|
1999
|
-
var
|
|
2000
|
-
|
|
2001
|
-
},
|
|
2002
|
-
var
|
|
2003
|
-
(
|
|
2004
|
-
},
|
|
2005
|
-
|
|
2006
|
-
}, me =
|
|
2007
|
-
return /* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2581
|
+
if (!f && !V) return null;
|
|
2582
|
+
const k = (D) => {
|
|
2583
|
+
D.preventDefault(), D.stopPropagation(), f && ve(D.type === "dragenter" || D.type === "dragover");
|
|
2584
|
+
}, ee = (D) => {
|
|
2585
|
+
var X;
|
|
2586
|
+
D.preventDefault(), D.stopPropagation(), ve(!1), f && (X = D.dataTransfer.files) != null && X[0] && y(D.dataTransfer.files[0]);
|
|
2587
|
+
}, se = (D) => {
|
|
2588
|
+
var X;
|
|
2589
|
+
(X = D.target.files) != null && X[0] && (y(D.target.files[0]), D.target.value = "");
|
|
2590
|
+
}, ce = () => {
|
|
2591
|
+
f && (ae(null), Z(null), re.current = null, B(null), H("empty"), r(t, void 0));
|
|
2592
|
+
}, me = U && b == null && x != null;
|
|
2593
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
2594
|
+
/* @__PURE__ */ p(L, { align: "center", justify: "between", mb: "2", children: [
|
|
2595
|
+
/* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
|
|
2596
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", children: [
|
|
2011
2597
|
n,
|
|
2012
|
-
d && /* @__PURE__ */
|
|
2598
|
+
d && /* @__PURE__ */ s(h, { color: "red", children: " *" })
|
|
2013
2599
|
] }),
|
|
2014
|
-
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
|
|
2600
|
+
V && f && /* @__PURE__ */ p(Ae, { children: [
|
|
2601
|
+
/* @__PURE__ */ s(rt, { content: "Replace spreadsheet", children: /* @__PURE__ */ s(
|
|
2602
|
+
Ze,
|
|
2017
2603
|
{
|
|
2018
2604
|
variant: "ghost",
|
|
2019
2605
|
size: "1",
|
|
2020
2606
|
onClick: () => {
|
|
2021
|
-
var
|
|
2022
|
-
return (
|
|
2607
|
+
var D;
|
|
2608
|
+
return (D = I.current) == null ? void 0 : D.click();
|
|
2023
2609
|
},
|
|
2024
2610
|
"aria-label": "Replace spreadsheet",
|
|
2025
|
-
children: /* @__PURE__ */
|
|
2611
|
+
children: /* @__PURE__ */ s(Ge, {})
|
|
2026
2612
|
}
|
|
2027
2613
|
) }),
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
|
|
2614
|
+
/* @__PURE__ */ s(rt, { content: "Remove spreadsheet", children: /* @__PURE__ */ s(
|
|
2615
|
+
Ze,
|
|
2030
2616
|
{
|
|
2031
2617
|
variant: "ghost",
|
|
2032
2618
|
size: "1",
|
|
2033
2619
|
color: "gray",
|
|
2034
|
-
onClick:
|
|
2620
|
+
onClick: ce,
|
|
2035
2621
|
"aria-label": "Remove spreadsheet",
|
|
2036
|
-
children: /* @__PURE__ */
|
|
2622
|
+
children: /* @__PURE__ */ s(Ct, {})
|
|
2037
2623
|
}
|
|
2038
2624
|
) })
|
|
2039
2625
|
] })
|
|
2040
2626
|
] }),
|
|
2041
|
-
/* @__PURE__ */
|
|
2042
|
-
|
|
2627
|
+
/* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
|
|
2628
|
+
Ie(z),
|
|
2043
2629
|
" max · ",
|
|
2044
|
-
|
|
2630
|
+
De(v)
|
|
2045
2631
|
] })
|
|
2046
2632
|
] }),
|
|
2047
|
-
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
|
|
2633
|
+
V && J && /* @__PURE__ */ s(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: J }),
|
|
2634
|
+
/* @__PURE__ */ s("input", { ref: I, type: "file", style: { display: "none" }, accept: v, onChange: se }),
|
|
2635
|
+
f && !V && /* @__PURE__ */ s(
|
|
2050
2636
|
"div",
|
|
2051
2637
|
{
|
|
2052
2638
|
role: "button",
|
|
2053
2639
|
tabIndex: 0,
|
|
2054
2640
|
onClick: () => {
|
|
2055
|
-
var
|
|
2056
|
-
return (
|
|
2641
|
+
var D;
|
|
2642
|
+
return (D = I.current) == null ? void 0 : D.click();
|
|
2057
2643
|
},
|
|
2058
|
-
onKeyDown: (
|
|
2059
|
-
var
|
|
2060
|
-
(
|
|
2644
|
+
onKeyDown: (D) => {
|
|
2645
|
+
var X;
|
|
2646
|
+
(D.key === "Enter" || D.key === " ") && (D.preventDefault(), (X = I.current) == null || X.click());
|
|
2061
2647
|
},
|
|
2062
|
-
onDragEnter:
|
|
2063
|
-
onDragLeave:
|
|
2064
|
-
onDragOver:
|
|
2065
|
-
onDrop:
|
|
2648
|
+
onDragEnter: k,
|
|
2649
|
+
onDragLeave: k,
|
|
2650
|
+
onDragOver: k,
|
|
2651
|
+
onDrop: ee,
|
|
2066
2652
|
style: { cursor: "pointer" },
|
|
2067
2653
|
className: [
|
|
2068
2654
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
2069
2655
|
"transition-all duration-200 ease-in-out",
|
|
2070
|
-
|
|
2656
|
+
le ? "border-blue-500 bg-blue-50" : J ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
2071
2657
|
].join(" "),
|
|
2072
|
-
children: /* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
] }) :
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2079
|
-
] }) : /* @__PURE__ */
|
|
2080
|
-
/* @__PURE__ */
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
|
|
2658
|
+
children: /* @__PURE__ */ s(L, { direction: "column", align: "center", gap: "2", children: te === "parsing" ? /* @__PURE__ */ p(Ae, { children: [
|
|
2659
|
+
/* @__PURE__ */ s(Je, { size: "3" }),
|
|
2660
|
+
/* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
|
|
2661
|
+
] }) : J ? /* @__PURE__ */ p(Ae, { children: [
|
|
2662
|
+
/* @__PURE__ */ s(ht, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
2663
|
+
/* @__PURE__ */ s(h, { size: "2", color: "red", weight: "medium", children: J }),
|
|
2664
|
+
/* @__PURE__ */ s(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
2665
|
+
] }) : /* @__PURE__ */ p(Ae, { children: [
|
|
2666
|
+
/* @__PURE__ */ s(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
2667
|
+
/* @__PURE__ */ s(h, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
|
|
2668
|
+
/* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
|
|
2669
|
+
Ie(z),
|
|
2084
2670
|
" max · ",
|
|
2085
|
-
|
|
2671
|
+
De(v)
|
|
2086
2672
|
] })
|
|
2087
2673
|
] }) })
|
|
2088
2674
|
}
|
|
2089
2675
|
),
|
|
2090
|
-
|
|
2091
|
-
me && /* @__PURE__ */
|
|
2092
|
-
Object.keys(
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
|
|
2676
|
+
G,
|
|
2677
|
+
me && /* @__PURE__ */ s(h, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
|
|
2678
|
+
Object.keys(O).length > 0 && /* @__PURE__ */ p(N, { mt: "3", children: [
|
|
2679
|
+
/* @__PURE__ */ s(h, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
|
|
2680
|
+
/* @__PURE__ */ s(L, { direction: "column", gap: "1", children: Object.entries(O).map(([D, X]) => /* @__PURE__ */ p(L, { justify: "between", children: [
|
|
2681
|
+
/* @__PURE__ */ s(h, { size: "2", children: X.label }),
|
|
2682
|
+
X.error ? /* @__PURE__ */ s(h, { size: "2", color: "red", children: X.error }) : (
|
|
2097
2683
|
// d.value is CellValue | null now (SUM/AVERAGE aren't the only
|
|
2098
2684
|
// possible results anymore — INDEX/CONCATENATE can return a
|
|
2099
2685
|
// string, a bare comparison can return a boolean, etc.), so
|
|
2100
2686
|
// `.toLocaleString()` would throw for e.g. a boolean result.
|
|
2101
2687
|
// Reuse the same formatCell used for the sheet-preview grid.
|
|
2102
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ s(h, { size: "2", children: nr(X.value) })
|
|
2103
2689
|
)
|
|
2104
|
-
] },
|
|
2690
|
+
] }, D)) })
|
|
2105
2691
|
] }),
|
|
2106
|
-
!
|
|
2692
|
+
!m && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Oe(c, n) })
|
|
2107
2693
|
] });
|
|
2108
|
-
},
|
|
2694
|
+
}, Li = Ee(Ni), zi = ue(
|
|
2109
2695
|
10,
|
|
2110
2696
|
// matches FileControlTester's rank — beats the default object/Group renderer
|
|
2111
|
-
|
|
2697
|
+
_e(
|
|
2112
2698
|
(e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
|
|
2113
2699
|
)
|
|
2114
|
-
),
|
|
2115
|
-
function
|
|
2700
|
+
), Mi = "Sheet1", Fi = "xlsx";
|
|
2701
|
+
function $i(e) {
|
|
2116
2702
|
if (e === void 0) return null;
|
|
2117
2703
|
if (!Array.isArray(e)) return "columns must be an array of { id, label } objects.";
|
|
2118
2704
|
if (e.length === 0)
|
|
@@ -2122,64 +2708,64 @@ function No(e) {
|
|
|
2122
2708
|
);
|
|
2123
2709
|
return r !== -1 ? `columns[${r}] must be a { id, label } object with non-empty string fields.` : null;
|
|
2124
2710
|
}
|
|
2125
|
-
function
|
|
2126
|
-
if (!
|
|
2127
|
-
const t =
|
|
2711
|
+
function Pi(e, r) {
|
|
2712
|
+
if (!Pr(e)) return e;
|
|
2713
|
+
const t = Ur(
|
|
2128
2714
|
e,
|
|
2129
|
-
r == null ? void 0 : r.map((
|
|
2715
|
+
r == null ? void 0 : r.map((l) => l.id)
|
|
2130
2716
|
);
|
|
2131
2717
|
if (!r || t.length === 0) return t;
|
|
2132
|
-
const n = new Map(r.map((
|
|
2133
|
-
return [i.map((
|
|
2718
|
+
const n = new Map(r.map((l) => [l.id, l.label])), [i, ...o] = t;
|
|
2719
|
+
return [i.map((l) => n.get(String(l)) ?? l), ...o];
|
|
2134
2720
|
}
|
|
2135
|
-
const
|
|
2136
|
-
const [o,
|
|
2721
|
+
const Ui = ({ data: e, path: r, label: t, schema: n, visible: i = !0 }) => {
|
|
2722
|
+
const [o, l] = Y(null), a = Ne();
|
|
2137
2723
|
if (i === !1)
|
|
2138
2724
|
return null;
|
|
2139
|
-
const c = (n == null ? void 0 : n["x-spreadsheet-export"]) ?? {}, u = c.columns, d = c.sheetName ??
|
|
2140
|
-
if (
|
|
2141
|
-
return /* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2725
|
+
const c = (n == null ? void 0 : n["x-spreadsheet-export"]) ?? {}, u = c.columns, d = c.sheetName ?? Mi, m = c.fileType ?? Fi, f = c.fileName ?? `export.${m}`, g = $i(u);
|
|
2726
|
+
if (g)
|
|
2727
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
2728
|
+
/* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: t }),
|
|
2729
|
+
/* @__PURE__ */ p(h, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
2144
2730
|
"Invalid x-spreadsheet-export config: ",
|
|
2145
|
-
|
|
2731
|
+
g
|
|
2146
2732
|
] })
|
|
2147
2733
|
] });
|
|
2148
|
-
const
|
|
2149
|
-
var
|
|
2150
|
-
if (
|
|
2151
|
-
|
|
2734
|
+
const E = Array.isArray(e) && e.length > 0, v = async () => {
|
|
2735
|
+
var z, R;
|
|
2736
|
+
if (E) {
|
|
2737
|
+
l(null);
|
|
2152
2738
|
try {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2157
|
-
} catch (
|
|
2158
|
-
|
|
2739
|
+
const j = await import("@e965/xlsx"), S = Pi(e, u), C = j.utils.aoa_to_sheet(S), A = j.utils.book_new();
|
|
2740
|
+
j.utils.book_append_sheet(A, C, d);
|
|
2741
|
+
const T = r.split(".").slice(0, -1).join("."), W = T ? Xe.data((z = a.core) == null ? void 0 : z.data, T) : (R = a.core) == null ? void 0 : R.data;
|
|
2742
|
+
j.writeFile(A, It(f, W, `export.${m}`), { bookType: m });
|
|
2743
|
+
} catch (j) {
|
|
2744
|
+
l(j instanceof Error ? j.message : "Failed to build the workbook.");
|
|
2159
2745
|
}
|
|
2160
2746
|
}
|
|
2161
2747
|
};
|
|
2162
|
-
return /* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
/* @__PURE__ */
|
|
2165
|
-
/* @__PURE__ */
|
|
2748
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
2749
|
+
/* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: t }),
|
|
2750
|
+
/* @__PURE__ */ p(Re, { type: "button", variant: "soft", disabled: !E, onClick: () => void v(), children: [
|
|
2751
|
+
/* @__PURE__ */ s(Rt, {}),
|
|
2166
2752
|
" Download Spreadsheet"
|
|
2167
2753
|
] }),
|
|
2168
|
-
o && /* @__PURE__ */
|
|
2754
|
+
o && /* @__PURE__ */ s(h, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: o })
|
|
2169
2755
|
] });
|
|
2170
|
-
},
|
|
2756
|
+
}, ji = Ee(Ui), _i = ue(
|
|
2171
2757
|
10,
|
|
2172
|
-
|
|
2173
|
-
|
|
2758
|
+
mr(
|
|
2759
|
+
_e((e) => {
|
|
2174
2760
|
const r = e["x-spreadsheet-export"];
|
|
2175
2761
|
return e.type === "array" && typeof r == "object" && r !== null;
|
|
2176
2762
|
}),
|
|
2177
|
-
|
|
2763
|
+
mn(gn("editable", !0))
|
|
2178
2764
|
)
|
|
2179
2765
|
);
|
|
2180
|
-
class
|
|
2766
|
+
class Ue extends Error {
|
|
2181
2767
|
}
|
|
2182
|
-
const
|
|
2768
|
+
const or = 5e6, Vi = 1024, Wi = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i, Hi = {
|
|
2183
2769
|
// Default is true, which would silently drop what in many formats is most of
|
|
2184
2770
|
// the payload.
|
|
2185
2771
|
ignoreAttributes: !1,
|
|
@@ -2226,7 +2812,7 @@ const Lt = 5e6, Mo = 1024, zo = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["'
|
|
|
2226
2812
|
maxNestedTags: 100,
|
|
2227
2813
|
strictReservedNames: !0
|
|
2228
2814
|
};
|
|
2229
|
-
function
|
|
2815
|
+
function Bi(e) {
|
|
2230
2816
|
const r = new Set(e);
|
|
2231
2817
|
return r.size === 0 ? () => !1 : (t, n) => (
|
|
2232
2818
|
// A string while the library's own `jPath` option is true (the default) and
|
|
@@ -2234,120 +2820,120 @@ function $o(e) {
|
|
|
2234
2820
|
r.has(typeof n == "string" ? n : n.toString()) || r.has(t)
|
|
2235
2821
|
);
|
|
2236
2822
|
}
|
|
2237
|
-
function
|
|
2823
|
+
function Xi(e) {
|
|
2238
2824
|
const r = e instanceof Error ? e.message : "";
|
|
2239
2825
|
return r.startsWith("[SECURITY] Invalid name:") ? "This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely." : r === "External entities are not supported" || r === "Parameter entities are not supported" ? `${r}. Please remove the DOCTYPE entity declarations and try again.` : r.startsWith("Maximum nested tags exceeded") ? "This document is nested too deeply to parse." : r.startsWith("Entity count") || r.includes("exceeds maximum allowed") ? "This document declares too many or too large entity definitions to expand safely." : "This doesn't look like a valid XML document. Please check the file and try again.";
|
|
2240
2826
|
}
|
|
2241
|
-
async function
|
|
2827
|
+
async function qi(e, r = {}) {
|
|
2242
2828
|
var u;
|
|
2243
|
-
if (typeof e != "string") throw new
|
|
2829
|
+
if (typeof e != "string") throw new Ue("This file could not be read as text.");
|
|
2244
2830
|
const t = e.charCodeAt(0) === 65279 ? e.slice(1) : e;
|
|
2245
|
-
if (t.trim() === "") throw new
|
|
2246
|
-
if (t.length >
|
|
2247
|
-
throw new
|
|
2248
|
-
`This document is too large to parse (over ${
|
|
2831
|
+
if (t.trim() === "") throw new Ue("This file is empty.");
|
|
2832
|
+
if (t.length > or)
|
|
2833
|
+
throw new Ue(
|
|
2834
|
+
`This document is too large to parse (over ${or / 1e6} million characters).`
|
|
2249
2835
|
);
|
|
2250
|
-
const n = (u =
|
|
2836
|
+
const n = (u = Wi.exec(t.slice(0, Vi))) == null ? void 0 : u[1];
|
|
2251
2837
|
if (n && !/^utf-?8$/i.test(n))
|
|
2252
|
-
throw new
|
|
2838
|
+
throw new Ue(
|
|
2253
2839
|
`This document declares the unsupported encoding "${n}". Only UTF-8 is supported.`
|
|
2254
2840
|
);
|
|
2255
|
-
const { XMLParser: i, XMLValidator: o } = await import("fast-xml-parser"),
|
|
2256
|
-
if (
|
|
2257
|
-
const { msg: d, line:
|
|
2258
|
-
throw new
|
|
2841
|
+
const { XMLParser: i, XMLValidator: o } = await import("fast-xml-parser"), l = o.validate(t, { allowBooleanAttributes: !1 });
|
|
2842
|
+
if (l !== !0) {
|
|
2843
|
+
const { msg: d, line: m, col: f } = l.err;
|
|
2844
|
+
throw new Ue(`Invalid XML at line ${m}, column ${f}: ${d}`);
|
|
2259
2845
|
}
|
|
2260
2846
|
const a = new i({
|
|
2261
|
-
...
|
|
2847
|
+
...Hi,
|
|
2262
2848
|
removeNSPrefix: r.removeNamespaces === !0,
|
|
2263
|
-
isArray:
|
|
2849
|
+
isArray: Bi(r.arrayPaths ?? [])
|
|
2264
2850
|
});
|
|
2265
2851
|
let c;
|
|
2266
2852
|
try {
|
|
2267
2853
|
c = a.parse(t);
|
|
2268
2854
|
} catch (d) {
|
|
2269
|
-
throw new
|
|
2855
|
+
throw new Ue(Xi(d));
|
|
2270
2856
|
}
|
|
2271
2857
|
if (c == null || typeof c != "object" || Array.isArray(c))
|
|
2272
|
-
throw new
|
|
2858
|
+
throw new Ue("This document has no root element.");
|
|
2273
2859
|
return c;
|
|
2274
2860
|
}
|
|
2275
|
-
function
|
|
2276
|
-
const { path: n, default: i } = typeof t == "string" ? { path: t, default: void 0 } : t, o =
|
|
2861
|
+
function jr(e, r, t) {
|
|
2862
|
+
const { path: n, default: i } = typeof t == "string" ? { path: t, default: void 0 } : t, o = Xe.data(e, r ? `${r}.${n}` : n);
|
|
2277
2863
|
return o ?? i;
|
|
2278
2864
|
}
|
|
2279
|
-
function
|
|
2865
|
+
function Ki(e, r, t) {
|
|
2280
2866
|
const n = {};
|
|
2281
2867
|
for (const [i, o] of Object.entries(t)) {
|
|
2282
|
-
const
|
|
2283
|
-
if (
|
|
2284
|
-
n[i] =
|
|
2868
|
+
const l = jr(e, r, o);
|
|
2869
|
+
if (l === void 0) return;
|
|
2870
|
+
n[i] = l;
|
|
2285
2871
|
}
|
|
2286
2872
|
return n;
|
|
2287
2873
|
}
|
|
2288
|
-
async function
|
|
2874
|
+
async function Yi(e, r) {
|
|
2289
2875
|
try {
|
|
2290
|
-
return { status: "ok", value: await
|
|
2876
|
+
return { status: "ok", value: await Mr(e, r) };
|
|
2291
2877
|
} catch (t) {
|
|
2292
|
-
return { status: "error", error:
|
|
2878
|
+
return { status: "error", error: Dt(t) };
|
|
2293
2879
|
}
|
|
2294
2880
|
}
|
|
2295
|
-
function
|
|
2296
|
-
return e == null ? "" : typeof e == "number" ? e.toFixed(
|
|
2881
|
+
function _r(e, r) {
|
|
2882
|
+
return e == null ? "" : typeof e == "number" ? e.toFixed(Gi(r)) : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
2297
2883
|
}
|
|
2298
|
-
function
|
|
2884
|
+
function Gi(e) {
|
|
2299
2885
|
return Number.isFinite(e) ? Math.min(100, Math.max(0, Math.trunc(e))) : 0;
|
|
2300
2886
|
}
|
|
2301
|
-
const
|
|
2302
|
-
function
|
|
2303
|
-
return e == null || e === "" ?
|
|
2887
|
+
const je = { found: !1 }, Te = (e) => ({ found: !0, value: e });
|
|
2888
|
+
function ir(e) {
|
|
2889
|
+
return e == null || e === "" ? je : Array.isArray(e) || e instanceof Date ? Te(e) : typeof e == "object" ? je : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? Te(e) : je;
|
|
2304
2890
|
}
|
|
2305
|
-
const
|
|
2306
|
-
async function
|
|
2891
|
+
const Ji = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), Zi = /* @__PURE__ */ new Set(["false", "0", "no", "n"]), Qi = /^(\d{4}-\d{2}-\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;
|
|
2892
|
+
async function es(e, r, t) {
|
|
2307
2893
|
switch (r.as) {
|
|
2308
2894
|
case void 0:
|
|
2309
|
-
return
|
|
2895
|
+
return Te(e);
|
|
2310
2896
|
case "string":
|
|
2311
|
-
return
|
|
2897
|
+
return Te(e instanceof Date ? e.toISOString() : String(e));
|
|
2312
2898
|
case "number": {
|
|
2313
2899
|
const n = e instanceof Date ? e.getTime() : Number(e);
|
|
2314
|
-
return Number.isFinite(n) ?
|
|
2900
|
+
return Number.isFinite(n) ? Te(r.decimals === void 0 ? n : _r(n, r.decimals)) : je;
|
|
2315
2901
|
}
|
|
2316
2902
|
case "boolean": {
|
|
2317
2903
|
const n = String(e).trim().toLowerCase();
|
|
2318
|
-
return
|
|
2904
|
+
return Ji.has(n) ? Te(!0) : Zi.has(n) ? Te(!1) : je;
|
|
2319
2905
|
}
|
|
2320
2906
|
case "date": {
|
|
2321
2907
|
const { default: n } = await import("dayjs"), { default: i } = await import("./customParseFormat-D14EWdSX.js").then((a) => a.c);
|
|
2322
2908
|
if (n.extend(i), t === "export") {
|
|
2323
|
-
const a = typeof e == "string" ?
|
|
2324
|
-
return c != null && c.isValid() ?
|
|
2909
|
+
const a = typeof e == "string" ? Qi.exec(e) : null, c = e instanceof Date ? n(e) : a ? n(a[1], "YYYY-MM-DD", !0) : null;
|
|
2910
|
+
return c != null && c.isValid() ? Te(c.format(r.format ?? "YYYY-MM-DD")) : je;
|
|
2325
2911
|
}
|
|
2326
|
-
const o = e instanceof Date ? e.toISOString() : String(e),
|
|
2327
|
-
return
|
|
2912
|
+
const o = e instanceof Date ? e.toISOString() : String(e), l = r.format ? n(o, r.format, !0) : n(o);
|
|
2913
|
+
return l.isValid() ? Te(l.format("YYYY-MM-DD")) : je;
|
|
2328
2914
|
}
|
|
2329
2915
|
}
|
|
2330
2916
|
}
|
|
2331
|
-
async function
|
|
2917
|
+
async function ts(e, r) {
|
|
2332
2918
|
if (r.formula !== void 0) {
|
|
2333
2919
|
const t = {};
|
|
2334
2920
|
for (const [n, i] of Object.entries(r.inputs ?? {})) {
|
|
2335
|
-
const o =
|
|
2336
|
-
if (!o.found || Array.isArray(o.value)) return
|
|
2921
|
+
const o = ir(Xe.data(e, i));
|
|
2922
|
+
if (!o.found || Array.isArray(o.value)) return je;
|
|
2337
2923
|
t[n] = o.value;
|
|
2338
2924
|
}
|
|
2339
2925
|
try {
|
|
2340
|
-
return
|
|
2926
|
+
return Te(await Mr(t, r.formula));
|
|
2341
2927
|
} catch (n) {
|
|
2342
|
-
throw new Error(`writeTo "${r.to}": ${
|
|
2928
|
+
throw new Error(`writeTo "${r.to}": ${Dt(n)}`);
|
|
2343
2929
|
}
|
|
2344
2930
|
}
|
|
2345
2931
|
if (r.from === void 0) throw new Error(`writeTo "${r.to}" needs either "from" or "formula".`);
|
|
2346
|
-
return
|
|
2932
|
+
return ir(Xe.data(e, r.from));
|
|
2347
2933
|
}
|
|
2348
|
-
const
|
|
2349
|
-
function
|
|
2350
|
-
if (typeof e.to != "string" ||
|
|
2934
|
+
const dt = "@_", Vr = "#text", ft = (e) => e.split(".").filter(Boolean), Wr = (e) => e.startsWith(dt) || e === Vr;
|
|
2935
|
+
function Hr(e, r) {
|
|
2936
|
+
if (typeof e.to != "string" || ft(e.to).length === 0) return '"to" must be a non-empty path.';
|
|
2351
2937
|
if (e.format !== void 0 && e.as !== "date") return '"format" needs "as": "date".';
|
|
2352
2938
|
if (e.decimals !== void 0) {
|
|
2353
2939
|
if (r === "import")
|
|
@@ -2358,79 +2944,79 @@ function fr(e, r) {
|
|
|
2358
2944
|
return '"decimals" must be a whole number from 0 to 100.';
|
|
2359
2945
|
}
|
|
2360
2946
|
if (r === "export") {
|
|
2361
|
-
const t =
|
|
2947
|
+
const t = ft(e.to);
|
|
2362
2948
|
for (const [n, i] of t.entries()) {
|
|
2363
|
-
if (i ===
|
|
2364
|
-
if (
|
|
2949
|
+
if (i === dt) return '"@_" needs an attribute name after it, e.g. "@_id".';
|
|
2950
|
+
if (Wr(i) && n < t.length - 1)
|
|
2365
2951
|
return `"${i}" must be the last segment — it belongs to the element before it.`;
|
|
2366
2952
|
}
|
|
2367
2953
|
}
|
|
2368
2954
|
return null;
|
|
2369
2955
|
}
|
|
2370
|
-
function
|
|
2371
|
-
const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${
|
|
2956
|
+
function sr(e, r, t) {
|
|
2957
|
+
const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${Vr}".` : "";
|
|
2372
2958
|
return new Error(`writeTo "${e}": "${r}" is written both as a value and as the parent of other values.${n}`);
|
|
2373
2959
|
}
|
|
2374
|
-
function
|
|
2960
|
+
function Br(e) {
|
|
2375
2961
|
const r = {}, t = /* @__PURE__ */ new Set([r]);
|
|
2376
2962
|
for (const { to: n, value: i } of e) {
|
|
2377
|
-
const o =
|
|
2963
|
+
const o = ft(n);
|
|
2378
2964
|
if (o.length === 0) continue;
|
|
2379
|
-
let
|
|
2965
|
+
let l = r;
|
|
2380
2966
|
for (const [u, d] of o.slice(0, -1).entries()) {
|
|
2381
|
-
const
|
|
2382
|
-
if (
|
|
2383
|
-
const
|
|
2384
|
-
t.add(
|
|
2385
|
-
} else if (t.has(
|
|
2386
|
-
|
|
2967
|
+
const m = l[d];
|
|
2968
|
+
if (m === void 0) {
|
|
2969
|
+
const f = {};
|
|
2970
|
+
t.add(f), l[d] = f, l = f;
|
|
2971
|
+
} else if (t.has(m))
|
|
2972
|
+
l = m;
|
|
2387
2973
|
else
|
|
2388
|
-
throw
|
|
2974
|
+
throw sr(n, o.slice(0, u + 1).join("."), o[u + 1].startsWith(dt));
|
|
2389
2975
|
}
|
|
2390
|
-
const a = o[o.length - 1], c =
|
|
2976
|
+
const a = o[o.length - 1], c = l[a];
|
|
2391
2977
|
if (t.has(c)) {
|
|
2392
|
-
const u = Object.keys(c).some((d) => d.startsWith(
|
|
2393
|
-
throw
|
|
2978
|
+
const u = Object.keys(c).some((d) => d.startsWith(dt));
|
|
2979
|
+
throw sr(n, o.join("."), u);
|
|
2394
2980
|
}
|
|
2395
|
-
|
|
2981
|
+
l[a] = i;
|
|
2396
2982
|
}
|
|
2397
2983
|
return r;
|
|
2398
2984
|
}
|
|
2399
|
-
const
|
|
2400
|
-
async function
|
|
2985
|
+
const rs = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
2986
|
+
async function Nt(e, r, t) {
|
|
2401
2987
|
const n = [];
|
|
2402
2988
|
for (const i of r) {
|
|
2403
|
-
const o =
|
|
2989
|
+
const o = Hr(i, t);
|
|
2404
2990
|
if (o) throw new Error(`writeTo "${i.to}": ${o}`);
|
|
2405
|
-
const
|
|
2406
|
-
if (!(a &&
|
|
2407
|
-
if (a && !
|
|
2408
|
-
const
|
|
2991
|
+
const l = ft(i.to), a = t === "export" && Wr(l[l.length - 1]), c = (m) => {
|
|
2992
|
+
if (!(a && m == null)) {
|
|
2993
|
+
if (a && !rs(m)) {
|
|
2994
|
+
const f = m instanceof Date ? ' Add "as": "date" to write a date.' : "";
|
|
2409
2995
|
throw new Error(
|
|
2410
|
-
`writeTo "${i.to}": an attribute or #text value must be text, a number or a boolean.${
|
|
2996
|
+
`writeTo "${i.to}": an attribute or #text value must be text, a number or a boolean.${f}`
|
|
2411
2997
|
);
|
|
2412
2998
|
}
|
|
2413
|
-
n.push({ to: i.to, value:
|
|
2999
|
+
n.push({ to: i.to, value: m });
|
|
2414
3000
|
}
|
|
2415
3001
|
};
|
|
2416
|
-
let u = await
|
|
3002
|
+
let u = await ts(e, i);
|
|
2417
3003
|
const d = u.found && Array.isArray(u.value);
|
|
2418
3004
|
if (u.found && d && i.writeTo) {
|
|
2419
|
-
const
|
|
3005
|
+
const m = await Promise.all(
|
|
2420
3006
|
u.value.map(
|
|
2421
|
-
async (
|
|
3007
|
+
async (f) => Br(await Nt(f, i.writeTo, t))
|
|
2422
3008
|
)
|
|
2423
3009
|
);
|
|
2424
|
-
c(
|
|
3010
|
+
c(m);
|
|
2425
3011
|
continue;
|
|
2426
3012
|
}
|
|
2427
3013
|
if (u.found && !d && i.writeTo)
|
|
2428
3014
|
throw new Error(`writeTo "${i.to}": "writeTo" is set, but "from" did not resolve to a repeating element.`);
|
|
2429
3015
|
if (u.found && !d && i.map) {
|
|
2430
|
-
const
|
|
2431
|
-
Object.prototype.hasOwnProperty.call(i.map,
|
|
3016
|
+
const m = u.value instanceof Date ? u.value.toISOString() : String(u.value);
|
|
3017
|
+
Object.prototype.hasOwnProperty.call(i.map, m) && (u = Te(i.map[m]));
|
|
2432
3018
|
}
|
|
2433
|
-
if (u.found && !d && (u = await
|
|
3019
|
+
if (u.found && !d && (u = await es(u.value, i, t)), !u.found) {
|
|
2434
3020
|
if (i.default === void 0) continue;
|
|
2435
3021
|
c(i.default);
|
|
2436
3022
|
continue;
|
|
@@ -2439,163 +3025,163 @@ async function yt(e, r, t) {
|
|
|
2439
3025
|
}
|
|
2440
3026
|
return n;
|
|
2441
3027
|
}
|
|
2442
|
-
const
|
|
3028
|
+
const ns = ".xml,text/xml,application/xml", os = 5 * 1024 * 1024, is = ({
|
|
2443
3029
|
data: e,
|
|
2444
3030
|
handleChange: r,
|
|
2445
3031
|
path: t,
|
|
2446
3032
|
label: n,
|
|
2447
3033
|
required: i,
|
|
2448
3034
|
schema: o,
|
|
2449
|
-
enabled:
|
|
3035
|
+
enabled: l,
|
|
2450
3036
|
readonly: a,
|
|
2451
3037
|
errors: c,
|
|
2452
3038
|
visible: u = !0
|
|
2453
3039
|
}) => {
|
|
2454
|
-
|
|
2455
|
-
const d =
|
|
2456
|
-
async (
|
|
2457
|
-
var
|
|
2458
|
-
const
|
|
2459
|
-
if (
|
|
2460
|
-
|
|
3040
|
+
Le(u, t, r);
|
|
3041
|
+
const d = Ce(t, i, u), m = !c || c.length === 0, f = Nr(l, a), g = (o == null ? void 0 : o["x-xml"]) ?? {}, E = g.accept ?? ns, v = g.maxSize ?? os, z = g.arrayPaths, R = g.removeNamespaces === !0, j = g.writeTo, S = g.writeBase ?? "root", C = g.persistDocument !== !1, A = Ne(), T = e ?? null, [W, U] = Y(() => T ? "ready" : "empty"), [F, M] = Y(null), [x, te] = Y(!1), H = he(null), J = he(0), B = T != null, le = j !== void 0 && j.length > 0, ve = Be(
|
|
3042
|
+
async (I) => {
|
|
3043
|
+
var G;
|
|
3044
|
+
const re = ++J.current;
|
|
3045
|
+
if (M(null), I.size > v) {
|
|
3046
|
+
M(`File exceeds the ${Ie(v)} limit.`);
|
|
2461
3047
|
return;
|
|
2462
3048
|
}
|
|
2463
|
-
if (!
|
|
2464
|
-
|
|
3049
|
+
if (!E.split(",").map((y) => y.trim()).some((y) => y === "*" || y === "*/*" ? !0 : y.endsWith("/*") ? I.type.startsWith(y.slice(0, -1)) : y.startsWith(".") ? I.name.toLowerCase().endsWith(y.toLowerCase()) : I.type === y)) {
|
|
3050
|
+
M(`Invalid type. Accepted: ${De(E)}`);
|
|
2465
3051
|
return;
|
|
2466
3052
|
}
|
|
2467
|
-
|
|
2468
|
-
let
|
|
3053
|
+
U("parsing");
|
|
3054
|
+
let b;
|
|
2469
3055
|
try {
|
|
2470
|
-
const
|
|
2471
|
-
|
|
2472
|
-
} catch (
|
|
2473
|
-
if (
|
|
2474
|
-
|
|
2475
|
-
|
|
3056
|
+
const y = await I.text();
|
|
3057
|
+
b = await qi(y, { arrayPaths: z, removeNamespaces: R });
|
|
3058
|
+
} catch (y) {
|
|
3059
|
+
if (re !== J.current) return;
|
|
3060
|
+
U("error"), M(
|
|
3061
|
+
y instanceof Ue ? y.message : "This doesn't look like a valid XML document. Please check the file and try again."
|
|
2476
3062
|
);
|
|
2477
3063
|
return;
|
|
2478
3064
|
}
|
|
2479
|
-
let
|
|
2480
|
-
if (
|
|
3065
|
+
let O = [];
|
|
3066
|
+
if (j && j.length > 0)
|
|
2481
3067
|
try {
|
|
2482
|
-
|
|
2483
|
-
} catch (
|
|
2484
|
-
if (
|
|
2485
|
-
|
|
3068
|
+
O = await Nt(b, j, "import");
|
|
3069
|
+
} catch (y) {
|
|
3070
|
+
if (re !== J.current) return;
|
|
3071
|
+
U("error"), M(y instanceof Error ? y.message : "This document could not be mapped onto the form.");
|
|
2486
3072
|
return;
|
|
2487
3073
|
}
|
|
2488
|
-
if (
|
|
2489
|
-
|
|
2490
|
-
const
|
|
2491
|
-
for (const
|
|
2492
|
-
|
|
3074
|
+
if (re !== J.current) return;
|
|
3075
|
+
C && r(t, b);
|
|
3076
|
+
const V = S === "parent" ? t.split(".").slice(0, -1).join(".") : "";
|
|
3077
|
+
for (const y of O) (G = A.dispatch) == null || G.call(A, yn(V ? `${V}.${y.to}` : y.to, () => y.value));
|
|
3078
|
+
U("ready");
|
|
2493
3079
|
},
|
|
2494
|
-
[
|
|
3080
|
+
[E, v, z, R, j, S, C, t, r, A]
|
|
2495
3081
|
);
|
|
2496
|
-
if (u === !1 || !
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2499
|
-
},
|
|
2500
|
-
var
|
|
2501
|
-
|
|
2502
|
-
},
|
|
2503
|
-
var
|
|
2504
|
-
(
|
|
3082
|
+
if (u === !1 || !f && !B) return null;
|
|
3083
|
+
const ne = (I) => {
|
|
3084
|
+
I.preventDefault(), I.stopPropagation(), f && te(I.type === "dragenter" || I.type === "dragover");
|
|
3085
|
+
}, ae = (I) => {
|
|
3086
|
+
var re;
|
|
3087
|
+
I.preventDefault(), I.stopPropagation(), te(!1), f && (re = I.dataTransfer.files) != null && re[0] && ve(I.dataTransfer.files[0]);
|
|
3088
|
+
}, $ = (I) => {
|
|
3089
|
+
var re;
|
|
3090
|
+
(re = I.target.files) != null && re[0] && (ve(I.target.files[0]), I.target.value = "");
|
|
2505
3091
|
};
|
|
2506
|
-
return /* @__PURE__ */
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
3092
|
+
return /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
3093
|
+
/* @__PURE__ */ p(L, { align: "center", justify: "between", mb: "2", children: [
|
|
3094
|
+
/* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
|
|
3095
|
+
/* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", children: [
|
|
2510
3096
|
n,
|
|
2511
|
-
d && /* @__PURE__ */
|
|
3097
|
+
d && /* @__PURE__ */ s(h, { color: "red", children: " *" })
|
|
2512
3098
|
] }),
|
|
2513
|
-
!
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
|
|
3099
|
+
!le && B && f && /* @__PURE__ */ p(Ae, { children: [
|
|
3100
|
+
/* @__PURE__ */ s(rt, { content: "Replace document", children: /* @__PURE__ */ s(
|
|
3101
|
+
Ze,
|
|
2516
3102
|
{
|
|
2517
3103
|
variant: "ghost",
|
|
2518
3104
|
size: "1",
|
|
2519
3105
|
onClick: () => {
|
|
2520
|
-
var
|
|
2521
|
-
return (
|
|
3106
|
+
var I;
|
|
3107
|
+
return (I = H.current) == null ? void 0 : I.click();
|
|
2522
3108
|
},
|
|
2523
3109
|
"aria-label": "Replace document",
|
|
2524
|
-
children: /* @__PURE__ */
|
|
3110
|
+
children: /* @__PURE__ */ s(Ge, {})
|
|
2525
3111
|
}
|
|
2526
3112
|
) }),
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
|
|
2529
|
-
}, "aria-label": "Remove document", children: /* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ s(rt, { content: "Remove document", children: /* @__PURE__ */ s(Ze, { variant: "ghost", size: "1", color: "gray", onClick: () => {
|
|
3114
|
+
f && (++J.current, M(null), U("empty"), r(t, void 0));
|
|
3115
|
+
}, "aria-label": "Remove document", children: /* @__PURE__ */ s(Ct, {}) }) })
|
|
2530
3116
|
] })
|
|
2531
3117
|
] }),
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2534
|
-
|
|
3118
|
+
/* @__PURE__ */ p(L, { align: "center", gap: "2", children: [
|
|
3119
|
+
/* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
|
|
3120
|
+
Ie(v),
|
|
2535
3121
|
" max · ",
|
|
2536
|
-
|
|
3122
|
+
De(E)
|
|
2537
3123
|
] }),
|
|
2538
|
-
|
|
2539
|
-
var
|
|
2540
|
-
return (
|
|
2541
|
-
}, disabled:
|
|
2542
|
-
|
|
3124
|
+
le && f && /* @__PURE__ */ p(Re, { size: "1", variant: "soft", onClick: () => {
|
|
3125
|
+
var I;
|
|
3126
|
+
return (I = H.current) == null ? void 0 : I.click();
|
|
3127
|
+
}, disabled: W === "parsing", children: [
|
|
3128
|
+
W === "parsing" ? /* @__PURE__ */ s(Je, { size: "1" }) : /* @__PURE__ */ s(Ge, {}),
|
|
2543
3129
|
"Upload"
|
|
2544
3130
|
] })
|
|
2545
3131
|
] })
|
|
2546
3132
|
] }),
|
|
2547
|
-
(
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
!
|
|
3133
|
+
(le || B) && F && /* @__PURE__ */ s(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: F }),
|
|
3134
|
+
/* @__PURE__ */ s("input", { ref: H, type: "file", style: { display: "none" }, accept: E, onChange: $ }),
|
|
3135
|
+
!le && f && !B && /* @__PURE__ */ s(
|
|
2550
3136
|
"div",
|
|
2551
3137
|
{
|
|
2552
3138
|
role: "button",
|
|
2553
3139
|
tabIndex: 0,
|
|
2554
3140
|
onClick: () => {
|
|
2555
|
-
var
|
|
2556
|
-
return (
|
|
3141
|
+
var I;
|
|
3142
|
+
return (I = H.current) == null ? void 0 : I.click();
|
|
2557
3143
|
},
|
|
2558
|
-
onKeyDown: (
|
|
2559
|
-
var
|
|
2560
|
-
(
|
|
3144
|
+
onKeyDown: (I) => {
|
|
3145
|
+
var re;
|
|
3146
|
+
(I.key === "Enter" || I.key === " ") && (I.preventDefault(), (re = H.current) == null || re.click());
|
|
2561
3147
|
},
|
|
2562
|
-
onDragEnter:
|
|
2563
|
-
onDragLeave:
|
|
2564
|
-
onDragOver:
|
|
2565
|
-
onDrop:
|
|
3148
|
+
onDragEnter: ne,
|
|
3149
|
+
onDragLeave: ne,
|
|
3150
|
+
onDragOver: ne,
|
|
3151
|
+
onDrop: ae,
|
|
2566
3152
|
style: { cursor: "pointer" },
|
|
2567
3153
|
className: [
|
|
2568
3154
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
2569
3155
|
"transition-all duration-200 ease-in-out",
|
|
2570
|
-
|
|
3156
|
+
x ? "border-blue-500 bg-blue-50" : F ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
2571
3157
|
].join(" "),
|
|
2572
|
-
children: /* @__PURE__ */
|
|
2573
|
-
/* @__PURE__ */
|
|
2574
|
-
/* @__PURE__ */
|
|
2575
|
-
] }) :
|
|
2576
|
-
/* @__PURE__ */
|
|
2577
|
-
/* @__PURE__ */
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
] }) : /* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2581
|
-
/* @__PURE__ */
|
|
2582
|
-
/* @__PURE__ */
|
|
2583
|
-
|
|
3158
|
+
children: /* @__PURE__ */ s(L, { direction: "column", align: "center", gap: "2", children: W === "parsing" ? /* @__PURE__ */ p(Ae, { children: [
|
|
3159
|
+
/* @__PURE__ */ s(Je, { size: "3" }),
|
|
3160
|
+
/* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Parsing document…" })
|
|
3161
|
+
] }) : F ? /* @__PURE__ */ p(Ae, { children: [
|
|
3162
|
+
/* @__PURE__ */ s(ht, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
3163
|
+
/* @__PURE__ */ s(h, { size: "2", color: "red", weight: "medium", children: F }),
|
|
3164
|
+
/* @__PURE__ */ s(h, { size: "1", color: "gray", children: "Click to try again" })
|
|
3165
|
+
] }) : /* @__PURE__ */ p(Ae, { children: [
|
|
3166
|
+
/* @__PURE__ */ s(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
3167
|
+
/* @__PURE__ */ s(h, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
|
|
3168
|
+
/* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
|
|
3169
|
+
Ie(v),
|
|
2584
3170
|
" max · ",
|
|
2585
|
-
|
|
3171
|
+
De(E)
|
|
2586
3172
|
] })
|
|
2587
3173
|
] }) })
|
|
2588
3174
|
}
|
|
2589
3175
|
),
|
|
2590
|
-
!
|
|
3176
|
+
!m && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Oe(c, n) })
|
|
2591
3177
|
] });
|
|
2592
|
-
},
|
|
3178
|
+
}, ss = Ee(is), ls = ue(
|
|
2593
3179
|
10,
|
|
2594
|
-
|
|
3180
|
+
_e((e) => {
|
|
2595
3181
|
const r = e["x-xml"];
|
|
2596
3182
|
return e.type === "object" && typeof r == "object" && r !== null;
|
|
2597
3183
|
})
|
|
2598
|
-
),
|
|
3184
|
+
), as = "root", lr = "export.xml", cs = {
|
|
2599
3185
|
format: !0,
|
|
2600
3186
|
indentBy: " ",
|
|
2601
3187
|
ignoreAttributes: !1,
|
|
@@ -2604,189 +3190,189 @@ const Yo = ".xml,text/xml,application/xml", Go = 5 * 1024 * 1024, Jo = ({
|
|
|
2604
3190
|
suppressBooleanAttributes: !1,
|
|
2605
3191
|
processEntities: !0
|
|
2606
3192
|
};
|
|
2607
|
-
function
|
|
3193
|
+
function us(e) {
|
|
2608
3194
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
2609
3195
|
return 'declaration must be an object, e.g. { "standalone": "no" }, or {} for the defaults.';
|
|
2610
3196
|
const { version: r, encoding: t, standalone: n, ...i } = e, [o] = Object.keys(i);
|
|
2611
3197
|
return o ? `declaration has an unknown key "${o}" — only version, encoding and standalone.` : r !== void 0 && r !== "1.0" && r !== "1.1" ? 'declaration.version must be "1.0" or "1.1".' : t !== void 0 && t !== "UTF-8" ? 'declaration.encoding can only be "UTF-8" — the file is always written as UTF-8.' : n !== void 0 && n !== "yes" && n !== "no" ? 'declaration.standalone must be "yes" or "no".' : null;
|
|
2612
3198
|
}
|
|
2613
|
-
function
|
|
3199
|
+
function Xr(e) {
|
|
2614
3200
|
for (const r of e) {
|
|
2615
3201
|
if (r === null || typeof r != "object" || Array.isArray(r))
|
|
2616
3202
|
return "every writeTo entry must be an object.";
|
|
2617
|
-
const { to: t, writeTo: n } = r, i =
|
|
3203
|
+
const { to: t, writeTo: n } = r, i = Hr(r, "export");
|
|
2618
3204
|
if (i) return `writeTo "${t}": ${i}`;
|
|
2619
3205
|
if (n !== void 0) {
|
|
2620
3206
|
if (!Array.isArray(n)) return `writeTo "${t}": its nested writeTo must be an array.`;
|
|
2621
|
-
const o =
|
|
3207
|
+
const o = Xr(n);
|
|
2622
3208
|
if (o) return o;
|
|
2623
3209
|
}
|
|
2624
3210
|
}
|
|
2625
3211
|
return null;
|
|
2626
3212
|
}
|
|
2627
|
-
function
|
|
2628
|
-
return e === void 0 ? "writeTo is required — see docs/xml-export-control.md." : Array.isArray(e) ? e.length === 0 ? "writeTo is declared but empty — declare at least one entry." :
|
|
3213
|
+
function ds({ writeTo: e, declaration: r }) {
|
|
3214
|
+
return e === void 0 ? "writeTo is required — see docs/xml-export-control.md." : Array.isArray(e) ? e.length === 0 ? "writeTo is declared but empty — declare at least one entry." : Xr(e) ?? (r === void 0 ? null : us(r)) : "writeTo must be an array of { from | formula, to } entries.";
|
|
2629
3215
|
}
|
|
2630
|
-
function
|
|
3216
|
+
function fs({ version: e = "1.0", standalone: r }) {
|
|
2631
3217
|
return { "@_version": e, "@_encoding": "UTF-8", ...r && { "@_standalone": r } };
|
|
2632
3218
|
}
|
|
2633
|
-
function
|
|
3219
|
+
function ps(e) {
|
|
2634
3220
|
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
|
|
2635
3221
|
}
|
|
2636
|
-
const
|
|
2637
|
-
var
|
|
2638
|
-
const i = (t == null ? void 0 : t["x-xml-export"]) ?? {}, o = i.rootElement ??
|
|
3222
|
+
const hs = ({ path: e, label: r, schema: t, visible: n = !0 }) => {
|
|
3223
|
+
var j, S;
|
|
3224
|
+
const i = (t == null ? void 0 : t["x-xml-export"]) ?? {}, o = i.rootElement ?? as, l = i.fileName ?? lr, a = i.writeTo, c = i.writeBase ?? "root", u = i.declaration, d = ds(i), m = Ne(), f = c === "parent" ? e.split(".").slice(0, -1).join(".") : "", g = f ? Xe.data((j = m.core) == null ? void 0 : j.data, f) : (S = m.core) == null ? void 0 : S.data, [E, v] = Y(null), z = ps(g), R = Be(async () => {
|
|
2639
3225
|
if (a) {
|
|
2640
|
-
|
|
3226
|
+
v(null);
|
|
2641
3227
|
try {
|
|
2642
|
-
const
|
|
2643
|
-
...u && { "?xml":
|
|
2644
|
-
[o]:
|
|
2645
|
-
},
|
|
2646
|
-
|
|
2647
|
-
} catch (
|
|
2648
|
-
|
|
3228
|
+
const C = Br(await Nt(g, a, "export")), { XMLBuilder: A } = await import("fast-xml-parser"), T = {
|
|
3229
|
+
...u && { "?xml": fs(u) },
|
|
3230
|
+
[o]: C
|
|
3231
|
+
}, W = new A(cs).build(T);
|
|
3232
|
+
Ho(W, It(l, g, lr), "application/xml");
|
|
3233
|
+
} catch (C) {
|
|
3234
|
+
v(C instanceof Error ? C.message : "This export could not be built.");
|
|
2649
3235
|
}
|
|
2650
3236
|
}
|
|
2651
|
-
}, [a,
|
|
2652
|
-
return n === !1 ? null : d ? /* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
3237
|
+
}, [a, g, u, o, l]);
|
|
3238
|
+
return n === !1 ? null : d ? /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
3239
|
+
/* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: r }),
|
|
3240
|
+
/* @__PURE__ */ p(h, { size: "2", color: "red", style: { display: "block" }, children: [
|
|
2655
3241
|
"Invalid x-xml-export config: ",
|
|
2656
3242
|
d
|
|
2657
3243
|
] })
|
|
2658
|
-
] }) : /* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
3244
|
+
] }) : /* @__PURE__ */ p(N, { mb: "4", children: [
|
|
3245
|
+
/* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: r }),
|
|
3246
|
+
/* @__PURE__ */ p(Re, { size: "1", variant: "soft", disabled: z, onClick: () => void R(), children: [
|
|
3247
|
+
/* @__PURE__ */ s(Rt, {}),
|
|
2662
3248
|
"Download XML"
|
|
2663
3249
|
] }),
|
|
2664
|
-
|
|
3250
|
+
E && /* @__PURE__ */ s(h, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: E })
|
|
2665
3251
|
] });
|
|
2666
|
-
},
|
|
3252
|
+
}, ms = Ee(hs), gs = ue(
|
|
2667
3253
|
10,
|
|
2668
|
-
|
|
3254
|
+
_e((e) => {
|
|
2669
3255
|
const r = e["x-xml-export"];
|
|
2670
3256
|
return e.type === "object" && typeof r == "object" && r !== null;
|
|
2671
3257
|
})
|
|
2672
|
-
),
|
|
2673
|
-
var
|
|
2674
|
-
|
|
2675
|
-
const
|
|
2676
|
-
return
|
|
3258
|
+
), ys = "{value}", bs = 2, vs = {}, ws = ({ data: e, handleChange: r, path: t, label: n, schema: i, visible: o = !0 }) => {
|
|
3259
|
+
var T;
|
|
3260
|
+
Le(o, t, r);
|
|
3261
|
+
const l = i == null ? void 0 : i["x-computed"], a = (l == null ? void 0 : l.inputs) ?? vs, c = (l == null ? void 0 : l.formula) ?? "", u = (l == null ? void 0 : l.format) ?? ys, d = (l == null ? void 0 : l.decimals) ?? bs, m = Ne(), f = t.split(".").slice(0, -1).join("."), g = Ki((T = m.core) == null ? void 0 : T.data, f, a), E = g ? JSON.stringify(g) : null, v = m.readonly === !0, [z, R] = Y(() => typeof e == "number" ? "ok" : "unavailable"), [j, S] = Y(() => typeof e == "number" ? e : null), [C, A] = Y(null);
|
|
3262
|
+
return ye(() => {
|
|
2677
3263
|
if (!o) return;
|
|
2678
|
-
let
|
|
2679
|
-
const
|
|
2680
|
-
|
|
3264
|
+
let W = !1;
|
|
3265
|
+
const U = (F) => {
|
|
3266
|
+
v || F !== e && r(t, F);
|
|
2681
3267
|
};
|
|
2682
|
-
if (
|
|
2683
|
-
|
|
3268
|
+
if (g === void 0) {
|
|
3269
|
+
R("unavailable"), A(null), S(null), U(void 0);
|
|
2684
3270
|
return;
|
|
2685
3271
|
}
|
|
2686
|
-
return
|
|
2687
|
-
if (
|
|
2688
|
-
const
|
|
2689
|
-
if (
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
),
|
|
3272
|
+
return R((F) => F === "ok" ? F : "loading"), Yi(g, c).then((F) => {
|
|
3273
|
+
if (W) return;
|
|
3274
|
+
const M = F.status === "ok" && typeof F.value == "number" && Number.isFinite(F.value) ? F.value : null;
|
|
3275
|
+
if (M === null) {
|
|
3276
|
+
R("error"), A(
|
|
3277
|
+
F.status === "error" ? F.error ?? "Unable to compute value." : "Computed value must be a number."
|
|
3278
|
+
), S(null), U(void 0);
|
|
2693
3279
|
return;
|
|
2694
3280
|
}
|
|
2695
|
-
|
|
3281
|
+
R("ok"), A(null), S(M), U(M);
|
|
2696
3282
|
}), () => {
|
|
2697
|
-
|
|
3283
|
+
W = !0;
|
|
2698
3284
|
};
|
|
2699
|
-
}, [
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
] }) :
|
|
2705
|
-
i.description && /* @__PURE__ */
|
|
3285
|
+
}, [E, c, o, v]), o === !1 ? null : /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
|
|
3286
|
+
/* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: n }),
|
|
3287
|
+
z === "unavailable" ? /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Not yet available." }) : z === "loading" ? /* @__PURE__ */ p(L, { align: "center", gap: "2", children: [
|
|
3288
|
+
/* @__PURE__ */ s(Je, { size: "1" }),
|
|
3289
|
+
/* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Computing…" })
|
|
3290
|
+
] }) : z === "error" ? /* @__PURE__ */ s(h, { size: "2", color: "red", children: C }) : /* @__PURE__ */ s(h, { size: "2", children: mt(u, { value: _r(j, d) }) }),
|
|
3291
|
+
i.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: i.description })
|
|
2706
3292
|
] }) });
|
|
2707
|
-
},
|
|
3293
|
+
}, Es = Ee(ws), xs = ue(
|
|
2708
3294
|
5,
|
|
2709
|
-
|
|
3295
|
+
_e((e) => {
|
|
2710
3296
|
const r = e["x-computed"];
|
|
2711
3297
|
return e.type === "number" && typeof r == "object" && r !== null;
|
|
2712
3298
|
})
|
|
2713
|
-
),
|
|
3299
|
+
), qr = "seq", ar = 2, Ts = (e) => e == null || e === "", Kr = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0, As = (e) => {
|
|
2714
3300
|
const r = e == null ? void 0 : e["x-template"];
|
|
2715
3301
|
if (typeof r != "object" || r === null) return;
|
|
2716
3302
|
const { template: t, inputs: n } = r;
|
|
2717
3303
|
if (!(typeof t != "string" || t === ""))
|
|
2718
3304
|
return { template: t, inputs: n };
|
|
2719
|
-
},
|
|
3305
|
+
}, Lt = (e) => typeof e == "object" && e.name === qr && e.arg !== void 0, Ss = (e) => e.every((r, t) => !Lt(r) || typeof e[t - 1] != "object" && typeof e[t + 1] != "object"), Rs = (e) => {
|
|
2720
3306
|
const r = /* @__PURE__ */ new Set();
|
|
2721
|
-
for (const t of
|
|
3307
|
+
for (const t of kt(e))
|
|
2722
3308
|
typeof t == "object" && t.arg === void 0 && r.add(t.name);
|
|
2723
3309
|
return [...r];
|
|
2724
|
-
},
|
|
3310
|
+
}, Cs = (e) => {
|
|
2725
3311
|
const r = [];
|
|
2726
3312
|
for (const [t, n] of Object.entries((e == null ? void 0 : e.properties) ?? {})) {
|
|
2727
|
-
const i =
|
|
3313
|
+
const i = As(n);
|
|
2728
3314
|
i && r.push([t, i]);
|
|
2729
3315
|
}
|
|
2730
3316
|
return r;
|
|
2731
|
-
},
|
|
3317
|
+
}, Os = (e, r, t) => {
|
|
2732
3318
|
var i;
|
|
2733
3319
|
const n = {};
|
|
2734
|
-
for (const o of
|
|
2735
|
-
const
|
|
2736
|
-
n[o] = typeof
|
|
3320
|
+
for (const o of Rs(t.template)) {
|
|
3321
|
+
const l = jr(e, r, ((i = t.inputs) == null ? void 0 : i[o]) ?? o);
|
|
3322
|
+
n[o] = typeof l == "string" || typeof l == "number" || typeof l == "boolean" ? String(l) : "";
|
|
2737
3323
|
}
|
|
2738
3324
|
return n;
|
|
2739
|
-
},
|
|
2740
|
-
const t = r.trim() === "" ?
|
|
2741
|
-
return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t :
|
|
2742
|
-
},
|
|
3325
|
+
}, ks = (e) => (r) => {
|
|
3326
|
+
const t = r.trim() === "" ? ar : Number(r);
|
|
3327
|
+
return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t : ar, "0");
|
|
3328
|
+
}, Is = (e) => {
|
|
2743
3329
|
const r = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2744
3330
|
let t = "";
|
|
2745
|
-
for (const n of
|
|
2746
|
-
typeof n == "string" ? t += r(n) : t +=
|
|
3331
|
+
for (const n of kt(e))
|
|
3332
|
+
typeof n == "string" ? t += r(n) : t += Lt(n) ? "(\\d+)" : ".*?";
|
|
2747
3333
|
return new RegExp(`^${t}$`);
|
|
2748
|
-
},
|
|
2749
|
-
var o,
|
|
2750
|
-
const n =
|
|
3334
|
+
}, Ds = (e, r, t) => {
|
|
3335
|
+
var o, l;
|
|
3336
|
+
const n = Is(t.template);
|
|
2751
3337
|
let i = 0;
|
|
2752
3338
|
for (const a of e) {
|
|
2753
|
-
const c = (o =
|
|
3339
|
+
const c = (o = Kr(a)) == null ? void 0 : o[r];
|
|
2754
3340
|
if (typeof c != "string") continue;
|
|
2755
|
-
const u = Number((
|
|
3341
|
+
const u = Number((l = n.exec(c)) == null ? void 0 : l[1]);
|
|
2756
3342
|
Number.isFinite(u) && u > i && (i = u);
|
|
2757
3343
|
}
|
|
2758
3344
|
return i;
|
|
2759
|
-
},
|
|
2760
|
-
const
|
|
2761
|
-
if (
|
|
2762
|
-
const a =
|
|
3345
|
+
}, Ns = (e, r, t, n, i, o) => {
|
|
3346
|
+
const l = Cs(e);
|
|
3347
|
+
if (l.length === 0) return r;
|
|
3348
|
+
const a = Kr(r);
|
|
2763
3349
|
if (!a) return r;
|
|
2764
3350
|
const c = { ...a };
|
|
2765
|
-
for (const [u, d] of
|
|
2766
|
-
if (!
|
|
2767
|
-
const
|
|
2768
|
-
if (
|
|
2769
|
-
if (!
|
|
3351
|
+
for (const [u, d] of l) {
|
|
3352
|
+
if (!Ts(c[u])) continue;
|
|
3353
|
+
const m = kt(d.template), f = {};
|
|
3354
|
+
if (m.some(Lt)) {
|
|
3355
|
+
if (!Ss(m)) {
|
|
2770
3356
|
console.warn(
|
|
2771
3357
|
`x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${d.template}"`
|
|
2772
3358
|
);
|
|
2773
3359
|
continue;
|
|
2774
3360
|
}
|
|
2775
|
-
const
|
|
2776
|
-
o[u] =
|
|
3361
|
+
const g = Math.max(o[u] ?? 0, Ds(t, u, d)) + 1;
|
|
3362
|
+
o[u] = g, f[qr] = ks(g);
|
|
2777
3363
|
}
|
|
2778
|
-
c[u] =
|
|
3364
|
+
c[u] = mt(d.template, Os(n, i, d), f);
|
|
2779
3365
|
}
|
|
2780
3366
|
return c;
|
|
2781
|
-
},
|
|
2782
|
-
const
|
|
2783
|
-
return /* @__PURE__ */
|
|
3367
|
+
}, Ls = ({ path: e, items: r, itemsSchema: t, rootSchema: n, addItem: i, sequences: o }) => {
|
|
3368
|
+
const l = Ne();
|
|
3369
|
+
return /* @__PURE__ */ s(N, { mt: "2", children: /* @__PURE__ */ p(Re, { type: "button", variant: "surface", onClick: () => {
|
|
2784
3370
|
var u;
|
|
2785
|
-
const c =
|
|
3371
|
+
const c = Ns(
|
|
2786
3372
|
t,
|
|
2787
|
-
|
|
3373
|
+
bn(t, n),
|
|
2788
3374
|
r,
|
|
2789
|
-
(u =
|
|
3375
|
+
(u = l.core) == null ? void 0 : u.data,
|
|
2790
3376
|
// The object CONTAINING the array, not the row: a row being filled is
|
|
2791
3377
|
// empty, so what a template reaches for sits alongside the array.
|
|
2792
3378
|
e.split(".").slice(0, -1).join("."),
|
|
@@ -2794,176 +3380,180 @@ const si = ({ path: e, label: r, schema: t, visible: n = !0 }) => {
|
|
|
2794
3380
|
);
|
|
2795
3381
|
i && i(e, c)();
|
|
2796
3382
|
}, children: [
|
|
2797
|
-
/* @__PURE__ */
|
|
3383
|
+
/* @__PURE__ */ s(In, {}),
|
|
2798
3384
|
"Add Item"
|
|
2799
3385
|
] }) });
|
|
2800
|
-
},
|
|
3386
|
+
}, zs = ({
|
|
2801
3387
|
data: e,
|
|
2802
3388
|
path: r,
|
|
2803
3389
|
schema: t,
|
|
2804
3390
|
uischema: n,
|
|
2805
3391
|
enabled: i,
|
|
2806
3392
|
visible: o,
|
|
2807
|
-
addItem:
|
|
3393
|
+
addItem: l,
|
|
2808
3394
|
removeItems: a,
|
|
2809
3395
|
rootSchema: c,
|
|
2810
3396
|
arraySchema: u,
|
|
2811
3397
|
required: d = !1,
|
|
2812
|
-
errors:
|
|
3398
|
+
errors: m = ""
|
|
2813
3399
|
}) => {
|
|
2814
|
-
const
|
|
2815
|
-
if (o === !1 || !
|
|
3400
|
+
const f = he({}), g = Ce(r, d, o), E = u ? t : t.items, v = u || t;
|
|
3401
|
+
if (o === !1 || !E || typeof E != "object" || Array.isArray(E))
|
|
2816
3402
|
return null;
|
|
2817
|
-
const
|
|
3403
|
+
const z = E, R = Array.isArray(e) ? e : [], j = v.title || "Array Items", S = n.options ?? {}, C = i && S.addable !== !1, A = i && S.removable !== !1, T = S.itemLabel || "Item", W = g || typeof v.minItems == "number" && v.minItems >= 1, U = !m, F = U ? "" : R.length === 0 && S.errorMessage || Oe(m, j), M = (x) => {
|
|
2818
3404
|
if (a) {
|
|
2819
|
-
const
|
|
2820
|
-
|
|
3405
|
+
const te = a(r, [x]);
|
|
3406
|
+
te && te();
|
|
2821
3407
|
}
|
|
2822
3408
|
};
|
|
2823
|
-
return /* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
|
|
3409
|
+
return /* @__PURE__ */ s(N, { mb: "6", children: /* @__PURE__ */ p(L, { direction: "column", gap: "4", children: [
|
|
3410
|
+
/* @__PURE__ */ p(h, { as: "div", size: "4", weight: "bold", children: [
|
|
3411
|
+
j,
|
|
2826
3412
|
" ",
|
|
2827
|
-
|
|
3413
|
+
W && /* @__PURE__ */ s(h, { color: "red", children: "*" })
|
|
2828
3414
|
] }),
|
|
2829
|
-
|
|
2830
|
-
!
|
|
2831
|
-
|
|
2832
|
-
var
|
|
2833
|
-
const
|
|
2834
|
-
return /* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
|
|
3415
|
+
R.length === 0 && /* @__PURE__ */ s(N, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "No items have been added yet." }) }),
|
|
3416
|
+
!U && /* @__PURE__ */ s(h, { color: "red", size: "1", children: F }),
|
|
3417
|
+
R.map((x, te) => {
|
|
3418
|
+
var J;
|
|
3419
|
+
const H = `${r}.${te}`;
|
|
3420
|
+
return /* @__PURE__ */ s(yr, { size: "3", variant: "surface", children: /* @__PURE__ */ p(L, { direction: "column", gap: "4", children: [
|
|
3421
|
+
/* @__PURE__ */ p(L, { justify: "between", align: "center", children: [
|
|
3422
|
+
/* @__PURE__ */ p(h, { size: "3", weight: "bold", children: [
|
|
3423
|
+
T,
|
|
2838
3424
|
" ",
|
|
2839
|
-
|
|
3425
|
+
te + 1
|
|
2840
3426
|
] }),
|
|
2841
|
-
|
|
2842
|
-
|
|
3427
|
+
A && /* @__PURE__ */ p(
|
|
3428
|
+
Re,
|
|
2843
3429
|
{
|
|
2844
3430
|
type: "button",
|
|
2845
3431
|
color: "red",
|
|
2846
3432
|
variant: "soft",
|
|
2847
|
-
onClick: () =>
|
|
3433
|
+
onClick: () => M(te),
|
|
2848
3434
|
title: "Remove item",
|
|
2849
3435
|
children: [
|
|
2850
|
-
/* @__PURE__ */
|
|
3436
|
+
/* @__PURE__ */ s(kn, {}),
|
|
2851
3437
|
"Remove"
|
|
2852
3438
|
]
|
|
2853
3439
|
}
|
|
2854
3440
|
)
|
|
2855
3441
|
] }),
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
|
|
3442
|
+
/* @__PURE__ */ s(N, { children: /* @__PURE__ */ s(
|
|
3443
|
+
Qe,
|
|
2858
3444
|
{
|
|
2859
|
-
schema:
|
|
2860
|
-
uischema: ((
|
|
3445
|
+
schema: z,
|
|
3446
|
+
uischema: ((J = n.options) == null ? void 0 : J.detail) || (z.type === "object" || z.properties ? {
|
|
2861
3447
|
type: "VerticalLayout",
|
|
2862
|
-
elements: Object.keys(
|
|
3448
|
+
elements: Object.keys(z.properties || {}).map((B) => ({
|
|
2863
3449
|
type: "Control",
|
|
2864
|
-
scope: `#/properties/${
|
|
3450
|
+
scope: `#/properties/${B}`
|
|
2865
3451
|
}))
|
|
2866
3452
|
} : {
|
|
2867
3453
|
type: "Control",
|
|
2868
3454
|
scope: "#"
|
|
2869
3455
|
}),
|
|
2870
|
-
path:
|
|
3456
|
+
path: H,
|
|
2871
3457
|
enabled: i,
|
|
2872
3458
|
renderers: void 0,
|
|
2873
3459
|
cells: void 0
|
|
2874
3460
|
}
|
|
2875
3461
|
) })
|
|
2876
|
-
] }) },
|
|
3462
|
+
] }) }, H);
|
|
2877
3463
|
}),
|
|
2878
|
-
|
|
2879
|
-
|
|
3464
|
+
C && /* @__PURE__ */ s(
|
|
3465
|
+
Ls,
|
|
2880
3466
|
{
|
|
2881
3467
|
path: r,
|
|
2882
|
-
items:
|
|
2883
|
-
itemsSchema:
|
|
3468
|
+
items: R,
|
|
3469
|
+
itemsSchema: z,
|
|
2884
3470
|
rootSchema: c,
|
|
2885
|
-
addItem:
|
|
2886
|
-
sequences:
|
|
3471
|
+
addItem: l,
|
|
3472
|
+
sequences: f
|
|
2887
3473
|
}
|
|
2888
3474
|
)
|
|
2889
3475
|
] }) });
|
|
2890
|
-
},
|
|
3476
|
+
}, cr = En(zs), Ms = ue(3, vn), Fs = ({ uischema: e, visible: r }) => {
|
|
2891
3477
|
const t = e;
|
|
2892
|
-
return r === !1 ? null : /* @__PURE__ */
|
|
2893
|
-
},
|
|
2894
|
-
{ tester:
|
|
2895
|
-
{ tester:
|
|
2896
|
-
{ tester:
|
|
2897
|
-
{ tester:
|
|
2898
|
-
{ tester:
|
|
2899
|
-
{ tester:
|
|
2900
|
-
{ tester:
|
|
2901
|
-
{ tester:
|
|
3478
|
+
return r === !1 ? null : /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ s(tt, { size: "4", children: t.text }) });
|
|
3479
|
+
}, $s = ue(1, ot("Label")), Ps = ue(3, wn), Gs = [
|
|
3480
|
+
{ tester: Gn, renderer: Jn },
|
|
3481
|
+
{ tester: eo, renderer: to },
|
|
3482
|
+
{ tester: no, renderer: oo },
|
|
3483
|
+
{ tester: so, renderer: lo },
|
|
3484
|
+
{ tester: ho, renderer: wo },
|
|
3485
|
+
{ tester: co, renderer: Bt },
|
|
3486
|
+
{ tester: uo, renderer: Bt },
|
|
3487
|
+
{ tester: So, renderer: Ro },
|
|
2902
3488
|
// The layout renderers take their props from withJsonFormsLayoutProps, which
|
|
2903
3489
|
// evaluates the layout's rule into `visible` and `enabled`, as
|
|
2904
3490
|
// withJsonFormsControlProps does for the controls.
|
|
2905
|
-
{ tester:
|
|
2906
|
-
{ tester:
|
|
2907
|
-
{ tester:
|
|
2908
|
-
{ tester:
|
|
2909
|
-
{ tester:
|
|
2910
|
-
{ tester:
|
|
2911
|
-
{ tester:
|
|
3491
|
+
{ tester: zo, renderer: st(Lo) },
|
|
3492
|
+
{ tester: Fo, renderer: st(Mo) },
|
|
3493
|
+
{ tester: Po, renderer: st($o) },
|
|
3494
|
+
{ tester: _o, renderer: st(Uo) },
|
|
3495
|
+
{ tester: Qo, renderer: Zo },
|
|
3496
|
+
{ tester: zi, renderer: Li },
|
|
3497
|
+
{ tester: _i, renderer: ji },
|
|
2912
3498
|
// After SpreadsheetControl on purpose: both testers rank 10, and a tie is
|
|
2913
3499
|
// resolved by registration order (see XmlControlTester's comment).
|
|
2914
|
-
{ tester:
|
|
3500
|
+
{ tester: ls, renderer: ss },
|
|
2915
3501
|
// Also rank 10, but matches the distinct `x-xml-export` keyword rather
|
|
2916
3502
|
// than `x-xml`, so it never ties with XmlControlTester on the same schema
|
|
2917
3503
|
// node (see XmlExportControlTester's own comment).
|
|
2918
|
-
{ tester:
|
|
2919
|
-
{ tester:
|
|
2920
|
-
{ tester:
|
|
2921
|
-
{ tester:
|
|
2922
|
-
{ tester:
|
|
3504
|
+
{ tester: gs, renderer: ms },
|
|
3505
|
+
{ tester: xs, renderer: Es },
|
|
3506
|
+
{ tester: Ms, renderer: cr },
|
|
3507
|
+
{ tester: Ps, renderer: cr },
|
|
3508
|
+
{ tester: $s, renderer: Fs }
|
|
2923
3509
|
];
|
|
2924
3510
|
export {
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
3511
|
+
cr as ArrayControl,
|
|
3512
|
+
Ms as ArrayControlTester,
|
|
3513
|
+
ro as BooleanControl,
|
|
3514
|
+
no as BooleanControlTester,
|
|
3515
|
+
Uo as CategorizationLayoutRenderer,
|
|
3516
|
+
_o as CategorizationLayoutTester,
|
|
3517
|
+
Es as ComputedControl,
|
|
3518
|
+
xs as ComputedControlTester,
|
|
3519
|
+
Ao as DateControl,
|
|
3520
|
+
So as DateControlTester,
|
|
3521
|
+
Zo as FileControl,
|
|
3522
|
+
Qo as FileControlTester,
|
|
3523
|
+
Ys as FormStepsProvider,
|
|
3524
|
+
$o as GroupLayoutRenderer,
|
|
3525
|
+
Po as GroupLayoutTester,
|
|
3526
|
+
Mo as HorizontalLayoutRenderer,
|
|
3527
|
+
Fo as HorizontalLayoutTester,
|
|
3528
|
+
Fs as LabelRenderer,
|
|
3529
|
+
$s as LabelTester,
|
|
3530
|
+
Qn as NumberControl,
|
|
3531
|
+
eo as NumberControlTester,
|
|
3532
|
+
io as RadioControl,
|
|
3533
|
+
so as RadioControlTester,
|
|
3534
|
+
jn as STEPPER_MESSAGES,
|
|
3535
|
+
wo as SearchSelectControl,
|
|
3536
|
+
ho as SearchSelectControlTester,
|
|
3537
|
+
Ks as SearchServiceProvider,
|
|
3538
|
+
ao as SelectControl,
|
|
3539
|
+
co as SelectControlTester,
|
|
3540
|
+
uo as SelectObjectControlTester,
|
|
3541
|
+
Li as SpreadsheetControl,
|
|
3542
|
+
zi as SpreadsheetControlTester,
|
|
3543
|
+
ji as SpreadsheetExportControl,
|
|
3544
|
+
_i as SpreadsheetExportControlTester,
|
|
3545
|
+
Yn as TextControl,
|
|
3546
|
+
Gn as TextControlTester,
|
|
3547
|
+
qs as UploadProvider,
|
|
3548
|
+
Lo as VerticalLayoutRenderer,
|
|
3549
|
+
zo as VerticalLayoutTester,
|
|
3550
|
+
ss as XmlControl,
|
|
3551
|
+
ls as XmlControlTester,
|
|
3552
|
+
ms as XmlExportControl,
|
|
3553
|
+
gs as XmlExportControlTester,
|
|
3554
|
+
Ln as isStepperUiSchema,
|
|
3555
|
+
Gs as radixRenderers,
|
|
3556
|
+
Rr as searchSelectTargetSchema,
|
|
3557
|
+
Nn as useSearchService,
|
|
3558
|
+
Dn as useUpload
|
|
2969
3559
|
};
|