bank20baht-ui 0.2.8 → 0.3.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.
@@ -17,7 +17,7 @@ function D(e) {
17
17
  return null;
18
18
  }
19
19
  }
20
- const Y = {
20
+ const U = {
21
21
  required: "This field is required",
22
22
  minLength: "Must be at least {n} characters",
23
23
  maxLength: "Must be at most {n} characters",
@@ -58,8 +58,18 @@ const Y = {
58
58
  no: "No",
59
59
  emptyValue: "Not provided",
60
60
  choose: "Select",
61
- rowCount: "{n} rows"
62
- }, J = {
61
+ rowCount: "{n} rows",
62
+ close: "Close",
63
+ dismiss: "Dismiss",
64
+ opensInNewTab: "opens in new tab",
65
+ otpCharacter: "Character {i} of {n}",
66
+ row: "Row {n}",
67
+ removeRowN: "Remove row {n}",
68
+ stepDone: "completed",
69
+ stepCurrent: "current step",
70
+ today: "Today",
71
+ clear: "Clear"
72
+ }, K = {
63
73
  required: "กรุณากรอกข้อมูลนี้",
64
74
  minLength: "ต้องมีอย่างน้อย {n} ตัวอักษร",
65
75
  maxLength: "ต้องไม่เกิน {n} ตัวอักษร",
@@ -100,20 +110,30 @@ const Y = {
100
110
  no: "ไม่ใช่",
101
111
  emptyValue: "ไม่ได้ระบุ",
102
112
  choose: "เลือก",
103
- rowCount: "{n} แถว"
104
- }, K = { en: Y, th: J };
105
- let R = Y;
113
+ rowCount: "{n} แถว",
114
+ close: "ปิด",
115
+ dismiss: "ปิดข้อความ",
116
+ opensInNewTab: "เปิดในแท็บใหม่",
117
+ otpCharacter: "ตัวอักษรที่ {i} จาก {n}",
118
+ row: "แถวที่ {n}",
119
+ removeRowN: "ลบแถวที่ {n}",
120
+ stepDone: "เสร็จแล้ว",
121
+ stepCurrent: "ขั้นตอนปัจจุบัน",
122
+ today: "วันนี้",
123
+ clear: "ล้างค่า"
124
+ }, J = { en: U, th: K };
125
+ let L = U;
106
126
  function xe(e, t) {
107
- R = { ...K[e], ...t };
127
+ L = { ...J[e], ...t };
108
128
  }
109
129
  function Ae() {
110
- return R;
130
+ return L;
111
131
  }
112
132
  function ve(e) {
113
- R = e;
133
+ L = e;
114
134
  }
115
135
  function f(e, t) {
116
- let n = R[e];
136
+ let n = L[e];
117
137
  if (t)
118
138
  for (const [s, r] of Object.entries(t))
119
139
  n = n.replaceAll(`{${s}}`, () => String(r));
@@ -121,19 +141,19 @@ function f(e, t) {
121
141
  }
122
142
  function B(e) {
123
143
  if (e.kind !== "approval") return [];
124
- const t = (s) => e.field_data.some((r) => r.key === s), n = [];
144
+ const t = (s) => e.fields.some((r) => r.key === s), n = [];
125
145
  return t("decision") || n.push({ order: 9001, type: "text", key: "decision", label: f("decision") }), t("comment") || n.push({ order: 9002, type: "textarea", key: "comment", label: f("comment") }), n;
126
146
  }
127
- function q(e, t) {
147
+ function R(e, t) {
128
148
  var s;
129
149
  const n = t.indexOf(".");
130
150
  if (n !== -1)
131
151
  return (s = e[t.slice(0, n)]) == null ? void 0 : s[t.slice(n + 1)];
132
152
  }
133
- function j(e) {
153
+ function O(e) {
134
154
  return e == null ? !0 : typeof e == "string" ? e === "" : Array.isArray(e) ? e.length === 0 : !1;
135
155
  }
136
- function w(e, t) {
156
+ function N(e, t) {
137
157
  if (typeof e == "number" && typeof t == "number") return e - t;
138
158
  if (e instanceof Date || t instanceof Date) {
139
159
  const r = new Date(e).getTime(), o = new Date(t).getTime();
@@ -147,26 +167,26 @@ function w(e, t) {
147
167
  return Number.isNaN(n) || Number.isNaN(s) ? null : n - s;
148
168
  }
149
169
  function X(e, t) {
150
- const n = q(t, e.field), s = e.valueField !== void 0 ? q(t, e.valueField) : e.value;
170
+ const n = R(t, e.field), s = e.value_field !== void 0 ? R(t, e.value_field) : e.value;
151
171
  switch (e.op) {
152
172
  case "eq":
153
173
  return n === s;
154
174
  case "ne":
155
175
  return n !== s;
156
176
  case "gt": {
157
- const r = w(n, s);
177
+ const r = N(n, s);
158
178
  return r !== null && r > 0;
159
179
  }
160
180
  case "gte": {
161
- const r = w(n, s);
181
+ const r = N(n, s);
162
182
  return r !== null && r >= 0;
163
183
  }
164
184
  case "lt": {
165
- const r = w(n, s);
185
+ const r = N(n, s);
166
186
  return r !== null && r < 0;
167
187
  }
168
188
  case "lte": {
169
- const r = w(n, s);
189
+ const r = N(n, s);
170
190
  return r !== null && r <= 0;
171
191
  }
172
192
  case "in":
@@ -182,16 +202,16 @@ function X(e, t) {
182
202
  case "endsWith":
183
203
  return typeof n == "string" && n.endsWith(String(s));
184
204
  case "isEmpty":
185
- return j(n);
205
+ return O(n);
186
206
  case "isNotEmpty":
187
- return !j(n);
207
+ return !O(n);
188
208
  }
189
209
  }
190
- function x(e, t) {
191
- return e === void 0 ? !0 : "and" in e ? e.and.every((n) => x(n, t)) : "or" in e ? e.or.some((n) => x(n, t)) : "not" in e ? !x(e.not, t) : X(e, t);
210
+ function _(e, t) {
211
+ return e === void 0 ? !0 : "and" in e ? e.and.every((n) => _(n, t)) : "or" in e ? e.or.some((n) => _(n, t)) : "not" in e ? !_(e.not, t) : X(e, t);
192
212
  }
193
213
  const H = /^(\d{4})-(\d{2})-(\d{2})$/;
194
- function A(e) {
214
+ function x(e) {
195
215
  if (typeof e != "string") return null;
196
216
  const t = H.exec(e);
197
217
  if (!t) return null;
@@ -202,32 +222,32 @@ function Q(e) {
202
222
  const t = (n) => String(n).padStart(2, "0");
203
223
  return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
204
224
  }
205
- const Z = (e) => e.dateMode ?? "single";
225
+ const Z = (e) => e.date_mode ?? "single";
206
226
  function ee(e) {
207
227
  return typeof e == "string" ? e === "" ? [] : [e] : Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
208
228
  }
209
229
  function te(e) {
210
230
  const t = e.indexOf("/");
211
231
  if (t === -1) {
212
- const r = A(e);
232
+ const r = x(e);
213
233
  return r ? [r, r] : null;
214
234
  }
215
- const n = A(e.slice(0, t)), s = A(e.slice(t + 1));
235
+ const n = x(e.slice(0, t)), s = x(e.slice(t + 1));
216
236
  return !n || !s ? null : n <= s ? [n, s] : [s, n];
217
237
  }
218
238
  function ne(e, t) {
219
239
  var s;
220
- const n = A(t);
240
+ const n = x(t);
221
241
  if (!n) return !1;
222
- if ((s = e.disabledWeekdays) != null && s.includes(n.getDay())) return !0;
223
- for (const r of e.disabledDates ?? []) {
242
+ if ((s = e.disabled_weekdays) != null && s.includes(n.getDay())) return !0;
243
+ for (const r of e.disabled_dates ?? []) {
224
244
  const o = te(r);
225
245
  if (o && n >= o[0] && n <= o[1]) return !0;
226
246
  }
227
247
  return !1;
228
248
  }
229
249
  function re(e, t, n = 3660) {
230
- const s = A(e), r = A(t);
250
+ const s = x(e), r = x(t);
231
251
  if (!s || !r || s >= r) return [];
232
252
  const o = [], i = new Date(s);
233
253
  for (i.setDate(i.getDate() + 1); i < r && o.length < n; )
@@ -235,39 +255,39 @@ function re(e, t, n = 3660) {
235
255
  return o;
236
256
  }
237
257
  const se = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
238
- function F(e) {
258
+ function q(e) {
239
259
  return e == null ? !0 : typeof e == "string" ? e === "" : Array.isArray(e) ? e.length === 0 : typeof e == "boolean" ? e === !1 : !1;
240
260
  }
241
261
  function oe(e) {
242
262
  const t = [...e.validators ?? []], n = (s) => t.some((r) => r.type === s);
243
- return e.required && !n("required") && t.push({ type: "required" }), e.maxLength !== void 0 && !n("maxLength") && t.push({ type: "maxLength", value: e.maxLength }), e.minLength !== void 0 && !n("minLength") && t.push({ type: "minLength", value: e.minLength }), e.min !== void 0 && !n("min") && t.push({ type: "min", value: e.min }), e.max !== void 0 && !n("max") && t.push({ type: "max", value: e.max }), e.type === "email" && !n("email") && t.push({ type: "email" }), t;
263
+ return e.required && !n("required") && t.push({ type: "required" }), e.max_length !== void 0 && !n("maxLength") && t.push({ type: "maxLength", value: e.max_length }), e.min_length !== void 0 && !n("minLength") && t.push({ type: "minLength", value: e.min_length }), e.min !== void 0 && !n("min") && t.push({ type: "min", value: e.min }), e.max !== void 0 && !n("max") && t.push({ type: "max", value: e.max }), e.type === "email" && !n("email") && t.push({ type: "email" }), t;
244
264
  }
245
- const M = (e) => Array.isArray(e) ? e : [e];
265
+ const E = (e) => Array.isArray(e) ? e : [e];
246
266
  function ie(e, t, n, s) {
247
267
  var r;
248
268
  switch (e.type) {
249
269
  case "required":
250
- return F(t) ? e.message ?? f("required") : null;
270
+ return q(t) ? e.message ?? f("required") : null;
251
271
  case "minLength": {
252
272
  const o = Number(e.value);
253
273
  return Number.isNaN(o) ? (console.warn(
254
- `[bahtui] minLength validator has non-numeric value ${JSON.stringify(e.value)} — skipped`
274
+ `[bahtui] min_length validator has non-numeric value ${JSON.stringify(e.value)} — skipped`
255
275
  ), null) : typeof t == "string" && t.length < o ? e.message ?? f("minLength", { n: e.value }) : null;
256
276
  }
257
277
  case "maxLength": {
258
278
  const o = Number(e.value);
259
279
  return Number.isNaN(o) ? (console.warn(
260
- `[bahtui] maxLength validator has non-numeric value ${JSON.stringify(e.value)} — skipped`
280
+ `[bahtui] max_length validator has non-numeric value ${JSON.stringify(e.value)} — skipped`
261
281
  ), null) : typeof t == "string" && t.length > o ? e.message ?? f("maxLength", { n: e.value }) : null;
262
282
  }
263
283
  case "min":
264
- return M(t).some((i) => {
265
- const a = w(i, e.value);
284
+ return E(t).some((i) => {
285
+ const a = N(i, e.value);
266
286
  return a !== null && a < 0;
267
287
  }) ? e.message ?? f("min", { n: e.value }) : null;
268
288
  case "max":
269
- return M(t).some((i) => {
270
- const a = w(i, e.value);
289
+ return E(t).some((i) => {
290
+ const a = N(i, e.value);
271
291
  return a !== null && a > 0;
272
292
  }) ? e.message ?? f("max", { n: e.value }) : null;
273
293
  case "pattern": {
@@ -284,8 +304,8 @@ function ie(e, t, n, s) {
284
304
  return typeof t == "string" && !se.test(t) ? e.message ?? f("email") : null;
285
305
  case "compare": {
286
306
  const o = s == null ? void 0 : s[e.field ?? ""];
287
- if (o === void 0 || F(o)) return null;
288
- const i = w(t, o);
307
+ if (o === void 0 || q(o)) return null;
308
+ const i = N(t, o);
289
309
  if (i === null) return null;
290
310
  const a = e.op ?? "eq";
291
311
  if (a === "eq" ? i === 0 : a === "ne" ? i !== 0 : a === "gt" ? i > 0 : a === "gte" ? i >= 0 : a === "lt" ? i < 0 : i <= 0) return null;
@@ -302,17 +322,17 @@ function ie(e, t, n, s) {
302
322
  }
303
323
  }
304
324
  function ae(e, t, n, s) {
305
- const r = [], o = oe(e), i = F(t);
325
+ const r = [], o = oe(e), i = q(t);
306
326
  for (const a of o) {
307
327
  if (a.type !== "required" && i) continue;
308
- const d = ie(a, t, n, s);
309
- d !== null && r.push({ key: e.key, message: d });
328
+ const m = ie(a, t, n, s);
329
+ m !== null && r.push({ key: e.key, message: m });
310
330
  }
311
331
  return e.type === "repeater" && r.push(...me(e, t, n)), e.type === "file" && r.push(...fe(e, t)), e.type === "date" && !i && r.push(...ue(e, t)), r;
312
332
  }
313
333
  function ue(e, t) {
314
334
  var s, r;
315
- if (!((s = e.disabledDates) != null && s.length) && !((r = e.disabledWeekdays) != null && r.length)) return [];
335
+ if (!((s = e.disabled_dates) != null && s.length) && !((r = e.disabled_weekdays) != null && r.length)) return [];
316
336
  const n = ee(t);
317
337
  return Z(e) === "range" && n.length === 2 && n.push(...re(n[0], n[1])), n.some((o) => ne(e, o)) ? [{ key: e.key, message: f("dateDisabled") }] : [];
318
338
  }
@@ -328,59 +348,59 @@ function le(e, t, n) {
328
348
  function fe(e, t) {
329
349
  const n = (Array.isArray(t) ? t : [t]).filter(ce), s = [];
330
350
  for (const r of n)
331
- e.maxSize !== void 0 && r.size > e.maxSize && s.push({ key: e.key, message: f("fileTooLarge") }), e.accept && !le(e.accept, r.name ?? "", r.type ?? "") && s.push({ key: e.key, message: f("fileTypeNotAllowed") });
351
+ e.max_size !== void 0 && r.size > e.max_size && s.push({ key: e.key, message: f("fileTooLarge") }), e.accept && !le(e.accept, r.name ?? "", r.type ?? "") && s.push({ key: e.key, message: f("fileTypeNotAllowed") });
332
352
  return s;
333
353
  }
334
354
  function me(e, t, n) {
335
355
  if (t != null && !Array.isArray(t))
336
356
  return [{ key: e.key, message: f("pattern") }];
337
357
  const s = Array.isArray(t) ? t : [], r = [];
338
- e.minRows !== void 0 && s.length < e.minRows && r.push({ key: e.key, message: f("minRows", { n: e.minRows }) }), e.maxRows !== void 0 && s.length > e.maxRows && r.push({ key: e.key, message: f("maxRows", { n: e.maxRows }) });
358
+ e.min_rows !== void 0 && s.length < e.min_rows && r.push({ key: e.key, message: f("minRows", { n: e.min_rows }) }), e.max_rows !== void 0 && s.length > e.max_rows && r.push({ key: e.key, message: f("maxRows", { n: e.max_rows }) });
339
359
  const o = [...e.fields ?? []].sort((i, a) => i.order - a.order);
340
360
  return s.forEach((i, a) => {
341
- const d = i !== null && typeof i == "object" && !Array.isArray(i) ? i : {}, p = {};
361
+ const m = i !== null && typeof i == "object" && !Array.isArray(i) ? i : {}, p = {};
342
362
  for (const u of o)
343
- u.type === "label" || u.type === "section" || u.type === "repeater" || (p[u.key] = Object.hasOwn(d, u.key) ? d[u.key] : D(u));
363
+ u.type === "label" || u.type === "section" || u.type === "repeater" || (p[u.key] = Object.hasOwn(m, u.key) ? m[u.key] : D(u));
344
364
  for (const u of o)
345
365
  if (!(u.type === "label" || u.type === "section" || u.type === "repeater"))
346
366
  for (const y of ae(u, p[u.key], n, p))
347
367
  r.push({ key: `${e.key}[${a}].${y.key}`, message: y.message });
348
368
  }), r;
349
369
  }
350
- function Se(e, t) {
370
+ function $e(e, t) {
351
371
  var r;
352
- if (!t) return [...e.field_data].sort((o, i) => o.order - i.order);
372
+ if (!t) return [...e.fields].sort((o, i) => o.order - i.order);
353
373
  const n = (r = e.views) == null ? void 0 : r.find((o) => o.name === t);
354
374
  if (!n) return null;
355
- const s = new Map(e.field_data.map((o) => [o.key, o]));
375
+ const s = new Map(e.fields.map((o) => [o.key, o]));
356
376
  return n.fields.map((o) => s.get(o)).filter((o) => o !== void 0);
357
377
  }
358
- function S(e, t) {
378
+ function v(e, t) {
359
379
  return e ? e.startsWith("!") ? t[e.slice(1)] !== !0 : t[e] === !0 : !0;
360
380
  }
361
381
  function G(e, t) {
362
- return e.filter((n) => S(n.flag, t)).map((n) => n.fields ? { ...n, fields: G(n.fields, t) } : n);
382
+ return e.filter((n) => v(n.flag, t)).map((n) => n.fields ? { ...n, fields: G(n.fields, t) } : n);
363
383
  }
364
- function E(e) {
365
- return e.some((t) => t.flag !== void 0 || (t.fields ? E(t.fields) : !1));
384
+ function j(e) {
385
+ return e.some((t) => t.flag !== void 0 || (t.fields ? j(t.fields) : !1));
366
386
  }
367
387
  function T(e, t) {
368
- if (!E(e.field_data)) return e;
369
- const n = G(e.field_data, t), s = new Set(n.map((r) => r.key));
388
+ if (!j(e.fields)) return e;
389
+ const n = G(e.fields, t), s = new Set(n.map((r) => r.key));
370
390
  return {
371
391
  ...e,
372
- field_data: n,
392
+ fields: n,
373
393
  ...e.views ? { views: e.views.map((r) => ({ ...r, fields: r.fields.filter((o) => s.has(o)) })) } : {}
374
394
  };
375
395
  }
376
- function Le(e, t = {}) {
377
- if ("workflowId" in e) {
396
+ function Se(e, t = {}) {
397
+ if ("workflow_id" in e) {
378
398
  const n = e;
379
- return n.forms.some((r) => r.flag !== void 0 || E(r.field_data)) || n.rules.some((r) => r.flag !== void 0) || (n.transitions ?? []).some((r) => r.flag !== void 0) ? {
399
+ return n.forms.some((r) => r.flag !== void 0 || j(r.fields)) || n.rules.some((r) => r.flag !== void 0) || (n.transitions ?? []).some((r) => r.flag !== void 0) ? {
380
400
  ...n,
381
- forms: n.forms.filter((r) => S(r.flag, t)).map((r) => T(r, t)),
382
- rules: n.rules.filter((r) => S(r.flag, t)),
383
- ...n.transitions ? { transitions: n.transitions.filter((r) => S(r.flag, t)) } : {}
401
+ forms: n.forms.filter((r) => v(r.flag, t)).map((r) => T(r, t)),
402
+ rules: n.rules.filter((r) => v(r.flag, t)),
403
+ ...n.transitions ? { transitions: n.transitions.filter((r) => v(r.flag, t)) } : {}
384
404
  } : e;
385
405
  }
386
406
  return T(e, t);
@@ -390,17 +410,17 @@ function de(e) {
390
410
  const t = Number(e);
391
411
  return Number.isNaN(t) ? null : t;
392
412
  }
393
- function L(e) {
413
+ function $(e) {
394
414
  return typeof e == "number" && Number.isNaN(e) ? null : e;
395
415
  }
396
- function $(e, t) {
397
- if ("ref" in e) return q(t, e.ref);
416
+ function S(e, t) {
417
+ if ("ref" in e) return R(t, e.ref);
398
418
  if ("const" in e) return e.const;
399
419
  if ("if" in e) {
400
420
  const [s, r, o] = e.if;
401
- return x(s, t) ? L($(r, t)) : L($(o, t));
421
+ return _(s, t) ? $(S(r, t)) : $(S(o, t));
402
422
  }
403
- const n = e.args.map((s) => L($(s, t)));
423
+ const n = e.args.map((s) => $(S(s, t)));
404
424
  switch (e.op) {
405
425
  case "concat":
406
426
  return n.map((s) => s == null ? "" : String(s)).join("");
@@ -428,19 +448,19 @@ function $(e, t) {
428
448
  }
429
449
  }
430
450
  function pe(e, t) {
431
- return L($(e, t));
451
+ return $(S(e, t));
432
452
  }
433
- const V = 20, _ = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
453
+ const C = 20, M = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
434
454
  function I(e, t) {
435
455
  return e !== null && typeof e == "object" && Object.hasOwn(e, t) ? e[t] : void 0;
436
456
  }
437
- function O(e, t) {
457
+ function F(e, t) {
438
458
  if (e === t) return !0;
439
459
  if (Array.isArray(e) && Array.isArray(t))
440
- return e.length === t.length && e.every((n, s) => O(n, t[s]));
460
+ return e.length === t.length && e.every((n, s) => F(n, t[s]));
441
461
  if (e !== null && t !== null && typeof e == "object" && typeof t == "object" && Object.getPrototypeOf(e) === Object.prototype && Object.getPrototypeOf(t) === Object.prototype) {
442
462
  const n = Object.keys(e), s = Object.keys(t);
443
- return n.length === s.length && n.every((r) => O(e[r], t[r]));
463
+ return n.length === s.length && n.every((r) => F(e[r], t[r]));
444
464
  }
445
465
  return !1;
446
466
  }
@@ -454,30 +474,30 @@ function he(e, t) {
454
474
  const n = [], s = /* @__PURE__ */ new Map(), r = [];
455
475
  let o = {};
456
476
  for (const u of e.forms) {
457
- if (_.has(u.formName)) {
458
- n.push({ ref: u.formName, message: "unsafe form name", kind: "schema" });
477
+ if (M.has(u.form_name)) {
478
+ n.push({ ref: u.form_name, message: "unsafe form name", kind: "schema" });
459
479
  continue;
460
480
  }
461
- r.push(u.formName);
462
- const y = {}, N = I(t, u.formName);
463
- for (const m of [...u.field_data, ...B(u)]) {
464
- if (m.type === "label" || m.type === "section") continue;
465
- if (_.has(m.key)) {
481
+ r.push(u.form_name);
482
+ const y = {}, w = I(t, u.form_name);
483
+ for (const d of [...u.fields, ...B(u)]) {
484
+ if (d.type === "label" || d.type === "section") continue;
485
+ if (M.has(d.key)) {
466
486
  n.push({
467
- ref: `${u.formName}.${m.key}`,
487
+ ref: `${u.form_name}.${d.key}`,
468
488
  message: "unsafe field key",
469
489
  kind: "schema"
470
490
  });
471
491
  continue;
472
492
  }
473
- s.set(`${u.formName}.${m.key}`, m);
474
- const c = I(N, m.key);
475
- y[m.key] = c !== void 0 ? c : D(m);
493
+ s.set(`${u.form_name}.${d.key}`, d);
494
+ const c = I(w, d.key);
495
+ y[d.key] = c !== void 0 ? c : D(d);
476
496
  }
477
- o[u.formName] = y;
497
+ o[u.form_name] = y;
478
498
  }
479
- let i = {}, a = {}, d = !1;
480
- for (let u = 0; u < V; u++) {
499
+ let i = {}, a = {}, m = !1;
500
+ for (let u = 0; u < C; u++) {
481
501
  i = {}, a = {};
482
502
  for (const c of r) a[c] = { visible: !0 };
483
503
  for (const [c, h] of s)
@@ -490,25 +510,25 @@ function he(e, t) {
490
510
  };
491
511
  const y = /* @__PURE__ */ new Map();
492
512
  e.rules.forEach((c, h) => {
493
- const l = x(c.when, o) ? c.then : c.else;
513
+ const l = _(c.when, o) ? c.then : c.else;
494
514
  if (!l) return;
495
515
  const k = c.priority ?? 0;
496
516
  for (const g of l) {
497
- const b = ge(g), v = y.get(b) ?? [];
498
- v.push({ action: g, priority: k, index: h }), y.set(b, v);
517
+ const b = ge(g), A = y.get(b) ?? [];
518
+ A.push({ action: g, priority: k, index: h }), y.set(b, A);
499
519
  }
500
520
  });
501
- const N = [];
521
+ const w = [];
502
522
  for (const [c, h] of y) {
503
523
  const l = ye(h);
504
524
  if (!l) continue;
505
525
  if (l.action === "setValue") {
506
- N.push({ ref: `${l.target.form}.${l.target.field}`, action: l });
526
+ w.push({ ref: `${l.target.form}.${l.target.field}`, action: l });
507
527
  continue;
508
528
  }
509
529
  if (l.action === "showForm" || l.action === "hideForm" || l.action === "skipForm") {
510
- const v = a[l.target.form];
511
- if (!v) {
530
+ const A = a[l.target.form];
531
+ if (!A) {
512
532
  n.push({
513
533
  ref: l.target.form,
514
534
  message: `rule targets unknown form (${c})`,
@@ -516,7 +536,7 @@ function he(e, t) {
516
536
  });
517
537
  continue;
518
538
  }
519
- v.visible = l.action === "showForm";
539
+ A.visible = l.action === "showForm";
520
540
  continue;
521
541
  }
522
542
  const k = l.target, g = `${k.form}.${k.field}`, b = i[g];
@@ -548,37 +568,37 @@ function he(e, t) {
548
568
  break;
549
569
  }
550
570
  }
551
- const m = {};
552
- for (const c of r) m[c] = { ...o[c] };
571
+ const d = {};
572
+ for (const c of r) d[c] = { ...o[c] };
553
573
  for (const [c, h] of s) {
554
- const [l, k] = C(c);
555
- (!a[l].visible || !i[c].visible) && (m[l][k] = D(h));
574
+ const [l, k] = V(c);
575
+ (!a[l].visible || !i[c].visible) && (d[l][k] = D(h));
556
576
  }
557
- for (const { ref: c, action: h } of N) {
558
- const [l, k] = C(c), g = i[c];
577
+ for (const { ref: c, action: h } of w) {
578
+ const [l, k] = V(c), g = i[c];
559
579
  if (!g) {
560
580
  n.push({ ref: c, message: "setValue targets unknown field", kind: "schema" });
561
581
  continue;
562
582
  }
563
- !a[l].visible || !g.visible || (m[l][k] = pe(h.value, m), h.lock !== !1 && (g.readonly = !0, g.computed = !0));
583
+ !a[l].visible || !g.visible || (d[l][k] = pe(h.value, d), h.lock !== !1 && (g.readonly = !0, g.computed = !0));
564
584
  }
565
- if (O(m, o)) {
566
- d = !0, o = m;
585
+ if (F(d, o)) {
586
+ m = !0, o = d;
567
587
  break;
568
588
  }
569
- o = m;
589
+ o = d;
570
590
  }
571
- d || n.push({
572
- ref: e.workflowId,
573
- message: `rules did not converge within ${V} passes (cycle?)`,
591
+ m || n.push({
592
+ ref: e.workflow_id,
593
+ message: `rules did not converge within ${C} passes (cycle?)`,
574
594
  kind: "data"
575
595
  });
576
596
  const p = {};
577
597
  for (const u of r) {
578
598
  if (!a[u].visible) continue;
579
599
  const y = {};
580
- for (const [N, m] of Object.entries(o[u]))
581
- i[`${u}.${N}`].visible && (y[N] = m);
600
+ for (const [w, d] of Object.entries(o[u]))
601
+ i[`${u}.${w}`].visible && (y[w] = d);
582
602
  p[u] = y;
583
603
  }
584
604
  return { data: p, fields: i, forms: a, errors: n };
@@ -587,7 +607,7 @@ function ge(e) {
587
607
  const t = e.action === "show" || e.action === "hide" ? "visible" : e.action === "enable" || e.action === "disable" ? "enabled" : e.action === "required" || e.action === "optional" ? "required" : e.action === "showForm" || e.action === "hideForm" || e.action === "skipForm" ? "formVisible" : e.action, n = "field" in e.target ? `${e.target.form}.${e.target.field}` : e.target.form;
588
608
  return `${t}:${n}`;
589
609
  }
590
- function C(e) {
610
+ function V(e) {
591
611
  const t = e.indexOf(".");
592
612
  return [e.slice(0, t), e.slice(t + 1)];
593
613
  }
@@ -596,16 +616,16 @@ function P(e, t) {
596
616
  return new Set(
597
617
  e.forms.filter((s) => {
598
618
  var r;
599
- return ((r = n.forms[s.formName]) == null ? void 0 : r.visible) !== !1;
600
- }).map((s) => s.formName)
619
+ return ((r = n.forms[s.form_name]) == null ? void 0 : r.visible) !== !1;
620
+ }).map((s) => s.form_name)
601
621
  );
602
622
  }
603
623
  function W(e, t, n) {
604
624
  for (const o of e.transitions ?? [])
605
- if (o.from === t && x(o.when, n))
625
+ if (o.from === t && _(o.when, n))
606
626
  return o.to;
607
- const s = [...e.forms].sort((o, i) => o.order - i.order), r = s.findIndex((o) => o.formName === t);
608
- return r >= 0 && r + 1 < s.length ? s[r + 1].formName : "end";
627
+ const s = [...e.forms].sort((o, i) => o.order - i.order), r = s.findIndex((o) => o.form_name === t);
628
+ return r >= 0 && r + 1 < s.length ? s[r + 1].form_name : "end";
609
629
  }
610
630
  function be(e, t, n, s) {
611
631
  const r = s ?? P(e, n), o = /* @__PURE__ */ new Set([t]);
@@ -616,9 +636,9 @@ function be(e, t, n, s) {
616
636
  }
617
637
  return i;
618
638
  }
619
- function $e(e, t) {
620
- var d;
621
- const n = P(e, t), r = (d = [...e.forms].sort((p, u) => p.order - u.order).find((p) => n.has(p.formName))) == null ? void 0 : d.formName;
639
+ function Le(e, t) {
640
+ var m;
641
+ const n = P(e, t), r = (m = [...e.forms].sort((p, u) => p.order - u.order).find((p) => n.has(p.form_name))) == null ? void 0 : m.form_name;
622
642
  if (!r) return [];
623
643
  const o = [], i = /* @__PURE__ */ new Set();
624
644
  let a = r;
@@ -626,14 +646,14 @@ function $e(e, t) {
626
646
  i.add(a), o.push(a), a = be(e, a, t, n);
627
647
  return o;
628
648
  }
629
- const ke = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, U = (e, t) => {
649
+ const ke = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, z = (e, t) => {
630
650
  const n = e == null ? void 0 : e.find((s) => s.key === String(t));
631
651
  return n ? n.label : String(t);
632
- }, Ne = (e) => e && typeof e == "object" && "name" in e ? String(e.name) : String(e), z = (e) => {
652
+ }, we = (e) => e && typeof e == "object" && "name" in e ? String(e.name) : String(e), Y = (e) => {
633
653
  const t = new Date(e);
634
654
  return Number.isNaN(t.getTime()) ? e : /^\d{4}-\d{2}-\d{2}$/.test(e) ? (/* @__PURE__ */ new Date(e + "T00:00:00")).toLocaleDateString() : t.toLocaleString();
635
655
  };
636
- function we(e, t, n = e.options) {
656
+ function Ne(e, t, n = e.options) {
637
657
  if (ke(t)) return { kind: "empty" };
638
658
  switch (e.type) {
639
659
  case "checkbox":
@@ -641,24 +661,24 @@ function we(e, t, n = e.options) {
641
661
  return { kind: "text", text: f(t ? "yes" : "no") };
642
662
  case "dropdown":
643
663
  case "radio":
644
- return { kind: "text", text: U(n, t) };
664
+ return { kind: "text", text: z(n, t) };
645
665
  case "multiselect":
646
- return { kind: "chips", items: (Array.isArray(t) ? t : [t]).map((r) => U(n, r)) };
666
+ return { kind: "chips", items: (Array.isArray(t) ? t : [t]).map((r) => z(n, r)) };
647
667
  case "date": {
648
- if (!Array.isArray(t)) return { kind: "text", text: z(String(t)) };
649
- const s = t.map((r) => z(String(r)));
650
- return e.dateMode === "range" && s.length === 2 ? { kind: "text", text: `${s[0]} – ${s[1]}` } : { kind: "chips", items: s };
668
+ if (!Array.isArray(t)) return { kind: "text", text: Y(String(t)) };
669
+ const s = t.map((r) => Y(String(r)));
670
+ return e.date_mode === "range" && s.length === 2 ? { kind: "text", text: `${s[0]} – ${s[1]}` } : { kind: "chips", items: s };
651
671
  }
652
672
  case "file":
653
- return { kind: "chips", items: (Array.isArray(t) ? t : [t]).map(Ne) };
673
+ return { kind: "chips", items: (Array.isArray(t) ? t : [t]).map(we) };
654
674
  case "repeater": {
655
675
  const s = Array.isArray(t) ? t : [], r = e.fields ?? [];
656
676
  return {
657
677
  kind: "rows",
658
678
  rows: s.map(
659
679
  (o) => r.filter((i) => i.type !== "label" && i.type !== "section").map((i) => {
660
- const a = we(i, o == null ? void 0 : o[i.key]), d = a.kind === "text" ? a.text : a.kind === "chips" ? a.items.join(", ") : a.kind === "rows" ? f("rowCount", { n: a.rows.length }) : f("emptyValue");
661
- return { label: i.label ?? i.key, text: d };
680
+ const a = Ne(i, o == null ? void 0 : o[i.key]), m = a.kind === "text" ? a.text : a.kind === "chips" ? a.items.join(", ") : a.kind === "rows" ? f("rowCount", { n: a.rows.length }) : f("emptyValue");
681
+ return { label: i.label ?? i.key, text: m };
662
682
  })
663
683
  )
664
684
  };
@@ -667,28 +687,70 @@ function we(e, t, n = e.options) {
667
687
  return { kind: "text", text: String(t) };
668
688
  }
669
689
  }
690
+ const _e = {
691
+ formId: "form_id",
692
+ formName: "form_name",
693
+ field_data: "fields",
694
+ workflowId: "workflow_id",
695
+ optionsFrom: "options_from",
696
+ optionsDeps: "options_deps",
697
+ maxLength: "max_length",
698
+ minLength: "min_length",
699
+ dateMode: "date_mode",
700
+ dateFormat: "date_format",
701
+ disabledDates: "disabled_dates",
702
+ disabledWeekdays: "disabled_weekdays",
703
+ maxSize: "max_size",
704
+ minRows: "min_rows",
705
+ maxRows: "max_rows",
706
+ addLabel: "add_label",
707
+ summaryForms: "summary_forms",
708
+ approveLabel: "approve_label",
709
+ rejectLabel: "reject_label",
710
+ onReject: "on_reject",
711
+ valueField: "value_field"
712
+ };
713
+ function De(e) {
714
+ const t = [], n = (s, r) => {
715
+ if (Array.isArray(s)) return s.map((a, m) => n(a, `${r}[${m}]`));
716
+ if (typeof s != "object" || s === null) return s;
717
+ const o = {}, i = s;
718
+ for (const [a, m] of Object.entries(i)) {
719
+ const p = _e[a];
720
+ if (p === void 0) {
721
+ o[a] = n(m, r ? `${r}.${a}` : a);
722
+ continue;
723
+ }
724
+ t.push(r ? `${r}.${a}` : a), !Object.hasOwn(i, p) && (o[p] = n(m, r ? `${r}.${p}` : p));
725
+ }
726
+ return o;
727
+ };
728
+ return { schema: n(e, ""), renamed: t };
729
+ }
670
730
  export {
731
+ _e as L,
671
732
  te as a,
672
733
  D as b,
673
- Le as c,
734
+ Se as c,
674
735
  Z as d,
675
- we as e,
736
+ Ne as e,
676
737
  Q as f,
677
738
  he as g,
678
739
  be as h,
679
740
  ee as i,
680
741
  B as j,
681
- x as k,
742
+ _ as k,
682
743
  pe as l,
683
- S as m,
744
+ v as m,
684
745
  Ae as n,
685
746
  ne as o,
686
- A as p,
687
- q,
688
- Se as r,
689
- ve as s,
747
+ x as p,
748
+ De as q,
749
+ $e as r,
750
+ R as s,
690
751
  f as t,
691
- xe as u,
752
+ ve as u,
692
753
  ae as v,
693
- $e as w
754
+ xe as w,
755
+ Le as x
694
756
  };