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