@overmap-ai/forms 1.0.2 → 1.0.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/forms.js CHANGED
@@ -1,12 +1,12 @@
1
- var Dt = Object.defineProperty;
2
- var _t = (s, i, e) => i in s ? Dt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
1
+ var kt = Object.defineProperty;
2
+ var _t = (s, i, e) => i in s ? kt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
3
  var m = (s, i, e) => (_t(s, typeof i != "symbol" ? i + "" : i, e), e);
4
- import { jsx as r, jsxs as b, Fragment as dt } from "react/jsx-runtime";
5
- import { Flex as v, Text as D, useSeverityColor as de, Checkbox as Mt, CheckCircledIcon as $t, TextField as oe, FontFamilyIcon as Ot, CalendarIcon as Rt, InputIcon as Nt, TextArea as Bt, RowsIcon as qt, Select as ut, Box as me, IconButton as se, PlusIcon as Le, Badge as Oe, Cross1Icon as ft, ListBulletIcon as Wt, DropdownMenuIcon as jt, MultiSelect as Ht, CheckboxIcon as Ut, Card as ge, Heading as Pe, Button as j, UploadIcon as mt, ButtonList as Ve, divButtonProps as Gt, StarFilledIcon as Kt, StarIcon as Yt, QuestionMarkCircledIcon as Qt, PersonIcon as Xt, Tooltip as Jt, Avatar as Zt, Separator as ei, Dialog as ti, Pencil1Icon as ii, TrashIcon as ni, DragHandleDots2Icon as ri, DropdownMenu as oi, DotsVerticalIcon as si, useAlertDialog as li, Em as ai, Strong as nt, useToast as ci, Tabs as Y } from "@overmap-ai/blocks";
4
+ import { jsx as r, jsxs as y, Fragment as dt } from "react/jsx-runtime";
5
+ import { Flex as v, Text as k, useSeverityColor as de, Checkbox as Mt, CheckCircledIcon as $t, TextField as se, FontFamilyIcon as Ot, CalendarIcon as Rt, InputIcon as Nt, TextArea as Bt, RowsIcon as qt, Select as ut, Box as me, IconButton as le, PlusIcon as De, Badge as Oe, Cross1Icon as ft, ListBulletIcon as Wt, DropdownMenuIcon as jt, MultiSelect as Ht, CheckboxIcon as Ut, Card as ge, Heading as Le, Button as H, UploadIcon as mt, ButtonList as Pe, divButtonProps as Gt, StarFilledIcon as Kt, StarIcon as Yt, QuestionMarkCircledIcon as Qt, PersonIcon as Xt, Tooltip as Jt, Avatar as Zt, Separator as ei, useDiscardAlertDialog as ti, Dialog as ii, Pencil1Icon as ni, TrashIcon as ri, DragHandleDots2Icon as oi, DropdownMenu as si, DotsVerticalIcon as li, useAlertDialog as ai, Em as ci, Strong as nt, useToast as di, Tabs as Q } from "@overmap-ai/blocks";
6
6
  import { useField as He, useFormikContext as ue, useFormik as Ue, FormikProvider as Ge } from "formik";
7
- import di, { useMemo as C, memo as T, useCallback as z, useState as le, useEffect as be, useRef as ui, forwardRef as ye, useReducer as fi } from "react";
7
+ import ui, { useMemo as C, memo as S, useCallback as E, useState as U, useEffect as be, useRef as fi, forwardRef as ye, useReducer as mi } from "react";
8
8
  import { DragDropContext as ht, Droppable as Ke, Draggable as Ye } from "@hello-pangea/dnd";
9
- import { slugify as mi, useAppSelector as _, selectFormRevision as pt, useSDK as gt, selectSubmissionAttachments as hi, selectFilteredUserForms as pi, selectUserFormMapping as gi, selectOrganization as bt, selectUser as Qe, selectNumberOfUserForms as bi, selectCurrentUser as yt, classNames as vt, isToday as yi, getLocalDateString as vi, selectLatestFormRevision as wi, useFileSrc as xi, selectSubmissionsForForm as Ii } from "@overmap-ai/core";
9
+ import { slugify as hi, useAppSelector as M, selectFormRevision as pt, useSDK as gt, selectSubmissionAttachments as pi, selectFilteredUserForms as gi, selectUserFormMapping as bi, selectOrganization as bt, selectUser as Qe, selectNumberOfUserForms as yi, selectCurrentUser as yt, classNames as vt, isToday as vi, getLocalDateString as wi, selectLatestFormRevision as xi, useFileSrc as Ii, selectSubmissionsForForm as Ci } from "@overmap-ai/core";
10
10
  import ae from "lodash.get";
11
11
  import Xe from "lodash.set";
12
12
  class wt {
@@ -33,10 +33,10 @@ class wt {
33
33
  };
34
34
  }
35
35
  }
36
- class M extends wt {
36
+ class $ extends wt {
37
37
  constructor(e) {
38
- const { label: t, required: n, fieldValidators: o = [], formValidators: a = [], ...l } = e;
39
- super(l);
38
+ const { label: t, required: n, fieldValidators: o = [], formValidators: l = [], ...a } = e;
39
+ super(a);
40
40
  m(this, "required");
41
41
  m(this, "formValidators");
42
42
  m(this, "fieldValidators");
@@ -48,7 +48,7 @@ class M extends wt {
48
48
  * which don't have a `onBlur` event (which is used to set the `touched` state).
49
49
  */
50
50
  m(this, "onlyValidateAfterTouched", !0);
51
- this.label = t, this.required = n, this.fieldValidators = o, this.formValidators = a;
51
+ this.label = t, this.required = n, this.fieldValidators = o, this.formValidators = l;
52
52
  }
53
53
  static getFieldCreationSchema() {
54
54
  return [];
@@ -89,72 +89,72 @@ class M extends wt {
89
89
  return [...this.formValidators];
90
90
  }
91
91
  }
92
- m(M, "fieldTypeName"), m(M, "fieldTypeDescription");
93
- const Ci = "_description_17zed_1", ke = {
94
- description: Ci
95
- }, B = (s) => {
96
- const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: a } = s;
97
- return /* @__PURE__ */ r(v, { direction: "column", gap: "1", asChild: !0, ...a, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
98
- /* @__PURE__ */ r(D, { severity: t, id: o, children: i }),
92
+ m($, "fieldTypeName"), m($, "fieldTypeDescription");
93
+ const Fi = "_description_17zed_1", Ve = {
94
+ description: Fi
95
+ }, q = (s) => {
96
+ const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: l } = s;
97
+ return /* @__PURE__ */ r(v, { direction: "column", gap: "1", asChild: !0, ...l, children: /* @__PURE__ */ y("label", { htmlFor: n, children: [
98
+ /* @__PURE__ */ r(k, { severity: t, id: o, children: i }),
99
99
  e
100
100
  ] }) });
101
- }, q = (s) => {
101
+ }, W = (s) => {
102
102
  const { helpText: i, children: e, severity: t } = s;
103
- return /* @__PURE__ */ b(v, { direction: "column", gap: "1", children: [
103
+ return /* @__PURE__ */ y(v, { direction: "column", gap: "1", children: [
104
104
  e,
105
- /* @__PURE__ */ r(v, { direction: "column", children: /* @__PURE__ */ r(D, { size: "1", severity: t, className: ke.description, children: i }) })
105
+ /* @__PURE__ */ r(v, { direction: "column", children: /* @__PURE__ */ r(k, { size: "1", severity: t, className: Ve.description, children: i }) })
106
106
  ] });
107
- }, W = (s) => {
108
- const { id: i, field: e, formId: t, ...n } = s, [o, a, l] = He(e.getId()), { touched: c } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, h = `${u}-label`, p = e.required ? `${e.label} *` : e.label, g = C(() => ({
107
+ }, j = (s) => {
108
+ const { id: i, field: e, formId: t, ...n } = s, [o, l, a] = He(e.getId()), { touched: c } = l, u = l.error ?? e.description, d = l.error ? "danger" : void 0, f = i ?? `${t}-${e.getId()}-input`, h = `${f}-label`, p = e.required ? `${e.label} *` : e.label, g = C(() => ({
109
109
  ...o,
110
- onChange: (F) => {
111
- const w = e.getValueFromChangeEvent(F);
112
- l.setValue(w, !1).then(), (c || !e.onlyValidateAfterTouched) && l.setError(e.getError(w));
110
+ onChange: (I) => {
111
+ const w = e.getValueFromChangeEvent(I);
112
+ a.setValue(w, !1).then(), (c || !e.onlyValidateAfterTouched) && a.setError(e.getError(w));
113
113
  },
114
- onBlur: (F) => {
115
- l.setTouched(!0, !1).then(), l.setError(e.getError(e.getValueFromChangeEvent(F)));
114
+ onBlur: (I) => {
115
+ a.setTouched(!0, !1).then(), a.setError(e.getError(e.getValueFromChangeEvent(I)));
116
116
  }
117
- }), [e, o, l, c]);
117
+ }), [e, o, a, c]);
118
118
  return [
119
119
  {
120
- helpText: f,
120
+ helpText: u,
121
121
  severity: d,
122
- inputId: u,
122
+ inputId: f,
123
123
  labelId: h,
124
124
  label: p,
125
125
  fieldProps: g,
126
- helpers: l,
126
+ helpers: a,
127
127
  field: e
128
128
  },
129
129
  { ...n, "aria-labelledby": h }
130
130
  ];
131
- }, Fi = [!0, "true"], Ti = T(function(i) {
132
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i), f = de(n), d = Fi.includes(l.value);
133
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(
134
- B,
131
+ }, Ti = [!0, "true"], Si = S(function(i) {
132
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a }, c] = j(i), u = de(n), d = Ti.includes(a.value);
133
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(
134
+ q,
135
135
  {
136
136
  severity: n,
137
137
  inputId: e,
138
138
  labelId: t,
139
- label: a,
139
+ label: l,
140
140
  flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
141
141
  children: /* @__PURE__ */ r(
142
142
  Mt,
143
143
  {
144
144
  ...c,
145
- ...l,
145
+ ...a,
146
146
  id: e,
147
- color: f,
147
+ color: u,
148
148
  value: d.toString(),
149
149
  checked: d,
150
- onCheckedChange: l.onChange,
150
+ onCheckedChange: a.onChange,
151
151
  onChange: void 0,
152
152
  onBlur: void 0
153
153
  }
154
154
  )
155
155
  }
156
156
  ) });
157
- }), Q = class Q extends M {
157
+ }), X = class X extends $ {
158
158
  constructor(e) {
159
159
  super({ ...e, type: "boolean" });
160
160
  m(this, "onlyValidateAfterTouched", !1);
@@ -172,21 +172,21 @@ const Ci = "_description_17zed_1", ke = {
172
172
  static deserialize(e) {
173
173
  if (e.type !== "boolean")
174
174
  throw new Error("Type mismatch.");
175
- return new Q(e);
175
+ return new X(e);
176
176
  }
177
177
  getInput(e) {
178
- return /* @__PURE__ */ r(Ti, { ...e, field: this });
178
+ return /* @__PURE__ */ r(Si, { ...e, field: this });
179
179
  }
180
180
  };
181
- m(Q, "fieldTypeName", "Checkbox"), m(Q, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(Q, "Icon", $t);
182
- let ce = Q;
183
- const Si = T(function(i) {
184
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), d = de(n);
185
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
186
- oe.Input,
181
+ m(X, "fieldTypeName", "Checkbox"), m(X, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(X, "Icon", $t);
182
+ let ce = X;
183
+ const zi = S(function(i) {
184
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a, field: c }, u] = j(i), d = de(n);
185
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
186
+ se.Input,
187
187
  {
188
- ...f,
189
- ...l,
188
+ ...u,
189
+ ...a,
190
190
  type: "number",
191
191
  id: e,
192
192
  min: c.minimum,
@@ -195,15 +195,15 @@ const Si = T(function(i) {
195
195
  color: d
196
196
  }
197
197
  ) }) });
198
- }), O = class O extends M {
198
+ }), R = class R extends $ {
199
199
  constructor(e) {
200
200
  const {
201
201
  minimum: t = Number.MIN_SAFE_INTEGER,
202
202
  maximum: n = Number.MAX_SAFE_INTEGER,
203
203
  integers: o = !1,
204
- ...a
204
+ ...l
205
205
  } = e;
206
- super({ ...a, type: "number" });
206
+ super({ ...l, type: "number" });
207
207
  m(this, "minimum");
208
208
  m(this, "maximum");
209
209
  m(this, "integers");
@@ -215,7 +215,7 @@ const Si = T(function(i) {
215
215
  }
216
216
  static getFieldCreationSchema() {
217
217
  return [
218
- new O({
218
+ new R({
219
219
  label: "Minimum",
220
220
  description: "Minimum value",
221
221
  integers: !0,
@@ -223,7 +223,7 @@ const Si = T(function(i) {
223
223
  identifier: "minimum",
224
224
  formValidators: [this._validateMin]
225
225
  }),
226
- new O({
226
+ new R({
227
227
  label: "Maximum",
228
228
  description: "Maximum value",
229
229
  integers: !0,
@@ -263,18 +263,18 @@ const Si = T(function(i) {
263
263
  static deserialize(e) {
264
264
  if (e.type !== "number")
265
265
  throw new Error("Type mismatch.");
266
- return new O(e);
266
+ return new R(e);
267
267
  }
268
268
  getInput(e) {
269
- return /* @__PURE__ */ r(Si, { field: this, ...e });
269
+ return /* @__PURE__ */ r(zi, { field: this, ...e });
270
270
  }
271
271
  };
272
- m(O, "fieldTypeName", "Number"), m(O, "fieldTypeDescription", "Allows specifying a number within a given range."), m(O, "Icon", Ot), m(O, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(O, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
273
- let U = O;
274
- const zi = T(function(i) {
275
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i), f = de(n), d = l.value ? l.value.split("T")[0] : "";
276
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(oe.Input, { ...c, ...l, type: "date", id: e, color: f, value: d }) }) });
277
- }), X = class X extends M {
272
+ m(R, "fieldTypeName", "Number"), m(R, "fieldTypeDescription", "Allows specifying a number within a given range."), m(R, "Icon", Ot), m(R, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(R, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
273
+ let G = R;
274
+ const Ei = S(function(i) {
275
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a }, c] = j(i), u = de(n), d = a.value ? a.value.split("T")[0] : "";
276
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(se.Input, { ...c, ...a, type: "date", id: e, color: u, value: d }) }) });
277
+ }), J = class J extends $ {
278
278
  constructor(e) {
279
279
  super({ ...e, type: "date" });
280
280
  m(this, "onlyValidateAfterTouched", !1);
@@ -288,15 +288,15 @@ const zi = T(function(i) {
288
288
  static deserialize(e) {
289
289
  if (e.type !== "date")
290
290
  throw new Error("Type mismatch.");
291
- return new X(e);
291
+ return new J(e);
292
292
  }
293
293
  getInput(e) {
294
- return /* @__PURE__ */ r(zi, { field: this, ...e });
294
+ return /* @__PURE__ */ r(Ei, { field: this, ...e });
295
295
  }
296
296
  };
297
- m(X, "fieldTypeName", "Date"), m(X, "fieldTypeDescription", "Allows specifying a date."), m(X, "Icon", Rt);
298
- let Re = X;
299
- class we extends M {
297
+ m(J, "fieldTypeName", "Date"), m(J, "fieldTypeDescription", "Allows specifying a date."), m(J, "Icon", Rt);
298
+ let Re = J;
299
+ class we extends $ {
300
300
  constructor(e) {
301
301
  const { minLength: t, maxLength: n = 5e3, ...o } = e;
302
302
  super(o);
@@ -307,7 +307,7 @@ class we extends M {
307
307
  static getFieldCreationSchema() {
308
308
  return [
309
309
  // min, max
310
- new U({
310
+ new G({
311
311
  label: "Minimum length",
312
312
  description: "Minimum number of characters",
313
313
  required: !1,
@@ -317,7 +317,7 @@ class we extends M {
317
317
  formValidators: [this._validateMin],
318
318
  integers: !0
319
319
  }),
320
- new U({
320
+ new G({
321
321
  label: "Maximum length",
322
322
  description: "Maximum number of characters",
323
323
  required: !1,
@@ -365,13 +365,13 @@ m(we, "_validateMax", (e, t) => {
365
365
  const { minimum_length: n } = t;
366
366
  return typeof n != "number" ? null : n > e ? "Maximum cannot be less than minimum." : null;
367
367
  });
368
- const Ei = T(function(i) {
369
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), d = de(n);
370
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(oe.Input, { ...f, ...l, type: c.inputType, id: e, color: d }) }) });
371
- }), J = class J extends we {
368
+ const Ai = S(function(i) {
369
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a, field: c }, u] = j(i), d = de(n);
370
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(se.Input, { ...u, ...a, type: c.inputType, id: e, color: d }) }) });
371
+ }), Z = class Z extends we {
372
372
  constructor(e) {
373
- const { inputType: t = "text", ...n } = e, o = e.maxLength ? Math.min(500, e.maxLength) : 500, a = e.minLength ? Math.min(e.minLength, o) : void 0;
374
- super({ ...n, maxLength: o, minLength: a, type: "string" });
373
+ const { inputType: t = "text", ...n } = e, o = e.maxLength ? Math.min(500, e.maxLength) : 500, l = e.minLength ? Math.min(e.minLength, o) : void 0;
374
+ super({ ...n, maxLength: o, minLength: l, type: "string" });
375
375
  m(this, "inputType");
376
376
  this.inputType = t;
377
377
  }
@@ -381,19 +381,19 @@ const Ei = T(function(i) {
381
381
  static deserialize(e) {
382
382
  if (e.type !== "string")
383
383
  throw new Error("Type mismatch.");
384
- const { maximum_length: t, minimum_length: n, input_type: o, ...a } = e;
385
- return new J({ ...a, maxLength: t, minLength: n, inputType: o });
384
+ const { maximum_length: t, minimum_length: n, input_type: o, ...l } = e;
385
+ return new Z({ ...l, maxLength: t, minLength: n, inputType: o });
386
386
  }
387
387
  getInput(e) {
388
- return /* @__PURE__ */ r(Ei, { field: this, ...e });
388
+ return /* @__PURE__ */ r(Ai, { field: this, ...e });
389
389
  }
390
390
  };
391
- m(J, "fieldTypeName", "Short Text"), m(J, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(J, "Icon", Nt);
392
- let he = J;
393
- const Ai = T(function(i) {
394
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i);
395
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(Bt, { ...c, ...l, resize: "vertical", id: e, severity: n }) }) });
396
- }), Z = class Z extends we {
391
+ m(Z, "fieldTypeName", "Short Text"), m(Z, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(Z, "Icon", Nt);
392
+ let he = Z;
393
+ const Di = S(function(i) {
394
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a }, c] = j(i);
395
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(Bt, { ...c, ...a, resize: "vertical", id: e, severity: n }) }) });
396
+ }), ee = class ee extends we {
397
397
  constructor(i) {
398
398
  const e = i.maxLength ? Math.min(5e3, i.maxLength) : 5e3, t = i.minLength ? Math.min(i.minLength, e) : void 0;
399
399
  super({ ...i, maxLength: e, minLength: t, type: "text" });
@@ -405,34 +405,34 @@ const Ai = T(function(i) {
405
405
  if (i.type !== "text")
406
406
  throw new Error("Type mismatch.");
407
407
  const { maximum_length: e, minimum_length: t, ...n } = i;
408
- return new Z({ ...n, maxLength: e, minLength: t });
408
+ return new ee({ ...n, maxLength: e, minLength: t });
409
409
  }
410
410
  getInput(i) {
411
- return /* @__PURE__ */ r(Ai, { field: this, ...i });
411
+ return /* @__PURE__ */ r(Di, { field: this, ...i });
412
412
  }
413
413
  };
414
- m(Z, "fieldTypeName", "Paragraph"), m(Z, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(Z, "Icon", qt);
415
- let pe = Z;
416
- const Li = T(function(i) {
417
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), { onChange: d, onBlur: u } = l, h = C(
414
+ m(ee, "fieldTypeName", "Paragraph"), m(ee, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(ee, "Icon", qt);
415
+ let pe = ee;
416
+ const Li = S(function(i) {
417
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a, field: c }, u] = j(i), { onChange: d, onBlur: f } = a, h = C(
418
418
  () => c.options.map((g) => ({ value: g.value, itemContent: g.label })),
419
419
  [c.options]
420
- ), p = z(
420
+ ), p = E(
421
421
  (g) => {
422
- d(g), u(g);
422
+ d(g), f(g);
423
423
  },
424
- [d, u]
424
+ [d, f]
425
425
  );
426
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
426
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
427
427
  ut,
428
428
  {
429
429
  items: h,
430
- ...l,
430
+ ...a,
431
431
  onValueChange: p,
432
432
  placeholder: "Select one...",
433
433
  id: e,
434
434
  severity: n,
435
- ...f
435
+ ...u
436
436
  }
437
437
  ) }) });
438
438
  }), xe = (s = "", i = []) => ({
@@ -474,7 +474,7 @@ const ki = (s, i) => {
474
474
  if (typeof s == "string" && s.length > 0)
475
475
  return s;
476
476
  const e = /* @__PURE__ */ new Date();
477
- return `${mi(i)}-${e.getTime()}`;
477
+ return `${hi(i)}-${e.getTime()}`;
478
478
  }, It = (s, i) => {
479
479
  if (!i)
480
480
  return null;
@@ -486,92 +486,92 @@ const ki = (s, i) => {
486
486
  } else if (e.identifier === i)
487
487
  return e;
488
488
  return null;
489
- }, Be = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Di = T(function(i) {
490
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l }, c] = W(i), f = de(n), d = C(() => Array.isArray(l.value) ? l.value : [], [l.value]), { onChange: u, onBlur: h } = l, p = `${e}-droppable`, { disabled: g } = c, [I, S] = le(""), [F, w] = le(""), A = F || o, L = F ? "red" : f, x = z(
491
- (y) => {
492
- u(y), h(y);
489
+ }, Be = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), _i = S(function(i) {
490
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a }, c] = j(i), u = de(n), d = C(() => Array.isArray(a.value) ? a.value : [], [a.value]), { onChange: f, onBlur: h } = a, p = `${e}-droppable`, { disabled: g } = c, [x, z] = U(""), [I, w] = U(""), L = I || o, P = I ? "red" : u, F = E(
491
+ (b) => {
492
+ f(b), h(b);
493
493
  },
494
- [u, h]
495
- ), V = z(
496
- (y) => {
497
- d.findIndex((P) => P.value === y.target.value.trim()) >= 0 ? w("All options must be unique") : y.target.value ? w("") : w("Option cannot be empty"), S(y.target.value);
494
+ [f, h]
495
+ ), V = E(
496
+ (b) => {
497
+ d.findIndex((A) => A.value === b.target.value.trim()) >= 0 ? w("All options must be unique") : b.target.value ? w("") : w("Option cannot be empty"), z(b.target.value);
498
498
  },
499
- [S, d]
500
- ), $ = z(() => {
501
- if (F)
499
+ [z, d]
500
+ ), N = E(() => {
501
+ if (I)
502
502
  return;
503
- if (!I.trim())
503
+ if (!x.trim())
504
504
  return w("Option cannot be empty");
505
- const y = I.trim();
506
- x([...d, { value: y, label: y }]), S("");
507
- }, [I, F, x, d]), H = z(
508
- (y) => {
509
- y.key === "Enter" && (y.preventDefault(), $());
505
+ const b = x.trim();
506
+ F([...d, { value: b, label: b }]), z("");
507
+ }, [x, I, F, d]), _ = E(
508
+ (b) => {
509
+ b.key === "Enter" && (b.preventDefault(), N());
510
510
  },
511
- [$]
512
- ), R = z(
513
- (y) => {
514
- x(Ie(d, y));
511
+ [N]
512
+ ), O = E(
513
+ (b) => {
514
+ F(Ie(d, b));
515
515
  },
516
- [d, x]
517
- ), E = z(
518
- (y) => {
519
- if (!y.destination)
516
+ [d, F]
517
+ ), T = E(
518
+ (b) => {
519
+ if (!b.destination)
520
520
  return;
521
- const P = y.source.index, k = y.destination.index;
522
- x(Ne(d, P, k));
521
+ const A = b.source.index, D = b.destination.index;
522
+ F(Ne(d, A, D));
523
523
  },
524
- [x, d]
524
+ [F, d]
525
525
  );
526
- return /* @__PURE__ */ r(ht, { onDragEnd: E, children: /* @__PURE__ */ b(v, { direction: "column", gap: "2", children: [
527
- /* @__PURE__ */ r(q, { helpText: A, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: (!g || d.length === 0) && /* @__PURE__ */ b(v, { gap: "2", children: [
526
+ return /* @__PURE__ */ r(ht, { onDragEnd: T, children: /* @__PURE__ */ y(v, { direction: "column", gap: "2", children: [
527
+ /* @__PURE__ */ r(W, { helpText: L, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: (!g || d.length === 0) && /* @__PURE__ */ y(v, { gap: "2", children: [
528
528
  /* @__PURE__ */ r(me, { grow: "1", children: /* @__PURE__ */ r(
529
- oe.Input,
529
+ se.Input,
530
530
  {
531
531
  placeholder: "Press enter to add a new option",
532
532
  ...c,
533
- ...l,
534
- value: I,
533
+ ...a,
534
+ value: x,
535
535
  onChange: V,
536
- onKeyDown: H,
536
+ onKeyDown: _,
537
537
  id: e,
538
- color: L,
538
+ color: P,
539
539
  onBlur: void 0
540
540
  }
541
541
  ) }),
542
542
  /* @__PURE__ */ r(
543
- se,
543
+ le,
544
544
  {
545
545
  type: "button",
546
546
  "aria-label": "Add option",
547
- disabled: !!F || g,
548
- onClick: $,
549
- children: /* @__PURE__ */ r(Le, {})
547
+ disabled: !!I || g,
548
+ onClick: N,
549
+ children: /* @__PURE__ */ r(De, {})
550
550
  }
551
551
  )
552
552
  ] }) }) }),
553
- /* @__PURE__ */ r(Ke, { droppableId: p, children: (y) => /* @__PURE__ */ b(v, { ...y.droppableProps, ref: y.innerRef, direction: "column", children: [
554
- d.map((P, k) => /* @__PURE__ */ r(
553
+ /* @__PURE__ */ r(Ke, { droppableId: p, children: (b) => /* @__PURE__ */ y(v, { ...b.droppableProps, ref: b.innerRef, direction: "column", children: [
554
+ d.map((A, D) => /* @__PURE__ */ r(
555
555
  Ye,
556
556
  {
557
- draggableId: `${P.value}-draggable`,
558
- index: k,
557
+ draggableId: `${A.value}-draggable`,
558
+ index: D,
559
559
  isDragDisabled: g,
560
- children: ({ draggableProps: N, dragHandleProps: fe, innerRef: K }) => /* @__PURE__ */ r(
560
+ children: ({ draggableProps: B, dragHandleProps: fe, innerRef: Y }) => /* @__PURE__ */ r(
561
561
  v,
562
562
  {
563
563
  ...fe,
564
- ...N,
565
- ref: K,
564
+ ...B,
565
+ ref: Y,
566
566
  gap: "2",
567
567
  align: "center",
568
568
  justify: "between",
569
569
  mb: "1",
570
570
  asChild: !0,
571
- children: /* @__PURE__ */ b(Oe, { color: "gray", size: "2", children: [
572
- /* @__PURE__ */ r("span", { children: P.label }),
571
+ children: /* @__PURE__ */ y(Oe, { color: "gray", size: "2", children: [
572
+ /* @__PURE__ */ r("span", { children: A.label }),
573
573
  /* @__PURE__ */ r(
574
- se,
574
+ le,
575
575
  {
576
576
  size: "small",
577
577
  variant: "ghost",
@@ -579,7 +579,7 @@ const ki = (s, i) => {
579
579
  "aria-label": "Delete option",
580
580
  severity: "info",
581
581
  disabled: g,
582
- onClick: () => R(k),
582
+ onClick: () => O(D),
583
583
  children: /* @__PURE__ */ r(ft, {})
584
584
  }
585
585
  )
@@ -587,12 +587,12 @@ const ki = (s, i) => {
587
587
  }
588
588
  )
589
589
  },
590
- P.value
590
+ A.value
591
591
  )),
592
- y.placeholder
592
+ b.placeholder
593
593
  ] }) })
594
594
  ] }) });
595
- }), ee = class ee extends M {
595
+ }), te = class te extends $ {
596
596
  constructor(e) {
597
597
  const { minimum_length: t, maximum_length: n, ...o } = e;
598
598
  super({ ...o, type: "multi-string" });
@@ -607,7 +607,7 @@ const ki = (s, i) => {
607
607
  throw new Error("Expected an array.");
608
608
  }
609
609
  getInput(e) {
610
- return /* @__PURE__ */ r(Di, { field: this, ...e });
610
+ return /* @__PURE__ */ r(_i, { field: this, ...e });
611
611
  }
612
612
  serialize() {
613
613
  return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
@@ -628,12 +628,12 @@ const ki = (s, i) => {
628
628
  static deserialize(e) {
629
629
  if (e.type !== "multi-string")
630
630
  throw new Error("Type mismatch.");
631
- return new ee(e);
631
+ return new te(e);
632
632
  }
633
633
  };
634
- m(ee, "fieldTypeName", "Multi-string"), m(ee, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(ee, "Icon", Wt);
635
- let Ce = ee;
636
- class Ct extends M {
634
+ m(te, "fieldTypeName", "Multi-string"), m(te, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(te, "Icon", Wt);
635
+ let Ce = te;
636
+ class Ct extends $ {
637
637
  constructor(e) {
638
638
  super(e);
639
639
  m(this, "options");
@@ -663,7 +663,7 @@ class Ct extends M {
663
663
  ];
664
664
  }
665
665
  }
666
- const te = class te extends Ct {
666
+ const ie = class ie extends Ct {
667
667
  constructor(i) {
668
668
  super({ ...i, type: "select" });
669
669
  }
@@ -676,35 +676,35 @@ const te = class te extends Ct {
676
676
  static deserialize(i) {
677
677
  if (i.type !== "select")
678
678
  throw new Error("Type mismatch.");
679
- return new te(i);
679
+ return new ie(i);
680
680
  }
681
681
  getInput(i) {
682
682
  return /* @__PURE__ */ r(Li, { field: this, ...i });
683
683
  }
684
684
  };
685
- m(te, "fieldTypeName", "Dropdown"), m(te, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(te, "Icon", jt);
686
- let Fe = te;
687
- const _i = (s) => s ? Array.isArray(s) ? s : [s] : [], Mi = T(function(i) {
688
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), { onChange: d, onBlur: u } = l, h = C(() => _i(l.value), [l.value]), p = z(
685
+ m(ie, "fieldTypeName", "Dropdown"), m(ie, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(ie, "Icon", jt);
686
+ let Fe = ie;
687
+ const Mi = (s) => s ? Array.isArray(s) ? s : [s] : [], $i = S(function(i) {
688
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a, field: c }, u] = j(i), { onChange: d, onBlur: f } = a, h = C(() => Mi(a.value), [a.value]), p = E(
689
689
  (g) => {
690
- d(g), u(g);
690
+ d(g), f(g);
691
691
  },
692
- [d, u]
692
+ [d, f]
693
693
  );
694
- return /* @__PURE__ */ r(q, { helpText: o, severity: n, children: /* @__PURE__ */ r(B, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
694
+ return /* @__PURE__ */ r(W, { helpText: o, severity: n, children: /* @__PURE__ */ r(q, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
695
695
  Ht,
696
696
  {
697
697
  value: h,
698
698
  onValueChange: p,
699
699
  options: c.options,
700
- name: l.name,
700
+ name: a.name,
701
701
  placeholder: "Select one or more...",
702
702
  id: e,
703
703
  severity: n,
704
- ...f
704
+ ...u
705
705
  }
706
706
  ) }) });
707
- }), ie = class ie extends Ct {
707
+ }), ne = class ne extends Ct {
708
708
  constructor(i) {
709
709
  super({ ...i, type: "multi-select" });
710
710
  }
@@ -722,22 +722,22 @@ const _i = (s) => s ? Array.isArray(s) ? s : [s] : [], Mi = T(function(i) {
722
722
  static deserialize(i) {
723
723
  if (i.type !== "multi-select")
724
724
  throw new Error("Type mismatch.");
725
- return new ie(i);
725
+ return new ne(i);
726
726
  }
727
727
  getInput(i) {
728
- return /* @__PURE__ */ r(Mi, { field: this, ...i });
728
+ return /* @__PURE__ */ r($i, { field: this, ...i });
729
729
  }
730
730
  };
731
- m(ie, "fieldTypeName", "Multi-select"), m(ie, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(ie, "Icon", Ut);
732
- let Te = ie;
733
- const $i = T(function({ field: i, ...e }) {
731
+ m(ne, "fieldTypeName", "Multi-select"), m(ne, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(ne, "Icon", Ut);
732
+ let Te = ne;
733
+ const Oi = S(function({ field: i, ...e }) {
734
734
  const [{ value: t }] = He(i.options.clonedFieldIdentifier), n = C(() => {
735
735
  const o = i.options.getFieldToClone(t);
736
- return o ? De(o) : null;
736
+ return o ? ke(o) : null;
737
737
  }, [i.options, t]);
738
738
  return ze(n, e);
739
739
  });
740
- class Se extends M {
740
+ class Se extends $ {
741
741
  constructor(e, t) {
742
742
  super({ ...e, type: "custom" });
743
743
  m(this, "Component");
@@ -754,34 +754,34 @@ class Se extends M {
754
754
  }
755
755
  }
756
756
  m(Se, "fieldTypeName", "Custom"), m(Se, "fieldTypeDescription", "Allows re-rendering of field already in the form");
757
- class Oi extends Se {
757
+ class Ri extends Se {
758
758
  constructor(i) {
759
- super(i, $i);
759
+ super(i, Oi);
760
760
  }
761
761
  }
762
- const Ri = T(function(i) {
763
- const { field: e, ...t } = i, { label: n, description: o, fields: a, condition: l } = e, { values: c, setFieldValue: f } = ue(), d = l != null && l.identifier ? ae(c, l.identifier) : void 0, u = C(() => St(l, d), [l, d]);
762
+ const Ni = S(function(i) {
763
+ const { field: e, ...t } = i, { label: n, description: o, fields: l, condition: a } = e, { values: c, setFieldValue: u } = ue(), d = a != null && a.identifier ? ae(c, a.identifier) : void 0, f = C(() => St(a, d), [a, d]);
764
764
  be(() => {
765
- if (!u)
766
- for (const p of a)
767
- f(p.getId(), "").then();
768
- }, [u, a, f]);
769
- const h = zt(a, t);
770
- return u ? n ? /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ b(v, { direction: "column", gap: "3", children: [
771
- /* @__PURE__ */ b(v, { direction: "column", children: [
772
- /* @__PURE__ */ r(Pe, { as: "h3", size: "3", children: n }),
773
- /* @__PURE__ */ r(D, { className: ke.description, children: o })
765
+ if (!f)
766
+ for (const p of l)
767
+ u(p.getId(), "").then();
768
+ }, [f, l, u]);
769
+ const h = zt(l, t);
770
+ return f ? n ? /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ y(v, { direction: "column", gap: "3", children: [
771
+ /* @__PURE__ */ y(v, { direction: "column", children: [
772
+ /* @__PURE__ */ r(Le, { as: "h3", size: "3", children: n }),
773
+ /* @__PURE__ */ r(k, { className: Ve.description, children: o })
774
774
  ] }),
775
775
  h
776
776
  ] }) }) : h : null;
777
- }), ne = class ne extends wt {
777
+ }), re = class re extends wt {
778
778
  constructor(e) {
779
- const { label: t = null, fields: n, condition: o = null, conditional: a, ...l } = e;
780
- super({ ...l, type: "section" });
779
+ const { label: t = null, fields: n, condition: o = null, conditional: l, ...a } = e;
780
+ super({ ...a, type: "section" });
781
781
  m(this, "label");
782
782
  m(this, "fields");
783
783
  m(this, "condition");
784
- this.fields = n, this.condition = o, this.label = t, a === !1 && (this.condition = null);
784
+ this.fields = n, this.condition = o, this.label = t, l === !1 && (this.condition = null);
785
785
  }
786
786
  static getFieldCreationSchema(e) {
787
787
  return e.length === 0 ? [] : [
@@ -792,7 +792,7 @@ const Ri = T(function(i) {
792
792
  required: !1
793
793
  }),
794
794
  // Declare a section that will hold options for the condition (if any).
795
- new ne({
795
+ new re({
796
796
  label: "Conditional settings",
797
797
  identifier: "conditional-settings",
798
798
  // This section will only be rendered if the above "Conditional" field is checked.
@@ -821,7 +821,7 @@ const Ri = T(function(i) {
821
821
  // Declare a custom field that will be used to input a value for the condition. The value of the
822
822
  // conditional field selected in the previous step must be equal to the value the user inputs into
823
823
  // this field for the section to be rendered.
824
- new Oi({
824
+ new Ri({
825
825
  label: "Value",
826
826
  identifier: "condition.value",
827
827
  required: !0,
@@ -849,7 +849,7 @@ const Ri = T(function(i) {
849
849
  if (e.type !== "section")
850
850
  throw new Error("Invalid type");
851
851
  const t = ((n = e.fields) == null ? void 0 : n.map(Ft)) ?? [];
852
- return new ne({ ...e, fields: t });
852
+ return new re({ ...e, fields: t });
853
853
  }
854
854
  conditional() {
855
855
  return this.condition !== null;
@@ -866,103 +866,103 @@ const Ri = T(function(i) {
866
866
  getErrors(e) {
867
867
  const t = {};
868
868
  for (const n of this.fields) {
869
- const o = n.getId(), a = n.getError(ae(e, o), e);
870
- a && Xe(t, n.getId(), a);
869
+ const o = n.getId(), l = n.getError(ae(e, o), e);
870
+ l && Xe(t, n.getId(), l);
871
871
  }
872
872
  return t;
873
873
  }
874
874
  getInput(e) {
875
- return /* @__PURE__ */ r(Ri, { field: this, ...e });
875
+ return /* @__PURE__ */ r(Ni, { field: this, ...e });
876
876
  }
877
877
  };
878
- m(ne, "fieldTypeName", "Section"), m(ne, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
879
- let G = ne;
880
- const Ni = "_previewImage_1ig84_1", Bi = {
881
- previewImage: Ni
878
+ m(re, "fieldTypeName", "Section"), m(re, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
879
+ let K = re;
880
+ const Bi = "_previewImage_1ig84_1", qi = {
881
+ previewImage: Bi
882
882
  }, Je = (s) => {
883
883
  const i = ["byte", "kilobyte", "megabyte"];
884
884
  let e = s, t = 0;
885
885
  for (; e > 1024 && t < i.length - 1; )
886
886
  e /= 1024, t++;
887
887
  return new Intl.NumberFormat([], { maximumFractionDigits: 2, style: "unit", unit: i[t] }).format(e);
888
- }, qi = T(function(i) {
889
- var L;
890
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: l, field: c }, f] = W(i), { onChange: d } = l, u = de(n), h = ui(null), { value: p } = l, g = C(() => o || (c.maxFileSize ? `Maximum file size: ${Je(c.maxFileSize)}` : null), [c.maxFileSize, o]), I = z(() => {
891
- var x;
892
- (x = h.current) == null || x.click();
893
- }, []), S = z(
894
- (x) => {
888
+ }, Wi = S(function(i) {
889
+ var P;
890
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: a, field: c }, u] = j(i), { onChange: d } = a, f = de(n), h = fi(null), { value: p } = a, g = C(() => o || (c.maxFileSize ? `Maximum file size: ${Je(c.maxFileSize)}` : null), [c.maxFileSize, o]), x = E(() => {
891
+ var F;
892
+ (F = h.current) == null || F.click();
893
+ }, []), z = E(
894
+ (F) => {
895
895
  const V = [...p];
896
- V.splice(x, 1), d({ target: { files: V } });
896
+ V.splice(F, 1), d({ target: { files: V } });
897
897
  },
898
898
  [p, d]
899
- ), F = p ? "Select new files" : "Select files", w = p ? "Select new file" : "Select a file", A = c.maxFiles > 1 ? F : w;
900
- return /* @__PURE__ */ b(v, { direction: "column", gap: "2", children: [
901
- /* @__PURE__ */ r(q, { helpText: g, severity: n, children: /* @__PURE__ */ b(B, { severity: n, inputId: e, labelId: t, label: a, children: [
902
- /* @__PURE__ */ r(v, { direction: "row", gap: "2", children: /* @__PURE__ */ r(me, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(j, { ...f, onClick: I, children: [
899
+ ), I = p ? "Select new files" : "Select files", w = p ? "Select new file" : "Select a file", L = c.maxFiles > 1 ? I : w;
900
+ return /* @__PURE__ */ y(v, { direction: "column", gap: "2", children: [
901
+ /* @__PURE__ */ r(W, { helpText: g, severity: n, children: /* @__PURE__ */ y(q, { severity: n, inputId: e, labelId: t, label: l, children: [
902
+ /* @__PURE__ */ r(v, { direction: "row", gap: "2", children: /* @__PURE__ */ r(me, { width: "max-content", asChild: !0, children: /* @__PURE__ */ y(H, { ...u, onClick: x, children: [
903
903
  /* @__PURE__ */ r(mt, {}),
904
904
  " ",
905
- A
905
+ L
906
906
  ] }) }) }),
907
907
  /* @__PURE__ */ r(
908
908
  "input",
909
909
  {
910
- ...f,
910
+ ...u,
911
911
  type: "file",
912
912
  ref: h,
913
913
  id: e,
914
- accept: (L = c.extensions) == null ? void 0 : L.join(","),
914
+ accept: (P = c.extensions) == null ? void 0 : P.join(","),
915
915
  multiple: c.maxFiles > 1,
916
- color: u,
916
+ color: f,
917
917
  style: { display: "none" },
918
- ...l,
918
+ ...a,
919
919
  value: ""
920
920
  }
921
921
  )
922
922
  ] }) }),
923
- Array.isArray(p) && p.length > 0 && /* @__PURE__ */ r(v, { direction: "column", gap: "2", children: p.map((x, V) => /* @__PURE__ */ r(
924
- Wi,
923
+ Array.isArray(p) && p.length > 0 && /* @__PURE__ */ r(v, { direction: "column", gap: "2", children: p.map((F, V) => /* @__PURE__ */ r(
924
+ ji,
925
925
  {
926
926
  field: c,
927
- file: x,
928
- onRemove: () => S(V),
929
- disabled: f.disabled
927
+ file: F,
928
+ onRemove: () => z(V),
929
+ disabled: u.disabled
930
930
  },
931
931
  V
932
932
  )) })
933
933
  ] });
934
- }), Wi = T(function({ file: i, field: e, onRemove: t, disabled: n }) {
935
- const [o, a] = le(null), l = C(() => o && e.getError([o]), [e, o]), { url: c, name: f, size: d } = C(() => {
936
- let u = null, h, p;
937
- return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (h = o.name, p = Je(o.size)) : (h = "Downloading...", p = "..."), { url: u, name: h, size: p };
934
+ }), ji = S(function({ file: i, field: e, onRemove: t, disabled: n }) {
935
+ const [o, l] = U(null), a = C(() => o && e.getError([o]), [e, o]), { url: c, name: u, size: d } = C(() => {
936
+ let f = null, h, p;
937
+ return o != null && o.type.startsWith("image/") && (f = URL.createObjectURL(o)), o ? (h = o.name, p = Je(o.size)) : (h = "Downloading...", p = "..."), { url: f, name: h, size: p };
938
938
  }, [o]);
939
939
  return be(() => {
940
- i instanceof Promise ? i.then(a) : a(i);
941
- }, [i]), /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ b(v, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
942
- /* @__PURE__ */ b(v, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
940
+ i instanceof Promise ? i.then(l) : l(i);
941
+ }, [i]), /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ y(v, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
942
+ /* @__PURE__ */ y(v, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
943
943
  /* @__PURE__ */ r(
944
- se,
944
+ le,
945
945
  {
946
946
  severity: "info",
947
947
  variant: "outline",
948
- "aria-label": `Remove ${f}`,
948
+ "aria-label": `Remove ${u}`,
949
949
  disabled: n,
950
950
  onClick: t,
951
951
  children: /* @__PURE__ */ r(ft, {})
952
952
  }
953
953
  ),
954
- /* @__PURE__ */ b(v, { direction: "column", gap: "1", children: [
955
- /* @__PURE__ */ r(D, { children: f }),
956
- /* @__PURE__ */ r(D, { size: "1", children: d }),
957
- l && /* @__PURE__ */ r(D, { size: "1", severity: "danger", children: l })
954
+ /* @__PURE__ */ y(v, { direction: "column", gap: "1", children: [
955
+ /* @__PURE__ */ r(k, { children: u }),
956
+ /* @__PURE__ */ r(k, { size: "1", children: d }),
957
+ a && /* @__PURE__ */ r(k, { size: "1", severity: "danger", children: a })
958
958
  ] })
959
959
  ] }),
960
- c && /* @__PURE__ */ r("img", { className: Bi.previewImage, src: c, alt: f })
960
+ c && /* @__PURE__ */ r("img", { className: qi.previewImage, src: c, alt: u })
961
961
  ] }) });
962
- }), rt = 50 * 1024 * 1024, re = class re extends M {
962
+ }), rt = 50 * 1024 * 1024, oe = class oe extends $ {
963
963
  constructor(e) {
964
- const { extensions: t, maximum_files: n, maximum_size: o, ...a } = e;
965
- super({ ...a, type: "upload" });
964
+ const { extensions: t, maximum_files: n, maximum_size: o, ...l } = e;
965
+ super({ ...l, type: "upload" });
966
966
  m(this, "extensions");
967
967
  m(this, "maxFileSize");
968
968
  m(this, "maxFiles");
@@ -977,7 +977,7 @@ const Ni = "_previewImage_1ig84_1", Bi = {
977
977
  }
978
978
  static getFieldCreationSchema() {
979
979
  return [
980
- new U({
980
+ new G({
981
981
  label: "How many files can be uploaded?",
982
982
  description: "By default, only one file can be uploaded.",
983
983
  required: !1,
@@ -985,7 +985,7 @@ const Ni = "_previewImage_1ig84_1", Bi = {
985
985
  maximum: 10,
986
986
  identifier: "maximum_files"
987
987
  }),
988
- new U({
988
+ new G({
989
989
  label: "What is the maximum size of each file?",
990
990
  description: "Maximum file size in bytes.",
991
991
  required: !1,
@@ -1027,7 +1027,7 @@ const Ni = "_previewImage_1ig84_1", Bi = {
1027
1027
  getFieldValidators() {
1028
1028
  const e = super.getFieldValidators(), t = this.maxFileSize ?? rt, n = this.maxFiles ?? 1;
1029
1029
  return e.push((o) => {
1030
- if (o && o.some((a) => a.size > t))
1030
+ if (o && o.some((l) => l.size > t))
1031
1031
  return `Files must be at most ${Je(t)}.`;
1032
1032
  }), e.push((o) => {
1033
1033
  if (o && o.length > n)
@@ -1045,17 +1045,17 @@ const Ni = "_previewImage_1ig84_1", Bi = {
1045
1045
  static deserialize(e) {
1046
1046
  if (e.type !== "upload")
1047
1047
  throw new Error("Type mismatch.");
1048
- return new re(e);
1048
+ return new oe(e);
1049
1049
  }
1050
1050
  getInput(e) {
1051
- return /* @__PURE__ */ r(qi, { field: this, ...e });
1051
+ return /* @__PURE__ */ r(Wi, { field: this, ...e });
1052
1052
  }
1053
1053
  };
1054
- m(re, "fieldTypeName", "Upload"), m(re, "fieldTypeDescription", "Allows a file to be uploaded."), m(re, "Icon", mt);
1055
- let qe = re;
1054
+ m(oe, "fieldTypeName", "Upload"), m(oe, "fieldTypeDescription", "Allows a file to be uploaded."), m(oe, "Icon", mt);
1055
+ let qe = oe;
1056
1056
  const Ze = {
1057
1057
  date: Re,
1058
- number: U,
1058
+ number: G,
1059
1059
  boolean: ce,
1060
1060
  select: Fe,
1061
1061
  string: he,
@@ -1068,13 +1068,13 @@ const Ze = {
1068
1068
  }, Ft = (s) => {
1069
1069
  const i = s.type;
1070
1070
  return Ze[i].deserialize(s);
1071
- }, De = (s) => s.type === "section" ? G.deserialize(s) : Ft(s);
1071
+ }, ke = (s) => s.type === "section" ? K.deserialize(s) : Ft(s);
1072
1072
  function Tt(s, i = {}) {
1073
1073
  const { readonly: e = !1 } = i;
1074
1074
  return {
1075
1075
  title: s.title,
1076
1076
  description: s.description,
1077
- fields: s.fields.map((t) => De(t)),
1077
+ fields: s.fields.map((t) => ke(t)),
1078
1078
  meta: { readonly: e }
1079
1079
  };
1080
1080
  }
@@ -1101,7 +1101,7 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1101
1101
  }, Ee = (s) => Object.keys(s).length > 0, Et = async (s, i) => {
1102
1102
  const e = {};
1103
1103
  for (const t of s.fields)
1104
- if (t instanceof G) {
1104
+ if (t instanceof K) {
1105
1105
  if (t.condition) {
1106
1106
  const { identifier: n } = t.condition;
1107
1107
  if (!St(t.condition, ae(i, n)))
@@ -1109,128 +1109,128 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1109
1109
  }
1110
1110
  Object.assign(e, t.getErrors(i));
1111
1111
  } else {
1112
- if (!(t instanceof M))
1112
+ if (!(t instanceof $))
1113
1113
  throw new Error("Invalid field type");
1114
1114
  const n = t.getId(), o = t.getError(ae(i, n), i);
1115
1115
  o && Xe(e, n, o);
1116
1116
  }
1117
1117
  if (Ee(e))
1118
1118
  return e;
1119
- }, ji = [null, void 0], et = (s, i) => s.reduce((e, t) => t instanceof G ? { ...e, ...et(t.fields, i) } : (ji.includes(ae(e, t.getId())) && Xe(e, t.getId(), ""), e), i), Hi = () => {
1119
+ }, Hi = [null, void 0], et = (s, i) => s.reduce((e, t) => t instanceof K ? { ...e, ...et(t.fields, i) } : (Hi.includes(ae(e, t.getId())) && Xe(e, t.getId(), ""), e), i), Ui = () => {
1120
1120
  throw new Error("onSubmit must be provided if form is not readonly.");
1121
- }, tt = T(
1121
+ }, tt = S(
1122
1122
  ye((s, i) => {
1123
1123
  const {
1124
1124
  schema: e,
1125
1125
  values: t = {},
1126
- onSubmit: n = Hi,
1126
+ onSubmit: n = Ui,
1127
1127
  submitText: o = "Submit",
1128
- cancelText: a,
1129
- onCancel: l,
1128
+ cancelText: l,
1129
+ onCancel: a,
1130
1130
  onDirty: c,
1131
1131
  // if the title isn't provided, hide it by default
1132
- hideTitle: f = !e.title,
1132
+ hideTitle: u = !e.title,
1133
1133
  hideDescription: d,
1134
- className: u
1134
+ className: f
1135
1135
  } = s, { readonly: h } = e.meta, p = C(() => crypto.randomUUID(), []), g = Ue({
1136
1136
  initialValues: et(e.fields, t),
1137
1137
  onSubmit: n,
1138
- validate: (A) => Et(e, A),
1138
+ validate: (L) => Et(e, L),
1139
1139
  // only validate the entire form on submit
1140
1140
  validateOnBlur: !1,
1141
1141
  validateOnChange: !1
1142
- }), { dirty: I } = g, S = C(
1143
- () => typeof e.title == "string" ? /* @__PURE__ */ r(Pe, { children: e.title }) : e.title,
1142
+ }), { dirty: x } = g, z = C(
1143
+ () => typeof e.title == "string" ? /* @__PURE__ */ r(Le, { children: e.title }) : e.title,
1144
1144
  [e.title]
1145
- ), F = C(
1146
- () => typeof e.description == "string" ? /* @__PURE__ */ r(D, { className: ke.description, children: e.description }) : e.description,
1145
+ ), I = C(
1146
+ () => typeof e.description == "string" ? /* @__PURE__ */ r(k, { className: Ve.description, children: e.description }) : e.description,
1147
1147
  [e.description]
1148
1148
  ), w = zt(e.fields, { formId: p, disabled: h });
1149
1149
  return be(() => {
1150
- I && c && c();
1151
- }, [I, c]), /* @__PURE__ */ r(Ge, { value: g, children: /* @__PURE__ */ r(v, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: p, onSubmit: g.handleSubmit, children: [
1152
- !f && /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ b(v, { direction: "column", gap: "1", children: [
1153
- S,
1154
- !d && F
1150
+ x && c && c();
1151
+ }, [x, c]), /* @__PURE__ */ r(Ge, { value: g, children: /* @__PURE__ */ r(v, { ref: i, direction: "column", gap: "2", className: f, asChild: !0, children: /* @__PURE__ */ y("form", { id: p, onSubmit: g.handleSubmit, children: [
1152
+ !u && /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ y(v, { direction: "column", gap: "1", children: [
1153
+ z,
1154
+ !d && I
1155
1155
  ] }) }),
1156
1156
  w,
1157
- !h && /* @__PURE__ */ b(v, { justify: "end", gap: "2", children: [
1158
- a && /* @__PURE__ */ r(j, { type: "button", variant: "soft", onClick: l, children: a }),
1159
- /* @__PURE__ */ r(j, { type: "submit", disabled: !g.isValid, children: o })
1157
+ !h && /* @__PURE__ */ y(v, { justify: "end", gap: "2", children: [
1158
+ l && /* @__PURE__ */ r(H, { type: "button", variant: "soft", onClick: a, children: l }),
1159
+ /* @__PURE__ */ r(H, { type: "submit", disabled: !g.isValid, children: o })
1160
1160
  ] })
1161
1161
  ] }) }) });
1162
1162
  })
1163
- ), Tn = T(
1163
+ ), Sn = S(
1164
1164
  ye((s, i) => {
1165
- const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = _(pt(e.form_revision)), { sdk: a } = gt();
1165
+ const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = M(pt(e.form_revision)), { sdk: l } = gt();
1166
1166
  if (!o)
1167
1167
  throw new Error(
1168
1168
  `Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
1169
1169
  );
1170
- const l = C(() => Tt(o, { readonly: !0 }), [o]), c = C(() => {
1171
- const f = hi(e.offline_id)(a.store.getState()) ?? [], d = {};
1172
- for (const u of f) {
1173
- const h = a.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((g) => {
1170
+ const a = C(() => Tt(o, { readonly: !0 }), [o]), c = C(() => {
1171
+ const u = pi(e.offline_id)(l.store.getState()) ?? [], d = {};
1172
+ for (const f of u) {
1173
+ const h = l.files.fetchFileFromUrl(f.file, f.file_sha1, f.file_name).then((g) => {
1174
1174
  if (!g.success)
1175
- throw new Error(`Failed to download attachment ${u.file_name}.`);
1175
+ throw new Error(`Failed to download attachment ${f.file_name}.`);
1176
1176
  return g.body;
1177
- }), p = d[u.field_identifier];
1178
- p ? p.push(h) : d[u.field_identifier] = [h];
1177
+ }), p = d[f.field_identifier];
1178
+ p ? p.push(h) : d[f.field_identifier] = [h];
1179
1179
  }
1180
1180
  return { ...e.values, ...d };
1181
- }, [a.files, a.store, e.offline_id, e.values]);
1181
+ }, [l.files, l.store, e.offline_id, e.values]);
1182
1182
  return /* @__PURE__ */ r(
1183
1183
  tt,
1184
1184
  {
1185
1185
  ref: i,
1186
- schema: l,
1186
+ schema: a,
1187
1187
  values: c,
1188
1188
  hideDescription: !t,
1189
1189
  hideTitle: !n
1190
1190
  }
1191
1191
  );
1192
1192
  })
1193
- ), Ui = "_favoriteIcon_1bixi_1", Gi = "_regularIcon_1bixi_9", ot = {
1194
- favoriteIcon: Ui,
1195
- regularIcon: Gi
1196
- }, Me = "organization:", $e = "user:", Sn = T(
1193
+ ), Gi = "_favoriteIcon_1bixi_1", Ki = "_regularIcon_1bixi_9", ot = {
1194
+ favoriteIcon: Gi,
1195
+ regularIcon: Ki
1196
+ }, Me = "organization:", $e = "user:", zn = S(
1197
1197
  ye((s, i) => {
1198
- const { maxResults: e = 20, ...t } = s, [n, o] = le(""), [a, l] = le(""), { sdk: c } = gt(), f = C(() => {
1198
+ const { maxResults: e = 20, ...t } = s, [n, o] = U(""), [l, a] = U(""), { sdk: c } = gt(), u = C(() => {
1199
1199
  const w = { maxResults: e, searchTerm: n };
1200
- return a && (a.startsWith(Me) ? w.owner_organization = parseInt(a.slice(Me.length)) : a.startsWith($e) && (w.owner_user = parseInt(a.slice($e.length)))), w;
1201
- }, [n, e, a]), d = _(pi(f)) ?? [], u = _(gi), h = z(
1200
+ return l && (l.startsWith(Me) ? w.owner_organization = parseInt(l.slice(Me.length)) : l.startsWith($e) && (w.owner_user = parseInt(l.slice($e.length)))), w;
1201
+ }, [n, e, l]), d = M(gi(u)) ?? [], f = M(bi), h = E(
1202
1202
  (w) => {
1203
1203
  w.favorite ? c.userForms.unfavorite(w.offline_id).then() : c.userForms.favorite(w.offline_id).then();
1204
1204
  },
1205
1205
  [c]
1206
1206
  ), p = C(() => {
1207
- const w = c.store.getState(), A = {};
1208
- for (const L of Object.values(u)) {
1209
- const x = bt(L.owner_organization || -1)(w);
1210
- x && (A[`${Me}${x.id}`] = x.name);
1211
- const V = Qe(L.owner_user || -1)(w);
1212
- V && (A[`${$e}${V.id}`] = V.username);
1207
+ const w = c.store.getState(), L = {};
1208
+ for (const P of Object.values(f)) {
1209
+ const F = bt(P.owner_organization || -1)(w);
1210
+ F && (L[`${Me}${F.id}`] = F.name);
1211
+ const V = Qe(P.owner_user || -1)(w);
1212
+ V && (L[`${$e}${V.id}`] = V.username);
1213
1213
  }
1214
- return Object.entries(A).map(([L, x]) => ({ itemContent: x, value: L }));
1215
- }, [u, c.store]), g = z((w) => {
1214
+ return Object.entries(L).map(([P, F]) => ({ itemContent: F, value: P }));
1215
+ }, [f, c.store]), g = E((w) => {
1216
1216
  o(w.currentTarget.value);
1217
- }, []), S = (_(bi) || 0) - d.length, F = d.length == e && S > 0 ? `Only the first ${e} results are shown (${S} hidden)` : S > 0 && `${S} hidden forms`;
1218
- return /* @__PURE__ */ b(v, { ref: i, direction: "column", gap: "2", children: [
1219
- /* @__PURE__ */ b(v, { gap: "2", grow: "1", children: [
1220
- /* @__PURE__ */ r(me, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(oe.Root, { size: "3", children: /* @__PURE__ */ r(oe.Input, { placeholder: "Filter", value: n, onChange: g }) }) }),
1217
+ }, []), z = (M(yi) || 0) - d.length, I = d.length == e && z > 0 ? `Only the first ${e} results are shown (${z} hidden)` : z > 0 && `${z} hidden forms`;
1218
+ return /* @__PURE__ */ y(v, { ref: i, direction: "column", gap: "2", children: [
1219
+ /* @__PURE__ */ y(v, { gap: "2", grow: "1", children: [
1220
+ /* @__PURE__ */ r(me, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(se.Root, { size: "3", children: /* @__PURE__ */ r(se.Input, { placeholder: "Filter", value: n, onChange: g }) }) }),
1221
1221
  /* @__PURE__ */ r(
1222
1222
  ut,
1223
1223
  {
1224
1224
  items: p,
1225
- value: a,
1226
- onValueChange: l,
1225
+ value: l,
1226
+ onValueChange: a,
1227
1227
  placeholder: "Owner",
1228
1228
  size: "large"
1229
1229
  }
1230
1230
  )
1231
1231
  ] }),
1232
- d.length > 0 && /* @__PURE__ */ r(Ve.Root, { children: d.map((w) => /* @__PURE__ */ r(
1233
- Ki,
1232
+ d.length > 0 && /* @__PURE__ */ r(Pe.Root, { children: d.map((w) => /* @__PURE__ */ r(
1233
+ Yi,
1234
1234
  {
1235
1235
  ...t,
1236
1236
  form: w,
@@ -1238,20 +1238,20 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1238
1238
  },
1239
1239
  w.offline_id
1240
1240
  )) }),
1241
- /* @__PURE__ */ r(me, { px: "3", children: /* @__PURE__ */ r(D, { size: "2", severity: "info", children: F }) })
1241
+ /* @__PURE__ */ r(me, { px: "3", children: /* @__PURE__ */ r(k, { size: "2", severity: "info", children: I }) })
1242
1242
  ] });
1243
1243
  })
1244
- ), Ki = (s) => {
1244
+ ), Yi = (s) => {
1245
1245
  var h;
1246
- const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (h = _(bt(i.owner_organization || -1))) == null ? void 0 : h.name, a = _(Qe(i.owner_user || -1)), l = _(yt).id, c = !!a && a.id === l, f = o ?? (c ? "You" : a == null ? void 0 : a.username) ?? "Unknown", d = z(
1246
+ const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (h = M(bt(i.owner_organization || -1))) == null ? void 0 : h.name, l = M(Qe(i.owner_user || -1)), a = M(yt).id, c = !!l && l.id === a, u = o ?? (c ? "You" : l == null ? void 0 : l.username) ?? "Unknown", d = E(
1247
1247
  (p) => {
1248
1248
  p.stopPropagation(), n();
1249
1249
  },
1250
1250
  [n]
1251
- ), u = /* @__PURE__ */ r(Ve.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(v, { justify: "between", gap: "2", py: "2", px: "3", ...Gt, children: [
1252
- /* @__PURE__ */ b(v, { grow: "1", align: "center", gap: "2", children: [
1251
+ ), f = /* @__PURE__ */ r(Pe.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ y(v, { justify: "between", gap: "2", py: "2", px: "3", ...Gt, children: [
1252
+ /* @__PURE__ */ y(v, { grow: "1", align: "center", gap: "2", children: [
1253
1253
  /* @__PURE__ */ r(
1254
- se,
1254
+ le,
1255
1255
  {
1256
1256
  className: vt(i.favorite ? ot.favoriteIcon : ot.regularIcon),
1257
1257
  variant: "ghost",
@@ -1261,80 +1261,80 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1261
1261
  children: i.favorite ? /* @__PURE__ */ r(Kt, {}) : /* @__PURE__ */ r(Yt, {})
1262
1262
  }
1263
1263
  ),
1264
- /* @__PURE__ */ r(D, { noWrap: !0, children: i.latestRevision.title }),
1264
+ /* @__PURE__ */ r(k, { noWrap: !0, children: i.latestRevision.title }),
1265
1265
  i.latestRevision.description && /* @__PURE__ */ r(Qt, {})
1266
1266
  ] }),
1267
- f && /* @__PURE__ */ b(v, { align: "center", gap: "2", children: [
1267
+ u && /* @__PURE__ */ y(v, { align: "center", gap: "2", children: [
1268
1268
  /* @__PURE__ */ r(Xt, {}),
1269
1269
  " ",
1270
- f
1270
+ u
1271
1271
  ] })
1272
1272
  ] }) });
1273
- return i.latestRevision.description ? /* @__PURE__ */ r(Jt, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
1274
- }, Yi = "_submissionsContainer_9iirt_1", Qi = "_stopHorizontalOverflow_9iirt_6", At = {
1275
- submissionsContainer: Yi,
1276
- stopHorizontalOverflow: Qi
1277
- }, Xi = T(function(i) {
1273
+ return i.latestRevision.description ? /* @__PURE__ */ r(Jt, { content: i.latestRevision.description, children: f }, i.offline_id) : f;
1274
+ }, Qi = "_submissionsContainer_9iirt_1", Xi = "_stopHorizontalOverflow_9iirt_6", At = {
1275
+ submissionsContainer: Qi,
1276
+ stopHorizontalOverflow: Xi
1277
+ }, Ji = S(function(i) {
1278
1278
  var w;
1279
- const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: a } = i, l = _(yt), c = _(Qe("created_by" in e ? e.created_by : l.id)), f = je(e), d = yi(f) ? f.toLocaleTimeString([], {
1279
+ const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: l } = i, a = M(yt), c = M(Qe("created_by" in e ? e.created_by : a.id)), u = je(e), d = vi(u) ? u.toLocaleTimeString([], {
1280
1280
  hour: "2-digit",
1281
1281
  minute: "2-digit"
1282
- }) : vi(f), u = _(pt(e.form_revision));
1283
- if (!u)
1282
+ }) : wi(u), f = M(pt(e.form_revision));
1283
+ if (!f)
1284
1284
  throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
1285
- const h = (w = _(wi(u.form))) == null ? void 0 : w.revision, p = xi({
1285
+ const h = (w = M(xi(f.form))) == null ? void 0 : w.revision, p = Ii({
1286
1286
  file: (c == null ? void 0 : c.profile.file) ?? null,
1287
1287
  fileSha1: (c == null ? void 0 : c.profile.file_sha1) ?? null
1288
- }), g = (c == null ? void 0 : c.username.charAt(0).toUpperCase()) ?? "?", I = u.revision === h, S = di.useCallback(() => {
1288
+ }), g = (c == null ? void 0 : c.username.charAt(0).toUpperCase()) ?? "?", x = f.revision === h, z = ui.useCallback(() => {
1289
1289
  t && t({ submission: e });
1290
- }, [e, t]), F = /* @__PURE__ */ r(Ve.Item, { onClick: S, asChild: !0, children: /* @__PURE__ */ b(v, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
1291
- /* @__PURE__ */ b(v, { gap: "2", align: "center", className: At.stopHorizontalOverflow, children: [
1290
+ }, [e, t]), I = /* @__PURE__ */ r(Pe.Item, { onClick: z, asChild: !0, children: /* @__PURE__ */ y(v, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
1291
+ /* @__PURE__ */ y(v, { gap: "2", align: "center", className: At.stopHorizontalOverflow, children: [
1292
1292
  /* @__PURE__ */ r(Zt, { src: p, size: "1", fallback: g }),
1293
- /* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: o === "creator" ? (c || l).username : u.title })
1293
+ /* @__PURE__ */ r(k, { size: "2", noWrap: !0, children: o === "creator" ? (c || a).username : f.title })
1294
1294
  ] }),
1295
- /* @__PURE__ */ b(v, { gap: "2", align: "center", children: [
1296
- !n && (u.revision ? /* @__PURE__ */ r(Oe, { variant: "soft", severity: I ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!h && /* @__PURE__ */ r(Oe, { children: "Original" })),
1297
- /* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: d })
1295
+ /* @__PURE__ */ y(v, { gap: "2", align: "center", children: [
1296
+ !n && (f.revision ? /* @__PURE__ */ r(Oe, { variant: "soft", severity: x ? "primary" : "info", children: n ? f.revision.toString() : `Revision #${f.revision}` }) : !!h && /* @__PURE__ */ r(Oe, { children: "Original" })),
1297
+ /* @__PURE__ */ r(k, { size: "2", noWrap: !0, children: d })
1298
1298
  ] })
1299
1299
  ] }) });
1300
- return a ? a(e, F) : F;
1300
+ return l ? l(e, I) : I;
1301
1301
  }), je = (s) => {
1302
1302
  const i = "created_at" in s ? s.created_at : s.submitted_at;
1303
1303
  return new Date(i);
1304
- }, zn = T(function(i) {
1304
+ }, En = S(function(i) {
1305
1305
  const {
1306
1306
  formId: e,
1307
1307
  submissions: t,
1308
1308
  compact: n = !1,
1309
1309
  className: o,
1310
- after: a,
1311
- variant: l = "outline",
1310
+ after: l,
1311
+ variant: a = "outline",
1312
1312
  ...c
1313
1313
  } = i;
1314
1314
  if (!!e == !!t)
1315
1315
  throw new Error("Either formId or submissions must be provided, but not both.");
1316
- const f = _(
1317
- t ? () => t : Ii(e)
1316
+ const u = M(
1317
+ t ? () => t : Ci(e)
1318
1318
  ), d = C(
1319
- () => f == null ? void 0 : f.sort((u, h) => je(h).getTime() - je(u).getTime()),
1320
- [f]
1319
+ () => u == null ? void 0 : u.sort((f, h) => je(h).getTime() - je(f).getTime()),
1320
+ [u]
1321
1321
  );
1322
1322
  return /* @__PURE__ */ r(
1323
- Ve.Root,
1323
+ Pe.Root,
1324
1324
  {
1325
1325
  className: vt(At.submissionsContainer, o),
1326
1326
  size: "small",
1327
- variant: l,
1328
- before: !n && /* @__PURE__ */ b(D, { severity: "info", children: [
1327
+ variant: a,
1328
+ before: !n && /* @__PURE__ */ y(k, { severity: "info", children: [
1329
1329
  "There are ",
1330
- ((f == null ? void 0 : f.length) || 0).toString(),
1330
+ ((u == null ? void 0 : u.length) || 0).toString(),
1331
1331
  " submissions of this form."
1332
1332
  ] }),
1333
- after: a,
1334
- children: d == null ? void 0 : d.map((u, h) => /* @__PURE__ */ r(
1335
- Xi,
1333
+ after: l,
1334
+ children: d == null ? void 0 : d.map((f, h) => /* @__PURE__ */ r(
1335
+ Ji,
1336
1336
  {
1337
- submission: u,
1337
+ submission: f,
1338
1338
  compact: n,
1339
1339
  ...c
1340
1340
  },
@@ -1342,86 +1342,86 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1342
1342
  ))
1343
1343
  }
1344
1344
  );
1345
- }), En = T(function(i) {
1346
- const { name: e, render: t } = i, { submitForm: n } = ue(), [o, a, l] = He(e);
1345
+ }), An = S(function(i) {
1346
+ const { name: e, render: t } = i, { submitForm: n } = ue(), [o, l, a] = He(e);
1347
1347
  return C(() => {
1348
- const c = (f) => l.setValue(f, !1);
1348
+ const c = (u) => a.setValue(u, !1);
1349
1349
  return t({
1350
1350
  value: o.value,
1351
1351
  setValue: c,
1352
1352
  patchValue: n
1353
1353
  });
1354
- }, [n, l, o.value, t]);
1355
- }), An = T(
1354
+ }, [n, a, o.value, t]);
1355
+ }), Dn = S(
1356
1356
  ye((s, i) => {
1357
- const { children: e, schema: t, values: n, onPatch: o, onError: a, ...l } = s, c = C(() => et(t.fields, n), [t.fields, n]), f = z(
1357
+ const { children: e, schema: t, values: n, onPatch: o, onError: l, ...a } = s, c = C(() => et(t.fields, n), [t.fields, n]), u = E(
1358
1358
  (g) => {
1359
- const I = {};
1360
- for (const S in g) {
1361
- const F = g[S];
1362
- F !== c[S] && F !== void 0 && (I[S] = F);
1359
+ const x = {};
1360
+ for (const z in g) {
1361
+ const I = g[z];
1362
+ I !== c[z] && I !== void 0 && (x[z] = I);
1363
1363
  }
1364
- Ee(I) && o(I);
1364
+ Ee(x) && o(x);
1365
1365
  },
1366
1366
  [c, o]
1367
- ), d = z(
1367
+ ), d = E(
1368
1368
  async (g) => {
1369
- const I = await Et(t, g);
1370
- return I && a(I), I;
1369
+ const x = await Et(t, g);
1370
+ return x && l(x), x;
1371
1371
  },
1372
- [t, a]
1373
- ), u = Ue({
1372
+ [t, l]
1373
+ ), f = Ue({
1374
1374
  initialValues: c,
1375
- onSubmit: f,
1375
+ onSubmit: u,
1376
1376
  validate: d,
1377
1377
  // only validate the entire form on submit
1378
1378
  validateOnBlur: !1,
1379
1379
  validateOnChange: !1
1380
- }), { errors: h, resetForm: p } = u;
1380
+ }), { errors: h, resetForm: p } = f;
1381
1381
  return be(() => {
1382
1382
  Ee(h) && p({ values: c, errors: {} });
1383
- }, [h, c, p]), /* @__PURE__ */ r(Ge, { value: u, children: /* @__PURE__ */ r("form", { ...l, ref: i, onSubmit: u.handleSubmit, children: e }) });
1383
+ }, [h, c, p]), /* @__PURE__ */ r(Ge, { value: f, children: /* @__PURE__ */ r("form", { ...a, ref: i, onSubmit: f.handleSubmit, children: e }) });
1384
1384
  })
1385
- ), Lt = {
1385
+ ), Dt = {
1386
1386
  ...Ze,
1387
- section: G
1388
- }, Ji = T(function(i) {
1389
- const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, a = e.Icon;
1390
- return /* @__PURE__ */ b(v, { gap: "4", align: "center", children: [
1391
- /* @__PURE__ */ r(j, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(v, { gap: "3", align: "center", grow: "1", children: [
1392
- /* @__PURE__ */ r(a, {}),
1387
+ section: K
1388
+ }, Zi = S(function(i) {
1389
+ const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, l = e.Icon;
1390
+ return /* @__PURE__ */ y(v, { gap: "4", align: "center", children: [
1391
+ /* @__PURE__ */ r(H, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ y(v, { gap: "3", align: "center", grow: "1", children: [
1392
+ /* @__PURE__ */ r(l, {}),
1393
1393
  n
1394
1394
  ] }) }),
1395
- /* @__PURE__ */ r(D, { children: o })
1395
+ /* @__PURE__ */ r(k, { children: o })
1396
1396
  ] });
1397
- }), Pt = [
1397
+ }), Lt = [
1398
1398
  ["string", "text"],
1399
1399
  ["select", "multi-select", "upload"],
1400
1400
  ["boolean", "date", "number", "multi-string"]
1401
- ], Zi = Pt.length - 1, en = T(function(i) {
1401
+ ], en = Lt.length - 1, tn = S(function(i) {
1402
1402
  const { setFieldType: e } = i;
1403
- return /* @__PURE__ */ r(v, { direction: "column", gap: "3", children: Pt.map((t, n) => /* @__PURE__ */ b(v, { direction: "column", gap: "3", children: [
1403
+ return /* @__PURE__ */ r(v, { direction: "column", gap: "3", children: Lt.map((t, n) => /* @__PURE__ */ y(v, { direction: "column", gap: "3", children: [
1404
1404
  /* @__PURE__ */ r(v, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
1405
- Ji,
1405
+ Zi,
1406
1406
  {
1407
1407
  field: Ze[o],
1408
1408
  setFieldType: () => e(o)
1409
1409
  },
1410
1410
  o
1411
1411
  )) }),
1412
- n < Zi && /* @__PURE__ */ r(ei, { size: "4" })
1412
+ n < en && /* @__PURE__ */ r(ei, { size: "4" })
1413
1413
  ] }, n)) });
1414
- }), tn = (s) => (i) => {
1414
+ }), nn = (s) => (i) => {
1415
1415
  if (!(!i || typeof i != "string") && s.includes(i.trim()))
1416
1416
  return "This name is already taken.";
1417
- }, nn = (s, i) => {
1417
+ }, rn = (s, i) => {
1418
1418
  const e = [
1419
1419
  new he({
1420
1420
  label: "Label",
1421
1421
  required: !0,
1422
1422
  maxLength: 200,
1423
1423
  identifier: "label",
1424
- fieldValidators: [tn(s)]
1424
+ fieldValidators: [nn(s)]
1425
1425
  }),
1426
1426
  new pe({
1427
1427
  label: "Description",
@@ -1434,92 +1434,112 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1434
1434
  ...e,
1435
1435
  new ce({ label: "Required", description: null, required: !1, identifier: "required" })
1436
1436
  ];
1437
- }, rn = T(function(i) {
1438
- const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: a } = i, l = Lt[e], c = ue(), f = C(() => {
1439
- const d = c.values.fields.flatMap(
1440
- (h) => h.type === "section" ? [...h.fields.map((p) => p.label), h.label] : h.label
1441
- ).filter((h) => h !== (o == null ? void 0 : o.label) && h !== null);
1442
- let u = nn(d, e);
1443
- if (l === G) {
1437
+ }, on = S(function(i) {
1438
+ const { fieldType: e, handleCancel: t, handleCreateField: n, handleDirty: o, defaultField: l, conditionalSourceFields: a } = i, c = Dt[e], u = ue(), d = C(() => {
1439
+ const f = u.values.fields.flatMap(
1440
+ (p) => p.type === "section" ? [...p.fields.map((g) => g.label), p.label] : p.label
1441
+ ).filter((p) => p !== (l == null ? void 0 : l.label) && p !== null);
1442
+ let h = rn(f, e);
1443
+ if (c === K) {
1444
1444
  if (a === void 0)
1445
1445
  throw new Error("Conditional source fields must be provided when changing sections.");
1446
- u = u.concat(l.getFieldCreationSchema(a));
1446
+ h = h.concat(c.getFieldCreationSchema(a));
1447
1447
  } else {
1448
- if (!(l.prototype instanceof M))
1449
- throw new Error(`Field must be an instance of BaseField. Got ${l}.`);
1450
- u = [...u, ...l.getFieldCreationSchema()];
1448
+ if (!(c.prototype instanceof $))
1449
+ throw new Error(`Field must be an instance of BaseField. Got ${c}.`);
1450
+ h = [...h, ...c.getFieldCreationSchema()];
1451
1451
  }
1452
1452
  return {
1453
- fields: u,
1453
+ fields: h,
1454
1454
  meta: { readonly: !1 },
1455
1455
  // using the dialog title as the form title
1456
1456
  title: null
1457
1457
  };
1458
- }, [c.values.fields, e, l, o == null ? void 0 : o.label, a]);
1458
+ }, [u.values.fields, e, c, l == null ? void 0 : l.label, a]);
1459
1459
  return /* @__PURE__ */ r(
1460
1460
  tt,
1461
1461
  {
1462
- schema: f,
1463
- values: o,
1462
+ schema: d,
1463
+ values: l,
1464
1464
  onSubmit: n,
1465
- cancelText: o ? void 0 : "Back",
1466
- onCancel: t
1465
+ cancelText: l ? void 0 : "Back",
1466
+ onCancel: t,
1467
+ onDirty: o
1467
1468
  }
1468
1469
  );
1469
- }), Ae = T(function(i) {
1470
- const { parentPath: e, index: t, children: n, initial: o, editing: a, conditionalSourceFields: l } = i, [c, f] = le(), d = (o == null ? void 0 : o.type) ?? c, u = d ? Lt[d].fieldTypeName : void 0, { setFieldValue: h, values: p } = ue();
1471
- if (a && !o)
1470
+ }), Ae = S(function(i) {
1471
+ const { parentPath: e, index: t, children: n, initial: o, editing: l, conditionalSourceFields: a } = i, [c, u] = U(), [d, f] = U(!1), h = (o == null ? void 0 : o.type) ?? c, p = h ? Dt[h].fieldTypeName : void 0, { setFieldValue: g, values: x } = ue();
1472
+ if (l && !o)
1472
1473
  throw new Error("Initial field must be provided if editing is true.");
1473
- const g = !d && !a && !o, I = g ? "Choose a field type" : `${u} settings`, S = g ? "Select a field type to add to this section." : (u == null ? void 0 : u.toLowerCase()) === "section" ? "Customize your section" : `Customize your ${u == null ? void 0 : u.toLowerCase()} field.`, F = z(() => f(void 0), []), w = z((x) => {
1474
- f(void 0), x();
1475
- }, []), A = z(
1476
- (x, V) => {
1477
- const { label: $ } = x;
1478
- if (!d)
1474
+ const z = ti(), I = !h && !l && !o, w = I ? "Choose a field type" : `${p} settings`, L = I ? "Select a field type to add to this section." : (p == null ? void 0 : p.toLowerCase()) === "section" ? "Customize your section" : `Customize your ${p == null ? void 0 : p.toLowerCase()} field.`, P = E(() => {
1475
+ console.log("handlecancel ran", d), u(void 0), f(!1);
1476
+ }, []), F = E(
1477
+ (_, O) => (T) => {
1478
+ console.log("closeinterrupt ran", _), _ ? z({
1479
+ onDiscard: () => {
1480
+ O(!1), u(void 0), T();
1481
+ }
1482
+ }) : (u(void 0), T());
1483
+ },
1484
+ [z]
1485
+ ), V = E(
1486
+ (_, O) => {
1487
+ const { label: T } = _;
1488
+ if (!h)
1479
1489
  throw new Error("Field type must be selected before creating a field.");
1480
- if (!$ || typeof $ != "string")
1490
+ if (!T || typeof T != "string")
1481
1491
  throw new Error("Label must be provided before creating a field.");
1482
- const H = De({
1483
- type: d,
1484
- ...x,
1485
- identifier: ki(x.identifier, $)
1486
- }).serialize(), R = ae(p, e);
1487
- if (R === void 0)
1492
+ const b = ke({
1493
+ type: h,
1494
+ ..._,
1495
+ identifier: ki(_.identifier, T)
1496
+ }).serialize(), A = ae(x, e);
1497
+ if (A === void 0)
1488
1498
  throw new Error("Parent path must point to an existing field.");
1489
- let E;
1490
- if (!Array.isArray(R))
1499
+ let D;
1500
+ if (!Array.isArray(A))
1491
1501
  throw new Error("Parent path must point to an array.");
1492
- a ? E = Vi(R, t, H) : E = xt(R, t, H), h(e, E).then(), V();
1502
+ l ? D = Vi(A, t, b) : D = xt(A, t, b), g(e, D).then(), f(!1), O();
1493
1503
  },
1494
- [a, d, p, e, h, t]
1495
- ), L = z(
1496
- (x) => g ? /* @__PURE__ */ r(en, { setFieldType: f }) : /* @__PURE__ */ r(
1497
- rn,
1504
+ [l, h, x, e, g, t]
1505
+ ), N = E(
1506
+ (_) => I ? /* @__PURE__ */ r(tn, { setFieldType: u }) : /* @__PURE__ */ r(
1507
+ on,
1498
1508
  {
1499
- conditionalSourceFields: l,
1500
- handleCancel: F,
1501
- handleCreateField: (V) => A(V, x),
1502
- fieldType: d,
1503
- defaultField: o
1509
+ conditionalSourceFields: a,
1510
+ handleCancel: P,
1511
+ handleCreateField: (O) => V(O, _),
1512
+ fieldType: h,
1513
+ defaultField: o,
1514
+ handleDirty: () => f(!0)
1504
1515
  }
1505
1516
  ),
1506
- [l, F, A, o, g, d]
1517
+ [a, P, V, o, I, h]
1518
+ );
1519
+ return /* @__PURE__ */ r(
1520
+ ii,
1521
+ {
1522
+ onCloseInterrupt: F(d, f),
1523
+ title: w,
1524
+ description: L,
1525
+ content: N,
1526
+ children: n
1527
+ }
1507
1528
  );
1508
- return /* @__PURE__ */ r(ti, { onCloseInterrupt: w, title: I, description: S, content: L, children: n });
1509
1529
  }), st = ({ children: s }) => /* @__PURE__ */ r(dt, { children: s }), lt = (s, i) => ({
1510
1530
  initial: s ? i : "none",
1511
1531
  sm: s ? "none" : i
1512
- }), Vt = T(function(i) {
1513
- const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o } = i, a = C(
1532
+ }), Pt = S(function(i) {
1533
+ const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o } = i, l = C(
1514
1534
  () => [
1515
1535
  {
1516
1536
  Wrapper: Ae,
1517
1537
  wrapperProps: n,
1518
- Icon: ii,
1538
+ Icon: ni,
1519
1539
  text: "Edit"
1520
1540
  },
1521
1541
  {
1522
- Icon: ni,
1542
+ Icon: ri,
1523
1543
  buttonProps: {
1524
1544
  onClick: e
1525
1545
  },
@@ -1528,14 +1548,14 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1528
1548
  {
1529
1549
  Wrapper: Ae,
1530
1550
  wrapperProps: o,
1531
- Icon: Le,
1551
+ Icon: De,
1532
1552
  text: "Add after"
1533
1553
  },
1534
1554
  {
1535
1555
  // Wrapping icon in a div so that the asChild turns the button into a div
1536
1556
  // so that the drag handle props are not applied to the icon
1537
1557
  // Note: b/c the <button> does not handle the space-press event correctly
1538
- Icon: (l) => /* @__PURE__ */ r("div", { ...l, children: /* @__PURE__ */ r(ri, {}) }),
1558
+ Icon: (a) => /* @__PURE__ */ r("div", { ...a, children: /* @__PURE__ */ r(oi, {}) }),
1539
1559
  text: "Reorder",
1540
1560
  disableOnMobile: !0,
1541
1561
  buttonProps: { ...t, asChild: !0 }
@@ -1543,35 +1563,35 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1543
1563
  ],
1544
1564
  [t, n, o, e]
1545
1565
  );
1546
- return /* @__PURE__ */ b(dt, { children: [
1547
- /* @__PURE__ */ r(v, { gap: "4", display: lt(!1, "flex"), children: a.map((l) => {
1548
- const c = l.Wrapper ?? st;
1549
- return /* @__PURE__ */ r(c, { ...l.wrapperProps, children: /* @__PURE__ */ r(se, { type: "button", variant: "ghost", "aria-label": l.text, ...l.buttonProps, children: /* @__PURE__ */ r(l.Icon, {}) }) }, l.text);
1566
+ return /* @__PURE__ */ y(dt, { children: [
1567
+ /* @__PURE__ */ r(v, { gap: "4", display: lt(!1, "flex"), children: l.map((a) => {
1568
+ const c = a.Wrapper ?? st;
1569
+ return /* @__PURE__ */ r(c, { ...a.wrapperProps, children: /* @__PURE__ */ r(le, { type: "button", variant: "ghost", "aria-label": a.text, ...a.buttonProps, children: /* @__PURE__ */ r(a.Icon, {}) }) }, a.text);
1550
1570
  }) }),
1551
1571
  /* @__PURE__ */ r(me, { display: lt(!0, "block"), children: /* @__PURE__ */ r(
1552
- oi,
1572
+ si,
1553
1573
  {
1554
- trigger: /* @__PURE__ */ r(se, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(si, {}) }),
1574
+ trigger: /* @__PURE__ */ r(le, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(li, {}) }),
1555
1575
  closeOnSelect: !1,
1556
- items: a.map((l) => {
1557
- var f;
1558
- if (l.disableOnMobile)
1576
+ items: l.map((a) => {
1577
+ var u;
1578
+ if (a.disableOnMobile)
1559
1579
  return null;
1560
- const c = l.Wrapper ?? st;
1580
+ const c = a.Wrapper ?? st;
1561
1581
  return {
1562
- ...l.buttonProps,
1563
- onSelect: (f = l.buttonProps) == null ? void 0 : f.onClick,
1564
- content: /* @__PURE__ */ r(c, { ...l.wrapperProps, children: /* @__PURE__ */ b(v, { gap: "2", align: "center", children: [
1565
- /* @__PURE__ */ r(l.Icon, {}),
1566
- l.text
1582
+ ...a.buttonProps,
1583
+ onSelect: (u = a.buttonProps) == null ? void 0 : u.onClick,
1584
+ content: /* @__PURE__ */ r(c, { ...a.wrapperProps, children: /* @__PURE__ */ y(v, { gap: "2", align: "center", children: [
1585
+ /* @__PURE__ */ r(a.Icon, {}),
1586
+ a.text
1567
1587
  ] }) })
1568
1588
  };
1569
- }).filter((l) => l !== null)
1589
+ }).filter((a) => a !== null)
1570
1590
  }
1571
1591
  ) })
1572
1592
  ] });
1573
- }), _e = "form-builder", on = T(function(i) {
1574
- const { field: e, index: t, sectionIndex: n, remove: o } = i, a = C(() => De(e), [e]), l = ze(a, { formId: _e, disabled: !0 }), c = C(
1593
+ }), _e = "form-builder", sn = S(function(i) {
1594
+ const { field: e, index: t, sectionIndex: n, remove: o } = i, l = C(() => ke(e), [e]), a = ze(l, { formId: _e, disabled: !0 }), c = C(
1575
1595
  () => ({
1576
1596
  index: t,
1577
1597
  parentPath: `fields.${n}.fields`,
@@ -1579,7 +1599,7 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1579
1599
  editing: !0
1580
1600
  }),
1581
1601
  [e, t, n]
1582
- ), f = C(
1602
+ ), u = C(
1583
1603
  () => ({
1584
1604
  parentPath: `fields.${n}.fields`,
1585
1605
  index: t + 1,
@@ -1594,163 +1614,163 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1594
1614
  ...d.draggableProps,
1595
1615
  ...d.dragHandleProps,
1596
1616
  mb: "4",
1597
- children: /* @__PURE__ */ b(v, { gap: "4", justify: "between", align: "center", children: [
1598
- l,
1617
+ children: /* @__PURE__ */ y(v, { gap: "4", justify: "between", align: "center", children: [
1618
+ a,
1599
1619
  /* @__PURE__ */ r(
1600
- Vt,
1620
+ Pt,
1601
1621
  {
1602
1622
  remove: o,
1603
1623
  editProps: c,
1604
- insertAfterProps: f,
1624
+ insertAfterProps: u,
1605
1625
  dragHandleProps: d.dragHandleProps
1606
1626
  }
1607
1627
  )
1608
1628
  ] })
1609
1629
  }
1610
1630
  ) });
1611
- }), sn = T(function(i) {
1612
- var A, L, x, V, $, H, R;
1613
- const { field: e, index: t, dropState: n } = i, o = (A = n[e.identifier]) == null ? void 0 : A.disabled, { setFieldValue: a, values: l } = ue(), c = li(), f = z(
1614
- (E, y) => {
1615
- for (const P of E) {
1616
- const k = y.indexOf(P);
1617
- a(`fields.${k}.condition`, null).then(), a(`fields.${k}.conditional`, !1).then();
1631
+ }), ln = S(function(i) {
1632
+ var L, P, F, V, N, _, O;
1633
+ const { field: e, index: t, dropState: n } = i, o = (L = n[e.identifier]) == null ? void 0 : L.disabled, { setFieldValue: l, values: a } = ue(), c = ai(), u = E(
1634
+ (T, b) => {
1635
+ for (const A of T) {
1636
+ const D = b.indexOf(A);
1637
+ l(`fields.${D}.condition`, null).then(), l(`fields.${D}.conditional`, !1).then();
1618
1638
  }
1619
1639
  },
1620
- [a]
1621
- ), d = z(
1622
- (E) => {
1623
- var k;
1624
- const y = e.fields[E];
1625
- if (!y)
1640
+ [l]
1641
+ ), d = E(
1642
+ (T) => {
1643
+ var D;
1644
+ const b = e.fields[T];
1645
+ if (!b)
1626
1646
  throw new Error("Could not find field to remove.");
1627
- const P = [];
1628
- for (const N of l.fields)
1629
- ((k = N.condition) == null ? void 0 : k.identifier) === y.identifier && P.push(N);
1647
+ const A = [];
1648
+ for (const B of a.fields)
1649
+ ((D = B.condition) == null ? void 0 : D.identifier) === b.identifier && A.push(B);
1630
1650
  return {
1631
- removing: y,
1632
- affectedSections: P,
1633
- action: () => a(`fields.${t}.fields`, Ie(e.fields, E))
1651
+ removing: b,
1652
+ affectedSections: A,
1653
+ action: () => l(`fields.${t}.fields`, Ie(e.fields, T))
1634
1654
  };
1635
1655
  },
1636
- [e.fields, l.fields, a, t]
1637
- ), u = z(
1638
- (E) => {
1639
- const { affectedSections: y, action: P, removing: k } = d(E), N = () => {
1640
- P().then(), f(y, l.fields);
1656
+ [e.fields, a.fields, l, t]
1657
+ ), f = E(
1658
+ (T) => {
1659
+ const { affectedSections: b, action: A, removing: D } = d(T), B = () => {
1660
+ A().then(), u(b, a.fields);
1641
1661
  };
1642
- if (y.length > 0) {
1643
- const fe = y.map((K) => K.label).join(", ");
1662
+ if (b.length > 0) {
1663
+ const fe = b.map((Y) => Y.label).join(", ");
1644
1664
  return c({
1645
1665
  title: "Remove condition?",
1646
- description: `${k.label} is being used as a condition, deleting it will remove the condition from the ${fe} section(s).`,
1666
+ description: `${D.label} is being used as a condition, deleting it will remove the condition from the ${fe} section(s).`,
1647
1667
  severity: "danger",
1648
1668
  actionText: "Remove",
1649
- onAction: N
1669
+ onAction: B
1650
1670
  });
1651
1671
  }
1652
- N();
1672
+ B();
1653
1673
  },
1654
- [d, f, l.fields, c]
1655
- ), h = z(() => {
1656
- const y = e.fields.map((ve, kt) => d(kt)).flatMap((ve) => ve.affectedSections), P = y.length ? "Remove fields and conditions?" : "Remove fields?", k = e.fields.length, N = y.map((ve) => ve.label).join(", "), fe = y.length ? `Deleting this section will remove the ${k} field(s) it contains and will remove the conditions from following sections: ${N}` : `Deleting this section will remove the ${k} field(s) it contains.`, K = Ie(l.fields, t), it = () => a("fields", K);
1657
- if (y.length > 0)
1674
+ [d, u, a.fields, c]
1675
+ ), h = E(() => {
1676
+ const b = e.fields.map((ve, Vt) => d(Vt)).flatMap((ve) => ve.affectedSections), A = b.length ? "Remove fields and conditions?" : "Remove fields?", D = e.fields.length, B = b.map((ve) => ve.label).join(", "), fe = b.length ? `Deleting this section will remove the ${D} field(s) it contains and will remove the conditions from following sections: ${B}` : `Deleting this section will remove the ${D} field(s) it contains.`, Y = Ie(a.fields, t), it = () => l("fields", Y);
1677
+ if (b.length > 0)
1658
1678
  return c({
1659
- title: P,
1679
+ title: A,
1660
1680
  description: fe,
1661
1681
  severity: "danger",
1662
1682
  actionText: "Remove",
1663
1683
  onAction: () => {
1664
1684
  it().then(() => {
1665
- f(y, K);
1685
+ u(b, Y);
1666
1686
  });
1667
1687
  }
1668
1688
  });
1669
1689
  it().then();
1670
1690
  }, [
1671
1691
  e.fields,
1672
- l.fields,
1692
+ a.fields,
1673
1693
  t,
1674
1694
  d,
1675
- a,
1695
+ l,
1676
1696
  c,
1677
- f
1697
+ u
1678
1698
  ]), p = C(
1679
1699
  () => ({
1680
1700
  index: t,
1681
1701
  parentPath: "fields",
1682
1702
  initial: e,
1683
1703
  editing: !0,
1684
- conditionalSourceFields: Be(l.fields, t)
1704
+ conditionalSourceFields: Be(a.fields, t)
1685
1705
  }),
1686
- [e, t, l.fields]
1706
+ [e, t, a.fields]
1687
1707
  ), g = C(
1688
1708
  () => ({
1689
1709
  index: t + 1,
1690
1710
  parentPath: "fields",
1691
1711
  initial: xe(),
1692
- conditionalSourceFields: Be(l.fields, t + 1)
1712
+ conditionalSourceFields: Be(a.fields, t + 1)
1693
1713
  }),
1694
- [t, l.fields]
1695
- ), I = C(
1714
+ [t, a.fields]
1715
+ ), x = C(
1696
1716
  () => ({
1697
1717
  parentPath: `fields.${t}.fields`,
1698
1718
  index: e.fields.length,
1699
1719
  initial: void 0
1700
1720
  }),
1701
1721
  [e.fields.length, t]
1702
- ), S = C(
1722
+ ), z = C(
1703
1723
  () => {
1704
- var E, y;
1705
- return (y = It(l.fields, (E = e.condition) == null ? void 0 : E.identifier)) == null ? void 0 : y.label;
1724
+ var T, b;
1725
+ return (b = It(a.fields, (T = e.condition) == null ? void 0 : T.identifier)) == null ? void 0 : b.label;
1706
1726
  },
1707
- [(L = e.condition) == null ? void 0 : L.identifier, l.fields]
1708
- ), F = Array.isArray((x = e.condition) == null ? void 0 : x.value) ? "contains all of" : "equals";
1727
+ [(P = e.condition) == null ? void 0 : P.identifier, a.fields]
1728
+ ), I = Array.isArray((F = e.condition) == null ? void 0 : F.value) ? "contains all of" : "equals";
1709
1729
  if (We((V = e.condition) == null ? void 0 : V.value))
1710
1730
  throw new Error("File values are not supported for conditions.");
1711
- const w = Array.isArray(($ = e.condition) == null ? void 0 : $.value) ? (H = e.condition) == null ? void 0 : H.value.map((E) => typeof E == "string" ? E : E.label).join(", ") : (R = e.condition) == null ? void 0 : R.value.toString();
1712
- return /* @__PURE__ */ r(Ye, { draggableId: e.identifier, index: t, children: (E) => /* @__PURE__ */ r(
1731
+ const w = Array.isArray((N = e.condition) == null ? void 0 : N.value) ? (_ = e.condition) == null ? void 0 : _.value.map((T) => typeof T == "string" ? T : T.label).join(", ") : (O = e.condition) == null ? void 0 : O.value.toString();
1732
+ return /* @__PURE__ */ r(Ye, { draggableId: e.identifier, index: t, children: (T) => /* @__PURE__ */ r(
1713
1733
  ge,
1714
1734
  {
1715
- ref: E.innerRef,
1716
- ...E.draggableProps,
1717
- ...E.dragHandleProps,
1735
+ ref: T.innerRef,
1736
+ ...T.draggableProps,
1737
+ ...T.dragHandleProps,
1718
1738
  mb: "4",
1719
- children: /* @__PURE__ */ b(v, { gap: "3", justify: "between", align: "center", children: [
1720
- /* @__PURE__ */ b(v, { direction: "column", gap: "2", grow: "1", children: [
1721
- /* @__PURE__ */ b(v, { direction: "column", children: [
1722
- /* @__PURE__ */ r(Pe, { as: "h3", size: "3", children: e.label }),
1723
- /* @__PURE__ */ r(D, { className: ke.description, children: e.description })
1739
+ children: /* @__PURE__ */ y(v, { gap: "3", justify: "between", align: "center", children: [
1740
+ /* @__PURE__ */ y(v, { direction: "column", gap: "2", grow: "1", children: [
1741
+ /* @__PURE__ */ y(v, { direction: "column", children: [
1742
+ /* @__PURE__ */ r(Le, { as: "h3", size: "3", children: e.label }),
1743
+ /* @__PURE__ */ r(k, { className: Ve.description, children: e.description })
1724
1744
  ] }),
1725
- e.condition && /* @__PURE__ */ r(D, { size: "1", children: /* @__PURE__ */ b(ai, { children: [
1745
+ e.condition && /* @__PURE__ */ r(k, { size: "1", children: /* @__PURE__ */ y(ci, { children: [
1726
1746
  "Display only if ",
1727
- /* @__PURE__ */ r(nt, { children: S }),
1747
+ /* @__PURE__ */ r(nt, { children: z }),
1728
1748
  " ",
1729
- F,
1749
+ I,
1730
1750
  " ",
1731
1751
  /* @__PURE__ */ r(nt, { children: w })
1732
1752
  ] }) }),
1733
- /* @__PURE__ */ r(Ke, { droppableId: e.identifier, type: "SECTION", isDropDisabled: o, children: (y) => /* @__PURE__ */ b(
1753
+ /* @__PURE__ */ r(Ke, { droppableId: e.identifier, type: "SECTION", isDropDisabled: o, children: (b) => /* @__PURE__ */ y(
1734
1754
  v,
1735
1755
  {
1736
- ref: y.innerRef,
1737
- ...y.droppableProps,
1756
+ ref: b.innerRef,
1757
+ ...b.droppableProps,
1738
1758
  direction: "column",
1739
1759
  gap: "0",
1740
1760
  children: [
1741
- e.fields.map((P, k) => /* @__PURE__ */ r(
1742
- on,
1761
+ e.fields.map((A, D) => /* @__PURE__ */ r(
1762
+ sn,
1743
1763
  {
1744
- field: P,
1745
- index: k,
1764
+ field: A,
1765
+ index: D,
1746
1766
  sectionIndex: t,
1747
- remove: () => u(k)
1767
+ remove: () => f(D)
1748
1768
  },
1749
- P.identifier
1769
+ A.identifier
1750
1770
  )),
1751
- y.placeholder,
1752
- /* @__PURE__ */ r(Ae, { ...I, children: /* @__PURE__ */ b(j, { type: "button", variant: "outline", children: [
1753
- /* @__PURE__ */ r(Le, {}),
1771
+ b.placeholder,
1772
+ /* @__PURE__ */ r(Ae, { ...x, children: /* @__PURE__ */ y(H, { type: "button", variant: "outline", children: [
1773
+ /* @__PURE__ */ r(De, {}),
1754
1774
  " Add a field"
1755
1775
  ] }) })
1756
1776
  ]
@@ -1758,18 +1778,18 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1758
1778
  ) })
1759
1779
  ] }),
1760
1780
  /* @__PURE__ */ r(
1761
- Vt,
1781
+ Pt,
1762
1782
  {
1763
1783
  remove: h,
1764
1784
  insertAfterProps: g,
1765
- dragHandleProps: E.dragHandleProps,
1785
+ dragHandleProps: T.dragHandleProps,
1766
1786
  editProps: p
1767
1787
  }
1768
1788
  )
1769
1789
  ] })
1770
1790
  }
1771
1791
  ) });
1772
- }), ln = (s, i) => {
1792
+ }), an = (s, i) => {
1773
1793
  var t;
1774
1794
  const e = { ...s };
1775
1795
  switch (i.type) {
@@ -1784,7 +1804,7 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1784
1804
  case "update":
1785
1805
  return i.state;
1786
1806
  }
1787
- }, an = (s, i) => {
1807
+ }, cn = (s, i) => {
1788
1808
  if (i)
1789
1809
  for (let e = 0; e < s.length; e++) {
1790
1810
  const t = s[e];
@@ -1798,16 +1818,16 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1798
1818
  var e, t, n;
1799
1819
  const i = {};
1800
1820
  for (let o = 0; o < s.length; o++) {
1801
- const a = s[o];
1802
- if (!a)
1821
+ const l = s[o];
1822
+ if (!l)
1803
1823
  throw new Error("Field is undefined.");
1804
- const l = o > 0 ? (e = i[s[o - 1].identifier]) == null ? void 0 : e.conditionFields : void 0, c = new Set(l);
1805
- (t = a.condition) != null && t.identifier && c.add(a.condition.identifier), i[a.identifier] = {
1824
+ const a = o > 0 ? (e = i[s[o - 1].identifier]) == null ? void 0 : e.conditionFields : void 0, c = new Set(a);
1825
+ (t = l.condition) != null && t.identifier && c.add(l.condition.identifier), i[l.identifier] = {
1806
1826
  disabled: !1,
1807
1827
  conditionFields: c,
1808
- conditionIndex: an(s, (n = a.condition) == null ? void 0 : n.identifier),
1828
+ conditionIndex: cn(s, (n = l.condition) == null ? void 0 : n.identifier),
1809
1829
  index: o,
1810
- label: a.label
1830
+ label: l.label
1811
1831
  };
1812
1832
  }
1813
1833
  return i;
@@ -1815,50 +1835,50 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1815
1835
  for (const [e, t] of Object.entries(s))
1816
1836
  if (t.identifier === i)
1817
1837
  return [t, e];
1818
- }, cn = T(function() {
1819
- const { values: i, setFieldValue: e } = ue(), [t, n] = fi(ln, i.fields, at), { showInfo: o } = ci();
1838
+ }, dn = S(function() {
1839
+ const { values: i, setFieldValue: e } = ue(), [t, n] = mi(an, i.fields, at), { showInfo: o } = di();
1820
1840
  be(() => {
1821
1841
  n({ type: "update", state: at(i.fields) });
1822
1842
  }, [n, i.fields]);
1823
- const a = z((f) => {
1824
- f.type === "SECTION" && n({ type: "hold", fieldId: f.draggableId });
1825
- }, []), l = z(
1826
- (f) => {
1827
- const { source: d, destination: u, type: h, reason: p, draggableId: g } = f;
1828
- if (n({ type: "release" }), !u || p === "CANCEL")
1843
+ const l = E((u) => {
1844
+ u.type === "SECTION" && n({ type: "hold", fieldId: u.draggableId });
1845
+ }, []), a = E(
1846
+ (u) => {
1847
+ const { source: d, destination: f, type: h, reason: p, draggableId: g } = u;
1848
+ if (n({ type: "release" }), !f || p === "CANCEL")
1829
1849
  return;
1830
1850
  if (h === "ROOT") {
1831
- const A = t[g];
1832
- if (!A)
1851
+ const L = t[g];
1852
+ if (!L)
1833
1853
  throw new Error("Could not find section context.");
1834
- let L = typeof A.conditionIndex < "u" ? (
1854
+ let P = typeof L.conditionIndex < "u" ? (
1835
1855
  // cannot move a section with a condition before the condition's field
1836
- Math.max(A.conditionIndex + 1, u.index)
1837
- ) : u.index;
1838
- for (const x of Object.values(t))
1839
- x.conditionIndex === d.index && (L = Math.min(L, x.index - 1));
1840
- return L != u.index && o({
1856
+ Math.max(L.conditionIndex + 1, f.index)
1857
+ ) : f.index;
1858
+ for (const F of Object.values(t))
1859
+ F.conditionIndex === d.index && (P = Math.min(P, F.index - 1));
1860
+ return P != f.index && o({
1841
1861
  title: "Reordered sections",
1842
1862
  description: "Sections with conditions must be below the fields they reference."
1843
- }), e("fields", Ne(i.fields, d.index, L));
1863
+ }), e("fields", Ne(i.fields, d.index, P));
1844
1864
  }
1845
1865
  if (h !== "SECTION")
1846
1866
  throw new Error("Unexpected droppable type.");
1847
- const [I, S] = ct(i.fields, d.droppableId) ?? [], [F, w] = ct(i.fields, u.droppableId) ?? [];
1848
- if (!(I != null && I.fields) || !F)
1867
+ const [x, z] = ct(i.fields, d.droppableId) ?? [], [I, w] = ct(i.fields, f.droppableId) ?? [];
1868
+ if (!(x != null && x.fields) || !I)
1849
1869
  throw new Error("Could not find section with fields.");
1850
- if (I.identifier === F.identifier)
1870
+ if (x.identifier === I.identifier)
1851
1871
  e(
1852
- `fields.${S}.fields`,
1853
- Ne(I.fields, d.index, u.index)
1872
+ `fields.${z}.fields`,
1873
+ Ne(x.fields, d.index, f.index)
1854
1874
  ).then();
1855
1875
  else {
1856
- const A = I.fields[d.index];
1857
- if (!A)
1876
+ const L = x.fields[d.index];
1877
+ if (!L)
1858
1878
  throw new Error("Could not find field to reorder.");
1859
- e(`fields.${S}.fields`, Ie(I.fields, d.index)).then(), e(
1879
+ e(`fields.${z}.fields`, Ie(x.fields, d.index)).then(), e(
1860
1880
  `fields.${w}.fields`,
1861
- xt(F.fields, u.index, A)
1881
+ xt(I.fields, f.index, L)
1862
1882
  ).then();
1863
1883
  }
1864
1884
  },
@@ -1872,74 +1892,74 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1872
1892
  }),
1873
1893
  [i.fields]
1874
1894
  );
1875
- return /* @__PURE__ */ r(ht, { onDragStart: a, onDragEnd: l, children: /* @__PURE__ */ r(Ke, { droppableId: "droppable", type: "ROOT", children: (f) => /* @__PURE__ */ b(
1895
+ return /* @__PURE__ */ r(ht, { onDragStart: l, onDragEnd: a, children: /* @__PURE__ */ r(Ke, { droppableId: "droppable", type: "ROOT", children: (u) => /* @__PURE__ */ y(
1876
1896
  v,
1877
1897
  {
1878
- ref: f.innerRef,
1879
- ...f.droppableProps,
1898
+ ref: u.innerRef,
1899
+ ...u.droppableProps,
1880
1900
  direction: "column",
1881
1901
  gap: "0",
1882
1902
  children: [
1883
- i.fields.map((d, u) => /* @__PURE__ */ r(
1884
- sn,
1903
+ i.fields.map((d, f) => /* @__PURE__ */ r(
1904
+ ln,
1885
1905
  {
1886
1906
  field: d,
1887
- index: u,
1907
+ index: f,
1888
1908
  dropState: t
1889
1909
  },
1890
1910
  d.label
1891
1911
  )),
1892
- f.placeholder,
1893
- /* @__PURE__ */ r(Ae, { ...c, children: /* @__PURE__ */ b(j, { type: "button", variant: "outline", children: [
1894
- /* @__PURE__ */ r(Le, {}),
1912
+ u.placeholder,
1913
+ /* @__PURE__ */ r(Ae, { ...c, children: /* @__PURE__ */ y(H, { type: "button", variant: "outline", children: [
1914
+ /* @__PURE__ */ r(De, {}),
1895
1915
  " Add a section"
1896
1916
  ] }) })
1897
1917
  ]
1898
1918
  }
1899
1919
  ) }) });
1900
- }), dn = {
1920
+ }), un = {
1901
1921
  title: "",
1902
1922
  description: "",
1903
1923
  fields: []
1904
- }, un = new he({
1924
+ }, fn = new he({
1905
1925
  label: "Title",
1906
1926
  minLength: 0,
1907
1927
  maxLength: 100,
1908
1928
  required: !0,
1909
1929
  identifier: "title"
1910
- }), fn = { formId: _e, placeholder: "Give your form a title." }, mn = new pe({
1930
+ }), mn = { formId: _e, placeholder: "Give your form a title." }, hn = new pe({
1911
1931
  label: "Description",
1912
1932
  minLength: 0,
1913
1933
  maxLength: 1e3,
1914
1934
  required: !1,
1915
1935
  identifier: "description"
1916
- }), hn = { formId: _e, placeholder: "Explain the purpose of this form." }, pn = () => {
1936
+ }), pn = { formId: _e, placeholder: "Explain the purpose of this form." }, gn = () => {
1917
1937
  alert("This is a form preview, your data will not be saved.");
1918
- }, Ln = T(
1938
+ }, Ln = S(
1919
1939
  ye((s, i) => {
1920
- const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: a = o } = s, l = z((p) => {
1940
+ const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: l = o } = s, a = E((p) => {
1921
1941
  const g = {};
1922
1942
  if (p.title || (g.title = "Title is required."), (!p.fields || p.fields.length === 0) && (g.fields = "At least one field is required."), Ee(g))
1923
1943
  return g;
1924
1944
  }, []), c = Ue({
1925
- initialValues: Pi(n) ?? dn,
1926
- validate: l,
1945
+ initialValues: Pi(n) ?? un,
1946
+ validate: a,
1927
1947
  onSubmit: (p) => t(p),
1928
1948
  // only validate the entire for on submit
1929
1949
  validateOnChange: !1,
1930
1950
  validateOnBlur: !1
1931
- }), f = C(() => Tt(c.values), [c.values]), d = ze(un, fn), u = ze(mn, hn), h = C(
1932
- () => typeof a == "object" ? a : /* @__PURE__ */ r(Pe, { children: a }),
1933
- [a]
1951
+ }), u = C(() => Tt(c.values), [c.values]), d = ze(fn, mn), f = ze(hn, pn), h = C(
1952
+ () => typeof l == "object" ? l : /* @__PURE__ */ r(Le, { children: l }),
1953
+ [l]
1934
1954
  );
1935
- return /* @__PURE__ */ r(Y.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ b(v, { direction: "column", gap: "2", children: [
1936
- /* @__PURE__ */ b(Y.List, { children: [
1937
- /* @__PURE__ */ r(Y.Trigger, { value: "edit", children: "Edit" }),
1938
- /* @__PURE__ */ r(Y.Trigger, { value: "preview", children: "Preview" })
1955
+ return /* @__PURE__ */ r(Q.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ y(v, { direction: "column", gap: "2", children: [
1956
+ /* @__PURE__ */ y(Q.List, { children: [
1957
+ /* @__PURE__ */ r(Q.Trigger, { value: "edit", children: "Edit" }),
1958
+ /* @__PURE__ */ r(Q.Trigger, { value: "preview", children: "Preview" })
1939
1959
  ] }),
1940
- /* @__PURE__ */ b(Y.Content, { value: "edit", children: [
1960
+ /* @__PURE__ */ y(Q.Content, { value: "edit", children: [
1941
1961
  h,
1942
- /* @__PURE__ */ b(D, { children: [
1962
+ /* @__PURE__ */ y(k, { children: [
1943
1963
  "Add a new form field by clicking a + button. Specify options for each field, then drag and drop to rearrange them. You can see what a submitted form might look like in the",
1944
1964
  " ",
1945
1965
  /* @__PURE__ */ r("em", { children: "Preview" }),
@@ -1947,49 +1967,49 @@ const ze = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), zt = (s,
1947
1967
  " ",
1948
1968
  /* @__PURE__ */ r("strong", { children: "field values entered on this page will not be saved." })
1949
1969
  ] }),
1950
- /* @__PURE__ */ r(v, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ b("form", { id: _e, onSubmit: c.handleSubmit, children: [
1951
- /* @__PURE__ */ b(Ge, { value: c, children: [
1970
+ /* @__PURE__ */ r(v, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ y("form", { id: _e, onSubmit: c.handleSubmit, children: [
1971
+ /* @__PURE__ */ y(Ge, { value: c, children: [
1952
1972
  d,
1953
- u,
1954
- /* @__PURE__ */ r(cn, {}),
1955
- /* @__PURE__ */ r(D, { severity: "danger", size: "1", children: typeof c.errors.fields == "string" && c.errors.fields })
1973
+ f,
1974
+ /* @__PURE__ */ r(dn, {}),
1975
+ /* @__PURE__ */ r(k, { severity: "danger", size: "1", children: typeof c.errors.fields == "string" && c.errors.fields })
1956
1976
  ] }),
1957
- /* @__PURE__ */ b(v, { justify: "end", gap: "2", children: [
1958
- /* @__PURE__ */ r(j, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
1959
- /* @__PURE__ */ r(j, { type: "submit", disabled: !c.isValid, children: "Save" })
1977
+ /* @__PURE__ */ y(v, { justify: "end", gap: "2", children: [
1978
+ /* @__PURE__ */ r(H, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
1979
+ /* @__PURE__ */ r(H, { type: "submit", disabled: !c.isValid, children: "Save" })
1960
1980
  ] })
1961
1981
  ] }) })
1962
1982
  ] }),
1963
- /* @__PURE__ */ r(Y.Content, { value: "preview", children: /* @__PURE__ */ r(tt, { schema: f, onSubmit: pn }) })
1983
+ /* @__PURE__ */ r(Q.Content, { value: "preview", children: /* @__PURE__ */ r(tt, { schema: u, onSubmit: gn }) })
1964
1984
  ] }) });
1965
1985
  })
1966
1986
  );
1967
1987
  export {
1968
1988
  ce as BooleanField,
1969
- Ti as BooleanInput,
1989
+ Si as BooleanInput,
1970
1990
  Re as DateField,
1971
- zi as DateInput,
1972
- G as FieldSection,
1973
- Sn as FormBrowser,
1991
+ Ei as DateInput,
1992
+ K as FieldSection,
1993
+ zn as FormBrowser,
1974
1994
  Ln as FormBuilder,
1975
1995
  tt as FormRenderer,
1976
- zn as FormSubmissionBrowser,
1977
- Tn as FormSubmissionViewer,
1996
+ En as FormSubmissionBrowser,
1997
+ Sn as FormSubmissionViewer,
1978
1998
  Te as MultiSelectField,
1979
- Mi as MultiSelectInput,
1999
+ $i as MultiSelectInput,
1980
2000
  Ce as MultiStringField,
1981
- Di as MultiStringInput,
1982
- U as NumberField,
1983
- Si as NumberInput,
1984
- En as PatchField,
1985
- An as PatchFormProvider,
2001
+ _i as MultiStringInput,
2002
+ G as NumberField,
2003
+ zi as NumberInput,
2004
+ An as PatchField,
2005
+ Dn as PatchFormProvider,
1986
2006
  Fe as SelectField,
1987
2007
  Li as SelectInput,
1988
2008
  he as StringField,
1989
- Ei as StringInput,
2009
+ Ai as StringInput,
1990
2010
  pe as TextField,
1991
- Ai as TextInput,
1992
- De as deserialize,
2011
+ Di as TextInput,
2012
+ ke as deserialize,
1993
2013
  Ft as deserializeField,
1994
2014
  Tt as formRevisionToSchema,
1995
2015
  St as isConditionMet,