@verbb/formie-browser 1.0.2 → 1.0.4

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/{address-finder-CQW81kY0.js → address-finder-BU4roxT6.js} +2 -2
  3. package/dist/chunks/{bpoint-D8OjLmsn.js → bpoint-uNg5j6rt.js} +1 -1
  4. package/dist/chunks/{calculations-BqZsENCq.js → calculations-C9t6Zop9.js} +2 -2
  5. package/dist/chunks/{captcha-eu-DIa6aUWz.js → captcha-eu-BAPzHNts.js} +2 -2
  6. package/dist/chunks/{checkbox-radio-BI-UjgMF.js → checkbox-radio-CHeLNVIK.js} +39 -34
  7. package/dist/chunks/{conditions-BVl6jTYo.js → conditions-DKxVCsjD.js} +189 -163
  8. package/dist/chunks/{date-picker-69TgvErA.js → date-picker-B3iQ797Z.js} +2 -2
  9. package/dist/chunks/{eway-1GPxH6DU.js → eway-DCielIML.js} +2 -2
  10. package/dist/chunks/file-upload-DP2TOUYV.js +316 -0
  11. package/dist/chunks/{friendly-captcha-v1-DA2QPKA3.js → friendly-captcha-v1-DdlcGiFY.js} +1 -1
  12. package/dist/chunks/{friendly-captcha-v2-BorOWiz_.js → friendly-captcha-v2-76w-YnFm.js} +1 -1
  13. package/dist/chunks/{go-cardless-DwBgERcA.js → go-cardless-rwCkzbNK.js} +1 -1
  14. package/dist/chunks/{google-address-BcTBncyS.js → google-address-BD8IZ86V.js} +77 -58
  15. package/dist/chunks/{hcaptcha-BchdVCqq.js → hcaptcha-BNNTL6uf.js} +2 -2
  16. package/dist/chunks/{hidden-D8RqSPt7.js → hidden-CW6Rcf1N.js} +1 -1
  17. package/dist/chunks/{index-C1ZOKiAi.js → index-D6npYxvr.js} +1372 -1178
  18. package/dist/chunks/{loqate-nXuTX7In.js → loqate-B-ZNS65B.js} +2 -2
  19. package/dist/chunks/{mollie-qdCynQCd.js → mollie-BDAZ-1X4.js} +1 -1
  20. package/dist/chunks/{moneris-BNEA-laO.js → moneris-B1b0uEtY.js} +1 -1
  21. package/dist/chunks/{opayo-BJtXOkuK.js → opayo-CC5hraHo.js} +2 -2
  22. package/dist/chunks/{paddle-D72Pa8kr.js → paddle-B4GmrDsq.js} +2 -2
  23. package/dist/chunks/{paypal-Cqt2bned.js → paypal-BFS6XsIS.js} +2 -2
  24. package/dist/chunks/{payway-BjCqsc0H.js → payway-DekoJead.js} +2 -2
  25. package/dist/chunks/{phone-country-K9pYAlzM.js → phone-country-Cm5YUeXI.js} +2 -2
  26. package/dist/chunks/{place-kit-Dg6f_UoM.js → place-kit-DizZWV_e.js} +1 -1
  27. package/dist/chunks/{recaptcha-enterprise--VYAeeqz.js → recaptcha-enterprise-BbOvO7JZ.js} +2 -2
  28. package/dist/chunks/{recaptcha-shared-PSIEEEe1.js → recaptcha-shared-Dwg1eVFS.js} +2 -2
  29. package/dist/chunks/{recaptcha-v2-checkbox-atBNe5ml.js → recaptcha-v2-checkbox-SY3ti5iQ.js} +2 -2
  30. package/dist/chunks/{recaptcha-v2-invisible-DnBufNPT.js → recaptcha-v2-invisible-DSmQnn6c.js} +2 -2
  31. package/dist/chunks/{recaptcha-v3-CF6O8rDj.js → recaptcha-v3-DNh7YCnR.js} +2 -2
  32. package/dist/chunks/{repeater-CB7Yojvx.js → repeater-DM0vuFNQ.js} +2 -2
  33. package/dist/chunks/{rich-text-nAV_SQZo.js → rich-text-C8aGYp70.js} +1 -1
  34. package/dist/chunks/{scripts-BkAAux0i.js → scripts-CKTFtxPO.js} +1 -1
  35. package/dist/chunks/{shared-DGqeMvcJ.js → shared--BU5CFoL.js} +4 -4
  36. package/dist/chunks/{signature-BT6CsQ6n.js → signature-pFhZfH7d.js} +1 -1
  37. package/dist/chunks/{snaptcha-C7qQo02f.js → snaptcha-VuOUOaLj.js} +1 -1
  38. package/dist/chunks/{square-C5AH3trb.js → square-BR9pvToy.js} +4 -4
  39. package/dist/chunks/{stripe-EJK0RyUv.js → stripe-OHUwoV9g.js} +2 -2
  40. package/dist/chunks/{summary-DC_ipXCU.js → summary-Da7Ktg3N.js} +2 -2
  41. package/dist/chunks/{table-BEAI99qo.js → table-C0PmR9bI.js} +2 -2
  42. package/dist/chunks/text-limit-mLEwZDIa.js +144 -0
  43. package/dist/chunks/{turnstile-_uCRwnU-.js → turnstile-9tM7q_LK.js} +2 -2
  44. package/dist/css/theme/forms/_form.css +28 -0
  45. package/dist/index.js +9 -9
  46. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  47. package/dist/js/core/field-error-container.d.ts +4 -0
  48. package/dist/js/core/field-error-container.d.ts.map +1 -0
  49. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  50. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  51. package/dist/js/modules/address/google-address.d.ts +7 -0
  52. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  53. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  54. package/dist/js/modules/fields/conditions/effects.d.ts +3 -1
  55. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  56. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  57. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  58. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  59. package/dist/js/submit/pipeline.d.ts.map +1 -1
  60. package/dist/js/utils/i18n.d.ts.map +1 -1
  61. package/dist/js/validation/rules/email.d.ts.map +1 -1
  62. package/dist/js/validation/rules/number.d.ts.map +1 -1
  63. package/dist/js/validation/scope.d.ts +6 -0
  64. package/dist/js/validation/scope.d.ts.map +1 -0
  65. package/dist/js/validation/submit-readiness.d.ts +4 -0
  66. package/dist/js/validation/submit-readiness.d.ts.map +1 -0
  67. package/dist/js/validation/validator.d.ts +1 -0
  68. package/dist/js/validation/validator.d.ts.map +1 -1
  69. package/package.json +2 -2
  70. package/src/css/theme/forms/_form.css +28 -0
  71. package/src/js/core/create-formie-client.ts +6 -0
  72. package/src/js/core/field-error-container.ts +39 -0
  73. package/src/js/core/submit-result-state.ts +29 -2
  74. package/src/js/core/submit-result-ui.ts +3 -9
  75. package/src/js/modules/address/google-address.ts +33 -1
  76. package/src/js/modules/fields/checkbox-radio.ts +21 -15
  77. package/src/js/modules/fields/conditions/effects.ts +79 -2
  78. package/src/js/modules/fields/conditions.ts +53 -11
  79. package/src/js/modules/fields/file-upload.ts +200 -105
  80. package/src/js/modules/fields/text-limit.ts +87 -22
  81. package/src/js/submit/pipeline.ts +3 -28
  82. package/src/js/utils/i18n.ts +184 -5
  83. package/src/js/validation/rules/email.ts +3 -2
  84. package/src/js/validation/rules/match.ts +2 -2
  85. package/src/js/validation/rules/minmax.ts +4 -4
  86. package/src/js/validation/rules/number.ts +9 -5
  87. package/src/js/validation/rules/pattern.ts +4 -4
  88. package/src/js/validation/rules/required.ts +1 -1
  89. package/src/js/validation/rules/url.ts +1 -1
  90. package/src/js/validation/scope.ts +25 -0
  91. package/src/js/validation/submit-readiness.ts +157 -0
  92. package/src/js/validation/validator.ts +11 -7
  93. package/dist/chunks/file-upload-BDZZftgL.js +0 -281
  94. package/dist/chunks/text-limit-Blgq5G-G.js +0 -135
@@ -1,8 +1,8 @@
1
- import { S as j, A as U } from "./index-BEsfee-D.js";
2
- import { e as R } from "./shared-DGqeMvcJ.js";
3
- import { j as _, h as W } from "./index-C1ZOKiAi.js";
4
- const C = "[data-formie-conditions]";
5
- function G(e) {
1
+ import { S as te, A as re } from "./index-BEsfee-D.js";
2
+ import { e as V } from "./shared--BU5CFoL.js";
3
+ import { j as F, h as ne } from "./index-D6npYxvr.js";
4
+ const D = "[data-formie-conditions]";
5
+ function ie(e) {
6
6
  if (!e || typeof e != "object")
7
7
  return null;
8
8
  const t = e, r = t.transformerParams;
@@ -17,11 +17,11 @@ function G(e) {
17
17
  isValid: t.isValid !== !1
18
18
  };
19
19
  }
20
- function O(e) {
21
- const t = Array.from(e.querySelectorAll(C));
22
- return e.matches(C) ? [e, ...t] : t;
20
+ function $(e) {
21
+ const t = Array.from(e.querySelectorAll(D));
22
+ return e.matches(D) ? [e, ...t] : t;
23
23
  }
24
- function z(e) {
24
+ function se(e) {
25
25
  const t = e.getAttribute("data-formie-conditions");
26
26
  if (!t)
27
27
  return null;
@@ -29,13 +29,13 @@ function z(e) {
29
29
  const r = JSON.parse(t), n = Array.isArray(r.conditions) ? r.conditions.filter((i) => {
30
30
  if (!i || typeof i != "object")
31
31
  return !1;
32
- const o = i;
33
- return typeof o.field == "string" && typeof o.condition == "string";
32
+ const s = i;
33
+ return typeof s.field == "string" && typeof s.condition == "string";
34
34
  }).map((i) => {
35
- const o = i;
35
+ const s = i;
36
36
  return {
37
37
  field: i.field,
38
- source: G(o.source),
38
+ source: ie(s.source),
39
39
  condition: i.condition,
40
40
  value: i.value
41
41
  };
@@ -51,150 +51,162 @@ function z(e) {
51
51
  return console.error("[formie] Invalid condition JSON.", r), null;
52
52
  }
53
53
  }
54
- const I = "data-formie-conditions-disabled", H = "data-formie-preserve-disabled", x = "data-formie-conditionally-hidden", $ = "data-formie-page-hidden", J = "formie-conditionally-hidden", K = "formie-page-hidden", y = "data-formie-row-hidden", L = "formie-row-hidden", T = "data-formie-field-count", w = "[data-formie-row], [data-formie-subfield-row], [data-formie-nested-field-row]", Q = ":scope > [data-formie-field]";
55
- function X(e) {
54
+ const M = "data-formie-conditions-disabled", v = "data-formie-preserve-disabled", T = "data-formie-conditionally-hidden", C = "data-formie-page-hidden", O = "formie-conditionally-hidden", L = "fui-cp-muted-conditional-field", x = "fui-cp-muted-conditional-field--expanded", I = "data-formie-cp-muted", w = "formie-page-hidden", E = "data-formie-row-hidden", R = "formie-row-hidden", H = "data-formie-field-count", U = "[data-formie-row], [data-formie-subfield-row], [data-formie-nested-field-row]", oe = ":scope > [data-formie-field]";
55
+ function ae(e) {
56
56
  e.querySelectorAll("input, select, textarea").forEach((t) => {
57
57
  !(t instanceof HTMLInputElement) && !(t instanceof HTMLSelectElement) && !(t instanceof HTMLTextAreaElement) || (t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio" ? t.checked = !1 : t.type !== "hidden" && (t.value = "")), t instanceof HTMLSelectElement && (t.multiple ? Array.from(t.options).forEach((r) => {
58
58
  r.selected = !1;
59
59
  }) : t.selectedIndex = 0), t instanceof HTMLTextAreaElement && (t.value = ""));
60
60
  });
61
61
  }
62
- function Z(e, t) {
63
- const r = e.hasAttribute("data-formie-page"), n = r ? $ : x, i = r ? K : J, o = e.hasAttribute(n);
64
- return t ? (o || e.setAttribute(n, "true"), e.classList.contains(i) || e.classList.add(i)) : (o && e.removeAttribute(n), e.classList.contains(i) && e.classList.remove(i)), o !== t;
62
+ function ue(e, t) {
63
+ const r = e.hasAttribute("data-formie-page"), n = r ? C : T, i = r ? w : O, s = e.hasAttribute(n);
64
+ return t ? (s || e.setAttribute(n, "true"), e.classList.contains(i) || e.classList.add(i)) : (s && e.removeAttribute(n), e.classList.contains(i) && e.classList.remove(i)), s !== t;
65
65
  }
66
- function ee(e, t) {
66
+ function le(e, t) {
67
67
  e.querySelectorAll("input, textarea, select").forEach((r) => {
68
68
  if (t) {
69
- r.hasAttribute(I) || (r.hasAttribute("disabled") && r.setAttribute(H, "true"), r.setAttribute(I, "true")), r.setAttribute("disabled", "true");
69
+ r.hasAttribute(M) || (r.hasAttribute("disabled") && r.setAttribute(v, "true"), r.setAttribute(M, "true")), r.setAttribute("disabled", "true");
70
70
  return;
71
71
  }
72
- r.hasAttribute(I) && (r.hasAttribute(H) ? (r.setAttribute("disabled", "true"), r.removeAttribute(H)) : r.removeAttribute("disabled"), r.removeAttribute(I));
72
+ r.hasAttribute(M) && (r.hasAttribute(v) ? (r.setAttribute("disabled", "true"), r.removeAttribute(v)) : r.removeAttribute("disabled"), r.removeAttribute(M));
73
73
  });
74
74
  }
75
- function te(e) {
76
- return !e.hasAttribute(x) && !e.hasAttribute($) && !e.hasAttribute(y) && !e.hasAttribute("hidden");
75
+ function ce(e) {
76
+ return !e.hasAttribute(T) && !e.hasAttribute(C) && !e.hasAttribute(E) && !e.hasAttribute("hidden");
77
77
  }
78
- function re(e) {
79
- const r = Array.from(e.querySelectorAll(Q)).filter((n) => te(n)).length;
78
+ function fe(e) {
79
+ const r = Array.from(e.querySelectorAll(oe)).filter((n) => ce(n)).length;
80
80
  if (r > 0) {
81
81
  const n = String(r);
82
- e.getAttribute(T) !== n && e.setAttribute(T, n), e.hasAttribute(y) && e.removeAttribute(y), e.classList.contains(L) && e.classList.remove(L);
82
+ e.getAttribute(H) !== n && e.setAttribute(H, n), e.hasAttribute(E) && e.removeAttribute(E), e.classList.contains(R) && e.classList.remove(R);
83
83
  return;
84
84
  }
85
- e.hasAttribute(T) && e.removeAttribute(T), e.hasAttribute(y) || e.setAttribute(y, "true"), e.classList.contains(L) || e.classList.add(L);
85
+ e.hasAttribute(H) && e.removeAttribute(H), e.hasAttribute(E) || e.setAttribute(E, "true"), e.classList.contains(R) || e.classList.add(R);
86
+ }
87
+ function K(e) {
88
+ e.removeAttribute(I), e.classList.remove(L), e.classList.remove(x);
89
+ }
90
+ function B(e) {
91
+ e.removeAttribute(T), e.removeAttribute(C), e.classList.remove(O), e.classList.remove(w);
86
92
  }
87
- function ne(e) {
88
- let t = e.closest(w);
93
+ function Q(e) {
94
+ let t = e.closest(U);
89
95
  for (; t; )
90
- re(t), t = t.parentElement?.closest(w) || null;
96
+ fe(t), t = t.parentElement?.closest(U) || null;
91
97
  }
92
- function ie(e, t, r) {
93
- const n = Z(e, t);
94
- return ee(e, t), ne(e), t && r && n && X(e), n;
98
+ function de(e, t, r, n = {}) {
99
+ if (n.displayMode === "muted")
100
+ return me(e, t);
101
+ let i = !1;
102
+ return (e.hasAttribute(I) || e.classList.contains(L) || e.classList.contains(x)) && (K(e), i = !0), i = ue(e, t) || i, le(e, t), Q(e), t && r && i && ae(e), i;
95
103
  }
96
- const v = "input, select, textarea", oe = "[data-formie-repeater-item], [data-formie-table-row]";
97
- function g(e) {
104
+ function me(e, t) {
105
+ let r = !1;
106
+ return t ? ((e.hasAttribute(T) || e.hasAttribute(C) || e.classList.contains(O) || e.classList.contains(w)) && (B(e), r = !0), e.hasAttribute(I) || (e.setAttribute(I, "true"), r = !0), e.classList.contains(L) || (e.classList.add(L), r = !0)) : ((e.hasAttribute(I) || e.classList.contains(L) || e.classList.contains(x)) && (K(e), r = !0), (e.hasAttribute(T) || e.hasAttribute(C) || e.classList.contains(O) || e.classList.contains(w)) && (B(e), r = !0)), Q(e), r;
107
+ }
108
+ const X = "input, select, textarea", he = "[data-formie-repeater-item], [data-formie-table-row]";
109
+ function A(e) {
98
110
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
99
111
  }
100
- function se(e) {
101
- const t = e.querySelector(v);
112
+ function pe(e) {
113
+ const t = e.querySelector(X);
102
114
  if (!t)
103
115
  return null;
104
116
  const r = t.getAttribute("name") || "", n = Array.from(r.matchAll(/\[(\d+)\]/g));
105
117
  return n.length && n[n.length - 1]?.[1] || null;
106
118
  }
107
- function D(e) {
108
- return e.closest(oe);
119
+ function Y(e) {
120
+ return e.closest(he);
109
121
  }
110
- function ae(e) {
111
- return Array.from(e.querySelectorAll(v)).filter((t) => g(t));
122
+ function ge(e) {
123
+ return Array.from(e.querySelectorAll(X)).filter((t) => A(t));
112
124
  }
113
- function ue(e) {
125
+ function Ae(e) {
114
126
  const t = e.getAttribute("name") || "";
115
127
  return Array.from(t.matchAll(/\[([^\]]+)\]/g)).map((r) => r[1] || "").filter(Boolean);
116
128
  }
117
- function le(e, t) {
129
+ function be(e, t) {
118
130
  if (!t)
119
131
  return !0;
120
132
  const r = t.split(/[.:]/).filter(Boolean);
121
133
  if (!r.length)
122
134
  return !0;
123
- const n = ue(e);
124
- return n.length < r.length ? !1 : r.every((i, o) => n[n.length - r.length + o] === i);
135
+ const n = Ae(e);
136
+ return n.length < r.length ? !1 : r.every((i, s) => n[n.length - r.length + s] === i);
125
137
  }
126
- function ce(e, t) {
138
+ function ye(e, t) {
127
139
  if (!t)
128
140
  return e;
129
- const r = e.filter((n) => le(n, t));
141
+ const r = e.filter((n) => be(n, t));
130
142
  return r.length ? r : e;
131
143
  }
132
- function V(e, t) {
133
- const r = D(e);
144
+ function j(e, t) {
145
+ const r = Y(e);
134
146
  if (!r)
135
147
  return t;
136
- const n = t.filter((i) => D(i) === r);
148
+ const n = t.filter((i) => Y(i) === r);
137
149
  return n.length ? n : t;
138
150
  }
139
- function B(e) {
151
+ function Z(e) {
140
152
  return e.source?.target === "field" && e.source.handle ? e.source : null;
141
153
  }
142
- function P(e, t, r) {
143
- const n = B(r);
154
+ function W(e, t, r) {
155
+ const n = Z(r);
144
156
  if (!n || n.target !== "field" || !n.handle)
145
157
  return [];
146
- const i = R(n.handle), o = Array.from(e.querySelectorAll(`[data-formie-field-handle="${i}"]`));
147
- if (o.length)
148
- return V(t, o).flatMap((f) => ce(ae(f), n.selector));
149
- const l = _(n.handle), c = R(l), m = Array.from(e.querySelectorAll(`[name="${c}"]`)).filter((f) => g(f)), S = Array.from(e.querySelectorAll(`[name="${c}[]"]`)).filter((f) => g(f));
150
- if (m.length || S.length)
151
- return V(t, [...m, ...S]);
158
+ const i = V(n.handle), s = Array.from(e.querySelectorAll(`[data-formie-field-handle="${i}"]`));
159
+ if (s.length)
160
+ return j(t, s).flatMap((f) => ye(ge(f), n.selector));
161
+ const l = F(n.handle), c = V(l), h = Array.from(e.querySelectorAll(`[name="${c}"]`)).filter((f) => A(f)), d = Array.from(e.querySelectorAll(`[name="${c}[]"]`)).filter((f) => A(f));
162
+ if (h.length || d.length)
163
+ return j(t, [...h, ...d]);
152
164
  if (!n.handle.includes("__ROW__"))
153
165
  return [];
154
- const h = se(t);
155
- if (h) {
156
- const f = _(n.handle.replace(/__ROW__/g, h)), b = R(f), s = Array.from(e.querySelectorAll(`[name="${b}"]`)).filter((u) => g(u)), a = Array.from(e.querySelectorAll(`[name="${b}[]"]`)).filter((u) => g(u));
157
- if (s.length || a.length)
158
- return [...s, ...a];
166
+ const _ = pe(t);
167
+ if (_) {
168
+ const f = F(n.handle.replace(/__ROW__/g, _)), b = V(f), N = Array.from(e.querySelectorAll(`[name="${b}"]`)).filter((o) => A(o)), y = Array.from(e.querySelectorAll(`[name="${b}[]"]`)).filter((o) => A(o));
169
+ if (N.length || y.length)
170
+ return [...N, ...y];
159
171
  }
160
- const N = _(n.handle).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/__ROW__/g, "\\d+"), E = new RegExp(N);
161
- return Array.from(e.querySelectorAll("[name]")).filter((f) => g(f) && E.test(f.getAttribute("name") || ""));
172
+ const P = F(n.handle).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/__ROW__/g, "\\d+"), p = new RegExp(P);
173
+ return Array.from(e.querySelectorAll("[name]")).filter((f) => A(f) && p.test(f.getAttribute("name") || ""));
162
174
  }
163
- function fe(e) {
175
+ function Se(e) {
164
176
  return e == null ? "" : String(e);
165
177
  }
166
- function de(e) {
178
+ function Ee(e) {
167
179
  if (typeof e == "boolean")
168
180
  return e;
169
181
  if (typeof e == "number")
170
182
  return e !== 0;
171
- const t = fe(e).trim().toLowerCase();
183
+ const t = Se(e).trim().toLowerCase();
172
184
  return !(!t || ["0", "false", "no", "off"].includes(t));
173
185
  }
174
- function me(e) {
186
+ function Le(e) {
175
187
  return e.toLowerCase().replace(/\b\w/g, (t) => t.toUpperCase());
176
188
  }
177
- function he(e, t) {
178
- const r = Number.isFinite(Number(t.decimals)) ? Number(t.decimals) : 0, n = t.decimalPoint ?? ".", i = t.thousandsSeparator ?? ",", o = e.toFixed(r), [l, c = ""] = o.split("."), m = l.replace(/\B(?=(\d{3})+(?!\d))/g, i);
179
- return r === 0 ? m : `${m}${n}${c}`;
189
+ function Ie(e, t) {
190
+ const r = Number.isFinite(Number(t.decimals)) ? Number(t.decimals) : 0, n = t.decimalPoint ?? ".", i = t.thousandsSeparator ?? ",", s = e.toFixed(r), [l, c = ""] = s.split("."), h = l.replace(/\B(?=(\d{3})+(?!\d))/g, i);
191
+ return r === 0 ? h : `${h}${n}${c}`;
180
192
  }
181
- function A(e) {
193
+ function S(e) {
182
194
  return String(e).padStart(2, "0");
183
195
  }
184
- function pe(e, t) {
196
+ function Te(e, t) {
185
197
  return [
186
198
  ["Y", String(e.getFullYear())],
187
- ["m", A(e.getMonth() + 1)],
188
- ["d", A(e.getDate())],
199
+ ["m", S(e.getMonth() + 1)],
200
+ ["d", S(e.getDate())],
189
201
  ["j", String(e.getDate())],
190
- ["H", A(e.getHours())],
191
- ["h", A((e.getHours() + 11) % 12 + 1)],
192
- ["i", A(e.getMinutes())],
202
+ ["H", S(e.getHours())],
203
+ ["h", S((e.getHours() + 11) % 12 + 1)],
204
+ ["i", S(e.getMinutes())],
193
205
  ["A", e.getHours() >= 12 ? "PM" : "AM"],
194
206
  ["F", e.toLocaleString(void 0, { month: "long" })]
195
- ].reduce((n, [i, o]) => n.replaceAll(i, o), t);
207
+ ].reduce((n, [i, s]) => n.replaceAll(i, s), t);
196
208
  }
197
- function ge(e) {
209
+ function Ce(e) {
198
210
  switch (e) {
199
211
  case "datetimeUs12":
200
212
  return "m/d/Y h:i A";
@@ -220,7 +232,7 @@ function ge(e) {
220
232
  return "";
221
233
  }
222
234
  }
223
- function be(e, t) {
235
+ function _e(e, t) {
224
236
  const r = t.transformerId, n = t.transformerParams;
225
237
  switch (r) {
226
238
  case "round":
@@ -232,19 +244,19 @@ function be(e, t) {
232
244
  case "format": {
233
245
  const i = Number(e);
234
246
  if (Number.isFinite(i) && e.trim() !== "")
235
- return he(i, n);
236
- const o = n.preset || "", l = o === "custom" ? n.pattern || "" : ge(o);
247
+ return Ie(i, n);
248
+ const s = n.preset || "", l = s === "custom" ? n.pattern || "" : Ce(s);
237
249
  if (!l)
238
250
  return e;
239
251
  const c = new Date(e);
240
- return Number.isNaN(c.getTime()) ? e : pe(c, l);
252
+ return Number.isNaN(c.getTime()) ? e : Te(c, l);
241
253
  }
242
254
  case "lower":
243
255
  return e.toLowerCase();
244
256
  case "upper":
245
257
  return e.toUpperCase();
246
258
  case "title":
247
- return me(e);
259
+ return Le(e);
248
260
  case "capitalize":
249
261
  return e && e.charAt(0).toUpperCase() + e.slice(1);
250
262
  case "replace": {
@@ -252,182 +264,196 @@ function be(e, t) {
252
264
  return i ? e.split(i).join(n.replace || "") : e;
253
265
  }
254
266
  case "truncate": {
255
- const i = Math.max(1, Number.parseInt(n.length || "50", 10) || 50), o = n.suffix || "...";
256
- return e.length <= i ? e : `${e.slice(0, Math.max(0, i - o.length))}${o}`;
267
+ const i = Math.max(1, Number.parseInt(n.length || "50", 10) || 50), s = n.suffix || "...";
268
+ return e.length <= i ? e : `${e.slice(0, Math.max(0, i - s.length))}${s}`;
257
269
  }
258
270
  case "map":
259
- return de(e) ? n.trueLabel || "Yes" : n.falseLabel || "No";
271
+ return Ee(e) ? n.trueLabel || "Yes" : n.falseLabel || "No";
260
272
  default:
261
273
  return e;
262
274
  }
263
275
  }
264
- function Ae(e, t) {
276
+ function Ne(e, t) {
265
277
  if (!t)
266
278
  return e;
267
- const r = t.transformerId ? e.map((n) => be(n, t)) : e;
279
+ const r = t.transformerId ? e.map((n) => _e(n, t)) : e;
268
280
  return (r.length === 0 || r.every((n) => n.trim() === "")) && t.defaultValue ? [t.defaultValue] : r;
269
281
  }
270
- function ye(e, t) {
282
+ function Me(e, t) {
271
283
  return e.name || `__condition_input_${t}`;
272
284
  }
273
- function F(e) {
285
+ function G(e) {
274
286
  const t = e.id ? e.ownerDocument.querySelector(`label[for="${e.id}"]`)?.textContent?.trim() : "";
275
287
  return t || e.closest("label")?.textContent?.trim() || "";
276
288
  }
277
- function Se(e, t = "") {
289
+ function Re(e, t = "") {
278
290
  const r = e[0];
279
291
  if (!r)
280
292
  return [];
281
293
  if (r instanceof HTMLInputElement) {
282
294
  if (r.type === "checkbox") {
283
295
  const n = e.filter((i) => i instanceof HTMLInputElement && i.checked);
284
- return t === "label" ? n.map((i) => F(i)).filter(Boolean) : n.map((i) => i.value);
296
+ return t === "label" ? n.map((i) => G(i)).filter(Boolean) : n.map((i) => i.value);
285
297
  }
286
298
  if (r.type === "radio") {
287
299
  const n = e.filter((i) => i instanceof HTMLInputElement && i.checked);
288
- return t === "label" ? n.map((i) => F(i)).filter(Boolean) : n.map((i) => i.value);
300
+ return t === "label" ? n.map((i) => G(i)).filter(Boolean) : n.map((i) => i.value);
289
301
  }
290
302
  if (r.type === "file")
291
303
  return Array.from(r.files || []).map((n) => n.name);
292
304
  }
293
305
  return r instanceof HTMLSelectElement && r.multiple ? t === "label" ? Array.from(r.selectedOptions).map((n) => n.label || n.text) : Array.from(r.selectedOptions).map((n) => n.value) : r instanceof HTMLSelectElement && t === "label" ? Array.from(r.selectedOptions).map((n) => n.label || n.text) : e.map((n) => n.value);
294
306
  }
295
- function k(e) {
307
+ function z(e) {
296
308
  return ["input", "change"];
297
309
  }
298
- function Ee(e, t = null) {
310
+ function He(e, t = null) {
299
311
  const r = /* @__PURE__ */ new Map();
300
- e.forEach((i, o) => {
301
- const l = ye(i, o), c = r.get(l) || [];
312
+ e.forEach((i, s) => {
313
+ const l = Me(i, s), c = r.get(l) || [];
302
314
  c.push(i), r.set(l, c);
303
315
  });
304
- const n = Array.from(r.values()).flatMap((i) => Se(i, t?.selector || ""));
305
- return Ae(n, t);
316
+ const n = Array.from(r.values()).flatMap((i) => Re(i, t?.selector || ""));
317
+ return Ne(n, t);
306
318
  }
307
- function Ie(e) {
319
+ function De(e) {
308
320
  return e.closest("[data-formie-conditionally-hidden]") || e.closest("[data-formie-page-hidden]") || e.closest("[hidden]") || e.closest('[aria-hidden="true"]') ? !1 : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
309
321
  }
310
- function Le(e) {
311
- return e.length ? e.some((t) => Ie(t)) : null;
322
+ function Oe(e) {
323
+ return e.length ? e.some((t) => De(t)) : null;
312
324
  }
313
- function Te(e, t) {
325
+ function we(e, t) {
314
326
  const r = e.conditions.map((n) => {
315
- const i = t(n), o = B(n);
316
- return j(n, Ee(i, o), {
317
- visibility: Le(i)
327
+ const i = t(n), s = Z(n);
328
+ return te(n, He(i, s), {
329
+ visibility: Oe(i)
318
330
  });
319
331
  });
320
- return U(e, r);
332
+ return re(e, r);
321
333
  }
322
- const M = 4, p = W("conditions");
323
- function q(e) {
334
+ const q = 4, g = ne("conditions");
335
+ function J(e) {
324
336
  const t = /* @__PURE__ */ new Set();
325
337
  return e.filter((r) => t.has(r) ? !1 : (t.add(r), !0));
326
338
  }
327
- const _e = {
339
+ const ve = {
328
340
  id: "conditions",
329
341
  kind: "field",
330
- match: (e) => e.target instanceof HTMLElement && (e.target.matches(C) || !!e.target.querySelector(C)),
342
+ match: (e) => e.target instanceof HTMLElement && (e.target.matches(D) || !!e.target.querySelector(D)),
331
343
  setup: async (e) => {
332
344
  const t = e.target instanceof HTMLElement ? e.target : e.root;
333
- if (!O(t).length) {
334
- p.log("No condition nodes in scope.");
345
+ if (!$(t).length) {
346
+ g.log("No condition nodes in scope.");
335
347
  return;
336
348
  }
337
349
  const r = [];
338
- let n = [], i = !1, o = !1;
350
+ let n = [], i = !1, s = !1;
339
351
  const l = () => {
340
- r.forEach((s) => {
341
- s();
352
+ r.forEach((o) => {
353
+ o();
342
354
  }), r.length = 0;
343
- }, c = () => O(t).flatMap((s) => {
344
- const a = z(s);
355
+ }, c = () => $(t).flatMap((o) => {
356
+ const a = se(o);
345
357
  if (!a || !a.conditions.length)
346
358
  return [];
347
- const u = q(a.conditions.flatMap((d) => P(t, s, d)));
359
+ const u = J(a.conditions.flatMap((m) => W(t, o, m)));
348
360
  return [{
349
- node: s,
361
+ node: o,
350
362
  settings: a,
351
363
  sourceInputs: u
352
364
  }];
353
- }), m = () => {
354
- let s = !1;
365
+ }), h = e.options?.cpDisplayMode === "muted" ? "muted" : "hide";
366
+ let d = !1;
367
+ const _ = () => {
368
+ let o = !1;
355
369
  return n.forEach((a) => {
356
- const u = Te(a.settings, (Y) => P(t, a.node, Y)), d = ie(a.node, u.shouldHide, a.settings.clearOnHide);
357
- s = s || d, p.log("Condition evaluated.", {
370
+ const u = we(a.settings, (ee) => W(t, a.node, ee)), m = a.node.hasAttribute("data-formie-page") ? "hide" : h, k = de(
371
+ a.node,
372
+ u.shouldHide,
373
+ a.settings.clearOnHide,
374
+ { displayMode: m }
375
+ );
376
+ o = o || k, g.log("Condition evaluated.", {
358
377
  shouldHide: u.shouldHide,
359
378
  finalResult: u.finalResult,
360
- stateChanged: d
379
+ stateChanged: k
361
380
  }), e.emit("formie:conditions:evaluated", {
362
381
  node: a.node,
363
382
  shouldHide: u.shouldHide,
364
383
  finalResult: u.finalResult,
365
384
  clearOnHide: a.settings.clearOnHide
366
385
  });
367
- }), s;
368
- }, S = () => {
369
- for (let s = 0; s < M && m(); s += 1)
370
- s === M - 1 && p.warn("Reached max evaluation passes.", { maxPasses: M });
371
- }, h = () => {
372
- i || (i = !0, queueMicrotask(() => {
373
- i = !1, S();
386
+ }), o;
387
+ }, P = () => {
388
+ if (!d) {
389
+ d = !0;
390
+ try {
391
+ for (let o = 0; o < q && _(); o += 1)
392
+ o === q - 1 && g.warn("Reached max evaluation passes.", { maxPasses: q });
393
+ } finally {
394
+ d = !1;
395
+ }
396
+ }
397
+ }, p = () => {
398
+ d || i || (i = !0, requestAnimationFrame(() => {
399
+ i = !1, !d && P();
374
400
  }));
375
- }, N = () => {
376
- if (q(n.flatMap((s) => s.sourceInputs)).forEach((s) => {
401
+ }, f = () => {
402
+ if (J(n.flatMap((o) => o.sourceInputs)).forEach((o) => {
377
403
  const a = () => {
378
- h();
404
+ p();
379
405
  };
380
- k().forEach((u) => {
381
- s.addEventListener(u, a);
406
+ z().forEach((u) => {
407
+ o.addEventListener(u, a);
382
408
  }), r.push(() => {
383
- k().forEach((u) => {
384
- s.removeEventListener(u, a);
409
+ z().forEach((u) => {
410
+ o.removeEventListener(u, a);
385
411
  });
386
412
  });
387
413
  }), e.form) {
388
- const s = () => {
414
+ const o = () => {
389
415
  window.setTimeout(() => {
390
- h();
416
+ p();
391
417
  }, 0);
392
418
  };
393
- e.form.addEventListener("reset", s), r.push(() => {
394
- e.form?.removeEventListener("reset", s);
419
+ e.form.addEventListener("reset", o), r.push(() => {
420
+ e.form?.removeEventListener("reset", o);
395
421
  });
396
422
  }
397
- }, E = () => {
398
- l(), n = c(), N(), p.log("Rebuilt condition graph.", {
423
+ }, b = () => {
424
+ l(), n = c(), f(), g.log("Rebuilt condition graph.", {
399
425
  entryCount: n.length
400
- }), h();
401
- }, f = () => {
402
- o || (o = !0, queueMicrotask(() => {
403
- o = !1, E();
426
+ }), p();
427
+ }, N = () => {
428
+ d || s || (s = !0, requestAnimationFrame(() => {
429
+ s = !1, !d && b();
404
430
  }));
405
- }, b = new MutationObserver((s) => {
406
- const a = s.some((d) => d.type === "childList" && (d.addedNodes.length > 0 || d.removedNodes.length > 0)), u = s.some((d) => d.type === "attributes");
407
- a ? f() : u && h();
431
+ }, y = new MutationObserver((o) => {
432
+ if (d)
433
+ return;
434
+ const a = o.some((m) => m.type === "childList" && (m.addedNodes.length > 0 || m.removedNodes.length > 0)), u = o.some((m) => m.type === "attributes");
435
+ a ? N() : u && p();
408
436
  });
409
- return b.observe(t, {
437
+ return y.observe(t, {
410
438
  childList: !0,
411
439
  subtree: !0,
412
440
  attributes: !0,
413
441
  attributeFilter: [
414
- "class",
415
- "style",
416
442
  "hidden",
417
443
  "aria-hidden",
418
444
  "data-formie-conditionally-hidden",
419
445
  "data-formie-page-hidden",
420
446
  "data-formie-row-hidden"
421
447
  ]
422
- }), E(), await e.emit("formie:module:conditions:init", {
448
+ }), b(), await e.emit("formie:module:conditions:init", {
423
449
  count: n.length
424
- }), p.log("Module setup complete.", { entryCount: n.length }), {
450
+ }), g.log("Module setup complete.", { entryCount: n.length }), {
425
451
  destroy: () => {
426
- l(), b.disconnect(), p.log("Module destroy."), e.emit("formie:module:conditions:destroy", {});
452
+ l(), y.disconnect(), g.log("Module destroy."), e.emit("formie:module:conditions:destroy", {});
427
453
  }
428
454
  };
429
455
  }
430
456
  };
431
457
  export {
432
- _e as conditionsModule
458
+ ve as conditionsModule
433
459
  };
@@ -1,6 +1,6 @@
1
- import { g as st, d as Qn } from "./shared-DGqeMvcJ.js";
1
+ import { g as st, d as Qn } from "./shared--BU5CFoL.js";
2
2
  import { e as ft } from "./styles-C3aqgtek.js";
3
- import { h as ut } from "./index-C1ZOKiAi.js";
3
+ import { h as ut } from "./index-D6npYxvr.js";
4
4
  function ct(a, i) {
5
5
  for (var e = 0; e < i.length; e++) {
6
6
  const u = i[e];
@@ -1,5 +1,5 @@
1
- import { u as f, w } from "./index-C1ZOKiAi.js";
2
- import { l as m } from "./scripts-BkAAux0i.js";
1
+ import { v as f, w } from "./index-D6npYxvr.js";
2
+ import { l as m } from "./scripts-CKTFtxPO.js";
3
3
  const s = [
4
4
  {
5
5
  id: "FORMIE_EWAY_SCRIPT_MIN",