@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,4 +1,4 @@
1
- const Pr = [
1
+ const Dr = [
2
2
  { legacyEvent: "onFormieLoaded", canonicalEvent: "formie:mount:after", disposition: "approximate", target: "document" },
3
3
  { legacyEvent: "onFormieInit", canonicalEvent: "formie:mount:after", disposition: "approximate", target: "document" },
4
4
  { legacyEvent: "onFormieReady", canonicalEvent: "formie:mount:after", disposition: "safe" },
@@ -9,13 +9,13 @@ const Pr = [
9
9
  { legacyEvent: "onFormieValidate", canonicalEvent: "formie:stage:validate:before", disposition: "approximate" },
10
10
  { legacyEvent: "onAfterFormieValidate", canonicalEvent: "formie:stage:validate:after", disposition: "approximate" },
11
11
  { legacyEvent: "onFormieSubmit", canonicalEvent: "formie:submit:after", disposition: "approximate" }
12
- ], Uo = [
12
+ ], oa = [
13
13
  { legacyEvent: "formieValidatorInitialized", canonicalEvent: "formie:validator:ready", disposition: "safe" },
14
14
  { legacyEvent: "formieValidatorDestroyed", canonicalEvent: "formie:validator:destroy", disposition: "safe" },
15
15
  { legacyEvent: "formieValidatorShowError", canonicalEvent: "formie:validator:show-error", disposition: "safe" },
16
16
  { legacyEvent: "formieValidatorClearError", canonicalEvent: "formie:validator:clear-error", disposition: "safe" }
17
17
  ];
18
- function $r(e) {
18
+ function xr(e) {
19
19
  if (!e)
20
20
  return {
21
21
  enabled: !1,
@@ -35,7 +35,7 @@ function $r(e) {
35
35
  legacyValidatorEvents: r
36
36
  };
37
37
  }
38
- const Vr = [
38
+ const Nr = [
39
39
  "formie:mount:after",
40
40
  "formie:unmount:before",
41
41
  "formie:unmount:after",
@@ -53,49 +53,49 @@ const Vr = [
53
53
  "formie:refresh-tokens:after",
54
54
  "formie:refresh-tokens:refreshed"
55
55
  ];
56
- function Ne(e) {
56
+ function Be(e) {
57
57
  return e;
58
58
  }
59
- function zo(e) {
59
+ function aa(e) {
60
60
  return e;
61
61
  }
62
- function jo(e, t) {
62
+ function sa(e, t) {
63
63
  return `formie:field:${e}:${t}`;
64
64
  }
65
65
  function pe(e) {
66
66
  return `formie:validator:${e}`;
67
67
  }
68
- function Bo(e, t) {
68
+ function la(e, t) {
69
69
  return `formie:address:${e}:${t}`;
70
70
  }
71
- function Wo(e) {
71
+ function ua(e) {
72
72
  return `formie:file-upload:${e}`;
73
73
  }
74
- function Ko(e, t) {
74
+ function ca(e, t) {
75
75
  return `formie:payment:${e}:${t}`;
76
76
  }
77
- function Ue(e) {
77
+ function je(e) {
78
78
  return `formie:state:${e}`;
79
79
  }
80
- function Or(e, t) {
80
+ function Ur(e, t) {
81
81
  return `formie:module:${e}:${t}`;
82
82
  }
83
- function Hr(e) {
83
+ function Br(e) {
84
84
  return `formie:module:${e}`;
85
85
  }
86
- function _r(e, t, r) {
86
+ function jr(e, t, r) {
87
87
  e.dispatchEvent(new CustomEvent(t, {
88
88
  bubbles: !0,
89
89
  detail: r
90
90
  }));
91
91
  }
92
- function Dr(e, t) {
92
+ function zr(e, t) {
93
93
  if (e.canonicalEvent !== "formie:submit:result")
94
94
  return !0;
95
95
  const r = t;
96
96
  return e.legacyEvent === "onAfterFormieSubmit" ? !!r?.ok : e.legacyEvent === "onFormieSubmitError" ? r?.ok === !1 : !0;
97
97
  }
98
- function xr(e, t) {
98
+ function Wr(e, t) {
99
99
  const r = t && typeof t == "object" ? t : {}, n = typeof r.pageId == "string" ? r.pageId : "", i = Array.from(e.querySelectorAll("[data-formie-page-id]")), o = i.findIndex((a) => a.getAttribute("data-formie-page-id") === n);
100
100
  return {
101
101
  data: {
@@ -105,7 +105,7 @@ function xr(e, t) {
105
105
  }
106
106
  };
107
107
  }
108
- function Nr(e, t, r, n, i) {
108
+ function Kr(e, t, r, n, i) {
109
109
  const o = globalThis.Formie || i;
110
110
  return e.legacyEvent === "onFormieLoaded" ? {
111
111
  formie: o
@@ -119,24 +119,24 @@ function Nr(e, t, r, n, i) {
119
119
  form: n,
120
120
  target: r,
121
121
  instance: i
122
- } : e.legacyEvent === "onFormiePageToggle" ? xr(n, t) : t;
122
+ } : e.legacyEvent === "onFormiePageToggle" ? Wr(n, t) : t;
123
123
  }
124
- function Ur({
124
+ function Gr({
125
125
  target: e,
126
126
  form: t,
127
127
  instance: r,
128
128
  options: n,
129
129
  unbinds: i
130
130
  }) {
131
- n.legacyDomEvents && Pr.forEach((o) => {
131
+ n.legacyDomEvents && Dr.forEach((o) => {
132
132
  const a = (s) => {
133
- if (!(s instanceof CustomEvent) || !Dr(o, s.detail))
133
+ if (!(s instanceof CustomEvent) || !zr(o, s.detail))
134
134
  return;
135
135
  const l = o.target === "document" ? document : t;
136
- _r(l, o.legacyEvent, Nr(o, s.detail, e, t, r));
136
+ jr(l, o.legacyEvent, Kr(o, s.detail, e, t, r));
137
137
  };
138
- e.addEventListener(Ne(o.canonicalEvent), a), i.push(() => {
139
- e.removeEventListener(Ne(o.canonicalEvent), a);
138
+ e.addEventListener(Be(o.canonicalEvent), a), i.push(() => {
139
+ e.removeEventListener(Be(o.canonicalEvent), a);
140
140
  });
141
141
  });
142
142
  }
@@ -146,10 +146,10 @@ function ge(e, t, r) {
146
146
  detail: r
147
147
  }));
148
148
  }
149
- function $e(e, t) {
149
+ function Oe(e, t) {
150
150
  return !!e && typeof e == "object" && e.validator === t;
151
151
  }
152
- function zr({
152
+ function Jr({
153
153
  target: e,
154
154
  form: t,
155
155
  validatorDetail: r,
@@ -164,49 +164,49 @@ function zr({
164
164
  target: e
165
165
  };
166
166
  ge(document, "formieValidatorInitialized", l);
167
- const d = (c) => {
168
- !(c instanceof CustomEvent) || !$e(c.detail, o) || ge(document, "formieValidatorDestroyed", {
167
+ const d = (u) => {
168
+ !(u instanceof CustomEvent) || !Oe(u.detail, o) || ge(document, "formieValidatorDestroyed", {
169
169
  ...l,
170
- ...c.detail
170
+ ...u.detail
171
171
  });
172
- }, p = (c) => {
173
- !(c instanceof CustomEvent) || !$e(c.detail, o) || !(c.target instanceof Element) || t.contains(c.target) && ge(c.target, "formieValidatorShowError", {
174
- ...c.detail,
172
+ }, p = (u) => {
173
+ !(u instanceof CustomEvent) || !Oe(u.detail, o) || !(u.target instanceof Element) || t.contains(u.target) && ge(u.target, "formieValidatorShowError", {
174
+ ...u.detail,
175
175
  addValidator: a,
176
176
  removeValidator: s,
177
177
  form: t,
178
178
  target: e
179
179
  });
180
- }, y = (c) => {
181
- !(c instanceof CustomEvent) || !$e(c.detail, o) || !(c.target instanceof Element) || t.contains(c.target) && ge(c.target, "formieValidatorClearError", {
182
- ...c.detail,
180
+ }, h = (u) => {
181
+ !(u instanceof CustomEvent) || !Oe(u.detail, o) || !(u.target instanceof Element) || t.contains(u.target) && ge(u.target, "formieValidatorClearError", {
182
+ ...u.detail,
183
183
  addValidator: a,
184
184
  removeValidator: s,
185
185
  form: t,
186
186
  target: e
187
187
  });
188
188
  };
189
- document.addEventListener("formie:validator:destroy", d), document.addEventListener("formie:validator:show-error", p), document.addEventListener("formie:validator:clear-error", y), i.push(() => {
190
- document.removeEventListener("formie:validator:destroy", d), document.removeEventListener("formie:validator:show-error", p), document.removeEventListener("formie:validator:clear-error", y);
189
+ document.addEventListener("formie:validator:destroy", d), document.addEventListener("formie:validator:show-error", p), document.addEventListener("formie:validator:clear-error", h), i.push(() => {
190
+ document.removeEventListener("formie:validator:destroy", d), document.removeEventListener("formie:validator:show-error", p), document.removeEventListener("formie:validator:clear-error", h);
191
191
  });
192
192
  }
193
193
  function I(e, t, r) {
194
- e.dispatchEvent(new CustomEvent(Ne(t), {
194
+ e.dispatchEvent(new CustomEvent(Be(t), {
195
195
  bubbles: !0,
196
196
  detail: r
197
197
  }));
198
198
  }
199
- function Ut() {
199
+ function zt() {
200
200
  return globalThis;
201
201
  }
202
- function zt() {
203
- return Ut().__FORMIE_DEBUG__ === !0;
202
+ function Wt() {
203
+ return zt().__FORMIE_DEBUG__ === !0;
204
204
  }
205
- function Go(e) {
206
- Ut().__FORMIE_DEBUG__ = e;
205
+ function da(e) {
206
+ zt().__FORMIE_DEBUG__ = e;
207
207
  }
208
- function jr(e, t, r) {
209
- if (zt()) {
208
+ function Yr(e, t, r) {
209
+ if (Wt()) {
210
210
  if (typeof r > "u") {
211
211
  console.log(`[formie:${e}] ${t}`);
212
212
  return;
@@ -214,8 +214,8 @@ function jr(e, t, r) {
214
214
  console.log(`[formie:${e}] ${t}`, r);
215
215
  }
216
216
  }
217
- function Br(e, t, r) {
218
- if (zt()) {
217
+ function Zr(e, t, r) {
218
+ if (Wt()) {
219
219
  if (typeof r > "u") {
220
220
  console.warn(`[formie:${e}] ${t}`);
221
221
  return;
@@ -227,117 +227,117 @@ function _(e, t) {
227
227
  const r = t ? `${e}:${t}` : e;
228
228
  return {
229
229
  log: (n, i) => {
230
- jr(r, n, i);
230
+ Yr(r, n, i);
231
231
  },
232
232
  warn: (n, i) => {
233
- Br(r, n, i);
233
+ Zr(r, n, i);
234
234
  }
235
235
  };
236
236
  }
237
- const ve = _("general", "page-client-event"), Wr = "data-formie-client-event";
238
- function Kr(e) {
237
+ const Ee = _("general", "page-client-event"), Qr = "data-formie-client-event";
238
+ function Xr(e) {
239
239
  return typeof window < "u" && window.CSS?.escape ? window.CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
240
240
  }
241
- function Gr(e) {
241
+ function en(e) {
242
242
  const r = e.querySelector('input[name="pageId"]')?.value?.trim();
243
243
  if (r)
244
244
  return r;
245
245
  const i = e.querySelector("[data-formie-page]:not([data-formie-page-hidden])")?.getAttribute("data-formie-page-id")?.trim();
246
246
  return i || e.querySelector("[data-formie-page]")?.getAttribute("data-formie-page-id")?.trim() || null;
247
247
  }
248
- function Jr(e) {
248
+ function tn(e) {
249
249
  if (!e?.trim())
250
250
  return null;
251
251
  try {
252
252
  const t = JSON.parse(e);
253
253
  return t && typeof t == "object" ? t : null;
254
254
  } catch {
255
- return ve.warn("Invalid data-formie-client-event JSON.", {
255
+ return Ee.warn("Invalid data-formie-client-event JSON.", {
256
256
  rawPreview: e.slice(0, 80)
257
257
  }), null;
258
258
  }
259
259
  }
260
- function Yr(e) {
260
+ function rn(e) {
261
261
  const t = {};
262
262
  return e.forEach((r) => {
263
263
  const n = typeof r.label == "string" ? r.label.trim() : "";
264
264
  n && (t[n] = typeof r.value == "string" ? r.value : "");
265
265
  }), t;
266
266
  }
267
- function jt(e, t) {
267
+ function Kt(e, t) {
268
268
  if (t !== "submit")
269
269
  return;
270
- const r = Gr(e);
270
+ const r = en(e);
271
271
  if (!r) {
272
- ve.log("No submitted page id; skipping client event.");
272
+ Ee.log("No submitted page id; skipping client event.");
273
273
  return;
274
274
  }
275
275
  const n = e.querySelector(
276
- `[data-formie-page][data-formie-page-id="${Kr(r)}"]`
276
+ `[data-formie-page][data-formie-page-id="${Xr(r)}"]`
277
277
  );
278
278
  if (!n) {
279
- ve.log("No page section for id; skipping client event.", { pageId: r });
279
+ Ee.log("No page section for id; skipping client event.", { pageId: r });
280
280
  return;
281
281
  }
282
- const i = n.getAttribute(Wr);
282
+ const i = n.getAttribute(Qr);
283
283
  if (i === null)
284
284
  return;
285
- const o = Jr(i);
285
+ const o = tn(i);
286
286
  if (!o || !Array.isArray(o.fields))
287
287
  return;
288
- const a = Yr(o.fields), s = window;
288
+ const a = rn(o.fields), s = window;
289
289
  s.dataLayer = s.dataLayer || [], s.dataLayer.push(a), e.dispatchEvent(new CustomEvent("formie:client-event", {
290
290
  bubbles: !0,
291
291
  detail: { payload: a }
292
- })), ve.log("Dispatched page client event.", {
292
+ })), Ee.log("Dispatched page client event.", {
293
293
  pageId: r,
294
294
  keys: Object.keys(a)
295
295
  });
296
296
  }
297
- const Ae = /* @__PURE__ */ new WeakMap(), Zr = "[data-formie-form], [data-formie], form";
298
- function Qr(e) {
297
+ const we = /* @__PURE__ */ new WeakMap(), nn = "[data-formie-form], [data-formie], form";
298
+ function on(e) {
299
299
  return e ? (Array.isArray(e) ? e : [e]).flatMap((r) => String(r).split(/\s+/)).map((r) => r.trim()).filter(Boolean) : [];
300
300
  }
301
- function Xe(e) {
301
+ function tt(e) {
302
302
  return Array.from(new Set(e));
303
303
  }
304
- function Xr(e) {
304
+ function an(e) {
305
305
  if (!e)
306
306
  return {};
307
- const t = Ae.get(e);
307
+ const t = we.get(e);
308
308
  if (t)
309
309
  return t;
310
- const r = e.closest(Zr);
311
- return r ? Ae.get(r) || {} : {};
310
+ const r = e.closest(nn);
311
+ return r ? we.get(r) || {} : {};
312
312
  }
313
- function en(e) {
313
+ function sn(e) {
314
314
  const t = {};
315
315
  return Object.entries(e || {}).forEach(([r, n]) => {
316
- const i = Xe(Qr(n));
316
+ const i = tt(on(n));
317
317
  i.length && (t[r] = i);
318
318
  }), t;
319
319
  }
320
- function gt(e, t, r) {
321
- const n = en(t), i = r || (e instanceof HTMLFormElement ? e : e.querySelector("form"));
322
- return Ae.set(e, n), i && Ae.set(i, n), n;
320
+ function yt(e, t, r) {
321
+ const n = sn(t), i = r || (e instanceof HTMLFormElement ? e : e.querySelector("form"));
322
+ return we.set(e, n), i && we.set(i, n), n;
323
323
  }
324
- function et(e, t) {
325
- return Xr(e)[t] || [];
324
+ function rt(e, t) {
325
+ return an(e)[t] || [];
326
326
  }
327
- function V(e, t, ...r) {
328
- const n = Xe(r.flatMap((i) => et(t, i)));
327
+ function O(e, t, ...r) {
328
+ const n = tt(r.flatMap((i) => rt(t, i)));
329
329
  n.length && e.classList.add(...n);
330
330
  }
331
331
  function le(e, t, ...r) {
332
- const n = Xe(r.flatMap((i) => et(t, i)));
332
+ const n = tt(r.flatMap((i) => rt(t, i)));
333
333
  n.length && e.classList.remove(...n);
334
334
  }
335
335
  function ue(e, t, r, n) {
336
- et(t, r).forEach((i) => {
336
+ rt(t, r).forEach((i) => {
337
337
  e.classList.toggle(i, n);
338
338
  });
339
339
  }
340
- function tn(e, t) {
340
+ function ln(e, t) {
341
341
  if (ue(e, e, "tabError", t), t) {
342
342
  e.setAttribute("data-formie-tab-error", "true");
343
343
  return;
@@ -351,10 +351,10 @@ function J(e) {
351
351
  i && n.querySelector("[data-formie-field-has-error]") && t.add(i);
352
352
  }), e.querySelectorAll("[data-formie-tab]").forEach((r) => {
353
353
  const n = r, i = n.getAttribute("data-formie-page-id");
354
- tn(n, !!i && t.has(i));
354
+ ln(n, !!i && t.has(i));
355
355
  });
356
356
  }
357
- class Bt {
357
+ class Gt {
358
358
  constructor() {
359
359
  this.listeners = /* @__PURE__ */ new Map();
360
360
  }
@@ -414,7 +414,7 @@ class Bt {
414
414
  this.listeners.clear();
415
415
  }
416
416
  }
417
- async function Wt(e, t = {}) {
417
+ async function Jt(e, t = {}) {
418
418
  const r = {
419
419
  Accept: "application/json",
420
420
  ...t.headers || {}
@@ -432,42 +432,42 @@ async function Wt(e, t = {}) {
432
432
  credentials: "same-origin"
433
433
  });
434
434
  }
435
- async function Ie(e, t = {}) {
436
- const r = await Wt(e, t);
435
+ async function Re(e, t = {}) {
436
+ const r = await Jt(e, t);
437
437
  if (!r.ok)
438
438
  throw new Error(`Request failed (${r.status}) for ${String(e)}`);
439
439
  return r.json();
440
440
  }
441
- async function Jo(e, t = {}) {
442
- const r = await Wt(e, t);
441
+ async function fa(e, t = {}) {
442
+ const r = await Jt(e, t);
443
443
  if (!r.ok)
444
444
  throw new Error(`Request failed (${r.status}) for ${String(e)}`);
445
445
  return r.text();
446
446
  }
447
447
  const H = _("general", "transport");
448
- function rn(e) {
448
+ function un(e) {
449
449
  const t = {};
450
450
  return ["theme", "themeConfig", "locale", "siteId"].forEach((r) => {
451
451
  e[r] !== void 0 && (t[r] = e[r]);
452
452
  }), t;
453
453
  }
454
- function Kt(e, t = "", r = {}) {
454
+ function Yt(e, t = "", r = {}) {
455
455
  if (Array.isArray(e)) {
456
456
  const n = e.map((i) => typeof i == "string" ? i : String(i ?? "")).filter((i) => i.trim() !== "");
457
457
  return t && n.length && (r[t] = (r[t] || []).concat(n)), r;
458
458
  }
459
459
  return e && typeof e == "object" && Object.entries(e).forEach(([n, i]) => {
460
460
  const o = t ? `${t}.${n}` : n;
461
- Kt(i, o, r);
461
+ Yt(i, o, r);
462
462
  }), r;
463
463
  }
464
- function nn(e, t) {
465
- const r = e.success === !0, n = e.keepSubmitLoading === !0, i = e.errors, o = Kt(i || {}), a = o.form || [], s = {};
466
- Object.entries(o).forEach(([y, c]) => {
467
- if (y === "form")
464
+ function cn(e, t) {
465
+ const r = e.success === !0, n = e.keepSubmitLoading === !0, i = e.errors, o = Yt(i || {}), a = o.form || [], s = {};
466
+ Object.entries(o).forEach(([h, u]) => {
467
+ if (h === "form")
468
468
  return;
469
- const u = y.split(".")[0];
470
- s[u] = (s[u] || []).concat(c);
469
+ const c = h.split(".")[0];
470
+ s[c] = (s[c] || []).concat(u);
471
471
  });
472
472
  const l = !r && a.length === 0 && Object.keys(s).length > 0 ? [t || "Submission failed."] : a, d = !r && n && l.length === 0 && Object.keys(s).length === 0;
473
473
  return {
@@ -489,13 +489,13 @@ function nn(e, t) {
489
489
  meta: e
490
490
  };
491
491
  }
492
- async function on(e, t, r = {}) {
492
+ async function dn(e, t, r = {}) {
493
493
  const n = JSON.stringify({
494
494
  handle: t,
495
495
  renderOptions: r
496
496
  });
497
497
  H.log("requestRender start.", { endpoint: e, handle: t });
498
- const i = await Ie(e, {
498
+ const i = await Re(e, {
499
499
  method: "POST",
500
500
  body: n,
501
501
  headers: {
@@ -506,7 +506,7 @@ async function on(e, t, r = {}) {
506
506
  hasHtml: !!i.html
507
507
  }), i;
508
508
  }
509
- async function an(e, t, r = {}) {
509
+ async function fn(e, t, r = {}) {
510
510
  const i = JSON.stringify({
511
511
  query: `
512
512
  query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
@@ -516,11 +516,11 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
516
516
  }`,
517
517
  variables: {
518
518
  handle: t,
519
- input: rn(r)
519
+ input: un(r)
520
520
  }
521
521
  });
522
522
  H.log("requestGraphqlRender start.", { endpoint: e, handle: t });
523
- const o = await Ie(e, {
523
+ const o = await Re(e, {
524
524
  method: "POST",
525
525
  body: i,
526
526
  headers: {
@@ -536,24 +536,24 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
536
536
  hasHtml: !!a.html
537
537
  }), a;
538
538
  }
539
- async function tt(e, t, r) {
539
+ async function nt(e, t, r) {
540
540
  const n = new URL(e, window.location.origin);
541
541
  n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r), H.log("requestRefreshTokens start.", {
542
542
  endpoint: n.toString(),
543
543
  handle: t,
544
544
  hasRenderId: !!r
545
545
  });
546
- const i = await Ie(n.toString());
546
+ const i = await Re(n.toString());
547
547
  return H.log("requestRefreshTokens complete.", {
548
548
  hasRefreshTokens: !!i.refreshTokens
549
549
  }), i.refreshTokens || i;
550
550
  }
551
- async function sn(e, t, r) {
551
+ async function mn(e, t, r) {
552
552
  const n = new URL(e, window.location.origin), i = new FormData();
553
553
  if (r && i.append("pageId", r), t) {
554
554
  ["handle", "renderId", "draftContextToken", "draftContext", "continuationToken"].forEach((d) => {
555
- const y = t.querySelector(`input[name="${d}"]`)?.value?.trim();
556
- y && i.append(d, y);
555
+ const h = t.querySelector(`input[name="${d}"]`)?.value?.trim();
556
+ h && i.append(d, h);
557
557
  });
558
558
  const l = t.querySelector('input[name="CRAFT_CSRF_TOKEN"]')?.value?.trim();
559
559
  l && i.append("CRAFT_CSRF_TOKEN", l);
@@ -562,13 +562,13 @@ async function sn(e, t, r) {
562
562
  requestUrl: n.toString(),
563
563
  pageId: r || null
564
564
  });
565
- const o = await Ie(n.toString(), {
565
+ const o = await Re(n.toString(), {
566
566
  method: "POST",
567
567
  body: i
568
568
  });
569
569
  return H.log("requestSetPage complete.", o), o;
570
570
  }
571
- function ln(e, t) {
571
+ function pn(e, t) {
572
572
  const r = new URL(e, window.location.origin), n = new FormData();
573
573
  ["handle", "renderId", "draftContextToken", "draftContext"].forEach((s) => {
574
574
  const d = t.querySelector(`input[name="${s}"]`)?.value?.trim();
@@ -593,7 +593,7 @@ function ln(e, t) {
593
593
  }
594
594
  });
595
595
  }
596
- async function un(e, t) {
596
+ async function gn(e, t) {
597
597
  const r = (e.getAttribute("method") || "POST").toUpperCase(), n = e.getAttribute("action") || window.location.href, i = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
598
598
  H.log("submitForm start.", {
599
599
  method: r,
@@ -624,7 +624,7 @@ async function un(e, t) {
624
624
  message: `Request failed (${o.status}).`,
625
625
  formErrors: [`Request failed (${o.status}).`]
626
626
  });
627
- const s = await o.json(), l = nn(s, i);
627
+ const s = await o.json(), l = cn(s, i);
628
628
  return H.log("submitForm JSON response normalized.", {
629
629
  ok: l.ok,
630
630
  code: l.code,
@@ -632,21 +632,11 @@ async function un(e, t) {
632
632
  hasSubmitData: Array.isArray(l.submitData) && l.submitData.length > 0
633
633
  }), l;
634
634
  }
635
- const cn = ["prepare", "normalize", "validate", "screen", "authorize", "dispatch", "finalize"], dn = ["prepare", "normalize", "validate", "screen", "authorize"], R = _("general", "pipeline");
636
- function Ve(e, t) {
637
- return {
638
- ok: !1,
639
- stage: e,
640
- code: "ABORTED",
641
- message: t || "Submission aborted.",
642
- formErrors: [t || "Submission aborted."]
643
- };
644
- }
645
- function rt(e) {
635
+ function it(e) {
646
636
  return Array.from(e.querySelectorAll("[data-formie-page]"));
647
637
  }
648
- function fn(e) {
649
- const t = rt(e);
638
+ function Zt(e) {
639
+ const t = it(e);
650
640
  if (!t.length)
651
641
  return {
652
642
  scope: e,
@@ -658,13 +648,23 @@ function fn(e) {
658
648
  final: r === t[t.length - 1]
659
649
  };
660
650
  }
661
- function Gt(e) {
651
+ const hn = ["prepare", "normalize", "validate", "screen", "authorize", "dispatch", "finalize"], bn = ["prepare", "normalize", "validate", "screen", "authorize"], F = _("general", "pipeline");
652
+ function $e(e, t) {
653
+ return {
654
+ ok: !1,
655
+ stage: e,
656
+ code: "ABORTED",
657
+ message: t || "Submission aborted.",
658
+ formErrors: [t || "Submission aborted."]
659
+ };
660
+ }
661
+ function Qt(e) {
662
662
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
663
663
  }
664
- function Jt(e) {
664
+ function Xt(e) {
665
665
  return !(!e.name || e.disabled || e instanceof HTMLInputElement && (e.type === "submit" || e.type === "button" || e.type === "reset" || e.type === "image" || (e.type === "checkbox" || e.type === "radio") && !e.checked || e.type === "file" && (!e.files || e.files.length === 0)));
666
666
  }
667
- function Yt(e, t) {
667
+ function er(e, t) {
668
668
  if (t instanceof HTMLInputElement) {
669
669
  if (t.type === "file") {
670
670
  Array.from(t.files || []).forEach((r) => {
@@ -683,67 +683,67 @@ function Yt(e, t) {
683
683
  }
684
684
  e.append(t.name, t.value);
685
685
  }
686
- function mn(e, t) {
686
+ function yn(e, t) {
687
687
  t.querySelectorAll("input, select, textarea").forEach((r) => {
688
- const n = Gt(r) ? r : null;
689
- !n || n.closest("[data-formie-page]") || Jt(n) && Yt(e, n);
688
+ const n = Qt(r) ? r : null;
689
+ !n || n.closest("[data-formie-page]") || Xt(n) && er(e, n);
690
690
  });
691
691
  }
692
- function pn(e, t) {
692
+ function vn(e, t) {
693
693
  const r = /* @__PURE__ */ new Set();
694
694
  return t.querySelectorAll("input, select, textarea").forEach((n) => {
695
- const i = Gt(n) ? n : null;
696
- !i || !i.name || i.disabled || i instanceof HTMLInputElement && (i.type === "submit" || i.type === "button" || i.type === "reset" || i.type === "image") || (i.name.startsWith("fields[") && r.add(i.name), Jt(i) && Yt(e, i));
695
+ const i = Qt(n) ? n : null;
696
+ !i || !i.name || i.disabled || i instanceof HTMLInputElement && (i.type === "submit" || i.type === "button" || i.type === "reset" || i.type === "image") || (i.name.startsWith("fields[") && r.add(i.name), Xt(i) && er(e, i));
697
697
  }), r;
698
698
  }
699
- function gn(e, t) {
699
+ function En(e, t) {
700
700
  t.forEach((r) => {
701
701
  e.has(r) || e.append(r, "");
702
702
  });
703
703
  }
704
- function ht(e, t) {
705
- const r = rt(e), n = r.find((a) => !a.hasAttribute("data-formie-page-hidden")) || null;
704
+ function vt(e, t) {
705
+ const r = it(e), n = r.find((a) => !a.hasAttribute("data-formie-page-hidden")) || null;
706
706
  if (!r.length || !n) {
707
707
  const a = new FormData(e);
708
708
  return a.set("submitAction", t), a;
709
709
  }
710
710
  const i = new FormData();
711
- mn(i, e);
712
- const o = pn(i, n);
713
- return gn(i, o), i.set("submitAction", t), i;
711
+ yn(i, e);
712
+ const o = vn(i, n);
713
+ return En(i, o), i.set("submitAction", t), i;
714
714
  }
715
- function hn(e, t) {
715
+ function Sn(e, t) {
716
716
  if (t !== "submit")
717
717
  return !1;
718
- const r = rt(e);
718
+ const r = it(e);
719
719
  return r.length ? (r.find((i) => !i.hasAttribute("data-formie-page-hidden")) || r[r.length - 1]) === r[r.length - 1] : !0;
720
720
  }
721
- async function Zt(e, t, r, n = {}) {
722
- R.log("Starting submit pipeline.", {
721
+ async function tr(e, t, r, n = {}) {
722
+ F.log("Starting submit pipeline.", {
723
723
  action: t,
724
724
  preflightOnly: n.preflightOnly === !0
725
725
  });
726
726
  let i = !1, o, a = null;
727
- const s = hn(e, t), l = {
727
+ const s = Sn(e, t), l = {
728
728
  form: e,
729
729
  action: t,
730
- formData: ht(e, t),
731
- abort: (c) => {
732
- i = !0, o = c, R.warn("Pipeline aborted.", { reason: c });
730
+ formData: vt(e, t),
731
+ abort: (u) => {
732
+ i = !0, o = u, F.warn("Pipeline aborted.", { reason: u });
733
733
  },
734
734
  isAborted: () => i,
735
735
  abortReason: () => o
736
736
  }, d = {
737
- prepare: async (c) => {
738
- const u = c.form.querySelector('input[name="submitAction"]');
739
- return u && (u.value = c.action), c.formData.set("submitAction", c.action), null;
737
+ prepare: async (u) => {
738
+ const c = u.form.querySelector('input[name="submitAction"]');
739
+ return c && (c.value = u.action), u.formData.set("submitAction", u.action), null;
740
740
  },
741
741
  normalize: async () => null,
742
- validate: async (c) => {
743
- if (c.action !== "submit" || n.validateOnSubmit === !1)
742
+ validate: async (u) => {
743
+ if (u.action !== "submit" || n.validateOnSubmit === !1)
744
744
  return null;
745
745
  if (n.validator) {
746
- const { scope: u, final: h } = fn(c.form), A = n.validator.submit(h ? c.form : u, { final: h });
746
+ const { scope: c, final: b } = Zt(u.form), A = n.validator.submit(b ? u.form : c, { final: b });
747
747
  return A.length > 0 ? (A[0]?.input.focus(), {
748
748
  ok: !1,
749
749
  stage: "validate",
@@ -753,7 +753,7 @@ async function Zt(e, t, r, n = {}) {
753
753
  formErrors: [n.validator.config.errorMessage || "Validation failed."]
754
754
  }) : null;
755
755
  }
756
- return c.form.checkValidity() ? null : (c.form.querySelector(":invalid")?.focus(), {
756
+ return u.form.checkValidity() ? null : (u.form.querySelector(":invalid")?.focus(), {
757
757
  ok: !1,
758
758
  stage: "validate",
759
759
  code: "VALIDATION_FAILED",
@@ -763,148 +763,158 @@ async function Zt(e, t, r, n = {}) {
763
763
  },
764
764
  screen: async () => null,
765
765
  authorize: async () => null,
766
- dispatch: async (c) => {
767
- c.formData = ht(c.form, c.action);
768
- const u = await un(c.form, c.formData);
769
- return a = u, u;
766
+ dispatch: async (u) => {
767
+ u.formData = vt(u.form, u.action);
768
+ const c = await gn(u.form, u.formData);
769
+ return a = c, c;
770
770
  },
771
- finalize: async (c) => (a && a.ok && a.redirect?.url && (a.redirect.target === "new-tab" ? window.open(a.redirect.url, "_blank") : window.location.href = a.redirect.url), null)
771
+ finalize: async (u) => (a && a.ok && a.redirect?.url && (a.redirect.target === "new-tab" ? window.open(a.redirect.url, "_blank") : window.location.href = a.redirect.url), null)
772
772
  };
773
773
  {
774
- const c = await r.emitSafe("formie:submit:before", l);
775
- c.failed.length > 0 && R.warn("Submit before listeners failed.", {
776
- eventName: c.eventName,
777
- failed: c.failed.length
774
+ const u = await r.emitSafe("formie:submit:before", l);
775
+ u.failed.length > 0 && F.warn("Submit before listeners failed.", {
776
+ eventName: u.eventName,
777
+ failed: u.failed.length
778
778
  });
779
779
  }
780
780
  if (s) {
781
- const c = await r.emitSafe("formie:submit:final:before", l);
782
- c.failed.length > 0 && R.warn("Final submit before listeners failed.", {
783
- eventName: c.eventName,
784
- failed: c.failed.length
781
+ const u = await r.emitSafe("formie:submit:final:before", l);
782
+ u.failed.length > 0 && F.warn("Final submit before listeners failed.", {
783
+ eventName: u.eventName,
784
+ failed: u.failed.length
785
785
  });
786
786
  }
787
- const p = n.preflightOnly ? dn : cn;
788
- for (const c of p) {
789
- if (R.log("Stage start.", { stage: c, action: t }), i)
790
- return R.warn("Stage skipped due to abort.", { stage: c, reason: o }), Ve(c, o);
787
+ const p = n.preflightOnly ? bn : hn;
788
+ for (const u of p) {
789
+ if (F.log("Stage start.", { stage: u, action: t }), i)
790
+ return F.warn("Stage skipped due to abort.", { stage: u, reason: o }), $e(u, o);
791
791
  {
792
- const h = await r.emitSafe(`formie:stage:${c}:before`, {
792
+ const b = await r.emitSafe(`formie:stage:${u}:before`, {
793
793
  ...l,
794
- stage: c
794
+ stage: u
795
795
  });
796
- h.failed.length > 0 && R.warn("Stage before listeners failed.", {
797
- stage: c,
798
- failed: h.failed.length
796
+ b.failed.length > 0 && F.warn("Stage before listeners failed.", {
797
+ stage: u,
798
+ failed: b.failed.length
799
799
  });
800
800
  }
801
801
  if (i) {
802
- const h = Ve(c, o);
802
+ const b = $e(u, o);
803
803
  {
804
- const A = await r.emitSafe("formie:submit:after", h);
805
- A.failed.length > 0 && R.warn("Submit after listeners failed (abort before stage).", {
806
- stage: c,
804
+ const A = await r.emitSafe("formie:submit:after", b);
805
+ A.failed.length > 0 && F.warn("Submit after listeners failed (abort before stage).", {
806
+ stage: u,
807
807
  failed: A.failed.length
808
808
  });
809
809
  }
810
810
  if (s) {
811
- const A = await r.emitSafe("formie:submit:final:after", h);
812
- A.failed.length > 0 && R.warn("Final submit after listeners failed (abort before stage).", {
813
- stage: c,
811
+ const A = await r.emitSafe("formie:submit:final:after", b);
812
+ A.failed.length > 0 && F.warn("Final submit after listeners failed (abort before stage).", {
813
+ stage: u,
814
814
  failed: A.failed.length
815
815
  });
816
816
  }
817
- return R.warn("Aborted after stage before-hooks.", { stage: c, reason: o }), h;
817
+ return F.warn("Aborted after stage before-hooks.", { stage: u, reason: o }), b;
818
818
  }
819
- const u = await d[c](l);
820
- R.log("Stage runner complete.", {
821
- stage: c,
822
- hasResult: !!u,
823
- ok: u ? u.ok : void 0,
824
- code: u?.code
819
+ const c = await d[u](l);
820
+ F.log("Stage runner complete.", {
821
+ stage: u,
822
+ hasResult: !!c,
823
+ ok: c ? c.ok : void 0,
824
+ code: c?.code
825
825
  });
826
826
  {
827
- const h = await r.emitSafe(`formie:stage:${c}:after`, {
827
+ const b = await r.emitSafe(`formie:stage:${u}:after`, {
828
828
  ...l,
829
- stage: c,
830
- result: u
829
+ stage: u,
830
+ result: c
831
831
  });
832
- h.failed.length > 0 && R.warn("Stage after listeners failed.", {
833
- stage: c,
834
- failed: h.failed.length
832
+ b.failed.length > 0 && F.warn("Stage after listeners failed.", {
833
+ stage: u,
834
+ failed: b.failed.length
835
835
  });
836
836
  }
837
837
  if (i) {
838
- const h = Ve(c, o);
838
+ const b = $e(u, o);
839
839
  {
840
- const A = await r.emitSafe("formie:submit:after", h);
841
- A.failed.length > 0 && R.warn("Submit after listeners failed (abort after stage).", {
842
- stage: c,
840
+ const A = await r.emitSafe("formie:submit:after", b);
841
+ A.failed.length > 0 && F.warn("Submit after listeners failed (abort after stage).", {
842
+ stage: u,
843
843
  failed: A.failed.length
844
844
  });
845
845
  }
846
846
  if (s) {
847
- const A = await r.emitSafe("formie:submit:final:after", h);
848
- A.failed.length > 0 && R.warn("Final submit after listeners failed (abort after stage).", {
849
- stage: c,
847
+ const A = await r.emitSafe("formie:submit:final:after", b);
848
+ A.failed.length > 0 && F.warn("Final submit after listeners failed (abort after stage).", {
849
+ stage: u,
850
850
  failed: A.failed.length
851
851
  });
852
852
  }
853
- return R.warn("Aborted after stage after-hooks.", { stage: c, reason: o }), h;
853
+ return F.warn("Aborted after stage after-hooks.", { stage: u, reason: o }), b;
854
854
  }
855
- if (u && !u.ok) {
855
+ if (c && !c.ok) {
856
856
  {
857
- const h = await r.emitSafe("formie:submit:after", u);
858
- h.failed.length > 0 && R.warn("Submit after listeners failed (failed stage).", {
859
- stage: c,
860
- failed: h.failed.length
857
+ const b = await r.emitSafe("formie:submit:after", c);
858
+ b.failed.length > 0 && F.warn("Submit after listeners failed (failed stage).", {
859
+ stage: u,
860
+ failed: b.failed.length
861
861
  });
862
862
  }
863
863
  if (s) {
864
- const h = await r.emitSafe("formie:submit:final:after", u);
865
- h.failed.length > 0 && R.warn("Final submit after listeners failed (failed stage).", {
866
- stage: c,
867
- failed: h.failed.length
864
+ const b = await r.emitSafe("formie:submit:final:after", c);
865
+ b.failed.length > 0 && F.warn("Final submit after listeners failed (failed stage).", {
866
+ stage: u,
867
+ failed: b.failed.length
868
868
  });
869
869
  }
870
- return R.warn("Pipeline short-circuited by failed stage.", {
871
- stage: c,
872
- code: u.code,
873
- message: u.message
874
- }), u;
870
+ return F.warn("Pipeline short-circuited by failed stage.", {
871
+ stage: u,
872
+ code: c.code,
873
+ message: c.message
874
+ }), c;
875
875
  }
876
876
  }
877
- const y = a || {
877
+ const h = a || {
878
878
  ok: !0,
879
879
  stage: n.preflightOnly ? "authorize" : "finalize",
880
880
  message: n.preflightOnly ? "Submission preflight completed." : "Submission completed."
881
881
  };
882
882
  {
883
- const c = await r.emitSafe("formie:submit:after", y);
884
- c.failed.length > 0 && R.warn("Submit after listeners failed (success).", {
885
- failed: c.failed.length
883
+ const u = await r.emitSafe("formie:submit:after", h);
884
+ u.failed.length > 0 && F.warn("Submit after listeners failed (success).", {
885
+ failed: u.failed.length
886
886
  });
887
887
  }
888
888
  if (s) {
889
- const c = await r.emitSafe("formie:submit:final:after", y);
890
- c.failed.length > 0 && R.warn("Final submit after listeners failed (success).", {
891
- failed: c.failed.length
889
+ const u = await r.emitSafe("formie:submit:final:after", h);
890
+ u.failed.length > 0 && F.warn("Final submit after listeners failed (success).", {
891
+ failed: u.failed.length
892
892
  });
893
893
  }
894
- return R.log("Pipeline completed.", {
895
- ok: y.ok,
896
- stage: y.stage,
897
- code: y.code
898
- }), y;
894
+ return F.log("Pipeline completed.", {
895
+ ok: h.ok,
896
+ stage: h.stage,
897
+ code: h.code
898
+ }), h;
899
+ }
900
+ function An(e) {
901
+ return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
899
902
  }
900
- const bn = {
903
+ function rr(e, t) {
904
+ const r = e.querySelector("[data-formie-field-errors]");
905
+ if (r)
906
+ return r;
907
+ const n = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), o = An(e), a = document.createElement("div");
908
+ return a.setAttribute("data-formie-field-errors", "true"), t?.(a), n && i ? o === "above" ? n.insertBefore(a, i) : n.appendChild(a) : e.appendChild(a), a;
909
+ }
910
+ const wn = {
901
911
  rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
902
- message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? r("{attribute} is not a valid email address.", { attribute: t })
912
+ message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-validation-email-message") ?? e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? r("{label} is not a valid email address.", { label: t })
903
913
  };
904
- function yn(e) {
914
+ function Tn(e) {
905
915
  return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
906
916
  }
907
- function bt(e) {
917
+ function Et(e) {
908
918
  const t = e.getRule("match");
909
919
  if (!t || t === !0 || typeof t != "object" || !e.field)
910
920
  return null;
@@ -914,19 +924,19 @@ function bt(e) {
914
924
  const n = e.form.querySelector(`[data-formie-field-handle="${r}"]`);
915
925
  return n ? n.querySelector(e.config.fieldsSelector) : null;
916
926
  }
917
- const vn = {
927
+ const Mn = {
918
928
  rule: (e) => {
919
- const t = bt(e);
929
+ const t = Et(e);
920
930
  return t ? t.value === e.input.value : !0;
921
931
  },
922
932
  message: (e) => {
923
- const r = bt(e)?.closest("[data-formie-field-handle]"), n = yn(r);
924
- return e.t("{name} must match {value}.", {
925
- name: e.label,
933
+ const r = Et(e)?.closest("[data-formie-field-handle]"), n = Tn(r);
934
+ return e.t("{label} must match {value}.", {
935
+ label: e.label,
926
936
  value: n
927
937
  });
928
938
  }
929
- }, En = {
939
+ }, Cn = {
930
940
  rule: ({ input: e, getRule: t }) => {
931
941
  const r = t("number");
932
942
  if (!r || !e.value || e.value.trim() === "")
@@ -943,9 +953,9 @@ const vn = {
943
953
  },
944
954
  message: ({ input: e, label: t, getRule: r, t: n }) => {
945
955
  const i = r("number"), o = i !== !0 && i && typeof i == "object" && typeof i.min == "number" ? i.min : null, a = i !== !0 && i && typeof i == "object" && typeof i.max == "number" ? i.max : null;
946
- return o !== null && a !== null ? n("{attribute} must be between {min} and {max}.", { attribute: t, min: o, max: a }) : o !== null ? n("{attribute} must be no less than {min}.", { attribute: t, min: o }) : a !== null ? n("{attribute} must be no greater than {max}.", { attribute: t, max: a }) : e.getAttribute("data-formie-pattern-number-message") ?? e.getAttribute("data-pattern-number-message") ?? n("{attribute} is not a valid number.", { attribute: t });
956
+ return o !== null && a !== null ? e.getAttribute("data-formie-validation-number-min-message") ?? n("{label} must be between {min} and {max}.", { label: t, min: o, max: a }) : o !== null ? e.getAttribute("data-formie-validation-number-min-message") ?? n("{label} must be no less than {min}.", { label: t, min: o }) : a !== null ? e.getAttribute("data-formie-validation-number-max-message") ?? n("{label} must be no greater than {max}.", { label: t, max: a }) : e.getAttribute("data-formie-validation-number-message") ?? e.getAttribute("data-formie-pattern-number-message") ?? e.getAttribute("data-pattern-number-message") ?? n("{label} is not a valid number.", { label: t });
947
957
  }
948
- }, Sn = {
958
+ }, Ln = {
949
959
  rule: ({ input: e, getRule: t }) => {
950
960
  if (!t("required") || e.type === "hidden")
951
961
  return !0;
@@ -955,8 +965,8 @@ const vn = {
955
965
  }
956
966
  return e.value.trim() !== "";
957
967
  },
958
- message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? r("{attribute} cannot be blank.", { attribute: t })
959
- }, An = {
968
+ message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? r("{label} cannot be blank.", { label: t })
969
+ }, In = {
960
970
  rule: ({ input: e, getRule: t }) => {
961
971
  if (!t("url") || !e.value || e.value.length < 1)
962
972
  return !0;
@@ -966,20 +976,20 @@ const vn = {
966
976
  return !1;
967
977
  }
968
978
  },
969
- message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-url-message") ?? e.getAttribute("data-pattern-url-message") ?? r("{attribute} is not a valid URL.", { attribute: t })
970
- }, wn = {
979
+ message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-url-message") ?? e.getAttribute("data-pattern-url-message") ?? r("{label} is not a valid URL.", { label: t })
980
+ }, Rn = {
971
981
  // Keep the core validator registry centralized so FormieValidator can extend
972
982
  // it at runtime while still shipping one predictable builtin rule surface.
973
- required: Sn,
974
- email: bn,
975
- url: An,
976
- number: En,
977
- match: vn
983
+ required: Ln,
984
+ email: wn,
985
+ url: In,
986
+ number: Cn,
987
+ match: Mn
978
988
  };
979
- function Qt() {
989
+ function nr() {
980
990
  return window.FormieTranslations || {};
981
991
  }
982
- function Tn() {
992
+ function Fn() {
983
993
  if (typeof document > "u")
984
994
  return;
985
995
  const e = Array.from(document.querySelectorAll('script[type="application/json"][data-formie-translations]:not([data-formie-translations-loaded="true"])'));
@@ -995,7 +1005,7 @@ function Tn() {
995
1005
  if (!i || Array.isArray(i) || typeof i != "object")
996
1006
  continue;
997
1007
  t = {
998
- ...t ?? Qt(),
1008
+ ...t ?? nr(),
999
1009
  ...i
1000
1010
  };
1001
1011
  } catch {
@@ -1004,26 +1014,118 @@ function Tn() {
1004
1014
  }
1005
1015
  t && (window.FormieTranslations = t);
1006
1016
  }
1007
- function nt() {
1008
- return Tn(), Qt();
1017
+ function ot() {
1018
+ return Fn(), nr();
1009
1019
  }
1010
- function Xt() {
1011
- return { ...nt() };
1020
+ function ir() {
1021
+ return { ...ot() };
1012
1022
  }
1013
- function Yo(e) {
1014
- return window.FormieTranslations = { ...e }, Xt();
1023
+ function ma(e) {
1024
+ return window.FormieTranslations = { ...e }, ir();
1015
1025
  }
1016
- function Zo(e) {
1026
+ function pa(e) {
1017
1027
  return window.FormieTranslations = {
1018
- ...nt(),
1028
+ ...ot(),
1019
1029
  ...e
1020
- }, Xt();
1030
+ }, ir();
1031
+ }
1032
+ function kn(e) {
1033
+ const t = {};
1034
+ let r = 0;
1035
+ for (; r < e.length; ) {
1036
+ for (; r < e.length && /\s/.test(e[r]); )
1037
+ r++;
1038
+ if (r >= e.length)
1039
+ break;
1040
+ const n = e.slice(r).match(/^(\w+|=\d+)\{/);
1041
+ if (!n)
1042
+ break;
1043
+ const i = n[1];
1044
+ r += n[0].length;
1045
+ let o = 1;
1046
+ const a = r;
1047
+ for (; r < e.length && o > 0; )
1048
+ e[r] === "{" ? o++ : e[r] === "}" && o--, o > 0 && r++;
1049
+ t[i] = e.slice(a, r), r++;
1050
+ }
1051
+ return t;
1052
+ }
1053
+ function Pn(e, t) {
1054
+ const r = `=${e}`;
1055
+ if (Object.prototype.hasOwnProperty.call(t, r))
1056
+ return t[r];
1057
+ if (typeof Intl < "u" && typeof Intl.PluralRules == "function") {
1058
+ const i = new Intl.PluralRules().select(e);
1059
+ if (Object.prototype.hasOwnProperty.call(t, i))
1060
+ return t[i];
1061
+ }
1062
+ if (e === 1 && Object.prototype.hasOwnProperty.call(t, "one"))
1063
+ return t.one;
1064
+ if (Object.prototype.hasOwnProperty.call(t, "other"))
1065
+ return t.other;
1066
+ const n = Object.keys(t)[0];
1067
+ return n ? t[n] : "";
1068
+ }
1069
+ function qn(e, t) {
1070
+ const r = e.slice(t).match(/^\{(\w+),\s*plural,\s*/);
1071
+ if (!r)
1072
+ return null;
1073
+ const n = r[1], i = t + r[0].length;
1074
+ let o = i;
1075
+ for (; o < e.length; ) {
1076
+ for (; o < e.length && /\s/.test(e[o]); )
1077
+ o++;
1078
+ if (o >= e.length || e[o] === "}")
1079
+ break;
1080
+ const a = e.slice(o).match(/^(\w+|=\d+)\{/);
1081
+ if (!a)
1082
+ return null;
1083
+ o += a[0].length;
1084
+ let s = 1;
1085
+ for (; o < e.length && s > 0; )
1086
+ e[o] === "{" ? s++ : e[o] === "}" && s--, s > 0 && o++;
1087
+ o++;
1088
+ }
1089
+ return o >= e.length || e[o] !== "}" ? null : {
1090
+ param: n,
1091
+ body: e.slice(i, o),
1092
+ endIndex: o
1093
+ };
1094
+ }
1095
+ function Vn(e, t) {
1096
+ let r = "", n = 0;
1097
+ for (; n < e.length; ) {
1098
+ if (e[n] !== "{") {
1099
+ r += e[n], n++;
1100
+ continue;
1101
+ }
1102
+ const i = qn(e, n);
1103
+ if (!i) {
1104
+ r += e[n], n++;
1105
+ continue;
1106
+ }
1107
+ const o = t[i.param], a = typeof o == "number" ? o : Number.parseInt(String(o ?? ""), 10) || 0, s = kn(i.body);
1108
+ let l = Pn(a, s);
1109
+ l = l.replace(/#/g, String(a)), r += l, n = i.endIndex + 1;
1110
+ }
1111
+ return r;
1112
+ }
1113
+ function On(e, t) {
1114
+ return e.replace(/\{(\w+),\s*number\}/g, (r, n) => {
1115
+ if (!Object.prototype.hasOwnProperty.call(t, n))
1116
+ return r;
1117
+ const i = t[n];
1118
+ return typeof i == "number" ? i.toLocaleString() : String(i);
1119
+ });
1120
+ }
1121
+ function $n(e, t) {
1122
+ return e.replace(/\{(\w+)\}/g, (r, n) => Object.prototype.hasOwnProperty.call(t, n) ? String(t[n]) : r);
1021
1123
  }
1022
1124
  function x(e, t = {}) {
1023
- let r = nt()[e] || e;
1024
- return r = r.replace(/{([a-zA-Z0-9]+)}/g, (n, i) => Object.prototype.hasOwnProperty.call(t, i) ? String(t[i]) : n), r;
1125
+ let r = ot()[e] || e;
1126
+ return r = Vn(r, t), r = On(r, t), r = $n(r, t), r;
1025
1127
  }
1026
- const Qo = x, Cn = {
1128
+ const ga = x, Hn = {
1027
1129
  // eslint-disable-next-line
1028
1130
  email: /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$/,
1029
1131
  url: /^(?:(?:https?|HTTPS?|ftp|FTP):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)(?:\.(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)*(?:\.(?:[a-zA-Z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/,
@@ -1036,7 +1138,7 @@ const Qo = x, Cn = {
1036
1138
  function oe(e) {
1037
1139
  return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
1038
1140
  }
1039
- function Mn(e, t) {
1141
+ function _n(e, t) {
1040
1142
  const r = (e.getAttribute("aria-describedby") || "").trim();
1041
1143
  if (!r)
1042
1144
  return;
@@ -1047,17 +1149,17 @@ function Mn(e, t) {
1047
1149
  }
1048
1150
  e.removeAttribute("aria-describedby");
1049
1151
  }
1050
- function Ln(e, t) {
1152
+ function Dn(e, t) {
1051
1153
  const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
1052
1154
  n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
1053
1155
  }
1054
- function In(e, t) {
1156
+ function xn(e, t) {
1055
1157
  e.setAttribute("aria-errormessage", t);
1056
1158
  }
1057
- function Fn(e, t) {
1159
+ function Nn(e, t) {
1058
1160
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
1059
1161
  }
1060
- class Rn {
1162
+ class Un {
1061
1163
  constructor(t, r = {}) {
1062
1164
  this.errors = [], this.validators = {}, this.boundListeners = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.submitted = !1, this.initialValues = /* @__PURE__ */ new WeakMap(), this.form = t, this.onBlur = this.blurHandler.bind(this), this.onChange = this.changeHandler.bind(this), this.onInput = this.inputHandler.bind(this), this.config = {
1063
1165
  live: !1,
@@ -1067,9 +1169,9 @@ class Rn {
1067
1169
  messagesClass: [],
1068
1170
  messageClass: [],
1069
1171
  fieldsSelector: 'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([disabled]), select:not([disabled]), textarea:not([disabled])',
1070
- patterns: Cn,
1172
+ patterns: Hn,
1071
1173
  ...r
1072
- }, Object.entries(wn).forEach(([n, i]) => {
1174
+ }, Object.entries(Rn).forEach(([n, i]) => {
1073
1175
  this.addValidator(n, i.rule, i.message);
1074
1176
  }), this.init();
1075
1177
  }
@@ -1098,6 +1200,9 @@ class Rn {
1098
1200
  shouldShowError(t) {
1099
1201
  return this.submitted || this.activated.has(t);
1100
1202
  }
1203
+ isValid(t = null, r = {}) {
1204
+ return this.validate(t, r).length === 0;
1205
+ }
1101
1206
  validate(t = null, r = {}) {
1102
1207
  this.errors = [];
1103
1208
  const n = /* @__PURE__ */ new Set();
@@ -1115,12 +1220,12 @@ class Rn {
1115
1220
  const l = this.getValidatorCallbackOptions(i);
1116
1221
  Object.entries(this.validators).forEach(([d, p]) => {
1117
1222
  if (!p.validate(l)) {
1118
- const c = this.getErrorMessage(i, d, p, l);
1119
- this.shouldShowError(i) && !o && this.showError(i, d, c), this.errors.push({
1223
+ const u = this.getErrorMessage(i, d, p, l);
1224
+ this.shouldShowError(i) && !o && this.showError(i, d, u), this.errors.push({
1120
1225
  input: i,
1121
1226
  field: l.field,
1122
1227
  validator: d,
1123
- message: c,
1228
+ message: u,
1124
1229
  handle: l.field?.getAttribute("data-formie-field-handle") || null,
1125
1230
  result: !1
1126
1231
  }), o = !0;
@@ -1147,9 +1252,9 @@ class Rn {
1147
1252
  o.remove();
1148
1253
  }), n && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((o) => {
1149
1254
  const a = o;
1150
- a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i && Mn(a, i), r.querySelectorAll("[data-formie-field-error]").forEach((s) => {
1255
+ a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i && _n(a, i), r.querySelectorAll("[data-formie-field-error]").forEach((s) => {
1151
1256
  const l = s.id;
1152
- l && Fn(a, l);
1257
+ l && Nn(a, l);
1153
1258
  });
1154
1259
  });
1155
1260
  for (let o = r; o; o = o.parentElement?.closest("[data-formie-field-handle]"))
@@ -1163,13 +1268,15 @@ class Rn {
1163
1268
  if (!i)
1164
1269
  return;
1165
1270
  let o = i.querySelector("[data-formie-field-errors]");
1166
- o || (o = document.createElement("div"), o.setAttribute("data-formie-field-errors", "true"), this.config.messagesClass.length && o.classList.add(...this.config.messagesClass), i.appendChild(o)), this.config.messagesClass.length && o.classList.add(...this.config.messagesClass), o.innerHTML = "";
1271
+ o || (o = rr(i, (d) => {
1272
+ this.config.messagesClass.length && d.classList.add(...this.config.messagesClass);
1273
+ })), this.config.messagesClass.length && o.classList.add(...this.config.messagesClass), o.innerHTML = "";
1167
1274
  const a = i.getAttribute("data-formie-field-handle") || "field", s = `${a}-error`;
1168
1275
  o.id = o.id || `${a}-errors`, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true");
1169
1276
  const l = document.createElement("div");
1170
1277
  l.setAttribute("data-formie-field-error", "true"), l.setAttribute(`data-formie-field-error-${r}`, "true"), l.setAttribute("id", s), l.setAttribute("role", "alert"), this.config.messageClass.length && l.classList.add(...this.config.messageClass), l.textContent = n, o.appendChild(l), i.setAttribute("data-formie-field-has-error", "true"), i.querySelectorAll("input, select, textarea").forEach((d) => {
1171
1278
  const p = d;
1172
- p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"), Ln(p, o.id), In(p, s);
1279
+ p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"), Dn(p, o.id), xn(p, s);
1173
1280
  });
1174
1281
  for (let d = i; d; d = d.parentElement?.closest("[data-formie-field-handle]"))
1175
1282
  this.config.fieldContainerErrorClass.length && d.classList.add(...this.config.fieldContainerErrorClass), d.setAttribute("data-formie-field-has-error", "true");
@@ -1193,7 +1300,7 @@ class Rn {
1193
1300
  };
1194
1301
  }
1195
1302
  getErrorMessage(t, r, n, i) {
1196
- return (typeof n.errorMessage == "function" ? n.errorMessage(i) : n.errorMessage) ?? x("{attribute} is invalid.", { attribute: i.label });
1303
+ return (typeof n.errorMessage == "function" ? n.errorMessage(i) : n.errorMessage) ?? x("{label} is invalid.", { label: i.label });
1197
1304
  }
1198
1305
  getErrors() {
1199
1306
  return this.errors;
@@ -1286,18 +1393,94 @@ class Rn {
1286
1393
  delete this.validators[t];
1287
1394
  }
1288
1395
  }
1289
- const kn = "STALE_SUBMISSION_STATE", yt = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), j = _("general", "submit-result");
1396
+ const he = "data-formie-submit-validation-disabled", He = "data-formie-preserve-disabled", Bn = "data-formie-submit-ready";
1397
+ function or(e) {
1398
+ return e.dataset.formieDisableSubmitUntilValid === "true";
1399
+ }
1400
+ function jn(e) {
1401
+ return Array.from(e.querySelectorAll('button[data-formie-action="submit"]')).filter((t) => t instanceof HTMLButtonElement);
1402
+ }
1403
+ function zn(e) {
1404
+ return !e.hasAttribute("data-formie-conditionally-hidden") && !e.closest("[data-formie-conditionally-hidden]");
1405
+ }
1406
+ function at(e, t) {
1407
+ if (!or(e) || e.getAttribute("data-formie-loading") === "true")
1408
+ return;
1409
+ const { scope: r, final: n } = Zt(e), i = t.isValid(r, {
1410
+ includeHiddenPages: n
1411
+ });
1412
+ e.setAttribute(Bn, i ? "true" : "false"), jn(e).forEach((o) => {
1413
+ if (zn(o)) {
1414
+ if (i) {
1415
+ if (!o.hasAttribute(he))
1416
+ return;
1417
+ o.hasAttribute(He) ? (o.disabled = !0, o.removeAttribute(He)) : o.disabled = !1, o.removeAttribute(he);
1418
+ return;
1419
+ }
1420
+ o.hasAttribute(he) || (o.disabled && o.setAttribute(He, "true"), o.setAttribute(he, "true")), o.disabled = !0;
1421
+ }
1422
+ });
1423
+ }
1424
+ function Wn(e, t, r) {
1425
+ if (!or(e))
1426
+ return () => {
1427
+ };
1428
+ let n = !1;
1429
+ const i = () => {
1430
+ n || (n = !0, queueMicrotask(() => {
1431
+ n = !1, at(e, t);
1432
+ }));
1433
+ };
1434
+ i();
1435
+ const o = () => {
1436
+ i();
1437
+ };
1438
+ e.addEventListener("input", o, !0), e.addEventListener("change", o, !0);
1439
+ const a = () => {
1440
+ window.setTimeout(() => {
1441
+ i();
1442
+ }, 0);
1443
+ };
1444
+ e.addEventListener("reset", a);
1445
+ const s = () => {
1446
+ i();
1447
+ };
1448
+ r.addEventListener("formie:conditions:evaluated", s);
1449
+ const l = new MutationObserver((d) => {
1450
+ d.some((h) => {
1451
+ if (h.type === "attributes") {
1452
+ const u = h.attributeName || "";
1453
+ return u === "data-formie-page-hidden" || u === "data-formie-conditionally-hidden" || u === "data-formie-loading" || u === "disabled";
1454
+ }
1455
+ return h.type === "childList";
1456
+ }) && i();
1457
+ });
1458
+ return l.observe(e, {
1459
+ childList: !0,
1460
+ subtree: !0,
1461
+ attributes: !0,
1462
+ attributeFilter: [
1463
+ "data-formie-page-hidden",
1464
+ "data-formie-conditionally-hidden",
1465
+ "data-formie-loading",
1466
+ "disabled"
1467
+ ]
1468
+ }), () => {
1469
+ e.removeEventListener("input", o, !0), e.removeEventListener("change", o, !0), e.removeEventListener("reset", a), r.removeEventListener("formie:conditions:evaluated", s), l.disconnect();
1470
+ };
1471
+ }
1472
+ const Kn = "STALE_SUBMISSION_STATE", St = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), j = _("general", "submit-result");
1290
1473
  function ze(e, t, r) {
1291
1474
  let n = e.querySelector(`input[name="${t}"]`);
1292
1475
  n || (n = document.createElement("input"), n.type = "hidden", n.name = t, e.appendChild(n)), n.value = r;
1293
1476
  }
1294
- function vt(e, t) {
1477
+ function At(e, t) {
1295
1478
  e.setAttribute("data-formie-internal-navigation", t);
1296
1479
  }
1297
1480
  function ae(e, t) {
1298
1481
  e.querySelector(`input[name="${t}"]`)?.remove();
1299
1482
  }
1300
- function qn(e, t) {
1483
+ function Gn(e, t) {
1301
1484
  try {
1302
1485
  const r = new URL(e, window.location.href);
1303
1486
  return r.searchParams.delete(t), r.toString();
@@ -1305,36 +1488,40 @@ function qn(e, t) {
1305
1488
  return e;
1306
1489
  }
1307
1490
  }
1308
- function Pn(e) {
1491
+ function Jn(e) {
1309
1492
  try {
1310
1493
  return new URL(e, window.location.href).origin === window.location.origin;
1311
1494
  } catch {
1312
1495
  return !1;
1313
1496
  }
1314
1497
  }
1315
- function er(e) {
1498
+ function ar(e) {
1316
1499
  return Array.from(e.querySelectorAll("[data-formie-page]"));
1317
1500
  }
1318
- function $n(e) {
1501
+ function Yn(e) {
1319
1502
  return Array.from(e.querySelectorAll("[data-formie-tab]"));
1320
1503
  }
1321
- function Vn(e, t, r) {
1504
+ function Zn(e, t, r) {
1322
1505
  return t < 0 || r < 1 ? 0 : (e.dataset.formieProgressCalculation === "page-position" ? "page-position" : "completion") === "page-position" ? Math.round((t + 1) / r * 100) : Math.round(t / r * 100);
1323
1506
  }
1324
- function On(e) {
1507
+ function Qn(e) {
1325
1508
  return e <= 0 ? "start" : e >= 100 ? "end" : "middle";
1326
1509
  }
1327
- function Et(e) {
1510
+ function Xn(e) {
1328
1511
  return (e.dataset.formieSubmitAction || "").trim();
1329
1512
  }
1330
- function St(e) {
1513
+ function wt(e, t) {
1514
+ const r = t.meta?.effectiveSubmitAction;
1515
+ return typeof r == "string" && r.trim() !== "" ? r.trim() : Xn(e);
1516
+ }
1517
+ function Tt(e) {
1331
1518
  const t = e.dataset.formieSubmitActionFormHide;
1332
1519
  if (t === void 0)
1333
1520
  return !1;
1334
1521
  const r = t.trim().toLowerCase();
1335
1522
  return r === "true" || r === "1" || r === "";
1336
1523
  }
1337
- function it(e, t) {
1524
+ function st(e, t) {
1338
1525
  const r = [
1339
1526
  "[data-formie-form-header]",
1340
1527
  "[data-formie-form-navigation]",
@@ -1348,79 +1535,85 @@ function it(e, t) {
1348
1535
  });
1349
1536
  });
1350
1537
  }
1351
- function z(e) {
1352
- const t = yt.get(e);
1353
- typeof t == "number" && (window.clearTimeout(t), yt.delete(e));
1538
+ function B(e) {
1539
+ const t = St.get(e);
1540
+ typeof t == "number" && (window.clearTimeout(t), St.delete(e));
1354
1541
  }
1355
- function Hn(e, t) {
1356
- we.has(e) || we.set(e, e.innerHTML), e.textContent = t;
1542
+ function ei(e, t) {
1543
+ Te.has(e) || Te.set(e, e.innerHTML), e.textContent = t;
1357
1544
  }
1358
- function je(e) {
1359
- const t = we.get(e);
1360
- t !== void 0 && (e.innerHTML = t, we.delete(e));
1545
+ function We(e) {
1546
+ const t = Te.get(e);
1547
+ t !== void 0 && (e.innerHTML = t, Te.delete(e));
1361
1548
  }
1362
- function _n(e, t) {
1549
+ function ti(e, t) {
1363
1550
  const r = e.querySelector("[data-formie-progress-bar]"), n = e.querySelector("[data-formie-progress-value]");
1364
- r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state", On(t)), n && (n.textContent = `${t}%`, n.setAttribute("data-formie-progress-value", `${t}`)));
1551
+ r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state", Qn(t)), n && (n.textContent = `${t}%`, n.setAttribute("data-formie-progress-value", `${t}`)));
1365
1552
  }
1366
- function Dn(e, t) {
1553
+ function ri(e, t) {
1367
1554
  if (!t)
1368
1555
  return;
1369
1556
  const r = (e.dataset.formieLoadingIndicator || "").trim();
1370
1557
  if (r) {
1371
1558
  if (t.setAttribute("data-formie-loading-indicator", r), r === "spinner") {
1372
- ue(t, e, "loading", !0), je(t), t.removeAttribute("data-formie-loading-text");
1559
+ ue(t, e, "loading", !0), We(t), t.removeAttribute("data-formie-loading-text");
1373
1560
  return;
1374
1561
  }
1375
1562
  if (r === "text") {
1376
1563
  const n = (e.dataset.formieLoadingIndicatorText || "").trim(), i = t.textContent?.trim() || "", o = n || i;
1377
- t.setAttribute("data-formie-loading-text", o), Hn(t, o);
1564
+ t.setAttribute("data-formie-loading-text", o), ei(t, o);
1378
1565
  return;
1379
1566
  }
1380
- je(t), t.removeAttribute("data-formie-loading-text");
1567
+ We(t), t.removeAttribute("data-formie-loading-text");
1381
1568
  }
1382
1569
  }
1383
- function tr(e) {
1570
+ function sr(e) {
1384
1571
  return Array.from(e.querySelectorAll("[data-formie-action]"));
1385
1572
  }
1386
- function rr(e, t) {
1573
+ function lr(e, t) {
1387
1574
  if (e.getAttribute("data-formie-loading") === "true")
1388
1575
  return;
1389
- e.setAttribute("data-formie-loading", "true"), tr(e).forEach((n) => {
1576
+ e.setAttribute("data-formie-loading", "true"), sr(e).forEach((n) => {
1390
1577
  "disabled" in n && (n.disabled ? n.setAttribute("data-formie-was-disabled", "true") : n.removeAttribute("data-formie-was-disabled"), n.disabled = !0);
1391
- }), t && (t.setAttribute("data-formie-loading", "true"), Dn(e, t));
1578
+ }), t && (t.setAttribute("data-formie-loading", "true"), ri(e, t));
1392
1579
  }
1393
- function Te(e) {
1394
- e.removeAttribute("data-formie-loading"), tr(e).forEach((r) => {
1580
+ function Me(e) {
1581
+ if (e.removeAttribute("data-formie-loading"), sr(e).forEach((r) => {
1395
1582
  if ("disabled" in r) {
1396
1583
  const n = r, i = n.getAttribute("data-formie-was-disabled") === "true";
1397
1584
  n.disabled = i;
1398
1585
  }
1399
- je(r), r.removeAttribute("data-formie-was-disabled"), r.removeAttribute("data-formie-loading"), ue(r, e, "loading", !1), r.removeAttribute("data-formie-loading-indicator"), r.removeAttribute("data-formie-loading-text");
1400
- });
1586
+ We(r), r.removeAttribute("data-formie-was-disabled"), r.removeAttribute("data-formie-loading"), ue(r, e, "loading", !1), r.removeAttribute("data-formie-loading-indicator"), r.removeAttribute("data-formie-loading-text");
1587
+ }), e.dataset.formieDisableSubmitUntilValid === "true") {
1588
+ const r = e;
1589
+ r.formieValidation && at(e, r.formieValidation);
1590
+ }
1401
1591
  }
1402
- function ot(e, t) {
1403
- const r = er(e), n = $n(e), i = r.findIndex((o) => o.getAttribute("data-formie-page-id") === t);
1592
+ function lt(e, t) {
1593
+ const r = ar(e), n = Yn(e), i = r.findIndex((o) => o.getAttribute("data-formie-page-id") === t);
1404
1594
  if (r.forEach((o) => {
1405
- o.getAttribute("data-formie-page-id") === t ? (o.removeAttribute("data-formie-page-hidden"), le(o, e, "pageHidden")) : (o.setAttribute("data-formie-page-hidden", "true"), V(o, e, "pageHidden"));
1595
+ o.getAttribute("data-formie-page-id") === t ? (o.removeAttribute("data-formie-page-hidden"), le(o, e, "pageHidden")) : (o.setAttribute("data-formie-page-hidden", "true"), O(o, e, "pageHidden"));
1406
1596
  }), n.forEach((o, a) => {
1407
1597
  const s = o.getAttribute("data-formie-page-id") === t, l = i > -1 && a < i;
1408
1598
  ue(o, e, "tabCurrent", s), ue(o, e, "tabComplete", l), s ? o.setAttribute("aria-current", "page") : o.removeAttribute("aria-current"), l ? o.setAttribute("data-formie-tab-complete", "true") : o.removeAttribute("data-formie-tab-complete");
1409
1599
  }), i > -1 && r.length > 0) {
1410
- const o = Vn(e, i, r.length);
1411
- _n(e, o);
1600
+ const o = Zn(e, i, r.length);
1601
+ ti(e, o);
1602
+ }
1603
+ if (ze(e, "pageId", t), J(e), e.dataset.formieDisableSubmitUntilValid === "true") {
1604
+ const o = e;
1605
+ o.formieValidation && at(e, o.formieValidation);
1412
1606
  }
1413
- ze(e, "pageId", t), J(e);
1414
1607
  }
1415
- function xn(e, t) {
1608
+ function ni(e, t) {
1416
1609
  const r = t.meta?.submissionUid;
1417
1610
  typeof r == "string" && r.trim() !== "" && ze(e, "submissionUid", r);
1418
1611
  const n = t.meta?.session?.continuation?.continuationToken;
1419
1612
  typeof n == "string" && n.trim() !== "" ? ze(e, "continuationToken", n) : ae(e, "continuationToken");
1420
1613
  }
1421
- function Nn(e) {
1614
+ function ii(e) {
1422
1615
  const t = e.getAttribute("action");
1423
- t && e.setAttribute("action", qn(t, "resumeToken"));
1616
+ t && e.setAttribute("action", Gn(t, "resumeToken"));
1424
1617
  try {
1425
1618
  const r = new URL(window.location.href);
1426
1619
  if (!r.searchParams.has("resumeToken"))
@@ -1429,12 +1622,12 @@ function Nn(e) {
1429
1622
  } catch {
1430
1623
  }
1431
1624
  }
1432
- function Un(e, t) {
1625
+ function oi(e, t) {
1433
1626
  const r = t.meta?.resumeUrl;
1434
1627
  if (typeof r != "string" || r.trim() === "")
1435
1628
  return;
1436
1629
  const n = r.trim();
1437
- if (!Pn(n))
1630
+ if (!Jn(n))
1438
1631
  return;
1439
1632
  e.getAttribute("action") && e.setAttribute("action", n);
1440
1633
  try {
@@ -1443,31 +1636,31 @@ function Un(e, t) {
1443
1636
  } catch {
1444
1637
  }
1445
1638
  }
1446
- function he(e, t = {}) {
1447
- const n = e.formieValidation, i = er(e)[0]?.getAttribute("data-formie-page-id");
1448
- if (z(e), e.reset(), t.preserveHiddenState || it(e, !1), ae(e, "submissionId"), ae(e, "submissionUid"), ae(e, "continuationToken"), ae(e, "pageId"), Nn(e), n?.resetLiveState(), i) {
1449
- ot(e, i), e.dispatchEvent(new CustomEvent(Ue("reset"), { bubbles: !0 }));
1639
+ function be(e, t = {}) {
1640
+ const n = e.formieValidation, i = ar(e)[0]?.getAttribute("data-formie-page-id");
1641
+ if (B(e), e.reset(), t.preserveHiddenState || st(e, !1), ae(e, "submissionId"), ae(e, "submissionUid"), ae(e, "continuationToken"), ae(e, "pageId"), ii(e), n?.resetLiveState(), i) {
1642
+ lt(e, i), e.dispatchEvent(new CustomEvent(je("reset"), { bubbles: !0 }));
1450
1643
  return;
1451
1644
  }
1452
- J(e), e.dispatchEvent(new CustomEvent(Ue("reset"), { bubbles: !0 }));
1645
+ J(e), e.dispatchEvent(new CustomEvent(je("reset"), { bubbles: !0 }));
1453
1646
  }
1454
- function zn(e) {
1455
- return e.code === kn || e.meta?.resetState === !0;
1647
+ function ai(e) {
1648
+ return e.code === Kn || e.meta?.resetState === !0;
1456
1649
  }
1457
- function jn(e, t) {
1650
+ function si(e, t) {
1458
1651
  const r = t.submitData, n = /* @__PURE__ */ new Set();
1459
1652
  let i = !1;
1460
1653
  if (Array.isArray(r) && r.length > 0) {
1461
1654
  const p = r.filter(
1462
- (y) => typeof y == "object" && y !== null && "event" in y && typeof y.event == "string"
1655
+ (h) => typeof h == "object" && h !== null && "event" in h && typeof h.event == "string"
1463
1656
  );
1464
- for (const y of p) {
1465
- const c = y.event;
1466
- n.add(c), j.log("Dispatching submitData event.", {
1467
- eventName: c
1468
- }), c.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(c, {
1657
+ for (const h of p) {
1658
+ const u = h.event;
1659
+ n.add(u), j.log("Dispatching submitData event.", {
1660
+ eventName: u
1661
+ }), u.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(u, {
1469
1662
  bubbles: !0,
1470
- detail: { data: y.data }
1663
+ detail: { data: h.data }
1471
1664
  }));
1472
1665
  }
1473
1666
  }
@@ -1479,118 +1672,119 @@ function jn(e, t) {
1479
1672
  eventName: d
1480
1673
  })), { hasPaymentFollowUpEvent: i };
1481
1674
  }
1482
- function Bn(e, t, r) {
1675
+ function li(e, t, r) {
1483
1676
  if (j.log("Applying submit result state.", {
1484
1677
  ok: t.ok,
1485
1678
  action: r,
1486
1679
  code: t.code,
1487
1680
  hasRedirect: !!t.redirect?.url,
1488
1681
  hasSubmitData: Array.isArray(t.submitData) && t.submitData.length > 0
1489
- }), zn(t)) {
1490
- he(e), j.log("Resetting state due to stale/reset marker.");
1682
+ }), ai(t)) {
1683
+ be(e), j.log("Resetting state due to stale/reset marker.");
1491
1684
  return;
1492
1685
  }
1493
- const n = jn(e, t);
1686
+ const n = si(e, t);
1494
1687
  if (!t.ok && t.redirect?.url && !n.hasPaymentFollowUpEvent) {
1495
1688
  j.log("Applying redirect fallback for failed result.", {
1496
1689
  url: t.redirect.url,
1497
1690
  target: t.redirect.target
1498
- }), z(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (vt(e, "redirect"), window.location.href = t.redirect.url);
1691
+ }), B(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (At(e, "redirect"), window.location.href = t.redirect.url);
1499
1692
  return;
1500
1693
  }
1501
- if (xn(e, t), !t.ok) {
1502
- j.log("Non-redirect failure; keeping current form state."), z(e);
1694
+ if (ni(e, t), !t.ok) {
1695
+ j.log("Non-redirect failure; keeping current form state."), B(e);
1503
1696
  return;
1504
1697
  }
1505
- if (jt(e, r), t.nextPage?.id) {
1506
- z(e), e.formieValidation?.resetLiveState(), ot(e, t.nextPage.id), j.log("Advanced to next page.", {
1698
+ if (Kt(e, r), t.nextPage?.id) {
1699
+ B(e), e.formieValidation?.resetLiveState(), lt(e, t.nextPage.id), j.log("Advanced to next page.", {
1507
1700
  nextPageId: t.nextPage.id
1508
1701
  });
1509
1702
  return;
1510
1703
  }
1511
1704
  if (r === "save") {
1512
- z(e), Un(e, t), j.log("Applied save/resume token state.");
1705
+ B(e), oi(e, t), j.log("Applied save/resume token state.");
1513
1706
  return;
1514
1707
  }
1515
1708
  if (r === "submit" && !t.redirect?.url) {
1516
- const i = Et(e), o = i === "message" && St(e);
1709
+ const i = wt(e, t), o = i === "message" && Tt(e);
1517
1710
  if (i === "reload") {
1518
- z(e), vt(e, "reload"), window.location.reload();
1711
+ B(e), At(e, "reload"), window.location.reload();
1519
1712
  return;
1520
1713
  }
1521
1714
  if (i === "reset") {
1522
- he(e);
1715
+ be(e);
1523
1716
  return;
1524
1717
  }
1525
- z(e), he(e, { preserveHiddenState: o });
1718
+ B(e), be(e, { preserveHiddenState: o });
1526
1719
  return;
1527
1720
  }
1528
1721
  if (r === "submit" && t.redirect?.url && t.redirect.target === "new-tab") {
1529
- const o = Et(e) === "message" && St(e);
1530
- z(e), he(e, { preserveHiddenState: o });
1722
+ const o = wt(e, t) === "message" && Tt(e);
1723
+ B(e), be(e, { preserveHiddenState: o });
1531
1724
  return;
1532
1725
  }
1533
- z(e);
1726
+ B(e);
1534
1727
  }
1535
1728
  const Ce = /* @__PURE__ */ new WeakMap();
1536
- function nr(e) {
1729
+ function ur(e) {
1537
1730
  return (e.dataset.formieSubmitAction || "").trim();
1538
1731
  }
1539
- function Wn(e) {
1732
+ function ui(e) {
1540
1733
  return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
1541
1734
  }
1542
- function ir(e) {
1735
+ function cr(e) {
1543
1736
  return (e.dataset.formieSubmitActionMessagePosition || "").trim();
1544
1737
  }
1545
- function Kn(e) {
1738
+ function ci(e) {
1546
1739
  const t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
1547
1740
  if (!t)
1548
1741
  return null;
1549
1742
  const r = Number.parseFloat(t);
1550
1743
  return !Number.isFinite(r) || r < 0 ? null : Math.round(r * 1e3);
1551
1744
  }
1552
- function at(e) {
1745
+ function ut(e) {
1553
1746
  const t = e.dataset.formieSubmitActionFormHide;
1554
1747
  if (t === void 0)
1555
1748
  return !1;
1556
1749
  const r = t.trim().toLowerCase();
1557
1750
  return r === "true" || r === "1" || r === "";
1558
1751
  }
1559
- function Gn(e) {
1752
+ function di(e) {
1560
1753
  const t = Ce.get(e);
1561
1754
  typeof t == "number" && (window.clearTimeout(t), Ce.delete(e));
1562
1755
  }
1563
- function or(e) {
1756
+ function dr(e) {
1564
1757
  return e.querySelector("[data-formie-form-messages-top]") || e;
1565
1758
  }
1566
- function ar(e) {
1759
+ function fr(e) {
1567
1760
  return e.querySelector("[data-formie-form-messages-bottom]") || e;
1568
1761
  }
1569
- function Jn(e, t) {
1570
- return t === "bottom-form" ? ar(e) : or(e);
1762
+ function fi(e, t) {
1763
+ return t === "bottom-form" ? fr(e) : dr(e);
1571
1764
  }
1572
- function Yn(e, t) {
1573
- return t === "top-form" ? or(e) : t === "bottom-form" && !at(e) ? ar(e) : e;
1765
+ function mi(e, t) {
1766
+ return t === "top-form" ? dr(e) : t === "bottom-form" && !ut(e) ? fr(e) : e;
1574
1767
  }
1575
- function Zn(e) {
1576
- const t = Wn(e), r = Jn(e, t);
1768
+ function pi(e) {
1769
+ const t = ui(e), r = fi(e, t);
1577
1770
  let n = r.querySelector("[data-formie-error-container], [data-formie-errors]");
1578
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"), V(n, e, "errors")), n.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1771
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"), O(n, e, "errors")), n.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1579
1772
  }
1580
- function Qn(e, t) {
1773
+ function gi(e, t) {
1581
1774
  let r = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
1582
- return r || (r = document.createElement("div"), r.setAttribute("data-formie-error-message-container", "true"), t.appendChild(r)), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-error", "true"), V(r, e, "message", "messageError"), r.setAttribute("role", "alert"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r;
1775
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-error-message-container", "true"), t.appendChild(r)), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-error", "true"), O(r, e, "message", "messageError"), r.setAttribute("role", "alert"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r;
1583
1776
  }
1584
- function Xn(e, t) {
1777
+ function hi(e, t) {
1585
1778
  let r = e.querySelector("[data-formie-success-container]");
1586
- const n = Yn(e, t);
1587
- return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"), V(r, e, "successes")), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1779
+ const n = mi(e, t);
1780
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"), O(r, e, "successes")), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1588
1781
  }
1589
- function ei(e) {
1590
- let t = e.querySelector("[data-formie-field-errors]");
1591
- return t || (t = document.createElement("div"), t.setAttribute("data-formie-field-errors", "true"), V(t, e, "fieldErrors"), e.appendChild(t)), t;
1782
+ function bi(e) {
1783
+ return rr(e, (t) => {
1784
+ O(t, e, "fieldErrors");
1785
+ });
1592
1786
  }
1593
- function ti(e, t) {
1787
+ function yi(e, t) {
1594
1788
  const r = (e.getAttribute("aria-describedby") || "").trim();
1595
1789
  if (!r)
1596
1790
  return;
@@ -1601,26 +1795,26 @@ function ti(e, t) {
1601
1795
  }
1602
1796
  e.removeAttribute("aria-describedby");
1603
1797
  }
1604
- function ri(e, t) {
1798
+ function vi(e, t) {
1605
1799
  e.setAttribute("aria-errormessage", t);
1606
1800
  }
1607
- function ni(e, t) {
1801
+ function Ei(e, t) {
1608
1802
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
1609
1803
  }
1610
- function sr(e) {
1804
+ function mr(e) {
1611
1805
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
1612
1806
  const r = t, n = r.querySelector("[data-formie-field-errors]"), i = n?.id || "", o = Array.from(r.querySelectorAll("[data-formie-field-error]")).map((a) => a.id).filter(Boolean);
1613
1807
  le(r, e, "fieldLayoutError"), r.removeAttribute("data-formie-field-has-error"), r.querySelectorAll("[data-formie-field-error]").forEach((a) => {
1614
1808
  a.remove();
1615
1809
  }), n && !n.querySelector("[data-formie-field-error]") && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((a) => {
1616
1810
  const s = a;
1617
- s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i && ti(s, i), o.forEach((l) => {
1618
- ni(s, l);
1811
+ s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i && yi(s, i), o.forEach((l) => {
1812
+ Ei(s, l);
1619
1813
  });
1620
1814
  });
1621
1815
  }), J(e);
1622
1816
  }
1623
- function lr(e) {
1817
+ function pr(e) {
1624
1818
  e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
1625
1819
  const r = t;
1626
1820
  r.querySelectorAll("[data-formie-error]").forEach((n) => {
@@ -1628,92 +1822,92 @@ function lr(e) {
1628
1822
  }), le(r, e, "message", "messageError"), r.removeAttribute("data-formie-message"), r.removeAttribute("data-formie-message-error"), r.removeAttribute("role"), r.removeAttribute("aria-live"), r.removeAttribute("aria-atomic"), r.querySelector("[data-formie-error]") || (r.innerHTML = "");
1629
1823
  });
1630
1824
  }
1631
- function st(e) {
1632
- Gn(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((t) => {
1825
+ function ct(e) {
1826
+ di(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((t) => {
1633
1827
  t.remove();
1634
1828
  }), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
1635
1829
  const r = t;
1636
1830
  r.querySelectorAll("[data-formie-success]").forEach((n) => {
1637
1831
  n.remove();
1638
1832
  }), le(r, e, "message", "messageSuccess"), r.removeAttribute("data-formie-message"), r.removeAttribute("data-formie-message-success"), r.removeAttribute("role"), r.removeAttribute("aria-live"), r.removeAttribute("aria-atomic"), r.querySelector("[data-formie-success]") || (r.innerHTML = "");
1639
- }), nr(e) === "message" && at(e) || it(e, !1);
1833
+ }), ur(e) === "message" && ut(e) || st(e, !1);
1640
1834
  }
1641
- function ur(e) {
1835
+ function gr(e) {
1642
1836
  e.querySelectorAll('[aria-invalid="true"]').forEach((t) => {
1643
1837
  t.removeAttribute("aria-invalid");
1644
1838
  });
1645
1839
  }
1646
- function At(e, t) {
1840
+ function Mt(e, t) {
1647
1841
  const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
1648
1842
  n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
1649
1843
  }
1650
- function ii(e, t) {
1844
+ function Si(e, t) {
1651
1845
  Object.entries(t).forEach(([r, n]) => {
1652
1846
  const i = e.querySelector(`[data-formie-field-handle="${r}"]`);
1653
1847
  if (!i)
1654
1848
  return;
1655
- const o = ei(i), a = o.id && o.id.trim() ? o.id : `${r}-errors`;
1656
- o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), V(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), n.forEach((l, d) => {
1849
+ const o = bi(i), a = o.id && o.id.trim() ? o.id : `${r}-errors`;
1850
+ o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), O(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), n.forEach((l, d) => {
1657
1851
  const p = document.createElement("div");
1658
- p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`, V(p, e, "fieldError"), p.textContent = l, o.appendChild(p);
1852
+ p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`, O(p, e, "fieldError"), p.textContent = l, o.appendChild(p);
1659
1853
  });
1660
1854
  const s = o.querySelector("[data-formie-field-error]")?.id;
1661
1855
  i.querySelectorAll("input, select, textarea").forEach((l) => {
1662
1856
  const d = l;
1663
- d.setAttribute("aria-invalid", "true"), V(d, e, "fieldControlError"), d.setAttribute("data-formie-input-has-error", "true"), At(d, a), s && ri(d, s);
1857
+ d.setAttribute("aria-invalid", "true"), O(d, e, "fieldControlError"), d.setAttribute("data-formie-input-has-error", "true"), Mt(d, a), s && vi(d, s);
1664
1858
  const p = i.querySelector("[data-formie-instructions]");
1665
- p?.id && At(d, p.id);
1859
+ p?.id && Mt(d, p.id);
1666
1860
  });
1667
1861
  }), J(e);
1668
1862
  }
1669
- function wt(e, t) {
1670
- const r = Zn(e), n = Qn(e, r);
1671
- V(r, e, "errors"), t.forEach((i) => {
1863
+ function Ct(e, t) {
1864
+ const r = pi(e), n = gi(e, r);
1865
+ O(r, e, "errors"), t.forEach((i) => {
1672
1866
  const o = document.createElement("div");
1673
- o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"), V(o, e, "error"), o.innerHTML = i, n.appendChild(o);
1867
+ o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"), O(o, e, "error"), o.innerHTML = i, n.appendChild(o);
1674
1868
  });
1675
1869
  }
1676
- function oi(e, t) {
1677
- return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : nr(e) === "message" && ir(e) !== "";
1870
+ function Ai(e, t) {
1871
+ return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : ur(e) === "message" && cr(e) !== "";
1678
1872
  }
1679
- function ai(e, t) {
1680
- const r = ir(e);
1873
+ function wi(e, t) {
1874
+ const r = cr(e);
1681
1875
  if (!r)
1682
1876
  return;
1683
- const n = Xn(e, r);
1684
- V(n, e, "message", "messageSuccess"), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-success", "true"), n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true");
1877
+ const n = hi(e, r);
1878
+ O(n, e, "message", "messageSuccess"), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-success", "true"), n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true");
1685
1879
  const i = document.createElement("div");
1686
- i.setAttribute("data-formie-success", "true"), V(i, e, "success"), i.innerHTML = t, n.appendChild(i), at(e) && it(e, !0);
1687
- const o = Kn(e);
1880
+ i.setAttribute("data-formie-success", "true"), O(i, e, "success"), i.innerHTML = t, n.appendChild(i), ut(e) && st(e, !0);
1881
+ const o = ci(e);
1688
1882
  if (o !== null) {
1689
1883
  const a = window.setTimeout(() => {
1690
- Ce.delete(e), st(e);
1884
+ Ce.delete(e), ct(e);
1691
1885
  }, o);
1692
1886
  Ce.set(e, a);
1693
1887
  }
1694
1888
  }
1695
- function Me(e, t) {
1696
- if (sr(e), lr(e), st(e), ur(e), t.ok) {
1697
- oi(e, t) && ai(e, t.message || "");
1889
+ function Le(e, t) {
1890
+ if (mr(e), pr(e), ct(e), gr(e), t.ok) {
1891
+ Ai(e, t) && wi(e, t.message || "");
1698
1892
  return;
1699
1893
  }
1700
- if (t.fieldErrors && ii(e, t.fieldErrors), t.formErrors?.length) {
1701
- wt(e, t.formErrors);
1894
+ if (t.fieldErrors && Si(e, t.fieldErrors), t.formErrors?.length) {
1895
+ Ct(e, t.formErrors);
1702
1896
  return;
1703
1897
  }
1704
- !t.fieldErrors && t.message && wt(e, [t.message]);
1898
+ !t.fieldErrors && t.message && Ct(e, [t.message]);
1705
1899
  }
1706
- const si = _("general", "submit-flow");
1707
- function li(e) {
1900
+ const Ti = _("general", "submit-flow");
1901
+ function Mi(e) {
1708
1902
  return !(!e.ok && e.stage === "validate");
1709
1903
  }
1710
- function cr(e) {
1904
+ function hr(e) {
1711
1905
  return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
1712
1906
  }
1713
- function dr(e) {
1714
- sr(e), lr(e), st(e), ur(e);
1907
+ function br(e) {
1908
+ mr(e), pr(e), ct(e), gr(e);
1715
1909
  }
1716
- async function fr(e) {
1910
+ async function yr(e) {
1717
1911
  const {
1718
1912
  id: t,
1719
1913
  target: r,
@@ -1725,38 +1919,38 @@ async function fr(e) {
1725
1919
  submitter: l,
1726
1920
  waitForSubmitDelay: d,
1727
1921
  onRefreshTokensAfterSubmit: p,
1728
- dispatchSubmitResult: y
1922
+ dispatchSubmitResult: h
1729
1923
  } = e;
1730
- dr(n), rr(n, l || null);
1731
- let c = {
1924
+ br(n), lr(n, l || null);
1925
+ let u = {
1732
1926
  ok: !1,
1733
1927
  code: "SUBMIT_ERROR",
1734
1928
  message: "Submission failed.",
1735
1929
  formErrors: ["Submission failed."]
1736
1930
  };
1737
1931
  try {
1738
- await d(n), c = await Zt(n, s, i, {
1932
+ await d(n), u = await tr(n, s, i, {
1739
1933
  validator: o,
1740
1934
  validateOnSubmit: a
1741
- }), Me(n, c), Bn(n, c, s), li(c) && await p(c), y(c);
1742
- } catch (u) {
1743
- c = {
1935
+ }), Le(n, u), li(n, u, s), Mi(u) && await p(u), h(u);
1936
+ } catch (c) {
1937
+ u = {
1744
1938
  ok: !1,
1745
1939
  code: "SUBMIT_ERROR",
1746
- message: u instanceof Error ? u.message : "Submission failed.",
1747
- formErrors: [u instanceof Error ? u.message : "Submission failed."]
1748
- }, Me(n, c), y(c), si.warn("Submit failed with exception.", {
1940
+ message: c instanceof Error ? c.message : "Submission failed.",
1941
+ formErrors: [c instanceof Error ? c.message : "Submission failed."]
1942
+ }, Le(n, u), h(u), Ti.warn("Submit failed with exception.", {
1749
1943
  id: t,
1750
1944
  action: s,
1751
1945
  target: r,
1752
- error: u instanceof Error ? u.message : u
1946
+ error: c instanceof Error ? c.message : c
1753
1947
  });
1754
1948
  } finally {
1755
- cr(c) || Te(n);
1949
+ hr(u) || Me(n);
1756
1950
  }
1757
- return c;
1951
+ return u;
1758
1952
  }
1759
- class mr {
1953
+ class vr {
1760
1954
  constructor() {
1761
1955
  this.modules = /* @__PURE__ */ new Map();
1762
1956
  }
@@ -1776,127 +1970,127 @@ class mr {
1776
1970
  return Array.from(this.modules.values());
1777
1971
  }
1778
1972
  }
1779
- const ui = {
1973
+ const Ci = {
1780
1974
  // Address providers stay behind lazy importer entries because their SDKs are
1781
1975
  // optional and often much heavier than the base form client.
1782
- "address-finder": () => import("./address-finder-CQW81kY0.js").then((e) => e.addressFinderModule),
1783
- "google-address": () => import("./google-address-BcTBncyS.js").then((e) => e.googleAddressModule),
1784
- loqate: () => import("./loqate-nXuTX7In.js").then((e) => e.loqateModule),
1785
- "place-kit": () => import("./place-kit-Dg6f_UoM.js").then((e) => e.placeKitModule)
1786
- }, ci = {
1976
+ "address-finder": () => import("./address-finder-BU4roxT6.js").then((e) => e.addressFinderModule),
1977
+ "google-address": () => import("./google-address-BD8IZ86V.js").then((e) => e.googleAddressModule),
1978
+ loqate: () => import("./loqate-B-ZNS65B.js").then((e) => e.loqateModule),
1979
+ "place-kit": () => import("./place-kit-DizZWV_e.js").then((e) => e.placeKitModule)
1980
+ }, Li = {
1787
1981
  // Module ids map directly to importer functions so the loader can fetch only
1788
1982
  // the captcha chunks required by the current form manifest.
1789
- "captcha-eu": () => import("./captcha-eu-DIa6aUWz.js").then((e) => e.captchaEuModule),
1790
- "friendly-captcha-v1": () => import("./friendly-captcha-v1-DA2QPKA3.js").then((e) => e.friendlyCaptchaV1Module),
1791
- "friendly-captcha-v2": () => import("./friendly-captcha-v2-BorOWiz_.js").then((e) => e.friendlyCaptchaV2Module),
1792
- hcaptcha: () => import("./hcaptcha-BchdVCqq.js").then((e) => e.hcaptchaModule),
1793
- "recaptcha-enterprise": () => import("./recaptcha-enterprise--VYAeeqz.js").then((e) => e.recaptchaEnterpriseModule),
1794
- "recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-atBNe5ml.js").then((e) => e.recaptchaV2CheckboxModule),
1795
- "recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-DnBufNPT.js").then((e) => e.recaptchaV2InvisibleModule),
1796
- "recaptcha-v3": () => import("./recaptcha-v3-CF6O8rDj.js").then((e) => e.recaptchaV3Module),
1797
- snaptcha: () => import("./snaptcha-C7qQo02f.js").then((e) => e.snaptchaModule),
1798
- turnstile: () => import("./turnstile-_uCRwnU-.js").then((e) => e.turnstileModule)
1799
- }, di = {
1983
+ "captcha-eu": () => import("./captcha-eu-BAPzHNts.js").then((e) => e.captchaEuModule),
1984
+ "friendly-captcha-v1": () => import("./friendly-captcha-v1-DdlcGiFY.js").then((e) => e.friendlyCaptchaV1Module),
1985
+ "friendly-captcha-v2": () => import("./friendly-captcha-v2-76w-YnFm.js").then((e) => e.friendlyCaptchaV2Module),
1986
+ hcaptcha: () => import("./hcaptcha-BNNTL6uf.js").then((e) => e.hcaptchaModule),
1987
+ "recaptcha-enterprise": () => import("./recaptcha-enterprise-BbOvO7JZ.js").then((e) => e.recaptchaEnterpriseModule),
1988
+ "recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-SY3ti5iQ.js").then((e) => e.recaptchaV2CheckboxModule),
1989
+ "recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-DSmQnn6c.js").then((e) => e.recaptchaV2InvisibleModule),
1990
+ "recaptcha-v3": () => import("./recaptcha-v3-DNh7YCnR.js").then((e) => e.recaptchaV3Module),
1991
+ snaptcha: () => import("./snaptcha-VuOUOaLj.js").then((e) => e.snaptchaModule),
1992
+ turnstile: () => import("./turnstile-9tM7q_LK.js").then((e) => e.turnstileModule)
1993
+ }, Ii = {
1800
1994
  // Keep the builtin map flat and explicit so manifest ids remain the source of
1801
1995
  // truth for lazy-loading first-party field enhancements.
1802
- calculations: () => import("./calculations-BqZsENCq.js").then((e) => e.calculationsModule),
1803
- "checkbox-radio": () => import("./checkbox-radio-BI-UjgMF.js").then((e) => e.checkboxRadioModule),
1804
- conditions: () => import("./conditions-BVl6jTYo.js").then((e) => e.conditionsModule),
1805
- "date-picker": () => import("./date-picker-69TgvErA.js").then((e) => e.datePickerModule),
1806
- "file-upload": () => import("./file-upload-BDZZftgL.js").then((e) => e.fileUploadModule),
1807
- hidden: () => import("./hidden-D8RqSPt7.js").then((e) => e.hiddenModule),
1808
- "phone-country": () => import("./phone-country-K9pYAlzM.js").then((e) => e.phoneCountryModule),
1809
- repeater: () => import("./repeater-CB7Yojvx.js").then((e) => e.repeaterModule),
1810
- "rich-text": () => import("./rich-text-nAV_SQZo.js").then((e) => e.richTextModule),
1811
- signature: () => import("./signature-BT6CsQ6n.js").then((e) => e.signatureModule),
1812
- summary: () => import("./summary-DC_ipXCU.js").then((e) => e.summaryModule),
1813
- table: () => import("./table-BEAI99qo.js").then((e) => e.tableModule),
1814
- "text-limit": () => import("./text-limit-Blgq5G-G.js").then((e) => e.textLimitModule)
1815
- }, fi = {
1996
+ calculations: () => import("./calculations-C9t6Zop9.js").then((e) => e.calculationsModule),
1997
+ "checkbox-radio": () => import("./checkbox-radio-CHeLNVIK.js").then((e) => e.checkboxRadioModule),
1998
+ conditions: () => import("./conditions-DKxVCsjD.js").then((e) => e.conditionsModule),
1999
+ "date-picker": () => import("./date-picker-B3iQ797Z.js").then((e) => e.datePickerModule),
2000
+ "file-upload": () => import("./file-upload-DP2TOUYV.js").then((e) => e.fileUploadModule),
2001
+ hidden: () => import("./hidden-CW6Rcf1N.js").then((e) => e.hiddenModule),
2002
+ "phone-country": () => import("./phone-country-Cm5YUeXI.js").then((e) => e.phoneCountryModule),
2003
+ repeater: () => import("./repeater-DM0vuFNQ.js").then((e) => e.repeaterModule),
2004
+ "rich-text": () => import("./rich-text-C8aGYp70.js").then((e) => e.richTextModule),
2005
+ signature: () => import("./signature-pFhZfH7d.js").then((e) => e.signatureModule),
2006
+ summary: () => import("./summary-Da7Ktg3N.js").then((e) => e.summaryModule),
2007
+ table: () => import("./table-C0PmR9bI.js").then((e) => e.tableModule),
2008
+ "text-limit": () => import("./text-limit-mLEwZDIa.js").then((e) => e.textLimitModule)
2009
+ }, Ri = {
1816
2010
  // Keep payment providers lazy and separately addressable so forms only ship
1817
2011
  // the payment SDK wrapper code they actually declare in their manifest.
1818
- bpoint: () => import("./bpoint-D8OjLmsn.js").then((e) => e.bpointModule),
1819
- eway: () => import("./eway-1GPxH6DU.js").then((e) => e.ewayModule),
1820
- "go-cardless": () => import("./go-cardless-DwBgERcA.js").then((e) => e.goCardlessModule),
1821
- mollie: () => import("./mollie-qdCynQCd.js").then((e) => e.mollieModule),
1822
- moneris: () => import("./moneris-BNEA-laO.js").then((e) => e.monerisModule),
1823
- opayo: () => import("./opayo-BJtXOkuK.js").then((e) => e.opayoModule),
1824
- paddle: () => import("./paddle-D72Pa8kr.js").then((e) => e.paddleModule),
1825
- paypal: () => import("./paypal-Cqt2bned.js").then((e) => e.paypalModule),
1826
- payway: () => import("./payway-BjCqsc0H.js").then((e) => e.paywayModule),
1827
- square: () => import("./square-C5AH3trb.js").then((e) => e.squareModule),
1828
- stripe: () => import("./stripe-EJK0RyUv.js").then((e) => e.stripeModule)
1829
- }, mi = {
1830
- ...di,
1831
- ...ui,
1832
- ...ci,
1833
- ...fi
1834
- }, Oe = /* @__PURE__ */ new Map(), D = _("general", "loader"), pi = new Function("src", "return import(src);");
1835
- async function be(e, t, r, n) {
1836
- await e(Hr(r), n), await e(Or(t, r), n);
1837
- }
1838
- function pr(e) {
2012
+ bpoint: () => import("./bpoint-uNg5j6rt.js").then((e) => e.bpointModule),
2013
+ eway: () => import("./eway-DCielIML.js").then((e) => e.ewayModule),
2014
+ "go-cardless": () => import("./go-cardless-rwCkzbNK.js").then((e) => e.goCardlessModule),
2015
+ mollie: () => import("./mollie-BDAZ-1X4.js").then((e) => e.mollieModule),
2016
+ moneris: () => import("./moneris-B1b0uEtY.js").then((e) => e.monerisModule),
2017
+ opayo: () => import("./opayo-CC5hraHo.js").then((e) => e.opayoModule),
2018
+ paddle: () => import("./paddle-B4GmrDsq.js").then((e) => e.paddleModule),
2019
+ paypal: () => import("./paypal-BFS6XsIS.js").then((e) => e.paypalModule),
2020
+ payway: () => import("./payway-DekoJead.js").then((e) => e.paywayModule),
2021
+ square: () => import("./square-BR9pvToy.js").then((e) => e.squareModule),
2022
+ stripe: () => import("./stripe-OHUwoV9g.js").then((e) => e.stripeModule)
2023
+ }, Fi = {
2024
+ ...Ii,
2025
+ ...Ci,
2026
+ ...Li,
2027
+ ...Ri
2028
+ }, _e = /* @__PURE__ */ new Map(), D = _("general", "loader"), ki = new Function("src", "return import(src);");
2029
+ async function ye(e, t, r, n) {
2030
+ await e(Br(r), n), await e(Ur(t, r), n);
2031
+ }
2032
+ function Er(e) {
1839
2033
  return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
1840
2034
  }
1841
- async function gi(e, t) {
1842
- const r = mi[e];
1843
- return r ? (Oe.has(e) || Oe.set(e, (async () => {
2035
+ async function Pi(e, t) {
2036
+ const r = Fi[e];
2037
+ return r ? (_e.has(e) || _e.set(e, (async () => {
1844
2038
  try {
1845
2039
  const n = await r();
1846
- return pr(n) ? (t.registry.register(n), n) : null;
2040
+ return Er(n) ? (t.registry.register(n), n) : null;
1847
2041
  } catch (n) {
1848
2042
  return console.error("[formie] Failed to load builtin module:", e, n), D.warn("Failed loading builtin module.", { moduleId: e, error: n }), null;
1849
2043
  }
1850
- })()), Oe.get(e) || null) : null;
2044
+ })()), _e.get(e) || null) : null;
1851
2045
  }
1852
- async function hi(e) {
2046
+ async function qi(e) {
1853
2047
  try {
1854
- const t = await pi(e), r = t?.default || t?.formieModule || null;
1855
- return pr(r) ? r : null;
2048
+ const t = await ki(e), r = t?.default || t?.formieModule || null;
2049
+ return Er(r) ? r : null;
1856
2050
  } catch (t) {
1857
2051
  return console.error("[formie] Failed to load module from src:", e, t), D.warn("Failed loading module from src.", { src: e, error: t }), null;
1858
2052
  }
1859
2053
  }
1860
- async function bi(e, t) {
2054
+ async function Vi(e, t) {
1861
2055
  const r = t.registry.get(e.id);
1862
2056
  if (r)
1863
2057
  return r;
1864
- const n = await gi(e.id, t);
2058
+ const n = await Pi(e.id, t);
1865
2059
  if (n)
1866
2060
  return n;
1867
2061
  if (e.src) {
1868
- const i = await hi(e.src);
2062
+ const i = await qi(e.src);
1869
2063
  if (i)
1870
2064
  return t.registry.register(i), i;
1871
2065
  }
1872
2066
  return null;
1873
2067
  }
1874
- function He(e) {
2068
+ function De(e) {
1875
2069
  return typeof window.CSS?.escape == "function" ? window.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1876
2070
  }
1877
- function ye(e, t) {
2071
+ function ve(e, t) {
1878
2072
  return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
1879
2073
  }
1880
- function yi(e, t) {
2074
+ function Oi(e, t) {
1881
2075
  const r = t.setupContext.root, n = t.setupContext.form, i = e.targetType, o = e.targetId;
1882
- return i === "selector" ? ye(r, o).map((a) => ({ scope: i, element: a })) : i === "field" ? ye(r, `[data-formie-field-handle="${He(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "page" ? ye(r, `[data-formie-page-id="${He(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "button" ? ye(r, `[data-formie-action="${He(o)}"]`).map((a) => ({ scope: i, element: a })) : [{
2076
+ return i === "selector" ? ve(r, o).map((a) => ({ scope: i, element: a })) : i === "field" ? ve(r, `[data-formie-field-handle="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "page" ? ve(r, `[data-formie-page-id="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "button" ? ve(r, `[data-formie-action="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : [{
1883
2077
  scope: "form",
1884
2078
  element: n || r
1885
2079
  }];
1886
2080
  }
1887
- function vi(e, t) {
2081
+ function $i(e, t) {
1888
2082
  return (e.targets && e.targets.length > 0 ? e.targets : [{
1889
2083
  targetType: "form",
1890
2084
  targetId: "form"
1891
- }]).flatMap((n) => yi(n, t));
2085
+ }]).flatMap((n) => Oi(n, t));
1892
2086
  }
1893
- async function gr(e, t) {
2087
+ async function Sr(e, t) {
1894
2088
  const r = [];
1895
2089
  D.log("Loading module manifest.", {
1896
2090
  manifestCount: e.length
1897
2091
  });
1898
2092
  for (const n of e) {
1899
- const i = await bi(n, t);
2093
+ const i = await Vi(n, t);
1900
2094
  if (!i) {
1901
2095
  D.warn("Skipping manifest item (definition not resolved).", {
1902
2096
  moduleId: n.id,
@@ -1904,7 +2098,7 @@ async function gr(e, t) {
1904
2098
  });
1905
2099
  continue;
1906
2100
  }
1907
- const o = vi(n, t);
2101
+ const o = $i(n, t);
1908
2102
  D.log("Resolved module targets.", {
1909
2103
  moduleId: i.id,
1910
2104
  targets: n.targets || [],
@@ -1936,36 +2130,36 @@ async function gr(e, t) {
1936
2130
  options: l,
1937
2131
  manifestItem: n
1938
2132
  };
1939
- await be(t.setupContext.emit, d, "before-setup", p);
1940
- let y = null;
2133
+ await ye(t.setupContext.emit, d, "before-setup", p);
2134
+ let h = null;
1941
2135
  try {
1942
- const c = await i.setup({
2136
+ const u = await i.setup({
1943
2137
  ...t.setupContext,
1944
2138
  target: a.element,
1945
2139
  scope: a.scope,
1946
2140
  options: l
1947
2141
  });
1948
- c && (y = c);
1949
- } catch (c) {
1950
- console.error(`[formie] Module "${i.id}" setup failed:`, c), D.warn("Module setup failed.", {
2142
+ u && (h = u);
2143
+ } catch (u) {
2144
+ console.error(`[formie] Module "${i.id}" setup failed:`, u), D.warn("Module setup failed.", {
1951
2145
  moduleId: i.id,
1952
2146
  scope: a.scope,
1953
- error: c
2147
+ error: u
1954
2148
  });
1955
2149
  }
1956
- await be(t.setupContext.emit, d, "after-setup", {
2150
+ await ye(t.setupContext.emit, d, "after-setup", {
1957
2151
  ...p,
1958
- instanceCreated: !!y
1959
- }), y && (D.log("Module instance created.", {
2152
+ instanceCreated: !!h
2153
+ }), h && (D.log("Module instance created.", {
1960
2154
  moduleId: i.id,
1961
2155
  scope: a.scope
1962
2156
  }), r.push({
1963
- ...y,
2157
+ ...h,
1964
2158
  destroy: async () => {
1965
2159
  D.log("Destroying module instance.", {
1966
2160
  moduleId: i.id,
1967
2161
  scope: a.scope
1968
- }), await be(t.setupContext.emit, d, "before-destroy", p), await y.destroy(), await be(t.setupContext.emit, d, "after-destroy", p), D.log("Module instance destroyed.", {
2162
+ }), await ye(t.setupContext.emit, d, "before-destroy", p), await h.destroy(), await ye(t.setupContext.emit, d, "after-destroy", p), D.log("Module instance destroyed.", {
1969
2163
  moduleId: i.id,
1970
2164
  scope: a.scope
1971
2165
  });
@@ -1977,7 +2171,7 @@ async function gr(e, t) {
1977
2171
  instanceCount: r.length
1978
2172
  }), r;
1979
2173
  }
1980
- const Ei = /* @__PURE__ */ new Set([
2174
+ const Hi = /* @__PURE__ */ new Set([
1981
2175
  "CRAFT_CSRF_TOKEN",
1982
2176
  "action",
1983
2177
  "redirect",
@@ -1989,7 +2183,7 @@ const Ei = /* @__PURE__ */ new Set([
1989
2183
  "draftContext",
1990
2184
  "continuationToken"
1991
2185
  ]);
1992
- function Be(e, t) {
2186
+ function Ke(e, t) {
1993
2187
  if (e == null)
1994
2188
  return String(e);
1995
2189
  if (typeof e == "string")
@@ -2003,65 +2197,65 @@ function Be(e, t) {
2003
2197
  if (typeof Blob < "u" && e instanceof Blob)
2004
2198
  return `[blob:${e.size}:${e.type}]`;
2005
2199
  if (Array.isArray(e))
2006
- return `[${e.map((r) => Be(r, t)).join(",")}]`;
2200
+ return `[${e.map((r) => Ke(r, t)).join(",")}]`;
2007
2201
  if (typeof e == "object") {
2008
2202
  if (t.has(e))
2009
2203
  return "[circular]";
2010
2204
  t.add(e);
2011
- const r = Object.entries(e).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${Be(i, t)}`);
2205
+ const r = Object.entries(e).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${Ke(i, t)}`);
2012
2206
  return t.delete(e), `{${r.join(",")}}`;
2013
2207
  }
2014
2208
  return JSON.stringify(String(e));
2015
2209
  }
2016
- function Si(e) {
2017
- return Be(e, /* @__PURE__ */ new WeakSet());
2210
+ function _i(e) {
2211
+ return Ke(e, /* @__PURE__ */ new WeakSet());
2018
2212
  }
2019
- function Ai(e) {
2213
+ function Di(e) {
2020
2214
  if (!e)
2021
2215
  return !1;
2022
2216
  const t = e.endsWith("[]") ? e.slice(0, -2) : e;
2023
- return !Ei.has(t);
2217
+ return !Hi.has(t);
2024
2218
  }
2025
- function Tt(e) {
2026
- const t = Array.from(new FormData(e).entries()).filter(([r]) => Ai(String(r || "")));
2027
- return Si(t);
2219
+ function Lt(e) {
2220
+ const t = Array.from(new FormData(e).entries()).filter(([r]) => Di(String(r || "")));
2221
+ return _i(t);
2028
2222
  }
2029
- function wi(e, t = {}) {
2223
+ function xi(e, t = {}) {
2030
2224
  let r = null, n = !1, i = !1, o = null, a = null, s = null;
2031
2225
  const l = () => {
2032
2226
  o !== null && (window.cancelAnimationFrame(o), o = null), a !== null && (window.clearTimeout(a), a = null), s !== null && (window.clearTimeout(s), s = null);
2033
- }, d = () => n ? (i = Tt(e) !== r, i) : !1, p = () => {
2034
- r = Tt(e), n = !0, i = !1;
2035
- }, y = () => {
2227
+ }, d = () => n ? (i = Lt(e) !== r, i) : !1, p = () => {
2228
+ r = Lt(e), n = !0, i = !1;
2229
+ }, h = () => {
2036
2230
  l(), n = !1, o = window.requestAnimationFrame(() => {
2037
2231
  o = null, s = window.setTimeout(() => {
2038
2232
  s = null, p();
2039
2233
  }, 0);
2040
2234
  });
2041
- }, c = () => {
2235
+ }, u = () => {
2042
2236
  a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
2043
2237
  a = null, d();
2044
2238
  }, 120);
2045
- }, u = (h) => {
2046
- t.shouldWarn && !t.shouldWarn() || d() && (h.preventDefault(), h.returnValue = "");
2239
+ }, c = (b) => {
2240
+ t.shouldWarn && !t.shouldWarn() || d() && (b.preventDefault(), b.returnValue = "");
2047
2241
  };
2048
- return e.addEventListener("input", c), e.addEventListener("change", c), window.addEventListener("beforeunload", u), y(), {
2242
+ return e.addEventListener("input", u), e.addEventListener("change", u), window.addEventListener("beforeunload", c), h(), {
2049
2243
  captureBaseline: p,
2050
- scheduleBaselineCapture: y,
2244
+ scheduleBaselineCapture: h,
2051
2245
  refreshDirtyState: d,
2052
2246
  destroy: () => {
2053
- l(), e.removeEventListener("input", c), e.removeEventListener("change", c), window.removeEventListener("beforeunload", u);
2247
+ l(), e.removeEventListener("input", u), e.removeEventListener("change", u), window.removeEventListener("beforeunload", c);
2054
2248
  }
2055
2249
  };
2056
2250
  }
2057
- const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])', Ti = 300, Ci = "/actions/formie/server/forms/render", Ct = "/api", Mi = "/actions/formie/server/forms/refresh-tokens", Li = "/actions/formie/server/submissions/submit", Ii = "/actions/formie/server/submissions/set-page", Fi = "/actions/formie/server/submissions/clear-submission", Ri = "/actions/formie/file-upload/hydrate", L = _("general", "client"), Mt = /* @__PURE__ */ new Set();
2251
+ const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])', Ni = 300, Ui = "/actions/formie/server/forms/render", It = "/api", Bi = "/actions/formie/server/forms/refresh-tokens", ji = "/actions/formie/server/submissions/submit", zi = "/actions/formie/server/submissions/set-page", Wi = "/actions/formie/server/submissions/clear-submission", Ki = "/actions/formie/file-upload/hydrate", L = _("general", "client"), Rt = /* @__PURE__ */ new Set();
2058
2252
  function ce(e, t) {
2059
2253
  if (e == null || e === "")
2060
2254
  return t;
2061
2255
  const r = e.toLowerCase();
2062
2256
  return !(r === "false" || r === "0" || r === "off");
2063
2257
  }
2064
- function We(e) {
2258
+ function Ge(e) {
2065
2259
  return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? ce(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? ce(e.formieStaticCache, !1) : !1;
2066
2260
  }
2067
2261
  function ee(e) {
@@ -2071,7 +2265,7 @@ function ee(e) {
2071
2265
  transport: t.formieTransport || "rest",
2072
2266
  formHandle: t.formieHandle,
2073
2267
  endpoint: t.formieEndpoint,
2074
- staticCache: We(t),
2268
+ staticCache: Ge(t),
2075
2269
  autoVisible: ce(t.formieAutoVisible, !0),
2076
2270
  compatibility: ce(t.formieCompatibility, !1)
2077
2271
  };
@@ -2079,16 +2273,16 @@ function ee(e) {
2079
2273
  function Fe(e) {
2080
2274
  return e || "server-rendered";
2081
2275
  }
2082
- function Re(e) {
2276
+ function ke(e) {
2083
2277
  return e || "rest";
2084
2278
  }
2085
- function Ee(e) {
2279
+ function Se(e) {
2086
2280
  return e instanceof HTMLFormElement ? e : e.querySelector("form");
2087
2281
  }
2088
- function ki(e, t) {
2089
- Mt.has(e) || (Mt.add(e), L.warn(t));
2282
+ function Gi(e, t) {
2283
+ Rt.has(e) || (Rt.add(e), L.warn(t));
2090
2284
  }
2091
- function hr(e, t) {
2285
+ function Ar(e, t) {
2092
2286
  if (!e)
2093
2287
  return e;
2094
2288
  try {
@@ -2105,22 +2299,22 @@ function hr(e, t) {
2105
2299
  }
2106
2300
  function re(e, t) {
2107
2301
  const r = (e || "").trim();
2108
- return r ? r.includes("/actions/") ? r : hr(t, r) : t;
2302
+ return r ? r.includes("/actions/") ? r : Ar(t, r) : t;
2109
2303
  }
2110
- function qi(e, t) {
2111
- return re(e.endpoint || t.dataset.formieEndpoint, Ci);
2304
+ function Ji(e, t) {
2305
+ return re(e.endpoint || t.dataset.formieEndpoint, Ui);
2112
2306
  }
2113
- function Pi(e, t) {
2307
+ function Yi(e, t) {
2114
2308
  const r = (e.endpoint || t.dataset.formieEndpoint || "").trim();
2115
- return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r : hr(Ct, r) : Ct;
2309
+ return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r : Ar(It, r) : It;
2116
2310
  }
2117
- function lt(e, t) {
2311
+ function dt(e, t) {
2118
2312
  return re(
2119
2313
  t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint,
2120
- Mi
2314
+ Bi
2121
2315
  );
2122
2316
  }
2123
- function Lt(e, t) {
2317
+ function Ft(e, t) {
2124
2318
  if (!e)
2125
2319
  return t;
2126
2320
  try {
@@ -2132,50 +2326,50 @@ function Lt(e, t) {
2132
2326
  return t;
2133
2327
  }
2134
2328
  }
2135
- function $i(e, t, r) {
2136
- const n = r.endpoint || e.dataset.formieEndpoint, i = re(n, Li), o = t.getAttribute("action");
2137
- t.setAttribute("action", Lt(o, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((a) => {
2138
- const s = a.getAttribute("href"), l = re(n, Ii);
2139
- a.setAttribute("href", Lt(s, l));
2329
+ function Zi(e, t, r) {
2330
+ const n = r.endpoint || e.dataset.formieEndpoint, i = re(n, ji), o = t.getAttribute("action");
2331
+ t.setAttribute("action", Ft(o, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((a) => {
2332
+ const s = a.getAttribute("href"), l = re(n, zi);
2333
+ a.setAttribute("href", Ft(s, l));
2140
2334
  }), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((a) => {
2141
2335
  a.setAttribute(
2142
2336
  "data-formie-file-upload-hydrate-endpoint",
2143
- re(n, Ri)
2337
+ re(n, Ki)
2144
2338
  );
2145
2339
  });
2146
2340
  }
2147
- function ut(e, t) {
2341
+ function ft(e, t) {
2148
2342
  if (e === "graphql" && t !== "server-rendered")
2149
2343
  throw new Error(`Formie ${t} mode does not support GraphQL transport yet.`);
2150
2344
  }
2151
- function ct(e) {
2345
+ function mt(e) {
2152
2346
  if (e == null)
2153
2347
  return !1;
2154
2348
  const t = e.trim().toLowerCase();
2155
2349
  return t === "true" || t === "1" || t === "";
2156
2350
  }
2157
- function Vi(e) {
2351
+ function Qi(e) {
2158
2352
  return ce(e.dataset.formieAutomaticSubmissionState, !0);
2159
2353
  }
2160
- function Oi(e, t, r) {
2354
+ function Xi(e, t, r) {
2161
2355
  return re(
2162
2356
  r.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint,
2163
- Fi
2357
+ Wi
2164
2358
  );
2165
2359
  }
2166
- function Hi(e) {
2167
- return ct(e.dataset.formieUnloadWarning);
2360
+ function eo(e) {
2361
+ return mt(e.dataset.formieUnloadWarning);
2168
2362
  }
2169
- function It(e, t) {
2363
+ function kt(e, t) {
2170
2364
  e.setAttribute("data-formie-internal-navigation", t);
2171
2365
  }
2172
- function _e(e) {
2366
+ function xe(e) {
2173
2367
  e.removeAttribute("data-formie-internal-navigation");
2174
2368
  }
2175
- function Ft(e) {
2369
+ function Pt(e) {
2176
2370
  return e.getAttribute("data-formie-internal-navigation") !== null;
2177
2371
  }
2178
- function Rt(e, t) {
2372
+ function qt(e, t) {
2179
2373
  if (!e)
2180
2374
  return !1;
2181
2375
  try {
@@ -2184,31 +2378,31 @@ function Rt(e, t) {
2184
2378
  return !1;
2185
2379
  }
2186
2380
  }
2187
- function _i(e) {
2188
- return Rt(window.location.href, "resumeToken") || Rt(e.getAttribute("action"), "resumeToken");
2381
+ function to(e) {
2382
+ return qt(window.location.href, "resumeToken") || qt(e.getAttribute("action"), "resumeToken");
2189
2383
  }
2190
- function Di(e) {
2384
+ function ro(e) {
2191
2385
  return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
2192
2386
  }
2193
- function xi(e, t = 0) {
2387
+ function no(e, t = 0) {
2194
2388
  if (!e)
2195
2389
  return t;
2196
2390
  const r = Number.parseInt(e, 10);
2197
2391
  return Number.isFinite(r) ? r : t;
2198
2392
  }
2199
- function Ni(e) {
2200
- return Math.max(0, xi(e.dataset.formieSubmitDelay, Ti));
2393
+ function io(e) {
2394
+ return Math.max(0, no(e.dataset.formieSubmitDelay, Ni));
2201
2395
  }
2202
- function Ke(e) {
2203
- return ct(e.dataset.formieValidationOnSubmit);
2396
+ function Je(e) {
2397
+ return mt(e.dataset.formieValidationOnSubmit);
2204
2398
  }
2205
- async function Ge(e) {
2206
- const t = Ni(e);
2399
+ async function Ye(e) {
2400
+ const t = io(e);
2207
2401
  t < 1 || await new Promise((r) => {
2208
2402
  window.setTimeout(r, t);
2209
2403
  });
2210
2404
  }
2211
- function kt(e, t) {
2405
+ function Vt(e, t) {
2212
2406
  const r = e?.getAttribute(t)?.trim();
2213
2407
  if (!r)
2214
2408
  return null;
@@ -2218,17 +2412,17 @@ function kt(e, t) {
2218
2412
  return console.error(`[formie] Failed to parse ${t}.`, n), null;
2219
2413
  }
2220
2414
  }
2221
- function qt(e, t) {
2415
+ function Ot(e, t) {
2222
2416
  const r = t || (e instanceof HTMLFormElement ? e : null);
2223
2417
  if (!r)
2224
2418
  return null;
2225
- const n = kt(r, "data-formie-modules"), i = kt(r, "data-formie-theme");
2419
+ const n = Vt(r, "data-formie-modules"), i = Vt(r, "data-formie-theme");
2226
2420
  return !n && !i ? null : {
2227
2421
  modules: n || void 0,
2228
2422
  theme: i || void 0
2229
2423
  };
2230
2424
  }
2231
- function Ui(e) {
2425
+ function oo(e) {
2232
2426
  if (!(e instanceof HTMLElement))
2233
2427
  return !0;
2234
2428
  if (!e.isConnected || e.hidden || e.closest("[hidden]"))
@@ -2236,14 +2430,14 @@ function Ui(e) {
2236
2430
  const t = window.getComputedStyle(e);
2237
2431
  return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
2238
2432
  }
2239
- function zi(e, t) {
2433
+ function ao(e, t) {
2240
2434
  return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
2241
2435
  }
2242
- function P(e) {
2436
+ function V(e) {
2243
2437
  const t = e, r = t.id ? `#${t.id}` : "", n = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
2244
2438
  return `${t.tagName ? t.tagName.toLowerCase() : "element"}${r}${n}`;
2245
2439
  }
2246
- function dt(e, t) {
2440
+ function pt(e, t) {
2247
2441
  if (t) {
2248
2442
  if (t.csrf?.param && t.csrf?.token) {
2249
2443
  const r = e.querySelector(`input[name="${t.csrf.param}"]`);
@@ -2268,14 +2462,14 @@ function dt(e, t) {
2268
2462
  });
2269
2463
  }
2270
2464
  }
2271
- async function ji(e, t) {
2272
- const r = Fe(t.mode), n = Re(t.transport);
2465
+ async function so(e, t) {
2466
+ const r = Fe(t.mode), n = ke(t.transport);
2273
2467
  if (r !== "server-rendered")
2274
2468
  return null;
2275
2469
  if (t.payload)
2276
2470
  return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
2277
- ut(n, r);
2278
- const i = !!Ee(e), o = t.formHandle || e.dataset.formieHandle;
2471
+ ft(n, r);
2472
+ const i = !!Se(e), o = t.formHandle || e.dataset.formieHandle;
2279
2473
  if (i || !o)
2280
2474
  return null;
2281
2475
  const a = {
@@ -2285,138 +2479,138 @@ async function ji(e, t) {
2285
2479
  siteId: t.siteId,
2286
2480
  theme: t.theme,
2287
2481
  themeConfig: t.themeConfig
2288
- }, s = n === "graphql" ? Pi(t, e) : qi(t, e), l = n === "graphql" ? await an(s, o, a) : await on(s, o, {
2482
+ }, s = n === "graphql" ? Yi(t, e) : Ji(t, e), l = n === "graphql" ? await fn(s, o, a) : await dn(s, o, {
2289
2483
  ...a,
2290
2484
  endpoint: s
2291
2485
  });
2292
2486
  return l?.html && (e.innerHTML = l.html), l;
2293
2487
  }
2294
- async function br(e, t, r) {
2488
+ async function wr(e, t, r) {
2295
2489
  if (t.refreshTokens === !1)
2296
2490
  return;
2297
- ut(Re(t.transport), Fe(t.mode));
2491
+ ft(ke(t.transport), Fe(t.mode));
2298
2492
  const n = t.formHandle || e.dataset.formieHandle;
2299
2493
  if (!n)
2300
2494
  return;
2301
- const i = lt(t, e), a = r.querySelector('input[name="renderId"]')?.value || void 0, s = await tt(i, n, a);
2302
- dt(r, s), I(e, "formie:refresh-tokens:refreshed", s);
2495
+ const i = dt(t, e), a = r.querySelector('input[name="renderId"]')?.value || void 0, s = await nt(i, n, a);
2496
+ pt(r, s), I(e, "formie:refresh-tokens:refreshed", s);
2303
2497
  }
2304
- function Bi(e, t, r, n, i, o) {
2498
+ function lo(e, t, r, n, i, o) {
2305
2499
  const a = String(
2306
2500
  t.dataset.formieSubmitMethod || ""
2307
- ).trim().toLowerCase(), s = Oi(r, e, t);
2501
+ ).trim().toLowerCase(), s = Xi(r, e, t);
2308
2502
  let l = !1;
2309
- const d = t.querySelectorAll("[data-formie-action]"), p = (u) => {
2310
- if (u) {
2311
- t.setAttribute("data-formie-pending-action", u);
2503
+ const d = t.querySelectorAll("[data-formie-action]"), p = (c) => {
2504
+ if (c) {
2505
+ t.setAttribute("data-formie-pending-action", c);
2312
2506
  return;
2313
2507
  }
2314
2508
  t.removeAttribute("data-formie-pending-action");
2315
2509
  };
2316
- if (Hi(t)) {
2317
- const u = wi(t, {
2318
- shouldWarn: () => !Ft(t)
2319
- }), h = (f) => {
2510
+ if (eo(t)) {
2511
+ const c = xi(t, {
2512
+ shouldWarn: () => !Pt(t)
2513
+ }), b = (f) => {
2320
2514
  if (!(f instanceof CustomEvent))
2321
2515
  return;
2322
2516
  const v = f.detail;
2323
- v?.ok && v.action === "save" && u.scheduleBaselineCapture();
2517
+ v?.ok && v.action === "save" && c.scheduleBaselineCapture();
2324
2518
  }, A = () => {
2325
- u.scheduleBaselineCapture();
2519
+ c.scheduleBaselineCapture();
2326
2520
  };
2327
- e.addEventListener("formie:submit:result", h), t.addEventListener("formie:state:reset", A), o.push(() => {
2328
- e.removeEventListener("formie:submit:result", h), t.removeEventListener("formie:state:reset", A), u.destroy();
2521
+ e.addEventListener("formie:submit:result", b), t.addEventListener("formie:state:reset", A), o.push(() => {
2522
+ e.removeEventListener("formie:submit:result", b), t.removeEventListener("formie:state:reset", A), c.destroy();
2329
2523
  });
2330
2524
  }
2331
- if (d.forEach((u) => {
2332
- const h = (A) => {
2525
+ if (d.forEach((c) => {
2526
+ const b = (A) => {
2333
2527
  const f = A.currentTarget.getAttribute("data-formie-action"), v = t.querySelector('input[name="submitAction"]');
2334
2528
  p(f), f && v && (v.value = f);
2335
2529
  };
2336
- u.addEventListener("click", h), o.push(() => {
2337
- u.removeEventListener("click", h);
2530
+ c.addEventListener("click", b), o.push(() => {
2531
+ c.removeEventListener("click", b);
2338
2532
  });
2339
- }), t.querySelectorAll("[data-formie-tab-link]").forEach((u) => {
2340
- const h = async (A) => {
2533
+ }), t.querySelectorAll("[data-formie-tab-link]").forEach((c) => {
2534
+ const b = async (A) => {
2341
2535
  if (a !== "ajax") {
2342
- Di(A) && It(t, "set-page");
2536
+ ro(A) && kt(t, "set-page");
2343
2537
  return;
2344
2538
  }
2345
2539
  A.preventDefault();
2346
2540
  const f = A.currentTarget, v = f?.getAttribute("data-formie-page-id"), E = f?.getAttribute("href");
2347
2541
  if (!(!v || !E)) {
2348
- ot(t, v), I(e, "formie:page:navigate", {
2542
+ lt(t, v), I(e, "formie:page:navigate", {
2349
2543
  pageId: v,
2350
2544
  href: E
2351
2545
  });
2352
2546
  try {
2353
- const b = await sn(E, t, v);
2547
+ const y = await mn(E, t, v);
2354
2548
  I(e, "formie:page:navigate:after", {
2355
2549
  pageId: v,
2356
2550
  href: E,
2357
- response: b
2551
+ response: y
2358
2552
  });
2359
- } catch (b) {
2360
- console.error("[formie] Failed to persist page navigation state.", b), I(e, "formie:page:navigate:error", {
2553
+ } catch (y) {
2554
+ console.error("[formie] Failed to persist page navigation state.", y), I(e, "formie:page:navigate:error", {
2361
2555
  pageId: v,
2362
2556
  href: E,
2363
- error: b
2557
+ error: y
2364
2558
  });
2365
2559
  }
2366
2560
  }
2367
2561
  };
2368
- u.addEventListener("click", h), o.push(() => {
2369
- u.removeEventListener("click", h);
2562
+ c.addEventListener("click", b), o.push(() => {
2563
+ c.removeEventListener("click", b);
2370
2564
  });
2371
- }), !Vi(t)) {
2372
- let u = !1;
2373
- const h = () => {
2374
- u || Ft(t) || _i(t) || (u = !0, ln(s, t));
2565
+ }), !Qi(t)) {
2566
+ let c = !1;
2567
+ const b = () => {
2568
+ c || Pt(t) || to(t) || (c = !0, pn(s, t));
2375
2569
  };
2376
- window.addEventListener("pagehide", h), window.addEventListener("beforeunload", h), o.push(() => {
2377
- window.removeEventListener("pagehide", h), window.removeEventListener("beforeunload", h);
2570
+ window.addEventListener("pagehide", b), window.addEventListener("beforeunload", b), o.push(() => {
2571
+ window.removeEventListener("pagehide", b), window.removeEventListener("beforeunload", b);
2378
2572
  });
2379
2573
  }
2380
- const c = async (u) => {
2574
+ const u = async (c) => {
2381
2575
  if (l)
2382
2576
  return;
2383
- const h = a === "ajax";
2384
- if (u.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
2577
+ const b = a === "ajax";
2578
+ if (c.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
2385
2579
  if (!(t.getAttribute("data-formie-internal-resubmit") === "true"))
2386
2580
  return;
2387
2581
  t.removeAttribute("data-formie-internal-resubmit");
2388
2582
  } else
2389
2583
  t.removeAttribute("data-formie-internal-resubmit");
2390
- const f = u.submitter, v = f?.getAttribute("data-formie-action"), E = t.getAttribute("data-formie-pending-action"), b = t.querySelector('input[name="submitAction"]'), m = v || E || b?.value || "submit";
2584
+ const f = c.submitter, v = f?.getAttribute("data-formie-action"), E = t.getAttribute("data-formie-pending-action"), y = t.querySelector('input[name="submitAction"]'), m = v || E || y?.value || "submit";
2391
2585
  let g = null, S = !1;
2392
2586
  try {
2393
- if (h)
2394
- g = await fr({
2587
+ if (b)
2588
+ g = await yr({
2395
2589
  target: e,
2396
2590
  form: t,
2397
2591
  bus: n,
2398
2592
  validator: i,
2399
- validateOnSubmit: Ke(t),
2593
+ validateOnSubmit: Je(t),
2400
2594
  action: m,
2401
2595
  submitter: f,
2402
- waitForSubmitDelay: Ge,
2596
+ waitForSubmitDelay: Ye,
2403
2597
  onRefreshTokensAfterSubmit: async () => {
2404
- await br(e, r, t);
2598
+ await wr(e, r, t);
2405
2599
  },
2406
- dispatchSubmitResult: (C) => {
2407
- I(e, "formie:submit:result", C);
2600
+ dispatchSubmitResult: (M) => {
2601
+ I(e, "formie:submit:result", M);
2408
2602
  }
2409
2603
  });
2410
2604
  else {
2411
- if (dr(t), rr(t, f), await Ge(t), g = await Zt(t, m, n, {
2605
+ if (br(t), lr(t, f), await Ye(t), g = await tr(t, m, n, {
2412
2606
  validator: i,
2413
- validateOnSubmit: Ke(t),
2607
+ validateOnSubmit: Je(t),
2414
2608
  preflightOnly: !0
2415
2609
  }), g.ok) {
2416
- jt(t, m), l = !0, It(t, "submit"), p(null);
2417
- let C = !1;
2610
+ Kt(t, m), l = !0, kt(t, "submit"), p(null);
2611
+ let M = !1;
2418
2612
  const T = () => {
2419
- C = !0, l = !1, _e(t), Te(t);
2613
+ M = !0, l = !1, xe(t), Me(t);
2420
2614
  };
2421
2615
  if (typeof t.requestSubmit == "function") {
2422
2616
  t.addEventListener("invalid", T, !0);
@@ -2427,40 +2621,40 @@ function Bi(e, t, r, n, i, o) {
2427
2621
  }
2428
2622
  } else
2429
2623
  t.submit();
2430
- if (C)
2624
+ if (M)
2431
2625
  return;
2432
2626
  S = !0;
2433
2627
  return;
2434
2628
  }
2435
- Me(t, g), I(e, "formie:submit:result", g), _e(t);
2629
+ Le(t, g), I(e, "formie:submit:result", g), xe(t);
2436
2630
  }
2437
- } catch (C) {
2631
+ } catch (M) {
2438
2632
  l = !1, g = {
2439
2633
  ok: !1,
2440
2634
  code: "SUBMIT_ERROR",
2441
- message: C instanceof Error ? C.message : "Submission failed.",
2442
- formErrors: [C instanceof Error ? C.message : "Submission failed."]
2443
- }, Me(t, g), I(e, "formie:submit:result", g), _e(t);
2635
+ message: M instanceof Error ? M.message : "Submission failed.",
2636
+ formErrors: [M instanceof Error ? M.message : "Submission failed."]
2637
+ }, Le(t, g), I(e, "formie:submit:result", g), xe(t);
2444
2638
  } finally {
2445
- p(null), !h && !S && !cr(g) && Te(t);
2639
+ p(null), !b && !S && !hr(g) && Me(t);
2446
2640
  }
2447
2641
  };
2448
- t.addEventListener("submit", c), o.push(() => {
2449
- t.removeEventListener("submit", c);
2642
+ t.addEventListener("submit", u), o.push(() => {
2643
+ t.removeEventListener("submit", u);
2450
2644
  });
2451
2645
  }
2452
- async function Wi(e, t, r) {
2646
+ async function uo(e, t, r) {
2453
2647
  if (t.refreshTokens === !1 || !t.staticCache)
2454
2648
  return;
2455
- ut(Re(t.transport), Fe(t.mode));
2456
- const n = t.formHandle || e.dataset.formieHandle, i = lt(t, e), a = r?.querySelector('input[name="renderId"]')?.value || void 0;
2649
+ ft(ke(t.transport), Fe(t.mode));
2650
+ const n = t.formHandle || e.dataset.formieHandle, i = dt(t, e), a = r?.querySelector('input[name="renderId"]')?.value || void 0;
2457
2651
  if (!n)
2458
2652
  return;
2459
- const s = await tt(i, n, a);
2460
- !s || !r || (dt(r, s), I(e, "formie:refresh-tokens:after", s));
2653
+ const s = await nt(i, n, a);
2654
+ !s || !r || (pt(r, s), I(e, "formie:refresh-tokens:after", s));
2461
2655
  }
2462
- function Ki() {
2463
- const e = /* @__PURE__ */ new Map(), t = new mr(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = [
2656
+ function co() {
2657
+ const e = /* @__PURE__ */ new Map(), t = new vr(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = [
2464
2658
  "prepare",
2465
2659
  "normalize",
2466
2660
  "validate",
@@ -2475,12 +2669,12 @@ function Ki() {
2475
2669
  return;
2476
2670
  }
2477
2671
  const E = (async () => {
2478
- L.log("Unmount requested.", { target: P(f) });
2479
- const b = r.get(f);
2480
- b && (b(), r.delete(f));
2672
+ L.log("Unmount requested.", { target: V(f) });
2673
+ const y = r.get(f);
2674
+ y && (y(), r.delete(f));
2481
2675
  const m = e.get(f);
2482
2676
  if (!m) {
2483
- L.log("Unmount skipped (no mounted state).", { target: P(f) });
2677
+ L.log("Unmount skipped (no mounted state).", { target: V(f) });
2484
2678
  return;
2485
2679
  }
2486
2680
  I(f, "formie:unmount:before", {
@@ -2492,67 +2686,67 @@ function Ki() {
2492
2686
  await g.destroy();
2493
2687
  m.modules = [], m.bus.clear(), e.delete(f), I(f, "formie:unmount:after", {
2494
2688
  id: m.instance.id
2495
- }), L.log("Unmount complete.", { id: m.instance.id, target: P(f) });
2689
+ }), L.log("Unmount complete.", { id: m.instance.id, target: V(f) });
2496
2690
  })().finally(() => {
2497
2691
  n.delete(f);
2498
2692
  });
2499
2693
  n.set(f, E), await E;
2500
2694
  }, a = async (f, v) => {
2501
2695
  L.log("Mount requested.", {
2502
- target: P(f),
2696
+ target: V(f),
2503
2697
  mode: v.mode,
2504
2698
  autoVisible: v.autoVisible
2505
2699
  });
2506
2700
  const E = r.get(f);
2507
2701
  E && (E(), r.delete(f));
2508
- const b = e.get(f);
2509
- if (b)
2702
+ const y = e.get(f);
2703
+ if (y)
2510
2704
  return L.log("Mount skipped (already mounted).", {
2511
- id: b.instance.id,
2512
- target: P(f)
2513
- }), b.instance;
2514
- const m = new Bt(), g = [], S = f?.id || `formie-${e.size + 1}`, C = ee(f), T = {
2515
- ...C,
2705
+ id: y.instance.id,
2706
+ target: V(f)
2707
+ }), y.instance;
2708
+ const m = new Gt(), g = [], S = f?.id || `formie-${e.size + 1}`, M = ee(f), T = {
2709
+ ...M,
2516
2710
  ...v,
2517
- mode: Fe(v.mode ?? C.mode),
2518
- transport: Re(v.transport ?? C.transport)
2519
- }, F = $r(T.compatibility);
2520
- if (T.mode !== "server-rendered" && !Ee(f))
2711
+ mode: Fe(v.mode ?? M.mode),
2712
+ transport: ke(v.transport ?? M.transport)
2713
+ }, R = xr(T.compatibility);
2714
+ if (T.mode !== "server-rendered" && !Se(f))
2521
2715
  throw new Error(`Formie ${T.mode} mode is not implemented yet in the browser client.`);
2522
- const k = await ji(f, T), w = Ee(f);
2523
- T.staticCache = v.staticCache ?? We(w ? w.dataset : f.dataset);
2524
- const q = qt(f, w), N = k || q ? {
2525
- ...k || {},
2716
+ const P = await so(f, T), w = Se(f);
2717
+ T.staticCache = v.staticCache ?? Ge(w ? w.dataset : f.dataset);
2718
+ const q = Ot(f, w), N = P || q ? {
2719
+ ...P || {},
2526
2720
  ...q || {}
2527
- } : null, B = N?.theme, Y = {}, fe = (N?.modules || []).filter((M) => !!M?.id && !!M?.type);
2721
+ } : null, z = N?.theme, Y = {}, fe = (N?.modules || []).filter((C) => !!C?.id && !!C?.type);
2528
2722
  L.log("Resolved mount payload.", {
2529
- target: P(f),
2530
- hasRenderPayload: !!k,
2723
+ target: V(f),
2724
+ hasRenderPayload: !!P,
2531
2725
  hasEmbeddedPayload: !!q,
2532
2726
  moduleCount: fe.length
2533
2727
  });
2534
- const ne = gt(f, B, w), $ = w ? new Rn(w, {
2535
- live: ct(w.dataset.formieValidationOnFocus),
2728
+ const ne = yt(f, z, w), k = w ? new Un(w, {
2729
+ live: mt(w.dataset.formieValidationOnFocus),
2536
2730
  errorMessage: w.dataset.formieErrorMessage || "",
2537
2731
  fieldContainerErrorClass: ne.fieldLayoutError || [],
2538
2732
  inputErrorClass: ne.fieldControlError || [],
2539
2733
  messagesClass: ne.fieldErrors || [],
2540
2734
  messageClass: ne.fieldError || []
2541
2735
  }) : null;
2542
- if (w && $) {
2543
- const M = w;
2544
- M.formieValidation = $, Y.validation = $;
2545
- const O = {
2546
- validator: $,
2547
- addValidator: $.addValidator.bind($),
2548
- removeValidator: $.removeValidator.bind($)
2736
+ if (w && k) {
2737
+ const C = w;
2738
+ C.formieValidation = k, Y.validation = k;
2739
+ const $ = {
2740
+ validator: k,
2741
+ addValidator: k.addValidator.bind(k),
2742
+ removeValidator: k.removeValidator.bind(k)
2549
2743
  };
2550
- I(w, "formie:validator:ready", O), I(f, "formie:validator:ready", O);
2744
+ I(w, "formie:validator:ready", $), I(f, "formie:validator:ready", $);
2551
2745
  }
2552
- w && ((k || T.endpoint || f.dataset.formieEndpoint) && $i(f, w, T), J(w)), Object.keys(ne).length && I(f, "formie:theme:applied", {
2746
+ w && ((P || T.endpoint || f.dataset.formieEndpoint) && Zi(f, w, T), J(w)), Object.keys(ne).length && I(f, "formie:theme:applied", {
2553
2747
  hasClasses: !0
2554
2748
  });
2555
- const me = await gr(fe, {
2749
+ const me = await Sr(fe, {
2556
2750
  registry: t,
2557
2751
  matchContext: {
2558
2752
  root: f,
@@ -2566,27 +2760,27 @@ function Ki() {
2566
2760
  target: f,
2567
2761
  scope: "form",
2568
2762
  state: Y,
2569
- on: (M, O) => m.on(M, O),
2570
- emit: (M, O) => (I(f, M, O), m.emitSafe(M, O).then((Z) => {
2763
+ on: (C, $) => m.on(C, $),
2764
+ emit: (C, $) => (I(f, C, $), m.emitSafe(C, $).then((Z) => {
2571
2765
  Z.failed.length > 0 && L.warn("Lifecycle listeners failed.", {
2572
- eventName: M,
2766
+ eventName: C,
2573
2767
  failed: Z.failed.length
2574
2768
  });
2575
2769
  }))
2576
2770
  }
2577
2771
  });
2578
2772
  L.log("Module setup complete.", {
2579
- target: P(f),
2773
+ target: V(f),
2580
2774
  moduleInstances: me.length
2581
2775
  });
2582
2776
  const qe = {
2583
2777
  id: S,
2584
2778
  root: f,
2585
- submit: async (M = "submit") => {
2779
+ submit: async (C = "submit") => {
2586
2780
  if (L.log("Submit requested.", {
2587
2781
  id: S,
2588
- target: P(f),
2589
- action: M
2782
+ target: V(f),
2783
+ action: C
2590
2784
  }), !w)
2591
2785
  return {
2592
2786
  ok: !1,
@@ -2594,34 +2788,34 @@ function Ki() {
2594
2788
  message: "No form element found for mount target.",
2595
2789
  formErrors: ["No form element found for mount target."]
2596
2790
  };
2597
- const O = w.querySelector('input[name="submitAction"]');
2598
- if (O && (O.value = M), w.getAttribute("data-formie-loading") === "true")
2791
+ const $ = w.querySelector('input[name="submitAction"]');
2792
+ if ($ && ($.value = C), w.getAttribute("data-formie-loading") === "true")
2599
2793
  return {
2600
2794
  ok: !1,
2601
2795
  code: "SUBMIT_IN_PROGRESS",
2602
2796
  message: "Submission already in progress.",
2603
2797
  formErrors: []
2604
2798
  };
2605
- const Z = w.querySelector(`[data-formie-action="${M}"]`), Q = await fr({
2799
+ const Z = w.querySelector(`[data-formie-action="${C}"]`), Q = await yr({
2606
2800
  id: S,
2607
2801
  target: f,
2608
2802
  form: w,
2609
2803
  bus: m,
2610
- validator: $,
2611
- validateOnSubmit: Ke(w),
2612
- action: M,
2804
+ validator: k,
2805
+ validateOnSubmit: Je(w),
2806
+ action: C,
2613
2807
  submitter: Z,
2614
- waitForSubmitDelay: Ge,
2808
+ waitForSubmitDelay: Ye,
2615
2809
  onRefreshTokensAfterSubmit: async () => {
2616
- await br(f, T, w);
2810
+ await wr(f, T, w);
2617
2811
  },
2618
- dispatchSubmitResult: (Pe) => {
2619
- I(f, "formie:submit:result", Pe);
2812
+ dispatchSubmitResult: (Ve) => {
2813
+ I(f, "formie:submit:result", Ve);
2620
2814
  }
2621
2815
  });
2622
2816
  return L.log("Submit completed.", {
2623
2817
  id: S,
2624
- action: M,
2818
+ action: C,
2625
2819
  ok: Q.ok,
2626
2820
  code: Q.code,
2627
2821
  message: Q.message
@@ -2630,58 +2824,58 @@ function Ki() {
2630
2824
  destroy: async () => {
2631
2825
  await o(f);
2632
2826
  },
2633
- on: (M, O) => m.on(M, O)
2827
+ on: (C, $) => m.on(C, $)
2634
2828
  };
2635
- w && (zr({
2829
+ w && (Jr({
2636
2830
  target: f,
2637
2831
  form: w,
2638
- validatorDetail: $ ? {
2639
- validator: $,
2640
- addValidator: $.addValidator.bind($),
2641
- removeValidator: $.removeValidator.bind($)
2832
+ validatorDetail: k ? {
2833
+ validator: k,
2834
+ addValidator: k.addValidator.bind(k),
2835
+ removeValidator: k.removeValidator.bind(k)
2642
2836
  } : null,
2643
- options: F,
2837
+ options: R,
2644
2838
  unbinds: g
2645
- }), Ur({
2839
+ }), Gr({
2646
2840
  target: f,
2647
2841
  form: w,
2648
2842
  instance: qe,
2649
- options: F,
2843
+ options: R,
2650
2844
  unbinds: g
2651
- })), w && (Bi(f, w, T, m, $, g), await Wi(f, T, w)), i.forEach((M) => {
2652
- const O = m.on(`formie:stage:${M}:before`, async (W) => {
2653
- I(f, `formie:stage:${M}:before`, W);
2654
- }), Z = m.on(`formie:stage:${M}:before`, async (W) => {
2845
+ })), w && (lo(f, w, T, m, k, g), k && g.push(Wn(w, k, f)), await uo(f, T, w)), i.forEach((C) => {
2846
+ const $ = m.on(`formie:stage:${C}:before`, async (W) => {
2847
+ I(f, `formie:stage:${C}:before`, W);
2848
+ }), Z = m.on(`formie:stage:${C}:before`, async (W) => {
2655
2849
  for (const ie of me)
2656
2850
  ie.onBeforeStage && await ie.onBeforeStage(W);
2657
- }), Q = m.on(`formie:stage:${M}:after`, async (W) => {
2658
- I(f, `formie:stage:${M}:after`, W);
2659
- }), Pe = m.on(`formie:stage:${M}:after`, async (W) => {
2851
+ }), Q = m.on(`formie:stage:${C}:after`, async (W) => {
2852
+ I(f, `formie:stage:${C}:after`, W);
2853
+ }), Ve = m.on(`formie:stage:${C}:after`, async (W) => {
2660
2854
  const ie = W;
2661
- for (const pt of me)
2662
- pt.onAfterStage && await pt.onAfterStage(ie, ie.result);
2855
+ for (const bt of me)
2856
+ bt.onAfterStage && await bt.onAfterStage(ie, ie.result);
2663
2857
  });
2664
- g.push(O, Z, Q, Pe);
2858
+ g.push($, Z, Q, Ve);
2665
2859
  });
2666
- const Fr = m.on("formie:submit:before", async (M) => {
2667
- I(f, "formie:submit:before", M);
2668
- }), Rr = m.on("formie:submit:after", async (M) => {
2669
- I(f, "formie:submit:after", M);
2670
- }), kr = m.on("formie:submit:final:before", async (M) => {
2671
- I(f, "formie:submit:final:before", M);
2672
- }), qr = m.on("formie:submit:final:after", async (M) => {
2673
- I(f, "formie:submit:final:after", M);
2860
+ const Or = m.on("formie:submit:before", async (C) => {
2861
+ I(f, "formie:submit:before", C);
2862
+ }), $r = m.on("formie:submit:after", async (C) => {
2863
+ I(f, "formie:submit:after", C);
2864
+ }), Hr = m.on("formie:submit:final:before", async (C) => {
2865
+ I(f, "formie:submit:final:before", C);
2866
+ }), _r = m.on("formie:submit:final:after", async (C) => {
2867
+ I(f, "formie:submit:final:after", C);
2674
2868
  });
2675
2869
  return g.push(
2676
- Fr,
2677
- Rr,
2678
- kr,
2679
- qr
2870
+ Or,
2871
+ $r,
2872
+ Hr,
2873
+ _r
2680
2874
  ), e.set(f, {
2681
2875
  options: T,
2682
2876
  bus: m,
2683
2877
  form: w,
2684
- validator: $,
2878
+ validator: k,
2685
2879
  modules: me,
2686
2880
  unbinds: g,
2687
2881
  instance: qe
@@ -2690,21 +2884,21 @@ function Ki() {
2690
2884
  mode: T.mode
2691
2885
  }), L.log("Mount complete.", {
2692
2886
  id: S,
2693
- target: P(f),
2887
+ target: V(f),
2694
2888
  mode: T.mode
2695
2889
  }), qe;
2696
2890
  }, s = (f, v) => {
2697
- if (!v.autoVisible || Ui(f) || typeof IntersectionObserver > "u")
2891
+ if (!v.autoVisible || oo(f) || typeof IntersectionObserver > "u")
2698
2892
  return a(f, v);
2699
2893
  if (e.has(f))
2700
2894
  return Promise.resolve(e.get(f)?.instance || null);
2701
2895
  if (r.has(f))
2702
2896
  return L.log("Mount deferred (already waiting visibility).", {
2703
- target: P(f)
2897
+ target: V(f)
2704
2898
  }), Promise.resolve(null);
2705
- const E = new IntersectionObserver((b) => {
2706
- b.some((g) => g.target === f && g.isIntersecting) && (E.disconnect(), r.delete(f), L.log("Visibility reached, proceeding mount.", {
2707
- target: P(f)
2899
+ const E = new IntersectionObserver((y) => {
2900
+ y.some((g) => g.target === f && g.isIntersecting) && (E.disconnect(), r.delete(f), L.log("Visibility reached, proceeding mount.", {
2901
+ target: V(f)
2708
2902
  }), a(f, {
2709
2903
  ...v,
2710
2904
  autoVisible: !1
@@ -2715,7 +2909,7 @@ function Ki() {
2715
2909
  return E.observe(f), r.set(f, () => {
2716
2910
  E.disconnect();
2717
2911
  }), L.log("Mount deferred until visible.", {
2718
- target: P(f)
2912
+ target: V(f)
2719
2913
  }), Promise.resolve(null);
2720
2914
  };
2721
2915
  return {
@@ -2733,7 +2927,7 @@ function Ki() {
2733
2927
  ...E.options,
2734
2928
  ...v
2735
2929
  };
2736
- const b = v.payload?.theme || E.options.payload?.theme || qt(f, E.form)?.theme, m = gt(f, b, E.form);
2930
+ const y = v.payload?.theme || E.options.payload?.theme || Ot(f, E.form)?.theme, m = yt(f, y, E.form);
2737
2931
  return E.validator && (E.validator.config.fieldContainerErrorClass = m.fieldLayoutError || [], E.validator.config.inputErrorClass = m.fieldControlError || [], E.validator.config.messagesClass = m.fieldErrors || [], E.validator.config.messageClass = m.fieldError || []), Object.keys(m).length && I(f, "formie:theme:applied", {
2738
2932
  hasClasses: !0,
2739
2933
  reason: "update"
@@ -2741,14 +2935,14 @@ function Ki() {
2741
2935
  },
2742
2936
  getInstance: (f) => e.get(f)?.instance || null,
2743
2937
  refreshForCache: async (f) => {
2744
- ki(
2938
+ Gi(
2745
2939
  "refreshForCache",
2746
2940
  "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead."
2747
2941
  );
2748
2942
  let v = null;
2749
2943
  if (typeof f == "string") {
2750
- const k = document.getElementById(f);
2751
- k ? v = k : v = document.querySelector(`[data-formie-form-id="${f}"]`);
2944
+ const P = document.getElementById(f);
2945
+ P ? v = P : v = document.querySelector(`[data-formie-form-id="${f}"]`);
2752
2946
  } else
2753
2947
  v = f;
2754
2948
  if (!v) {
@@ -2757,22 +2951,22 @@ function Ki() {
2757
2951
  });
2758
2952
  return;
2759
2953
  }
2760
- const E = e.get(v), b = Ee(v), m = E?.options || ee(v);
2761
- if (!b) {
2954
+ const E = e.get(v), y = Se(v), m = E?.options || ee(v);
2955
+ if (!y) {
2762
2956
  L.warn("refreshForCache found no form element for target.", {
2763
- target: P(v)
2957
+ target: V(v)
2764
2958
  });
2765
2959
  return;
2766
2960
  }
2767
- const g = m.formHandle || v.dataset.formieHandle || b.dataset.formieHandle, S = lt(m, v), T = b.querySelector('input[name="renderId"]')?.value || void 0;
2961
+ const g = m.formHandle || v.dataset.formieHandle || y.dataset.formieHandle, S = dt(m, v), T = y.querySelector('input[name="renderId"]')?.value || void 0;
2768
2962
  if (!g) {
2769
2963
  L.warn("refreshForCache found no form handle for target.", {
2770
- target: P(v)
2964
+ target: V(v)
2771
2965
  });
2772
2966
  return;
2773
2967
  }
2774
- const F = await tt(S, g, T);
2775
- F && (dt(b, F), I(v, "formie:refresh-tokens:after", F));
2968
+ const R = await nt(S, g, T);
2969
+ R && (pt(y, R), I(v, "formie:refresh-tokens:after", R));
2776
2970
  },
2777
2971
  registerModule: (f, v) => t.register(f, v),
2778
2972
  unregisterModule: (f) => {
@@ -2802,22 +2996,22 @@ function Ki() {
2802
2996
  L.log("Observer started.", {
2803
2997
  scope: v === document ? "document" : v
2804
2998
  });
2805
- const E = new MutationObserver((b) => {
2806
- b.forEach((m) => {
2999
+ const E = new MutationObserver((y) => {
3000
+ y.forEach((m) => {
2807
3001
  m.addedNodes.forEach((g) => {
2808
3002
  g instanceof Element && (g.matches(X) && (L.log("Observer detected new root.", {
2809
- target: P(g)
3003
+ target: V(g)
2810
3004
  }), s(g, ee(g))), g.querySelectorAll(X).forEach((S) => {
2811
3005
  L.log("Observer detected new nested root.", {
2812
- target: P(S)
3006
+ target: V(S)
2813
3007
  }), s(S, ee(S));
2814
3008
  }));
2815
3009
  }), m.removedNodes.forEach((g) => {
2816
3010
  g instanceof Element && (e.has(g) && (L.log("Observer detected removed root.", {
2817
- target: P(g)
3011
+ target: V(g)
2818
3012
  }), o(g)), g.querySelectorAll(X).forEach((S) => {
2819
3013
  e.has(S) && (L.log("Observer detected removed nested root.", {
2820
- target: P(S)
3014
+ target: V(S)
2821
3015
  }), o(S));
2822
3016
  }));
2823
3017
  });
@@ -2828,21 +3022,21 @@ function Ki() {
2828
3022
  subtree: !0
2829
3023
  }), () => {
2830
3024
  E.disconnect(), L.log("Observer stopped."), r.forEach((m, g) => {
2831
- zi(g, v) && (m(), r.delete(g));
3025
+ ao(g, v) && (m(), r.delete(g));
2832
3026
  });
2833
- const b = [];
2834
- v instanceof Element && v.matches(X) && b.push(v), v.querySelectorAll(X).forEach((m) => {
2835
- b.push(m);
2836
- }), b.forEach((m) => {
3027
+ const y = [];
3028
+ v instanceof Element && v.matches(X) && y.push(v), v.querySelectorAll(X).forEach((m) => {
3029
+ y.push(m);
3030
+ }), y.forEach((m) => {
2837
3031
  e.has(m) && o(m);
2838
3032
  });
2839
3033
  };
2840
3034
  }
2841
3035
  };
2842
3036
  }
2843
- const yr = _("general", "module-hydrator");
2844
- async function Xo(e) {
2845
- const t = e.root, r = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), n = e.modules ?? [], i = e.mode ?? "server-rendered", o = e.registry ?? new mr(), a = new Bt(), s = await gr(n, {
3037
+ const Tr = _("general", "module-hydrator");
3038
+ async function ha(e) {
3039
+ const t = e.root, r = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), n = e.modules ?? [], i = e.mode ?? "server-rendered", o = e.registry ?? new vr(), a = new Gt(), s = await Sr(n, {
2846
3040
  registry: o,
2847
3041
  setupContext: {
2848
3042
  formId: r?.id || t.id || "formie-modules",
@@ -2863,13 +3057,13 @@ async function Xo(e) {
2863
3057
  mode: i
2864
3058
  }
2865
3059
  });
2866
- return yr.log("Hydrated module manifest.", {
3060
+ return Tr.log("Hydrated module manifest.", {
2867
3061
  moduleCount: n.length,
2868
3062
  instanceCount: s.length,
2869
3063
  mode: i
2870
3064
  }), {
2871
3065
  destroy: async () => {
2872
- await Gi(s), a.clear();
3066
+ await fo(s), a.clear();
2873
3067
  },
2874
3068
  on: (l, d) => a.on(l, d),
2875
3069
  emit: async (l, d) => {
@@ -2882,45 +3076,45 @@ async function Xo(e) {
2882
3076
  getRegisteredModules: () => o.getAll()
2883
3077
  };
2884
3078
  }
2885
- async function Gi(e) {
3079
+ async function fo(e) {
2886
3080
  for (const t of e)
2887
3081
  try {
2888
3082
  await t.destroy();
2889
3083
  } catch (r) {
2890
- console.error("[formie] Failed to destroy module instance.", r), yr.warn("Failed destroying module instance.", { error: r });
3084
+ console.error("[formie] Failed to destroy module instance.", r), Tr.warn("Failed destroying module instance.", { error: r });
2891
3085
  }
2892
3086
  }
2893
- function ke(e) {
3087
+ function Pe(e) {
2894
3088
  return e instanceof Element;
2895
3089
  }
2896
- function Ji(e) {
3090
+ function mo(e) {
2897
3091
  return e.ok;
2898
3092
  }
2899
- function Yi(e) {
2900
- return typeof e == "string" ? `selector "${e}"` : ke(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
3093
+ function po(e) {
3094
+ return typeof e == "string" ? `selector "${e}"` : Pe(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2901
3095
  }
2902
- function Zi(e) {
3096
+ function go(e) {
2903
3097
  const t = /* @__PURE__ */ new Set(), r = [];
2904
3098
  for (const n of e)
2905
- !ke(n) || t.has(n) || (t.add(n), r.push(n));
3099
+ !Pe(n) || t.has(n) || (t.add(n), r.push(n));
2906
3100
  return r;
2907
3101
  }
2908
- function Je(e) {
2909
- return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : ke(e) ? [e] : Zi(e);
3102
+ function Ze(e) {
3103
+ return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : Pe(e) ? [e] : go(e);
2910
3104
  }
2911
- function Qi() {
3105
+ function ho() {
2912
3106
  return document.readyState !== "loading" ? Promise.resolve() : new Promise((e) => {
2913
3107
  document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
2914
3108
  });
2915
3109
  }
2916
- async function Xi(e) {
2917
- const t = Je(e);
2918
- return t.length > 0 || typeof e != "string" ? t : (await Qi(), Je(e));
3110
+ async function bo(e) {
3111
+ const t = Ze(e);
3112
+ return t.length > 0 || typeof e != "string" ? t : (await ho(), Ze(e));
2919
3113
  }
2920
- function eo(e) {
2921
- return typeof e == "string" ? document : ke(e) ? e.getRootNode() : document;
3114
+ function yo(e) {
3115
+ return typeof e == "string" ? document : Pe(e) ? e.getRootNode() : document;
2922
3116
  }
2923
- function to(e) {
3117
+ function vo(e) {
2924
3118
  const {
2925
3119
  element: t,
2926
3120
  observe: r,
@@ -2938,8 +3132,8 @@ function to(e) {
2938
3132
  ...p
2939
3133
  };
2940
3134
  }
2941
- async function Pt(e, t, r, n) {
2942
- const i = [], o = to(e);
3135
+ async function $t(e, t, r, n) {
3136
+ const i = [], o = vo(e);
2943
3137
  for (const a of n) {
2944
3138
  const s = r.get(a);
2945
3139
  if (s) {
@@ -2948,14 +3142,14 @@ async function Pt(e, t, r, n) {
2948
3142
  }
2949
3143
  const l = await t.mount(a, o), d = [];
2950
3144
  if (e.onReady?.(l), d.push(l.on("formie:submit:result", (p) => {
2951
- const y = p;
2952
- e.onResult?.(y, l), Ji(y) ? e.onSuccess?.(y, l) : e.onError?.(y, l);
3145
+ const h = p;
3146
+ e.onResult?.(h, l), mo(h) ? e.onSuccess?.(h, l) : e.onError?.(h, l);
2953
3147
  })), e.onEvent)
2954
- for (const p of Vr)
2955
- d.push(l.on(p, (y) => {
3148
+ for (const p of Nr)
3149
+ d.push(l.on(p, (h) => {
2956
3150
  e.onEvent?.({
2957
3151
  name: p,
2958
- payload: y
3152
+ payload: h
2959
3153
  }, l);
2960
3154
  }));
2961
3155
  r.set(a, {
@@ -2965,12 +3159,12 @@ async function Pt(e, t, r, n) {
2965
3159
  }
2966
3160
  return i;
2967
3161
  }
2968
- async function ea(e) {
2969
- const t = e.client ?? Ki(), r = /* @__PURE__ */ new Map(), n = await Xi(e.element);
3162
+ async function ba(e) {
3163
+ const t = e.client ?? co(), r = /* @__PURE__ */ new Map(), n = await bo(e.element);
2970
3164
  if (n.length === 0 && !e.allowEmpty)
2971
- throw new Error(`Formie could not find any elements for ${Yi(e.element)}.`);
2972
- await Pt(e, t, r, n);
2973
- const i = e.observe ? t.observe(eo(e.element)) : null;
3165
+ throw new Error(`Formie could not find any elements for ${po(e.element)}.`);
3166
+ await $t(e, t, r, n);
3167
+ const i = e.observe ? t.observe(yo(e.element)) : null;
2974
3168
  return {
2975
3169
  client: t,
2976
3170
  get instances() {
@@ -2981,8 +3175,8 @@ async function ea(e) {
2981
3175
  return a ? r.get(a)?.instance ?? t.getInstance(a) : null;
2982
3176
  },
2983
3177
  async rescan() {
2984
- const o = Je(e.element);
2985
- return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) : Pt(e, t, r, o);
3178
+ const o = Ze(e.element);
3179
+ return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) : $t(e, t, r, o);
2986
3180
  },
2987
3181
  async destroy() {
2988
3182
  i?.();
@@ -2992,13 +3186,13 @@ async function ea(e) {
2992
3186
  }
2993
3187
  };
2994
3188
  }
2995
- const ft = 2e3, ta = 5e3, ra = 5e3, na = 12e4;
2996
- async function mt(e) {
3189
+ const gt = 2e3, ya = 5e3, va = 5e3, Ea = 12e4;
3190
+ async function ht(e) {
2997
3191
  await new Promise((t) => {
2998
3192
  window.setTimeout(t, Math.max(e, 0));
2999
3193
  });
3000
3194
  }
3001
- async function ia(e, {
3195
+ async function Sa(e, {
3002
3196
  timeoutMs: t = 5e3,
3003
3197
  intervalMs: r = 30
3004
3198
  } = {}) {
@@ -3007,11 +3201,11 @@ async function ia(e, {
3007
3201
  const i = e();
3008
3202
  if (i)
3009
3203
  return i;
3010
- await mt(r);
3204
+ await ht(r);
3011
3205
  }
3012
3206
  throw new Error("Timed out waiting for async condition.");
3013
3207
  }
3014
- function vr(e, t) {
3208
+ function Mr(e, t) {
3015
3209
  let r = null;
3016
3210
  return (...n) => {
3017
3211
  r !== null && window.clearTimeout(r), r = window.setTimeout(() => {
@@ -3019,14 +3213,14 @@ function vr(e, t) {
3019
3213
  }, Math.max(t, 0));
3020
3214
  };
3021
3215
  }
3022
- function oa(e) {
3216
+ function Aa(e) {
3023
3217
  const t = String(e || "asyncDefer").toLowerCase();
3024
3218
  return {
3025
3219
  async: t.includes("async"),
3026
3220
  defer: t.includes("defer")
3027
3221
  };
3028
3222
  }
3029
- function Er(e, t) {
3223
+ function Cr(e, t) {
3030
3224
  const r = Array.from(e.querySelectorAll(`input[name="${t}"], textarea[name="${t}"]`));
3031
3225
  for (const n of r) {
3032
3226
  const i = String(n.value || "").trim();
@@ -3035,39 +3229,39 @@ function Er(e, t) {
3035
3229
  }
3036
3230
  return "";
3037
3231
  }
3038
- function Ye(e, t) {
3039
- return t.some((r) => Er(e, r) !== "");
3232
+ function Qe(e, t) {
3233
+ return t.some((r) => Cr(e, r) !== "");
3040
3234
  }
3041
- function ro(e, t) {
3235
+ function Eo(e, t) {
3042
3236
  t.forEach((r) => {
3043
3237
  Array.from(e.querySelectorAll(`input[name="${r}"], textarea[name="${r}"]`)).forEach((i) => {
3044
3238
  i.value = "";
3045
3239
  });
3046
3240
  });
3047
3241
  }
3048
- function Sr(e, t, {
3242
+ function Lr(e, t, {
3049
3243
  value: r = "",
3050
3244
  container: n
3051
3245
  } = {}) {
3052
3246
  let i = e.querySelector(`input[name="${t}"]`);
3053
3247
  return i || (i = document.createElement("input"), i.type = "hidden", i.name = t, (n || (e instanceof HTMLElement ? e : null))?.appendChild(i)), i.value = r, i;
3054
3248
  }
3055
- async function Ar(e, t, r) {
3056
- if (Ye(e, t))
3249
+ async function Ir(e, t, r) {
3250
+ if (Qe(e, t))
3057
3251
  return !0;
3058
3252
  const n = Date.now() + Math.max(r, 0);
3059
3253
  for (; Date.now() < n; )
3060
- if (await mt(120), Ye(e, t))
3254
+ if (await ht(120), Qe(e, t))
3061
3255
  return !0;
3062
3256
  return !1;
3063
3257
  }
3064
- const no = /* @__PURE__ */ new Set([
3258
+ const So = /* @__PURE__ */ new Set([
3065
3259
  "handle",
3066
3260
  "placeholderSelector",
3067
3261
  "errorMessage",
3068
3262
  "sessionKey",
3069
3263
  "value"
3070
- ]), io = "[data-formie-captcha-error-container]", oo = [
3264
+ ]), Ao = "[data-formie-captcha-error-container]", wo = [
3071
3265
  "formie:page:navigate",
3072
3266
  "formie:page:navigate:after",
3073
3267
  "formie:submit:result"
@@ -3077,55 +3271,55 @@ function se(e, t, r) {
3077
3271
  e.removeEventListener(t, r);
3078
3272
  };
3079
3273
  }
3080
- function Le(e, t) {
3274
+ function Ie(e, t) {
3081
3275
  return e instanceof HTMLElement && e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
3082
3276
  }
3083
- function Ze(e) {
3277
+ function Xe(e) {
3084
3278
  if (!(e instanceof HTMLElement) || !e.isConnected || e.hidden || e.closest("[hidden]") || e.closest("[data-formie-page-hidden]") || e.closest('[aria-hidden="true"]'))
3085
3279
  return !1;
3086
3280
  const t = window.getComputedStyle(e);
3087
3281
  return t.display !== "none" && t.visibility !== "hidden";
3088
3282
  }
3089
- function De(e, t) {
3090
- const r = Le(e, t);
3091
- return r.find((n) => Ze(n)) || r[0] || null;
3283
+ function Ne(e, t) {
3284
+ const r = Ie(e, t);
3285
+ return r.find((n) => Xe(n)) || r[0] || null;
3092
3286
  }
3093
- function ao(e) {
3287
+ function To(e) {
3094
3288
  e.innerHTML = "";
3095
3289
  const t = document.createElement("div");
3096
3290
  return e.appendChild(t), t;
3097
3291
  }
3098
- function Qe(e) {
3099
- e?.querySelector(io)?.remove();
3292
+ function et(e) {
3293
+ e?.querySelector(Ao)?.remove();
3100
3294
  }
3101
- function so(e, t, r) {
3295
+ function Mo(e, t, r) {
3102
3296
  if (!e)
3103
3297
  return;
3104
- Qe(e);
3298
+ et(e);
3105
3299
  const n = document.createElement("div");
3106
- n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), V(n, r || e, "fieldErrors");
3300
+ n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), O(n, r || e, "fieldErrors");
3107
3301
  const i = document.createElement("div");
3108
- i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"), V(i, r || e, "fieldError"), i.textContent = t, n.appendChild(i), e.appendChild(n);
3302
+ i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"), O(i, r || e, "fieldError"), i.textContent = t, n.appendChild(i), e.appendChild(n);
3109
3303
  }
3110
- function lo(e) {
3304
+ function Co(e) {
3111
3305
  const t = e instanceof CustomEvent ? e.detail : null;
3112
3306
  return !t || typeof t != "object" ? null : t;
3113
3307
  }
3114
- function uo(e, t) {
3308
+ function Lo(e, t) {
3115
3309
  if (!e?.captchas || typeof e.captchas != "object")
3116
3310
  return null;
3117
3311
  const r = e.captchas[t];
3118
3312
  return !r || typeof r != "object" ? null : r;
3119
3313
  }
3120
- function co(e, t, r, n) {
3314
+ function Io(e, t, r, n) {
3121
3315
  const i = /* @__PURE__ */ new Set(), o = () => {
3122
- const d = Le(e, t), p = new Set(d.filter((y) => Ze(y)));
3123
- d.forEach((y) => {
3124
- p.has(y) && !i.has(y) && (i.add(y), r(y));
3125
- }), Array.from(i).forEach((y) => {
3126
- p.has(y) || (i.delete(y), n(y));
3316
+ const d = Ie(e, t), p = new Set(d.filter((h) => Xe(h)));
3317
+ d.forEach((h) => {
3318
+ p.has(h) && !i.has(h) && (i.add(h), r(h));
3319
+ }), Array.from(i).forEach((h) => {
3320
+ p.has(h) || (i.delete(h), n(h));
3127
3321
  });
3128
- }, a = vr(o, 20), s = new MutationObserver(() => {
3322
+ }, a = Mr(o, 20), s = new MutationObserver(() => {
3129
3323
  a();
3130
3324
  });
3131
3325
  s.observe(e, {
@@ -3138,7 +3332,7 @@ function co(e, t, r, n) {
3138
3332
  se(window, "resize", () => {
3139
3333
  a();
3140
3334
  }),
3141
- ...oo.map((d) => se(e, d, () => {
3335
+ ...wo.map((d) => se(e, d, () => {
3142
3336
  a();
3143
3337
  }))
3144
3338
  ];
@@ -3151,20 +3345,20 @@ function co(e, t, r, n) {
3151
3345
  }), i.clear();
3152
3346
  },
3153
3347
  reconcile: a,
3154
- getVisible: () => Le(e, t).filter((d) => Ze(d))
3348
+ getVisible: () => Ie(e, t).filter((d) => Xe(d))
3155
3349
  };
3156
3350
  }
3157
- function fo(e, t) {
3351
+ function Ro(e, t) {
3158
3352
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
3159
3353
  }
3160
- function mo(e, t, {
3354
+ function Fo(e, t, {
3161
3355
  defaultPlaceholderSelector: r,
3162
3356
  defaultTokenFieldNames: n = [],
3163
- defaultWaitForValueMs: i = ft
3357
+ defaultWaitForValueMs: i = gt
3164
3358
  }) {
3165
- const o = t || {}, a = Object.entries(o).reduce((u, [h, A]) => (no.has(h) || (u[h] = A), u), {}), s = n.map(String).filter(Boolean), l = Number(i), d = typeof o.placeholderSelector == "string" && o.placeholderSelector.trim() !== "" ? o.placeholderSelector.trim() : r, p = typeof o.errorMessage == "string" && o.errorMessage.trim() !== "" ? o.errorMessage.trim() : x("Captcha challenge must be completed."), y = typeof o.sessionKey == "string" && o.sessionKey.trim() !== "" ? o.sessionKey.trim() : null, c = typeof o.value == "string" ? o.value : null;
3359
+ const o = t || {}, a = Object.entries(o).reduce((c, [b, A]) => (So.has(b) || (c[b] = A), c), {}), s = n.map(String).filter(Boolean), l = Number(i), d = typeof o.placeholderSelector == "string" && o.placeholderSelector.trim() !== "" ? o.placeholderSelector.trim() : r, p = typeof o.errorMessage == "string" && o.errorMessage.trim() !== "" ? o.errorMessage.trim() : x("Captcha challenge must be completed."), h = typeof o.sessionKey == "string" && o.sessionKey.trim() !== "" ? o.sessionKey.trim() : null, u = typeof o.value == "string" ? o.value : null;
3166
3360
  return {
3167
- handle: fo(e, o),
3361
+ handle: Ro(e, o),
3168
3362
  ui: {
3169
3363
  placeholderSelector: d,
3170
3364
  errorMessage: p
@@ -3172,61 +3366,61 @@ function mo(e, t, {
3172
3366
  transport: {
3173
3367
  tokenFieldNames: s,
3174
3368
  waitForValueMs: Number.isFinite(l) ? l : i,
3175
- sessionKey: y,
3176
- value: c
3369
+ sessionKey: h,
3370
+ value: u
3177
3371
  },
3178
3372
  provider: a
3179
3373
  };
3180
3374
  }
3181
- function po(e, t) {
3375
+ function ko(e, t) {
3182
3376
  const r = e.form || e.root, n = t.ui.placeholderSelector, i = t.handle;
3183
3377
  return {
3184
3378
  form: e.form,
3185
3379
  root: e.root,
3186
3380
  placeholder: {
3187
- query: () => Le(e.root, n),
3188
- getPrimary: () => De(e.root, n),
3189
- observe: (o, a) => co(e.root, n, o, a),
3190
- createContainer: (o) => ao(o),
3381
+ query: () => Ie(e.root, n),
3382
+ getPrimary: () => Ne(e.root, n),
3383
+ observe: (o, a) => Io(e.root, n, o, a),
3384
+ createContainer: (o) => To(o),
3191
3385
  clear: (o) => {
3192
- o && (Qe(o), o.innerHTML = "");
3386
+ o && (et(o), o.innerHTML = "");
3193
3387
  }
3194
3388
  },
3195
3389
  errors: {
3196
3390
  getDefaultMessage: () => t.ui.errorMessage,
3197
3391
  show: (o, a) => {
3198
- so(a || De(e.root, n), o || t.ui.errorMessage, e.form || e.root);
3392
+ Mo(a || Ne(e.root, n), o || t.ui.errorMessage, e.form || e.root);
3199
3393
  },
3200
3394
  clear: (o) => {
3201
- Qe(o || De(e.root, n));
3395
+ et(o || Ne(e.root, n));
3202
3396
  }
3203
3397
  },
3204
3398
  tokens: {
3205
3399
  names: t.transport.tokenFieldNames,
3206
- has: (o = t.transport.tokenFieldNames, a = r) => Ye(a, o),
3207
- read: (o = t.transport.tokenFieldNames[0], a = r) => o ? Er(a, o) : "",
3400
+ has: (o = t.transport.tokenFieldNames, a = r) => Qe(a, o),
3401
+ read: (o = t.transport.tokenFieldNames[0], a = r) => o ? Cr(a, o) : "",
3208
3402
  write: (o, {
3209
3403
  names: a = t.transport.tokenFieldNames,
3210
3404
  root: s = r,
3211
3405
  container: l = e.form
3212
3406
  } = {}) => {
3213
3407
  a.forEach((d) => {
3214
- Sr(s, d, {
3408
+ Lr(s, d, {
3215
3409
  value: o,
3216
3410
  container: l
3217
3411
  });
3218
3412
  });
3219
3413
  },
3220
3414
  clear: (o = t.transport.tokenFieldNames, a = r) => {
3221
- ro(a, o);
3415
+ Eo(a, o);
3222
3416
  },
3223
- wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) => Ar(s, a, o)
3417
+ wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) => Ir(s, a, o)
3224
3418
  },
3225
3419
  refresh: {
3226
3420
  providerHandle: i,
3227
3421
  onTokensRefreshed: (o) => {
3228
3422
  const a = ["formie:refresh-tokens:after", "formie:refresh-tokens:refreshed"].map((s) => se(e.root, s, (l) => {
3229
- const d = lo(l), p = uo(d, i);
3423
+ const d = Co(l), p = Lo(d, i);
3230
3424
  p && o(p);
3231
3425
  }));
3232
3426
  return () => {
@@ -3244,11 +3438,11 @@ function po(e, t) {
3244
3438
  };
3245
3439
  }
3246
3440
  const G = _("captchas");
3247
- function wr({
3441
+ function Rr({
3248
3442
  id: e,
3249
3443
  defaultPlaceholderSelector: t,
3250
3444
  defaultTokenFieldNames: r = [],
3251
- defaultWaitForValueMs: n = ft,
3445
+ defaultWaitForValueMs: n = gt,
3252
3446
  setup: i
3253
3447
  }) {
3254
3448
  return {
@@ -3256,7 +3450,7 @@ function wr({
3256
3450
  kind: "captcha",
3257
3451
  match: () => !0,
3258
3452
  setup: async (o) => {
3259
- const a = mo(e, o.options || {}, {
3453
+ const a = Fo(e, o.options || {}, {
3260
3454
  defaultPlaceholderSelector: t,
3261
3455
  defaultTokenFieldNames: r,
3262
3456
  defaultWaitForValueMs: n
@@ -3266,7 +3460,7 @@ function wr({
3266
3460
  placeholderSelector: a.ui.placeholderSelector,
3267
3461
  tokenFieldNames: a.transport.tokenFieldNames
3268
3462
  });
3269
- const s = po(o, a);
3463
+ const s = ko(o, a);
3270
3464
  return i({
3271
3465
  ...o,
3272
3466
  options: a,
@@ -3275,13 +3469,13 @@ function wr({
3275
3469
  }
3276
3470
  };
3277
3471
  }
3278
- function go({
3472
+ function Po({
3279
3473
  id: e,
3280
3474
  defaultPlaceholderSelector: t,
3281
3475
  defaultTokenFieldNames: r = [],
3282
- defaultWaitForValueMs: n = ft
3476
+ defaultWaitForValueMs: n = gt
3283
3477
  }) {
3284
- return wr({
3478
+ return Rr({
3285
3479
  id: e,
3286
3480
  defaultPlaceholderSelector: t,
3287
3481
  defaultTokenFieldNames: r,
@@ -3289,51 +3483,51 @@ function go({
3289
3483
  setup: async ({ services: i, options: o, root: a }) => {
3290
3484
  const s = [];
3291
3485
  let l = i.placeholder.getPrimary(), d = o.transport.sessionKey, p = o.transport.value || "";
3292
- const y = (u) => {
3293
- !u || !d || (u.innerHTML = "", Sr(u, d, {
3486
+ const h = (c) => {
3487
+ !c || !d || (c.innerHTML = "", Lr(c, d, {
3294
3488
  value: p,
3295
- container: u
3489
+ container: c
3296
3490
  }));
3297
- }, c = i.placeholder.observe(
3298
- (u) => {
3299
- l = u, G.log("Passive placeholder visible.", {
3491
+ }, u = i.placeholder.observe(
3492
+ (c) => {
3493
+ l = c, G.log("Passive placeholder visible.", {
3300
3494
  moduleId: e
3301
- }), y(u);
3495
+ }), h(c);
3302
3496
  },
3303
- (u) => {
3304
- l === u && (l = i.placeholder.getPrimary()), u.innerHTML = "";
3497
+ (c) => {
3498
+ l === c && (l = i.placeholder.getPrimary()), c.innerHTML = "";
3305
3499
  }
3306
3500
  );
3307
- return s.push(c.cleanup), y(l), s.push(i.refresh.onTokensRefreshed((u) => {
3308
- d = typeof u.sessionKey == "string" && u.sessionKey.trim() !== "" ? u.sessionKey.trim() : d, p = typeof u.value == "string" ? u.value : "";
3309
- const h = i.placeholder.getPrimary() || l;
3310
- l = h, y(h);
3501
+ return s.push(u.cleanup), h(l), s.push(i.refresh.onTokensRefreshed((c) => {
3502
+ d = typeof c.sessionKey == "string" && c.sessionKey.trim() !== "" ? c.sessionKey.trim() : d, p = typeof c.value == "string" ? c.value : "";
3503
+ const b = i.placeholder.getPrimary() || l;
3504
+ l = b, h(b);
3311
3505
  })), {
3312
3506
  destroy: () => {
3313
- s.forEach((u) => {
3314
- u();
3507
+ s.forEach((c) => {
3508
+ c();
3315
3509
  });
3316
3510
  },
3317
- onBeforeStage: async (u) => {
3318
- if (u.stage !== "screen" || u.action !== "submit")
3511
+ onBeforeStage: async (c) => {
3512
+ if (c.stage !== "screen" || c.action !== "submit")
3319
3513
  return;
3320
- const h = d ? [d] : o.transport.tokenFieldNames;
3321
- if (h.length === 0)
3514
+ const b = d ? [d] : o.transport.tokenFieldNames;
3515
+ if (b.length === 0)
3322
3516
  return;
3323
- if (!await Ar(a, h, o.transport.waitForValueMs)) {
3517
+ if (!await Ir(a, b, o.transport.waitForValueMs)) {
3324
3518
  const f = i.errors.getDefaultMessage();
3325
3519
  i.errors.show(f, l), G.warn("Passive captcha missing token.", {
3326
3520
  moduleId: e,
3327
- tokenFieldNames: h
3328
- }), u.abort(f);
3521
+ tokenFieldNames: b
3522
+ }), c.abort(f);
3329
3523
  }
3330
3524
  }
3331
3525
  };
3332
3526
  }
3333
3527
  });
3334
3528
  }
3335
- function ho(e) {
3336
- return wr({
3529
+ function qo(e) {
3530
+ return Rr({
3337
3531
  id: e.id,
3338
3532
  defaultPlaceholderSelector: e.defaultPlaceholderSelector,
3339
3533
  defaultTokenFieldNames: e.defaultTokenFieldNames,
@@ -3342,56 +3536,56 @@ function ho(e) {
3342
3536
  let o = t.services.placeholder.getPrimary(), a = !1, s = null;
3343
3537
  const l = async () => (s || (G.log("Loading captcha provider API.", {
3344
3538
  moduleId: e.id
3345
- }), s = e.load(t)), s), d = async (u) => {
3346
- const h = n.get(u);
3347
- if (t.services.errors.clear(u), !h) {
3348
- u.innerHTML = "";
3539
+ }), s = e.load(t)), s), d = async (c) => {
3540
+ const b = n.get(c);
3541
+ if (t.services.errors.clear(c), !b) {
3542
+ c.innerHTML = "";
3349
3543
  return;
3350
3544
  }
3351
3545
  const A = await l();
3352
3546
  e.unmount && await e.unmount({
3353
3547
  api: A,
3354
- widget: h,
3355
- placeholder: u,
3548
+ widget: b,
3549
+ placeholder: c,
3356
3550
  services: t.services,
3357
3551
  options: t.options,
3358
3552
  provider: t.options.provider
3359
- }), n.delete(u), u.innerHTML = "", t.services.tokens.clear(), G.log("Unmounted captcha placeholder widget.", {
3553
+ }), n.delete(c), c.innerHTML = "", t.services.tokens.clear(), G.log("Unmounted captcha placeholder widget.", {
3360
3554
  moduleId: e.id
3361
- }), o === u && (o = t.services.placeholder.getPrimary());
3362
- }, p = async (u) => {
3363
- if (a || n.has(u) || i.has(u))
3555
+ }), o === c && (o = t.services.placeholder.getPrimary());
3556
+ }, p = async (c) => {
3557
+ if (a || n.has(c) || i.has(c))
3364
3558
  return;
3365
- const h = (async () => {
3559
+ const b = (async () => {
3366
3560
  const A = await l();
3367
- if (a || n.has(u))
3561
+ if (a || n.has(c))
3368
3562
  return;
3369
- const f = t.services.placeholder.createContainer(u), v = await e.mount({
3563
+ const f = t.services.placeholder.createContainer(c), v = await e.mount({
3370
3564
  api: A,
3371
- placeholder: u,
3565
+ placeholder: c,
3372
3566
  container: f,
3373
3567
  services: t.services,
3374
3568
  options: t.options,
3375
3569
  provider: t.options.provider
3376
3570
  });
3377
- n.set(u, v), o = u, G.log("Mounted captcha placeholder widget.", {
3571
+ n.set(c, v), o = c, G.log("Mounted captcha placeholder widget.", {
3378
3572
  moduleId: e.id
3379
3573
  });
3380
3574
  })().finally(() => {
3381
- i.delete(u);
3575
+ i.delete(c);
3382
3576
  });
3383
- i.set(u, h), await h;
3384
- }, y = t.services.placeholder.observe(
3385
- (u) => {
3386
- o = u, p(u);
3577
+ i.set(c, b), await b;
3578
+ }, h = t.services.placeholder.observe(
3579
+ (c) => {
3580
+ o = c, p(c);
3387
3581
  },
3388
- (u) => {
3389
- d(u);
3582
+ (c) => {
3583
+ d(c);
3390
3584
  }
3391
3585
  );
3392
- r.push(y.cleanup);
3393
- const c = async (u) => {
3394
- const A = y.getVisible();
3586
+ r.push(h.cleanup);
3587
+ const u = async (c) => {
3588
+ const A = h.getVisible();
3395
3589
  if (e.reset) {
3396
3590
  const f = await l();
3397
3591
  for (const v of A) {
@@ -3407,47 +3601,47 @@ function ho(e) {
3407
3601
  services: t.services,
3408
3602
  options: t.options,
3409
3603
  provider: t.options.provider,
3410
- reason: u
3604
+ reason: c
3411
3605
  }), t.services.tokens.clear(), t.services.errors.clear(v);
3412
3606
  }
3413
- y.reconcile();
3607
+ h.reconcile();
3414
3608
  return;
3415
3609
  }
3416
3610
  for (const f of Array.from(n.keys()))
3417
3611
  await d(f);
3418
3612
  for (const f of A)
3419
3613
  await p(f);
3420
- y.reconcile();
3614
+ h.reconcile();
3421
3615
  };
3422
- return r.push(t.services.events.onRoot("formie:submit:result", (u) => {
3423
- const h = u instanceof CustomEvent ? u.detail : null;
3424
- h?.stage !== "validate" && (h?.ok === !1 && h?.stage === "screen" || h?.ok !== !0 && c("submit-result"));
3425
- })), t.form && r.push(t.services.events.onForm(Ue("reset"), () => {
3616
+ return r.push(t.services.events.onRoot("formie:submit:result", (c) => {
3617
+ const b = c instanceof CustomEvent ? c.detail : null;
3618
+ b?.stage !== "validate" && (b?.ok === !1 && b?.stage === "screen" || b?.ok !== !0 && u("submit-result"));
3619
+ })), t.form && r.push(t.services.events.onForm(je("reset"), () => {
3426
3620
  o = t.services.placeholder.getPrimary() || o, window.setTimeout(() => {
3427
- c("reset-state");
3621
+ u("reset-state");
3428
3622
  }, 0);
3429
3623
  })), {
3430
3624
  destroy: async () => {
3431
- a = !0, r.forEach((u) => {
3432
- u();
3625
+ a = !0, r.forEach((c) => {
3626
+ c();
3433
3627
  });
3434
- for (const u of Array.from(n.keys()))
3435
- await d(u);
3628
+ for (const c of Array.from(n.keys()))
3629
+ await d(c);
3436
3630
  },
3437
- onBeforeStage: async (u) => {
3438
- if (u.stage !== "screen" || u.action !== "submit")
3631
+ onBeforeStage: async (c) => {
3632
+ if (c.stage !== "screen" || c.action !== "submit")
3439
3633
  return;
3440
- const h = y.getVisible();
3441
- if (h.length === 0)
3634
+ const b = h.getVisible();
3635
+ if (b.length === 0)
3442
3636
  return;
3443
- let A = h.find((E) => E === o) || h[0];
3637
+ let A = b.find((E) => E === o) || b[0];
3444
3638
  await p(A), A = o || A, t.services.errors.clear(A);
3445
3639
  const f = n.get(A);
3446
3640
  if (!f) {
3447
3641
  const E = t.services.errors.getDefaultMessage();
3448
3642
  t.services.errors.show(E, A), G.warn("Captcha widget unavailable at screen stage.", {
3449
3643
  moduleId: e.id
3450
- }), u.abort(E);
3644
+ }), c.abort(E);
3451
3645
  return;
3452
3646
  }
3453
3647
  const v = await l();
@@ -3458,14 +3652,14 @@ function ho(e) {
3458
3652
  services: t.services,
3459
3653
  options: t.options,
3460
3654
  provider: t.options.provider,
3461
- stageCtx: u
3655
+ stageCtx: c
3462
3656
  });
3463
3657
  }
3464
3658
  };
3465
3659
  }
3466
3660
  });
3467
3661
  }
3468
- const aa = ho, sa = go, $t = 2500, bo = {
3662
+ const wa = qo, Ta = Po, Ht = 2500, Vo = {
3469
3663
  bpoint: ["bpointToken"],
3470
3664
  stripe: ["stripePaymentIntentId"],
3471
3665
  paypal: ["paypalOrderId", "paypalAuthId"],
@@ -3478,18 +3672,18 @@ const aa = ho, sa = go, $t = 2500, bo = {
3478
3672
  paddle: ["paddleTransactionId"],
3479
3673
  square: ["squarePaymentId"]
3480
3674
  };
3481
- function yo(e) {
3675
+ function Oo(e) {
3482
3676
  return e.replace("{field:", "").replace("{", "").replace("}", "").replace("]", "").split("[").join("][");
3483
3677
  }
3484
- function vo(e) {
3485
- return `fields[${yo(e)}]`;
3678
+ function $o(e) {
3679
+ return `fields[${Oo(e)}]`;
3486
3680
  }
3487
- function Eo(e, t) {
3488
- const r = vo(t), n = Array.from(e.querySelectorAll(`[name="${r}"]`)), i = Array.from(e.querySelectorAll(`[name="${r}[]"]`));
3681
+ function Ho(e, t) {
3682
+ const r = $o(t), n = Array.from(e.querySelectorAll(`[name="${r}"]`)), i = Array.from(e.querySelectorAll(`[name="${r}[]"]`));
3489
3683
  return (i.length ? i : n).filter((o) => o instanceof HTMLElement);
3490
3684
  }
3491
- function Vt(e, t) {
3492
- const r = Eo(e, t);
3685
+ function _t(e, t) {
3686
+ const r = Ho(e, t);
3493
3687
  for (const n of r) {
3494
3688
  const o = n.closest("[data-formie-field-handle]")?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim();
3495
3689
  if (o)
@@ -3497,32 +3691,32 @@ function Vt(e, t) {
3497
3691
  }
3498
3692
  return "";
3499
3693
  }
3500
- function xe(e) {
3694
+ function Ue(e) {
3501
3695
  let t = e.replace(/[^\d.,-]/g, "");
3502
3696
  const r = t.includes(","), n = t.includes(".");
3503
3697
  return r && n ? t = t.replace(/\./g, "").replace(/,/, ".") : r && !n ? t = t.replace(/,/, ".") : t = t.replace(/,/g, ""), parseFloat(t);
3504
3698
  }
3505
- function So(e) {
3699
+ function _o(e) {
3506
3700
  return e.replace(/^\{field:/, "").replace(/^\{/, "").replace(/\}$/, "").trim();
3507
3701
  }
3508
3702
  function de(e) {
3509
- return So(e).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
3703
+ return _o(e).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
3510
3704
  }
3511
- function Tr(e) {
3705
+ function Fr(e) {
3512
3706
  const r = de(e).split(".").filter(Boolean);
3513
3707
  if (!r.length)
3514
3708
  return "";
3515
3709
  const [n, ...i] = r;
3516
3710
  return `fields[${n}]${i.map((o) => `[${o}]`).join("")}`;
3517
3711
  }
3518
- function Ao(e) {
3712
+ function Do(e) {
3519
3713
  const r = String(e || "").trim().match(/^fields\[([^\]]+)\](.*)$/);
3520
3714
  if (!r)
3521
3715
  return "";
3522
3716
  const n = r[1] || "", i = r[2] || "", o = Array.from(i.matchAll(/\[([^\]]+)\]/g)).map((a) => a[1] || "").filter(Boolean);
3523
3717
  return [n, ...o].join(".");
3524
3718
  }
3525
- function wo(e) {
3719
+ function xo(e) {
3526
3720
  const t = e.split(";").map((a) => a.trim()).filter(Boolean);
3527
3721
  if (!t.length)
3528
3722
  return {
@@ -3548,7 +3742,7 @@ function wo(e) {
3548
3742
  transforms: i
3549
3743
  };
3550
3744
  }
3551
- function Cr(e) {
3745
+ function kr(e) {
3552
3746
  const t = String(e || "").trim();
3553
3747
  if (!t)
3554
3748
  return {
@@ -3573,7 +3767,7 @@ function Cr(e) {
3573
3767
  isToken: !1,
3574
3768
  isValid: !0
3575
3769
  };
3576
- const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } = wo(o || "");
3770
+ const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } = xo(o || "");
3577
3771
  if (n !== "field")
3578
3772
  return {
3579
3773
  raw: t,
@@ -3585,22 +3779,22 @@ function Cr(e) {
3585
3779
  isToken: !0,
3586
3780
  isValid: !1
3587
3781
  };
3588
- const d = s.indexOf(":"), p = d === -1 ? s : s.slice(0, d), y = d === -1 ? "" : s.slice(d + 1), c = de(p);
3782
+ const d = s.indexOf(":"), p = d === -1 ? s : s.slice(0, d), h = d === -1 ? "" : s.slice(d + 1), u = de(p);
3589
3783
  return {
3590
3784
  raw: t,
3591
3785
  target: "field",
3592
- key: c,
3593
- selector: y.trim(),
3786
+ key: u,
3787
+ selector: h.trim(),
3594
3788
  defaultValue: a.trim(),
3595
3789
  transforms: l,
3596
3790
  isToken: !0,
3597
- isValid: c !== ""
3791
+ isValid: u !== ""
3598
3792
  };
3599
3793
  }
3600
- function To(e) {
3794
+ function No(e) {
3601
3795
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
3602
3796
  }
3603
- function Co(e, t, r) {
3797
+ function Uo(e, t, r) {
3604
3798
  const n = t.trim(), i = String(r.name || "").trim();
3605
3799
  if (!n || !i)
3606
3800
  return;
@@ -3611,14 +3805,14 @@ function Co(e, t, r) {
3611
3805
  };
3612
3806
  o.names.includes(i) || o.names.push(i), o.inputs.includes(r) || o.inputs.push(r), e.set(n, o);
3613
3807
  }
3614
- function Mo(e) {
3808
+ function Bo(e) {
3615
3809
  const t = /* @__PURE__ */ new Map();
3616
- return Array.from(e.querySelectorAll("[name]")).filter((n) => To(n)).forEach((n) => {
3617
- const i = Ao(n.name);
3618
- i && Co(t, i, n);
3810
+ return Array.from(e.querySelectorAll("[name]")).filter((n) => No(n)).forEach((n) => {
3811
+ const i = Do(n.name);
3812
+ i && Uo(t, i, n);
3619
3813
  }), t;
3620
3814
  }
3621
- function Lo(e) {
3815
+ function jo(e) {
3622
3816
  if (!e.length)
3623
3817
  return "";
3624
3818
  const t = e[0];
@@ -3630,33 +3824,33 @@ function Lo(e) {
3630
3824
  }
3631
3825
  return t.value;
3632
3826
  }
3633
- function Mr(e, t) {
3827
+ function Pr(e, t) {
3634
3828
  return e.get(de(t)) || null;
3635
3829
  }
3636
- function Io(e, t) {
3637
- const r = Cr(e), n = r.key, i = Mr(t, n);
3830
+ function zo(e, t) {
3831
+ const r = kr(e), n = r.key, i = Pr(t, n);
3638
3832
  if (!i)
3639
3833
  return {
3640
3834
  key: n,
3641
3835
  value: r.defaultValue,
3642
3836
  found: !1
3643
3837
  };
3644
- const o = Lo(i.inputs);
3838
+ const o = jo(i.inputs);
3645
3839
  return {
3646
3840
  key: n,
3647
3841
  value: o === "" && r.defaultValue !== "" ? r.defaultValue : o,
3648
3842
  found: !0
3649
3843
  };
3650
3844
  }
3651
- function la(e, t, r) {
3652
- const n = Cr(e), i = n.key;
3845
+ function Ma(e, t, r) {
3846
+ const n = kr(e), i = n.key;
3653
3847
  if (!i)
3654
3848
  return {
3655
3849
  key: i,
3656
3850
  value: n.defaultValue,
3657
3851
  found: !1
3658
3852
  };
3659
- const o = r ? Mr(r, i) : null, s = (o?.names?.length ? o.names : [Tr(i)]).flatMap((l) => {
3853
+ const o = r ? Pr(r, i) : null, s = (o?.names?.length ? o.names : [Fr(i)]).flatMap((l) => {
3660
3854
  const d = t.getAll(l).map((p) => String(p ?? ""));
3661
3855
  return d.length ? d : t.getAll(`${l}[]`).map((p) => String(p ?? ""));
3662
3856
  }).filter((l) => l !== "");
@@ -3670,13 +3864,13 @@ function la(e, t, r) {
3670
3864
  found: !1
3671
3865
  };
3672
3866
  }
3673
- function Lr(e, t) {
3867
+ function qr(e, t) {
3674
3868
  const r = t.replace(/"/g, '\\"');
3675
3869
  return e.querySelector(`input[name$="[${r}]"]`) || e.querySelector(`input[name$="${r}"]`);
3676
3870
  }
3677
- function Se(e, t) {
3871
+ function Ae(e, t) {
3678
3872
  const r = t.find((n) => {
3679
- const i = Lr(e, n);
3873
+ const i = qr(e, n);
3680
3874
  return !i || String(i.value || "").trim() === "";
3681
3875
  });
3682
3876
  return {
@@ -3684,95 +3878,95 @@ function Se(e, t) {
3684
3878
  missingSuffix: r
3685
3879
  };
3686
3880
  }
3687
- async function Ir(e, t, r) {
3688
- const n = Se(e, t);
3881
+ async function Vr(e, t, r) {
3882
+ const n = Ae(e, t);
3689
3883
  if (n.ok)
3690
3884
  return n;
3691
3885
  const i = Date.now() + Math.max(r, 0);
3692
3886
  for (; Date.now() < i; ) {
3693
- await mt(120);
3694
- const o = Se(e, t);
3887
+ await ht(120);
3888
+ const o = Ae(e, t);
3695
3889
  if (o.ok)
3696
3890
  return o;
3697
3891
  }
3698
- return Se(e, t);
3892
+ return Ae(e, t);
3699
3893
  }
3700
- const Fo = /* @__PURE__ */ new Set([
3894
+ const Wo = /* @__PURE__ */ new Set([
3701
3895
  "handle",
3702
3896
  "requiredInputSuffixes",
3703
3897
  "waitForValueMs",
3704
3898
  "errorMessage"
3705
- ]), Ot = "[data-payment-success]", Ht = "[data-payment-error]";
3706
- function Ro(e, t) {
3899
+ ]), Dt = "[data-payment-success]", xt = "[data-payment-error]";
3900
+ function Ko(e, t) {
3707
3901
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
3708
3902
  }
3709
- function ko(e, t, r) {
3710
- const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (Fo.has(d) || (l[d] = p), l), {}), o = Array.isArray(n.requiredInputSuffixes) ? n.requiredInputSuffixes.map(String).filter(Boolean) : r.defaultRequiredInputSuffixes || [], a = Number(n.waitForValueMs ?? r.defaultWaitForValueMs ?? $t), s = typeof n.errorMessage == "string" && n.errorMessage.trim() !== "" ? n.errorMessage.trim() : "Payment authorization is incomplete.";
3903
+ function Go(e, t, r) {
3904
+ const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (Wo.has(d) || (l[d] = p), l), {}), o = Array.isArray(n.requiredInputSuffixes) ? n.requiredInputSuffixes.map(String).filter(Boolean) : r.defaultRequiredInputSuffixes || [], a = Number(n.waitForValueMs ?? r.defaultWaitForValueMs ?? Ht), s = typeof n.errorMessage == "string" && n.errorMessage.trim() !== "" ? n.errorMessage.trim() : "Payment authorization is incomplete.";
3711
3905
  return {
3712
- handle: Ro(e, n),
3906
+ handle: Ko(e, n),
3713
3907
  transport: {
3714
3908
  requiredInputSuffixes: o,
3715
- waitForValueMs: Number.isFinite(a) ? a : $t,
3909
+ waitForValueMs: Number.isFinite(a) ? a : Ht,
3716
3910
  errorMessage: s
3717
3911
  },
3718
3912
  provider: i
3719
3913
  };
3720
3914
  }
3721
- function _t(e, t, r) {
3915
+ function Nt(e, t, r) {
3722
3916
  return e.addEventListener(t, r), () => {
3723
3917
  e.removeEventListener(t, r);
3724
3918
  };
3725
3919
  }
3726
- function qo(e, t) {
3727
- const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () => Mo(n || i), l = (b) => {
3728
- const g = Io(b, s()).value;
3920
+ function Jo(e, t) {
3921
+ const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () => Bo(n || i), l = (y) => {
3922
+ const g = zo(y, s()).value;
3729
3923
  return Array.isArray(g) ? g[0] || "" : String(g || "");
3730
3924
  };
3731
3925
  return {
3732
3926
  root: i,
3733
3927
  form: n,
3734
3928
  field: r,
3735
- updateInputs: (b, m) => {
3736
- const g = Array.isArray(b) ? b : [b];
3929
+ updateInputs: (y, m) => {
3930
+ const g = Array.isArray(y) ? y : [y];
3737
3931
  for (const S of g) {
3738
- const C = Lr(o, S) ?? r.querySelector(`input[name*="${S}"]`);
3739
- C && (C.value = m);
3932
+ const M = qr(o, S) ?? r.querySelector(`input[name*="${S}"]`);
3933
+ M && (M.value = m);
3740
3934
  }
3741
3935
  },
3742
- addError: (b) => {
3743
- const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Ht);
3936
+ addError: (y) => {
3937
+ const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(xt);
3744
3938
  g && g.remove();
3745
3939
  const S = document.createElement("div");
3746
- S.setAttribute("data-payment-error", ""), S.textContent = b, V(S, n || i, "fieldError"), m.appendChild(S);
3940
+ S.setAttribute("data-payment-error", ""), S.textContent = y, O(S, n || i, "fieldError"), m.appendChild(S);
3747
3941
  },
3748
3942
  removeError: () => {
3749
- r.querySelector(Ht)?.remove();
3943
+ r.querySelector(xt)?.remove();
3750
3944
  },
3751
- addSuccess: (b) => {
3752
- const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Ot);
3945
+ addSuccess: (y) => {
3946
+ const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Dt);
3753
3947
  g && g.remove();
3754
3948
  const S = document.createElement("div");
3755
- S.setAttribute("data-payment-success", ""), S.textContent = b, V(S, n || i, "successMessage"), m.appendChild(S);
3949
+ S.setAttribute("data-payment-success", ""), S.textContent = y, O(S, n || i, "successMessage"), m.appendChild(S);
3756
3950
  },
3757
3951
  removeSuccess: () => {
3758
- r.querySelector(Ot)?.remove();
3952
+ r.querySelector(Dt)?.remove();
3759
3953
  },
3760
- hasToken: () => Se(o, a).ok,
3761
- waitForToken: (b = t.transport.waitForValueMs) => Ir(o, a, b).then((m) => m.ok),
3762
- getFieldValue: (b, m = "string") => {
3763
- const g = l(b);
3764
- return m === "float" || m === "int" || m === "number" ? xe(g) : g;
3954
+ hasToken: () => Ae(o, a).ok,
3955
+ waitForToken: (y = t.transport.waitForValueMs) => Vr(o, a, y).then((m) => m.ok),
3956
+ getFieldValue: (y, m = "string") => {
3957
+ const g = l(y);
3958
+ return m === "float" || m === "int" || m === "number" ? Ue(g) : g;
3765
3959
  },
3766
- resolveAmount: (b) => {
3767
- const m = n || i, S = String(b.type || "").toLowerCase() === "dynamic" && typeof b.variable == "string" && b.variable.trim() !== "", C = b.value ?? (S ? b.variable : b.fixed), T = String(C ?? "").trim(), F = typeof C == "number" ? C : xe(T);
3768
- if (Number.isFinite(F) && F > 0)
3769
- return { ok: !0, value: F };
3960
+ resolveAmount: (y) => {
3961
+ const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed), T = String(M ?? "").trim(), R = typeof M == "number" ? M : Ue(T);
3962
+ if (Number.isFinite(R) && R > 0)
3963
+ return { ok: !0, value: R };
3770
3964
  if (T !== "") {
3771
- const k = l(T), w = xe(k);
3965
+ const P = l(T), w = Ue(P);
3772
3966
  if (Number.isFinite(w) && w > 0)
3773
3967
  return { ok: !0, value: w };
3774
- const q = Vt(m, T);
3775
- if (!k)
3968
+ const q = _t(m, T);
3969
+ if (!P)
3776
3970
  return {
3777
3971
  ok: !1,
3778
3972
  error: q ? x('Provide a value for "{label}" to proceed.', { label: q }) : x("Provide a payment amount to proceed.")
@@ -3783,16 +3977,16 @@ function qo(e, t) {
3783
3977
  error: x("Payment amount must be greater than 0.")
3784
3978
  };
3785
3979
  },
3786
- resolveCurrency: (b) => {
3787
- const m = n || i, S = String(b.type || "").toLowerCase() === "dynamic" && typeof b.variable == "string" && b.variable.trim() !== "", C = b.value ?? (S ? b.variable : b.fixed ?? b.defaultCurrency ?? ""), T = String(C ?? "").trim(), F = T.toUpperCase();
3788
- if (/^[A-Z]{3}$/.test(F) && !S)
3789
- return { ok: !0, value: F };
3980
+ resolveCurrency: (y) => {
3981
+ const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed ?? y.defaultCurrency ?? ""), T = String(M ?? "").trim(), R = T.toUpperCase();
3982
+ if (/^[A-Z]{3}$/.test(R) && !S)
3983
+ return { ok: !0, value: R };
3790
3984
  if (T !== "") {
3791
- const k = String(l(T) || "").trim(), w = k.toUpperCase();
3985
+ const P = String(l(T) || "").trim(), w = P.toUpperCase();
3792
3986
  if (/^[A-Z]{3}$/.test(w))
3793
3987
  return { ok: !0, value: w };
3794
- const q = Vt(m, T);
3795
- if (!k)
3988
+ const q = _t(m, T);
3989
+ if (!P)
3796
3990
  return {
3797
3991
  ok: !1,
3798
3992
  error: q ? x('Provide a value for "{label}" to proceed.', { label: q }) : x("Provide a payment currency to proceed.")
@@ -3803,28 +3997,28 @@ function qo(e, t) {
3803
3997
  error: x("Payment currency must be a valid 3-letter code.")
3804
3998
  };
3805
3999
  },
3806
- watchFieldValueChanges: (b, m, g = 600) => {
3807
- const S = n || i, C = b.map((q) => String(q || "").trim()).filter(Boolean);
3808
- if (C.length === 0)
4000
+ watchFieldValueChanges: (y, m, g = 600) => {
4001
+ const S = n || i, M = y.map((q) => String(q || "").trim()).filter(Boolean);
4002
+ if (M.length === 0)
3809
4003
  return () => {
3810
4004
  };
3811
- const T = s(), F = /* @__PURE__ */ new Set();
3812
- C.forEach((q) => {
3813
- const N = de(q), B = T.get(N);
3814
- if (B?.names?.length) {
3815
- B.names.forEach((fe) => {
3816
- F.add(fe);
4005
+ const T = s(), R = /* @__PURE__ */ new Set();
4006
+ M.forEach((q) => {
4007
+ const N = de(q), z = T.get(N);
4008
+ if (z?.names?.length) {
4009
+ z.names.forEach((fe) => {
4010
+ R.add(fe);
3817
4011
  });
3818
4012
  return;
3819
4013
  }
3820
- const Y = Tr(N);
3821
- Y && (F.add(Y), F.add(`${Y}[]`));
4014
+ const Y = Fr(N);
4015
+ Y && (R.add(Y), R.add(`${Y}[]`));
3822
4016
  });
3823
- const k = vr(() => {
4017
+ const P = Mr(() => {
3824
4018
  m();
3825
4019
  }, g), w = (q) => {
3826
- const B = q.target?.name || "";
3827
- !B || !F.has(B) || k();
4020
+ const z = q.target?.name || "";
4021
+ !z || !R.has(z) || P();
3828
4022
  };
3829
4023
  return S.addEventListener("input", w), S.addEventListener("change", w), () => {
3830
4024
  S.removeEventListener("input", w), S.removeEventListener("change", w);
@@ -3834,40 +4028,40 @@ function qo(e, t) {
3834
4028
  n && n.setAttribute("data-formie-internal-resubmit", "true"), n && typeof n.requestSubmit == "function" ? n.requestSubmit() : n && n.submit();
3835
4029
  },
3836
4030
  releaseSubmitLoading: () => {
3837
- n && (n.removeAttribute("data-formie-internal-resubmit"), Te(n));
4031
+ n && (n.removeAttribute("data-formie-internal-resubmit"), Me(n));
3838
4032
  },
3839
- getBillingData: (b) => {
4033
+ getBillingData: (y) => {
3840
4034
  const m = {};
3841
- if (!b || typeof b != "object")
4035
+ if (!y || typeof y != "object")
3842
4036
  return { billing_details: m };
3843
- if (b.billingName) {
3844
- const g = l(b.billingName);
4037
+ if (y.billingName) {
4038
+ const g = l(y.billingName);
3845
4039
  g && (m.name = g);
3846
4040
  }
3847
- if (b.billingEmail) {
3848
- const g = l(b.billingEmail);
4041
+ if (y.billingEmail) {
4042
+ const g = l(y.billingEmail);
3849
4043
  g && (m.email = g);
3850
4044
  }
3851
- if (b.billingAddress) {
3852
- const g = b.billingAddress, S = {}, C = l(`${g}.address1`), T = l(`${g}.address2`), F = l(`${g}.address3`), k = l(`${g}.city`), w = l(`${g}.zip`), q = l(`${g}.state`), N = l(`${g}.country`);
3853
- C && (S.line1 = C), T && (S.line2 = T), F && (S.line3 = F), k && (S.city = k), w && (S.postal_code = w), q && (S.state = q), N && (S.country = N), Object.keys(S).length && (m.address = S);
4045
+ if (y.billingAddress) {
4046
+ const g = y.billingAddress, S = {}, M = l(`${g}.address1`), T = l(`${g}.address2`), R = l(`${g}.address3`), P = l(`${g}.city`), w = l(`${g}.zip`), q = l(`${g}.state`), N = l(`${g}.country`);
4047
+ M && (S.line1 = M), T && (S.line2 = T), R && (S.line3 = R), P && (S.city = P), w && (S.postal_code = w), q && (S.state = q), N && (S.country = N), Object.keys(S).length && (m.address = S);
3854
4048
  }
3855
4049
  return { billing_details: m };
3856
4050
  },
3857
4051
  events: {
3858
- onForm: (b, m) => n ? _t(n, b, m) : () => {
4052
+ onForm: (y, m) => n ? Nt(n, y, m) : () => {
3859
4053
  },
3860
- onRoot: (b, m) => _t(i, b, m)
4054
+ onRoot: (y, m) => Nt(i, y, m)
3861
4055
  }
3862
4056
  };
3863
4057
  }
3864
4058
  const U = _("payments");
3865
- function Dt(e) {
4059
+ function Ut(e) {
3866
4060
  const t = e;
3867
4061
  return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
3868
4062
  }
3869
- function Po(e) {
3870
- const t = e.defaultRequiredInputSuffixes ?? bo[e.id] ?? [];
4063
+ function Yo(e) {
4064
+ const t = e.defaultRequiredInputSuffixes ?? Vo[e.id] ?? [];
3871
4065
  return {
3872
4066
  id: e.id,
3873
4067
  kind: "payment",
@@ -3885,24 +4079,24 @@ function Po(e) {
3885
4079
  } catch {
3886
4080
  }
3887
4081
  }
3888
- const a = ko(
4082
+ const a = Go(
3889
4083
  e.id,
3890
4084
  r.options || {},
3891
4085
  {
3892
4086
  defaultRequiredInputSuffixes: t
3893
4087
  }
3894
- ), s = qo(r, a), l = {
4088
+ ), s = Jo(r, a), l = {
3895
4089
  ...r,
3896
4090
  options: a,
3897
4091
  services: s
3898
4092
  }, d = [];
3899
- let p = null, y = null, c = null, u = null;
3900
- const h = async () => (p || (U.log("Loading payment provider API.", { moduleId: e.id }), p = e.load(l)), p), A = async () => {
3901
- if (!e.mount || y || !Dt(r.target))
4093
+ let p = null, h = null, u = null, c = null;
4094
+ const b = async () => (p || (U.log("Loading payment provider API.", { moduleId: e.id }), p = e.load(l)), p), A = async () => {
4095
+ if (!e.mount || h || !Ut(r.target))
3902
4096
  return;
3903
- const E = await h();
4097
+ const E = await b();
3904
4098
  try {
3905
- y = await e.mount({
4099
+ h = await e.mount({
3906
4100
  api: E,
3907
4101
  field: r.target,
3908
4102
  services: s,
@@ -3923,25 +4117,25 @@ function Po(e) {
3923
4117
  s.removeError(), s.removeSuccess();
3924
4118
  })), e.setup) {
3925
4119
  const E = r.root || r.form || r.target;
3926
- c = await e.setup({ ...l, root: E }), c.destroy && d.push(c.destroy);
4120
+ u = await e.setup({ ...l, root: E }), u.destroy && d.push(u.destroy);
3927
4121
  }
3928
- e.mount && Dt(r.target) && await A(), ["formie:page:navigate:after", "formie:submit:result"].forEach((E) => {
3929
- const b = () => {
4122
+ e.mount && Ut(r.target) && await A(), ["formie:page:navigate:after", "formie:submit:result"].forEach((E) => {
4123
+ const y = () => {
3930
4124
  A();
3931
4125
  };
3932
- r.root.addEventListener(E, b), d.push(() => {
3933
- r.root.removeEventListener(E, b);
4126
+ r.root.addEventListener(E, y), d.push(() => {
4127
+ r.root.removeEventListener(E, y);
3934
4128
  });
3935
4129
  });
3936
4130
  const v = async () => {
3937
4131
  if (U.log("Destroying payment module.", {
3938
4132
  moduleId: e.id,
3939
4133
  handle: a.handle
3940
- }), d.forEach((E) => E()), y && e.unmount) {
3941
- const E = await h();
4134
+ }), d.forEach((E) => E()), h && e.unmount) {
4135
+ const E = await b();
3942
4136
  await e.unmount({
3943
4137
  api: E,
3944
- widget: y,
4138
+ widget: h,
3945
4139
  field: r.target,
3946
4140
  services: s,
3947
4141
  options: a,
@@ -3959,27 +4153,27 @@ function Po(e) {
3959
4153
  return i[e.id] = { destroy: v }, {
3960
4154
  destroy: v,
3961
4155
  onBeforeStage: async (E) => {
3962
- if (c?.onBeforeStage) {
3963
- await c.onBeforeStage(E);
4156
+ if (u?.onBeforeStage) {
4157
+ await u.onBeforeStage(E);
3964
4158
  return;
3965
4159
  }
3966
4160
  if (E.stage !== "authorize" || E.action !== "submit" || r.target.closest("[data-formie-page]")?.hasAttribute("data-formie-page-hidden"))
3967
4161
  return;
3968
4162
  await A();
3969
- const g = await h();
4163
+ const g = await b();
3970
4164
  if (e.onBeforeAuthorize) {
3971
- u || (u = (async () => e.onBeforeAuthorize({
4165
+ c || (c = (async () => e.onBeforeAuthorize({
3972
4166
  api: g,
3973
- widget: y,
4167
+ widget: h,
3974
4168
  field: r.target,
3975
4169
  services: s,
3976
4170
  options: a,
3977
4171
  provider: a.provider,
3978
4172
  stageCtx: E
3979
4173
  }))().finally(() => {
3980
- u = null;
4174
+ c = null;
3981
4175
  }));
3982
- const T = await u;
4176
+ const T = await c;
3983
4177
  if (U.log("onBeforeAuthorize resolved.", {
3984
4178
  moduleId: e.id,
3985
4179
  handle: a.handle,
@@ -3992,31 +4186,31 @@ function Po(e) {
3992
4186
  }
3993
4187
  if (a.transport.requiredInputSuffixes.length === 0)
3994
4188
  return;
3995
- const S = r.form || r.root, C = await Ir(
4189
+ const S = r.form || r.root, M = await Vr(
3996
4190
  S,
3997
4191
  a.transport.requiredInputSuffixes,
3998
4192
  a.transport.waitForValueMs
3999
4193
  );
4000
- C.ok || (U.warn("Required payment input(s) missing.", {
4194
+ M.ok || (U.warn("Required payment input(s) missing.", {
4001
4195
  moduleId: e.id,
4002
4196
  handle: a.handle,
4003
- missingSuffix: C.missingSuffix
4197
+ missingSuffix: M.missingSuffix
4004
4198
  }), E.abort(a.transport.errorMessage));
4005
4199
  },
4006
- onAfterStage: async (E, b) => {
4200
+ onAfterStage: async (E, y) => {
4007
4201
  E.stage !== "dispatch" || !e.onAfterSubmit || await e.onAfterSubmit({
4008
4202
  field: r.target,
4009
4203
  services: s,
4010
4204
  options: a,
4011
4205
  provider: a.provider,
4012
- result: b
4206
+ result: y
4013
4207
  });
4014
4208
  }
4015
4209
  };
4016
4210
  }
4017
4211
  };
4018
4212
  }
4019
- const ua = Po, $o = "[data-formie-address-autocomplete-input]", xt = "[data-formie-address-location]", Vo = {
4213
+ const Ca = Yo, Zo = "[data-formie-address-autocomplete-input]", Bt = "[data-formie-address-location]", Qo = {
4020
4214
  autoComplete: "[data-formie-address-autocomplete-input]",
4021
4215
  address1: "[data-formie-address-line1-input]",
4022
4216
  address2: "[data-formie-address-line2-input]",
@@ -4025,24 +4219,24 @@ const ua = Po, $o = "[data-formie-address-autocomplete-input]", xt = "[data-form
4025
4219
  state: "[data-formie-address-state-input]",
4026
4220
  zip: "[data-formie-address-zip-input]",
4027
4221
  country: "[data-formie-address-country-input]"
4028
- }, Oo = /* @__PURE__ */ new Set(["handle"]);
4029
- function Ho(e, t) {
4222
+ }, Xo = /* @__PURE__ */ new Set(["handle"]);
4223
+ function ea(e, t) {
4030
4224
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
4031
4225
  }
4032
- function _o(e, t) {
4033
- const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (Oo.has(o) || (i[o] = a), i), {});
4226
+ function ta(e, t) {
4227
+ const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (Xo.has(o) || (i[o] = a), i), {});
4034
4228
  return {
4035
- handle: Ho(e, r),
4229
+ handle: ea(e, r),
4036
4230
  provider: n
4037
4231
  };
4038
4232
  }
4039
- function Do(e, t, r) {
4233
+ function ra(e, t, r) {
4040
4234
  return e.addEventListener(t, r), () => {
4041
4235
  e.removeEventListener(t, r);
4042
4236
  };
4043
4237
  }
4044
- function xo(e) {
4045
- const t = e.target, r = e.form, n = e.root, i = $o;
4238
+ function na(e) {
4239
+ const t = e.target, r = e.form, n = e.root, i = Zo;
4046
4240
  return {
4047
4241
  root: n,
4048
4242
  field: t,
@@ -4050,14 +4244,14 @@ function xo(e) {
4050
4244
  input: {
4051
4245
  getAutocomplete: () => t.querySelector(i),
4052
4246
  setValue: (o, a, s) => {
4053
- const l = Vo[o], d = t.querySelector(l);
4247
+ const l = Qo[o], d = t.querySelector(l);
4054
4248
  d && (d.value = a || s || "");
4055
4249
  }
4056
4250
  },
4057
4251
  location: {
4058
- getButton: () => t.querySelector(xt),
4252
+ getButton: () => t.querySelector(Bt),
4059
4253
  onUseLocation: (o) => {
4060
- const a = t.querySelector(xt);
4254
+ const a = t.querySelector(Bt);
4061
4255
  if (!a)
4062
4256
  return () => {
4063
4257
  };
@@ -4075,22 +4269,22 @@ function xo(e) {
4075
4269
  }
4076
4270
  },
4077
4271
  events: {
4078
- onField: (o, a) => Do(t, o, a)
4272
+ onField: (o, a) => ra(t, o, a)
4079
4273
  }
4080
4274
  };
4081
4275
  }
4082
4276
  const te = _("address");
4083
- function Nt(e) {
4277
+ function jt(e) {
4084
4278
  const t = e;
4085
4279
  return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
4086
4280
  }
4087
- function No(e) {
4281
+ function ia(e) {
4088
4282
  return {
4089
4283
  id: e.id,
4090
4284
  kind: "address",
4091
4285
  match: (t) => !!t.target.querySelector("[data-formie-address-autocomplete-input]"),
4092
4286
  setup: async (t) => {
4093
- const r = _o(e.id, t.options || {}), n = xo(t);
4287
+ const r = ta(e.id, t.options || {}), n = na(t);
4094
4288
  te.log("Setup module.", {
4095
4289
  moduleId: e.id
4096
4290
  });
@@ -4112,11 +4306,11 @@ function No(e) {
4112
4306
  const d = async () => (a || (te.log("Loading provider API.", {
4113
4307
  moduleId: e.id
4114
4308
  }), a = e.load(i)), a), p = async () => {
4115
- if (s || !Nt(t.target))
4309
+ if (s || !jt(t.target))
4116
4310
  return;
4117
- const u = await d();
4311
+ const c = await d();
4118
4312
  s = await e.mount({
4119
- api: u,
4313
+ api: c,
4120
4314
  field: t.target,
4121
4315
  services: n,
4122
4316
  options: r,
@@ -4125,21 +4319,21 @@ function No(e) {
4125
4319
  moduleId: e.id
4126
4320
  });
4127
4321
  };
4128
- Nt(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((u) => {
4129
- const h = () => {
4322
+ jt(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((c) => {
4323
+ const b = () => {
4130
4324
  p();
4131
4325
  };
4132
- t.root.addEventListener(u, h), o.push(() => {
4133
- t.root.removeEventListener(u, h);
4326
+ t.root.addEventListener(c, b), o.push(() => {
4327
+ t.root.removeEventListener(c, b);
4134
4328
  });
4135
4329
  });
4136
- const c = n.location.onUseLocation((u) => {
4330
+ const u = n.location.onUseLocation((c) => {
4137
4331
  e.onCurrentLocation && (async () => {
4138
4332
  if (await p(), !s)
4139
4333
  return;
4140
- const h = await d();
4141
- await e.onCurrentLocation?.(u, {
4142
- api: h,
4334
+ const b = await d();
4335
+ await e.onCurrentLocation?.(c, {
4336
+ api: b,
4143
4337
  widget: s,
4144
4338
  field: t.target,
4145
4339
  services: n,
@@ -4148,14 +4342,14 @@ function No(e) {
4148
4342
  });
4149
4343
  })();
4150
4344
  });
4151
- return c && o.push(c), {
4345
+ return u && o.push(u), {
4152
4346
  destroy: async () => {
4153
4347
  if (te.log("Destroying module.", {
4154
4348
  moduleId: e.id
4155
- }), o.forEach((u) => u()), s && e.unmount) {
4156
- const u = await d();
4349
+ }), o.forEach((c) => c()), s && e.unmount) {
4350
+ const c = await d();
4157
4351
  await e.unmount({
4158
- api: u,
4352
+ api: c,
4159
4353
  widget: s,
4160
4354
  field: t.target,
4161
4355
  services: n,
@@ -4170,60 +4364,60 @@ function No(e) {
4170
4364
  }
4171
4365
  };
4172
4366
  }
4173
- const ca = No;
4367
+ const La = ia;
4174
4368
  export {
4175
- Qo as $,
4176
- Vo as A,
4177
- Uo as B,
4178
- ta as C,
4179
- Ur as D,
4180
- zr as E,
4181
- Vr as F,
4182
- Ki as G,
4183
- jr as H,
4184
- Br as I,
4185
- ea as J,
4186
- Xt as K,
4187
- Pr as L,
4188
- mr as M,
4189
- Hr as N,
4190
- Or as O,
4191
- Xo as P,
4192
- Ao as Q,
4193
- zt as R,
4194
- Zo as S,
4195
- zo as T,
4196
- Cr as U,
4197
- la as V,
4198
- $r as W,
4199
- Go as X,
4200
- Yo as Y,
4201
- x as Z,
4202
- Ne as _,
4203
- aa as a,
4204
- oa as b,
4205
- na as c,
4206
- ca as d,
4207
- sa as e,
4208
- ra as f,
4209
- Bo as g,
4369
+ ga as $,
4370
+ Qo as A,
4371
+ Un as B,
4372
+ ya as C,
4373
+ oa as D,
4374
+ Gr as E,
4375
+ Nr as F,
4376
+ Jr as G,
4377
+ co as H,
4378
+ Yr as I,
4379
+ Zr as J,
4380
+ ba as K,
4381
+ Dr as L,
4382
+ vr as M,
4383
+ ir as N,
4384
+ Br as O,
4385
+ Ur as P,
4386
+ ha as Q,
4387
+ Do as R,
4388
+ Wt as S,
4389
+ pa as T,
4390
+ aa as U,
4391
+ kr as V,
4392
+ Ma as W,
4393
+ xr as X,
4394
+ da as Y,
4395
+ ma as Z,
4396
+ Be as _,
4397
+ wa as a,
4398
+ Aa as b,
4399
+ Ea as c,
4400
+ La as d,
4401
+ Ta as e,
4402
+ va as f,
4403
+ la as g,
4210
4404
  _ as h,
4211
- Mo as i,
4212
- Tr as j,
4213
- Wo as k,
4214
- Ue as l,
4215
- Ie as m,
4405
+ Bo as i,
4406
+ Fr as j,
4407
+ sa as k,
4408
+ ua as l,
4409
+ je as m,
4216
4410
  de as n,
4217
- vr as o,
4218
- Jo as p,
4219
- jo as q,
4220
- Io as r,
4221
- mt as s,
4411
+ Re as o,
4412
+ Mr as p,
4413
+ fa as q,
4414
+ zo as r,
4415
+ ht as s,
4222
4416
  ue as t,
4223
- ua as u,
4224
- Ko as v,
4225
- ia as w,
4226
- V as x,
4227
- le as y,
4228
- Rn as z
4417
+ x as u,
4418
+ Ca as v,
4419
+ Sa as w,
4420
+ ca as x,
4421
+ O as y,
4422
+ le as z
4229
4423
  };