@opennsw/jsonforms-renderers 0.5.0 → 0.6.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,50 +1,50 @@
1
- var nr = Object.defineProperty;
2
- var or = (e, t, r) => t in e ? nr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var Ue = (e, t, r) => or(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx as n, jsxs as g, Fragment as Ee } from "react/jsx-runtime";
5
- import { useContext as He, createContext as We, useMemo as lr, useEffect as pe, useState as k, useRef as ue, useCallback as De } from "react";
6
- import { rankWith as W, isStringControl as ir, or as Ne, isNumberControl as sr, isIntegerControl as cr, isBooleanControl as ar, isEnumControl as Be, isOneOfControl as Ke, schemaMatches as Me, isDateControl as dr, isDateTimeControl as ur, isTimeControl as fr, uiTypeIs as we, and as hr, createDefaultValue as pr, isObjectArrayControl as gr, isPrimitiveArrayControl as mr } from "@jsonforms/core";
7
- import { withJsonFormsControlProps as le, JsonFormsDispatch as Re, withJsonFormsArrayControlProps as yr } from "@jsonforms/react";
8
- import { Box as R, Flex as T, Text as h, TextField as ye, Checkbox as vr, RadioGroup as ke, Select as Ce, ScrollArea as br, Spinner as xe, Button as Se, Tabs as Te, Heading as Ge, Card as ze, IconButton as Xe, Table as oe } from "@radix-ui/themes";
9
- import { ChevronDownIcon as Er, FileTextIcon as Ye, CheckCircledIcon as Je, Cross2Icon as Ze, ExclamationTriangleIcon as qe, UploadIcon as Qe, TrashIcon as wr, PlusIcon as Rr } from "@radix-ui/react-icons";
10
- import Cr from "dayjs";
11
- import { read as Tr, utils as Ar } from "@e965/xlsx";
12
- const je = We(null);
13
- function qt({
1
+ var cr = Object.defineProperty;
2
+ var ar = (e, t, r) => t in e ? cr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var Pe = (e, t, r) => ar(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsx as n, jsxs as p, Fragment as Te } from "react/jsx-runtime";
5
+ import { useContext as Xe, createContext as Ye, useMemo as dr, useEffect as ge, useState as _, useRef as de, useCallback as ke } from "react";
6
+ import { rankWith as W, isStringControl as ur, or as Me, isNumberControl as fr, isIntegerControl as hr, isBooleanControl as pr, isEnumControl as Je, isOneOfControl as Ze, schemaMatches as Fe, isDateControl as gr, isDateTimeControl as mr, isTimeControl as yr, uiTypeIs as Ae, and as vr, createDefaultValue as br, isObjectArrayControl as Er, isPrimitiveArrayControl as wr } from "@jsonforms/core";
7
+ import { withJsonFormsControlProps as oe, JsonFormsDispatch as Se, withJsonFormsArrayControlProps as Rr } from "@jsonforms/react";
8
+ import { Box as C, Flex as T, Text as f, TextField as ve, Checkbox as Cr, RadioGroup as Ve, Select as Oe, ScrollArea as Tr, Spinner as ze, Button as Le, Tabs as Ie, Heading as qe, Card as $e, IconButton as je, Table as ne } from "@radix-ui/themes";
9
+ import { ChevronDownIcon as Ar, FileTextIcon as Qe, CheckCircledIcon as er, Cross2Icon as rr, ExclamationTriangleIcon as tr, UploadIcon as nr, TrashIcon as Sr, PlusIcon as Nr } from "@radix-ui/react-icons";
10
+ import Or from "dayjs";
11
+ import { read as Ir, utils as xr } from "@e965/xlsx";
12
+ const or = Ye(null);
13
+ function tn({
14
14
  children: e,
15
15
  onUpload: t,
16
16
  getDownloadUrl: r
17
17
  }) {
18
18
  const d = { onUpload: t, getDownloadUrl: r };
19
- return /* @__PURE__ */ n(je.Provider, { value: d, children: e });
19
+ return /* @__PURE__ */ n(or.Provider, { value: d, children: e });
20
20
  }
21
- function Sr() {
22
- return He(je);
21
+ function Lr() {
22
+ return Xe(or);
23
23
  }
24
- const er = We(null);
25
- function Qt({
24
+ const lr = Ye(null);
25
+ function nn({
26
26
  children: e,
27
27
  services: t
28
28
  }) {
29
- const r = lr(() => t, [t]);
30
- return /* @__PURE__ */ n(er.Provider, { value: r, children: e });
29
+ const r = dr(() => t, [t]);
30
+ return /* @__PURE__ */ n(lr.Provider, { value: r, children: e });
31
31
  }
32
- function Nr(e) {
33
- const t = He(er);
32
+ function Mr(e) {
33
+ const t = Xe(lr);
34
34
  return !t || !e ? null : t[e] ?? null;
35
35
  }
36
- const fe = (e, t, r, d = void 0) => {
37
- pe(() => {
36
+ const ue = (e, t, r, d = void 0) => {
37
+ ge(() => {
38
38
  e === !1 && r(t, d);
39
39
  }, [e, t, r, d]);
40
- }, ie = (e, t) => e ? e.split(`
40
+ }, le = (e, t) => e ? e.split(`
41
41
  `).map((r) => r.trim() === "is a required property" ? `${t || "This field"} is required` : r).join(`
42
- `) : "", Or = ({
42
+ `) : "", Dr = ({
43
43
  data: e,
44
44
  handleChange: t,
45
45
  path: r,
46
46
  label: d,
47
- required: m,
47
+ required: g,
48
48
  errors: a,
49
49
  uischema: c,
50
50
  schema: s,
@@ -52,91 +52,91 @@ const fe = (e, t, r, d = void 0) => {
52
52
  visible: i = !0
53
53
  }) => {
54
54
  var y;
55
- if (fe(i, r, t), i === !1)
55
+ if (ue(i, r, t), i === !1)
56
56
  return null;
57
57
  const l = a.length === 0;
58
- return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(T, { direction: "column", gap: "1", children: [
59
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
58
+ return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
59
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
60
60
  d,
61
61
  " ",
62
- m && /* @__PURE__ */ n(h, { color: "red", children: "*" })
62
+ g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
63
63
  ] }),
64
64
  /* @__PURE__ */ n(
65
- ye.Root,
65
+ ve.Root,
66
66
  {
67
67
  value: e || "",
68
- onChange: (p) => t(r, p.target.value),
68
+ onChange: (h) => t(r, h.target.value),
69
69
  disabled: !o,
70
70
  placeholder: (y = c.options) == null ? void 0 : y.placeholder,
71
71
  color: l ? void 0 : "red",
72
72
  id: r
73
73
  }
74
74
  ),
75
- !l && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ie(a, d) }),
76
- s.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: s.description })
75
+ !l && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
76
+ s.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: s.description })
77
77
  ] }) });
78
- }, Ir = W(1, ir), xr = le(Or), Lr = ({
78
+ }, zr = W(1, ur), Ur = oe(Dr), kr = ({
79
79
  data: e,
80
80
  handleChange: t,
81
81
  path: r,
82
82
  label: d,
83
- required: m,
83
+ required: g,
84
84
  errors: a,
85
85
  uischema: c,
86
86
  schema: s,
87
87
  enabled: o,
88
88
  visible: i = !0
89
89
  }) => {
90
- var p;
91
- if (fe(i, r, t), i === !1)
90
+ var h;
91
+ if (ue(i, r, t), i === !1)
92
92
  return null;
93
- const l = a.length === 0, y = (f) => {
94
- if (f === "") {
93
+ const l = a.length === 0, y = (u) => {
94
+ if (u === "") {
95
95
  t(r, void 0);
96
96
  return;
97
97
  }
98
- const v = Number(f);
98
+ const v = Number(u);
99
99
  isNaN(v) || t(r, v);
100
100
  };
101
- return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(T, { direction: "column", gap: "1", children: [
102
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
101
+ return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
102
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
103
103
  d,
104
104
  " ",
105
- m && /* @__PURE__ */ n(h, { color: "red", children: "*" })
105
+ g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
106
106
  ] }),
107
107
  /* @__PURE__ */ n(
108
- ye.Root,
108
+ ve.Root,
109
109
  {
110
110
  type: "number",
111
111
  value: e ?? "",
112
- onChange: (f) => y(f.target.value),
112
+ onChange: (u) => y(u.target.value),
113
113
  disabled: !o,
114
- placeholder: (p = c.options) == null ? void 0 : p.placeholder,
114
+ placeholder: (h = c.options) == null ? void 0 : h.placeholder,
115
115
  color: l ? void 0 : "red",
116
116
  id: r
117
117
  }
118
118
  ),
119
- !l && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ie(a, d) }),
120
- s.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: s.description })
119
+ !l && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
120
+ s.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: s.description })
121
121
  ] }) });
122
- }, Dr = W(2, Ne(sr, cr)), Mr = le(Lr), zr = ({
122
+ }, Fr = W(2, Me(fr, hr)), $r = oe(kr), _r = ({
123
123
  data: e,
124
124
  handleChange: t,
125
125
  path: r,
126
126
  label: d,
127
- required: m,
127
+ required: g,
128
128
  errors: a,
129
129
  schema: c,
130
130
  enabled: s,
131
131
  visible: o = !0
132
132
  }) => {
133
- if (fe(o, r, t), o === !1)
133
+ if (ue(o, r, t), o === !1)
134
134
  return null;
135
135
  const i = a.length === 0;
136
- return /* @__PURE__ */ g(R, { mb: "4", children: [
137
- /* @__PURE__ */ g(T, { gap: "2", align: "center", children: [
136
+ return /* @__PURE__ */ p(C, { mb: "4", children: [
137
+ /* @__PURE__ */ p(T, { gap: "2", align: "center", children: [
138
138
  /* @__PURE__ */ n(
139
- vr,
139
+ Cr,
140
140
  {
141
141
  checked: !!e,
142
142
  onCheckedChange: (l) => t(r, l === !0),
@@ -144,48 +144,48 @@ const fe = (e, t, r, d = void 0) => {
144
144
  id: r
145
145
  }
146
146
  ),
147
- /* @__PURE__ */ g(h, { as: "label", size: "2", htmlFor: r, children: [
147
+ /* @__PURE__ */ p(f, { as: "label", size: "2", htmlFor: r, children: [
148
148
  d,
149
149
  " ",
150
- m && "*"
150
+ g && "*"
151
151
  ] })
152
152
  ] }),
153
- !i && /* @__PURE__ */ n(h, { color: "red", size: "1", className: "block mt-1", children: ie(a, d) }),
154
- c.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", className: "block mt-1", children: c.description })
153
+ !i && /* @__PURE__ */ n(f, { color: "red", size: "1", className: "block mt-1", children: le(a, d) }),
154
+ c.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", className: "block mt-1", children: c.description })
155
155
  ] });
156
- }, Ur = W(2, ar), kr = le(zr), Fr = ({
156
+ }, Pr = W(2, pr), Vr = oe(_r), Hr = ({
157
157
  data: e,
158
158
  handleChange: t,
159
159
  path: r,
160
160
  label: d,
161
- required: m,
161
+ required: g,
162
162
  errors: a,
163
163
  schema: c,
164
164
  enabled: s,
165
165
  visible: o = !0
166
166
  }) => {
167
- if (fe(o, r, t), o === !1)
167
+ if (ue(o, r, t), o === !1)
168
168
  return null;
169
169
  const i = a.length === 0;
170
170
  let l = [];
171
- c.enum ? l = c.enum.map((p) => ({ value: p, label: String(p) })) : c.oneOf && (l = c.oneOf.map((p) => ({
172
- value: p.const,
173
- label: p.title || String(p.const)
171
+ c.enum ? l = c.enum.map((h) => ({ value: h, label: String(h) })) : c.oneOf && (l = c.oneOf.map((h) => ({
172
+ value: h.const,
173
+ label: h.title || String(h.const)
174
174
  })));
175
175
  const y = e;
176
- return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(T, { direction: "column", gap: "1", children: [
177
- /* @__PURE__ */ g(h, { as: "div", size: "2", weight: "bold", children: [
176
+ return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
177
+ /* @__PURE__ */ p(f, { as: "div", size: "2", weight: "bold", children: [
178
178
  d,
179
179
  " ",
180
- m && /* @__PURE__ */ n(h, { color: "red", children: "*" })
180
+ g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
181
181
  ] }),
182
182
  /* @__PURE__ */ n(
183
- ke.Root,
183
+ Ve.Root,
184
184
  {
185
185
  value: y !== void 0 ? String(y) : "",
186
- onValueChange: (p) => {
187
- const f = l.find((v) => String(v.value) === p);
188
- f && t(r, f.value);
186
+ onValueChange: (h) => {
187
+ const u = l.find((v) => String(v.value) === h);
188
+ u && t(r, u.value);
189
189
  },
190
190
  disabled: !s,
191
191
  children: /* @__PURE__ */ n(
@@ -197,34 +197,34 @@ const fe = (e, t, r, d = void 0) => {
197
197
  columnGap: "clamp(14px, 3vw, 36px)",
198
198
  rowGap: "clamp(8px, 1.6vw, 14px)"
199
199
  },
200
- children: l.map((p) => /* @__PURE__ */ g(T, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
201
- /* @__PURE__ */ n(ke.Item, { value: String(p.value) }),
202
- /* @__PURE__ */ n(h, { size: "2", color: s ? void 0 : "gray", children: p.label })
203
- ] }, String(p.value)))
200
+ children: l.map((h) => /* @__PURE__ */ p(T, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
201
+ /* @__PURE__ */ n(Ve.Item, { value: String(h.value) }),
202
+ /* @__PURE__ */ n(f, { size: "2", color: s ? void 0 : "gray", children: h.label })
203
+ ] }, String(h.value)))
204
204
  }
205
205
  )
206
206
  }
207
207
  ),
208
- !i && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ie(a, d) }),
209
- c.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: c.description })
208
+ !i && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
209
+ c.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: c.description })
210
210
  ] }) });
211
- }, $r = (e, t, r) => {
212
- var m;
213
- return Ne(Be, Ke)(e, t, r) && ((m = e == null ? void 0 : e.options) == null ? void 0 : m.format) === "radio" ? 3 : -1;
214
- }, _r = le(Fr), Pr = ({
211
+ }, Wr = (e, t, r) => {
212
+ var g;
213
+ return Me(Je, Ze)(e, t, r) && ((g = e == null ? void 0 : e.options) == null ? void 0 : g.format) === "radio" ? 3 : -1;
214
+ }, Br = oe(Hr), Kr = ({
215
215
  data: e,
216
216
  handleChange: t,
217
217
  path: r,
218
218
  label: d,
219
- required: m,
219
+ required: g,
220
220
  errors: a,
221
221
  schema: c,
222
222
  uischema: s,
223
223
  enabled: o,
224
224
  visible: i = !0
225
225
  }) => {
226
- var f;
227
- if (fe(i, r, t), i === !1)
226
+ var u;
227
+ if (ue(i, r, t), i === !1)
228
228
  return null;
229
229
  const l = a.length === 0;
230
230
  let y = [];
@@ -232,168 +232,175 @@ const fe = (e, t, r, d = void 0) => {
232
232
  value: String(v.const),
233
233
  label: v.title || String(v.const)
234
234
  })));
235
- const p = e !== void 0 ? String(e) : "";
236
- return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(T, { direction: "column", gap: "1", children: [
237
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
235
+ const h = e !== void 0 ? String(e) : "";
236
+ return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
237
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
238
238
  d,
239
239
  " ",
240
- m && /* @__PURE__ */ n(h, { color: "red", children: "*" })
240
+ g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
241
241
  ] }),
242
- /* @__PURE__ */ g(Ce.Root, { value: p, onValueChange: (v) => t(r, v), disabled: !o, children: [
242
+ /* @__PURE__ */ p(Oe.Root, { value: h, onValueChange: (v) => t(r, v), disabled: !o, children: [
243
243
  /* @__PURE__ */ n(
244
- Ce.Trigger,
244
+ Oe.Trigger,
245
245
  {
246
- placeholder: ((f = s.options) == null ? void 0 : f.placeholder) || "Select an option",
246
+ placeholder: ((u = s.options) == null ? void 0 : u.placeholder) || "Select an option",
247
247
  color: l ? void 0 : "red",
248
248
  id: r
249
249
  }
250
250
  ),
251
- /* @__PURE__ */ n(Ce.Content, { children: y.map((v) => /* @__PURE__ */ n(Ce.Item, { value: v.value, children: v.label }, v.value)) })
251
+ /* @__PURE__ */ n(Oe.Content, { children: y.map((v) => /* @__PURE__ */ n(Oe.Item, { value: v.value, children: v.label }, v.value)) })
252
252
  ] }),
253
- !l && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ie(a, d) }),
254
- c.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: c.description })
253
+ !l && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
254
+ c.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: c.description })
255
255
  ] }) });
256
- }, Vr = W(2, Ne(Be, Ke)), Hr = le(Pr), Wr = {
256
+ }, Gr = W(2, Me(Je, Ze)), Xr = oe(Kr), Yr = {
257
257
  "small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
258
258
  "large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
259
259
  "large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
260
- }, Br = ({
260
+ }, Jr = ({
261
261
  data: e,
262
262
  handleChange: t,
263
263
  path: r,
264
264
  label: d,
265
- required: m,
265
+ required: g,
266
266
  errors: a,
267
267
  enabled: c,
268
268
  visible: s = !0,
269
269
  schema: o,
270
270
  uischema: i
271
271
  }) => {
272
- var ve;
273
- const l = (o == null ? void 0 : o["x-search"]) ?? { service: "" }, y = l.service ?? "", p = l.mode ?? "large-paginated-list", f = Wr[p], v = (f == null ? void 0 : f.fetchOnOpen) ?? !1, S = Nr(y), x = y ? S ? f ? null : `Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${y}" is not registered.` : "Search not configured.", C = c !== !1, I = !a || a.length === 0, [L, O] = k(!1), [F, $] = k(""), [re, _] = k([]), [se, B] = k(!1), [P, X] = k(!1), [te, D] = k(!1), [ce, G] = k(null), [ae, Y] = k(void 0), q = ue(void 0), ne = ue(null), b = ue(null), N = ue(null), z = ue(void 0);
274
- pe(() => {
275
- if (!e) {
276
- Y(void 0), z.current = void 0;
272
+ var ae;
273
+ const l = (o == null ? void 0 : o["x-search"]) ?? { service: "" }, y = l.service ?? "", h = l.mode ?? "large-paginated-list", u = Yr[h], v = (u == null ? void 0 : u.fetchOnOpen) ?? !1, M = l.params, A = Mr(y), w = o.type === "object", O = w ? typeof e == "string" ? { value: e } : e ?? void 0 : void 0, z = w ? O == null ? void 0 : O.value : e, S = O == null ? void 0 : O.label, q = y ? A ? u ? null : `Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${y}" is not registered.` : "Search not configured.", P = c !== !1, ee = !a || a.length === 0, [x, J] = _(!1), [F, V] = _(""), [j, K] = _([]), [$, Q] = _(!1), [re, ie] = _(!1), [se, ce] = _(!1), [fe, b] = _(null), [I, D] = _(void 0), R = de(void 0), U = de(null), G = de(null), Y = de(null), B = de(void 0);
274
+ ge(() => {
275
+ var Z, he;
276
+ if (!z) {
277
+ D(void 0), B.current = void 0;
278
+ return;
279
+ }
280
+ if (((Z = B.current) == null ? void 0 : Z.value) === z && ((he = B.current) == null ? void 0 : he.label) === S) return;
281
+ if (B.current = { value: z, label: S }, w && S) {
282
+ D({ id: z, name: S });
277
283
  return;
278
284
  }
279
- if (z.current === e || (z.current = e, Y({ id: e, name: e }), !(S != null && S.resolve))) return;
280
- let u = !1;
281
- return S.resolve(e).then((w) => {
282
- !u && w && Y(w);
285
+ if (D({ id: z, name: S ?? z }), !(A != null && A.resolve)) return;
286
+ let m = !1;
287
+ return A.resolve(z, M).then((Re) => {
288
+ !m && Re && D(Re);
283
289
  }).catch(() => {
284
290
  }), () => {
285
- u = !0;
291
+ m = !0;
286
292
  };
287
- }, [e, S]);
288
- const E = De(
289
- async (u, w = !1) => {
290
- var j;
291
- if (!S) {
292
- G("Search service not configured.");
293
+ }, [z, S, w, A, M]);
294
+ const be = ke(
295
+ async (m, Z = !1) => {
296
+ var Re;
297
+ if (!A) {
298
+ b("Search service not configured.");
293
299
  return;
294
300
  }
295
- (j = b.current) == null || j.abort();
296
- const de = new AbortController();
297
- b.current = de, w ? D(!0) : (X(!0), D(!1), G(null));
301
+ (Re = G.current) == null || Re.abort();
302
+ const he = new AbortController();
303
+ G.current = he, Z ? ce(!0) : (ie(!0), ce(!1), b(null));
298
304
  try {
299
- const ee = await S.search({
300
- query: u,
301
- cursor: w ? q.current : void 0,
302
- signal: de.signal
303
- }), U = ee.options ?? [];
304
- _(w ? (tr) => [...tr, ...U] : U), q.current = ee.nextCursor, B(((f == null ? void 0 : f.paginated) ?? !1) && ee.nextCursor != null);
305
+ const Ne = await A.search({
306
+ query: m,
307
+ cursor: Z ? R.current : void 0,
308
+ signal: he.signal,
309
+ params: M
310
+ }), _e = Ne.options ?? [];
311
+ K(Z ? (sr) => [...sr, ..._e] : _e), R.current = Ne.nextCursor, Q(((u == null ? void 0 : u.paginated) ?? !1) && Ne.nextCursor != null);
305
312
  } catch {
306
- if (de.signal.aborted) return;
307
- G("Failed to load results. Please try again.");
313
+ if (he.signal.aborted) return;
314
+ b("Failed to load results. Please try again.");
308
315
  } finally {
309
- de.signal.aborted || (w ? D(!1) : X(!1));
316
+ he.signal.aborted || (Z ? ce(!1) : ie(!1));
310
317
  }
311
318
  },
312
- [S, f == null ? void 0 : f.paginated]
319
+ [A, u == null ? void 0 : u.paginated, M]
313
320
  );
314
- if (pe(() => {
315
- if (!L) return;
316
- const u = (w) => {
317
- N.current && !N.current.contains(w.target) && O(!1);
321
+ if (ge(() => {
322
+ if (!x) return;
323
+ const m = (Z) => {
324
+ Y.current && !Y.current.contains(Z.target) && J(!1);
318
325
  };
319
- return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
320
- }, [L]), pe(() => {
321
- var u;
322
- L || ((u = b.current) == null || u.abort(), $(""), _([]), B(!1), G(null), X(!1), D(!1), q.current = void 0);
323
- }, [L]), pe(() => {
324
- if (!L) return;
326
+ return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
327
+ }, [x]), ge(() => {
328
+ var m;
329
+ x || ((m = G.current) == null || m.abort(), V(""), K([]), Q(!1), b(null), ie(!1), ce(!1), R.current = void 0);
330
+ }, [x]), ge(() => {
331
+ if (!x) return;
325
332
  if (!F && !v) {
326
- _([]), B(!1), G(null), q.current = void 0;
333
+ K([]), Q(!1), b(null), R.current = void 0;
327
334
  return;
328
335
  }
329
- ne.current && clearTimeout(ne.current);
330
- const u = F ? 300 : 0;
331
- return ne.current = setTimeout(() => {
332
- _([]), B(!1), q.current = void 0, E(F);
333
- }, u), () => {
334
- ne.current && clearTimeout(ne.current);
336
+ U.current && clearTimeout(U.current);
337
+ const m = F ? 300 : 0;
338
+ return U.current = setTimeout(() => {
339
+ K([]), Q(!1), R.current = void 0, be(F);
340
+ }, m), () => {
341
+ U.current && clearTimeout(U.current);
335
342
  };
336
- }, [F, L, v, E]), fe(s, r, t, null), s === !1)
343
+ }, [F, x, v, be]), ue(s, r, t, w ? void 0 : null), s === !1)
337
344
  return null;
338
- const V = () => {
339
- $(""), _([]), B(!1), G(null), q.current = void 0, O(!0);
340
- }, J = (u) => {
341
- t(r, u.id), Y(u), z.current = u.id, O(!1);
342
- }, Z = (u) => {
343
- u.stopPropagation(), t(r, null), Y(void 0);
344
- }, Q = (u) => {
345
- (u.key === "Enter" || u.key === " ") && Z(u);
346
- }, Oe = ((ve = i == null ? void 0 : i.options) == null ? void 0 : ve.placeholder) ?? "Select an option";
347
- return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(T, { direction: "column", gap: "1", children: [
348
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
345
+ const Ee = () => {
346
+ V(""), K([]), Q(!1), b(null), R.current = void 0, J(!0);
347
+ }, E = (m) => {
348
+ t(r, w ? { value: m.id, label: m.name } : m.id), D(m), B.current = { value: m.id, label: w ? m.name : void 0 }, J(!1);
349
+ }, L = (m) => {
350
+ m.stopPropagation(), t(r, w ? void 0 : null), D(void 0);
351
+ }, we = (m) => {
352
+ (m.key === "Enter" || m.key === " ") && L(m);
353
+ }, te = ((ae = i == null ? void 0 : i.options) == null ? void 0 : ae.placeholder) ?? "Select an option";
354
+ return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
355
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: r, children: [
349
356
  d,
350
357
  " ",
351
- m && /* @__PURE__ */ n(h, { color: "red", children: "*" })
358
+ g && /* @__PURE__ */ n(f, { color: "red", children: "*" })
352
359
  ] }),
353
- /* @__PURE__ */ g("div", { ref: N, style: { position: "relative" }, children: [
360
+ /* @__PURE__ */ p("div", { ref: Y, style: { position: "relative" }, children: [
354
361
  /* @__PURE__ */ n(
355
- ye.Root,
362
+ ve.Root,
356
363
  {
357
364
  id: r,
358
- value: L ? F : (ae == null ? void 0 : ae.name) ?? "",
359
- placeholder: L && (f != null && f.searchable) ? "Search..." : Oe,
360
- disabled: !C,
361
- readOnly: L && !(f != null && f.searchable),
362
- style: I ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
363
- onChange: (u) => {
364
- f != null && f.searchable && ($(u.target.value), L || V());
365
+ value: x ? F : (I == null ? void 0 : I.name) ?? "",
366
+ placeholder: x && (u != null && u.searchable) ? "Search..." : te,
367
+ disabled: !P,
368
+ readOnly: x && !(u != null && u.searchable),
369
+ style: ee ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
370
+ onChange: (m) => {
371
+ u != null && u.searchable && (V(m.target.value), x || Ee());
365
372
  },
366
373
  onFocus: () => {
367
- C && !L && V();
374
+ P && !x && Ee();
368
375
  },
369
- onKeyDown: (u) => {
370
- u.key === "Escape" && O(!1);
376
+ onKeyDown: (m) => {
377
+ m.key === "Escape" && J(!1);
371
378
  },
372
- children: /* @__PURE__ */ n(ye.Slot, { side: "right", children: /* @__PURE__ */ g(T, { align: "center", gap: "1", children: [
373
- e && C && /* @__PURE__ */ n(
379
+ children: /* @__PURE__ */ n(ve.Slot, { side: "right", children: /* @__PURE__ */ p(T, { align: "center", gap: "1", children: [
380
+ z && P && /* @__PURE__ */ n(
374
381
  "span",
375
382
  {
376
383
  role: "button",
377
384
  tabIndex: 0,
378
- onMouseDown: (u) => u.preventDefault(),
379
- onClick: Z,
380
- onKeyDown: Q,
385
+ onMouseDown: (m) => m.preventDefault(),
386
+ onClick: L,
387
+ onKeyDown: we,
381
388
  style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
382
389
  "aria-label": "Clear selection",
383
390
  children: "×"
384
391
  }
385
392
  ),
386
393
  /* @__PURE__ */ n(
387
- Er,
394
+ Ar,
388
395
  {
389
- style: { transform: L ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
396
+ style: { transform: x ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
390
397
  }
391
398
  )
392
399
  ] }) })
393
400
  }
394
401
  ),
395
- L && /* @__PURE__ */ n(
396
- R,
402
+ x && /* @__PURE__ */ n(
403
+ C,
397
404
  {
398
405
  style: {
399
406
  position: "absolute",
@@ -407,229 +414,229 @@ const fe = (e, t, r, d = void 0) => {
407
414
  border: "1px solid var(--gray-a6)",
408
415
  overflow: "hidden"
409
416
  },
410
- children: x ? /* @__PURE__ */ n(R, { p: "3", children: /* @__PURE__ */ n(h, { size: "2", color: "gray", children: x }) }) : /* @__PURE__ */ n(br, { style: { maxHeight: 240 }, children: /* @__PURE__ */ g(R, { p: "1", children: [
411
- P && /* @__PURE__ */ n(T, { justify: "center", p: "4", children: /* @__PURE__ */ n(xe, {}) }),
412
- !P && ce && /* @__PURE__ */ n(R, { px: "3", py: "2", children: /* @__PURE__ */ n(h, { size: "2", color: "red", children: ce }) }),
413
- !P && !ce && re.length === 0 && /* @__PURE__ */ n(R, { px: "3", py: "2", children: /* @__PURE__ */ n(h, { size: "2", color: "gray", children: F || v ? "No results found." : "Type to search…" }) }),
414
- re.map((u) => /* @__PURE__ */ n(
415
- R,
417
+ children: q ? /* @__PURE__ */ n(C, { p: "3", children: /* @__PURE__ */ n(f, { size: "2", color: "gray", children: q }) }) : /* @__PURE__ */ n(Tr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ p(C, { p: "1", children: [
418
+ re && /* @__PURE__ */ n(T, { justify: "center", p: "4", children: /* @__PURE__ */ n(ze, {}) }),
419
+ !re && fe && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(f, { size: "2", color: "red", children: fe }) }),
420
+ !re && !fe && j.length === 0 && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(f, { size: "2", color: "gray", children: F || v ? "No results found." : "Type to search…" }) }),
421
+ j.map((m) => /* @__PURE__ */ n(
422
+ C,
416
423
  {
417
424
  px: "3",
418
425
  py: "2",
419
- onMouseDown: (w) => w.preventDefault(),
420
- onClick: () => J(u),
426
+ onMouseDown: (Z) => Z.preventDefault(),
427
+ onClick: () => E(m),
421
428
  style: {
422
429
  cursor: "pointer",
423
430
  borderRadius: "var(--radius-2)",
424
- backgroundColor: u.id === e ? "var(--accent-3)" : void 0
431
+ backgroundColor: m.id === z ? "var(--accent-3)" : void 0
425
432
  },
426
433
  className: "hover:bg-(--gray-3)",
427
- children: /* @__PURE__ */ n(h, { size: "2", children: u.name })
434
+ children: /* @__PURE__ */ n(f, { size: "2", children: m.name })
428
435
  },
429
- u.id
436
+ m.id
430
437
  )),
431
- (f == null ? void 0 : f.paginated) && se && !te && /* @__PURE__ */ n(R, { px: "3", py: "2", children: /* @__PURE__ */ n(
432
- Se,
438
+ (u == null ? void 0 : u.paginated) && $ && !se && /* @__PURE__ */ n(C, { px: "3", py: "2", children: /* @__PURE__ */ n(
439
+ Le,
433
440
  {
434
441
  variant: "ghost",
435
442
  size: "1",
436
443
  style: { width: "100%" },
437
- onMouseDown: (u) => u.preventDefault(),
438
- onClick: () => void E(F, !0),
444
+ onMouseDown: (m) => m.preventDefault(),
445
+ onClick: () => void be(F, !0),
439
446
  children: "Load more"
440
447
  }
441
448
  ) }),
442
- te && /* @__PURE__ */ n(T, { justify: "center", p: "2", children: /* @__PURE__ */ n(xe, {}) })
449
+ se && /* @__PURE__ */ n(T, { justify: "center", p: "2", children: /* @__PURE__ */ n(ze, {}) })
443
450
  ] }) })
444
451
  }
445
452
  )
446
453
  ] }),
447
- !I && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ie(a, d) }),
448
- o.description && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: o.description })
454
+ !ee && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(a, d) }),
455
+ o.description && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: o.description })
449
456
  ] }) });
450
- }, Kr = le(Br), Gr = W(
457
+ }, Zr = oe(Jr), qr = W(
451
458
  3,
452
- Me((e) => {
459
+ Fe((e) => {
453
460
  const t = e["x-search"];
454
- return e.type === "string" && typeof (t == null ? void 0 : t.service) == "string" && t.service !== "";
461
+ return (e.type === "string" || e.type === "object") && typeof (t == null ? void 0 : t.service) == "string" && t.service !== "";
455
462
  })
456
- ), Xr = (e, t) => Cr(`${e}T${t}`).format(), Yr = ({ path: e, label: t, required: r, errors: d, description: m, children: a }) => {
463
+ ), jr = (e, t) => Or(`${e}T${t}`).format(), Qr = ({ path: e, label: t, required: r, errors: d, description: g, children: a }) => {
457
464
  const c = d.length === 0;
458
- return /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ g(T, { direction: "column", gap: "1", children: [
459
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
465
+ return /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ p(T, { direction: "column", gap: "1", children: [
466
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
460
467
  t,
461
468
  " ",
462
- r && /* @__PURE__ */ n(h, { color: "red", children: "*" })
469
+ r && /* @__PURE__ */ n(f, { color: "red", children: "*" })
463
470
  ] }),
464
471
  a,
465
- !c && /* @__PURE__ */ n(h, { color: "red", size: "1", children: ie(d, t) }),
466
- m && /* @__PURE__ */ n(h, { size: "1", color: "gray", children: m })
472
+ !c && /* @__PURE__ */ n(f, { color: "red", size: "1", children: le(d, t) }),
473
+ g && /* @__PURE__ */ n(f, { size: "1", color: "gray", children: g })
467
474
  ] }) });
468
- }, Jr = ({
475
+ }, et = ({
469
476
  data: e,
470
477
  handleChange: t,
471
478
  path: r,
472
479
  label: d,
473
- required: m,
480
+ required: g,
474
481
  errors: a,
475
482
  schema: c,
476
483
  enabled: s,
477
484
  visible: o = !0
478
485
  }) => {
479
- if (pe(() => {
486
+ if (ge(() => {
480
487
  o === !1 && t(r, void 0);
481
488
  }, [o, r, t]), o === !1)
482
489
  return null;
483
- const i = a.length === 0, l = typeof e == "string" ? e : "", y = (C) => /* @__PURE__ */ n(Yr, { path: r, label: d, required: m, errors: a, description: c.description, children: C });
490
+ const i = a.length === 0, l = typeof e == "string" ? e : "", y = (w) => /* @__PURE__ */ n(Qr, { path: r, label: d, required: g, errors: a, description: c.description, children: w });
484
491
  if (c.format === "time")
485
492
  return y(
486
493
  /* @__PURE__ */ n(
487
- ye.Root,
494
+ ve.Root,
488
495
  {
489
496
  type: "time",
490
497
  value: l,
491
- onChange: (C) => t(r, C.target.value),
498
+ onChange: (w) => t(r, w.target.value),
492
499
  disabled: !s,
493
500
  color: i ? void 0 : "red",
494
501
  id: r
495
502
  }
496
503
  )
497
504
  );
498
- const p = c.format === "date-time", [f = "", v = ""] = l.split("T"), S = v.slice(0, 5), x = (C, I) => {
499
- if (!C) {
505
+ const h = c.format === "date-time", [u = "", v = ""] = l.split("T"), M = v.slice(0, 5), A = (w, O) => {
506
+ if (!w) {
500
507
  t(r, void 0);
501
508
  return;
502
509
  }
503
- t(r, p ? Xr(C, I || "00:00") : C);
510
+ t(r, h ? jr(w, O || "00:00") : w);
504
511
  };
505
512
  return y(
506
- /* @__PURE__ */ g(T, { gap: "2", align: "center", children: [
513
+ /* @__PURE__ */ p(T, { gap: "2", align: "center", children: [
507
514
  /* @__PURE__ */ n(
508
- ye.Root,
515
+ ve.Root,
509
516
  {
510
517
  type: "date",
511
- value: f,
518
+ value: u,
512
519
  disabled: !s,
513
520
  color: i ? void 0 : "red",
514
- onChange: (C) => x(C.target.value, S),
521
+ onChange: (w) => A(w.target.value, M),
515
522
  id: r,
516
523
  style: { flex: 1 }
517
524
  }
518
525
  ),
519
- p && /* @__PURE__ */ n(
520
- ye.Root,
526
+ h && /* @__PURE__ */ n(
527
+ ve.Root,
521
528
  {
522
529
  type: "time",
523
- value: S,
524
- disabled: !s || !f,
530
+ value: M,
531
+ disabled: !s || !u,
525
532
  color: i ? void 0 : "red",
526
- onChange: (C) => x(f, C.target.value),
533
+ onChange: (w) => A(u, w.target.value),
527
534
  style: { flex: 1 }
528
535
  }
529
536
  )
530
537
  ] })
531
538
  );
532
- }, Zr = W(2, Ne(dr, ur, fr)), qr = le(Jr), Qr = ({
539
+ }, rt = W(2, Me(gr, mr, yr)), tt = oe(et), nt = ({
533
540
  uischema: e,
534
541
  schema: t,
535
542
  path: r,
536
543
  renderers: d,
537
- cells: m,
544
+ cells: g,
538
545
  enabled: a,
539
546
  visible: c = !0
540
547
  }) => {
541
548
  const o = e.elements;
542
549
  return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
543
- Re,
550
+ Se,
544
551
  {
545
552
  uischema: i,
546
553
  schema: t,
547
554
  path: r,
548
555
  renderers: d,
549
- cells: m,
556
+ cells: g,
550
557
  enabled: a
551
558
  },
552
559
  `${r}-${l}`
553
560
  )) });
554
- }, jr = W(1, we("VerticalLayout")), et = ({
561
+ }, ot = W(1, Ae("VerticalLayout")), lt = ({
555
562
  uischema: e,
556
563
  schema: t,
557
564
  path: r,
558
565
  renderers: d,
559
- cells: m,
566
+ cells: g,
560
567
  enabled: a,
561
568
  visible: c = !0
562
569
  }) => {
563
570
  const o = e.elements;
564
- return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "row", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(R, { style: { flex: 1 }, children: /* @__PURE__ */ n(
565
- Re,
571
+ return c === !1 ? null : /* @__PURE__ */ n(T, { direction: "row", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(C, { style: { flex: 1 }, children: /* @__PURE__ */ n(
572
+ Se,
566
573
  {
567
574
  uischema: i,
568
575
  schema: t,
569
576
  path: r,
570
577
  renderers: d,
571
- cells: m,
578
+ cells: g,
572
579
  enabled: a
573
580
  }
574
581
  ) }, `${r}-${l}`)) });
575
- }, rt = W(1, we("HorizontalLayout")), tt = ({
582
+ }, it = W(1, Ae("HorizontalLayout")), st = ({
576
583
  uischema: e,
577
584
  schema: t,
578
585
  path: r,
579
586
  renderers: d,
580
- cells: m,
587
+ cells: g,
581
588
  enabled: a,
582
589
  visible: c = !0
583
590
  }) => {
584
591
  const s = e, o = s.elements;
585
- return c === !1 ? null : /* @__PURE__ */ g(R, { mb: "6", children: [
586
- s.label && /* @__PURE__ */ n(Ge, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: s.label }),
592
+ return c === !1 ? null : /* @__PURE__ */ p(C, { mb: "6", children: [
593
+ s.label && /* @__PURE__ */ n(qe, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: s.label }),
587
594
  /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: o.map((i, l) => /* @__PURE__ */ n(
588
- Re,
595
+ Se,
589
596
  {
590
597
  uischema: i,
591
598
  schema: t,
592
599
  path: r,
593
600
  renderers: d,
594
- cells: m,
601
+ cells: g,
595
602
  enabled: a
596
603
  },
597
604
  `${r}-${l}`
598
605
  )) })
599
606
  ] });
600
- }, nt = W(1, we("Group")), ot = ({
607
+ }, ct = W(1, Ae("Group")), at = ({
601
608
  uischema: e,
602
609
  schema: t,
603
610
  path: r,
604
611
  renderers: d,
605
- cells: m,
612
+ cells: g,
606
613
  enabled: a,
607
614
  visible: c = !0
608
615
  }) => {
609
- var p;
610
- const o = e.elements.filter((f) => f.type === "Category"), [i, l] = k(((p = o[0]) == null ? void 0 : p.label) || "");
616
+ var h;
617
+ const o = e.elements.filter((u) => u.type === "Category"), [i, l] = _(((h = o[0]) == null ? void 0 : h.label) || "");
611
618
  if (c === !1 || !o.length) return null;
612
- const y = o.find((f) => f.label === i) ? i : o[0].label;
613
- return /* @__PURE__ */ g(Te.Root, { value: y, onValueChange: l, children: [
614
- /* @__PURE__ */ n(Te.List, { children: o.map((f, v) => /* @__PURE__ */ n(Te.Trigger, { value: f.label, children: f.label }, `${r}-${v}`)) }),
615
- /* @__PURE__ */ n(R, { pt: "3", children: o.map((f, v) => /* @__PURE__ */ n(Te.Content, { value: f.label, children: /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: f.elements.map((S, x) => /* @__PURE__ */ n(
616
- Re,
619
+ const y = o.find((u) => u.label === i) ? i : o[0].label;
620
+ return /* @__PURE__ */ p(Ie.Root, { value: y, onValueChange: l, children: [
621
+ /* @__PURE__ */ n(Ie.List, { children: o.map((u, v) => /* @__PURE__ */ n(Ie.Trigger, { value: u.label, children: u.label }, `${r}-${v}`)) }),
622
+ /* @__PURE__ */ n(C, { pt: "3", children: o.map((u, v) => /* @__PURE__ */ n(Ie.Content, { value: u.label, children: /* @__PURE__ */ n(T, { direction: "column", gap: "4", children: u.elements.map((M, A) => /* @__PURE__ */ n(
623
+ Se,
617
624
  {
618
- uischema: S,
625
+ uischema: M,
619
626
  schema: t,
620
627
  path: r,
621
628
  renderers: d,
622
- cells: m,
629
+ cells: g,
623
630
  enabled: a
624
631
  },
625
- `${r}-${v}-${x}`
632
+ `${r}-${v}-${A}`
626
633
  )) }) }, `${r}-${v}`)) })
627
634
  ] });
628
- }, lt = W(1, we("Categorization"));
629
- function ge(e) {
635
+ }, dt = W(1, Ae("Categorization"));
636
+ function me(e) {
630
637
  return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
631
638
  }
632
- function me(e) {
639
+ function ye(e) {
633
640
  return e.split(",").map((t) => {
634
641
  if (t = t.trim(), t.endsWith("/*"))
635
642
  return t.split("/")[0].toUpperCase() + "S";
@@ -639,109 +646,109 @@ function me(e) {
639
646
  return r ? r.toUpperCase() : t;
640
647
  }).join(", ");
641
648
  }
642
- function it(e) {
649
+ function ut(e) {
643
650
  return e ? Array.isArray(e) ? e : [e] : [];
644
651
  }
645
- const st = ({
652
+ const ft = ({
646
653
  data: e,
647
654
  handleChange: t,
648
655
  path: r,
649
656
  label: d,
650
- required: m,
657
+ required: g,
651
658
  uischema: a,
652
659
  schema: c,
653
660
  enabled: s,
654
661
  errors: o,
655
662
  visible: i = !0
656
663
  }) => {
657
- const l = Sr();
658
- fe(i, r, t, null);
659
- const y = !o || o.length === 0, p = (c == null ? void 0 : c["x-file"]) ?? {}, f = (a == null ? void 0 : a.options) ?? {}, v = p.maxFiles ?? f.maxFiles ?? 1, S = p.maxSize ?? f.maxSize ?? 5 * 1024 * 1024, x = p.accept ?? f.accept ?? "image/*,application/pdf", C = v > 1, I = s !== !1, [L, O] = k(!1), [F, $] = k(null), [re, _] = k({}), se = ue(/* @__PURE__ */ new Set()), B = ue(null), P = it(e), X = P.length >= v;
660
- pe(() => () => {
661
- se.current.forEach((b) => URL.revokeObjectURL(b)), se.current.clear();
664
+ const l = Lr();
665
+ ue(i, r, t, null);
666
+ const y = !o || o.length === 0, h = (c == null ? void 0 : c["x-file"]) ?? {}, u = (a == null ? void 0 : a.options) ?? {}, v = h.maxFiles ?? u.maxFiles ?? 1, M = h.maxSize ?? u.maxSize ?? 5 * 1024 * 1024, A = h.accept ?? u.accept ?? "image/*,application/pdf", w = v > 1, O = s !== !1, [z, S] = _(!1), [q, P] = _(null), [ee, x] = _({}), J = de(/* @__PURE__ */ new Set()), F = de(null), V = ut(e), j = V.length >= v;
667
+ ge(() => () => {
668
+ J.current.forEach((b) => URL.revokeObjectURL(b)), J.current.clear();
662
669
  }, []);
663
- const te = De(
670
+ const K = ke(
664
671
  async (b) => {
665
- if ($(null), P.length >= v) {
666
- $(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
672
+ if (P(null), V.length >= v) {
673
+ P(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
667
674
  return;
668
675
  }
669
- if (b.size > S) {
670
- $(`File exceeds the ${ge(S)} limit.`);
676
+ if (b.size > M) {
677
+ P(`File exceeds the ${me(M)} limit.`);
671
678
  return;
672
679
  }
673
- if (!x.split(",").map((E) => E.trim()).some((E) => E === "*" || E === "*/*" ? !0 : E.endsWith("/*") ? b.type.startsWith(E.slice(0, -1)) : E.startsWith(".") ? b.name.toLowerCase().endsWith(E.toLowerCase()) : b.type === E)) {
674
- $(`Invalid type. Accepted: ${me(x)}`);
680
+ if (!A.split(",").map((R) => R.trim()).some((R) => R === "*" || R === "*/*" ? !0 : R.endsWith("/*") ? b.type.startsWith(R.slice(0, -1)) : R.startsWith(".") ? b.name.toLowerCase().endsWith(R.toLowerCase()) : b.type === R)) {
681
+ P(`Invalid type. Accepted: ${ye(A)}`);
675
682
  return;
676
683
  }
677
684
  if (!(l != null && l.onUpload)) {
678
- $("Upload service not configured.");
685
+ P("Upload service not configured.");
679
686
  return;
680
687
  }
681
688
  try {
682
- const E = await l.onUpload(b), V = URL.createObjectURL(b);
683
- se.current.add(V);
684
- const J = { key: E.key, name: E.name ?? b.name, blobUrl: V };
685
- _((Q) => ({ ...Q, [E.key]: J }));
686
- const Z = [...P, E.key];
687
- t(r, C ? Z : Z[0]);
689
+ const R = await l.onUpload(b), U = URL.createObjectURL(b);
690
+ J.current.add(U);
691
+ const G = { key: R.key, name: R.name ?? b.name, blobUrl: U };
692
+ x((B) => ({ ...B, [R.key]: G }));
693
+ const Y = [...V, R.key];
694
+ t(r, w ? Y : Y[0]);
688
695
  } catch {
689
- $("Upload failed. Please try again."), B.current && (B.current.value = "");
696
+ P("Upload failed. Please try again."), F.current && (F.current.value = "");
690
697
  }
691
698
  },
692
- [P, v, S, x, l, r, t, C]
699
+ [V, v, M, A, l, r, t, w]
693
700
  );
694
701
  if (i === !1)
695
702
  return null;
696
- const D = (b) => {
697
- b.preventDefault(), b.stopPropagation(), !(!I || X) && O(b.type === "dragenter" || b.type === "dragover");
698
- }, ce = (b) => {
699
- var N;
700
- b.preventDefault(), b.stopPropagation(), O(!1), !(!I || X) && (N = b.dataTransfer.files) != null && N[0] && te(b.dataTransfer.files[0]);
701
- }, G = (b) => {
702
- var N;
703
- (N = b.target.files) != null && N[0] && (te(b.target.files[0]), b.target.value = "");
704
- }, ae = (b) => {
705
- if (!I) return;
706
- _((z) => {
707
- var J;
708
- const E = { ...z }, V = (J = E[b]) == null ? void 0 : J.blobUrl;
709
- return V && (URL.revokeObjectURL(V), se.current.delete(V)), delete E[b], E;
703
+ const $ = (b) => {
704
+ b.preventDefault(), b.stopPropagation(), !(!O || j) && S(b.type === "dragenter" || b.type === "dragover");
705
+ }, Q = (b) => {
706
+ var I;
707
+ b.preventDefault(), b.stopPropagation(), S(!1), !(!O || j) && (I = b.dataTransfer.files) != null && I[0] && K(b.dataTransfer.files[0]);
708
+ }, re = (b) => {
709
+ var I;
710
+ (I = b.target.files) != null && I[0] && (K(b.target.files[0]), b.target.value = "");
711
+ }, ie = (b) => {
712
+ if (!O) return;
713
+ x((D) => {
714
+ var G;
715
+ const R = { ...D }, U = (G = R[b]) == null ? void 0 : G.blobUrl;
716
+ return U && (URL.revokeObjectURL(U), J.current.delete(U)), delete R[b], R;
710
717
  });
711
- const N = P.filter((z) => z !== b);
712
- t(r, C ? N.length > 0 ? N : null : N[0] ?? null);
713
- }, Y = async (b, N) => {
714
- var V, J, Z;
718
+ const I = V.filter((D) => D !== b);
719
+ t(r, w ? I.length > 0 ? I : null : I[0] ?? null);
720
+ }, se = async (b, I) => {
721
+ var U, G, Y;
715
722
  b.preventDefault();
716
- const z = (V = re[N]) == null ? void 0 : V.blobUrl;
717
- if (z) {
718
- (J = window.open(z, "_blank", "noopener,noreferrer")) == null || J.focus();
723
+ const D = (U = ee[I]) == null ? void 0 : U.blobUrl;
724
+ if (D) {
725
+ (G = window.open(D, "_blank", "noopener,noreferrer")) == null || G.focus();
719
726
  return;
720
727
  }
721
- const E = window.open("", "_blank");
722
- if (E)
728
+ const R = window.open("", "_blank");
729
+ if (R)
723
730
  try {
724
- const Q = await ((Z = l == null ? void 0 : l.getDownloadUrl) == null ? void 0 : Z.call(l, N));
725
- Q != null && Q.url ? E.location.href = Q.url : E.close();
731
+ const B = await ((Y = l == null ? void 0 : l.getDownloadUrl) == null ? void 0 : Y.call(l, I));
732
+ B != null && B.url ? R.location.href = B.url : R.close();
726
733
  } catch {
727
- E.close();
734
+ R.close();
728
735
  }
729
736
  };
730
- if (!I && P.length === 0) return null;
731
- const q = v - P.length, ne = I && !X;
732
- return /* @__PURE__ */ g(R, { mb: "4", children: [
733
- /* @__PURE__ */ g(T, { align: "center", justify: "between", mb: "2", children: [
734
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", children: [
737
+ if (!O && V.length === 0) return null;
738
+ const ce = v - V.length, fe = O && !j;
739
+ return /* @__PURE__ */ p(C, { mb: "4", children: [
740
+ /* @__PURE__ */ p(T, { align: "center", justify: "between", mb: "2", children: [
741
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", children: [
735
742
  d,
736
- m && /* @__PURE__ */ n(h, { color: "red", children: " *" })
743
+ g && /* @__PURE__ */ n(f, { color: "red", children: " *" })
737
744
  ] }),
738
- /* @__PURE__ */ n(h, { size: "1", color: "gray", children: C ? `Up to ${v} files · ${ge(S)} each · ${me(x)}` : `${ge(S)} · ${me(x)}` })
745
+ /* @__PURE__ */ n(f, { size: "1", color: "gray", children: w ? `Up to ${v} files · ${me(M)} each · ${ye(A)}` : `${me(M)} · ${ye(A)}` })
739
746
  ] }),
740
- P.map((b) => {
741
- var N;
742
- return /* @__PURE__ */ n(ze, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ g(T, { align: "center", gap: "3", children: [
747
+ V.map((b) => {
748
+ var I;
749
+ return /* @__PURE__ */ n($e, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ p(T, { align: "center", gap: "3", children: [
743
750
  /* @__PURE__ */ n(
744
- R,
751
+ C,
745
752
  {
746
753
  style: {
747
754
  background: "var(--blue-3)",
@@ -750,11 +757,11 @@ const st = ({
750
757
  color: "var(--blue-9)",
751
758
  flexShrink: 0
752
759
  },
753
- children: /* @__PURE__ */ n(Ye, { width: "20", height: "20" })
760
+ children: /* @__PURE__ */ n(Qe, { width: "20", height: "20" })
754
761
  }
755
762
  ),
756
- /* @__PURE__ */ n(R, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ n(
757
- h,
763
+ /* @__PURE__ */ n(C, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ n(
764
+ f,
758
765
  {
759
766
  size: "2",
760
767
  weight: "bold",
@@ -764,70 +771,70 @@ const st = ({
764
771
  textOverflow: "ellipsis",
765
772
  whiteSpace: "nowrap"
766
773
  },
767
- children: ((N = re[b]) == null ? void 0 : N.name) ?? "Uploaded File"
774
+ children: ((I = ee[b]) == null ? void 0 : I.name) ?? "Uploaded File"
768
775
  }
769
776
  ) }),
770
- /* @__PURE__ */ g(T, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
771
- /* @__PURE__ */ n(Se, { variant: "soft", color: "blue", size: "1", onClick: (z) => Y(z, b), children: "View" }),
772
- /* @__PURE__ */ n(Je, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
773
- I && /* @__PURE__ */ n(Xe, { variant: "ghost", color: "gray", onClick: () => ae(b), children: /* @__PURE__ */ n(Ze, {}) })
777
+ /* @__PURE__ */ p(T, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
778
+ /* @__PURE__ */ n(Le, { variant: "soft", color: "blue", size: "1", onClick: (D) => se(D, b), children: "View" }),
779
+ /* @__PURE__ */ n(er, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
780
+ O && /* @__PURE__ */ n(je, { variant: "ghost", color: "gray", onClick: () => ie(b), children: /* @__PURE__ */ n(rr, {}) })
774
781
  ] })
775
782
  ] }) }, b);
776
783
  }),
777
- ne && /* @__PURE__ */ g(
784
+ fe && /* @__PURE__ */ p(
778
785
  "div",
779
786
  {
780
787
  role: "button",
781
788
  tabIndex: 0,
782
789
  onClick: () => {
783
790
  var b;
784
- return (b = B.current) == null ? void 0 : b.click();
791
+ return (b = F.current) == null ? void 0 : b.click();
785
792
  },
786
793
  onKeyDown: (b) => {
787
- var N;
788
- (b.key === "Enter" || b.key === " ") && (b.preventDefault(), (N = B.current) == null || N.click());
794
+ var I;
795
+ (b.key === "Enter" || b.key === " ") && (b.preventDefault(), (I = F.current) == null || I.click());
789
796
  },
790
- onDragEnter: D,
791
- onDragLeave: D,
792
- onDragOver: D,
793
- onDrop: ce,
797
+ onDragEnter: $,
798
+ onDragLeave: $,
799
+ onDragOver: $,
800
+ onDrop: Q,
794
801
  style: { cursor: "pointer" },
795
802
  className: [
796
803
  "border-2 border-dashed rounded-lg p-6 text-center",
797
804
  "transition-all duration-200 ease-in-out",
798
- L ? "border-blue-500 bg-blue-50" : F ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
805
+ z ? "border-blue-500 bg-blue-50" : q ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
799
806
  ].join(" "),
800
807
  children: [
801
- /* @__PURE__ */ n("input", { ref: B, type: "file", style: { display: "none" }, accept: x, onChange: G }),
802
- /* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children: F ? /* @__PURE__ */ g(Ee, { children: [
803
- /* @__PURE__ */ n(qe, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
804
- /* @__PURE__ */ n(h, { size: "2", color: "red", weight: "medium", children: F }),
805
- /* @__PURE__ */ n(h, { size: "1", color: "gray", children: "Click to try again" })
806
- ] }) : /* @__PURE__ */ g(Ee, { children: [
807
- /* @__PURE__ */ n(Qe, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
808
- /* @__PURE__ */ n(h, { size: "2", weight: "medium", children: P.length > 0 ? `Add another file (${q} remaining)` : "Click to upload or drag and drop" }),
809
- /* @__PURE__ */ g(h, { size: "1", color: "gray", children: [
810
- ge(S),
808
+ /* @__PURE__ */ n("input", { ref: F, type: "file", style: { display: "none" }, accept: A, onChange: re }),
809
+ /* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children: q ? /* @__PURE__ */ p(Te, { children: [
810
+ /* @__PURE__ */ n(tr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
811
+ /* @__PURE__ */ n(f, { size: "2", color: "red", weight: "medium", children: q }),
812
+ /* @__PURE__ */ n(f, { size: "1", color: "gray", children: "Click to try again" })
813
+ ] }) : /* @__PURE__ */ p(Te, { children: [
814
+ /* @__PURE__ */ n(nr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
815
+ /* @__PURE__ */ n(f, { size: "2", weight: "medium", children: V.length > 0 ? `Add another file (${ce} remaining)` : "Click to upload or drag and drop" }),
816
+ /* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
817
+ me(M),
811
818
  " max · ",
812
- me(x)
819
+ ye(A)
813
820
  ] })
814
821
  ] }) })
815
822
  ]
816
823
  }
817
824
  ),
818
- I && X && C && /* @__PURE__ */ g(h, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
825
+ O && j && w && /* @__PURE__ */ p(f, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
819
826
  "Maximum ",
820
827
  v,
821
828
  " files uploaded. Remove one to replace it."
822
829
  ] }),
823
- !y && /* @__PURE__ */ n(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: ie(o, d) })
830
+ !y && /* @__PURE__ */ n(f, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: le(o, d) })
824
831
  ] });
825
- }, ct = le(st), at = W(
832
+ }, ht = oe(ft), pt = W(
826
833
  10,
827
834
  // high rank to beat default array renderer
828
- hr(
835
+ vr(
829
836
  // Match both single-file (type: string) and multi-file (type: array)
830
- Me((e) => {
837
+ Fe((e) => {
831
838
  if (e.type === "string" && e.format === "file") return !0;
832
839
  if (e.type === "array") {
833
840
  const t = e.items;
@@ -837,16 +844,16 @@ const st = ({
837
844
  })
838
845
  )
839
846
  );
840
- class Le extends Error {
847
+ class Ue extends Error {
841
848
  }
842
- function dt(e, t) {
843
- const r = Tr(e, { type: "array", cellDates: !0 });
849
+ function gt(e, t) {
850
+ const r = Ir(e, { type: "array", cellDates: !0 });
844
851
  if (r.SheetNames.length === 0)
845
- throw new Le("This file has no sheets.");
846
- const d = t ?? r.SheetNames[0], m = r.Sheets[d];
847
- if (!m)
848
- throw new Le(`This file doesn't have a sheet named "${d}".`);
849
- const a = Ar.sheet_to_json(m, { header: 1, raw: !0, defval: null });
852
+ throw new Ue("This file has no sheets.");
853
+ const d = t ?? r.SheetNames[0], g = r.Sheets[d];
854
+ if (!g)
855
+ throw new Ue(`This file doesn't have a sheet named "${d}".`);
856
+ const a = xr.sheet_to_json(g, { header: 1, raw: !0, defval: null });
850
857
  return {
851
858
  sheetName: d,
852
859
  matrix: a,
@@ -854,7 +861,7 @@ function dt(e, t) {
854
861
  colCount: Math.max(0, ...a.map((c) => c.length))
855
862
  };
856
863
  }
857
- function ut(e) {
864
+ function mt(e) {
858
865
  let t = e + 1, r = "";
859
866
  for (; t > 0; ) {
860
867
  const d = (t - 1) % 26;
@@ -862,14 +869,14 @@ function ut(e) {
862
869
  }
863
870
  return r;
864
871
  }
865
- class K extends Error {
872
+ class X extends Error {
866
873
  constructor(r, d) {
867
874
  super(d ?? r);
868
- Ue(this, "code");
875
+ Pe(this, "code");
869
876
  this.code = r, this.name = "FormulaError";
870
877
  }
871
878
  }
872
- const ft = [
879
+ const yt = [
873
880
  // Logical
874
881
  // IF is excluded here even though its native body is real, non-stub code —
875
882
  // see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
@@ -895,7 +902,7 @@ const ft = [
895
902
  // DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
896
903
  "DATE",
897
904
  "TODAY"
898
- ], ht = [
905
+ ], vt = [
899
906
  "MAX",
900
907
  "MIN",
901
908
  "MAXA",
@@ -914,7 +921,7 @@ const ft = [
914
921
  "COUNTA",
915
922
  // not present in fast-formula-parser's function table at all.
916
923
  "UPPER"
917
- ], pt = ["YEAR", "MONTH", "DAY", "WEEKDAY"], gt = ["IF"], mt = [
924
+ ], bt = ["YEAR", "MONTH", "DAY", "WEEKDAY"], Et = ["IF"], wt = [
918
925
  "CONCATENATE",
919
926
  "CONCAT",
920
927
  "LEN",
@@ -925,24 +932,24 @@ const ft = [
925
932
  "MID",
926
933
  "FIND",
927
934
  "SEARCH"
928
- ], yt = /* @__PURE__ */ new Set([
929
- ...ft,
930
- ...ht,
931
- ...pt,
932
- ...mt,
933
- ...gt
934
- ]), vt = /"(?:[^"]|"")*"/g, Fe = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
935
- function bt(e) {
936
- const t = e.replace(vt, (d) => " ".repeat(d.length));
937
- Fe.lastIndex = 0;
935
+ ], Rt = /* @__PURE__ */ new Set([
936
+ ...yt,
937
+ ...vt,
938
+ ...bt,
939
+ ...wt,
940
+ ...Et
941
+ ]), Ct = /"(?:[^"]|"")*"/g, He = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
942
+ function Tt(e) {
943
+ const t = e.replace(Ct, (d) => " ".repeat(d.length));
944
+ He.lastIndex = 0;
938
945
  let r;
939
- for (; (r = Fe.exec(t)) !== null; ) {
946
+ for (; (r = He.exec(t)) !== null; ) {
940
947
  const d = r[1].toUpperCase();
941
- if (!yt.has(d))
942
- throw new K("NAME", `Function ${d} is not allowed.`);
948
+ if (!Rt.has(d))
949
+ throw new X("NAME", `Function ${d} is not allowed.`);
943
950
  }
944
951
  }
945
- function Et(e, t, r) {
952
+ function At(e, t, r) {
946
953
  let d = e;
947
954
  if (d == null) throw r.NA;
948
955
  if (typeof d == "object" && !(d instanceof r) && (d = t.retrieveRef(d)), d instanceof r) throw d;
@@ -950,42 +957,42 @@ function Et(e, t, r) {
950
957
  if (typeof d == "number") return d !== 0;
951
958
  throw r.VALUE;
952
959
  }
953
- function rr(e) {
960
+ function ir(e) {
954
961
  return e !== null && typeof e == "object" && "value" in e ? e.value : e;
955
962
  }
956
- function he(e) {
957
- const t = rr(e);
963
+ function pe(e) {
964
+ const t = ir(e);
958
965
  return Array.isArray(t) ? t.flat(1 / 0) : [t];
959
966
  }
960
- function A(e) {
961
- const t = rr(e);
967
+ function N(e) {
968
+ const t = ir(e);
962
969
  return Array.isArray(t) ? t.flat(1 / 0)[0] : t;
963
970
  }
964
- function Ae(e) {
965
- return e === void 0 ? void 0 : A(e);
971
+ function xe(e) {
972
+ return e === void 0 ? void 0 : N(e);
966
973
  }
967
974
  function H(e) {
968
975
  return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
969
976
  }
970
- function wt(e, t) {
977
+ function St(e, t) {
971
978
  return e instanceof t ? e : new t(e.message || "#ERROR!");
972
979
  }
973
- function M(e) {
980
+ function k(e) {
974
981
  return e.find((t) => t instanceof Error);
975
982
  }
976
- function Rt(e, t) {
983
+ function Nt(e, t) {
977
984
  const r = (a) => {
978
- throw wt(a, t);
985
+ throw St(a, t);
979
986
  }, d = (a, { checkArgsForErrors: c = !0 } = {}) => (...s) => {
980
- const o = s.flatMap(he);
987
+ const o = s.flatMap(pe);
981
988
  if (c) {
982
- const l = M(o);
989
+ const l = k(o);
983
990
  l && r(l);
984
991
  }
985
992
  const i = a(...o);
986
993
  return i instanceof Error ? r(i) : i;
987
- }, m = (a, { toText: c = !1 } = {}) => (s) => {
988
- const o = A(s), i = M([o]);
994
+ }, g = (a, { toText: c = !1 } = {}) => (s) => {
995
+ const o = N(s), i = k([o]);
989
996
  i && r(i);
990
997
  const l = a(c ? H(o) : o);
991
998
  return l instanceof Error ? r(l) : l;
@@ -995,7 +1002,7 @@ function Rt(e, t) {
995
1002
  // dereferenced or type-checked here) — that's what makes
996
1003
  // `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
997
1004
  IF: (a, c, s, o) => {
998
- const i = Et(c, a, t);
1005
+ const i = At(c, a, t);
999
1006
  if (s == null) throw t.NA;
1000
1007
  return i ? s : o ?? !1;
1001
1008
  },
@@ -1012,25 +1019,25 @@ function Rt(e, t) {
1012
1019
  // the other aggregates use.
1013
1020
  COUNTA: d(e.COUNTA, { checkArgsForErrors: !1 }),
1014
1021
  LARGE: (a, c) => {
1015
- const s = he(a), o = A(c), i = M([...s, o]);
1022
+ const s = pe(a), o = N(c), i = k([...s, o]);
1016
1023
  i && r(i);
1017
1024
  const l = e.LARGE(s, o);
1018
1025
  return l instanceof Error ? r(l) : l;
1019
1026
  },
1020
1027
  SMALL: (a, c) => {
1021
- const s = he(a), o = A(c), i = M([...s, o]);
1028
+ const s = pe(a), o = N(c), i = k([...s, o]);
1022
1029
  i && r(i);
1023
1030
  const l = e.SMALL(s, o);
1024
1031
  return l instanceof Error ? r(l) : l;
1025
1032
  },
1026
1033
  PERMUT: (a, c) => {
1027
- const s = [A(a), A(c)], o = M(s);
1034
+ const s = [N(a), N(c)], o = k(s);
1028
1035
  o && r(o);
1029
1036
  const i = e.PERMUT(s[0], s[1]);
1030
1037
  return i instanceof Error ? r(i) : i;
1031
1038
  },
1032
1039
  PERMUTATIONA: (a, c) => {
1033
- const s = [A(a), A(c)], o = M(s);
1040
+ const s = [N(a), N(c)], o = k(s);
1034
1041
  o && r(o);
1035
1042
  const i = e.PERMUTATIONA(s[0], s[1]);
1036
1043
  return i instanceof Error ? r(i) : i;
@@ -1042,39 +1049,39 @@ function Rt(e, t) {
1042
1049
  // real-world data. Same scope decision as the hand-rolled engine this
1043
1050
  // replaces, carried forward deliberately rather than dropped.
1044
1051
  MATCH: (a, c) => {
1045
- const s = A(a), o = he(c), i = M([s, ...o]);
1052
+ const s = N(a), o = pe(c), i = k([s, ...o]);
1046
1053
  i && r(i);
1047
1054
  const l = e.MATCH(s, o, 0);
1048
1055
  return l instanceof Error ? r(l) : l;
1049
1056
  },
1050
1057
  SWITCH: (...a) => {
1051
- const c = a.map(A), s = M(c);
1058
+ const c = a.map(N), s = k(c);
1052
1059
  s && r(s);
1053
1060
  const o = e.SWITCH(...c);
1054
1061
  return o instanceof Error ? r(o) : o;
1055
1062
  },
1056
1063
  SUBSTITUTE: (a, c, s, o) => {
1057
- const i = [H(A(a)), H(A(c)), H(A(s))];
1058
- o !== void 0 && i.push(A(o));
1059
- const l = M(i);
1064
+ const i = [H(N(a)), H(N(c)), H(N(s))];
1065
+ o !== void 0 && i.push(N(o));
1066
+ const l = k(i);
1060
1067
  l && r(l);
1061
1068
  const y = e.SUBSTITUTE(...i);
1062
1069
  return y instanceof Error ? r(y) : y;
1063
1070
  },
1064
1071
  TEXTJOIN: (a, c, ...s) => {
1065
- const o = H(A(a)), i = A(c), l = s.flatMap(he).map(H), y = M([o, i]);
1072
+ const o = H(N(a)), i = N(c), l = s.flatMap(pe).map(H), y = k([o, i]);
1066
1073
  y && r(y);
1067
- const p = e.TEXTJOIN(o, i, l);
1068
- return p instanceof Error ? r(p) : p;
1074
+ const h = e.TEXTJOIN(o, i, l);
1075
+ return h instanceof Error ? r(h) : h;
1069
1076
  },
1070
- UPPER: m(e.UPPER),
1077
+ UPPER: g(e.UPPER),
1071
1078
  // See DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL above for why these override
1072
1079
  // fast-formula-parser's own (real, but broken-for-Date-cells) versions.
1073
- YEAR: m(e.YEAR),
1074
- MONTH: m(e.MONTH),
1075
- DAY: m(e.DAY),
1080
+ YEAR: g(e.YEAR),
1081
+ MONTH: g(e.MONTH),
1082
+ DAY: g(e.DAY),
1076
1083
  WEEKDAY: (a, c) => {
1077
- const s = A(a), o = A(c), i = M([s]);
1084
+ const s = N(a), o = N(c), i = k([s]);
1078
1085
  i && r(i);
1079
1086
  const l = e.WEEKDAY(s, o);
1080
1087
  return l instanceof Error ? r(l) : l;
@@ -1089,53 +1096,53 @@ function Rt(e, t) {
1089
1096
  // separator, matching Excel's own range-argument behavior — the native
1090
1097
  // implementation instead inserts stray commas for a whole-range argument.
1091
1098
  CONCATENATE: (...a) => {
1092
- const c = a.flatMap(he), s = M(c);
1099
+ const c = a.flatMap(pe), s = k(c);
1093
1100
  s && r(s);
1094
1101
  const o = e.CONCATENATE(...c.map(H));
1095
1102
  return o instanceof Error ? r(o) : o;
1096
1103
  },
1097
1104
  CONCAT: (...a) => {
1098
- const c = a.flatMap(he), s = M(c);
1105
+ const c = a.flatMap(pe), s = k(c);
1099
1106
  s && r(s);
1100
1107
  const o = e.CONCAT(...c.map(H));
1101
1108
  return o instanceof Error ? r(o) : o;
1102
1109
  },
1103
- LEN: m(e.LEN, { toText: !0 }),
1104
- TRIM: m(e.TRIM, { toText: !0 }),
1105
- LOWER: m(e.LOWER, { toText: !0 }),
1110
+ LEN: g(e.LEN, { toText: !0 }),
1111
+ TRIM: g(e.TRIM, { toText: !0 }),
1112
+ LOWER: g(e.LOWER, { toText: !0 }),
1106
1113
  LEFT: (a, c) => {
1107
- const s = A(a), o = Ae(c), i = M([s]);
1114
+ const s = N(a), o = xe(c), i = k([s]);
1108
1115
  i && r(i);
1109
1116
  const l = e.LEFT(H(s), o);
1110
1117
  return l instanceof Error ? r(l) : l;
1111
1118
  },
1112
1119
  RIGHT: (a, c) => {
1113
- const s = A(a), o = Ae(c), i = M([s]);
1120
+ const s = N(a), o = xe(c), i = k([s]);
1114
1121
  i && r(i);
1115
1122
  const l = e.RIGHT(H(s), o);
1116
1123
  return l instanceof Error ? r(l) : l;
1117
1124
  },
1118
1125
  MID: (a, c, s) => {
1119
- const o = A(a), i = A(c), l = A(s), y = M([o, i, l]);
1126
+ const o = N(a), i = N(c), l = N(s), y = k([o, i, l]);
1120
1127
  y && r(y);
1121
- const p = e.MID(H(o), i, l);
1122
- return p instanceof Error ? r(p) : p;
1128
+ const h = e.MID(H(o), i, l);
1129
+ return h instanceof Error ? r(h) : h;
1123
1130
  },
1124
1131
  FIND: (a, c, s) => {
1125
- const o = A(a), i = A(c), l = Ae(s), y = M([o, i]);
1132
+ const o = N(a), i = N(c), l = xe(s), y = k([o, i]);
1126
1133
  y && r(y);
1127
- const p = e.FIND(H(o), H(i), l);
1128
- return p instanceof Error ? r(p) : p;
1134
+ const h = e.FIND(H(o), H(i), l);
1135
+ return h instanceof Error ? r(h) : h;
1129
1136
  },
1130
1137
  SEARCH: (a, c, s) => {
1131
- const o = A(a), i = A(c), l = Ae(s), y = M([o, i]);
1138
+ const o = N(a), i = N(c), l = xe(s), y = k([o, i]);
1132
1139
  y && r(y);
1133
- const p = e.SEARCH(H(o), H(i), l);
1134
- return p instanceof Error ? r(p) : p;
1140
+ const h = e.SEARCH(H(o), H(i), l);
1141
+ return h instanceof Error ? r(h) : h;
1135
1142
  }
1136
1143
  };
1137
1144
  }
1138
- const Ct = {
1145
+ const Ot = {
1139
1146
  "#REF!": "REF",
1140
1147
  "#VALUE!": "VALUE",
1141
1148
  "#DIV/0!": "DIV0",
@@ -1144,41 +1151,41 @@ const Ct = {
1144
1151
  "#NUM!": "NUM",
1145
1152
  "#NULL!": "NULL"
1146
1153
  };
1147
- function $e(e) {
1148
- return Ct[e.error] ?? "ERROR";
1154
+ function We(e) {
1155
+ return Ot[e.error] ?? "ERROR";
1149
1156
  }
1150
- function _e(e, t) {
1151
- if (e instanceof K) return e;
1157
+ function Be(e, t) {
1158
+ if (e instanceof X) return e;
1152
1159
  if (e instanceof t) {
1153
1160
  const r = e.details;
1154
- return r instanceof K ? r : r instanceof t ? new K($e(r), r.message) : new K($e(e), e.message);
1161
+ return r instanceof X ? r : r instanceof t ? new X(We(r), r.message) : new X(We(e), e.message);
1155
1162
  }
1156
- return new K("ERROR", e instanceof Error ? e.message : void 0);
1163
+ return new X("ERROR", e instanceof Error ? e.message : void 0);
1157
1164
  }
1158
- function Tt(e) {
1165
+ function It(e) {
1159
1166
  return Math.max(0, ...e.map((t) => (t == null ? void 0 : t.length) ?? 0));
1160
1167
  }
1161
- function At(e) {
1168
+ function xt(e) {
1162
1169
  return (t) => {
1163
1170
  const r = e[t.row - 1];
1164
1171
  if (t.row < 1 || t.col < 1 || r == null || t.col - 1 >= r.length)
1165
- throw new K("REF");
1172
+ throw new X("REF");
1166
1173
  const d = r[t.col - 1];
1167
1174
  return d == null || d === "" ? null : d;
1168
1175
  };
1169
1176
  }
1170
- function St(e) {
1177
+ function Lt(e) {
1171
1178
  return (t) => {
1172
- const r = Math.min(t.from.row, t.to.row), d = Math.min(t.from.col, t.to.col), m = Math.max(t.from.row, t.to.row), a = Math.max(t.from.col, t.to.col), c = Tt(e);
1179
+ const r = Math.min(t.from.row, t.to.row), d = Math.min(t.from.col, t.to.col), g = Math.max(t.from.row, t.to.row), a = Math.max(t.from.col, t.to.col), c = It(e);
1173
1180
  if (r > e.length || d > c)
1174
- throw new K("REF");
1175
- const s = Math.min(m, e.length), o = [];
1181
+ throw new X("REF");
1182
+ const s = Math.min(g, e.length), o = [];
1176
1183
  for (let i = r; i <= s; i++) {
1177
1184
  const l = e[i - 1], y = [];
1178
1185
  if (l != null) {
1179
- const p = Math.min(a, l.length);
1180
- for (let f = d; f <= p; f++) {
1181
- const v = l[f - 1];
1186
+ const h = Math.min(a, l.length);
1187
+ for (let u = d; u <= h; u++) {
1188
+ const v = l[u - 1];
1182
1189
  y.push(v == null || v === "" ? null : v);
1183
1190
  }
1184
1191
  }
@@ -1187,38 +1194,38 @@ function St(e) {
1187
1194
  return o;
1188
1195
  };
1189
1196
  }
1190
- function Nt(e) {
1197
+ function Mt(e) {
1191
1198
  if (e == null || e === "") return null;
1192
1199
  if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
1193
1200
  return e;
1194
- throw new K("VALUE");
1201
+ throw new X("VALUE");
1195
1202
  }
1196
- async function Ot(e, t) {
1197
- if (typeof t != "string") throw new K("ERROR");
1203
+ async function Dt(e, t) {
1204
+ if (typeof t != "string") throw new X("ERROR");
1198
1205
  const r = t.trim();
1199
- if (r === "") throw new K("ERROR");
1206
+ if (r === "") throw new X("ERROR");
1200
1207
  const d = r.startsWith("=") ? r.slice(1) : r;
1201
- bt(d);
1202
- const [m, a] = await Promise.all([
1208
+ Tt(d);
1209
+ const [g, a] = await Promise.all([
1203
1210
  import("fast-formula-parser"),
1204
1211
  import("@formulajs/formulajs")
1205
- ]), c = m.default ?? m, s = c.FormulaError, o = new c({
1206
- onCell: At(e),
1207
- onRange: St(e),
1212
+ ]), c = g.default ?? g, s = c.FormulaError, o = new c({
1213
+ onCell: xt(e),
1214
+ onRange: Lt(e),
1208
1215
  // 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.
1209
- functions: Rt(a, s)
1216
+ functions: Nt(a, s)
1210
1217
  });
1211
1218
  let i;
1212
1219
  try {
1213
1220
  i = o.parse(d, { row: 1, col: 1, sheet: "Sheet1" });
1214
1221
  } catch (l) {
1215
- throw _e(l, s);
1222
+ throw Be(l, s);
1216
1223
  }
1217
1224
  if (i instanceof s)
1218
- throw _e(i, s);
1219
- return Nt(i);
1225
+ throw Be(i, s);
1226
+ return Mt(i);
1220
1227
  }
1221
- const Pe = {
1228
+ const Ke = {
1222
1229
  REF: "#REF!",
1223
1230
  VALUE: "#VALUE!",
1224
1231
  DIV0: "#DIV/0!",
@@ -1228,102 +1235,102 @@ const Pe = {
1228
1235
  NUM: "#NUM!",
1229
1236
  NULL: "#NULL!"
1230
1237
  };
1231
- async function It(e, t) {
1232
- return e.length === 0 ? t.map((r) => ({ label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Pe.ERROR })) : Promise.all(
1238
+ async function zt(e, t) {
1239
+ return e.length === 0 ? t.map((r) => ({ label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Ke.ERROR })) : Promise.all(
1233
1240
  t.map(async (r) => {
1234
1241
  try {
1235
1242
  if (!r || typeof r.label != "string" || typeof r.expression != "string")
1236
- throw new K("ERROR");
1237
- return { label: r.label, value: await Ot(e, r.expression) };
1243
+ throw new X("ERROR");
1244
+ return { label: r.label, value: await Dt(e, r.expression) };
1238
1245
  } catch (d) {
1239
- const m = d instanceof K ? d.code : "ERROR";
1240
- return { label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Pe[m] };
1246
+ const g = d instanceof X ? d.code : "ERROR";
1247
+ return { label: (r == null ? void 0 : r.label) ?? "(unknown)", value: null, error: Ke[g] };
1241
1248
  }
1242
1249
  })
1243
1250
  );
1244
1251
  }
1245
- const xt = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", Lt = 10 * 1024 * 1024, Ie = 200, Dt = 50, Mt = [];
1246
- function be(e) {
1252
+ const Ut = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", kt = 10 * 1024 * 1024, De = 200, Ft = 50, $t = [];
1253
+ function Ce(e) {
1247
1254
  return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
1248
1255
  }
1249
- const zt = ({
1256
+ const _t = ({
1250
1257
  data: e,
1251
1258
  handleChange: t,
1252
1259
  path: r,
1253
1260
  label: d,
1254
- required: m,
1261
+ required: g,
1255
1262
  schema: a,
1256
1263
  enabled: c,
1257
1264
  errors: s,
1258
1265
  visible: o = !0
1259
1266
  }) => {
1260
- var ve;
1261
- fe(o, r, t, null);
1262
- const i = !s || s.length === 0, l = c !== !1, y = (a == null ? void 0 : a["x-spreadsheet"]) ?? {}, p = (a == null ? void 0 : a["x-evaluate"]) ?? Mt, f = y.accept ?? xt, v = y.maxSize ?? Lt, S = y.persistSheet !== !1, x = y.columnHeader === !0, C = y.rowHeader === !0, I = y.showSheet !== !1, L = y.sheetName, O = e ?? null, [F, $] = k(
1267
+ var Ee;
1268
+ ue(o, r, t, null);
1269
+ const i = !s || s.length === 0, l = c !== !1, y = (a == null ? void 0 : a["x-spreadsheet"]) ?? {}, h = (a == null ? void 0 : a["x-evaluate"]) ?? $t, u = y.accept ?? Ut, v = y.maxSize ?? kt, M = y.persistSheet !== !1, A = y.columnHeader === !0, w = y.rowHeader === !0, O = y.showSheet !== !1, z = y.sheetName, S = e ?? null, [q, P] = _(
1263
1270
  () => {
1264
- var u;
1265
- return O != null && O.sheet || (((u = O == null ? void 0 : O.derivations) == null ? void 0 : u.length) ?? 0) > 0 ? "ready" : "empty";
1271
+ var E;
1272
+ return S != null && S.sheet || (((E = S == null ? void 0 : S.derivations) == null ? void 0 : E.length) ?? 0) > 0 ? "ready" : "empty";
1266
1273
  }
1267
- ), [re, _] = k(null), [se, B] = k(!1), [P, X] = k(null), te = ue(null), D = P ?? (O == null ? void 0 : O.sheet) ?? null, ce = (O == null ? void 0 : O.derivations) ?? [], G = D != null || O != null, ae = De(
1268
- async (u) => {
1269
- if (_(null), u.size > v) {
1270
- _(`File exceeds the ${ge(v)} limit.`);
1274
+ ), [ee, x] = _(null), [J, F] = _(!1), [V, j] = _(null), K = de(null), $ = V ?? (S == null ? void 0 : S.sheet) ?? null, Q = (S == null ? void 0 : S.derivations) ?? [], re = $ != null || S != null, ie = ke(
1275
+ async (E) => {
1276
+ if (x(null), E.size > v) {
1277
+ x(`File exceeds the ${me(v)} limit.`);
1271
1278
  return;
1272
1279
  }
1273
- if (!f.split(",").map((U) => U.trim()).some((U) => U === "*" || U === "*/*" ? !0 : U.endsWith("/*") ? u.type.startsWith(U.slice(0, -1)) : U.startsWith(".") ? u.name.toLowerCase().endsWith(U.toLowerCase()) : u.type === U)) {
1274
- _(`Invalid type. Accepted: ${me(f)}`);
1280
+ if (!u.split(",").map((m) => m.trim()).some((m) => m === "*" || m === "*/*" ? !0 : m.endsWith("/*") ? E.type.startsWith(m.slice(0, -1)) : m.startsWith(".") ? E.name.toLowerCase().endsWith(m.toLowerCase()) : E.type === m)) {
1281
+ x(`Invalid type. Accepted: ${ye(u)}`);
1275
1282
  return;
1276
1283
  }
1277
- $("parsing");
1278
- let j;
1284
+ P("parsing");
1285
+ let te;
1279
1286
  try {
1280
- const U = await u.arrayBuffer();
1281
- j = dt(U, L).matrix;
1282
- } catch (U) {
1283
- $("error"), _(
1284
- U instanceof Le ? U.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
1287
+ const m = await E.arrayBuffer();
1288
+ te = gt(m, z).matrix;
1289
+ } catch (m) {
1290
+ P("error"), x(
1291
+ m instanceof Ue ? m.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
1285
1292
  );
1286
1293
  return;
1287
1294
  }
1288
- X(j);
1289
- const ee = await It(j, p);
1295
+ j(te);
1296
+ const ae = await zt(te, h);
1290
1297
  t(
1291
1298
  r,
1292
- S ? { sheet: j, derivations: ee } : { derivations: ee }
1293
- ), $("ready");
1299
+ M ? { sheet: te, derivations: ae } : { derivations: ae }
1300
+ ), P("ready");
1294
1301
  },
1295
- [f, v, S, L, p, r, t]
1302
+ [u, v, M, z, h, r, t]
1296
1303
  );
1297
- if (o === !1 || !l && !G) return null;
1298
- const Y = (u) => {
1299
- u.preventDefault(), u.stopPropagation(), l && B(u.type === "dragenter" || u.type === "dragover");
1300
- }, q = (u) => {
1301
- var w;
1302
- u.preventDefault(), u.stopPropagation(), B(!1), l && (w = u.dataTransfer.files) != null && w[0] && ae(u.dataTransfer.files[0]);
1303
- }, ne = (u) => {
1304
- var w;
1305
- (w = u.target.files) != null && w[0] && (ae(u.target.files[0]), u.target.value = "");
1304
+ if (o === !1 || !l && !re) return null;
1305
+ const se = (E) => {
1306
+ E.preventDefault(), E.stopPropagation(), l && F(E.type === "dragenter" || E.type === "dragover");
1307
+ }, ce = (E) => {
1308
+ var L;
1309
+ E.preventDefault(), E.stopPropagation(), F(!1), l && (L = E.dataTransfer.files) != null && L[0] && ie(E.dataTransfer.files[0]);
1310
+ }, fe = (E) => {
1311
+ var L;
1312
+ (L = E.target.files) != null && L[0] && (ie(E.target.files[0]), E.target.value = "");
1306
1313
  }, b = () => {
1307
- l && (X(null), _(null), $("empty"), t(r, null));
1308
- }, N = x ? 1 : 0, z = C ? 1 : 0, E = D ? D.slice(N) : [], V = E.slice(0, Ie), J = Math.min(
1309
- Dt,
1310
- Math.max(0, ...V.map((u) => Math.max(0, u.length - z)))
1311
- ), Z = Array.from({ length: J }, (u, w) => w + z), Q = I && D == null && O != null, Oe = x && C ? be((ve = D == null ? void 0 : D[0]) == null ? void 0 : ve[0]) : "";
1312
- return /* @__PURE__ */ g(R, { mb: "4", children: [
1313
- /* @__PURE__ */ g(T, { align: "center", justify: "between", mb: "2", children: [
1314
- /* @__PURE__ */ g(h, { as: "label", size: "2", weight: "bold", children: [
1314
+ l && (j(null), x(null), P("empty"), t(r, null));
1315
+ }, I = A ? 1 : 0, D = w ? 1 : 0, R = $ ? $.slice(I) : [], U = R.slice(0, De), G = Math.min(
1316
+ Ft,
1317
+ Math.max(0, ...U.map((E) => Math.max(0, E.length - D)))
1318
+ ), Y = Array.from({ length: G }, (E, L) => L + D), B = O && $ == null && S != null, be = A && w ? Ce((Ee = $ == null ? void 0 : $[0]) == null ? void 0 : Ee[0]) : "";
1319
+ return /* @__PURE__ */ p(C, { mb: "4", children: [
1320
+ /* @__PURE__ */ p(T, { align: "center", justify: "between", mb: "2", children: [
1321
+ /* @__PURE__ */ p(f, { as: "label", size: "2", weight: "bold", children: [
1315
1322
  d,
1316
- m && /* @__PURE__ */ n(h, { color: "red", children: " *" })
1323
+ g && /* @__PURE__ */ n(f, { color: "red", children: " *" })
1317
1324
  ] }),
1318
- /* @__PURE__ */ g(h, { size: "1", color: "gray", children: [
1319
- ge(v),
1325
+ /* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
1326
+ me(v),
1320
1327
  " max · ",
1321
- me(f)
1328
+ ye(u)
1322
1329
  ] })
1323
1330
  ] }),
1324
- G && /* @__PURE__ */ n(ze, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ g(T, { align: "center", gap: "3", children: [
1331
+ re && /* @__PURE__ */ n($e, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ p(T, { align: "center", gap: "3", children: [
1325
1332
  /* @__PURE__ */ n(
1326
- R,
1333
+ C,
1327
1334
  {
1328
1335
  style: {
1329
1336
  background: "var(--blue-3)",
@@ -1332,112 +1339,112 @@ const zt = ({
1332
1339
  color: "var(--blue-9)",
1333
1340
  flexShrink: 0
1334
1341
  },
1335
- children: /* @__PURE__ */ n(Ye, { width: "20", height: "20" })
1342
+ children: /* @__PURE__ */ n(Qe, { width: "20", height: "20" })
1336
1343
  }
1337
1344
  ),
1338
- /* @__PURE__ */ n(R, { style: { flex: 1 }, children: /* @__PURE__ */ n(h, { size: "2", weight: "bold", children: "Spreadsheet uploaded" }) }),
1339
- /* @__PURE__ */ n(Je, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
1340
- l && /* @__PURE__ */ n(Xe, { variant: "ghost", color: "gray", onClick: b, "aria-label": "Remove spreadsheet", children: /* @__PURE__ */ n(Ze, {}) })
1345
+ /* @__PURE__ */ n(C, { style: { flex: 1 }, children: /* @__PURE__ */ n(f, { size: "2", weight: "bold", children: "Spreadsheet uploaded" }) }),
1346
+ /* @__PURE__ */ n(er, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
1347
+ l && /* @__PURE__ */ n(je, { variant: "ghost", color: "gray", onClick: b, "aria-label": "Remove spreadsheet", children: /* @__PURE__ */ n(rr, {}) })
1341
1348
  ] }) }),
1342
- l && /* @__PURE__ */ g(
1349
+ l && /* @__PURE__ */ p(
1343
1350
  "div",
1344
1351
  {
1345
1352
  role: "button",
1346
1353
  tabIndex: 0,
1347
1354
  onClick: () => {
1348
- var u;
1349
- return (u = te.current) == null ? void 0 : u.click();
1355
+ var E;
1356
+ return (E = K.current) == null ? void 0 : E.click();
1350
1357
  },
1351
- onKeyDown: (u) => {
1352
- var w;
1353
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), (w = te.current) == null || w.click());
1358
+ onKeyDown: (E) => {
1359
+ var L;
1360
+ (E.key === "Enter" || E.key === " ") && (E.preventDefault(), (L = K.current) == null || L.click());
1354
1361
  },
1355
- onDragEnter: Y,
1356
- onDragLeave: Y,
1357
- onDragOver: Y,
1358
- onDrop: q,
1362
+ onDragEnter: se,
1363
+ onDragLeave: se,
1364
+ onDragOver: se,
1365
+ onDrop: ce,
1359
1366
  style: { cursor: "pointer" },
1360
1367
  className: [
1361
1368
  "border-2 border-dashed rounded-lg p-6 text-center",
1362
1369
  "transition-all duration-200 ease-in-out",
1363
- se ? "border-blue-500 bg-blue-50" : re ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
1370
+ J ? "border-blue-500 bg-blue-50" : ee ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
1364
1371
  ].join(" "),
1365
1372
  children: [
1366
- /* @__PURE__ */ n("input", { ref: te, type: "file", style: { display: "none" }, accept: f, onChange: ne }),
1367
- /* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children: F === "parsing" ? /* @__PURE__ */ g(Ee, { children: [
1368
- /* @__PURE__ */ n(xe, { size: "3" }),
1369
- /* @__PURE__ */ n(h, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
1370
- ] }) : re ? /* @__PURE__ */ g(Ee, { children: [
1371
- /* @__PURE__ */ n(qe, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
1372
- /* @__PURE__ */ n(h, { size: "2", color: "red", weight: "medium", children: re }),
1373
- /* @__PURE__ */ n(h, { size: "1", color: "gray", children: "Click to try again" })
1374
- ] }) : /* @__PURE__ */ g(Ee, { children: [
1375
- /* @__PURE__ */ n(Qe, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
1376
- /* @__PURE__ */ n(h, { size: "2", weight: "medium", children: G ? "Click to upload a replacement" : "Click to upload or drag and drop" }),
1377
- /* @__PURE__ */ g(h, { size: "1", color: "gray", children: [
1378
- ge(v),
1373
+ /* @__PURE__ */ n("input", { ref: K, type: "file", style: { display: "none" }, accept: u, onChange: fe }),
1374
+ /* @__PURE__ */ n(T, { direction: "column", align: "center", gap: "2", children: q === "parsing" ? /* @__PURE__ */ p(Te, { children: [
1375
+ /* @__PURE__ */ n(ze, { size: "3" }),
1376
+ /* @__PURE__ */ n(f, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
1377
+ ] }) : ee ? /* @__PURE__ */ p(Te, { children: [
1378
+ /* @__PURE__ */ n(tr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
1379
+ /* @__PURE__ */ n(f, { size: "2", color: "red", weight: "medium", children: ee }),
1380
+ /* @__PURE__ */ n(f, { size: "1", color: "gray", children: "Click to try again" })
1381
+ ] }) : /* @__PURE__ */ p(Te, { children: [
1382
+ /* @__PURE__ */ n(nr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
1383
+ /* @__PURE__ */ n(f, { size: "2", weight: "medium", children: re ? "Click to upload a replacement" : "Click to upload or drag and drop" }),
1384
+ /* @__PURE__ */ p(f, { size: "1", color: "gray", children: [
1385
+ me(v),
1379
1386
  " max · ",
1380
- me(f)
1387
+ ye(u)
1381
1388
  ] })
1382
1389
  ] }) })
1383
1390
  ]
1384
1391
  }
1385
1392
  ),
1386
- D && I && /* @__PURE__ */ g(R, { mt: "3", children: [
1387
- /* @__PURE__ */ n(R, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ g(oe.Root, { variant: "surface", size: "1", children: [
1388
- /* @__PURE__ */ n(oe.Header, { children: /* @__PURE__ */ g(oe.Row, { children: [
1389
- /* @__PURE__ */ n(oe.ColumnHeaderCell, { children: Oe }),
1390
- Z.map((u) => {
1391
- var w;
1392
- return /* @__PURE__ */ n(oe.ColumnHeaderCell, { children: x ? be((w = D[0]) == null ? void 0 : w[u]) : ut(u) }, u);
1393
+ $ && O && /* @__PURE__ */ p(C, { mt: "3", children: [
1394
+ /* @__PURE__ */ n(C, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ p(ne.Root, { variant: "surface", size: "1", children: [
1395
+ /* @__PURE__ */ n(ne.Header, { children: /* @__PURE__ */ p(ne.Row, { children: [
1396
+ /* @__PURE__ */ n(ne.ColumnHeaderCell, { children: be }),
1397
+ Y.map((E) => {
1398
+ var L;
1399
+ return /* @__PURE__ */ n(ne.ColumnHeaderCell, { children: A ? Ce((L = $[0]) == null ? void 0 : L[E]) : mt(E) }, E);
1393
1400
  })
1394
1401
  ] }) }),
1395
- /* @__PURE__ */ n(oe.Body, { children: V.map((u, w) => {
1396
- var j;
1397
- const de = N + w;
1398
- return /* @__PURE__ */ g(oe.Row, { children: [
1399
- /* @__PURE__ */ n(oe.RowHeaderCell, { children: C ? be((j = D[de]) == null ? void 0 : j[0]) : de + 1 }),
1400
- Z.map((ee) => /* @__PURE__ */ n(oe.Cell, { children: be(u[ee]) }, ee))
1401
- ] }, w);
1402
+ /* @__PURE__ */ n(ne.Body, { children: U.map((E, L) => {
1403
+ var te;
1404
+ const we = I + L;
1405
+ return /* @__PURE__ */ p(ne.Row, { children: [
1406
+ /* @__PURE__ */ n(ne.RowHeaderCell, { children: w ? Ce((te = $[we]) == null ? void 0 : te[0]) : we + 1 }),
1407
+ Y.map((ae) => /* @__PURE__ */ n(ne.Cell, { children: Ce(E[ae]) }, ae))
1408
+ ] }, L);
1402
1409
  }) })
1403
1410
  ] }) }),
1404
- E.length > Ie && /* @__PURE__ */ g(h, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
1411
+ R.length > De && /* @__PURE__ */ p(f, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
1405
1412
  "Showing first ",
1406
- Ie,
1413
+ De,
1407
1414
  " of ",
1408
- E.length,
1415
+ R.length,
1409
1416
  " rows"
1410
1417
  ] })
1411
1418
  ] }),
1412
- Q && /* @__PURE__ */ n(h, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
1413
- ce.length > 0 && /* @__PURE__ */ g(R, { mt: "3", children: [
1414
- /* @__PURE__ */ n(h, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
1415
- /* @__PURE__ */ n(T, { direction: "column", gap: "1", children: ce.map((u, w) => /* @__PURE__ */ g(T, { justify: "between", children: [
1416
- /* @__PURE__ */ n(h, { size: "2", children: u.label }),
1417
- u.error ? /* @__PURE__ */ n(h, { size: "2", color: "red", children: u.error }) : (
1419
+ B && /* @__PURE__ */ n(f, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
1420
+ Q.length > 0 && /* @__PURE__ */ p(C, { mt: "3", children: [
1421
+ /* @__PURE__ */ n(f, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
1422
+ /* @__PURE__ */ n(T, { direction: "column", gap: "1", children: Q.map((E, L) => /* @__PURE__ */ p(T, { justify: "between", children: [
1423
+ /* @__PURE__ */ n(f, { size: "2", children: E.label }),
1424
+ E.error ? /* @__PURE__ */ n(f, { size: "2", color: "red", children: E.error }) : (
1418
1425
  // d.value is CellValue | null now (SUM/AVERAGE aren't the only
1419
1426
  // possible results anymore — INDEX/CONCATENATE can return a
1420
1427
  // string, a bare comparison can return a boolean, etc.), so
1421
1428
  // `.toLocaleString()` would throw for e.g. a boolean result.
1422
1429
  // Reuse the same formatCell used for the sheet-preview grid.
1423
- /* @__PURE__ */ n(h, { size: "2", children: be(u.value) })
1430
+ /* @__PURE__ */ n(f, { size: "2", children: Ce(E.value) })
1424
1431
  )
1425
- ] }, w)) })
1432
+ ] }, L)) })
1426
1433
  ] }),
1427
- !i && /* @__PURE__ */ n(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: ie(s, d) })
1434
+ !i && /* @__PURE__ */ n(f, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: le(s, d) })
1428
1435
  ] });
1429
- }, Ut = le(zt), kt = W(
1436
+ }, Pt = oe(_t), Vt = W(
1430
1437
  10,
1431
1438
  // matches FileControlTester's rank — beats the default object/Group renderer
1432
- Me(
1439
+ Fe(
1433
1440
  (e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
1434
1441
  )
1435
- ), Ft = ({
1442
+ ), Ht = ({
1436
1443
  data: e,
1437
1444
  path: t,
1438
1445
  schema: r,
1439
1446
  uischema: d,
1440
- enabled: m,
1447
+ enabled: g,
1441
1448
  visible: a,
1442
1449
  addItem: c,
1443
1450
  removeItems: s,
@@ -1447,124 +1454,124 @@ const zt = ({
1447
1454
  const l = i ? r : r.items, y = i || r;
1448
1455
  if (a === !1 || !l || typeof l != "object" || Array.isArray(l))
1449
1456
  return null;
1450
- const p = l, f = Array.isArray(e) ? e : [], v = y.title || "Array Items", S = () => {
1451
- const C = pr(p, o);
1452
- c && c(t, C)();
1453
- }, x = (C) => {
1457
+ const h = l, u = Array.isArray(e) ? e : [], v = y.title || "Array Items", M = () => {
1458
+ const w = br(h, o);
1459
+ c && c(t, w)();
1460
+ }, A = (w) => {
1454
1461
  if (s) {
1455
- const I = s(t, [C]);
1456
- I && I();
1462
+ const O = s(t, [w]);
1463
+ O && O();
1457
1464
  }
1458
1465
  };
1459
- return /* @__PURE__ */ n(R, { mb: "6", children: /* @__PURE__ */ g(T, { direction: "column", gap: "4", children: [
1460
- /* @__PURE__ */ n(h, { as: "div", size: "4", weight: "bold", children: v }),
1461
- f.length === 0 && /* @__PURE__ */ n(R, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ n(h, { size: "2", color: "gray", children: "No items have been added yet." }) }),
1462
- f.map((C, I) => {
1463
- var O;
1464
- const L = `${t}.${I}`;
1465
- return /* @__PURE__ */ n(ze, { size: "3", variant: "surface", children: /* @__PURE__ */ g(T, { direction: "column", gap: "4", children: [
1466
- /* @__PURE__ */ g(T, { justify: "between", align: "center", children: [
1467
- /* @__PURE__ */ g(h, { size: "3", weight: "bold", children: [
1466
+ return /* @__PURE__ */ n(C, { mb: "6", children: /* @__PURE__ */ p(T, { direction: "column", gap: "4", children: [
1467
+ /* @__PURE__ */ n(f, { as: "div", size: "4", weight: "bold", children: v }),
1468
+ u.length === 0 && /* @__PURE__ */ n(C, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ n(f, { size: "2", color: "gray", children: "No items have been added yet." }) }),
1469
+ u.map((w, O) => {
1470
+ var S;
1471
+ const z = `${t}.${O}`;
1472
+ return /* @__PURE__ */ n($e, { size: "3", variant: "surface", children: /* @__PURE__ */ p(T, { direction: "column", gap: "4", children: [
1473
+ /* @__PURE__ */ p(T, { justify: "between", align: "center", children: [
1474
+ /* @__PURE__ */ p(f, { size: "3", weight: "bold", children: [
1468
1475
  "Item ",
1469
- I + 1
1476
+ O + 1
1470
1477
  ] }),
1471
- m && /* @__PURE__ */ g(
1472
- Se,
1478
+ g && /* @__PURE__ */ p(
1479
+ Le,
1473
1480
  {
1474
1481
  type: "button",
1475
1482
  color: "red",
1476
1483
  variant: "soft",
1477
- onClick: () => x(I),
1484
+ onClick: () => A(O),
1478
1485
  title: "Remove item",
1479
1486
  children: [
1480
- /* @__PURE__ */ n(wr, {}),
1487
+ /* @__PURE__ */ n(Sr, {}),
1481
1488
  "Remove"
1482
1489
  ]
1483
1490
  }
1484
1491
  )
1485
1492
  ] }),
1486
- /* @__PURE__ */ n(R, { children: /* @__PURE__ */ n(
1487
- Re,
1493
+ /* @__PURE__ */ n(C, { children: /* @__PURE__ */ n(
1494
+ Se,
1488
1495
  {
1489
- schema: p,
1490
- uischema: ((O = d.options) == null ? void 0 : O.detail) || (p.type === "object" || p.properties ? {
1496
+ schema: h,
1497
+ uischema: ((S = d.options) == null ? void 0 : S.detail) || (h.type === "object" || h.properties ? {
1491
1498
  type: "VerticalLayout",
1492
- elements: Object.keys(p.properties || {}).map((F) => ({
1499
+ elements: Object.keys(h.properties || {}).map((q) => ({
1493
1500
  type: "Control",
1494
- scope: `#/properties/${F}`
1501
+ scope: `#/properties/${q}`
1495
1502
  }))
1496
1503
  } : {
1497
1504
  type: "Control",
1498
1505
  scope: "#"
1499
1506
  }),
1500
- path: L,
1501
- enabled: m,
1507
+ path: z,
1508
+ enabled: g,
1502
1509
  renderers: void 0,
1503
1510
  cells: void 0
1504
1511
  }
1505
1512
  ) })
1506
- ] }) }, L);
1513
+ ] }) }, z);
1507
1514
  }),
1508
- m && /* @__PURE__ */ n(R, { mt: "2", children: /* @__PURE__ */ g(Se, { type: "button", variant: "surface", onClick: S, children: [
1509
- /* @__PURE__ */ n(Rr, {}),
1515
+ g && /* @__PURE__ */ n(C, { mt: "2", children: /* @__PURE__ */ p(Le, { type: "button", variant: "surface", onClick: M, children: [
1516
+ /* @__PURE__ */ n(Nr, {}),
1510
1517
  "Add Item"
1511
1518
  ] }) })
1512
1519
  ] }) });
1513
- }, Ve = yr(Ft), $t = W(3, gr), _t = ({ uischema: e, visible: t }) => {
1520
+ }, Ge = Rr(Ht), Wt = W(3, Er), Bt = ({ uischema: e, visible: t }) => {
1514
1521
  const r = e;
1515
- return t === !1 ? null : /* @__PURE__ */ n(R, { mb: "4", children: /* @__PURE__ */ n(Ge, { size: "4", children: r.text }) });
1516
- }, Pt = W(1, we("Label")), Vt = W(3, mr), jt = [
1517
- { tester: Ir, renderer: xr },
1518
- { tester: Dr, renderer: Mr },
1519
- { tester: Ur, renderer: kr },
1520
- { tester: $r, renderer: _r },
1521
- { tester: Gr, renderer: Kr },
1522
- { tester: Vr, renderer: Hr },
1523
- { tester: Zr, renderer: qr },
1524
- { tester: jr, renderer: Qr },
1525
- { tester: rt, renderer: et },
1526
- { tester: nt, renderer: tt },
1527
- { tester: lt, renderer: ot },
1528
- { tester: at, renderer: ct },
1529
- { tester: kt, renderer: Ut },
1530
- { tester: $t, renderer: Ve },
1531
- { tester: Vt, renderer: Ve },
1532
- { tester: Pt, renderer: _t }
1522
+ return t === !1 ? null : /* @__PURE__ */ n(C, { mb: "4", children: /* @__PURE__ */ n(qe, { size: "4", children: r.text }) });
1523
+ }, Kt = W(1, Ae("Label")), Gt = W(3, wr), on = [
1524
+ { tester: zr, renderer: Ur },
1525
+ { tester: Fr, renderer: $r },
1526
+ { tester: Pr, renderer: Vr },
1527
+ { tester: Wr, renderer: Br },
1528
+ { tester: qr, renderer: Zr },
1529
+ { tester: Gr, renderer: Xr },
1530
+ { tester: rt, renderer: tt },
1531
+ { tester: ot, renderer: nt },
1532
+ { tester: it, renderer: lt },
1533
+ { tester: ct, renderer: st },
1534
+ { tester: dt, renderer: at },
1535
+ { tester: pt, renderer: ht },
1536
+ { tester: Vt, renderer: Pt },
1537
+ { tester: Wt, renderer: Ge },
1538
+ { tester: Gt, renderer: Ge },
1539
+ { tester: Kt, renderer: Bt }
1533
1540
  ];
1534
1541
  export {
1535
- Ve as ArrayControl,
1536
- $t as ArrayControlTester,
1537
- zr as BooleanControl,
1538
- Ur as BooleanControlTester,
1539
- ot as CategorizationLayoutRenderer,
1540
- lt as CategorizationLayoutTester,
1541
- Jr as DateControl,
1542
- Zr as DateControlTester,
1543
- ct as FileControl,
1544
- at as FileControlTester,
1545
- tt as GroupLayoutRenderer,
1546
- nt as GroupLayoutTester,
1547
- et as HorizontalLayoutRenderer,
1548
- rt as HorizontalLayoutTester,
1549
- _t as LabelRenderer,
1550
- Pt as LabelTester,
1551
- Lr as NumberControl,
1552
- Dr as NumberControlTester,
1553
- Fr as RadioControl,
1554
- $r as RadioControlTester,
1555
- Kr as SearchSelectControl,
1556
- Gr as SearchSelectControlTester,
1557
- Qt as SearchServiceProvider,
1558
- Pr as SelectControl,
1559
- Vr as SelectControlTester,
1560
- Ut as SpreadsheetControl,
1561
- kt as SpreadsheetControlTester,
1562
- Or as TextControl,
1563
- Ir as TextControlTester,
1564
- qt as UploadProvider,
1565
- Qr as VerticalLayoutRenderer,
1566
- jr as VerticalLayoutTester,
1567
- jt as radixRenderers,
1568
- Nr as useSearchService,
1569
- Sr as useUpload
1542
+ Ge as ArrayControl,
1543
+ Wt as ArrayControlTester,
1544
+ _r as BooleanControl,
1545
+ Pr as BooleanControlTester,
1546
+ at as CategorizationLayoutRenderer,
1547
+ dt as CategorizationLayoutTester,
1548
+ et as DateControl,
1549
+ rt as DateControlTester,
1550
+ ht as FileControl,
1551
+ pt as FileControlTester,
1552
+ st as GroupLayoutRenderer,
1553
+ ct as GroupLayoutTester,
1554
+ lt as HorizontalLayoutRenderer,
1555
+ it as HorizontalLayoutTester,
1556
+ Bt as LabelRenderer,
1557
+ Kt as LabelTester,
1558
+ kr as NumberControl,
1559
+ Fr as NumberControlTester,
1560
+ Hr as RadioControl,
1561
+ Wr as RadioControlTester,
1562
+ Zr as SearchSelectControl,
1563
+ qr as SearchSelectControlTester,
1564
+ nn as SearchServiceProvider,
1565
+ Kr as SelectControl,
1566
+ Gr as SelectControlTester,
1567
+ Pt as SpreadsheetControl,
1568
+ Vt as SpreadsheetControlTester,
1569
+ Dr as TextControl,
1570
+ zr as TextControlTester,
1571
+ tn as UploadProvider,
1572
+ nt as VerticalLayoutRenderer,
1573
+ ot as VerticalLayoutTester,
1574
+ on as radixRenderers,
1575
+ Mr as useSearchService,
1576
+ Lr as useUpload
1570
1577
  };