@arudovwen/form-builder-react 1.6.9 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import Ye from "react-currency-input-field";
9
9
  import { createPortal as Cn } from "react-dom";
10
10
  import { appendErrors as Mn, useForm as yi, useFieldArray as ei, useWatch as wn, FormProvider as Tn } from "react-hook-form";
11
11
  import { validateFieldsNatively as Bn, toNestErrors as En } from "@hookform/resolvers";
12
- import * as D from "yup";
12
+ import * as R from "yup";
13
13
  import Ln from "papaparse";
14
14
  import * as Bi from "xlsx";
15
15
  import { Link as Pn } from "react-router-dom";
@@ -47,8 +47,8 @@ const re = fn(void 0), Ei = {
47
47
  c((H) => {
48
48
  const J = typeof O == "function" ? O(H) : O;
49
49
  if (JSON.stringify(H) !== JSON.stringify(J)) {
50
- const T = Date.now();
51
- v((P) => P.length > 0 && JSON.stringify(P[P.length - 1]) === JSON.stringify(H) ? P : T - f.current < 800 && P.length > 0 ? (f.current = T, P) : (f.current = T, [...P, H])), y([]);
50
+ const B = Date.now();
51
+ v((P) => P.length > 0 && JSON.stringify(P[P.length - 1]) === JSON.stringify(H) ? P : B - f.current < 800 && P.length > 0 ? (f.current = B, P) : (f.current = B, [...P, H])), y([]);
52
52
  }
53
53
  return J;
54
54
  });
@@ -60,53 +60,53 @@ const re = fn(void 0), Ei = {
60
60
  if (h.length === 0) return;
61
61
  const O = h[0], H = h.slice(1);
62
62
  y(H), v([...m, r]), c(O), a == null || a("REDO", null);
63
- }, [m, h, r, a]), C = r, S = m.length > 0, x = h.length > 0, [M, k] = I(!1), [L, A] = I(null), [w, R] = I([
63
+ }, [m, h, r, a]), k = r, S = m.length > 0, x = h.length > 0, [C, M] = I(!1), [w, A] = I(null), [T, D] = I([
64
64
  0
65
- ]), [B, z] = I(""), $ = ne.useCallback(() => {
65
+ ]), [E, z] = I(""), $ = ne.useCallback(() => {
66
66
  }, []), ae = ne.useCallback(() => {
67
67
  const O = be();
68
- p((H) => [...H, { ...Ei, id: O }]), A(O), R([C.length]), a == null || a("ADD_SECTION", { sectionId: O });
69
- }, [C, a, p]), X = ne.useCallback((O) => {
68
+ p((H) => [...H, { ...Ei, id: O }]), A(O), D([k.length]), a == null || a("ADD_SECTION", { sectionId: O });
69
+ }, [k, a, p]), X = ne.useCallback((O) => {
70
70
  p(
71
71
  (H) => H.filter((J) => J.id !== O)
72
72
  ), A(null), a == null || a("REMOVE_SECTION", { sectionId: O });
73
73
  }, [a, p]), te = ne.useCallback(
74
74
  (O, H) => {
75
- const J = C.find((P) => P.id === H), T = J == null ? void 0 : J.questionData.find(
75
+ const J = k.find((P) => P.id === H), B = J == null ? void 0 : J.questionData.find(
76
76
  (P) => P.id === O
77
77
  );
78
- T && (p(
78
+ B && (p(
79
79
  (P) => P == null ? void 0 : P.map(
80
80
  (U) => U.id === H ? {
81
81
  ...U,
82
- questionData: U.questionData.filter((E) => T.type === "grid" ? E.gridId !== T.id && E.id !== T.id : E.id !== O)
82
+ questionData: U.questionData.filter((L) => B.type === "grid" ? L.gridId !== B.id && L.id !== B.id : L.id !== O)
83
83
  } : U
84
84
  )
85
85
  ), a == null || a("REMOVE_ELEMENT", { sectionId: H, elementId: O }));
86
86
  },
87
- [C, p, a]
87
+ [k, p, a]
88
88
  ), _ = ne.useCallback(
89
89
  (O, H) => {
90
- const J = C.find((E) => E.id === H);
90
+ const J = k.find((L) => L.id === H);
91
91
  if (!J) return;
92
- const T = J.questionData.findIndex(
93
- (E) => E.id === O
92
+ const B = J.questionData.findIndex(
93
+ (L) => L.id === O
94
94
  );
95
- if (T === -1) return;
96
- const P = J.questionData[T], U = (E, Y = {}) => ({
97
- ...JSON.parse(JSON.stringify(E)),
95
+ if (B === -1) return;
96
+ const P = J.questionData[B], U = (L, Y = {}) => ({
97
+ ...JSON.parse(JSON.stringify(L)),
98
98
  id: be(),
99
99
  ...Y
100
100
  });
101
101
  p(
102
- (E) => E == null ? void 0 : E.map((Y) => {
102
+ (L) => L == null ? void 0 : L.map((Y) => {
103
103
  var F;
104
104
  if (Y.id !== H) return Y;
105
105
  const K = [...Y.questionData];
106
106
  if (P.type === "grid") {
107
107
  const oe = (F = K == null ? void 0 : K.map((pe, Xe) => ({ e: pe, i: Xe })).filter(
108
108
  ({ e: pe }) => pe.id === P.id || pe.gridId === P.id
109
- )) == null ? void 0 : F.map(({ i: pe }) => pe), ce = oe.length ? Math.max(...oe) + 1 : T + 1, le = be(), ve = U(P, {});
109
+ )) == null ? void 0 : F.map(({ i: pe }) => pe), ce = oe.length ? Math.max(...oe) + 1 : B + 1, le = be(), ve = U(P, {});
110
110
  ve.id = le;
111
111
  const de = K.filter((pe) => pe.gridId === P.id), xe = de == null ? void 0 : de.map(
112
112
  (pe) => U(pe, { gridId: le })
@@ -120,7 +120,7 @@ const re = fn(void 0), Ei = {
120
120
  } else if (P.gridId) {
121
121
  const { gridId: oe, gridPosition: ce, ...le } = P, ve = U(le, {}), de = K.reduce(
122
122
  (Te, pe, Xe) => pe.id === P.gridId || pe.gridId === P.gridId ? Xe : Te,
123
- T
123
+ B
124
124
  ), xe = [
125
125
  ...K.slice(0, de + 1),
126
126
  ve,
@@ -129,21 +129,21 @@ const re = fn(void 0), Ei = {
129
129
  return { ...Y, questionData: xe };
130
130
  } else {
131
131
  const oe = U(P, {}), ce = [
132
- ...K.slice(0, T + 1),
132
+ ...K.slice(0, B + 1),
133
133
  oe,
134
- ...K.slice(T + 1)
134
+ ...K.slice(B + 1)
135
135
  ];
136
136
  return { ...Y, questionData: ce };
137
137
  }
138
138
  })
139
139
  ), a == null || a("DUPLICATE_ELEMENT", { sectionId: H, elementId: O });
140
140
  },
141
- [C, p, a]
141
+ [k, p, a]
142
142
  ), j = ne.useCallback(
143
143
  (O, H) => {
144
144
  p(
145
145
  (J) => J == null ? void 0 : J.map(
146
- (T) => T.id === H ? { ...T, questionData: O } : T
146
+ (B) => B.id === H ? { ...B, questionData: O } : B
147
147
  )
148
148
  ), a == null || a("UPDATE_ELEMENT_POSITION", { sectionId: H });
149
149
  },
@@ -151,16 +151,16 @@ const re = fn(void 0), Ei = {
151
151
  ), ye = ne.useCallback((O, H) => {
152
152
  p(
153
153
  (J) => J == null ? void 0 : J.map(
154
- (T) => T.id === H ? {
155
- ...T,
156
- questionData: [...T.questionData, O]
157
- } : T
154
+ (B) => B.id === H ? {
155
+ ...B,
156
+ questionData: [...B.questionData, O]
157
+ } : B
158
158
  )
159
159
  ), a == null || a("ADD_ELEMENT", { sectionId: H, element: O });
160
160
  }, [p, a]), Ne = ne.useCallback(
161
161
  (O, H, J) => {
162
162
  p(
163
- (T) => T == null ? void 0 : T.map(
163
+ (B) => B == null ? void 0 : B.map(
164
164
  (P) => P.id === H ? {
165
165
  ...P,
166
166
  questionData: [
@@ -176,25 +176,25 @@ const re = fn(void 0), Ei = {
176
176
  ), Me = ne.useCallback(
177
177
  (O, H, J) => {
178
178
  p(
179
- (T) => T == null ? void 0 : T.map(
179
+ (B) => B == null ? void 0 : B.map(
180
180
  (P) => {
181
181
  var U;
182
182
  return P.id === J ? {
183
183
  ...P,
184
184
  questionData: (U = P.questionData) == null ? void 0 : U.map(
185
- (E) => {
185
+ (L) => {
186
186
  var Y;
187
- return E.type === "grid" && E.gridData ? {
188
- ...E,
189
- gridData: (Y = E.gridData) == null ? void 0 : Y.map(
187
+ return L.type === "grid" && L.gridData ? {
188
+ ...L,
189
+ gridData: (Y = L.gridData) == null ? void 0 : Y.map(
190
190
  (K, F) => F === O ? {
191
191
  ...K,
192
192
  ...H
193
193
  } : K
194
194
  ).concat(
195
- O >= E.gridData.length ? { ...H } : []
195
+ O >= L.gridData.length ? { ...H } : []
196
196
  )
197
- } : E;
197
+ } : L;
198
198
  }
199
199
  )
200
200
  } : P;
@@ -206,26 +206,26 @@ const re = fn(void 0), Ei = {
206
206
  ), he = ne.useCallback((O, H) => {
207
207
  p(
208
208
  (J) => J == null ? void 0 : J.map(
209
- (T) => {
209
+ (B) => {
210
210
  var P;
211
- return T.id === H ? {
212
- ...T,
213
- questionData: (P = T.questionData) == null ? void 0 : P.map(
211
+ return B.id === H ? {
212
+ ...B,
213
+ questionData: (P = B.questionData) == null ? void 0 : P.map(
214
214
  (U) => U.id === O.id ? { ...U, ...O } : U
215
215
  )
216
- } : T;
216
+ } : B;
217
217
  }
218
218
  )
219
219
  ), a == null || a("UPDATE_ELEMENT", { sectionId: H, value: O });
220
- }, [p, a]), Ae = ne.useCallback(
220
+ }, [p, a]), Se = ne.useCallback(
221
221
  (O) => {
222
222
  const {
223
223
  draggedId: H,
224
224
  sectionId: J,
225
- targetIndex: T,
225
+ targetIndex: B,
226
226
  targetId: P,
227
227
  targetGridId: U,
228
- targetCol: E
228
+ targetCol: L
229
229
  } = O;
230
230
  p(
231
231
  (Y) => Y.map((K) => {
@@ -233,19 +233,19 @@ const re = fn(void 0), Ei = {
233
233
  const F = [...K.questionData], oe = F.findIndex((le) => le.id === H);
234
234
  if (oe === -1) return K;
235
235
  const ce = { ...F[oe] };
236
- if (U !== void 0 && E !== void 0) {
236
+ if (U !== void 0 && L !== void 0) {
237
237
  if (ce.type === "grid") return K;
238
238
  const le = F.findIndex(
239
239
  (de) => {
240
240
  var xe;
241
- return de.id !== H && de.gridId === U && ((xe = de.gridPosition) == null ? void 0 : xe.col) === E;
241
+ return de.id !== H && de.gridId === U && ((xe = de.gridPosition) == null ? void 0 : xe.col) === L;
242
242
  }
243
243
  );
244
244
  let ve = F.map(
245
245
  (de) => de.id === H ? {
246
246
  ...de,
247
247
  gridId: U,
248
- gridPosition: { col: E }
248
+ gridPosition: { col: L }
249
249
  } : de
250
250
  );
251
251
  return le !== -1 && (ve = ve.map((de, xe) => {
@@ -254,15 +254,15 @@ const re = fn(void 0), Ei = {
254
254
  return delete Te.gridId, delete Te.gridPosition, Te;
255
255
  })), { ...K, questionData: ve };
256
256
  }
257
- if (ce.gridId && T !== void 0 && U === void 0) {
257
+ if (ce.gridId && B !== void 0 && U === void 0) {
258
258
  const le = { ...ce };
259
259
  delete le.gridId, delete le.gridPosition;
260
- const ve = F.filter((xe) => xe.id !== H), de = Math.min(T, ve.length);
260
+ const ve = F.filter((xe) => xe.id !== H), de = Math.min(B, ve.length);
261
261
  return ve.splice(de, 0, le), { ...K, questionData: ve };
262
262
  }
263
- if (!ce.gridId && T !== void 0 && U === void 0 && !P) {
263
+ if (!ce.gridId && B !== void 0 && U === void 0 && !P) {
264
264
  F.splice(oe, 1);
265
- const le = Math.min(T, F.length);
265
+ const le = Math.min(B, F.length);
266
266
  return F.splice(le, 0, ce), { ...K, questionData: F };
267
267
  }
268
268
  if (P) {
@@ -277,15 +277,15 @@ const re = fn(void 0), Ei = {
277
277
  ), we = ne.useCallback((O, H) => {
278
278
  p(
279
279
  (J) => J == null ? void 0 : J.map(
280
- (T) => T.id === H ? {
281
- ...T,
280
+ (B) => B.id === H ? {
281
+ ...B,
282
282
  ...O
283
- } : T
283
+ } : B
284
284
  )
285
285
  ), a == null || a("UPDATE_SECTION", { sectionId: H, value: O });
286
286
  }, [p, a]), Ee = Q(
287
287
  () => ({
288
- formData: C,
288
+ formData: k,
289
289
  setFormData: p,
290
290
  handleDragStop: $,
291
291
  removeElement: te,
@@ -298,19 +298,19 @@ const re = fn(void 0), Ei = {
298
298
  addSection: ae,
299
299
  removeSection: X,
300
300
  updateSection: we,
301
- isDragging: M,
302
- setIsDragging: k,
303
- selectedSection: L,
301
+ isDragging: C,
302
+ setIsDragging: M,
303
+ selectedSection: w,
304
304
  setSelectedSection: A,
305
- activeSections: w,
306
- setActiveSections: R,
305
+ activeSections: T,
306
+ setActiveSections: D,
307
307
  updateGridElement: Me,
308
308
  answerData: l,
309
309
  setAnswerData: d,
310
- uploadUrl: B,
310
+ uploadUrl: E,
311
311
  setUploadUrl: z,
312
312
  duplicateElement: _,
313
- moveElement: Ae,
313
+ moveElement: Se,
314
314
  showPreview: s,
315
315
  setShowPreview: o,
316
316
  undo: g,
@@ -319,7 +319,7 @@ const re = fn(void 0), Ei = {
319
319
  canRedo: x
320
320
  }),
321
321
  [
322
- C,
322
+ k,
323
323
  $,
324
324
  te,
325
325
  u,
@@ -330,14 +330,14 @@ const re = fn(void 0), Ei = {
330
330
  ae,
331
331
  X,
332
332
  we,
333
- M,
334
- L,
333
+ C,
335
334
  w,
335
+ T,
336
336
  Me,
337
337
  l,
338
- B,
338
+ E,
339
339
  _,
340
- Ae,
340
+ Se,
341
341
  s,
342
342
  g,
343
343
  N,
@@ -863,10 +863,10 @@ function Yn(e, n) {
863
863
  let l = a.body;
864
864
  [a, s].forEach((f) => {
865
865
  const p = [], g = f.hFlip, N = f.vFlip;
866
- let C = f.rotate;
867
- g ? N ? C += 2 : (p.push("translate(" + (o.width + o.left).toString() + " " + (0 - o.top).toString() + ")"), p.push("scale(-1 1)"), o.top = o.left = 0) : N && (p.push("translate(" + (0 - o.left).toString() + " " + (o.height + o.top).toString() + ")"), p.push("scale(1 -1)"), o.top = o.left = 0);
866
+ let k = f.rotate;
867
+ g ? N ? k += 2 : (p.push("translate(" + (o.width + o.left).toString() + " " + (0 - o.top).toString() + ")"), p.push("scale(-1 1)"), o.top = o.left = 0) : N && (p.push("translate(" + (0 - o.left).toString() + " " + (o.height + o.top).toString() + ")"), p.push("scale(1 -1)"), o.top = o.left = 0);
868
868
  let S;
869
- switch (C < 0 && (C -= Math.floor(C / 4) * 4), C = C % 4, C) {
869
+ switch (k < 0 && (k -= Math.floor(k / 4) * 4), k = k % 4, k) {
870
870
  case 1:
871
871
  S = o.height / 2 + o.top, p.unshift("rotate(90 " + S.toString() + " " + S.toString() + ")");
872
872
  break;
@@ -877,7 +877,7 @@ function Yn(e, n) {
877
877
  S = o.width / 2 + o.left, p.unshift("rotate(-90 " + S.toString() + " " + S.toString() + ")");
878
878
  break;
879
879
  }
880
- C % 2 === 1 && (o.left !== o.top && (S = o.left, o.left = o.top, o.top = S), o.width !== o.height && (S = o.width, o.width = o.height, o.height = S)), p.length && (l = qn(l, '<g transform="' + p.join(" ") + '">', "</g>"));
880
+ k % 2 === 1 && (o.left !== o.top && (S = o.left, o.left = o.top, o.top = S), o.width !== o.height && (S = o.width, o.width = o.height, o.height = S)), p.length && (l = qn(l, '<g transform="' + p.join(" ") + '">', "</g>"));
881
881
  });
882
882
  const d = s.width, u = s.height, t = o.width, r = o.height;
883
883
  let c, m;
@@ -1135,12 +1135,12 @@ function pa(e, n, a, s) {
1135
1135
  const o = e.resources.length, l = e.random ? Math.floor(Math.random() * o) : e.index;
1136
1136
  let d;
1137
1137
  if (e.random) {
1138
- let M = e.resources.slice(0);
1139
- for (d = []; M.length > 1; ) {
1140
- const k = Math.floor(Math.random() * M.length);
1141
- d.push(M[k]), M = M.slice(0, k).concat(M.slice(k + 1));
1138
+ let C = e.resources.slice(0);
1139
+ for (d = []; C.length > 1; ) {
1140
+ const M = Math.floor(Math.random() * C.length);
1141
+ d.push(C[M]), C = C.slice(0, M).concat(C.slice(M + 1));
1142
1142
  }
1143
- d = d.concat(M);
1143
+ d = d.concat(C);
1144
1144
  } else d = e.resources.slice(l).concat(e.resources.slice(0, l));
1145
1145
  const u = Date.now();
1146
1146
  let t = "pending", r = 0, c, m = null, v = [], h = [];
@@ -1149,12 +1149,12 @@ function pa(e, n, a, s) {
1149
1149
  m && (clearTimeout(m), m = null);
1150
1150
  }
1151
1151
  function f() {
1152
- t === "pending" && (t = "aborted"), y(), v.forEach((M) => {
1153
- M.status === "pending" && (M.status = "aborted");
1152
+ t === "pending" && (t = "aborted"), y(), v.forEach((C) => {
1153
+ C.status === "pending" && (C.status = "aborted");
1154
1154
  }), v = [];
1155
1155
  }
1156
- function p(M, k) {
1157
- k && (h = []), typeof M == "function" && h.push(M);
1156
+ function p(C, M) {
1157
+ M && (h = []), typeof C == "function" && h.push(C);
1158
1158
  }
1159
1159
  function g() {
1160
1160
  return {
@@ -1168,18 +1168,18 @@ function pa(e, n, a, s) {
1168
1168
  };
1169
1169
  }
1170
1170
  function N() {
1171
- t = "failed", h.forEach((M) => {
1172
- M(void 0, c);
1171
+ t = "failed", h.forEach((C) => {
1172
+ C(void 0, c);
1173
1173
  });
1174
1174
  }
1175
- function C() {
1176
- v.forEach((M) => {
1177
- M.status === "pending" && (M.status = "aborted");
1175
+ function k() {
1176
+ v.forEach((C) => {
1177
+ C.status === "pending" && (C.status = "aborted");
1178
1178
  }), v = [];
1179
1179
  }
1180
- function S(M, k, L) {
1181
- const A = k !== "success";
1182
- switch (v = v.filter((w) => w !== M), t) {
1180
+ function S(C, M, w) {
1181
+ const A = M !== "success";
1182
+ switch (v = v.filter((T) => T !== C), t) {
1183
1183
  case "pending":
1184
1184
  break;
1185
1185
  case "failed":
@@ -1188,44 +1188,44 @@ function pa(e, n, a, s) {
1188
1188
  default:
1189
1189
  return;
1190
1190
  }
1191
- if (k === "abort") {
1192
- c = L, N();
1191
+ if (M === "abort") {
1192
+ c = w, N();
1193
1193
  return;
1194
1194
  }
1195
1195
  if (A) {
1196
- c = L, v.length || (d.length ? x() : N());
1196
+ c = w, v.length || (d.length ? x() : N());
1197
1197
  return;
1198
1198
  }
1199
- if (y(), C(), !e.random) {
1200
- const w = e.resources.indexOf(M.resource);
1201
- w !== -1 && w !== e.index && (e.index = w);
1199
+ if (y(), k(), !e.random) {
1200
+ const T = e.resources.indexOf(C.resource);
1201
+ T !== -1 && T !== e.index && (e.index = T);
1202
1202
  }
1203
- t = "completed", h.forEach((w) => {
1204
- w(L);
1203
+ t = "completed", h.forEach((T) => {
1204
+ T(w);
1205
1205
  });
1206
1206
  }
1207
1207
  function x() {
1208
1208
  if (t !== "pending") return;
1209
1209
  y();
1210
- const M = d.shift();
1211
- if (M === void 0) {
1210
+ const C = d.shift();
1211
+ if (C === void 0) {
1212
1212
  if (v.length) {
1213
1213
  m = setTimeout(() => {
1214
- y(), t === "pending" && (C(), N());
1214
+ y(), t === "pending" && (k(), N());
1215
1215
  }, e.timeout);
1216
1216
  return;
1217
1217
  }
1218
1218
  N();
1219
1219
  return;
1220
1220
  }
1221
- const k = {
1221
+ const M = {
1222
1222
  status: "pending",
1223
- resource: M,
1224
- callback: (L, A) => {
1225
- S(k, L, A);
1223
+ resource: C,
1224
+ callback: (w, A) => {
1225
+ S(M, w, A);
1226
1226
  }
1227
1227
  };
1228
- v.push(k), r++, m = setTimeout(x, e.rotate), a(M, n, k.callback);
1228
+ v.push(M), r++, m = setTimeout(x, e.rotate), a(C, n, M.callback);
1229
1229
  }
1230
1230
  return setTimeout(x), g;
1231
1231
  }
@@ -1513,8 +1513,8 @@ const Ia = (e, n, a) => {
1513
1513
  "provider",
1514
1514
  "prefix"
1515
1515
  ];
1516
- for (const C of N)
1517
- p[C] && g.push("iconify--" + p[C]);
1516
+ for (const k of N)
1517
+ p[k] && g.push("iconify--" + p[k]);
1518
1518
  t.className = g.join(" ");
1519
1519
  }
1520
1520
  }
@@ -1949,15 +1949,15 @@ function Ha({
1949
1949
  [l]
1950
1950
  ), y = Z(
1951
1951
  async (S) => {
1952
- var k, L;
1953
- const x = se("token"), M = ((k = se("orgData")) == null ? void 0 : k.id) || se("organizationId");
1952
+ var M, w;
1953
+ const x = se("token"), C = ((M = se("orgData")) == null ? void 0 : M.id) || se("organizationId");
1954
1954
  try {
1955
1955
  const { data: A } = await Be.post(
1956
1956
  d,
1957
1957
  {
1958
1958
  ...S,
1959
1959
  service: "FORM",
1960
- organizationId: M || ""
1960
+ organizationId: C || ""
1961
1961
  },
1962
1962
  {
1963
1963
  headers: {
@@ -1965,50 +1965,50 @@ function Ha({
1965
1965
  }
1966
1966
  }
1967
1967
  );
1968
- return (L = A == null ? void 0 : A.data) == null ? void 0 : L.url;
1968
+ return (w = A == null ? void 0 : A.data) == null ? void 0 : w.url;
1969
1969
  } catch (A) {
1970
1970
  throw console.error("File upload error:", A), new Error("Failed to upload file to server");
1971
1971
  }
1972
1972
  },
1973
1973
  [d]
1974
1974
  ), f = Z(
1975
- (S) => new Promise((x, M) => {
1976
- const k = new FileReader();
1977
- k.onloadend = async () => {
1975
+ (S) => new Promise((x, C) => {
1976
+ const M = new FileReader();
1977
+ M.onloadend = async () => {
1978
1978
  try {
1979
- const L = k.result.replace(
1979
+ const w = M.result.replace(
1980
1980
  /^data:.*;base64,/,
1981
1981
  ""
1982
1982
  ), A = d ? await y({
1983
- base64: L,
1983
+ base64: w,
1984
1984
  ext: `.${S.name.split(".").pop()}`,
1985
1985
  fileName: S.name
1986
- }) : k.result;
1986
+ }) : M.result;
1987
1987
  x({
1988
1988
  base64: A,
1989
1989
  type: S.type,
1990
1990
  name: S.name
1991
1991
  });
1992
- } catch (L) {
1993
- M(L);
1992
+ } catch (w) {
1993
+ C(w);
1994
1994
  }
1995
- }, k.onerror = () => M(new Error("File read failed")), k.readAsDataURL(S);
1995
+ }, M.onerror = () => C(new Error("File read failed")), M.readAsDataURL(S);
1996
1996
  }),
1997
1997
  [d, y]
1998
1998
  ), p = Z(
1999
1999
  (S) => {
2000
- var M;
2001
- const x = v ? (M = v.split(",")) == null ? void 0 : M.map((k) => k.trim()) : [];
2002
- for (const k of S) {
2003
- if (k.size > ja)
2000
+ var C;
2001
+ const x = v ? (C = v.split(",")) == null ? void 0 : C.map((M) => M.trim()) : [];
2002
+ for (const M of S) {
2003
+ if (M.size > ja)
2004
2004
  return fe.error(
2005
- `File "${k.name}" exceeds 5MB limit (${(k.size / 1024 / 1024).toFixed(2)}MB)`
2005
+ `File "${M.name}" exceeds 5MB limit (${(M.size / 1024 / 1024).toFixed(2)}MB)`
2006
2006
  ), !1;
2007
2007
  if (x.length && !x.some(
2008
- (L) => k.type === L || k.name.toLowerCase().endsWith(L.replace("*", ""))
2008
+ (w) => M.type === w || M.name.toLowerCase().endsWith(w.replace("*", ""))
2009
2009
  ))
2010
2010
  return fe.error(
2011
- `File "${k.name}" is not an allowed type. Allowed: ${h || "any"}`
2011
+ `File "${M.name}" is not an allowed type. Allowed: ${h || "any"}`
2012
2012
  ), !1;
2013
2013
  }
2014
2014
  return !0;
@@ -2024,10 +2024,10 @@ function Ha({
2024
2024
  }
2025
2025
  try {
2026
2026
  m(!0);
2027
- const M = await Promise.all(x == null ? void 0 : x.map(f)), k = s && t ? [...t, ...M] : M;
2028
- r(k), e(k), fe.success(`Successfully uploaded ${x.length} file(s)`);
2029
- } catch (M) {
2030
- console.error("Upload error:", M), fe.error("Failed to upload file(s). Please try again.");
2027
+ const C = await Promise.all(x == null ? void 0 : x.map(f)), M = s && t ? [...t, ...C] : C;
2028
+ r(M), e(M), fe.success(`Successfully uploaded ${x.length} file(s)`);
2029
+ } catch (C) {
2030
+ console.error("Upload error:", C), fe.error("Failed to upload file(s). Please try again.");
2031
2031
  } finally {
2032
2032
  m(!1), u.current && (u.current.value = "");
2033
2033
  }
@@ -2037,12 +2037,12 @@ function Ha({
2037
2037
  ), N = Z(
2038
2038
  (S) => {
2039
2039
  c || (u.current && (u.current.value = ""), r((x) => {
2040
- const M = S === void 0 ? null : (x == null ? void 0 : x.filter((k, L) => L !== S)) || null;
2041
- return e(M), M;
2040
+ const C = S === void 0 ? null : (x == null ? void 0 : x.filter((M, w) => w !== S)) || null;
2041
+ return e(C), C;
2042
2042
  }), a == null || a());
2043
2043
  },
2044
2044
  [a, e, c]
2045
- ), C = t && t.length > 0;
2045
+ ), k = t && t.length > 0;
2046
2046
  return /* @__PURE__ */ b("div", { className: "flex flex-col items-start gap-2", children: [
2047
2047
  !n && /* @__PURE__ */ b("div", { className: "!flex field-control !py-0 !px-0 relative", children: [
2048
2048
  /* @__PURE__ */ i(
@@ -2061,7 +2061,7 @@ function Ha({
2061
2061
  hover:file:bg-blue-100 disabled:opacity-50 disabled:cursor-not-allowed`
2062
2062
  }
2063
2063
  ),
2064
- C && /* @__PURE__ */ i(
2064
+ k && /* @__PURE__ */ i(
2065
2065
  "button",
2066
2066
  {
2067
2067
  type: "button",
@@ -2073,7 +2073,7 @@ function Ha({
2073
2073
  }
2074
2074
  )
2075
2075
  ] }),
2076
- C && /* @__PURE__ */ b("div", { className: "relative grid gap-y-1 flex-1 w-full", children: [
2076
+ k && /* @__PURE__ */ b("div", { className: "relative grid gap-y-1 flex-1 w-full", children: [
2077
2077
  c && /* @__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: [
2078
2078
  /* @__PURE__ */ i("span", { className: "animate-spin h-4 w-4 border-2 border-blue-500 border-t-transparent rounded-full" }),
2079
2079
  "Uploading..."
@@ -2178,7 +2178,7 @@ const V = ({
2178
2178
  description: p,
2179
2179
  onChange: g
2180
2180
  }) => {
2181
- var C, S, x, M;
2181
+ var k, S, x, C;
2182
2182
  const N = a ? { ...a(n) } : {};
2183
2183
  if (l === "amount")
2184
2184
  return /* @__PURE__ */ b("div", { className: "space-y-1.5 relative", children: [
@@ -2192,8 +2192,8 @@ const V = ({
2192
2192
  /* @__PURE__ */ i(
2193
2193
  Ye,
2194
2194
  {
2195
- onValueChange: (k) => {
2196
- t(n, k != null ? k : null), a && a(n), c && c(n);
2195
+ onValueChange: (M) => {
2196
+ t(n, M != null ? M : null), a && a(n), c && c(n);
2197
2197
  },
2198
2198
  placeholder: d,
2199
2199
  className: `field-control ${s != null && s[n] ? "border-red-300" : "border-[#D0D5DD]"}`,
@@ -2203,12 +2203,12 @@ const V = ({
2203
2203
  disabled: v
2204
2204
  }
2205
2205
  ),
2206
- (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 })
2206
+ (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 })
2207
2207
  ] });
2208
2208
  if (["checkbox", "radio"].includes(l)) {
2209
- const k = (h == null ? void 0 : h(n)) || null;
2210
- let L = !1;
2211
- return k && (k != null && k.length && l === "checkbox" ? L = k == null ? void 0 : k.includes(r) : L = k == r), /* @__PURE__ */ b("div", { className: "space-y-1", children: [
2209
+ const M = (h == null ? void 0 : h(n)) || null;
2210
+ let w = !1;
2211
+ return M && (M != null && M.length && l === "checkbox" ? w = M == null ? void 0 : M.includes(r) : w = M == r), /* @__PURE__ */ b("div", { className: "space-y-1", children: [
2212
2212
  /* @__PURE__ */ b(
2213
2213
  "label",
2214
2214
  {
@@ -2236,7 +2236,7 @@ const V = ({
2236
2236
  peer-disabled:opacity-60
2237
2237
  peer-disabled:cursor-not-allowed
2238
2238
  `,
2239
- children: L && /* @__PURE__ */ i(
2239
+ children: w && /* @__PURE__ */ i(
2240
2240
  W,
2241
2241
  {
2242
2242
  icon: "meteor-icons:check",
@@ -2267,9 +2267,9 @@ const V = ({
2267
2267
  "textarea",
2268
2268
  {
2269
2269
  ...N,
2270
- onChange: (k) => {
2271
- var L;
2272
- (L = N.onChange) == null || L.call(N, k), g == null || g(k);
2270
+ onChange: (M) => {
2271
+ var w;
2272
+ (w = N.onChange) == null || w.call(N, M), g == null || g(M);
2273
2273
  },
2274
2274
  className: `field-control ${s != null && s[n] ? "border-red-300" : "border-[#D0D5DD]"} ${o}`,
2275
2275
  placeholder: d,
@@ -2289,9 +2289,9 @@ const V = ({
2289
2289
  "input",
2290
2290
  {
2291
2291
  ...N,
2292
- onChange: (k) => {
2293
- var L;
2294
- (L = N.onChange) == null || L.call(N, k), g == null || g(k);
2292
+ onChange: (M) => {
2293
+ var w;
2294
+ (w = N.onChange) == null || w.call(N, M), g == null || g(M);
2295
2295
  },
2296
2296
  type: l,
2297
2297
  className: `field-control ${s != null && s[n] ? "border-red-300" : "border-[#D0D5DD]"} ${o}`,
@@ -2301,7 +2301,7 @@ const V = ({
2301
2301
  max: f
2302
2302
  }
2303
2303
  ),
2304
- (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (M = s[n]) == null ? void 0 : M.message })
2304
+ (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 })
2305
2305
  ] });
2306
2306
  };
2307
2307
  function Ua({
@@ -2372,13 +2372,13 @@ const Re = ({
2372
2372
  disabled: y
2373
2373
  }) => {
2374
2374
  const [f, p] = I(r ? [] : null), g = ue(!1), N = Q(() => !u || !e || e.length === 0 ? r ? [] : null : r ? Array.isArray(u) ? e.filter((x) => u.some(
2375
- (M) => {
2376
- var k;
2377
- return typeof x.value == "object" ? ((k = x.value) == null ? void 0 : k.id) === (M == null ? void 0 : M.id) : x.value === M;
2375
+ (C) => {
2376
+ var M;
2377
+ return typeof x.value == "object" ? ((M = x.value) == null ? void 0 : M.id) === (C == null ? void 0 : C.id) : x.value === C;
2378
2378
  }
2379
2379
  )) : [] : e.find((x) => {
2380
- var M;
2381
- return typeof x.value == "string" && typeof u == "string" ? x.value.toLowerCase() === u.toLowerCase() : typeof x.value == "object" && typeof u == "object" ? ((M = x.value) == null ? void 0 : M.id) === (u == null ? void 0 : u.id) : x.value === u;
2380
+ var C;
2381
+ 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;
2382
2382
  }) || null, [u, e, r]);
2383
2383
  G(() => {
2384
2384
  if (g.current) {
@@ -2386,15 +2386,15 @@ const Re = ({
2386
2386
  return;
2387
2387
  }
2388
2388
  if (r && Array.isArray(N) && Array.isArray(f)) {
2389
- const x = f == null ? void 0 : f.map((k) => k.value), M = N == null ? void 0 : N.map((k) => k.value);
2390
- JSON.stringify(x) !== JSON.stringify(M) && p(N);
2389
+ const x = f == null ? void 0 : f.map((M) => M.value), C = N == null ? void 0 : N.map((M) => M.value);
2390
+ JSON.stringify(x) !== JSON.stringify(C) && p(N);
2391
2391
  } else (N == null ? void 0 : N.value) !== (f == null ? void 0 : f.value) && p(N);
2392
2392
  }, [N, r]);
2393
- const C = Z((x) => {
2394
- var M;
2393
+ const k = Z((x) => {
2394
+ var C;
2395
2395
  if (g.current = !0, p(x), o) {
2396
- const k = r ? Array.isArray(x) ? x == null ? void 0 : x.map((L) => L.value) : [] : (M = x == null ? void 0 : x.value) != null ? M : null;
2397
- o(l, k), t == null || t(l);
2396
+ const M = r ? Array.isArray(x) ? x == null ? void 0 : x.map((w) => w.value) : [] : (C = x == null ? void 0 : x.value) != null ? C : null;
2397
+ o(l, M), t == null || t(l);
2398
2398
  }
2399
2399
  s && !g.current && s(l);
2400
2400
  }, [o, l, t, s, r]), S = Q(() => h ? "Fetching data..." : f ? r && 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, h, n, r]);
@@ -2414,7 +2414,7 @@ const Re = ({
2414
2414
  ie,
2415
2415
  {
2416
2416
  value: f,
2417
- onChange: C,
2417
+ onChange: k,
2418
2418
  multiple: r,
2419
2419
  disabled: y || h,
2420
2420
  children: /* @__PURE__ */ b("div", { className: "relative", children: [
@@ -2436,16 +2436,16 @@ const Re = ({
2436
2436
  leave: "transition ease-in duration-100",
2437
2437
  leaveFrom: "opacity-100",
2438
2438
  leaveTo: "opacity-0",
2439
- children: /* @__PURE__ */ i(ie.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, M) => {
2440
- var k;
2439
+ children: /* @__PURE__ */ i(ie.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) => {
2440
+ var M;
2441
2441
  return /* @__PURE__ */ i(
2442
2442
  ie.Option,
2443
2443
  {
2444
2444
  value: x,
2445
- className: ({ active: L }) => q("select-option", { active: L }),
2446
- children: ({ selected: L }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: L }), children: x.label })
2445
+ className: ({ active: w }) => q("select-option", { active: w }),
2446
+ children: ({ selected: w }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: w }), children: x.label })
2447
2447
  },
2448
- ((k = x.value) == null ? void 0 : k.id) || x.value || M
2448
+ ((M = x.value) == null ? void 0 : M.id) || x.value || C
2449
2449
  );
2450
2450
  }) })
2451
2451
  }
@@ -2470,21 +2470,21 @@ function Fe({
2470
2470
  const [t, r] = I(""), [c, m] = I([]), [v, h] = I(!1);
2471
2471
  G(() => {
2472
2472
  (async () => {
2473
- var x, M;
2473
+ var x, C;
2474
2474
  if (n) {
2475
2475
  h(!0);
2476
2476
  try {
2477
- const k = se("token"), L = k ? { headers: { Authorization: `Bearer ${k}` } } : {};
2478
- let w = (await Be.get(n, L)).data;
2479
- if (w && !Array.isArray(w) && (w.data && Array.isArray(w.data) ? w = w.data : (x = w.data) != null && x.data && Array.isArray(w.data.data) ? w = w.data.data : w.results && Array.isArray(w.results) ? w = w.results : (M = w.data) != null && M.results && Array.isArray(w.data.results) ? w = w.data.results : w.items && Array.isArray(w.items) && (w = w.items)), Array.isArray(w)) {
2480
- const R = w.map((B) => typeof B == "string" ? { label: B, value: B } : {
2481
- label: B.label || B.name || String(B.id || B.value),
2482
- value: String(B.value || B.id || B.name)
2477
+ const M = se("token"), w = M ? { headers: { Authorization: `Bearer ${M}` } } : {};
2478
+ let T = (await Be.get(n, w)).data;
2479
+ 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)) {
2480
+ const D = T.map((E) => typeof E == "string" ? { label: E, value: E } : {
2481
+ label: E.label || E.name || String(E.id || E.value),
2482
+ value: String(E.value || E.id || E.name)
2483
2483
  });
2484
- m(R);
2484
+ m(D);
2485
2485
  }
2486
- } catch (k) {
2487
- console.error("Failed to fetch options", k);
2486
+ } catch (M) {
2487
+ console.error("Failed to fetch options", M);
2488
2488
  } finally {
2489
2489
  h(!1);
2490
2490
  }
@@ -2510,14 +2510,14 @@ function Fe({
2510
2510
  return y.filter(
2511
2511
  (x) => x.label.toLowerCase().includes(S)
2512
2512
  );
2513
- }, [t, y]), C = Z((S) => {
2513
+ }, [t, y]), k = Z((S) => {
2514
2514
  g(S), o(d, S);
2515
2515
  }, [d, o]);
2516
2516
  return /* @__PURE__ */ i("div", { className: "relative w-full", children: /* @__PURE__ */ b(
2517
2517
  Pe,
2518
2518
  {
2519
2519
  value: p,
2520
- onChange: C,
2520
+ onChange: k,
2521
2521
  disabled: l,
2522
2522
  children: [
2523
2523
  /* @__PURE__ */ b("div", { className: "relative", children: [
@@ -2539,7 +2539,7 @@ function Fe({
2539
2539
  kn,
2540
2540
  {
2541
2541
  value: S,
2542
- className: ({ active: x, selected: M }) => q("select-option", { active: x, selected: M }),
2542
+ className: ({ active: x, selected: C }) => q("select-option", { active: x, selected: C }),
2543
2543
  children: ({ selected: x }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: x }), children: S.label })
2544
2544
  },
2545
2545
  S.value
@@ -3526,33 +3526,33 @@ function xo({
3526
3526
  n(yo(A));
3527
3527
  },
3528
3528
  [n]
3529
- ), N = (A, w) => {
3530
- const R = [...o];
3531
- R[A] = { type: "operator", value: w }, l(R), g(R);
3532
- }, C = (A) => {
3533
- const w = o.filter((R, B) => B !== A);
3534
- l(w), g(w);
3529
+ ), N = (A, T) => {
3530
+ const D = [...o];
3531
+ D[A] = { type: "operator", value: T }, l(D), g(D);
3532
+ }, k = (A) => {
3533
+ const T = o.filter((D, E) => E !== A);
3534
+ l(T), g(T);
3535
3535
  }, S = (A) => {
3536
3536
  h(A), m(""), r(!0);
3537
- }, x = (A, w) => {
3538
- const R = w !== void 0 ? w : v != null ? v : o.length, B = [...o], z = B.slice(0, R), $ = B.slice(R), ae = [
3537
+ }, x = (A, T) => {
3538
+ const D = T !== void 0 ? T : v != null ? v : o.length, E = [...o], z = E.slice(0, D), $ = E.slice(D), ae = [
3539
3539
  ...z,
3540
3540
  { type: "field", id: A.id, display: A.display },
3541
3541
  ...$
3542
- ], X = M(ae);
3542
+ ], X = C(ae);
3543
3543
  l(X), g(X), r(!1), h(null);
3544
3544
  };
3545
- function M(A) {
3546
- const w = [];
3545
+ function C(A) {
3546
+ const T = [];
3547
3547
  if (A.length === 0) return [{ type: "operator", value: "" }];
3548
- A[0].type === "field" && w.push({ type: "operator", value: "" });
3549
- for (let R = 0; R < A.length; R++)
3550
- w.push(A[R]), A[R].type === "field" && (R + 1 >= A.length || A[R + 1].type === "field") && w.push({ type: "operator", value: "" });
3551
- return w;
3548
+ A[0].type === "field" && T.push({ type: "operator", value: "" });
3549
+ for (let D = 0; D < A.length; D++)
3550
+ T.push(A[D]), A[D].type === "field" && (D + 1 >= A.length || A[D + 1].type === "field") && T.push({ type: "operator", value: "" });
3551
+ return T;
3552
3552
  }
3553
- const k = a.filter(
3553
+ const M = a.filter(
3554
3554
  (A) => A.display.toLowerCase().includes(c.toLowerCase())
3555
- ), L = o.every(
3555
+ ), w = o.every(
3556
3556
  (A) => A.type === "operator" && A.value.trim() === ""
3557
3557
  );
3558
3558
  return /* @__PURE__ */ b("div", { className: "relative", ref: f, children: [
@@ -3562,16 +3562,16 @@ function xo({
3562
3562
  className: "field-control flex flex-wrap items-center gap-1 min-h-[44px] cursor-text",
3563
3563
  style: { padding: "6px 10px" },
3564
3564
  onClick: () => {
3565
- var w;
3566
- const A = [...o].reverse().findIndex((R) => R.type === "operator");
3565
+ var T;
3566
+ const A = [...o].reverse().findIndex((D) => D.type === "operator");
3567
3567
  if (A !== -1) {
3568
- const R = o.length - 1 - A;
3569
- (w = p.current.get(R)) == null || w.focus();
3568
+ const D = o.length - 1 - A;
3569
+ (T = p.current.get(D)) == null || T.focus();
3570
3570
  }
3571
3571
  },
3572
3572
  children: [
3573
- L && /* @__PURE__ */ i("span", { className: "text-gray-400 text-sm pointer-events-none select-none", children: s || "Build your formula..." }),
3574
- o.map((A, w) => A.type === "field" ? /* @__PURE__ */ b(
3573
+ w && /* @__PURE__ */ i("span", { className: "text-gray-400 text-sm pointer-events-none select-none", children: s || "Build your formula..." }),
3574
+ o.map((A, T) => A.type === "field" ? /* @__PURE__ */ b(
3575
3575
  "span",
3576
3576
  {
3577
3577
  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",
@@ -3581,8 +3581,8 @@ function xo({
3581
3581
  "button",
3582
3582
  {
3583
3583
  type: "button",
3584
- onMouseDown: (R) => {
3585
- R.preventDefault(), C(w);
3584
+ onMouseDown: (D) => {
3585
+ D.preventDefault(), k(T);
3586
3586
  },
3587
3587
  className: "text-blue-400 hover:text-blue-700 leading-none ml-0.5",
3588
3588
  "aria-label": `Remove ${A.display}`,
@@ -3591,28 +3591,28 @@ function xo({
3591
3591
  )
3592
3592
  ]
3593
3593
  },
3594
- w
3594
+ T
3595
3595
  ) : /* @__PURE__ */ i(
3596
3596
  "input",
3597
3597
  {
3598
- ref: (R) => {
3599
- R ? p.current.set(w, R) : p.current.delete(w);
3598
+ ref: (D) => {
3599
+ D ? p.current.set(T, D) : p.current.delete(T);
3600
3600
  },
3601
3601
  type: "text",
3602
3602
  value: A.value,
3603
- onChange: (R) => N(w, R.target.value),
3604
- onFocus: () => u(w),
3603
+ onChange: (D) => N(T, D.target.value),
3604
+ onFocus: () => u(T),
3605
3605
  onBlur: () => u(null),
3606
3606
  className: "border-none outline-none bg-transparent text-sm font-mono p-0 m-0",
3607
3607
  style: {
3608
- width: `${Math.max(A.value.length * 9 + 8, d === w ? 40 : 14)}px`,
3608
+ width: `${Math.max(A.value.length * 9 + 8, d === T ? 40 : 14)}px`,
3609
3609
  minWidth: "14px",
3610
3610
  maxWidth: "200px"
3611
3611
  },
3612
3612
  placeholder: "",
3613
- "aria-label": `Operator at position ${w}`
3613
+ "aria-label": `Operator at position ${T}`
3614
3614
  },
3615
- w
3615
+ T
3616
3616
  )),
3617
3617
  /* @__PURE__ */ i(
3618
3618
  "button",
@@ -3629,7 +3629,7 @@ function xo({
3629
3629
  ]
3630
3630
  }
3631
3631
  ),
3632
- !L && /* @__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: [
3632
+ !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: [
3633
3633
  /* @__PURE__ */ i("span", { className: "font-sans font-semibold text-blue-500 uppercase tracking-wide mr-1", children: "Preview:" }),
3634
3634
  o.map((A) => A.type === "field" ? `[${A.display}]` : A.value).join("")
3635
3635
  ] }),
@@ -3658,17 +3658,17 @@ function xo({
3658
3658
  onChange: (A) => m(A.target.value),
3659
3659
  className: "w-full text-sm px-2 py-1 border border-gray-200 rounded outline-none focus:border-blue-300",
3660
3660
  onKeyDown: (A) => {
3661
- A.key === "Escape" && r(!1), A.key === "Enter" && k.length > 0 && x(k[0]);
3661
+ A.key === "Escape" && r(!1), A.key === "Enter" && M.length > 0 && x(M[0]);
3662
3662
  }
3663
3663
  }
3664
3664
  ) }),
3665
3665
  /* @__PURE__ */ b("div", { className: "max-h-48 overflow-y-auto", children: [
3666
- k.length === 0 && /* @__PURE__ */ i("p", { className: "text-xs text-gray-400 text-center py-3", children: "No matching fields" }),
3667
- k.map((A) => /* @__PURE__ */ b(
3666
+ M.length === 0 && /* @__PURE__ */ i("p", { className: "text-xs text-gray-400 text-center py-3", children: "No matching fields" }),
3667
+ M.map((A) => /* @__PURE__ */ b(
3668
3668
  "div",
3669
3669
  {
3670
- onMouseDown: (w) => {
3671
- w.preventDefault(), x(A);
3670
+ onMouseDown: (T) => {
3671
+ T.preventDefault(), x(A);
3672
3672
  },
3673
3673
  className: "px-3 py-2 text-sm cursor-pointer flex items-center justify-between hover:bg-blue-50 group",
3674
3674
  children: [
@@ -3690,8 +3690,8 @@ function xo({
3690
3690
  "button",
3691
3691
  {
3692
3692
  type: "button",
3693
- onMouseDown: (w) => {
3694
- w.preventDefault(), x(A, o.length);
3693
+ onMouseDown: (T) => {
3694
+ T.preventDefault(), x(A, o.length);
3695
3695
  },
3696
3696
  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",
3697
3697
  children: [
@@ -3703,25 +3703,25 @@ function xo({
3703
3703
  )) })
3704
3704
  ] });
3705
3705
  }
3706
- const Ao = D.object().shape({
3707
- inputLabel: D.string().nullable(),
3708
- placeholder: D.string().nullable(),
3709
- description: D.string().nullable(),
3710
- isReadOnly: D.boolean(),
3711
- isDisabled: D.boolean(),
3712
- isRequired: D.boolean(),
3713
- requiredMessage: D.string().nullable(),
3714
- minLengthMessage: D.string().nullable(),
3715
- maxLengthMessage: D.string().nullable(),
3716
- maxLength: D.number().typeError("Expecting a number").nullable(),
3717
- minLength: D.number().typeError("Expecting a number").nullable(),
3718
- inputType: D.string().nullable(),
3719
- maxAmountMessage: D.string().nullable(),
3720
- maxAmount: D.string().nullable(),
3721
- options: D.array().of(
3722
- D.object().shape({
3723
- label: D.string().nullable(),
3724
- value: D.string().when("label", {
3706
+ const Ao = R.object().shape({
3707
+ inputLabel: R.string().nullable(),
3708
+ placeholder: R.string().nullable(),
3709
+ description: R.string().nullable(),
3710
+ isReadOnly: R.boolean(),
3711
+ isDisabled: R.boolean(),
3712
+ isRequired: R.boolean(),
3713
+ requiredMessage: R.string().nullable(),
3714
+ minLengthMessage: R.string().nullable(),
3715
+ maxLengthMessage: R.string().nullable(),
3716
+ maxLength: R.number().typeError("Expecting a number").nullable(),
3717
+ minLength: R.number().typeError("Expecting a number").nullable(),
3718
+ inputType: R.string().nullable(),
3719
+ maxAmountMessage: R.string().nullable(),
3720
+ maxAmount: R.string().nullable(),
3721
+ options: R.array().of(
3722
+ R.object().shape({
3723
+ label: R.string().nullable(),
3724
+ value: R.string().when("label", {
3725
3725
  is: (e) => e && e.length > 0,
3726
3726
  then: (e) => e.required("Value is required when label is present"),
3727
3727
  otherwise: (e) => e.nullable()
@@ -3732,10 +3732,10 @@ const Ao = D.object().shape({
3732
3732
  then: (e) => e.required("Options are required for radio or checkbox inputs"),
3733
3733
  otherwise: (e) => e.nullable()
3734
3734
  }),
3735
- options1: D.array().of(
3736
- D.object().shape({
3737
- label: D.string().nullable(),
3738
- value: D.string().when("label", {
3735
+ options1: R.array().of(
3736
+ R.object().shape({
3737
+ label: R.string().nullable(),
3738
+ value: R.string().when("label", {
3739
3739
  is: (e) => e && e.length > 0,
3740
3740
  then: (e) => e.required("Value is required when label is present"),
3741
3741
  otherwise: (e) => e.nullable()
@@ -3746,35 +3746,35 @@ const Ao = D.object().shape({
3746
3746
  then: (e) => e.required("Options are required for radio or checkbox inputs"),
3747
3747
  otherwise: (e) => e.nullable()
3748
3748
  }),
3749
- prefix: D.string().nullable(),
3750
- url: D.string().nullable(),
3751
- method: D.string().nullable(),
3752
- denominators: D.mixed().nullable(),
3753
- responseType: D.string().nullable(),
3754
- minAmount: D.string().nullable(),
3755
- heading: D.string().nullable(),
3756
- minAmountMessage: D.string().nullable(),
3757
- columns: D.number().nullable().max(4).min(2),
3758
- value: D.mixed().nullable(),
3759
- customClass: D.string().nullable(),
3760
- elementClass: D.string().nullable(),
3761
- apiUrl: D.string().nullable(),
3762
- selectType: D.string().default("list"),
3763
- dateType: D.string().default("basic"),
3764
- validationUrl: D.string(),
3765
- signatureLink: D.string(),
3766
- minDate: D.string().nullable(),
3767
- maxDate: D.string().nullable(),
3768
- canHaveDateRange: D.boolean(),
3769
- allowYearPicker: D.boolean(),
3770
- isHidden: D.boolean(),
3771
- visibilityDependentFields: D.array().nullable(),
3772
- isMultiple: D.boolean(),
3773
- acceptedFiles: D.array(),
3774
- showState: D.boolean(),
3775
- formula: D.string().nullable(),
3776
- fetchExternalResults: D.boolean(),
3777
- externalApiUrl: D.string().nullable()
3749
+ prefix: R.string().nullable(),
3750
+ url: R.string().nullable(),
3751
+ method: R.string().nullable(),
3752
+ denominators: R.mixed().nullable(),
3753
+ responseType: R.string().nullable(),
3754
+ minAmount: R.string().nullable(),
3755
+ heading: R.string().nullable(),
3756
+ minAmountMessage: R.string().nullable(),
3757
+ columns: R.number().nullable().max(4).min(2),
3758
+ value: R.mixed().nullable(),
3759
+ customClass: R.string().nullable(),
3760
+ elementClass: R.string().nullable(),
3761
+ apiUrl: R.string().nullable(),
3762
+ selectType: R.string().default("list"),
3763
+ dateType: R.string().default("basic"),
3764
+ validationUrl: R.string(),
3765
+ signatureLink: R.string(),
3766
+ minDate: R.string().nullable(),
3767
+ maxDate: R.string().nullable(),
3768
+ canHaveDateRange: R.boolean(),
3769
+ allowYearPicker: R.boolean(),
3770
+ isHidden: R.boolean(),
3771
+ visibilityDependentFields: R.array().nullable(),
3772
+ isMultiple: R.boolean(),
3773
+ acceptedFiles: R.array(),
3774
+ showState: R.boolean(),
3775
+ formula: R.string().nullable(),
3776
+ fetchExternalResults: R.boolean(),
3777
+ externalApiUrl: R.string().nullable()
3778
3778
  }), So = [
3779
3779
  { title: "Configurations", key: "basic" },
3780
3780
  { title: "Validations", key: "validation" }
@@ -3785,29 +3785,29 @@ const Ao = D.object().shape({
3785
3785
  }) => {
3786
3786
  var J;
3787
3787
  const s = So.filter(
3788
- (T) => !Ve.includes(a.inputType) || T.key !== "validation"
3789
- ), { updateElement: o, formData: l } = ne.useContext(re), [d, u] = I("basic"), [t, r] = I(!1), [c, m] = I("manual"), v = ((J = l == null ? void 0 : l.flatMap((T) => T.questionData || [])) == null ? void 0 : J.length) || 0, h = ne.useMemo(() => (l == null ? void 0 : l.flatMap((T) => T.questionData || []).filter((T) => {
3788
+ (B) => !Ve.includes(a.inputType) || B.key !== "validation"
3789
+ ), { updateElement: o, formData: l } = ne.useContext(re), [d, u] = I("basic"), [t, r] = I(!1), [c, m] = I("manual"), v = ((J = l == null ? void 0 : l.flatMap((B) => B.questionData || [])) == null ? void 0 : J.length) || 0, h = ne.useMemo(() => (l == null ? void 0 : l.flatMap((B) => B.questionData || []).filter((B) => {
3790
3790
  var P;
3791
- return T.id !== (a == null ? void 0 : a.id) && !["spacer", "divider", "section", "grid"].includes((P = T.type) == null ? void 0 : P.toLowerCase());
3792
- }).map((T) => ({
3793
- id: T.id,
3794
- display: T.inputLabel || T.label || "Unnamed"
3791
+ return B.id !== (a == null ? void 0 : a.id) && !["spacer", "divider", "section", "grid"].includes((P = B.type) == null ? void 0 : P.toLowerCase());
3792
+ }).map((B) => ({
3793
+ id: B.id,
3794
+ display: B.inputLabel || B.label || "Unnamed"
3795
3795
  }))) || [], [v, a == null ? void 0 : a.id]), y = se("config"), {
3796
3796
  register: f,
3797
3797
  handleSubmit: p,
3798
3798
  control: g,
3799
3799
  setValue: N,
3800
- watch: C,
3800
+ watch: k,
3801
3801
  trigger: S,
3802
- formState: { errors: x, isSubmitting: M, isValid: k },
3803
- reset: L
3802
+ formState: { errors: x, isSubmitting: C, isValid: M },
3803
+ reset: w
3804
3804
  } = yi({
3805
3805
  resolver: Ci(Ao),
3806
3806
  defaultValues: {
3807
3807
  ...a,
3808
3808
  options: a.options || []
3809
3809
  }
3810
- }), A = C(), { fields: w, append: R, remove: B } = ei({
3810
+ }), A = k(), { fields: T, append: D, remove: E } = ei({
3811
3811
  control: g,
3812
3812
  name: "options"
3813
3813
  }), {
@@ -3826,24 +3826,24 @@ const Ao = D.object().shape({
3826
3826
  name: "dataColumns"
3827
3827
  });
3828
3828
  G(() => {
3829
- e || L();
3830
- }, [e, L]);
3831
- const j = (T) => {
3832
- o(T, a.sectionId), n();
3829
+ e || w();
3830
+ }, [e, w]);
3831
+ const j = (B) => {
3832
+ o(B, a.sectionId), n();
3833
3833
  }, Ne = {
3834
3834
  headers: {
3835
3835
  Authorization: `Bearer ${se("token")}`
3836
3836
  }
3837
3837
  }, Me = Z(async () => {
3838
- var T, P, U;
3838
+ var B, P, U;
3839
3839
  if (!A.apiUrl || !/^https?:\/\//.test(A.apiUrl)) {
3840
3840
  fe.info("Please provide a valid API URL");
3841
3841
  return;
3842
3842
  }
3843
3843
  try {
3844
3844
  r(!0);
3845
- const { status: E, data: Y } = await Be.get(A.apiUrl, Ne);
3846
- if (E !== 200 || !Y) {
3845
+ const { status: L, data: Y } = await Be.get(A.apiUrl, Ne);
3846
+ if (L !== 200 || !Y) {
3847
3847
  fe.error("Unexpected response from server.");
3848
3848
  return;
3849
3849
  }
@@ -3852,19 +3852,19 @@ const Ao = D.object().shape({
3852
3852
  fe.error("Expected an array in response (data, record, or result).");
3853
3853
  return;
3854
3854
  }
3855
- ((T = a.type) == null ? void 0 : T.toLowerCase()) === "datagrid" ? N("dataColumns", fi(K)) : N("options", gi(K));
3856
- } catch (E) {
3857
- const Y = ((U = (P = E == null ? void 0 : E.response) == null ? void 0 : P.data) == null ? void 0 : U.message) || (E == null ? void 0 : E.message) || "Unable to load options";
3855
+ ((B = a.type) == null ? void 0 : B.toLowerCase()) === "datagrid" ? N("dataColumns", fi(K)) : N("options", gi(K));
3856
+ } catch (L) {
3857
+ const Y = ((U = (P = L == null ? void 0 : L.response) == null ? void 0 : P.data) == null ? void 0 : U.message) || (L == null ? void 0 : L.message) || "Unable to load options";
3858
3858
  fe.error(Y);
3859
3859
  } finally {
3860
3860
  r(!1);
3861
3861
  }
3862
3862
  }, [a.type, N, A.apiUrl]), he = ["manual", "api", "sheet"];
3863
- function Ae() {
3863
+ function Se() {
3864
3864
  c === "api" && Me();
3865
3865
  }
3866
3866
  const we = () => {
3867
- var T, P;
3867
+ var B, P;
3868
3868
  return /* @__PURE__ */ b("div", { className: "flex flex-col justify-start gap-y-1", children: [
3869
3869
  /* @__PURE__ */ i("div", { className: "flex items-center mb-4 gap-x-5", children: he == null ? void 0 : he.map((U) => /* @__PURE__ */ b("label", { className: "items-center text-base capitalize gap-x-3", children: [
3870
3870
  /* @__PURE__ */ i(
@@ -3872,7 +3872,7 @@ const Ao = D.object().shape({
3872
3872
  {
3873
3873
  type: "radio",
3874
3874
  name: "optionType",
3875
- onChange: (E) => m(E.target.value),
3875
+ onChange: (L) => m(L.target.value),
3876
3876
  value: U
3877
3877
  }
3878
3878
  ),
@@ -3888,7 +3888,7 @@ const Ao = D.object().shape({
3888
3888
  /* @__PURE__ */ i(
3889
3889
  V,
3890
3890
  {
3891
- watch: C,
3891
+ watch: k,
3892
3892
  label: "Load Options from Api",
3893
3893
  name: "apiUrl",
3894
3894
  errors: x,
@@ -3903,7 +3903,7 @@ const Ao = D.object().shape({
3903
3903
  /* @__PURE__ */ i(
3904
3904
  "button",
3905
3905
  {
3906
- onClick: Ae,
3906
+ onClick: Se,
3907
3907
  className: "px-3 py-1 text-xs text-white bg-gray-600 rounded",
3908
3908
  type: "button",
3909
3909
  children: "Load"
@@ -3922,8 +3922,8 @@ const Ao = D.object().shape({
3922
3922
  }
3923
3923
  ) }),
3924
3924
  /* @__PURE__ */ b("div", { children: [
3925
- /* @__PURE__ */ i("h3", { className: "mb-4 text-sm text-gray-500 font-semibold", children: ((T = a == null ? void 0 : a.type) == null ? void 0 : T.toLowerCase()) === "matrix" ? "Rows Options" : "Parent Options" }),
3926
- w == null ? void 0 : w.map((U, E) => /* @__PURE__ */ b(
3925
+ /* @__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" }),
3926
+ T == null ? void 0 : T.map((U, L) => /* @__PURE__ */ b(
3927
3927
  "div",
3928
3928
  {
3929
3929
  className: "flex items-center mb-1 gap-x-4 last:mb-0",
@@ -3931,16 +3931,16 @@ const Ao = D.object().shape({
3931
3931
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
3932
3932
  V,
3933
3933
  {
3934
- watch: C,
3935
- label: E === 0 ? "Label" : "",
3936
- name: `options.${E}.label`,
3934
+ watch: k,
3935
+ label: L === 0 ? "Label" : "",
3936
+ name: `options.${L}.label`,
3937
3937
  register: f,
3938
3938
  errors: x,
3939
3939
  element: a,
3940
3940
  placeholder: "Label",
3941
3941
  onChange: (Y) => {
3942
3942
  const F = Y.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
3943
- N(`options.${E}.value`, F, {
3943
+ N(`options.${L}.value`, F, {
3944
3944
  shouldValidate: !0,
3945
3945
  shouldDirty: !0
3946
3946
  });
@@ -3950,9 +3950,9 @@ const Ao = D.object().shape({
3950
3950
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
3951
3951
  V,
3952
3952
  {
3953
- watch: C,
3954
- label: E === 0 ? "Value" : "",
3955
- name: `options.${E}.value`,
3953
+ watch: k,
3954
+ label: L === 0 ? "Value" : "",
3955
+ name: `options.${L}.value`,
3956
3956
  register: f,
3957
3957
  errors: x,
3958
3958
  element: a,
@@ -3962,10 +3962,10 @@ const Ao = D.object().shape({
3962
3962
  /* @__PURE__ */ i(
3963
3963
  "button",
3964
3964
  {
3965
- disabled: w.length === 1,
3965
+ disabled: T.length === 1,
3966
3966
  type: "button",
3967
3967
  className: "outline-none hover:opacity-80 disabled:opacity-40 disabled:cursor-not-allowed",
3968
- onClick: () => B(E),
3968
+ onClick: () => E(L),
3969
3969
  children: /* @__PURE__ */ i(W, { icon: "iconamoon:sign-times-fill" })
3970
3970
  }
3971
3971
  )
@@ -3981,7 +3981,7 @@ const Ao = D.object().shape({
3981
3981
  {
3982
3982
  type: "button",
3983
3983
  className: "flex items-center mt-2 text-sm font-medium text-gray-700 gap-x-1",
3984
- onClick: () => R({ label: "", value: "", id: be() }),
3984
+ onClick: () => D({ label: "", value: "", id: be() }),
3985
3985
  children: [
3986
3986
  /* @__PURE__ */ i(W, { icon: "qlementine-icons:plus-16" }),
3987
3987
  " Add Option"
@@ -3995,7 +3995,7 @@ const Ao = D.object().shape({
3995
3995
  /* @__PURE__ */ b("div", { children: [
3996
3996
  " ",
3997
3997
  /* @__PURE__ */ i("h3", { className: "mb-4 text-sm text-gray-500 font-semibold", children: ((P = a == null ? void 0 : a.type) == null ? void 0 : P.toLowerCase()) === "matrix" ? "Columns Options" : "Child Options" }),
3998
- z == null ? void 0 : z.map((U, E) => /* @__PURE__ */ b(
3998
+ z == null ? void 0 : z.map((U, L) => /* @__PURE__ */ b(
3999
3999
  "div",
4000
4000
  {
4001
4001
  className: "flex items-center mb-1 gap-x-4 last:mb-0",
@@ -4003,16 +4003,16 @@ const Ao = D.object().shape({
4003
4003
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4004
4004
  V,
4005
4005
  {
4006
- watch: C,
4007
- label: E === 0 ? "Label" : "",
4008
- name: `options1.${E}.label`,
4006
+ watch: k,
4007
+ label: L === 0 ? "Label" : "",
4008
+ name: `options1.${L}.label`,
4009
4009
  register: f,
4010
4010
  errors: x,
4011
4011
  element: a,
4012
4012
  placeholder: "Label",
4013
4013
  onChange: (Y) => {
4014
4014
  const F = Y.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4015
- N(`options1.${E}.value`, F, {
4015
+ N(`options1.${L}.value`, F, {
4016
4016
  shouldValidate: !0,
4017
4017
  shouldDirty: !0
4018
4018
  });
@@ -4022,9 +4022,9 @@ const Ao = D.object().shape({
4022
4022
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4023
4023
  V,
4024
4024
  {
4025
- watch: C,
4026
- label: E === 0 ? "Value" : "",
4027
- name: `options1.${E}.value`,
4025
+ watch: k,
4026
+ label: L === 0 ? "Value" : "",
4027
+ name: `options1.${L}.value`,
4028
4028
  register: f,
4029
4029
  errors: x,
4030
4030
  element: a,
@@ -4034,9 +4034,9 @@ const Ao = D.object().shape({
4034
4034
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4035
4035
  V,
4036
4036
  {
4037
- watch: C,
4038
- label: E === 0 ? "Key" : "",
4039
- name: `options1.${E}.key`,
4037
+ watch: k,
4038
+ label: L === 0 ? "Key" : "",
4039
+ name: `options1.${L}.key`,
4040
4040
  register: f,
4041
4041
  errors: x,
4042
4042
  element: a,
@@ -4049,7 +4049,7 @@ const Ao = D.object().shape({
4049
4049
  disabled: z.length === 1,
4050
4050
  type: "button",
4051
4051
  className: "outline-none hover:opacity-80 disabled:opacity-40 disabled:cursor-not-allowed",
4052
- onClick: () => ae(E),
4052
+ onClick: () => ae(L),
4053
4053
  children: /* @__PURE__ */ i(W, { icon: "iconamoon:sign-times-fill" })
4054
4054
  }
4055
4055
  )
@@ -4076,30 +4076,30 @@ const Ao = D.object().shape({
4076
4076
  ] })
4077
4077
  ] });
4078
4078
  }, Ee = () => /* @__PURE__ */ b("div", { className: "flex flex-col justify-start gap-y-1", children: [
4079
- /* @__PURE__ */ i("div", { className: "flex items-center mb-4 gap-x-5", children: he == null ? void 0 : he.map((T) => /* @__PURE__ */ b("label", { className: "items-center text-base capitalize gap-x-3", children: [
4079
+ /* @__PURE__ */ i("div", { className: "flex items-center mb-4 gap-x-5", children: he == null ? void 0 : he.map((B) => /* @__PURE__ */ b("label", { className: "items-center text-base capitalize gap-x-3", children: [
4080
4080
  /* @__PURE__ */ i(
4081
4081
  "input",
4082
4082
  {
4083
4083
  type: "radio",
4084
4084
  name: "optionType",
4085
4085
  onChange: (P) => m(P.target.value),
4086
- value: T,
4087
- checked: T === c
4086
+ value: B,
4087
+ checked: B === c
4088
4088
  }
4089
4089
  ),
4090
4090
  " ",
4091
4091
  /* @__PURE__ */ b("span", { children: [
4092
- T,
4092
+ B,
4093
4093
  " options"
4094
4094
  ] })
4095
- ] }, T)) }),
4095
+ ] }, B)) }),
4096
4096
  c === "api" && /* @__PURE__ */ b("div", { className: "mb-4", children: [
4097
4097
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
4098
4098
  /* @__PURE__ */ b("div", { className: "relative flex items-center w-full mb-2", children: [
4099
4099
  /* @__PURE__ */ i(
4100
4100
  V,
4101
4101
  {
4102
- watch: C,
4102
+ watch: k,
4103
4103
  label: "Load Columns from Api",
4104
4104
  name: "apiUrl",
4105
4105
  errors: x,
@@ -4114,7 +4114,7 @@ const Ao = D.object().shape({
4114
4114
  /* @__PURE__ */ i(
4115
4115
  "button",
4116
4116
  {
4117
- onClick: Ae,
4117
+ onClick: Se,
4118
4118
  className: "px-3 py-1 text-xs text-white bg-gray-600 rounded",
4119
4119
  type: "button",
4120
4120
  children: "Load"
@@ -4132,8 +4132,8 @@ const Ao = D.object().shape({
4132
4132
  name: "dataColumns"
4133
4133
  }
4134
4134
  ) }),
4135
- /* @__PURE__ */ i("div", { className: "grid gap-y-3", children: X == null ? void 0 : X.map((T, P) => {
4136
- var U, E;
4135
+ /* @__PURE__ */ i("div", { className: "grid gap-y-3", children: X == null ? void 0 : X.map((B, P) => {
4136
+ var U, L;
4137
4137
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-2 border-b border-gray-100 pb-2 mb-2 last:border-0 last:pb-0 last:mb-0", children: [
4138
4138
  /* @__PURE__ */ b("div", { className: "flex items-center gap-x-4", children: [
4139
4139
  /* @__PURE__ */ i("div", { className: "min-w-[140px]", children: /* @__PURE__ */ i(
@@ -4168,7 +4168,7 @@ const Ao = D.object().shape({
4168
4168
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4169
4169
  V,
4170
4170
  {
4171
- watch: C,
4171
+ watch: k,
4172
4172
  label: P === 0 ? "Display header" : "",
4173
4173
  name: `dataColumns.${P}.headerName`,
4174
4174
  register: f,
@@ -4187,7 +4187,7 @@ const Ao = D.object().shape({
4187
4187
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4188
4188
  V,
4189
4189
  {
4190
- watch: C,
4190
+ watch: k,
4191
4191
  label: P === 0 ? "Field key" : "",
4192
4192
  name: `dataColumns.${P}.field`,
4193
4193
  register: f,
@@ -4208,10 +4208,10 @@ const Ao = D.object().shape({
4208
4208
  }
4209
4209
  )
4210
4210
  ] }),
4211
- ((E = (U = A.dataColumns) == null ? void 0 : U[P]) == 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(
4211
+ ((L = (U = A.dataColumns) == null ? void 0 : U[P]) == 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(
4212
4212
  V,
4213
4213
  {
4214
- watch: C,
4214
+ watch: k,
4215
4215
  label: "Options API URL",
4216
4216
  name: `dataColumns.${P}.optionsUrl`,
4217
4217
  register: f,
@@ -4220,7 +4220,7 @@ const Ao = D.object().shape({
4220
4220
  placeholder: "https://api.example.com/options"
4221
4221
  }
4222
4222
  ) }) })
4223
- ] }, T.id);
4223
+ ] }, B.id);
4224
4224
  }) }),
4225
4225
  /* @__PURE__ */ b("div", { children: [
4226
4226
  " ",
@@ -4245,9 +4245,9 @@ const Ao = D.object().shape({
4245
4245
  )
4246
4246
  ] })
4247
4247
  ] }), O = Z(async () => {
4248
- const T = se("token"), { status: P, data: U } = await Be.get(A.url, {
4248
+ const B = se("token"), { status: P, data: U } = await Be.get(A.url, {
4249
4249
  headers: {
4250
- Authorization: `Bearer ${T}`
4250
+ Authorization: `Bearer ${B}`
4251
4251
  }
4252
4252
  });
4253
4253
  P === 200 && N("options", (U == null ? void 0 : U.data) || U);
@@ -4259,10 +4259,10 @@ const Ao = D.object().shape({
4259
4259
  "div",
4260
4260
  {
4261
4261
  className: "fixed inset-0 bg-gray-800/40 backdrop-blur-sm flex items-center justify-end z-[999] cursor-default",
4262
- onMouseDown: (T) => T.stopPropagation(),
4263
- onPointerDown: (T) => T.stopPropagation(),
4264
- onDragStart: (T) => {
4265
- T.preventDefault(), T.stopPropagation();
4262
+ onMouseDown: (B) => B.stopPropagation(),
4263
+ onPointerDown: (B) => B.stopPropagation(),
4264
+ onDragStart: (B) => {
4265
+ B.preventDefault(), B.stopPropagation();
4266
4266
  },
4267
4267
  children: /* @__PURE__ */ b("div", { className: "w-full lg:w-2/3 xl:w-2/5 bg-white h-screen shadow-xl relative flex flex-col items-center", children: [
4268
4268
  /* @__PURE__ */ i(
@@ -4296,7 +4296,7 @@ const Ao = D.object().shape({
4296
4296
  oi.includes(a.inputType) && /* @__PURE__ */ i(me, { children: /* @__PURE__ */ i(
4297
4297
  V,
4298
4298
  {
4299
- watch: C,
4299
+ watch: k,
4300
4300
  label: "Value",
4301
4301
  name: "value",
4302
4302
  register: f,
@@ -4308,7 +4308,7 @@ const Ao = D.object().shape({
4308
4308
  /* @__PURE__ */ i(
4309
4309
  V,
4310
4310
  {
4311
- watch: C,
4311
+ watch: k,
4312
4312
  label: "Label",
4313
4313
  name: "inputLabel",
4314
4314
  register: f,
@@ -4320,7 +4320,7 @@ const Ao = D.object().shape({
4320
4320
  a.type.toLowerCase() === "cascadeselect" && /* @__PURE__ */ i(
4321
4321
  V,
4322
4322
  {
4323
- watch: C,
4323
+ watch: k,
4324
4324
  label: "Child Label",
4325
4325
  name: "childLabel",
4326
4326
  register: f,
@@ -4332,7 +4332,7 @@ const Ao = D.object().shape({
4332
4332
  ao.includes(a.inputType) && /* @__PURE__ */ i(
4333
4333
  V,
4334
4334
  {
4335
- watch: C,
4335
+ watch: k,
4336
4336
  label: "Placeholder",
4337
4337
  name: "placeholder",
4338
4338
  register: f,
@@ -4343,7 +4343,7 @@ const Ao = D.object().shape({
4343
4343
  io.includes(a.inputType) && /* @__PURE__ */ i(
4344
4344
  V,
4345
4345
  {
4346
- watch: C,
4346
+ watch: k,
4347
4347
  label: "Prefix",
4348
4348
  name: "prefix",
4349
4349
  register: f,
@@ -4356,7 +4356,7 @@ const Ao = D.object().shape({
4356
4356
  /* @__PURE__ */ i(
4357
4357
  V,
4358
4358
  {
4359
- watch: C,
4359
+ watch: k,
4360
4360
  label: "Api Url",
4361
4361
  name: "url",
4362
4362
  register: f,
@@ -4382,7 +4382,7 @@ const Ao = D.object().shape({
4382
4382
  name: "method",
4383
4383
  setValue: N,
4384
4384
  trigger: S,
4385
- value: C("method")
4385
+ value: k("method")
4386
4386
  }
4387
4387
  ),
4388
4388
  /* @__PURE__ */ i(
@@ -4403,23 +4403,23 @@ const Ao = D.object().shape({
4403
4403
  name: "responseType",
4404
4404
  setValue: N,
4405
4405
  trigger: S,
4406
- value: C("responseType")
4406
+ value: k("responseType")
4407
4407
  }
4408
4408
  )
4409
4409
  ] }),
4410
4410
  uo.includes(a.inputType) && /* @__PURE__ */ i(
4411
4411
  co,
4412
4412
  {
4413
- onChange: (T) => {
4414
- N("denominators", T);
4413
+ onChange: (B) => {
4414
+ N("denominators", B);
4415
4415
  },
4416
- value: C("denominators")
4416
+ value: k("denominators")
4417
4417
  }
4418
4418
  ),
4419
4419
  !oi.includes(a.inputType) && !Ve.includes(a.inputType) && /* @__PURE__ */ i(
4420
4420
  V,
4421
4421
  {
4422
- watch: C,
4422
+ watch: k,
4423
4423
  label: "Short Description",
4424
4424
  name: "description",
4425
4425
  register: f,
@@ -4437,13 +4437,13 @@ const Ao = D.object().shape({
4437
4437
  name: "dateFormat",
4438
4438
  setValue: N,
4439
4439
  trigger: S,
4440
- value: C("dateFormat")
4440
+ value: k("dateFormat")
4441
4441
  }
4442
4442
  ),
4443
4443
  /* @__PURE__ */ i(
4444
4444
  V,
4445
4445
  {
4446
- watch: C,
4446
+ watch: k,
4447
4447
  label: "Allow Range",
4448
4448
  name: "canHaveDateRange",
4449
4449
  register: f,
@@ -4477,7 +4477,7 @@ const Ao = D.object().shape({
4477
4477
  /* @__PURE__ */ i(
4478
4478
  V,
4479
4479
  {
4480
- watch: C,
4480
+ watch: k,
4481
4481
  label: "Allow Year Picker",
4482
4482
  name: "allowYearPicker",
4483
4483
  register: f,
@@ -4491,7 +4491,7 @@ const Ao = D.object().shape({
4491
4491
  a.type.toLowerCase() === "country" && /* @__PURE__ */ i(
4492
4492
  V,
4493
4493
  {
4494
- watch: C,
4494
+ watch: k,
4495
4495
  label: "Allow States",
4496
4496
  name: "showState",
4497
4497
  register: f,
@@ -4519,13 +4519,13 @@ const Ao = D.object().shape({
4519
4519
  name: "selectType",
4520
4520
  setValue: N,
4521
4521
  trigger: S,
4522
- value: C("selectType")
4522
+ value: k("selectType")
4523
4523
  }
4524
4524
  ),
4525
4525
  a.type.toLowerCase() === "grid" && /* @__PURE__ */ i(
4526
4526
  V,
4527
4527
  {
4528
- watch: C,
4528
+ watch: k,
4529
4529
  label: "Number of columns (max: 4)",
4530
4530
  name: "columns",
4531
4531
  register: f,
@@ -4540,7 +4540,7 @@ const Ao = D.object().shape({
4540
4540
  /* @__PURE__ */ i(
4541
4541
  V,
4542
4542
  {
4543
- watch: C,
4543
+ watch: k,
4544
4544
  label: "Document Options Url",
4545
4545
  name: "url",
4546
4546
  register: f,
@@ -4555,7 +4555,7 @@ const Ao = D.object().shape({
4555
4555
  /* @__PURE__ */ i(
4556
4556
  V,
4557
4557
  {
4558
- watch: C,
4558
+ watch: k,
4559
4559
  label: "Document Validation Url",
4560
4560
  name: "validationUrl",
4561
4561
  register: f,
@@ -4568,7 +4568,7 @@ const Ao = D.object().shape({
4568
4568
  /* @__PURE__ */ i("div", { className: "grid gap-y-1", children: /* @__PURE__ */ i(
4569
4569
  V,
4570
4570
  {
4571
- watch: C,
4571
+ watch: k,
4572
4572
  label: "Signature Page Url",
4573
4573
  name: "signatureLink",
4574
4574
  register: f,
@@ -4582,7 +4582,7 @@ const Ao = D.object().shape({
4582
4582
  /* @__PURE__ */ i(
4583
4583
  V,
4584
4584
  {
4585
- watch: C,
4585
+ watch: k,
4586
4586
  label: "Allow Multiple Uploads",
4587
4587
  name: "isMultiple",
4588
4588
  register: f,
@@ -4600,7 +4600,7 @@ const Ao = D.object().shape({
4600
4600
  id: "acceptedFiles",
4601
4601
  value: A == null ? void 0 : A.acceptedFiles
4602
4602
  },
4603
- validationData: { register: f, setValue: N, trigger: S, watch: C },
4603
+ validationData: { register: f, setValue: N, trigger: S, watch: k },
4604
4604
  placeholder: "Choose file types"
4605
4605
  }
4606
4606
  )
@@ -4610,7 +4610,7 @@ const Ao = D.object().shape({
4610
4610
  /* @__PURE__ */ i("div", { className: "w-[150px] mb-4", children: /* @__PURE__ */ i(
4611
4611
  V,
4612
4612
  {
4613
- watch: C,
4613
+ watch: k,
4614
4614
  label: "Toggle Visibility",
4615
4615
  name: "isHidden",
4616
4616
  register: f,
@@ -4627,7 +4627,7 @@ const Ao = D.object().shape({
4627
4627
  register: f,
4628
4628
  setValue: N,
4629
4629
  trigger: S,
4630
- watch: C,
4630
+ watch: k,
4631
4631
  id: a == null ? void 0 : a.id
4632
4632
  }
4633
4633
  )
@@ -4637,8 +4637,8 @@ const Ao = D.object().shape({
4637
4637
  /* @__PURE__ */ i(
4638
4638
  xo,
4639
4639
  {
4640
- value: C("formula") || "",
4641
- onChange: (T) => N("formula", T, { shouldValidate: !0, shouldDirty: !0 }),
4640
+ value: k("formula") || "",
4641
+ onChange: (B) => N("formula", B, { shouldValidate: !0, shouldDirty: !0 }),
4642
4642
  fields: h,
4643
4643
  placeholder: "Build your formula..."
4644
4644
  }
@@ -4648,7 +4648,7 @@ const Ao = D.object().shape({
4648
4648
  /* @__PURE__ */ i(
4649
4649
  V,
4650
4650
  {
4651
- watch: C,
4651
+ watch: k,
4652
4652
  label: "Fetch results from external API",
4653
4653
  name: "fetchExternalResults",
4654
4654
  register: f,
@@ -4661,7 +4661,7 @@ const Ao = D.object().shape({
4661
4661
  A.fetchExternalResults && /* @__PURE__ */ i(
4662
4662
  V,
4663
4663
  {
4664
- watch: C,
4664
+ watch: k,
4665
4665
  label: "External API URL (returns options results)",
4666
4666
  name: "externalApiUrl",
4667
4667
  register: f,
@@ -4677,7 +4677,7 @@ const Ao = D.object().shape({
4677
4677
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4678
4678
  V,
4679
4679
  {
4680
- watch: C,
4680
+ watch: k,
4681
4681
  label: "Required",
4682
4682
  name: "isRequired",
4683
4683
  register: f,
@@ -4691,7 +4691,7 @@ const Ao = D.object().shape({
4691
4691
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4692
4692
  V,
4693
4693
  {
4694
- watch: C,
4694
+ watch: k,
4695
4695
  label: "Error message text",
4696
4696
  name: "requiredMessage",
4697
4697
  register: f,
@@ -4705,7 +4705,7 @@ const Ao = D.object().shape({
4705
4705
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4706
4706
  V,
4707
4707
  {
4708
- watch: C,
4708
+ watch: k,
4709
4709
  label: "Min Length",
4710
4710
  name: "minLength",
4711
4711
  register: f,
@@ -4718,7 +4718,7 @@ const Ao = D.object().shape({
4718
4718
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4719
4719
  V,
4720
4720
  {
4721
- watch: C,
4721
+ watch: k,
4722
4722
  label: "Error message text",
4723
4723
  name: "minLengthMessage",
4724
4724
  register: f,
@@ -4731,7 +4731,7 @@ const Ao = D.object().shape({
4731
4731
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4732
4732
  V,
4733
4733
  {
4734
- watch: C,
4734
+ watch: k,
4735
4735
  label: "Max Length",
4736
4736
  name: "maxLength",
4737
4737
  register: f,
@@ -4744,7 +4744,7 @@ const Ao = D.object().shape({
4744
4744
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4745
4745
  V,
4746
4746
  {
4747
- watch: C,
4747
+ watch: k,
4748
4748
  label: "Error message text",
4749
4749
  name: "maxLengthMessage",
4750
4750
  register: f,
@@ -4759,7 +4759,7 @@ const Ao = D.object().shape({
4759
4759
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4760
4760
  V,
4761
4761
  {
4762
- watch: C,
4762
+ watch: k,
4763
4763
  label: "Min Amount",
4764
4764
  name: "minAmount",
4765
4765
  register: f,
@@ -4772,7 +4772,7 @@ const Ao = D.object().shape({
4772
4772
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4773
4773
  V,
4774
4774
  {
4775
- watch: C,
4775
+ watch: k,
4776
4776
  label: "Error message text",
4777
4777
  name: "minAmountMessage",
4778
4778
  register: f,
@@ -4785,7 +4785,7 @@ const Ao = D.object().shape({
4785
4785
  /* @__PURE__ */ i("div", { className: "w-[150px]", children: /* @__PURE__ */ i(
4786
4786
  V,
4787
4787
  {
4788
- watch: C,
4788
+ watch: k,
4789
4789
  label: "Max Amount",
4790
4790
  name: "maxAmount",
4791
4791
  register: f,
@@ -4798,7 +4798,7 @@ const Ao = D.object().shape({
4798
4798
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4799
4799
  V,
4800
4800
  {
4801
- watch: C,
4801
+ watch: k,
4802
4802
  label: "Error message text",
4803
4803
  name: "maxAmountMessage",
4804
4804
  register: f,
@@ -4825,10 +4825,10 @@ const Ao = D.object().shape({
4825
4825
  "button",
4826
4826
  {
4827
4827
  type: "submit",
4828
- disabled: !k || M,
4828
+ disabled: !M || C,
4829
4829
  style: { background: (y == null ? void 0 : y.buttonColor) || "#333" },
4830
- className: `flex-1 px-4 py-2.5 ${!k || M ? "bg-[#F2F4F7]" : "bg-[#2563EB]"} ${!k || M ? "text-[#98A2B3]" : "text-white"} rounded-lg shadow-xs font-semibold font-onest disabled:opacity-50 editor_option__save`,
4831
- children: M ? "Saving..." : "Save"
4830
+ 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`,
4831
+ children: C ? "Saving..." : "Save"
4832
4832
  }
4833
4833
  )
4834
4834
  ] })
@@ -5051,7 +5051,7 @@ function wo({
5051
5051
  element: e,
5052
5052
  validationData: n
5053
5053
  }) {
5054
- var M;
5054
+ var C;
5055
5055
  const { register: a = () => ({}), setValue: s, watch: o } = n || {}, [l, d] = I(), [u, t] = I(!1), [r, c] = I(!1), [m, v] = I(""), h = o && o(e == null ? void 0 : e.id);
5056
5056
  G(() => {
5057
5057
  d(h);
@@ -5065,24 +5065,24 @@ function wo({
5065
5065
  Authorization: `Bearer ${se("token")}`
5066
5066
  }
5067
5067
  }, x = Z(
5068
- async (k) => {
5069
- var L, A, w, R, B, z, $, ae, X, te, _;
5068
+ async (M) => {
5069
+ var w, A, T, D, E, z, $, ae, X, te, _;
5070
5070
  if (!(!p || !g)) {
5071
5071
  t(!0);
5072
5072
  try {
5073
5073
  let j;
5074
5074
  if (g.toLowerCase() === "get") {
5075
- const ye = `${p}?value=${k}`;
5075
+ const ye = `${p}?value=${M}`;
5076
5076
  j = await Be.get(ye, S);
5077
5077
  } else if (g.toLowerCase() === "post")
5078
- j = await Be.post(p, { value: k }, S);
5078
+ j = await Be.post(p, { value: M }, S);
5079
5079
  else
5080
5080
  throw new Error("Unsupported HTTP method");
5081
- j.status === 200 && ((((A = (L = j == null ? void 0 : j.data) == null ? void 0 : L.data) == null ? void 0 : A.status) || ((w = j == null ? void 0 : j.data) == null ? void 0 : w.status)) === !0 ? (c(!0), N === "string" ? v(
5082
- ((B = (R = j == null ? void 0 : j.data) == null ? void 0 : R.data) == null ? void 0 : B.description) || ((z = j == null ? void 0 : j.data) == null ? void 0 : z.description) || "Validation successful"
5081
+ j.status === 200 && ((((A = (w = j == null ? void 0 : j.data) == null ? void 0 : w.data) == null ? void 0 : A.status) || ((T = j == null ? void 0 : j.data) == null ? void 0 : T.status)) === !0 ? (c(!0), N === "string" ? v(
5082
+ ((E = (D = j == null ? void 0 : j.data) == null ? void 0 : D.data) == null ? void 0 : E.description) || ((z = j == null ? void 0 : j.data) == null ? void 0 : z.description) || "Validation successful"
5083
5083
  ) : f(
5084
5084
  ((ae = ($ = j == null ? void 0 : j.data) == null ? void 0 : $.data) == null ? void 0 : ae.description) || ((X = j == null ? void 0 : j.data) == null ? void 0 : X.description) || {}
5085
- )) : (console.error("Invalid input:", k), v("Unable to validate input"), c(!1)));
5085
+ )) : (console.error("Invalid input:", M), v("Unable to validate input"), c(!1)));
5086
5086
  } catch (j) {
5087
5087
  console.error("Error validating input:", j), v(
5088
5088
  ((_ = (te = j == null ? void 0 : j.response) == null ? void 0 : te.data) == null ? void 0 : _.message) || "Unable to validate input"
@@ -5096,10 +5096,10 @@ function wo({
5096
5096
  );
5097
5097
  return G(() => {
5098
5098
  if (l) {
5099
- const k = setTimeout(() => {
5099
+ const M = setTimeout(() => {
5100
5100
  x(l);
5101
5101
  }, 700);
5102
- return () => clearTimeout(k);
5102
+ return () => clearTimeout(M);
5103
5103
  }
5104
5104
  }, [x, l]), /* @__PURE__ */ b("div", { children: [
5105
5105
  /* @__PURE__ */ b("div", { className: "relative flex items-center", children: [
@@ -5110,8 +5110,8 @@ function wo({
5110
5110
  type: (e == null ? void 0 : e.inputType) || "text",
5111
5111
  className: q("field-control", e == null ? void 0 : e.customClass),
5112
5112
  ...a(e == null ? void 0 : e.id),
5113
- onChange: (k) => {
5114
- d(k.target.value), s(e == null ? void 0 : e.id, k.target.value);
5113
+ onChange: (M) => {
5114
+ d(M.target.value), s(e == null ? void 0 : e.id, M.target.value);
5115
5115
  },
5116
5116
  disabled: n == null ? void 0 : n.isReadOnly
5117
5117
  }
@@ -5160,13 +5160,13 @@ function wo({
5160
5160
  children: m
5161
5161
  }
5162
5162
  ),
5163
- N === "object" && /* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-6 mt-2 text-sm text-gray-600", children: (M = Object.entries(y)) == null ? void 0 : M.map(([k, L]) => /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
5163
+ 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: [
5164
5164
  /* @__PURE__ */ b("span", { className: "font-semibold", children: [
5165
- k,
5165
+ M,
5166
5166
  ":"
5167
5167
  ] }),
5168
- Co(L) ? /* @__PURE__ */ i(Mo, { imageUrl: L }) : /* @__PURE__ */ i("span", { children: String(L) })
5169
- ] }, k)) })
5168
+ Co(w) ? /* @__PURE__ */ i(Mo, { imageUrl: w }) : /* @__PURE__ */ i("span", { children: String(w) })
5169
+ ] }, M)) })
5170
5170
  ] });
5171
5171
  }
5172
5172
  function To({
@@ -5542,11 +5542,11 @@ const zi = ({
5542
5542
  loading: y,
5543
5543
  disabled: f
5544
5544
  }) => {
5545
- const [p, g] = I(c ? [] : null), N = q("custom-select__control", e), C = Q(() => n, [n]);
5545
+ const [p, g] = I(c ? [] : null), N = q("custom-select__control", e), k = Q(() => n, [n]);
5546
5546
  return G(() => {
5547
5547
  const S = n == null ? void 0 : n.find((x) => {
5548
- var M;
5549
- return typeof x.value == "string" && typeof t == "string" ? x.value.toLowerCase() === t.toLowerCase() : typeof x.value == "object" && typeof t == "object" ? ((M = x.value) == null ? void 0 : M.id) === (t == null ? void 0 : t.id) : x.value === t;
5548
+ var C;
5549
+ 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;
5550
5550
  });
5551
5551
  g(S || null);
5552
5552
  }, [t, n]), G(() => {
@@ -5571,20 +5571,20 @@ const zi = ({
5571
5571
  {
5572
5572
  as: ne.Fragment,
5573
5573
  leave: "custom-select__transition",
5574
- children: /* @__PURE__ */ i(ie.Options, { className: "custom-select__options", anchor: "bottom", children: C == null ? void 0 : C.map((S, x) => /* @__PURE__ */ i(
5574
+ children: /* @__PURE__ */ i(ie.Options, { className: "custom-select__options", anchor: "bottom", children: k == null ? void 0 : k.map((S, x) => /* @__PURE__ */ i(
5575
5575
  ie.Option,
5576
5576
  {
5577
5577
  value: S,
5578
- className: ({ active: M }) => q(
5578
+ className: ({ active: C }) => q(
5579
5579
  "custom-select__option",
5580
- M && "custom-select__option--active"
5580
+ C && "custom-select__option--active"
5581
5581
  ),
5582
- children: ({ selected: M }) => /* @__PURE__ */ i(
5582
+ children: ({ selected: C }) => /* @__PURE__ */ i(
5583
5583
  "span",
5584
5584
  {
5585
5585
  className: q(
5586
5586
  "custom-select__option-label",
5587
- M && "custom-select__option--selected"
5587
+ C && "custom-select__option--selected"
5588
5588
  ),
5589
5589
  children: S.label
5590
5590
  }
@@ -5682,14 +5682,14 @@ const zi = ({
5682
5682
  }, []);
5683
5683
  const p = (N) => {
5684
5684
  if (!a && !v) {
5685
- const C = N + 1;
5686
- c == null || c(d.id, C), r == null || r(d.id), s == null || s(C);
5685
+ const k = N + 1;
5686
+ c == null || c(d.id, k), r == null || r(d.id), s == null || s(k);
5687
5687
  }
5688
5688
  };
5689
5689
  return /* @__PURE__ */ b("div", { className: `flex gap-1 ${l}`, children: [
5690
5690
  /* @__PURE__ */ i("input", { type: "hidden", ...t(d.id) }),
5691
- Array.from({ length: n }, (N, C) => {
5692
- const S = y !== null ? C <= y : C < h;
5691
+ Array.from({ length: n }, (N, k) => {
5692
+ const S = y !== null ? k <= y : k < h;
5693
5693
  return /* @__PURE__ */ i(
5694
5694
  mn,
5695
5695
  {
@@ -5697,11 +5697,11 @@ const zi = ({
5697
5697
  className: `cursor-pointer transition-colors ${S ? "text-yellow-400" : "text-gray-300"}`,
5698
5698
  width: o,
5699
5699
  height: o,
5700
- onMouseEnter: () => !(a || v) && f(C),
5700
+ onMouseEnter: () => !(a || v) && f(k),
5701
5701
  onMouseLeave: () => !(a || v) && f(null),
5702
- onClick: () => p(C)
5702
+ onClick: () => p(k)
5703
5703
  },
5704
- C
5704
+ k
5705
5705
  );
5706
5706
  })
5707
5707
  ] });
@@ -6138,38 +6138,38 @@ function Vo({
6138
6138
  onChange: h,
6139
6139
  onError: y
6140
6140
  }) {
6141
- const [f, p] = I(""), [g, N] = I(null), [C, S] = I(""), x = Q(
6141
+ const [f, p] = I(""), [g, N] = I(null), [k, S] = I(""), x = Q(
6142
6142
  () => {
6143
- var B;
6144
- return (B = li == null ? void 0 : li.slice().sort((z, $) => z.label.localeCompare($.label))) == null ? void 0 : B.map((z) => ({ ...z, phone: `+${z.phone}` }));
6143
+ var E;
6144
+ return (E = li == null ? void 0 : li.slice().sort((z, $) => z.label.localeCompare($.label))) == null ? void 0 : E.map((z) => ({ ...z, phone: `+${z.phone}` }));
6145
6145
  },
6146
6146
  []
6147
- ), M = Q(() => f ? x.filter(
6148
- (B) => `${B.label} ${B.phone}`.toLowerCase().includes(f.toLowerCase())
6149
- ) : x, [f, x]), k = (g == null ? void 0 : g.min) || 10, L = (g == null ? void 0 : g.max) || 10, A = () => C ? `${(g == null ? void 0 : g.phone) || "+234"}-${C}` : "", w = (B) => {
6150
- if (!B) return { code: "+234", number: "" };
6151
- const z = B.split(/[-\s]/);
6147
+ ), C = Q(() => f ? x.filter(
6148
+ (E) => `${E.label} ${E.phone}`.toLowerCase().includes(f.toLowerCase())
6149
+ ) : x, [f, x]), M = (g == null ? void 0 : g.min) || 10, w = (g == null ? void 0 : g.max) || 10, A = () => k ? `${(g == null ? void 0 : g.phone) || "+234"}-${k}` : "", T = (E) => {
6150
+ if (!E) return { code: "+234", number: "" };
6151
+ const z = E.split(/[-\s]/);
6152
6152
  return { code: z[0], number: z.slice(1).join(" ") };
6153
6153
  };
6154
6154
  G(() => {
6155
6155
  if (d) {
6156
- const B = w(d);
6156
+ const E = T(d);
6157
6157
  N(
6158
- x.find((z) => z.phone === B.code) || x[0]
6159
- ), S(B.number);
6158
+ x.find((z) => z.phone === E.code) || x[0]
6159
+ ), S(E.number);
6160
6160
  }
6161
6161
  }, [d, x]);
6162
- const R = Q(() => {
6162
+ const D = Q(() => {
6163
6163
  if (u) return u;
6164
- const B = C.length;
6165
- return s && B === 0 ? "Phone number is required" : B > 0 && !/^\d+$/.test(C) ? "Phone number must contain only digits" : B > 0 && B < k ? `Minimum length is ${k}` : B > L ? `Maximum length is ${L}` : "";
6166
- }, [u, C, k, L, s]);
6164
+ const E = k.length;
6165
+ return s && E === 0 ? "Phone number is required" : E > 0 && !/^\d+$/.test(k) ? "Phone number must contain only digits" : E > 0 && E < M ? `Minimum length is ${M}` : E > w ? `Maximum length is ${w}` : "";
6166
+ }, [u, k, M, w, s]);
6167
6167
  return G(() => {
6168
- h == null || h(A()), y == null || y(R || null);
6169
- }, [C, g, R]), /* @__PURE__ */ b(
6168
+ h == null || h(A()), y == null || y(D || null);
6169
+ }, [k, g, D]), /* @__PURE__ */ b(
6170
6170
  "div",
6171
6171
  {
6172
- className: `relative formGroup ${R && !r ? "has-error" : ""} ${c ? "flex" : ""} ${!R && C.length > 0 && !r ? "is-valid" : ""}`,
6172
+ className: `relative formGroup ${D && !r ? "has-error" : ""} ${c ? "flex" : ""} ${!D && k.length > 0 && !r ? "is-valid" : ""}`,
6173
6173
  children: [
6174
6174
  e && /* @__PURE__ */ b(
6175
6175
  "label",
@@ -6191,24 +6191,24 @@ function Vo({
6191
6191
  Pe.Input,
6192
6192
  {
6193
6193
  className: "pl-3 pr-4 mr-1 text-sm bg-white py-[10px] outline-none whitespace-nowrap max-w-[70px]",
6194
- displayValue: (B) => (B == null ? void 0 : B.phone) || "+234",
6194
+ displayValue: (E) => (E == null ? void 0 : E.phone) || "+234",
6195
6195
  placeholder: "+234",
6196
- onChange: (B) => p(B.target.value)
6196
+ onChange: (E) => p(E.target.value)
6197
6197
  }
6198
6198
  ),
6199
6199
  /* @__PURE__ */ i(Pe.Button, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ i(W, { icon: "lucide:chevron-down" }) }),
6200
- /* @__PURE__ */ i(Pe.Options, { className: "absolute z-10 w-[250px] left-0 bg-white border rounded-md shadow-lg max-h-[400px] overflow-y-auto", children: M == null ? void 0 : M.map((B, z) => /* @__PURE__ */ b(
6200
+ /* @__PURE__ */ i(Pe.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, z) => /* @__PURE__ */ b(
6201
6201
  Pe.Option,
6202
6202
  {
6203
- value: B,
6203
+ value: E,
6204
6204
  className: "px-4 py-2 cursor-pointer hover:bg-gray-100",
6205
6205
  children: [
6206
- B.phone,
6206
+ E.phone,
6207
6207
  " - ",
6208
- B.label
6208
+ E.label
6209
6209
  ]
6210
6210
  },
6211
- `${B.code}+ ${z}`
6211
+ `${E.code}+ ${z}`
6212
6212
  )) })
6213
6213
  ] }) }),
6214
6214
  /* @__PURE__ */ b("div", { className: "relative flex items-center flex-1 z-[1]", children: [
@@ -6217,20 +6217,20 @@ function Vo({
6217
6217
  {
6218
6218
  type: "tel",
6219
6219
  inputMode: "numeric",
6220
- value: C,
6220
+ value: k,
6221
6221
  disabled: t,
6222
6222
  readOnly: r,
6223
- onChange: (B) => {
6224
- const z = B.target.value.replace(/\D/g, "");
6223
+ onChange: (E) => {
6224
+ const z = E.target.value.replace(/\D/g, "");
6225
6225
  S(z);
6226
6226
  },
6227
6227
  placeholder: n,
6228
6228
  className: "w-full px-3 outline-none",
6229
- maxLength: L,
6230
- minLength: k
6229
+ maxLength: w,
6230
+ minLength: M
6231
6231
  }
6232
6232
  ),
6233
- /* @__PURE__ */ i("div", { className: "absolute flex text-xl -translate-y-1/2 top-1/2 right-4", children: !R && C.length > 0 && !r && /* @__PURE__ */ i("span", { className: "text-green-500", children: /* @__PURE__ */ i(W, { icon: "bi:check-lg" }) }) })
6233
+ /* @__PURE__ */ i("div", { className: "absolute flex text-xl -translate-y-1/2 top-1/2 right-4", children: !D && k.length > 0 && !r && /* @__PURE__ */ i("span", { className: "text-green-500", children: /* @__PURE__ */ i(W, { icon: "bi:check-lg" }) }) })
6234
6234
  ] })
6235
6235
  ] }),
6236
6236
  m && /* @__PURE__ */ i("span", { className: "block text-[#475467] font-light leading-4 text-xs mt-2", children: m })
@@ -6378,11 +6378,11 @@ function Jo({
6378
6378
  const g = await p.json();
6379
6379
  let N = {};
6380
6380
  Array.isArray(g) ? g.forEach((S) => {
6381
- const x = S.value || S.id || S.option, M = S.count || S.votes || S.value || 0;
6382
- x && (N[x] = Number(M));
6381
+ const x = S.value || S.id || S.option, C = S.count || S.votes || S.value || 0;
6382
+ x && (N[x] = Number(C));
6383
6383
  }) : typeof g == "object" && (N = g), u(N);
6384
- const C = Object.values(N).reduce((S, x) => S + Number(x), 0);
6385
- r(C);
6384
+ const k = Object.values(N).reduce((S, x) => S + Number(x), 0);
6385
+ r(k);
6386
6386
  } catch (p) {
6387
6387
  console.error("Failed to fetch polling results", p);
6388
6388
  }
@@ -6566,42 +6566,42 @@ const hn = {
6566
6566
  []
6567
6567
  ), g = Z(
6568
6568
  (S, x) => {
6569
- const M = S.relatedTarget;
6570
- M && S.currentTarget.contains(M) || y((k) => k === x ? null : k);
6569
+ const C = S.relatedTarget;
6570
+ C && S.currentTarget.contains(C) || y((M) => M === x ? null : M);
6571
6571
  },
6572
6572
  []
6573
6573
  ), N = Z(
6574
6574
  (S, x) => {
6575
- var L;
6575
+ var w;
6576
6576
  S.preventDefault(), S.stopPropagation(), t(!1), y(null);
6577
- const M = x + 1, k = S.dataTransfer.getData("elementId");
6578
- if (k) {
6577
+ const C = x + 1, M = S.dataTransfer.getData("elementId");
6578
+ if (M) {
6579
6579
  r({
6580
- draggedId: k,
6580
+ draggedId: M,
6581
6581
  sectionId: n,
6582
6582
  targetGridId: e.id,
6583
- targetCol: M
6583
+ targetCol: C
6584
6584
  });
6585
6585
  return;
6586
6586
  }
6587
6587
  try {
6588
6588
  const A = S.dataTransfer.getData("properties");
6589
6589
  if (!A) return;
6590
- const w = JSON.parse(A);
6591
- if ((w == null ? void 0 : w.type) === "grid") return;
6592
- const R = d.find(($) => $.id === n), B = (L = R == null ? void 0 : R.questionData) == null ? void 0 : L.find(
6590
+ const T = JSON.parse(A);
6591
+ if ((T == null ? void 0 : T.type) === "grid") return;
6592
+ const D = d.find(($) => $.id === n), E = (w = D == null ? void 0 : D.questionData) == null ? void 0 : w.find(
6593
6593
  ($) => {
6594
6594
  var ae;
6595
- return $.gridId === e.id && ((ae = $.gridPosition) == null ? void 0 : ae.col) === M;
6595
+ return $.gridId === e.id && ((ae = $.gridPosition) == null ? void 0 : ae.col) === C;
6596
6596
  }
6597
6597
  );
6598
- B && m(B.id, n);
6598
+ E && m(E.id, n);
6599
6599
  const z = {
6600
- ...w,
6600
+ ...T,
6601
6601
  id: be(),
6602
6602
  sectionId: n,
6603
6603
  gridId: e.id,
6604
- gridPosition: { col: M }
6604
+ gridPosition: { col: C }
6605
6605
  };
6606
6606
  u(z, n);
6607
6607
  } catch (A) {
@@ -6609,17 +6609,17 @@ const hn = {
6609
6609
  }
6610
6610
  },
6611
6611
  [u, e.id, d, n, t, r]
6612
- ), C = (S, x, M) => {
6612
+ ), k = (S, x, C) => {
6613
6613
  var ae, X, te;
6614
- const k = S + 1, L = (X = (ae = d.find((_) => _.id === n)) == null ? void 0 : ae.questionData) == null ? void 0 : X.find(
6614
+ const M = S + 1, w = (X = (ae = d.find((_) => _.id === n)) == null ? void 0 : ae.questionData) == null ? void 0 : X.find(
6615
6615
  (_) => {
6616
6616
  var j;
6617
- return _.gridId === e.id && ((j = _.gridPosition) == null ? void 0 : j.col) === k;
6617
+ return _.gridId === e.id && ((j = _.gridPosition) == null ? void 0 : j.col) === M;
6618
6618
  }
6619
- ), A = (te = L == null ? void 0 : L.id) != null ? te : null, w = Array.isArray(a) && a.find((_) => {
6619
+ ), A = (te = w == null ? void 0 : w.id) != null ? te : null, T = Array.isArray(a) && a.find((_) => {
6620
6620
  var j;
6621
- return ((j = _ == null ? void 0 : _.props) == null ? void 0 : j.col) === k;
6622
- }), R = c && h === S, B = !!w, z = c && !!l, $ = B && A && M === "edit" ? {
6621
+ return ((j = _ == null ? void 0 : _.props) == null ? void 0 : j.col) === M;
6622
+ }), D = c && h === S, E = !!T, z = c && !!l, $ = E && A && C === "edit" ? {
6623
6623
  draggable: !0,
6624
6624
  onDragStart: (_) => {
6625
6625
  _.stopPropagation(), _.dataTransfer.setData("elementId", A), _.dataTransfer.setData("properties", A), _.dataTransfer.effectAllowed = "move", t(!0);
@@ -6641,30 +6641,30 @@ const hn = {
6641
6641
  "relative border rounded-lg min-h-[110px] min-w-0",
6642
6642
  "flex items-center justify-center",
6643
6643
  "transition-all duration-200 ease-in-out",
6644
- M === "edit" ? "py-3 " : "",
6645
- B && M === "edit" && "cursor-grab active:cursor-grabbing border-none",
6644
+ C === "edit" ? "py-3 " : "",
6645
+ E && C === "edit" && "cursor-grab active:cursor-grabbing border-none",
6646
6646
  x,
6647
- !z && !R && "bg-white border-gray-200 text-gray-300",
6648
- z && !R && !B && "bg-blue-50 border-blue-200 border-dashed text-blue-300",
6649
- z && !R && B && "bg-white border-orange-200 border-dashed",
6650
- R && !B && "bg-blue-100 border-blue-400 border-dashed shadow-inner scale-[1.01] text-blue-500",
6651
- R && B && "bg-orange-50 border-orange-400 border-dashed shadow-inner scale-[1.01] text-orange-500"
6647
+ !z && !D && "bg-white border-gray-200 text-gray-300",
6648
+ z && !D && !E && "bg-blue-50 border-blue-200 border-dashed text-blue-300",
6649
+ z && !D && E && "bg-white border-orange-200 border-dashed",
6650
+ D && !E && "bg-blue-100 border-blue-400 border-dashed shadow-inner scale-[1.01] text-blue-500",
6651
+ D && E && "bg-orange-50 border-orange-400 border-dashed shadow-inner scale-[1.01] text-orange-500"
6652
6652
  ),
6653
6653
  children: [
6654
- B && M === "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(W, { icon: "ph:dots-six-bold" }) }),
6655
- R && !B && /* @__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: [
6654
+ 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(W, { icon: "ph:dots-six-bold" }) }),
6655
+ D && !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: [
6656
6656
  /* @__PURE__ */ i(W, { icon: "ph:plus-bold" }),
6657
6657
  "Drop here"
6658
6658
  ] }),
6659
- R && B && /* @__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" }),
6659
+ D && 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" }),
6660
6660
  /* @__PURE__ */ i(
6661
6661
  "div",
6662
6662
  {
6663
6663
  className: q(
6664
6664
  "w-full select-none min-w-0",
6665
- R && "opacity-50 pointer-events-none"
6665
+ D && "opacity-50 pointer-events-none"
6666
6666
  ),
6667
- children: w || /* @__PURE__ */ i("span", { className: "flex items-center justify-center text-gray-300", children: M === "edit" && /* @__PURE__ */ i(W, { icon: "ph:plus-bold" }) })
6667
+ children: T || /* @__PURE__ */ i("span", { className: "flex items-center justify-center text-gray-300", children: C === "edit" && /* @__PURE__ */ i(W, { icon: "ph:plus-bold" }) })
6668
6668
  }
6669
6669
  )
6670
6670
  ]
@@ -6679,7 +6679,7 @@ const hn = {
6679
6679
  gridTemplateColumns: `repeat(${e.columns}, minmax(0, 1fr))`
6680
6680
  },
6681
6681
  children: v == null ? void 0 : v.map(
6682
- (S, x) => C(x, s, o)
6682
+ (S, x) => k(x, s, o)
6683
6683
  )
6684
6684
  }
6685
6685
  ) });
@@ -6747,23 +6747,23 @@ function Zo({ elementData: e, sectionId: n }) {
6747
6747
  const v = Z(
6748
6748
  (g) => {
6749
6749
  g.preventDefault(), g.stopPropagation();
6750
- const N = g.dataTransfer.getData("elementId"), C = g.currentTarget.id;
6751
- if (!N || !C || N === C) {
6750
+ const N = g.dataTransfer.getData("elementId"), k = g.currentTarget.id;
6751
+ if (!N || !k || N === k) {
6752
6752
  m();
6753
6753
  return;
6754
6754
  }
6755
- const S = r.find((M) => M.id === N), x = r.findIndex(
6756
- (M) => M.id === C
6755
+ const S = r.find((C) => C.id === N), x = r.findIndex(
6756
+ (C) => C.id === k
6757
6757
  );
6758
- S != null && S.gridId && x !== -1 ? d({ draggedId: N, sectionId: n, targetIndex: x }) : d({ draggedId: N, sectionId: n, targetId: C }), t(null), o(!1);
6758
+ S != null && S.gridId && x !== -1 ? d({ draggedId: N, sectionId: n, targetIndex: x }) : d({ draggedId: N, sectionId: n, targetId: k }), t(null), o(!1);
6759
6759
  },
6760
6760
  [n, d, o, m, r]
6761
6761
  ), h = Z(
6762
6762
  (g, N) => {
6763
6763
  g.preventDefault(), g.stopPropagation(), o(!1);
6764
- const C = g.dataTransfer.getData("elementId");
6765
- if (C) {
6766
- d({ draggedId: C, sectionId: n, targetIndex: N }), t(null);
6764
+ const k = g.dataTransfer.getData("elementId");
6765
+ if (k) {
6766
+ d({ draggedId: k, sectionId: n, targetIndex: N }), t(null);
6767
6767
  return;
6768
6768
  }
6769
6769
  try {
@@ -6782,9 +6782,9 @@ function Zo({ elementData: e, sectionId: n }) {
6782
6782
  {
6783
6783
  id: g.id,
6784
6784
  draggable: !0,
6785
- onDragStart: (C) => c(C, g.id),
6786
- onDragOver: N ? void 0 : (C) => {
6787
- C.preventDefault(), C.stopPropagation();
6785
+ onDragStart: (k) => c(k, g.id),
6786
+ onDragOver: N ? void 0 : (k) => {
6787
+ k.preventDefault(), k.stopPropagation();
6788
6788
  },
6789
6789
  onDrop: N ? void 0 : v,
6790
6790
  onDragEnd: m,
@@ -6822,18 +6822,18 @@ function Zo({ elementData: e, sectionId: n }) {
6822
6822
  }
6823
6823
  ),
6824
6824
  p.map((g) => {
6825
- const N = r.findIndex((C) => C.id === g.id);
6825
+ const N = r.findIndex((k) => k.id === g.id);
6826
6826
  if (g.type === "grid") {
6827
- const C = f[g.id] || [], S = u === g.id, x = !!u && !S;
6827
+ const k = f[g.id] || [], S = u === g.id, x = !!u && !S;
6828
6828
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-0", children: [
6829
6829
  /* @__PURE__ */ i(
6830
6830
  "div",
6831
6831
  {
6832
6832
  id: g.id,
6833
6833
  draggable: !0,
6834
- onDragStart: (M) => c(M, g.id),
6835
- onDragOver: (M) => {
6836
- M.preventDefault(), M.stopPropagation();
6834
+ onDragStart: (C) => c(C, g.id),
6835
+ onDragOver: (C) => {
6836
+ C.preventDefault(), C.stopPropagation();
6837
6837
  },
6838
6838
  onDrop: v,
6839
6839
  onDragEnd: m,
@@ -6849,10 +6849,10 @@ function Zo({ elementData: e, sectionId: n }) {
6849
6849
  sectionId: n,
6850
6850
  state: Yo,
6851
6851
  draggedElementId: u,
6852
- children: C == null ? void 0 : C.map(
6853
- (M) => {
6854
- var k;
6855
- return /* @__PURE__ */ i($e, { col: (k = M.gridPosition) == null ? void 0 : k.col, children: y(M, !0) }, M.id);
6852
+ children: k == null ? void 0 : k.map(
6853
+ (C) => {
6854
+ var M;
6855
+ return /* @__PURE__ */ i($e, { col: (M = C.gridPosition) == null ? void 0 : M.col, children: y(C, !0) }, C.id);
6856
6856
  }
6857
6857
  )
6858
6858
  }
@@ -6885,11 +6885,11 @@ function Zo({ elementData: e, sectionId: n }) {
6885
6885
  })
6886
6886
  ] });
6887
6887
  }
6888
- const $o = _e(Zo), Qo = D.object({
6889
- title: D.string(),
6890
- description: D.string(),
6891
- disabled: D.boolean().default(!1),
6892
- isHidden: D.boolean().default(!1)
6888
+ const $o = _e(Zo), Qo = R.object({
6889
+ title: R.string(),
6890
+ description: R.string(),
6891
+ disabled: R.boolean().default(!1),
6892
+ isHidden: R.boolean().default(!1)
6893
6893
  }).required(), ui = se("config"), Xo = ({ isOpen: e, onClose: n, section: a }) => {
6894
6894
  const { updateSection: s } = ne.useContext(re), {
6895
6895
  register: o,
@@ -7336,33 +7336,33 @@ const $o = _e(Zo), Qo = D.object({
7336
7336
  });
7337
7337
  }), N.current = (m == null ? void 0 : m.length) || 0;
7338
7338
  }, [m == null ? void 0 : m.length]);
7339
- const C = Z((A) => {
7339
+ const k = Z((A) => {
7340
7340
  A.preventDefault(), A.dataTransfer.dropEffect = "move", t.current && (t.current.scrollTop = t.current.scrollHeight);
7341
- }, []), S = Z((A, w) => {
7342
- g((R) => {
7343
- const B = R.findIndex((X) => X.id === A), z = R.findIndex((X) => X.id === w);
7344
- if (B === -1 || z === -1 || B === z) return R;
7345
- const $ = [...R], [ae] = $.splice(B, 1);
7341
+ }, []), S = Z((A, T) => {
7342
+ g((D) => {
7343
+ const E = D.findIndex((X) => X.id === A), z = D.findIndex((X) => X.id === T);
7344
+ if (E === -1 || z === -1 || E === z) return D;
7345
+ const $ = [...D], [ae] = $.splice(E, 1);
7346
7346
  return $.splice(z, 0, ae), $;
7347
7347
  });
7348
7348
  }, [g]);
7349
7349
  function x(A) {
7350
7350
  f.includes(A) ? p(
7351
- (w) => w.filter((R) => R !== A)
7352
- ) : p((w) => [...w, A]);
7351
+ (T) => T.filter((D) => D !== A)
7352
+ ) : p((T) => [...T, A]);
7353
7353
  }
7354
- function M(A) {
7354
+ function C(A) {
7355
7355
  u.current = A, o(!0);
7356
7356
  }
7357
- const k = (A) => {
7358
- const w = (R, B = {}) => ({
7359
- ...JSON.parse(JSON.stringify(R)),
7360
- ...B
7357
+ const M = (A) => {
7358
+ const T = (D, E = {}) => ({
7359
+ ...JSON.parse(JSON.stringify(D)),
7360
+ ...E
7361
7361
  });
7362
7362
  if (A.sections && Array.isArray(A.sections)) {
7363
- const B = A.sections.filter(Boolean).map(($) => {
7363
+ const E = A.sections.filter(Boolean).map(($) => {
7364
7364
  var te;
7365
- const ae = be(), X = (te = $.questionData) == null ? void 0 : te.map((_) => w(_, { id: be(), sectionId: ae }));
7365
+ const ae = be(), X = (te = $.questionData) == null ? void 0 : te.map((_) => T(_, { id: be(), sectionId: ae }));
7366
7366
  if (X) {
7367
7367
  const _ = /* @__PURE__ */ new Map();
7368
7368
  $.questionData.forEach((j, ye) => {
@@ -7371,11 +7371,11 @@ const $o = _e(Zo), Qo = D.object({
7371
7371
  j.gridId && _.has(j.gridId) && (j.gridId = _.get(j.gridId));
7372
7372
  });
7373
7373
  }
7374
- return w($, { id: ae, questionData: X || [] });
7374
+ return T($, { id: ae, questionData: X || [] });
7375
7375
  });
7376
- m.length === 1 && m[0].title === "" && m[0].description === "" && (!m[0].questionData || m[0].questionData.length === 0) ? (g(B), B.length > 0 && h(B[0].id)) : g(($) => [...$, ...B]);
7376
+ m.length === 1 && m[0].title === "" && m[0].description === "" && (!m[0].questionData || m[0].questionData.length === 0) ? (g(E), E.length > 0 && h(E[0].id)) : g(($) => [...$, ...E]);
7377
7377
  }
7378
- }, L = se("config");
7378
+ }, w = se("config");
7379
7379
  return /* @__PURE__ */ b(
7380
7380
  "div",
7381
7381
  {
@@ -7397,19 +7397,19 @@ const $o = _e(Zo), Qo = D.object({
7397
7397
  className: "relative flex flex-col flex-1 w-full gap-y-3 container overflow-y-auto",
7398
7398
  children: [
7399
7399
  m == null ? void 0 : m.map(
7400
- (A, w) => /* @__PURE__ */ i(
7400
+ (A, T) => /* @__PURE__ */ i(
7401
7401
  ns,
7402
7402
  {
7403
7403
  section: A,
7404
- index: w,
7404
+ index: T,
7405
7405
  selectedSection: y,
7406
7406
  setSelectedSection: h,
7407
7407
  activeSections: f,
7408
7408
  toggleSection: x,
7409
- handleSectionEdit: M,
7409
+ handleSectionEdit: C,
7410
7410
  removeSection: r,
7411
7411
  formDataLength: m.length,
7412
- onDragOver: C,
7412
+ onDragOver: k,
7413
7413
  setIsDragging: v,
7414
7414
  onReorderSection: S
7415
7415
  },
@@ -7422,7 +7422,7 @@ const $o = _e(Zo), Qo = D.object({
7422
7422
  {
7423
7423
  type: "button",
7424
7424
  onClick: () => c(),
7425
- style: { color: (L == null ? void 0 : L.buttonColor) || "#333" },
7425
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7426
7426
  className: "text-sm font-medium",
7427
7427
  children: [
7428
7428
  "+ Add section",
@@ -7437,7 +7437,7 @@ const $o = _e(Zo), Qo = D.object({
7437
7437
  onClick: () => {
7438
7438
  a != null && a.length ? d(!0) : e && e();
7439
7439
  },
7440
- style: { color: (L == null ? void 0 : L.buttonColor) || "#333" },
7440
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7441
7441
  className: "text-sm font-medium",
7442
7442
  children: "+ Add existing template"
7443
7443
  }
@@ -7452,7 +7452,7 @@ const $o = _e(Zo), Qo = D.object({
7452
7452
  isOpen: l,
7453
7453
  onClose: () => d(!1),
7454
7454
  templates: a,
7455
- onSelect: k
7455
+ onSelect: M
7456
7456
  }
7457
7457
  )
7458
7458
  ]
@@ -7504,7 +7504,7 @@ const $o = _e(Zo), Qo = D.object({
7504
7504
  const a = se("config"), s = (a == null ? void 0 : a.loaderColor) || "#333";
7505
7505
  document.documentElement.style.setProperty("--loader-color", s);
7506
7506
  }, []), /* @__PURE__ */ i("div", { className: n, children: /* @__PURE__ */ i("span", { className: "loader" }) });
7507
- }, ss = ne.lazy(() => import("./logic-flow-COuXfOVB.js"));
7507
+ }, ss = ne.lazy(() => import("./logic-flow-DziuWDEF.js"));
7508
7508
  function ls({
7509
7509
  questionData: e,
7510
7510
  uploadUrl: n,
@@ -7646,7 +7646,7 @@ const ti = [
7646
7646
  ] }, y);
7647
7647
  }) }) })
7648
7648
  ] });
7649
- }, us = _e(ds), Se = ({
7649
+ }, us = _e(ds), Ae = ({
7650
7650
  text: e = "",
7651
7651
  isDisabled: n = !1,
7652
7652
  isLoading: a = !1,
@@ -7821,25 +7821,26 @@ function ms({
7821
7821
  publishLoading: d,
7822
7822
  onTitleChange: u,
7823
7823
  viewMode: t,
7824
- setViewMode: r
7824
+ setViewMode: r,
7825
+ onShowVersion: c
7825
7826
  }) {
7826
7827
  const {
7827
- formData: c,
7828
- setShowPreview: m,
7829
- showPreview: v,
7830
- undo: h,
7831
- redo: y,
7832
- canUndo: f,
7833
- canRedo: p
7834
- } = ge(re), [g, N] = I(!1), [C, S] = I(!1), [x, M] = I(e || ""), k = se("config");
7835
- function L() {
7836
- localStorage.setItem("formData", JSON.stringify(c)), a == null || a(c);
7837
- }
7828
+ formData: m,
7829
+ setShowPreview: v,
7830
+ showPreview: h,
7831
+ undo: y,
7832
+ redo: f,
7833
+ canUndo: p,
7834
+ canRedo: g
7835
+ } = ge(re), [N, k] = I(!1), [S, x] = I(!1), [C, M] = I(e || ""), w = se("config");
7838
7836
  function A() {
7839
- localStorage.setItem("formData", JSON.stringify(c)), s == null || s(c);
7837
+ localStorage.setItem("formData", JSON.stringify(m)), a == null || a(m);
7840
7838
  }
7841
- function w() {
7842
- S(!1), u && x !== e && u(x.trim());
7839
+ function T() {
7840
+ localStorage.setItem("formData", JSON.stringify(m)), s == null || s(m);
7841
+ }
7842
+ function D() {
7843
+ x(!1), u && C !== e && u(C.trim());
7843
7844
  }
7844
7845
  return /* @__PURE__ */ b("div", { className: "px-[30px] py-3 flex justify-between items-center bg-[#F9F9FB] top_bar border-b h-full", children: [
7845
7846
  /* @__PURE__ */ b("span", { className: "flex items-center gap-x-2", children: [
@@ -7848,19 +7849,19 @@ function ms({
7848
7849
  {
7849
7850
  type: "button",
7850
7851
  onClick: () => n(),
7851
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7852
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7852
7853
  className: "flex items-center gap-x-3",
7853
7854
  children: /* @__PURE__ */ i(rs, {})
7854
7855
  }
7855
7856
  ),
7856
7857
  " ",
7857
- C ? /* @__PURE__ */ i(
7858
+ S ? /* @__PURE__ */ i(
7858
7859
  "input",
7859
7860
  {
7860
7861
  type: "text",
7861
- value: x,
7862
- onChange: (R) => M(R.target.value),
7863
- onBlur: w,
7862
+ value: C,
7863
+ onChange: (E) => M(E.target.value),
7864
+ onBlur: D,
7864
7865
  autoFocus: !0,
7865
7866
  className: "w-48 px-2 py-1 text-sm font-semibold outline-gray-100 input form_title"
7866
7867
  }
@@ -7869,16 +7870,16 @@ function ms({
7869
7870
  {
7870
7871
  title: "Click to edit",
7871
7872
  className: "text-base font-semibold cursor-pointer form_title",
7872
- onClick: () => S(!0),
7873
- children: x || "Untitled"
7873
+ onClick: () => x(!0),
7874
+ children: C || "Untitled"
7874
7875
  }
7875
7876
  )
7876
7877
  ] }),
7877
- g && /* @__PURE__ */ i(
7878
+ N && /* @__PURE__ */ i(
7878
7879
  cs,
7879
7880
  {
7880
- isOpen: g,
7881
- onClose: () => N(!1),
7881
+ isOpen: N,
7882
+ onClose: () => k(!1),
7882
7883
  element: void 0
7883
7884
  }
7884
7885
  ),
@@ -7888,8 +7889,8 @@ function ms({
7888
7889
  "button",
7889
7890
  {
7890
7891
  type: "button",
7891
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7892
- className: `px-3 flex items-center gap-1.5 transition-colors canvas_view ${t === "canvas" ? "bg-gray-100 font-medium" : "bg-white text-gray-500 hover:bg-gray-50"}`,
7892
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7893
+ className: `px-3 flex items-center gap-1.5 transition-colors canvas_view ${t === "canvas" ? "bg-white font-medium" : "bg-gray-100 text-gray-500 hover:bg-gray-50"}`,
7893
7894
  onClick: () => r("canvas"),
7894
7895
  children: [
7895
7896
  /* @__PURE__ */ i(
@@ -7908,8 +7909,8 @@ function ms({
7908
7909
  "button",
7909
7910
  {
7910
7911
  type: "button",
7911
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7912
- className: `px-3 flex items-center gap-1.5 border-l border-gray-300 transition-colors flow_view ${t === "flow" ? "bg-gray-100 font-medium" : "bg-white text-gray-500 hover:bg-gray-50"}`,
7912
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7913
+ 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"}`,
7913
7914
  onClick: () => r("flow"),
7914
7915
  children: [
7915
7916
  /* @__PURE__ */ i(W, { icon: "mdi:sitemap-outline", iconClass: "text-base" }),
@@ -7919,61 +7920,72 @@ function ms({
7919
7920
  )
7920
7921
  ] }),
7921
7922
  /* @__PURE__ */ i(
7922
- Se,
7923
+ Ae,
7923
7924
  {
7924
- onClick: h,
7925
+ onClick: y,
7925
7926
  text: "",
7926
- btnClass: `!px-2 bg-transparent undo ${f ? "" : "opacity-50"}`,
7927
+ btnClass: `!px-2 bg-transparent undo ${p ? "" : "opacity-50"}`,
7927
7928
  icon: "material-symbols:undo",
7928
7929
  iconClass: "text-xl !mr-0",
7929
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7930
- isDisabled: !f
7930
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7931
+ isDisabled: !p
7931
7932
  }
7932
7933
  ),
7933
7934
  /* @__PURE__ */ i(
7934
- Se,
7935
+ Ae,
7935
7936
  {
7936
- onClick: y,
7937
+ onClick: f,
7937
7938
  text: "",
7938
- btnClass: `!px-2 bg-transparent redo ${p ? "" : "opacity-50"}`,
7939
+ btnClass: `!px-2 bg-transparent redo ${g ? "" : "opacity-50"}`,
7939
7940
  icon: "material-symbols:redo",
7940
7941
  iconClass: "text-xl !mr-0",
7941
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7942
- isDisabled: !p
7942
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7943
+ isDisabled: !g
7944
+ }
7945
+ ),
7946
+ c && /* @__PURE__ */ i(
7947
+ Ae,
7948
+ {
7949
+ onClick: c,
7950
+ text: "Versions",
7951
+ btnClass: "px-2 bg-transparent font-medium text-sm",
7952
+ icon: "tabler:history",
7953
+ iconClass: "text-xl",
7954
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" }
7943
7955
  }
7944
7956
  ),
7945
7957
  /* @__PURE__ */ i(
7946
- Se,
7958
+ Ae,
7947
7959
  {
7948
- onClick: () => m((R) => !R),
7949
- text: v ? "Hide Preview" : "Preview",
7960
+ onClick: () => v((E) => !E),
7961
+ text: h ? "Hide Preview" : "Preview",
7950
7962
  btnClass: "px-2 bg-transparent font-medium text-sm form_preview",
7951
- icon: v ? "iconamoon:eye-off-duotone" : "solar:eye-bold-duotone",
7963
+ icon: h ? "iconamoon:eye-off-duotone" : "solar:eye-bold-duotone",
7952
7964
  iconClass: "text-base",
7953
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7965
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7954
7966
  isDisabled: o,
7955
7967
  isLoading: o
7956
7968
  }
7957
7969
  ),
7958
7970
  /* @__PURE__ */ i(
7959
- Se,
7971
+ Ae,
7960
7972
  {
7961
- onClick: L,
7973
+ onClick: A,
7962
7974
  text: "Save",
7963
7975
  btnClass: "px-2 bg-transparent font-medium text-sm form_save__btn",
7964
7976
  icon: "lets-icons:save-duotone",
7965
7977
  iconClass: "text-base",
7966
- style: { color: (k == null ? void 0 : k.buttonColor) || "#333" },
7978
+ style: { color: (w == null ? void 0 : w.buttonColor) || "#333" },
7967
7979
  isDisabled: l,
7968
7980
  isLoading: l
7969
7981
  }
7970
7982
  ),
7971
7983
  /* @__PURE__ */ i(
7972
- Se,
7984
+ Ae,
7973
7985
  {
7974
- onClick: A,
7986
+ onClick: T,
7975
7987
  text: "Publish",
7976
- style: { background: (k == null ? void 0 : k.buttonColor) || "#333" },
7988
+ style: { background: (w == null ? void 0 : w.buttonColor) || "#333" },
7977
7989
  btnClass: "border-[#98A2B3] font-medium text-sm py-2 px-6 text-white rounded-lg form_publish__btn",
7978
7990
  isDisabled: d,
7979
7991
  isLoading: d
@@ -7997,14 +8009,15 @@ function bs({
7997
8009
  onTitleChange: m,
7998
8010
  uploadUrl: v,
7999
8011
  onAddTemplate: h,
8000
- templates: y
8012
+ templates: y,
8013
+ onShowVersion: f
8001
8014
  }) {
8002
- const [f, p] = I("canvas");
8015
+ const [p, g] = I("canvas");
8003
8016
  return /* @__PURE__ */ b(Zi, { onChange: n, onLogAction: a, children: [
8004
8017
  /* @__PURE__ */ i(Yi, { position: "top-right", richColors: !0, closeButton: !0 }),
8005
8018
  /* @__PURE__ */ i("div", { className: "w-full h-full bg-[#F8F9FC] flex flex-col", children: /* @__PURE__ */ b("div", { className: "flex flex-1 ", children: [
8006
- f === "canvas" && /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("div", { className: "w-[250px] h-screen border-r border-[#E4E7EC] bg-white ", children: /* @__PURE__ */ i(us, {}) }) }),
8007
- /* @__PURE__ */ b("div", { className: `flex-1 h-full max-h-full z-[1] ${f === "canvas" ? "w-[calc(100%-250px)]" : "w-full"}`, children: [
8019
+ p === "canvas" && /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("div", { className: "w-[250px] h-screen border-r border-[#E4E7EC] bg-white ", children: /* @__PURE__ */ i(us, {}) }) }),
8020
+ /* @__PURE__ */ b("div", { className: `flex-1 h-full max-h-full z-[1] ${p === "canvas" ? "w-[calc(100%-250px)]" : "w-full"}`, children: [
8008
8021
  /* @__PURE__ */ i("div", { className: " h-[70px]", children: /* @__PURE__ */ i(
8009
8022
  ms,
8010
8023
  {
@@ -8016,8 +8029,9 @@ function bs({
8016
8029
  saveLoading: r,
8017
8030
  publishLoading: c,
8018
8031
  onTitleChange: m,
8019
- viewMode: f,
8020
- setViewMode: p
8032
+ viewMode: p,
8033
+ setViewMode: g,
8034
+ onShowVersion: f
8021
8035
  }
8022
8036
  ) }),
8023
8037
  /* @__PURE__ */ i("div", { className: "p-6 h-[calc(100vh-70px)]", children: d ? /* @__PURE__ */ i(wi, { loadingClass: "!w-full !h-[800px]" }) : /* @__PURE__ */ i(
@@ -8027,7 +8041,7 @@ function bs({
8027
8041
  uploadUrl: v,
8028
8042
  onAddTemplate: h,
8029
8043
  templates: y,
8030
- viewMode: f
8044
+ viewMode: p
8031
8045
  }
8032
8046
  ) })
8033
8047
  ] })
@@ -8053,7 +8067,8 @@ const Gs = ({
8053
8067
  onTitleChange: h,
8054
8068
  uploadUrl: y,
8055
8069
  onAddTemplate: f,
8056
- templates: p
8070
+ templates: p,
8071
+ onShowVersion: g
8057
8072
  }) => (G(() => {
8058
8073
  l && vn("config", l);
8059
8074
  }, [l]), /* @__PURE__ */ i(
@@ -8074,7 +8089,8 @@ const Gs = ({
8074
8089
  onTitleChange: h,
8075
8090
  uploadUrl: y,
8076
8091
  onAddTemplate: f,
8077
- templates: p
8092
+ templates: p,
8093
+ onShowVersion: g
8078
8094
  }
8079
8095
  )), Ce = {
8080
8096
  required: "This field is required",
@@ -8085,20 +8101,20 @@ const Gs = ({
8085
8101
  minAmount: (e) => `Minimum amount is ${e}`,
8086
8102
  maxAmount: (e) => `Maximum amount is ${e}`
8087
8103
  }, vs = (e, n = !1) => ({
8088
- textField: D.string().nullable(),
8089
- longText: D.string().nullable(),
8090
- numberField: D.number().nullable().transform((s) => isNaN(s) ? null : s),
8091
- amountField: D.number().nullable().transform((s) => isNaN(s) ? null : s),
8092
- selectField: D.string().nullable(),
8093
- checkbox: D.mixed().nullable(),
8094
- radio: D.mixed().nullable(),
8095
- matrix: D.mixed().nullable(),
8096
- email: D.string().nullable().test("email-format", Ce.email, (s) => !s || s.trim() === "" ? !0 : /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/.test(s)),
8097
- date: D.date().nullable().transform((s, o) => n && o === "" ? null : s).typeError("Invalid date"),
8098
- url: D.string().nullable().test("url-format", Ce.url, (s) => !s || s.trim() === "" ? !0 : /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(
8104
+ textField: R.string().nullable(),
8105
+ longText: R.string().nullable(),
8106
+ numberField: R.number().nullable().transform((s) => isNaN(s) ? null : s),
8107
+ amountField: R.number().nullable().transform((s) => isNaN(s) ? null : s),
8108
+ selectField: R.string().nullable(),
8109
+ checkbox: R.mixed().nullable(),
8110
+ radio: R.mixed().nullable(),
8111
+ matrix: R.mixed().nullable(),
8112
+ email: R.string().nullable().test("email-format", Ce.email, (s) => !s || s.trim() === "" ? !0 : /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/.test(s)),
8113
+ date: R.date().nullable().transform((s, o) => n && o === "" ? null : s).typeError("Invalid date"),
8114
+ url: R.string().nullable().test("url-format", Ce.url, (s) => !s || s.trim() === "" ? !0 : /^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(
8099
8115
  s
8100
8116
  ))
8101
- })[e] || D.mixed().nullable(), ps = (e, n, a) => n ? e.type === "boolean" ? e.oneOf([!0], a || Ce.required) : e.required(a || Ce.required) : e, hs = (e, {
8117
+ })[e] || R.mixed().nullable(), ps = (e, n, a) => n ? e.type === "boolean" ? e.oneOf([!0], a || Ce.required) : e.required(a || Ce.required) : e, hs = (e, {
8102
8118
  minLength: n,
8103
8119
  maxLength: a,
8104
8120
  minLengthMessage: s,
@@ -8169,7 +8185,7 @@ function fs({ formData: e, isReadOnly: n, answerData: a }) {
8169
8185
  l
8170
8186
  )), s[d] = m;
8171
8187
  });
8172
- }), D.object().shape(s);
8188
+ }), R.object().shape(s);
8173
8189
  }
8174
8190
  const Ie = ({ element: e, validationData: n }) => {
8175
8191
  const a = hn[e.type], { answerData: s } = ge(re), o = Q(
@@ -8411,7 +8427,7 @@ function As({ element: e, options: n, onNext: a, onPrev: s, isFirst: o, isLast:
8411
8427
  /* @__PURE__ */ i("div", { className: "text-left w-full mb-8", children: e.type === "grid" ? t(e) : r(e) }),
8412
8428
  !d && /* @__PURE__ */ b("div", { className: "flex items-center gap-4 mt-8", children: [
8413
8429
  /* @__PURE__ */ i(
8414
- Se,
8430
+ Ae,
8415
8431
  {
8416
8432
  type: "button",
8417
8433
  text: l ? n != null && n.isSubmitting ? "Submitting..." : "Submit" : "OK",
@@ -8448,52 +8464,52 @@ const Ns = ({
8448
8464
  hideFooter: t = !1,
8449
8465
  uploadUrl: r
8450
8466
  }) => {
8451
- var we, Ee, O, H, J, T, P, U;
8467
+ var we, Ee, O, H, J, B, P, U;
8452
8468
  const { setAnswerData: c, setUploadUrl: m } = ge(re), [v, h] = I(0), [y, f] = I(0), p = Q(
8453
- () => e.filter((E) => !E.isHidden).map((E) => {
8469
+ () => e.filter((L) => !L.isHidden).map((L) => {
8454
8470
  var K;
8455
- return E.isDisabled || E.disabled ? {
8456
- ...E,
8457
- questionData: (K = E.questionData) == null ? void 0 : K.map((F) => ({
8471
+ return L.isDisabled || L.disabled ? {
8472
+ ...L,
8473
+ questionData: (K = L.questionData) == null ? void 0 : K.map((F) => ({
8458
8474
  ...F,
8459
8475
  isDisabled: !0
8460
8476
  }))
8461
- } : E;
8477
+ } : L;
8462
8478
  }),
8463
8479
  [e]
8464
- ), g = (we = p == null ? void 0 : p.length) != null ? we : 0, N = se("config"), C = Z(
8465
- async (E, Y, K) => {
8480
+ ), g = (we = p == null ? void 0 : p.length) != null ? we : 0, N = se("config"), k = Z(
8481
+ async (L, Y, K) => {
8466
8482
  const F = fs({
8467
8483
  formData: p,
8468
8484
  isReadOnly: l,
8469
- answerData: E
8485
+ answerData: L
8470
8486
  // use current form data to evaluate visibility
8471
8487
  });
8472
- return Ci(F)(E, Y, K);
8488
+ return Ci(F)(L, Y, K);
8473
8489
  },
8474
8490
  [p, l]
8475
8491
  ), S = yi({
8476
- resolver: C,
8492
+ resolver: k,
8477
8493
  mode: "onSubmit",
8478
8494
  defaultValues: {}
8479
8495
  }), {
8480
8496
  register: x,
8481
- setValue: M,
8482
- control: k,
8483
- handleSubmit: L,
8497
+ setValue: C,
8498
+ control: M,
8499
+ handleSubmit: w,
8484
8500
  reset: A,
8485
- getValues: w,
8486
- watch: R,
8487
- formState: { errors: B, isSubmitting: z },
8501
+ getValues: T,
8502
+ watch: D,
8503
+ formState: { errors: E, isSubmitting: z },
8488
8504
  trigger: $,
8489
8505
  setError: ae,
8490
8506
  clearErrors: X
8491
- } = S, te = wn({ control: k }), _ = Q(
8507
+ } = S, te = wn({ control: M }), _ = Q(
8492
8508
  () => te,
8493
8509
  [JSON.stringify(te)]
8494
8510
  ), j = Q(() => {
8495
8511
  if (d !== "conversational") return [];
8496
- const E = [];
8512
+ const L = [];
8497
8513
  return p.forEach((Y) => {
8498
8514
  var K;
8499
8515
  (K = Y.questionData) == null || K.forEach((F) => {
@@ -8501,13 +8517,13 @@ const Ns = ({
8501
8517
  if (Ti(F, _))
8502
8518
  if (F.type === "grid") {
8503
8519
  const ce = (oe = Y.questionData) == null ? void 0 : oe.filter((le) => le.gridId === F.id);
8504
- E.push({ ...F, gridChildren: ce });
8505
- } else F.gridId || E.push(F);
8520
+ L.push({ ...F, gridChildren: ce });
8521
+ } else F.gridId || L.push(F);
8506
8522
  });
8507
- }), E;
8523
+ }), L;
8508
8524
  }, [p, _, d]), ye = Z(
8509
- (E) => {
8510
- o && o(E);
8525
+ (L) => {
8526
+ o && o(L);
8511
8527
  },
8512
8528
  [o]
8513
8529
  );
@@ -8515,7 +8531,7 @@ const Ns = ({
8515
8531
  m(r);
8516
8532
  }, [m, r]), G(() => {
8517
8533
  if (!(p != null && p.length) || !o) return;
8518
- const E = p.flatMap(
8534
+ const L = p.flatMap(
8519
8535
  (Y) => {
8520
8536
  var K;
8521
8537
  return (K = Y.questionData) == null ? void 0 : K.map((F) => ({
@@ -8530,7 +8546,7 @@ const Ns = ({
8530
8546
  }));
8531
8547
  }
8532
8548
  );
8533
- ye(E), c(_);
8549
+ ye(L), c(_);
8534
8550
  }, [
8535
8551
  _,
8536
8552
  p,
@@ -8541,13 +8557,13 @@ const Ns = ({
8541
8557
  n != null && n.length && A(Ss(n));
8542
8558
  }, [n, A]);
8543
8559
  const Ne = Z(
8544
- (E) => {
8560
+ (L) => {
8545
8561
  const Y = p.flatMap(
8546
8562
  (K) => {
8547
8563
  var F;
8548
8564
  return (F = K.questionData) == null ? void 0 : F.map((oe) => ({
8549
8565
  id: oe.id,
8550
- value: E[oe.id] || "",
8566
+ value: L[oe.id] || "",
8551
8567
  sectionId: K.id,
8552
8568
  type: oe.type,
8553
8569
  metaData: {
@@ -8557,11 +8573,11 @@ const Ns = ({
8557
8573
  }));
8558
8574
  }
8559
8575
  );
8560
- Object.keys(B).length > 0 || s == null || s(Y);
8576
+ Object.keys(E).length > 0 || s == null || s(Y);
8561
8577
  },
8562
- [B, p, s]
8578
+ [E, p, s]
8563
8579
  ), Me = Z(async () => {
8564
- var E, Y;
8580
+ var L, Y;
8565
8581
  if (d === "conversational") {
8566
8582
  if (!a) {
8567
8583
  const K = j[y];
@@ -8569,44 +8585,44 @@ const Ns = ({
8569
8585
  const F = K.gridChildren ? K.gridChildren.map((ce) => ce.id) : [K.id];
8570
8586
  if (!await $(F)) return;
8571
8587
  }
8572
- y < j.length - 1 ? f((K) => K + 1) : L(Ne)();
8588
+ y < j.length - 1 ? f((K) => K + 1) : w(Ne)();
8573
8589
  return;
8574
8590
  }
8575
8591
  if (!a) {
8576
- const K = (Y = (E = p == null ? void 0 : p[v]) == null ? void 0 : E.questionData) == null ? void 0 : Y.map(
8592
+ const K = (Y = (L = p == null ? void 0 : p[v]) == null ? void 0 : L.questionData) == null ? void 0 : Y.map(
8577
8593
  (oe) => oe.id
8578
8594
  );
8579
8595
  if (!await $(K)) return;
8580
8596
  }
8581
8597
  h((K) => K + 1);
8582
- }, [v, y, j, p, a, $, d, L, Ne]), he = Z(() => {
8598
+ }, [v, y, j, p, a, $, d, w, Ne]), he = Z(() => {
8583
8599
  if (d === "conversational") {
8584
- f((E) => Math.max(0, E - 1));
8600
+ f((L) => Math.max(0, L - 1));
8585
8601
  return;
8586
8602
  }
8587
- h((E) => E - 1);
8588
- }, [d]), Ae = Q(
8603
+ h((L) => L - 1);
8604
+ }, [d]), Se = Q(
8589
8605
  () => ({
8590
8606
  register: x,
8591
- setValue: M,
8592
- watch: R,
8593
- errors: B,
8607
+ setValue: C,
8608
+ watch: D,
8609
+ errors: E,
8594
8610
  trigger: $,
8595
8611
  isSubmitting: z,
8596
8612
  isReadOnly: l,
8597
- getValues: w,
8613
+ getValues: T,
8598
8614
  setError: ae,
8599
8615
  clearErrors: X
8600
8616
  }),
8601
8617
  [
8602
8618
  x,
8603
- M,
8604
- R,
8605
- B,
8619
+ C,
8620
+ D,
8621
+ E,
8606
8622
  $,
8607
8623
  z,
8608
8624
  l,
8609
- w,
8625
+ T,
8610
8626
  ae,
8611
8627
  X
8612
8628
  ]
@@ -8616,7 +8632,7 @@ const Ns = ({
8616
8632
  /* @__PURE__ */ b(
8617
8633
  "form",
8618
8634
  {
8619
- onSubmit: L(Ne),
8635
+ onSubmit: w(Ne),
8620
8636
  className: "container h-full mx-auto",
8621
8637
  children: [
8622
8638
  /* @__PURE__ */ i("div", { className: "relative flex flex-col w-full min-w-0 py-4 gap-y-12", children: /* @__PURE__ */ b(
@@ -8626,20 +8642,20 @@ const Ns = ({
8626
8642
  children: [
8627
8643
  d === "multi" && (((Ee = p == null ? void 0 : p[v]) == null ? void 0 : Ee.title) || ((O = p == null ? void 0 : p[v]) == null ? void 0 : O.description)) && /* @__PURE__ */ b("div", { className: "py-4 mb-4 border-b border-gray-100 multi_section__title", children: [
8628
8644
  ((H = p[v]) == null ? void 0 : H.title) && /* @__PURE__ */ i("h2", { className: "text-lg font-semibold mb-[6px]", children: (J = p[v]) == null ? void 0 : J.title }),
8629
- ((T = p[v]) == null ? void 0 : T.description) && /* @__PURE__ */ i("p", { className: "text-sm", children: (P = p[v]) == null ? void 0 : P.description })
8645
+ ((B = p[v]) == null ? void 0 : B.description) && /* @__PURE__ */ i("p", { className: "text-sm", children: (P = p[v]) == null ? void 0 : P.description })
8630
8646
  ] }),
8631
8647
  d === "multi" ? /* @__PURE__ */ i(
8632
8648
  xs,
8633
8649
  {
8634
8650
  form_data: p,
8635
- options: Ae,
8651
+ options: Se,
8636
8652
  current: v
8637
8653
  }
8638
8654
  ) : d === "conversational" ? /* @__PURE__ */ i(
8639
8655
  As,
8640
8656
  {
8641
8657
  element: j[y],
8642
- options: Ae,
8658
+ options: Se,
8643
8659
  onNext: Me,
8644
8660
  onPrev: he,
8645
8661
  isFirst: y === 0,
@@ -8650,7 +8666,7 @@ const Ns = ({
8650
8666
  ys,
8651
8667
  {
8652
8668
  form_data: p,
8653
- options: Ae
8669
+ options: Se
8654
8670
  }
8655
8671
  )
8656
8672
  ]
@@ -8675,7 +8691,7 @@ const Ns = ({
8675
8691
  )
8676
8692
  ] }),
8677
8693
  v < g - 1 && /* @__PURE__ */ i(
8678
- Se,
8694
+ Ae,
8679
8695
  {
8680
8696
  type: "button",
8681
8697
  text: "Next",
@@ -8686,9 +8702,9 @@ const Ns = ({
8686
8702
  )
8687
8703
  ] }),
8688
8704
  (v === g - 1 || l) && !a && (u != null ? u : /* @__PURE__ */ i(
8689
- Se,
8705
+ Ae,
8690
8706
  {
8691
- isDisabled: z || Object.keys(B).length > 0,
8707
+ isDisabled: z || Object.keys(E).length > 0,
8692
8708
  isLoading: z,
8693
8709
  type: "submit",
8694
8710
  text: "Submit",
@@ -8697,9 +8713,9 @@ const Ns = ({
8697
8713
  }
8698
8714
  ))
8699
8715
  ] }) : !a && (u != null ? u : /* @__PURE__ */ i(
8700
- Se,
8716
+ Ae,
8701
8717
  {
8702
- isDisabled: z || Object.keys(B).length > 0,
8718
+ isDisabled: z || Object.keys(E).length > 0,
8703
8719
  isLoading: z,
8704
8720
  type: "submit",
8705
8721
  text: "Submit",