@verbb/formie-browser 1.0.2 → 1.0.3

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 (73) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chunks/{address-finder-CQW81kY0.js → address-finder-BjMuEiwF.js} +2 -2
  3. package/dist/chunks/{bpoint-D8OjLmsn.js → bpoint-KudsBCo2.js} +1 -1
  4. package/dist/chunks/{calculations-BqZsENCq.js → calculations-DlGSkQ3W.js} +2 -2
  5. package/dist/chunks/{captcha-eu-DIa6aUWz.js → captcha-eu-CterYFok.js} +2 -2
  6. package/dist/chunks/{checkbox-radio-BI-UjgMF.js → checkbox-radio-CBvgk3hR.js} +2 -2
  7. package/dist/chunks/{conditions-BVl6jTYo.js → conditions-DYy1-Hwt.js} +189 -163
  8. package/dist/chunks/{date-picker-69TgvErA.js → date-picker-BlD--zfe.js} +2 -2
  9. package/dist/chunks/{eway-1GPxH6DU.js → eway-qwc-B5Us.js} +2 -2
  10. package/dist/chunks/file-upload-CIgHrXfp.js +316 -0
  11. package/dist/chunks/{friendly-captcha-v1-DA2QPKA3.js → friendly-captcha-v1-EDFac33c.js} +1 -1
  12. package/dist/chunks/{friendly-captcha-v2-BorOWiz_.js → friendly-captcha-v2-BDpSvFGR.js} +1 -1
  13. package/dist/chunks/{go-cardless-DwBgERcA.js → go-cardless-DuDMVsnz.js} +1 -1
  14. package/dist/chunks/{google-address-BcTBncyS.js → google-address-Bmjp01pH.js} +77 -58
  15. package/dist/chunks/{hcaptcha-BchdVCqq.js → hcaptcha-BTQ6An6g.js} +2 -2
  16. package/dist/chunks/{hidden-D8RqSPt7.js → hidden-DbPdOxKb.js} +1 -1
  17. package/dist/chunks/{index-C1ZOKiAi.js → index-BcqwpPNE.js} +1261 -1176
  18. package/dist/chunks/{loqate-nXuTX7In.js → loqate-BdNGv93o.js} +2 -2
  19. package/dist/chunks/{mollie-qdCynQCd.js → mollie-DFOjTuGX.js} +1 -1
  20. package/dist/chunks/{moneris-BNEA-laO.js → moneris-BbFfl-EL.js} +1 -1
  21. package/dist/chunks/{opayo-BJtXOkuK.js → opayo-CmgYa9ya.js} +2 -2
  22. package/dist/chunks/{paddle-D72Pa8kr.js → paddle-BUi7w1_o.js} +2 -2
  23. package/dist/chunks/{paypal-Cqt2bned.js → paypal-A-ePfh6k.js} +2 -2
  24. package/dist/chunks/{payway-BjCqsc0H.js → payway-BqFCbhyo.js} +2 -2
  25. package/dist/chunks/{phone-country-K9pYAlzM.js → phone-country-DPMiqk4L.js} +2 -2
  26. package/dist/chunks/{place-kit-Dg6f_UoM.js → place-kit-CX7tamAg.js} +1 -1
  27. package/dist/chunks/{recaptcha-enterprise--VYAeeqz.js → recaptcha-enterprise-DxF6cW95.js} +2 -2
  28. package/dist/chunks/{recaptcha-shared-PSIEEEe1.js → recaptcha-shared-DhGcbiaq.js} +2 -2
  29. package/dist/chunks/{recaptcha-v2-checkbox-atBNe5ml.js → recaptcha-v2-checkbox-R9EfbZ4k.js} +2 -2
  30. package/dist/chunks/{recaptcha-v2-invisible-DnBufNPT.js → recaptcha-v2-invisible-DV9hswAp.js} +2 -2
  31. package/dist/chunks/{recaptcha-v3-CF6O8rDj.js → recaptcha-v3-V0xc-Edh.js} +2 -2
  32. package/dist/chunks/{repeater-CB7Yojvx.js → repeater-DKUT6TGI.js} +2 -2
  33. package/dist/chunks/{rich-text-nAV_SQZo.js → rich-text-SH7KiaKH.js} +1 -1
  34. package/dist/chunks/{scripts-BkAAux0i.js → scripts-D9N2d5rN.js} +1 -1
  35. package/dist/chunks/{shared-DGqeMvcJ.js → shared-BmntPmnW.js} +4 -4
  36. package/dist/chunks/{signature-BT6CsQ6n.js → signature-BA3tQsGT.js} +1 -1
  37. package/dist/chunks/{snaptcha-C7qQo02f.js → snaptcha-DV7p6J9k.js} +1 -1
  38. package/dist/chunks/{square-C5AH3trb.js → square-Bs-ndqYK.js} +2 -2
  39. package/dist/chunks/{stripe-EJK0RyUv.js → stripe-DkZAHxtn.js} +2 -2
  40. package/dist/chunks/{summary-DC_ipXCU.js → summary-Dq2i9TQk.js} +2 -2
  41. package/dist/chunks/{table-BEAI99qo.js → table-Cu4WfVcw.js} +2 -2
  42. package/dist/chunks/{text-limit-Blgq5G-G.js → text-limit-2ycmB-Ae.js} +1 -1
  43. package/dist/chunks/{turnstile-_uCRwnU-.js → turnstile-CId90tRr.js} +2 -2
  44. package/dist/css/theme/forms/_form.css +28 -0
  45. package/dist/index.js +1 -1
  46. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  47. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  48. package/dist/js/modules/address/google-address.d.ts +7 -0
  49. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  50. package/dist/js/modules/fields/conditions/effects.d.ts +3 -1
  51. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  52. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  53. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  54. package/dist/js/submit/pipeline.d.ts.map +1 -1
  55. package/dist/js/validation/scope.d.ts +6 -0
  56. package/dist/js/validation/scope.d.ts.map +1 -0
  57. package/dist/js/validation/submit-readiness.d.ts +4 -0
  58. package/dist/js/validation/submit-readiness.d.ts.map +1 -0
  59. package/dist/js/validation/validator.d.ts +1 -0
  60. package/dist/js/validation/validator.d.ts.map +1 -1
  61. package/package.json +2 -2
  62. package/src/css/theme/forms/_form.css +28 -0
  63. package/src/js/core/create-formie-client.ts +6 -0
  64. package/src/js/core/submit-result-state.ts +17 -0
  65. package/src/js/modules/address/google-address.ts +33 -1
  66. package/src/js/modules/fields/conditions/effects.ts +79 -2
  67. package/src/js/modules/fields/conditions.ts +53 -11
  68. package/src/js/modules/fields/file-upload.ts +188 -96
  69. package/src/js/submit/pipeline.ts +3 -28
  70. package/src/js/validation/scope.ts +25 -0
  71. package/src/js/validation/submit-readiness.ts +157 -0
  72. package/src/js/validation/validator.ts +4 -0
  73. package/dist/chunks/file-upload-BDZZftgL.js +0 -281
@@ -1,4 +1,4 @@
1
- const Pr = [
1
+ const _r = [
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
+ ], Yo = [
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 Dr(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 xr = [
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 ze(e) {
57
57
  return e;
58
58
  }
59
- function zo(e) {
59
+ function Zo(e) {
60
60
  return e;
61
61
  }
62
- function jo(e, t) {
62
+ function Qo(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 Xo(e, t) {
69
69
  return `formie:address:${e}:${t}`;
70
70
  }
71
- function Wo(e) {
71
+ function ea(e) {
72
72
  return `formie:file-upload:${e}`;
73
73
  }
74
- function Ko(e, t) {
74
+ function ta(e, t) {
75
75
  return `formie:payment:${e}:${t}`;
76
76
  }
77
- function Ue(e) {
77
+ function Be(e) {
78
78
  return `formie:state:${e}`;
79
79
  }
80
- function Or(e, t) {
80
+ function Nr(e, t) {
81
81
  return `formie:module:${e}:${t}`;
82
82
  }
83
- function Hr(e) {
83
+ function Ur(e) {
84
84
  return `formie:module:${e}`;
85
85
  }
86
- function _r(e, t, r) {
86
+ function zr(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 Br(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 jr(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 Wr(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" ? jr(n, t) : t;
123
123
  }
124
- function Ur({
124
+ function Kr({
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 && _r.forEach((o) => {
132
132
  const a = (s) => {
133
- if (!(s instanceof CustomEvent) || !Dr(o, s.detail))
133
+ if (!(s instanceof CustomEvent) || !Br(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
+ zr(l, o.legacyEvent, Wr(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(ze(o.canonicalEvent), a), i.push(() => {
139
+ e.removeEventListener(ze(o.canonicalEvent), a);
140
140
  });
141
141
  });
142
142
  }
@@ -149,7 +149,7 @@ function ge(e, t, r) {
149
149
  function $e(e, t) {
150
150
  return !!e && typeof e == "object" && e.validator === t;
151
151
  }
152
- function zr({
152
+ function Gr({
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) || !$e(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) || !$e(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) || !$e(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(ze(t), {
195
195
  bubbles: !0,
196
196
  detail: r
197
197
  }));
198
198
  }
199
- function Ut() {
199
+ function jt() {
200
200
  return globalThis;
201
201
  }
202
- function zt() {
203
- return Ut().__FORMIE_DEBUG__ === !0;
202
+ function Wt() {
203
+ return jt().__FORMIE_DEBUG__ === !0;
204
204
  }
205
- function Go(e) {
206
- Ut().__FORMIE_DEBUG__ = e;
205
+ function ra(e) {
206
+ jt().__FORMIE_DEBUG__ = e;
207
207
  }
208
- function jr(e, t, r) {
209
- if (zt()) {
208
+ function Jr(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 Yr(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
+ Jr(r, n, i);
231
231
  },
232
232
  warn: (n, i) => {
233
- Br(r, n, i);
233
+ Yr(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"), Zr = "data-formie-client-event";
238
+ function Qr(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 Xr(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 en(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 tn(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 = Xr(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="${Qr(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(Zr);
283
283
  if (i === null)
284
284
  return;
285
- const o = Jr(i);
285
+ const o = en(i);
286
286
  if (!o || !Array.isArray(o.fields))
287
287
  return;
288
- const a = Yr(o.fields), s = window;
288
+ const a = tn(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(), rn = "[data-formie-form], [data-formie], form";
298
+ function nn(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 on(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(rn);
311
+ return r ? we.get(r) || {} : {};
312
312
  }
313
- function en(e) {
313
+ function an(e) {
314
314
  const t = {};
315
315
  return Object.entries(e || {}).forEach(([r, n]) => {
316
- const i = Xe(Qr(n));
316
+ const i = tt(nn(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 = an(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 on(e)[t] || [];
326
326
  }
327
- function V(e, t, ...r) {
328
- const n = Xe(r.flatMap((i) => et(t, i)));
327
+ function $(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 sn(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
+ sn(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 Fe(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 na(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
- const H = _("general", "transport");
448
- function rn(e) {
447
+ const O = _("general", "transport");
448
+ function ln(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 un(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,24 +489,24 @@ function nn(e, t) {
489
489
  meta: e
490
490
  };
491
491
  }
492
- async function on(e, t, r = {}) {
492
+ async function cn(e, t, r = {}) {
493
493
  const n = JSON.stringify({
494
494
  handle: t,
495
495
  renderOptions: r
496
496
  });
497
- H.log("requestRender start.", { endpoint: e, handle: t });
498
- const i = await Ie(e, {
497
+ O.log("requestRender start.", { endpoint: e, handle: t });
498
+ const i = await Fe(e, {
499
499
  method: "POST",
500
500
  body: n,
501
501
  headers: {
502
502
  "Content-Type": "application/json"
503
503
  }
504
504
  });
505
- return H.log("requestRender complete.", {
505
+ return O.log("requestRender complete.", {
506
506
  hasHtml: !!i.html
507
507
  }), i;
508
508
  }
509
- async function an(e, t, r = {}) {
509
+ async function dn(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: ln(r)
520
520
  }
521
521
  });
522
- H.log("requestGraphqlRender start.", { endpoint: e, handle: t });
523
- const o = await Ie(e, {
522
+ O.log("requestGraphqlRender start.", { endpoint: e, handle: t });
523
+ const o = await Fe(e, {
524
524
  method: "POST",
525
525
  body: i,
526
526
  headers: {
@@ -532,50 +532,50 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
532
532
  if (!o.data?.formieHtmlForm)
533
533
  throw new Error(`Form not found for handle "${t}".`);
534
534
  const a = o.data.formieHtmlForm;
535
- return H.log("requestGraphqlRender complete.", {
535
+ return O.log("requestGraphqlRender complete.", {
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
- n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r), H.log("requestRefreshTokens start.", {
541
+ n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r), O.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());
547
- return H.log("requestRefreshTokens complete.", {
546
+ const i = await Fe(n.toString());
547
+ return O.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 fn(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);
560
560
  }
561
- H.log("requestSetPage start.", {
561
+ O.log("requestSetPage start.", {
562
562
  requestUrl: n.toString(),
563
563
  pageId: r || null
564
564
  });
565
- const o = await Ie(n.toString(), {
565
+ const o = await Fe(n.toString(), {
566
566
  method: "POST",
567
567
  body: i
568
568
  });
569
- return H.log("requestSetPage complete.", o), o;
569
+ return O.log("requestSetPage complete.", o), o;
570
570
  }
571
- function ln(e, t) {
571
+ function mn(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();
575
575
  d && n.append(s, d);
576
576
  });
577
577
  const a = t.querySelector('input[name="CRAFT_CSRF_TOKEN"]')?.value?.trim();
578
- a && n.append("CRAFT_CSRF_TOKEN", a), H.log("clearSubmissionOnUnload start.", {
578
+ a && n.append("CRAFT_CSRF_TOKEN", a), O.log("clearSubmissionOnUnload start.", {
579
579
  requestUrl: r.toString()
580
580
  });
581
581
  try {
@@ -593,9 +593,9 @@ function ln(e, t) {
593
593
  }
594
594
  });
595
595
  }
596
- async function un(e, t) {
596
+ async function pn(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
- H.log("submitForm start.", {
598
+ O.log("submitForm start.", {
599
599
  method: r,
600
600
  action: n,
601
601
  submitAction: t.get("submitAction")
@@ -609,13 +609,13 @@ async function un(e, t) {
609
609
  }
610
610
  }), a = o.headers.get("content-type") || "";
611
611
  if (!a.includes("application/json"))
612
- return o.ok ? (H.log("submitForm non-JSON success response.", {
612
+ return o.ok ? (O.log("submitForm non-JSON success response.", {
613
613
  status: o.status,
614
614
  contentType: a
615
615
  }), {
616
616
  ok: !0,
617
617
  message: "Submission completed."
618
- }) : (H.warn("submitForm non-JSON HTTP error.", {
618
+ }) : (O.warn("submitForm non-JSON HTTP error.", {
619
619
  status: o.status,
620
620
  contentType: a
621
621
  }), {
@@ -624,29 +624,19 @@ 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);
628
- return H.log("submitForm JSON response normalized.", {
627
+ const s = await o.json(), l = un(s, i);
628
+ return O.log("submitForm JSON response normalized.", {
629
629
  ok: l.ok,
630
630
  code: l.code,
631
631
  hasRedirect: !!l.redirect?.url,
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 gn = ["prepare", "normalize", "validate", "screen", "authorize", "dispatch", "finalize"], hn = ["prepare", "normalize", "validate", "screen", "authorize"], R = _("general", "pipeline");
652
+ function He(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 bn(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 yn(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 vn(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
+ bn(i, e);
712
+ const o = yn(i, n);
713
+ return vn(i, o), i.set("submitAction", t), i;
714
714
  }
715
- function hn(e, t) {
715
+ function En(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 = {}) {
721
+ async function tr(e, t, r, n = {}) {
722
722
  R.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 = En(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, R.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,148 @@ 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 pn(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 && R.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 && R.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 ? hn : gn;
788
+ for (const u of p) {
789
+ if (R.log("Stage start.", { stage: u, action: t }), i)
790
+ return R.warn("Stage skipped due to abort.", { stage: u, reason: o }), He(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 && R.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 = He(u, o);
803
803
  {
804
- const A = await r.emitSafe("formie:submit:after", h);
804
+ const A = await r.emitSafe("formie:submit:after", b);
805
805
  A.failed.length > 0 && R.warn("Submit after listeners failed (abort before stage).", {
806
- stage: c,
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);
811
+ const A = await r.emitSafe("formie:submit:final:after", b);
812
812
  A.failed.length > 0 && R.warn("Final submit after listeners failed (abort before stage).", {
813
- stage: c,
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 R.warn("Aborted after stage before-hooks.", { stage: u, reason: o }), b;
818
818
  }
819
- const u = await d[c](l);
819
+ const c = await d[u](l);
820
820
  R.log("Stage runner complete.", {
821
- stage: c,
822
- hasResult: !!u,
823
- ok: u ? u.ok : void 0,
824
- code: u?.code
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 && R.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 = He(u, o);
839
839
  {
840
- const A = await r.emitSafe("formie:submit:after", h);
840
+ const A = await r.emitSafe("formie:submit:after", b);
841
841
  A.failed.length > 0 && R.warn("Submit after listeners failed (abort after stage).", {
842
- stage: c,
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);
847
+ const A = await r.emitSafe("formie:submit:final:after", b);
848
848
  A.failed.length > 0 && R.warn("Final submit after listeners failed (abort after stage).", {
849
- stage: c,
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 R.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 && R.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 && R.warn("Final submit after listeners failed (failed stage).", {
866
+ stage: u,
867
+ failed: b.failed.length
868
868
  });
869
869
  }
870
870
  return R.warn("Pipeline short-circuited by failed stage.", {
871
- stage: c,
872
- code: u.code,
873
- message: u.message
874
- }), u;
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 && R.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 && R.warn("Final submit after listeners failed (success).", {
891
+ failed: u.failed.length
892
892
  });
893
893
  }
894
894
  return R.log("Pipeline completed.", {
895
- ok: y.ok,
896
- stage: y.stage,
897
- code: y.code
898
- }), y;
895
+ ok: h.ok,
896
+ stage: h.stage,
897
+ code: h.code
898
+ }), h;
899
899
  }
900
- const bn = {
900
+ const Sn = {
901
901
  rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
902
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 })
903
903
  };
904
- function yn(e) {
904
+ function An(e) {
905
905
  return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
906
906
  }
907
- function bt(e) {
907
+ function Et(e) {
908
908
  const t = e.getRule("match");
909
909
  if (!t || t === !0 || typeof t != "object" || !e.field)
910
910
  return null;
@@ -914,19 +914,19 @@ function bt(e) {
914
914
  const n = e.form.querySelector(`[data-formie-field-handle="${r}"]`);
915
915
  return n ? n.querySelector(e.config.fieldsSelector) : null;
916
916
  }
917
- const vn = {
917
+ const wn = {
918
918
  rule: (e) => {
919
- const t = bt(e);
919
+ const t = Et(e);
920
920
  return t ? t.value === e.input.value : !0;
921
921
  },
922
922
  message: (e) => {
923
- const r = bt(e)?.closest("[data-formie-field-handle]"), n = yn(r);
923
+ const r = Et(e)?.closest("[data-formie-field-handle]"), n = An(r);
924
924
  return e.t("{name} must match {value}.", {
925
925
  name: e.label,
926
926
  value: n
927
927
  });
928
928
  }
929
- }, En = {
929
+ }, Tn = {
930
930
  rule: ({ input: e, getRule: t }) => {
931
931
  const r = t("number");
932
932
  if (!r || !e.value || e.value.trim() === "")
@@ -945,7 +945,7 @@ const vn = {
945
945
  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
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 });
947
947
  }
948
- }, Sn = {
948
+ }, Mn = {
949
949
  rule: ({ input: e, getRule: t }) => {
950
950
  if (!t("required") || e.type === "hidden")
951
951
  return !0;
@@ -956,7 +956,7 @@ const vn = {
956
956
  return e.value.trim() !== "";
957
957
  },
958
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 = {
959
+ }, Cn = {
960
960
  rule: ({ input: e, getRule: t }) => {
961
961
  if (!t("url") || !e.value || e.value.length < 1)
962
962
  return !0;
@@ -967,19 +967,19 @@ const vn = {
967
967
  }
968
968
  },
969
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 = {
970
+ }, Ln = {
971
971
  // Keep the core validator registry centralized so FormieValidator can extend
972
972
  // 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
973
+ required: Mn,
974
+ email: Sn,
975
+ url: Cn,
976
+ number: Tn,
977
+ match: wn
978
978
  };
979
- function Qt() {
979
+ function rr() {
980
980
  return window.FormieTranslations || {};
981
981
  }
982
- function Tn() {
982
+ function In() {
983
983
  if (typeof document > "u")
984
984
  return;
985
985
  const e = Array.from(document.querySelectorAll('script[type="application/json"][data-formie-translations]:not([data-formie-translations-loaded="true"])'));
@@ -995,7 +995,7 @@ function Tn() {
995
995
  if (!i || Array.isArray(i) || typeof i != "object")
996
996
  continue;
997
997
  t = {
998
- ...t ?? Qt(),
998
+ ...t ?? rr(),
999
999
  ...i
1000
1000
  };
1001
1001
  } catch {
@@ -1004,26 +1004,26 @@ function Tn() {
1004
1004
  }
1005
1005
  t && (window.FormieTranslations = t);
1006
1006
  }
1007
- function nt() {
1008
- return Tn(), Qt();
1007
+ function ot() {
1008
+ return In(), rr();
1009
1009
  }
1010
- function Xt() {
1011
- return { ...nt() };
1010
+ function nr() {
1011
+ return { ...ot() };
1012
1012
  }
1013
- function Yo(e) {
1014
- return window.FormieTranslations = { ...e }, Xt();
1013
+ function ia(e) {
1014
+ return window.FormieTranslations = { ...e }, nr();
1015
1015
  }
1016
- function Zo(e) {
1016
+ function oa(e) {
1017
1017
  return window.FormieTranslations = {
1018
- ...nt(),
1018
+ ...ot(),
1019
1019
  ...e
1020
- }, Xt();
1020
+ }, nr();
1021
1021
  }
1022
1022
  function x(e, t = {}) {
1023
- let r = nt()[e] || e;
1023
+ let r = ot()[e] || e;
1024
1024
  return r = r.replace(/{([a-zA-Z0-9]+)}/g, (n, i) => Object.prototype.hasOwnProperty.call(t, i) ? String(t[i]) : n), r;
1025
1025
  }
1026
- const Qo = x, Cn = {
1026
+ const aa = x, Fn = {
1027
1027
  // eslint-disable-next-line
1028
1028
  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
1029
  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 +1036,7 @@ const Qo = x, Cn = {
1036
1036
  function oe(e) {
1037
1037
  return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
1038
1038
  }
1039
- function Mn(e, t) {
1039
+ function Rn(e, t) {
1040
1040
  const r = (e.getAttribute("aria-describedby") || "").trim();
1041
1041
  if (!r)
1042
1042
  return;
@@ -1047,17 +1047,17 @@ function Mn(e, t) {
1047
1047
  }
1048
1048
  e.removeAttribute("aria-describedby");
1049
1049
  }
1050
- function Ln(e, t) {
1050
+ function kn(e, t) {
1051
1051
  const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
1052
1052
  n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
1053
1053
  }
1054
- function In(e, t) {
1054
+ function qn(e, t) {
1055
1055
  e.setAttribute("aria-errormessage", t);
1056
1056
  }
1057
- function Fn(e, t) {
1057
+ function Pn(e, t) {
1058
1058
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
1059
1059
  }
1060
- class Rn {
1060
+ class Vn {
1061
1061
  constructor(t, r = {}) {
1062
1062
  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
1063
  live: !1,
@@ -1067,9 +1067,9 @@ class Rn {
1067
1067
  messagesClass: [],
1068
1068
  messageClass: [],
1069
1069
  fieldsSelector: 'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([disabled]), select:not([disabled]), textarea:not([disabled])',
1070
- patterns: Cn,
1070
+ patterns: Fn,
1071
1071
  ...r
1072
- }, Object.entries(wn).forEach(([n, i]) => {
1072
+ }, Object.entries(Ln).forEach(([n, i]) => {
1073
1073
  this.addValidator(n, i.rule, i.message);
1074
1074
  }), this.init();
1075
1075
  }
@@ -1098,6 +1098,9 @@ class Rn {
1098
1098
  shouldShowError(t) {
1099
1099
  return this.submitted || this.activated.has(t);
1100
1100
  }
1101
+ isValid(t = null, r = {}) {
1102
+ return this.validate(t, r).length === 0;
1103
+ }
1101
1104
  validate(t = null, r = {}) {
1102
1105
  this.errors = [];
1103
1106
  const n = /* @__PURE__ */ new Set();
@@ -1115,12 +1118,12 @@ class Rn {
1115
1118
  const l = this.getValidatorCallbackOptions(i);
1116
1119
  Object.entries(this.validators).forEach(([d, p]) => {
1117
1120
  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({
1121
+ const u = this.getErrorMessage(i, d, p, l);
1122
+ this.shouldShowError(i) && !o && this.showError(i, d, u), this.errors.push({
1120
1123
  input: i,
1121
1124
  field: l.field,
1122
1125
  validator: d,
1123
- message: c,
1126
+ message: u,
1124
1127
  handle: l.field?.getAttribute("data-formie-field-handle") || null,
1125
1128
  result: !1
1126
1129
  }), o = !0;
@@ -1147,9 +1150,9 @@ class Rn {
1147
1150
  o.remove();
1148
1151
  }), n && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((o) => {
1149
1152
  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) => {
1153
+ a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i && Rn(a, i), r.querySelectorAll("[data-formie-field-error]").forEach((s) => {
1151
1154
  const l = s.id;
1152
- l && Fn(a, l);
1155
+ l && Pn(a, l);
1153
1156
  });
1154
1157
  });
1155
1158
  for (let o = r; o; o = o.parentElement?.closest("[data-formie-field-handle]"))
@@ -1169,7 +1172,7 @@ class Rn {
1169
1172
  const l = document.createElement("div");
1170
1173
  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
1174
  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);
1175
+ p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"), kn(p, o.id), qn(p, s);
1173
1176
  });
1174
1177
  for (let d = i; d; d = d.parentElement?.closest("[data-formie-field-handle]"))
1175
1178
  this.config.fieldContainerErrorClass.length && d.classList.add(...this.config.fieldContainerErrorClass), d.setAttribute("data-formie-field-has-error", "true");
@@ -1286,18 +1289,94 @@ class Rn {
1286
1289
  delete this.validators[t];
1287
1290
  }
1288
1291
  }
1289
- const kn = "STALE_SUBMISSION_STATE", yt = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakMap(), j = _("general", "submit-result");
1290
- function ze(e, t, r) {
1292
+ const he = "data-formie-submit-validation-disabled", Oe = "data-formie-preserve-disabled", $n = "data-formie-submit-ready";
1293
+ function ir(e) {
1294
+ return e.dataset.formieDisableSubmitUntilValid === "true";
1295
+ }
1296
+ function Hn(e) {
1297
+ return Array.from(e.querySelectorAll('button[data-formie-action="submit"]')).filter((t) => t instanceof HTMLButtonElement);
1298
+ }
1299
+ function On(e) {
1300
+ return !e.hasAttribute("data-formie-conditionally-hidden") && !e.closest("[data-formie-conditionally-hidden]");
1301
+ }
1302
+ function at(e, t) {
1303
+ if (!ir(e) || e.getAttribute("data-formie-loading") === "true")
1304
+ return;
1305
+ const { scope: r, final: n } = Zt(e), i = t.isValid(r, {
1306
+ includeHiddenPages: n
1307
+ });
1308
+ e.setAttribute($n, i ? "true" : "false"), Hn(e).forEach((o) => {
1309
+ if (On(o)) {
1310
+ if (i) {
1311
+ if (!o.hasAttribute(he))
1312
+ return;
1313
+ o.hasAttribute(Oe) ? (o.disabled = !0, o.removeAttribute(Oe)) : o.disabled = !1, o.removeAttribute(he);
1314
+ return;
1315
+ }
1316
+ o.hasAttribute(he) || (o.disabled && o.setAttribute(Oe, "true"), o.setAttribute(he, "true")), o.disabled = !0;
1317
+ }
1318
+ });
1319
+ }
1320
+ function _n(e, t, r) {
1321
+ if (!ir(e))
1322
+ return () => {
1323
+ };
1324
+ let n = !1;
1325
+ const i = () => {
1326
+ n || (n = !0, queueMicrotask(() => {
1327
+ n = !1, at(e, t);
1328
+ }));
1329
+ };
1330
+ i();
1331
+ const o = () => {
1332
+ i();
1333
+ };
1334
+ e.addEventListener("input", o, !0), e.addEventListener("change", o, !0);
1335
+ const a = () => {
1336
+ window.setTimeout(() => {
1337
+ i();
1338
+ }, 0);
1339
+ };
1340
+ e.addEventListener("reset", a);
1341
+ const s = () => {
1342
+ i();
1343
+ };
1344
+ r.addEventListener("formie:conditions:evaluated", s);
1345
+ const l = new MutationObserver((d) => {
1346
+ d.some((h) => {
1347
+ if (h.type === "attributes") {
1348
+ const u = h.attributeName || "";
1349
+ return u === "data-formie-page-hidden" || u === "data-formie-conditionally-hidden" || u === "data-formie-loading" || u === "disabled";
1350
+ }
1351
+ return h.type === "childList";
1352
+ }) && i();
1353
+ });
1354
+ return l.observe(e, {
1355
+ childList: !0,
1356
+ subtree: !0,
1357
+ attributes: !0,
1358
+ attributeFilter: [
1359
+ "data-formie-page-hidden",
1360
+ "data-formie-conditionally-hidden",
1361
+ "data-formie-loading",
1362
+ "disabled"
1363
+ ]
1364
+ }), () => {
1365
+ e.removeEventListener("input", o, !0), e.removeEventListener("change", o, !0), e.removeEventListener("reset", a), r.removeEventListener("formie:conditions:evaluated", s), l.disconnect();
1366
+ };
1367
+ }
1368
+ const Dn = "STALE_SUBMISSION_STATE", St = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), B = _("general", "submit-result");
1369
+ function je(e, t, r) {
1291
1370
  let n = e.querySelector(`input[name="${t}"]`);
1292
1371
  n || (n = document.createElement("input"), n.type = "hidden", n.name = t, e.appendChild(n)), n.value = r;
1293
1372
  }
1294
- function vt(e, t) {
1373
+ function At(e, t) {
1295
1374
  e.setAttribute("data-formie-internal-navigation", t);
1296
1375
  }
1297
1376
  function ae(e, t) {
1298
1377
  e.querySelector(`input[name="${t}"]`)?.remove();
1299
1378
  }
1300
- function qn(e, t) {
1379
+ function xn(e, t) {
1301
1380
  try {
1302
1381
  const r = new URL(e, window.location.href);
1303
1382
  return r.searchParams.delete(t), r.toString();
@@ -1305,36 +1384,36 @@ function qn(e, t) {
1305
1384
  return e;
1306
1385
  }
1307
1386
  }
1308
- function Pn(e) {
1387
+ function Nn(e) {
1309
1388
  try {
1310
1389
  return new URL(e, window.location.href).origin === window.location.origin;
1311
1390
  } catch {
1312
1391
  return !1;
1313
1392
  }
1314
1393
  }
1315
- function er(e) {
1394
+ function or(e) {
1316
1395
  return Array.from(e.querySelectorAll("[data-formie-page]"));
1317
1396
  }
1318
- function $n(e) {
1397
+ function Un(e) {
1319
1398
  return Array.from(e.querySelectorAll("[data-formie-tab]"));
1320
1399
  }
1321
- function Vn(e, t, r) {
1400
+ function zn(e, t, r) {
1322
1401
  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
1402
  }
1324
- function On(e) {
1403
+ function Bn(e) {
1325
1404
  return e <= 0 ? "start" : e >= 100 ? "end" : "middle";
1326
1405
  }
1327
- function Et(e) {
1406
+ function wt(e) {
1328
1407
  return (e.dataset.formieSubmitAction || "").trim();
1329
1408
  }
1330
- function St(e) {
1409
+ function Tt(e) {
1331
1410
  const t = e.dataset.formieSubmitActionFormHide;
1332
1411
  if (t === void 0)
1333
1412
  return !1;
1334
1413
  const r = t.trim().toLowerCase();
1335
1414
  return r === "true" || r === "1" || r === "";
1336
1415
  }
1337
- function it(e, t) {
1416
+ function st(e, t) {
1338
1417
  const r = [
1339
1418
  "[data-formie-form-header]",
1340
1419
  "[data-formie-form-navigation]",
@@ -1349,78 +1428,84 @@ function it(e, t) {
1349
1428
  });
1350
1429
  }
1351
1430
  function z(e) {
1352
- const t = yt.get(e);
1353
- typeof t == "number" && (window.clearTimeout(t), yt.delete(e));
1431
+ const t = St.get(e);
1432
+ typeof t == "number" && (window.clearTimeout(t), St.delete(e));
1354
1433
  }
1355
- function Hn(e, t) {
1356
- we.has(e) || we.set(e, e.innerHTML), e.textContent = t;
1434
+ function jn(e, t) {
1435
+ Te.has(e) || Te.set(e, e.innerHTML), e.textContent = t;
1357
1436
  }
1358
- function je(e) {
1359
- const t = we.get(e);
1360
- t !== void 0 && (e.innerHTML = t, we.delete(e));
1437
+ function We(e) {
1438
+ const t = Te.get(e);
1439
+ t !== void 0 && (e.innerHTML = t, Te.delete(e));
1361
1440
  }
1362
- function _n(e, t) {
1441
+ function Wn(e, t) {
1363
1442
  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}`)));
1443
+ r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state", Bn(t)), n && (n.textContent = `${t}%`, n.setAttribute("data-formie-progress-value", `${t}`)));
1365
1444
  }
1366
- function Dn(e, t) {
1445
+ function Kn(e, t) {
1367
1446
  if (!t)
1368
1447
  return;
1369
1448
  const r = (e.dataset.formieLoadingIndicator || "").trim();
1370
1449
  if (r) {
1371
1450
  if (t.setAttribute("data-formie-loading-indicator", r), r === "spinner") {
1372
- ue(t, e, "loading", !0), je(t), t.removeAttribute("data-formie-loading-text");
1451
+ ue(t, e, "loading", !0), We(t), t.removeAttribute("data-formie-loading-text");
1373
1452
  return;
1374
1453
  }
1375
1454
  if (r === "text") {
1376
1455
  const n = (e.dataset.formieLoadingIndicatorText || "").trim(), i = t.textContent?.trim() || "", o = n || i;
1377
- t.setAttribute("data-formie-loading-text", o), Hn(t, o);
1456
+ t.setAttribute("data-formie-loading-text", o), jn(t, o);
1378
1457
  return;
1379
1458
  }
1380
- je(t), t.removeAttribute("data-formie-loading-text");
1459
+ We(t), t.removeAttribute("data-formie-loading-text");
1381
1460
  }
1382
1461
  }
1383
- function tr(e) {
1462
+ function ar(e) {
1384
1463
  return Array.from(e.querySelectorAll("[data-formie-action]"));
1385
1464
  }
1386
- function rr(e, t) {
1465
+ function sr(e, t) {
1387
1466
  if (e.getAttribute("data-formie-loading") === "true")
1388
1467
  return;
1389
- e.setAttribute("data-formie-loading", "true"), tr(e).forEach((n) => {
1468
+ e.setAttribute("data-formie-loading", "true"), ar(e).forEach((n) => {
1390
1469
  "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));
1470
+ }), t && (t.setAttribute("data-formie-loading", "true"), Kn(e, t));
1392
1471
  }
1393
- function Te(e) {
1394
- e.removeAttribute("data-formie-loading"), tr(e).forEach((r) => {
1472
+ function Me(e) {
1473
+ if (e.removeAttribute("data-formie-loading"), ar(e).forEach((r) => {
1395
1474
  if ("disabled" in r) {
1396
1475
  const n = r, i = n.getAttribute("data-formie-was-disabled") === "true";
1397
1476
  n.disabled = i;
1398
1477
  }
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
- });
1478
+ 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");
1479
+ }), e.dataset.formieDisableSubmitUntilValid === "true") {
1480
+ const r = e;
1481
+ r.formieValidation && at(e, r.formieValidation);
1482
+ }
1401
1483
  }
1402
- function ot(e, t) {
1403
- const r = er(e), n = $n(e), i = r.findIndex((o) => o.getAttribute("data-formie-page-id") === t);
1484
+ function lt(e, t) {
1485
+ const r = or(e), n = Un(e), i = r.findIndex((o) => o.getAttribute("data-formie-page-id") === t);
1404
1486
  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"));
1487
+ 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, e, "pageHidden"));
1406
1488
  }), n.forEach((o, a) => {
1407
1489
  const s = o.getAttribute("data-formie-page-id") === t, l = i > -1 && a < i;
1408
1490
  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
1491
  }), i > -1 && r.length > 0) {
1410
- const o = Vn(e, i, r.length);
1411
- _n(e, o);
1492
+ const o = zn(e, i, r.length);
1493
+ Wn(e, o);
1494
+ }
1495
+ if (je(e, "pageId", t), J(e), e.dataset.formieDisableSubmitUntilValid === "true") {
1496
+ const o = e;
1497
+ o.formieValidation && at(e, o.formieValidation);
1412
1498
  }
1413
- ze(e, "pageId", t), J(e);
1414
1499
  }
1415
- function xn(e, t) {
1500
+ function Gn(e, t) {
1416
1501
  const r = t.meta?.submissionUid;
1417
- typeof r == "string" && r.trim() !== "" && ze(e, "submissionUid", r);
1502
+ typeof r == "string" && r.trim() !== "" && je(e, "submissionUid", r);
1418
1503
  const n = t.meta?.session?.continuation?.continuationToken;
1419
- typeof n == "string" && n.trim() !== "" ? ze(e, "continuationToken", n) : ae(e, "continuationToken");
1504
+ typeof n == "string" && n.trim() !== "" ? je(e, "continuationToken", n) : ae(e, "continuationToken");
1420
1505
  }
1421
- function Nn(e) {
1506
+ function Jn(e) {
1422
1507
  const t = e.getAttribute("action");
1423
- t && e.setAttribute("action", qn(t, "resumeToken"));
1508
+ t && e.setAttribute("action", xn(t, "resumeToken"));
1424
1509
  try {
1425
1510
  const r = new URL(window.location.href);
1426
1511
  if (!r.searchParams.has("resumeToken"))
@@ -1429,12 +1514,12 @@ function Nn(e) {
1429
1514
  } catch {
1430
1515
  }
1431
1516
  }
1432
- function Un(e, t) {
1517
+ function Yn(e, t) {
1433
1518
  const r = t.meta?.resumeUrl;
1434
1519
  if (typeof r != "string" || r.trim() === "")
1435
1520
  return;
1436
1521
  const n = r.trim();
1437
- if (!Pn(n))
1522
+ if (!Nn(n))
1438
1523
  return;
1439
1524
  e.getAttribute("action") && e.setAttribute("action", n);
1440
1525
  try {
@@ -1443,31 +1528,31 @@ function Un(e, t) {
1443
1528
  } catch {
1444
1529
  }
1445
1530
  }
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 }));
1531
+ function be(e, t = {}) {
1532
+ const n = e.formieValidation, i = or(e)[0]?.getAttribute("data-formie-page-id");
1533
+ if (z(e), e.reset(), t.preserveHiddenState || st(e, !1), ae(e, "submissionId"), ae(e, "submissionUid"), ae(e, "continuationToken"), ae(e, "pageId"), Jn(e), n?.resetLiveState(), i) {
1534
+ lt(e, i), e.dispatchEvent(new CustomEvent(Be("reset"), { bubbles: !0 }));
1450
1535
  return;
1451
1536
  }
1452
- J(e), e.dispatchEvent(new CustomEvent(Ue("reset"), { bubbles: !0 }));
1537
+ J(e), e.dispatchEvent(new CustomEvent(Be("reset"), { bubbles: !0 }));
1453
1538
  }
1454
- function zn(e) {
1455
- return e.code === kn || e.meta?.resetState === !0;
1539
+ function Zn(e) {
1540
+ return e.code === Dn || e.meta?.resetState === !0;
1456
1541
  }
1457
- function jn(e, t) {
1542
+ function Qn(e, t) {
1458
1543
  const r = t.submitData, n = /* @__PURE__ */ new Set();
1459
1544
  let i = !1;
1460
1545
  if (Array.isArray(r) && r.length > 0) {
1461
1546
  const p = r.filter(
1462
- (y) => typeof y == "object" && y !== null && "event" in y && typeof y.event == "string"
1547
+ (h) => typeof h == "object" && h !== null && "event" in h && typeof h.event == "string"
1463
1548
  );
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, {
1549
+ for (const h of p) {
1550
+ const u = h.event;
1551
+ n.add(u), B.log("Dispatching submitData event.", {
1552
+ eventName: u
1553
+ }), u.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(u, {
1469
1554
  bubbles: !0,
1470
- detail: { data: y.data }
1555
+ detail: { data: h.data }
1471
1556
  }));
1472
1557
  }
1473
1558
  }
@@ -1475,122 +1560,122 @@ function jn(e, t) {
1475
1560
  return d && !n.has(d) && (d.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(d, {
1476
1561
  bubbles: !0,
1477
1562
  detail: { data: l }
1478
- })), j.log("Dispatching fallback payment action event.", {
1563
+ })), B.log("Dispatching fallback payment action event.", {
1479
1564
  eventName: d
1480
1565
  })), { hasPaymentFollowUpEvent: i };
1481
1566
  }
1482
- function Bn(e, t, r) {
1483
- if (j.log("Applying submit result state.", {
1567
+ function Xn(e, t, r) {
1568
+ if (B.log("Applying submit result state.", {
1484
1569
  ok: t.ok,
1485
1570
  action: r,
1486
1571
  code: t.code,
1487
1572
  hasRedirect: !!t.redirect?.url,
1488
1573
  hasSubmitData: Array.isArray(t.submitData) && t.submitData.length > 0
1489
- }), zn(t)) {
1490
- he(e), j.log("Resetting state due to stale/reset marker.");
1574
+ }), Zn(t)) {
1575
+ be(e), B.log("Resetting state due to stale/reset marker.");
1491
1576
  return;
1492
1577
  }
1493
- const n = jn(e, t);
1578
+ const n = Qn(e, t);
1494
1579
  if (!t.ok && t.redirect?.url && !n.hasPaymentFollowUpEvent) {
1495
- j.log("Applying redirect fallback for failed result.", {
1580
+ B.log("Applying redirect fallback for failed result.", {
1496
1581
  url: t.redirect.url,
1497
1582
  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);
1583
+ }), z(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (At(e, "redirect"), window.location.href = t.redirect.url);
1499
1584
  return;
1500
1585
  }
1501
- if (xn(e, t), !t.ok) {
1502
- j.log("Non-redirect failure; keeping current form state."), z(e);
1586
+ if (Gn(e, t), !t.ok) {
1587
+ B.log("Non-redirect failure; keeping current form state."), z(e);
1503
1588
  return;
1504
1589
  }
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.", {
1590
+ if (Kt(e, r), t.nextPage?.id) {
1591
+ z(e), e.formieValidation?.resetLiveState(), lt(e, t.nextPage.id), B.log("Advanced to next page.", {
1507
1592
  nextPageId: t.nextPage.id
1508
1593
  });
1509
1594
  return;
1510
1595
  }
1511
1596
  if (r === "save") {
1512
- z(e), Un(e, t), j.log("Applied save/resume token state.");
1597
+ z(e), Yn(e, t), B.log("Applied save/resume token state.");
1513
1598
  return;
1514
1599
  }
1515
1600
  if (r === "submit" && !t.redirect?.url) {
1516
- const i = Et(e), o = i === "message" && St(e);
1601
+ const i = wt(e), o = i === "message" && Tt(e);
1517
1602
  if (i === "reload") {
1518
- z(e), vt(e, "reload"), window.location.reload();
1603
+ z(e), At(e, "reload"), window.location.reload();
1519
1604
  return;
1520
1605
  }
1521
1606
  if (i === "reset") {
1522
- he(e);
1607
+ be(e);
1523
1608
  return;
1524
1609
  }
1525
- z(e), he(e, { preserveHiddenState: o });
1610
+ z(e), be(e, { preserveHiddenState: o });
1526
1611
  return;
1527
1612
  }
1528
1613
  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 });
1614
+ const o = wt(e) === "message" && Tt(e);
1615
+ z(e), be(e, { preserveHiddenState: o });
1531
1616
  return;
1532
1617
  }
1533
1618
  z(e);
1534
1619
  }
1535
1620
  const Ce = /* @__PURE__ */ new WeakMap();
1536
- function nr(e) {
1621
+ function lr(e) {
1537
1622
  return (e.dataset.formieSubmitAction || "").trim();
1538
1623
  }
1539
- function Wn(e) {
1624
+ function ei(e) {
1540
1625
  return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
1541
1626
  }
1542
- function ir(e) {
1627
+ function ur(e) {
1543
1628
  return (e.dataset.formieSubmitActionMessagePosition || "").trim();
1544
1629
  }
1545
- function Kn(e) {
1630
+ function ti(e) {
1546
1631
  const t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
1547
1632
  if (!t)
1548
1633
  return null;
1549
1634
  const r = Number.parseFloat(t);
1550
1635
  return !Number.isFinite(r) || r < 0 ? null : Math.round(r * 1e3);
1551
1636
  }
1552
- function at(e) {
1637
+ function ut(e) {
1553
1638
  const t = e.dataset.formieSubmitActionFormHide;
1554
1639
  if (t === void 0)
1555
1640
  return !1;
1556
1641
  const r = t.trim().toLowerCase();
1557
1642
  return r === "true" || r === "1" || r === "";
1558
1643
  }
1559
- function Gn(e) {
1644
+ function ri(e) {
1560
1645
  const t = Ce.get(e);
1561
1646
  typeof t == "number" && (window.clearTimeout(t), Ce.delete(e));
1562
1647
  }
1563
- function or(e) {
1648
+ function cr(e) {
1564
1649
  return e.querySelector("[data-formie-form-messages-top]") || e;
1565
1650
  }
1566
- function ar(e) {
1651
+ function dr(e) {
1567
1652
  return e.querySelector("[data-formie-form-messages-bottom]") || e;
1568
1653
  }
1569
- function Jn(e, t) {
1570
- return t === "bottom-form" ? ar(e) : or(e);
1654
+ function ni(e, t) {
1655
+ return t === "bottom-form" ? dr(e) : cr(e);
1571
1656
  }
1572
- function Yn(e, t) {
1573
- return t === "top-form" ? or(e) : t === "bottom-form" && !at(e) ? ar(e) : e;
1657
+ function ii(e, t) {
1658
+ return t === "top-form" ? cr(e) : t === "bottom-form" && !ut(e) ? dr(e) : e;
1574
1659
  }
1575
- function Zn(e) {
1576
- const t = Wn(e), r = Jn(e, t);
1660
+ function oi(e) {
1661
+ const t = ei(e), r = ni(e, t);
1577
1662
  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;
1663
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"), $(n, e, "errors")), n.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1579
1664
  }
1580
- function Qn(e, t) {
1665
+ function ai(e, t) {
1581
1666
  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;
1667
+ 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"), $(r, e, "message", "messageError"), r.setAttribute("role", "alert"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r;
1583
1668
  }
1584
- function Xn(e, t) {
1669
+ function si(e, t) {
1585
1670
  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;
1671
+ const n = ii(e, t);
1672
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"), $(r, e, "successes")), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1588
1673
  }
1589
- function ei(e) {
1674
+ function li(e) {
1590
1675
  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;
1676
+ return t || (t = document.createElement("div"), t.setAttribute("data-formie-field-errors", "true"), $(t, e, "fieldErrors"), e.appendChild(t)), t;
1592
1677
  }
1593
- function ti(e, t) {
1678
+ function ui(e, t) {
1594
1679
  const r = (e.getAttribute("aria-describedby") || "").trim();
1595
1680
  if (!r)
1596
1681
  return;
@@ -1601,26 +1686,26 @@ function ti(e, t) {
1601
1686
  }
1602
1687
  e.removeAttribute("aria-describedby");
1603
1688
  }
1604
- function ri(e, t) {
1689
+ function ci(e, t) {
1605
1690
  e.setAttribute("aria-errormessage", t);
1606
1691
  }
1607
- function ni(e, t) {
1692
+ function di(e, t) {
1608
1693
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
1609
1694
  }
1610
- function sr(e) {
1695
+ function fr(e) {
1611
1696
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
1612
1697
  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
1698
  le(r, e, "fieldLayoutError"), r.removeAttribute("data-formie-field-has-error"), r.querySelectorAll("[data-formie-field-error]").forEach((a) => {
1614
1699
  a.remove();
1615
1700
  }), n && !n.querySelector("[data-formie-field-error]") && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((a) => {
1616
1701
  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);
1702
+ s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i && ui(s, i), o.forEach((l) => {
1703
+ di(s, l);
1619
1704
  });
1620
1705
  });
1621
1706
  }), J(e);
1622
1707
  }
1623
- function lr(e) {
1708
+ function mr(e) {
1624
1709
  e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
1625
1710
  const r = t;
1626
1711
  r.querySelectorAll("[data-formie-error]").forEach((n) => {
@@ -1628,92 +1713,92 @@ function lr(e) {
1628
1713
  }), 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
1714
  });
1630
1715
  }
1631
- function st(e) {
1632
- Gn(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((t) => {
1716
+ function ct(e) {
1717
+ ri(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((t) => {
1633
1718
  t.remove();
1634
1719
  }), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
1635
1720
  const r = t;
1636
1721
  r.querySelectorAll("[data-formie-success]").forEach((n) => {
1637
1722
  n.remove();
1638
1723
  }), 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);
1724
+ }), lr(e) === "message" && ut(e) || st(e, !1);
1640
1725
  }
1641
- function ur(e) {
1726
+ function pr(e) {
1642
1727
  e.querySelectorAll('[aria-invalid="true"]').forEach((t) => {
1643
1728
  t.removeAttribute("aria-invalid");
1644
1729
  });
1645
1730
  }
1646
- function At(e, t) {
1731
+ function Mt(e, t) {
1647
1732
  const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
1648
1733
  n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
1649
1734
  }
1650
- function ii(e, t) {
1735
+ function fi(e, t) {
1651
1736
  Object.entries(t).forEach(([r, n]) => {
1652
1737
  const i = e.querySelector(`[data-formie-field-handle="${r}"]`);
1653
1738
  if (!i)
1654
1739
  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) => {
1740
+ const o = li(i), a = o.id && o.id.trim() ? o.id : `${r}-errors`;
1741
+ o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), $(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), n.forEach((l, d) => {
1657
1742
  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);
1743
+ p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`, $(p, e, "fieldError"), p.textContent = l, o.appendChild(p);
1659
1744
  });
1660
1745
  const s = o.querySelector("[data-formie-field-error]")?.id;
1661
1746
  i.querySelectorAll("input, select, textarea").forEach((l) => {
1662
1747
  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);
1748
+ d.setAttribute("aria-invalid", "true"), $(d, e, "fieldControlError"), d.setAttribute("data-formie-input-has-error", "true"), Mt(d, a), s && ci(d, s);
1664
1749
  const p = i.querySelector("[data-formie-instructions]");
1665
- p?.id && At(d, p.id);
1750
+ p?.id && Mt(d, p.id);
1666
1751
  });
1667
1752
  }), J(e);
1668
1753
  }
1669
- function wt(e, t) {
1670
- const r = Zn(e), n = Qn(e, r);
1671
- V(r, e, "errors"), t.forEach((i) => {
1754
+ function Ct(e, t) {
1755
+ const r = oi(e), n = ai(e, r);
1756
+ $(r, e, "errors"), t.forEach((i) => {
1672
1757
  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);
1758
+ o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"), $(o, e, "error"), o.innerHTML = i, n.appendChild(o);
1674
1759
  });
1675
1760
  }
1676
- function oi(e, t) {
1677
- return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : nr(e) === "message" && ir(e) !== "";
1761
+ function mi(e, t) {
1762
+ return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : lr(e) === "message" && ur(e) !== "";
1678
1763
  }
1679
- function ai(e, t) {
1680
- const r = ir(e);
1764
+ function pi(e, t) {
1765
+ const r = ur(e);
1681
1766
  if (!r)
1682
1767
  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");
1768
+ const n = si(e, r);
1769
+ $(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
1770
  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);
1771
+ i.setAttribute("data-formie-success", "true"), $(i, e, "success"), i.innerHTML = t, n.appendChild(i), ut(e) && st(e, !0);
1772
+ const o = ti(e);
1688
1773
  if (o !== null) {
1689
1774
  const a = window.setTimeout(() => {
1690
- Ce.delete(e), st(e);
1775
+ Ce.delete(e), ct(e);
1691
1776
  }, o);
1692
1777
  Ce.set(e, a);
1693
1778
  }
1694
1779
  }
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 || "");
1780
+ function Le(e, t) {
1781
+ if (fr(e), mr(e), ct(e), pr(e), t.ok) {
1782
+ mi(e, t) && pi(e, t.message || "");
1698
1783
  return;
1699
1784
  }
1700
- if (t.fieldErrors && ii(e, t.fieldErrors), t.formErrors?.length) {
1701
- wt(e, t.formErrors);
1785
+ if (t.fieldErrors && fi(e, t.fieldErrors), t.formErrors?.length) {
1786
+ Ct(e, t.formErrors);
1702
1787
  return;
1703
1788
  }
1704
- !t.fieldErrors && t.message && wt(e, [t.message]);
1789
+ !t.fieldErrors && t.message && Ct(e, [t.message]);
1705
1790
  }
1706
- const si = _("general", "submit-flow");
1707
- function li(e) {
1791
+ const gi = _("general", "submit-flow");
1792
+ function hi(e) {
1708
1793
  return !(!e.ok && e.stage === "validate");
1709
1794
  }
1710
- function cr(e) {
1795
+ function gr(e) {
1711
1796
  return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
1712
1797
  }
1713
- function dr(e) {
1714
- sr(e), lr(e), st(e), ur(e);
1798
+ function hr(e) {
1799
+ fr(e), mr(e), ct(e), pr(e);
1715
1800
  }
1716
- async function fr(e) {
1801
+ async function br(e) {
1717
1802
  const {
1718
1803
  id: t,
1719
1804
  target: r,
@@ -1725,38 +1810,38 @@ async function fr(e) {
1725
1810
  submitter: l,
1726
1811
  waitForSubmitDelay: d,
1727
1812
  onRefreshTokensAfterSubmit: p,
1728
- dispatchSubmitResult: y
1813
+ dispatchSubmitResult: h
1729
1814
  } = e;
1730
- dr(n), rr(n, l || null);
1731
- let c = {
1815
+ hr(n), sr(n, l || null);
1816
+ let u = {
1732
1817
  ok: !1,
1733
1818
  code: "SUBMIT_ERROR",
1734
1819
  message: "Submission failed.",
1735
1820
  formErrors: ["Submission failed."]
1736
1821
  };
1737
1822
  try {
1738
- await d(n), c = await Zt(n, s, i, {
1823
+ await d(n), u = await tr(n, s, i, {
1739
1824
  validator: o,
1740
1825
  validateOnSubmit: a
1741
- }), Me(n, c), Bn(n, c, s), li(c) && await p(c), y(c);
1742
- } catch (u) {
1743
- c = {
1826
+ }), Le(n, u), Xn(n, u, s), hi(u) && await p(u), h(u);
1827
+ } catch (c) {
1828
+ u = {
1744
1829
  ok: !1,
1745
1830
  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.", {
1831
+ message: c instanceof Error ? c.message : "Submission failed.",
1832
+ formErrors: [c instanceof Error ? c.message : "Submission failed."]
1833
+ }, Le(n, u), h(u), gi.warn("Submit failed with exception.", {
1749
1834
  id: t,
1750
1835
  action: s,
1751
1836
  target: r,
1752
- error: u instanceof Error ? u.message : u
1837
+ error: c instanceof Error ? c.message : c
1753
1838
  });
1754
1839
  } finally {
1755
- cr(c) || Te(n);
1840
+ gr(u) || Me(n);
1756
1841
  }
1757
- return c;
1842
+ return u;
1758
1843
  }
1759
- class mr {
1844
+ class yr {
1760
1845
  constructor() {
1761
1846
  this.modules = /* @__PURE__ */ new Map();
1762
1847
  }
@@ -1776,127 +1861,127 @@ class mr {
1776
1861
  return Array.from(this.modules.values());
1777
1862
  }
1778
1863
  }
1779
- const ui = {
1864
+ const bi = {
1780
1865
  // Address providers stay behind lazy importer entries because their SDKs are
1781
1866
  // 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 = {
1867
+ "address-finder": () => import("./address-finder-BjMuEiwF.js").then((e) => e.addressFinderModule),
1868
+ "google-address": () => import("./google-address-Bmjp01pH.js").then((e) => e.googleAddressModule),
1869
+ loqate: () => import("./loqate-BdNGv93o.js").then((e) => e.loqateModule),
1870
+ "place-kit": () => import("./place-kit-CX7tamAg.js").then((e) => e.placeKitModule)
1871
+ }, yi = {
1787
1872
  // Module ids map directly to importer functions so the loader can fetch only
1788
1873
  // 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 = {
1874
+ "captcha-eu": () => import("./captcha-eu-CterYFok.js").then((e) => e.captchaEuModule),
1875
+ "friendly-captcha-v1": () => import("./friendly-captcha-v1-EDFac33c.js").then((e) => e.friendlyCaptchaV1Module),
1876
+ "friendly-captcha-v2": () => import("./friendly-captcha-v2-BDpSvFGR.js").then((e) => e.friendlyCaptchaV2Module),
1877
+ hcaptcha: () => import("./hcaptcha-BTQ6An6g.js").then((e) => e.hcaptchaModule),
1878
+ "recaptcha-enterprise": () => import("./recaptcha-enterprise-DxF6cW95.js").then((e) => e.recaptchaEnterpriseModule),
1879
+ "recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-R9EfbZ4k.js").then((e) => e.recaptchaV2CheckboxModule),
1880
+ "recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-DV9hswAp.js").then((e) => e.recaptchaV2InvisibleModule),
1881
+ "recaptcha-v3": () => import("./recaptcha-v3-V0xc-Edh.js").then((e) => e.recaptchaV3Module),
1882
+ snaptcha: () => import("./snaptcha-DV7p6J9k.js").then((e) => e.snaptchaModule),
1883
+ turnstile: () => import("./turnstile-CId90tRr.js").then((e) => e.turnstileModule)
1884
+ }, vi = {
1800
1885
  // Keep the builtin map flat and explicit so manifest ids remain the source of
1801
1886
  // 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 = {
1887
+ calculations: () => import("./calculations-DlGSkQ3W.js").then((e) => e.calculationsModule),
1888
+ "checkbox-radio": () => import("./checkbox-radio-CBvgk3hR.js").then((e) => e.checkboxRadioModule),
1889
+ conditions: () => import("./conditions-DYy1-Hwt.js").then((e) => e.conditionsModule),
1890
+ "date-picker": () => import("./date-picker-BlD--zfe.js").then((e) => e.datePickerModule),
1891
+ "file-upload": () => import("./file-upload-CIgHrXfp.js").then((e) => e.fileUploadModule),
1892
+ hidden: () => import("./hidden-DbPdOxKb.js").then((e) => e.hiddenModule),
1893
+ "phone-country": () => import("./phone-country-DPMiqk4L.js").then((e) => e.phoneCountryModule),
1894
+ repeater: () => import("./repeater-DKUT6TGI.js").then((e) => e.repeaterModule),
1895
+ "rich-text": () => import("./rich-text-SH7KiaKH.js").then((e) => e.richTextModule),
1896
+ signature: () => import("./signature-BA3tQsGT.js").then((e) => e.signatureModule),
1897
+ summary: () => import("./summary-Dq2i9TQk.js").then((e) => e.summaryModule),
1898
+ table: () => import("./table-Cu4WfVcw.js").then((e) => e.tableModule),
1899
+ "text-limit": () => import("./text-limit-2ycmB-Ae.js").then((e) => e.textLimitModule)
1900
+ }, Ei = {
1816
1901
  // Keep payment providers lazy and separately addressable so forms only ship
1817
1902
  // 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) {
1903
+ bpoint: () => import("./bpoint-KudsBCo2.js").then((e) => e.bpointModule),
1904
+ eway: () => import("./eway-qwc-B5Us.js").then((e) => e.ewayModule),
1905
+ "go-cardless": () => import("./go-cardless-DuDMVsnz.js").then((e) => e.goCardlessModule),
1906
+ mollie: () => import("./mollie-DFOjTuGX.js").then((e) => e.mollieModule),
1907
+ moneris: () => import("./moneris-BbFfl-EL.js").then((e) => e.monerisModule),
1908
+ opayo: () => import("./opayo-CmgYa9ya.js").then((e) => e.opayoModule),
1909
+ paddle: () => import("./paddle-BUi7w1_o.js").then((e) => e.paddleModule),
1910
+ paypal: () => import("./paypal-A-ePfh6k.js").then((e) => e.paypalModule),
1911
+ payway: () => import("./payway-BqFCbhyo.js").then((e) => e.paywayModule),
1912
+ square: () => import("./square-Bs-ndqYK.js").then((e) => e.squareModule),
1913
+ stripe: () => import("./stripe-DkZAHxtn.js").then((e) => e.stripeModule)
1914
+ }, Si = {
1915
+ ...vi,
1916
+ ...bi,
1917
+ ...yi,
1918
+ ...Ei
1919
+ }, _e = /* @__PURE__ */ new Map(), D = _("general", "loader"), Ai = new Function("src", "return import(src);");
1920
+ async function ye(e, t, r, n) {
1921
+ await e(Ur(r), n), await e(Nr(t, r), n);
1922
+ }
1923
+ function vr(e) {
1839
1924
  return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
1840
1925
  }
1841
- async function gi(e, t) {
1842
- const r = mi[e];
1843
- return r ? (Oe.has(e) || Oe.set(e, (async () => {
1926
+ async function wi(e, t) {
1927
+ const r = Si[e];
1928
+ return r ? (_e.has(e) || _e.set(e, (async () => {
1844
1929
  try {
1845
1930
  const n = await r();
1846
- return pr(n) ? (t.registry.register(n), n) : null;
1931
+ return vr(n) ? (t.registry.register(n), n) : null;
1847
1932
  } catch (n) {
1848
1933
  return console.error("[formie] Failed to load builtin module:", e, n), D.warn("Failed loading builtin module.", { moduleId: e, error: n }), null;
1849
1934
  }
1850
- })()), Oe.get(e) || null) : null;
1935
+ })()), _e.get(e) || null) : null;
1851
1936
  }
1852
- async function hi(e) {
1937
+ async function Ti(e) {
1853
1938
  try {
1854
- const t = await pi(e), r = t?.default || t?.formieModule || null;
1855
- return pr(r) ? r : null;
1939
+ const t = await Ai(e), r = t?.default || t?.formieModule || null;
1940
+ return vr(r) ? r : null;
1856
1941
  } catch (t) {
1857
1942
  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
1943
  }
1859
1944
  }
1860
- async function bi(e, t) {
1945
+ async function Mi(e, t) {
1861
1946
  const r = t.registry.get(e.id);
1862
1947
  if (r)
1863
1948
  return r;
1864
- const n = await gi(e.id, t);
1949
+ const n = await wi(e.id, t);
1865
1950
  if (n)
1866
1951
  return n;
1867
1952
  if (e.src) {
1868
- const i = await hi(e.src);
1953
+ const i = await Ti(e.src);
1869
1954
  if (i)
1870
1955
  return t.registry.register(i), i;
1871
1956
  }
1872
1957
  return null;
1873
1958
  }
1874
- function He(e) {
1959
+ function De(e) {
1875
1960
  return typeof window.CSS?.escape == "function" ? window.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
1876
1961
  }
1877
- function ye(e, t) {
1962
+ function ve(e, t) {
1878
1963
  return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
1879
1964
  }
1880
- function yi(e, t) {
1965
+ function Ci(e, t) {
1881
1966
  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 })) : [{
1967
+ 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
1968
  scope: "form",
1884
1969
  element: n || r
1885
1970
  }];
1886
1971
  }
1887
- function vi(e, t) {
1972
+ function Li(e, t) {
1888
1973
  return (e.targets && e.targets.length > 0 ? e.targets : [{
1889
1974
  targetType: "form",
1890
1975
  targetId: "form"
1891
- }]).flatMap((n) => yi(n, t));
1976
+ }]).flatMap((n) => Ci(n, t));
1892
1977
  }
1893
- async function gr(e, t) {
1978
+ async function Er(e, t) {
1894
1979
  const r = [];
1895
1980
  D.log("Loading module manifest.", {
1896
1981
  manifestCount: e.length
1897
1982
  });
1898
1983
  for (const n of e) {
1899
- const i = await bi(n, t);
1984
+ const i = await Mi(n, t);
1900
1985
  if (!i) {
1901
1986
  D.warn("Skipping manifest item (definition not resolved).", {
1902
1987
  moduleId: n.id,
@@ -1904,7 +1989,7 @@ async function gr(e, t) {
1904
1989
  });
1905
1990
  continue;
1906
1991
  }
1907
- const o = vi(n, t);
1992
+ const o = Li(n, t);
1908
1993
  D.log("Resolved module targets.", {
1909
1994
  moduleId: i.id,
1910
1995
  targets: n.targets || [],
@@ -1936,36 +2021,36 @@ async function gr(e, t) {
1936
2021
  options: l,
1937
2022
  manifestItem: n
1938
2023
  };
1939
- await be(t.setupContext.emit, d, "before-setup", p);
1940
- let y = null;
2024
+ await ye(t.setupContext.emit, d, "before-setup", p);
2025
+ let h = null;
1941
2026
  try {
1942
- const c = await i.setup({
2027
+ const u = await i.setup({
1943
2028
  ...t.setupContext,
1944
2029
  target: a.element,
1945
2030
  scope: a.scope,
1946
2031
  options: l
1947
2032
  });
1948
- c && (y = c);
1949
- } catch (c) {
1950
- console.error(`[formie] Module "${i.id}" setup failed:`, c), D.warn("Module setup failed.", {
2033
+ u && (h = u);
2034
+ } catch (u) {
2035
+ console.error(`[formie] Module "${i.id}" setup failed:`, u), D.warn("Module setup failed.", {
1951
2036
  moduleId: i.id,
1952
2037
  scope: a.scope,
1953
- error: c
2038
+ error: u
1954
2039
  });
1955
2040
  }
1956
- await be(t.setupContext.emit, d, "after-setup", {
2041
+ await ye(t.setupContext.emit, d, "after-setup", {
1957
2042
  ...p,
1958
- instanceCreated: !!y
1959
- }), y && (D.log("Module instance created.", {
2043
+ instanceCreated: !!h
2044
+ }), h && (D.log("Module instance created.", {
1960
2045
  moduleId: i.id,
1961
2046
  scope: a.scope
1962
2047
  }), r.push({
1963
- ...y,
2048
+ ...h,
1964
2049
  destroy: async () => {
1965
2050
  D.log("Destroying module instance.", {
1966
2051
  moduleId: i.id,
1967
2052
  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.", {
2053
+ }), 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
2054
  moduleId: i.id,
1970
2055
  scope: a.scope
1971
2056
  });
@@ -1977,7 +2062,7 @@ async function gr(e, t) {
1977
2062
  instanceCount: r.length
1978
2063
  }), r;
1979
2064
  }
1980
- const Ei = /* @__PURE__ */ new Set([
2065
+ const Ii = /* @__PURE__ */ new Set([
1981
2066
  "CRAFT_CSRF_TOKEN",
1982
2067
  "action",
1983
2068
  "redirect",
@@ -1989,7 +2074,7 @@ const Ei = /* @__PURE__ */ new Set([
1989
2074
  "draftContext",
1990
2075
  "continuationToken"
1991
2076
  ]);
1992
- function Be(e, t) {
2077
+ function Ke(e, t) {
1993
2078
  if (e == null)
1994
2079
  return String(e);
1995
2080
  if (typeof e == "string")
@@ -2003,65 +2088,65 @@ function Be(e, t) {
2003
2088
  if (typeof Blob < "u" && e instanceof Blob)
2004
2089
  return `[blob:${e.size}:${e.type}]`;
2005
2090
  if (Array.isArray(e))
2006
- return `[${e.map((r) => Be(r, t)).join(",")}]`;
2091
+ return `[${e.map((r) => Ke(r, t)).join(",")}]`;
2007
2092
  if (typeof e == "object") {
2008
2093
  if (t.has(e))
2009
2094
  return "[circular]";
2010
2095
  t.add(e);
2011
- const r = Object.entries(e).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${Be(i, t)}`);
2096
+ const r = Object.entries(e).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${Ke(i, t)}`);
2012
2097
  return t.delete(e), `{${r.join(",")}}`;
2013
2098
  }
2014
2099
  return JSON.stringify(String(e));
2015
2100
  }
2016
- function Si(e) {
2017
- return Be(e, /* @__PURE__ */ new WeakSet());
2101
+ function Fi(e) {
2102
+ return Ke(e, /* @__PURE__ */ new WeakSet());
2018
2103
  }
2019
- function Ai(e) {
2104
+ function Ri(e) {
2020
2105
  if (!e)
2021
2106
  return !1;
2022
2107
  const t = e.endsWith("[]") ? e.slice(0, -2) : e;
2023
- return !Ei.has(t);
2108
+ return !Ii.has(t);
2024
2109
  }
2025
- function Tt(e) {
2026
- const t = Array.from(new FormData(e).entries()).filter(([r]) => Ai(String(r || "")));
2027
- return Si(t);
2110
+ function Lt(e) {
2111
+ const t = Array.from(new FormData(e).entries()).filter(([r]) => Ri(String(r || "")));
2112
+ return Fi(t);
2028
2113
  }
2029
- function wi(e, t = {}) {
2114
+ function ki(e, t = {}) {
2030
2115
  let r = null, n = !1, i = !1, o = null, a = null, s = null;
2031
2116
  const l = () => {
2032
2117
  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 = () => {
2118
+ }, d = () => n ? (i = Lt(e) !== r, i) : !1, p = () => {
2119
+ r = Lt(e), n = !0, i = !1;
2120
+ }, h = () => {
2036
2121
  l(), n = !1, o = window.requestAnimationFrame(() => {
2037
2122
  o = null, s = window.setTimeout(() => {
2038
2123
  s = null, p();
2039
2124
  }, 0);
2040
2125
  });
2041
- }, c = () => {
2126
+ }, u = () => {
2042
2127
  a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
2043
2128
  a = null, d();
2044
2129
  }, 120);
2045
- }, u = (h) => {
2046
- t.shouldWarn && !t.shouldWarn() || d() && (h.preventDefault(), h.returnValue = "");
2130
+ }, c = (b) => {
2131
+ t.shouldWarn && !t.shouldWarn() || d() && (b.preventDefault(), b.returnValue = "");
2047
2132
  };
2048
- return e.addEventListener("input", c), e.addEventListener("change", c), window.addEventListener("beforeunload", u), y(), {
2133
+ return e.addEventListener("input", u), e.addEventListener("change", u), window.addEventListener("beforeunload", c), h(), {
2049
2134
  captureBaseline: p,
2050
- scheduleBaselineCapture: y,
2135
+ scheduleBaselineCapture: h,
2051
2136
  refreshDirtyState: d,
2052
2137
  destroy: () => {
2053
- l(), e.removeEventListener("input", c), e.removeEventListener("change", c), window.removeEventListener("beforeunload", u);
2138
+ l(), e.removeEventListener("input", u), e.removeEventListener("change", u), window.removeEventListener("beforeunload", c);
2054
2139
  }
2055
2140
  };
2056
2141
  }
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();
2142
+ const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])', qi = 300, Pi = "/actions/formie/server/forms/render", It = "/api", Vi = "/actions/formie/server/forms/refresh-tokens", $i = "/actions/formie/server/submissions/submit", Hi = "/actions/formie/server/submissions/set-page", Oi = "/actions/formie/server/submissions/clear-submission", _i = "/actions/formie/file-upload/hydrate", L = _("general", "client"), Ft = /* @__PURE__ */ new Set();
2058
2143
  function ce(e, t) {
2059
2144
  if (e == null || e === "")
2060
2145
  return t;
2061
2146
  const r = e.toLowerCase();
2062
2147
  return !(r === "false" || r === "0" || r === "off");
2063
2148
  }
2064
- function We(e) {
2149
+ function Ge(e) {
2065
2150
  return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? ce(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? ce(e.formieStaticCache, !1) : !1;
2066
2151
  }
2067
2152
  function ee(e) {
@@ -2071,24 +2156,24 @@ function ee(e) {
2071
2156
  transport: t.formieTransport || "rest",
2072
2157
  formHandle: t.formieHandle,
2073
2158
  endpoint: t.formieEndpoint,
2074
- staticCache: We(t),
2159
+ staticCache: Ge(t),
2075
2160
  autoVisible: ce(t.formieAutoVisible, !0),
2076
2161
  compatibility: ce(t.formieCompatibility, !1)
2077
2162
  };
2078
2163
  }
2079
- function Fe(e) {
2164
+ function Re(e) {
2080
2165
  return e || "server-rendered";
2081
2166
  }
2082
- function Re(e) {
2167
+ function ke(e) {
2083
2168
  return e || "rest";
2084
2169
  }
2085
- function Ee(e) {
2170
+ function Se(e) {
2086
2171
  return e instanceof HTMLFormElement ? e : e.querySelector("form");
2087
2172
  }
2088
- function ki(e, t) {
2089
- Mt.has(e) || (Mt.add(e), L.warn(t));
2173
+ function Di(e, t) {
2174
+ Ft.has(e) || (Ft.add(e), L.warn(t));
2090
2175
  }
2091
- function hr(e, t) {
2176
+ function Sr(e, t) {
2092
2177
  if (!e)
2093
2178
  return e;
2094
2179
  try {
@@ -2105,22 +2190,22 @@ function hr(e, t) {
2105
2190
  }
2106
2191
  function re(e, t) {
2107
2192
  const r = (e || "").trim();
2108
- return r ? r.includes("/actions/") ? r : hr(t, r) : t;
2193
+ return r ? r.includes("/actions/") ? r : Sr(t, r) : t;
2109
2194
  }
2110
- function qi(e, t) {
2111
- return re(e.endpoint || t.dataset.formieEndpoint, Ci);
2195
+ function xi(e, t) {
2196
+ return re(e.endpoint || t.dataset.formieEndpoint, Pi);
2112
2197
  }
2113
- function Pi(e, t) {
2198
+ function Ni(e, t) {
2114
2199
  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;
2200
+ return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r : Sr(It, r) : It;
2116
2201
  }
2117
- function lt(e, t) {
2202
+ function dt(e, t) {
2118
2203
  return re(
2119
2204
  t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint,
2120
- Mi
2205
+ Vi
2121
2206
  );
2122
2207
  }
2123
- function Lt(e, t) {
2208
+ function Rt(e, t) {
2124
2209
  if (!e)
2125
2210
  return t;
2126
2211
  try {
@@ -2132,50 +2217,50 @@ function Lt(e, t) {
2132
2217
  return t;
2133
2218
  }
2134
2219
  }
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));
2220
+ function Ui(e, t, r) {
2221
+ const n = r.endpoint || e.dataset.formieEndpoint, i = re(n, $i), o = t.getAttribute("action");
2222
+ t.setAttribute("action", Rt(o, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((a) => {
2223
+ const s = a.getAttribute("href"), l = re(n, Hi);
2224
+ a.setAttribute("href", Rt(s, l));
2140
2225
  }), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((a) => {
2141
2226
  a.setAttribute(
2142
2227
  "data-formie-file-upload-hydrate-endpoint",
2143
- re(n, Ri)
2228
+ re(n, _i)
2144
2229
  );
2145
2230
  });
2146
2231
  }
2147
- function ut(e, t) {
2232
+ function ft(e, t) {
2148
2233
  if (e === "graphql" && t !== "server-rendered")
2149
2234
  throw new Error(`Formie ${t} mode does not support GraphQL transport yet.`);
2150
2235
  }
2151
- function ct(e) {
2236
+ function mt(e) {
2152
2237
  if (e == null)
2153
2238
  return !1;
2154
2239
  const t = e.trim().toLowerCase();
2155
2240
  return t === "true" || t === "1" || t === "";
2156
2241
  }
2157
- function Vi(e) {
2242
+ function zi(e) {
2158
2243
  return ce(e.dataset.formieAutomaticSubmissionState, !0);
2159
2244
  }
2160
- function Oi(e, t, r) {
2245
+ function Bi(e, t, r) {
2161
2246
  return re(
2162
2247
  r.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint,
2163
- Fi
2248
+ Oi
2164
2249
  );
2165
2250
  }
2166
- function Hi(e) {
2167
- return ct(e.dataset.formieUnloadWarning);
2251
+ function ji(e) {
2252
+ return mt(e.dataset.formieUnloadWarning);
2168
2253
  }
2169
- function It(e, t) {
2254
+ function kt(e, t) {
2170
2255
  e.setAttribute("data-formie-internal-navigation", t);
2171
2256
  }
2172
- function _e(e) {
2257
+ function xe(e) {
2173
2258
  e.removeAttribute("data-formie-internal-navigation");
2174
2259
  }
2175
- function Ft(e) {
2260
+ function qt(e) {
2176
2261
  return e.getAttribute("data-formie-internal-navigation") !== null;
2177
2262
  }
2178
- function Rt(e, t) {
2263
+ function Pt(e, t) {
2179
2264
  if (!e)
2180
2265
  return !1;
2181
2266
  try {
@@ -2184,31 +2269,31 @@ function Rt(e, t) {
2184
2269
  return !1;
2185
2270
  }
2186
2271
  }
2187
- function _i(e) {
2188
- return Rt(window.location.href, "resumeToken") || Rt(e.getAttribute("action"), "resumeToken");
2272
+ function Wi(e) {
2273
+ return Pt(window.location.href, "resumeToken") || Pt(e.getAttribute("action"), "resumeToken");
2189
2274
  }
2190
- function Di(e) {
2275
+ function Ki(e) {
2191
2276
  return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
2192
2277
  }
2193
- function xi(e, t = 0) {
2278
+ function Gi(e, t = 0) {
2194
2279
  if (!e)
2195
2280
  return t;
2196
2281
  const r = Number.parseInt(e, 10);
2197
2282
  return Number.isFinite(r) ? r : t;
2198
2283
  }
2199
- function Ni(e) {
2200
- return Math.max(0, xi(e.dataset.formieSubmitDelay, Ti));
2284
+ function Ji(e) {
2285
+ return Math.max(0, Gi(e.dataset.formieSubmitDelay, qi));
2201
2286
  }
2202
- function Ke(e) {
2203
- return ct(e.dataset.formieValidationOnSubmit);
2287
+ function Je(e) {
2288
+ return mt(e.dataset.formieValidationOnSubmit);
2204
2289
  }
2205
- async function Ge(e) {
2206
- const t = Ni(e);
2290
+ async function Ye(e) {
2291
+ const t = Ji(e);
2207
2292
  t < 1 || await new Promise((r) => {
2208
2293
  window.setTimeout(r, t);
2209
2294
  });
2210
2295
  }
2211
- function kt(e, t) {
2296
+ function Vt(e, t) {
2212
2297
  const r = e?.getAttribute(t)?.trim();
2213
2298
  if (!r)
2214
2299
  return null;
@@ -2218,17 +2303,17 @@ function kt(e, t) {
2218
2303
  return console.error(`[formie] Failed to parse ${t}.`, n), null;
2219
2304
  }
2220
2305
  }
2221
- function qt(e, t) {
2306
+ function $t(e, t) {
2222
2307
  const r = t || (e instanceof HTMLFormElement ? e : null);
2223
2308
  if (!r)
2224
2309
  return null;
2225
- const n = kt(r, "data-formie-modules"), i = kt(r, "data-formie-theme");
2310
+ const n = Vt(r, "data-formie-modules"), i = Vt(r, "data-formie-theme");
2226
2311
  return !n && !i ? null : {
2227
2312
  modules: n || void 0,
2228
2313
  theme: i || void 0
2229
2314
  };
2230
2315
  }
2231
- function Ui(e) {
2316
+ function Yi(e) {
2232
2317
  if (!(e instanceof HTMLElement))
2233
2318
  return !0;
2234
2319
  if (!e.isConnected || e.hidden || e.closest("[hidden]"))
@@ -2236,14 +2321,14 @@ function Ui(e) {
2236
2321
  const t = window.getComputedStyle(e);
2237
2322
  return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
2238
2323
  }
2239
- function zi(e, t) {
2324
+ function Zi(e, t) {
2240
2325
  return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
2241
2326
  }
2242
- function P(e) {
2327
+ function V(e) {
2243
2328
  const t = e, r = t.id ? `#${t.id}` : "", n = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
2244
2329
  return `${t.tagName ? t.tagName.toLowerCase() : "element"}${r}${n}`;
2245
2330
  }
2246
- function dt(e, t) {
2331
+ function pt(e, t) {
2247
2332
  if (t) {
2248
2333
  if (t.csrf?.param && t.csrf?.token) {
2249
2334
  const r = e.querySelector(`input[name="${t.csrf.param}"]`);
@@ -2268,14 +2353,14 @@ function dt(e, t) {
2268
2353
  });
2269
2354
  }
2270
2355
  }
2271
- async function ji(e, t) {
2272
- const r = Fe(t.mode), n = Re(t.transport);
2356
+ async function Qi(e, t) {
2357
+ const r = Re(t.mode), n = ke(t.transport);
2273
2358
  if (r !== "server-rendered")
2274
2359
  return null;
2275
2360
  if (t.payload)
2276
2361
  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;
2362
+ ft(n, r);
2363
+ const i = !!Se(e), o = t.formHandle || e.dataset.formieHandle;
2279
2364
  if (i || !o)
2280
2365
  return null;
2281
2366
  const a = {
@@ -2285,138 +2370,138 @@ async function ji(e, t) {
2285
2370
  siteId: t.siteId,
2286
2371
  theme: t.theme,
2287
2372
  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, {
2373
+ }, s = n === "graphql" ? Ni(t, e) : xi(t, e), l = n === "graphql" ? await dn(s, o, a) : await cn(s, o, {
2289
2374
  ...a,
2290
2375
  endpoint: s
2291
2376
  });
2292
2377
  return l?.html && (e.innerHTML = l.html), l;
2293
2378
  }
2294
- async function br(e, t, r) {
2379
+ async function Ar(e, t, r) {
2295
2380
  if (t.refreshTokens === !1)
2296
2381
  return;
2297
- ut(Re(t.transport), Fe(t.mode));
2382
+ ft(ke(t.transport), Re(t.mode));
2298
2383
  const n = t.formHandle || e.dataset.formieHandle;
2299
2384
  if (!n)
2300
2385
  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);
2386
+ const i = dt(t, e), a = r.querySelector('input[name="renderId"]')?.value || void 0, s = await nt(i, n, a);
2387
+ pt(r, s), I(e, "formie:refresh-tokens:refreshed", s);
2303
2388
  }
2304
- function Bi(e, t, r, n, i, o) {
2389
+ function Xi(e, t, r, n, i, o) {
2305
2390
  const a = String(
2306
2391
  t.dataset.formieSubmitMethod || ""
2307
- ).trim().toLowerCase(), s = Oi(r, e, t);
2392
+ ).trim().toLowerCase(), s = Bi(r, e, t);
2308
2393
  let l = !1;
2309
- const d = t.querySelectorAll("[data-formie-action]"), p = (u) => {
2310
- if (u) {
2311
- t.setAttribute("data-formie-pending-action", u);
2394
+ const d = t.querySelectorAll("[data-formie-action]"), p = (c) => {
2395
+ if (c) {
2396
+ t.setAttribute("data-formie-pending-action", c);
2312
2397
  return;
2313
2398
  }
2314
2399
  t.removeAttribute("data-formie-pending-action");
2315
2400
  };
2316
- if (Hi(t)) {
2317
- const u = wi(t, {
2318
- shouldWarn: () => !Ft(t)
2319
- }), h = (f) => {
2401
+ if (ji(t)) {
2402
+ const c = ki(t, {
2403
+ shouldWarn: () => !qt(t)
2404
+ }), b = (f) => {
2320
2405
  if (!(f instanceof CustomEvent))
2321
2406
  return;
2322
2407
  const v = f.detail;
2323
- v?.ok && v.action === "save" && u.scheduleBaselineCapture();
2408
+ v?.ok && v.action === "save" && c.scheduleBaselineCapture();
2324
2409
  }, A = () => {
2325
- u.scheduleBaselineCapture();
2410
+ c.scheduleBaselineCapture();
2326
2411
  };
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();
2412
+ e.addEventListener("formie:submit:result", b), t.addEventListener("formie:state:reset", A), o.push(() => {
2413
+ e.removeEventListener("formie:submit:result", b), t.removeEventListener("formie:state:reset", A), c.destroy();
2329
2414
  });
2330
2415
  }
2331
- if (d.forEach((u) => {
2332
- const h = (A) => {
2416
+ if (d.forEach((c) => {
2417
+ const b = (A) => {
2333
2418
  const f = A.currentTarget.getAttribute("data-formie-action"), v = t.querySelector('input[name="submitAction"]');
2334
2419
  p(f), f && v && (v.value = f);
2335
2420
  };
2336
- u.addEventListener("click", h), o.push(() => {
2337
- u.removeEventListener("click", h);
2421
+ c.addEventListener("click", b), o.push(() => {
2422
+ c.removeEventListener("click", b);
2338
2423
  });
2339
- }), t.querySelectorAll("[data-formie-tab-link]").forEach((u) => {
2340
- const h = async (A) => {
2424
+ }), t.querySelectorAll("[data-formie-tab-link]").forEach((c) => {
2425
+ const b = async (A) => {
2341
2426
  if (a !== "ajax") {
2342
- Di(A) && It(t, "set-page");
2427
+ Ki(A) && kt(t, "set-page");
2343
2428
  return;
2344
2429
  }
2345
2430
  A.preventDefault();
2346
2431
  const f = A.currentTarget, v = f?.getAttribute("data-formie-page-id"), E = f?.getAttribute("href");
2347
2432
  if (!(!v || !E)) {
2348
- ot(t, v), I(e, "formie:page:navigate", {
2433
+ lt(t, v), I(e, "formie:page:navigate", {
2349
2434
  pageId: v,
2350
2435
  href: E
2351
2436
  });
2352
2437
  try {
2353
- const b = await sn(E, t, v);
2438
+ const y = await fn(E, t, v);
2354
2439
  I(e, "formie:page:navigate:after", {
2355
2440
  pageId: v,
2356
2441
  href: E,
2357
- response: b
2442
+ response: y
2358
2443
  });
2359
- } catch (b) {
2360
- console.error("[formie] Failed to persist page navigation state.", b), I(e, "formie:page:navigate:error", {
2444
+ } catch (y) {
2445
+ console.error("[formie] Failed to persist page navigation state.", y), I(e, "formie:page:navigate:error", {
2361
2446
  pageId: v,
2362
2447
  href: E,
2363
- error: b
2448
+ error: y
2364
2449
  });
2365
2450
  }
2366
2451
  }
2367
2452
  };
2368
- u.addEventListener("click", h), o.push(() => {
2369
- u.removeEventListener("click", h);
2453
+ c.addEventListener("click", b), o.push(() => {
2454
+ c.removeEventListener("click", b);
2370
2455
  });
2371
- }), !Vi(t)) {
2372
- let u = !1;
2373
- const h = () => {
2374
- u || Ft(t) || _i(t) || (u = !0, ln(s, t));
2456
+ }), !zi(t)) {
2457
+ let c = !1;
2458
+ const b = () => {
2459
+ c || qt(t) || Wi(t) || (c = !0, mn(s, t));
2375
2460
  };
2376
- window.addEventListener("pagehide", h), window.addEventListener("beforeunload", h), o.push(() => {
2377
- window.removeEventListener("pagehide", h), window.removeEventListener("beforeunload", h);
2461
+ window.addEventListener("pagehide", b), window.addEventListener("beforeunload", b), o.push(() => {
2462
+ window.removeEventListener("pagehide", b), window.removeEventListener("beforeunload", b);
2378
2463
  });
2379
2464
  }
2380
- const c = async (u) => {
2465
+ const u = async (c) => {
2381
2466
  if (l)
2382
2467
  return;
2383
- const h = a === "ajax";
2384
- if (u.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
2468
+ const b = a === "ajax";
2469
+ if (c.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
2385
2470
  if (!(t.getAttribute("data-formie-internal-resubmit") === "true"))
2386
2471
  return;
2387
2472
  t.removeAttribute("data-formie-internal-resubmit");
2388
2473
  } else
2389
2474
  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";
2475
+ 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
2476
  let g = null, S = !1;
2392
2477
  try {
2393
- if (h)
2394
- g = await fr({
2478
+ if (b)
2479
+ g = await br({
2395
2480
  target: e,
2396
2481
  form: t,
2397
2482
  bus: n,
2398
2483
  validator: i,
2399
- validateOnSubmit: Ke(t),
2484
+ validateOnSubmit: Je(t),
2400
2485
  action: m,
2401
2486
  submitter: f,
2402
- waitForSubmitDelay: Ge,
2487
+ waitForSubmitDelay: Ye,
2403
2488
  onRefreshTokensAfterSubmit: async () => {
2404
- await br(e, r, t);
2489
+ await Ar(e, r, t);
2405
2490
  },
2406
- dispatchSubmitResult: (C) => {
2407
- I(e, "formie:submit:result", C);
2491
+ dispatchSubmitResult: (M) => {
2492
+ I(e, "formie:submit:result", M);
2408
2493
  }
2409
2494
  });
2410
2495
  else {
2411
- if (dr(t), rr(t, f), await Ge(t), g = await Zt(t, m, n, {
2496
+ if (hr(t), sr(t, f), await Ye(t), g = await tr(t, m, n, {
2412
2497
  validator: i,
2413
- validateOnSubmit: Ke(t),
2498
+ validateOnSubmit: Je(t),
2414
2499
  preflightOnly: !0
2415
2500
  }), g.ok) {
2416
- jt(t, m), l = !0, It(t, "submit"), p(null);
2417
- let C = !1;
2501
+ Kt(t, m), l = !0, kt(t, "submit"), p(null);
2502
+ let M = !1;
2418
2503
  const T = () => {
2419
- C = !0, l = !1, _e(t), Te(t);
2504
+ M = !0, l = !1, xe(t), Me(t);
2420
2505
  };
2421
2506
  if (typeof t.requestSubmit == "function") {
2422
2507
  t.addEventListener("invalid", T, !0);
@@ -2427,40 +2512,40 @@ function Bi(e, t, r, n, i, o) {
2427
2512
  }
2428
2513
  } else
2429
2514
  t.submit();
2430
- if (C)
2515
+ if (M)
2431
2516
  return;
2432
2517
  S = !0;
2433
2518
  return;
2434
2519
  }
2435
- Me(t, g), I(e, "formie:submit:result", g), _e(t);
2520
+ Le(t, g), I(e, "formie:submit:result", g), xe(t);
2436
2521
  }
2437
- } catch (C) {
2522
+ } catch (M) {
2438
2523
  l = !1, g = {
2439
2524
  ok: !1,
2440
2525
  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);
2526
+ message: M instanceof Error ? M.message : "Submission failed.",
2527
+ formErrors: [M instanceof Error ? M.message : "Submission failed."]
2528
+ }, Le(t, g), I(e, "formie:submit:result", g), xe(t);
2444
2529
  } finally {
2445
- p(null), !h && !S && !cr(g) && Te(t);
2530
+ p(null), !b && !S && !gr(g) && Me(t);
2446
2531
  }
2447
2532
  };
2448
- t.addEventListener("submit", c), o.push(() => {
2449
- t.removeEventListener("submit", c);
2533
+ t.addEventListener("submit", u), o.push(() => {
2534
+ t.removeEventListener("submit", u);
2450
2535
  });
2451
2536
  }
2452
- async function Wi(e, t, r) {
2537
+ async function eo(e, t, r) {
2453
2538
  if (t.refreshTokens === !1 || !t.staticCache)
2454
2539
  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;
2540
+ ft(ke(t.transport), Re(t.mode));
2541
+ const n = t.formHandle || e.dataset.formieHandle, i = dt(t, e), a = r?.querySelector('input[name="renderId"]')?.value || void 0;
2457
2542
  if (!n)
2458
2543
  return;
2459
- const s = await tt(i, n, a);
2460
- !s || !r || (dt(r, s), I(e, "formie:refresh-tokens:after", s));
2544
+ const s = await nt(i, n, a);
2545
+ !s || !r || (pt(r, s), I(e, "formie:refresh-tokens:after", s));
2461
2546
  }
2462
- function Ki() {
2463
- const e = /* @__PURE__ */ new Map(), t = new mr(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = [
2547
+ function to() {
2548
+ const e = /* @__PURE__ */ new Map(), t = new yr(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = [
2464
2549
  "prepare",
2465
2550
  "normalize",
2466
2551
  "validate",
@@ -2475,12 +2560,12 @@ function Ki() {
2475
2560
  return;
2476
2561
  }
2477
2562
  const E = (async () => {
2478
- L.log("Unmount requested.", { target: P(f) });
2479
- const b = r.get(f);
2480
- b && (b(), r.delete(f));
2563
+ L.log("Unmount requested.", { target: V(f) });
2564
+ const y = r.get(f);
2565
+ y && (y(), r.delete(f));
2481
2566
  const m = e.get(f);
2482
2567
  if (!m) {
2483
- L.log("Unmount skipped (no mounted state).", { target: P(f) });
2568
+ L.log("Unmount skipped (no mounted state).", { target: V(f) });
2484
2569
  return;
2485
2570
  }
2486
2571
  I(f, "formie:unmount:before", {
@@ -2492,67 +2577,67 @@ function Ki() {
2492
2577
  await g.destroy();
2493
2578
  m.modules = [], m.bus.clear(), e.delete(f), I(f, "formie:unmount:after", {
2494
2579
  id: m.instance.id
2495
- }), L.log("Unmount complete.", { id: m.instance.id, target: P(f) });
2580
+ }), L.log("Unmount complete.", { id: m.instance.id, target: V(f) });
2496
2581
  })().finally(() => {
2497
2582
  n.delete(f);
2498
2583
  });
2499
2584
  n.set(f, E), await E;
2500
2585
  }, a = async (f, v) => {
2501
2586
  L.log("Mount requested.", {
2502
- target: P(f),
2587
+ target: V(f),
2503
2588
  mode: v.mode,
2504
2589
  autoVisible: v.autoVisible
2505
2590
  });
2506
2591
  const E = r.get(f);
2507
2592
  E && (E(), r.delete(f));
2508
- const b = e.get(f);
2509
- if (b)
2593
+ const y = e.get(f);
2594
+ if (y)
2510
2595
  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,
2596
+ id: y.instance.id,
2597
+ target: V(f)
2598
+ }), y.instance;
2599
+ const m = new Gt(), g = [], S = f?.id || `formie-${e.size + 1}`, M = ee(f), T = {
2600
+ ...M,
2516
2601
  ...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))
2602
+ mode: Re(v.mode ?? M.mode),
2603
+ transport: ke(v.transport ?? M.transport)
2604
+ }, F = Dr(T.compatibility);
2605
+ if (T.mode !== "server-rendered" && !Se(f))
2521
2606
  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 || {},
2526
- ...q || {}
2527
- } : null, B = N?.theme, Y = {}, fe = (N?.modules || []).filter((M) => !!M?.id && !!M?.type);
2607
+ const q = await Qi(f, T), w = Se(f);
2608
+ T.staticCache = v.staticCache ?? Ge(w ? w.dataset : f.dataset);
2609
+ const P = $t(f, w), N = q || P ? {
2610
+ ...q || {},
2611
+ ...P || {}
2612
+ } : null, j = N?.theme, Y = {}, fe = (N?.modules || []).filter((C) => !!C?.id && !!C?.type);
2528
2613
  L.log("Resolved mount payload.", {
2529
- target: P(f),
2530
- hasRenderPayload: !!k,
2531
- hasEmbeddedPayload: !!q,
2614
+ target: V(f),
2615
+ hasRenderPayload: !!q,
2616
+ hasEmbeddedPayload: !!P,
2532
2617
  moduleCount: fe.length
2533
2618
  });
2534
- const ne = gt(f, B, w), $ = w ? new Rn(w, {
2535
- live: ct(w.dataset.formieValidationOnFocus),
2619
+ const ne = yt(f, j, w), k = w ? new Vn(w, {
2620
+ live: mt(w.dataset.formieValidationOnFocus),
2536
2621
  errorMessage: w.dataset.formieErrorMessage || "",
2537
2622
  fieldContainerErrorClass: ne.fieldLayoutError || [],
2538
2623
  inputErrorClass: ne.fieldControlError || [],
2539
2624
  messagesClass: ne.fieldErrors || [],
2540
2625
  messageClass: ne.fieldError || []
2541
2626
  }) : 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($)
2627
+ if (w && k) {
2628
+ const C = w;
2629
+ C.formieValidation = k, Y.validation = k;
2630
+ const H = {
2631
+ validator: k,
2632
+ addValidator: k.addValidator.bind(k),
2633
+ removeValidator: k.removeValidator.bind(k)
2549
2634
  };
2550
- I(w, "formie:validator:ready", O), I(f, "formie:validator:ready", O);
2635
+ I(w, "formie:validator:ready", H), I(f, "formie:validator:ready", H);
2551
2636
  }
2552
- w && ((k || T.endpoint || f.dataset.formieEndpoint) && $i(f, w, T), J(w)), Object.keys(ne).length && I(f, "formie:theme:applied", {
2637
+ w && ((q || T.endpoint || f.dataset.formieEndpoint) && Ui(f, w, T), J(w)), Object.keys(ne).length && I(f, "formie:theme:applied", {
2553
2638
  hasClasses: !0
2554
2639
  });
2555
- const me = await gr(fe, {
2640
+ const me = await Er(fe, {
2556
2641
  registry: t,
2557
2642
  matchContext: {
2558
2643
  root: f,
@@ -2566,27 +2651,27 @@ function Ki() {
2566
2651
  target: f,
2567
2652
  scope: "form",
2568
2653
  state: Y,
2569
- on: (M, O) => m.on(M, O),
2570
- emit: (M, O) => (I(f, M, O), m.emitSafe(M, O).then((Z) => {
2654
+ on: (C, H) => m.on(C, H),
2655
+ emit: (C, H) => (I(f, C, H), m.emitSafe(C, H).then((Z) => {
2571
2656
  Z.failed.length > 0 && L.warn("Lifecycle listeners failed.", {
2572
- eventName: M,
2657
+ eventName: C,
2573
2658
  failed: Z.failed.length
2574
2659
  });
2575
2660
  }))
2576
2661
  }
2577
2662
  });
2578
2663
  L.log("Module setup complete.", {
2579
- target: P(f),
2664
+ target: V(f),
2580
2665
  moduleInstances: me.length
2581
2666
  });
2582
- const qe = {
2667
+ const Pe = {
2583
2668
  id: S,
2584
2669
  root: f,
2585
- submit: async (M = "submit") => {
2670
+ submit: async (C = "submit") => {
2586
2671
  if (L.log("Submit requested.", {
2587
2672
  id: S,
2588
- target: P(f),
2589
- action: M
2673
+ target: V(f),
2674
+ action: C
2590
2675
  }), !w)
2591
2676
  return {
2592
2677
  ok: !1,
@@ -2594,34 +2679,34 @@ function Ki() {
2594
2679
  message: "No form element found for mount target.",
2595
2680
  formErrors: ["No form element found for mount target."]
2596
2681
  };
2597
- const O = w.querySelector('input[name="submitAction"]');
2598
- if (O && (O.value = M), w.getAttribute("data-formie-loading") === "true")
2682
+ const H = w.querySelector('input[name="submitAction"]');
2683
+ if (H && (H.value = C), w.getAttribute("data-formie-loading") === "true")
2599
2684
  return {
2600
2685
  ok: !1,
2601
2686
  code: "SUBMIT_IN_PROGRESS",
2602
2687
  message: "Submission already in progress.",
2603
2688
  formErrors: []
2604
2689
  };
2605
- const Z = w.querySelector(`[data-formie-action="${M}"]`), Q = await fr({
2690
+ const Z = w.querySelector(`[data-formie-action="${C}"]`), Q = await br({
2606
2691
  id: S,
2607
2692
  target: f,
2608
2693
  form: w,
2609
2694
  bus: m,
2610
- validator: $,
2611
- validateOnSubmit: Ke(w),
2612
- action: M,
2695
+ validator: k,
2696
+ validateOnSubmit: Je(w),
2697
+ action: C,
2613
2698
  submitter: Z,
2614
- waitForSubmitDelay: Ge,
2699
+ waitForSubmitDelay: Ye,
2615
2700
  onRefreshTokensAfterSubmit: async () => {
2616
- await br(f, T, w);
2701
+ await Ar(f, T, w);
2617
2702
  },
2618
- dispatchSubmitResult: (Pe) => {
2619
- I(f, "formie:submit:result", Pe);
2703
+ dispatchSubmitResult: (Ve) => {
2704
+ I(f, "formie:submit:result", Ve);
2620
2705
  }
2621
2706
  });
2622
2707
  return L.log("Submit completed.", {
2623
2708
  id: S,
2624
- action: M,
2709
+ action: C,
2625
2710
  ok: Q.ok,
2626
2711
  code: Q.code,
2627
2712
  message: Q.message
@@ -2630,81 +2715,81 @@ function Ki() {
2630
2715
  destroy: async () => {
2631
2716
  await o(f);
2632
2717
  },
2633
- on: (M, O) => m.on(M, O)
2718
+ on: (C, H) => m.on(C, H)
2634
2719
  };
2635
- w && (zr({
2720
+ w && (Gr({
2636
2721
  target: f,
2637
2722
  form: w,
2638
- validatorDetail: $ ? {
2639
- validator: $,
2640
- addValidator: $.addValidator.bind($),
2641
- removeValidator: $.removeValidator.bind($)
2723
+ validatorDetail: k ? {
2724
+ validator: k,
2725
+ addValidator: k.addValidator.bind(k),
2726
+ removeValidator: k.removeValidator.bind(k)
2642
2727
  } : null,
2643
2728
  options: F,
2644
2729
  unbinds: g
2645
- }), Ur({
2730
+ }), Kr({
2646
2731
  target: f,
2647
2732
  form: w,
2648
- instance: qe,
2733
+ instance: Pe,
2649
2734
  options: F,
2650
2735
  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) => {
2736
+ })), w && (Xi(f, w, T, m, k, g), k && g.push(_n(w, k, f)), await eo(f, T, w)), i.forEach((C) => {
2737
+ const H = m.on(`formie:stage:${C}:before`, async (W) => {
2738
+ I(f, `formie:stage:${C}:before`, W);
2739
+ }), Z = m.on(`formie:stage:${C}:before`, async (W) => {
2655
2740
  for (const ie of me)
2656
2741
  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) => {
2742
+ }), Q = m.on(`formie:stage:${C}:after`, async (W) => {
2743
+ I(f, `formie:stage:${C}:after`, W);
2744
+ }), Ve = m.on(`formie:stage:${C}:after`, async (W) => {
2660
2745
  const ie = W;
2661
- for (const pt of me)
2662
- pt.onAfterStage && await pt.onAfterStage(ie, ie.result);
2746
+ for (const bt of me)
2747
+ bt.onAfterStage && await bt.onAfterStage(ie, ie.result);
2663
2748
  });
2664
- g.push(O, Z, Q, Pe);
2749
+ g.push(H, Z, Q, Ve);
2665
2750
  });
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);
2751
+ const Vr = m.on("formie:submit:before", async (C) => {
2752
+ I(f, "formie:submit:before", C);
2753
+ }), $r = m.on("formie:submit:after", async (C) => {
2754
+ I(f, "formie:submit:after", C);
2755
+ }), Hr = m.on("formie:submit:final:before", async (C) => {
2756
+ I(f, "formie:submit:final:before", C);
2757
+ }), Or = m.on("formie:submit:final:after", async (C) => {
2758
+ I(f, "formie:submit:final:after", C);
2674
2759
  });
2675
2760
  return g.push(
2676
- Fr,
2677
- Rr,
2678
- kr,
2679
- qr
2761
+ Vr,
2762
+ $r,
2763
+ Hr,
2764
+ Or
2680
2765
  ), e.set(f, {
2681
2766
  options: T,
2682
2767
  bus: m,
2683
2768
  form: w,
2684
- validator: $,
2769
+ validator: k,
2685
2770
  modules: me,
2686
2771
  unbinds: g,
2687
- instance: qe
2772
+ instance: Pe
2688
2773
  }), I(f, "formie:mount:after", {
2689
2774
  id: S,
2690
2775
  mode: T.mode
2691
2776
  }), L.log("Mount complete.", {
2692
2777
  id: S,
2693
- target: P(f),
2778
+ target: V(f),
2694
2779
  mode: T.mode
2695
- }), qe;
2780
+ }), Pe;
2696
2781
  }, s = (f, v) => {
2697
- if (!v.autoVisible || Ui(f) || typeof IntersectionObserver > "u")
2782
+ if (!v.autoVisible || Yi(f) || typeof IntersectionObserver > "u")
2698
2783
  return a(f, v);
2699
2784
  if (e.has(f))
2700
2785
  return Promise.resolve(e.get(f)?.instance || null);
2701
2786
  if (r.has(f))
2702
2787
  return L.log("Mount deferred (already waiting visibility).", {
2703
- target: P(f)
2788
+ target: V(f)
2704
2789
  }), 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)
2790
+ const E = new IntersectionObserver((y) => {
2791
+ y.some((g) => g.target === f && g.isIntersecting) && (E.disconnect(), r.delete(f), L.log("Visibility reached, proceeding mount.", {
2792
+ target: V(f)
2708
2793
  }), a(f, {
2709
2794
  ...v,
2710
2795
  autoVisible: !1
@@ -2715,7 +2800,7 @@ function Ki() {
2715
2800
  return E.observe(f), r.set(f, () => {
2716
2801
  E.disconnect();
2717
2802
  }), L.log("Mount deferred until visible.", {
2718
- target: P(f)
2803
+ target: V(f)
2719
2804
  }), Promise.resolve(null);
2720
2805
  };
2721
2806
  return {
@@ -2733,7 +2818,7 @@ function Ki() {
2733
2818
  ...E.options,
2734
2819
  ...v
2735
2820
  };
2736
- const b = v.payload?.theme || E.options.payload?.theme || qt(f, E.form)?.theme, m = gt(f, b, E.form);
2821
+ const y = v.payload?.theme || E.options.payload?.theme || $t(f, E.form)?.theme, m = yt(f, y, E.form);
2737
2822
  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
2823
  hasClasses: !0,
2739
2824
  reason: "update"
@@ -2741,14 +2826,14 @@ function Ki() {
2741
2826
  },
2742
2827
  getInstance: (f) => e.get(f)?.instance || null,
2743
2828
  refreshForCache: async (f) => {
2744
- ki(
2829
+ Di(
2745
2830
  "refreshForCache",
2746
2831
  "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead."
2747
2832
  );
2748
2833
  let v = null;
2749
2834
  if (typeof f == "string") {
2750
- const k = document.getElementById(f);
2751
- k ? v = k : v = document.querySelector(`[data-formie-form-id="${f}"]`);
2835
+ const q = document.getElementById(f);
2836
+ q ? v = q : v = document.querySelector(`[data-formie-form-id="${f}"]`);
2752
2837
  } else
2753
2838
  v = f;
2754
2839
  if (!v) {
@@ -2757,22 +2842,22 @@ function Ki() {
2757
2842
  });
2758
2843
  return;
2759
2844
  }
2760
- const E = e.get(v), b = Ee(v), m = E?.options || ee(v);
2761
- if (!b) {
2845
+ const E = e.get(v), y = Se(v), m = E?.options || ee(v);
2846
+ if (!y) {
2762
2847
  L.warn("refreshForCache found no form element for target.", {
2763
- target: P(v)
2848
+ target: V(v)
2764
2849
  });
2765
2850
  return;
2766
2851
  }
2767
- const g = m.formHandle || v.dataset.formieHandle || b.dataset.formieHandle, S = lt(m, v), T = b.querySelector('input[name="renderId"]')?.value || void 0;
2852
+ const g = m.formHandle || v.dataset.formieHandle || y.dataset.formieHandle, S = dt(m, v), T = y.querySelector('input[name="renderId"]')?.value || void 0;
2768
2853
  if (!g) {
2769
2854
  L.warn("refreshForCache found no form handle for target.", {
2770
- target: P(v)
2855
+ target: V(v)
2771
2856
  });
2772
2857
  return;
2773
2858
  }
2774
- const F = await tt(S, g, T);
2775
- F && (dt(b, F), I(v, "formie:refresh-tokens:after", F));
2859
+ const F = await nt(S, g, T);
2860
+ F && (pt(y, F), I(v, "formie:refresh-tokens:after", F));
2776
2861
  },
2777
2862
  registerModule: (f, v) => t.register(f, v),
2778
2863
  unregisterModule: (f) => {
@@ -2802,22 +2887,22 @@ function Ki() {
2802
2887
  L.log("Observer started.", {
2803
2888
  scope: v === document ? "document" : v
2804
2889
  });
2805
- const E = new MutationObserver((b) => {
2806
- b.forEach((m) => {
2890
+ const E = new MutationObserver((y) => {
2891
+ y.forEach((m) => {
2807
2892
  m.addedNodes.forEach((g) => {
2808
2893
  g instanceof Element && (g.matches(X) && (L.log("Observer detected new root.", {
2809
- target: P(g)
2894
+ target: V(g)
2810
2895
  }), s(g, ee(g))), g.querySelectorAll(X).forEach((S) => {
2811
2896
  L.log("Observer detected new nested root.", {
2812
- target: P(S)
2897
+ target: V(S)
2813
2898
  }), s(S, ee(S));
2814
2899
  }));
2815
2900
  }), m.removedNodes.forEach((g) => {
2816
2901
  g instanceof Element && (e.has(g) && (L.log("Observer detected removed root.", {
2817
- target: P(g)
2902
+ target: V(g)
2818
2903
  }), o(g)), g.querySelectorAll(X).forEach((S) => {
2819
2904
  e.has(S) && (L.log("Observer detected removed nested root.", {
2820
- target: P(S)
2905
+ target: V(S)
2821
2906
  }), o(S));
2822
2907
  }));
2823
2908
  });
@@ -2828,21 +2913,21 @@ function Ki() {
2828
2913
  subtree: !0
2829
2914
  }), () => {
2830
2915
  E.disconnect(), L.log("Observer stopped."), r.forEach((m, g) => {
2831
- zi(g, v) && (m(), r.delete(g));
2916
+ Zi(g, v) && (m(), r.delete(g));
2832
2917
  });
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) => {
2918
+ const y = [];
2919
+ v instanceof Element && v.matches(X) && y.push(v), v.querySelectorAll(X).forEach((m) => {
2920
+ y.push(m);
2921
+ }), y.forEach((m) => {
2837
2922
  e.has(m) && o(m);
2838
2923
  });
2839
2924
  };
2840
2925
  }
2841
2926
  };
2842
2927
  }
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, {
2928
+ const wr = _("general", "module-hydrator");
2929
+ async function sa(e) {
2930
+ 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 yr(), a = new Gt(), s = await Er(n, {
2846
2931
  registry: o,
2847
2932
  setupContext: {
2848
2933
  formId: r?.id || t.id || "formie-modules",
@@ -2863,13 +2948,13 @@ async function Xo(e) {
2863
2948
  mode: i
2864
2949
  }
2865
2950
  });
2866
- return yr.log("Hydrated module manifest.", {
2951
+ return wr.log("Hydrated module manifest.", {
2867
2952
  moduleCount: n.length,
2868
2953
  instanceCount: s.length,
2869
2954
  mode: i
2870
2955
  }), {
2871
2956
  destroy: async () => {
2872
- await Gi(s), a.clear();
2957
+ await ro(s), a.clear();
2873
2958
  },
2874
2959
  on: (l, d) => a.on(l, d),
2875
2960
  emit: async (l, d) => {
@@ -2882,45 +2967,45 @@ async function Xo(e) {
2882
2967
  getRegisteredModules: () => o.getAll()
2883
2968
  };
2884
2969
  }
2885
- async function Gi(e) {
2970
+ async function ro(e) {
2886
2971
  for (const t of e)
2887
2972
  try {
2888
2973
  await t.destroy();
2889
2974
  } catch (r) {
2890
- console.error("[formie] Failed to destroy module instance.", r), yr.warn("Failed destroying module instance.", { error: r });
2975
+ console.error("[formie] Failed to destroy module instance.", r), wr.warn("Failed destroying module instance.", { error: r });
2891
2976
  }
2892
2977
  }
2893
- function ke(e) {
2978
+ function qe(e) {
2894
2979
  return e instanceof Element;
2895
2980
  }
2896
- function Ji(e) {
2981
+ function no(e) {
2897
2982
  return e.ok;
2898
2983
  }
2899
- function Yi(e) {
2900
- return typeof e == "string" ? `selector "${e}"` : ke(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2984
+ function io(e) {
2985
+ return typeof e == "string" ? `selector "${e}"` : qe(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2901
2986
  }
2902
- function Zi(e) {
2987
+ function oo(e) {
2903
2988
  const t = /* @__PURE__ */ new Set(), r = [];
2904
2989
  for (const n of e)
2905
- !ke(n) || t.has(n) || (t.add(n), r.push(n));
2990
+ !qe(n) || t.has(n) || (t.add(n), r.push(n));
2906
2991
  return r;
2907
2992
  }
2908
- function Je(e) {
2909
- return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : ke(e) ? [e] : Zi(e);
2993
+ function Ze(e) {
2994
+ return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : qe(e) ? [e] : oo(e);
2910
2995
  }
2911
- function Qi() {
2996
+ function ao() {
2912
2997
  return document.readyState !== "loading" ? Promise.resolve() : new Promise((e) => {
2913
2998
  document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
2914
2999
  });
2915
3000
  }
2916
- async function Xi(e) {
2917
- const t = Je(e);
2918
- return t.length > 0 || typeof e != "string" ? t : (await Qi(), Je(e));
3001
+ async function so(e) {
3002
+ const t = Ze(e);
3003
+ return t.length > 0 || typeof e != "string" ? t : (await ao(), Ze(e));
2919
3004
  }
2920
- function eo(e) {
2921
- return typeof e == "string" ? document : ke(e) ? e.getRootNode() : document;
3005
+ function lo(e) {
3006
+ return typeof e == "string" ? document : qe(e) ? e.getRootNode() : document;
2922
3007
  }
2923
- function to(e) {
3008
+ function uo(e) {
2924
3009
  const {
2925
3010
  element: t,
2926
3011
  observe: r,
@@ -2938,8 +3023,8 @@ function to(e) {
2938
3023
  ...p
2939
3024
  };
2940
3025
  }
2941
- async function Pt(e, t, r, n) {
2942
- const i = [], o = to(e);
3026
+ async function Ht(e, t, r, n) {
3027
+ const i = [], o = uo(e);
2943
3028
  for (const a of n) {
2944
3029
  const s = r.get(a);
2945
3030
  if (s) {
@@ -2948,14 +3033,14 @@ async function Pt(e, t, r, n) {
2948
3033
  }
2949
3034
  const l = await t.mount(a, o), d = [];
2950
3035
  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);
3036
+ const h = p;
3037
+ e.onResult?.(h, l), no(h) ? e.onSuccess?.(h, l) : e.onError?.(h, l);
2953
3038
  })), e.onEvent)
2954
- for (const p of Vr)
2955
- d.push(l.on(p, (y) => {
3039
+ for (const p of xr)
3040
+ d.push(l.on(p, (h) => {
2956
3041
  e.onEvent?.({
2957
3042
  name: p,
2958
- payload: y
3043
+ payload: h
2959
3044
  }, l);
2960
3045
  }));
2961
3046
  r.set(a, {
@@ -2965,12 +3050,12 @@ async function Pt(e, t, r, n) {
2965
3050
  }
2966
3051
  return i;
2967
3052
  }
2968
- async function ea(e) {
2969
- const t = e.client ?? Ki(), r = /* @__PURE__ */ new Map(), n = await Xi(e.element);
3053
+ async function la(e) {
3054
+ const t = e.client ?? to(), r = /* @__PURE__ */ new Map(), n = await so(e.element);
2970
3055
  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;
3056
+ throw new Error(`Formie could not find any elements for ${io(e.element)}.`);
3057
+ await Ht(e, t, r, n);
3058
+ const i = e.observe ? t.observe(lo(e.element)) : null;
2974
3059
  return {
2975
3060
  client: t,
2976
3061
  get instances() {
@@ -2981,8 +3066,8 @@ async function ea(e) {
2981
3066
  return a ? r.get(a)?.instance ?? t.getInstance(a) : null;
2982
3067
  },
2983
3068
  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);
3069
+ const o = Ze(e.element);
3070
+ return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) : Ht(e, t, r, o);
2986
3071
  },
2987
3072
  async destroy() {
2988
3073
  i?.();
@@ -2992,13 +3077,13 @@ async function ea(e) {
2992
3077
  }
2993
3078
  };
2994
3079
  }
2995
- const ft = 2e3, ta = 5e3, ra = 5e3, na = 12e4;
2996
- async function mt(e) {
3080
+ const gt = 2e3, ua = 5e3, ca = 5e3, da = 12e4;
3081
+ async function ht(e) {
2997
3082
  await new Promise((t) => {
2998
3083
  window.setTimeout(t, Math.max(e, 0));
2999
3084
  });
3000
3085
  }
3001
- async function ia(e, {
3086
+ async function fa(e, {
3002
3087
  timeoutMs: t = 5e3,
3003
3088
  intervalMs: r = 30
3004
3089
  } = {}) {
@@ -3007,11 +3092,11 @@ async function ia(e, {
3007
3092
  const i = e();
3008
3093
  if (i)
3009
3094
  return i;
3010
- await mt(r);
3095
+ await ht(r);
3011
3096
  }
3012
3097
  throw new Error("Timed out waiting for async condition.");
3013
3098
  }
3014
- function vr(e, t) {
3099
+ function Tr(e, t) {
3015
3100
  let r = null;
3016
3101
  return (...n) => {
3017
3102
  r !== null && window.clearTimeout(r), r = window.setTimeout(() => {
@@ -3019,14 +3104,14 @@ function vr(e, t) {
3019
3104
  }, Math.max(t, 0));
3020
3105
  };
3021
3106
  }
3022
- function oa(e) {
3107
+ function ma(e) {
3023
3108
  const t = String(e || "asyncDefer").toLowerCase();
3024
3109
  return {
3025
3110
  async: t.includes("async"),
3026
3111
  defer: t.includes("defer")
3027
3112
  };
3028
3113
  }
3029
- function Er(e, t) {
3114
+ function Mr(e, t) {
3030
3115
  const r = Array.from(e.querySelectorAll(`input[name="${t}"], textarea[name="${t}"]`));
3031
3116
  for (const n of r) {
3032
3117
  const i = String(n.value || "").trim();
@@ -3035,39 +3120,39 @@ function Er(e, t) {
3035
3120
  }
3036
3121
  return "";
3037
3122
  }
3038
- function Ye(e, t) {
3039
- return t.some((r) => Er(e, r) !== "");
3123
+ function Qe(e, t) {
3124
+ return t.some((r) => Mr(e, r) !== "");
3040
3125
  }
3041
- function ro(e, t) {
3126
+ function co(e, t) {
3042
3127
  t.forEach((r) => {
3043
3128
  Array.from(e.querySelectorAll(`input[name="${r}"], textarea[name="${r}"]`)).forEach((i) => {
3044
3129
  i.value = "";
3045
3130
  });
3046
3131
  });
3047
3132
  }
3048
- function Sr(e, t, {
3133
+ function Cr(e, t, {
3049
3134
  value: r = "",
3050
3135
  container: n
3051
3136
  } = {}) {
3052
3137
  let i = e.querySelector(`input[name="${t}"]`);
3053
3138
  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
3139
  }
3055
- async function Ar(e, t, r) {
3056
- if (Ye(e, t))
3140
+ async function Lr(e, t, r) {
3141
+ if (Qe(e, t))
3057
3142
  return !0;
3058
3143
  const n = Date.now() + Math.max(r, 0);
3059
3144
  for (; Date.now() < n; )
3060
- if (await mt(120), Ye(e, t))
3145
+ if (await ht(120), Qe(e, t))
3061
3146
  return !0;
3062
3147
  return !1;
3063
3148
  }
3064
- const no = /* @__PURE__ */ new Set([
3149
+ const fo = /* @__PURE__ */ new Set([
3065
3150
  "handle",
3066
3151
  "placeholderSelector",
3067
3152
  "errorMessage",
3068
3153
  "sessionKey",
3069
3154
  "value"
3070
- ]), io = "[data-formie-captcha-error-container]", oo = [
3155
+ ]), mo = "[data-formie-captcha-error-container]", po = [
3071
3156
  "formie:page:navigate",
3072
3157
  "formie:page:navigate:after",
3073
3158
  "formie:submit:result"
@@ -3077,55 +3162,55 @@ function se(e, t, r) {
3077
3162
  e.removeEventListener(t, r);
3078
3163
  };
3079
3164
  }
3080
- function Le(e, t) {
3165
+ function Ie(e, t) {
3081
3166
  return e instanceof HTMLElement && e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
3082
3167
  }
3083
- function Ze(e) {
3168
+ function Xe(e) {
3084
3169
  if (!(e instanceof HTMLElement) || !e.isConnected || e.hidden || e.closest("[hidden]") || e.closest("[data-formie-page-hidden]") || e.closest('[aria-hidden="true"]'))
3085
3170
  return !1;
3086
3171
  const t = window.getComputedStyle(e);
3087
3172
  return t.display !== "none" && t.visibility !== "hidden";
3088
3173
  }
3089
- function De(e, t) {
3090
- const r = Le(e, t);
3091
- return r.find((n) => Ze(n)) || r[0] || null;
3174
+ function Ne(e, t) {
3175
+ const r = Ie(e, t);
3176
+ return r.find((n) => Xe(n)) || r[0] || null;
3092
3177
  }
3093
- function ao(e) {
3178
+ function go(e) {
3094
3179
  e.innerHTML = "";
3095
3180
  const t = document.createElement("div");
3096
3181
  return e.appendChild(t), t;
3097
3182
  }
3098
- function Qe(e) {
3099
- e?.querySelector(io)?.remove();
3183
+ function et(e) {
3184
+ e?.querySelector(mo)?.remove();
3100
3185
  }
3101
- function so(e, t, r) {
3186
+ function ho(e, t, r) {
3102
3187
  if (!e)
3103
3188
  return;
3104
- Qe(e);
3189
+ et(e);
3105
3190
  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");
3191
+ n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), $(n, r || e, "fieldErrors");
3107
3192
  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);
3193
+ i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"), $(i, r || e, "fieldError"), i.textContent = t, n.appendChild(i), e.appendChild(n);
3109
3194
  }
3110
- function lo(e) {
3195
+ function bo(e) {
3111
3196
  const t = e instanceof CustomEvent ? e.detail : null;
3112
3197
  return !t || typeof t != "object" ? null : t;
3113
3198
  }
3114
- function uo(e, t) {
3199
+ function yo(e, t) {
3115
3200
  if (!e?.captchas || typeof e.captchas != "object")
3116
3201
  return null;
3117
3202
  const r = e.captchas[t];
3118
3203
  return !r || typeof r != "object" ? null : r;
3119
3204
  }
3120
- function co(e, t, r, n) {
3205
+ function vo(e, t, r, n) {
3121
3206
  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));
3207
+ const d = Ie(e, t), p = new Set(d.filter((h) => Xe(h)));
3208
+ d.forEach((h) => {
3209
+ p.has(h) && !i.has(h) && (i.add(h), r(h));
3210
+ }), Array.from(i).forEach((h) => {
3211
+ p.has(h) || (i.delete(h), n(h));
3127
3212
  });
3128
- }, a = vr(o, 20), s = new MutationObserver(() => {
3213
+ }, a = Tr(o, 20), s = new MutationObserver(() => {
3129
3214
  a();
3130
3215
  });
3131
3216
  s.observe(e, {
@@ -3138,7 +3223,7 @@ function co(e, t, r, n) {
3138
3223
  se(window, "resize", () => {
3139
3224
  a();
3140
3225
  }),
3141
- ...oo.map((d) => se(e, d, () => {
3226
+ ...po.map((d) => se(e, d, () => {
3142
3227
  a();
3143
3228
  }))
3144
3229
  ];
@@ -3151,20 +3236,20 @@ function co(e, t, r, n) {
3151
3236
  }), i.clear();
3152
3237
  },
3153
3238
  reconcile: a,
3154
- getVisible: () => Le(e, t).filter((d) => Ze(d))
3239
+ getVisible: () => Ie(e, t).filter((d) => Xe(d))
3155
3240
  };
3156
3241
  }
3157
- function fo(e, t) {
3242
+ function Eo(e, t) {
3158
3243
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
3159
3244
  }
3160
- function mo(e, t, {
3245
+ function So(e, t, {
3161
3246
  defaultPlaceholderSelector: r,
3162
3247
  defaultTokenFieldNames: n = [],
3163
- defaultWaitForValueMs: i = ft
3248
+ defaultWaitForValueMs: i = gt
3164
3249
  }) {
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;
3250
+ const o = t || {}, a = Object.entries(o).reduce((c, [b, A]) => (fo.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
3251
  return {
3167
- handle: fo(e, o),
3252
+ handle: Eo(e, o),
3168
3253
  ui: {
3169
3254
  placeholderSelector: d,
3170
3255
  errorMessage: p
@@ -3172,61 +3257,61 @@ function mo(e, t, {
3172
3257
  transport: {
3173
3258
  tokenFieldNames: s,
3174
3259
  waitForValueMs: Number.isFinite(l) ? l : i,
3175
- sessionKey: y,
3176
- value: c
3260
+ sessionKey: h,
3261
+ value: u
3177
3262
  },
3178
3263
  provider: a
3179
3264
  };
3180
3265
  }
3181
- function po(e, t) {
3266
+ function Ao(e, t) {
3182
3267
  const r = e.form || e.root, n = t.ui.placeholderSelector, i = t.handle;
3183
3268
  return {
3184
3269
  form: e.form,
3185
3270
  root: e.root,
3186
3271
  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),
3272
+ query: () => Ie(e.root, n),
3273
+ getPrimary: () => Ne(e.root, n),
3274
+ observe: (o, a) => vo(e.root, n, o, a),
3275
+ createContainer: (o) => go(o),
3191
3276
  clear: (o) => {
3192
- o && (Qe(o), o.innerHTML = "");
3277
+ o && (et(o), o.innerHTML = "");
3193
3278
  }
3194
3279
  },
3195
3280
  errors: {
3196
3281
  getDefaultMessage: () => t.ui.errorMessage,
3197
3282
  show: (o, a) => {
3198
- so(a || De(e.root, n), o || t.ui.errorMessage, e.form || e.root);
3283
+ ho(a || Ne(e.root, n), o || t.ui.errorMessage, e.form || e.root);
3199
3284
  },
3200
3285
  clear: (o) => {
3201
- Qe(o || De(e.root, n));
3286
+ et(o || Ne(e.root, n));
3202
3287
  }
3203
3288
  },
3204
3289
  tokens: {
3205
3290
  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) : "",
3291
+ has: (o = t.transport.tokenFieldNames, a = r) => Qe(a, o),
3292
+ read: (o = t.transport.tokenFieldNames[0], a = r) => o ? Mr(a, o) : "",
3208
3293
  write: (o, {
3209
3294
  names: a = t.transport.tokenFieldNames,
3210
3295
  root: s = r,
3211
3296
  container: l = e.form
3212
3297
  } = {}) => {
3213
3298
  a.forEach((d) => {
3214
- Sr(s, d, {
3299
+ Cr(s, d, {
3215
3300
  value: o,
3216
3301
  container: l
3217
3302
  });
3218
3303
  });
3219
3304
  },
3220
3305
  clear: (o = t.transport.tokenFieldNames, a = r) => {
3221
- ro(a, o);
3306
+ co(a, o);
3222
3307
  },
3223
- wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) => Ar(s, a, o)
3308
+ wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) => Lr(s, a, o)
3224
3309
  },
3225
3310
  refresh: {
3226
3311
  providerHandle: i,
3227
3312
  onTokensRefreshed: (o) => {
3228
3313
  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);
3314
+ const d = bo(l), p = yo(d, i);
3230
3315
  p && o(p);
3231
3316
  }));
3232
3317
  return () => {
@@ -3244,11 +3329,11 @@ function po(e, t) {
3244
3329
  };
3245
3330
  }
3246
3331
  const G = _("captchas");
3247
- function wr({
3332
+ function Ir({
3248
3333
  id: e,
3249
3334
  defaultPlaceholderSelector: t,
3250
3335
  defaultTokenFieldNames: r = [],
3251
- defaultWaitForValueMs: n = ft,
3336
+ defaultWaitForValueMs: n = gt,
3252
3337
  setup: i
3253
3338
  }) {
3254
3339
  return {
@@ -3256,7 +3341,7 @@ function wr({
3256
3341
  kind: "captcha",
3257
3342
  match: () => !0,
3258
3343
  setup: async (o) => {
3259
- const a = mo(e, o.options || {}, {
3344
+ const a = So(e, o.options || {}, {
3260
3345
  defaultPlaceholderSelector: t,
3261
3346
  defaultTokenFieldNames: r,
3262
3347
  defaultWaitForValueMs: n
@@ -3266,7 +3351,7 @@ function wr({
3266
3351
  placeholderSelector: a.ui.placeholderSelector,
3267
3352
  tokenFieldNames: a.transport.tokenFieldNames
3268
3353
  });
3269
- const s = po(o, a);
3354
+ const s = Ao(o, a);
3270
3355
  return i({
3271
3356
  ...o,
3272
3357
  options: a,
@@ -3275,13 +3360,13 @@ function wr({
3275
3360
  }
3276
3361
  };
3277
3362
  }
3278
- function go({
3363
+ function wo({
3279
3364
  id: e,
3280
3365
  defaultPlaceholderSelector: t,
3281
3366
  defaultTokenFieldNames: r = [],
3282
- defaultWaitForValueMs: n = ft
3367
+ defaultWaitForValueMs: n = gt
3283
3368
  }) {
3284
- return wr({
3369
+ return Ir({
3285
3370
  id: e,
3286
3371
  defaultPlaceholderSelector: t,
3287
3372
  defaultTokenFieldNames: r,
@@ -3289,51 +3374,51 @@ function go({
3289
3374
  setup: async ({ services: i, options: o, root: a }) => {
3290
3375
  const s = [];
3291
3376
  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, {
3377
+ const h = (c) => {
3378
+ !c || !d || (c.innerHTML = "", Cr(c, d, {
3294
3379
  value: p,
3295
- container: u
3380
+ container: c
3296
3381
  }));
3297
- }, c = i.placeholder.observe(
3298
- (u) => {
3299
- l = u, G.log("Passive placeholder visible.", {
3382
+ }, u = i.placeholder.observe(
3383
+ (c) => {
3384
+ l = c, G.log("Passive placeholder visible.", {
3300
3385
  moduleId: e
3301
- }), y(u);
3386
+ }), h(c);
3302
3387
  },
3303
- (u) => {
3304
- l === u && (l = i.placeholder.getPrimary()), u.innerHTML = "";
3388
+ (c) => {
3389
+ l === c && (l = i.placeholder.getPrimary()), c.innerHTML = "";
3305
3390
  }
3306
3391
  );
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);
3392
+ return s.push(u.cleanup), h(l), s.push(i.refresh.onTokensRefreshed((c) => {
3393
+ d = typeof c.sessionKey == "string" && c.sessionKey.trim() !== "" ? c.sessionKey.trim() : d, p = typeof c.value == "string" ? c.value : "";
3394
+ const b = i.placeholder.getPrimary() || l;
3395
+ l = b, h(b);
3311
3396
  })), {
3312
3397
  destroy: () => {
3313
- s.forEach((u) => {
3314
- u();
3398
+ s.forEach((c) => {
3399
+ c();
3315
3400
  });
3316
3401
  },
3317
- onBeforeStage: async (u) => {
3318
- if (u.stage !== "screen" || u.action !== "submit")
3402
+ onBeforeStage: async (c) => {
3403
+ if (c.stage !== "screen" || c.action !== "submit")
3319
3404
  return;
3320
- const h = d ? [d] : o.transport.tokenFieldNames;
3321
- if (h.length === 0)
3405
+ const b = d ? [d] : o.transport.tokenFieldNames;
3406
+ if (b.length === 0)
3322
3407
  return;
3323
- if (!await Ar(a, h, o.transport.waitForValueMs)) {
3408
+ if (!await Lr(a, b, o.transport.waitForValueMs)) {
3324
3409
  const f = i.errors.getDefaultMessage();
3325
3410
  i.errors.show(f, l), G.warn("Passive captcha missing token.", {
3326
3411
  moduleId: e,
3327
- tokenFieldNames: h
3328
- }), u.abort(f);
3412
+ tokenFieldNames: b
3413
+ }), c.abort(f);
3329
3414
  }
3330
3415
  }
3331
3416
  };
3332
3417
  }
3333
3418
  });
3334
3419
  }
3335
- function ho(e) {
3336
- return wr({
3420
+ function To(e) {
3421
+ return Ir({
3337
3422
  id: e.id,
3338
3423
  defaultPlaceholderSelector: e.defaultPlaceholderSelector,
3339
3424
  defaultTokenFieldNames: e.defaultTokenFieldNames,
@@ -3342,56 +3427,56 @@ function ho(e) {
3342
3427
  let o = t.services.placeholder.getPrimary(), a = !1, s = null;
3343
3428
  const l = async () => (s || (G.log("Loading captcha provider API.", {
3344
3429
  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 = "";
3430
+ }), s = e.load(t)), s), d = async (c) => {
3431
+ const b = n.get(c);
3432
+ if (t.services.errors.clear(c), !b) {
3433
+ c.innerHTML = "";
3349
3434
  return;
3350
3435
  }
3351
3436
  const A = await l();
3352
3437
  e.unmount && await e.unmount({
3353
3438
  api: A,
3354
- widget: h,
3355
- placeholder: u,
3439
+ widget: b,
3440
+ placeholder: c,
3356
3441
  services: t.services,
3357
3442
  options: t.options,
3358
3443
  provider: t.options.provider
3359
- }), n.delete(u), u.innerHTML = "", t.services.tokens.clear(), G.log("Unmounted captcha placeholder widget.", {
3444
+ }), n.delete(c), c.innerHTML = "", t.services.tokens.clear(), G.log("Unmounted captcha placeholder widget.", {
3360
3445
  moduleId: e.id
3361
- }), o === u && (o = t.services.placeholder.getPrimary());
3362
- }, p = async (u) => {
3363
- if (a || n.has(u) || i.has(u))
3446
+ }), o === c && (o = t.services.placeholder.getPrimary());
3447
+ }, p = async (c) => {
3448
+ if (a || n.has(c) || i.has(c))
3364
3449
  return;
3365
- const h = (async () => {
3450
+ const b = (async () => {
3366
3451
  const A = await l();
3367
- if (a || n.has(u))
3452
+ if (a || n.has(c))
3368
3453
  return;
3369
- const f = t.services.placeholder.createContainer(u), v = await e.mount({
3454
+ const f = t.services.placeholder.createContainer(c), v = await e.mount({
3370
3455
  api: A,
3371
- placeholder: u,
3456
+ placeholder: c,
3372
3457
  container: f,
3373
3458
  services: t.services,
3374
3459
  options: t.options,
3375
3460
  provider: t.options.provider
3376
3461
  });
3377
- n.set(u, v), o = u, G.log("Mounted captcha placeholder widget.", {
3462
+ n.set(c, v), o = c, G.log("Mounted captcha placeholder widget.", {
3378
3463
  moduleId: e.id
3379
3464
  });
3380
3465
  })().finally(() => {
3381
- i.delete(u);
3466
+ i.delete(c);
3382
3467
  });
3383
- i.set(u, h), await h;
3384
- }, y = t.services.placeholder.observe(
3385
- (u) => {
3386
- o = u, p(u);
3468
+ i.set(c, b), await b;
3469
+ }, h = t.services.placeholder.observe(
3470
+ (c) => {
3471
+ o = c, p(c);
3387
3472
  },
3388
- (u) => {
3389
- d(u);
3473
+ (c) => {
3474
+ d(c);
3390
3475
  }
3391
3476
  );
3392
- r.push(y.cleanup);
3393
- const c = async (u) => {
3394
- const A = y.getVisible();
3477
+ r.push(h.cleanup);
3478
+ const u = async (c) => {
3479
+ const A = h.getVisible();
3395
3480
  if (e.reset) {
3396
3481
  const f = await l();
3397
3482
  for (const v of A) {
@@ -3407,47 +3492,47 @@ function ho(e) {
3407
3492
  services: t.services,
3408
3493
  options: t.options,
3409
3494
  provider: t.options.provider,
3410
- reason: u
3495
+ reason: c
3411
3496
  }), t.services.tokens.clear(), t.services.errors.clear(v);
3412
3497
  }
3413
- y.reconcile();
3498
+ h.reconcile();
3414
3499
  return;
3415
3500
  }
3416
3501
  for (const f of Array.from(n.keys()))
3417
3502
  await d(f);
3418
3503
  for (const f of A)
3419
3504
  await p(f);
3420
- y.reconcile();
3505
+ h.reconcile();
3421
3506
  };
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"), () => {
3507
+ return r.push(t.services.events.onRoot("formie:submit:result", (c) => {
3508
+ const b = c instanceof CustomEvent ? c.detail : null;
3509
+ b?.stage !== "validate" && (b?.ok === !1 && b?.stage === "screen" || b?.ok !== !0 && u("submit-result"));
3510
+ })), t.form && r.push(t.services.events.onForm(Be("reset"), () => {
3426
3511
  o = t.services.placeholder.getPrimary() || o, window.setTimeout(() => {
3427
- c("reset-state");
3512
+ u("reset-state");
3428
3513
  }, 0);
3429
3514
  })), {
3430
3515
  destroy: async () => {
3431
- a = !0, r.forEach((u) => {
3432
- u();
3516
+ a = !0, r.forEach((c) => {
3517
+ c();
3433
3518
  });
3434
- for (const u of Array.from(n.keys()))
3435
- await d(u);
3519
+ for (const c of Array.from(n.keys()))
3520
+ await d(c);
3436
3521
  },
3437
- onBeforeStage: async (u) => {
3438
- if (u.stage !== "screen" || u.action !== "submit")
3522
+ onBeforeStage: async (c) => {
3523
+ if (c.stage !== "screen" || c.action !== "submit")
3439
3524
  return;
3440
- const h = y.getVisible();
3441
- if (h.length === 0)
3525
+ const b = h.getVisible();
3526
+ if (b.length === 0)
3442
3527
  return;
3443
- let A = h.find((E) => E === o) || h[0];
3528
+ let A = b.find((E) => E === o) || b[0];
3444
3529
  await p(A), A = o || A, t.services.errors.clear(A);
3445
3530
  const f = n.get(A);
3446
3531
  if (!f) {
3447
3532
  const E = t.services.errors.getDefaultMessage();
3448
3533
  t.services.errors.show(E, A), G.warn("Captcha widget unavailable at screen stage.", {
3449
3534
  moduleId: e.id
3450
- }), u.abort(E);
3535
+ }), c.abort(E);
3451
3536
  return;
3452
3537
  }
3453
3538
  const v = await l();
@@ -3458,14 +3543,14 @@ function ho(e) {
3458
3543
  services: t.services,
3459
3544
  options: t.options,
3460
3545
  provider: t.options.provider,
3461
- stageCtx: u
3546
+ stageCtx: c
3462
3547
  });
3463
3548
  }
3464
3549
  };
3465
3550
  }
3466
3551
  });
3467
3552
  }
3468
- const aa = ho, sa = go, $t = 2500, bo = {
3553
+ const pa = To, ga = wo, Ot = 2500, Mo = {
3469
3554
  bpoint: ["bpointToken"],
3470
3555
  stripe: ["stripePaymentIntentId"],
3471
3556
  paypal: ["paypalOrderId", "paypalAuthId"],
@@ -3478,18 +3563,18 @@ const aa = ho, sa = go, $t = 2500, bo = {
3478
3563
  paddle: ["paddleTransactionId"],
3479
3564
  square: ["squarePaymentId"]
3480
3565
  };
3481
- function yo(e) {
3566
+ function Co(e) {
3482
3567
  return e.replace("{field:", "").replace("{", "").replace("}", "").replace("]", "").split("[").join("][");
3483
3568
  }
3484
- function vo(e) {
3485
- return `fields[${yo(e)}]`;
3569
+ function Lo(e) {
3570
+ return `fields[${Co(e)}]`;
3486
3571
  }
3487
- function Eo(e, t) {
3488
- const r = vo(t), n = Array.from(e.querySelectorAll(`[name="${r}"]`)), i = Array.from(e.querySelectorAll(`[name="${r}[]"]`));
3572
+ function Io(e, t) {
3573
+ const r = Lo(t), n = Array.from(e.querySelectorAll(`[name="${r}"]`)), i = Array.from(e.querySelectorAll(`[name="${r}[]"]`));
3489
3574
  return (i.length ? i : n).filter((o) => o instanceof HTMLElement);
3490
3575
  }
3491
- function Vt(e, t) {
3492
- const r = Eo(e, t);
3576
+ function _t(e, t) {
3577
+ const r = Io(e, t);
3493
3578
  for (const n of r) {
3494
3579
  const o = n.closest("[data-formie-field-handle]")?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim();
3495
3580
  if (o)
@@ -3497,32 +3582,32 @@ function Vt(e, t) {
3497
3582
  }
3498
3583
  return "";
3499
3584
  }
3500
- function xe(e) {
3585
+ function Ue(e) {
3501
3586
  let t = e.replace(/[^\d.,-]/g, "");
3502
3587
  const r = t.includes(","), n = t.includes(".");
3503
3588
  return r && n ? t = t.replace(/\./g, "").replace(/,/, ".") : r && !n ? t = t.replace(/,/, ".") : t = t.replace(/,/g, ""), parseFloat(t);
3504
3589
  }
3505
- function So(e) {
3590
+ function Fo(e) {
3506
3591
  return e.replace(/^\{field:/, "").replace(/^\{/, "").replace(/\}$/, "").trim();
3507
3592
  }
3508
3593
  function de(e) {
3509
- return So(e).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
3594
+ return Fo(e).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
3510
3595
  }
3511
- function Tr(e) {
3596
+ function Fr(e) {
3512
3597
  const r = de(e).split(".").filter(Boolean);
3513
3598
  if (!r.length)
3514
3599
  return "";
3515
3600
  const [n, ...i] = r;
3516
3601
  return `fields[${n}]${i.map((o) => `[${o}]`).join("")}`;
3517
3602
  }
3518
- function Ao(e) {
3603
+ function Ro(e) {
3519
3604
  const r = String(e || "").trim().match(/^fields\[([^\]]+)\](.*)$/);
3520
3605
  if (!r)
3521
3606
  return "";
3522
3607
  const n = r[1] || "", i = r[2] || "", o = Array.from(i.matchAll(/\[([^\]]+)\]/g)).map((a) => a[1] || "").filter(Boolean);
3523
3608
  return [n, ...o].join(".");
3524
3609
  }
3525
- function wo(e) {
3610
+ function ko(e) {
3526
3611
  const t = e.split(";").map((a) => a.trim()).filter(Boolean);
3527
3612
  if (!t.length)
3528
3613
  return {
@@ -3548,7 +3633,7 @@ function wo(e) {
3548
3633
  transforms: i
3549
3634
  };
3550
3635
  }
3551
- function Cr(e) {
3636
+ function Rr(e) {
3552
3637
  const t = String(e || "").trim();
3553
3638
  if (!t)
3554
3639
  return {
@@ -3573,7 +3658,7 @@ function Cr(e) {
3573
3658
  isToken: !1,
3574
3659
  isValid: !0
3575
3660
  };
3576
- const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } = wo(o || "");
3661
+ const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } = ko(o || "");
3577
3662
  if (n !== "field")
3578
3663
  return {
3579
3664
  raw: t,
@@ -3585,22 +3670,22 @@ function Cr(e) {
3585
3670
  isToken: !0,
3586
3671
  isValid: !1
3587
3672
  };
3588
- const d = s.indexOf(":"), p = d === -1 ? s : s.slice(0, d), y = d === -1 ? "" : s.slice(d + 1), c = de(p);
3673
+ const d = s.indexOf(":"), p = d === -1 ? s : s.slice(0, d), h = d === -1 ? "" : s.slice(d + 1), u = de(p);
3589
3674
  return {
3590
3675
  raw: t,
3591
3676
  target: "field",
3592
- key: c,
3593
- selector: y.trim(),
3677
+ key: u,
3678
+ selector: h.trim(),
3594
3679
  defaultValue: a.trim(),
3595
3680
  transforms: l,
3596
3681
  isToken: !0,
3597
- isValid: c !== ""
3682
+ isValid: u !== ""
3598
3683
  };
3599
3684
  }
3600
- function To(e) {
3685
+ function qo(e) {
3601
3686
  return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
3602
3687
  }
3603
- function Co(e, t, r) {
3688
+ function Po(e, t, r) {
3604
3689
  const n = t.trim(), i = String(r.name || "").trim();
3605
3690
  if (!n || !i)
3606
3691
  return;
@@ -3611,14 +3696,14 @@ function Co(e, t, r) {
3611
3696
  };
3612
3697
  o.names.includes(i) || o.names.push(i), o.inputs.includes(r) || o.inputs.push(r), e.set(n, o);
3613
3698
  }
3614
- function Mo(e) {
3699
+ function Vo(e) {
3615
3700
  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);
3701
+ return Array.from(e.querySelectorAll("[name]")).filter((n) => qo(n)).forEach((n) => {
3702
+ const i = Ro(n.name);
3703
+ i && Po(t, i, n);
3619
3704
  }), t;
3620
3705
  }
3621
- function Lo(e) {
3706
+ function $o(e) {
3622
3707
  if (!e.length)
3623
3708
  return "";
3624
3709
  const t = e[0];
@@ -3630,33 +3715,33 @@ function Lo(e) {
3630
3715
  }
3631
3716
  return t.value;
3632
3717
  }
3633
- function Mr(e, t) {
3718
+ function kr(e, t) {
3634
3719
  return e.get(de(t)) || null;
3635
3720
  }
3636
- function Io(e, t) {
3637
- const r = Cr(e), n = r.key, i = Mr(t, n);
3721
+ function Ho(e, t) {
3722
+ const r = Rr(e), n = r.key, i = kr(t, n);
3638
3723
  if (!i)
3639
3724
  return {
3640
3725
  key: n,
3641
3726
  value: r.defaultValue,
3642
3727
  found: !1
3643
3728
  };
3644
- const o = Lo(i.inputs);
3729
+ const o = $o(i.inputs);
3645
3730
  return {
3646
3731
  key: n,
3647
3732
  value: o === "" && r.defaultValue !== "" ? r.defaultValue : o,
3648
3733
  found: !0
3649
3734
  };
3650
3735
  }
3651
- function la(e, t, r) {
3652
- const n = Cr(e), i = n.key;
3736
+ function ha(e, t, r) {
3737
+ const n = Rr(e), i = n.key;
3653
3738
  if (!i)
3654
3739
  return {
3655
3740
  key: i,
3656
3741
  value: n.defaultValue,
3657
3742
  found: !1
3658
3743
  };
3659
- const o = r ? Mr(r, i) : null, s = (o?.names?.length ? o.names : [Tr(i)]).flatMap((l) => {
3744
+ const o = r ? kr(r, i) : null, s = (o?.names?.length ? o.names : [Fr(i)]).flatMap((l) => {
3660
3745
  const d = t.getAll(l).map((p) => String(p ?? ""));
3661
3746
  return d.length ? d : t.getAll(`${l}[]`).map((p) => String(p ?? ""));
3662
3747
  }).filter((l) => l !== "");
@@ -3670,13 +3755,13 @@ function la(e, t, r) {
3670
3755
  found: !1
3671
3756
  };
3672
3757
  }
3673
- function Lr(e, t) {
3758
+ function qr(e, t) {
3674
3759
  const r = t.replace(/"/g, '\\"');
3675
3760
  return e.querySelector(`input[name$="[${r}]"]`) || e.querySelector(`input[name$="${r}"]`);
3676
3761
  }
3677
- function Se(e, t) {
3762
+ function Ae(e, t) {
3678
3763
  const r = t.find((n) => {
3679
- const i = Lr(e, n);
3764
+ const i = qr(e, n);
3680
3765
  return !i || String(i.value || "").trim() === "";
3681
3766
  });
3682
3767
  return {
@@ -3684,98 +3769,98 @@ function Se(e, t) {
3684
3769
  missingSuffix: r
3685
3770
  };
3686
3771
  }
3687
- async function Ir(e, t, r) {
3688
- const n = Se(e, t);
3772
+ async function Pr(e, t, r) {
3773
+ const n = Ae(e, t);
3689
3774
  if (n.ok)
3690
3775
  return n;
3691
3776
  const i = Date.now() + Math.max(r, 0);
3692
3777
  for (; Date.now() < i; ) {
3693
- await mt(120);
3694
- const o = Se(e, t);
3778
+ await ht(120);
3779
+ const o = Ae(e, t);
3695
3780
  if (o.ok)
3696
3781
  return o;
3697
3782
  }
3698
- return Se(e, t);
3783
+ return Ae(e, t);
3699
3784
  }
3700
- const Fo = /* @__PURE__ */ new Set([
3785
+ const Oo = /* @__PURE__ */ new Set([
3701
3786
  "handle",
3702
3787
  "requiredInputSuffixes",
3703
3788
  "waitForValueMs",
3704
3789
  "errorMessage"
3705
- ]), Ot = "[data-payment-success]", Ht = "[data-payment-error]";
3706
- function Ro(e, t) {
3790
+ ]), Dt = "[data-payment-success]", xt = "[data-payment-error]";
3791
+ function _o(e, t) {
3707
3792
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
3708
3793
  }
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.";
3794
+ function Do(e, t, r) {
3795
+ const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (Oo.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 ?? Ot), s = typeof n.errorMessage == "string" && n.errorMessage.trim() !== "" ? n.errorMessage.trim() : "Payment authorization is incomplete.";
3711
3796
  return {
3712
- handle: Ro(e, n),
3797
+ handle: _o(e, n),
3713
3798
  transport: {
3714
3799
  requiredInputSuffixes: o,
3715
- waitForValueMs: Number.isFinite(a) ? a : $t,
3800
+ waitForValueMs: Number.isFinite(a) ? a : Ot,
3716
3801
  errorMessage: s
3717
3802
  },
3718
3803
  provider: i
3719
3804
  };
3720
3805
  }
3721
- function _t(e, t, r) {
3806
+ function Nt(e, t, r) {
3722
3807
  return e.addEventListener(t, r), () => {
3723
3808
  e.removeEventListener(t, r);
3724
3809
  };
3725
3810
  }
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;
3811
+ function xo(e, t) {
3812
+ const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () => Vo(n || i), l = (y) => {
3813
+ const g = Ho(y, s()).value;
3729
3814
  return Array.isArray(g) ? g[0] || "" : String(g || "");
3730
3815
  };
3731
3816
  return {
3732
3817
  root: i,
3733
3818
  form: n,
3734
3819
  field: r,
3735
- updateInputs: (b, m) => {
3736
- const g = Array.isArray(b) ? b : [b];
3820
+ updateInputs: (y, m) => {
3821
+ const g = Array.isArray(y) ? y : [y];
3737
3822
  for (const S of g) {
3738
- const C = Lr(o, S) ?? r.querySelector(`input[name*="${S}"]`);
3739
- C && (C.value = m);
3823
+ const M = qr(o, S) ?? r.querySelector(`input[name*="${S}"]`);
3824
+ M && (M.value = m);
3740
3825
  }
3741
3826
  },
3742
- addError: (b) => {
3743
- const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Ht);
3827
+ addError: (y) => {
3828
+ const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(xt);
3744
3829
  g && g.remove();
3745
3830
  const S = document.createElement("div");
3746
- S.setAttribute("data-payment-error", ""), S.textContent = b, V(S, n || i, "fieldError"), m.appendChild(S);
3831
+ S.setAttribute("data-payment-error", ""), S.textContent = y, $(S, n || i, "fieldError"), m.appendChild(S);
3747
3832
  },
3748
3833
  removeError: () => {
3749
- r.querySelector(Ht)?.remove();
3834
+ r.querySelector(xt)?.remove();
3750
3835
  },
3751
- addSuccess: (b) => {
3752
- const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Ot);
3836
+ addSuccess: (y) => {
3837
+ const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Dt);
3753
3838
  g && g.remove();
3754
3839
  const S = document.createElement("div");
3755
- S.setAttribute("data-payment-success", ""), S.textContent = b, V(S, n || i, "successMessage"), m.appendChild(S);
3840
+ S.setAttribute("data-payment-success", ""), S.textContent = y, $(S, n || i, "successMessage"), m.appendChild(S);
3756
3841
  },
3757
3842
  removeSuccess: () => {
3758
- r.querySelector(Ot)?.remove();
3843
+ r.querySelector(Dt)?.remove();
3759
3844
  },
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;
3845
+ hasToken: () => Ae(o, a).ok,
3846
+ waitForToken: (y = t.transport.waitForValueMs) => Pr(o, a, y).then((m) => m.ok),
3847
+ getFieldValue: (y, m = "string") => {
3848
+ const g = l(y);
3849
+ return m === "float" || m === "int" || m === "number" ? Ue(g) : g;
3765
3850
  },
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);
3851
+ resolveAmount: (y) => {
3852
+ 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(), F = typeof M == "number" ? M : Ue(T);
3768
3853
  if (Number.isFinite(F) && F > 0)
3769
3854
  return { ok: !0, value: F };
3770
3855
  if (T !== "") {
3771
- const k = l(T), w = xe(k);
3856
+ const q = l(T), w = Ue(q);
3772
3857
  if (Number.isFinite(w) && w > 0)
3773
3858
  return { ok: !0, value: w };
3774
- const q = Vt(m, T);
3775
- if (!k)
3859
+ const P = _t(m, T);
3860
+ if (!q)
3776
3861
  return {
3777
3862
  ok: !1,
3778
- error: q ? x('Provide a value for "{label}" to proceed.', { label: q }) : x("Provide a payment amount to proceed.")
3863
+ error: P ? x('Provide a value for "{label}" to proceed.', { label: P }) : x("Provide a payment amount to proceed.")
3779
3864
  };
3780
3865
  }
3781
3866
  return {
@@ -3783,19 +3868,19 @@ function qo(e, t) {
3783
3868
  error: x("Payment amount must be greater than 0.")
3784
3869
  };
3785
3870
  },
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();
3871
+ resolveCurrency: (y) => {
3872
+ 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(), F = T.toUpperCase();
3788
3873
  if (/^[A-Z]{3}$/.test(F) && !S)
3789
3874
  return { ok: !0, value: F };
3790
3875
  if (T !== "") {
3791
- const k = String(l(T) || "").trim(), w = k.toUpperCase();
3876
+ const q = String(l(T) || "").trim(), w = q.toUpperCase();
3792
3877
  if (/^[A-Z]{3}$/.test(w))
3793
3878
  return { ok: !0, value: w };
3794
- const q = Vt(m, T);
3795
- if (!k)
3879
+ const P = _t(m, T);
3880
+ if (!q)
3796
3881
  return {
3797
3882
  ok: !1,
3798
- error: q ? x('Provide a value for "{label}" to proceed.', { label: q }) : x("Provide a payment currency to proceed.")
3883
+ error: P ? x('Provide a value for "{label}" to proceed.', { label: P }) : x("Provide a payment currency to proceed.")
3799
3884
  };
3800
3885
  }
3801
3886
  return {
@@ -3803,28 +3888,28 @@ function qo(e, t) {
3803
3888
  error: x("Payment currency must be a valid 3-letter code.")
3804
3889
  };
3805
3890
  },
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)
3891
+ watchFieldValueChanges: (y, m, g = 600) => {
3892
+ const S = n || i, M = y.map((P) => String(P || "").trim()).filter(Boolean);
3893
+ if (M.length === 0)
3809
3894
  return () => {
3810
3895
  };
3811
3896
  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) => {
3897
+ M.forEach((P) => {
3898
+ const N = de(P), j = T.get(N);
3899
+ if (j?.names?.length) {
3900
+ j.names.forEach((fe) => {
3816
3901
  F.add(fe);
3817
3902
  });
3818
3903
  return;
3819
3904
  }
3820
- const Y = Tr(N);
3905
+ const Y = Fr(N);
3821
3906
  Y && (F.add(Y), F.add(`${Y}[]`));
3822
3907
  });
3823
- const k = vr(() => {
3908
+ const q = Tr(() => {
3824
3909
  m();
3825
- }, g), w = (q) => {
3826
- const B = q.target?.name || "";
3827
- !B || !F.has(B) || k();
3910
+ }, g), w = (P) => {
3911
+ const j = P.target?.name || "";
3912
+ !j || !F.has(j) || q();
3828
3913
  };
3829
3914
  return S.addEventListener("input", w), S.addEventListener("change", w), () => {
3830
3915
  S.removeEventListener("input", w), S.removeEventListener("change", w);
@@ -3834,40 +3919,40 @@ function qo(e, t) {
3834
3919
  n && n.setAttribute("data-formie-internal-resubmit", "true"), n && typeof n.requestSubmit == "function" ? n.requestSubmit() : n && n.submit();
3835
3920
  },
3836
3921
  releaseSubmitLoading: () => {
3837
- n && (n.removeAttribute("data-formie-internal-resubmit"), Te(n));
3922
+ n && (n.removeAttribute("data-formie-internal-resubmit"), Me(n));
3838
3923
  },
3839
- getBillingData: (b) => {
3924
+ getBillingData: (y) => {
3840
3925
  const m = {};
3841
- if (!b || typeof b != "object")
3926
+ if (!y || typeof y != "object")
3842
3927
  return { billing_details: m };
3843
- if (b.billingName) {
3844
- const g = l(b.billingName);
3928
+ if (y.billingName) {
3929
+ const g = l(y.billingName);
3845
3930
  g && (m.name = g);
3846
3931
  }
3847
- if (b.billingEmail) {
3848
- const g = l(b.billingEmail);
3932
+ if (y.billingEmail) {
3933
+ const g = l(y.billingEmail);
3849
3934
  g && (m.email = g);
3850
3935
  }
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);
3936
+ if (y.billingAddress) {
3937
+ const g = y.billingAddress, S = {}, M = l(`${g}.address1`), T = l(`${g}.address2`), F = l(`${g}.address3`), q = l(`${g}.city`), w = l(`${g}.zip`), P = l(`${g}.state`), N = l(`${g}.country`);
3938
+ M && (S.line1 = M), T && (S.line2 = T), F && (S.line3 = F), q && (S.city = q), w && (S.postal_code = w), P && (S.state = P), N && (S.country = N), Object.keys(S).length && (m.address = S);
3854
3939
  }
3855
3940
  return { billing_details: m };
3856
3941
  },
3857
3942
  events: {
3858
- onForm: (b, m) => n ? _t(n, b, m) : () => {
3943
+ onForm: (y, m) => n ? Nt(n, y, m) : () => {
3859
3944
  },
3860
- onRoot: (b, m) => _t(i, b, m)
3945
+ onRoot: (y, m) => Nt(i, y, m)
3861
3946
  }
3862
3947
  };
3863
3948
  }
3864
3949
  const U = _("payments");
3865
- function Dt(e) {
3950
+ function Ut(e) {
3866
3951
  const t = e;
3867
3952
  return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
3868
3953
  }
3869
- function Po(e) {
3870
- const t = e.defaultRequiredInputSuffixes ?? bo[e.id] ?? [];
3954
+ function No(e) {
3955
+ const t = e.defaultRequiredInputSuffixes ?? Mo[e.id] ?? [];
3871
3956
  return {
3872
3957
  id: e.id,
3873
3958
  kind: "payment",
@@ -3885,24 +3970,24 @@ function Po(e) {
3885
3970
  } catch {
3886
3971
  }
3887
3972
  }
3888
- const a = ko(
3973
+ const a = Do(
3889
3974
  e.id,
3890
3975
  r.options || {},
3891
3976
  {
3892
3977
  defaultRequiredInputSuffixes: t
3893
3978
  }
3894
- ), s = qo(r, a), l = {
3979
+ ), s = xo(r, a), l = {
3895
3980
  ...r,
3896
3981
  options: a,
3897
3982
  services: s
3898
3983
  }, 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))
3984
+ let p = null, h = null, u = null, c = null;
3985
+ const b = async () => (p || (U.log("Loading payment provider API.", { moduleId: e.id }), p = e.load(l)), p), A = async () => {
3986
+ if (!e.mount || h || !Ut(r.target))
3902
3987
  return;
3903
- const E = await h();
3988
+ const E = await b();
3904
3989
  try {
3905
- y = await e.mount({
3990
+ h = await e.mount({
3906
3991
  api: E,
3907
3992
  field: r.target,
3908
3993
  services: s,
@@ -3923,25 +4008,25 @@ function Po(e) {
3923
4008
  s.removeError(), s.removeSuccess();
3924
4009
  })), e.setup) {
3925
4010
  const E = r.root || r.form || r.target;
3926
- c = await e.setup({ ...l, root: E }), c.destroy && d.push(c.destroy);
4011
+ u = await e.setup({ ...l, root: E }), u.destroy && d.push(u.destroy);
3927
4012
  }
3928
- e.mount && Dt(r.target) && await A(), ["formie:page:navigate:after", "formie:submit:result"].forEach((E) => {
3929
- const b = () => {
4013
+ e.mount && Ut(r.target) && await A(), ["formie:page:navigate:after", "formie:submit:result"].forEach((E) => {
4014
+ const y = () => {
3930
4015
  A();
3931
4016
  };
3932
- r.root.addEventListener(E, b), d.push(() => {
3933
- r.root.removeEventListener(E, b);
4017
+ r.root.addEventListener(E, y), d.push(() => {
4018
+ r.root.removeEventListener(E, y);
3934
4019
  });
3935
4020
  });
3936
4021
  const v = async () => {
3937
4022
  if (U.log("Destroying payment module.", {
3938
4023
  moduleId: e.id,
3939
4024
  handle: a.handle
3940
- }), d.forEach((E) => E()), y && e.unmount) {
3941
- const E = await h();
4025
+ }), d.forEach((E) => E()), h && e.unmount) {
4026
+ const E = await b();
3942
4027
  await e.unmount({
3943
4028
  api: E,
3944
- widget: y,
4029
+ widget: h,
3945
4030
  field: r.target,
3946
4031
  services: s,
3947
4032
  options: a,
@@ -3959,27 +4044,27 @@ function Po(e) {
3959
4044
  return i[e.id] = { destroy: v }, {
3960
4045
  destroy: v,
3961
4046
  onBeforeStage: async (E) => {
3962
- if (c?.onBeforeStage) {
3963
- await c.onBeforeStage(E);
4047
+ if (u?.onBeforeStage) {
4048
+ await u.onBeforeStage(E);
3964
4049
  return;
3965
4050
  }
3966
4051
  if (E.stage !== "authorize" || E.action !== "submit" || r.target.closest("[data-formie-page]")?.hasAttribute("data-formie-page-hidden"))
3967
4052
  return;
3968
4053
  await A();
3969
- const g = await h();
4054
+ const g = await b();
3970
4055
  if (e.onBeforeAuthorize) {
3971
- u || (u = (async () => e.onBeforeAuthorize({
4056
+ c || (c = (async () => e.onBeforeAuthorize({
3972
4057
  api: g,
3973
- widget: y,
4058
+ widget: h,
3974
4059
  field: r.target,
3975
4060
  services: s,
3976
4061
  options: a,
3977
4062
  provider: a.provider,
3978
4063
  stageCtx: E
3979
4064
  }))().finally(() => {
3980
- u = null;
4065
+ c = null;
3981
4066
  }));
3982
- const T = await u;
4067
+ const T = await c;
3983
4068
  if (U.log("onBeforeAuthorize resolved.", {
3984
4069
  moduleId: e.id,
3985
4070
  handle: a.handle,
@@ -3992,31 +4077,31 @@ function Po(e) {
3992
4077
  }
3993
4078
  if (a.transport.requiredInputSuffixes.length === 0)
3994
4079
  return;
3995
- const S = r.form || r.root, C = await Ir(
4080
+ const S = r.form || r.root, M = await Pr(
3996
4081
  S,
3997
4082
  a.transport.requiredInputSuffixes,
3998
4083
  a.transport.waitForValueMs
3999
4084
  );
4000
- C.ok || (U.warn("Required payment input(s) missing.", {
4085
+ M.ok || (U.warn("Required payment input(s) missing.", {
4001
4086
  moduleId: e.id,
4002
4087
  handle: a.handle,
4003
- missingSuffix: C.missingSuffix
4088
+ missingSuffix: M.missingSuffix
4004
4089
  }), E.abort(a.transport.errorMessage));
4005
4090
  },
4006
- onAfterStage: async (E, b) => {
4091
+ onAfterStage: async (E, y) => {
4007
4092
  E.stage !== "dispatch" || !e.onAfterSubmit || await e.onAfterSubmit({
4008
4093
  field: r.target,
4009
4094
  services: s,
4010
4095
  options: a,
4011
4096
  provider: a.provider,
4012
- result: b
4097
+ result: y
4013
4098
  });
4014
4099
  }
4015
4100
  };
4016
4101
  }
4017
4102
  };
4018
4103
  }
4019
- const ua = Po, $o = "[data-formie-address-autocomplete-input]", xt = "[data-formie-address-location]", Vo = {
4104
+ const ba = No, Uo = "[data-formie-address-autocomplete-input]", zt = "[data-formie-address-location]", zo = {
4020
4105
  autoComplete: "[data-formie-address-autocomplete-input]",
4021
4106
  address1: "[data-formie-address-line1-input]",
4022
4107
  address2: "[data-formie-address-line2-input]",
@@ -4025,24 +4110,24 @@ const ua = Po, $o = "[data-formie-address-autocomplete-input]", xt = "[data-form
4025
4110
  state: "[data-formie-address-state-input]",
4026
4111
  zip: "[data-formie-address-zip-input]",
4027
4112
  country: "[data-formie-address-country-input]"
4028
- }, Oo = /* @__PURE__ */ new Set(["handle"]);
4029
- function Ho(e, t) {
4113
+ }, Bo = /* @__PURE__ */ new Set(["handle"]);
4114
+ function jo(e, t) {
4030
4115
  return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
4031
4116
  }
4032
- function _o(e, t) {
4033
- const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (Oo.has(o) || (i[o] = a), i), {});
4117
+ function Wo(e, t) {
4118
+ const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (Bo.has(o) || (i[o] = a), i), {});
4034
4119
  return {
4035
- handle: Ho(e, r),
4120
+ handle: jo(e, r),
4036
4121
  provider: n
4037
4122
  };
4038
4123
  }
4039
- function Do(e, t, r) {
4124
+ function Ko(e, t, r) {
4040
4125
  return e.addEventListener(t, r), () => {
4041
4126
  e.removeEventListener(t, r);
4042
4127
  };
4043
4128
  }
4044
- function xo(e) {
4045
- const t = e.target, r = e.form, n = e.root, i = $o;
4129
+ function Go(e) {
4130
+ const t = e.target, r = e.form, n = e.root, i = Uo;
4046
4131
  return {
4047
4132
  root: n,
4048
4133
  field: t,
@@ -4050,14 +4135,14 @@ function xo(e) {
4050
4135
  input: {
4051
4136
  getAutocomplete: () => t.querySelector(i),
4052
4137
  setValue: (o, a, s) => {
4053
- const l = Vo[o], d = t.querySelector(l);
4138
+ const l = zo[o], d = t.querySelector(l);
4054
4139
  d && (d.value = a || s || "");
4055
4140
  }
4056
4141
  },
4057
4142
  location: {
4058
- getButton: () => t.querySelector(xt),
4143
+ getButton: () => t.querySelector(zt),
4059
4144
  onUseLocation: (o) => {
4060
- const a = t.querySelector(xt);
4145
+ const a = t.querySelector(zt);
4061
4146
  if (!a)
4062
4147
  return () => {
4063
4148
  };
@@ -4075,22 +4160,22 @@ function xo(e) {
4075
4160
  }
4076
4161
  },
4077
4162
  events: {
4078
- onField: (o, a) => Do(t, o, a)
4163
+ onField: (o, a) => Ko(t, o, a)
4079
4164
  }
4080
4165
  };
4081
4166
  }
4082
4167
  const te = _("address");
4083
- function Nt(e) {
4168
+ function Bt(e) {
4084
4169
  const t = e;
4085
4170
  return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
4086
4171
  }
4087
- function No(e) {
4172
+ function Jo(e) {
4088
4173
  return {
4089
4174
  id: e.id,
4090
4175
  kind: "address",
4091
4176
  match: (t) => !!t.target.querySelector("[data-formie-address-autocomplete-input]"),
4092
4177
  setup: async (t) => {
4093
- const r = _o(e.id, t.options || {}), n = xo(t);
4178
+ const r = Wo(e.id, t.options || {}), n = Go(t);
4094
4179
  te.log("Setup module.", {
4095
4180
  moduleId: e.id
4096
4181
  });
@@ -4112,11 +4197,11 @@ function No(e) {
4112
4197
  const d = async () => (a || (te.log("Loading provider API.", {
4113
4198
  moduleId: e.id
4114
4199
  }), a = e.load(i)), a), p = async () => {
4115
- if (s || !Nt(t.target))
4200
+ if (s || !Bt(t.target))
4116
4201
  return;
4117
- const u = await d();
4202
+ const c = await d();
4118
4203
  s = await e.mount({
4119
- api: u,
4204
+ api: c,
4120
4205
  field: t.target,
4121
4206
  services: n,
4122
4207
  options: r,
@@ -4125,21 +4210,21 @@ function No(e) {
4125
4210
  moduleId: e.id
4126
4211
  });
4127
4212
  };
4128
- Nt(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((u) => {
4129
- const h = () => {
4213
+ Bt(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((c) => {
4214
+ const b = () => {
4130
4215
  p();
4131
4216
  };
4132
- t.root.addEventListener(u, h), o.push(() => {
4133
- t.root.removeEventListener(u, h);
4217
+ t.root.addEventListener(c, b), o.push(() => {
4218
+ t.root.removeEventListener(c, b);
4134
4219
  });
4135
4220
  });
4136
- const c = n.location.onUseLocation((u) => {
4221
+ const u = n.location.onUseLocation((c) => {
4137
4222
  e.onCurrentLocation && (async () => {
4138
4223
  if (await p(), !s)
4139
4224
  return;
4140
- const h = await d();
4141
- await e.onCurrentLocation?.(u, {
4142
- api: h,
4225
+ const b = await d();
4226
+ await e.onCurrentLocation?.(c, {
4227
+ api: b,
4143
4228
  widget: s,
4144
4229
  field: t.target,
4145
4230
  services: n,
@@ -4148,14 +4233,14 @@ function No(e) {
4148
4233
  });
4149
4234
  })();
4150
4235
  });
4151
- return c && o.push(c), {
4236
+ return u && o.push(u), {
4152
4237
  destroy: async () => {
4153
4238
  if (te.log("Destroying module.", {
4154
4239
  moduleId: e.id
4155
- }), o.forEach((u) => u()), s && e.unmount) {
4156
- const u = await d();
4240
+ }), o.forEach((c) => c()), s && e.unmount) {
4241
+ const c = await d();
4157
4242
  await e.unmount({
4158
- api: u,
4243
+ api: c,
4159
4244
  widget: s,
4160
4245
  field: t.target,
4161
4246
  services: n,
@@ -4170,60 +4255,60 @@ function No(e) {
4170
4255
  }
4171
4256
  };
4172
4257
  }
4173
- const ca = No;
4258
+ const ya = Jo;
4174
4259
  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,
4260
+ aa as $,
4261
+ zo as A,
4262
+ Yo as B,
4263
+ ua as C,
4264
+ Kr as D,
4265
+ Gr as E,
4266
+ xr as F,
4267
+ to as G,
4268
+ Jr as H,
4269
+ Yr as I,
4270
+ la as J,
4271
+ nr as K,
4272
+ _r as L,
4273
+ yr as M,
4274
+ Ur as N,
4275
+ Nr as O,
4276
+ sa as P,
4277
+ Ro as Q,
4278
+ Wt as R,
4279
+ oa as S,
4280
+ Zo as T,
4281
+ Rr as U,
4282
+ ha as V,
4283
+ Dr as W,
4284
+ ra as X,
4285
+ ia as Y,
4201
4286
  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,
4287
+ ze as _,
4288
+ pa as a,
4289
+ ma as b,
4290
+ da as c,
4291
+ ya as d,
4292
+ ga as e,
4293
+ ca as f,
4294
+ Xo as g,
4210
4295
  _ as h,
4211
- Mo as i,
4212
- Tr as j,
4213
- Wo as k,
4214
- Ue as l,
4215
- Ie as m,
4296
+ Vo as i,
4297
+ Fr as j,
4298
+ Qo as k,
4299
+ ea as l,
4300
+ Be as m,
4216
4301
  de as n,
4217
- vr as o,
4218
- Jo as p,
4219
- jo as q,
4220
- Io as r,
4221
- mt as s,
4302
+ Fe as o,
4303
+ Tr as p,
4304
+ na as q,
4305
+ Ho as r,
4306
+ ht as s,
4222
4307
  ue as t,
4223
- ua as u,
4224
- Ko as v,
4225
- ia as w,
4226
- V as x,
4308
+ ba as u,
4309
+ ta as v,
4310
+ fa as w,
4311
+ $ as x,
4227
4312
  le as y,
4228
- Rn as z
4313
+ Vn as z
4229
4314
  };