@arudovwen/form-builder-react 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  import { jsx as i, Fragment as ve, jsxs as b } from "react/jsx-runtime";
2
- import se, { createContext as xn, useState as D, useEffect as G, useRef as re, useMemo as ee, forwardRef as Zi, createElement as bi, Fragment as ze, useContext as ye, useCallback as Y, memo as Ze, Suspense as An } from "react";
2
+ import se, { createContext as xn, useState as D, useEffect as G, useRef as re, useMemo as ee, forwardRef as Zi, createElement as bi, Fragment as ze, useContext as ye, useCallback as Y, memo as Ze, Suspense as Sn } from "react";
3
3
  import { v4 as pe } from "uuid";
4
- import Sn from "react-datepicker";
5
- import { Listbox as ae, Transition as we, Combobox as De, ComboboxInput as Nn, ComboboxButton as kn, ComboboxOptions as Cn, ComboboxOption as Mn } from "@headlessui/react";
4
+ import An from "react-datepicker";
5
+ import { Listbox as ae, Transition as we, Combobox as De, ComboboxInput as Nn, ComboboxButton as Cn, ComboboxOptions as kn, ComboboxOption as Mn } from "@headlessui/react";
6
6
  import { toast as xe, Toaster as $i } from "sonner";
7
7
  import Pe from "axios";
8
8
  import $e from "react-currency-input-field";
9
9
  import { createPortal as wn } from "react-dom";
10
- import { appendErrors as Tn, useForm as Ai, useFieldArray as ni, useWatch as Bn, FormProvider as En } from "react-hook-form";
10
+ import { appendErrors as Tn, useForm as Si, useFieldArray as ni, useWatch as Bn, FormProvider as En } from "react-hook-form";
11
11
  import { validateFieldsNatively as Ln, toNestErrors as Pn } from "@hookform/resolvers";
12
12
  import * as R from "yup";
13
13
  import Rn from "papaparse";
@@ -43,16 +43,32 @@ const be = xn(void 0), Pi = {
43
43
  G(() => {
44
44
  n && n(m);
45
45
  }, [m, n]), G(() => {
46
- sessionStorage.setItem("editor_past", JSON.stringify(r));
46
+ try {
47
+ sessionStorage.setItem("editor_past", JSON.stringify(r));
48
+ } catch (O) {
49
+ console.warn("Could not save editor_past to sessionStorage", O);
50
+ }
47
51
  }, [r]), G(() => {
48
- sessionStorage.setItem("editor_future", JSON.stringify(v));
52
+ try {
53
+ sessionStorage.setItem("editor_future", JSON.stringify(v));
54
+ } catch (O) {
55
+ console.warn("Could not save editor_future to sessionStorage", O);
56
+ }
49
57
  }, [v]);
50
58
  const f = re(Date.now()), g = se.useCallback((O) => {
51
59
  c((B) => {
52
60
  const K = typeof O == "function" ? O(B) : O;
53
61
  if (JSON.stringify(B) !== JSON.stringify(K)) {
54
62
  const P = Date.now();
55
- h((E) => E.length > 0 && JSON.stringify(E[E.length - 1]) === JSON.stringify(B) ? E : P - f.current < 800 && E.length > 0 ? (f.current = P, E) : (f.current = P, [...E, B])), y([]);
63
+ h((L) => {
64
+ if (L.length > 0 && JSON.stringify(L[L.length - 1]) === JSON.stringify(B))
65
+ return L;
66
+ if (P - f.current < 800 && L.length > 0)
67
+ return f.current = P, L;
68
+ f.current = P;
69
+ const U = [...L, B];
70
+ return U.length > 20 ? U.slice(U.length - 20) : U;
71
+ }), y([]);
56
72
  }
57
73
  return K;
58
74
  });
@@ -64,59 +80,59 @@ const be = xn(void 0), Pi = {
64
80
  if (v.length === 0) return;
65
81
  const O = v[0], B = v.slice(1);
66
82
  y(B), h([...r, m]), c(O), a == null || a("REDO", null);
67
- }, [r, v, m, a]), S = m, C = r.length > 0, x = v.length > 0, [k, M] = D(!1), [w, A] = D(null), [T, I] = D([
83
+ }, [r, v, m, a]), A = m, k = r.length > 0, x = v.length > 0, [C, M] = D(!1), [w, S] = D(null), [T, I] = D([
68
84
  0
69
- ]), [L, F] = D(""), [Z, ie] = D(0), X = se.useCallback(() => {
85
+ ]), [E, F] = D(""), [Z, ie] = D(0), X = se.useCallback(() => {
70
86
  }, []), he = se.useCallback(() => {
71
87
  const O = pe();
72
- g((B) => [...B, { ...Pi, id: O }]), A(O), I([S.length]), a == null || a("ADD_SECTION", { sectionId: O });
73
- }, [S, a, g]), _ = se.useCallback(
88
+ g((B) => [...B, { ...Pi, id: O }]), S(O), I([A.length]), a == null || a("ADD_SECTION", { sectionId: O });
89
+ }, [A, a, g]), _ = se.useCallback(
74
90
  (O) => {
75
91
  g(
76
92
  (B) => B.filter((K) => K.id !== O)
77
- ), A(null), a == null || a("REMOVE_SECTION", { sectionId: O });
93
+ ), S(null), a == null || a("REMOVE_SECTION", { sectionId: O });
78
94
  },
79
95
  [a, g]
80
96
  ), V = se.useCallback(
81
97
  (O, B) => {
82
- const K = S.find((E) => E.id === B), P = K == null ? void 0 : K.questionData.find(
83
- (E) => E.id === O
98
+ const K = A.find((L) => L.id === B), P = K == null ? void 0 : K.questionData.find(
99
+ (L) => L.id === O
84
100
  );
85
101
  P && (g(
86
- (E) => E == null ? void 0 : E.map(
87
- (q) => q.id === B ? {
88
- ...q,
89
- questionData: q == null ? void 0 : q.questionData.filter(($) => P.type === "grid" ? $.gridId !== P.id && $.id !== P.id : $.id !== O)
90
- } : q
102
+ (L) => L == null ? void 0 : L.map(
103
+ (U) => U.id === B ? {
104
+ ...U,
105
+ questionData: U == null ? void 0 : U.questionData.filter(($) => P.type === "grid" ? $.gridId !== P.id && $.id !== P.id : $.id !== O)
106
+ } : U
91
107
  )
92
108
  ), a == null || a("REMOVE_ELEMENT", { sectionId: B, elementId: O }));
93
109
  },
94
- [S, g, a]
110
+ [A, g, a]
95
111
  ), ce = se.useCallback(
96
112
  (O, B) => {
97
- const K = S.find(($) => $.id === B);
113
+ const K = A.find(($) => $.id === B);
98
114
  if (!K) return;
99
115
  const P = K == null ? void 0 : K.questionData.findIndex(
100
116
  ($) => $.id === O
101
117
  );
102
118
  if (P === -1) return;
103
- const E = K == null ? void 0 : K.questionData[P], q = ($, j = {}) => ({
119
+ const L = K == null ? void 0 : K.questionData[P], U = ($, j = {}) => ({
104
120
  ...JSON.parse(JSON.stringify($)),
105
121
  id: pe(),
106
122
  ...j
107
123
  });
108
124
  g(
109
125
  ($) => $ == null ? void 0 : $.map((j) => {
110
- var U;
126
+ var W;
111
127
  if (j.id !== B) return j;
112
128
  const H = [...j.questionData];
113
- if (E.type === "grid") {
114
- const Q = (U = H == null ? void 0 : H.map((fe, ii) => ({ e: fe, i: ii })).filter(
115
- ({ e: fe }) => fe.id === E.id || fe.gridId === E.id
116
- )) == null ? void 0 : U.map(({ i: fe }) => fe), oe = Q.length ? Math.max(...Q) + 1 : P + 1, le = pe(), me = q(E, {});
129
+ if (L.type === "grid") {
130
+ const Q = (W = H == null ? void 0 : H.map((fe, ii) => ({ e: fe, i: ii })).filter(
131
+ ({ e: fe }) => fe.id === L.id || fe.gridId === L.id
132
+ )) == null ? void 0 : W.map(({ i: fe }) => fe), oe = Q.length ? Math.max(...Q) + 1 : P + 1, le = pe(), me = U(L, {});
117
133
  me.id = le;
118
- const te = H.filter((fe) => fe.gridId === E.id), Ne = te == null ? void 0 : te.map(
119
- (fe) => q(fe, { gridId: le })
134
+ const te = H.filter((fe) => fe.gridId === L.id), Ne = te == null ? void 0 : te.map(
135
+ (fe) => U(fe, { gridId: le })
120
136
  ), Le = [
121
137
  ...H.slice(0, oe),
122
138
  me,
@@ -124,9 +140,9 @@ const be = xn(void 0), Pi = {
124
140
  ...H.slice(oe)
125
141
  ];
126
142
  return { ...j, questionData: Le };
127
- } else if (E.gridId) {
128
- const { gridId: Q, gridPosition: oe, ...le } = E, me = q(le, {}), te = H.reduce(
129
- (Le, fe, ii) => fe.id === E.gridId || fe.gridId === E.gridId ? ii : Le,
143
+ } else if (L.gridId) {
144
+ const { gridId: Q, gridPosition: oe, ...le } = L, me = U(le, {}), te = H.reduce(
145
+ (Le, fe, ii) => fe.id === L.gridId || fe.gridId === L.gridId ? ii : Le,
130
146
  P
131
147
  ), Ne = [
132
148
  ...H.slice(0, te + 1),
@@ -135,7 +151,7 @@ const be = xn(void 0), Pi = {
135
151
  ];
136
152
  return { ...j, questionData: Ne };
137
153
  } else {
138
- const Q = q(E, {}), oe = [
154
+ const Q = U(L, {}), oe = [
139
155
  ...H.slice(0, P + 1),
140
156
  Q,
141
157
  ...H.slice(P + 1)
@@ -145,8 +161,8 @@ const be = xn(void 0), Pi = {
145
161
  })
146
162
  ), a == null || a("DUPLICATE_ELEMENT", { sectionId: B, elementId: O });
147
163
  },
148
- [S, g, a]
149
- ), Ae = se.useCallback(
164
+ [A, g, a]
165
+ ), Se = se.useCallback(
150
166
  (O, B) => {
151
167
  g(
152
168
  (K) => K == null ? void 0 : K.map(
@@ -171,33 +187,33 @@ const be = xn(void 0), Pi = {
171
187
  (O, B, K) => {
172
188
  g(
173
189
  (P) => P == null ? void 0 : P.map(
174
- (E) => E.id === B ? {
175
- ...E,
190
+ (L) => L.id === B ? {
191
+ ...L,
176
192
  questionData: [
177
- ...E == null ? void 0 : E.questionData.slice(0, K),
193
+ ...L == null ? void 0 : L.questionData.slice(0, K),
178
194
  O,
179
- ...E == null ? void 0 : E.questionData.slice(K)
195
+ ...L == null ? void 0 : L.questionData.slice(K)
180
196
  ]
181
- } : E
197
+ } : L
182
198
  )
183
199
  ), a == null || a("ADD_ELEMENT_IN_POSITION", { sectionId: B, element: O, index: K });
184
200
  },
185
201
  [g, a]
186
- ), Se = se.useCallback(
202
+ ), Ae = se.useCallback(
187
203
  (O, B, K) => {
188
204
  g(
189
205
  (P) => P == null ? void 0 : P.map(
190
- (E) => {
191
- var q;
192
- return E.id === K ? {
193
- ...E,
194
- questionData: (q = E == null ? void 0 : E.questionData) == null ? void 0 : q.map(
206
+ (L) => {
207
+ var U;
208
+ return L.id === K ? {
209
+ ...L,
210
+ questionData: (U = L == null ? void 0 : L.questionData) == null ? void 0 : U.map(
195
211
  ($) => {
196
212
  var j;
197
213
  return $.type === "grid" && $.gridData ? {
198
214
  ...$,
199
215
  gridData: (j = $.gridData) == null ? void 0 : j.map(
200
- (H, U) => U === O ? {
216
+ (H, W) => W === O ? {
201
217
  ...H,
202
218
  ...B
203
219
  } : H
@@ -207,22 +223,22 @@ const be = xn(void 0), Pi = {
207
223
  } : $;
208
224
  }
209
225
  )
210
- } : E;
226
+ } : L;
211
227
  }
212
228
  )
213
229
  ), a == null || a("UPDATE_GRID_ELEMENT", { sectionId: K, gridIndex: O, element: B });
214
230
  },
215
231
  [g, a]
216
- ), Ce = se.useCallback(
232
+ ), ke = se.useCallback(
217
233
  (O, B) => {
218
234
  g(
219
235
  (K) => K == null ? void 0 : K.map(
220
236
  (P) => {
221
- var E;
237
+ var L;
222
238
  return P.id === B ? {
223
239
  ...P,
224
- questionData: (E = P == null ? void 0 : P.questionData) == null ? void 0 : E.map(
225
- (q) => q.id === O.id ? { ...q, ...O } : q
240
+ questionData: (L = P == null ? void 0 : P.questionData) == null ? void 0 : L.map(
241
+ (U) => U.id === O.id ? { ...U, ...O } : U
226
242
  )
227
243
  } : P;
228
244
  }
@@ -236,28 +252,28 @@ const be = xn(void 0), Pi = {
236
252
  draggedId: B,
237
253
  sectionId: K,
238
254
  targetIndex: P,
239
- targetId: E,
240
- targetGridId: q,
255
+ targetId: L,
256
+ targetGridId: U,
241
257
  targetCol: $
242
258
  } = O;
243
259
  g(
244
260
  (j) => j.map((H) => {
245
261
  if (H.id !== K) return H;
246
- const U = [...H == null ? void 0 : H.questionData], Q = U.findIndex((le) => le.id === B);
262
+ const W = [...H == null ? void 0 : H.questionData], Q = W.findIndex((le) => le.id === B);
247
263
  if (Q === -1) return H;
248
- const oe = { ...U[Q] };
249
- if (q !== void 0 && $ !== void 0) {
264
+ const oe = { ...W[Q] };
265
+ if (U !== void 0 && $ !== void 0) {
250
266
  if (oe.type === "grid") return H;
251
- const le = U.findIndex(
267
+ const le = W.findIndex(
252
268
  (te) => {
253
269
  var Ne;
254
- return te.id !== B && te.gridId === q && ((Ne = te.gridPosition) == null ? void 0 : Ne.col) === $;
270
+ return te.id !== B && te.gridId === U && ((Ne = te.gridPosition) == null ? void 0 : Ne.col) === $;
255
271
  }
256
272
  );
257
- let me = U.map(
273
+ let me = W.map(
258
274
  (te) => te.id === B ? {
259
275
  ...te,
260
- gridId: q,
276
+ gridId: U,
261
277
  gridPosition: { col: $ }
262
278
  } : te
263
279
  );
@@ -267,20 +283,20 @@ const be = xn(void 0), Pi = {
267
283
  return delete Le.gridId, delete Le.gridPosition, Le;
268
284
  })), { ...H, questionData: me };
269
285
  }
270
- if (oe.gridId && P !== void 0 && q === void 0) {
286
+ if (oe.gridId && P !== void 0 && U === void 0) {
271
287
  const le = { ...oe };
272
288
  delete le.gridId, delete le.gridPosition;
273
- const me = U.filter((Ne) => Ne.id !== B), te = Math.min(P, me.length);
289
+ const me = W.filter((Ne) => Ne.id !== B), te = Math.min(P, me.length);
274
290
  return me.splice(te, 0, le), { ...H, questionData: me };
275
291
  }
276
- if (!oe.gridId && P !== void 0 && q === void 0 && !E) {
277
- U.splice(Q, 1);
278
- const le = Math.min(P, U.length);
279
- return U.splice(le, 0, oe), { ...H, questionData: U };
292
+ if (!oe.gridId && P !== void 0 && U === void 0 && !L) {
293
+ W.splice(Q, 1);
294
+ const le = Math.min(P, W.length);
295
+ return W.splice(le, 0, oe), { ...H, questionData: W };
280
296
  }
281
- if (E) {
282
- const le = U.findIndex((me) => me.id === E);
283
- return le === -1 ? H : (U.splice(Q, 1), U.splice(le, 0, oe), { ...H, questionData: U });
297
+ if (L) {
298
+ const le = W.findIndex((me) => me.id === L);
299
+ return le === -1 ? H : (W.splice(Q, 1), W.splice(le, 0, oe), { ...H, questionData: W });
284
300
  }
285
301
  return H;
286
302
  })
@@ -301,29 +317,29 @@ const be = xn(void 0), Pi = {
301
317
  [g, a]
302
318
  ), Ee = ee(
303
319
  () => ({
304
- formData: S,
320
+ formData: A,
305
321
  setFormData: g,
306
322
  handleDragStop: X,
307
323
  removeElement: V,
308
324
  elementData: u,
309
325
  setElementData: t,
310
- updateElementPosition: Ae,
326
+ updateElementPosition: Se,
311
327
  addElement: ge,
312
328
  addElementInPosition: ue,
313
- updateElement: Ce,
329
+ updateElement: ke,
314
330
  addSection: he,
315
331
  removeSection: _,
316
332
  updateSection: Me,
317
- isDragging: k,
333
+ isDragging: C,
318
334
  setIsDragging: M,
319
335
  selectedSection: w,
320
- setSelectedSection: A,
336
+ setSelectedSection: S,
321
337
  activeSections: T,
322
338
  setActiveSections: I,
323
- updateGridElement: Se,
339
+ updateGridElement: Ae,
324
340
  answerData: l,
325
341
  setAnswerData: d,
326
- uploadUrl: L,
342
+ uploadUrl: E,
327
343
  setUploadUrl: F,
328
344
  apiActivityCount: Z,
329
345
  setApiActivityCount: ie,
@@ -333,34 +349,34 @@ const be = xn(void 0), Pi = {
333
349
  setShowPreview: o,
334
350
  undo: p,
335
351
  redo: N,
336
- canUndo: C,
352
+ canUndo: k,
337
353
  canRedo: x
338
354
  }),
339
355
  [
340
- S,
356
+ A,
341
357
  X,
342
358
  V,
343
359
  u,
344
- Ae,
360
+ Se,
345
361
  ge,
346
362
  ue,
347
- Ce,
363
+ ke,
348
364
  he,
349
365
  _,
350
366
  Me,
351
- k,
367
+ C,
352
368
  w,
353
369
  T,
354
- Se,
370
+ Ae,
355
371
  l,
356
- L,
372
+ E,
357
373
  Z,
358
374
  ce,
359
375
  Be,
360
376
  s,
361
377
  p,
362
378
  N,
363
- C,
379
+ k,
364
380
  x
365
381
  ]
366
382
  );
@@ -375,7 +391,7 @@ function Xi(e) {
375
391
  } else for (a in e) e[a] && (s && (s += " "), s += a);
376
392
  return s;
377
393
  }
378
- function J() {
394
+ function q() {
379
395
  for (var e, n, a = 0, s = "", o = arguments.length; a < o; a++) (e = arguments[a]) && (n = Xi(e)) && (s && (s += " "), s += n);
380
396
  return s;
381
397
  }
@@ -570,7 +586,7 @@ const vi = ({
570
586
  }, [e]), G(() => {
571
587
  n && n(o, c);
572
588
  }, [c, n, o]), /* @__PURE__ */ i("div", { className: "builder_date__picker", children: /* @__PURE__ */ i(
573
- Sn,
589
+ An,
574
590
  {
575
591
  showIcon: !0,
576
592
  icon: /* @__PURE__ */ i(In, { className: "react-datepicker__calendar-icon" }),
@@ -629,7 +645,7 @@ function ai({
629
645
  {
630
646
  placeholder: (e == null ? void 0 : e.placeholder) || "",
631
647
  type: (e == null ? void 0 : e.inputType) || "text",
632
- className: J("field-control", e == null ? void 0 : e.customClass),
648
+ className: q("field-control", e == null ? void 0 : e.customClass),
633
649
  ...a(e == null ? void 0 : e.id),
634
650
  disabled: n == null ? void 0 : n.isReadOnly,
635
651
  inputMode: (e == null ? void 0 : e.inputMode) || void 0,
@@ -660,11 +676,11 @@ const en = Object.freeze({
660
676
  rotate: 0,
661
677
  vFlip: !1,
662
678
  hFlip: !1
663
- }), Si = Object.freeze({
679
+ }), Ai = Object.freeze({
664
680
  ...en,
665
681
  ...Ye
666
682
  }), pi = Object.freeze({
667
- ...Si,
683
+ ...Ai,
668
684
  body: "",
669
685
  hidden: !1
670
686
  });
@@ -868,7 +884,7 @@ function Yn(e, n, a) {
868
884
  const Zn = (e) => e === "unset" || e === "undefined" || e === "none";
869
885
  function $n(e, n) {
870
886
  const a = {
871
- ...Si,
887
+ ...Ai,
872
888
  ...e
873
889
  }, s = {
874
890
  ...un,
@@ -882,21 +898,21 @@ function $n(e, n) {
882
898
  let l = a.body;
883
899
  [a, s].forEach((f) => {
884
900
  const g = [], p = f.hFlip, N = f.vFlip;
885
- let S = f.rotate;
886
- p ? N ? S += 2 : (g.push("translate(" + (o.width + o.left).toString() + " " + (0 - o.top).toString() + ")"), g.push("scale(-1 1)"), o.top = o.left = 0) : N && (g.push("translate(" + (0 - o.left).toString() + " " + (o.height + o.top).toString() + ")"), g.push("scale(1 -1)"), o.top = o.left = 0);
887
- let C;
888
- switch (S < 0 && (S -= Math.floor(S / 4) * 4), S = S % 4, S) {
901
+ let A = f.rotate;
902
+ p ? N ? A += 2 : (g.push("translate(" + (o.width + o.left).toString() + " " + (0 - o.top).toString() + ")"), g.push("scale(-1 1)"), o.top = o.left = 0) : N && (g.push("translate(" + (0 - o.left).toString() + " " + (o.height + o.top).toString() + ")"), g.push("scale(1 -1)"), o.top = o.left = 0);
903
+ let k;
904
+ switch (A < 0 && (A -= Math.floor(A / 4) * 4), A = A % 4, A) {
889
905
  case 1:
890
- C = o.height / 2 + o.top, g.unshift("rotate(90 " + C.toString() + " " + C.toString() + ")");
906
+ k = o.height / 2 + o.top, g.unshift("rotate(90 " + k.toString() + " " + k.toString() + ")");
891
907
  break;
892
908
  case 2:
893
909
  g.unshift("rotate(180 " + (o.width / 2 + o.left).toString() + " " + (o.height / 2 + o.top).toString() + ")");
894
910
  break;
895
911
  case 3:
896
- C = o.width / 2 + o.left, g.unshift("rotate(-90 " + C.toString() + " " + C.toString() + ")");
912
+ k = o.width / 2 + o.left, g.unshift("rotate(-90 " + k.toString() + " " + k.toString() + ")");
897
913
  break;
898
914
  }
899
- S % 2 === 1 && (o.left !== o.top && (C = o.left, o.left = o.top, o.top = C), o.width !== o.height && (C = o.width, o.width = o.height, o.height = C)), g.length && (l = Yn(l, '<g transform="' + g.join(" ") + '">', "</g>"));
915
+ A % 2 === 1 && (o.left !== o.top && (k = o.left, o.left = o.top, o.top = k), o.width !== o.height && (k = o.width, o.width = o.height, o.height = k)), g.length && (l = Yn(l, '<g transform="' + g.join(" ") + '">', "</g>"));
900
916
  });
901
917
  const d = s.width, u = s.height, t = o.width, m = o.height;
902
918
  let c, r;
@@ -952,15 +968,15 @@ function Ni(e) {
952
968
  dataAfterTimeout: e.dataAfterTimeout !== !1
953
969
  };
954
970
  }
955
- const ki = /* @__PURE__ */ Object.create(null), je = ["https://api.simplesvg.com", "https://api.unisvg.com"], qe = [];
971
+ const Ci = /* @__PURE__ */ Object.create(null), je = ["https://api.simplesvg.com", "https://api.unisvg.com"], qe = [];
956
972
  for (; je.length > 0; ) je.length === 1 || Math.random() > 0.5 ? qe.push(je.shift()) : qe.push(je.pop());
957
- ki[""] = Ni({ resources: ["https://api.iconify.design"].concat(qe) });
973
+ Ci[""] = Ni({ resources: ["https://api.iconify.design"].concat(qe) });
958
974
  function aa(e, n) {
959
975
  const a = Ni(n);
960
- return a === null ? !1 : (ki[e] = a, !0);
976
+ return a === null ? !1 : (Ci[e] = a, !0);
961
977
  }
962
- function Ci(e) {
963
- return ki[e];
978
+ function ki(e) {
979
+ return Ci[e];
964
980
  }
965
981
  const oa = () => {
966
982
  let e;
@@ -971,7 +987,7 @@ const oa = () => {
971
987
  };
972
988
  let Oi = oa();
973
989
  function sa(e, n) {
974
- const a = Ci(e);
990
+ const a = ki(e);
975
991
  if (!a) return 0;
976
992
  let s;
977
993
  if (!a.maxURL) s = 0;
@@ -1007,7 +1023,7 @@ const da = (e, n, a) => {
1007
1023
  };
1008
1024
  function ua(e) {
1009
1025
  if (typeof e == "string") {
1010
- const n = Ci(e);
1026
+ const n = ki(e);
1011
1027
  if (n) return n.path;
1012
1028
  }
1013
1029
  return "/";
@@ -1154,12 +1170,12 @@ function ga(e, n, a, s) {
1154
1170
  const o = e.resources.length, l = e.random ? Math.floor(Math.random() * o) : e.index;
1155
1171
  let d;
1156
1172
  if (e.random) {
1157
- let k = e.resources.slice(0);
1158
- for (d = []; k.length > 1; ) {
1159
- const M = Math.floor(Math.random() * k.length);
1160
- d.push(k[M]), k = k.slice(0, M).concat(k.slice(M + 1));
1173
+ let C = e.resources.slice(0);
1174
+ for (d = []; C.length > 1; ) {
1175
+ const M = Math.floor(Math.random() * C.length);
1176
+ d.push(C[M]), C = C.slice(0, M).concat(C.slice(M + 1));
1161
1177
  }
1162
- d = d.concat(k);
1178
+ d = d.concat(C);
1163
1179
  } else d = e.resources.slice(l).concat(e.resources.slice(0, l));
1164
1180
  const u = Date.now();
1165
1181
  let t = "pending", m = 0, c, r = null, h = [], v = [];
@@ -1168,12 +1184,12 @@ function ga(e, n, a, s) {
1168
1184
  r && (clearTimeout(r), r = null);
1169
1185
  }
1170
1186
  function f() {
1171
- t === "pending" && (t = "aborted"), y(), h.forEach((k) => {
1172
- k.status === "pending" && (k.status = "aborted");
1187
+ t === "pending" && (t = "aborted"), y(), h.forEach((C) => {
1188
+ C.status === "pending" && (C.status = "aborted");
1173
1189
  }), h = [];
1174
1190
  }
1175
- function g(k, M) {
1176
- M && (v = []), typeof k == "function" && v.push(k);
1191
+ function g(C, M) {
1192
+ M && (v = []), typeof C == "function" && v.push(C);
1177
1193
  }
1178
1194
  function p() {
1179
1195
  return {
@@ -1187,22 +1203,22 @@ function ga(e, n, a, s) {
1187
1203
  };
1188
1204
  }
1189
1205
  function N() {
1190
- t = "failed", v.forEach((k) => {
1191
- k(void 0, c);
1206
+ t = "failed", v.forEach((C) => {
1207
+ C(void 0, c);
1192
1208
  });
1193
1209
  }
1194
- function S() {
1195
- h.forEach((k) => {
1196
- k.status === "pending" && (k.status = "aborted");
1210
+ function A() {
1211
+ h.forEach((C) => {
1212
+ C.status === "pending" && (C.status = "aborted");
1197
1213
  }), h = [];
1198
1214
  }
1199
- function C(k, M, w) {
1200
- const A = M !== "success";
1201
- switch (h = h.filter((T) => T !== k), t) {
1215
+ function k(C, M, w) {
1216
+ const S = M !== "success";
1217
+ switch (h = h.filter((T) => T !== C), t) {
1202
1218
  case "pending":
1203
1219
  break;
1204
1220
  case "failed":
1205
- if (A || !e.dataAfterTimeout) return;
1221
+ if (S || !e.dataAfterTimeout) return;
1206
1222
  break;
1207
1223
  default:
1208
1224
  return;
@@ -1211,12 +1227,12 @@ function ga(e, n, a, s) {
1211
1227
  c = w, N();
1212
1228
  return;
1213
1229
  }
1214
- if (A) {
1230
+ if (S) {
1215
1231
  c = w, h.length || (d.length ? x() : N());
1216
1232
  return;
1217
1233
  }
1218
- if (y(), S(), !e.random) {
1219
- const T = e.resources.indexOf(k.resource);
1234
+ if (y(), A(), !e.random) {
1235
+ const T = e.resources.indexOf(C.resource);
1220
1236
  T !== -1 && T !== e.index && (e.index = T);
1221
1237
  }
1222
1238
  t = "completed", v.forEach((T) => {
@@ -1226,11 +1242,11 @@ function ga(e, n, a, s) {
1226
1242
  function x() {
1227
1243
  if (t !== "pending") return;
1228
1244
  y();
1229
- const k = d.shift();
1230
- if (k === void 0) {
1245
+ const C = d.shift();
1246
+ if (C === void 0) {
1231
1247
  if (h.length) {
1232
1248
  r = setTimeout(() => {
1233
- y(), t === "pending" && (S(), N());
1249
+ y(), t === "pending" && (A(), N());
1234
1250
  }, e.timeout);
1235
1251
  return;
1236
1252
  }
@@ -1239,12 +1255,12 @@ function ga(e, n, a, s) {
1239
1255
  }
1240
1256
  const M = {
1241
1257
  status: "pending",
1242
- resource: k,
1243
- callback: (w, A) => {
1244
- C(M, w, A);
1258
+ resource: C,
1259
+ callback: (w, S) => {
1260
+ k(M, w, S);
1245
1261
  }
1246
1262
  };
1247
- h.push(M), m++, r = setTimeout(x, e.rotate), a(k, n, M.callback);
1263
+ h.push(M), m++, r = setTimeout(x, e.rotate), a(C, n, M.callback);
1248
1264
  }
1249
1265
  return setTimeout(x), p;
1250
1266
  }
@@ -1281,7 +1297,7 @@ function Gi() {
1281
1297
  const si = /* @__PURE__ */ Object.create(null);
1282
1298
  function fa(e) {
1283
1299
  if (!si[e]) {
1284
- const n = Ci(e);
1300
+ const n = ki(e);
1285
1301
  if (!n) return;
1286
1302
  const a = cn(n), s = {
1287
1303
  config: n,
@@ -1317,7 +1333,7 @@ function xa(e) {
1317
1333
  e.iconsLoaderFlag = !1, ra(e);
1318
1334
  }));
1319
1335
  }
1320
- function Aa(e) {
1336
+ function Sa(e) {
1321
1337
  const n = [], a = [];
1322
1338
  return e.forEach((s) => {
1323
1339
  (s.match(sn) ? n : a).push(s);
@@ -1350,7 +1366,7 @@ function Hi(e, n) {
1350
1366
  n(null);
1351
1367
  }) : n(e);
1352
1368
  }
1353
- function Sa(e, n) {
1369
+ function Aa(e, n) {
1354
1370
  e.iconsToLoad ? e.iconsToLoad = e.iconsToLoad.concat(n).sort() : e.iconsToLoad = n, e.iconsQueueFlag || (e.iconsQueueFlag = !0, setTimeout(() => {
1355
1371
  e.iconsQueueFlag = !1;
1356
1372
  const { provider: a, prefix: s } = e, o = e.iconsToLoad;
@@ -1375,7 +1391,7 @@ function Sa(e, n) {
1375
1391
  });
1376
1392
  return;
1377
1393
  }
1378
- const { valid: d, invalid: u } = Aa(o);
1394
+ const { valid: d, invalid: u } = Sa(o);
1379
1395
  if (u.length && He(e, u, null), !d.length) return;
1380
1396
  const t = s.match(sn) ? gi(a) : null;
1381
1397
  if (!t) {
@@ -1412,10 +1428,10 @@ const Na = (e, n) => {
1412
1428
  v.has(r) || (v.add(r), o[m][c].push(r));
1413
1429
  }), l.forEach((t) => {
1414
1430
  const m = o[t.provider][t.prefix];
1415
- m.length && Sa(t, m);
1431
+ m.length && Aa(t, m);
1416
1432
  }), n ? ba(n, s, l) : ji;
1417
1433
  };
1418
- function ka(e, n) {
1434
+ function Ca(e, n) {
1419
1435
  const a = { ...e };
1420
1436
  for (const s in n) {
1421
1437
  const o = n[s], l = typeof o;
@@ -1423,9 +1439,9 @@ function ka(e, n) {
1423
1439
  }
1424
1440
  return a;
1425
1441
  }
1426
- const Ca = /[\s,]+/;
1442
+ const ka = /[\s,]+/;
1427
1443
  function Ma(e, n) {
1428
- n.split(Ca).forEach((a) => {
1444
+ n.split(ka).forEach((a) => {
1429
1445
  switch (a.trim()) {
1430
1446
  case "horizontal":
1431
1447
  e.hFlip = !0;
@@ -1522,7 +1538,7 @@ function Ui(e) {
1522
1538
  return e + (e.match(/^[-0-9.]+$/) ? "px" : "");
1523
1539
  }
1524
1540
  const Oa = (e, n, a) => {
1525
- const s = n.inline ? Ka : rn, o = ka(s, n), l = n.mode || "svg", d = {}, u = n.style || {}, t = {
1541
+ const s = n.inline ? Ka : rn, o = Ca(s, n), l = n.mode || "svg", d = {}, u = n.style || {}, t = {
1526
1542
  ...l === "svg" ? Da : {}
1527
1543
  };
1528
1544
  if (a) {
@@ -1532,8 +1548,8 @@ const Oa = (e, n, a) => {
1532
1548
  "provider",
1533
1549
  "prefix"
1534
1550
  ];
1535
- for (const S of N)
1536
- g[S] && p.push("iconify--" + g[S]);
1551
+ for (const A of N)
1552
+ g[A] && p.push("iconify--" + g[A]);
1537
1553
  t.className = p.join(" ");
1538
1554
  }
1539
1555
  }
@@ -1702,7 +1718,7 @@ function bn(e) {
1702
1718
  }, [e.icon, n]);
1703
1719
  const { name: r, data: h } = d;
1704
1720
  return h ? Oa({
1705
- ...Si,
1721
+ ...Ai,
1706
1722
  ...h
1707
1723
  }, e, r) : e.children ? e.children : e.fallback ? e.fallback : bi("span", {});
1708
1724
  }
@@ -1715,7 +1731,7 @@ Zi((e, n) => bn({
1715
1731
  ...e,
1716
1732
  _ref: n
1717
1733
  }));
1718
- function z({
1734
+ function J({
1719
1735
  icon: e,
1720
1736
  iconClass: n
1721
1737
  }) {
@@ -1770,7 +1786,7 @@ function Mi({
1770
1786
  disabled: l,
1771
1787
  children: [
1772
1788
  /* @__PURE__ */ i("span", { className: "custom-select__value", children: (t == null ? void 0 : t.length) > 0 ? c : /* @__PURE__ */ i("span", { className: "custom-select__placeholder", children: a != null ? a : " Select options" }) }),
1773
- /* @__PURE__ */ i("span", { className: "custom-select__icon", children: /* @__PURE__ */ i(z, { icon: "lucide:chevron-down" }) })
1789
+ /* @__PURE__ */ i("span", { className: "custom-select__icon", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) })
1774
1790
  ]
1775
1791
  }
1776
1792
  ),
@@ -1867,8 +1883,8 @@ function pn({
1867
1883
  className: "!flex items-center rounded cursor-pointer gap-x-3",
1868
1884
  title: `Click to preview ${r}`,
1869
1885
  children: [
1870
- l === "image" && /* @__PURE__ */ i("div", { className: "flex items-center justify-center ", children: /* @__PURE__ */ i(z, { iconClass: "text-4xl", icon: "fluent-color:image-48" }) }),
1871
- l !== "image" && /* @__PURE__ */ i(z, { icon: Ha[l], iconClass: "text-4xl" }),
1886
+ l === "image" && /* @__PURE__ */ i("div", { className: "flex items-center justify-center ", children: /* @__PURE__ */ i(J, { iconClass: "text-4xl", icon: "fluent-color:image-48" }) }),
1887
+ l !== "image" && /* @__PURE__ */ i(J, { icon: Ha[l], iconClass: "text-4xl" }),
1872
1888
  /* @__PURE__ */ i("span", { className: "text-sm font-semibold text-center text-gray-700 truncate max-w-[300px]", children: r })
1873
1889
  ]
1874
1890
  }
@@ -1881,7 +1897,7 @@ function pn({
1881
1897
  className: "p-2",
1882
1898
  onClick: () => h(u || e, n),
1883
1899
  title: `Download ${r}`,
1884
- children: /* @__PURE__ */ i(z, { icon: "streamline-flex:download-tray-solid" })
1900
+ children: /* @__PURE__ */ i(J, { icon: "streamline-flex:download-tray-solid" })
1885
1901
  }
1886
1902
  ),
1887
1903
  a && /* @__PURE__ */ i(
@@ -1890,7 +1906,7 @@ function pn({
1890
1906
  type: "button",
1891
1907
  className: "p-2 text-lg text-red-500",
1892
1908
  onClick: a,
1893
- children: /* @__PURE__ */ i(z, { icon: "lets-icons:trash-duotone" })
1909
+ children: /* @__PURE__ */ i(J, { icon: "lets-icons:trash-duotone" })
1894
1910
  }
1895
1911
  )
1896
1912
  ] }),
@@ -1968,8 +1984,8 @@ function Va({
1968
1984
  [l]
1969
1985
  ), f = Y(
1970
1986
  async (x) => {
1971
- var w, A;
1972
- const k = de("token"), M = ((w = de("orgData")) == null ? void 0 : w.id) || de("organizationId");
1987
+ var w, S;
1988
+ const C = de("token"), M = ((w = de("orgData")) == null ? void 0 : w.id) || de("organizationId");
1973
1989
  try {
1974
1990
  const { data: T } = await Pe.post(
1975
1991
  d,
@@ -1980,36 +1996,36 @@ function Va({
1980
1996
  },
1981
1997
  {
1982
1998
  headers: {
1983
- Authorization: `Bearer ${k}`
1999
+ Authorization: `Bearer ${C}`
1984
2000
  }
1985
2001
  }
1986
2002
  );
1987
- return (A = T == null ? void 0 : T.data) == null ? void 0 : A.url;
2003
+ return (S = T == null ? void 0 : T.data) == null ? void 0 : S.url;
1988
2004
  } catch (T) {
1989
2005
  throw console.error("File upload error:", T), new Error("Failed to upload file to server");
1990
2006
  }
1991
2007
  },
1992
2008
  [d]
1993
2009
  ), g = Y(
1994
- (x) => new Promise((k, M) => {
2010
+ (x) => new Promise((C, M) => {
1995
2011
  const w = new FileReader();
1996
2012
  w.onloadend = async () => {
1997
2013
  try {
1998
- const A = w.result.replace(
2014
+ const S = w.result.replace(
1999
2015
  /^data:.*;base64,/,
2000
2016
  ""
2001
2017
  ), T = d ? await f({
2002
- base64: A,
2018
+ base64: S,
2003
2019
  ext: `.${x.name.split(".").pop()}`,
2004
2020
  fileName: x.name
2005
2021
  }) : w.result;
2006
- k({
2022
+ C({
2007
2023
  base64: T,
2008
2024
  type: x.type,
2009
2025
  name: x.name
2010
2026
  });
2011
- } catch (A) {
2012
- M(A);
2027
+ } catch (S) {
2028
+ M(S);
2013
2029
  }
2014
2030
  }, w.onerror = () => M(new Error("File read failed")), w.readAsDataURL(x);
2015
2031
  }),
@@ -2017,14 +2033,14 @@ function Va({
2017
2033
  ), p = Y(
2018
2034
  (x) => {
2019
2035
  var M;
2020
- const k = v ? (M = v.split(",")) == null ? void 0 : M.map((w) => w.trim()) : [];
2036
+ const C = v ? (M = v.split(",")) == null ? void 0 : M.map((w) => w.trim()) : [];
2021
2037
  for (const w of x) {
2022
2038
  if (w.size > Fa)
2023
2039
  return xe.error(
2024
2040
  `File "${w.name}" exceeds 5MB limit (${(w.size / 1024 / 1024).toFixed(2)}MB)`
2025
2041
  ), !1;
2026
- if (k.length && !k.some(
2027
- (A) => w.type === A || w.name.toLowerCase().endsWith(A.replace("*", ""))
2042
+ if (C.length && !C.some(
2043
+ (S) => w.type === S || w.name.toLowerCase().endsWith(S.replace("*", ""))
2028
2044
  ))
2029
2045
  return xe.error(
2030
2046
  `File "${w.name}" is not an allowed type. Allowed: ${y || "any"}`
@@ -2035,16 +2051,16 @@ function Va({
2035
2051
  [v, y]
2036
2052
  ), N = Y(
2037
2053
  async (x) => {
2038
- const k = Array.from(x.target.files || []);
2039
- if (!(!k.length || r)) {
2040
- if (!p(k)) {
2054
+ const C = Array.from(x.target.files || []);
2055
+ if (!(!C.length || r)) {
2056
+ if (!p(C)) {
2041
2057
  t.current && (t.current.value = "");
2042
2058
  return;
2043
2059
  }
2044
2060
  try {
2045
- h(!0), u == null || u((A) => A + 1);
2046
- const M = await Promise.all(k == null ? void 0 : k.map(g)), w = s && m ? [...m, ...M] : M;
2047
- c(w), e(w), xe.success(`Successfully uploaded ${k.length} file(s)`);
2061
+ h(!0), u == null || u((S) => S + 1);
2062
+ const M = await Promise.all(C == null ? void 0 : C.map(g)), w = s && m ? [...m, ...M] : M;
2063
+ c(w), e(w), xe.success(`Successfully uploaded ${C.length} file(s)`);
2048
2064
  } catch (M) {
2049
2065
  console.error("Upload error:", M), xe.error("Failed to upload file(s). Please try again.");
2050
2066
  } finally {
@@ -2053,15 +2069,15 @@ function Va({
2053
2069
  }
2054
2070
  },
2055
2071
  [r, p, g, e, s, m, u]
2056
- ), S = Y(
2072
+ ), A = Y(
2057
2073
  (x) => {
2058
- r || (t.current && (t.current.value = ""), c((k) => {
2059
- const M = x === void 0 ? null : (k == null ? void 0 : k.filter((w, A) => A !== x)) || null;
2074
+ r || (t.current && (t.current.value = ""), c((C) => {
2075
+ const M = x === void 0 ? null : (C == null ? void 0 : C.filter((w, S) => S !== x)) || null;
2060
2076
  return e(M), M;
2061
2077
  }), a == null || a());
2062
2078
  },
2063
2079
  [a, e, r]
2064
- ), C = m && m.length > 0;
2080
+ ), k = m && m.length > 0;
2065
2081
  return /* @__PURE__ */ b("div", { className: "flex flex-col items-start gap-2", children: [
2066
2082
  !n && /* @__PURE__ */ b("div", { className: "!flex field-control !py-0 !px-0 relative", children: [
2067
2083
  /* @__PURE__ */ i(
@@ -2080,31 +2096,31 @@ function Va({
2080
2096
  hover:file:bg-blue-100 disabled:opacity-50 disabled:cursor-not-allowed`
2081
2097
  }
2082
2098
  ),
2083
- C && /* @__PURE__ */ i(
2099
+ k && /* @__PURE__ */ i(
2084
2100
  "button",
2085
2101
  {
2086
2102
  type: "button",
2087
2103
  className: "p-2 text-lg text-red-500 hover:text-red-600 transition-colors disabled:opacity-50",
2088
- onClick: () => S(),
2104
+ onClick: () => A(),
2089
2105
  disabled: r,
2090
2106
  "aria-label": "Remove all files",
2091
- children: /* @__PURE__ */ i(z, { icon: "lets-icons:trash-duotone" })
2107
+ children: /* @__PURE__ */ i(J, { icon: "lets-icons:trash-duotone" })
2092
2108
  }
2093
2109
  )
2094
2110
  ] }),
2095
- C && /* @__PURE__ */ b("div", { className: "relative grid gap-y-1 flex-1 w-full", children: [
2111
+ k && /* @__PURE__ */ b("div", { className: "relative grid gap-y-1 flex-1 w-full", children: [
2096
2112
  r && /* @__PURE__ */ i("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-white/60 rounded", children: /* @__PURE__ */ b("div", { className: "flex items-center gap-2 text-sm text-blue-600 font-medium", children: [
2097
2113
  /* @__PURE__ */ i("span", { className: "animate-spin h-4 w-4 border-2 border-blue-500 border-t-transparent rounded-full" }),
2098
2114
  "Uploading..."
2099
2115
  ] }) }),
2100
- typeof m == "object" && (m == null ? void 0 : m.map((x, k) => /* @__PURE__ */ i(
2116
+ typeof m == "object" && (m == null ? void 0 : m.map((x, C) => /* @__PURE__ */ i(
2101
2117
  pn,
2102
2118
  {
2103
2119
  fileUrl: x.base64,
2104
2120
  fileName: x.name,
2105
- removeFile: () => S(k)
2121
+ removeFile: () => A(C)
2106
2122
  },
2107
- `${x.name}-${k}`
2123
+ `${x.name}-${C}`
2108
2124
  )))
2109
2125
  ] })
2110
2126
  ] });
@@ -2171,13 +2187,13 @@ function Wa({
2171
2187
  {
2172
2188
  placeholder: e.placeholder,
2173
2189
  type: e.inputType,
2174
- className: J("field-control", e == null ? void 0 : e.customClass),
2190
+ className: q("field-control", e == null ? void 0 : e.customClass),
2175
2191
  ...a(e.id),
2176
2192
  disabled: n == null ? void 0 : n.isReadOnly
2177
2193
  }
2178
2194
  );
2179
2195
  }
2180
- const W = ({
2196
+ const z = ({
2181
2197
  label: e,
2182
2198
  name: n,
2183
2199
  register: a,
@@ -2197,7 +2213,7 @@ const W = ({
2197
2213
  description: g,
2198
2214
  onChange: p
2199
2215
  }) => {
2200
- var S, C, x, k;
2216
+ var A, k, x, C;
2201
2217
  const N = a ? { ...a(n) } : {};
2202
2218
  if (l === "amount")
2203
2219
  return /* @__PURE__ */ b("div", { className: "space-y-1.5 relative", children: [
@@ -2222,7 +2238,7 @@ const W = ({
2222
2238
  disabled: h
2223
2239
  }
2224
2240
  ),
2225
- (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (S = s[n]) == null ? void 0 : S.message })
2241
+ (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (A = s[n]) == null ? void 0 : A.message })
2226
2242
  ] });
2227
2243
  if (["checkbox", "radio"].includes(l)) {
2228
2244
  const M = (v == null ? void 0 : v(n)) || null;
@@ -2256,7 +2272,7 @@ const W = ({
2256
2272
  peer-disabled:cursor-not-allowed
2257
2273
  `,
2258
2274
  children: w && /* @__PURE__ */ i(
2259
- z,
2275
+ J,
2260
2276
  {
2261
2277
  icon: "meteor-icons:check",
2262
2278
  iconClass: "w-3.5 h-3.5 text-white"
@@ -2271,7 +2287,7 @@ const W = ({
2271
2287
  ]
2272
2288
  }
2273
2289
  ),
2274
- (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "ml-8 text-sm text-red-600", children: (C = s[n]) == null ? void 0 : C.message })
2290
+ (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "ml-8 text-sm text-red-600", children: (k = s[n]) == null ? void 0 : k.message })
2275
2291
  ] });
2276
2292
  }
2277
2293
  return l === "textarea" ? /* @__PURE__ */ b("div", { className: "space-y-1.5 relative", children: [
@@ -2320,7 +2336,7 @@ const W = ({
2320
2336
  max: f
2321
2337
  }
2322
2338
  ),
2323
- (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (k = s[n]) == null ? void 0 : k.message })
2339
+ (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (C = s[n]) == null ? void 0 : C.message })
2324
2340
  ] });
2325
2341
  };
2326
2342
  function za({
@@ -2329,9 +2345,9 @@ function za({
2329
2345
  }) {
2330
2346
  var o;
2331
2347
  const { register: a = () => ({}), watch: s } = n || {};
2332
- return /* @__PURE__ */ i("div", { className: J("grid gap-y-[6px]", e.customClass), children: (o = e == null ? void 0 : e.options) == null ? void 0 : o.map(
2348
+ return /* @__PURE__ */ i("div", { className: q("grid gap-y-[6px]", e.customClass), children: (o = e == null ? void 0 : e.options) == null ? void 0 : o.map(
2333
2349
  (l) => /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
2334
- W,
2350
+ z,
2335
2351
  {
2336
2352
  placeholder: e.placeholder,
2337
2353
  type: e.inputType,
@@ -2357,9 +2373,9 @@ function qa({
2357
2373
  }) {
2358
2374
  var o;
2359
2375
  const { register: a = () => ({}), watch: s } = n || {};
2360
- return /* @__PURE__ */ i("div", { className: J("grid gap-y-[6px]", e.customClass), children: (o = e == null ? void 0 : e.options) == null ? void 0 : o.map(
2376
+ return /* @__PURE__ */ i("div", { className: q("grid gap-y-[6px]", e.customClass), children: (o = e == null ? void 0 : e.options) == null ? void 0 : o.map(
2361
2377
  (l) => /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
2362
- W,
2378
+ z,
2363
2379
  {
2364
2380
  placeholder: e.placeholder,
2365
2381
  type: e.inputType,
@@ -2391,13 +2407,13 @@ const Ie = ({
2391
2407
  disabled: y
2392
2408
  }) => {
2393
2409
  const [f, g] = D(m ? [] : null), p = re(!1), N = ee(() => !u || !e || e.length === 0 ? m ? [] : null : m ? Array.isArray(u) ? e.filter((x) => u.some(
2394
- (k) => {
2410
+ (C) => {
2395
2411
  var M;
2396
- return typeof x.value == "object" ? ((M = x.value) == null ? void 0 : M.id) === (k == null ? void 0 : k.id) : x.value === k;
2412
+ return typeof x.value == "object" ? ((M = x.value) == null ? void 0 : M.id) === (C == null ? void 0 : C.id) : x.value === C;
2397
2413
  }
2398
2414
  )) : [] : e.find((x) => {
2399
- var k;
2400
- return typeof x.value == "string" && typeof u == "string" ? x.value.toLowerCase() === u.toLowerCase() : typeof x.value == "object" && typeof u == "object" ? ((k = x.value) == null ? void 0 : k.id) === (u == null ? void 0 : u.id) : x.value === u;
2415
+ var C;
2416
+ return typeof x.value == "string" && typeof u == "string" ? x.value.toLowerCase() === u.toLowerCase() : typeof x.value == "object" && typeof u == "object" ? ((C = x.value) == null ? void 0 : C.id) === (u == null ? void 0 : u.id) : x.value === u;
2401
2417
  }) || null, [u, e, m]);
2402
2418
  G(() => {
2403
2419
  if (p.current) {
@@ -2405,24 +2421,24 @@ const Ie = ({
2405
2421
  return;
2406
2422
  }
2407
2423
  if (m && Array.isArray(N) && Array.isArray(f)) {
2408
- const x = f == null ? void 0 : f.map((M) => M.value), k = N == null ? void 0 : N.map((M) => M.value);
2409
- JSON.stringify(x) !== JSON.stringify(k) && g(N);
2424
+ const x = f == null ? void 0 : f.map((M) => M.value), C = N == null ? void 0 : N.map((M) => M.value);
2425
+ JSON.stringify(x) !== JSON.stringify(C) && g(N);
2410
2426
  } else (N == null ? void 0 : N.value) !== (f == null ? void 0 : f.value) && g(N);
2411
2427
  }, [N, m]);
2412
- const S = Y((x) => {
2413
- var k;
2428
+ const A = Y((x) => {
2429
+ var C;
2414
2430
  if (p.current = !0, g(x), o) {
2415
- const M = m ? Array.isArray(x) ? x == null ? void 0 : x.map((w) => w.value) : [] : (k = x == null ? void 0 : x.value) != null ? k : null;
2431
+ const M = m ? Array.isArray(x) ? x == null ? void 0 : x.map((w) => w.value) : [] : (C = x == null ? void 0 : x.value) != null ? C : null;
2416
2432
  o(l, M), t == null || t(l);
2417
2433
  }
2418
2434
  s && !p.current && s(l);
2419
- }, [o, l, t, s, m]), C = ee(() => v ? "Fetching data..." : f ? m && Array.isArray(f) ? f.length > 0 ? f == null ? void 0 : f.map((x) => x.label).join(", ") : n : (f == null ? void 0 : f.label) || n : n, [f, v, n, m]);
2435
+ }, [o, l, t, s, m]), k = ee(() => v ? "Fetching data..." : f ? m && Array.isArray(f) ? f.length > 0 ? f == null ? void 0 : f.map((x) => x.label).join(", ") : n : (f == null ? void 0 : f.label) || n : n, [f, v, n, m]);
2420
2436
  return /* @__PURE__ */ b("div", { className: "relative", children: [
2421
2437
  !c && d && /* @__PURE__ */ i("label", { className: "block text-sm text-[#686878] darks:text-white/70 mb-2", children: d }),
2422
2438
  c && d && /* @__PURE__ */ i(
2423
2439
  "label",
2424
2440
  {
2425
- className: J(
2441
+ className: q(
2426
2442
  "z-[40] absolute bg-white py-[2px] px-1 -top-[10px] left-3",
2427
2443
  h
2428
2444
  ),
@@ -2433,7 +2449,7 @@ const Ie = ({
2433
2449
  ae,
2434
2450
  {
2435
2451
  value: f,
2436
- onChange: S,
2452
+ onChange: A,
2437
2453
  multiple: m,
2438
2454
  disabled: y || v,
2439
2455
  children: /* @__PURE__ */ b("div", { className: "relative", children: [
@@ -2441,13 +2457,13 @@ const Ie = ({
2441
2457
  /* @__PURE__ */ i(
2442
2458
  "span",
2443
2459
  {
2444
- className: J("block text-sm text-left truncate", {
2460
+ className: q("block text-sm text-left truncate", {
2445
2461
  "opacity-60": !f || v
2446
2462
  }),
2447
- children: C
2463
+ children: k
2448
2464
  }
2449
2465
  ),
2450
- /* @__PURE__ */ i("span", { className: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none", children: /* @__PURE__ */ i(z, { icon: "lucide:chevron-down" }) })
2466
+ /* @__PURE__ */ i("span", { className: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) })
2451
2467
  ] }),
2452
2468
  /* @__PURE__ */ i(
2453
2469
  we,
@@ -2455,16 +2471,16 @@ const Ie = ({
2455
2471
  leave: "transition ease-in duration-100",
2456
2472
  leaveFrom: "opacity-100",
2457
2473
  leaveTo: "opacity-0",
2458
- children: /* @__PURE__ */ i(ae.Options, { anchor: "bottom start", className: "select-button-options", children: e.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No options available" }) : e == null ? void 0 : e.map((x, k) => {
2474
+ children: /* @__PURE__ */ i(ae.Options, { anchor: "bottom start", className: "select-button-options", children: e.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No options available" }) : e == null ? void 0 : e.map((x, C) => {
2459
2475
  var M;
2460
2476
  return /* @__PURE__ */ i(
2461
2477
  ae.Option,
2462
2478
  {
2463
2479
  value: x,
2464
- className: ({ active: w }) => J("select-option", { active: w }),
2465
- children: ({ selected: w }) => /* @__PURE__ */ i("div", { className: J("option-text", { selected: w }), children: x.label })
2480
+ className: ({ active: w }) => q("select-option", { active: w }),
2481
+ children: ({ selected: w }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: w }), children: x.label })
2466
2482
  },
2467
- ((M = x.value) == null ? void 0 : M.id) || x.value || k
2483
+ ((M = x.value) == null ? void 0 : M.id) || x.value || C
2468
2484
  );
2469
2485
  }) })
2470
2486
  }
@@ -2489,16 +2505,16 @@ function Ue({
2489
2505
  const [t, m] = D(""), [c, r] = D([]), [h, v] = D(!1);
2490
2506
  G(() => {
2491
2507
  (async () => {
2492
- var x, k;
2508
+ var x, C;
2493
2509
  if (n) {
2494
2510
  v(!0);
2495
2511
  try {
2496
2512
  const M = de("token"), w = M ? { headers: { Authorization: `Bearer ${M}` } } : {};
2497
2513
  let T = (await Pe.get(n, w)).data;
2498
- if (T && !Array.isArray(T) && (T.data && Array.isArray(T.data) ? T = T.data : (x = T.data) != null && x.data && Array.isArray(T.data.data) ? T = T.data.data : T.results && Array.isArray(T.results) ? T = T.results : (k = T.data) != null && k.results && Array.isArray(T.data.results) ? T = T.data.results : T.items && Array.isArray(T.items) && (T = T.items)), Array.isArray(T)) {
2499
- const I = T.map((L) => typeof L == "string" ? { label: L, value: L } : {
2500
- label: L.label || L.name || String(L.id || L.value),
2501
- value: String(L.value || L.id || L.name)
2514
+ if (T && !Array.isArray(T) && (T.data && Array.isArray(T.data) ? T = T.data : (x = T.data) != null && x.data && Array.isArray(T.data.data) ? T = T.data.data : T.results && Array.isArray(T.results) ? T = T.results : (C = T.data) != null && C.results && Array.isArray(T.data.results) ? T = T.data.results : T.items && Array.isArray(T.items) && (T = T.items)), Array.isArray(T)) {
2515
+ const I = T.map((E) => typeof E == "string" ? { label: E, value: E } : {
2516
+ label: E.label || E.name || String(E.id || E.value),
2517
+ value: String(E.value || E.id || E.name)
2502
2518
  });
2503
2519
  r(I);
2504
2520
  }
@@ -2511,32 +2527,32 @@ function Ue({
2511
2527
  })();
2512
2528
  }, [n]);
2513
2529
  const y = n ? c : e, f = ee(() => {
2514
- const C = a != null ? a : s;
2515
- return C == null || C === "" ? null : y.find((x) => String(x.value) === String(C) || String(x.label) === String(C)) || null;
2530
+ const k = a != null ? a : s;
2531
+ return k == null || k === "" ? null : y.find((x) => String(x.value) === String(k) || String(x.label) === String(k)) || null;
2516
2532
  }, [a, s, y]), [g, p] = D(f);
2517
2533
  G(() => {
2518
2534
  if (a !== void 0)
2519
2535
  if (a === null || a === "")
2520
2536
  p(null);
2521
2537
  else {
2522
- const C = y.find((x) => String(x.value) === String(a) || String(x.label) === String(a)) || null;
2523
- p(C);
2538
+ const k = y.find((x) => String(x.value) === String(a) || String(x.label) === String(a)) || null;
2539
+ p(k);
2524
2540
  }
2525
2541
  }, [a, y]);
2526
2542
  const N = ee(() => {
2527
2543
  if (t === "") return y;
2528
- const C = t.toLowerCase();
2544
+ const k = t.toLowerCase();
2529
2545
  return y.filter(
2530
- (x) => x.label.toLowerCase().includes(C)
2546
+ (x) => x.label.toLowerCase().includes(k)
2531
2547
  );
2532
- }, [t, y]), S = Y((C) => {
2533
- p(C), o(d, C);
2548
+ }, [t, y]), A = Y((k) => {
2549
+ p(k), o(d, k);
2534
2550
  }, [d, o]);
2535
2551
  return /* @__PURE__ */ i("div", { className: "relative w-full", children: /* @__PURE__ */ b(
2536
2552
  De,
2537
2553
  {
2538
2554
  value: g,
2539
- onChange: S,
2555
+ onChange: A,
2540
2556
  disabled: l,
2541
2557
  children: [
2542
2558
  /* @__PURE__ */ b("div", { className: "relative", children: [
@@ -2544,24 +2560,24 @@ function Ue({
2544
2560
  Nn,
2545
2561
  {
2546
2562
  className: `field-control ${u}`,
2547
- displayValue: (C) => (C == null ? void 0 : C.label) || "",
2548
- onChange: (C) => m(C.target.value),
2563
+ displayValue: (k) => (k == null ? void 0 : k.label) || "",
2564
+ onChange: (k) => m(k.target.value),
2549
2565
  placeholder: h ? "Loading..." : l ? "" : "Select an option..."
2550
2566
  }
2551
2567
  ),
2552
- !l && /* @__PURE__ */ i(kn, { className: "absolute inset-y-0 right-0 flex items-center px-2 text-gray-400 hover:text-gray-600", children: h ? /* @__PURE__ */ b("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2568
+ !l && /* @__PURE__ */ i(Cn, { className: "absolute inset-y-0 right-0 flex items-center px-2 text-gray-400 hover:text-gray-600", children: h ? /* @__PURE__ */ b("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
2553
2569
  /* @__PURE__ */ i("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
2554
2570
  /* @__PURE__ */ i("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
2555
- ] }) : /* @__PURE__ */ i(z, { icon: "octicon:chevron-down-12" }) })
2571
+ ] }) : /* @__PURE__ */ i(J, { icon: "octicon:chevron-down-12" }) })
2556
2572
  ] }),
2557
- /* @__PURE__ */ i(Cn, { anchor: "bottom start", className: "select-options__combo", children: h ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "Loading..." }) : N.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No results found." }) : N == null ? void 0 : N.map((C) => /* @__PURE__ */ i(
2573
+ /* @__PURE__ */ i(kn, { anchor: "bottom start", className: "select-options__combo", children: h ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "Loading..." }) : N.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No results found." }) : N == null ? void 0 : N.map((k) => /* @__PURE__ */ i(
2558
2574
  Mn,
2559
2575
  {
2560
- value: C,
2561
- className: ({ active: x, selected: k }) => J("select-option", { active: x, selected: k }),
2562
- children: ({ selected: x }) => /* @__PURE__ */ i("div", { className: J("option-text", { selected: x }), children: C.label })
2576
+ value: k,
2577
+ className: ({ active: x, selected: C }) => q("select-option", { active: x, selected: C }),
2578
+ children: ({ selected: x }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: x }), children: k.label })
2563
2579
  },
2564
- C.value
2580
+ k.value
2565
2581
  )) })
2566
2582
  ]
2567
2583
  }
@@ -2590,7 +2606,7 @@ function _a({
2590
2606
  setValue: o,
2591
2607
  trigger: s,
2592
2608
  value: d,
2593
- className: J("field-control", e == null ? void 0 : e.customClass),
2609
+ className: q("field-control", e == null ? void 0 : e.customClass),
2594
2610
  disabled: n == null ? void 0 : n.isReadOnly
2595
2611
  }
2596
2612
  ) : /* @__PURE__ */ i(
@@ -2614,7 +2630,7 @@ function Ya({
2614
2630
  {
2615
2631
  placeholder: e.placeholder,
2616
2632
  rows: 4,
2617
- className: J("field-control resize-none", e == null ? void 0 : e.customClass),
2633
+ className: q("field-control resize-none", e == null ? void 0 : e.customClass),
2618
2634
  ...a(e.id),
2619
2635
  disabled: n == null ? void 0 : n.isReadOnly
2620
2636
  }
@@ -2656,16 +2672,16 @@ const Za = ({
2656
2672
  activeTab: o,
2657
2673
  btnClass: l = ""
2658
2674
  }) => {
2659
- const d = J(
2675
+ const d = q(
2660
2676
  "flex gap-x-3 mb-8 w-full no-scrollbar overflow-x-auto border-b-2 border-[#EAECF0] darks:border-gray-500",
2661
2677
  n
2662
2678
  );
2663
2679
  return /* @__PURE__ */ i("div", { className: d, children: e == null ? void 0 : e.map((u) => {
2664
- const t = o === u.key, m = a[u.key] || 0, c = J(
2680
+ const t = o === u.key, m = a[u.key] || 0, c = q(
2665
2681
  "capitalize text-sm whitespace-nowrap no-scrollbar font-semibold pb-[14px] border-b-2 border-[#EAECF0] px-6 flex items-center gap-x-1 flex-1 text-center",
2666
2682
  `${e.length === 1 ? "justify-start" : "justify-center"}`,
2667
2683
  l
2668
- ), r = J({
2684
+ ), r = q({
2669
2685
  "border-gray-500 border-primary border-primary-500 text-primary text-primary-500": t,
2670
2686
  "border-transparent text-gray-400 ": !t
2671
2687
  }), h = m > 0 && /* @__PURE__ */ i("span", { className: "text-xs h-6 min-w-[24px] rounded-full flex justify-center items-center border border-[#EAECF0] darks:border-gray-500 bg-[#F9FAFB] darks:bg-gray-800 text-[#454745] darks:text-white/80", children: m });
@@ -2673,7 +2689,7 @@ const Za = ({
2673
2689
  "button",
2674
2690
  {
2675
2691
  onClick: () => s(u.key),
2676
- className: J(c, r),
2692
+ className: q(c, r),
2677
2693
  "aria-selected": t,
2678
2694
  role: "tab",
2679
2695
  type: "button",
@@ -3524,12 +3540,12 @@ function Ji(e) {
3524
3540
  const l = e.slice(s);
3525
3541
  return l && n.push({ type: "operator", value: l }), n;
3526
3542
  }
3527
- function Ao(e) {
3543
+ function So(e) {
3528
3544
  return e.map(
3529
3545
  (n) => n.type === "field" ? `@[${n.display}](${n.id})` : n.value
3530
3546
  ).join("");
3531
3547
  }
3532
- function So({
3548
+ function Ao({
3533
3549
  value: e,
3534
3550
  onChange: n,
3535
3551
  fields: a,
@@ -3537,42 +3553,42 @@ function So({
3537
3553
  }) {
3538
3554
  const [o, l] = D(() => Ji(e)), [d, u] = D(null), [t, m] = D(!1), [c, r] = D(""), [h, v] = D(null), y = re(null), f = re(null), g = re(/* @__PURE__ */ new Map());
3539
3555
  G(() => {
3540
- const A = Ji(e);
3541
- l(A);
3556
+ const S = Ji(e);
3557
+ l(S);
3542
3558
  }, []);
3543
3559
  const p = Y(
3544
- (A) => {
3545
- n(Ao(A));
3560
+ (S) => {
3561
+ n(So(S));
3546
3562
  },
3547
3563
  [n]
3548
- ), N = (A, T) => {
3564
+ ), N = (S, T) => {
3549
3565
  const I = [...o];
3550
- I[A] = { type: "operator", value: T }, l(I), p(I);
3551
- }, S = (A) => {
3552
- const T = o.filter((I, L) => L !== A);
3566
+ I[S] = { type: "operator", value: T }, l(I), p(I);
3567
+ }, A = (S) => {
3568
+ const T = o.filter((I, E) => E !== S);
3553
3569
  l(T), p(T);
3554
- }, C = (A) => {
3555
- v(A), r(""), m(!0);
3556
- }, x = (A, T) => {
3557
- const I = T !== void 0 ? T : h != null ? h : o.length, L = [...o], F = L.slice(0, I), Z = L.slice(I), ie = [
3570
+ }, k = (S) => {
3571
+ v(S), r(""), m(!0);
3572
+ }, x = (S, T) => {
3573
+ const I = T !== void 0 ? T : h != null ? h : o.length, E = [...o], F = E.slice(0, I), Z = E.slice(I), ie = [
3558
3574
  ...F,
3559
- { type: "field", id: A.id, display: A.display },
3575
+ { type: "field", id: S.id, display: S.display },
3560
3576
  ...Z
3561
- ], X = k(ie);
3577
+ ], X = C(ie);
3562
3578
  l(X), p(X), m(!1), v(null);
3563
3579
  };
3564
- function k(A) {
3580
+ function C(S) {
3565
3581
  const T = [];
3566
- if (A.length === 0) return [{ type: "operator", value: "" }];
3567
- A[0].type === "field" && T.push({ type: "operator", value: "" });
3568
- for (let I = 0; I < A.length; I++)
3569
- T.push(A[I]), A[I].type === "field" && (I + 1 >= A.length || A[I + 1].type === "field") && T.push({ type: "operator", value: "" });
3582
+ if (S.length === 0) return [{ type: "operator", value: "" }];
3583
+ S[0].type === "field" && T.push({ type: "operator", value: "" });
3584
+ for (let I = 0; I < S.length; I++)
3585
+ T.push(S[I]), S[I].type === "field" && (I + 1 >= S.length || S[I + 1].type === "field") && T.push({ type: "operator", value: "" });
3570
3586
  return T;
3571
3587
  }
3572
3588
  const M = a.filter(
3573
- (A) => A.display.toLowerCase().includes(c.toLowerCase())
3589
+ (S) => S.display.toLowerCase().includes(c.toLowerCase())
3574
3590
  ), w = o.every(
3575
- (A) => A.type === "operator" && A.value.trim() === ""
3591
+ (S) => S.type === "operator" && S.value.trim() === ""
3576
3592
  );
3577
3593
  return /* @__PURE__ */ b("div", { className: "relative", ref: f, children: [
3578
3594
  /* @__PURE__ */ b(
@@ -3582,29 +3598,29 @@ function So({
3582
3598
  style: { padding: "6px 10px" },
3583
3599
  onClick: () => {
3584
3600
  var T;
3585
- const A = [...o].reverse().findIndex((I) => I.type === "operator");
3586
- if (A !== -1) {
3587
- const I = o.length - 1 - A;
3601
+ const S = [...o].reverse().findIndex((I) => I.type === "operator");
3602
+ if (S !== -1) {
3603
+ const I = o.length - 1 - S;
3588
3604
  (T = g.current.get(I)) == null || T.focus();
3589
3605
  }
3590
3606
  },
3591
3607
  children: [
3592
3608
  w && /* @__PURE__ */ i("span", { className: "text-gray-400 text-sm pointer-events-none select-none", children: s || "Build your formula..." }),
3593
- o.map((A, T) => A.type === "field" ? /* @__PURE__ */ b(
3609
+ o.map((S, T) => S.type === "field" ? /* @__PURE__ */ b(
3594
3610
  "span",
3595
3611
  {
3596
3612
  className: "inline-flex items-center gap-1 bg-blue-100 text-blue-800 text-sm px-2 py-0.5 rounded-full font-medium select-none",
3597
3613
  children: [
3598
- A.display,
3614
+ S.display,
3599
3615
  /* @__PURE__ */ i(
3600
3616
  "button",
3601
3617
  {
3602
3618
  type: "button",
3603
3619
  onMouseDown: (I) => {
3604
- I.preventDefault(), S(T);
3620
+ I.preventDefault(), A(T);
3605
3621
  },
3606
3622
  className: "text-blue-400 hover:text-blue-700 leading-none ml-0.5",
3607
- "aria-label": `Remove ${A.display}`,
3623
+ "aria-label": `Remove ${S.display}`,
3608
3624
  children: "×"
3609
3625
  }
3610
3626
  )
@@ -3618,13 +3634,13 @@ function So({
3618
3634
  I ? g.current.set(T, I) : g.current.delete(T);
3619
3635
  },
3620
3636
  type: "text",
3621
- value: A.value,
3637
+ value: S.value,
3622
3638
  onChange: (I) => N(T, I.target.value),
3623
3639
  onFocus: () => u(T),
3624
3640
  onBlur: () => u(null),
3625
3641
  className: "border-none outline-none bg-transparent text-sm font-mono p-0 m-0",
3626
3642
  style: {
3627
- width: `${Math.max(A.value.length * 9 + 8, d === T ? 40 : 14)}px`,
3643
+ width: `${Math.max(S.value.length * 9 + 8, d === T ? 40 : 14)}px`,
3628
3644
  minWidth: "14px",
3629
3645
  maxWidth: "200px"
3630
3646
  },
@@ -3637,8 +3653,8 @@ function So({
3637
3653
  "button",
3638
3654
  {
3639
3655
  type: "button",
3640
- onMouseDown: (A) => {
3641
- A.preventDefault(), C(o.length);
3656
+ onMouseDown: (S) => {
3657
+ S.preventDefault(), k(o.length);
3642
3658
  },
3643
3659
  className: "inline-flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800 hover:bg-blue-50 px-1.5 py-0.5 rounded transition-colors",
3644
3660
  title: "Insert a field",
@@ -3650,7 +3666,7 @@ function So({
3650
3666
  ),
3651
3667
  !w && /* @__PURE__ */ b("div", { className: "mt-2 text-xs bg-blue-50 text-blue-800 border border-blue-100 rounded px-2 py-1.5 font-mono break-words", children: [
3652
3668
  /* @__PURE__ */ i("span", { className: "font-sans font-semibold text-blue-500 uppercase tracking-wide mr-1", children: "Preview:" }),
3653
- o.map((A) => A.type === "field" ? `[${A.display}]` : A.value).join("")
3669
+ o.map((S) => S.type === "field" ? `[${S.display}]` : S.value).join("")
3654
3670
  ] }),
3655
3671
  t && /* @__PURE__ */ b(ve, { children: [
3656
3672
  /* @__PURE__ */ i(
@@ -3674,51 +3690,51 @@ function So({
3674
3690
  type: "text",
3675
3691
  placeholder: "Search fields...",
3676
3692
  value: c,
3677
- onChange: (A) => r(A.target.value),
3693
+ onChange: (S) => r(S.target.value),
3678
3694
  className: "w-full text-sm px-2 py-1 border border-gray-200 rounded outline-none focus:border-blue-300",
3679
- onKeyDown: (A) => {
3680
- A.key === "Escape" && m(!1), A.key === "Enter" && M.length > 0 && x(M[0]);
3695
+ onKeyDown: (S) => {
3696
+ S.key === "Escape" && m(!1), S.key === "Enter" && M.length > 0 && x(M[0]);
3681
3697
  }
3682
3698
  }
3683
3699
  ) }),
3684
3700
  /* @__PURE__ */ b("div", { className: "max-h-48 overflow-y-auto", children: [
3685
3701
  M.length === 0 && /* @__PURE__ */ i("p", { className: "text-xs text-gray-400 text-center py-3", children: "No matching fields" }),
3686
- M.map((A) => /* @__PURE__ */ b(
3702
+ M.map((S) => /* @__PURE__ */ b(
3687
3703
  "div",
3688
3704
  {
3689
3705
  onMouseDown: (T) => {
3690
- T.preventDefault(), x(A);
3706
+ T.preventDefault(), x(S);
3691
3707
  },
3692
3708
  className: "px-3 py-2 text-sm cursor-pointer flex items-center justify-between hover:bg-blue-50 group",
3693
3709
  children: [
3694
- /* @__PURE__ */ i("span", { className: "font-medium text-gray-800", children: A.display }),
3710
+ /* @__PURE__ */ i("span", { className: "font-medium text-gray-800", children: S.display }),
3695
3711
  /* @__PURE__ */ b("span", { className: "text-xs text-gray-400 font-mono group-hover:text-blue-400", children: [
3696
- A.id.slice(0, 8),
3712
+ S.id.slice(0, 8),
3697
3713
  "..."
3698
3714
  ] })
3699
3715
  ]
3700
3716
  },
3701
- A.id
3717
+ S.id
3702
3718
  ))
3703
3719
  ] })
3704
3720
  ]
3705
3721
  }
3706
3722
  )
3707
3723
  ] }),
3708
- a.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: a.map((A) => /* @__PURE__ */ b(
3724
+ a.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: a.map((S) => /* @__PURE__ */ b(
3709
3725
  "button",
3710
3726
  {
3711
3727
  type: "button",
3712
3728
  onMouseDown: (T) => {
3713
- T.preventDefault(), x(A, o.length);
3729
+ T.preventDefault(), x(S, o.length);
3714
3730
  },
3715
3731
  className: "text-xs bg-gray-100 hover:bg-blue-50 hover:text-blue-700 border text-gray-600 px-2 py-0.5 rounded-full transition-colors",
3716
3732
  children: [
3717
3733
  "+ ",
3718
- A.display
3734
+ S.display
3719
3735
  ]
3720
3736
  },
3721
- A.id
3737
+ S.id
3722
3738
  )) })
3723
3739
  ] });
3724
3740
  }
@@ -3794,16 +3810,16 @@ const No = R.object().shape({
3794
3810
  formula: R.string().nullable(),
3795
3811
  fetchExternalResults: R.boolean(),
3796
3812
  externalApiUrl: R.string().nullable()
3797
- }), ko = [
3813
+ }), Co = [
3798
3814
  { title: "Configurations", key: "basic" },
3799
3815
  { title: "Validations", key: "validation" }
3800
- ], Co = ({
3816
+ ], ko = ({
3801
3817
  isOpen: e,
3802
3818
  onClose: n,
3803
3819
  element: a
3804
3820
  }) => {
3805
3821
  var O;
3806
- const s = ko.filter(
3822
+ const s = Co.filter(
3807
3823
  (B) => !We.includes(a.inputType) || B.key !== "validation"
3808
3824
  ), { updateElement: o, formData: l } = se.useContext(be), [d, u] = D("basic"), [t, m] = D(!1), [c, r] = D("manual"), h = ((O = l == null ? void 0 : l.flatMap((B) => (B == null ? void 0 : B.questionData) || [])) == null ? void 0 : O.length) || 0, v = se.useMemo(() => (l == null ? void 0 : l.flatMap((B) => (B == null ? void 0 : B.questionData) || []).filter(
3809
3825
  (B) => {
@@ -3820,17 +3836,17 @@ const No = R.object().shape({
3820
3836
  handleSubmit: g,
3821
3837
  control: p,
3822
3838
  setValue: N,
3823
- watch: S,
3824
- trigger: C,
3825
- formState: { errors: x, isSubmitting: k, isValid: M },
3839
+ watch: A,
3840
+ trigger: k,
3841
+ formState: { errors: x, isSubmitting: C, isValid: M },
3826
3842
  reset: w
3827
- } = Ai({
3843
+ } = Si({
3828
3844
  resolver: wi(No),
3829
3845
  defaultValues: {
3830
3846
  ...a,
3831
3847
  options: a.options || []
3832
3848
  }
3833
- }), A = S(), { fields: T, append: I, remove: L } = ni({
3849
+ }), S = A(), { fields: T, append: I, remove: E } = ni({
3834
3850
  control: p,
3835
3851
  name: "options"
3836
3852
  }), {
@@ -3853,40 +3869,40 @@ const No = R.object().shape({
3853
3869
  }, [e, w]);
3854
3870
  const V = (B) => {
3855
3871
  o(B, a.sectionId), n();
3856
- }, Ae = {
3872
+ }, Se = {
3857
3873
  headers: {
3858
3874
  Authorization: `Bearer ${de("token")}`
3859
3875
  }
3860
3876
  }, ge = Y(async () => {
3861
3877
  var B, K, P;
3862
- if (!A.apiUrl || !/^https?:\/\//.test(A.apiUrl)) {
3878
+ if (!S.apiUrl || !/^https?:\/\//.test(S.apiUrl)) {
3863
3879
  xe.info("Please provide a valid API URL");
3864
3880
  return;
3865
3881
  }
3866
3882
  try {
3867
3883
  m(!0);
3868
- const { status: E, data: q } = await Pe.get(A.apiUrl, Ae);
3869
- if (E !== 200 || !q) {
3884
+ const { status: L, data: U } = await Pe.get(S.apiUrl, Se);
3885
+ if (L !== 200 || !U) {
3870
3886
  xe.error("Unexpected response from server.");
3871
3887
  return;
3872
3888
  }
3873
- const $ = q.data || q.record || q.result;
3889
+ const $ = U.data || U.record || U.result;
3874
3890
  if (!Array.isArray($)) {
3875
3891
  xe.error("Expected an array in response (data, record, or result).");
3876
3892
  return;
3877
3893
  }
3878
3894
  ((B = a.type) == null ? void 0 : B.toLowerCase()) === "datagrid" ? N("dataColumns", xi($)) : N("options", yi($));
3879
- } catch (E) {
3880
- const q = ((P = (K = E == null ? void 0 : E.response) == null ? void 0 : K.data) == null ? void 0 : P.message) || (E == null ? void 0 : E.message) || "Unable to load options";
3881
- xe.error(q);
3895
+ } catch (L) {
3896
+ const U = ((P = (K = L == null ? void 0 : L.response) == null ? void 0 : K.data) == null ? void 0 : P.message) || (L == null ? void 0 : L.message) || "Unable to load options";
3897
+ xe.error(U);
3882
3898
  } finally {
3883
3899
  m(!1);
3884
3900
  }
3885
- }, [a.type, N, A.apiUrl]), ue = ["manual", "api", "sheet"];
3886
- function Se() {
3901
+ }, [a.type, N, S.apiUrl]), ue = ["manual", "api", "sheet"];
3902
+ function Ae() {
3887
3903
  c === "api" && ge();
3888
3904
  }
3889
- const Ce = () => {
3905
+ const ke = () => {
3890
3906
  var B, K;
3891
3907
  return /* @__PURE__ */ b("div", { className: "flex flex-col justify-start gap-y-1", children: [
3892
3908
  /* @__PURE__ */ i("div", { className: "flex items-center mb-4 gap-x-5", children: ue == null ? void 0 : ue.map((P) => /* @__PURE__ */ b("label", { className: "items-center text-base capitalize gap-x-3", children: [
@@ -3895,7 +3911,7 @@ const No = R.object().shape({
3895
3911
  {
3896
3912
  type: "radio",
3897
3913
  name: "optionType",
3898
- onChange: (E) => r(E.target.value),
3914
+ onChange: (L) => r(L.target.value),
3899
3915
  value: P
3900
3916
  }
3901
3917
  ),
@@ -3909,9 +3925,9 @@ const No = R.object().shape({
3909
3925
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
3910
3926
  /* @__PURE__ */ b("div", { className: "relative flex items-center w-full mb-2", children: [
3911
3927
  /* @__PURE__ */ i(
3912
- W,
3928
+ z,
3913
3929
  {
3914
- watch: S,
3930
+ watch: A,
3915
3931
  label: "Load Options from Api",
3916
3932
  name: "apiUrl",
3917
3933
  errors: x,
@@ -3926,7 +3942,7 @@ const No = R.object().shape({
3926
3942
  /* @__PURE__ */ i(
3927
3943
  "button",
3928
3944
  {
3929
- onClick: Se,
3945
+ onClick: Ae,
3930
3946
  className: "px-3 py-1 text-xs text-white bg-gray-600 rounded",
3931
3947
  type: "button",
3932
3948
  children: "Load"
@@ -3946,24 +3962,24 @@ const No = R.object().shape({
3946
3962
  ) }),
3947
3963
  /* @__PURE__ */ b("div", { children: [
3948
3964
  /* @__PURE__ */ i("h3", { className: "mb-4 text-sm text-gray-500 font-semibold", children: ((B = a == null ? void 0 : a.type) == null ? void 0 : B.toLowerCase()) === "matrix" ? "Rows Options" : "Parent Options" }),
3949
- T == null ? void 0 : T.map((P, E) => /* @__PURE__ */ b(
3965
+ T == null ? void 0 : T.map((P, L) => /* @__PURE__ */ b(
3950
3966
  "div",
3951
3967
  {
3952
3968
  className: "flex items-center mb-1 gap-x-4 last:mb-0",
3953
3969
  children: [
3954
3970
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
3955
- W,
3971
+ z,
3956
3972
  {
3957
- watch: S,
3958
- label: E === 0 ? "Label" : "",
3959
- name: `options.${E}.label`,
3973
+ watch: A,
3974
+ label: L === 0 ? "Label" : "",
3975
+ name: `options.${L}.label`,
3960
3976
  register: f,
3961
3977
  errors: x,
3962
3978
  element: a,
3963
3979
  placeholder: "Label",
3964
- onChange: (q) => {
3965
- const j = q.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
3966
- N(`options.${E}.value`, j, {
3980
+ onChange: (U) => {
3981
+ const j = U.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
3982
+ N(`options.${L}.value`, j, {
3967
3983
  shouldValidate: !0,
3968
3984
  shouldDirty: !0
3969
3985
  });
@@ -3971,11 +3987,11 @@ const No = R.object().shape({
3971
3987
  }
3972
3988
  ) }),
3973
3989
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
3974
- W,
3990
+ z,
3975
3991
  {
3976
- watch: S,
3977
- label: E === 0 ? "Value" : "",
3978
- name: `options.${E}.value`,
3992
+ watch: A,
3993
+ label: L === 0 ? "Value" : "",
3994
+ name: `options.${L}.value`,
3979
3995
  register: f,
3980
3996
  errors: x,
3981
3997
  element: a,
@@ -3988,8 +4004,8 @@ const No = R.object().shape({
3988
4004
  disabled: T.length === 1,
3989
4005
  type: "button",
3990
4006
  className: "outline-none hover:opacity-80 disabled:opacity-40 disabled:cursor-not-allowed",
3991
- onClick: () => L(E),
3992
- children: /* @__PURE__ */ i(z, { icon: "iconamoon:sign-times-fill" })
4007
+ onClick: () => E(L),
4008
+ children: /* @__PURE__ */ i(J, { icon: "iconamoon:sign-times-fill" })
3993
4009
  }
3994
4010
  )
3995
4011
  ]
@@ -4006,7 +4022,7 @@ const No = R.object().shape({
4006
4022
  className: "flex items-center mt-2 text-sm font-medium text-gray-700 gap-x-1",
4007
4023
  onClick: () => I({ label: "", value: "", id: pe() }),
4008
4024
  children: [
4009
- /* @__PURE__ */ i(z, { icon: "qlementine-icons:plus-16" }),
4025
+ /* @__PURE__ */ i(J, { icon: "qlementine-icons:plus-16" }),
4010
4026
  " Add Option"
4011
4027
  ]
4012
4028
  }
@@ -4018,24 +4034,24 @@ const No = R.object().shape({
4018
4034
  /* @__PURE__ */ b("div", { children: [
4019
4035
  " ",
4020
4036
  /* @__PURE__ */ i("h3", { className: "mb-4 text-sm text-gray-500 font-semibold", children: ((K = a == null ? void 0 : a.type) == null ? void 0 : K.toLowerCase()) === "matrix" ? "Columns Options" : "Child Options" }),
4021
- F == null ? void 0 : F.map((P, E) => /* @__PURE__ */ b(
4037
+ F == null ? void 0 : F.map((P, L) => /* @__PURE__ */ b(
4022
4038
  "div",
4023
4039
  {
4024
4040
  className: "flex items-center mb-1 gap-x-4 last:mb-0",
4025
4041
  children: [
4026
4042
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4027
- W,
4043
+ z,
4028
4044
  {
4029
- watch: S,
4030
- label: E === 0 ? "Label" : "",
4031
- name: `options1.${E}.label`,
4045
+ watch: A,
4046
+ label: L === 0 ? "Label" : "",
4047
+ name: `options1.${L}.label`,
4032
4048
  register: f,
4033
4049
  errors: x,
4034
4050
  element: a,
4035
4051
  placeholder: "Label",
4036
- onChange: (q) => {
4037
- const j = q.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4038
- N(`options1.${E}.value`, j, {
4052
+ onChange: (U) => {
4053
+ const j = U.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4054
+ N(`options1.${L}.value`, j, {
4039
4055
  shouldValidate: !0,
4040
4056
  shouldDirty: !0
4041
4057
  });
@@ -4043,11 +4059,11 @@ const No = R.object().shape({
4043
4059
  }
4044
4060
  ) }),
4045
4061
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4046
- W,
4062
+ z,
4047
4063
  {
4048
- watch: S,
4049
- label: E === 0 ? "Value" : "",
4050
- name: `options1.${E}.value`,
4064
+ watch: A,
4065
+ label: L === 0 ? "Value" : "",
4066
+ name: `options1.${L}.value`,
4051
4067
  register: f,
4052
4068
  errors: x,
4053
4069
  element: a,
@@ -4055,11 +4071,11 @@ const No = R.object().shape({
4055
4071
  }
4056
4072
  ) }),
4057
4073
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4058
- W,
4074
+ z,
4059
4075
  {
4060
- watch: S,
4061
- label: E === 0 ? "Key" : "",
4062
- name: `options1.${E}.key`,
4076
+ watch: A,
4077
+ label: L === 0 ? "Key" : "",
4078
+ name: `options1.${L}.key`,
4063
4079
  register: f,
4064
4080
  errors: x,
4065
4081
  element: a,
@@ -4072,8 +4088,8 @@ const No = R.object().shape({
4072
4088
  disabled: F.length === 1,
4073
4089
  type: "button",
4074
4090
  className: "outline-none hover:opacity-80 disabled:opacity-40 disabled:cursor-not-allowed",
4075
- onClick: () => ie(E),
4076
- children: /* @__PURE__ */ i(z, { icon: "iconamoon:sign-times-fill" })
4091
+ onClick: () => ie(L),
4092
+ children: /* @__PURE__ */ i(J, { icon: "iconamoon:sign-times-fill" })
4077
4093
  }
4078
4094
  )
4079
4095
  ]
@@ -4089,7 +4105,7 @@ const No = R.object().shape({
4089
4105
  className: "flex items-center mt-2 text-sm font-medium text-gray-700 gap-x-1",
4090
4106
  onClick: () => Z({ label: "", value: "", key: "", id: pe() }),
4091
4107
  children: [
4092
- /* @__PURE__ */ i(z, { icon: "qlementine-icons:plus-16" }),
4108
+ /* @__PURE__ */ i(J, { icon: "qlementine-icons:plus-16" }),
4093
4109
  " Add Option"
4094
4110
  ]
4095
4111
  }
@@ -4120,9 +4136,9 @@ const No = R.object().shape({
4120
4136
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
4121
4137
  /* @__PURE__ */ b("div", { className: "relative flex items-center w-full mb-2", children: [
4122
4138
  /* @__PURE__ */ i(
4123
- W,
4139
+ z,
4124
4140
  {
4125
- watch: S,
4141
+ watch: A,
4126
4142
  label: "Load Columns from Api",
4127
4143
  name: "apiUrl",
4128
4144
  errors: x,
@@ -4137,7 +4153,7 @@ const No = R.object().shape({
4137
4153
  /* @__PURE__ */ i(
4138
4154
  "button",
4139
4155
  {
4140
- onClick: Se,
4156
+ onClick: Ae,
4141
4157
  className: "px-3 py-1 text-xs text-white bg-gray-600 rounded",
4142
4158
  type: "button",
4143
4159
  children: "Load"
@@ -4156,7 +4172,7 @@ const No = R.object().shape({
4156
4172
  }
4157
4173
  ) }),
4158
4174
  /* @__PURE__ */ i("div", { className: "grid gap-y-3", children: X == null ? void 0 : X.map((B, K) => {
4159
- var P, E;
4175
+ var P, L;
4160
4176
  return /* @__PURE__ */ b(
4161
4177
  "div",
4162
4178
  {
@@ -4188,19 +4204,19 @@ const No = R.object().shape({
4188
4204
  register: f,
4189
4205
  name: `dataColumns.${K}.type`,
4190
4206
  setValue: N,
4191
- trigger: C,
4192
- value: A.dataColumns[K].type
4207
+ trigger: k,
4208
+ value: S.dataColumns[K].type
4193
4209
  }
4194
4210
  ) }),
4195
4211
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4196
- W,
4212
+ z,
4197
4213
  {
4198
- watch: S,
4214
+ watch: A,
4199
4215
  label: K === 0 ? "Display header" : "",
4200
4216
  name: `dataColumns.${K}.headerName`,
4201
4217
  register: f,
4202
- onChange: (q) => {
4203
- const j = q.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4218
+ onChange: (U) => {
4219
+ const j = U.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4204
4220
  N(`dataColumns.${K}.field`, j, {
4205
4221
  shouldValidate: !0,
4206
4222
  shouldDirty: !0
@@ -4212,9 +4228,9 @@ const No = R.object().shape({
4212
4228
  }
4213
4229
  ) }),
4214
4230
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4215
- W,
4231
+ z,
4216
4232
  {
4217
- watch: S,
4233
+ watch: A,
4218
4234
  label: K === 0 ? "Field key" : "",
4219
4235
  name: `dataColumns.${K}.field`,
4220
4236
  register: f,
@@ -4231,14 +4247,14 @@ const No = R.object().shape({
4231
4247
  type: "button",
4232
4248
  className: "outline-none hover:opacity-80 disabled:opacity-40 disabled:cursor-not-allowed",
4233
4249
  onClick: () => _(K),
4234
- children: /* @__PURE__ */ i(z, { icon: "iconamoon:sign-times-fill" })
4250
+ children: /* @__PURE__ */ i(J, { icon: "iconamoon:sign-times-fill" })
4235
4251
  }
4236
4252
  )
4237
4253
  ] }),
4238
- ((E = (P = A.dataColumns) == null ? void 0 : P[K]) == null ? void 0 : E.type) === "select" && /* @__PURE__ */ i("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4239
- W,
4254
+ ((L = (P = S.dataColumns) == null ? void 0 : P[K]) == null ? void 0 : L.type) === "select" && /* @__PURE__ */ i("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4255
+ z,
4240
4256
  {
4241
- watch: S,
4257
+ watch: A,
4242
4258
  label: "Options API URL",
4243
4259
  name: `dataColumns.${K}.optionsUrl`,
4244
4260
  register: f,
@@ -4268,23 +4284,23 @@ const No = R.object().shape({
4268
4284
  validate: !1
4269
4285
  }),
4270
4286
  children: [
4271
- /* @__PURE__ */ i(z, { icon: "qlementine-icons:plus-16" }),
4287
+ /* @__PURE__ */ i(J, { icon: "qlementine-icons:plus-16" }),
4272
4288
  " Add column"
4273
4289
  ]
4274
4290
  }
4275
4291
  )
4276
4292
  ] })
4277
4293
  ] }), Me = Y(async () => {
4278
- const B = de("token"), { status: K, data: P } = await Pe.get(A.url, {
4294
+ const B = de("token"), { status: K, data: P } = await Pe.get(S.url, {
4279
4295
  headers: {
4280
4296
  Authorization: `Bearer ${B}`
4281
4297
  }
4282
4298
  });
4283
4299
  K === 200 && N("options", (P == null ? void 0 : P.data) || P);
4284
- }, [N, A.url]);
4300
+ }, [N, S.url]);
4285
4301
  G(() => {
4286
- a.type === "document" && A.url && Me();
4287
- }, [A.url, a.type, Me]);
4302
+ a.type === "document" && S.url && Me();
4303
+ }, [S.url, a.type, Me]);
4288
4304
  const Ee = /* @__PURE__ */ i(
4289
4305
  "div",
4290
4306
  {
@@ -4300,7 +4316,7 @@ const No = R.object().shape({
4300
4316
  {
4301
4317
  className: "bg-white h-10 w-10 flex justify-center items-center absolute top-1 -left-12 rounded-lg hover:bg-gray-50",
4302
4318
  onClick: n,
4303
- children: /* @__PURE__ */ i(z, { icon: "tabler:x", iconClass: "text-xl" })
4319
+ children: /* @__PURE__ */ i(J, { icon: "tabler:x", iconClass: "text-xl" })
4304
4320
  }
4305
4321
  ),
4306
4322
  /* @__PURE__ */ i("div", { className: "w-full pt-4", children: /* @__PURE__ */ i(
@@ -4324,9 +4340,9 @@ const No = R.object().shape({
4324
4340
  /* @__PURE__ */ b("div", { className: " max-h-[70vh] overflow-y-auto flex-1", children: [
4325
4341
  d === "basic" && /* @__PURE__ */ b("div", { className: "z-10 flex flex-col w-full gap-5 px-6", children: [
4326
4342
  li.includes(a.inputType) && /* @__PURE__ */ i(ve, { children: /* @__PURE__ */ i(
4327
- W,
4343
+ z,
4328
4344
  {
4329
- watch: S,
4345
+ watch: A,
4330
4346
  label: "Value",
4331
4347
  name: "value",
4332
4348
  register: f,
@@ -4336,9 +4352,9 @@ const No = R.object().shape({
4336
4352
  ) }),
4337
4353
  !li.includes(a.inputType) && !We.includes(a.inputType) && /* @__PURE__ */ b(ve, { children: [
4338
4354
  /* @__PURE__ */ i(
4339
- W,
4355
+ z,
4340
4356
  {
4341
- watch: S,
4357
+ watch: A,
4342
4358
  label: "Label",
4343
4359
  name: "inputLabel",
4344
4360
  register: f,
@@ -4348,9 +4364,9 @@ const No = R.object().shape({
4348
4364
  ),
4349
4365
  " ",
4350
4366
  a.type.toLowerCase() === "cascadeselect" && /* @__PURE__ */ i(
4351
- W,
4367
+ z,
4352
4368
  {
4353
- watch: S,
4369
+ watch: A,
4354
4370
  label: "Child Label",
4355
4371
  name: "childLabel",
4356
4372
  register: f,
@@ -4360,9 +4376,9 @@ const No = R.object().shape({
4360
4376
  )
4361
4377
  ] }),
4362
4378
  so.includes(a.inputType) && /* @__PURE__ */ i(
4363
- W,
4379
+ z,
4364
4380
  {
4365
- watch: S,
4381
+ watch: A,
4366
4382
  label: "Placeholder",
4367
4383
  name: "placeholder",
4368
4384
  register: f,
@@ -4371,9 +4387,9 @@ const No = R.object().shape({
4371
4387
  }
4372
4388
  ),
4373
4389
  ao.includes(a.inputType) && /* @__PURE__ */ i(
4374
- W,
4390
+ z,
4375
4391
  {
4376
- watch: S,
4392
+ watch: A,
4377
4393
  label: "Prefix",
4378
4394
  name: "prefix",
4379
4395
  register: f,
@@ -4384,9 +4400,9 @@ const No = R.object().shape({
4384
4400
  to.includes(a.inputType) && /* @__PURE__ */ b("div", { className: "grid gap-y-4", children: [
4385
4401
  /* @__PURE__ */ i(bo, {}),
4386
4402
  /* @__PURE__ */ i(
4387
- W,
4403
+ z,
4388
4404
  {
4389
- watch: S,
4405
+ watch: A,
4390
4406
  label: "Api Url",
4391
4407
  name: "url",
4392
4408
  register: f,
@@ -4411,8 +4427,8 @@ const No = R.object().shape({
4411
4427
  register: f,
4412
4428
  name: "method",
4413
4429
  setValue: N,
4414
- trigger: C,
4415
- value: S("method")
4430
+ trigger: k,
4431
+ value: A("method")
4416
4432
  }
4417
4433
  ),
4418
4434
  /* @__PURE__ */ i(
@@ -4432,8 +4448,8 @@ const No = R.object().shape({
4432
4448
  register: f,
4433
4449
  name: "responseType",
4434
4450
  setValue: N,
4435
- trigger: C,
4436
- value: S("responseType")
4451
+ trigger: k,
4452
+ value: A("responseType")
4437
4453
  }
4438
4454
  )
4439
4455
  ] }),
@@ -4443,13 +4459,13 @@ const No = R.object().shape({
4443
4459
  onChange: (B) => {
4444
4460
  N("denominators", B);
4445
4461
  },
4446
- value: S("denominators")
4462
+ value: A("denominators")
4447
4463
  }
4448
4464
  ),
4449
4465
  !li.includes(a.inputType) && !We.includes(a.inputType) && /* @__PURE__ */ i(
4450
- W,
4466
+ z,
4451
4467
  {
4452
- watch: S,
4468
+ watch: A,
4453
4469
  label: "Short Description",
4454
4470
  name: "description",
4455
4471
  register: f,
@@ -4466,29 +4482,29 @@ const No = R.object().shape({
4466
4482
  register: f,
4467
4483
  name: "dateFormat",
4468
4484
  setValue: N,
4469
- trigger: C,
4470
- value: S("dateFormat")
4485
+ trigger: k,
4486
+ value: A("dateFormat")
4471
4487
  }
4472
4488
  ),
4473
4489
  /* @__PURE__ */ i(
4474
- W,
4490
+ z,
4475
4491
  {
4476
- watch: S,
4492
+ watch: A,
4477
4493
  label: "Allow Range",
4478
4494
  name: "canHaveDateRange",
4479
4495
  register: f,
4480
4496
  errors: x,
4481
4497
  element: a,
4482
4498
  type: "checkbox",
4483
- value: A.canHaveDateRange
4499
+ value: S.canHaveDateRange
4484
4500
  }
4485
4501
  ),
4486
- (A == null ? void 0 : A.canHaveDateRange) && /* @__PURE__ */ b("div", { className: "grid grid-cols-2 gap-4", children: [
4502
+ (S == null ? void 0 : S.canHaveDateRange) && /* @__PURE__ */ b("div", { className: "grid grid-cols-2 gap-4", children: [
4487
4503
  /* @__PURE__ */ i(
4488
4504
  vi,
4489
4505
  {
4490
4506
  name: "minDate",
4491
- value: A == null ? void 0 : A.minDate,
4507
+ value: S == null ? void 0 : S.minDate,
4492
4508
  onGetValue: N,
4493
4509
  placeholder: "Select min date"
4494
4510
  }
@@ -4497,38 +4513,38 @@ const No = R.object().shape({
4497
4513
  vi,
4498
4514
  {
4499
4515
  name: "maxDate",
4500
- value: A == null ? void 0 : A.minDate,
4516
+ value: S == null ? void 0 : S.minDate,
4501
4517
  onGetValue: N,
4502
4518
  placeholder: "Select max date",
4503
- minDate: A == null ? void 0 : A.minDate
4519
+ minDate: S == null ? void 0 : S.minDate
4504
4520
  }
4505
4521
  )
4506
4522
  ] }),
4507
4523
  /* @__PURE__ */ i(
4508
- W,
4524
+ z,
4509
4525
  {
4510
- watch: S,
4526
+ watch: A,
4511
4527
  label: "Allow Year Picker",
4512
4528
  name: "allowYearPicker",
4513
4529
  register: f,
4514
4530
  errors: x,
4515
4531
  element: a,
4516
4532
  type: "checkbox",
4517
- value: A.allowYearPicker
4533
+ value: S.allowYearPicker
4518
4534
  }
4519
4535
  )
4520
4536
  ] }),
4521
4537
  a.type.toLowerCase() === "country" && /* @__PURE__ */ i(
4522
- W,
4538
+ z,
4523
4539
  {
4524
- watch: S,
4540
+ watch: A,
4525
4541
  label: "Allow States",
4526
4542
  name: "showState",
4527
4543
  register: f,
4528
4544
  errors: x,
4529
4545
  element: a,
4530
4546
  type: "checkbox",
4531
- value: A.showState
4547
+ value: S.showState
4532
4548
  }
4533
4549
  ),
4534
4550
  a.type.toLowerCase() === "selectfield" && /* @__PURE__ */ i(
@@ -4548,14 +4564,14 @@ const No = R.object().shape({
4548
4564
  register: f,
4549
4565
  name: "selectType",
4550
4566
  setValue: N,
4551
- trigger: C,
4552
- value: S("selectType")
4567
+ trigger: k,
4568
+ value: A("selectType")
4553
4569
  }
4554
4570
  ),
4555
4571
  a.type.toLowerCase() === "grid" && /* @__PURE__ */ i(
4556
- W,
4572
+ z,
4557
4573
  {
4558
- watch: S,
4574
+ watch: A,
4559
4575
  label: "Number of columns (max: 4)",
4560
4576
  name: "columns",
4561
4577
  register: f,
@@ -4568,9 +4584,9 @@ const No = R.object().shape({
4568
4584
  a.type.toLowerCase() === "document" && /* @__PURE__ */ b("div", { className: "grid gap-y-6", children: [
4569
4585
  /* @__PURE__ */ b("div", { className: "grid gap-y-1", children: [
4570
4586
  /* @__PURE__ */ i(
4571
- W,
4587
+ z,
4572
4588
  {
4573
- watch: S,
4589
+ watch: A,
4574
4590
  label: "Document Options Url",
4575
4591
  name: "url",
4576
4592
  register: f,
@@ -4583,9 +4599,9 @@ const No = R.object().shape({
4583
4599
  ] }),
4584
4600
  /* @__PURE__ */ b("div", { className: "grid gap-y-1", children: [
4585
4601
  /* @__PURE__ */ i(
4586
- W,
4602
+ z,
4587
4603
  {
4588
- watch: S,
4604
+ watch: A,
4589
4605
  label: "Document Validation Url",
4590
4606
  name: "validationUrl",
4591
4607
  register: f,
@@ -4596,9 +4612,9 @@ const No = R.object().shape({
4596
4612
  /* @__PURE__ */ i(go, {})
4597
4613
  ] }),
4598
4614
  /* @__PURE__ */ i("div", { className: "grid gap-y-1", children: /* @__PURE__ */ i(
4599
- W,
4615
+ z,
4600
4616
  {
4601
- watch: S,
4617
+ watch: A,
4602
4618
  label: "Signature Page Url",
4603
4619
  name: "signatureLink",
4604
4620
  register: f,
@@ -4610,16 +4626,16 @@ const No = R.object().shape({
4610
4626
  a.type.toLowerCase() === "datagrid" && Be(),
4611
4627
  a.type.toLowerCase() === "file" && /* @__PURE__ */ b(ve, { children: [
4612
4628
  /* @__PURE__ */ i(
4613
- W,
4629
+ z,
4614
4630
  {
4615
- watch: S,
4631
+ watch: A,
4616
4632
  label: "Allow Multiple Uploads",
4617
4633
  name: "isMultiple",
4618
4634
  register: f,
4619
4635
  errors: x,
4620
4636
  element: a,
4621
4637
  type: "checkbox",
4622
- value: A.isMultiple
4638
+ value: S.isMultiple
4623
4639
  }
4624
4640
  ),
4625
4641
  /* @__PURE__ */ i(
@@ -4628,36 +4644,36 @@ const No = R.object().shape({
4628
4644
  element: {
4629
4645
  options: ro,
4630
4646
  id: "acceptedFiles",
4631
- value: A == null ? void 0 : A.acceptedFiles
4647
+ value: S == null ? void 0 : S.acceptedFiles
4632
4648
  },
4633
- validationData: { register: f, setValue: N, trigger: C, watch: S },
4649
+ validationData: { register: f, setValue: N, trigger: k, watch: A },
4634
4650
  placeholder: "Choose file types"
4635
4651
  }
4636
4652
  )
4637
4653
  ] }),
4638
- uo.includes(a.inputType) && Ce(),
4654
+ uo.includes(a.inputType) && ke(),
4639
4655
  /* @__PURE__ */ b("div", { children: [
4640
4656
  /* @__PURE__ */ i("div", { className: "w-[150px] mb-4", children: /* @__PURE__ */ i(
4641
- W,
4657
+ z,
4642
4658
  {
4643
- watch: S,
4659
+ watch: A,
4644
4660
  label: "Toggle Visibility",
4645
4661
  name: "isHidden",
4646
4662
  register: f,
4647
4663
  errors: x,
4648
4664
  element: a,
4649
4665
  type: "checkbox",
4650
- value: A.isHidden
4666
+ value: S.isHidden
4651
4667
  }
4652
4668
  ) }),
4653
4669
  " ",
4654
- A.isHidden && /* @__PURE__ */ i(
4670
+ S.isHidden && /* @__PURE__ */ i(
4655
4671
  xo,
4656
4672
  {
4657
4673
  register: f,
4658
4674
  setValue: N,
4659
- trigger: C,
4660
- watch: S,
4675
+ trigger: k,
4676
+ watch: A,
4661
4677
  id: a == null ? void 0 : a.id
4662
4678
  }
4663
4679
  )
@@ -4665,9 +4681,9 @@ const No = R.object().shape({
4665
4681
  a.type.toLowerCase() === "calculatedfield" && /* @__PURE__ */ b("div", { className: "grid gap-y-2 mb-4", children: [
4666
4682
  /* @__PURE__ */ i("label", { className: "block text-sm font-medium text-[#344054] font-onest", children: "Formula" }),
4667
4683
  /* @__PURE__ */ i(
4668
- So,
4684
+ Ao,
4669
4685
  {
4670
- value: S("formula") || "",
4686
+ value: A("formula") || "",
4671
4687
  onChange: (B) => N("formula", B, {
4672
4688
  shouldValidate: !0,
4673
4689
  shouldDirty: !0
@@ -4679,22 +4695,22 @@ const No = R.object().shape({
4679
4695
  ] }),
4680
4696
  a.type.toLowerCase() === "polling" && /* @__PURE__ */ b("div", { className: "grid gap-y-4 mb-4 mt-2", children: [
4681
4697
  /* @__PURE__ */ i(
4682
- W,
4698
+ z,
4683
4699
  {
4684
- watch: S,
4700
+ watch: A,
4685
4701
  label: "Fetch results from external API",
4686
4702
  name: "fetchExternalResults",
4687
4703
  register: f,
4688
4704
  errors: x,
4689
4705
  element: a,
4690
4706
  type: "checkbox",
4691
- value: A.fetchExternalResults
4707
+ value: S.fetchExternalResults
4692
4708
  }
4693
4709
  ),
4694
- A.fetchExternalResults && /* @__PURE__ */ i(
4695
- W,
4710
+ S.fetchExternalResults && /* @__PURE__ */ i(
4711
+ z,
4696
4712
  {
4697
- watch: S,
4713
+ watch: A,
4698
4714
  label: "External API URL (returns options results)",
4699
4715
  name: "externalApiUrl",
4700
4716
  register: f,
@@ -4708,23 +4724,23 @@ const No = R.object().shape({
4708
4724
  !We.includes(a.type.toLowerCase()) && d === "validation" && /* @__PURE__ */ b("div", { className: "z-10 flex flex-col w-full gap-5 px-6", children: [
4709
4725
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-6", children: [
4710
4726
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4711
- W,
4727
+ z,
4712
4728
  {
4713
- watch: S,
4729
+ watch: A,
4714
4730
  label: "Required",
4715
4731
  name: "isRequired",
4716
4732
  register: f,
4717
4733
  errors: x,
4718
4734
  element: a,
4719
4735
  type: "checkbox",
4720
- value: A.isRequired
4736
+ value: S.isRequired
4721
4737
  }
4722
4738
  ) }),
4723
4739
  " ",
4724
4740
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4725
- W,
4741
+ z,
4726
4742
  {
4727
- watch: S,
4743
+ watch: A,
4728
4744
  label: "Error message text",
4729
4745
  name: "requiredMessage",
4730
4746
  register: f,
@@ -4736,9 +4752,9 @@ const No = R.object().shape({
4736
4752
  oo.includes(a.inputType) && /* @__PURE__ */ b(ve, { children: [
4737
4753
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-6", children: [
4738
4754
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4739
- W,
4755
+ z,
4740
4756
  {
4741
- watch: S,
4757
+ watch: A,
4742
4758
  label: "Min Length",
4743
4759
  name: "minLength",
4744
4760
  register: f,
@@ -4749,9 +4765,9 @@ const No = R.object().shape({
4749
4765
  ) }),
4750
4766
  " ",
4751
4767
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4752
- W,
4768
+ z,
4753
4769
  {
4754
- watch: S,
4770
+ watch: A,
4755
4771
  label: "Error message text",
4756
4772
  name: "minLengthMessage",
4757
4773
  register: f,
@@ -4762,9 +4778,9 @@ const No = R.object().shape({
4762
4778
  ] }),
4763
4779
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-6", children: [
4764
4780
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4765
- W,
4781
+ z,
4766
4782
  {
4767
- watch: S,
4783
+ watch: A,
4768
4784
  label: "Max Length",
4769
4785
  name: "maxLength",
4770
4786
  register: f,
@@ -4775,9 +4791,9 @@ const No = R.object().shape({
4775
4791
  ) }),
4776
4792
  " ",
4777
4793
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4778
- W,
4794
+ z,
4779
4795
  {
4780
- watch: S,
4796
+ watch: A,
4781
4797
  label: "Error message text",
4782
4798
  name: "maxLengthMessage",
4783
4799
  register: f,
@@ -4790,9 +4806,9 @@ const No = R.object().shape({
4790
4806
  lo.includes(a.inputType) && /* @__PURE__ */ b(ve, { children: [
4791
4807
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-6", children: [
4792
4808
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4793
- W,
4809
+ z,
4794
4810
  {
4795
- watch: S,
4811
+ watch: A,
4796
4812
  label: "Min Amount",
4797
4813
  name: "minAmount",
4798
4814
  register: f,
@@ -4803,9 +4819,9 @@ const No = R.object().shape({
4803
4819
  ) }),
4804
4820
  " ",
4805
4821
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4806
- W,
4822
+ z,
4807
4823
  {
4808
- watch: S,
4824
+ watch: A,
4809
4825
  label: "Error message text",
4810
4826
  name: "minAmountMessage",
4811
4827
  register: f,
@@ -4816,9 +4832,9 @@ const No = R.object().shape({
4816
4832
  ] }),
4817
4833
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-6", children: [
4818
4834
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4819
- W,
4835
+ z,
4820
4836
  {
4821
- watch: S,
4837
+ watch: A,
4822
4838
  label: "Max Amount",
4823
4839
  name: "maxAmount",
4824
4840
  register: f,
@@ -4829,9 +4845,9 @@ const No = R.object().shape({
4829
4845
  ) }),
4830
4846
  " ",
4831
4847
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4832
- W,
4848
+ z,
4833
4849
  {
4834
- watch: S,
4850
+ watch: A,
4835
4851
  label: "Error message text",
4836
4852
  name: "maxAmountMessage",
4837
4853
  register: f,
@@ -4858,10 +4874,10 @@ const No = R.object().shape({
4858
4874
  "button",
4859
4875
  {
4860
4876
  type: "submit",
4861
- disabled: !M || k,
4877
+ disabled: !M || C,
4862
4878
  style: { background: (y == null ? void 0 : y.buttonColor) || "#333" },
4863
- className: `flex-1 px-4 py-2.5 ${!M || k ? "bg-[#F2F4F7]" : "bg-[#2563EB]"} ${!M || k ? "text-[#98A2B3]" : "text-white"} rounded-lg shadow-xs font-semibold font-onest disabled:opacity-50 editor_option__save`,
4864
- children: k ? "Saving..." : "Save"
4879
+ className: `flex-1 px-4 py-2.5 ${!M || C ? "bg-[#F2F4F7]" : "bg-[#2563EB]"} ${!M || C ? "text-[#98A2B3]" : "text-white"} rounded-lg shadow-xs font-semibold font-onest disabled:opacity-50 editor_option__save`,
4880
+ children: C ? "Saving..." : "Save"
4865
4881
  }
4866
4882
  )
4867
4883
  ] })
@@ -4886,7 +4902,7 @@ const No = R.object().shape({
4886
4902
  }, [n.id, n.sectionId, l]);
4887
4903
  return /* @__PURE__ */ b("div", { className: "w-full min-w-0", children: [
4888
4904
  s && /* @__PURE__ */ i(
4889
- Co,
4905
+ ko,
4890
4906
  {
4891
4907
  isOpen: s,
4892
4908
  onClose: () => o(!1),
@@ -4929,7 +4945,7 @@ const No = R.object().shape({
4929
4945
  className: "text-sm outline-none hover:opacity-80 py-1 text-gray-600",
4930
4946
  onClick: () => d(n == null ? void 0 : n.id, n.sectionId),
4931
4947
  title: "Duplicate",
4932
- children: /* @__PURE__ */ i(z, { icon: "tabler:copy", iconClass: "text-base" })
4948
+ children: /* @__PURE__ */ i(J, { icon: "tabler:copy", iconClass: "text-base" })
4933
4949
  }
4934
4950
  ),
4935
4951
  /* @__PURE__ */ i(
@@ -4939,7 +4955,7 @@ const No = R.object().shape({
4939
4955
  className: "text-sm outline-none hover:opacity-80 text-gray-600 py-1",
4940
4956
  onClick: () => o(!0),
4941
4957
  title: "Edit",
4942
- children: /* @__PURE__ */ i(z, { icon: "circum:edit", iconClass: "text-base" })
4958
+ children: /* @__PURE__ */ i(J, { icon: "circum:edit", iconClass: "text-base" })
4943
4959
  }
4944
4960
  ),
4945
4961
  /* @__PURE__ */ i(
@@ -4949,7 +4965,7 @@ const No = R.object().shape({
4949
4965
  className: "text-sm outline-none hover:opacity-80 text-gray-600 py-1",
4950
4966
  onClick: m,
4951
4967
  title: "Remove",
4952
- children: /* @__PURE__ */ i(z, { icon: "iconamoon:trash", iconClass: "text-base" })
4968
+ children: /* @__PURE__ */ i(J, { icon: "iconamoon:trash", iconClass: "text-base" })
4953
4969
  }
4954
4970
  )
4955
4971
  ] })
@@ -4973,7 +4989,7 @@ function Mo({
4973
4989
  } = n || {};
4974
4990
  let u;
4975
4991
  return l && (u = l()[e.id]), /* @__PURE__ */ i(
4976
- W,
4992
+ z,
4977
4993
  {
4978
4994
  placeholder: e.placeholder,
4979
4995
  type: e.inputType,
@@ -5085,7 +5101,7 @@ function Bo({
5085
5101
  element: e,
5086
5102
  validationData: n
5087
5103
  }) {
5088
- var k;
5104
+ var C;
5089
5105
  const { register: a = () => ({}), setValue: s, watch: o } = n || {}, [l, d] = D(), [u, t] = D(!1), [m, c] = D(!1), [r, h] = D(""), v = o && o(e == null ? void 0 : e.id);
5090
5106
  G(() => {
5091
5107
  d(v);
@@ -5094,26 +5110,26 @@ function Bo({
5094
5110
  G(() => {
5095
5111
  a(e.id);
5096
5112
  }, [e.id, a]);
5097
- const { url: g, method: p, responseType: N } = e || {}, C = {
5113
+ const { url: g, method: p, responseType: N } = e || {}, k = {
5098
5114
  headers: {
5099
5115
  Authorization: `Bearer ${de("token")}`
5100
5116
  }
5101
5117
  }, x = Y(
5102
5118
  async (M) => {
5103
- var w, A, T, I, L, F, Z, ie, X, he, _;
5119
+ var w, S, T, I, E, F, Z, ie, X, he, _;
5104
5120
  if (!(!g || !p)) {
5105
5121
  t(!0);
5106
5122
  try {
5107
5123
  let V;
5108
5124
  if (p.toLowerCase() === "get") {
5109
5125
  const ce = `${g}?value=${M}`;
5110
- V = await Pe.get(ce, C);
5126
+ V = await Pe.get(ce, k);
5111
5127
  } else if (p.toLowerCase() === "post")
5112
- V = await Pe.post(g, { value: M }, C);
5128
+ V = await Pe.post(g, { value: M }, k);
5113
5129
  else
5114
5130
  throw new Error("Unsupported HTTP method");
5115
- V.status === 200 && ((((A = (w = V == null ? void 0 : V.data) == null ? void 0 : w.data) == null ? void 0 : A.status) || ((T = V == null ? void 0 : V.data) == null ? void 0 : T.status)) === !0 ? (c(!0), N === "string" ? h(
5116
- ((L = (I = V == null ? void 0 : V.data) == null ? void 0 : I.data) == null ? void 0 : L.description) || ((F = V == null ? void 0 : V.data) == null ? void 0 : F.description) || "Validation successful"
5131
+ V.status === 200 && ((((S = (w = V == null ? void 0 : V.data) == null ? void 0 : w.data) == null ? void 0 : S.status) || ((T = V == null ? void 0 : V.data) == null ? void 0 : T.status)) === !0 ? (c(!0), N === "string" ? h(
5132
+ ((E = (I = V == null ? void 0 : V.data) == null ? void 0 : I.data) == null ? void 0 : E.description) || ((F = V == null ? void 0 : V.data) == null ? void 0 : F.description) || "Validation successful"
5117
5133
  ) : f(
5118
5134
  ((ie = (Z = V == null ? void 0 : V.data) == null ? void 0 : Z.data) == null ? void 0 : ie.description) || ((X = V == null ? void 0 : V.data) == null ? void 0 : X.description) || {}
5119
5135
  )) : (console.error("Invalid input:", M), h("Unable to validate input"), c(!1)));
@@ -5142,7 +5158,7 @@ function Bo({
5142
5158
  {
5143
5159
  placeholder: (e == null ? void 0 : e.placeholder) || "",
5144
5160
  type: (e == null ? void 0 : e.inputType) || "text",
5145
- className: J("field-control", e == null ? void 0 : e.customClass),
5161
+ className: q("field-control", e == null ? void 0 : e.customClass),
5146
5162
  ...a(e == null ? void 0 : e.id),
5147
5163
  onChange: (M) => {
5148
5164
  d(M.target.value), s(e == null ? void 0 : e.id, M.target.value);
@@ -5184,7 +5200,7 @@ function Bo({
5184
5200
  }
5185
5201
  )
5186
5202
  ] }),
5187
- m && !u && /* @__PURE__ */ i("span", { className: "block pr-3 text-lg text-green-600", children: /* @__PURE__ */ i(z, { icon: "gg:check-o" }) })
5203
+ m && !u && /* @__PURE__ */ i("span", { className: "block pr-3 text-lg text-green-600", children: /* @__PURE__ */ i(J, { icon: "gg:check-o" }) })
5188
5204
  ] })
5189
5205
  ] }),
5190
5206
  r && N === "string" && /* @__PURE__ */ i(
@@ -5194,7 +5210,7 @@ function Bo({
5194
5210
  children: r
5195
5211
  }
5196
5212
  ),
5197
- N === "object" && /* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-6 mt-2 text-sm text-gray-600", children: (k = Object.entries(y)) == null ? void 0 : k.map(([M, w]) => /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
5213
+ N === "object" && /* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-6 mt-2 text-sm text-gray-600", children: (C = Object.entries(y)) == null ? void 0 : C.map(([M, w]) => /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
5198
5214
  /* @__PURE__ */ b("span", { className: "font-semibold", children: [
5199
5215
  M,
5200
5216
  ":"
@@ -5297,10 +5313,10 @@ function Lo({
5297
5313
  ) });
5298
5314
  }
5299
5315
  function Po({ element: e }) {
5300
- return /* @__PURE__ */ i("div", { className: J("py-6", e == null ? void 0 : e.customClass) });
5316
+ return /* @__PURE__ */ i("div", { className: q("py-6", e == null ? void 0 : e.customClass) });
5301
5317
  }
5302
5318
  function Ro({ element: e }) {
5303
- return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("hr", { className: J("border-gray-200 my-4", e == null ? void 0 : e.customClass) }) });
5319
+ return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("hr", { className: q("border-gray-200 my-4", e == null ? void 0 : e.customClass) }) });
5304
5320
  }
5305
5321
  function Do({
5306
5322
  element: e,
@@ -5433,7 +5449,7 @@ function Ko({
5433
5449
  onClick: () => l(e.id),
5434
5450
  className: "text-red-500 hover:text-red-700",
5435
5451
  "aria-label": "Delete row",
5436
- children: /* @__PURE__ */ i(z, { icon: "lets-icons:trash-duotone", iconClass: "text-xl" })
5452
+ children: /* @__PURE__ */ i(J, { icon: "lets-icons:trash-duotone", iconClass: "text-xl" })
5437
5453
  }
5438
5454
  ) })
5439
5455
  ] });
@@ -5576,18 +5592,18 @@ const qi = ({
5576
5592
  loading: y,
5577
5593
  disabled: f
5578
5594
  }) => {
5579
- const [g, p] = D(c ? [] : null), N = J("custom-select__control", e), S = ee(() => n, [n]);
5595
+ const [g, p] = D(c ? [] : null), N = q("custom-select__control", e), A = ee(() => n, [n]);
5580
5596
  return G(() => {
5581
- const C = n == null ? void 0 : n.find((x) => {
5582
- var k;
5583
- return typeof x.value == "string" && typeof t == "string" ? x.value.toLowerCase() === t.toLowerCase() : typeof x.value == "object" && typeof t == "object" ? ((k = x.value) == null ? void 0 : k.id) === (t == null ? void 0 : t.id) : x.value === t;
5597
+ const k = n == null ? void 0 : n.find((x) => {
5598
+ var C;
5599
+ return typeof x.value == "string" && typeof t == "string" ? x.value.toLowerCase() === t.toLowerCase() : typeof x.value == "object" && typeof t == "object" ? ((C = x.value) == null ? void 0 : C.id) === (t == null ? void 0 : t.id) : x.value === t;
5584
5600
  });
5585
- p(C || null);
5601
+ p(k || null);
5586
5602
  }, [t, n]), G(() => {
5587
5603
  g && l && o && (l(d, g == null ? void 0 : g.value), o(d), m == null || m(d));
5588
5604
  }, [d, g]), /* @__PURE__ */ b("div", { className: "custom-select", children: [
5589
5605
  u && !r && /* @__PURE__ */ i("label", { className: "custom-select__label", children: u }),
5590
- r && u && /* @__PURE__ */ i("label", { className: J("custom-select__floating-label", v), children: u }),
5606
+ r && u && /* @__PURE__ */ i("label", { className: q("custom-select__floating-label", v), children: u }),
5591
5607
  /* @__PURE__ */ i(
5592
5608
  ae,
5593
5609
  {
@@ -5598,29 +5614,29 @@ const qi = ({
5598
5614
  children: /* @__PURE__ */ b("div", { className: "custom-select__wrapper", children: [
5599
5615
  /* @__PURE__ */ b(ae.Button, { className: N, disabled: f, children: [
5600
5616
  y ? /* @__PURE__ */ i("span", { className: "custom-select__loading", children: "Fetching data..." }) : /* @__PURE__ */ i("span", { className: "custom-select__value", children: (g == null ? void 0 : g.label) || /* @__PURE__ */ i("span", { className: "custom-select__placeholder", children: a }) }),
5601
- /* @__PURE__ */ i("span", { className: "custom-select__icon", children: /* @__PURE__ */ i(z, { icon: "lucide:chevron-down" }) })
5617
+ /* @__PURE__ */ i("span", { className: "custom-select__icon", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) })
5602
5618
  ] }),
5603
5619
  /* @__PURE__ */ i(
5604
5620
  we,
5605
5621
  {
5606
5622
  as: se.Fragment,
5607
5623
  leave: "custom-select__transition",
5608
- children: /* @__PURE__ */ i(ae.Options, { className: "custom-select__options", anchor: "bottom", children: S == null ? void 0 : S.map((C, x) => /* @__PURE__ */ i(
5624
+ children: /* @__PURE__ */ i(ae.Options, { className: "custom-select__options", anchor: "bottom", children: A == null ? void 0 : A.map((k, x) => /* @__PURE__ */ i(
5609
5625
  ae.Option,
5610
5626
  {
5611
- value: C,
5612
- className: ({ active: k }) => J(
5627
+ value: k,
5628
+ className: ({ active: C }) => q(
5613
5629
  "custom-select__option",
5614
- k && "custom-select__option--active"
5630
+ C && "custom-select__option--active"
5615
5631
  ),
5616
- children: ({ selected: k }) => /* @__PURE__ */ i(
5632
+ children: ({ selected: C }) => /* @__PURE__ */ i(
5617
5633
  "span",
5618
5634
  {
5619
- className: J(
5635
+ className: q(
5620
5636
  "custom-select__option-label",
5621
- k && "custom-select__option--selected"
5637
+ C && "custom-select__option--selected"
5622
5638
  ),
5623
- children: C.label
5639
+ children: k.label
5624
5640
  }
5625
5641
  )
5626
5642
  },
@@ -5716,26 +5732,26 @@ const qi = ({
5716
5732
  }, []);
5717
5733
  const g = (N) => {
5718
5734
  if (!a && !h) {
5719
- const S = N + 1;
5720
- c == null || c(d.id, S), m == null || m(d.id), s == null || s(S);
5735
+ const A = N + 1;
5736
+ c == null || c(d.id, A), m == null || m(d.id), s == null || s(A);
5721
5737
  }
5722
5738
  };
5723
5739
  return /* @__PURE__ */ b("div", { className: `flex gap-1 ${l}`, children: [
5724
5740
  /* @__PURE__ */ i("input", { type: "hidden", ...t(d.id) }),
5725
- Array.from({ length: n }, (N, S) => {
5726
- const C = y !== null ? S <= y : S < v;
5741
+ Array.from({ length: n }, (N, A) => {
5742
+ const k = y !== null ? A <= y : A < v;
5727
5743
  return /* @__PURE__ */ i(
5728
5744
  vn,
5729
5745
  {
5730
- icon: C ? "mdi:star" : "mdi:star-outline",
5731
- className: `cursor-pointer transition-colors ${C ? "text-yellow-400" : "text-gray-300"}`,
5746
+ icon: k ? "mdi:star" : "mdi:star-outline",
5747
+ className: `cursor-pointer transition-colors ${k ? "text-yellow-400" : "text-gray-300"}`,
5732
5748
  width: o,
5733
5749
  height: o,
5734
- onMouseEnter: () => !(a || h) && f(S),
5750
+ onMouseEnter: () => !(a || h) && f(A),
5735
5751
  onMouseLeave: () => !(a || h) && f(null),
5736
- onClick: () => g(S)
5752
+ onClick: () => g(A)
5737
5753
  },
5738
- S
5754
+ A
5739
5755
  );
5740
5756
  })
5741
5757
  ] });
@@ -5745,7 +5761,7 @@ function Vo({
5745
5761
  validationData: n
5746
5762
  }) {
5747
5763
  const { register: a = () => ({}) } = n || {}, s = (e == null ? void 0 : e.options) || [], o = (e == null ? void 0 : e.options1) || [];
5748
- return /* @__PURE__ */ i("div", { className: J("w-full overflow-x-auto", e.customClass), children: /* @__PURE__ */ b("table", { className: "w-full text-left border-collapse min-w-[600px] mb-2", children: [
5764
+ return /* @__PURE__ */ i("div", { className: q("w-full overflow-x-auto", e.customClass), children: /* @__PURE__ */ b("table", { className: "w-full text-left border-collapse min-w-[600px] mb-2", children: [
5749
5765
  /* @__PURE__ */ i("thead", { children: /* @__PURE__ */ b("tr", { children: [
5750
5766
  /* @__PURE__ */ i("th", { className: "p-3 border-b bg-gray-50/50" }),
5751
5767
  o.map((l) => /* @__PURE__ */ i(
@@ -5879,7 +5895,7 @@ function Uo({
5879
5895
  {
5880
5896
  placeholder: e.placeholder,
5881
5897
  type: e.inputType,
5882
- className: J("field-control", e.customClass),
5898
+ className: q("field-control", e.customClass),
5883
5899
  ...a(e.id),
5884
5900
  disabled: s
5885
5901
  }
@@ -5891,13 +5907,13 @@ function Uo({
5891
5907
  onClick: h,
5892
5908
  disabled: c || t,
5893
5909
  style: { background: (u == null ? void 0 : u.buttonColor) || "#333" },
5894
- className: J(
5910
+ className: q(
5895
5911
  "flex items-center gap-x-1 rounded-lg border border-gray-200 bg-gray-200 px-3 py-[10px] text-sm text-white",
5896
5912
  { "!opacity-60": c }
5897
5913
  ),
5898
5914
  children: [
5899
5915
  /* @__PURE__ */ i(
5900
- z,
5916
+ J,
5901
5917
  {
5902
5918
  icon: c ? "solar:refresh-outline" : t ? "solar:check-circle-bold" : "solar:pen-2-line-duotone",
5903
5919
  iconClass: c ? "animate-spin" : ""
@@ -6172,38 +6188,38 @@ function Wo({
6172
6188
  onChange: v,
6173
6189
  onError: y
6174
6190
  }) {
6175
- const [f, g] = D(""), [p, N] = D(null), [S, C] = D(""), x = ee(
6191
+ const [f, g] = D(""), [p, N] = D(null), [A, k] = D(""), x = ee(
6176
6192
  () => {
6177
- var L;
6178
- return (L = ui == null ? void 0 : ui.slice().sort((F, Z) => F.label.localeCompare(Z.label))) == null ? void 0 : L.map((F) => ({ ...F, phone: `+${F.phone}` }));
6193
+ var E;
6194
+ return (E = ui == null ? void 0 : ui.slice().sort((F, Z) => F.label.localeCompare(Z.label))) == null ? void 0 : E.map((F) => ({ ...F, phone: `+${F.phone}` }));
6179
6195
  },
6180
6196
  []
6181
- ), k = ee(() => f ? x.filter(
6182
- (L) => `${L.label} ${L.phone}`.toLowerCase().includes(f.toLowerCase())
6183
- ) : x, [f, x]), M = (p == null ? void 0 : p.min) || 10, w = (p == null ? void 0 : p.max) || 10, A = () => S ? `${(p == null ? void 0 : p.phone) || "+234"}-${S}` : "", T = (L) => {
6184
- if (!L) return { code: "+234", number: "" };
6185
- const F = L.split(/[-\s]/);
6197
+ ), C = ee(() => f ? x.filter(
6198
+ (E) => `${E.label} ${E.phone}`.toLowerCase().includes(f.toLowerCase())
6199
+ ) : x, [f, x]), M = (p == null ? void 0 : p.min) || 10, w = (p == null ? void 0 : p.max) || 10, S = () => A ? `${(p == null ? void 0 : p.phone) || "+234"}-${A}` : "", T = (E) => {
6200
+ if (!E) return { code: "+234", number: "" };
6201
+ const F = E.split(/[-\s]/);
6186
6202
  return { code: F[0], number: F.slice(1).join(" ") };
6187
6203
  };
6188
6204
  G(() => {
6189
6205
  if (d) {
6190
- const L = T(d);
6206
+ const E = T(d);
6191
6207
  N(
6192
- x.find((F) => F.phone === L.code) || x[0]
6193
- ), C(L.number);
6208
+ x.find((F) => F.phone === E.code) || x[0]
6209
+ ), k(E.number);
6194
6210
  }
6195
6211
  }, [d, x]);
6196
6212
  const I = ee(() => {
6197
6213
  if (u) return u;
6198
- const L = S.length;
6199
- return s && L === 0 ? "Phone number is required" : L > 0 && !/^\d+$/.test(S) ? "Phone number must contain only digits" : L > 0 && L < M ? `Minimum length is ${M}` : L > w ? `Maximum length is ${w}` : "";
6200
- }, [u, S, M, w, s]);
6214
+ const E = A.length;
6215
+ return s && E === 0 ? "Phone number is required" : E > 0 && !/^\d+$/.test(A) ? "Phone number must contain only digits" : E > 0 && E < M ? `Minimum length is ${M}` : E > w ? `Maximum length is ${w}` : "";
6216
+ }, [u, A, M, w, s]);
6201
6217
  return G(() => {
6202
- v == null || v(A()), y == null || y(I || null);
6203
- }, [S, p, I]), /* @__PURE__ */ b(
6218
+ v == null || v(S()), y == null || y(I || null);
6219
+ }, [A, p, I]), /* @__PURE__ */ b(
6204
6220
  "div",
6205
6221
  {
6206
- className: `relative formGroup ${I && !m ? "has-error" : ""} ${c ? "flex" : ""} ${!I && S.length > 0 && !m ? "is-valid" : ""}`,
6222
+ className: `relative formGroup ${I && !m ? "has-error" : ""} ${c ? "flex" : ""} ${!I && A.length > 0 && !m ? "is-valid" : ""}`,
6207
6223
  children: [
6208
6224
  e && /* @__PURE__ */ b(
6209
6225
  "label",
@@ -6219,30 +6235,30 @@ function Wo({
6219
6235
  }
6220
6236
  ),
6221
6237
  /* @__PURE__ */ b("div", { className: "relative !flex items-center input-control text-[#667085] !py-0 field-control", children: [
6222
- /* @__PURE__ */ i(z, { icon: "lucide:phone-call" }),
6238
+ /* @__PURE__ */ i(J, { icon: "lucide:phone-call" }),
6223
6239
  /* @__PURE__ */ i(De, { value: p, onChange: N, children: /* @__PURE__ */ b("div", { className: "relative", children: [
6224
6240
  /* @__PURE__ */ i(
6225
6241
  De.Input,
6226
6242
  {
6227
6243
  className: "pl-3 pr-4 mr-1 text-sm bg-white py-[10px] outline-none whitespace-nowrap max-w-[70px]",
6228
- displayValue: (L) => (L == null ? void 0 : L.phone) || "+234",
6244
+ displayValue: (E) => (E == null ? void 0 : E.phone) || "+234",
6229
6245
  placeholder: "+234",
6230
- onChange: (L) => g(L.target.value)
6246
+ onChange: (E) => g(E.target.value)
6231
6247
  }
6232
6248
  ),
6233
- /* @__PURE__ */ i(De.Button, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ i(z, { icon: "lucide:chevron-down" }) }),
6234
- /* @__PURE__ */ i(De.Options, { className: "absolute z-10 w-[250px] left-0 bg-white border rounded-md shadow-lg max-h-[400px] overflow-y-auto", children: k == null ? void 0 : k.map((L, F) => /* @__PURE__ */ b(
6249
+ /* @__PURE__ */ i(De.Button, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) }),
6250
+ /* @__PURE__ */ i(De.Options, { className: "absolute z-10 w-[250px] left-0 bg-white border rounded-md shadow-lg max-h-[400px] overflow-y-auto", children: C == null ? void 0 : C.map((E, F) => /* @__PURE__ */ b(
6235
6251
  De.Option,
6236
6252
  {
6237
- value: L,
6253
+ value: E,
6238
6254
  className: "px-4 py-2 cursor-pointer hover:bg-gray-100",
6239
6255
  children: [
6240
- L.phone,
6256
+ E.phone,
6241
6257
  " - ",
6242
- L.label
6258
+ E.label
6243
6259
  ]
6244
6260
  },
6245
- `${L.code}+ ${F}`
6261
+ `${E.code}+ ${F}`
6246
6262
  )) })
6247
6263
  ] }) }),
6248
6264
  /* @__PURE__ */ b("div", { className: "relative flex items-center flex-1 z-[1]", children: [
@@ -6251,12 +6267,12 @@ function Wo({
6251
6267
  {
6252
6268
  type: "tel",
6253
6269
  inputMode: "numeric",
6254
- value: S,
6270
+ value: A,
6255
6271
  disabled: t,
6256
6272
  readOnly: m,
6257
- onChange: (L) => {
6258
- const F = L.target.value.replace(/\D/g, "");
6259
- C(F);
6273
+ onChange: (E) => {
6274
+ const F = E.target.value.replace(/\D/g, "");
6275
+ k(F);
6260
6276
  },
6261
6277
  placeholder: n,
6262
6278
  className: "w-full px-3 outline-none",
@@ -6264,7 +6280,7 @@ function Wo({
6264
6280
  minLength: M
6265
6281
  }
6266
6282
  ),
6267
- /* @__PURE__ */ i("div", { className: "absolute flex text-xl -translate-y-1/2 top-1/2 right-4", children: !I && S.length > 0 && !m && /* @__PURE__ */ i("span", { className: "text-green-500", children: /* @__PURE__ */ i(z, { icon: "bi:check-lg" }) }) })
6283
+ /* @__PURE__ */ i("div", { className: "absolute flex text-xl -translate-y-1/2 top-1/2 right-4", children: !I && A.length > 0 && !m && /* @__PURE__ */ i("span", { className: "text-green-500", children: /* @__PURE__ */ i(J, { icon: "bi:check-lg" }) }) })
6268
6284
  ] })
6269
6285
  ] }),
6270
6286
  r && /* @__PURE__ */ i("span", { className: "block text-[#475467] font-light leading-4 text-xs mt-2", children: r })
@@ -6322,7 +6338,7 @@ function Jo({
6322
6338
  {
6323
6339
  placeholder: (e == null ? void 0 : e.placeholder) || "Enter Url link",
6324
6340
  type: "text",
6325
- className: J(
6341
+ className: q(
6326
6342
  "field-control",
6327
6343
  t && "!pl-16",
6328
6344
  e == null ? void 0 : e.customClass
@@ -6388,7 +6404,7 @@ function qo({
6388
6404
  {
6389
6405
  placeholder: (e == null ? void 0 : e.placeholder) || "Calculated result",
6390
6406
  type: "text",
6391
- className: J("field-control bg-gray-100 cursor-not-allowed", e == null ? void 0 : e.customClass),
6407
+ className: q("field-control bg-gray-100 cursor-not-allowed", e == null ? void 0 : e.customClass),
6392
6408
  value: u,
6393
6409
  readOnly: !0,
6394
6410
  disabled: !0,
@@ -6411,12 +6427,12 @@ function _o({
6411
6427
  if (!g.ok) return;
6412
6428
  const p = await g.json();
6413
6429
  let N = {};
6414
- Array.isArray(p) ? p.forEach((C) => {
6415
- const x = C.value || C.id || C.option, k = C.count || C.votes || C.value || 0;
6416
- x && (N[x] = Number(k));
6430
+ Array.isArray(p) ? p.forEach((k) => {
6431
+ const x = k.value || k.id || k.option, C = k.count || k.votes || k.value || 0;
6432
+ x && (N[x] = Number(C));
6417
6433
  }) : typeof p == "object" && (N = p), u(N);
6418
- const S = Object.values(N).reduce((C, x) => C + Number(x), 0);
6419
- m(S);
6434
+ const A = Object.values(N).reduce((k, x) => k + Number(x), 0);
6435
+ m(A);
6420
6436
  } catch (g) {
6421
6437
  console.error("Failed to fetch polling results", g);
6422
6438
  }
@@ -6437,7 +6453,7 @@ function _o({
6437
6453
  "div",
6438
6454
  {
6439
6455
  onClick: () => h(y.value),
6440
- className: J(
6456
+ className: q(
6441
6457
  "relative flex items-center justify-between p-3 border rounded-lg overflow-hidden transition-all duration-200",
6442
6458
  n != null && n.isReadOnly ? "cursor-default" : "cursor-pointer hover:border-blue-400 hover:bg-blue-50/50",
6443
6459
  p ? "border-blue-500 ring-1 ring-blue-500" : "border-gray-200"
@@ -6454,7 +6470,7 @@ function _o({
6454
6470
  /* @__PURE__ */ i(
6455
6471
  "div",
6456
6472
  {
6457
- className: J(
6473
+ className: q(
6458
6474
  "flex-shrink-0 w-5 h-5 rounded-full border flex items-center justify-center transition-colors",
6459
6475
  p ? "border-blue-500 bg-blue-500" : "border-gray-300 bg-white"
6460
6476
  ),
@@ -6464,7 +6480,7 @@ function _o({
6464
6480
  /* @__PURE__ */ i(
6465
6481
  "span",
6466
6482
  {
6467
- className: J(
6483
+ className: q(
6468
6484
  "font-medium text-sm",
6469
6485
  p ? "text-blue-900" : "text-gray-700"
6470
6486
  ),
@@ -6477,7 +6493,7 @@ function _o({
6477
6493
  g,
6478
6494
  "%"
6479
6495
  ] }),
6480
- p && /* @__PURE__ */ i(z, { icon: "material-symbols:check-circle", iconClass: "text-blue-500 text-lg" })
6496
+ p && /* @__PURE__ */ i(J, { icon: "material-symbols:check-circle", iconClass: "text-blue-500 text-lg" })
6481
6497
  ] }),
6482
6498
  /* @__PURE__ */ i(
6483
6499
  "input",
@@ -6559,7 +6575,7 @@ const fn = {
6559
6575
  }, Xe = ({ col: e, children: n, customClass: a }) => /* @__PURE__ */ i(
6560
6576
  "div",
6561
6577
  {
6562
- className: J("w-full bg-white min-w-0", a),
6578
+ className: q("w-full bg-white min-w-0", a),
6563
6579
  style: { gridColumn: e },
6564
6580
  children: n
6565
6581
  }
@@ -6583,80 +6599,80 @@ const fn = {
6583
6599
  [e.columns]
6584
6600
  ), [v, y] = D(null);
6585
6601
  G(() => {
6586
- const C = () => {
6602
+ const k = () => {
6587
6603
  y(null), t(!1);
6588
6604
  };
6589
- return document.addEventListener("dragend", C), () => document.removeEventListener("dragend", C);
6605
+ return document.addEventListener("dragend", k), () => document.removeEventListener("dragend", k);
6590
6606
  }, [t]);
6591
6607
  const f = Y(
6592
- (C, x) => {
6593
- C.preventDefault(), C.stopPropagation(), C.dataTransfer.dropEffect = "move", y(x);
6608
+ (k, x) => {
6609
+ k.preventDefault(), k.stopPropagation(), k.dataTransfer.dropEffect = "move", y(x);
6594
6610
  },
6595
6611
  []
6596
6612
  ), g = Y(
6597
- (C, x) => {
6598
- C.preventDefault(), C.stopPropagation(), y(x);
6613
+ (k, x) => {
6614
+ k.preventDefault(), k.stopPropagation(), y(x);
6599
6615
  },
6600
6616
  []
6601
6617
  ), p = Y(
6602
- (C, x) => {
6603
- const k = C.relatedTarget;
6604
- k && C.currentTarget.contains(k) || y((M) => M === x ? null : M);
6618
+ (k, x) => {
6619
+ const C = k.relatedTarget;
6620
+ C && k.currentTarget.contains(C) || y((M) => M === x ? null : M);
6605
6621
  },
6606
6622
  []
6607
6623
  ), N = Y(
6608
- (C, x) => {
6624
+ (k, x) => {
6609
6625
  var w;
6610
- C.preventDefault(), C.stopPropagation(), t(!1), y(null);
6611
- const k = x + 1, M = C.dataTransfer.getData("elementId");
6626
+ k.preventDefault(), k.stopPropagation(), t(!1), y(null);
6627
+ const C = x + 1, M = k.dataTransfer.getData("elementId");
6612
6628
  if (M) {
6613
6629
  m({
6614
6630
  draggedId: M,
6615
6631
  sectionId: n,
6616
6632
  targetGridId: e.id,
6617
- targetCol: k
6633
+ targetCol: C
6618
6634
  });
6619
6635
  return;
6620
6636
  }
6621
6637
  try {
6622
- const A = C.dataTransfer.getData("properties");
6623
- if (!A) return;
6624
- const T = JSON.parse(A);
6638
+ const S = k.dataTransfer.getData("properties");
6639
+ if (!S) return;
6640
+ const T = JSON.parse(S);
6625
6641
  if ((T == null ? void 0 : T.type) === "grid") return;
6626
- const I = d.find((Z) => Z.id === n), L = (w = I == null ? void 0 : I.questionData) == null ? void 0 : w.find(
6642
+ const I = d.find((Z) => Z.id === n), E = (w = I == null ? void 0 : I.questionData) == null ? void 0 : w.find(
6627
6643
  (Z) => {
6628
6644
  var ie;
6629
- return Z.gridId === e.id && ((ie = Z.gridPosition) == null ? void 0 : ie.col) === k;
6645
+ return Z.gridId === e.id && ((ie = Z.gridPosition) == null ? void 0 : ie.col) === C;
6630
6646
  }
6631
6647
  );
6632
- L && r(L.id, n);
6648
+ E && r(E.id, n);
6633
6649
  const F = {
6634
6650
  ...T,
6635
6651
  id: pe(),
6636
6652
  sectionId: n,
6637
6653
  gridId: e.id,
6638
- gridPosition: { col: k }
6654
+ gridPosition: { col: C }
6639
6655
  };
6640
6656
  u(F, n);
6641
- } catch (A) {
6642
- console.error("Drop failed in grid:", A), t(!1);
6657
+ } catch (S) {
6658
+ console.error("Drop failed in grid:", S), t(!1);
6643
6659
  }
6644
6660
  },
6645
6661
  [u, e.id, d, n, t, m]
6646
- ), S = (C, x, k) => {
6662
+ ), A = (k, x, C) => {
6647
6663
  var ie, X, he;
6648
- const M = C + 1, w = (X = (ie = d.find((_) => _.id === n)) == null ? void 0 : ie.questionData) == null ? void 0 : X.find(
6664
+ const M = k + 1, w = (X = (ie = d.find((_) => _.id === n)) == null ? void 0 : ie.questionData) == null ? void 0 : X.find(
6649
6665
  (_) => {
6650
6666
  var V;
6651
6667
  return _.gridId === e.id && ((V = _.gridPosition) == null ? void 0 : V.col) === M;
6652
6668
  }
6653
- ), A = (he = w == null ? void 0 : w.id) != null ? he : null, T = Array.isArray(a) && a.find((_) => {
6669
+ ), S = (he = w == null ? void 0 : w.id) != null ? he : null, T = Array.isArray(a) && a.find((_) => {
6654
6670
  var V;
6655
6671
  return ((V = _ == null ? void 0 : _.props) == null ? void 0 : V.col) === M;
6656
- }), I = c && v === C, L = !!T, F = c && !!l, Z = L && A && k === "edit" ? {
6672
+ }), I = c && v === k, E = !!T, F = c && !!l, Z = E && S && C === "edit" ? {
6657
6673
  draggable: !0,
6658
6674
  onDragStart: (_) => {
6659
- _.stopPropagation(), _.dataTransfer.setData("elementId", A), _.dataTransfer.setData("properties", A), _.dataTransfer.effectAllowed = "move", t(!0);
6675
+ _.stopPropagation(), _.dataTransfer.setData("elementId", S), _.dataTransfer.setData("properties", S), _.dataTransfer.effectAllowed = "move", t(!0);
6660
6676
  },
6661
6677
  onDragEnd: () => {
6662
6678
  y(null), t(!1);
@@ -6665,45 +6681,45 @@ const fn = {
6665
6681
  return /* @__PURE__ */ i("div", { className: "min-w-0", children: /* @__PURE__ */ b(
6666
6682
  "div",
6667
6683
  {
6668
- id: `grid-cell-${e.id}-${C}`,
6684
+ id: `grid-cell-${e.id}-${k}`,
6669
6685
  ...Z,
6670
- onDrop: (_) => N(_, C),
6671
- onDragEnter: (_) => g(_, C),
6672
- onDragOver: (_) => f(_, C),
6673
- onDragLeave: (_) => p(_, C),
6674
- className: J(
6686
+ onDrop: (_) => N(_, k),
6687
+ onDragEnter: (_) => g(_, k),
6688
+ onDragOver: (_) => f(_, k),
6689
+ onDragLeave: (_) => p(_, k),
6690
+ className: q(
6675
6691
  "relative border rounded-lg min-h-[110px] min-w-0",
6676
6692
  "flex items-center justify-center",
6677
6693
  "transition-all duration-200 ease-in-out",
6678
- k === "edit" ? "py-3 " : "",
6679
- L && k === "edit" && "cursor-grab active:cursor-grabbing border-none",
6694
+ C === "edit" ? "py-3 " : "",
6695
+ E && C === "edit" && "cursor-grab active:cursor-grabbing border-none",
6680
6696
  x,
6681
6697
  !F && !I && "bg-white border-gray-200 text-gray-300",
6682
- F && !I && !L && "bg-blue-50 border-blue-200 border-dashed text-blue-300",
6683
- F && !I && L && "bg-white border-orange-200 border-dashed",
6684
- I && !L && "bg-blue-100 border-blue-400 border-dashed shadow-inner scale-[1.01] text-blue-500",
6685
- I && L && "bg-orange-50 border-orange-400 border-dashed shadow-inner scale-[1.01] text-orange-500"
6698
+ F && !I && !E && "bg-blue-50 border-blue-200 border-dashed text-blue-300",
6699
+ F && !I && E && "bg-white border-orange-200 border-dashed",
6700
+ I && !E && "bg-blue-100 border-blue-400 border-dashed shadow-inner scale-[1.01] text-blue-500",
6701
+ I && E && "bg-orange-50 border-orange-400 border-dashed shadow-inner scale-[1.01] text-orange-500"
6686
6702
  ),
6687
6703
  children: [
6688
- L && k === "edit" && /* @__PURE__ */ i("div", { className: "absolute top-1 left-1/2 -translate-x-1/2 flex items-center gap-0.5 px-2 py-0.5 rounded-full bg-gray-100 hover:bg-blue-100 text-gray-400 hover:text-blue-500 cursor-grab active:cursor-grabbing transition-colors z-10 opacity-60 hover:opacity-100 pointer-events-none select-none", children: /* @__PURE__ */ i(z, { icon: "ph:dots-six-bold" }) }),
6689
- I && !L && /* @__PURE__ */ b("span", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1 text-blue-400 text-xs font-medium pointer-events-none", children: [
6690
- /* @__PURE__ */ i(z, { icon: "ph:plus-bold" }),
6704
+ E && C === "edit" && /* @__PURE__ */ i("div", { className: "absolute top-1 left-1/2 -translate-x-1/2 flex items-center gap-0.5 px-2 py-0.5 rounded-full bg-gray-100 hover:bg-blue-100 text-gray-400 hover:text-blue-500 cursor-grab active:cursor-grabbing transition-colors z-10 opacity-60 hover:opacity-100 pointer-events-none select-none", children: /* @__PURE__ */ i(J, { icon: "ph:dots-six-bold" }) }),
6705
+ I && !E && /* @__PURE__ */ b("span", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1 text-blue-400 text-xs font-medium pointer-events-none", children: [
6706
+ /* @__PURE__ */ i(J, { icon: "ph:plus-bold" }),
6691
6707
  "Drop here"
6692
6708
  ] }),
6693
- I && L && /* @__PURE__ */ i("span", { className: "absolute top-1 right-1 text-xs text-orange-400 font-medium pointer-events-none px-1 py-0.5 bg-orange-50 rounded", children: "Replace" }),
6709
+ I && E && /* @__PURE__ */ i("span", { className: "absolute top-1 right-1 text-xs text-orange-400 font-medium pointer-events-none px-1 py-0.5 bg-orange-50 rounded", children: "Replace" }),
6694
6710
  /* @__PURE__ */ i(
6695
6711
  "div",
6696
6712
  {
6697
- className: J(
6713
+ className: q(
6698
6714
  "w-full select-none min-w-0",
6699
6715
  I && "opacity-50 pointer-events-none"
6700
6716
  ),
6701
- children: T || /* @__PURE__ */ i("span", { className: "flex items-center justify-center text-gray-300", children: k === "edit" && /* @__PURE__ */ i(z, { icon: "ph:plus-bold" }) })
6717
+ children: T || /* @__PURE__ */ i("span", { className: "flex items-center justify-center text-gray-300", children: C === "edit" && /* @__PURE__ */ i(J, { icon: "ph:plus-bold" }) })
6702
6718
  }
6703
6719
  )
6704
6720
  ]
6705
6721
  }
6706
- ) }, C);
6722
+ ) }, k);
6707
6723
  };
6708
6724
  return /* @__PURE__ */ i("div", { className: "relative w-full", children: /* @__PURE__ */ i(
6709
6725
  "div",
@@ -6713,7 +6729,7 @@ const fn = {
6713
6729
  gridTemplateColumns: `repeat(${e.columns}, minmax(0, 1fr))`
6714
6730
  },
6715
6731
  children: h == null ? void 0 : h.map(
6716
- (C, x) => S(x, s, o)
6732
+ (k, x) => A(x, s, o)
6717
6733
  )
6718
6734
  }
6719
6735
  ) });
@@ -6742,13 +6758,13 @@ function ti({
6742
6758
  l(!1), a();
6743
6759
  },
6744
6760
  style: { height: `${o ? 52 : s ? 28 : 4}px` },
6745
- className: J(
6761
+ className: q(
6746
6762
  "w-full rounded-md flex items-center justify-center",
6747
6763
  "transition-all duration-150 ease-in-out overflow-hidden",
6748
6764
  o ? "bg-blue-50 border-2 border-blue-300 border-dashed" : s ? "border-2 border-blue-200 border-dashed" : "border-2 border-transparent"
6749
6765
  ),
6750
6766
  children: o && /* @__PURE__ */ b("span", { className: "flex items-center gap-1 text-blue-500 text-xs font-medium select-none pointer-events-none", children: [
6751
- /* @__PURE__ */ i(z, { icon: "octicon:plus-16" }),
6767
+ /* @__PURE__ */ i(J, { icon: "octicon:plus-16" }),
6752
6768
  "Drop here"
6753
6769
  ] })
6754
6770
  }
@@ -6781,32 +6797,32 @@ function Qo({ elementData: e, sectionId: n }) {
6781
6797
  const h = Y(
6782
6798
  (p) => {
6783
6799
  p.preventDefault(), p.stopPropagation();
6784
- const N = p.dataTransfer.getData("elementId"), S = p.currentTarget.id;
6785
- if (!N || !S || N === S) {
6800
+ const N = p.dataTransfer.getData("elementId"), A = p.currentTarget.id;
6801
+ if (!N || !A || N === A) {
6786
6802
  r();
6787
6803
  return;
6788
6804
  }
6789
- const C = m.find((k) => k.id === N), x = m.findIndex(
6790
- (k) => k.id === S
6805
+ const k = m.find((C) => C.id === N), x = m.findIndex(
6806
+ (C) => C.id === A
6791
6807
  );
6792
- C != null && C.gridId && x !== -1 ? d({ draggedId: N, sectionId: n, targetIndex: x }) : d({ draggedId: N, sectionId: n, targetId: S }), t(null), o(!1);
6808
+ k != null && k.gridId && x !== -1 ? d({ draggedId: N, sectionId: n, targetIndex: x }) : d({ draggedId: N, sectionId: n, targetId: A }), t(null), o(!1);
6793
6809
  },
6794
6810
  [n, d, o, r, m]
6795
6811
  ), v = Y(
6796
6812
  (p, N) => {
6797
6813
  p.preventDefault(), p.stopPropagation(), o(!1);
6798
- const S = p.dataTransfer.getData("elementId");
6799
- if (S) {
6800
- d({ draggedId: S, sectionId: n, targetIndex: N }), t(null);
6814
+ const A = p.dataTransfer.getData("elementId");
6815
+ if (A) {
6816
+ d({ draggedId: A, sectionId: n, targetIndex: N }), t(null);
6801
6817
  return;
6802
6818
  }
6803
6819
  try {
6804
- const C = JSON.parse(p.dataTransfer.getData("properties"));
6805
- if ((C == null ? void 0 : C.type) === "section") return;
6806
- const x = { ...C, id: pe(), sectionId: n };
6820
+ const k = JSON.parse(p.dataTransfer.getData("properties"));
6821
+ if ((k == null ? void 0 : k.type) === "section") return;
6822
+ const x = { ...k, id: pe(), sectionId: n };
6807
6823
  l(x, n, N), t(null);
6808
- } catch (C) {
6809
- console.error("Drop error:", C);
6824
+ } catch (k) {
6825
+ console.error("Drop error:", k);
6810
6826
  }
6811
6827
  },
6812
6828
  [l, n, o, d]
@@ -6816,13 +6832,13 @@ function Qo({ elementData: e, sectionId: n }) {
6816
6832
  {
6817
6833
  id: p.id,
6818
6834
  draggable: !0,
6819
- onDragStart: (S) => c(S, p.id),
6820
- onDragOver: N ? void 0 : (S) => {
6821
- S.preventDefault(), S.stopPropagation();
6835
+ onDragStart: (A) => c(A, p.id),
6836
+ onDragOver: N ? void 0 : (A) => {
6837
+ A.preventDefault(), A.stopPropagation();
6822
6838
  },
6823
6839
  onDrop: N ? void 0 : h,
6824
6840
  onDragEnd: r,
6825
- className: J(
6841
+ className: q(
6826
6842
  "cursor-grab active:cursor-grabbing border p-4 w-full rounded-lg",
6827
6843
  "transition-all duration-200 ease-in-out",
6828
6844
  u === p.id ? "opacity-40 scale-[0.98] bg-gray-100 border-dashed border-blue-300 shadow-inner" : u ? "bg-white border-dashed border-blue-200 shadow-sm" : "bg-white border-gray-200 shadow-sm hover:border-blue-300 hover:shadow-md"
@@ -6856,25 +6872,25 @@ function Qo({ elementData: e, sectionId: n }) {
6856
6872
  }
6857
6873
  ),
6858
6874
  g.map((p) => {
6859
- const N = m.findIndex((S) => S.id === p.id);
6875
+ const N = m.findIndex((A) => A.id === p.id);
6860
6876
  if (p.type === "grid") {
6861
- const S = f[p.id] || [], C = u === p.id, x = !!u && !C;
6877
+ const A = f[p.id] || [], k = u === p.id, x = !!u && !k;
6862
6878
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-0", children: [
6863
6879
  /* @__PURE__ */ i(
6864
6880
  "div",
6865
6881
  {
6866
6882
  id: p.id,
6867
6883
  draggable: !0,
6868
- onDragStart: (k) => c(k, p.id),
6869
- onDragOver: (k) => {
6870
- k.preventDefault(), k.stopPropagation();
6884
+ onDragStart: (C) => c(C, p.id),
6885
+ onDragOver: (C) => {
6886
+ C.preventDefault(), C.stopPropagation();
6871
6887
  },
6872
6888
  onDrop: h,
6873
6889
  onDragEnd: r,
6874
- className: J(
6890
+ className: q(
6875
6891
  "w-full p-4 border rounded-lg cursor-grab active:cursor-grabbing",
6876
6892
  "transition-all duration-200 ease-in-out",
6877
- C ? "opacity-40 scale-[0.98] bg-gray-100 border-dashed border-blue-400 shadow-inner" : x ? "bg-white border-dashed border-blue-200" : "bg-white border-gray-200 shadow-sm hover:border-blue-300 hover:shadow-md"
6893
+ k ? "opacity-40 scale-[0.98] bg-gray-100 border-dashed border-blue-400 shadow-inner" : x ? "bg-white border-dashed border-blue-200" : "bg-white border-gray-200 shadow-sm hover:border-blue-300 hover:shadow-md"
6878
6894
  ),
6879
6895
  children: /* @__PURE__ */ i(Ti, { element: p, state: "edit", children: /* @__PURE__ */ i(
6880
6896
  ei,
@@ -6883,10 +6899,10 @@ function Qo({ elementData: e, sectionId: n }) {
6883
6899
  sectionId: n,
6884
6900
  state: $o,
6885
6901
  draggedElementId: u,
6886
- children: S == null ? void 0 : S.map(
6887
- (k) => {
6902
+ children: A == null ? void 0 : A.map(
6903
+ (C) => {
6888
6904
  var M;
6889
- return /* @__PURE__ */ i(Xe, { col: (M = k.gridPosition) == null ? void 0 : M.col, children: y(k, !0) }, k.id);
6905
+ return /* @__PURE__ */ i(Xe, { col: (M = C.gridPosition) == null ? void 0 : M.col, children: y(C, !0) }, C.id);
6890
6906
  }
6891
6907
  )
6892
6908
  }
@@ -6931,7 +6947,7 @@ const Xo = Ze(Qo), es = R.object({
6931
6947
  watch: d,
6932
6948
  formState: { errors: u, isSubmitting: t, isValid: m },
6933
6949
  reset: c
6934
- } = Ai({
6950
+ } = Si({
6935
6951
  resolver: wi(es),
6936
6952
  defaultValues: a
6937
6953
  });
@@ -6949,14 +6965,14 @@ const Xo = Ze(Qo), es = R.object({
6949
6965
  {
6950
6966
  onClick: n,
6951
6967
  className: "absolute right-4 top-4 p-2 text-[#98A2B3] hover:bg-gray-50 rounded-lg",
6952
- children: /* @__PURE__ */ i(z, { icon: "tabler:x" })
6968
+ children: /* @__PURE__ */ i(J, { icon: "tabler:x" })
6953
6969
  }
6954
6970
  )
6955
6971
  ] }),
6956
6972
  /* @__PURE__ */ b("form", { onSubmit: l(r), className: "w-full", children: [
6957
6973
  /* @__PURE__ */ b("div", { className: "w-full px-6 flex flex-col gap-5 z-10", children: [
6958
6974
  /* @__PURE__ */ i(
6959
- W,
6975
+ z,
6960
6976
  {
6961
6977
  label: "Title",
6962
6978
  name: "title",
@@ -6966,7 +6982,7 @@ const Xo = Ze(Qo), es = R.object({
6966
6982
  }
6967
6983
  ),
6968
6984
  /* @__PURE__ */ i(
6969
- W,
6985
+ z,
6970
6986
  {
6971
6987
  label: "Description",
6972
6988
  name: "description",
@@ -6977,7 +6993,7 @@ const Xo = Ze(Qo), es = R.object({
6977
6993
  }
6978
6994
  ),
6979
6995
  /* @__PURE__ */ i(
6980
- W,
6996
+ z,
6981
6997
  {
6982
6998
  label: "Disable Section",
6983
6999
  name: "disabled",
@@ -6990,7 +7006,7 @@ const Xo = Ze(Qo), es = R.object({
6990
7006
  }
6991
7007
  ),
6992
7008
  /* @__PURE__ */ i(
6993
- W,
7009
+ z,
6994
7010
  {
6995
7011
  label: "Hide Section",
6996
7012
  name: "isHidden",
@@ -7034,7 +7050,7 @@ const Xo = Ze(Qo), es = R.object({
7034
7050
  {
7035
7051
  onClick: n,
7036
7052
  className: "absolute right-4 top-4 p-2 text-[#98A2B3] hover:bg-gray-50 rounded-lg",
7037
- children: /* @__PURE__ */ i(z, { icon: "tabler:x" })
7053
+ children: /* @__PURE__ */ i(J, { icon: "tabler:x" })
7038
7054
  }
7039
7055
  )
7040
7056
  ] }),
@@ -7280,7 +7296,7 @@ const Xo = Ze(Qo), es = R.object({
7280
7296
  className: "flex-1 h-full py-4 cursor-grab active:cursor-grabbing flex items-center gap-2",
7281
7297
  title: "Drag to reorder section",
7282
7298
  children: [
7283
- /* @__PURE__ */ i(z, { icon: "material-symbols:drag-indicator", iconClass: "text-gray-400 text-lg" }),
7299
+ /* @__PURE__ */ i(J, { icon: "material-symbols:drag-indicator", iconClass: "text-gray-400 text-lg" }),
7284
7300
  /* @__PURE__ */ i("h2", { className: "font-medium", children: e.title || "Section title" })
7285
7301
  ]
7286
7302
  }
@@ -7292,7 +7308,7 @@ const Xo = Ze(Qo), es = R.object({
7292
7308
  type: "button",
7293
7309
  className: "p-1 text-xs border rounded-lg",
7294
7310
  onClick: () => d(e),
7295
- children: /* @__PURE__ */ i(z, { icon: "fluent:edit-28-regular" })
7311
+ children: /* @__PURE__ */ i(J, { icon: "fluent:edit-28-regular" })
7296
7312
  }
7297
7313
  ),
7298
7314
  t > 1 && /* @__PURE__ */ i(
@@ -7301,7 +7317,7 @@ const Xo = Ze(Qo), es = R.object({
7301
7317
  type: "button",
7302
7318
  className: "p-1 text-xs border rounded-lg",
7303
7319
  onClick: () => u(e.id),
7304
- children: /* @__PURE__ */ i(z, { icon: "lets-icons:trash-duotone-line" })
7320
+ children: /* @__PURE__ */ i(J, { icon: "lets-icons:trash-duotone-line" })
7305
7321
  }
7306
7322
  ),
7307
7323
  /* @__PURE__ */ i(
@@ -7311,7 +7327,7 @@ const Xo = Ze(Qo), es = R.object({
7311
7327
  className: "p-1 text-xs rounded-lg",
7312
7328
  onClick: () => l(n),
7313
7329
  children: /* @__PURE__ */ i(
7314
- z,
7330
+ J,
7315
7331
  {
7316
7332
  icon: o.includes(n) ? "fa6-solid:chevron-up" : "fa6-solid:chevron-down",
7317
7333
  iconClass: "text-base"
@@ -7362,56 +7378,56 @@ const Xo = Ze(Qo), es = R.object({
7362
7378
  setFormData: p
7363
7379
  } = ye(be), N = re((r == null ? void 0 : r.length) || 0);
7364
7380
  G(() => {
7365
- var A;
7366
- v(((A = r[0]) == null ? void 0 : A.id) || null);
7381
+ var S;
7382
+ v(((S = r[0]) == null ? void 0 : S.id) || null);
7367
7383
  }, []), G(() => {
7368
7384
  (r == null ? void 0 : r.length) > N.current && t.current && requestAnimationFrame(() => {
7369
- var A;
7370
- (A = t.current) == null || A.scrollTo({
7385
+ var S;
7386
+ (S = t.current) == null || S.scrollTo({
7371
7387
  top: t.current.scrollHeight,
7372
7388
  behavior: "smooth"
7373
7389
  });
7374
7390
  }), N.current = (r == null ? void 0 : r.length) || 0;
7375
7391
  }, [r == null ? void 0 : r.length]);
7376
- const S = Y((A) => {
7377
- A.preventDefault(), A.dataTransfer.dropEffect = "move", t.current && (t.current.scrollTop = t.current.scrollHeight);
7378
- }, []), C = Y((A, T) => {
7392
+ const A = Y((S) => {
7393
+ S.preventDefault(), S.dataTransfer.dropEffect = "move", t.current && (t.current.scrollTop = t.current.scrollHeight);
7394
+ }, []), k = Y((S, T) => {
7379
7395
  p((I) => {
7380
- const L = I.findIndex((X) => X.id === A), F = I.findIndex((X) => X.id === T);
7381
- if (L === -1 || F === -1 || L === F) return I;
7382
- const Z = [...I], [ie] = Z.splice(L, 1);
7396
+ const E = I.findIndex((X) => X.id === S), F = I.findIndex((X) => X.id === T);
7397
+ if (E === -1 || F === -1 || E === F) return I;
7398
+ const Z = [...I], [ie] = Z.splice(E, 1);
7383
7399
  return Z.splice(F, 0, ie), Z;
7384
7400
  });
7385
7401
  }, [p]);
7386
- function x(A) {
7387
- f.includes(A) ? g(
7388
- (T) => T.filter((I) => I !== A)
7389
- ) : g((T) => [...T, A]);
7402
+ function x(S) {
7403
+ f.includes(S) ? g(
7404
+ (T) => T.filter((I) => I !== S)
7405
+ ) : g((T) => [...T, S]);
7390
7406
  }
7391
- function k(A) {
7392
- u.current = A, o(!0);
7407
+ function C(S) {
7408
+ u.current = S, o(!0);
7393
7409
  }
7394
- const M = (A) => {
7395
- var I, L, F, Z;
7410
+ const M = (S) => {
7411
+ var I, E, F, Z;
7396
7412
  const T = (ie, X = {}) => ({
7397
7413
  ...JSON.parse(JSON.stringify(ie)),
7398
7414
  ...X
7399
7415
  });
7400
- if (A.sections && Array.isArray(A.sections)) {
7401
- const X = A.sections.filter(Boolean).map((_) => {
7402
- var Ae;
7403
- const V = pe(), ce = (Ae = _.questionData) == null ? void 0 : Ae.map((ge) => T(ge, { id: pe(), sectionId: V }));
7416
+ if (S.sections && Array.isArray(S.sections)) {
7417
+ const X = S.sections.filter(Boolean).map((_) => {
7418
+ var Se;
7419
+ const V = pe(), ce = (Se = _.questionData) == null ? void 0 : Se.map((ge) => T(ge, { id: pe(), sectionId: V }));
7404
7420
  if (ce) {
7405
7421
  const ge = /* @__PURE__ */ new Map();
7406
- _.questionData.forEach((ue, Se) => {
7407
- ge.set(ue.id, ce[Se].id);
7422
+ _.questionData.forEach((ue, Ae) => {
7423
+ ge.set(ue.id, ce[Ae].id);
7408
7424
  }), ce.forEach((ue) => {
7409
7425
  ue.gridId && ge.has(ue.gridId) && (ue.gridId = ge.get(ue.gridId));
7410
7426
  });
7411
7427
  }
7412
7428
  return T(_, { id: V, questionData: ce || [] });
7413
7429
  });
7414
- r.length === 1 && r[0].title === "" && r[0].description === "" && (!((I = r[0]) != null && I.questionData) || ((F = (L = r[0]) == null ? void 0 : L.questionData) == null ? void 0 : F.length) === 0) ? (p(X), X.length > 0 && v((Z = X[0]) == null ? void 0 : Z.id)) : p((_) => [..._, ...X]);
7430
+ r.length === 1 && r[0].title === "" && r[0].description === "" && (!((I = r[0]) != null && I.questionData) || ((F = (E = r[0]) == null ? void 0 : E.questionData) == null ? void 0 : F.length) === 0) ? (p(X), X.length > 0 && v((Z = X[0]) == null ? void 0 : Z.id)) : p((_) => [..._, ...X]);
7415
7431
  }
7416
7432
  }, w = de("config");
7417
7433
  return /* @__PURE__ */ b(
@@ -7435,23 +7451,23 @@ const Xo = Ze(Qo), es = R.object({
7435
7451
  className: "relative flex flex-col flex-1 w-full gap-y-3 container overflow-y-auto",
7436
7452
  children: [
7437
7453
  r == null ? void 0 : r.map(
7438
- (A, T) => /* @__PURE__ */ i(
7454
+ (S, T) => /* @__PURE__ */ i(
7439
7455
  os,
7440
7456
  {
7441
- section: A,
7457
+ section: S,
7442
7458
  index: T,
7443
7459
  selectedSection: y,
7444
7460
  setSelectedSection: v,
7445
7461
  activeSections: f,
7446
7462
  toggleSection: x,
7447
- handleSectionEdit: k,
7463
+ handleSectionEdit: C,
7448
7464
  removeSection: m,
7449
7465
  formDataLength: r.length,
7450
- onDragOver: S,
7466
+ onDragOver: A,
7451
7467
  setIsDragging: h,
7452
- onReorderSection: C
7468
+ onReorderSection: k
7453
7469
  },
7454
- A.id
7470
+ S.id
7455
7471
  )
7456
7472
  ),
7457
7473
  /* @__PURE__ */ b("div", { className: "flex justify-center gap-x-4", children: [
@@ -7534,7 +7550,7 @@ const Xo = Ze(Qo), es = R.object({
7534
7550
  ) })
7535
7551
  ] });
7536
7552
  }, Bi = ({ loadingClass: e }) => {
7537
- const n = J(
7553
+ const n = q(
7538
7554
  "h-full w-full min-h-[300px] flex justify-center items-center",
7539
7555
  e
7540
7556
  );
@@ -7542,7 +7558,7 @@ const Xo = Ze(Qo), es = R.object({
7542
7558
  const a = de("config"), s = (a == null ? void 0 : a.loaderColor) || "#333";
7543
7559
  document.documentElement.style.setProperty("--loader-color", s);
7544
7560
  }, []), /* @__PURE__ */ i("div", { className: n, children: /* @__PURE__ */ i("span", { className: "loader" }) });
7545
- }, ds = se.lazy(() => import("./logic-flow-C_YsGfPF.js"));
7561
+ }, ds = se.lazy(() => import("./logic-flow-2lu0WlOE.js"));
7546
7562
  function us({
7547
7563
  questionData: e,
7548
7564
  uploadUrl: n,
@@ -7575,7 +7591,7 @@ function us({
7575
7591
  onDragOver: (r) => r.preventDefault(),
7576
7592
  onDrop: (r) => c(r),
7577
7593
  className: " h-full overflow-y-auto no-scrollbar max-h-[calc(100vh-80px)] flex-1 form_builder",
7578
- children: o === "canvas" ? /* @__PURE__ */ i(ss, { onAddTemplate: a, templates: s }) : /* @__PURE__ */ i(An, { fallback: /* @__PURE__ */ i(Bi, { loadingClass: "!w-full !h-full" }), children: /* @__PURE__ */ i(ds, { formData: m }) })
7594
+ children: o === "canvas" ? /* @__PURE__ */ i(ss, { onAddTemplate: a, templates: s }) : /* @__PURE__ */ i(Sn, { fallback: /* @__PURE__ */ i(Bi, { loadingClass: "!w-full !h-full" }), children: /* @__PURE__ */ i(ds, { formData: m }) })
7579
7595
  }
7580
7596
  ),
7581
7597
  o === "canvas" && /* @__PURE__ */ i(
@@ -7668,7 +7684,7 @@ const ri = [
7668
7684
  active:opacity-50 element_class`,
7669
7685
  draggable: !0,
7670
7686
  children: /* @__PURE__ */ b("span", { className: "flex flex-col items-center justify-center w-full gap-2", children: [
7671
- /* @__PURE__ */ i("span", { style: { color: t }, children: /* @__PURE__ */ i(z, { icon: g.icon, iconClass: "w-6 h-6" }) }),
7687
+ /* @__PURE__ */ i("span", { style: { color: t }, children: /* @__PURE__ */ i(J, { icon: g.icon, iconClass: "w-6 h-6" }) }),
7672
7688
  /* @__PURE__ */ i(
7673
7689
  "span",
7674
7690
  {
@@ -7684,7 +7700,7 @@ const ri = [
7684
7700
  ] }, y);
7685
7701
  }) }) })
7686
7702
  ] });
7687
- }, cs = Ze(ts), ke = ({
7703
+ }, cs = Ze(ts), Ce = ({
7688
7704
  text: e = "",
7689
7705
  isDisabled: n = !1,
7690
7706
  isLoading: a = !1,
@@ -7699,7 +7715,7 @@ const ri = [
7699
7715
  style: r,
7700
7716
  onClick: h
7701
7717
  }) => {
7702
- const v = J(
7718
+ const v = q(
7703
7719
  "btn inline-flex justify-center",
7704
7720
  {
7705
7721
  "pointer-events-none": a,
@@ -7739,9 +7755,9 @@ const ri = [
7739
7755
  ),
7740
7756
  "Submitting..."
7741
7757
  ] }) : /* @__PURE__ */ b("span", { className: "flex items-center", children: [
7742
- o && l === "left" && /* @__PURE__ */ i("span", { className: `mr-[6px] ${d}`, children: /* @__PURE__ */ i(z, { icon: o }) }),
7758
+ o && l === "left" && /* @__PURE__ */ i("span", { className: `mr-[6px] ${d}`, children: /* @__PURE__ */ i(J, { icon: o }) }),
7743
7759
  e && /* @__PURE__ */ i("span", { children: e }),
7744
- o && l === "right" && /* @__PURE__ */ i("span", { className: `ml-[6px] ${d}`, children: /* @__PURE__ */ i(z, { icon: o }) })
7760
+ o && l === "right" && /* @__PURE__ */ i("span", { className: `ml-[6px] ${d}`, children: /* @__PURE__ */ i(J, { icon: o }) })
7745
7761
  ] });
7746
7762
  return m ? /* @__PURE__ */ i("div", { className: v, children: y() }) : t ? /* @__PURE__ */ i(Dn, { to: t, className: v, children: y() }) : /* @__PURE__ */ i(
7747
7763
  "button",
@@ -7870,15 +7886,25 @@ function vs({
7870
7886
  redo: f,
7871
7887
  canUndo: g,
7872
7888
  canRedo: p
7873
- } = ye(be), [N, S] = D(!1), [C, x] = D(!1), [k, M] = D(e || ""), w = de("config");
7874
- function A() {
7875
- localStorage.setItem("formData", JSON.stringify(r)), a == null || a(r);
7889
+ } = ye(be), [N, A] = D(!1), [k, x] = D(!1), [C, M] = D(e || ""), w = de("config");
7890
+ function S() {
7891
+ try {
7892
+ localStorage.setItem("formData", JSON.stringify(r));
7893
+ } catch (E) {
7894
+ console.warn("Could not save formData to localStorage", E);
7895
+ }
7896
+ a == null || a(r);
7876
7897
  }
7877
7898
  function T() {
7878
- localStorage.setItem("formData", JSON.stringify(r)), s == null || s(r);
7899
+ try {
7900
+ localStorage.setItem("formData", JSON.stringify(r));
7901
+ } catch (E) {
7902
+ console.warn("Could not save formData to localStorage", E);
7903
+ }
7904
+ s == null || s(r);
7879
7905
  }
7880
7906
  function I() {
7881
- x(!1), u && k !== e && u(k.trim());
7907
+ x(!1), u && C !== e && u(C.trim());
7882
7908
  }
7883
7909
  return /* @__PURE__ */ b("div", { className: "px-[30px] py-3 flex justify-between items-center bg-[#F9F9FB] top_bar border-b h-full", children: [
7884
7910
  /* @__PURE__ */ b("span", { className: "flex items-center gap-x-2", children: [
@@ -7893,12 +7919,12 @@ function vs({
7893
7919
  }
7894
7920
  ),
7895
7921
  " ",
7896
- C ? /* @__PURE__ */ i(
7922
+ k ? /* @__PURE__ */ i(
7897
7923
  "input",
7898
7924
  {
7899
7925
  type: "text",
7900
- value: k,
7901
- onChange: (L) => M(L.target.value),
7926
+ value: C,
7927
+ onChange: (E) => M(E.target.value),
7902
7928
  onBlur: I,
7903
7929
  autoFocus: !0,
7904
7930
  className: "w-48 px-2 py-1 text-sm font-semibold outline-gray-100 input form_title"
@@ -7909,7 +7935,7 @@ function vs({
7909
7935
  title: "Click to edit",
7910
7936
  className: "text-base font-semibold cursor-pointer form_title",
7911
7937
  onClick: () => x(!0),
7912
- children: k || "Untitled"
7938
+ children: C || "Untitled"
7913
7939
  }
7914
7940
  )
7915
7941
  ] }),
@@ -7917,7 +7943,7 @@ function vs({
7917
7943
  ms,
7918
7944
  {
7919
7945
  isOpen: N,
7920
- onClose: () => S(!1),
7946
+ onClose: () => A(!1),
7921
7947
  element: void 0
7922
7948
  }
7923
7949
  ),
@@ -7932,7 +7958,7 @@ function vs({
7932
7958
  onClick: () => m("canvas"),
7933
7959
  children: [
7934
7960
  /* @__PURE__ */ i(
7935
- z,
7961
+ J,
7936
7962
  {
7937
7963
  icon: "mdi:view-dashboard-outline",
7938
7964
  iconClass: "text-base"
@@ -7951,14 +7977,14 @@ function vs({
7951
7977
  className: `px-3 flex items-center gap-1.5 border-l border-gray-300 transition-colors flow_view ${t === "flow" ? " bg-white font-medium" : "bg-gray-100 text-gray-500 hover:bg-gray-50"}`,
7952
7978
  onClick: () => m("flow"),
7953
7979
  children: [
7954
- /* @__PURE__ */ i(z, { icon: "mdi:sitemap-outline", iconClass: "text-base" }),
7980
+ /* @__PURE__ */ i(J, { icon: "mdi:sitemap-outline", iconClass: "text-base" }),
7955
7981
  " Flow"
7956
7982
  ]
7957
7983
  }
7958
7984
  )
7959
7985
  ] }),
7960
7986
  /* @__PURE__ */ i(
7961
- ke,
7987
+ Ce,
7962
7988
  {
7963
7989
  onClick: y,
7964
7990
  text: "",
@@ -7970,7 +7996,7 @@ function vs({
7970
7996
  }
7971
7997
  ),
7972
7998
  /* @__PURE__ */ i(
7973
- ke,
7999
+ Ce,
7974
8000
  {
7975
8001
  onClick: f,
7976
8002
  text: "",
@@ -7982,7 +8008,7 @@ function vs({
7982
8008
  }
7983
8009
  ),
7984
8010
  c && /* @__PURE__ */ i(
7985
- ke,
8011
+ Ce,
7986
8012
  {
7987
8013
  onClick: c,
7988
8014
  text: "Versions",
@@ -7993,9 +8019,9 @@ function vs({
7993
8019
  }
7994
8020
  ),
7995
8021
  /* @__PURE__ */ i(
7996
- ke,
8022
+ Ce,
7997
8023
  {
7998
- onClick: () => h((L) => !L),
8024
+ onClick: () => h((E) => !E),
7999
8025
  text: v ? "Hide Preview" : "Preview",
8000
8026
  btnClass: "px-2 bg-transparent font-medium text-sm form_preview",
8001
8027
  icon: v ? "iconamoon:eye-off-duotone" : "solar:eye-bold-duotone",
@@ -8006,9 +8032,9 @@ function vs({
8006
8032
  }
8007
8033
  ),
8008
8034
  /* @__PURE__ */ i(
8009
- ke,
8035
+ Ce,
8010
8036
  {
8011
- onClick: A,
8037
+ onClick: S,
8012
8038
  text: "Save",
8013
8039
  btnClass: "px-2 bg-transparent font-medium text-sm form_save__btn",
8014
8040
  icon: "lets-icons:save-duotone",
@@ -8019,7 +8045,7 @@ function vs({
8019
8045
  }
8020
8046
  ),
8021
8047
  /* @__PURE__ */ i(
8022
- ke,
8048
+ Ce,
8023
8049
  {
8024
8050
  onClick: T,
8025
8051
  text: "Publish",
@@ -8257,7 +8283,7 @@ const Oe = ({ element: e, validationData: n }) => {
8257
8283
  e.description && /* @__PURE__ */ i("small", { className: "block text-gray-400 mt-0.5 text-xs", children: e.description })
8258
8284
  ] }) : null;
8259
8285
  }, Ge = (e, n) => e != null && e.allowEdit ? { ...n, isReadOnly: !1 } : n;
8260
- function As({ form_data: e, options: n }) {
8286
+ function Ss({ form_data: e, options: n }) {
8261
8287
  const a = (o, l) => /* @__PURE__ */ i("div", { className: "min-w-0", children: /* @__PURE__ */ i(ei, { element: o, customClass: "p-0 min-h-[60px] border-none", children: l == null ? void 0 : l.map((d) => {
8262
8288
  var u, t, m;
8263
8289
  return /* @__PURE__ */ b(
@@ -8283,7 +8309,7 @@ function As({ form_data: e, options: n }) {
8283
8309
  return /* @__PURE__ */ b(
8284
8310
  "div",
8285
8311
  {
8286
- className: J(
8312
+ className: q(
8287
8313
  "group relative grid gap-y-[6px] min-w-0",
8288
8314
  o.elementClass
8289
8315
  ),
@@ -8318,7 +8344,7 @@ function As({ form_data: e, options: n }) {
8318
8344
  ] }, o.id);
8319
8345
  }) });
8320
8346
  }
8321
- function Ss({ form_data: e, options: n, current: a }) {
8347
+ function As({ form_data: e, options: n, current: a }) {
8322
8348
  var s, o;
8323
8349
  return /* @__PURE__ */ i("div", { className: "grid gap-y-3 multi_section__content min-w-0", children: (o = (s = e[a]) == null ? void 0 : s.questionData) == null ? void 0 : o.map((l) => {
8324
8350
  var d, u, t, m;
@@ -8358,7 +8384,7 @@ function Ss({ form_data: e, options: n, current: a }) {
8358
8384
  return l.gridId ? null : /* @__PURE__ */ b(
8359
8385
  "div",
8360
8386
  {
8361
- className: J(
8387
+ className: q(
8362
8388
  "group relative grid gap-y-[6px] min-w-0",
8363
8389
  l.elementClass
8364
8390
  ),
@@ -8418,7 +8444,7 @@ function Ns({ element: e, options: n, onNext: a, onPrev: s, isFirst: o, isLast:
8418
8444
  return /* @__PURE__ */ b(
8419
8445
  "div",
8420
8446
  {
8421
- className: J("group relative grid gap-y-[6px] min-w-0 w-full", c.elementClass),
8447
+ className: q("group relative grid gap-y-[6px] min-w-0 w-full", c.elementClass),
8422
8448
  children: [
8423
8449
  /* @__PURE__ */ i(
8424
8450
  Oe,
@@ -8456,7 +8482,7 @@ function Ns({ element: e, options: n, onNext: a, onPrev: s, isFirst: o, isLast:
8456
8482
  /* @__PURE__ */ i("div", { className: "text-left w-full mb-8", children: e.type === "grid" ? t(e) : m(e) }),
8457
8483
  !d && /* @__PURE__ */ b("div", { className: "flex items-center gap-4 mt-8", children: [
8458
8484
  /* @__PURE__ */ i(
8459
- ke,
8485
+ Ce,
8460
8486
  {
8461
8487
  type: "button",
8462
8488
  text: l ? n != null && n.isSubmitting ? "Submitting..." : "Submit" : "OK",
@@ -8468,7 +8494,7 @@ function Ns({ element: e, options: n, onNext: a, onPrev: s, isFirst: o, isLast:
8468
8494
  ),
8469
8495
  !l && /* @__PURE__ */ i("span", { className: "text-xs text-gray-400 font-medium hidden sm:inline-block", children: "press Enter ↵" }),
8470
8496
  !o && /* @__PURE__ */ b("button", { type: "button", onClick: s, className: "text-gray-400 hover:text-gray-600 font-medium text-sm ml-auto flex items-center gap-1 transition-colors", children: [
8471
- /* @__PURE__ */ i(z, { icon: "material-symbols:arrow-upward-rounded", iconClass: "text-lg" }),
8497
+ /* @__PURE__ */ i(J, { icon: "material-symbols:arrow-upward-rounded", iconClass: "text-lg" }),
8472
8498
  "Back"
8473
8499
  ] })
8474
8500
  ] })
@@ -8479,10 +8505,10 @@ function Ns({ element: e, options: n, onNext: a, onPrev: s, isFirst: o, isLast:
8479
8505
  }
8480
8506
  );
8481
8507
  }
8482
- function ks(e) {
8508
+ function Cs(e) {
8483
8509
  return e.reduce((n, a) => (n[a.id] = a.value, n), {});
8484
8510
  }
8485
- const Cs = ({
8511
+ const ks = ({
8486
8512
  form_data: e,
8487
8513
  answerData: n = [],
8488
8514
  ignoreValidation: a = !1,
@@ -8494,42 +8520,42 @@ const Cs = ({
8494
8520
  hideFooter: t = !1,
8495
8521
  uploadUrl: m
8496
8522
  }) => {
8497
- var Be, Me, Ee, O, B, K, P, E, q, $;
8523
+ var Be, Me, Ee, O, B, K, P, L, U, $;
8498
8524
  const { setAnswerData: c, setUploadUrl: r, apiActivityCount: h } = ye(be), [v, y] = D(0), [f, g] = D(0), p = ee(
8499
8525
  () => e.filter((j) => !j.isHidden).map((j) => {
8500
- var U;
8526
+ var W;
8501
8527
  return j.isDisabled || j.disabled ? {
8502
8528
  ...j,
8503
- questionData: (U = j == null ? void 0 : j.questionData) == null ? void 0 : U.map((Q) => ({
8529
+ questionData: (W = j == null ? void 0 : j.questionData) == null ? void 0 : W.map((Q) => ({
8504
8530
  ...Q,
8505
8531
  isDisabled: !0
8506
8532
  }))
8507
8533
  } : j;
8508
8534
  }),
8509
8535
  [e]
8510
- ), N = (Be = p == null ? void 0 : p.length) != null ? Be : 0, S = de("config"), C = Y(
8511
- async (j, H, U) => {
8536
+ ), N = (Be = p == null ? void 0 : p.length) != null ? Be : 0, A = de("config"), k = Y(
8537
+ async (j, H, W) => {
8512
8538
  const Q = xs({
8513
8539
  formData: p,
8514
8540
  isReadOnly: l,
8515
8541
  answerData: j
8516
8542
  // use current form data to evaluate visibility
8517
8543
  });
8518
- return wi(Q)(j, H, U);
8544
+ return wi(Q)(j, H, W);
8519
8545
  },
8520
8546
  [p, l]
8521
- ), x = Ai({
8522
- resolver: C,
8547
+ ), x = Si({
8548
+ resolver: k,
8523
8549
  mode: "onSubmit",
8524
8550
  defaultValues: {}
8525
8551
  }), {
8526
- register: k,
8552
+ register: C,
8527
8553
  setValue: M,
8528
8554
  control: w,
8529
- handleSubmit: A,
8555
+ handleSubmit: S,
8530
8556
  reset: T,
8531
8557
  getValues: I,
8532
- watch: L,
8558
+ watch: E,
8533
8559
  formState: { errors: F, isSubmitting: Z },
8534
8560
  trigger: ie,
8535
8561
  setError: X,
@@ -8541,8 +8567,8 @@ const Cs = ({
8541
8567
  if (d !== "conversational") return [];
8542
8568
  const j = [];
8543
8569
  return p.forEach((H) => {
8544
- var U;
8545
- (U = H == null ? void 0 : H.questionData) == null || U.forEach((Q) => {
8570
+ var W;
8571
+ (W = H == null ? void 0 : H.questionData) == null || W.forEach((Q) => {
8546
8572
  var oe;
8547
8573
  if (Ei(Q, V))
8548
8574
  if (Q.type === "grid") {
@@ -8553,7 +8579,7 @@ const Cs = ({
8553
8579
  } else Q.gridId || j.push(Q);
8554
8580
  });
8555
8581
  }), j;
8556
- }, [p, V, d]), Ae = Y(
8582
+ }, [p, V, d]), Se = Y(
8557
8583
  (j) => {
8558
8584
  o && o(j);
8559
8585
  },
@@ -8565,8 +8591,8 @@ const Cs = ({
8565
8591
  if (!(p != null && p.length) || !o) return;
8566
8592
  const j = p.flatMap(
8567
8593
  (H) => {
8568
- var U;
8569
- return (U = H == null ? void 0 : H.questionData) == null ? void 0 : U.map((Q) => ({
8594
+ var W;
8595
+ return (W = H == null ? void 0 : H.questionData) == null ? void 0 : W.map((Q) => ({
8570
8596
  id: Q.id,
8571
8597
  value: V[Q.id] || "",
8572
8598
  sectionId: H.id,
@@ -8578,25 +8604,25 @@ const Cs = ({
8578
8604
  }));
8579
8605
  }
8580
8606
  );
8581
- Ae(j), c(V);
8607
+ Se(j), c(V);
8582
8608
  }, [
8583
8609
  V,
8584
8610
  p,
8585
- Ae,
8611
+ Se,
8586
8612
  o,
8587
8613
  c
8588
8614
  ]), G(() => {
8589
- n != null && n.length && T(ks(n));
8615
+ n != null && n.length && T(Cs(n));
8590
8616
  }, [n, T]);
8591
8617
  const ge = Y(
8592
8618
  (j) => {
8593
8619
  const H = p.flatMap(
8594
- (U) => {
8620
+ (W) => {
8595
8621
  var Q;
8596
- return (Q = U == null ? void 0 : U.questionData) == null ? void 0 : Q.map((oe) => ({
8622
+ return (Q = W == null ? void 0 : W.questionData) == null ? void 0 : Q.map((oe) => ({
8597
8623
  id: oe.id,
8598
8624
  value: j[oe.id] || "",
8599
- sectionId: U.id,
8625
+ sectionId: W.id,
8600
8626
  type: oe.type,
8601
8627
  metaData: {
8602
8628
  prefix: oe.prefix,
@@ -8612,21 +8638,21 @@ const Cs = ({
8612
8638
  var j, H;
8613
8639
  if (d === "conversational") {
8614
8640
  if (!a) {
8615
- const U = ce[f];
8616
- if (!U) return;
8617
- const Q = U.gridChildren ? U.gridChildren.map((le) => le.id) : [U.id];
8641
+ const W = ce[f];
8642
+ if (!W) return;
8643
+ const Q = W.gridChildren ? W.gridChildren.map((le) => le.id) : [W.id];
8618
8644
  if (!await ie(Q)) return;
8619
8645
  }
8620
- f < ce.length - 1 ? g((U) => U + 1) : A(ge)();
8646
+ f < ce.length - 1 ? g((W) => W + 1) : S(ge)();
8621
8647
  return;
8622
8648
  }
8623
8649
  if (!a) {
8624
- const U = (H = (j = p == null ? void 0 : p[v]) == null ? void 0 : j.questionData) == null ? void 0 : H.map(
8650
+ const W = (H = (j = p == null ? void 0 : p[v]) == null ? void 0 : j.questionData) == null ? void 0 : H.map(
8625
8651
  (oe) => oe.id
8626
8652
  );
8627
- if (!await ie(U)) return;
8653
+ if (!await ie(W)) return;
8628
8654
  }
8629
- y((U) => U + 1);
8655
+ y((W) => W + 1);
8630
8656
  }, [
8631
8657
  v,
8632
8658
  f,
@@ -8635,19 +8661,19 @@ const Cs = ({
8635
8661
  a,
8636
8662
  ie,
8637
8663
  d,
8638
- A,
8664
+ S,
8639
8665
  ge
8640
- ]), Se = Y(() => {
8666
+ ]), Ae = Y(() => {
8641
8667
  if (d === "conversational") {
8642
8668
  g((j) => Math.max(0, j - 1));
8643
8669
  return;
8644
8670
  }
8645
8671
  y((j) => j - 1);
8646
- }, [d]), Ce = ee(
8672
+ }, [d]), ke = ee(
8647
8673
  () => ({
8648
- register: k,
8674
+ register: C,
8649
8675
  setValue: M,
8650
- watch: L,
8676
+ watch: E,
8651
8677
  errors: F,
8652
8678
  trigger: ie,
8653
8679
  isSubmitting: Z,
@@ -8658,9 +8684,9 @@ const Cs = ({
8658
8684
  apiActivityCount: h
8659
8685
  }),
8660
8686
  [
8661
- k,
8687
+ C,
8662
8688
  M,
8663
- L,
8689
+ E,
8664
8690
  F,
8665
8691
  ie,
8666
8692
  Z,
@@ -8676,7 +8702,7 @@ const Cs = ({
8676
8702
  /* @__PURE__ */ b(
8677
8703
  "form",
8678
8704
  {
8679
- onSubmit: A(ge),
8705
+ onSubmit: S(ge),
8680
8706
  className: "container h-full mx-auto",
8681
8707
  children: [
8682
8708
  /* @__PURE__ */ i("div", { className: "relative flex flex-col w-full min-w-0 py-4 gap-y-12", children: /* @__PURE__ */ b(
@@ -8689,33 +8715,33 @@ const Cs = ({
8689
8715
  ((K = p[v]) == null ? void 0 : K.description) && /* @__PURE__ */ i("p", { className: "text-sm", children: (P = p[v]) == null ? void 0 : P.description })
8690
8716
  ] }),
8691
8717
  d === "multi" ? /* @__PURE__ */ i(
8692
- Ss,
8718
+ As,
8693
8719
  {
8694
8720
  form_data: p,
8695
- options: Ce,
8721
+ options: ke,
8696
8722
  current: v
8697
8723
  }
8698
8724
  ) : d === "conversational" ? /* @__PURE__ */ i(
8699
8725
  Ns,
8700
8726
  {
8701
8727
  element: ce[f],
8702
- options: Ce,
8728
+ options: ke,
8703
8729
  onNext: ue,
8704
- onPrev: Se,
8730
+ onPrev: Ae,
8705
8731
  isFirst: f === 0,
8706
8732
  isLast: f === ce.length - 1,
8707
8733
  isReadOnly: l
8708
8734
  }
8709
8735
  ) : /* @__PURE__ */ i(
8710
- As,
8736
+ Ss,
8711
8737
  {
8712
8738
  form_data: p,
8713
- options: Ce
8739
+ options: ke
8714
8740
  }
8715
8741
  )
8716
8742
  ]
8717
8743
  },
8718
- d === "conversational" ? `conv-${f}` : (E = p == null ? void 0 : p[v]) == null ? void 0 : E.id
8744
+ d === "conversational" ? `conv-${f}` : (L = p == null ? void 0 : p[v]) == null ? void 0 : L.id
8719
8745
  ) }),
8720
8746
  !t && d !== "conversational" && /* @__PURE__ */ i("footer", { className: "flex items-center justify-end gap-4 footer flex-wrap", children: d === "multi" ? /* @__PURE__ */ b(ve, { children: [
8721
8747
  /* @__PURE__ */ b("div", { className: "flex gap-x-4 justify-between navigation_container w-full", children: [
@@ -8725,11 +8751,11 @@ const Cs = ({
8725
8751
  "button",
8726
8752
  {
8727
8753
  type: "button",
8728
- onClick: Se,
8754
+ onClick: Ae,
8729
8755
  className: "text-gray-400 hover:text-gray-600 font-medium text-sm flex items-center gap-1 transition-colors back_btn",
8730
8756
  children: [
8731
8757
  /* @__PURE__ */ i(
8732
- z,
8758
+ J,
8733
8759
  {
8734
8760
  icon: "material-symbols:arrow-upward-rounded",
8735
8761
  iconClass: "text-lg"
@@ -8741,35 +8767,35 @@ const Cs = ({
8741
8767
  )
8742
8768
  ] }),
8743
8769
  v < N - 1 && /* @__PURE__ */ i(
8744
- ke,
8770
+ Ce,
8745
8771
  {
8746
8772
  type: "button",
8747
8773
  text: "Next",
8748
8774
  onClick: ue,
8749
- style: { background: (S == null ? void 0 : S.buttonColor) || "#333" },
8775
+ style: { background: (A == null ? void 0 : A.buttonColor) || "#333" },
8750
8776
  btnClass: "text-gray-700 next_btn text-sm border-[#98A2B3] !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg continue_btn"
8751
8777
  }
8752
8778
  )
8753
8779
  ] }),
8754
- (v === N - 1 || l) && !a && ((q = typeof u == "function" ? u({ isUploading: h > 0, isSubmitting: Z, hasErrors: Object.keys(F).length > 0 }) : u) != null ? q : /* @__PURE__ */ i(
8755
- ke,
8780
+ (v === N - 1 || l) && !a && ((U = typeof u == "function" ? u({ isUploading: h > 0, isSubmitting: Z, hasErrors: Object.keys(F).length > 0 }) : u) != null ? U : /* @__PURE__ */ i(
8781
+ Ce,
8756
8782
  {
8757
8783
  isDisabled: Z || Object.keys(F).length > 0 || h > 0,
8758
8784
  isLoading: Z,
8759
8785
  type: "submit",
8760
8786
  text: "Submit",
8761
- style: { background: (S == null ? void 0 : S.buttonColor) || "#333" },
8787
+ style: { background: (A == null ? void 0 : A.buttonColor) || "#333" },
8762
8788
  btnClass: "text-gray-700 border-[#98A2B3] submit_btn !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg submit_btn"
8763
8789
  }
8764
8790
  ))
8765
8791
  ] }) : !a && (($ = typeof u == "function" ? u({ isUploading: h > 0, isSubmitting: Z, hasErrors: Object.keys(F).length > 0 }) : u) != null ? $ : /* @__PURE__ */ i(
8766
- ke,
8792
+ Ce,
8767
8793
  {
8768
8794
  isDisabled: Z || Object.keys(F).length > 0 || h > 0,
8769
8795
  isLoading: Z,
8770
8796
  type: "submit",
8771
8797
  text: "Submit",
8772
- style: { background: (S == null ? void 0 : S.buttonColor) || "#333" },
8798
+ style: { background: (A == null ? void 0 : A.buttonColor) || "#333" },
8773
8799
  btnClass: "text-gray-700 border-[#98A2B3] submit_btn !font-medium !py-[10px] px-10 bg-blue-600 text-white rounded-lg submit_btn"
8774
8800
  }
8775
8801
  )) }),
@@ -8779,7 +8805,7 @@ const Cs = ({
8779
8805
  className: "h-full bg-blue-600 transition-all duration-500 ease-out",
8780
8806
  style: {
8781
8807
  width: `${(f + 1) / ce.length * 100}%`,
8782
- background: (S == null ? void 0 : S.buttonColor) || "#2563EB"
8808
+ background: (A == null ? void 0 : A.buttonColor) || "#2563EB"
8783
8809
  }
8784
8810
  }
8785
8811
  ) })
@@ -8787,7 +8813,7 @@ const Cs = ({
8787
8813
  }
8788
8814
  )
8789
8815
  ] });
8790
- }, Ms = se.memo(Cs);
8816
+ }, Ms = se.memo(ks);
8791
8817
  function yn({
8792
8818
  answerData: e,
8793
8819
  form_data: n,
@@ -8831,7 +8857,7 @@ function yn({
8831
8857
  ] }) : /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("p", { className: "p-6 text-sm text-gray-400", children: "Error: No form data available." }) });
8832
8858
  }
8833
8859
  export {
8834
- z as A,
8860
+ J as A,
8835
8861
  Hs as H,
8836
8862
  yn as V
8837
8863
  };