@overmap-ai/forms 1.0.4-conditional-arrows-2.0 → 1.0.4-conditional-arrows-2.1

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,16 +1,16 @@
1
- var qt = Object.defineProperty;
2
- var Wt = (s, i, e) => i in s ? qt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
- var p = (s, i, e) => (Wt(s, typeof i != "symbol" ? i + "" : i, e), e);
4
- import { jsx as r, jsxs as b, Fragment as ht } from "react/jsx-runtime";
5
- import { Flex as y, Text as $, useSeverityColor as pe, Checkbox as jt, CheckCircledIcon as Ht, TextField as ce, FontFamilyIcon as Ut, CalendarIcon as Gt, InputIcon as Kt, TextArea as Yt, RowsIcon as Xt, Select as gt, Box as be, IconButton as de, PlusIcon as $e, Badge as We, Cross1Icon as bt, ListBulletIcon as Qt, DropdownMenuIcon as Jt, MultiSelect as Zt, CheckboxIcon as ei, Card as ve, Heading as De, Button as K, UploadIcon as yt, ButtonList as _e, divButtonProps as ti, StarFilledIcon as ii, StarIcon as ni, QuestionMarkCircledIcon as ri, PersonIcon as oi, Tooltip as si, Avatar as li, Separator as ai, Dialog as ci, Pencil1Icon as di, TrashIcon as ui, CopyIcon as fi, DragHandleDots2Icon as mi, DropdownMenu as pi, DotsVerticalIcon as hi, useAlertDialog as gi, Em as bi, Strong as at, useToast as yi, Tabs as Z } from "@overmap-ai/blocks";
6
- import { useField as Xe, useFormikContext as he, useFormik as Qe, FormikProvider as Je } from "formik";
7
- import wi, { useMemo as C, memo as z, useCallback as T, useState as X, useEffect as ue, useRef as wt, forwardRef as xe, useReducer as vi } from "react";
8
- import { DragDropContext as vt, Droppable as Ze, Draggable as et } from "@hello-pangea/dnd";
9
- import { slugify as xi, useAppSelector as N, selectFormRevision as xt, useSDK as It, selectSubmissionAttachments as Ii, selectFilteredUserForms as Fi, selectUserFormMapping as Ci, selectOrganization as Ft, selectUser as tt, selectNumberOfUserForms as Ti, selectCurrentUser as Ct, classNames as Tt, isToday as Si, getLocalDateString as zi, selectLatestFormRevision as Ei, useFileSrc as Ai, selectSubmissionsForForm as Pi } from "@overmap-ai/core";
1
+ var Wt = Object.defineProperty;
2
+ var jt = (s, i, e) => i in s ? Wt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
+ var p = (s, i, e) => (jt(s, typeof i != "symbol" ? i + "" : i, e), e);
4
+ import { jsx as r, jsxs as b, Fragment as Xe } from "react/jsx-runtime";
5
+ import { Flex as w, Text as V, useSeverityColor as pe, Checkbox as Ht, CheckCircledIcon as Ut, TextField as ce, FontFamilyIcon as Gt, CalendarIcon as Kt, InputIcon as Yt, TextArea as Xt, RowsIcon as Qt, Select as bt, Box as be, IconButton as de, PlusIcon as Ve, Badge as We, Cross1Icon as yt, ListBulletIcon as Jt, DropdownMenuIcon as Zt, MultiSelect as ei, CheckboxIcon as ti, Card as ve, Heading as De, Button as K, UploadIcon as wt, ButtonList as _e, divButtonProps as ii, StarFilledIcon as ni, StarIcon as ri, QuestionMarkCircledIcon as oi, PersonIcon as si, Tooltip as li, Avatar as ai, Separator as ci, Dialog as di, Pencil1Icon as ui, TrashIcon as fi, CopyIcon as mi, DragHandleDots2Icon as pi, DropdownMenu as hi, DotsVerticalIcon as gi, useAlertDialog as bi, Em as yi, Strong as ct, useToast as wi, Tabs as Z } from "@overmap-ai/blocks";
6
+ import { useField as Qe, useFormikContext as he, useFormik as Je, FormikProvider as Ze } from "formik";
7
+ import vi, { useMemo as C, memo as z, useCallback as T, useState as X, useEffect as ue, useRef as vt, forwardRef as xe, useReducer as xi, Fragment as Ii } from "react";
8
+ import { DragDropContext as xt, Droppable as et, Draggable as tt } from "@hello-pangea/dnd";
9
+ import { slugify as Fi, useAppSelector as N, selectFormRevision as It, useSDK as Ft, selectSubmissionAttachments as Ci, selectFilteredUserForms as Ti, selectUserFormMapping as Si, selectOrganization as Ct, selectUser as it, selectNumberOfUserForms as zi, selectCurrentUser as Tt, classNames as St, isToday as Ei, getLocalDateString as Ai, selectLatestFormRevision as Pi, useFileSrc as Li, selectSubmissionsForForm as ki } from "@overmap-ai/core";
10
10
  import fe from "lodash.get";
11
- import it from "lodash.set";
12
- import Li from "react-xarrows";
13
- class St {
11
+ import nt from "lodash.set";
12
+ import dt from "react-xarrows";
13
+ class zt {
14
14
  constructor(i) {
15
15
  p(this, "type");
16
16
  p(this, "identifier");
@@ -34,7 +34,7 @@ class St {
34
34
  };
35
35
  }
36
36
  }
37
- class R extends St {
37
+ class R extends zt {
38
38
  constructor(e) {
39
39
  const { label: t, required: n, fieldValidators: o = [], formValidators: a = [], ...c } = e;
40
40
  super(c);
@@ -91,29 +91,29 @@ class R extends St {
91
91
  }
92
92
  }
93
93
  p(R, "fieldTypeName"), p(R, "fieldTypeDescription");
94
- const ki = "_description_17zed_1", Me = {
95
- description: ki
94
+ const $i = "_description_17zed_1", Me = {
95
+ description: $i
96
96
  }, H = (s) => {
97
97
  const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: a } = s;
98
- return /* @__PURE__ */ r(y, { direction: "column", gap: "1", asChild: !0, ...a, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
99
- /* @__PURE__ */ r($, { severity: t, id: o, children: i }),
98
+ return /* @__PURE__ */ r(w, { direction: "column", gap: "1", asChild: !0, ...a, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
99
+ /* @__PURE__ */ r(V, { severity: t, id: o, children: i }),
100
100
  e
101
101
  ] }) });
102
102
  }, U = (s) => {
103
103
  const { helpText: i, children: e, severity: t } = s;
104
- return /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
104
+ return /* @__PURE__ */ b(w, { direction: "column", gap: "1", children: [
105
105
  e,
106
- /* @__PURE__ */ r(y, { direction: "column", children: /* @__PURE__ */ r($, { size: "1", severity: t, className: Me.description, children: i }) })
106
+ /* @__PURE__ */ r(w, { direction: "column", children: /* @__PURE__ */ r(V, { size: "1", severity: t, className: Me.description, children: i }) })
107
107
  ] });
108
108
  }, G = (s) => {
109
- const { id: i, field: e, formId: t, ...n } = s, [o, a, c] = Xe(e.getId()), { touched: l } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, h = `${u}-label`, g = e.required ? `${e.label} *` : e.label, m = C(() => ({
109
+ const { id: i, field: e, formId: t, ...n } = s, [o, a, c] = Qe(e.getId()), { touched: l } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, h = `${u}-label`, g = e.required ? `${e.label} *` : e.label, m = C(() => ({
110
110
  ...o,
111
- onChange: (v) => {
112
- const I = e.getValueFromChangeEvent(v);
111
+ onChange: (y) => {
112
+ const I = e.getValueFromChangeEvent(y);
113
113
  c.setValue(I, !1).then(), (l || !e.onlyValidateAfterTouched) && c.setError(e.getError(I));
114
114
  },
115
- onBlur: (v) => {
116
- c.setTouched(!0, !1).then(), c.setError(e.getError(e.getValueFromChangeEvent(v)));
115
+ onBlur: (y) => {
116
+ c.setTouched(!0, !1).then(), c.setError(e.getError(e.getValueFromChangeEvent(y)));
117
117
  }
118
118
  }), [e, o, c, l]);
119
119
  return [
@@ -129,7 +129,7 @@ const ki = "_description_17zed_1", Me = {
129
129
  },
130
130
  { ...n, "aria-labelledby": h }
131
131
  ];
132
- }, Vi = [!0, "true"], $i = z(function(i) {
132
+ }, Vi = [!0, "true"], Di = z(function(i) {
133
133
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = G(i), f = pe(n), d = Vi.includes(c.value);
134
134
  return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(
135
135
  H,
@@ -140,7 +140,7 @@ const ki = "_description_17zed_1", Me = {
140
140
  label: a,
141
141
  flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
142
142
  children: /* @__PURE__ */ r(
143
- jt,
143
+ Ht,
144
144
  {
145
145
  ...l,
146
146
  ...c,
@@ -176,12 +176,12 @@ const ki = "_description_17zed_1", Me = {
176
176
  return new ee(e);
177
177
  }
178
178
  getInput(e) {
179
- return /* @__PURE__ */ r($i, { ...e, field: this });
179
+ return /* @__PURE__ */ r(Di, { ...e, field: this });
180
180
  }
181
181
  };
182
- p(ee, "fieldTypeName", "Checkbox"), p(ee, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), p(ee, "Icon", Ht);
182
+ p(ee, "fieldTypeName", "Checkbox"), p(ee, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), p(ee, "Icon", Ut);
183
183
  let me = ee;
184
- const Di = z(function(i) {
184
+ const _i = z(function(i) {
185
185
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), d = pe(n);
186
186
  return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
187
187
  ce.Input,
@@ -267,12 +267,12 @@ const Di = z(function(i) {
267
267
  return new j(e);
268
268
  }
269
269
  getInput(e) {
270
- return /* @__PURE__ */ r(Di, { field: this, ...e });
270
+ return /* @__PURE__ */ r(_i, { field: this, ...e });
271
271
  }
272
272
  };
273
- p(j, "fieldTypeName", "Number"), p(j, "fieldTypeDescription", "Allows specifying a number within a given range."), p(j, "Icon", Ut), p(j, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), p(j, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
273
+ p(j, "fieldTypeName", "Number"), p(j, "fieldTypeDescription", "Allows specifying a number within a given range."), p(j, "Icon", Gt), p(j, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), p(j, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
274
274
  let Q = j;
275
- const _i = z(function(i) {
275
+ const Mi = z(function(i) {
276
276
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = G(i), f = pe(n), d = c.value ? c.value.split("T")[0] : "";
277
277
  return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(ce.Input, { ...l, ...c, type: "date", id: e, color: f, value: d }) }) });
278
278
  }), te = class te extends R {
@@ -292,10 +292,10 @@ const _i = z(function(i) {
292
292
  return new te(e);
293
293
  }
294
294
  getInput(e) {
295
- return /* @__PURE__ */ r(_i, { field: this, ...e });
295
+ return /* @__PURE__ */ r(Mi, { field: this, ...e });
296
296
  }
297
297
  };
298
- p(te, "fieldTypeName", "Date"), p(te, "fieldTypeDescription", "Allows specifying a date."), p(te, "Icon", Gt);
298
+ p(te, "fieldTypeName", "Date"), p(te, "fieldTypeDescription", "Allows specifying a date."), p(te, "Icon", Kt);
299
299
  let je = te;
300
300
  class Te extends R {
301
301
  constructor(e) {
@@ -366,7 +366,7 @@ p(Te, "_validateMax", (e, t) => {
366
366
  const { minimum_length: n } = t;
367
367
  return typeof n != "number" ? null : n > e ? "Maximum cannot be less than minimum." : null;
368
368
  });
369
- const Mi = z(function(i) {
369
+ const Oi = z(function(i) {
370
370
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), d = pe(n);
371
371
  return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(ce.Input, { ...f, ...c, type: l.inputType, id: e, color: d }) }) });
372
372
  }), ie = class ie extends Te {
@@ -386,14 +386,14 @@ const Mi = z(function(i) {
386
386
  return new ie({ ...a, maxLength: t, minLength: n, inputType: o });
387
387
  }
388
388
  getInput(e) {
389
- return /* @__PURE__ */ r(Mi, { field: this, ...e });
389
+ return /* @__PURE__ */ r(Oi, { field: this, ...e });
390
390
  }
391
391
  };
392
- p(ie, "fieldTypeName", "Short Text"), p(ie, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), p(ie, "Icon", Kt);
392
+ p(ie, "fieldTypeName", "Short Text"), p(ie, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), p(ie, "Icon", Yt);
393
393
  let ye = ie;
394
- const Oi = z(function(i) {
394
+ const Ni = z(function(i) {
395
395
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = G(i);
396
- return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(Yt, { ...l, ...c, resize: "vertical", id: e, severity: n }) }) });
396
+ return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(Xt, { ...l, ...c, resize: "vertical", id: e, severity: n }) }) });
397
397
  }), ne = class ne extends Te {
398
398
  constructor(i) {
399
399
  const e = i.maxLength ? Math.min(5e3, i.maxLength) : 5e3, t = i.minLength ? Math.min(i.minLength, e) : void 0;
@@ -409,12 +409,12 @@ const Oi = z(function(i) {
409
409
  return new ne({ ...n, maxLength: e, minLength: t });
410
410
  }
411
411
  getInput(i) {
412
- return /* @__PURE__ */ r(Oi, { field: this, ...i });
412
+ return /* @__PURE__ */ r(Ni, { field: this, ...i });
413
413
  }
414
414
  };
415
- p(ne, "fieldTypeName", "Paragraph"), p(ne, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), p(ne, "Icon", Xt);
415
+ p(ne, "fieldTypeName", "Paragraph"), p(ne, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), p(ne, "Icon", Qt);
416
416
  let we = ne;
417
- const Ni = z(function(i) {
417
+ const Ri = z(function(i) {
418
418
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), { onChange: d, onBlur: u } = c, h = C(
419
419
  () => l.options.map((m) => ({ value: m.value, itemContent: m.label })),
420
420
  [l.options]
@@ -425,7 +425,7 @@ const Ni = z(function(i) {
425
425
  [d, u]
426
426
  );
427
427
  return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
428
- gt,
428
+ bt,
429
429
  {
430
430
  items: h,
431
431
  ...c,
@@ -443,7 +443,7 @@ const Ni = z(function(i) {
443
443
  label: null,
444
444
  condition: null,
445
445
  conditional: !1
446
- }), Ri = (s) => {
446
+ }), Bi = (s) => {
447
447
  if (!s)
448
448
  return;
449
449
  const i = s.fields;
@@ -459,11 +459,11 @@ function He(s, i, e) {
459
459
  throw new Error("Could not find field to reorder.");
460
460
  return t.splice(e, 0, n), t;
461
461
  }
462
- function Bi(s, i, e) {
462
+ function qi(s, i, e) {
463
463
  const t = Array.from(s);
464
464
  return t[i] = e, t;
465
465
  }
466
- function zt(s, i, e) {
466
+ function Et(s, i, e) {
467
467
  const t = Array.from(s ?? []);
468
468
  return t.splice(i, 0, e), t;
469
469
  }
@@ -471,31 +471,31 @@ function ze(s, i) {
471
471
  const e = Array.from(s);
472
472
  return e.splice(i, 1), e;
473
473
  }
474
- const Et = (s, i) => {
474
+ const At = (s, i) => {
475
475
  if (typeof s == "string" && s.length > 0)
476
476
  return s;
477
477
  const e = /* @__PURE__ */ new Date();
478
- return `${xi(i)}-${e.getTime()}`;
479
- }, At = (s, i) => {
478
+ return `${Fi(i)}-${e.getTime()}`;
479
+ }, Pt = (s, i) => {
480
480
  if (!i)
481
481
  return null;
482
482
  for (const e of s)
483
483
  if (e.type === "section") {
484
- const t = At(e.fields, i);
484
+ const t = Pt(e.fields, i);
485
485
  if (t)
486
486
  return t;
487
487
  } else if (e.identifier === i)
488
488
  return e;
489
489
  return null;
490
- }, Ce = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Pt = (s) => s.flatMap(
490
+ }, Ce = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Lt = (s) => s.flatMap(
491
491
  (i) => i.type === "section" ? [...i.fields.map((e) => e.label), i.label] : i.label
492
492
  ).filter((i) => i !== null), Ue = (s, i) => {
493
493
  let e = 1, t = `${s} (${e})`;
494
494
  for (; i.includes(t); )
495
495
  t = `${s} (${++e})`;
496
496
  return t;
497
- }, qi = z(function(i) {
498
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = G(i), f = pe(n), d = C(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: h } = c, g = `${e}-droppable`, { disabled: m } = l, [w, x] = X(""), [v, I] = X(""), k = v || o, P = v ? "red" : f, F = T(
497
+ }, Wi = z(function(i) {
498
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c }, l] = G(i), f = pe(n), d = C(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: h } = c, g = `${e}-droppable`, { disabled: m } = l, [v, x] = X(""), [y, I] = X(""), k = y || o, P = y ? "red" : f, F = T(
499
499
  (A) => {
500
500
  u(A), h(A);
501
501
  },
@@ -506,13 +506,13 @@ const Et = (s, i) => {
506
506
  },
507
507
  [x, d]
508
508
  ), O = T(() => {
509
- if (v)
509
+ if (y)
510
510
  return;
511
- if (!w.trim())
511
+ if (!v.trim())
512
512
  return I("Option cannot be empty");
513
- const A = w.trim();
513
+ const A = v.trim();
514
514
  F([...d, { value: A, label: A }]), x("");
515
- }, [w, v, F, d]), _ = T(
515
+ }, [v, y, F, d]), _ = T(
516
516
  (A) => {
517
517
  A.key === "Enter" && (A.preventDefault(), O());
518
518
  },
@@ -531,15 +531,15 @@ const Et = (s, i) => {
531
531
  },
532
532
  [F, d]
533
533
  );
534
- return /* @__PURE__ */ r(vt, { onDragEnd: B, children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
535
- /* @__PURE__ */ r(U, { helpText: k, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: (!m || d.length === 0) && /* @__PURE__ */ b(y, { gap: "2", children: [
534
+ return /* @__PURE__ */ r(xt, { onDragEnd: B, children: /* @__PURE__ */ b(w, { direction: "column", gap: "2", children: [
535
+ /* @__PURE__ */ r(U, { helpText: k, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: (!m || d.length === 0) && /* @__PURE__ */ b(w, { gap: "2", children: [
536
536
  /* @__PURE__ */ r(be, { grow: "1", children: /* @__PURE__ */ r(
537
537
  ce.Input,
538
538
  {
539
539
  placeholder: "Press enter to add a new option",
540
540
  ...l,
541
541
  ...c,
542
- value: w,
542
+ value: v,
543
543
  onChange: L,
544
544
  onKeyDown: _,
545
545
  id: e,
@@ -552,25 +552,25 @@ const Et = (s, i) => {
552
552
  {
553
553
  type: "button",
554
554
  "aria-label": "Add option",
555
- disabled: !!v || m,
555
+ disabled: !!y || m,
556
556
  onClick: O,
557
- children: /* @__PURE__ */ r($e, {})
557
+ children: /* @__PURE__ */ r(Ve, {})
558
558
  }
559
559
  )
560
560
  ] }) }) }),
561
- /* @__PURE__ */ r(Ze, { droppableId: g, children: (A) => /* @__PURE__ */ b(y, { ...A.droppableProps, ref: A.innerRef, direction: "column", children: [
561
+ /* @__PURE__ */ r(et, { droppableId: g, children: (A) => /* @__PURE__ */ b(w, { ...A.droppableProps, ref: A.innerRef, direction: "column", children: [
562
562
  d.map((q, Y) => /* @__PURE__ */ r(
563
- et,
563
+ tt,
564
564
  {
565
565
  draggableId: `${q.value}-draggable`,
566
566
  index: Y,
567
567
  isDragDisabled: m,
568
- children: ({ draggableProps: E, dragHandleProps: S, innerRef: V }) => /* @__PURE__ */ r(
569
- y,
568
+ children: ({ draggableProps: E, dragHandleProps: S, innerRef: $ }) => /* @__PURE__ */ r(
569
+ w,
570
570
  {
571
571
  ...S,
572
572
  ...E,
573
- ref: V,
573
+ ref: $,
574
574
  gap: "2",
575
575
  align: "center",
576
576
  justify: "between",
@@ -588,7 +588,7 @@ const Et = (s, i) => {
588
588
  severity: "info",
589
589
  disabled: m,
590
590
  onClick: () => M(Y),
591
- children: /* @__PURE__ */ r(bt, {})
591
+ children: /* @__PURE__ */ r(yt, {})
592
592
  }
593
593
  )
594
594
  ] })
@@ -615,7 +615,7 @@ const Et = (s, i) => {
615
615
  throw new Error("Expected an array.");
616
616
  }
617
617
  getInput(e) {
618
- return /* @__PURE__ */ r(qi, { field: this, ...e });
618
+ return /* @__PURE__ */ r(Wi, { field: this, ...e });
619
619
  }
620
620
  serialize() {
621
621
  return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
@@ -639,9 +639,9 @@ const Et = (s, i) => {
639
639
  return new re(e);
640
640
  }
641
641
  };
642
- p(re, "fieldTypeName", "Multi-string"), p(re, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), p(re, "Icon", Qt);
642
+ p(re, "fieldTypeName", "Multi-string"), p(re, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), p(re, "Icon", Jt);
643
643
  let Ee = re;
644
- class Lt extends R {
644
+ class kt extends R {
645
645
  constructor(e) {
646
646
  super(e);
647
647
  p(this, "options");
@@ -671,7 +671,7 @@ class Lt extends R {
671
671
  ];
672
672
  }
673
673
  }
674
- const oe = class oe extends Lt {
674
+ const oe = class oe extends kt {
675
675
  constructor(i) {
676
676
  super({ ...i, type: "select" });
677
677
  }
@@ -687,20 +687,20 @@ const oe = class oe extends Lt {
687
687
  return new oe(i);
688
688
  }
689
689
  getInput(i) {
690
- return /* @__PURE__ */ r(Ni, { field: this, ...i });
690
+ return /* @__PURE__ */ r(Ri, { field: this, ...i });
691
691
  }
692
692
  };
693
- p(oe, "fieldTypeName", "Dropdown"), p(oe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), p(oe, "Icon", Jt);
693
+ p(oe, "fieldTypeName", "Dropdown"), p(oe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), p(oe, "Icon", Zt);
694
694
  let Ae = oe;
695
- const Wi = (s) => s ? Array.isArray(s) ? s : [s] : [], ji = z(function(i) {
696
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), { onChange: d, onBlur: u } = c, h = C(() => Wi(c.value), [c.value]), g = T(
695
+ const ji = (s) => s ? Array.isArray(s) ? s : [s] : [], Hi = z(function(i) {
696
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), { onChange: d, onBlur: u } = c, h = C(() => ji(c.value), [c.value]), g = T(
697
697
  (m) => {
698
698
  d(m), u(m);
699
699
  },
700
700
  [d, u]
701
701
  );
702
702
  return /* @__PURE__ */ r(U, { helpText: o, severity: n, children: /* @__PURE__ */ r(H, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ r(
703
- Zt,
703
+ ei,
704
704
  {
705
705
  value: h,
706
706
  onValueChange: g,
@@ -712,7 +712,7 @@ const Wi = (s) => s ? Array.isArray(s) ? s : [s] : [], ji = z(function(i) {
712
712
  ...f
713
713
  }
714
714
  ) }) });
715
- }), se = class se extends Lt {
715
+ }), se = class se extends kt {
716
716
  constructor(i) {
717
717
  super({ ...i, type: "multi-select" });
718
718
  }
@@ -733,13 +733,13 @@ const Wi = (s) => s ? Array.isArray(s) ? s : [s] : [], ji = z(function(i) {
733
733
  return new se(i);
734
734
  }
735
735
  getInput(i) {
736
- return /* @__PURE__ */ r(ji, { field: this, ...i });
736
+ return /* @__PURE__ */ r(Hi, { field: this, ...i });
737
737
  }
738
738
  };
739
- p(se, "fieldTypeName", "Multi-select"), p(se, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), p(se, "Icon", ei);
739
+ p(se, "fieldTypeName", "Multi-select"), p(se, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), p(se, "Icon", ti);
740
740
  let Pe = se;
741
- const Hi = z(function({ field: i, ...e }) {
742
- const [{ value: t }] = Xe(i.options.clonedFieldIdentifier), n = C(() => {
741
+ const Ui = z(function({ field: i, ...e }) {
742
+ const [{ value: t }] = Qe(i.options.clonedFieldIdentifier), n = C(() => {
743
743
  const o = i.options.getFieldToClone(t);
744
744
  return o ? Oe(o) : null;
745
745
  }, [i.options, t]);
@@ -762,27 +762,27 @@ class Le extends R {
762
762
  }
763
763
  }
764
764
  p(Le, "fieldTypeName", "Custom"), p(Le, "fieldTypeDescription", "Allows re-rendering of field already in the form");
765
- class Ui extends Le {
765
+ class Gi extends Le {
766
766
  constructor(i) {
767
- super(i, Hi);
767
+ super(i, Ui);
768
768
  }
769
769
  }
770
- const Gi = z(function(i) {
771
- const { field: e, ...t } = i, { label: n, description: o, fields: a, condition: c } = e, { values: l, setFieldValue: f } = he(), d = c != null && c.identifier ? fe(l, c.identifier) : void 0, u = C(() => $t(c, d), [c, d]);
770
+ const Ki = z(function(i) {
771
+ const { field: e, ...t } = i, { label: n, description: o, fields: a, condition: c } = e, { values: l, setFieldValue: f } = he(), d = c != null && c.identifier ? fe(l, c.identifier) : void 0, u = C(() => Dt(c, d), [c, d]);
772
772
  ue(() => {
773
773
  if (!u)
774
774
  for (const g of a)
775
775
  f(g.getId(), "").then();
776
776
  }, [u, a, f]);
777
- const h = Dt(a, t);
778
- return u ? n ? /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
779
- /* @__PURE__ */ b(y, { direction: "column", children: [
777
+ const h = _t(a, t);
778
+ return u ? n ? /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(w, { direction: "column", gap: "3", children: [
779
+ /* @__PURE__ */ b(w, { direction: "column", children: [
780
780
  /* @__PURE__ */ r(De, { as: "h3", size: "3", children: n }),
781
- /* @__PURE__ */ r($, { className: Me.description, children: o })
781
+ /* @__PURE__ */ r(V, { className: Me.description, children: o })
782
782
  ] }),
783
783
  h
784
784
  ] }) }) : h : null;
785
- }), le = class le extends St {
785
+ }), le = class le extends zt {
786
786
  constructor(e) {
787
787
  const { label: t = null, fields: n, condition: o = null, conditional: a, ...c } = e;
788
788
  super({ ...c, type: "section" });
@@ -829,7 +829,7 @@ const Gi = z(function(i) {
829
829
  // Declare a custom field that will be used to input a value for the condition. The value of the
830
830
  // conditional field selected in the previous step must be equal to the value the user inputs into
831
831
  // this field for the section to be rendered.
832
- new Ui({
832
+ new Gi({
833
833
  label: "Value",
834
834
  identifier: "condition.value",
835
835
  required: !0,
@@ -856,7 +856,7 @@ const Gi = z(function(i) {
856
856
  var n;
857
857
  if (e.type !== "section")
858
858
  throw new Error("Invalid type");
859
- const t = ((n = e.fields) == null ? void 0 : n.map(kt)) ?? [];
859
+ const t = ((n = e.fields) == null ? void 0 : n.map($t)) ?? [];
860
860
  return new le({ ...e, fields: t });
861
861
  }
862
862
  conditional() {
@@ -875,27 +875,27 @@ const Gi = z(function(i) {
875
875
  const t = {};
876
876
  for (const n of this.fields) {
877
877
  const o = n.getId(), a = n.getError(fe(e, o), e);
878
- a && it(t, n.getId(), a);
878
+ a && nt(t, n.getId(), a);
879
879
  }
880
880
  return t;
881
881
  }
882
882
  getInput(e) {
883
- return /* @__PURE__ */ r(Gi, { field: this, ...e });
883
+ return /* @__PURE__ */ r(Ki, { field: this, ...e });
884
884
  }
885
885
  };
886
886
  p(le, "fieldTypeName", "Section"), p(le, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
887
887
  let J = le;
888
- const Ki = "_previewImage_1ig84_1", Yi = {
889
- previewImage: Ki
890
- }, nt = (s) => {
888
+ const Yi = "_previewImage_1ig84_1", Xi = {
889
+ previewImage: Yi
890
+ }, rt = (s) => {
891
891
  const i = ["byte", "kilobyte", "megabyte"];
892
892
  let e = s, t = 0;
893
893
  for (; e > 1024 && t < i.length - 1; )
894
894
  e /= 1024, t++;
895
895
  return new Intl.NumberFormat([], { maximumFractionDigits: 2, style: "unit", unit: i[t] }).format(e);
896
- }, Xi = z(function(i) {
896
+ }, Qi = z(function(i) {
897
897
  var P;
898
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), { onChange: d } = c, u = pe(n), h = wt(null), { value: g } = c, m = C(() => o || (l.maxFileSize ? `Maximum file size: ${nt(l.maxFileSize)}` : null), [l.maxFileSize, o]), w = T(() => {
898
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: a, fieldProps: c, field: l }, f] = G(i), { onChange: d } = c, u = pe(n), h = vt(null), { value: g } = c, m = C(() => o || (l.maxFileSize ? `Maximum file size: ${rt(l.maxFileSize)}` : null), [l.maxFileSize, o]), v = T(() => {
899
899
  var F;
900
900
  (F = h.current) == null || F.click();
901
901
  }, []), x = T(
@@ -904,11 +904,11 @@ const Ki = "_previewImage_1ig84_1", Yi = {
904
904
  L.splice(F, 1), d({ target: { files: L } });
905
905
  },
906
906
  [g, d]
907
- ), v = g ? "Select new files" : "Select files", I = g ? "Select new file" : "Select a file", k = l.maxFiles > 1 ? v : I;
908
- return /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
907
+ ), y = g ? "Select new files" : "Select files", I = g ? "Select new file" : "Select a file", k = l.maxFiles > 1 ? y : I;
908
+ return /* @__PURE__ */ b(w, { direction: "column", gap: "2", children: [
909
909
  /* @__PURE__ */ r(U, { helpText: m, severity: n, children: /* @__PURE__ */ b(H, { severity: n, inputId: e, labelId: t, label: a, children: [
910
- /* @__PURE__ */ r(y, { direction: "row", gap: "2", children: /* @__PURE__ */ r(be, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(K, { ...f, onClick: w, children: [
911
- /* @__PURE__ */ r(yt, {}),
910
+ /* @__PURE__ */ r(w, { direction: "row", gap: "2", children: /* @__PURE__ */ r(be, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(K, { ...f, onClick: v, children: [
911
+ /* @__PURE__ */ r(wt, {}),
912
912
  " ",
913
913
  k
914
914
  ] }) }) }),
@@ -928,8 +928,8 @@ const Ki = "_previewImage_1ig84_1", Yi = {
928
928
  }
929
929
  )
930
930
  ] }) }),
931
- Array.isArray(g) && g.length > 0 && /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: g.map((F, L) => /* @__PURE__ */ r(
932
- Qi,
931
+ Array.isArray(g) && g.length > 0 && /* @__PURE__ */ r(w, { direction: "column", gap: "2", children: g.map((F, L) => /* @__PURE__ */ r(
932
+ Ji,
933
933
  {
934
934
  field: l,
935
935
  file: F,
@@ -939,15 +939,15 @@ const Ki = "_previewImage_1ig84_1", Yi = {
939
939
  L
940
940
  )) })
941
941
  ] });
942
- }), Qi = z(function({ file: i, field: e, onRemove: t, disabled: n }) {
942
+ }), Ji = z(function({ file: i, field: e, onRemove: t, disabled: n }) {
943
943
  const [o, a] = X(null), c = C(() => o && e.getError([o]), [e, o]), { url: l, name: f, size: d } = C(() => {
944
944
  let u = null, h, g;
945
- return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (h = o.name, g = nt(o.size)) : (h = "Downloading...", g = "..."), { url: u, name: h, size: g };
945
+ return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (h = o.name, g = rt(o.size)) : (h = "Downloading...", g = "..."), { url: u, name: h, size: g };
946
946
  }, [o]);
947
947
  return ue(() => {
948
948
  i instanceof Promise ? i.then(a) : a(i);
949
- }, [i]), /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(y, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
950
- /* @__PURE__ */ b(y, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
949
+ }, [i]), /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(w, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
950
+ /* @__PURE__ */ b(w, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
951
951
  /* @__PURE__ */ r(
952
952
  de,
953
953
  {
@@ -956,18 +956,18 @@ const Ki = "_previewImage_1ig84_1", Yi = {
956
956
  "aria-label": `Remove ${f}`,
957
957
  disabled: n,
958
958
  onClick: t,
959
- children: /* @__PURE__ */ r(bt, {})
959
+ children: /* @__PURE__ */ r(yt, {})
960
960
  }
961
961
  ),
962
- /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
963
- /* @__PURE__ */ r($, { children: f }),
964
- /* @__PURE__ */ r($, { size: "1", children: d }),
965
- c && /* @__PURE__ */ r($, { size: "1", severity: "danger", children: c })
962
+ /* @__PURE__ */ b(w, { direction: "column", gap: "1", children: [
963
+ /* @__PURE__ */ r(V, { children: f }),
964
+ /* @__PURE__ */ r(V, { size: "1", children: d }),
965
+ c && /* @__PURE__ */ r(V, { size: "1", severity: "danger", children: c })
966
966
  ] })
967
967
  ] }),
968
- l && /* @__PURE__ */ r("img", { className: Yi.previewImage, src: l, alt: f })
968
+ l && /* @__PURE__ */ r("img", { className: Xi.previewImage, src: l, alt: f })
969
969
  ] }) });
970
- }), ct = 50 * 1024 * 1024, ae = class ae extends R {
970
+ }), ut = 50 * 1024 * 1024, ae = class ae extends R {
971
971
  constructor(e) {
972
972
  const { extensions: t, maximum_files: n, maximum_size: o, ...a } = e;
973
973
  super({ ...a, type: "upload" });
@@ -999,7 +999,7 @@ const Ki = "_previewImage_1ig84_1", Yi = {
999
999
  required: !1,
1000
1000
  identifier: "maximum_size",
1001
1001
  minimum: 1,
1002
- maximum: ct,
1002
+ maximum: ut,
1003
1003
  integers: !0
1004
1004
  }),
1005
1005
  new Pe({
@@ -1033,10 +1033,10 @@ const Ki = "_previewImage_1ig84_1", Yi = {
1033
1033
  ];
1034
1034
  }
1035
1035
  getFieldValidators() {
1036
- const e = super.getFieldValidators(), t = this.maxFileSize ?? ct, n = this.maxFiles ?? 1;
1036
+ const e = super.getFieldValidators(), t = this.maxFileSize ?? ut, n = this.maxFiles ?? 1;
1037
1037
  return e.push((o) => {
1038
1038
  if (o && o.some((a) => a.size > t))
1039
- return `Files must be at most ${nt(t)}.`;
1039
+ return `Files must be at most ${rt(t)}.`;
1040
1040
  }), e.push((o) => {
1041
1041
  if (o && o.length > n)
1042
1042
  return `You can only upload ${n} files.`;
@@ -1056,12 +1056,12 @@ const Ki = "_previewImage_1ig84_1", Yi = {
1056
1056
  return new ae(e);
1057
1057
  }
1058
1058
  getInput(e) {
1059
- return /* @__PURE__ */ r(Xi, { field: this, ...e });
1059
+ return /* @__PURE__ */ r(Qi, { field: this, ...e });
1060
1060
  }
1061
1061
  };
1062
- p(ae, "fieldTypeName", "Upload"), p(ae, "fieldTypeDescription", "Allows a file to be uploaded."), p(ae, "Icon", yt);
1062
+ p(ae, "fieldTypeName", "Upload"), p(ae, "fieldTypeDescription", "Allows a file to be uploaded."), p(ae, "Icon", wt);
1063
1063
  let Ge = ae;
1064
- const rt = {
1064
+ const ot = {
1065
1065
  date: je,
1066
1066
  number: Q,
1067
1067
  boolean: me,
@@ -1073,10 +1073,10 @@ const rt = {
1073
1073
  // TODO: Underscore
1074
1074
  "multi-string": Ee,
1075
1075
  "multi-select": Pe
1076
- }, kt = (s) => {
1076
+ }, $t = (s) => {
1077
1077
  const i = s.type;
1078
- return rt[i].deserialize(s);
1079
- }, Oe = (s) => s.type === "section" ? J.deserialize(s) : kt(s);
1078
+ return ot[i].deserialize(s);
1079
+ }, Oe = (s) => s.type === "section" ? J.deserialize(s) : $t(s);
1080
1080
  function Vt(s, i = {}) {
1081
1081
  const { readonly: e = !1 } = i;
1082
1082
  return {
@@ -1089,7 +1089,7 @@ function Vt(s, i = {}) {
1089
1089
  function Ke(s) {
1090
1090
  return !!(Array.isArray(s) && s.some((i) => i instanceof File || i instanceof Promise));
1091
1091
  }
1092
- function $t(s, i) {
1092
+ function Dt(s, i) {
1093
1093
  if (!s)
1094
1094
  return !0;
1095
1095
  if (Ke(i) || Ke(s.value))
@@ -1103,16 +1103,16 @@ function $t(s, i) {
1103
1103
  }
1104
1104
  return t === i;
1105
1105
  }
1106
- const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s, i) => {
1106
+ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), _t = (s, i) => {
1107
1107
  const e = C(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
1108
- return /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: e });
1109
- }, Ve = (s) => Object.keys(s).length > 0, _t = async (s, i) => {
1108
+ return /* @__PURE__ */ r(w, { direction: "column", gap: "2", children: e });
1109
+ }, $e = (s) => Object.keys(s).length > 0, Mt = async (s, i) => {
1110
1110
  const e = {};
1111
1111
  for (const t of s.fields)
1112
1112
  if (t instanceof J) {
1113
1113
  if (t.condition) {
1114
1114
  const { identifier: n } = t.condition;
1115
- if (!$t(t.condition, fe(i, n)))
1115
+ if (!Dt(t.condition, fe(i, n)))
1116
1116
  continue;
1117
1117
  }
1118
1118
  Object.assign(e, t.getErrors(i));
@@ -1120,18 +1120,18 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1120
1120
  if (!(t instanceof R))
1121
1121
  throw new Error("Invalid field type");
1122
1122
  const n = t.getId(), o = t.getError(fe(i, n), i);
1123
- o && it(e, n, o);
1123
+ o && nt(e, n, o);
1124
1124
  }
1125
- if (Ve(e))
1125
+ if ($e(e))
1126
1126
  return e;
1127
- }, Ji = [null, void 0], ot = (s, i) => s.reduce((e, t) => t instanceof J ? { ...e, ...ot(t.fields, i) } : (Ji.includes(fe(e, t.getId())) && it(e, t.getId(), ""), e), i), Zi = () => {
1127
+ }, Zi = [null, void 0], st = (s, i) => s.reduce((e, t) => t instanceof J ? { ...e, ...st(t.fields, i) } : (Zi.includes(fe(e, t.getId())) && nt(e, t.getId(), ""), e), i), en = () => {
1128
1128
  throw new Error("onSubmit must be provided if form is not readonly.");
1129
- }, st = z(
1129
+ }, lt = z(
1130
1130
  xe((s, i) => {
1131
1131
  const {
1132
1132
  schema: e,
1133
1133
  values: t = {},
1134
- onSubmit: n = Zi,
1134
+ onSubmit: n = en,
1135
1135
  submitText: o = "Submit",
1136
1136
  cancelText: a,
1137
1137
  onCancel: c,
@@ -1140,43 +1140,43 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1140
1140
  hideTitle: f = !e.title,
1141
1141
  hideDescription: d,
1142
1142
  className: u
1143
- } = s, { readonly: h } = e.meta, g = C(() => crypto.randomUUID(), []), m = Qe({
1144
- initialValues: ot(e.fields, t),
1143
+ } = s, { readonly: h } = e.meta, g = C(() => crypto.randomUUID(), []), m = Je({
1144
+ initialValues: st(e.fields, t),
1145
1145
  onSubmit: n,
1146
- validate: (k) => _t(e, k),
1146
+ validate: (k) => Mt(e, k),
1147
1147
  // only validate the entire form on submit
1148
1148
  validateOnBlur: !1,
1149
1149
  validateOnChange: !1
1150
- }), { dirty: w } = m, x = C(
1150
+ }), { dirty: v } = m, x = C(
1151
1151
  () => typeof e.title == "string" ? /* @__PURE__ */ r(De, { children: e.title }) : e.title,
1152
1152
  [e.title]
1153
- ), v = C(
1154
- () => typeof e.description == "string" ? /* @__PURE__ */ r($, { className: Me.description, children: e.description }) : e.description,
1153
+ ), y = C(
1154
+ () => typeof e.description == "string" ? /* @__PURE__ */ r(V, { className: Me.description, children: e.description }) : e.description,
1155
1155
  [e.description]
1156
- ), I = Dt(e.fields, { formId: g, disabled: h });
1156
+ ), I = _t(e.fields, { formId: g, disabled: h });
1157
1157
  return ue(() => {
1158
- w && l && l();
1159
- }, [w, l]), /* @__PURE__ */ r(Je, { value: m, children: /* @__PURE__ */ r(y, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: g, onSubmit: m.handleSubmit, children: [
1160
- !f && /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
1158
+ v && l && l();
1159
+ }, [v, l]), /* @__PURE__ */ r(Ze, { value: m, children: /* @__PURE__ */ r(w, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: g, onSubmit: m.handleSubmit, children: [
1160
+ !f && /* @__PURE__ */ r(ve, { children: /* @__PURE__ */ b(w, { direction: "column", gap: "1", children: [
1161
1161
  x,
1162
- !d && v
1162
+ !d && y
1163
1163
  ] }) }),
1164
1164
  I,
1165
- !h && /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
1165
+ !h && /* @__PURE__ */ b(w, { justify: "end", gap: "2", children: [
1166
1166
  a && /* @__PURE__ */ r(K, { type: "button", variant: "soft", onClick: c, children: a }),
1167
1167
  /* @__PURE__ */ r(K, { type: "submit", disabled: !m.isValid, children: o })
1168
1168
  ] })
1169
1169
  ] }) }) });
1170
1170
  })
1171
- ), $n = z(
1171
+ ), Dn = z(
1172
1172
  xe((s, i) => {
1173
- const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = N(xt(e.form_revision)), { sdk: a } = It();
1173
+ const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = N(It(e.form_revision)), { sdk: a } = Ft();
1174
1174
  if (!o)
1175
1175
  throw new Error(
1176
1176
  `Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
1177
1177
  );
1178
1178
  const c = C(() => Vt(o, { readonly: !0 }), [o]), l = C(() => {
1179
- const f = Ii(e.offline_id)(a.store.getState()) ?? [], d = {};
1179
+ const f = Ci(e.offline_id)(a.store.getState()) ?? [], d = {};
1180
1180
  for (const u of f) {
1181
1181
  const h = a.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((m) => {
1182
1182
  if (!m.success)
@@ -1188,7 +1188,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1188
1188
  return { ...e.values, ...d };
1189
1189
  }, [a.files, a.store, e.offline_id, e.values]);
1190
1190
  return /* @__PURE__ */ r(
1191
- st,
1191
+ lt,
1192
1192
  {
1193
1193
  ref: i,
1194
1194
  schema: c,
@@ -1198,15 +1198,15 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1198
1198
  }
1199
1199
  );
1200
1200
  })
1201
- ), en = "_favoriteIcon_1bixi_1", tn = "_regularIcon_1bixi_9", dt = {
1202
- favoriteIcon: en,
1203
- regularIcon: tn
1204
- }, Be = "organization:", qe = "user:", Dn = z(
1201
+ ), tn = "_favoriteIcon_1bixi_1", nn = "_regularIcon_1bixi_9", ft = {
1202
+ favoriteIcon: tn,
1203
+ regularIcon: nn
1204
+ }, Be = "organization:", qe = "user:", _n = z(
1205
1205
  xe((s, i) => {
1206
- const { maxResults: e = 20, ...t } = s, [n, o] = X(""), [a, c] = X(""), { sdk: l } = It(), f = C(() => {
1206
+ const { maxResults: e = 20, ...t } = s, [n, o] = X(""), [a, c] = X(""), { sdk: l } = Ft(), f = C(() => {
1207
1207
  const I = { maxResults: e, searchTerm: n };
1208
1208
  return a && (a.startsWith(Be) ? I.owner_organization = parseInt(a.slice(Be.length)) : a.startsWith(qe) && (I.owner_user = parseInt(a.slice(qe.length)))), I;
1209
- }, [n, e, a]), d = N(Fi(f)) ?? [], u = N(Ci), h = T(
1209
+ }, [n, e, a]), d = N(Ti(f)) ?? [], u = N(Si), h = T(
1210
1210
  (I) => {
1211
1211
  I.favorite ? l.userForms.unfavorite(I.offline_id).then() : l.userForms.favorite(I.offline_id).then();
1212
1212
  },
@@ -1214,20 +1214,20 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1214
1214
  ), g = C(() => {
1215
1215
  const I = l.store.getState(), k = {};
1216
1216
  for (const P of Object.values(u)) {
1217
- const F = Ft(P.owner_organization || -1)(I);
1217
+ const F = Ct(P.owner_organization || -1)(I);
1218
1218
  F && (k[`${Be}${F.id}`] = F.name);
1219
- const L = tt(P.owner_user || -1)(I);
1219
+ const L = it(P.owner_user || -1)(I);
1220
1220
  L && (k[`${qe}${L.id}`] = L.username);
1221
1221
  }
1222
1222
  return Object.entries(k).map(([P, F]) => ({ itemContent: F, value: P }));
1223
1223
  }, [u, l.store]), m = T((I) => {
1224
1224
  o(I.currentTarget.value);
1225
- }, []), x = (N(Ti) || 0) - d.length, v = d.length == e && x > 0 ? `Only the first ${e} results are shown (${x} hidden)` : x > 0 && `${x} hidden forms`;
1226
- return /* @__PURE__ */ b(y, { ref: i, direction: "column", gap: "2", children: [
1227
- /* @__PURE__ */ b(y, { gap: "2", grow: "1", children: [
1225
+ }, []), x = (N(zi) || 0) - d.length, y = d.length == e && x > 0 ? `Only the first ${e} results are shown (${x} hidden)` : x > 0 && `${x} hidden forms`;
1226
+ return /* @__PURE__ */ b(w, { ref: i, direction: "column", gap: "2", children: [
1227
+ /* @__PURE__ */ b(w, { gap: "2", grow: "1", children: [
1228
1228
  /* @__PURE__ */ r(be, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(ce.Root, { size: "3", children: /* @__PURE__ */ r(ce.Input, { placeholder: "Filter", value: n, onChange: m }) }) }),
1229
1229
  /* @__PURE__ */ r(
1230
- gt,
1230
+ bt,
1231
1231
  {
1232
1232
  items: g,
1233
1233
  value: a,
@@ -1238,7 +1238,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1238
1238
  )
1239
1239
  ] }),
1240
1240
  d.length > 0 && /* @__PURE__ */ r(_e.Root, { children: d.map((I) => /* @__PURE__ */ r(
1241
- nn,
1241
+ rn,
1242
1242
  {
1243
1243
  ...t,
1244
1244
  form: I,
@@ -1246,70 +1246,70 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1246
1246
  },
1247
1247
  I.offline_id
1248
1248
  )) }),
1249
- /* @__PURE__ */ r(be, { px: "3", children: /* @__PURE__ */ r($, { size: "2", severity: "info", children: v }) })
1249
+ /* @__PURE__ */ r(be, { px: "3", children: /* @__PURE__ */ r(V, { size: "2", severity: "info", children: y }) })
1250
1250
  ] });
1251
1251
  })
1252
- ), nn = (s) => {
1252
+ ), rn = (s) => {
1253
1253
  var h;
1254
- const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (h = N(Ft(i.owner_organization || -1))) == null ? void 0 : h.name, a = N(tt(i.owner_user || -1)), c = N(Ct).id, l = !!a && a.id === c, f = o ?? (l ? "You" : a == null ? void 0 : a.username) ?? "Unknown", d = T(
1254
+ const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (h = N(Ct(i.owner_organization || -1))) == null ? void 0 : h.name, a = N(it(i.owner_user || -1)), c = N(Tt).id, l = !!a && a.id === c, f = o ?? (l ? "You" : a == null ? void 0 : a.username) ?? "Unknown", d = T(
1255
1255
  (g) => {
1256
1256
  g.stopPropagation(), n();
1257
1257
  },
1258
1258
  [n]
1259
- ), u = /* @__PURE__ */ r(_e.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...ti, children: [
1260
- /* @__PURE__ */ b(y, { grow: "1", align: "center", gap: "2", children: [
1259
+ ), u = /* @__PURE__ */ r(_e.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(w, { justify: "between", gap: "2", py: "2", px: "3", ...ii, children: [
1260
+ /* @__PURE__ */ b(w, { grow: "1", align: "center", gap: "2", children: [
1261
1261
  /* @__PURE__ */ r(
1262
1262
  de,
1263
1263
  {
1264
- className: Tt(i.favorite ? dt.favoriteIcon : dt.regularIcon),
1264
+ className: St(i.favorite ? ft.favoriteIcon : ft.regularIcon),
1265
1265
  variant: "ghost",
1266
1266
  onClick: d,
1267
1267
  "aria-label": i.favorite ? "Favorite form" : "Standard form",
1268
1268
  disabled: !t,
1269
- children: i.favorite ? /* @__PURE__ */ r(ii, {}) : /* @__PURE__ */ r(ni, {})
1269
+ children: i.favorite ? /* @__PURE__ */ r(ni, {}) : /* @__PURE__ */ r(ri, {})
1270
1270
  }
1271
1271
  ),
1272
- /* @__PURE__ */ r($, { noWrap: !0, children: i.latestRevision.title }),
1273
- i.latestRevision.description && /* @__PURE__ */ r(ri, {})
1272
+ /* @__PURE__ */ r(V, { noWrap: !0, children: i.latestRevision.title }),
1273
+ i.latestRevision.description && /* @__PURE__ */ r(oi, {})
1274
1274
  ] }),
1275
- f && /* @__PURE__ */ b(y, { align: "center", gap: "2", children: [
1276
- /* @__PURE__ */ r(oi, {}),
1275
+ f && /* @__PURE__ */ b(w, { align: "center", gap: "2", children: [
1276
+ /* @__PURE__ */ r(si, {}),
1277
1277
  " ",
1278
1278
  f
1279
1279
  ] })
1280
1280
  ] }) });
1281
- return i.latestRevision.description ? /* @__PURE__ */ r(si, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
1282
- }, rn = "_submissionsContainer_9iirt_1", on = "_stopHorizontalOverflow_9iirt_6", Mt = {
1283
- submissionsContainer: rn,
1284
- stopHorizontalOverflow: on
1285
- }, sn = z(function(i) {
1281
+ return i.latestRevision.description ? /* @__PURE__ */ r(li, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
1282
+ }, on = "_submissionsContainer_9iirt_1", sn = "_stopHorizontalOverflow_9iirt_6", Ot = {
1283
+ submissionsContainer: on,
1284
+ stopHorizontalOverflow: sn
1285
+ }, ln = z(function(i) {
1286
1286
  var I;
1287
- const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: a } = i, c = N(Ct), l = N(tt("created_by" in e ? e.created_by : c.id)), f = Ye(e), d = Si(f) ? f.toLocaleTimeString([], {
1287
+ const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: a } = i, c = N(Tt), l = N(it("created_by" in e ? e.created_by : c.id)), f = Ye(e), d = Ei(f) ? f.toLocaleTimeString([], {
1288
1288
  hour: "2-digit",
1289
1289
  minute: "2-digit"
1290
- }) : zi(f), u = N(xt(e.form_revision));
1290
+ }) : Ai(f), u = N(It(e.form_revision));
1291
1291
  if (!u)
1292
1292
  throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
1293
- const h = (I = N(Ei(u.form))) == null ? void 0 : I.revision, g = Ai({
1293
+ const h = (I = N(Pi(u.form))) == null ? void 0 : I.revision, g = Li({
1294
1294
  file: (l == null ? void 0 : l.profile.file) ?? null,
1295
1295
  fileSha1: (l == null ? void 0 : l.profile.file_sha1) ?? null
1296
- }), m = (l == null ? void 0 : l.username.charAt(0).toUpperCase()) ?? "?", w = u.revision === h, x = wi.useCallback(() => {
1296
+ }), m = (l == null ? void 0 : l.username.charAt(0).toUpperCase()) ?? "?", v = u.revision === h, x = vi.useCallback(() => {
1297
1297
  t && t({ submission: e });
1298
- }, [e, t]), v = /* @__PURE__ */ r(_e.Item, { onClick: x, asChild: !0, children: /* @__PURE__ */ b(y, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
1299
- /* @__PURE__ */ b(y, { gap: "2", align: "center", className: Mt.stopHorizontalOverflow, children: [
1300
- /* @__PURE__ */ r(li, { src: g, size: "1", fallback: m }),
1301
- /* @__PURE__ */ r($, { size: "2", noWrap: !0, children: o === "creator" ? (l || c).username : u.title })
1298
+ }, [e, t]), y = /* @__PURE__ */ r(_e.Item, { onClick: x, asChild: !0, children: /* @__PURE__ */ b(w, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
1299
+ /* @__PURE__ */ b(w, { gap: "2", align: "center", className: Ot.stopHorizontalOverflow, children: [
1300
+ /* @__PURE__ */ r(ai, { src: g, size: "1", fallback: m }),
1301
+ /* @__PURE__ */ r(V, { size: "2", noWrap: !0, children: o === "creator" ? (l || c).username : u.title })
1302
1302
  ] }),
1303
- /* @__PURE__ */ b(y, { gap: "2", align: "center", children: [
1304
- !n && (u.revision ? /* @__PURE__ */ r(We, { variant: "soft", severity: w ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!h && /* @__PURE__ */ r(We, { children: "Original" })),
1305
- /* @__PURE__ */ r($, { size: "2", noWrap: !0, children: d })
1303
+ /* @__PURE__ */ b(w, { gap: "2", align: "center", children: [
1304
+ !n && (u.revision ? /* @__PURE__ */ r(We, { variant: "soft", severity: v ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!h && /* @__PURE__ */ r(We, { children: "Original" })),
1305
+ /* @__PURE__ */ r(V, { size: "2", noWrap: !0, children: d })
1306
1306
  ] })
1307
1307
  ] }) });
1308
- return a ? a(e, v) : v;
1308
+ return a ? a(e, y) : y;
1309
1309
  }), Ye = (s) => {
1310
1310
  const i = "created_at" in s ? s.created_at : s.submitted_at;
1311
1311
  return new Date(i);
1312
- }, _n = z(function(i) {
1312
+ }, Mn = z(function(i) {
1313
1313
  const {
1314
1314
  formId: e,
1315
1315
  submissions: t,
@@ -1322,7 +1322,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1322
1322
  if (!!e == !!t)
1323
1323
  throw new Error("Either formId or submissions must be provided, but not both.");
1324
1324
  const f = N(
1325
- t ? () => t : Pi(e)
1325
+ t ? () => t : ki(e)
1326
1326
  ), d = C(
1327
1327
  () => f == null ? void 0 : f.sort((u, h) => Ye(h).getTime() - Ye(u).getTime()),
1328
1328
  [f]
@@ -1330,17 +1330,17 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1330
1330
  return /* @__PURE__ */ r(
1331
1331
  _e.Root,
1332
1332
  {
1333
- className: Tt(Mt.submissionsContainer, o),
1333
+ className: St(Ot.submissionsContainer, o),
1334
1334
  size: "small",
1335
1335
  variant: c,
1336
- before: !n && /* @__PURE__ */ b($, { severity: "info", children: [
1336
+ before: !n && /* @__PURE__ */ b(V, { severity: "info", children: [
1337
1337
  "There are ",
1338
1338
  ((f == null ? void 0 : f.length) || 0).toString(),
1339
1339
  " submissions of this form."
1340
1340
  ] }),
1341
1341
  after: a,
1342
1342
  children: d == null ? void 0 : d.map((u, h) => /* @__PURE__ */ r(
1343
- sn,
1343
+ ln,
1344
1344
  {
1345
1345
  submission: u,
1346
1346
  compact: n,
@@ -1350,8 +1350,8 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1350
1350
  ))
1351
1351
  }
1352
1352
  );
1353
- }), Mn = z(function(i) {
1354
- const { name: e, render: t } = i, { submitForm: n } = he(), [o, a, c] = Xe(e);
1353
+ }), On = z(function(i) {
1354
+ const { name: e, render: t } = i, { submitForm: n } = he(), [o, a, c] = Qe(e);
1355
1355
  return C(() => {
1356
1356
  const l = (f) => c.setValue(f, !1);
1357
1357
  return t({
@@ -1360,25 +1360,25 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1360
1360
  patchValue: n
1361
1361
  });
1362
1362
  }, [n, c, o.value, t]);
1363
- }), On = z(
1363
+ }), Nn = z(
1364
1364
  xe((s, i) => {
1365
- const { children: e, schema: t, values: n, onPatch: o, onError: a, ...c } = s, l = C(() => ot(t.fields, n), [t.fields, n]), f = T(
1365
+ const { children: e, schema: t, values: n, onPatch: o, onError: a, ...c } = s, l = C(() => st(t.fields, n), [t.fields, n]), f = T(
1366
1366
  (m) => {
1367
- const w = {};
1367
+ const v = {};
1368
1368
  for (const x in m) {
1369
- const v = m[x];
1370
- v !== l[x] && v !== void 0 && (w[x] = v);
1369
+ const y = m[x];
1370
+ y !== l[x] && y !== void 0 && (v[x] = y);
1371
1371
  }
1372
- Ve(w) && o(w);
1372
+ $e(v) && o(v);
1373
1373
  },
1374
1374
  [l, o]
1375
1375
  ), d = T(
1376
1376
  async (m) => {
1377
- const w = await _t(t, m);
1378
- return w && a(w), w;
1377
+ const v = await Mt(t, m);
1378
+ return v && a(v), v;
1379
1379
  },
1380
1380
  [t, a]
1381
- ), u = Qe({
1381
+ ), u = Je({
1382
1382
  initialValues: l,
1383
1383
  onSubmit: f,
1384
1384
  validate: d,
@@ -1387,49 +1387,49 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1387
1387
  validateOnChange: !1
1388
1388
  }), { errors: h, resetForm: g } = u;
1389
1389
  return ue(() => {
1390
- Ve(h) && g({ values: l, errors: {} });
1391
- }, [h, l, g]), /* @__PURE__ */ r(Je, { value: u, children: /* @__PURE__ */ r("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
1390
+ $e(h) && g({ values: l, errors: {} });
1391
+ }, [h, l, g]), /* @__PURE__ */ r(Ze, { value: u, children: /* @__PURE__ */ r("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
1392
1392
  })
1393
- ), Ot = {
1394
- ...rt,
1393
+ ), Nt = {
1394
+ ...ot,
1395
1395
  section: J
1396
- }, ln = z(function(i) {
1396
+ }, an = z(function(i) {
1397
1397
  const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, a = e.Icon;
1398
- return /* @__PURE__ */ b(y, { gap: "4", align: "center", children: [
1399
- /* @__PURE__ */ r(K, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(y, { gap: "3", align: "center", grow: "1", children: [
1398
+ return /* @__PURE__ */ b(w, { gap: "4", align: "center", children: [
1399
+ /* @__PURE__ */ r(K, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(w, { gap: "3", align: "center", grow: "1", children: [
1400
1400
  /* @__PURE__ */ r(a, {}),
1401
1401
  n
1402
1402
  ] }) }),
1403
- /* @__PURE__ */ r($, { children: o })
1403
+ /* @__PURE__ */ r(V, { children: o })
1404
1404
  ] });
1405
- }), Nt = [
1405
+ }), Rt = [
1406
1406
  ["string", "text"],
1407
1407
  ["select", "multi-select", "upload"],
1408
1408
  ["boolean", "date", "number", "multi-string"]
1409
- ], an = Nt.length - 1, cn = z(function(i) {
1409
+ ], cn = Rt.length - 1, dn = z(function(i) {
1410
1410
  const { setFieldType: e } = i;
1411
- return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children: Nt.map((t, n) => /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
1412
- /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
1413
- ln,
1411
+ return /* @__PURE__ */ r(w, { direction: "column", gap: "3", children: Rt.map((t, n) => /* @__PURE__ */ b(w, { direction: "column", gap: "3", children: [
1412
+ /* @__PURE__ */ r(w, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
1413
+ an,
1414
1414
  {
1415
- field: rt[o],
1415
+ field: ot[o],
1416
1416
  setFieldType: () => e(o)
1417
1417
  },
1418
1418
  o
1419
1419
  )) }),
1420
- n < an && /* @__PURE__ */ r(ai, { size: "4" })
1420
+ n < cn && /* @__PURE__ */ r(ci, { size: "4" })
1421
1421
  ] }, n)) });
1422
- }), dn = (s) => (i) => {
1422
+ }), un = (s) => (i) => {
1423
1423
  if (!(!i || typeof i != "string") && s.includes(i.trim()))
1424
1424
  return "This name is already taken.";
1425
- }, un = (s, i) => {
1425
+ }, fn = (s, i) => {
1426
1426
  const e = [
1427
1427
  new ye({
1428
1428
  label: "Label",
1429
1429
  required: !0,
1430
1430
  maxLength: 200,
1431
1431
  identifier: "label",
1432
- fieldValidators: [dn(s)]
1432
+ fieldValidators: [un(s)]
1433
1433
  }),
1434
1434
  new we({
1435
1435
  label: "Description",
@@ -1442,10 +1442,10 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1442
1442
  ...e,
1443
1443
  new me({ label: "Required", description: null, required: !1, identifier: "required" })
1444
1444
  ];
1445
- }, fn = z(function(i) {
1446
- const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: a } = i, c = Ot[e], l = he(), f = C(() => {
1447
- const d = Pt(l.values.fields).filter((h) => h !== (o == null ? void 0 : o.label));
1448
- let u = un(d, e);
1445
+ }, mn = z(function(i) {
1446
+ const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: a } = i, c = Nt[e], l = he(), f = C(() => {
1447
+ const d = Lt(l.values.fields).filter((h) => h !== (o == null ? void 0 : o.label));
1448
+ let u = fn(d, e);
1449
1449
  if (c === J) {
1450
1450
  if (a === void 0)
1451
1451
  throw new Error("Conditional source fields must be provided when changing sections.");
@@ -1463,7 +1463,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1463
1463
  };
1464
1464
  }, [l.values.fields, e, c, o == null ? void 0 : o.label, a]);
1465
1465
  return /* @__PURE__ */ r(
1466
- st,
1466
+ lt,
1467
1467
  {
1468
1468
  schema: f,
1469
1469
  values: o,
@@ -1473,10 +1473,10 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1473
1473
  }
1474
1474
  );
1475
1475
  }), ge = z(function(i) {
1476
- const { parentPath: e, index: t, children: n, initial: o, editing: a, conditionalSourceFields: c } = i, [l, f] = X(), d = (o == null ? void 0 : o.type) ?? l, u = d ? Ot[d].fieldTypeName : void 0, { setFieldValue: h, values: g } = he();
1476
+ const { parentPath: e, index: t, children: n, initial: o, editing: a, conditionalSourceFields: c } = i, [l, f] = X(), d = (o == null ? void 0 : o.type) ?? l, u = d ? Nt[d].fieldTypeName : void 0, { setFieldValue: h, values: g } = he();
1477
1477
  if (a && !o)
1478
1478
  throw new Error("Initial field must be provided if editing is true.");
1479
- const m = !d && !a && !o, w = m ? "Choose a field type" : `${u} settings`, x = m ? "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.`, v = T(() => f(void 0), []), I = T((F) => {
1479
+ const m = !d && !a && !o, v = m ? "Choose a field type" : `${u} settings`, x = m ? "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.`, y = T(() => f(void 0), []), I = T((F) => {
1480
1480
  f(void 0), F();
1481
1481
  }, []), k = T(
1482
1482
  (F, L) => {
@@ -1488,44 +1488,44 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1488
1488
  const _ = Oe({
1489
1489
  type: d,
1490
1490
  ...F,
1491
- identifier: Et(F.identifier, O)
1491
+ identifier: At(F.identifier, O)
1492
1492
  }).serialize(), M = fe(g, e);
1493
1493
  if (M === void 0)
1494
1494
  throw new Error("Parent path must point to an existing field.");
1495
1495
  let B;
1496
1496
  if (!Array.isArray(M))
1497
1497
  throw new Error("Parent path must point to an array.");
1498
- a ? B = Bi(M, t, _) : B = zt(M, t, _), h(e, B).then(), L();
1498
+ a ? B = qi(M, t, _) : B = Et(M, t, _), h(e, B).then(), L();
1499
1499
  },
1500
1500
  [a, d, g, e, h, t]
1501
1501
  ), P = T(
1502
- (F) => m ? /* @__PURE__ */ r(cn, { setFieldType: f }) : /* @__PURE__ */ r(
1503
- fn,
1502
+ (F) => m ? /* @__PURE__ */ r(dn, { setFieldType: f }) : /* @__PURE__ */ r(
1503
+ mn,
1504
1504
  {
1505
1505
  conditionalSourceFields: c,
1506
- handleCancel: v,
1506
+ handleCancel: y,
1507
1507
  handleCreateField: (L) => k(L, F),
1508
1508
  fieldType: d,
1509
1509
  defaultField: o
1510
1510
  }
1511
1511
  ),
1512
- [c, v, k, o, m, d]
1512
+ [c, y, k, o, m, d]
1513
1513
  );
1514
- return /* @__PURE__ */ r(ci, { onCloseInterrupt: I, title: w, description: x, content: P, children: n });
1515
- }), ut = ({ children: s }) => /* @__PURE__ */ r(ht, { children: s }), ft = (s, i) => ({
1514
+ return /* @__PURE__ */ r(di, { onCloseInterrupt: I, title: v, description: x, content: P, children: n });
1515
+ }), mt = ({ children: s }) => /* @__PURE__ */ r(Xe, { children: s }), pt = (s, i) => ({
1516
1516
  initial: s ? i : "none",
1517
1517
  sm: s ? "none" : i
1518
- }), Rt = z(function(i) {
1518
+ }), Bt = z(function(i) {
1519
1519
  const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o, duplicateProps: a } = i, c = C(
1520
1520
  () => [
1521
1521
  {
1522
1522
  Wrapper: ge,
1523
1523
  wrapperProps: n,
1524
- Icon: di,
1524
+ Icon: ui,
1525
1525
  text: "Edit"
1526
1526
  },
1527
1527
  {
1528
- Icon: ui,
1528
+ Icon: fi,
1529
1529
  buttonProps: {
1530
1530
  onClick: e
1531
1531
  },
@@ -1534,20 +1534,20 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1534
1534
  {
1535
1535
  Wrapper: ge,
1536
1536
  wrapperProps: a,
1537
- Icon: fi,
1537
+ Icon: mi,
1538
1538
  text: "Duplicate"
1539
1539
  },
1540
1540
  {
1541
1541
  Wrapper: ge,
1542
1542
  wrapperProps: o,
1543
- Icon: $e,
1543
+ Icon: Ve,
1544
1544
  text: "Add after"
1545
1545
  },
1546
1546
  {
1547
1547
  // Wrapping icon in a div so that the asChild turns the button into a div
1548
1548
  // so that the drag handle props are not applied to the icon
1549
1549
  // Note: b/c the <button> does not handle the space-press event correctly
1550
- Icon: (l) => /* @__PURE__ */ r("div", { ...l, children: /* @__PURE__ */ r(mi, {}) }),
1550
+ Icon: (l) => /* @__PURE__ */ r("div", { ...l, children: /* @__PURE__ */ r(pi, {}) }),
1551
1551
  text: "Reorder",
1552
1552
  disableOnMobile: !0,
1553
1553
  buttonProps: { ...t, asChild: !0 }
@@ -1555,25 +1555,25 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1555
1555
  ],
1556
1556
  [t, a, n, o, e]
1557
1557
  );
1558
- return /* @__PURE__ */ b(ht, { children: [
1559
- /* @__PURE__ */ r(y, { gap: "4", display: ft(!1, "flex"), children: c.map((l) => {
1560
- const f = l.Wrapper ?? ut;
1558
+ return /* @__PURE__ */ b(Xe, { children: [
1559
+ /* @__PURE__ */ r(w, { gap: "4", display: pt(!1, "flex"), children: c.map((l) => {
1560
+ const f = l.Wrapper ?? mt;
1561
1561
  return /* @__PURE__ */ r(f, { ...l.wrapperProps, children: /* @__PURE__ */ r(de, { type: "button", variant: "ghost", "aria-label": l.text, ...l.buttonProps, children: /* @__PURE__ */ r(l.Icon, {}) }) }, l.text);
1562
1562
  }) }),
1563
- /* @__PURE__ */ r(be, { display: ft(!0, "block"), children: /* @__PURE__ */ r(
1564
- pi,
1563
+ /* @__PURE__ */ r(be, { display: pt(!0, "block"), children: /* @__PURE__ */ r(
1564
+ hi,
1565
1565
  {
1566
- trigger: /* @__PURE__ */ r(de, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(hi, {}) }),
1566
+ trigger: /* @__PURE__ */ r(de, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(gi, {}) }),
1567
1567
  closeOnSelect: !1,
1568
1568
  items: c.map((l) => {
1569
1569
  var d;
1570
1570
  if (l.disableOnMobile)
1571
1571
  return null;
1572
- const f = l.Wrapper ?? ut;
1572
+ const f = l.Wrapper ?? mt;
1573
1573
  return {
1574
1574
  ...l.buttonProps,
1575
1575
  onSelect: (d = l.buttonProps) == null ? void 0 : d.onClick,
1576
- content: /* @__PURE__ */ r(f, { ...l.wrapperProps, children: /* @__PURE__ */ b(y, { gap: "2", align: "center", children: [
1576
+ content: /* @__PURE__ */ r(f, { ...l.wrapperProps, children: /* @__PURE__ */ b(w, { gap: "2", align: "center", children: [
1577
1577
  /* @__PURE__ */ r(l.Icon, {}),
1578
1578
  l.text
1579
1579
  ] }) })
@@ -1582,7 +1582,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1582
1582
  }
1583
1583
  ) })
1584
1584
  ] });
1585
- }), Ne = "form-builder", mn = z(function(i) {
1585
+ }), Ne = "form-builder", pn = z(function(i) {
1586
1586
  const { field: e, index: t, sectionIndex: n, takenLabels: o, remove: a, getFieldNodeMap: c } = i, l = C(() => Oe(e), [e]), f = ke(l, { formId: Ne, disabled: !0 }), d = T(
1587
1587
  (m) => {
1588
1588
  if (m.label === null)
@@ -1613,28 +1613,28 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1613
1613
  }),
1614
1614
  [t, n]
1615
1615
  );
1616
- return /* @__PURE__ */ r(et, { draggableId: e.identifier, index: t, children: (m) => /* @__PURE__ */ r(
1616
+ return /* @__PURE__ */ r(tt, { draggableId: e.identifier, index: t, children: (m) => /* @__PURE__ */ r(
1617
1617
  ve,
1618
1618
  {
1619
1619
  ref: m.innerRef,
1620
1620
  ...m.draggableProps,
1621
1621
  ...m.dragHandleProps,
1622
+ id: `${e.identifier}-card`,
1622
1623
  mb: "4",
1623
1624
  children: /* @__PURE__ */ b(
1624
- y,
1625
+ w,
1625
1626
  {
1626
- ref: (w) => {
1627
+ ref: (v) => {
1627
1628
  const x = c();
1628
- w ? x.set(e.identifier, w) : x.delete(e.identifier);
1629
+ v ? x.set(e.identifier, v) : x.delete(e.identifier);
1629
1630
  },
1630
- id: `${e.identifier}-flex`,
1631
1631
  gap: "4",
1632
1632
  justify: "between",
1633
1633
  align: "center",
1634
1634
  children: [
1635
1635
  f,
1636
1636
  /* @__PURE__ */ r(
1637
- Rt,
1637
+ Bt,
1638
1638
  {
1639
1639
  remove: a,
1640
1640
  editProps: u,
@@ -1648,12 +1648,12 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1648
1648
  )
1649
1649
  }
1650
1650
  ) });
1651
- }), pn = z(function(i) {
1651
+ }), hn = z(function(i) {
1652
1652
  var O, _, M, B, A, q, Y;
1653
- const { field: e, index: t, dropState: n, getFieldNodeMap: o } = i, a = (O = n[e.identifier]) == null ? void 0 : O.disabled, { setFieldValue: c, values: l } = he(), f = gi(), d = Pt(l.fields), u = T(
1653
+ const { field: e, index: t, dropState: n, getFieldNodeMap: o } = i, a = (O = n[e.identifier]) == null ? void 0 : O.disabled, { setFieldValue: c, values: l } = he(), f = bi(), d = Lt(l.fields), u = T(
1654
1654
  (E, S) => {
1655
- for (const V of E) {
1656
- const D = S.indexOf(V);
1655
+ for (const $ of E) {
1656
+ const D = S.indexOf($);
1657
1657
  c(`fields.${D}.condition`, null).then(), c(`fields.${D}.conditional`, !1).then();
1658
1658
  }
1659
1659
  },
@@ -1664,20 +1664,20 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1664
1664
  const S = e.fields[E];
1665
1665
  if (!S)
1666
1666
  throw new Error("Could not find field to remove.");
1667
- const V = [];
1667
+ const $ = [];
1668
1668
  for (const W of l.fields)
1669
- ((D = W.condition) == null ? void 0 : D.identifier) === S.identifier && V.push(W);
1669
+ ((D = W.condition) == null ? void 0 : D.identifier) === S.identifier && $.push(W);
1670
1670
  return {
1671
1671
  removing: S,
1672
- affectedSections: V,
1672
+ affectedSections: $,
1673
1673
  action: () => c(`fields.${t}.fields`, ze(e.fields, E))
1674
1674
  };
1675
1675
  },
1676
1676
  [e.fields, l.fields, c, t]
1677
1677
  ), g = T(
1678
1678
  (E) => {
1679
- const { affectedSections: S, action: V, removing: D } = h(E), W = () => {
1680
- V().then(), u(S, l.fields);
1679
+ const { affectedSections: S, action: $, removing: D } = h(E), W = () => {
1680
+ $().then(), u(S, l.fields);
1681
1681
  };
1682
1682
  if (S.length > 0) {
1683
1683
  const Re = S.map((Ie) => Ie.label).join(", ");
@@ -1693,20 +1693,20 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1693
1693
  },
1694
1694
  [h, u, l.fields, f]
1695
1695
  ), m = T(() => {
1696
- const S = e.fields.map((Fe, Bt) => h(Bt)).flatMap((Fe) => Fe.affectedSections), V = S.length ? "Remove fields and conditions?" : "Remove fields?", D = e.fields.length, W = S.map((Fe) => Fe.label).join(", "), Re = S.length ? `Deleting this section will remove the ${D} field(s) it contains and will remove the conditions from following sections: ${W}` : `Deleting this section will remove the ${D} field(s) it contains.`, Ie = ze(l.fields, t), lt = () => c("fields", Ie);
1696
+ const S = e.fields.map((Fe, qt) => h(qt)).flatMap((Fe) => Fe.affectedSections), $ = S.length ? "Remove fields and conditions?" : "Remove fields?", D = e.fields.length, W = S.map((Fe) => Fe.label).join(", "), Re = S.length ? `Deleting this section will remove the ${D} field(s) it contains and will remove the conditions from following sections: ${W}` : `Deleting this section will remove the ${D} field(s) it contains.`, Ie = ze(l.fields, t), at = () => c("fields", Ie);
1697
1697
  if (S.length > 0)
1698
1698
  return f({
1699
- title: V,
1699
+ title: $,
1700
1700
  description: Re,
1701
1701
  severity: "danger",
1702
1702
  actionText: "Remove",
1703
1703
  onAction: () => {
1704
- lt().then(() => {
1704
+ at().then(() => {
1705
1705
  u(S, Ie);
1706
1706
  });
1707
1707
  }
1708
1708
  });
1709
- lt().then();
1709
+ at().then();
1710
1710
  }, [
1711
1711
  e.fields,
1712
1712
  l.fields,
@@ -1715,19 +1715,19 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1715
1715
  c,
1716
1716
  f,
1717
1717
  u
1718
- ]), w = T(
1718
+ ]), v = T(
1719
1719
  (E) => {
1720
1720
  if (E.label === null)
1721
1721
  throw new Error(`Expected a label for field ${E.identifier}`);
1722
- const S = Ue(E.label, d), V = E.fields.map((D) => {
1722
+ const S = Ue(E.label, d), $ = E.fields.map((D) => {
1723
1723
  const W = Ue(D.label, d);
1724
1724
  return {
1725
1725
  ...D,
1726
1726
  label: W,
1727
- identifier: Et(void 0, W)
1727
+ identifier: At(void 0, W)
1728
1728
  };
1729
1729
  });
1730
- return { ...E, label: S, fields: V, identifier: "" };
1730
+ return { ...E, label: S, fields: $, identifier: "" };
1731
1731
  },
1732
1732
  [d]
1733
1733
  ), x = C(
@@ -1739,7 +1739,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1739
1739
  conditionalSourceFields: Ce(l.fields, t)
1740
1740
  }),
1741
1741
  [e, t, l.fields]
1742
- ), v = C(
1742
+ ), y = C(
1743
1743
  () => ({
1744
1744
  index: t + 1,
1745
1745
  parentPath: "fields",
@@ -1758,97 +1758,109 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1758
1758
  () => ({
1759
1759
  index: t + 1,
1760
1760
  parentPath: "fields",
1761
- initial: w(e),
1761
+ initial: v(e),
1762
1762
  conditionalSourceFields: Ce(l.fields, t + 1)
1763
1763
  }),
1764
- [w, e, t, l.fields]
1764
+ [v, e, t, l.fields]
1765
1765
  ), P = C(
1766
1766
  () => {
1767
1767
  var E, S;
1768
- return (S = At(l.fields, (E = e.condition) == null ? void 0 : E.identifier)) == null ? void 0 : S.label;
1768
+ return (S = Pt(l.fields, (E = e.condition) == null ? void 0 : E.identifier)) == null ? void 0 : S.label;
1769
1769
  },
1770
1770
  [(_ = e.condition) == null ? void 0 : _.identifier, l.fields]
1771
1771
  ), F = Array.isArray((M = e.condition) == null ? void 0 : M.value) ? "contains all of" : "equals";
1772
1772
  if (Ke((B = e.condition) == null ? void 0 : B.value))
1773
1773
  throw new Error("File values are not supported for conditions.");
1774
1774
  const L = Array.isArray((A = e.condition) == null ? void 0 : A.value) ? (q = e.condition) == null ? void 0 : q.value.map((E) => typeof E == "string" ? E : E.label).join(", ") : (Y = e.condition) == null ? void 0 : Y.value.toString();
1775
- return console.log("field", e), /* @__PURE__ */ r(et, { draggableId: e.identifier, index: t, children: (E) => /* @__PURE__ */ r(
1776
- ve,
1777
- {
1778
- ref: E.innerRef,
1779
- ...E.draggableProps,
1780
- ...E.dragHandleProps,
1781
- mb: "4",
1782
- children: /* @__PURE__ */ b(
1783
- y,
1784
- {
1785
- ref: (S) => {
1786
- const V = o();
1787
- S ? V.set(e.identifier, S) : V.delete(e.identifier);
1788
- },
1789
- id: `${e.identifier}-flex`,
1790
- gap: "3",
1791
- justify: "between",
1792
- align: "center",
1793
- children: [
1794
- /* @__PURE__ */ b(y, { direction: "column", gap: "2", grow: "1", children: [
1795
- /* @__PURE__ */ b(y, { direction: "column", children: [
1796
- /* @__PURE__ */ r(De, { as: "h3", size: "3", children: e.label }),
1797
- /* @__PURE__ */ r($, { className: Me.description, children: e.description })
1775
+ return console.log("field", e), /* @__PURE__ */ r(tt, { draggableId: e.identifier, index: t, children: (E) => /* @__PURE__ */ b(w, { direction: "row", justify: "center", align: "center", children: [
1776
+ /* @__PURE__ */ r("div", { id: `${e.identifier}-floating-point`, style: { width: "1%", margin: "0 3 0 4" } }),
1777
+ /* @__PURE__ */ r(
1778
+ ve,
1779
+ {
1780
+ ref: E.innerRef,
1781
+ ...E.draggableProps,
1782
+ ...E.dragHandleProps,
1783
+ id: `${e.identifier}-card`,
1784
+ mb: "4",
1785
+ style: { flexGrow: "1" },
1786
+ children: /* @__PURE__ */ b(
1787
+ w,
1788
+ {
1789
+ ref: (S) => {
1790
+ const $ = o();
1791
+ S ? $.set(e.identifier, S) : $.delete(e.identifier);
1792
+ },
1793
+ gap: "3",
1794
+ justify: "between",
1795
+ align: "center",
1796
+ children: [
1797
+ /* @__PURE__ */ b(w, { direction: "column", gap: "2", grow: "1", children: [
1798
+ /* @__PURE__ */ b(w, { direction: "column", children: [
1799
+ /* @__PURE__ */ r(De, { as: "h3", size: "3", children: e.label }),
1800
+ /* @__PURE__ */ r(V, { className: Me.description, children: e.description })
1801
+ ] }),
1802
+ e.condition && /* @__PURE__ */ r(V, { size: "1", children: /* @__PURE__ */ b(yi, { children: [
1803
+ "Display only if ",
1804
+ /* @__PURE__ */ r(ct, { children: P }),
1805
+ " ",
1806
+ F,
1807
+ " ",
1808
+ /* @__PURE__ */ r(ct, { children: L })
1809
+ ] }) }),
1810
+ /* @__PURE__ */ r(
1811
+ et,
1812
+ {
1813
+ droppableId: e.identifier,
1814
+ type: "SECTION",
1815
+ isDropDisabled: a,
1816
+ children: (S) => /* @__PURE__ */ b(
1817
+ w,
1818
+ {
1819
+ ref: S.innerRef,
1820
+ ...S.droppableProps,
1821
+ direction: "column",
1822
+ gap: "0",
1823
+ children: [
1824
+ e.fields.map(($, D) => /* @__PURE__ */ r(
1825
+ pn,
1826
+ {
1827
+ field: $,
1828
+ index: D,
1829
+ sectionIndex: t,
1830
+ remove: () => g(D),
1831
+ takenLabels: d,
1832
+ getFieldNodeMap: o
1833
+ },
1834
+ $.identifier
1835
+ )),
1836
+ S.placeholder,
1837
+ /* @__PURE__ */ r(ge, { ...I, children: /* @__PURE__ */ b(K, { type: "button", variant: "outline", children: [
1838
+ /* @__PURE__ */ r(Ve, {}),
1839
+ " Add a field"
1840
+ ] }) })
1841
+ ]
1842
+ }
1843
+ )
1844
+ }
1845
+ )
1798
1846
  ] }),
1799
- e.condition && /* @__PURE__ */ r($, { size: "1", children: /* @__PURE__ */ b(bi, { children: [
1800
- "Display only if ",
1801
- /* @__PURE__ */ r(at, { children: P }),
1802
- " ",
1803
- F,
1804
- " ",
1805
- /* @__PURE__ */ r(at, { children: L })
1806
- ] }) }),
1807
- /* @__PURE__ */ r(Ze, { droppableId: e.identifier, type: "SECTION", isDropDisabled: a, children: (S) => /* @__PURE__ */ b(
1808
- y,
1847
+ /* @__PURE__ */ r(
1848
+ Bt,
1809
1849
  {
1810
- ref: S.innerRef,
1811
- ...S.droppableProps,
1812
- direction: "column",
1813
- gap: "0",
1814
- children: [
1815
- e.fields.map((V, D) => /* @__PURE__ */ r(
1816
- mn,
1817
- {
1818
- field: V,
1819
- index: D,
1820
- sectionIndex: t,
1821
- remove: () => g(D),
1822
- takenLabels: d,
1823
- getFieldNodeMap: o
1824
- },
1825
- V.identifier
1826
- )),
1827
- S.placeholder,
1828
- /* @__PURE__ */ r(ge, { ...I, children: /* @__PURE__ */ b(K, { type: "button", variant: "outline", children: [
1829
- /* @__PURE__ */ r($e, {}),
1830
- " Add a field"
1831
- ] }) })
1832
- ]
1850
+ remove: m,
1851
+ insertAfterProps: y,
1852
+ dragHandleProps: E.dragHandleProps,
1853
+ editProps: x,
1854
+ duplicateProps: k
1833
1855
  }
1834
- ) })
1835
- ] }),
1836
- /* @__PURE__ */ r(
1837
- Rt,
1838
- {
1839
- remove: m,
1840
- insertAfterProps: v,
1841
- dragHandleProps: E.dragHandleProps,
1842
- editProps: x,
1843
- duplicateProps: k
1844
- }
1845
- )
1846
- ]
1847
- }
1848
- )
1849
- }
1850
- ) });
1851
- }), hn = (s, i) => {
1856
+ )
1857
+ ]
1858
+ }
1859
+ )
1860
+ }
1861
+ )
1862
+ ] }) });
1863
+ }), gn = (s, i) => {
1852
1864
  var t;
1853
1865
  const e = { ...s };
1854
1866
  switch (i.type) {
@@ -1863,7 +1875,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1863
1875
  case "update":
1864
1876
  return i.state;
1865
1877
  }
1866
- }, gn = (s, i) => {
1878
+ }, bn = (s, i) => {
1867
1879
  if (i)
1868
1880
  for (let e = 0; e < s.length; e++) {
1869
1881
  const t = s[e];
@@ -1873,7 +1885,7 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1873
1885
  return e;
1874
1886
  }
1875
1887
  }
1876
- }, mt = (s) => {
1888
+ }, ht = (s) => {
1877
1889
  var e, t, n;
1878
1890
  const i = {};
1879
1891
  for (let o = 0; o < s.length; o++) {
@@ -1884,29 +1896,29 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1884
1896
  (t = a.condition) != null && t.identifier && l.add(a.condition.identifier), i[a.identifier] = {
1885
1897
  disabled: !1,
1886
1898
  conditionFields: l,
1887
- conditionIndex: gn(s, (n = a.condition) == null ? void 0 : n.identifier),
1899
+ conditionIndex: bn(s, (n = a.condition) == null ? void 0 : n.identifier),
1888
1900
  index: o,
1889
1901
  label: a.label
1890
1902
  };
1891
1903
  }
1892
1904
  return i;
1893
- }, pt = (s, i) => {
1905
+ }, gt = (s, i) => {
1894
1906
  for (const [e, t] of Object.entries(s))
1895
1907
  if (t.identifier === i)
1896
1908
  return [t, e];
1897
- }, bn = z(function() {
1898
- const { values: i, setFieldValue: e } = he(), t = wt(null), [n, o] = X([]), [a, c] = vi(hn, i.fields, mt), { showInfo: l } = yi();
1909
+ }, yn = z(function() {
1910
+ const { values: i, setFieldValue: e } = he(), t = vt(null), [n, o] = X([]), [a, c] = xi(gn, i.fields, ht), { showInfo: l } = wi();
1899
1911
  ue(() => {
1900
- c({ type: "update", state: mt(i.fields) });
1912
+ c({ type: "update", state: ht(i.fields) });
1901
1913
  }, [c, i.fields]);
1902
1914
  const f = T((m) => {
1903
1915
  m.type === "SECTION" && c({ type: "hold", fieldId: m.draggableId });
1904
1916
  }, []), d = T(
1905
1917
  (m) => {
1906
- const { source: w, destination: x, type: v, reason: I, draggableId: k } = m;
1918
+ const { source: v, destination: x, type: y, reason: I, draggableId: k } = m;
1907
1919
  if (c({ type: "release" }), !x || I === "CANCEL")
1908
1920
  return;
1909
- if (v === "ROOT") {
1921
+ if (y === "ROOT") {
1910
1922
  const _ = a[k];
1911
1923
  if (!_)
1912
1924
  throw new Error("Could not find section context.");
@@ -1915,29 +1927,29 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1915
1927
  Math.max(_.conditionIndex + 1, x.index)
1916
1928
  ) : x.index;
1917
1929
  for (const B of Object.values(a))
1918
- B.conditionIndex === w.index && (M = Math.min(M, B.index - 1));
1930
+ B.conditionIndex === v.index && (M = Math.min(M, B.index - 1));
1919
1931
  return M != x.index && l({
1920
1932
  title: "Reordered sections",
1921
1933
  description: "Sections with conditions must be below the fields they reference."
1922
- }), e("fields", He(i.fields, w.index, M));
1934
+ }), e("fields", He(i.fields, v.index, M));
1923
1935
  }
1924
- if (v !== "SECTION")
1936
+ if (y !== "SECTION")
1925
1937
  throw new Error("Unexpected droppable type.");
1926
- const [P, F] = pt(i.fields, w.droppableId) ?? [], [L, O] = pt(i.fields, x.droppableId) ?? [];
1938
+ const [P, F] = gt(i.fields, v.droppableId) ?? [], [L, O] = gt(i.fields, x.droppableId) ?? [];
1927
1939
  if (!(P != null && P.fields) || !L)
1928
1940
  throw new Error("Could not find section with fields.");
1929
1941
  if (P.identifier === L.identifier)
1930
1942
  e(
1931
1943
  `fields.${F}.fields`,
1932
- He(P.fields, w.index, x.index)
1944
+ He(P.fields, v.index, x.index)
1933
1945
  ).then();
1934
1946
  else {
1935
- const _ = P.fields[w.index];
1947
+ const _ = P.fields[v.index];
1936
1948
  if (!_)
1937
1949
  throw new Error("Could not find field to reorder.");
1938
- e(`fields.${F}.fields`, ze(P.fields, w.index)).then(), e(
1950
+ e(`fields.${F}.fields`, ze(P.fields, v.index)).then(), e(
1939
1951
  `fields.${O}.fields`,
1940
- zt(L.fields, x.index, _)
1952
+ Et(L.fields, x.index, _)
1941
1953
  ).then();
1942
1954
  }
1943
1955
  },
@@ -1952,36 +1964,49 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1952
1964
  [i.fields]
1953
1965
  ), h = T(() => (t.current === null && (t.current = /* @__PURE__ */ new Map()), t.current), []), g = T((m) => {
1954
1966
  console.log("in callback", m, m.getBoundingClientRect());
1955
- const { top: w, bottom: x, left: v } = m.getBoundingClientRect();
1956
- return { x: v + window.scrollX, y: (x - w) / 2 + window.scrollY };
1967
+ const { top: v, bottom: x, left: y } = m.getBoundingClientRect();
1968
+ return { x: y + window.scrollX, y: (x - v) / 2 + window.scrollY };
1957
1969
  }, []);
1958
1970
  return ue(() => {
1959
1971
  const m = () => {
1960
1972
  console.log("generatearrows ran", i.fields);
1961
- const w = i.fields.filter((v) => v.conditional), x = h();
1962
- return w.map((v) => {
1973
+ const v = i.fields.filter((y) => y.conditional), x = h();
1974
+ return v.map((y) => {
1963
1975
  var P, F;
1964
- const I = x.get(v.identifier), k = ((P = v.condition) == null ? void 0 : P.identifier) && x.get(v.condition.identifier);
1965
- return !I || !k || ((F = v.condition) == null ? void 0 : F.identifier) === void 0 ? null : /* @__PURE__ */ r(
1966
- Li,
1967
- {
1968
- start: `${v.identifier}-flex`,
1969
- end: `${v.condition.identifier}-flex`,
1970
- startAnchor: "left",
1971
- endAnchor: "left",
1972
- color: "black",
1973
- strokeWidth: 2,
1974
- path: "straight"
1975
- },
1976
- v.identifier
1977
- );
1976
+ const I = x.get(y.identifier), k = ((P = y.condition) == null ? void 0 : P.identifier) && x.get(y.condition.identifier);
1977
+ return !I || !k || ((F = y.condition) == null ? void 0 : F.identifier) === void 0 ? null : /* @__PURE__ */ b(Ii, { children: [
1978
+ /* @__PURE__ */ r(
1979
+ dt,
1980
+ {
1981
+ start: `${y.identifier}-card`,
1982
+ end: `${y.identifier}-floating-point`,
1983
+ startAnchor: "left",
1984
+ endAnchor: "right",
1985
+ color: "blue",
1986
+ strokeWidth: 2,
1987
+ path: "straight"
1988
+ }
1989
+ ),
1990
+ /* @__PURE__ */ r(
1991
+ dt,
1992
+ {
1993
+ start: `${y.identifier}-floating-point`,
1994
+ end: `${y.condition.identifier}-card`,
1995
+ startAnchor: "right",
1996
+ endAnchor: "left",
1997
+ color: "blue",
1998
+ strokeWidth: 2,
1999
+ path: "straight"
2000
+ }
2001
+ )
2002
+ ] }, y.identifier);
1978
2003
  });
1979
2004
  };
1980
2005
  console.log("useeffect ran"), o(m());
1981
- }, [h, g, i.fields]), /* @__PURE__ */ r(vt, { onDragStart: f, onDragEnd: d, children: /* @__PURE__ */ r(Ze, { droppableId: "droppable", type: "ROOT", children: (m) => /* @__PURE__ */ b(y, { direction: "row", children: [
1982
- /* @__PURE__ */ r("div", { style: { width: "10%" }, children: n }),
2006
+ }, [h, g, i.fields]), /* @__PURE__ */ r(xt, { onDragStart: f, onDragEnd: d, children: /* @__PURE__ */ r(et, { droppableId: "droppable", type: "ROOT", children: (m) => /* @__PURE__ */ b(Xe, { children: [
2007
+ n,
1983
2008
  /* @__PURE__ */ b(
1984
- y,
2009
+ w,
1985
2010
  {
1986
2011
  ref: m.innerRef,
1987
2012
  ...m.droppableProps,
@@ -1989,68 +2014,68 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
1989
2014
  gap: "0",
1990
2015
  grow: "1",
1991
2016
  children: [
1992
- i.fields.map((w, x) => /* @__PURE__ */ r(
1993
- pn,
2017
+ i.fields.map((v, x) => /* @__PURE__ */ r(
2018
+ hn,
1994
2019
  {
1995
- field: w,
2020
+ field: v,
1996
2021
  index: x,
1997
2022
  dropState: a,
1998
2023
  getFieldNodeMap: h
1999
2024
  },
2000
- w.label
2025
+ v.label
2001
2026
  )),
2002
2027
  m.placeholder,
2003
2028
  /* @__PURE__ */ r(ge, { ...u, children: /* @__PURE__ */ b(K, { type: "button", variant: "outline", children: [
2004
- /* @__PURE__ */ r($e, {}),
2029
+ /* @__PURE__ */ r(Ve, {}),
2005
2030
  " Add a section"
2006
2031
  ] }) })
2007
2032
  ]
2008
2033
  }
2009
2034
  )
2010
2035
  ] }) }) });
2011
- }), yn = {
2036
+ }), wn = {
2012
2037
  title: "",
2013
2038
  description: "",
2014
2039
  fields: []
2015
- }, wn = new ye({
2040
+ }, vn = new ye({
2016
2041
  label: "Title",
2017
2042
  minLength: 0,
2018
2043
  maxLength: 100,
2019
2044
  required: !0,
2020
2045
  identifier: "title"
2021
- }), vn = { formId: Ne, placeholder: "Give your form a title." }, xn = new we({
2046
+ }), xn = { formId: Ne, placeholder: "Give your form a title." }, In = new we({
2022
2047
  label: "Description",
2023
2048
  minLength: 0,
2024
2049
  maxLength: 1e3,
2025
2050
  required: !1,
2026
2051
  identifier: "description"
2027
- }), In = { formId: Ne, placeholder: "Explain the purpose of this form." }, Fn = () => {
2052
+ }), Fn = { formId: Ne, placeholder: "Explain the purpose of this form." }, Cn = () => {
2028
2053
  alert("This is a form preview, your data will not be saved.");
2029
- }, Nn = z(
2054
+ }, Rn = z(
2030
2055
  xe((s, i) => {
2031
2056
  const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: a = o } = s, c = T((g) => {
2032
2057
  const m = {};
2033
- if (g.title || (m.title = "Title is required."), (!g.fields || g.fields.length === 0) && (m.fields = "At least one field is required."), Ve(m))
2058
+ if (g.title || (m.title = "Title is required."), (!g.fields || g.fields.length === 0) && (m.fields = "At least one field is required."), $e(m))
2034
2059
  return m;
2035
- }, []), l = Qe({
2036
- initialValues: Ri(n) ?? yn,
2060
+ }, []), l = Je({
2061
+ initialValues: Bi(n) ?? wn,
2037
2062
  validate: c,
2038
2063
  onSubmit: (g) => t(g),
2039
2064
  // only validate the entire for on submit
2040
2065
  validateOnChange: !1,
2041
2066
  validateOnBlur: !1
2042
- }), f = C(() => Vt(l.values), [l.values]), d = ke(wn, vn), u = ke(xn, In), h = C(
2067
+ }), f = C(() => Vt(l.values), [l.values]), d = ke(vn, xn), u = ke(In, Fn), h = C(
2043
2068
  () => typeof a == "object" ? a : /* @__PURE__ */ r(De, { children: a }),
2044
2069
  [a]
2045
2070
  );
2046
- return /* @__PURE__ */ r(Z.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
2071
+ return /* @__PURE__ */ r(Z.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ b(w, { direction: "column", gap: "2", children: [
2047
2072
  /* @__PURE__ */ b(Z.List, { children: [
2048
2073
  /* @__PURE__ */ r(Z.Trigger, { value: "edit", children: "Edit" }),
2049
2074
  /* @__PURE__ */ r(Z.Trigger, { value: "preview", children: "Preview" })
2050
2075
  ] }),
2051
2076
  /* @__PURE__ */ b(Z.Content, { value: "edit", children: [
2052
2077
  h,
2053
- /* @__PURE__ */ b($, { children: [
2078
+ /* @__PURE__ */ b(V, { children: [
2054
2079
  "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",
2055
2080
  " ",
2056
2081
  /* @__PURE__ */ r("em", { children: "Preview" }),
@@ -2058,53 +2083,53 @@ const ke = (s, i) => C(() => !i || !s ? null : s.getInput(i), [s, i]), Dt = (s,
2058
2083
  " ",
2059
2084
  /* @__PURE__ */ r("strong", { children: "field values entered on this page will not be saved." })
2060
2085
  ] }),
2061
- /* @__PURE__ */ r(y, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ b("form", { id: Ne, onSubmit: l.handleSubmit, children: [
2062
- /* @__PURE__ */ b(Je, { value: l, children: [
2086
+ /* @__PURE__ */ r(w, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ b("form", { id: Ne, onSubmit: l.handleSubmit, children: [
2087
+ /* @__PURE__ */ b(Ze, { value: l, children: [
2063
2088
  d,
2064
2089
  u,
2065
- /* @__PURE__ */ r(bn, {}),
2066
- /* @__PURE__ */ r($, { severity: "danger", size: "1", children: typeof l.errors.fields == "string" && l.errors.fields })
2090
+ /* @__PURE__ */ r(yn, {}),
2091
+ /* @__PURE__ */ r(V, { severity: "danger", size: "1", children: typeof l.errors.fields == "string" && l.errors.fields })
2067
2092
  ] }),
2068
- /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
2093
+ /* @__PURE__ */ b(w, { justify: "end", gap: "2", children: [
2069
2094
  /* @__PURE__ */ r(K, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
2070
2095
  /* @__PURE__ */ r(K, { type: "submit", disabled: !l.isValid, children: "Save" })
2071
2096
  ] })
2072
2097
  ] }) })
2073
2098
  ] }),
2074
- /* @__PURE__ */ r(Z.Content, { value: "preview", children: /* @__PURE__ */ r(st, { schema: f, onSubmit: Fn }) })
2099
+ /* @__PURE__ */ r(Z.Content, { value: "preview", children: /* @__PURE__ */ r(lt, { schema: f, onSubmit: Cn }) })
2075
2100
  ] }) });
2076
2101
  })
2077
2102
  );
2078
2103
  export {
2079
2104
  me as BooleanField,
2080
- $i as BooleanInput,
2105
+ Di as BooleanInput,
2081
2106
  je as DateField,
2082
- _i as DateInput,
2107
+ Mi as DateInput,
2083
2108
  J as FieldSection,
2084
- Dn as FormBrowser,
2085
- Nn as FormBuilder,
2086
- st as FormRenderer,
2087
- _n as FormSubmissionBrowser,
2088
- $n as FormSubmissionViewer,
2109
+ _n as FormBrowser,
2110
+ Rn as FormBuilder,
2111
+ lt as FormRenderer,
2112
+ Mn as FormSubmissionBrowser,
2113
+ Dn as FormSubmissionViewer,
2089
2114
  Pe as MultiSelectField,
2090
- ji as MultiSelectInput,
2115
+ Hi as MultiSelectInput,
2091
2116
  Ee as MultiStringField,
2092
- qi as MultiStringInput,
2117
+ Wi as MultiStringInput,
2093
2118
  Q as NumberField,
2094
- Di as NumberInput,
2095
- Mn as PatchField,
2096
- On as PatchFormProvider,
2119
+ _i as NumberInput,
2120
+ On as PatchField,
2121
+ Nn as PatchFormProvider,
2097
2122
  Ae as SelectField,
2098
- Ni as SelectInput,
2123
+ Ri as SelectInput,
2099
2124
  ye as StringField,
2100
- Mi as StringInput,
2125
+ Oi as StringInput,
2101
2126
  we as TextField,
2102
- Oi as TextInput,
2127
+ Ni as TextInput,
2103
2128
  Oe as deserialize,
2104
- kt as deserializeField,
2129
+ $t as deserializeField,
2105
2130
  Vt as formRevisionToSchema,
2106
- $t as isConditionMet,
2131
+ Dt as isConditionMet,
2107
2132
  ke as useFieldInput,
2108
- Dt as useFieldInputs,
2133
+ _t as useFieldInputs,
2109
2134
  Ke as valueIsFile
2110
2135
  };