@verbb/formie-browser 1.0.5 → 1.0.7

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 (98) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/chunks/{address-finder-yXU5yMjG.js → address-finder-k7_BXaRe.js} +1 -1
  3. package/dist/chunks/{api-DMK8NSUI.js → api-BUb6P-xu.js} +57 -51
  4. package/dist/chunks/{api-CmwLRq_n.js → api-DztsCJ4r.js} +178 -170
  5. package/dist/chunks/{bpoint-DSjqRv63.js → bpoint-2qDxlKD9.js} +1 -1
  6. package/dist/chunks/{calculations-CgVJcQ2P.js → calculations-CeDgB9jt.js} +13 -13
  7. package/dist/chunks/{captcha-eu-CWJb64_j.js → captcha-eu-CGm8Lbrj.js} +2 -2
  8. package/dist/chunks/{conditions-CZ3FU5QO.js → conditions-B6_nzpeE.js} +97 -85
  9. package/dist/chunks/dist-BQ4a9hmy.js +2659 -0
  10. package/dist/chunks/{eway-D3ctTbEk.js → eway-CImXrB4g.js} +2 -2
  11. package/dist/chunks/{friendly-captcha-v1-ByXzENYZ.js → friendly-captcha-v1-C_2reOXr.js} +1 -1
  12. package/dist/chunks/{friendly-captcha-v2-BPdlmhQu.js → friendly-captcha-v2-CLSAbkqx.js} +1 -1
  13. package/dist/chunks/{go-cardless-BwASSYSK.js → go-cardless-Bz7HHtH0.js} +1 -1
  14. package/dist/chunks/{google-address-OhKilPWE.js → google-address-BH3Zhi06.js} +1 -1
  15. package/dist/chunks/{hcaptcha-CdCd9oEi.js → hcaptcha-CGLAmgjO.js} +2 -2
  16. package/dist/chunks/{loqate-Cp2zvwpE.js → loqate-CJPzBmSm.js} +1 -1
  17. package/dist/chunks/{mollie-COG-ko2D.js → mollie-BtnB3KGh.js} +1 -1
  18. package/dist/chunks/{moneris-CMH8PlRc.js → moneris-Bd4vUk8b.js} +1 -1
  19. package/dist/chunks/{opayo-D2jsR5vh.js → opayo-B-eRIXo-.js} +4 -4
  20. package/dist/chunks/{paddle-DxF88RfC.js → paddle-BUFeEU4d.js} +2 -2
  21. package/dist/chunks/{paypal-b5pnwrA2.js → paypal-8Euw7Hrn.js} +2 -2
  22. package/dist/chunks/{payway-BJYu9DIR.js → payway-dV0SzJxy.js} +2 -2
  23. package/dist/chunks/{recaptcha-enterprise-BSwi8IVX.js → recaptcha-enterprise-XPId5-bS.js} +19 -20
  24. package/dist/chunks/{recaptcha-shared-B4zAescW.js → recaptcha-shared-CLYJvojk.js} +15 -3
  25. package/dist/chunks/{recaptcha-v2-checkbox-CnDQmsKa.js → recaptcha-v2-checkbox-Cy-0PEPc.js} +2 -2
  26. package/dist/chunks/{recaptcha-v2-invisible-Cz5uIlp-.js → recaptcha-v2-invisible-BwRH540O.js} +2 -2
  27. package/dist/chunks/recaptcha-v3-No4Ykrhk.js +28 -0
  28. package/dist/chunks/rich-text-D0sb8bmX.js +349 -0
  29. package/dist/chunks/scripts-CbQ7agX3.js +30 -0
  30. package/dist/chunks/{signature-CpgqHCEx.js → signature-xz4QO7CR.js} +107 -34
  31. package/dist/chunks/{snaptcha-vz1RnZ15.js → snaptcha-DKx98oon.js} +1 -1
  32. package/dist/chunks/{square-BP8RWAKB.js → square-reyJukb7.js} +2 -2
  33. package/dist/chunks/{stripe-MihN63uC.js → stripe-BC-2PBvY.js} +2 -2
  34. package/dist/chunks/{text-limit-B09elPDB.js → text-limit-DbgEFHLO.js} +1 -1
  35. package/dist/chunks/{turnstile-D_Pi1CKM.js → turnstile-DJakPzQD.js} +3 -3
  36. package/dist/chunks/upload-manager-BpqWSHmU.js +2558 -0
  37. package/dist/css/theme/_buttons.css +16 -0
  38. package/dist/css/theme/_tokens.css +2 -0
  39. package/dist/css/theme/fields/_signature.css +19 -0
  40. package/dist/css/theme/fields/_upload-manager.css +279 -0
  41. package/dist/index.js +629 -578
  42. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  43. package/dist/js/core/error-aria-live.d.ts +6 -0
  44. package/dist/js/core/error-aria-live.d.ts.map +1 -0
  45. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  46. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  47. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  48. package/dist/js/modules/captchas/host.d.ts +1 -0
  49. package/dist/js/modules/captchas/host.d.ts.map +1 -1
  50. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
  51. package/dist/js/modules/captchas/recaptcha-shared.d.ts +1 -0
  52. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -1
  53. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  54. package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
  55. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  56. package/dist/js/modules/fields/index.d.ts.map +1 -1
  57. package/dist/js/modules/fields/signature.d.ts.map +1 -1
  58. package/dist/js/modules/fields/upload-manager.d.ts +3 -0
  59. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -0
  60. package/dist/js/utils/form-started-at.d.ts +2 -0
  61. package/dist/js/utils/form-started-at.d.ts.map +1 -0
  62. package/dist/js/utils/scripts.d.ts.map +1 -1
  63. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  64. package/dist/js/validation/enter-key-guard.d.ts +2 -0
  65. package/dist/js/validation/enter-key-guard.d.ts.map +1 -0
  66. package/dist/js/validation/types.d.ts +1 -0
  67. package/dist/js/validation/types.d.ts.map +1 -1
  68. package/dist/js/validation/validator.d.ts.map +1 -1
  69. package/package.json +4 -2
  70. package/src/css/theme/_buttons.css +16 -0
  71. package/src/css/theme/_tokens.css +2 -0
  72. package/src/css/theme/fields/_signature.css +19 -0
  73. package/src/css/theme/fields/_upload-manager.css +279 -0
  74. package/src/js/core/create-formie-client.ts +7 -0
  75. package/src/js/core/error-aria-live.ts +45 -0
  76. package/src/js/core/submit-result-state.ts +4 -0
  77. package/src/js/core/submit-result-ui.ts +8 -4
  78. package/src/js/modules/captchas/factories.ts +4 -0
  79. package/src/js/modules/captchas/host.ts +14 -2
  80. package/src/js/modules/captchas/recaptcha-enterprise.ts +14 -11
  81. package/src/js/modules/captchas/recaptcha-shared.ts +14 -0
  82. package/src/js/modules/captchas/recaptcha-v3.ts +7 -4
  83. package/src/js/modules/captchas/turnstile.ts +9 -3
  84. package/src/js/modules/fields/conditions/effects.ts +42 -0
  85. package/src/js/modules/fields/index.ts +1 -0
  86. package/src/js/modules/fields/signature.ts +199 -15
  87. package/src/js/modules/fields/upload-manager.ts +1277 -0
  88. package/src/js/utils/form-started-at.ts +25 -0
  89. package/src/js/utils/scripts.ts +16 -0
  90. package/src/js/utils/unload-warning.ts +1 -0
  91. package/src/js/validation/enter-key-guard.ts +63 -0
  92. package/src/js/validation/types.ts +1 -0
  93. package/src/js/validation/validator.ts +14 -5
  94. package/src/vendor.d.ts +1 -1
  95. package/dist/chunks/dist-BF5GU3_9.js +0 -2674
  96. package/dist/chunks/recaptcha-v3-BtbbP111.js +0 -27
  97. package/dist/chunks/rich-text-Cv8ADyk-.js +0 -349
  98. package/dist/chunks/scripts-6CYSUGKQ.js +0 -24
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { c as e, d as t, l as n, o as r, r as i, t as a, u as o } from "./chunks/event-names-BCI2FLD8.js";
2
- import { a as s, i as c, n as l, r as u, t as d } from "./chunks/debug-BV0DvdHx.js";
3
- import { a as f, c as p, d as ee, i as m, l as h, n as g, o as _, r as v, s as y, t as b, u as x } from "./chunks/api-CmwLRq_n.js";
4
- import { n as te, r as S, t as C } from "./chunks/theme-classes-Tv7q7ToE.js";
5
- import { t as w } from "./chunks/http-D-JExro7.js";
6
- import { a as T, i as E, n as ne, r as re, t as ie } from "./chunks/i18n-BY1ds1BL.js";
7
- import { n as ae, t as oe } from "./chunks/api-DMK8NSUI.js";
2
+ import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./chunks/api-DztsCJ4r.js";
3
+ import { a as y, i as b, n as x, r as ee, t as S } from "./chunks/debug-BV0DvdHx.js";
4
+ import { n as te, r as C, t as w } from "./chunks/theme-classes-Tv7q7ToE.js";
5
+ import { t as T } from "./chunks/http-D-JExro7.js";
6
+ import { a as E, i as D, n as ne, r as re, t as ie } from "./chunks/i18n-BY1ds1BL.js";
7
+ import { n as ae, t as oe } from "./chunks/api-BUb6P-xu.js";
8
8
  import { n as se, r as ce, t as le } from "./chunks/field-references.keys-58ZSTrCW.js";
9
9
  import { i as ue, n as de, r as fe, t as pe } from "./chunks/field-references.resolver-CHwn0G0L.js";
10
10
  import { t as me } from "./chunks/api-sPqGbOww.js";
@@ -149,30 +149,30 @@ function Se({ target: e, form: n, instance: r, options: i, unbinds: a }) {
149
149
  }
150
150
  //#endregion
151
151
  //#region src/js/compatibility/validator-adapter.ts
152
- function D(e, t, n) {
152
+ function O(e, t, n) {
153
153
  e.dispatchEvent(new CustomEvent(t, {
154
154
  bubbles: !0,
155
155
  detail: n
156
156
  }));
157
157
  }
158
- function Ce(e, t) {
158
+ function k(e, t) {
159
159
  return !!e && typeof e == "object" && e.validator === t;
160
160
  }
161
- function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
161
+ function Ce({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
162
162
  if (!r.legacyValidatorEvents || !n) return;
163
163
  let { validator: a, addValidator: o, removeValidator: s } = n, c = {
164
164
  ...n,
165
165
  form: t,
166
166
  target: e
167
167
  };
168
- D(document, "formieValidatorInitialized", c);
168
+ O(document, "formieValidatorInitialized", c);
169
169
  let l = (e) => {
170
- !(e instanceof CustomEvent) || !Ce(e.detail, a) || D(document, "formieValidatorDestroyed", {
170
+ !(e instanceof CustomEvent) || !k(e.detail, a) || O(document, "formieValidatorDestroyed", {
171
171
  ...c,
172
172
  ...e.detail
173
173
  });
174
174
  }, u = (n) => {
175
- !(n instanceof CustomEvent) || !Ce(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && D(n.target, "formieValidatorShowError", {
175
+ !(n instanceof CustomEvent) || !k(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && O(n.target, "formieValidatorShowError", {
176
176
  ...n.detail,
177
177
  addValidator: o,
178
178
  removeValidator: s,
@@ -180,7 +180,7 @@ function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
180
180
  target: e
181
181
  });
182
182
  }, d = (n) => {
183
- !(n instanceof CustomEvent) || !Ce(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && D(n.target, "formieValidatorClearError", {
183
+ !(n instanceof CustomEvent) || !k(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && O(n.target, "formieValidatorClearError", {
184
184
  ...n.detail,
185
185
  addValidator: o,
186
186
  removeValidator: s,
@@ -193,47 +193,58 @@ function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
193
193
  });
194
194
  }
195
195
  //#endregion
196
- //#region src/js/core/dom-events.ts
197
- function O(e, n, r) {
198
- e.dispatchEvent(new CustomEvent(t(n), {
199
- bubbles: !0,
200
- detail: r
201
- }));
196
+ //#region src/js/core/error-aria-live.ts
197
+ function we(e) {
198
+ let t = (e.dataset.formieErrorAriaLive || "polite").trim().toLowerCase();
199
+ return t === "assertive" || t === "off" ? t : "polite";
200
+ }
201
+ function Te(e, t) {
202
+ return e === "off" ? null : t ? e : "polite";
203
+ }
204
+ function Ee(e) {
205
+ return e === "off" ? null : e;
206
+ }
207
+ function De(e, t) {
208
+ if (t) {
209
+ e.setAttribute("aria-live", t), e.setAttribute("aria-atomic", "true");
210
+ return;
211
+ }
212
+ e.removeAttribute("aria-live"), e.removeAttribute("aria-atomic");
202
213
  }
203
214
  //#endregion
204
215
  //#region src/js/core/validation-focus.ts
205
- function Te(e, t) {
216
+ function Oe(e, t) {
206
217
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
207
218
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
208
219
  }
209
- function Ee(e) {
220
+ function ke(e) {
210
221
  return Array.from(e.querySelectorAll("[data-formie-field-handle]")).find((e) => e.getAttribute("data-formie-field-has-error") === "true" ? !0 : e.querySelector("[data-formie-field-error]") !== null) || null;
211
222
  }
212
- function De(e) {
223
+ function Ae(e) {
213
224
  return e.querySelector("[aria-invalid=\"true\"]") || e.querySelector("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])");
214
225
  }
215
- function Oe(e) {
226
+ function je(e) {
216
227
  return e.querySelector("[data-formie-message-error], [data-formie-error-container], [data-formie-errors]");
217
228
  }
218
- function ke(e) {
229
+ function Me(e) {
219
230
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
220
231
  let n = t;
221
232
  if (!(n.getAttribute("data-formie-field-has-error") === "true" || n.querySelector("[data-formie-field-error]") !== null)) return;
222
- n.setAttribute("data-formie-field-has-error", "true"), C(n, e, "fieldLayoutError");
233
+ n.setAttribute("data-formie-field-has-error", "true"), w(n, e, "fieldLayoutError");
223
234
  let r = n.querySelector("[data-formie-field-errors]")?.id || "", i = n.querySelector("[data-formie-field-error]")?.id || "";
224
235
  n.querySelectorAll("input, select, textarea").forEach((t) => {
225
236
  let n = t;
226
- n.setAttribute("aria-invalid", "true"), C(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), r && Te(n, r), i && n.setAttribute("aria-errormessage", i);
237
+ n.setAttribute("aria-invalid", "true"), w(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), r && Oe(n, r), i && n.setAttribute("aria-errormessage", i);
227
238
  });
228
239
  });
229
240
  }
230
- function Ae(e) {
231
- return !!Ee(e) || !!Oe(e);
241
+ function Ne(e) {
242
+ return !!ke(e) || !!je(e);
232
243
  }
233
- function je(e) {
234
- let t = Ee(e);
244
+ function Pe(e) {
245
+ let t = ke(e);
235
246
  if (t) {
236
- let e = De(t);
247
+ let e = Ae(t);
237
248
  if (e) {
238
249
  if (e.scrollIntoView({
239
250
  behavior: "smooth",
@@ -250,7 +261,7 @@ function je(e) {
250
261
  block: "center"
251
262
  }), !0;
252
263
  }
253
- let n = Oe(e);
264
+ let n = je(e);
254
265
  return n ? (n.scrollIntoView({
255
266
  behavior: "smooth",
256
267
  block: "center"
@@ -258,7 +269,7 @@ function je(e) {
258
269
  }
259
270
  //#endregion
260
271
  //#region src/js/events/event-bus.ts
261
- var Me = class {
272
+ var Fe = class {
262
273
  constructor() {
263
274
  this.listeners = /* @__PURE__ */ new Map();
264
275
  }
@@ -314,8 +325,8 @@ var Me = class {
314
325
  clear() {
315
326
  this.listeners.clear();
316
327
  }
317
- }, k = d("general", "transport");
318
- function Ne(e) {
328
+ }, A = S("general", "transport");
329
+ function Ie(e) {
319
330
  let t = {};
320
331
  return [
321
332
  "theme",
@@ -326,17 +337,17 @@ function Ne(e) {
326
337
  e[n] !== void 0 && (t[n] = e[n]);
327
338
  }), t;
328
339
  }
329
- function Pe(e, t = "", n = {}) {
340
+ function Le(e, t = "", n = {}) {
330
341
  if (Array.isArray(e)) {
331
342
  let r = e.map((e) => typeof e == "string" ? e : String(e ?? "")).filter((e) => e.trim() !== "");
332
343
  return t && r.length && (n[t] = (n[t] || []).concat(r)), n;
333
344
  }
334
345
  return e && typeof e == "object" && Object.entries(e).forEach(([e, r]) => {
335
- Pe(r, t ? `${t}.${e}` : e, n);
346
+ Le(r, t ? `${t}.${e}` : e, n);
336
347
  }), n;
337
348
  }
338
- function Fe(e, t) {
339
- let n = e.success === !0, r = e.keepSubmitLoading === !0, i = e.errors, a = Pe(i || {}), o = a.form || [], s = {};
349
+ function Re(e, t) {
350
+ let n = e.success === !0, r = e.keepSubmitLoading === !0, i = e.errors, a = Le(i || {}), o = a.form || [], s = {};
340
351
  Object.entries(a).forEach(([e, t]) => {
341
352
  if (e === "form") return;
342
353
  let n = e.split(".")[0];
@@ -360,35 +371,35 @@ function Fe(e, t) {
360
371
  meta: e
361
372
  };
362
373
  }
363
- async function Ie(e, t, n = {}) {
374
+ async function ze(e, t, n = {}) {
364
375
  let r = JSON.stringify({
365
376
  handle: t,
366
377
  renderOptions: n
367
378
  });
368
- k.log("requestRender start.", {
379
+ A.log("requestRender start.", {
369
380
  endpoint: e,
370
381
  handle: t
371
382
  });
372
- let i = await w(e, {
383
+ let i = await T(e, {
373
384
  method: "POST",
374
385
  body: r,
375
386
  headers: { "Content-Type": "application/json" }
376
387
  });
377
- return k.log("requestRender complete.", { hasHtml: !!i.html }), i;
388
+ return A.log("requestRender complete.", { hasHtml: !!i.html }), i;
378
389
  }
379
- async function Le(e, t, n = {}) {
390
+ async function Be(e, t, n = {}) {
380
391
  let r = JSON.stringify({
381
392
  query: "\nquery FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {\n formieHtmlForm(handle: $handle, input: $input) {\n html\n }\n}",
382
393
  variables: {
383
394
  handle: t,
384
- input: Ne(n)
395
+ input: Ie(n)
385
396
  }
386
397
  });
387
- k.log("requestGraphqlRender start.", {
398
+ A.log("requestGraphqlRender start.", {
388
399
  endpoint: e,
389
400
  handle: t
390
401
  });
391
- let i = await w(e, {
402
+ let i = await T(e, {
392
403
  method: "POST",
393
404
  body: r,
394
405
  headers: { "Content-Type": "application/json" }
@@ -396,19 +407,19 @@ async function Le(e, t, n = {}) {
396
407
  if (Array.isArray(i.errors) && i.errors.length > 0) throw Error(i.errors.map((e) => e.message || "Unknown GraphQL error").join("; "));
397
408
  if (!i.data?.formieHtmlForm) throw Error(`Form not found for handle "${t}".`);
398
409
  let a = i.data.formieHtmlForm;
399
- return k.log("requestGraphqlRender complete.", { hasHtml: !!a.html }), a;
410
+ return A.log("requestGraphqlRender complete.", { hasHtml: !!a.html }), a;
400
411
  }
401
- async function Re(e, t, n) {
412
+ async function Ve(e, t, n) {
402
413
  let r = new URL(e, window.location.origin);
403
- r.searchParams.set("handle", t), n && r.searchParams.set("renderId", n), k.log("requestRefreshTokens start.", {
414
+ r.searchParams.set("handle", t), n && r.searchParams.set("renderId", n), A.log("requestRefreshTokens start.", {
404
415
  endpoint: r.toString(),
405
416
  handle: t,
406
417
  hasRenderId: !!n
407
418
  });
408
- let i = await w(r.toString());
409
- return k.log("requestRefreshTokens complete.", { hasRefreshTokens: !!i.refreshTokens }), i.refreshTokens || i;
419
+ let i = await T(r.toString());
420
+ return A.log("requestRefreshTokens complete.", { hasRefreshTokens: !!i.refreshTokens }), i.refreshTokens || i;
410
421
  }
411
- async function ze(e, t, n) {
422
+ async function He(e, t, n) {
412
423
  let r = new URL(e, window.location.origin), i = new FormData();
413
424
  if (n && i.append("pageId", n), t) {
414
425
  [
@@ -424,17 +435,17 @@ async function ze(e, t, n) {
424
435
  let e = t.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]")?.value?.trim();
425
436
  e && i.append("CRAFT_CSRF_TOKEN", e);
426
437
  }
427
- k.log("requestSetPage start.", {
438
+ A.log("requestSetPage start.", {
428
439
  requestUrl: r.toString(),
429
440
  pageId: n || null
430
441
  });
431
- let a = await w(r.toString(), {
442
+ let a = await T(r.toString(), {
432
443
  method: "POST",
433
444
  body: i
434
445
  });
435
- return k.log("requestSetPage complete.", a), a;
446
+ return A.log("requestSetPage complete.", a), a;
436
447
  }
437
- function Be(e, t) {
448
+ function Ue(e, t) {
438
449
  let n = new URL(e, window.location.origin), r = new FormData();
439
450
  [
440
451
  "handle",
@@ -446,7 +457,7 @@ function Be(e, t) {
446
457
  n && r.append(e, n);
447
458
  });
448
459
  let i = t.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]")?.value?.trim();
449
- i && r.append("CRAFT_CSRF_TOKEN", i), k.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
460
+ i && r.append("CRAFT_CSRF_TOKEN", i), A.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
450
461
  try {
451
462
  if (typeof navigator.sendBeacon == "function" && navigator.sendBeacon(n.toString(), r)) return;
452
463
  } catch {}
@@ -458,9 +469,9 @@ function Be(e, t) {
458
469
  headers: { Accept: "application/json" }
459
470
  });
460
471
  }
461
- async function Ve(e, t) {
472
+ async function We(e, t) {
462
473
  let n = (e.getAttribute("method") || "POST").toUpperCase(), r = e.getAttribute("action") || window.location.href, i = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
463
- k.log("submitForm start.", {
474
+ A.log("submitForm start.", {
464
475
  method: n,
465
476
  action: r,
466
477
  submitAction: t.get("submitAction")
@@ -471,13 +482,13 @@ async function Ve(e, t) {
471
482
  credentials: "include",
472
483
  headers: { Accept: "application/json" }
473
484
  }), o = a.headers.get("content-type") || "";
474
- if (!o.includes("application/json")) return a.ok ? (k.log("submitForm non-JSON success response.", {
485
+ if (!o.includes("application/json")) return a.ok ? (A.log("submitForm non-JSON success response.", {
475
486
  status: a.status,
476
487
  contentType: o
477
488
  }), {
478
489
  ok: !0,
479
490
  message: "Submission completed."
480
- }) : (k.warn("submitForm non-JSON HTTP error.", {
491
+ }) : (A.warn("submitForm non-JSON HTTP error.", {
481
492
  status: a.status,
482
493
  contentType: o
483
494
  }), {
@@ -486,8 +497,8 @@ async function Ve(e, t) {
486
497
  message: `Request failed (${a.status}).`,
487
498
  formErrors: [`Request failed (${a.status}).`]
488
499
  });
489
- let s = Fe(await a.json(), i);
490
- return k.log("submitForm JSON response normalized.", {
500
+ let s = Re(await a.json(), i);
501
+ return A.log("submitForm JSON response normalized.", {
491
502
  ok: s.ok,
492
503
  code: s.code,
493
504
  hasRedirect: !!s.redirect?.url,
@@ -496,7 +507,7 @@ async function Ve(e, t) {
496
507
  }
497
508
  //#endregion
498
509
  //#region src/js/submit/pipeline.ts
499
- var He = [
510
+ var Ge = [
500
511
  "prepare",
501
512
  "normalize",
502
513
  "validate",
@@ -504,14 +515,14 @@ var He = [
504
515
  "authorize",
505
516
  "dispatch",
506
517
  "finalize"
507
- ], Ue = [
518
+ ], Ke = [
508
519
  "prepare",
509
520
  "normalize",
510
521
  "validate",
511
522
  "screen",
512
523
  "authorize"
513
- ], A = d("general", "pipeline");
514
- function We(e, t) {
524
+ ], j = S("general", "pipeline");
525
+ function qe(e, t) {
515
526
  return {
516
527
  ok: !1,
517
528
  stage: e,
@@ -520,13 +531,13 @@ function We(e, t) {
520
531
  formErrors: [t || "Submission aborted."]
521
532
  };
522
533
  }
523
- function Ge(e) {
534
+ function Je(e) {
524
535
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
525
536
  }
526
- function Ke(e) {
537
+ function Ye(e) {
527
538
  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)));
528
539
  }
529
- function qe(e, t) {
540
+ function Xe(e, t) {
530
541
  if (t instanceof HTMLInputElement) {
531
542
  if (t.type === "file") {
532
543
  Array.from(t.files || []).forEach((n) => {
@@ -545,49 +556,49 @@ function qe(e, t) {
545
556
  }
546
557
  e.append(t.name, t.value);
547
558
  }
548
- function Je(e, t) {
559
+ function Ze(e, t) {
549
560
  t.querySelectorAll("input, select, textarea").forEach((t) => {
550
- let n = Ge(t) ? t : null;
551
- !n || n.closest("[data-formie-page]") || Ke(n) && qe(e, n);
561
+ let n = Je(t) ? t : null;
562
+ !n || n.closest("[data-formie-page]") || Ye(n) && Xe(e, n);
552
563
  });
553
564
  }
554
- function Ye(e, t) {
565
+ function Qe(e, t) {
555
566
  let n = /* @__PURE__ */ new Set();
556
567
  return t.querySelectorAll("input, select, textarea").forEach((t) => {
557
- let r = Ge(t) ? t : null;
558
- !r || !r.name || r.disabled || r instanceof HTMLInputElement && (r.type === "submit" || r.type === "button" || r.type === "reset" || r.type === "image") || (r.name.startsWith("fields[") && n.add(r.name), Ke(r) && qe(e, r));
568
+ let r = Je(t) ? t : null;
569
+ !r || !r.name || r.disabled || r instanceof HTMLInputElement && (r.type === "submit" || r.type === "button" || r.type === "reset" || r.type === "image") || (r.name.startsWith("fields[") && n.add(r.name), Ye(r) && Xe(e, r));
559
570
  }), n;
560
571
  }
561
- function Xe(e, t) {
572
+ function $e(e, t) {
562
573
  t.forEach((t) => {
563
574
  e.has(t) || e.append(t, "");
564
575
  });
565
576
  }
566
- function Ze(e, t) {
567
- let n = p(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
577
+ function et(e, t) {
578
+ let n = c(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
568
579
  if (!n.length || !r) {
569
580
  let n = new FormData(e);
570
581
  return n.set("submitAction", t), n;
571
582
  }
572
583
  let i = new FormData();
573
- return Je(i, e), Xe(i, Ye(i, r)), i.set("submitAction", t), i;
584
+ return Ze(i, e), $e(i, Qe(i, r)), i.set("submitAction", t), i;
574
585
  }
575
- function Qe(e, t) {
586
+ function tt(e, t) {
576
587
  if (t !== "submit") return !1;
577
- let n = p(e);
588
+ let n = c(e);
578
589
  return n.length ? (n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || n[n.length - 1]) === n[n.length - 1] : !0;
579
590
  }
580
- async function $e(e, t, n, r = {}) {
581
- A.log("Starting submit pipeline.", {
591
+ async function nt(e, t, n, r = {}) {
592
+ j.log("Starting submit pipeline.", {
582
593
  action: t,
583
594
  preflightOnly: r.preflightOnly === !0
584
595
  });
585
- let i = !1, a, o = null, s = Qe(e, t), c = {
596
+ let i = !1, a, o = null, s = tt(e, t), c = {
586
597
  form: e,
587
598
  action: t,
588
- formData: Ze(e, t),
599
+ formData: et(e, t),
589
600
  abort: (e) => {
590
- i = !0, a = e, A.warn("Pipeline aborted.", { reason: e });
601
+ i = !0, a = e, j.warn("Pipeline aborted.", { reason: e });
591
602
  },
592
603
  isAborted: () => i,
593
604
  abortReason: () => a
@@ -600,7 +611,7 @@ async function $e(e, t, n, r = {}) {
600
611
  validate: async (e) => {
601
612
  if (e.action !== "submit" || r.validateOnSubmit === !1) return null;
602
613
  if (r.validator) {
603
- let { scope: t, final: n } = h(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
614
+ let { scope: t, final: n } = f(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
604
615
  if (i.length > 0) {
605
616
  let e = i[0]?.input;
606
617
  if (e) {
@@ -636,68 +647,68 @@ async function $e(e, t, n, r = {}) {
636
647
  screen: async () => null,
637
648
  authorize: async () => null,
638
649
  dispatch: async (e) => {
639
- e.formData = Ze(e.form, e.action);
640
- let t = await Ve(e.form, e.formData);
650
+ e.formData = et(e.form, e.action);
651
+ let t = await We(e.form, e.formData);
641
652
  return o = t, t;
642
653
  },
643
654
  finalize: async (e) => (o && o.ok && o.redirect?.url && (o.redirect.target === "new-tab" ? window.open(o.redirect.url, "_blank") : window.location.href = o.redirect.url), null)
644
655
  };
645
656
  {
646
657
  let e = await n.emitSafe("formie:submit:before", c);
647
- e.failed.length > 0 && A.warn("Submit before listeners failed.", {
658
+ e.failed.length > 0 && j.warn("Submit before listeners failed.", {
648
659
  eventName: e.eventName,
649
660
  failed: e.failed.length
650
661
  });
651
662
  }
652
663
  if (s) {
653
664
  let e = await n.emitSafe("formie:submit:final:before", c);
654
- e.failed.length > 0 && A.warn("Final submit before listeners failed.", {
665
+ e.failed.length > 0 && j.warn("Final submit before listeners failed.", {
655
666
  eventName: e.eventName,
656
667
  failed: e.failed.length
657
668
  });
658
669
  }
659
- let u = r.preflightOnly ? Ue : He;
670
+ let u = r.preflightOnly ? Ke : Ge;
660
671
  for (let e of u) {
661
- if (A.log("Stage start.", {
672
+ if (j.log("Stage start.", {
662
673
  stage: e,
663
674
  action: t
664
- }), i) return A.warn("Stage skipped due to abort.", {
675
+ }), i) return j.warn("Stage skipped due to abort.", {
665
676
  stage: e,
666
677
  reason: a
667
- }), We(e, a);
678
+ }), qe(e, a);
668
679
  {
669
680
  let t = await n.emitSafe(`formie:stage:${e}:before`, {
670
681
  ...c,
671
682
  stage: e
672
683
  });
673
- t.failed.length > 0 && A.warn("Stage before listeners failed.", {
684
+ t.failed.length > 0 && j.warn("Stage before listeners failed.", {
674
685
  stage: e,
675
686
  failed: t.failed.length
676
687
  });
677
688
  }
678
689
  if (i) {
679
- let t = We(e, a);
690
+ let t = qe(e, a);
680
691
  {
681
692
  let r = await n.emitSafe("formie:submit:after", t);
682
- r.failed.length > 0 && A.warn("Submit after listeners failed (abort before stage).", {
693
+ r.failed.length > 0 && j.warn("Submit after listeners failed (abort before stage).", {
683
694
  stage: e,
684
695
  failed: r.failed.length
685
696
  });
686
697
  }
687
698
  if (s) {
688
699
  let r = await n.emitSafe("formie:submit:final:after", t);
689
- r.failed.length > 0 && A.warn("Final submit after listeners failed (abort before stage).", {
700
+ r.failed.length > 0 && j.warn("Final submit after listeners failed (abort before stage).", {
690
701
  stage: e,
691
702
  failed: r.failed.length
692
703
  });
693
704
  }
694
- return A.warn("Aborted after stage before-hooks.", {
705
+ return j.warn("Aborted after stage before-hooks.", {
695
706
  stage: e,
696
707
  reason: a
697
708
  }), t;
698
709
  }
699
710
  let r = await l[e](c);
700
- A.log("Stage runner complete.", {
711
+ j.log("Stage runner complete.", {
701
712
  stage: e,
702
713
  hasResult: !!r,
703
714
  ok: r ? r.ok : void 0,
@@ -709,28 +720,28 @@ async function $e(e, t, n, r = {}) {
709
720
  stage: e,
710
721
  result: r
711
722
  });
712
- t.failed.length > 0 && A.warn("Stage after listeners failed.", {
723
+ t.failed.length > 0 && j.warn("Stage after listeners failed.", {
713
724
  stage: e,
714
725
  failed: t.failed.length
715
726
  });
716
727
  }
717
728
  if (i) {
718
- let t = We(e, a);
729
+ let t = qe(e, a);
719
730
  {
720
731
  let r = await n.emitSafe("formie:submit:after", t);
721
- r.failed.length > 0 && A.warn("Submit after listeners failed (abort after stage).", {
732
+ r.failed.length > 0 && j.warn("Submit after listeners failed (abort after stage).", {
722
733
  stage: e,
723
734
  failed: r.failed.length
724
735
  });
725
736
  }
726
737
  if (s) {
727
738
  let r = await n.emitSafe("formie:submit:final:after", t);
728
- r.failed.length > 0 && A.warn("Final submit after listeners failed (abort after stage).", {
739
+ r.failed.length > 0 && j.warn("Final submit after listeners failed (abort after stage).", {
729
740
  stage: e,
730
741
  failed: r.failed.length
731
742
  });
732
743
  }
733
- return A.warn("Aborted after stage after-hooks.", {
744
+ return j.warn("Aborted after stage after-hooks.", {
734
745
  stage: e,
735
746
  reason: a
736
747
  }), t;
@@ -738,19 +749,19 @@ async function $e(e, t, n, r = {}) {
738
749
  if (r && !r.ok) {
739
750
  {
740
751
  let t = await n.emitSafe("formie:submit:after", r);
741
- t.failed.length > 0 && A.warn("Submit after listeners failed (failed stage).", {
752
+ t.failed.length > 0 && j.warn("Submit after listeners failed (failed stage).", {
742
753
  stage: e,
743
754
  failed: t.failed.length
744
755
  });
745
756
  }
746
757
  if (s) {
747
758
  let t = await n.emitSafe("formie:submit:final:after", r);
748
- t.failed.length > 0 && A.warn("Final submit after listeners failed (failed stage).", {
759
+ t.failed.length > 0 && j.warn("Final submit after listeners failed (failed stage).", {
749
760
  stage: e,
750
761
  failed: t.failed.length
751
762
  });
752
763
  }
753
- return A.warn("Pipeline short-circuited by failed stage.", {
764
+ return j.warn("Pipeline short-circuited by failed stage.", {
754
765
  stage: e,
755
766
  code: r.code,
756
767
  message: r.message
@@ -764,13 +775,13 @@ async function $e(e, t, n, r = {}) {
764
775
  };
765
776
  {
766
777
  let e = await n.emitSafe("formie:submit:after", d);
767
- e.failed.length > 0 && A.warn("Submit after listeners failed (success).", { failed: e.failed.length });
778
+ e.failed.length > 0 && j.warn("Submit after listeners failed (success).", { failed: e.failed.length });
768
779
  }
769
780
  if (s) {
770
781
  let e = await n.emitSafe("formie:submit:final:after", d);
771
- e.failed.length > 0 && A.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
782
+ e.failed.length > 0 && j.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
772
783
  }
773
- return A.log("Pipeline completed.", {
784
+ return j.log("Pipeline completed.", {
774
785
  ok: d.ok,
775
786
  stage: d.stage,
776
787
  code: d.code
@@ -778,27 +789,27 @@ async function $e(e, t, n, r = {}) {
778
789
  }
779
790
  //#endregion
780
791
  //#region src/js/core/field-error-container.ts
781
- function et(e) {
792
+ function rt(e) {
782
793
  return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
783
794
  }
784
- function tt(e, t) {
795
+ function it(e, t) {
785
796
  let n = e.querySelector("[data-formie-field-errors]");
786
797
  if (n) return n;
787
- let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = et(e), o = document.createElement("div");
798
+ let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = rt(e), o = document.createElement("div");
788
799
  return o.setAttribute("data-formie-field-errors", "true"), t?.(o), r && i ? a === "above" ? r.insertBefore(o, i) : r.appendChild(o) : e.appendChild(o), o;
789
800
  }
790
801
  //#endregion
791
802
  //#region src/js/validation/rules/email.ts
792
- var nt = {
803
+ var at = {
793
804
  rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
794
805
  message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-validation-email-message") ?? e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? n("{label} is not a valid email address.", { label: t })
795
806
  };
796
807
  //#endregion
797
808
  //#region src/js/validation/rules/shared.ts
798
- function rt(e) {
809
+ function ot(e) {
799
810
  return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
800
811
  }
801
- function it(e) {
812
+ function st(e) {
802
813
  let t = e.getRule("match");
803
814
  if (!t || t === !0 || typeof t != "object" || !e.field) return null;
804
815
  let n = typeof t.fieldHandle == "string" ? t.fieldHandle.trim() : "";
@@ -808,7 +819,7 @@ function it(e) {
808
819
  }
809
820
  //#endregion
810
821
  //#region src/js/validation/rules.ts
811
- var at = {
822
+ var ct = {
812
823
  required: {
813
824
  rule: ({ input: e, getRule: t }) => {
814
825
  if (!t("required") || e.type === "hidden") return !0;
@@ -820,7 +831,7 @@ var at = {
820
831
  },
821
832
  message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? n("{label} cannot be blank.", { label: t })
822
833
  },
823
- email: nt,
834
+ email: at,
824
835
  url: {
825
836
  rule: ({ input: e, getRule: t }) => {
826
837
  if (!t("url") || !e.value || e.value.length < 1) return !0;
@@ -861,18 +872,18 @@ var at = {
861
872
  },
862
873
  match: {
863
874
  rule: (e) => {
864
- let t = it(e);
875
+ let t = st(e);
865
876
  return t ? t.value === e.input.value : !0;
866
877
  },
867
878
  message: (e) => {
868
- let t = it(e)?.closest("[data-formie-field-handle]"), n = rt(t);
879
+ let t = st(e)?.closest("[data-formie-field-handle]"), n = ot(t);
869
880
  return e.t("{label} must match {value}.", {
870
881
  label: e.label,
871
882
  value: n
872
883
  });
873
884
  }
874
885
  }
875
- }, ot = {
886
+ }, lt = {
876
887
  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,})+$/,
877
888
  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*)?$/,
878
889
  number: /^(?:[-+]?[0-9]*[.,]?[0-9]+)$/,
@@ -880,11 +891,11 @@ var at = {
880
891
  date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,
881
892
  time: /^(?:(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]))$/,
882
893
  month: /^(?:(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])))$/
883
- }, j = d("general", "validator");
884
- function M(e) {
894
+ }, M = S("general", "validator");
895
+ function N(e) {
885
896
  return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
886
897
  }
887
- function st(e, t) {
898
+ function ut(e, t) {
888
899
  let n = (e.getAttribute("aria-describedby") || "").trim();
889
900
  if (!n) return;
890
901
  let r = n.split(/\s+/).filter((e) => e !== t);
@@ -894,34 +905,35 @@ function st(e, t) {
894
905
  }
895
906
  e.removeAttribute("aria-describedby");
896
907
  }
897
- function ct(e, t) {
908
+ function dt(e, t) {
898
909
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
899
910
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
900
911
  }
901
- function lt(e, t) {
912
+ function ft(e, t) {
902
913
  e.setAttribute("aria-errormessage", t);
903
914
  }
904
- function ut(e, t) {
915
+ function pt(e, t) {
905
916
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
906
917
  }
907
- var dt = class {
918
+ var mt = class {
908
919
  constructor(e, t = {}) {
909
920
  this.errors = [], this.validators = {}, this.boundListeners = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.submitted = !1, this.initialValues = /* @__PURE__ */ new WeakMap(), this.form = e, this.onBlur = this.blurHandler.bind(this), this.onChange = this.changeHandler.bind(this), this.onInput = this.inputHandler.bind(this), this.config = {
910
921
  live: !1,
922
+ errorAriaLive: "polite",
911
923
  errorMessage: "",
912
924
  fieldContainerErrorClass: [],
913
925
  inputErrorClass: [],
914
926
  messagesClass: [],
915
927
  messageClass: [],
916
928
  fieldsSelector: "input:not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])",
917
- patterns: ot,
929
+ patterns: lt,
918
930
  ...t
919
- }, Object.entries(at).forEach(([e, t]) => {
931
+ }, Object.entries(ct).forEach(([e, t]) => {
920
932
  this.addValidator(e, t.rule, t.message);
921
933
  }), this.init();
922
934
  }
923
935
  init() {
924
- j.log("Initializing validator.", {
936
+ M.log("Initializing validator.", {
925
937
  formId: this.form.id || null,
926
938
  live: this.config.live
927
939
  }), this.form.setAttribute("novalidate", "true"), this.inputs().forEach((e) => {
@@ -929,9 +941,9 @@ var dt = class {
929
941
  }), this.config.live && this.addEventListeners(), this.emitEvent(document, n("ready"), { validator: this });
930
942
  }
931
943
  inputs(e = null) {
932
- if (M(e)) return [e];
944
+ if (N(e)) return [e];
933
945
  let t = e || this.form;
934
- return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => M(e));
946
+ return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => N(e));
935
947
  }
936
948
  getInputValue(e) {
937
949
  return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? e.checked : e instanceof HTMLInputElement && e.type === "file" ? e.files?.length ? Array.from(e.files).map((e) => e.name).join("|") : "" : e.value ?? "";
@@ -971,7 +983,7 @@ var dt = class {
971
983
  }), r = !0;
972
984
  }
973
985
  }), !r && this.shouldShowError(e) && this.removeError(e);
974
- }), j.log("Validation pass complete.", {
986
+ }), M.log("Validation pass complete.", {
975
987
  errorCount: this.errors.length,
976
988
  includeHiddenPages: t.includeHiddenPages === !0
977
989
  }), this.errors;
@@ -992,39 +1004,39 @@ var dt = class {
992
1004
  e.remove();
993
1005
  }), r && (r.innerHTML = ""), t.querySelectorAll("input, select, textarea").forEach((e) => {
994
1006
  let n = e;
995
- n.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && n.classList.remove(...this.config.inputErrorClass), n.removeAttribute("data-formie-input-has-error"), i && st(n, i), t.querySelectorAll("[data-formie-field-error]").forEach((e) => {
1007
+ n.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && n.classList.remove(...this.config.inputErrorClass), n.removeAttribute("data-formie-input-has-error"), i && ut(n, i), t.querySelectorAll("[data-formie-field-error]").forEach((e) => {
996
1008
  let t = e.id;
997
- t && ut(n, t);
1009
+ t && pt(n, t);
998
1010
  });
999
1011
  });
1000
1012
  for (let e = t; e; e = e.parentElement?.closest("[data-formie-field-handle]")) this.config.fieldContainerErrorClass.length && e.classList.remove(...this.config.fieldContainerErrorClass), e.removeAttribute("data-formie-field-has-error");
1001
- this.emitEvent(e, n("clear-error"), { validator: this }), x(this.form);
1013
+ this.emitEvent(e, n("clear-error"), { validator: this }), v(this.form);
1002
1014
  }
1003
1015
  showError(e, t, r) {
1004
1016
  let i = e.closest("[data-formie-field-handle]");
1005
1017
  if (!i) return;
1006
1018
  let a = i.querySelector("[data-formie-field-errors]");
1007
- a ||= tt(i, (e) => {
1019
+ a ||= it(i, (e) => {
1008
1020
  this.config.messagesClass.length && e.classList.add(...this.config.messagesClass);
1009
1021
  }), this.config.messagesClass.length && a.classList.add(...this.config.messagesClass), a.innerHTML = "";
1010
1022
  let o = i.getAttribute("data-formie-field-handle") || "field", s = `${o}-error`;
1011
- a.id = a.id || `${o}-errors`, a.setAttribute("aria-live", "polite"), a.setAttribute("aria-atomic", "true");
1023
+ a.id = a.id || `${o}-errors`, De(a, Te(this.config.errorAriaLive, this.submitted));
1012
1024
  let c = document.createElement("div");
1013
1025
  c.setAttribute("data-formie-field-error", "true"), c.setAttribute(`data-formie-field-error-${t}`, "true"), c.setAttribute("id", s), c.setAttribute("role", "alert"), this.config.messageClass.length && c.classList.add(...this.config.messageClass), c.textContent = r, a.appendChild(c), i.setAttribute("data-formie-field-has-error", "true"), i.querySelectorAll("input, select, textarea").forEach((e) => {
1014
1026
  let t = e;
1015
- t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), ct(t, a.id), lt(t, s);
1027
+ t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), dt(t, a.id), ft(t, s);
1016
1028
  });
1017
1029
  for (let e = i; e; e = e.parentElement?.closest("[data-formie-field-handle]")) this.config.fieldContainerErrorClass.length && e.classList.add(...this.config.fieldContainerErrorClass), e.setAttribute("data-formie-field-has-error", "true");
1018
1030
  this.emitEvent(e, n("show-error"), {
1019
1031
  validator: this,
1020
1032
  validatorName: t,
1021
1033
  errorMessage: r
1022
- }), x(this.form);
1034
+ }), v(this.form);
1023
1035
  }
1024
1036
  getValidatorCallbackOptions(e) {
1025
1037
  let t = e.closest("[data-formie-field-handle]"), n = t?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() ?? "", r = this.parseValidationRules(t?.getAttribute("data-formie-validation"));
1026
1038
  return {
1027
- t: E,
1039
+ t: D,
1028
1040
  input: e,
1029
1041
  label: n,
1030
1042
  field: t,
@@ -1035,7 +1047,7 @@ var dt = class {
1035
1047
  };
1036
1048
  }
1037
1049
  getErrorMessage(e, t, n, r) {
1038
- return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? E("{label} is invalid.", { label: r.label });
1050
+ return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? D("{label} is invalid.", { label: r.label });
1039
1051
  }
1040
1052
  getErrors() {
1041
1053
  return this.errors;
@@ -1058,7 +1070,7 @@ var dt = class {
1058
1070
  try {
1059
1071
  n = JSON.parse(e);
1060
1072
  } catch {
1061
- return j.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
1073
+ return M.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
1062
1074
  }
1063
1075
  return Array.isArray(n) && n.forEach((e) => {
1064
1076
  if (!e || typeof e != "object" || Array.isArray(e)) return;
@@ -1067,16 +1079,16 @@ var dt = class {
1067
1079
  }), t;
1068
1080
  }
1069
1081
  destroy() {
1070
- j.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, n("destroy"), { validator: this });
1082
+ M.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, n("destroy"), { validator: this });
1071
1083
  }
1072
1084
  isVisible(e, t = {}) {
1073
- return e.closest("[data-formie-conditionally-hidden]") ? !1 : e.closest("[data-formie-page-hidden]") ? !!t.includeHiddenPages : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1085
+ return e.disabled || e.hasAttribute("data-formie-conditions-disabled") || e.closest("[data-formie-conditions-disabled]") || e.closest("[data-formie-conditionally-hidden]") ? !1 : e.closest("[data-formie-page-hidden]") ? !!t.includeHiddenPages : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1074
1086
  }
1075
1087
  blurHandler(e) {
1076
- !(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form) || e instanceof CustomEvent || e.target instanceof HTMLInputElement && e.target.type === "file" || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || (this.isDirty(e.target) && this.activated.add(e.target), this.shouldShowError(e.target) && this.validate(e.target));
1088
+ !(e.target instanceof HTMLElement) || !N(e.target) || !e.target.form?.isSameNode(this.form) || e instanceof CustomEvent || e.target instanceof HTMLInputElement && e.target.type === "file" || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || (this.isDirty(e.target) && this.activated.add(e.target), this.shouldShowError(e.target) && this.validate(e.target));
1077
1089
  }
1078
1090
  changeHandler(e) {
1079
- if (!(!(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form)) && !(e instanceof CustomEvent)) {
1091
+ if (!(!(e.target instanceof HTMLElement) || !N(e.target) || !e.target.form?.isSameNode(this.form)) && !(e instanceof CustomEvent)) {
1080
1092
  if (e.target instanceof HTMLSelectElement) {
1081
1093
  this.activated.add(e.target), this.validate(e.target);
1082
1094
  return;
@@ -1085,19 +1097,19 @@ var dt = class {
1085
1097
  }
1086
1098
  }
1087
1099
  inputHandler(e) {
1088
- !(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form) || e instanceof CustomEvent || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || this.shouldShowError(e.target) && this.validate(e.target);
1100
+ !(e.target instanceof HTMLElement) || !N(e.target) || !e.target.form?.isSameNode(this.form) || e instanceof CustomEvent || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || this.shouldShowError(e.target) && this.validate(e.target);
1089
1101
  }
1090
1102
  submit(e = null, { final: t = !1 } = {}) {
1091
- return this.submitted = !0, j.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
1103
+ return this.submitted = !0, M.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
1092
1104
  }
1093
1105
  resetLiveState() {
1094
1106
  this.submitted = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.errors = [], this.removeAllErrors();
1095
1107
  }
1096
1108
  addEventListeners() {
1097
- this.boundListeners || (this.form.addEventListener("blur", this.onBlur, !0), this.form.addEventListener("change", this.onChange, !1), this.form.addEventListener("input", this.onInput, !1), this.boundListeners = !0, j.log("Event listeners attached."));
1109
+ this.boundListeners || (this.form.addEventListener("blur", this.onBlur, !0), this.form.addEventListener("change", this.onChange, !1), this.form.addEventListener("input", this.onInput, !1), this.boundListeners = !0, M.log("Event listeners attached."));
1098
1110
  }
1099
1111
  removeEventListeners() {
1100
- this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, j.log("Event listeners removed.");
1112
+ this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, M.log("Event listeners removed.");
1101
1113
  }
1102
1114
  emitEvent(e, t, n = {}) {
1103
1115
  e.dispatchEvent(new CustomEvent(t, {
@@ -1114,62 +1126,62 @@ var dt = class {
1114
1126
  removeValidator(e) {
1115
1127
  delete this.validators[e];
1116
1128
  }
1117
- }, N = /* @__PURE__ */ new WeakMap();
1118
- function ft(e) {
1129
+ }, P = /* @__PURE__ */ new WeakMap();
1130
+ function ht(e) {
1119
1131
  return (e.dataset.formieSubmitAction || "").trim();
1120
1132
  }
1121
- function pt(e) {
1133
+ function gt(e) {
1122
1134
  return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
1123
1135
  }
1124
- function mt(e) {
1136
+ function _t(e) {
1125
1137
  return (e.dataset.formieSubmitActionMessagePosition || "").trim();
1126
1138
  }
1127
- function ht(e) {
1139
+ function vt(e) {
1128
1140
  let t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
1129
1141
  if (!t) return null;
1130
1142
  let n = Number.parseFloat(t);
1131
1143
  return !Number.isFinite(n) || n < 0 ? null : Math.round(n * 1e3);
1132
1144
  }
1133
- function P(e) {
1145
+ function yt(e) {
1134
1146
  let t = e.dataset.formieSubmitActionFormHide;
1135
1147
  if (t === void 0) return !1;
1136
1148
  let n = t.trim().toLowerCase();
1137
1149
  return n === "true" || n === "1" || n === "";
1138
1150
  }
1139
- function gt(e) {
1140
- let t = N.get(e);
1141
- typeof t == "number" && (window.clearTimeout(t), N.delete(e));
1151
+ function bt(e) {
1152
+ let t = P.get(e);
1153
+ typeof t == "number" && (window.clearTimeout(t), P.delete(e));
1142
1154
  }
1143
- function _t(e) {
1155
+ function xt(e) {
1144
1156
  return e.querySelector("[data-formie-form-messages-top]") || e;
1145
1157
  }
1146
- function vt(e) {
1158
+ function St(e) {
1147
1159
  return e.querySelector("[data-formie-form-messages-bottom]") || e;
1148
1160
  }
1149
- function yt(e, t) {
1150
- return t === "bottom-form" ? vt(e) : _t(e);
1161
+ function Ct(e, t) {
1162
+ return t === "bottom-form" ? St(e) : xt(e);
1151
1163
  }
1152
- function bt(e, t) {
1153
- return t === "top-form" ? _t(e) : t === "bottom-form" && !P(e) ? vt(e) : e;
1164
+ function wt(e, t) {
1165
+ return t === "top-form" ? xt(e) : t === "bottom-form" && !yt(e) ? St(e) : e;
1154
1166
  }
1155
- function xt(e) {
1156
- let t = pt(e), n = yt(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
1157
- return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), C(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1167
+ function Tt(e) {
1168
+ let t = gt(e), n = Ct(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
1169
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), w(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
1158
1170
  }
1159
- function St(e, t) {
1171
+ function Et(e, t) {
1160
1172
  let n = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
1161
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-error-message-container", "true"), t.appendChild(n)), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-error", "true"), C(n, e, "message", "messageError"), n.setAttribute("role", "alert"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), n;
1173
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-error-message-container", "true"), t.appendChild(n)), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-error", "true"), w(n, e, "message", "messageError"), n.setAttribute("role", "alert"), De(n, Ee(we(e))), n;
1162
1174
  }
1163
- function Ct(e, t) {
1164
- let n = e.querySelector("[data-formie-success-container]"), r = bt(e, t);
1165
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), C(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1175
+ function Dt(e, t) {
1176
+ let n = e.querySelector("[data-formie-success-container]"), r = wt(e, t);
1177
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), w(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
1166
1178
  }
1167
- function wt(e) {
1168
- return tt(e, (t) => {
1169
- C(t, e, "fieldErrors");
1179
+ function Ot(e) {
1180
+ return it(e, (t) => {
1181
+ w(t, e, "fieldErrors");
1170
1182
  });
1171
1183
  }
1172
- function Tt(e, t) {
1184
+ function kt(e, t) {
1173
1185
  let n = (e.getAttribute("aria-describedby") || "").trim();
1174
1186
  if (!n) return;
1175
1187
  let r = n.split(/\s+/).filter((e) => e !== t).join(" ").trim();
@@ -1179,148 +1191,149 @@ function Tt(e, t) {
1179
1191
  }
1180
1192
  e.removeAttribute("aria-describedby");
1181
1193
  }
1182
- function Et(e, t) {
1194
+ function At(e, t) {
1183
1195
  e.setAttribute("aria-errormessage", t);
1184
1196
  }
1185
- function Dt(e, t) {
1197
+ function jt(e, t) {
1186
1198
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
1187
1199
  }
1188
- function Ot(e) {
1200
+ function Mt(e) {
1189
1201
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
1190
1202
  let n = t, r = n.querySelector("[data-formie-field-errors]"), i = r?.id || "", a = Array.from(n.querySelectorAll("[data-formie-field-error]")).map((e) => e.id).filter(Boolean);
1191
- S(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
1203
+ C(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
1192
1204
  e.remove();
1193
1205
  }), r && !r.querySelector("[data-formie-field-error]") && (r.innerHTML = ""), n.querySelectorAll("input, select, textarea").forEach((t) => {
1194
1206
  let n = t;
1195
- n.removeAttribute("aria-invalid"), S(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), i && Tt(n, i), a.forEach((e) => {
1196
- Dt(n, e);
1207
+ n.removeAttribute("aria-invalid"), C(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), i && kt(n, i), a.forEach((e) => {
1208
+ jt(n, e);
1197
1209
  });
1198
1210
  });
1199
- }), x(e);
1211
+ }), v(e);
1200
1212
  }
1201
- function kt(e) {
1213
+ function Nt(e) {
1202
1214
  e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
1203
1215
  let n = t;
1204
1216
  n.querySelectorAll("[data-formie-error]").forEach((e) => {
1205
1217
  e.remove();
1206
- }), S(n, e, "message", "messageError"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-error"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-error]") || (n.innerHTML = "");
1218
+ }), C(n, e, "message", "messageError"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-error"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-error]") || (n.innerHTML = "");
1207
1219
  });
1208
1220
  }
1209
- function F(e) {
1210
- gt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
1221
+ function Pt(e) {
1222
+ bt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
1211
1223
  e.remove();
1212
1224
  }), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
1213
1225
  let n = t;
1214
1226
  n.querySelectorAll("[data-formie-success]").forEach((e) => {
1215
1227
  e.remove();
1216
- }), S(n, e, "message", "messageSuccess"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-success"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-success]") || (n.innerHTML = "");
1217
- }), ft(e) === "message" && P(e) || f(e, !1);
1228
+ }), C(n, e, "message", "messageSuccess"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-success"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-success]") || (n.innerHTML = "");
1229
+ }), ht(e) === "message" && yt(e) || s(e, !1);
1218
1230
  }
1219
- function At(e) {
1231
+ function Ft(e) {
1220
1232
  e.querySelectorAll("[aria-invalid=\"true\"]").forEach((e) => {
1221
1233
  e.removeAttribute("aria-invalid");
1222
1234
  });
1223
1235
  }
1224
- function jt(e, t) {
1236
+ function It(e, t) {
1225
1237
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
1226
1238
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
1227
1239
  }
1228
- function Mt(e, t) {
1229
- Object.entries(t).forEach(([t, n]) => {
1230
- let r = e.querySelector(`[data-formie-field-handle="${t}"]`);
1231
- if (!r) return;
1232
- let i = wt(r), a = i.id && i.id.trim() ? i.id : `${t}-errors`;
1233
- i.id = a, i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), C(r, e, "fieldLayoutError"), r.setAttribute("data-formie-field-has-error", "true"), n.forEach((t, n) => {
1240
+ function Lt(e, t) {
1241
+ let n = Ee(we(e));
1242
+ Object.entries(t).forEach(([t, r]) => {
1243
+ let i = e.querySelector(`[data-formie-field-handle="${t}"]`);
1244
+ if (!i) return;
1245
+ let a = Ot(i), o = a.id && a.id.trim() ? a.id : `${t}-errors`;
1246
+ a.id = o, De(a, n), w(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), r.forEach((t, n) => {
1234
1247
  let r = document.createElement("div");
1235
- r.setAttribute("data-formie-field-error", "true"), r.setAttribute("role", "alert"), r.id = `${a}-${n + 1}`, C(r, e, "fieldError"), r.textContent = t, i.appendChild(r);
1248
+ r.setAttribute("data-formie-field-error", "true"), r.setAttribute("role", "alert"), r.id = `${o}-${n + 1}`, w(r, e, "fieldError"), r.textContent = t, a.appendChild(r);
1236
1249
  });
1237
- let o = i.querySelector("[data-formie-field-error]")?.id;
1238
- r.querySelectorAll("input, select, textarea").forEach((t) => {
1250
+ let s = a.querySelector("[data-formie-field-error]")?.id;
1251
+ i.querySelectorAll("input, select, textarea").forEach((t) => {
1239
1252
  let n = t;
1240
- n.setAttribute("aria-invalid", "true"), C(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), jt(n, a), o && Et(n, o);
1241
- let i = r.querySelector("[data-formie-instructions]");
1242
- i?.id && jt(n, i.id);
1253
+ n.setAttribute("aria-invalid", "true"), w(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), It(n, o), s && At(n, s);
1254
+ let r = i.querySelector("[data-formie-instructions]");
1255
+ r?.id && It(n, r.id);
1243
1256
  });
1244
- }), x(e);
1257
+ }), v(e);
1245
1258
  }
1246
- function Nt(e, t) {
1247
- let n = xt(e), r = St(e, n);
1248
- C(n, e, "errors"), t.forEach((t) => {
1259
+ function Rt(e, t) {
1260
+ let n = Tt(e), r = Et(e, n);
1261
+ w(n, e, "errors"), t.forEach((t) => {
1249
1262
  let n = document.createElement("div");
1250
- n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), C(n, e, "error"), n.innerHTML = t, r.appendChild(n);
1263
+ n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), w(n, e, "error"), n.innerHTML = t, r.appendChild(n);
1251
1264
  });
1252
1265
  }
1253
- function Pt(e, t) {
1254
- return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : ft(e) === "message" && mt(e) !== "";
1266
+ function zt(e, t) {
1267
+ return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : ht(e) === "message" && _t(e) !== "";
1255
1268
  }
1256
- function Ft(e, t) {
1257
- let n = mt(e);
1269
+ function Bt(e, t) {
1270
+ let n = _t(e);
1258
1271
  if (!n) return;
1259
- let r = Ct(e, n);
1260
- C(r, e, "message", "messageSuccess"), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-success", "true"), r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true");
1272
+ let r = Dt(e, n);
1273
+ w(r, e, "message", "messageSuccess"), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-success", "true"), r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true");
1261
1274
  let i = document.createElement("div");
1262
- i.setAttribute("data-formie-success", "true"), C(i, e, "success"), i.innerHTML = t, r.appendChild(i), P(e) && f(e, !0);
1263
- let a = ht(e);
1275
+ i.setAttribute("data-formie-success", "true"), w(i, e, "success"), i.innerHTML = t, r.appendChild(i), yt(e) && s(e, !0);
1276
+ let a = vt(e);
1264
1277
  if (a !== null) {
1265
1278
  let t = window.setTimeout(() => {
1266
- N.delete(e), F(e);
1279
+ P.delete(e), Pt(e);
1267
1280
  }, a);
1268
- N.set(e, t);
1281
+ P.set(e, t);
1269
1282
  }
1270
1283
  }
1271
- function I(e, t) {
1272
- if (Ot(e), kt(e), F(e), At(e), t.ok) {
1273
- Pt(e, t) && Ft(e, t.message || "");
1284
+ function F(e, t) {
1285
+ if (Mt(e), Nt(e), Pt(e), Ft(e), t.ok) {
1286
+ zt(e, t) && Bt(e, t.message || "");
1274
1287
  return;
1275
1288
  }
1276
- t.fieldErrors && Mt(e, t.fieldErrors), t.formErrors?.length ? Nt(e, t.formErrors) : !t.fieldErrors && t.message && Nt(e, [t.message]), je(e);
1289
+ t.fieldErrors && Lt(e, t.fieldErrors), t.formErrors?.length ? Rt(e, t.formErrors) : !t.fieldErrors && t.message && Rt(e, [t.message]), Pe(e);
1277
1290
  }
1278
1291
  //#endregion
1279
1292
  //#region src/js/core/submit-flow.ts
1280
- var It = d("general", "submit-flow");
1281
- function Lt(e) {
1293
+ var Vt = S("general", "submit-flow");
1294
+ function Ht(e) {
1282
1295
  return !(!e.ok && e.stage === "validate");
1283
1296
  }
1284
- function Rt(e) {
1297
+ function Ut(e) {
1285
1298
  return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
1286
1299
  }
1287
- function zt(e) {
1288
- Ot(e), kt(e), F(e), At(e);
1300
+ function Wt(e) {
1301
+ Mt(e), Nt(e), Pt(e), Ft(e);
1289
1302
  }
1290
- async function Bt(e) {
1291
- let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: d } = e;
1292
- zt(r), _(r, c || null);
1293
- let f = {
1303
+ async function Gt(e) {
1304
+ let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: f } = e;
1305
+ Wt(r), m(r, c || null);
1306
+ let p = {
1294
1307
  ok: !1,
1295
1308
  code: "SUBMIT_ERROR",
1296
1309
  message: "Submission failed.",
1297
1310
  formErrors: ["Submission failed."]
1298
1311
  };
1299
1312
  try {
1300
- await l(r), f = await $e(r, s, i, {
1313
+ await l(r), p = await nt(r, s, i, {
1301
1314
  validator: a,
1302
1315
  validateOnSubmit: o
1303
- }), I(r, f), v(r, f, s), Lt(f) && await u(f), d(f);
1316
+ }), F(r, p), h(r, p, s), Ht(p) && await u(p), f(p);
1304
1317
  } catch (e) {
1305
- f = {
1318
+ p = {
1306
1319
  ok: !1,
1307
1320
  code: "SUBMIT_ERROR",
1308
1321
  message: e instanceof Error ? e.message : "Submission failed.",
1309
1322
  formErrors: [e instanceof Error ? e.message : "Submission failed."]
1310
- }, I(r, f), d(f), It.warn("Submit failed with exception.", {
1323
+ }, F(r, p), f(p), Vt.warn("Submit failed with exception.", {
1311
1324
  id: t,
1312
1325
  action: s,
1313
1326
  target: n,
1314
1327
  error: e instanceof Error ? e.message : e
1315
1328
  });
1316
1329
  } finally {
1317
- Rt(f) || m(r);
1330
+ Ut(p) || d(r);
1318
1331
  }
1319
- return f;
1332
+ return p;
1320
1333
  }
1321
1334
  //#endregion
1322
1335
  //#region src/js/modules/registry.ts
1323
- var Vt = class {
1336
+ var I = class {
1324
1337
  constructor() {
1325
1338
  this.modules = /* @__PURE__ */ new Map();
1326
1339
  }
@@ -1337,72 +1350,73 @@ var Vt = class {
1337
1350
  getAll() {
1338
1351
  return Array.from(this.modules.values());
1339
1352
  }
1340
- }, Ht = {
1341
- "address-finder": () => import("./chunks/address-finder-yXU5yMjG.js").then((e) => e.addressFinderModule),
1342
- "google-address": () => import("./chunks/google-address-OhKilPWE.js").then((e) => e.googleAddressModule),
1343
- loqate: () => import("./chunks/loqate-Cp2zvwpE.js").then((e) => e.loqateModule),
1353
+ }, Kt = {
1354
+ "address-finder": () => import("./chunks/address-finder-k7_BXaRe.js").then((e) => e.addressFinderModule),
1355
+ "google-address": () => import("./chunks/google-address-BH3Zhi06.js").then((e) => e.googleAddressModule),
1356
+ loqate: () => import("./chunks/loqate-CJPzBmSm.js").then((e) => e.loqateModule),
1344
1357
  "place-kit": () => import("./chunks/place-kit-BGHklIZ-.js").then((e) => e.placeKitModule)
1345
- }, Ut = {
1346
- "captcha-eu": () => import("./chunks/captcha-eu-CWJb64_j.js").then((e) => e.captchaEuModule),
1347
- "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-ByXzENYZ.js").then((e) => e.friendlyCaptchaV1Module),
1348
- "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-BPdlmhQu.js").then((e) => e.friendlyCaptchaV2Module),
1349
- hcaptcha: () => import("./chunks/hcaptcha-CdCd9oEi.js").then((e) => e.hcaptchaModule),
1350
- "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-BSwi8IVX.js").then((e) => e.recaptchaEnterpriseModule),
1351
- "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-CnDQmsKa.js").then((e) => e.recaptchaV2CheckboxModule),
1352
- "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-Cz5uIlp-.js").then((e) => e.recaptchaV2InvisibleModule),
1353
- "recaptcha-v3": () => import("./chunks/recaptcha-v3-BtbbP111.js").then((e) => e.recaptchaV3Module),
1354
- snaptcha: () => import("./chunks/snaptcha-vz1RnZ15.js").then((e) => e.snaptchaModule),
1355
- turnstile: () => import("./chunks/turnstile-D_Pi1CKM.js").then((e) => e.turnstileModule)
1356
- }, Wt = {
1357
- calculations: () => import("./chunks/calculations-CgVJcQ2P.js").then((e) => e.calculationsModule),
1358
+ }, qt = {
1359
+ "captcha-eu": () => import("./chunks/captcha-eu-CGm8Lbrj.js").then((e) => e.captchaEuModule),
1360
+ "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-C_2reOXr.js").then((e) => e.friendlyCaptchaV1Module),
1361
+ "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-CLSAbkqx.js").then((e) => e.friendlyCaptchaV2Module),
1362
+ hcaptcha: () => import("./chunks/hcaptcha-CGLAmgjO.js").then((e) => e.hcaptchaModule),
1363
+ "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-XPId5-bS.js").then((e) => e.recaptchaEnterpriseModule),
1364
+ "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-Cy-0PEPc.js").then((e) => e.recaptchaV2CheckboxModule),
1365
+ "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-BwRH540O.js").then((e) => e.recaptchaV2InvisibleModule),
1366
+ "recaptcha-v3": () => import("./chunks/recaptcha-v3-No4Ykrhk.js").then((e) => e.recaptchaV3Module),
1367
+ snaptcha: () => import("./chunks/snaptcha-DKx98oon.js").then((e) => e.snaptchaModule),
1368
+ turnstile: () => import("./chunks/turnstile-DJakPzQD.js").then((e) => e.turnstileModule)
1369
+ }, Jt = {
1370
+ calculations: () => import("./chunks/calculations-CeDgB9jt.js").then((e) => e.calculationsModule),
1358
1371
  "checkbox-radio": () => import("./chunks/checkbox-radio-DQ0H67Tj.js").then((e) => e.checkboxRadioModule),
1359
1372
  combobox: () => import("./chunks/combobox-D-2b42wn.js").then((e) => e.comboboxModule),
1360
- conditions: () => import("./chunks/conditions-CZ3FU5QO.js").then((e) => e.conditionsModule),
1373
+ conditions: () => import("./chunks/conditions-B6_nzpeE.js").then((e) => e.conditionsModule),
1361
1374
  "custom-google-maps": () => import("./chunks/custom-google-maps-BsaSirEZ.js").then((e) => e.customGoogleMapsModule),
1362
1375
  "custom-link": () => import("./chunks/custom-link-CJ1-FjEM.js").then((e) => e.customLinkModule),
1363
1376
  "custom-maps": () => import("./chunks/custom-maps-DYW_pBid.js").then((e) => e.customMapsModule),
1364
1377
  "date-picker": () => import("./chunks/date-picker-5CA_-zGb.js").then((e) => e.datePickerModule),
1365
1378
  "file-upload": () => import("./chunks/file-upload-D49m8-DR.js").then((e) => e.fileUploadModule),
1379
+ "upload-manager": () => import("./chunks/upload-manager-BpqWSHmU.js").then((e) => e.uploadManagerModule),
1366
1380
  hidden: () => import("./chunks/hidden-D7_Ch-QN.js").then((e) => e.hiddenModule),
1367
1381
  "phone-country": () => import("./chunks/phone-country-D3ayr60L.js").then((e) => e.phoneCountryModule),
1368
1382
  "address-country": () => import("./chunks/address-country-Rx6GQTND.js").then((e) => e.addressCountryModule),
1369
1383
  "address-state": () => import("./chunks/address-state-BQ0xGV9n.js").then((e) => e.addressStateModule),
1370
1384
  repeater: () => import("./chunks/repeater-B5leVxZU.js").then((e) => e.repeaterModule),
1371
- "rich-text": () => import("./chunks/rich-text-Cv8ADyk-.js").then((e) => e.richTextModule),
1372
- signature: () => import("./chunks/signature-CpgqHCEx.js").then((e) => e.signatureModule),
1385
+ "rich-text": () => import("./chunks/rich-text-D0sb8bmX.js").then((e) => e.richTextModule),
1386
+ signature: () => import("./chunks/signature-xz4QO7CR.js").then((e) => e.signatureModule),
1373
1387
  summary: () => import("./chunks/summary-D3AjxpYN.js").then((e) => e.summaryModule),
1374
1388
  table: () => import("./chunks/table-C-lkQN6I.js").then((e) => e.tableModule),
1375
- "text-limit": () => import("./chunks/text-limit-B09elPDB.js").then((e) => e.textLimitModule)
1376
- }, Gt = {
1377
- bpoint: () => import("./chunks/bpoint-DSjqRv63.js").then((e) => e.bpointModule),
1378
- eway: () => import("./chunks/eway-D3ctTbEk.js").then((e) => e.ewayModule),
1379
- "go-cardless": () => import("./chunks/go-cardless-BwASSYSK.js").then((e) => e.goCardlessModule),
1380
- mollie: () => import("./chunks/mollie-COG-ko2D.js").then((e) => e.mollieModule),
1381
- moneris: () => import("./chunks/moneris-CMH8PlRc.js").then((e) => e.monerisModule),
1382
- opayo: () => import("./chunks/opayo-D2jsR5vh.js").then((e) => e.opayoModule),
1383
- paddle: () => import("./chunks/paddle-DxF88RfC.js").then((e) => e.paddleModule),
1384
- paypal: () => import("./chunks/paypal-b5pnwrA2.js").then((e) => e.paypalModule),
1385
- payway: () => import("./chunks/payway-BJYu9DIR.js").then((e) => e.paywayModule),
1386
- square: () => import("./chunks/square-BP8RWAKB.js").then((e) => e.squareModule),
1387
- stripe: () => import("./chunks/stripe-MihN63uC.js").then((e) => e.stripeModule)
1388
- }, Kt = {
1389
- ...Wt,
1390
- ...Ht,
1391
- ...Ut,
1392
- ...Gt
1393
- }, L = /* @__PURE__ */ new Map(), R = d("general", "loader"), qt = Function("src", "return import(src);");
1389
+ "text-limit": () => import("./chunks/text-limit-DbgEFHLO.js").then((e) => e.textLimitModule)
1390
+ }, Yt = {
1391
+ bpoint: () => import("./chunks/bpoint-2qDxlKD9.js").then((e) => e.bpointModule),
1392
+ eway: () => import("./chunks/eway-CImXrB4g.js").then((e) => e.ewayModule),
1393
+ "go-cardless": () => import("./chunks/go-cardless-Bz7HHtH0.js").then((e) => e.goCardlessModule),
1394
+ mollie: () => import("./chunks/mollie-BtnB3KGh.js").then((e) => e.mollieModule),
1395
+ moneris: () => import("./chunks/moneris-Bd4vUk8b.js").then((e) => e.monerisModule),
1396
+ opayo: () => import("./chunks/opayo-B-eRIXo-.js").then((e) => e.opayoModule),
1397
+ paddle: () => import("./chunks/paddle-BUFeEU4d.js").then((e) => e.paddleModule),
1398
+ paypal: () => import("./chunks/paypal-8Euw7Hrn.js").then((e) => e.paypalModule),
1399
+ payway: () => import("./chunks/payway-dV0SzJxy.js").then((e) => e.paywayModule),
1400
+ square: () => import("./chunks/square-reyJukb7.js").then((e) => e.squareModule),
1401
+ stripe: () => import("./chunks/stripe-BC-2PBvY.js").then((e) => e.stripeModule)
1402
+ }, Xt = {
1403
+ ...Jt,
1404
+ ...Kt,
1405
+ ...qt,
1406
+ ...Yt
1407
+ }, L = /* @__PURE__ */ new Map(), R = S("general", "loader"), Zt = Function("src", "return import(src);");
1394
1408
  async function z(t, n, i, a) {
1395
1409
  await t(r(i), a), await t(e(n, i), a);
1396
1410
  }
1397
- function Jt(e) {
1411
+ function Qt(e) {
1398
1412
  return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
1399
1413
  }
1400
- async function Yt(e, t) {
1401
- let n = Kt[e];
1414
+ async function $t(e, t) {
1415
+ let n = Xt[e];
1402
1416
  return n ? (L.has(e) || L.set(e, (async () => {
1403
1417
  try {
1404
1418
  let e = await n();
1405
- return Jt(e) ? (t.registry.register(e), e) : null;
1419
+ return Qt(e) ? (t.registry.register(e), e) : null;
1406
1420
  } catch (t) {
1407
1421
  return console.error("[formie] Failed to load builtin module:", e, t), R.warn("Failed loading builtin module.", {
1408
1422
  moduleId: e,
@@ -1411,10 +1425,10 @@ async function Yt(e, t) {
1411
1425
  }
1412
1426
  })()), L.get(e) || null) : null;
1413
1427
  }
1414
- async function Xt(e) {
1428
+ async function en(e) {
1415
1429
  try {
1416
- let t = await qt(e), n = t?.default || t?.formieModule || null;
1417
- return Jt(n) ? n : null;
1430
+ let t = await Zt(e), n = t?.default || t?.formieModule || null;
1431
+ return Qt(n) ? n : null;
1418
1432
  } catch (t) {
1419
1433
  return console.error("[formie] Failed to load module from src:", e, t), R.warn("Failed loading module from src.", {
1420
1434
  src: e,
@@ -1422,13 +1436,13 @@ async function Xt(e) {
1422
1436
  }), null;
1423
1437
  }
1424
1438
  }
1425
- async function Zt(e, t) {
1439
+ async function tn(e, t) {
1426
1440
  let n = t.registry.get(e.id);
1427
1441
  if (n) return n;
1428
- let r = await Yt(e.id, t);
1442
+ let r = await $t(e.id, t);
1429
1443
  if (r) return r;
1430
1444
  if (e.src) {
1431
- let n = await Xt(e.src);
1445
+ let n = await en(e.src);
1432
1446
  if (n) return t.registry.register(n), n;
1433
1447
  }
1434
1448
  return null;
@@ -1439,7 +1453,7 @@ function B(e) {
1439
1453
  function V(e, t) {
1440
1454
  return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
1441
1455
  }
1442
- function Qt(e, t) {
1456
+ function nn(e, t) {
1443
1457
  let n = t.setupContext.root, r = t.setupContext.form, i = e.targetType, a = e.targetId;
1444
1458
  return i === "selector" ? V(n, a).map((e) => ({
1445
1459
  scope: i,
@@ -1458,17 +1472,17 @@ function Qt(e, t) {
1458
1472
  element: r || n
1459
1473
  }];
1460
1474
  }
1461
- function $t(e, t) {
1475
+ function rn(e, t) {
1462
1476
  return (e.targets && e.targets.length > 0 ? e.targets : [{
1463
1477
  targetType: "form",
1464
1478
  targetId: "form"
1465
- }]).flatMap((e) => Qt(e, t));
1479
+ }]).flatMap((e) => nn(e, t));
1466
1480
  }
1467
- async function en(e, t) {
1481
+ async function an(e, t) {
1468
1482
  let n = [];
1469
1483
  R.log("Loading module manifest.", { manifestCount: e.length });
1470
1484
  for (let r of e) {
1471
- let e = await Zt(r, t);
1485
+ let e = await tn(r, t);
1472
1486
  if (!e) {
1473
1487
  R.warn("Skipping manifest item (definition not resolved).", {
1474
1488
  moduleId: r.id,
@@ -1476,7 +1490,7 @@ async function en(e, t) {
1476
1490
  });
1477
1491
  continue;
1478
1492
  }
1479
- let i = $t(r, t);
1493
+ let i = rn(r, t);
1480
1494
  R.log("Resolved module targets.", {
1481
1495
  moduleId: e.id,
1482
1496
  targets: r.targets || [],
@@ -1544,51 +1558,61 @@ async function en(e, t) {
1544
1558
  return R.log("Module manifest processing complete.", { instanceCount: n.length }), n;
1545
1559
  }
1546
1560
  //#endregion
1561
+ //#region src/js/utils/form-started-at.ts
1562
+ var on = "formie:formStartedAt:";
1563
+ function sn(e) {
1564
+ let t = e.querySelector("input[name=\"formStartedAt\"]");
1565
+ if (!t) return;
1566
+ let n = e.querySelector("input[name=\"renderId\"]")?.value?.trim() ?? "", r = n ? `${on}${n}` : null, i = r ? sessionStorage.getItem(r) : null;
1567
+ i || (i = String(Date.now()), r && sessionStorage.setItem(r, i)), t.value = i;
1568
+ }
1569
+ //#endregion
1547
1570
  //#region src/js/utils/unload-warning.ts
1548
- var tn = new Set([
1571
+ var cn = new Set([
1549
1572
  "CRAFT_CSRF_TOKEN",
1550
1573
  "action",
1551
1574
  "redirect",
1552
1575
  "requestToken",
1553
1576
  "renderId",
1577
+ "formStartedAt",
1554
1578
  "submitAction",
1555
1579
  "pageId",
1556
1580
  "draftContextToken",
1557
1581
  "draftContext",
1558
1582
  "continuationToken"
1559
1583
  ]);
1560
- function nn(e, t) {
1584
+ function H(e, t) {
1561
1585
  if (e == null) return String(e);
1562
1586
  if (typeof e == "string") return JSON.stringify(e);
1563
1587
  if (typeof e == "number" || typeof e == "boolean") return String(e);
1564
1588
  if (typeof e == "function") return "[function]";
1565
1589
  if (typeof File < "u" && e instanceof File) return `[file:${e.name}:${e.size}:${e.type}]`;
1566
1590
  if (typeof Blob < "u" && e instanceof Blob) return `[blob:${e.size}:${e.type}]`;
1567
- if (Array.isArray(e)) return `[${e.map((e) => nn(e, t)).join(",")}]`;
1591
+ if (Array.isArray(e)) return `[${e.map((e) => H(e, t)).join(",")}]`;
1568
1592
  if (typeof e == "object") {
1569
1593
  if (t.has(e)) return "[circular]";
1570
1594
  t.add(e);
1571
- let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${nn(n, t)}`);
1595
+ let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${H(n, t)}`);
1572
1596
  return t.delete(e), `{${n.join(",")}}`;
1573
1597
  }
1574
1598
  return JSON.stringify(String(e));
1575
1599
  }
1576
- function rn(e) {
1577
- return nn(e, /* @__PURE__ */ new WeakSet());
1600
+ function ln(e) {
1601
+ return H(e, /* @__PURE__ */ new WeakSet());
1578
1602
  }
1579
- function an(e) {
1603
+ function un(e) {
1580
1604
  if (!e) return !1;
1581
1605
  let t = e.endsWith("[]") ? e.slice(0, -2) : e;
1582
- return !tn.has(t);
1606
+ return !cn.has(t);
1583
1607
  }
1584
- function on(e) {
1585
- return rn(Array.from(new FormData(e).entries()).filter(([e]) => an(String(e || ""))));
1608
+ function dn(e) {
1609
+ return ln(Array.from(new FormData(e).entries()).filter(([e]) => un(String(e || ""))));
1586
1610
  }
1587
- function sn(e, t = {}) {
1611
+ function fn(e, t = {}) {
1588
1612
  let n = null, r = !1, i = !1, a = null, o = null, s = null, c = () => {
1589
1613
  a !== null && (window.cancelAnimationFrame(a), a = null), o !== null && (window.clearTimeout(o), o = null), s !== null && (window.clearTimeout(s), s = null);
1590
- }, l = () => r ? (i = on(e) !== n, i) : !1, u = () => {
1591
- n = on(e), r = !0, i = !1;
1614
+ }, l = () => r ? (i = dn(e) !== n, i) : !1, u = () => {
1615
+ n = dn(e), r = !0, i = !1;
1592
1616
  }, d = () => {
1593
1617
  c(), r = !1, a = window.requestAnimationFrame(() => {
1594
1618
  a = null, s = window.setTimeout(() => {
@@ -1612,41 +1636,67 @@ function sn(e, t = {}) {
1612
1636
  };
1613
1637
  }
1614
1638
  //#endregion
1639
+ //#region src/js/validation/enter-key-guard.ts
1640
+ function pn(e) {
1641
+ return e.hasAttribute("data-formie-conditionally-hidden") || !!e.closest("[data-formie-conditionally-hidden]") || e.hasAttribute("data-formie-page-hidden") || !!e.closest("[data-formie-page-hidden]");
1642
+ }
1643
+ function mn(e, t) {
1644
+ let n = e.querySelectorAll(`[data-formie-action="${t}"]`);
1645
+ return Array.from(n).some((e) => !pn(e));
1646
+ }
1647
+ function hn(e) {
1648
+ let { final: t } = f(e);
1649
+ return "submit";
1650
+ }
1651
+ function gn(e) {
1652
+ return !mn(e, hn(e));
1653
+ }
1654
+ function _n(e) {
1655
+ let t = (t) => {
1656
+ if (t.key !== "Enter" || t.defaultPrevented) return;
1657
+ let n = t.target;
1658
+ (n instanceof HTMLInputElement || n instanceof HTMLSelectElement) && (n instanceof HTMLInputElement && (n.type === "button" || n.type === "submit" || n.type === "reset" || n.type === "file") || gn(e) && t.preventDefault());
1659
+ };
1660
+ return e.addEventListener("keydown", t, !0), () => {
1661
+ e.removeEventListener("keydown", t, !0);
1662
+ };
1663
+ }
1664
+ //#endregion
1615
1665
  //#region src/js/core/create-formie-client.ts
1616
- var H = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", cn = 300, ln = "/actions/formie/server/forms/render", un = "/api", dn = "/actions/formie/server/forms/refresh-tokens", fn = "/actions/formie/server/submissions/submit", pn = "/actions/formie/server/submissions/set-page", mn = "/actions/formie/server/submissions/clear-submission", hn = "/actions/formie/file-upload/hydrate", U = d("general", "client"), gn = /* @__PURE__ */ new Set();
1617
- function W(e, t) {
1666
+ var U = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", vn = 300, yn = "/actions/formie/server/forms/render", bn = "/api", xn = "/actions/formie/server/forms/refresh-tokens", Sn = "/actions/formie/server/submissions/submit", Cn = "/actions/formie/server/submissions/set-page", wn = "/actions/formie/server/submissions/clear-submission", Tn = "/actions/formie/file-upload/hydrate", W = S("general", "client"), En = /* @__PURE__ */ new Set();
1667
+ function G(e, t) {
1618
1668
  if (e == null || e === "") return t;
1619
1669
  let n = e.toLowerCase();
1620
1670
  return !(n === "false" || n === "0" || n === "off");
1621
1671
  }
1622
- function _n(e) {
1623
- return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? W(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? W(e.formieStaticCache, !1) : !1;
1672
+ function Dn(e) {
1673
+ return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? G(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? G(e.formieStaticCache, !1) : !1;
1624
1674
  }
1625
- function G(e) {
1675
+ function K(e) {
1626
1676
  let t = e instanceof HTMLElement ? e.dataset : {};
1627
1677
  return {
1628
1678
  mode: "server-rendered",
1629
1679
  transport: t.formieTransport || "rest",
1630
1680
  formHandle: t.formieHandle,
1631
1681
  endpoint: t.formieEndpoint,
1632
- staticCache: _n(t),
1633
- autoVisible: W(t.formieAutoVisible, !0),
1634
- compatibility: W(t.formieCompatibility, !1)
1682
+ staticCache: Dn(t),
1683
+ autoVisible: G(t.formieAutoVisible, !0),
1684
+ compatibility: G(t.formieCompatibility, !1)
1635
1685
  };
1636
1686
  }
1637
- function K(e) {
1687
+ function q(e) {
1638
1688
  return e || "server-rendered";
1639
1689
  }
1640
- function q(e) {
1690
+ function J(e) {
1641
1691
  return e || "rest";
1642
1692
  }
1643
- function J(e) {
1693
+ function Y(e) {
1644
1694
  return e instanceof HTMLFormElement ? e : e.querySelector("form");
1645
1695
  }
1646
- function vn(e, t) {
1647
- gn.has(e) || (gn.add(e), U.warn(t));
1696
+ function On(e, t) {
1697
+ En.has(e) || (En.add(e), W.warn(t));
1648
1698
  }
1649
- function yn(e, t) {
1699
+ function kn(e, t) {
1650
1700
  if (!e) return e;
1651
1701
  try {
1652
1702
  return new URL(e).toString();
@@ -1658,21 +1708,21 @@ function yn(e, t) {
1658
1708
  return e;
1659
1709
  }
1660
1710
  }
1661
- function Y(e, t) {
1711
+ function X(e, t) {
1662
1712
  let n = (e || "").trim();
1663
- return n ? n.includes("/actions/") ? n : yn(t, n) : t;
1713
+ return n ? n.includes("/actions/") ? n : kn(t, n) : t;
1664
1714
  }
1665
- function bn(e, t) {
1666
- return Y(e.endpoint || t.dataset.formieEndpoint, ln);
1715
+ function An(e, t) {
1716
+ return X(e.endpoint || t.dataset.formieEndpoint, yn);
1667
1717
  }
1668
- function xn(e, t) {
1718
+ function jn(e, t) {
1669
1719
  let n = (e.endpoint || t.dataset.formieEndpoint || "").trim();
1670
- return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : yn(un, n) : un;
1720
+ return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : kn(bn, n) : bn;
1671
1721
  }
1672
- function Sn(e, t) {
1673
- return Y(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, dn);
1722
+ function Mn(e, t) {
1723
+ return X(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, xn);
1674
1724
  }
1675
- function Cn(e, t) {
1725
+ function Nn(e, t) {
1676
1726
  if (!e) return t;
1677
1727
  try {
1678
1728
  let n = new URL(e, window.location.origin), r = new URL(t, window.location.origin);
@@ -1683,42 +1733,42 @@ function Cn(e, t) {
1683
1733
  return t;
1684
1734
  }
1685
1735
  }
1686
- function wn(e, t, n) {
1687
- let r = n.endpoint || e.dataset.formieEndpoint, i = Y(r, fn), a = t.getAttribute("action");
1688
- t.setAttribute("action", Cn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1689
- let t = e.getAttribute("href"), n = Y(r, pn);
1690
- e.setAttribute("href", Cn(t, n));
1736
+ function Pn(e, t, n) {
1737
+ let r = n.endpoint || e.dataset.formieEndpoint, i = X(r, Sn), a = t.getAttribute("action");
1738
+ t.setAttribute("action", Nn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1739
+ let t = e.getAttribute("href"), n = X(r, Cn);
1740
+ e.setAttribute("href", Nn(t, n));
1691
1741
  }), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((e) => {
1692
- e.setAttribute("data-formie-file-upload-hydrate-endpoint", Y(r, hn));
1742
+ e.setAttribute("data-formie-file-upload-hydrate-endpoint", X(r, Tn));
1693
1743
  });
1694
1744
  }
1695
- function Tn(e, t) {
1745
+ function Fn(e, t) {
1696
1746
  if (e === "graphql" && t !== "server-rendered") throw Error(`Formie ${t} mode does not support GraphQL transport yet.`);
1697
1747
  }
1698
- function En(e) {
1748
+ function In(e) {
1699
1749
  if (e == null) return !1;
1700
1750
  let t = e.trim().toLowerCase();
1701
1751
  return t === "true" || t === "1" || t === "";
1702
1752
  }
1703
- function Dn(e) {
1704
- return W(e.dataset.formieAutomaticSubmissionState, !0);
1753
+ function Ln(e) {
1754
+ return G(e.dataset.formieAutomaticSubmissionState, !0);
1705
1755
  }
1706
- function On(e, t, n) {
1707
- return Y(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, mn);
1756
+ function Rn(e, t, n) {
1757
+ return X(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, wn);
1708
1758
  }
1709
- function kn(e) {
1710
- return En(e.dataset.formieUnloadWarning);
1759
+ function zn(e) {
1760
+ return In(e.dataset.formieUnloadWarning);
1711
1761
  }
1712
- function An(e, t) {
1762
+ function Bn(e, t) {
1713
1763
  e.setAttribute("data-formie-internal-navigation", t);
1714
1764
  }
1715
- function jn(e) {
1765
+ function Vn(e) {
1716
1766
  e.removeAttribute("data-formie-internal-navigation");
1717
1767
  }
1718
- function Mn(e) {
1768
+ function Hn(e) {
1719
1769
  return e.getAttribute("data-formie-internal-navigation") !== null;
1720
1770
  }
1721
- function Nn(e, t) {
1771
+ function Un(e, t) {
1722
1772
  if (!e) return !1;
1723
1773
  try {
1724
1774
  return new URL(e, window.location.origin).searchParams.has(t);
@@ -1726,30 +1776,30 @@ function Nn(e, t) {
1726
1776
  return !1;
1727
1777
  }
1728
1778
  }
1729
- function Pn(e) {
1730
- return Nn(window.location.href, "resumeToken") || Nn(e.getAttribute("action"), "resumeToken");
1779
+ function Wn(e) {
1780
+ return Un(window.location.href, "resumeToken") || Un(e.getAttribute("action"), "resumeToken");
1731
1781
  }
1732
- function Fn(e) {
1782
+ function Gn(e) {
1733
1783
  return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
1734
1784
  }
1735
- function In(e, t = 0) {
1785
+ function Kn(e, t = 0) {
1736
1786
  if (!e) return t;
1737
1787
  let n = Number.parseInt(e, 10);
1738
1788
  return Number.isFinite(n) ? n : t;
1739
1789
  }
1740
- function Ln(e) {
1741
- return Math.max(0, In(e.dataset.formieSubmitDelay, cn));
1790
+ function qn(e) {
1791
+ return Math.max(0, Kn(e.dataset.formieSubmitDelay, vn));
1742
1792
  }
1743
- function X(e) {
1744
- return En(e.dataset.formieValidationOnSubmit);
1793
+ function Z(e) {
1794
+ return In(e.dataset.formieValidationOnSubmit);
1745
1795
  }
1746
- async function Z(e) {
1747
- let t = Ln(e);
1796
+ async function Jn(e) {
1797
+ let t = qn(e);
1748
1798
  t < 1 || await new Promise((e) => {
1749
1799
  window.setTimeout(e, t);
1750
1800
  });
1751
1801
  }
1752
- function Rn(e, t) {
1802
+ function Yn(e, t) {
1753
1803
  let n = e?.getAttribute(t)?.trim();
1754
1804
  if (!n) return null;
1755
1805
  try {
@@ -1758,29 +1808,29 @@ function Rn(e, t) {
1758
1808
  return console.error(`[formie] Failed to parse ${t}.`, e), null;
1759
1809
  }
1760
1810
  }
1761
- function zn(e, t) {
1811
+ function Xn(e, t) {
1762
1812
  let n = t || (e instanceof HTMLFormElement ? e : null);
1763
1813
  if (!n) return null;
1764
- let r = Rn(n, "data-formie-modules"), i = Rn(n, "data-formie-theme");
1814
+ let r = Yn(n, "data-formie-modules"), i = Yn(n, "data-formie-theme");
1765
1815
  return !r && !i ? null : {
1766
1816
  modules: r || void 0,
1767
1817
  theme: i || void 0
1768
1818
  };
1769
1819
  }
1770
- function Bn(e) {
1820
+ function Zn(e) {
1771
1821
  if (!(e instanceof HTMLElement)) return !0;
1772
1822
  if (!e.isConnected || e.hidden || e.closest("[hidden]")) return !1;
1773
1823
  let t = window.getComputedStyle(e);
1774
1824
  return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
1775
1825
  }
1776
- function Vn(e, t) {
1826
+ function Qn(e, t) {
1777
1827
  return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
1778
1828
  }
1779
1829
  function Q(e) {
1780
1830
  let t = e, n = t.id ? `#${t.id}` : "", r = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
1781
1831
  return `${t.tagName ? t.tagName.toLowerCase() : "element"}${n}${r}`;
1782
1832
  }
1783
- function Hn(e, t) {
1833
+ function $n(e, t) {
1784
1834
  if (t) {
1785
1835
  if (t.csrf?.param && t.csrf?.token) {
1786
1836
  let n = e.querySelector(`input[name="${t.csrf.param}"]`);
@@ -1803,12 +1853,12 @@ function Hn(e, t) {
1803
1853
  });
1804
1854
  }
1805
1855
  }
1806
- async function Un(e, t) {
1807
- let n = K(t.mode), r = q(t.transport);
1856
+ async function er(e, t) {
1857
+ let n = q(t.mode), r = J(t.transport);
1808
1858
  if (n !== "server-rendered") return null;
1809
1859
  if (t.payload) return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
1810
- Tn(r, n);
1811
- let i = !!J(e), a = t.formHandle || e.dataset.formieHandle;
1860
+ Fn(r, n);
1861
+ let i = !!Y(e), a = t.formHandle || e.dataset.formieHandle;
1812
1862
  if (i || !a) return null;
1813
1863
  let o = {
1814
1864
  mode: n,
@@ -1817,30 +1867,30 @@ async function Un(e, t) {
1817
1867
  siteId: t.siteId,
1818
1868
  theme: t.theme,
1819
1869
  themeConfig: t.themeConfig
1820
- }, s = r === "graphql" ? xn(t, e) : bn(t, e), c = r === "graphql" ? await Le(s, a, o) : await Ie(s, a, {
1870
+ }, s = r === "graphql" ? jn(t, e) : An(t, e), c = r === "graphql" ? await Be(s, a, o) : await ze(s, a, {
1821
1871
  ...o,
1822
1872
  endpoint: s
1823
1873
  });
1824
1874
  return c?.html && (e.innerHTML = c.html), c;
1825
1875
  }
1826
- async function Wn(e, t, n) {
1876
+ async function tr(e, t, n) {
1827
1877
  if (t.refreshTokens === !1) return;
1828
- Tn(q(t.transport), K(t.mode));
1878
+ Fn(J(t.transport), q(t.mode));
1829
1879
  let r = t.formHandle || e.dataset.formieHandle;
1830
1880
  if (!r) return;
1831
- let i = await Re(Sn(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0);
1832
- Hn(n, i), O(e, "formie:refresh-tokens:refreshed", i);
1881
+ let i = await Ve(Mn(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0);
1882
+ $n(n, i), u(e, "formie:refresh-tokens:refreshed", i);
1833
1883
  }
1834
- function Gn(e, t, n, r, i, a) {
1835
- let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = On(n, e, t), c = !1, l = t.querySelectorAll("[data-formie-action]"), u = (e) => {
1884
+ function nr(e, t, n, r, i, a) {
1885
+ let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = Rn(n, e, t), c = !1, h = t.querySelectorAll("[data-formie-action]"), g = (e) => {
1836
1886
  if (e) {
1837
1887
  t.setAttribute("data-formie-pending-action", e);
1838
1888
  return;
1839
1889
  }
1840
1890
  t.removeAttribute("data-formie-pending-action");
1841
1891
  };
1842
- if (kn(t)) {
1843
- let n = sn(t, { shouldWarn: () => !Mn(t) }), r = (e) => {
1892
+ if (zn(t)) {
1893
+ let n = fn(t, { shouldWarn: () => !Hn(t) }), r = (e) => {
1844
1894
  if (!(e instanceof CustomEvent)) return;
1845
1895
  let t = e.detail;
1846
1896
  t?.ok && t.action === "save" && n.scheduleBaselineCapture();
@@ -1851,10 +1901,10 @@ function Gn(e, t, n, r, i, a) {
1851
1901
  e.removeEventListener("formie:submit:result", r), t.removeEventListener("formie:state:reset", i), n.destroy();
1852
1902
  });
1853
1903
  }
1854
- if (l.forEach((e) => {
1904
+ if (h.forEach((e) => {
1855
1905
  let n = (e) => {
1856
1906
  let n = e.currentTarget.getAttribute("data-formie-action"), r = t.querySelector("input[name=\"submitAction\"]");
1857
- u(n), n && r && (r.value = n);
1907
+ g(n), n && r && (r.value = n);
1858
1908
  };
1859
1909
  e.addEventListener("click", n), a.push(() => {
1860
1910
  e.removeEventListener("click", n);
@@ -1862,24 +1912,24 @@ function Gn(e, t, n, r, i, a) {
1862
1912
  }), t.querySelectorAll("[data-formie-tab-link]").forEach((n) => {
1863
1913
  let r = async (n) => {
1864
1914
  if (o !== "ajax") {
1865
- Fn(n) && An(t, "set-page");
1915
+ Gn(n) && Bn(t, "set-page");
1866
1916
  return;
1867
1917
  }
1868
1918
  n.preventDefault();
1869
1919
  let r = n.currentTarget, i = r?.getAttribute("data-formie-page-id"), a = r?.getAttribute("href");
1870
1920
  if (!(!i || !a)) {
1871
- g(t, i), O(e, "formie:page:navigate", {
1921
+ p(t, i), u(e, "formie:page:navigate", {
1872
1922
  pageId: i,
1873
1923
  href: a
1874
1924
  });
1875
1925
  try {
1876
- O(e, "formie:page:navigate:after", {
1926
+ u(e, "formie:page:navigate:after", {
1877
1927
  pageId: i,
1878
1928
  href: a,
1879
- response: await ze(a, t, i)
1929
+ response: await He(a, t, i)
1880
1930
  });
1881
1931
  } catch (t) {
1882
- console.error("[formie] Failed to persist page navigation state.", t), O(e, "formie:page:navigate:error", {
1932
+ console.error("[formie] Failed to persist page navigation state.", t), u(e, "formie:page:navigate:error", {
1883
1933
  pageId: i,
1884
1934
  href: a,
1885
1935
  error: t
@@ -1890,50 +1940,50 @@ function Gn(e, t, n, r, i, a) {
1890
1940
  n.addEventListener("click", r), a.push(() => {
1891
1941
  n.removeEventListener("click", r);
1892
1942
  });
1893
- }), !Dn(t)) {
1943
+ }), !Ln(t)) {
1894
1944
  let e = !1, n = () => {
1895
- e || Mn(t) || Pn(t) || (e = !0, Be(s, t));
1945
+ e || Hn(t) || Wn(t) || (e = !0, Ue(s, t));
1896
1946
  };
1897
1947
  window.addEventListener("pagehide", n), window.addEventListener("beforeunload", n), a.push(() => {
1898
1948
  window.removeEventListener("pagehide", n), window.removeEventListener("beforeunload", n);
1899
1949
  });
1900
1950
  }
1901
- let d = async (a) => {
1951
+ let _ = async (a) => {
1902
1952
  if (c) return;
1903
1953
  let s = o === "ajax";
1904
1954
  if (a.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
1905
1955
  if (t.getAttribute("data-formie-internal-resubmit") !== "true") return;
1906
1956
  t.removeAttribute("data-formie-internal-resubmit");
1907
1957
  } else t.removeAttribute("data-formie-internal-resubmit");
1908
- let l = a.submitter, d = l?.getAttribute("data-formie-action"), f = t.getAttribute("data-formie-pending-action"), p = t.querySelector("input[name=\"submitAction\"]"), g = d || f || p?.value || "submit", v = null, y = !1;
1958
+ let p = a.submitter, h = p?.getAttribute("data-formie-action"), _ = t.getAttribute("data-formie-pending-action"), v = t.querySelector("input[name=\"submitAction\"]"), y = h || _ || v?.value || "submit", b = null, x = !1;
1909
1959
  try {
1910
- if (s) v = await Bt({
1960
+ if (s) b = await Gt({
1911
1961
  target: e,
1912
1962
  form: t,
1913
1963
  bus: r,
1914
1964
  validator: i,
1915
- validateOnSubmit: X(t),
1916
- action: g,
1917
- submitter: l,
1918
- waitForSubmitDelay: Z,
1965
+ validateOnSubmit: Z(t),
1966
+ action: y,
1967
+ submitter: p,
1968
+ waitForSubmitDelay: Jn,
1919
1969
  onRefreshTokensAfterSubmit: async () => {
1920
- await Wn(e, n, t);
1970
+ await tr(e, n, t);
1921
1971
  },
1922
1972
  dispatchSubmitResult: (t) => {
1923
- O(e, "formie:submit:result", t);
1973
+ u(e, "formie:submit:result", t);
1924
1974
  }
1925
1975
  });
1926
1976
  else {
1927
- if (zt(t), _(t, l), await Z(t), v = await $e(t, g, r, {
1977
+ if (Wt(t), m(t, p), await Jn(t), b = await nt(t, y, r, {
1928
1978
  validator: i,
1929
- validateOnSubmit: X(t),
1979
+ validateOnSubmit: Z(t),
1930
1980
  preflightOnly: !0
1931
- }), v.ok) {
1932
- ee(t, g), c = !0, An(t, "submit"), u(null);
1981
+ }), b.ok) {
1982
+ l(t, y), c = !0, Bn(t, "submit"), g(null);
1933
1983
  let e = !1, n = () => {
1934
- if (e = !0, c = !1, jn(t), m(t), i && X(t)) {
1935
- let { scope: e, final: n } = h(t), r = i.submit(n ? t : e, { final: n });
1936
- r.length > 0 && I(t, {
1984
+ if (e = !0, c = !1, Vn(t), d(t), i && Z(t)) {
1985
+ let { scope: e, final: n } = f(t), r = i.submit(n ? t : e, { final: n });
1986
+ r.length > 0 && F(t, {
1937
1987
  ok: !1,
1938
1988
  stage: "validate",
1939
1989
  code: "VALIDATION_FAILED",
@@ -1952,36 +2002,36 @@ function Gn(e, t, n, r, i, a) {
1952
2002
  }
1953
2003
  } else t.submit();
1954
2004
  if (e) return;
1955
- y = !0;
2005
+ x = !0;
1956
2006
  return;
1957
2007
  }
1958
- I(t, v), O(e, "formie:submit:result", v), jn(t);
2008
+ F(t, b), u(e, "formie:submit:result", b), Vn(t);
1959
2009
  }
1960
2010
  } catch (n) {
1961
- c = !1, v = {
2011
+ c = !1, b = {
1962
2012
  ok: !1,
1963
2013
  code: "SUBMIT_ERROR",
1964
2014
  message: n instanceof Error ? n.message : "Submission failed.",
1965
2015
  formErrors: [n instanceof Error ? n.message : "Submission failed."]
1966
- }, I(t, v), O(e, "formie:submit:result", v), jn(t);
2016
+ }, F(t, b), u(e, "formie:submit:result", b), Vn(t);
1967
2017
  } finally {
1968
- u(null), !s && !y && !Rt(v) && m(t);
2018
+ g(null), !s && !x && !Ut(b) && d(t);
1969
2019
  }
1970
2020
  };
1971
- t.addEventListener("submit", d), a.push(() => {
1972
- t.removeEventListener("submit", d);
2021
+ t.addEventListener("submit", _), a.push(() => {
2022
+ t.removeEventListener("submit", _);
1973
2023
  });
1974
2024
  }
1975
- async function Kn(e, t, n) {
2025
+ async function rr(e, t, n) {
1976
2026
  if (t.refreshTokens === !1 || !t.staticCache) return;
1977
- Tn(q(t.transport), K(t.mode));
1978
- let r = t.formHandle || e.dataset.formieHandle, i = Sn(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
2027
+ Fn(J(t.transport), q(t.mode));
2028
+ let r = t.formHandle || e.dataset.formieHandle, i = Mn(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
1979
2029
  if (!r) return;
1980
- let o = await Re(i, r, a);
1981
- !o || !n || (Hn(n, o), O(e, "formie:refresh-tokens:after", o));
2030
+ let o = await Ve(i, r, a);
2031
+ !o || !n || ($n(n, o), u(e, "formie:refresh-tokens:after", o));
1982
2032
  }
1983
- function qn() {
1984
- let e = /* @__PURE__ */ new Map(), t = new Vt(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [
2033
+ function ir() {
2034
+ let e = /* @__PURE__ */ new Map(), t = new I(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [
1985
2035
  "prepare",
1986
2036
  "normalize",
1987
2037
  "validate",
@@ -1996,19 +2046,19 @@ function qn() {
1996
2046
  return;
1997
2047
  }
1998
2048
  let a = (async () => {
1999
- U.log("Unmount requested.", { target: Q(t) });
2049
+ W.log("Unmount requested.", { target: Q(t) });
2000
2050
  let r = n.get(t);
2001
2051
  r && (r(), n.delete(t));
2002
2052
  let i = e.get(t);
2003
2053
  if (!i) {
2004
- U.log("Unmount skipped (no mounted state).", { target: Q(t) });
2054
+ W.log("Unmount skipped (no mounted state).", { target: Q(t) });
2005
2055
  return;
2006
2056
  }
2007
- O(t, "formie:unmount:before", { id: i.instance.id }), i.unbinds.forEach((e) => {
2057
+ u(t, "formie:unmount:before", { id: i.instance.id }), i.unbinds.forEach((e) => {
2008
2058
  e();
2009
2059
  }), i.unbinds = [], i.validator?.destroy(), i.validator = null;
2010
2060
  for (let e of i.modules) await e.destroy();
2011
- i.modules = [], i.bus.clear(), e.delete(t), O(t, "formie:unmount:after", { id: i.instance.id }), U.log("Unmount complete.", {
2061
+ i.modules = [], i.bus.clear(), e.delete(t), u(t, "formie:unmount:after", { id: i.instance.id }), W.log("Unmount complete.", {
2012
2062
  id: i.instance.id,
2013
2063
  target: Q(t)
2014
2064
  });
@@ -2017,7 +2067,7 @@ function qn() {
2017
2067
  });
2018
2068
  r.set(t, a), await a;
2019
2069
  }, o = async (r, o) => {
2020
- U.log("Mount requested.", {
2070
+ W.log("Mount requested.", {
2021
2071
  target: Q(r),
2022
2072
  mode: o.mode,
2023
2073
  autoVisible: o.autoVisible
@@ -2025,115 +2075,116 @@ function qn() {
2025
2075
  let s = n.get(r);
2026
2076
  s && (s(), n.delete(r));
2027
2077
  let c = e.get(r);
2028
- if (c) return U.log("Mount skipped (already mounted).", {
2078
+ if (c) return W.log("Mount skipped (already mounted).", {
2029
2079
  id: c.instance.id,
2030
2080
  target: Q(r)
2031
2081
  }), c.instance;
2032
- let l = new Me(), u = [], d = r?.id || `formie-${e.size + 1}`, f = G(r), p = {
2033
- ...f,
2082
+ let l = new Fe(), d = [], f = r?.id || `formie-${e.size + 1}`, p = K(r), m = {
2083
+ ...p,
2034
2084
  ...o,
2035
- mode: K(o.mode ?? f.mode),
2036
- transport: q(o.transport ?? f.transport)
2037
- }, ee = _e(p.compatibility);
2038
- if (p.mode !== "server-rendered" && !J(r)) throw Error(`Formie ${p.mode} mode is not implemented yet in the browser client.`);
2039
- let m = await Un(r, p), h = J(r);
2040
- p.staticCache = o.staticCache ?? _n(h ? h.dataset : r.dataset);
2041
- let g = zn(r, h), _ = m || g ? {
2042
- ...m || {},
2043
- ...g || {}
2044
- } : null, v = _?.theme, b = {}, S = (_?.modules || []).filter((e) => !!e?.id && !!e?.type);
2045
- U.log("Resolved mount payload.", {
2085
+ mode: q(o.mode ?? p.mode),
2086
+ transport: J(o.transport ?? p.transport)
2087
+ }, h = _e(m.compatibility);
2088
+ if (m.mode !== "server-rendered" && !Y(r)) throw Error(`Formie ${m.mode} mode is not implemented yet in the browser client.`);
2089
+ let _ = await er(r, m), y = Y(r);
2090
+ m.staticCache = o.staticCache ?? Dn(y ? y.dataset : r.dataset);
2091
+ let b = Xn(r, y), x = _ || b ? {
2092
+ ..._ || {},
2093
+ ...b || {}
2094
+ } : null, ee = x?.theme, S = {}, C = (x?.modules || []).filter((e) => !!e?.id && !!e?.type);
2095
+ W.log("Resolved mount payload.", {
2046
2096
  target: Q(r),
2047
- hasRenderPayload: !!m,
2048
- hasEmbeddedPayload: !!g,
2049
- moduleCount: S.length
2097
+ hasRenderPayload: !!_,
2098
+ hasEmbeddedPayload: !!b,
2099
+ moduleCount: C.length
2050
2100
  });
2051
- let C = te(r, v, h), w = h ? new dt(h, {
2052
- live: En(h.dataset.formieValidationOnFocus),
2053
- errorMessage: h.dataset.formieErrorMessage || "",
2054
- fieldContainerErrorClass: C.fieldLayoutError || [],
2055
- inputErrorClass: C.fieldControlError || [],
2056
- messagesClass: C.fieldErrors || [],
2057
- messageClass: C.fieldError || []
2101
+ let w = te(r, ee, y), T = y ? new mt(y, {
2102
+ live: In(y.dataset.formieValidationOnFocus),
2103
+ errorAriaLive: we(y),
2104
+ errorMessage: y.dataset.formieErrorMessage || "",
2105
+ fieldContainerErrorClass: w.fieldLayoutError || [],
2106
+ inputErrorClass: w.fieldControlError || [],
2107
+ messagesClass: w.fieldErrors || [],
2108
+ messageClass: w.fieldError || []
2058
2109
  }) : null;
2059
- if (h && w) {
2060
- let e = h;
2061
- e.formieValidation = w, b.validation = w;
2110
+ if (y && T) {
2111
+ let e = y;
2112
+ e.formieValidation = T, S.validation = T;
2062
2113
  let t = {
2063
- validator: w,
2064
- addValidator: w.addValidator.bind(w),
2065
- removeValidator: w.removeValidator.bind(w)
2114
+ validator: T,
2115
+ addValidator: T.addValidator.bind(T),
2116
+ removeValidator: T.removeValidator.bind(T)
2066
2117
  };
2067
- O(h, "formie:validator:ready", t), O(r, "formie:validator:ready", t);
2118
+ u(y, "formie:validator:ready", t), u(r, "formie:validator:ready", t);
2068
2119
  }
2069
- h && ((m || p.endpoint || r.dataset.formieEndpoint) && wn(r, h, p), p.mode === "server-rendered" && Ae(h) && (ke(h), je(h)), x(h)), Object.keys(C).length && O(r, "formie:theme:applied", { hasClasses: !0 });
2070
- let T = await en(S, {
2120
+ y && (sn(y), (_ || m.endpoint || r.dataset.formieEndpoint) && Pn(r, y, m), m.mode === "server-rendered" && Ne(y) && (Me(y), Pe(y)), v(y)), Object.keys(w).length && u(r, "formie:theme:applied", { hasClasses: !0 });
2121
+ let E = await an(C, {
2071
2122
  registry: t,
2072
2123
  matchContext: {
2073
2124
  root: r,
2074
- form: h,
2075
- mode: p.mode
2125
+ form: y,
2126
+ mode: m.mode
2076
2127
  },
2077
2128
  setupContext: {
2078
- formId: d,
2129
+ formId: f,
2079
2130
  root: r,
2080
- form: h,
2131
+ form: y,
2081
2132
  target: r,
2082
2133
  scope: "form",
2083
- state: b,
2134
+ state: S,
2084
2135
  on: (e, t) => l.on(e, t),
2085
- emit: (e, t) => (O(r, e, t), l.emitSafe(e, t).then((t) => {
2086
- t.failed.length > 0 && U.warn("Lifecycle listeners failed.", {
2136
+ emit: (e, t) => (u(r, e, t), l.emitSafe(e, t).then((t) => {
2137
+ t.failed.length > 0 && W.warn("Lifecycle listeners failed.", {
2087
2138
  eventName: e,
2088
2139
  failed: t.failed.length
2089
2140
  });
2090
2141
  }))
2091
2142
  }
2092
2143
  });
2093
- U.log("Module setup complete.", {
2144
+ W.log("Module setup complete.", {
2094
2145
  target: Q(r),
2095
- moduleInstances: T.length
2146
+ moduleInstances: E.length
2096
2147
  });
2097
- let E = {
2098
- id: d,
2148
+ let D = {
2149
+ id: f,
2099
2150
  root: r,
2100
2151
  submit: async (e = "submit") => {
2101
- if (U.log("Submit requested.", {
2102
- id: d,
2152
+ if (W.log("Submit requested.", {
2153
+ id: f,
2103
2154
  target: Q(r),
2104
2155
  action: e
2105
- }), !h) return {
2156
+ }), !y) return {
2106
2157
  ok: !1,
2107
2158
  code: "FORM_NOT_FOUND",
2108
2159
  message: "No form element found for mount target.",
2109
2160
  formErrors: ["No form element found for mount target."]
2110
2161
  };
2111
- let t = h.querySelector("input[name=\"submitAction\"]");
2112
- if (t && (t.value = e), h.getAttribute("data-formie-loading") === "true") return {
2162
+ let t = y.querySelector("input[name=\"submitAction\"]");
2163
+ if (t && (t.value = e), y.getAttribute("data-formie-loading") === "true") return {
2113
2164
  ok: !1,
2114
2165
  code: "SUBMIT_IN_PROGRESS",
2115
2166
  message: "Submission already in progress.",
2116
2167
  formErrors: []
2117
2168
  };
2118
- let n = h.querySelector(`[data-formie-action="${e}"]`), i = await Bt({
2119
- id: d,
2169
+ let n = y.querySelector(`[data-formie-action="${e}"]`), i = await Gt({
2170
+ id: f,
2120
2171
  target: r,
2121
- form: h,
2172
+ form: y,
2122
2173
  bus: l,
2123
- validator: w,
2124
- validateOnSubmit: X(h),
2174
+ validator: T,
2175
+ validateOnSubmit: Z(y),
2125
2176
  action: e,
2126
2177
  submitter: n,
2127
- waitForSubmitDelay: Z,
2178
+ waitForSubmitDelay: Jn,
2128
2179
  onRefreshTokensAfterSubmit: async () => {
2129
- await Wn(r, p, h);
2180
+ await tr(r, m, y);
2130
2181
  },
2131
2182
  dispatchSubmitResult: (e) => {
2132
- O(r, "formie:submit:result", e);
2183
+ u(r, "formie:submit:result", e);
2133
2184
  }
2134
2185
  });
2135
- return U.log("Submit completed.", {
2136
- id: d,
2186
+ return W.log("Submit completed.", {
2187
+ id: f,
2137
2188
  action: e,
2138
2189
  ok: i.ok,
2139
2190
  code: i.code,
@@ -2145,73 +2196,73 @@ function qn() {
2145
2196
  },
2146
2197
  on: (e, t) => l.on(e, t)
2147
2198
  };
2148
- h && (we({
2199
+ y && (Ce({
2149
2200
  target: r,
2150
- form: h,
2151
- validatorDetail: w ? {
2152
- validator: w,
2153
- addValidator: w.addValidator.bind(w),
2154
- removeValidator: w.removeValidator.bind(w)
2201
+ form: y,
2202
+ validatorDetail: T ? {
2203
+ validator: T,
2204
+ addValidator: T.addValidator.bind(T),
2205
+ removeValidator: T.removeValidator.bind(T)
2155
2206
  } : null,
2156
- options: ee,
2157
- unbinds: u
2207
+ options: h,
2208
+ unbinds: d
2158
2209
  }), Se({
2159
2210
  target: r,
2160
- form: h,
2161
- instance: E,
2162
- options: ee,
2163
- unbinds: u
2164
- })), h && (Gn(r, h, p, l, w, u), w && u.push(y(h, w, r)), await Kn(r, p, h)), i.forEach((e) => {
2211
+ form: y,
2212
+ instance: D,
2213
+ options: h,
2214
+ unbinds: d
2215
+ })), y && (nr(r, y, m, l, T, d), T && (d.push(g(y, T, r)), d.push(_n(y))), await rr(r, m, y)), i.forEach((e) => {
2165
2216
  let t = l.on(`formie:stage:${e}:before`, async (t) => {
2166
- O(r, `formie:stage:${e}:before`, t);
2217
+ u(r, `formie:stage:${e}:before`, t);
2167
2218
  }), n = l.on(`formie:stage:${e}:before`, async (e) => {
2168
- for (let t of T) t.onBeforeStage && await t.onBeforeStage(e);
2219
+ for (let t of E) t.onBeforeStage && await t.onBeforeStage(e);
2169
2220
  }), i = l.on(`formie:stage:${e}:after`, async (t) => {
2170
- O(r, `formie:stage:${e}:after`, t);
2221
+ u(r, `formie:stage:${e}:after`, t);
2171
2222
  }), a = l.on(`formie:stage:${e}:after`, async (e) => {
2172
2223
  let t = e;
2173
- for (let e of T) e.onAfterStage && await e.onAfterStage(t, t.result);
2224
+ for (let e of E) e.onAfterStage && await e.onAfterStage(t, t.result);
2174
2225
  });
2175
- u.push(t, n, i, a);
2226
+ d.push(t, n, i, a);
2176
2227
  });
2177
2228
  let ne = l.on("formie:submit:before", async (e) => {
2178
- O(r, "formie:submit:before", e);
2229
+ u(r, "formie:submit:before", e);
2179
2230
  }), re = l.on("formie:submit:after", async (e) => {
2180
- O(r, "formie:submit:after", e);
2231
+ u(r, "formie:submit:after", e);
2181
2232
  }), ie = l.on("formie:submit:final:before", async (e) => {
2182
- O(r, "formie:submit:final:before", e);
2233
+ u(r, "formie:submit:final:before", e);
2183
2234
  }), ae = l.on("formie:submit:final:after", async (e) => {
2184
- O(r, "formie:submit:final:after", e);
2235
+ u(r, "formie:submit:final:after", e);
2185
2236
  });
2186
- return u.push(ne, re, ie, ae), e.set(r, {
2187
- options: p,
2237
+ return d.push(ne, re, ie, ae), e.set(r, {
2238
+ options: m,
2188
2239
  bus: l,
2189
- form: h,
2190
- validator: w,
2191
- modules: T,
2192
- unbinds: u,
2193
- instance: E
2194
- }), O(r, "formie:mount:after", {
2195
- id: d,
2196
- mode: p.mode
2197
- }), U.log("Mount complete.", {
2198
- id: d,
2240
+ form: y,
2241
+ validator: T,
2242
+ modules: E,
2243
+ unbinds: d,
2244
+ instance: D
2245
+ }), u(r, "formie:mount:after", {
2246
+ id: f,
2247
+ mode: m.mode
2248
+ }), W.log("Mount complete.", {
2249
+ id: f,
2199
2250
  target: Q(r),
2200
- mode: p.mode
2201
- }), E;
2251
+ mode: m.mode
2252
+ }), D;
2202
2253
  }, s = (t, r) => {
2203
- if (!r.autoVisible || Bn(t) || typeof IntersectionObserver > "u") return o(t, r);
2254
+ if (!r.autoVisible || Zn(t) || typeof IntersectionObserver > "u") return o(t, r);
2204
2255
  if (e.has(t)) return Promise.resolve(e.get(t)?.instance || null);
2205
- if (n.has(t)) return U.log("Mount deferred (already waiting visibility).", { target: Q(t) }), Promise.resolve(null);
2256
+ if (n.has(t)) return W.log("Mount deferred (already waiting visibility).", { target: Q(t) }), Promise.resolve(null);
2206
2257
  let i = new IntersectionObserver((e) => {
2207
- e.some((e) => e.target === t && e.isIntersecting) && (i.disconnect(), n.delete(t), U.log("Visibility reached, proceeding mount.", { target: Q(t) }), o(t, {
2258
+ e.some((e) => e.target === t && e.isIntersecting) && (i.disconnect(), n.delete(t), W.log("Visibility reached, proceeding mount.", { target: Q(t) }), o(t, {
2208
2259
  ...r,
2209
2260
  autoVisible: !1
2210
2261
  }));
2211
2262
  }, { threshold: .01 });
2212
2263
  return i.observe(t), n.set(t, () => {
2213
2264
  i.disconnect();
2214
- }), U.log("Mount deferred until visible.", { target: Q(t) }), Promise.resolve(null);
2265
+ }), W.log("Mount deferred until visible.", { target: Q(t) }), Promise.resolve(null);
2215
2266
  };
2216
2267
  return {
2217
2268
  mount: o,
@@ -2219,7 +2270,7 @@ function qn() {
2219
2270
  update: async (t, n) => {
2220
2271
  let r = e.get(t);
2221
2272
  if (!r) return o(t, {
2222
- ...G(t),
2273
+ ...K(t),
2223
2274
  ...n,
2224
2275
  mode: n.mode || "server-rendered"
2225
2276
  });
@@ -2227,32 +2278,32 @@ function qn() {
2227
2278
  ...r.options,
2228
2279
  ...n
2229
2280
  };
2230
- let i = te(t, n.payload?.theme || r.options.payload?.theme || zn(t, r.form)?.theme, r.form);
2231
- return r.validator && (r.validator.config.fieldContainerErrorClass = i.fieldLayoutError || [], r.validator.config.inputErrorClass = i.fieldControlError || [], r.validator.config.messagesClass = i.fieldErrors || [], r.validator.config.messageClass = i.fieldError || []), Object.keys(i).length && O(t, "formie:theme:applied", {
2281
+ let i = te(t, n.payload?.theme || r.options.payload?.theme || Xn(t, r.form)?.theme, r.form);
2282
+ return r.validator && (r.validator.config.fieldContainerErrorClass = i.fieldLayoutError || [], r.validator.config.inputErrorClass = i.fieldControlError || [], r.validator.config.messagesClass = i.fieldErrors || [], r.validator.config.messageClass = i.fieldError || []), Object.keys(i).length && u(t, "formie:theme:applied", {
2232
2283
  hasClasses: !0,
2233
2284
  reason: "update"
2234
2285
  }), r.instance;
2235
2286
  },
2236
2287
  getInstance: (t) => e.get(t)?.instance || null,
2237
2288
  refreshForCache: async (t) => {
2238
- vn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2289
+ On("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2239
2290
  let n = null;
2240
2291
  if (n = typeof t == "string" ? document.getElementById(t) || document.querySelector(`[data-formie-form-id="${t}"]`) : t, !n) {
2241
- U.warn("refreshForCache target not found.", { targetOrId: t });
2292
+ W.warn("refreshForCache target not found.", { targetOrId: t });
2242
2293
  return;
2243
2294
  }
2244
- let r = e.get(n), i = J(n), a = r?.options || G(n);
2295
+ let r = e.get(n), i = Y(n), a = r?.options || K(n);
2245
2296
  if (!i) {
2246
- U.warn("refreshForCache found no form element for target.", { target: Q(n) });
2297
+ W.warn("refreshForCache found no form element for target.", { target: Q(n) });
2247
2298
  return;
2248
2299
  }
2249
- let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Sn(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2300
+ let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Mn(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2250
2301
  if (!o) {
2251
- U.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2302
+ W.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2252
2303
  return;
2253
2304
  }
2254
- let l = await Re(s, o, c);
2255
- l && (Hn(i, l), O(n, "formie:refresh-tokens:after", l));
2305
+ let l = await Ve(s, o, c);
2306
+ l && ($n(i, l), u(n, "formie:refresh-tokens:after", l));
2256
2307
  },
2257
2308
  registerModule: (e, n) => t.register(e, n),
2258
2309
  unregisterModule: (e) => {
@@ -2260,13 +2311,13 @@ function qn() {
2260
2311
  },
2261
2312
  getRegisteredModules: () => t.getAll(),
2262
2313
  scan: async (e) => {
2263
- let t = e || document, n = Array.from(t.querySelectorAll(H));
2264
- U.log("Scan started.", {
2314
+ let t = e || document, n = Array.from(t.querySelectorAll(U));
2315
+ W.log("Scan started.", {
2265
2316
  scope: t === document ? "document" : t,
2266
2317
  targetCount: n.length
2267
2318
  });
2268
- let r = (await Promise.all(n.map((e) => s(e, G(e))))).filter((e) => !!e);
2269
- return U.log("Scan finished.", {
2319
+ let r = (await Promise.all(n.map((e) => s(e, K(e))))).filter((e) => !!e);
2320
+ return W.log("Scan finished.", {
2270
2321
  mountedCount: r.length,
2271
2322
  deferredCount: n.length - r.length
2272
2323
  }), r;
@@ -2274,16 +2325,16 @@ function qn() {
2274
2325
  observe: (t) => {
2275
2326
  if (typeof MutationObserver > "u") return () => {};
2276
2327
  let r = t || document;
2277
- U.log("Observer started.", { scope: r === document ? "document" : r });
2328
+ W.log("Observer started.", { scope: r === document ? "document" : r });
2278
2329
  let i = new MutationObserver((t) => {
2279
2330
  t.forEach((t) => {
2280
2331
  t.addedNodes.forEach((e) => {
2281
- e instanceof Element && (e.matches(H) && (U.log("Observer detected new root.", { target: Q(e) }), s(e, G(e))), e.querySelectorAll(H).forEach((e) => {
2282
- U.log("Observer detected new nested root.", { target: Q(e) }), s(e, G(e));
2332
+ e instanceof Element && (e.matches(U) && (W.log("Observer detected new root.", { target: Q(e) }), s(e, K(e))), e.querySelectorAll(U).forEach((e) => {
2333
+ W.log("Observer detected new nested root.", { target: Q(e) }), s(e, K(e));
2283
2334
  }));
2284
2335
  }), t.removedNodes.forEach((t) => {
2285
- t instanceof Element && (e.has(t) && (U.log("Observer detected removed root.", { target: Q(t) }), a(t)), t.querySelectorAll(H).forEach((t) => {
2286
- e.has(t) && (U.log("Observer detected removed nested root.", { target: Q(t) }), a(t));
2336
+ t instanceof Element && (e.has(t) && (W.log("Observer detected removed root.", { target: Q(t) }), a(t)), t.querySelectorAll(U).forEach((t) => {
2337
+ e.has(t) && (W.log("Observer detected removed nested root.", { target: Q(t) }), a(t));
2287
2338
  }));
2288
2339
  });
2289
2340
  });
@@ -2292,11 +2343,11 @@ function qn() {
2292
2343
  childList: !0,
2293
2344
  subtree: !0
2294
2345
  }), () => {
2295
- i.disconnect(), U.log("Observer stopped."), n.forEach((e, t) => {
2296
- Vn(t, r) && (e(), n.delete(t));
2346
+ i.disconnect(), W.log("Observer stopped."), n.forEach((e, t) => {
2347
+ Qn(t, r) && (e(), n.delete(t));
2297
2348
  });
2298
2349
  let t = [];
2299
- r instanceof Element && r.matches(H) && t.push(r), r.querySelectorAll(H).forEach((e) => {
2350
+ r instanceof Element && r.matches(U) && t.push(r), r.querySelectorAll(U).forEach((e) => {
2300
2351
  t.push(e);
2301
2352
  }), t.forEach((t) => {
2302
2353
  e.has(t) && a(t);
@@ -2307,9 +2358,9 @@ function qn() {
2307
2358
  }
2308
2359
  //#endregion
2309
2360
  //#region src/js/core/hydrate-modules.ts
2310
- var Jn = d("general", "module-hydrator");
2311
- async function Yn(e) {
2312
- let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), r = e.modules ?? [], i = e.mode ?? "server-rendered", a = e.registry ?? new Vt(), o = new Me(), s = await en(r, {
2361
+ var ar = S("general", "module-hydrator");
2362
+ async function or(e) {
2363
+ let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), r = e.modules ?? [], i = e.mode ?? "server-rendered", a = e.registry ?? new I(), o = new Fe(), s = await an(r, {
2313
2364
  registry: a,
2314
2365
  setupContext: {
2315
2366
  formId: n?.id || t.id || "formie-modules",
@@ -2330,13 +2381,13 @@ async function Yn(e) {
2330
2381
  mode: i
2331
2382
  }
2332
2383
  });
2333
- return Jn.log("Hydrated module manifest.", {
2384
+ return ar.log("Hydrated module manifest.", {
2334
2385
  moduleCount: r.length,
2335
2386
  instanceCount: s.length,
2336
2387
  mode: i
2337
2388
  }), {
2338
2389
  destroy: async () => {
2339
- await Xn(s), o.clear();
2390
+ await sr(s), o.clear();
2340
2391
  },
2341
2392
  on: (e, t) => o.on(e, t),
2342
2393
  emit: async (e, t) => {
@@ -2349,11 +2400,11 @@ async function Yn(e) {
2349
2400
  getRegisteredModules: () => a.getAll()
2350
2401
  };
2351
2402
  }
2352
- async function Xn(e) {
2403
+ async function sr(e) {
2353
2404
  for (let t of e) try {
2354
2405
  await t.destroy();
2355
2406
  } catch (e) {
2356
- console.error("[formie] Failed to destroy module instance.", e), Jn.warn("Failed destroying module instance.", { error: e });
2407
+ console.error("[formie] Failed to destroy module instance.", e), ar.warn("Failed destroying module instance.", { error: e });
2357
2408
  }
2358
2409
  }
2359
2410
  //#endregion
@@ -2361,41 +2412,41 @@ async function Xn(e) {
2361
2412
  function $(e) {
2362
2413
  return e instanceof Element;
2363
2414
  }
2364
- function Zn(e) {
2415
+ function cr(e) {
2365
2416
  return e.ok;
2366
2417
  }
2367
- function Qn(e) {
2418
+ function lr(e) {
2368
2419
  return typeof e == "string" ? `selector "${e}"` : $(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2369
2420
  }
2370
- function $n(e) {
2421
+ function ur(e) {
2371
2422
  let t = /* @__PURE__ */ new Set(), n = [];
2372
2423
  for (let r of e) !$(r) || t.has(r) || (t.add(r), n.push(r));
2373
2424
  return n;
2374
2425
  }
2375
- function er(e) {
2376
- return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : $n(e);
2426
+ function dr(e) {
2427
+ return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : ur(e);
2377
2428
  }
2378
- function tr() {
2429
+ function fr() {
2379
2430
  return document.readyState === "loading" ? new Promise((e) => {
2380
2431
  document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
2381
2432
  }) : Promise.resolve();
2382
2433
  }
2383
- async function nr(e) {
2384
- let t = er(e);
2385
- return t.length > 0 || typeof e != "string" ? t : (await tr(), er(e));
2434
+ async function pr(e) {
2435
+ let t = dr(e);
2436
+ return t.length > 0 || typeof e != "string" ? t : (await fr(), dr(e));
2386
2437
  }
2387
- function rr(e) {
2438
+ function mr(e) {
2388
2439
  return typeof e == "string" ? document : $(e) ? e.getRootNode() : document;
2389
2440
  }
2390
- function ir(e) {
2441
+ function hr(e) {
2391
2442
  let { element: t, observe: n, allowEmpty: r, client: i, onReady: a, onResult: o, onSuccess: s, onError: c, onEvent: l, ...u } = e;
2392
2443
  return {
2393
2444
  mode: "server-rendered",
2394
2445
  ...u
2395
2446
  };
2396
2447
  }
2397
- async function ar(e, t, n, r) {
2398
- let i = [], o = ir(e);
2448
+ async function gr(e, t, n, r) {
2449
+ let i = [], o = hr(e);
2399
2450
  for (let s of r) {
2400
2451
  let r = n.get(s);
2401
2452
  if (r) {
@@ -2405,7 +2456,7 @@ async function ar(e, t, n, r) {
2405
2456
  let c = await t.mount(s, o), l = [];
2406
2457
  if (e.onReady?.(c), l.push(c.on("formie:submit:result", (t) => {
2407
2458
  let n = t;
2408
- e.onResult?.(n, c), Zn(n) ? e.onSuccess?.(n, c) : e.onError?.(n, c);
2459
+ e.onResult?.(n, c), cr(n) ? e.onSuccess?.(n, c) : e.onError?.(n, c);
2409
2460
  })), e.onEvent) for (let t of a) l.push(c.on(t, (n) => {
2410
2461
  e.onEvent?.({
2411
2462
  name: t,
@@ -2419,11 +2470,11 @@ async function ar(e, t, n, r) {
2419
2470
  }
2420
2471
  return i;
2421
2472
  }
2422
- async function or(e) {
2423
- let t = e.client ?? qn(), n = /* @__PURE__ */ new Map(), r = await nr(e.element);
2424
- if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${Qn(e.element)}.`);
2425
- await ar(e, t, n, r);
2426
- let i = e.observe ? t.observe(rr(e.element)) : null;
2473
+ async function _r(e) {
2474
+ let t = e.client ?? ir(), n = /* @__PURE__ */ new Map(), r = await pr(e.element);
2475
+ if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${lr(e.element)}.`);
2476
+ await gr(e, t, n, r);
2477
+ let i = e.observe ? t.observe(mr(e.element)) : null;
2427
2478
  return {
2428
2479
  client: t,
2429
2480
  get instances() {
@@ -2434,8 +2485,8 @@ async function or(e) {
2434
2485
  return r ? n.get(r)?.instance ?? t.getInstance(r) : null;
2435
2486
  },
2436
2487
  async rescan() {
2437
- let r = er(e.element);
2438
- return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : ar(e, t, n, r);
2488
+ let r = dr(e.element);
2489
+ return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : gr(e, t, n, r);
2439
2490
  },
2440
2491
  async destroy() {
2441
2492
  i?.();
@@ -2445,4 +2496,4 @@ async function or(e) {
2445
2496
  };
2446
2497
  }
2447
2498
  //#endregion
2448
- export { a as FORMIE_HTML_EVENT_NAMES, dt as FormieValidator, he as LEGACY_FORMIE_DOM_EVENT_BRIDGES, ge as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, Vt as ModuleRegistry, Se as bindLegacyDomEventCompatibility, we as bindLegacyValidatorCompatibility, fe as buildFieldValueRegistry, d as createDebug, qn as createFormieClient, l as debugLog, u as debugWarn, me as defineAddressModule, oe as defineCaptchaModule, ae as definePassiveCaptchaModule, b as definePaymentModule, le as fieldKeyToInputName, or as formie, i as getFieldModuleEventName, ie as getFormieTranslations, r as getGlobalModuleLifecycleEventName, e as getScopedModuleLifecycleEventName, Yn as hydrateFormieModules, se as inputNameToFieldKey, c as isFormieDebugEnabled, ne as mergeFormieTranslations, ce as normalizeFieldKey, o as normalizeFormieEventName, ue as parseFieldReference, pe as resolveFieldReferenceFromFormData, de as resolveFieldReferenceLive, _e as resolveLegacyCompatibilityOptions, s as setFormieDebugEnabled, re as setFormieTranslations, E as t, t as toDomEventName, T as translate };
2499
+ export { a as FORMIE_HTML_EVENT_NAMES, mt as FormieValidator, he as LEGACY_FORMIE_DOM_EVENT_BRIDGES, ge as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, I as ModuleRegistry, Se as bindLegacyDomEventCompatibility, Ce as bindLegacyValidatorCompatibility, fe as buildFieldValueRegistry, S as createDebug, ir as createFormieClient, x as debugLog, ee as debugWarn, me as defineAddressModule, oe as defineCaptchaModule, ae as definePassiveCaptchaModule, _ as definePaymentModule, le as fieldKeyToInputName, _r as formie, i as getFieldModuleEventName, ie as getFormieTranslations, r as getGlobalModuleLifecycleEventName, e as getScopedModuleLifecycleEventName, or as hydrateFormieModules, se as inputNameToFieldKey, b as isFormieDebugEnabled, ne as mergeFormieTranslations, ce as normalizeFieldKey, o as normalizeFormieEventName, ue as parseFieldReference, pe as resolveFieldReferenceFromFormData, de as resolveFieldReferenceLive, _e as resolveLegacyCompatibilityOptions, y as setFormieDebugEnabled, re as setFormieTranslations, D as t, t as toDomEventName, E as translate };