@verbb/formie-browser 1.0.15 → 1.0.16

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 (135) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/chunks/{address-country-BcEQKw0T.js → address-country-DLJF-OkC.js} +4 -8
  3. package/dist/chunks/{address-finder-BWGINCSA.js → address-finder-QK1m1eyv.js} +1 -1
  4. package/dist/chunks/{address-state-DI3ndhMU.js → address-state-CHKit8AW.js} +26 -35
  5. package/dist/chunks/{api-BK9b340y.js → api-BPtH5RBA.js} +152 -120
  6. package/dist/chunks/{api-Dxl_CKw-.js → api-BR2Gqy37.js} +306 -301
  7. package/dist/chunks/{api-ghNr2uxX.js → api-CmuOZ0i3.js} +1 -1
  8. package/dist/chunks/{bpoint-BwtuyN_O.js → bpoint-GvYfyPjD.js} +1 -1
  9. package/dist/chunks/{calculations-YEoVCG2q.js → calculations-DeEmdUDq.js} +5 -7
  10. package/dist/chunks/{captcha-eu-DWLoQFKB.js → captcha-eu-eU_M6snp.js} +1 -1
  11. package/dist/chunks/{checkbox-radio-gsm8QPJg.js → checkbox-radio-CSXo6svm.js} +4 -12
  12. package/dist/chunks/{combobox-Ba08_cHL.js → combobox-CJh2DoSO.js} +292 -333
  13. package/dist/chunks/{conditions-Ceeg6ReZ.js → conditions-Dz3068K0.js} +56 -72
  14. package/dist/chunks/{country-from-ip-DDj_mFki.js → country-from-ip-BqQ-BqLH.js} +1 -1
  15. package/dist/chunks/{custom-google-maps-C4l2S3GO.js → custom-google-maps-rNm5VFbb.js} +2 -6
  16. package/dist/chunks/{custom-link-CLazgKYH.js → custom-link-CLqFCssQ.js} +1 -1
  17. package/dist/chunks/{custom-maps-DqcAlD0v.js → custom-maps-DgjYQDLj.js} +4 -8
  18. package/dist/chunks/{date-picker-DaPvMrop.js → date-picker-BVJxJVYT.js} +30 -47
  19. package/dist/chunks/{debug-BV0DvdHx.js → debug-rhzqP1j2.js} +2 -14
  20. package/dist/chunks/{dist-ZLeW0zZ3.js → dist-CJReDlDK.js} +13 -8
  21. package/dist/chunks/{eway-uw0DzU-L.js → eway-BZuTBAUW.js} +1 -1
  22. package/dist/chunks/{field-references.resolver-Ca8MguFv.js → field-references.resolver-uSHf5-NP.js} +1 -1
  23. package/dist/chunks/{file-upload-B8_mH012.js → file-upload-vEUr_EuP.js} +114 -108
  24. package/dist/chunks/{friendly-captcha-v1-CVXaXgDO.js → friendly-captcha-v1-C_cF1WD2.js} +2 -2
  25. package/dist/chunks/{friendly-captcha-v2-DkeIVTKI.js → friendly-captcha-v2-BenESH-n.js} +2 -2
  26. package/dist/chunks/{friendly-challenge-DPG9MJb1.js → friendly-challenge-BgPBEMXx.js} +21 -35
  27. package/dist/chunks/{go-cardless-c4wLJdOt.js → go-cardless-DWZeB0Bq.js} +2 -6
  28. package/dist/chunks/{google-address-JHYvjwgN.js → google-address-DQR6rsbh.js} +2 -2
  29. package/dist/chunks/{hcaptcha-Dt3ELLlP.js → hcaptcha-COilLmRT.js} +1 -1
  30. package/dist/chunks/{hidden-BZhXnNPe.js → hidden-Bc2TpcgF.js} +1 -1
  31. package/dist/chunks/{http-C2QdHuWO.js → http-Dj_skqaa.js} +1 -1
  32. package/dist/chunks/{leaflet-src-DE6rv6M-.js → leaflet-src-Cg-LUOD8.js} +74 -122
  33. package/dist/chunks/{loqate-m51iPyO1.js → loqate-ZZClcacr.js} +1 -1
  34. package/dist/chunks/{mollie-Bn0PX173.js → mollie-8OMXIYa8.js} +2 -6
  35. package/dist/chunks/{moneris-BRbUvI4t.js → moneris-qYHJ9EFy.js} +1 -1
  36. package/dist/chunks/opayo-DlWPEnla.js +159 -0
  37. package/dist/chunks/{paddle-CympHVvd.js → paddle-CArfWih0.js} +1 -1
  38. package/dist/chunks/{password-validation-C8_uO_c_.js → password-validation-HGOU9kf3.js} +2 -2
  39. package/dist/chunks/{paypal-h75h6wae.js → paypal-BcaMCMGY.js} +1 -1
  40. package/dist/chunks/{payway-C9rHTCC_.js → payway-vxC7_bfR.js} +3 -11
  41. package/dist/chunks/{phone-country-B8fv-L5_.js → phone-country-Bx9EG50h.js} +123 -140
  42. package/dist/chunks/{place-kit-BnZGQ-L1.js → place-kit-BKk8xDXf.js} +2 -2
  43. package/dist/chunks/{placekit-autocomplete.esm-CZZERYur.js → placekit-autocomplete.esm-D2A_0iVU.js} +2 -5
  44. package/dist/chunks/{recaptcha-enterprise-CUs8BO6V.js → recaptcha-enterprise-Cx6HUpMa.js} +6 -12
  45. package/dist/chunks/recaptcha-shared-CcMI-r8t.js +33 -0
  46. package/dist/chunks/{recaptcha-v2-checkbox-P1McW4Pv.js → recaptcha-v2-checkbox-DQ9BJzcv.js} +2 -2
  47. package/dist/chunks/{recaptcha-v2-invisible-FGDqozSP.js → recaptcha-v2-invisible-BP0T8Pan.js} +2 -2
  48. package/dist/chunks/recaptcha-v3-DKMGQ27K.js +38 -0
  49. package/dist/chunks/{repeater-CyhDbozO.js → repeater-BR0RUvTs.js} +3 -7
  50. package/dist/chunks/{rich-text-uV4o_pGk.js → rich-text-H2A6cm1t.js} +33 -11
  51. package/dist/chunks/{rolldown-runtime-DtPi1Y-2.js → rolldown-runtime-VHNaYcLd.js} +1 -1
  52. package/dist/chunks/{sdk-lkwSvlpM.js → sdk-_cmrRYgp.js} +4 -16
  53. package/dist/chunks/{shared-OKhSay59.js → shared-CJ1LIEh3.js} +1 -3
  54. package/dist/chunks/{signature-7cldFbqj.js → signature-CfKA_poI.js} +9 -41
  55. package/dist/chunks/{snaptcha-C3QLYxFT.js → snaptcha-P3EoSQud.js} +1 -1
  56. package/dist/chunks/{square-C1z5DPVw.js → square-Dyz0p_GU.js} +1 -1
  57. package/dist/chunks/{stripe-Dmkdkq1y.js → stripe-Bfd_jp_k.js} +3 -6
  58. package/dist/chunks/{summary-Bn-g5SDx.js → summary-B3CAebLV.js} +44 -36
  59. package/dist/chunks/{survey-likert-fk1hUPff.js → survey-likert-CEtUceag.js} +1 -1
  60. package/dist/chunks/{survey-rank-BsLGl2LX.js → survey-rank-Dtt97y6s.js} +3 -7
  61. package/dist/chunks/{survey-rating-DVS6e6fM.js → survey-rating-mlDMI0uq.js} +9 -23
  62. package/dist/chunks/{table-j7MlLLCc.js → table-0k6Md0IO.js} +1 -1
  63. package/dist/chunks/{text-limit-LGMPhFuC.js → text-limit-CTVML6s7.js} +10 -10
  64. package/dist/chunks/{turnstile-ptihQfLl.js → turnstile-Sp4ubowK.js} +1 -1
  65. package/dist/chunks/{upload-manager-BW7l-BhF.js → upload-manager-Ccg3d_4I.js} +11 -25
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +752 -756
  69. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  70. package/dist/js/core/dom-events.d.ts +5 -0
  71. package/dist/js/core/dom-events.d.ts.map +1 -1
  72. package/dist/js/core/page-client-event.d.ts.map +1 -1
  73. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  74. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  75. package/dist/js/core/validation-focus.d.ts.map +1 -1
  76. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  77. package/dist/js/modules/captchas/host.d.ts +4 -1
  78. package/dist/js/modules/captchas/host.d.ts.map +1 -1
  79. package/dist/js/modules/captchas/recaptcha-shared.d.ts +1 -1
  80. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -1
  81. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  82. package/dist/js/modules/fields/address-state.d.ts.map +1 -1
  83. package/dist/js/modules/fields/combobox.d.ts +2 -0
  84. package/dist/js/modules/fields/combobox.d.ts.map +1 -1
  85. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  86. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  87. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  88. package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
  89. package/dist/js/modules/fields/summary.d.ts.map +1 -1
  90. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  91. package/dist/js/modules/payments/factories.d.ts.map +1 -1
  92. package/dist/js/modules/payments/opayo.d.ts.map +1 -1
  93. package/dist/js/submit/pipeline.d.ts +2 -0
  94. package/dist/js/submit/pipeline.d.ts.map +1 -1
  95. package/dist/js/utils/form-started-at.d.ts +1 -0
  96. package/dist/js/utils/form-started-at.d.ts.map +1 -1
  97. package/dist/js/utils/unload-warning.d.ts +4 -0
  98. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  99. package/dist/js/validation/rules/required.d.ts.map +1 -1
  100. package/dist/js/validation/submit-readiness.d.ts.map +1 -1
  101. package/dist/js/validation/validator.d.ts +1 -0
  102. package/dist/js/validation/validator.d.ts.map +1 -1
  103. package/package.json +3 -3
  104. package/src/index.ts +1 -0
  105. package/src/js/core/create-formie-client.ts +20 -18
  106. package/src/js/core/dom-events.ts +30 -1
  107. package/src/js/core/page-client-event.ts +5 -7
  108. package/src/js/core/submit-result-state.ts +13 -2
  109. package/src/js/core/submit-result-ui.ts +21 -0
  110. package/src/js/core/validation-focus.ts +17 -3
  111. package/src/js/modules/captchas/factories.ts +241 -101
  112. package/src/js/modules/captchas/host.ts +16 -0
  113. package/src/js/modules/captchas/recaptcha-enterprise.ts +1 -1
  114. package/src/js/modules/captchas/recaptcha-shared.ts +23 -5
  115. package/src/js/modules/captchas/recaptcha-v3.ts +23 -14
  116. package/src/js/modules/fields/address-state.ts +6 -4
  117. package/src/js/modules/fields/combobox.ts +19 -1
  118. package/src/js/modules/fields/conditions.ts +3 -0
  119. package/src/js/modules/fields/file-upload.ts +11 -4
  120. package/src/js/modules/fields/phone-country.ts +23 -0
  121. package/src/js/modules/fields/rich-text.ts +33 -0
  122. package/src/js/modules/fields/summary.ts +63 -10
  123. package/src/js/modules/fields/text-limit.ts +11 -0
  124. package/src/js/modules/payments/factories.ts +87 -54
  125. package/src/js/modules/payments/opayo.ts +7 -0
  126. package/src/js/submit/pipeline.ts +16 -9
  127. package/src/js/utils/form-started-at.ts +19 -4
  128. package/src/js/utils/unload-warning.ts +63 -7
  129. package/src/js/validation/rules/required.ts +6 -0
  130. package/src/js/validation/submit-readiness.ts +2 -0
  131. package/src/js/validation/validator.ts +15 -4
  132. package/src/vendor.d.ts +2 -0
  133. package/dist/chunks/opayo-BwWdInEP.js +0 -188
  134. package/dist/chunks/recaptcha-shared-DTbTw-MF.js +0 -27
  135. package/dist/chunks/recaptcha-v3-CflUHeZD.js +0 -28
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import { n as e } from "./chunks/request-profile-DhwkeCpS.js";
2
- import { i as t, m as n, t as r } from "./chunks/dist-ZLeW0zZ3.js";
2
+ import { i as t, m as n, t as r } from "./chunks/dist-CJReDlDK.js";
3
3
  import { c as i, d as a, l as o, o as s, r as c, t as l, u } from "./chunks/event-names-BCI2FLD8.js";
4
- import { a as d, c as f, d as p, f as m, i as h, l as g, n as _, o as v, p as y, r as b, s as x, t as S, u as C } from "./chunks/api-Dxl_CKw-.js";
5
- import { a as ee, i as te, n as w, r as T, t as E } from "./chunks/debug-BV0DvdHx.js";
6
- import { i as D, r as ne, t as O } from "./chunks/theme-classes-DAQuEqdP.js";
7
- import { n as k } from "./chunks/skip-CEW89ExY.js";
8
- import { i as re, t as ie } from "./chunks/csrf-DxHg_ZYt.js";
9
- import { n as A, t as ae } from "./chunks/http-C2QdHuWO.js";
10
- import { i as oe } from "./chunks/async-2GdXNFCE.js";
11
- import { a as se, i as ce, n as le, r as ue, t as de } from "./chunks/i18n-BY1ds1BL.js";
12
- import { n as fe, t as pe } from "./chunks/api-BK9b340y.js";
13
- import { n as me, r as he, t as ge } from "./chunks/field-references.keys-58ZSTrCW.js";
14
- import { i as _e, n as ve, r as ye, t as be } from "./chunks/field-references.resolver-Ca8MguFv.js";
15
- import { t as xe } from "./chunks/api-ghNr2uxX.js";
4
+ import { _ as d, a as f, c as p, d as m, f as h, g, h as _, i as v, l as y, m as ee, o as b, p as x, r as S, s as C, t as w, u as T } from "./chunks/api-BR2Gqy37.js";
5
+ import { a as te, i as ne, n as E, r as D, t as O } from "./chunks/debug-rhzqP1j2.js";
6
+ import { i as k, r as re, t as A } from "./chunks/theme-classes-DAQuEqdP.js";
7
+ import { n as j } from "./chunks/skip-CEW89ExY.js";
8
+ import { i as ie, t as ae } from "./chunks/csrf-DxHg_ZYt.js";
9
+ import { n as M, t as oe } from "./chunks/http-Dj_skqaa.js";
10
+ import { i as se } from "./chunks/async-2GdXNFCE.js";
11
+ import { a as ce, i as le, n as ue, r as de, t as fe } from "./chunks/i18n-BY1ds1BL.js";
12
+ import { n as pe, t as me } from "./chunks/api-BPtH5RBA.js";
13
+ import { n as he, r as ge, t as _e } from "./chunks/field-references.keys-58ZSTrCW.js";
14
+ import { i as ve, n as ye, r as be, t as xe } from "./chunks/field-references.resolver-uSHf5-NP.js";
15
+ import { t as Se } from "./chunks/api-CmuOZ0i3.js";
16
16
  //#region src/js/compatibility/event-map.ts
17
- var Se = [
17
+ var Ce = [
18
18
  {
19
19
  legacyEvent: "onFormieLoaded",
20
20
  canonicalEvent: "formie:mount:after",
@@ -67,7 +67,7 @@ var Se = [
67
67
  canonicalEvent: "formie:submit:after",
68
68
  disposition: "approximate"
69
69
  }
70
- ], Ce = [
70
+ ], we = [
71
71
  {
72
72
  legacyEvent: "formieValidatorInitialized",
73
73
  canonicalEvent: "formie:validator:ready",
@@ -89,7 +89,7 @@ var Se = [
89
89
  disposition: "safe"
90
90
  }
91
91
  ];
92
- function we(e) {
92
+ function Te(e) {
93
93
  if (!e) return {
94
94
  enabled: !1,
95
95
  legacyDomEvents: !1,
@@ -109,18 +109,18 @@ function we(e) {
109
109
  }
110
110
  //#endregion
111
111
  //#region src/js/compatibility/dom-adapter.ts
112
- function Te(e, t, n) {
112
+ function Ee(e, t, n) {
113
113
  e.dispatchEvent(new CustomEvent(t, {
114
114
  bubbles: !0,
115
115
  detail: n
116
116
  }));
117
117
  }
118
- function Ee(e, t) {
118
+ function De(e, t) {
119
119
  if (e.canonicalEvent !== "formie:submit:result") return !0;
120
120
  let n = t;
121
121
  return e.legacyEvent === "onAfterFormieSubmit" ? !!n?.ok : e.legacyEvent !== "onFormieSubmitError" || n?.ok === !1;
122
122
  }
123
- function De(e, t) {
123
+ function Oe(e, t) {
124
124
  let n = t && typeof t == "object" ? t : {}, r = typeof n.pageId == "string" ? n.pageId : "", i = Array.from(e.querySelectorAll("[data-formie-page-id]"));
125
125
  return { data: {
126
126
  nextPageId: r,
@@ -128,7 +128,7 @@ function De(e, t) {
128
128
  totalPages: i.length
129
129
  } };
130
130
  }
131
- function Oe(e, t, n, r, i) {
131
+ function ke(e, t, n, r, i) {
132
132
  let a = globalThis.Formie || i;
133
133
  return e.legacyEvent === "onFormieLoaded" ? { formie: a } : e.legacyEvent === "onFormieInit" ? {
134
134
  formie: a,
@@ -140,12 +140,12 @@ function Oe(e, t, n, r, i) {
140
140
  form: r,
141
141
  target: n,
142
142
  instance: i
143
- } : e.legacyEvent === "onFormiePageToggle" ? De(r, t) : t;
143
+ } : e.legacyEvent === "onFormiePageToggle" ? Oe(r, t) : t;
144
144
  }
145
- function ke({ target: e, form: t, instance: n, options: r, unbinds: i }) {
146
- r.legacyDomEvents && Se.forEach((r) => {
145
+ function Ae({ target: e, form: t, instance: n, options: r, unbinds: i }) {
146
+ r.legacyDomEvents && Ce.forEach((r) => {
147
147
  let o = (i) => {
148
- i instanceof CustomEvent && Ee(r, i.detail) && Te(r.target === "document" ? document : t, r.legacyEvent, Oe(r, i.detail, e, t, n));
148
+ i instanceof CustomEvent && De(r, i.detail) && Ee(r.target === "document" ? document : t, r.legacyEvent, ke(r, i.detail, e, t, n));
149
149
  };
150
150
  e.addEventListener(a(r.canonicalEvent), o), i.push(() => {
151
151
  e.removeEventListener(a(r.canonicalEvent), o);
@@ -154,30 +154,30 @@ function ke({ target: e, form: t, instance: n, options: r, unbinds: i }) {
154
154
  }
155
155
  //#endregion
156
156
  //#region src/js/compatibility/validator-adapter.ts
157
- function j(e, t, n) {
157
+ function N(e, t, n) {
158
158
  e.dispatchEvent(new CustomEvent(t, {
159
159
  bubbles: !0,
160
160
  detail: n
161
161
  }));
162
162
  }
163
- function Ae(e, t) {
163
+ function je(e, t) {
164
164
  return !!e && typeof e == "object" && e.validator === t;
165
165
  }
166
- function je({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
166
+ function Me({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
167
167
  if (!r.legacyValidatorEvents || !n) return;
168
168
  let { validator: a, addValidator: o, removeValidator: s } = n, c = {
169
169
  ...n,
170
170
  form: t,
171
171
  target: e
172
172
  };
173
- j(document, "formieValidatorInitialized", c);
173
+ N(document, "formieValidatorInitialized", c);
174
174
  let l = (e) => {
175
- e instanceof CustomEvent && Ae(e.detail, a) && j(document, "formieValidatorDestroyed", {
175
+ e instanceof CustomEvent && je(e.detail, a) && N(document, "formieValidatorDestroyed", {
176
176
  ...c,
177
177
  ...e.detail
178
178
  });
179
179
  }, u = (n) => {
180
- n instanceof CustomEvent && Ae(n.detail, a) && n.target instanceof Element && t.contains(n.target) && j(n.target, "formieValidatorShowError", {
180
+ n instanceof CustomEvent && je(n.detail, a) && n.target instanceof Element && t.contains(n.target) && N(n.target, "formieValidatorShowError", {
181
181
  ...n.detail,
182
182
  addValidator: o,
183
183
  removeValidator: s,
@@ -185,7 +185,7 @@ function je({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
185
185
  target: e
186
186
  });
187
187
  }, d = (n) => {
188
- n instanceof CustomEvent && Ae(n.detail, a) && n.target instanceof Element && t.contains(n.target) && j(n.target, "formieValidatorClearError", {
188
+ n instanceof CustomEvent && je(n.detail, a) && n.target instanceof Element && t.contains(n.target) && N(n.target, "formieValidatorClearError", {
189
189
  ...n.detail,
190
190
  addValidator: o,
191
191
  removeValidator: s,
@@ -199,80 +199,82 @@ function je({ target: e, form: t, validatorDetail: n, options: r, unbinds: i })
199
199
  }
200
200
  //#endregion
201
201
  //#region src/js/core/error-aria-live.ts
202
- function Me(e) {
202
+ function Ne(e) {
203
203
  let t = (e.dataset.formieErrorAriaLive || "polite").trim().toLowerCase();
204
204
  return t === "assertive" || t === "off" ? t : "polite";
205
205
  }
206
- function Ne(e, t) {
206
+ function Pe(e, t) {
207
207
  return e === "off" ? null : t ? e : "polite";
208
208
  }
209
- function Pe(e) {
209
+ function Fe(e) {
210
210
  return e === "off" ? null : e;
211
211
  }
212
- function Fe(e, t) {
213
- if (t) {
214
- e.setAttribute("aria-live", t), e.setAttribute("aria-atomic", "true");
215
- return;
216
- }
217
- e.removeAttribute("aria-live"), e.removeAttribute("aria-atomic");
212
+ function Ie(e, t) {
213
+ t ? (e.setAttribute("aria-live", t), e.setAttribute("aria-atomic", "true")) : (e.removeAttribute("aria-live"), e.removeAttribute("aria-atomic"));
218
214
  }
219
215
  //#endregion
220
216
  //#region src/js/core/field-error-aria.ts
221
- function Ie(e, t) {
217
+ function Le(e, t) {
222
218
  let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
223
219
  r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
224
220
  }
225
- function Le(e, t = document) {
221
+ function Re(e, t = document) {
226
222
  let n = (e.getAttribute("aria-describedby") || "").trim();
227
223
  if (!n) return;
228
224
  let r = n.split(/\s+/).filter((e) => !!e && !!t.getElementById(e));
229
- if (r.length) {
230
- e.setAttribute("aria-describedby", r.join(" "));
231
- return;
232
- }
233
- e.removeAttribute("aria-describedby");
225
+ r.length ? e.setAttribute("aria-describedby", r.join(" ")) : e.removeAttribute("aria-describedby");
234
226
  }
235
- function M(e, t) {
236
- e.setAttribute("aria-errormessage", t), Ie(e, t);
227
+ function P(e, t) {
228
+ e.setAttribute("aria-errormessage", t), Le(e, t);
237
229
  }
238
- function Re(e, t = []) {
230
+ function ze(e, t = []) {
239
231
  t.forEach((t) => {
240
232
  e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
241
- }), !t.length && e.hasAttribute("aria-errormessage") && e.removeAttribute("aria-errormessage"), Le(e);
233
+ }), !t.length && e.hasAttribute("aria-errormessage") && e.removeAttribute("aria-errormessage"), Re(e);
242
234
  }
243
235
  //#endregion
244
236
  //#region src/js/core/validation-focus.ts
245
- function ze(e) {
246
- return Array.from(e.querySelectorAll("[data-formie-field-handle]")).find((e) => e.getAttribute("data-formie-field-has-error") === "true" || e.querySelector("[data-formie-field-error]") !== null) || null;
247
- }
248
237
  function Be(e) {
249
- return Array.from(e.querySelectorAll("[aria-invalid=\"true\"]")).find((e) => !k(e)) || (Array.from(e.querySelectorAll("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])")).find((e) => !k(e)) ?? null);
238
+ return Array.from(e.querySelectorAll("[data-formie-field-handle]")).find((e) => e.getAttribute("data-formie-field-has-error") === "true" || e.querySelector("[data-formie-field-error]") !== null) || null;
250
239
  }
251
240
  function Ve(e) {
252
- return e.querySelector("[data-formie-message-error], [data-formie-error-container], [data-formie-errors]");
241
+ if (e instanceof HTMLTextAreaElement) {
242
+ let t = e.richText;
243
+ if (t) return t.content;
244
+ }
245
+ return e;
253
246
  }
254
247
  function He(e) {
248
+ let t = Array.from(e.querySelectorAll("[aria-invalid=\"true\"]")).find((e) => !j(e));
249
+ if (t) return Ve(t);
250
+ let n = Array.from(e.querySelectorAll("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])")).find((e) => !j(e));
251
+ return n ? Ve(n) : null;
252
+ }
253
+ function Ue(e) {
254
+ return e.querySelector("[data-formie-message-error], [data-formie-error-container], [data-formie-errors]");
255
+ }
256
+ function We(e) {
255
257
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
256
258
  let n = t;
257
259
  if (n.getAttribute("data-formie-field-has-error") !== "true" && n.querySelector("[data-formie-field-error]") === null) return;
258
- n.setAttribute("data-formie-field-has-error", "true"), O(n, e, "fieldLayoutError");
260
+ n.setAttribute("data-formie-field-has-error", "true"), A(n, e, "fieldLayoutError");
259
261
  let r = n.querySelector("[data-formie-field-error]")?.id || "";
260
262
  n.querySelectorAll("input, select, textarea").forEach((t) => {
261
263
  let i = t;
262
- if (k(i)) return;
263
- i.setAttribute("aria-invalid", "true"), O(i, e, "fieldControlError"), i.setAttribute("data-formie-input-has-error", "true"), r && M(i, r);
264
+ if (j(i)) return;
265
+ i.setAttribute("aria-invalid", "true"), A(i, e, "fieldControlError"), i.setAttribute("data-formie-input-has-error", "true"), r && P(i, r);
264
266
  let a = n.querySelector("[data-formie-instructions]");
265
- a?.id && Ie(i, a.id);
267
+ a?.id && Le(i, a.id);
266
268
  });
267
269
  });
268
270
  }
269
- function Ue(e) {
270
- return !!ze(e) || !!Ve(e);
271
+ function Ge(e) {
272
+ return !!Be(e) || !!Ue(e);
271
273
  }
272
- function We(e) {
273
- let t = ze(e);
274
+ function F(e) {
275
+ let t = Be(e);
274
276
  if (t) {
275
- let e = Be(t);
277
+ let e = He(t);
276
278
  if (e) {
277
279
  if (e.scrollIntoView({
278
280
  behavior: "smooth",
@@ -289,7 +291,7 @@ function We(e) {
289
291
  block: "center"
290
292
  }), !0;
291
293
  }
292
- let n = Ve(e);
294
+ let n = Ue(e);
293
295
  return n ? (n.scrollIntoView({
294
296
  behavior: "smooth",
295
297
  block: "center"
@@ -297,8 +299,8 @@ function We(e) {
297
299
  }
298
300
  //#endregion
299
301
  //#region src/js/transport/forms-api.ts
300
- var N = E("general", "transport");
301
- function Ge(e) {
302
+ var I = O("general", "transport");
303
+ function Ke(e) {
302
304
  let t = {};
303
305
  return [
304
306
  "theme",
@@ -309,7 +311,7 @@ function Ge(e) {
309
311
  e[n] !== void 0 && (t[n] = e[n]);
310
312
  }), t;
311
313
  }
312
- function Ke(e, t) {
314
+ function qe(e, t) {
313
315
  let n = e.success === !0, r = e.completion && typeof e.completion == "object" ? e.completion : null, i = e.payment && typeof e.payment == "object" ? e.payment : null, a = [
314
316
  "requiresAction",
315
317
  "pending",
@@ -350,36 +352,36 @@ function Ke(e, t) {
350
352
  meta: e
351
353
  };
352
354
  }
353
- async function qe(e, t, n = {}, r = {}) {
355
+ async function Je(e, t, n = {}, r = {}) {
354
356
  let i = JSON.stringify({
355
357
  handle: t,
356
358
  renderOptions: n
357
359
  });
358
- N.log("requestRender start.", {
360
+ I.log("requestRender start.", {
359
361
  endpoint: e,
360
362
  handle: t
361
363
  });
362
- let a = await A(e, {
364
+ let a = await M(e, {
363
365
  ...r,
364
366
  method: "POST",
365
367
  body: i,
366
368
  headers: { "Content-Type": "application/json" }
367
369
  });
368
- return N.log("requestRender complete.", { hasHtml: !!a.html }), a;
370
+ return I.log("requestRender complete.", { hasHtml: !!a.html }), a;
369
371
  }
370
- async function Je(e, t, n = {}, r = {}) {
372
+ async function Ye(e, t, n = {}, r = {}) {
371
373
  let i = JSON.stringify({
372
374
  query: "\nquery FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {\n formieHtmlForm(handle: $handle, input: $input) {\n html\n }\n}",
373
375
  variables: {
374
376
  handle: t,
375
- input: Ge(n)
377
+ input: Ke(n)
376
378
  }
377
379
  });
378
- N.log("requestGraphqlRender start.", {
380
+ I.log("requestGraphqlRender start.", {
379
381
  endpoint: e,
380
382
  handle: t
381
383
  });
382
- let a = await A(e, {
384
+ let a = await M(e, {
383
385
  ...r,
384
386
  method: "POST",
385
387
  body: i,
@@ -388,19 +390,19 @@ async function Je(e, t, n = {}, r = {}) {
388
390
  if (Array.isArray(a.errors) && a.errors.length > 0) throw Error(a.errors.map((e) => e.message || "Unknown GraphQL error").join("; "));
389
391
  if (!a.data?.formieHtmlForm) throw Error(`Form not found for handle "${t}".`);
390
392
  let o = a.data.formieHtmlForm;
391
- return N.log("requestGraphqlRender complete.", { hasHtml: !!o.html }), o;
393
+ return I.log("requestGraphqlRender complete.", { hasHtml: !!o.html }), o;
392
394
  }
393
- async function P(e, t, n, r = {}, i) {
395
+ async function Xe(e, t, n, r = {}, i) {
394
396
  let a = new URL(e, window.location.origin);
395
- a.searchParams.set("handle", t), n && a.searchParams.set("renderId", n), i && a.searchParams.set("requestToken", i), N.log("requestRefreshTokens start.", {
397
+ a.searchParams.set("handle", t), n && a.searchParams.set("renderId", n), i && a.searchParams.set("requestToken", i), I.log("requestRefreshTokens start.", {
396
398
  endpoint: a.toString(),
397
399
  handle: t,
398
400
  hasRenderId: !!n
399
401
  });
400
- let o = await A(a.toString(), r);
401
- return N.log("requestRefreshTokens complete.", { hasRefreshTokens: !!o.refreshTokens }), o.refreshTokens || o;
402
+ let o = await M(a.toString(), r);
403
+ return I.log("requestRefreshTokens complete.", { hasRefreshTokens: !!o.refreshTokens }), o.refreshTokens || o;
402
404
  }
403
- async function Ye(e, t, n) {
405
+ async function Ze(e, t, n) {
404
406
  let r = new URL(e, window.location.origin), i = new FormData();
405
407
  if (n && i.append("pageId", n), t) {
406
408
  [
@@ -414,14 +416,14 @@ async function Ye(e, t, n) {
414
416
  ].forEach((e) => {
415
417
  let n = t.querySelector(`input[name="${e}"]`)?.value?.trim();
416
418
  n && i.append(e, n);
417
- }), ie(i, t);
419
+ }), ae(i, t);
418
420
  for (let [e, n] of new FormData(t)) e.startsWith("fields[") && i.append(e, n);
419
421
  }
420
- N.log("requestSetPage start.", {
422
+ I.log("requestSetPage start.", {
421
423
  requestUrl: r.toString(),
422
424
  pageId: n || null
423
425
  });
424
- let a = await (await ae(r.toString(), {
426
+ let a = await (await oe(r.toString(), {
425
427
  method: "POST",
426
428
  body: i,
427
429
  profile: t?.dataset.formieRequestProfile
@@ -430,9 +432,9 @@ async function Ye(e, t, n) {
430
432
  let e = a.session, n = t.querySelector("input[name=\"expectedVersion\"]"), r = t.querySelector("input[name=\"requestToken\"]");
431
433
  n && (n.value = String(e.version)), r && e.tokens?.request && (r.value = e.tokens.request);
432
434
  }
433
- return N.log("requestSetPage complete.", a), a;
435
+ return I.log("requestSetPage complete.", a), a;
434
436
  }
435
- function Xe(e, t) {
437
+ function Qe(e, t) {
436
438
  let n = new URL(e, window.location.origin), i = new FormData();
437
439
  [
438
440
  "handle",
@@ -442,7 +444,7 @@ function Xe(e, t) {
442
444
  ].forEach((e) => {
443
445
  let n = t.querySelector(`input[name="${e}"]`)?.value?.trim();
444
446
  n && i.append(e, n);
445
- }), ie(i, t), N.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
447
+ }), ae(i, t), I.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
446
448
  try {
447
449
  if (t.dataset.formieRequestProfile !== "cross-origin-public" && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(n.toString(), i)) return;
448
450
  } catch {}
@@ -453,9 +455,9 @@ function Xe(e, t) {
453
455
  headers: { Accept: "application/json" }
454
456
  }, { profile: t.dataset.formieRequestProfile });
455
457
  }
456
- async function Ze(e, t) {
458
+ async function $e(e, t) {
457
459
  let n = (e.getAttribute("method") || "POST").toUpperCase(), i = e.getAttribute("action") || window.location.href, a = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
458
- N.log("submitForm start.", {
460
+ I.log("submitForm start.", {
459
461
  method: n,
460
462
  action: i,
461
463
  submitAction: t.get("submitAction")
@@ -465,13 +467,13 @@ async function Ze(e, t) {
465
467
  body: t,
466
468
  headers: { Accept: "application/json" }
467
469
  }, { profile: e.dataset.formieRequestProfile }), s = o.headers.get("content-type") || "";
468
- if (!s.includes("application/json")) return o.ok ? (N.log("submitForm non-JSON success response.", {
470
+ if (!s.includes("application/json")) return o.ok ? (I.log("submitForm non-JSON success response.", {
469
471
  status: o.status,
470
472
  contentType: s
471
473
  }), {
472
474
  ok: !0,
473
475
  message: "Submission completed."
474
- }) : (N.warn("submitForm non-JSON HTTP error.", {
476
+ }) : (I.warn("submitForm non-JSON HTTP error.", {
475
477
  status: o.status,
476
478
  contentType: s
477
479
  }), {
@@ -480,8 +482,8 @@ async function Ze(e, t) {
480
482
  message: `Request failed (${o.status}).`,
481
483
  formErrors: [`Request failed (${o.status}).`]
482
484
  });
483
- let c = Ke(await o.json(), a);
484
- return N.log("submitForm JSON response normalized.", {
485
+ let c = qe(await o.json(), a);
486
+ return I.log("submitForm JSON response normalized.", {
485
487
  ok: c.ok,
486
488
  code: c.code,
487
489
  hasRedirect: !!c.redirect?.url,
@@ -490,20 +492,20 @@ async function Ze(e, t) {
490
492
  }
491
493
  //#endregion
492
494
  //#region src/js/submit/pipeline.ts
493
- var Qe = [
495
+ var et = [
494
496
  "prepare",
495
497
  "validate",
496
498
  "challenge",
497
499
  "payment",
498
500
  "send",
499
501
  "result"
500
- ], $e = [
502
+ ], tt = [
501
503
  "prepare",
502
504
  "validate",
503
505
  "challenge",
504
506
  "payment"
505
- ], F = E("general", "pipeline");
506
- function I(e, t) {
507
+ ], L = O("general", "pipeline");
508
+ function nt(e, t) {
507
509
  return {
508
510
  ok: !1,
509
511
  stage: e,
@@ -512,13 +514,13 @@ function I(e, t) {
512
514
  formErrors: [t || "Submission aborted."]
513
515
  };
514
516
  }
515
- function et(e) {
517
+ function rt(e) {
516
518
  return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
517
519
  }
518
- function tt(e) {
520
+ function it(e) {
519
521
  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)));
520
522
  }
521
- function nt(e, t) {
523
+ function at(e, t) {
522
524
  if (t instanceof HTMLInputElement) {
523
525
  if (t.type === "file") {
524
526
  Array.from(t.files || []).forEach((n) => {
@@ -527,63 +529,57 @@ function nt(e, t) {
527
529
  return;
528
530
  }
529
531
  e.append(t.name, t.value);
530
- return;
531
- }
532
- if (t instanceof HTMLSelectElement && t.multiple) {
533
- Array.from(t.selectedOptions).forEach((n) => {
534
- e.append(t.name, n.value);
535
- });
536
- return;
537
- }
538
- e.append(t.name, t.value);
532
+ } else t instanceof HTMLSelectElement && t.multiple ? Array.from(t.selectedOptions).forEach((n) => {
533
+ e.append(t.name, n.value);
534
+ }) : e.append(t.name, t.value);
539
535
  }
540
- function rt(e, t) {
536
+ function ot(e, t) {
541
537
  t.querySelectorAll("input, select, textarea").forEach((t) => {
542
- let n = et(t) ? t : null;
543
- n && !n.closest("[data-formie-page]") && tt(n) && nt(e, n);
538
+ let n = rt(t) ? t : null;
539
+ n && !n.closest("[data-formie-page]") && it(n) && at(e, n);
544
540
  });
545
541
  }
546
- function it(e, t) {
542
+ function st(e, t) {
547
543
  let n = /* @__PURE__ */ new Set();
548
544
  return t.querySelectorAll("input, select, textarea").forEach((t) => {
549
- let r = et(t) ? t : null;
550
- 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), tt(r) && nt(e, r)));
545
+ let r = rt(t) ? t : null;
546
+ 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), it(r) && at(e, r)));
551
547
  }), n;
552
548
  }
553
- function at(e, t) {
549
+ function ct(e, t) {
554
550
  t.forEach((t) => {
555
551
  e.has(t) || e.append(t, "");
556
552
  });
557
553
  }
558
- function ot(e, t) {
559
- let n = f(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
554
+ function lt(e, t) {
555
+ let n = T(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
560
556
  if (!n.length || !r) {
561
557
  let n = new FormData(e);
562
558
  return n.set("submitAction", t), n;
563
559
  }
564
560
  let i = new FormData();
565
- return rt(i, e), at(i, it(i, r)), i.set("submitAction", t), i;
561
+ return ot(i, e), ct(i, st(i, r)), i.set("submitAction", t), i;
566
562
  }
567
- function st(e, t) {
563
+ function ut(e, t) {
568
564
  if (t !== "submit") return !1;
569
- let n = f(e);
565
+ let n = T(e);
570
566
  return !n.length || (n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || n[n.length - 1]) === n[n.length - 1];
571
567
  }
572
- async function ct(e, t, n, r = {}) {
573
- F.log("Starting submit pipeline.", {
568
+ async function dt(e, t, n, r = {}) {
569
+ L.log("Starting submit pipeline.", {
574
570
  action: t,
575
571
  preflightOnly: r.preflightOnly === !0
576
572
  });
577
- let i = !1, a, o = null, s = st(e, t), c = {
573
+ let i = !1, a, o = null, s = ut(e, t), c = d(e, {
578
574
  form: e,
579
575
  action: t,
580
- formData: ot(e, t),
576
+ formData: lt(e, t),
581
577
  abort: (e) => {
582
- i = !0, a = e, F.warn("Pipeline aborted.", { reason: e });
578
+ i = !0, a = e, L.warn("Pipeline aborted.", { reason: e });
583
579
  },
584
580
  isAborted: () => i,
585
581
  abortReason: () => a
586
- }, l = {
582
+ }), l = (t, r) => n.emitSafe(t, d(e, r)), u = {
587
583
  prepare: async (e) => {
588
584
  let t = e.form.querySelector("input[name=\"submitAction\"]");
589
585
  return t && (t.value = e.action), e.formData.set("submitAction", e.action), null;
@@ -591,7 +587,7 @@ async function ct(e, t, n, r = {}) {
591
587
  validate: async (e) => {
592
588
  if (e.action !== "submit" || r.validateOnSubmit === !1) return null;
593
589
  if (r.validator) {
594
- let { scope: t, final: n } = g(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
590
+ let { scope: t, final: n } = m(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
595
591
  if (i.length > 0) {
596
592
  let e = i[0]?.input;
597
593
  if (e) {
@@ -627,68 +623,68 @@ async function ct(e, t, n, r = {}) {
627
623
  challenge: async () => null,
628
624
  payment: async () => null,
629
625
  send: async (e) => {
630
- e.formData = ot(e.form, e.action);
631
- let t = await Ze(e.form, e.formData);
626
+ e.formData = lt(e.form, e.action);
627
+ let t = await $e(e.form, e.formData);
632
628
  return o = t, t;
633
629
  },
634
630
  result: async (e) => (o && o.ok && o.redirect?.url && (o.redirect.target === "new-tab" ? window.open(o.redirect.url, "_blank", "noopener,noreferrer") : (e.form.setAttribute("data-formie-internal-navigation", "redirect"), window.location.href = o.redirect.url)), null)
635
631
  };
636
632
  {
637
633
  let e = await n.emitSafe("formie:submit:before", c);
638
- e.failed.length > 0 && F.warn("Submit before listeners failed.", {
634
+ e.failed.length > 0 && L.warn("Submit before listeners failed.", {
639
635
  eventName: e.eventName,
640
636
  failed: e.failed.length
641
637
  });
642
638
  }
643
639
  if (s) {
644
640
  let e = await n.emitSafe("formie:submit:final:before", c);
645
- e.failed.length > 0 && F.warn("Final submit before listeners failed.", {
641
+ e.failed.length > 0 && L.warn("Final submit before listeners failed.", {
646
642
  eventName: e.eventName,
647
643
  failed: e.failed.length
648
644
  });
649
645
  }
650
- let u = r.preflightOnly ? $e : Qe;
651
- for (let e of u) {
652
- if (F.log("Stage start.", {
646
+ let f = r.preflightOnly ? tt : et;
647
+ for (let e of f) {
648
+ if (L.log("Stage start.", {
653
649
  stage: e,
654
650
  action: t
655
- }), i) return F.warn("Stage skipped due to abort.", {
651
+ }), i) return L.warn("Stage skipped due to abort.", {
656
652
  stage: e,
657
653
  reason: a
658
- }), I(e, a);
654
+ }), nt(e, a);
659
655
  {
660
656
  let t = await n.emitSafe(`formie:stage:${e}:before`, {
661
657
  ...c,
662
658
  stage: e
663
659
  });
664
- t.failed.length > 0 && F.warn("Stage before listeners failed.", {
660
+ t.failed.length > 0 && L.warn("Stage before listeners failed.", {
665
661
  stage: e,
666
662
  failed: t.failed.length
667
663
  });
668
664
  }
669
665
  if (i) {
670
- let t = I(e, a);
666
+ let t = nt(e, a);
671
667
  {
672
- let r = await n.emitSafe("formie:submit:after", t);
673
- r.failed.length > 0 && F.warn("Submit after listeners failed (abort before stage).", {
668
+ let n = await l("formie:submit:after", t);
669
+ n.failed.length > 0 && L.warn("Submit after listeners failed (abort before stage).", {
674
670
  stage: e,
675
- failed: r.failed.length
671
+ failed: n.failed.length
676
672
  });
677
673
  }
678
674
  if (s) {
679
- let r = await n.emitSafe("formie:submit:final:after", t);
680
- r.failed.length > 0 && F.warn("Final submit after listeners failed (abort before stage).", {
675
+ let n = await l("formie:submit:final:after", t);
676
+ n.failed.length > 0 && L.warn("Final submit after listeners failed (abort before stage).", {
681
677
  stage: e,
682
- failed: r.failed.length
678
+ failed: n.failed.length
683
679
  });
684
680
  }
685
- return F.warn("Aborted after stage before-hooks.", {
681
+ return L.warn("Aborted after stage before-hooks.", {
686
682
  stage: e,
687
683
  reason: a
688
684
  }), t;
689
685
  }
690
- let r = await l[e](c);
691
- F.log("Stage runner complete.", {
686
+ let r = await u[e](c);
687
+ L.log("Stage runner complete.", {
692
688
  stage: e,
693
689
  hasResult: !!r,
694
690
  ok: r ? r.ok : void 0,
@@ -700,291 +696,302 @@ async function ct(e, t, n, r = {}) {
700
696
  stage: e,
701
697
  result: r
702
698
  });
703
- t.failed.length > 0 && F.warn("Stage after listeners failed.", {
699
+ t.failed.length > 0 && L.warn("Stage after listeners failed.", {
704
700
  stage: e,
705
701
  failed: t.failed.length
706
702
  });
707
703
  }
708
704
  if (i) {
709
- let t = I(e, a);
705
+ let t = nt(e, a);
710
706
  {
711
- let r = await n.emitSafe("formie:submit:after", t);
712
- r.failed.length > 0 && F.warn("Submit after listeners failed (abort after stage).", {
707
+ let n = await l("formie:submit:after", t);
708
+ n.failed.length > 0 && L.warn("Submit after listeners failed (abort after stage).", {
713
709
  stage: e,
714
- failed: r.failed.length
710
+ failed: n.failed.length
715
711
  });
716
712
  }
717
713
  if (s) {
718
- let r = await n.emitSafe("formie:submit:final:after", t);
719
- r.failed.length > 0 && F.warn("Final submit after listeners failed (abort after stage).", {
714
+ let n = await l("formie:submit:final:after", t);
715
+ n.failed.length > 0 && L.warn("Final submit after listeners failed (abort after stage).", {
720
716
  stage: e,
721
- failed: r.failed.length
717
+ failed: n.failed.length
722
718
  });
723
719
  }
724
- return F.warn("Aborted after stage after-hooks.", {
720
+ return L.warn("Aborted after stage after-hooks.", {
725
721
  stage: e,
726
722
  reason: a
727
723
  }), t;
728
724
  }
729
725
  if (r && !r.ok) {
730
726
  {
731
- let t = await n.emitSafe("formie:submit:after", r);
732
- t.failed.length > 0 && F.warn("Submit after listeners failed (failed stage).", {
727
+ let t = await l("formie:submit:after", r);
728
+ t.failed.length > 0 && L.warn("Submit after listeners failed (failed stage).", {
733
729
  stage: e,
734
730
  failed: t.failed.length
735
731
  });
736
732
  }
737
733
  if (s) {
738
- let t = await n.emitSafe("formie:submit:final:after", r);
739
- t.failed.length > 0 && F.warn("Final submit after listeners failed (failed stage).", {
734
+ let t = await l("formie:submit:final:after", r);
735
+ t.failed.length > 0 && L.warn("Final submit after listeners failed (failed stage).", {
740
736
  stage: e,
741
737
  failed: t.failed.length
742
738
  });
743
739
  }
744
- return F.warn("Pipeline short-circuited by failed stage.", {
740
+ return L.warn("Pipeline short-circuited by failed stage.", {
745
741
  stage: e,
746
742
  code: r.code,
747
743
  message: r.message
748
744
  }), r;
749
745
  }
750
746
  }
751
- let d = o || {
747
+ let p = o || {
752
748
  ok: !0,
753
749
  stage: r.preflightOnly ? "payment" : "result",
754
750
  code: r.preflightOnly ? "PREFLIGHT_COMPLETE" : void 0,
755
751
  message: r.preflightOnly ? "Submission preflight completed." : "Submission completed."
756
752
  };
757
753
  {
758
- let e = await n.emitSafe("formie:submit:after", d);
759
- e.failed.length > 0 && F.warn("Submit after listeners failed (success).", { failed: e.failed.length });
754
+ let e = await l("formie:submit:after", p);
755
+ e.failed.length > 0 && L.warn("Submit after listeners failed (success).", { failed: e.failed.length });
760
756
  }
761
757
  if (s) {
762
- let e = await n.emitSafe("formie:submit:final:after", d);
763
- e.failed.length > 0 && F.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
758
+ let e = await l("formie:submit:final:after", p);
759
+ e.failed.length > 0 && L.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
764
760
  }
765
- return F.log("Pipeline completed.", {
766
- ok: d.ok,
767
- stage: d.stage,
768
- code: d.code
769
- }), d;
761
+ return L.log("Pipeline completed.", {
762
+ ok: p.ok,
763
+ stage: p.stage,
764
+ code: p.code
765
+ }), p;
770
766
  }
771
767
  //#endregion
772
768
  //#region src/js/core/field-error-container.ts
773
- function lt(e) {
769
+ function ft(e) {
774
770
  return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
775
771
  }
776
- function ut(e, t) {
772
+ function pt(e, t) {
777
773
  let n = e.querySelector("[data-formie-field-errors]");
778
774
  if (n) return n;
779
- let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = lt(e), o = document.createElement("div");
775
+ let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = ft(e), o = document.createElement("div");
780
776
  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;
781
777
  }
782
778
  //#endregion
783
779
  //#region src/js/core/submit-result-ui.ts
784
- var L = /* @__PURE__ */ new WeakMap();
785
- function dt(e) {
780
+ var R = /* @__PURE__ */ new WeakMap();
781
+ function mt(e) {
786
782
  return (e.dataset.formieCompletionBehavior || e.dataset.formieSubmitAction || "").trim();
787
783
  }
788
- function ft(e) {
784
+ function ht(e) {
789
785
  return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
790
786
  }
791
- function pt(e) {
787
+ function gt(e) {
792
788
  return (e.dataset.formieSuccessMessagePosition || e.dataset.formieSubmitActionMessagePosition || "").trim();
793
789
  }
794
- function mt(e) {
790
+ function _t(e) {
795
791
  let t = (e.dataset.formieSuccessMessageTimeout || e.dataset.formieSubmitActionMessageTimeout || "").trim();
796
792
  if (!t) return null;
797
793
  let n = Number.parseFloat(t);
798
794
  return !Number.isFinite(n) || n < 0 ? null : Math.round(n * 1e3);
799
795
  }
800
- function R(e) {
796
+ function vt(e) {
801
797
  let t = e.dataset.formieHideFormAfterSubmit ?? e.dataset.formieSubmitActionFormHide;
802
798
  if (t === void 0) return !1;
803
799
  let n = t.trim().toLowerCase();
804
800
  return n === "true" || n === "1" || n === "";
805
801
  }
806
- function ht(e) {
807
- let t = L.get(e);
808
- typeof t == "number" && (window.clearTimeout(t), L.delete(e));
802
+ function yt(e) {
803
+ let t = R.get(e);
804
+ typeof t == "number" && (window.clearTimeout(t), R.delete(e));
809
805
  }
810
- function gt(e) {
806
+ function bt(e) {
811
807
  return e.querySelector("[data-formie-form-messages-top]") || e;
812
808
  }
813
- function _t(e) {
809
+ function xt(e) {
814
810
  return e.querySelector("[data-formie-form-messages-bottom]") || e;
815
811
  }
816
- function vt(e, t) {
817
- return t === "bottom-form" ? _t(e) : gt(e);
812
+ function St(e, t) {
813
+ return t === "bottom-form" ? xt(e) : bt(e);
818
814
  }
819
- function yt(e, t) {
820
- return t === "top-form" ? gt(e) : t === "bottom-form" && !R(e) ? _t(e) : e;
815
+ function Ct(e, t) {
816
+ return t === "top-form" ? bt(e) : t === "bottom-form" && !vt(e) ? xt(e) : e;
821
817
  }
822
- function bt(e) {
823
- let t = ft(e), n = vt(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
824
- return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), O(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
818
+ function wt(e) {
819
+ let t = ht(e), n = St(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
820
+ return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), A(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
825
821
  }
826
- function xt(e, t) {
822
+ function Tt(e, t) {
827
823
  let n = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
828
- 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"), O(n, e, "message", "messageError"), n.setAttribute("role", "alert"), Fe(n, Pe(Me(e))), n;
824
+ 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"), A(n, e, "message", "messageError"), n.setAttribute("role", "alert"), Ie(n, Fe(Ne(e))), n;
829
825
  }
830
- function St(e, t) {
831
- let n = e.querySelector("[data-formie-success-container]"), r = yt(e, t);
832
- return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), O(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
826
+ function Et(e, t) {
827
+ let n = e.querySelector("[data-formie-success-container]"), r = Ct(e, t);
828
+ return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), A(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
833
829
  }
834
- function Ct(e) {
835
- return ut(e, (t) => {
836
- O(t, e, "fieldErrors");
830
+ function Dt(e) {
831
+ return pt(e, (t) => {
832
+ A(t, e, "fieldErrors");
837
833
  });
838
834
  }
839
- function wt(e) {
835
+ function Ot(e) {
840
836
  e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
841
837
  let n = t, r = n.querySelector("[data-formie-field-errors]"), i = Array.from(n.querySelectorAll("[data-formie-field-error]")).map((e) => e.id).filter(Boolean);
842
- D(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
838
+ k(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
843
839
  e.remove();
844
840
  }), r && !r.querySelector("[data-formie-field-error]") && (r.innerHTML = ""), n.querySelectorAll("input, select, textarea").forEach((t) => {
845
841
  let n = t;
846
- n.removeAttribute("aria-invalid"), D(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), Re(n, i);
842
+ n.removeAttribute("aria-invalid"), k(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), ze(n, i);
847
843
  });
848
- }), C(e);
844
+ }), h(e);
849
845
  }
850
- function Tt(e) {
846
+ function kt(e) {
851
847
  e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
852
848
  let n = t;
853
849
  n.querySelectorAll("[data-formie-error]").forEach((e) => {
854
850
  e.remove();
855
- }), D(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 = "");
851
+ }), k(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 = "");
856
852
  });
857
853
  }
858
- function Et(e) {
859
- ht(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
854
+ function At(e) {
855
+ yt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
860
856
  e.remove();
861
857
  }), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
862
858
  let n = t;
863
859
  n.querySelectorAll("[data-formie-success]").forEach((e) => {
864
860
  e.remove();
865
- }), D(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 = "");
866
- }), dt(e) === "message" && R(e) || d(e, !1);
861
+ }), k(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 = "");
862
+ }), mt(e) === "message" && vt(e) || b(e, !1);
867
863
  }
868
- function Dt(e) {
864
+ function jt(e) {
869
865
  e.querySelectorAll("[aria-invalid=\"true\"]").forEach((e) => {
870
866
  e.removeAttribute("aria-invalid");
871
867
  });
872
868
  }
873
- function Ot(e, t) {
874
- let n = Pe(Me(e));
869
+ function Mt(e, t) {
870
+ let n = Fe(Ne(e));
875
871
  Object.entries(t).forEach(([t, r]) => {
876
872
  let i = `fields[${t.split(".").join("][")}]`, a = e.querySelector(`[name="${CSS.escape(i)}"], [name="${CSS.escape(i + "[]")}"]`)?.closest("[data-formie-field-handle]") || e.querySelector(`[data-formie-field-handle="${CSS.escape(t)}"]`);
877
873
  if (!a) return;
878
- let o = Ct(a), s = o.id && o.id.trim() ? o.id : `${t}-errors`;
879
- o.id = s, Fe(o, n), O(a, e, "fieldLayoutError"), a.setAttribute("data-formie-field-has-error", "true"), r.forEach((t, n) => {
874
+ let o = Dt(a), s = o.id && o.id.trim() ? o.id : `${t}-errors`;
875
+ o.id = s, Ie(o, n), A(a, e, "fieldLayoutError"), a.setAttribute("data-formie-field-has-error", "true"), r.forEach((t, n) => {
880
876
  let r = document.createElement("div");
881
- r.setAttribute("data-formie-field-error", "true"), r.id = `${s}-${n + 1}`, O(r, e, "fieldError"), r.textContent = t, o.appendChild(r);
877
+ r.setAttribute("data-formie-field-error", "true"), r.id = `${s}-${n + 1}`, A(r, e, "fieldError"), r.textContent = t, o.appendChild(r);
882
878
  });
883
879
  let c = o.querySelector("[data-formie-field-error]")?.id;
884
880
  a.querySelectorAll("input, select, textarea").forEach((t) => {
885
881
  let n = t;
886
- n.setAttribute("aria-invalid", "true"), O(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), c && M(n, c);
882
+ n.setAttribute("aria-invalid", "true"), A(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), c && P(n, c);
887
883
  let r = a.querySelector("[data-formie-instructions]");
888
- r?.id && Ie(n, r.id);
884
+ r?.id && Le(n, r.id);
889
885
  });
890
- }), C(e);
886
+ }), h(e);
891
887
  }
892
- function kt(e, t) {
893
- let n = bt(e), r = xt(e, n);
894
- O(n, e, "errors"), t.forEach((t) => {
888
+ function Nt(e, t) {
889
+ let n = wt(e), r = Tt(e, n);
890
+ A(n, e, "errors"), t.forEach((t) => {
895
891
  let n = document.createElement("div");
896
- n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), O(n, e, "error"), n.innerHTML = t, r.appendChild(n);
892
+ n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), A(n, e, "error"), n.innerHTML = t, r.appendChild(n);
897
893
  });
898
894
  }
899
- function At(e) {
895
+ function Pt(e) {
900
896
  if (e.ok || e.keepSubmitLoading !== !0) return !1;
901
897
  let t = e.payment?.status;
902
898
  return t === "requiresAction" || t === "pending" || t === "unknown";
903
899
  }
904
- function jt(e, t) {
905
- let n = bt(e), r = xt(e, n);
906
- O(n, e, "errors");
900
+ function Ft(e, t) {
901
+ let n = wt(e), r = Tt(e, n);
902
+ A(n, e, "errors");
907
903
  let i = document.createElement("div");
908
- i.setAttribute("data-formie-notice", "true"), i.setAttribute("role", "status"), O(i, e, "message"), i.textContent = t, r.appendChild(i);
904
+ i.setAttribute("data-formie-notice", "true"), i.setAttribute("role", "status"), A(i, e, "message"), i.textContent = t, r.appendChild(i);
909
905
  }
910
- function Mt(e, t) {
911
- return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" || dt(e) === "message" && pt(e) !== "";
906
+ function It(e, t) {
907
+ return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" || mt(e) === "message" && gt(e) !== "";
912
908
  }
913
- function Nt(e, t, n = {}) {
914
- let r = pt(e);
909
+ function Lt(e, t, n = {}) {
910
+ let r = gt(e);
915
911
  if (!r) return;
916
- let i = St(e, r);
917
- O(i, e, "message", "messageSuccess"), i.setAttribute("data-formie-message", "true"), i.setAttribute("data-formie-message-success", "true"), i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true");
912
+ let i = Et(e, r);
913
+ A(i, e, "message", "messageSuccess"), i.setAttribute("data-formie-message", "true"), i.setAttribute("data-formie-message-success", "true"), i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true");
918
914
  let a = document.createElement("div");
919
- a.setAttribute("data-formie-success", "true"), O(a, e, "success"), a.innerHTML = t, i.appendChild(a), n.hideForm !== !1 && R(e) && d(e, !0);
920
- let o = mt(e);
921
- if (o !== null) {
915
+ a.setAttribute("data-formie-success", "true"), A(a, e, "success"), a.innerHTML = t, i.appendChild(a), n.hideForm !== !1 && vt(e) && b(e, !0);
916
+ let o = e.dataset.formieScrollToTop?.trim().toLowerCase();
917
+ o !== void 0 && [
918
+ "",
919
+ "true",
920
+ "1"
921
+ ].includes(o) && i.scrollIntoView({
922
+ behavior: "smooth",
923
+ block: "start"
924
+ });
925
+ let s = _t(e);
926
+ if (s !== null) {
922
927
  let t = window.setTimeout(() => {
923
- L.delete(e), Et(e);
924
- }, o);
925
- L.set(e, t);
928
+ R.delete(e), At(e);
929
+ }, s);
930
+ R.set(e, t);
926
931
  }
927
932
  }
928
933
  function z(e, t) {
929
- if (wt(e), Tt(e), Et(e), Dt(e), t.ok) {
930
- Mt(e, t) && Nt(e, t.message || "", { hideForm: t.action !== "save" });
931
- return;
932
- }
933
- if (!t.ok) {
934
- if (At(t)) {
934
+ if (Ot(e), kt(e), At(e), jt(e), t.ok) {
935
+ let n = t.meta?.summaryTokens;
936
+ n && typeof n == "object" && e.querySelectorAll("[data-formie-field-uid]").forEach((e) => {
937
+ let t = n[e.dataset.formieFieldUid || ""];
938
+ typeof t == "string" && t && e.querySelector("[data-formie-summary-container]")?.setAttribute("data-formie-summary-token", t);
939
+ }), It(e, t) && Lt(e, t.message || "", { hideForm: t.action !== "save" });
940
+ } else if (!t.ok) {
941
+ if (Pt(t)) {
935
942
  let n = String(t.payment?.message || "").trim();
936
- n && jt(e, n);
943
+ n && Ft(e, n);
937
944
  return;
938
945
  }
939
- t.fieldErrors && Ot(e, t.fieldErrors), t.formErrors?.length ? kt(e, t.formErrors) : !t.fieldErrors && t.message && kt(e, [t.message]), We(e);
946
+ t.fieldErrors && Mt(e, t.fieldErrors), t.formErrors?.length ? Nt(e, t.formErrors) : !t.fieldErrors && t.message && Nt(e, [t.message]), F(e);
940
947
  }
941
948
  }
942
949
  //#endregion
943
950
  //#region src/js/core/submit-flow.ts
944
- var Pt = E("general", "submit-flow");
945
- function Ft(e) {
951
+ var Rt = O("general", "submit-flow");
952
+ function zt(e) {
946
953
  return !(!e.ok && e.stage === "validate");
947
954
  }
948
- function It(e) {
955
+ function Bt(e) {
949
956
  return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
950
957
  }
951
- function Lt(e) {
952
- wt(e), Tt(e), Et(e), Dt(e);
958
+ function Vt(e) {
959
+ Ot(e), kt(e), At(e), jt(e);
953
960
  }
954
- async function Rt(e) {
961
+ async function Ht(e) {
955
962
  let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: d } = e;
956
- Lt(r), v(r, c || null);
957
- let f = {
963
+ Vt(r), C(r, c || null);
964
+ let p = {
958
965
  ok: !1,
959
966
  code: "SUBMIT_ERROR",
960
967
  message: "Submission failed.",
961
968
  formErrors: ["Submission failed."]
962
969
  };
963
970
  try {
964
- await l(r), f = await ct(r, s, i, {
971
+ await l(r), p = await dt(r, s, i, {
965
972
  validator: a,
966
973
  validateOnSubmit: o
967
- }), z(r, f), d(f), b(r, f, s), Ft(f) && await u(f);
974
+ }), z(r, p), d(p), v(r, p, s), zt(p) && await u(p);
968
975
  } catch (e) {
969
- f = {
976
+ p = {
970
977
  ok: !1,
971
978
  code: "SUBMIT_ERROR",
972
979
  message: e instanceof Error ? e.message : "Submission failed.",
973
980
  formErrors: [e instanceof Error ? e.message : "Submission failed."]
974
- }, z(r, f), d(f), Pt.warn("Submit failed with exception.", {
981
+ }, z(r, p), d(p), Rt.warn("Submit failed with exception.", {
975
982
  id: t,
976
983
  action: s,
977
984
  target: n,
978
985
  error: e instanceof Error ? e.message : e
979
986
  });
980
987
  } finally {
981
- It(f) || h(r);
988
+ Bt(p) || f(r);
982
989
  }
983
- return f;
990
+ return p;
984
991
  }
985
992
  //#endregion
986
993
  //#region src/js/events/event-bus.ts
987
- var zt = class {
994
+ var Ut = class {
988
995
  listeners = /* @__PURE__ */ new Map();
989
996
  on(e, t) {
990
997
  return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e)?.add(t), () => {
@@ -1025,11 +1032,7 @@ var zt = class {
1025
1032
  failed: []
1026
1033
  };
1027
1034
  return !n || n.size === 0 || (await Promise.allSettled(Array.from(n).map(async (e) => e(t)))).forEach((e, t) => {
1028
- if (e.status === "fulfilled") {
1029
- r.succeeded += 1;
1030
- return;
1031
- }
1032
- r.failed.push({
1035
+ e.status === "fulfilled" ? r.succeeded += 1 : r.failed.push({
1033
1036
  index: t,
1034
1037
  error: e.reason
1035
1038
  });
@@ -1064,66 +1067,66 @@ var zt = class {
1064
1067
  getAll() {
1065
1068
  return Array.from(this.modules.values());
1066
1069
  }
1067
- }, Bt = new B(), Vt = {
1068
- "address-finder": () => import("./chunks/address-finder-BWGINCSA.js").then((e) => e.addressFinderModule),
1069
- "google-address": () => import("./chunks/google-address-JHYvjwgN.js").then((e) => e.googleAddressModule),
1070
- loqate: () => import("./chunks/loqate-m51iPyO1.js").then((e) => e.loqateModule),
1071
- "place-kit": () => import("./chunks/place-kit-BnZGQ-L1.js").then((e) => e.placeKitModule)
1072
- }, Ht = {
1073
- "captcha-eu": () => import("./chunks/captcha-eu-DWLoQFKB.js").then((e) => e.captchaEuModule),
1074
- "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-CVXaXgDO.js").then((e) => e.friendlyCaptchaV1Module),
1075
- "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-DkeIVTKI.js").then((e) => e.friendlyCaptchaV2Module),
1076
- hcaptcha: () => import("./chunks/hcaptcha-Dt3ELLlP.js").then((e) => e.hcaptchaModule),
1077
- "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-CUs8BO6V.js").then((e) => e.recaptchaEnterpriseModule),
1078
- "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-P1McW4Pv.js").then((e) => e.recaptchaV2CheckboxModule),
1079
- "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-FGDqozSP.js").then((e) => e.recaptchaV2InvisibleModule),
1080
- "recaptcha-v3": () => import("./chunks/recaptcha-v3-CflUHeZD.js").then((e) => e.recaptchaV3Module),
1081
- snaptcha: () => import("./chunks/snaptcha-C3QLYxFT.js").then((e) => e.snaptchaModule),
1082
- turnstile: () => import("./chunks/turnstile-ptihQfLl.js").then((e) => e.turnstileModule)
1083
- }, Ut = {
1084
- calculations: () => import("./chunks/calculations-YEoVCG2q.js").then((e) => e.calculationsModule),
1085
- "checkbox-radio": () => import("./chunks/checkbox-radio-gsm8QPJg.js").then((e) => e.checkboxRadioModule),
1086
- combobox: () => import("./chunks/combobox-Ba08_cHL.js").then((e) => e.comboboxModule),
1087
- conditions: () => import("./chunks/conditions-Ceeg6ReZ.js").then((e) => e.conditionsModule),
1088
- "custom-google-maps": () => import("./chunks/custom-google-maps-C4l2S3GO.js").then((e) => e.customGoogleMapsModule),
1089
- "custom-link": () => import("./chunks/custom-link-CLazgKYH.js").then((e) => e.customLinkModule),
1090
- "custom-maps": () => import("./chunks/custom-maps-DqcAlD0v.js").then((e) => e.customMapsModule),
1091
- "date-picker": () => import("./chunks/date-picker-DaPvMrop.js").then((e) => e.datePickerModule),
1092
- "file-upload": () => import("./chunks/file-upload-B8_mH012.js").then((e) => e.fileUploadModule),
1093
- "upload-manager": () => import("./chunks/upload-manager-BW7l-BhF.js").then((e) => e.uploadManagerModule),
1094
- hidden: () => import("./chunks/hidden-BZhXnNPe.js").then((e) => e.hiddenModule),
1095
- "phone-country": () => import("./chunks/phone-country-B8fv-L5_.js").then((e) => e.phoneCountryModule),
1096
- "password-validation": () => import("./chunks/password-validation-C8_uO_c_.js").then((e) => e.passwordValidationModule),
1097
- "address-country": () => import("./chunks/address-country-BcEQKw0T.js").then((e) => e.addressCountryModule),
1098
- "address-state": () => import("./chunks/address-state-DI3ndhMU.js").then((e) => e.addressStateModule),
1099
- repeater: () => import("./chunks/repeater-CyhDbozO.js").then((e) => e.repeaterModule),
1100
- "rich-text": () => import("./chunks/rich-text-uV4o_pGk.js").then((e) => e.richTextModule),
1101
- signature: () => import("./chunks/signature-7cldFbqj.js").then((e) => e.signatureModule),
1102
- summary: () => import("./chunks/summary-Bn-g5SDx.js").then((e) => e.summaryModule),
1103
- "survey-likert": () => import("./chunks/survey-likert-fk1hUPff.js").then((e) => e.surveyLikertModule),
1104
- "survey-rank": () => import("./chunks/survey-rank-BsLGl2LX.js").then((e) => e.surveyRankModule),
1105
- "survey-rating": () => import("./chunks/survey-rating-DVS6e6fM.js").then((e) => e.surveyRatingModule),
1106
- table: () => import("./chunks/table-j7MlLLCc.js").then((e) => e.tableModule),
1107
- "text-limit": () => import("./chunks/text-limit-LGMPhFuC.js").then((e) => e.textLimitModule)
1108
- }, Wt = {
1109
- bpoint: () => import("./chunks/bpoint-BwtuyN_O.js").then((e) => e.bpointModule),
1110
- eway: () => import("./chunks/eway-uw0DzU-L.js").then((e) => e.ewayModule),
1111
- "go-cardless": () => import("./chunks/go-cardless-c4wLJdOt.js").then((e) => e.goCardlessModule),
1112
- mollie: () => import("./chunks/mollie-Bn0PX173.js").then((e) => e.mollieModule),
1113
- moneris: () => import("./chunks/moneris-BRbUvI4t.js").then((e) => e.monerisModule),
1114
- opayo: () => import("./chunks/opayo-BwWdInEP.js").then((e) => e.opayoModule),
1115
- paddle: () => import("./chunks/paddle-CympHVvd.js").then((e) => e.paddleModule),
1116
- paypal: () => import("./chunks/paypal-h75h6wae.js").then((e) => e.paypalModule),
1117
- payway: () => import("./chunks/payway-C9rHTCC_.js").then((e) => e.paywayModule),
1118
- square: () => import("./chunks/square-C1z5DPVw.js").then((e) => e.squareModule),
1119
- stripe: () => import("./chunks/stripe-Dmkdkq1y.js").then((e) => e.stripeModule)
1120
- }, Gt = {
1121
- ...Ut,
1122
- ...Vt,
1123
- ...Ht,
1124
- ...Wt
1070
+ }, Wt = new B(), Gt = {
1071
+ "address-finder": () => import("./chunks/address-finder-QK1m1eyv.js").then((e) => e.addressFinderModule),
1072
+ "google-address": () => import("./chunks/google-address-DQR6rsbh.js").then((e) => e.googleAddressModule),
1073
+ loqate: () => import("./chunks/loqate-ZZClcacr.js").then((e) => e.loqateModule),
1074
+ "place-kit": () => import("./chunks/place-kit-BKk8xDXf.js").then((e) => e.placeKitModule)
1075
+ }, Kt = {
1076
+ "captcha-eu": () => import("./chunks/captcha-eu-eU_M6snp.js").then((e) => e.captchaEuModule),
1077
+ "friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-C_cF1WD2.js").then((e) => e.friendlyCaptchaV1Module),
1078
+ "friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-BenESH-n.js").then((e) => e.friendlyCaptchaV2Module),
1079
+ hcaptcha: () => import("./chunks/hcaptcha-COilLmRT.js").then((e) => e.hcaptchaModule),
1080
+ "recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-Cx6HUpMa.js").then((e) => e.recaptchaEnterpriseModule),
1081
+ "recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-DQ9BJzcv.js").then((e) => e.recaptchaV2CheckboxModule),
1082
+ "recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-BP0T8Pan.js").then((e) => e.recaptchaV2InvisibleModule),
1083
+ "recaptcha-v3": () => import("./chunks/recaptcha-v3-DKMGQ27K.js").then((e) => e.recaptchaV3Module),
1084
+ snaptcha: () => import("./chunks/snaptcha-P3EoSQud.js").then((e) => e.snaptchaModule),
1085
+ turnstile: () => import("./chunks/turnstile-Sp4ubowK.js").then((e) => e.turnstileModule)
1086
+ }, qt = {
1087
+ calculations: () => import("./chunks/calculations-DeEmdUDq.js").then((e) => e.calculationsModule),
1088
+ "checkbox-radio": () => import("./chunks/checkbox-radio-CSXo6svm.js").then((e) => e.checkboxRadioModule),
1089
+ combobox: () => import("./chunks/combobox-CJh2DoSO.js").then((e) => e.comboboxModule),
1090
+ conditions: () => import("./chunks/conditions-Dz3068K0.js").then((e) => e.conditionsModule),
1091
+ "custom-google-maps": () => import("./chunks/custom-google-maps-rNm5VFbb.js").then((e) => e.customGoogleMapsModule),
1092
+ "custom-link": () => import("./chunks/custom-link-CLqFCssQ.js").then((e) => e.customLinkModule),
1093
+ "custom-maps": () => import("./chunks/custom-maps-DgjYQDLj.js").then((e) => e.customMapsModule),
1094
+ "date-picker": () => import("./chunks/date-picker-BVJxJVYT.js").then((e) => e.datePickerModule),
1095
+ "file-upload": () => import("./chunks/file-upload-vEUr_EuP.js").then((e) => e.fileUploadModule),
1096
+ "upload-manager": () => import("./chunks/upload-manager-Ccg3d_4I.js").then((e) => e.uploadManagerModule),
1097
+ hidden: () => import("./chunks/hidden-Bc2TpcgF.js").then((e) => e.hiddenModule),
1098
+ "phone-country": () => import("./chunks/phone-country-Bx9EG50h.js").then((e) => e.phoneCountryModule),
1099
+ "password-validation": () => import("./chunks/password-validation-HGOU9kf3.js").then((e) => e.passwordValidationModule),
1100
+ "address-country": () => import("./chunks/address-country-DLJF-OkC.js").then((e) => e.addressCountryModule),
1101
+ "address-state": () => import("./chunks/address-state-CHKit8AW.js").then((e) => e.addressStateModule),
1102
+ repeater: () => import("./chunks/repeater-BR0RUvTs.js").then((e) => e.repeaterModule),
1103
+ "rich-text": () => import("./chunks/rich-text-H2A6cm1t.js").then((e) => e.richTextModule),
1104
+ signature: () => import("./chunks/signature-CfKA_poI.js").then((e) => e.signatureModule),
1105
+ summary: () => import("./chunks/summary-B3CAebLV.js").then((e) => e.summaryModule),
1106
+ "survey-likert": () => import("./chunks/survey-likert-CEtUceag.js").then((e) => e.surveyLikertModule),
1107
+ "survey-rank": () => import("./chunks/survey-rank-Dtt97y6s.js").then((e) => e.surveyRankModule),
1108
+ "survey-rating": () => import("./chunks/survey-rating-mlDMI0uq.js").then((e) => e.surveyRatingModule),
1109
+ table: () => import("./chunks/table-0k6Md0IO.js").then((e) => e.tableModule),
1110
+ "text-limit": () => import("./chunks/text-limit-CTVML6s7.js").then((e) => e.textLimitModule)
1111
+ }, Jt = {
1112
+ bpoint: () => import("./chunks/bpoint-GvYfyPjD.js").then((e) => e.bpointModule),
1113
+ eway: () => import("./chunks/eway-BZuTBAUW.js").then((e) => e.ewayModule),
1114
+ "go-cardless": () => import("./chunks/go-cardless-DWZeB0Bq.js").then((e) => e.goCardlessModule),
1115
+ mollie: () => import("./chunks/mollie-8OMXIYa8.js").then((e) => e.mollieModule),
1116
+ moneris: () => import("./chunks/moneris-qYHJ9EFy.js").then((e) => e.monerisModule),
1117
+ opayo: () => import("./chunks/opayo-DlWPEnla.js").then((e) => e.opayoModule),
1118
+ paddle: () => import("./chunks/paddle-CArfWih0.js").then((e) => e.paddleModule),
1119
+ paypal: () => import("./chunks/paypal-BcaMCMGY.js").then((e) => e.paypalModule),
1120
+ payway: () => import("./chunks/payway-vxC7_bfR.js").then((e) => e.paywayModule),
1121
+ square: () => import("./chunks/square-Dyz0p_GU.js").then((e) => e.squareModule),
1122
+ stripe: () => import("./chunks/stripe-Bfd_jp_k.js").then((e) => e.stripeModule)
1123
+ }, Yt = {
1124
+ ...qt,
1125
+ ...Gt,
1126
+ ...Kt,
1127
+ ...Jt
1125
1128
  }, V = /* @__PURE__ */ new Map();
1126
- function Kt(e) {
1129
+ function Xt(e) {
1127
1130
  if (e instanceof Error) return {
1128
1131
  name: e.name || "Error",
1129
1132
  message: e.message || "No error message was provided.",
@@ -1145,7 +1148,7 @@ function Kt(e) {
1145
1148
  };
1146
1149
  }
1147
1150
  }
1148
- function qt(e, t, n) {
1151
+ function Zt(e, t, n) {
1149
1152
  let r = [...t].filter((e) => e.required), i = [
1150
1153
  "Formie browser module diagnostics",
1151
1154
  `Surface: ${e}`,
@@ -1156,7 +1159,7 @@ function qt(e, t, n) {
1156
1159
  i.push("", `Failure ${r + 1}`, `Module: ${t.moduleId}`, `Key: ${t.key}`, `Code: ${t.code}`), e === "cp-edit" && a && (i.push(`Error: ${a.name}: ${a.message}`), a.stack && i.push("Stack:", a.stack));
1157
1160
  }), i.join("\n");
1158
1161
  }
1159
- async function Jt(e) {
1162
+ async function Qt(e) {
1160
1163
  if (navigator.clipboard?.writeText) {
1161
1164
  await navigator.clipboard.writeText(e);
1162
1165
  return;
@@ -1169,10 +1172,10 @@ async function Jt(e) {
1169
1172
  t.remove();
1170
1173
  }
1171
1174
  }
1172
- async function Yt(e, t) {
1175
+ async function $t(e, t) {
1173
1176
  let n = t.get(e);
1174
1177
  if (n) return n;
1175
- let r = e.startsWith("formie:") && Object.prototype.hasOwnProperty.call(Gt, e.slice(7)) ? Gt[e.slice(7)] : void 0;
1178
+ let r = e.startsWith("formie:") && Object.prototype.hasOwnProperty.call(Yt, e.slice(7)) ? Yt[e.slice(7)] : void 0;
1176
1179
  if (!r) throw Error(`Browser module ${e} is not registered.`);
1177
1180
  V.has(e) || V.set(e, r().catch((t) => {
1178
1181
  throw V.delete(e), t;
@@ -1181,14 +1184,14 @@ async function Yt(e, t) {
1181
1184
  if (i.moduleId !== e) throw Error(`Module definition does not match ${e}.`);
1182
1185
  return t.register(i), i;
1183
1186
  }
1184
- function Xt(e, t, n) {
1187
+ function en(e, t, n) {
1185
1188
  return [...new Set(e.targets.flatMap((e) => {
1186
1189
  if (e.type === "form") return [n || t];
1187
1190
  let r = e.type === "selector" ? e.selector : e.type === "field" ? `[data-formie-field-uid="${CSS.escape(e.uid)}"]` : e.type === "page" ? `[data-formie-page-id="${CSS.escape(e.id)}"]` : `[data-formie-action="${CSS.escape(e.action)}"]`;
1188
1191
  return [...t.matches(r) ? [t] : [], ...t.querySelectorAll(r)];
1189
1192
  }))].filter((e) => !e.closest("[hidden], [data-formie-hidden=\"true\"], [data-formie-conditionally-hidden], [data-formie-page-hidden]"));
1190
1193
  }
1191
- async function Zt(e, t) {
1194
+ async function tn(e, t) {
1192
1195
  n(e);
1193
1196
  let r = e.surface;
1194
1197
  if (t.matchContext.surface !== r || t.setupContext.surface !== r) throw Error(`Browser module manifest surface ${r} cannot mount as ${t.matchContext.surface}.`);
@@ -1201,7 +1204,7 @@ async function Zt(e, t) {
1201
1204
  code: "MODULE_UNAVAILABLE",
1202
1205
  message: "A form feature could not start. Reload the page or contact the site administrator."
1203
1206
  };
1204
- s.set(e.key, i), c.set(e.key, Kt(n)), console.error("[formie] Browser module failure", i, n), await t.setupContext.emit("formie:browser:module:error", i);
1207
+ s.set(e.key, i), c.set(e.key, Xt(n)), console.error("[formie] Browser module failure", i, n), await t.setupContext.emit("formie:browser:module:error", i);
1205
1208
  }, m = async (e) => {
1206
1209
  try {
1207
1210
  await e.destroy();
@@ -1243,7 +1246,7 @@ async function Zt(e, t) {
1243
1246
  let d = document.createElement("span");
1244
1247
  d.className = "formie-module-error__copy-status", d.setAttribute("role", "status"), d.setAttribute("aria-live", "polite"), u.addEventListener("click", async () => {
1245
1248
  try {
1246
- await Jt(n.textContent || ""), d.textContent = "Details copied.";
1249
+ await Qt(n.textContent || ""), d.textContent = "Details copied.";
1247
1250
  } catch {
1248
1251
  d.textContent = "Copy failed. Select the details above and copy them manually.";
1249
1252
  let e = document.createRange();
@@ -1253,7 +1256,7 @@ async function Zt(e, t) {
1253
1256
  }
1254
1257
  e.dataset.formieModuleError = "true", i !== a && a.contains(i) ? i.before(e) : a.prepend(e);
1255
1258
  }
1256
- let t = e.querySelector("[data-formie-module-error-details]"), n = qt(r, s.values(), c);
1259
+ let t = e.querySelector("[data-formie-module-error-details]"), n = Zt(r, s.values(), c);
1257
1260
  t && t.textContent !== n && (t.textContent = n);
1258
1261
  }, _ = (e) => {
1259
1262
  h() && (e.preventDefault(), e.stopImmediatePropagation(), g());
@@ -1272,7 +1275,7 @@ async function Zt(e, t) {
1272
1275
  });
1273
1276
  let d;
1274
1277
  try {
1275
- d = Xt(n, i, a);
1278
+ d = en(n, i, a);
1276
1279
  } catch (e) {
1277
1280
  s.has(n.key) || await p(n, e);
1278
1281
  continue;
@@ -1282,7 +1285,7 @@ async function Zt(e, t) {
1282
1285
  for (let [e, t] of Array.from(f.entries()).reverse()) d.includes(e) || (await m(t.instance), f.delete(e), l.splice(l.indexOf(t.instance), 1));
1283
1286
  let h;
1284
1287
  try {
1285
- h = await Yt(n.moduleId, t.registry);
1288
+ h = await $t(n.moduleId, t.registry);
1286
1289
  } catch (e) {
1287
1290
  s.has(n.key) || await p(n, e);
1288
1291
  continue;
@@ -1405,17 +1408,8 @@ async function Zt(e, t) {
1405
1408
  };
1406
1409
  }
1407
1410
  //#endregion
1408
- //#region src/js/utils/form-started-at.ts
1409
- var Qt = "formie:formStartedAt:";
1410
- function $t(e) {
1411
- let t = e.querySelector("input[name=\"formStartedAt\"]");
1412
- if (!t) return;
1413
- let n = e.querySelector("input[name=\"renderId\"]")?.value?.trim() ?? "", r = n ? `${Qt}${n}` : null, i = r ? sessionStorage.getItem(r) : null;
1414
- i || (i = String(Date.now()), r && sessionStorage.setItem(r, i)), t.value = i;
1415
- }
1416
- //#endregion
1417
1411
  //#region src/js/utils/unload-warning.ts
1418
- var en = /* @__PURE__ */ new Set([
1412
+ var nn = /* @__PURE__ */ new Set([
1419
1413
  "action",
1420
1414
  "redirect",
1421
1415
  "requestToken",
@@ -1428,63 +1422,78 @@ var en = /* @__PURE__ */ new Set([
1428
1422
  "draftContext",
1429
1423
  "progressId"
1430
1424
  ]);
1431
- function tn(e, t) {
1425
+ function rn(e) {
1426
+ let t = /* @__PURE__ */ new Set(), n = !0;
1427
+ return g(e, "formie:unload-warning:collect-exclusions", {
1428
+ form: e,
1429
+ exclude: (...e) => {
1430
+ n && e.forEach((e) => {
1431
+ typeof e == "string" && e !== "" && t.add(e);
1432
+ });
1433
+ }
1434
+ }), n = !1, t;
1435
+ }
1436
+ function H(e, t) {
1432
1437
  if (e == null) return String(e);
1433
1438
  if (typeof e == "string") return JSON.stringify(e);
1434
1439
  if (typeof e == "number" || typeof e == "boolean") return String(e);
1435
1440
  if (typeof e == "function") return "[function]";
1436
1441
  if (typeof File < "u" && e instanceof File) return `[file:${e.name}:${e.size}:${e.type}]`;
1437
1442
  if (typeof Blob < "u" && e instanceof Blob) return `[blob:${e.size}:${e.type}]`;
1438
- if (Array.isArray(e)) return `[${e.map((e) => tn(e, t)).join(",")}]`;
1443
+ if (Array.isArray(e)) return `[${e.map((e) => H(e, t)).join(",")}]`;
1439
1444
  if (typeof e == "object") {
1440
1445
  if (t.has(e)) return "[circular]";
1441
1446
  t.add(e);
1442
- let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${tn(n, t)}`);
1447
+ let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${H(n, t)}`);
1443
1448
  return t.delete(e), `{${n.join(",")}}`;
1444
1449
  }
1445
1450
  return JSON.stringify(String(e));
1446
1451
  }
1447
- function nn(e) {
1448
- return tn(e, /* @__PURE__ */ new WeakSet());
1452
+ function an(e) {
1453
+ return H(e, /* @__PURE__ */ new WeakSet());
1449
1454
  }
1450
- function rn(e, t) {
1455
+ function on(e, t) {
1451
1456
  if (!e) return !1;
1452
1457
  let n = e.endsWith("[]") ? e.slice(0, -2) : e;
1453
- return !re(n, t) && !en.has(n);
1454
- }
1455
- function an(e) {
1456
- return nn(Array.from(new FormData(e).entries()).filter(([t]) => rn(String(t || ""), e)));
1457
- }
1458
- function on(e, t = {}) {
1459
- let n = null, r = !1, i = !1, a = null, o = null, s = null, c = () => {
1460
- a !== null && (window.cancelAnimationFrame(a), a = null), o !== null && (window.clearTimeout(o), o = null), s !== null && (window.clearTimeout(s), s = null);
1461
- }, l = () => r ? (i = an(e) !== n, i) : !1, u = () => {
1462
- n = an(e), r = !0, i = !1;
1458
+ return !ie(n, t) && !nn.has(n);
1459
+ }
1460
+ function sn(e, t, n) {
1461
+ return an(e.filter(([e]) => !n.has(e) && on(String(e || ""), t)));
1462
+ }
1463
+ function cn(e, t = {}) {
1464
+ let n = [], r = !1, i = !1, a = !1, o = null, s = null, c = null, l = () => {
1465
+ o !== null && (window.cancelAnimationFrame(o), o = null), s !== null && (window.clearTimeout(s), s = null), c !== null && (window.clearTimeout(c), c = null);
1466
+ }, u = () => {
1467
+ if (!r) return !1;
1468
+ let t = rn(e);
1469
+ return a = sn(Array.from(new FormData(e).entries()), e, t) !== sn(n, e, t), a;
1463
1470
  }, d = () => {
1464
- c(), r = !1, a = window.requestAnimationFrame(() => {
1465
- a = null, s = window.setTimeout(() => {
1466
- s = null, u();
1467
- }, 0);
1468
- });
1471
+ i || (l(), n = Array.from(new FormData(e).entries()), r = !0, a = !1);
1469
1472
  }, f = () => {
1470
- o !== null && window.clearTimeout(o), o = window.setTimeout(() => {
1471
- o = null, l();
1473
+ i || (l(), r = !1, o = window.requestAnimationFrame(() => {
1474
+ o = null, c = window.setTimeout(() => {
1475
+ c = null, d();
1476
+ }, 0);
1477
+ }));
1478
+ }, p = () => {
1479
+ s !== null && window.clearTimeout(s), s = window.setTimeout(() => {
1480
+ s = null, u();
1472
1481
  }, 120);
1473
- }, p = (e) => {
1474
- (!t.shouldWarn || t.shouldWarn()) && l() && (e.preventDefault(), e.returnValue = "");
1482
+ }, m = (e) => {
1483
+ (!t.shouldWarn || t.shouldWarn()) && u() && (e.preventDefault(), e.returnValue = "");
1475
1484
  };
1476
- return e.addEventListener("input", f), e.addEventListener("change", f), window.addEventListener("beforeunload", p), d(), {
1477
- captureBaseline: u,
1478
- scheduleBaselineCapture: d,
1479
- refreshDirtyState: l,
1485
+ return e.addEventListener("input", p), e.addEventListener("change", p), window.addEventListener("beforeunload", m), d(), {
1486
+ captureBaseline: d,
1487
+ scheduleBaselineCapture: f,
1488
+ refreshDirtyState: u,
1480
1489
  destroy: () => {
1481
- c(), e.removeEventListener("input", f), e.removeEventListener("change", f), window.removeEventListener("beforeunload", p);
1490
+ i = !0, r = !1, n = [], l(), e.removeEventListener("input", p), e.removeEventListener("change", p), window.removeEventListener("beforeunload", m);
1482
1491
  }
1483
1492
  };
1484
1493
  }
1485
1494
  //#endregion
1486
1495
  //#region src/js/validation/rules/email.ts
1487
- var sn = {
1496
+ var ln = {
1488
1497
  rule: ({ input: e, getRule: n }) => {
1489
1498
  let r = n("email");
1490
1499
  return !r || t(e.value, {
@@ -1496,23 +1505,23 @@ var sn = {
1496
1505
  };
1497
1506
  //#endregion
1498
1507
  //#region src/js/validation/rules/shared.ts
1499
- function cn(e) {
1508
+ function un(e) {
1500
1509
  return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
1501
1510
  }
1502
- function ln(e) {
1511
+ function dn(e) {
1503
1512
  let t = e.getRule("match");
1504
1513
  if (!t || t === !0 || typeof t != "object" || !e.field) return null;
1505
1514
  let n = typeof t.fieldHandle == "string" ? t.fieldHandle.trim() : "";
1506
1515
  if (!n) return null;
1507
1516
  let r = e.form.querySelector(`[data-formie-field-handle="${n}"]`);
1508
- return r ? Array.from(r.querySelectorAll(e.config.fieldsSelector)).find((e) => (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !k(e)) ?? null : null;
1517
+ return r ? Array.from(r.querySelectorAll(e.config.fieldsSelector)).find((e) => (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !j(e)) ?? null : null;
1509
1518
  }
1510
1519
  //#endregion
1511
1520
  //#region src/js/validation/rules.ts
1512
- var un = {
1521
+ var fn = {
1513
1522
  required: {
1514
1523
  rule: ({ input: e, getRule: n }) => {
1515
- if (!n("required") || e.type === "hidden") return !0;
1524
+ if (!n("required") || e.type === "hidden" || e.closest("[data-formie-field-handle]")?.getAttribute("data-formie-field-type") === "table") return !0;
1516
1525
  if (e instanceof HTMLInputElement && e.type === "file") {
1517
1526
  if (e.files?.length) return !0;
1518
1527
  let t = e.closest("[data-formie-field-handle]"), n = e.name.replace(/\[\]$/, "");
@@ -1526,7 +1535,7 @@ var un = {
1526
1535
  },
1527
1536
  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 })
1528
1537
  },
1529
- email: sn,
1538
+ email: ln,
1530
1539
  url: {
1531
1540
  rule: ({ input: e, getRule: n }) => {
1532
1541
  let r = n("url");
@@ -1555,18 +1564,18 @@ var un = {
1555
1564
  },
1556
1565
  match: {
1557
1566
  rule: (e) => {
1558
- let n = ln(e);
1567
+ let n = dn(e);
1559
1568
  return !n || t(e.input.value, { type: "match" }, { comparison: n.value }) === null;
1560
1569
  },
1561
1570
  message: (e) => {
1562
- let t = ln(e)?.closest("[data-formie-field-handle]"), n = cn(t);
1571
+ let t = dn(e)?.closest("[data-formie-field-handle]"), n = un(t);
1563
1572
  return e.input.getAttribute("data-formie-validation-match-message") ?? e.t("{label} must match {value}.", {
1564
1573
  label: e.label,
1565
1574
  value: n
1566
1575
  });
1567
1576
  }
1568
1577
  }
1569
- }, dn = {
1578
+ }, pn = {
1570
1579
  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,})+$/,
1571
1580
  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*)?$/,
1572
1581
  number: /^(?:[-+]?[0-9]*[.,]?[0-9]+)$/,
@@ -1574,14 +1583,14 @@ var un = {
1574
1583
  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))/,
1575
1584
  time: /^(?:(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]))$/,
1576
1585
  month: /^(?:(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])))$/
1577
- }, H = E("general", "validator");
1578
- function U(e) {
1579
- return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
1586
+ }, U = O("general", "validator");
1587
+ function W(e) {
1588
+ return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !!e.name;
1580
1589
  }
1581
- function fn(e) {
1590
+ function G(e) {
1582
1591
  return !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
1583
1592
  }
1584
- var pn = class {
1593
+ var mn = class {
1585
1594
  form;
1586
1595
  errors = [];
1587
1596
  validators = {};
@@ -1603,14 +1612,14 @@ var pn = class {
1603
1612
  messagesClass: [],
1604
1613
  messageClass: [],
1605
1614
  fieldsSelector: "input:not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])",
1606
- patterns: dn,
1615
+ patterns: pn,
1607
1616
  ...t
1608
- }, Object.entries(un).forEach(([e, t]) => {
1617
+ }, Object.entries(fn).forEach(([e, t]) => {
1609
1618
  this.addValidator(e, t.rule, t.message);
1610
1619
  }), this.init();
1611
1620
  }
1612
1621
  init() {
1613
- H.log("Initializing validator.", {
1622
+ U.log("Initializing validator.", {
1614
1623
  formId: this.form.id || null,
1615
1624
  live: this.config.live
1616
1625
  }), this.form.setAttribute("novalidate", "true"), this.inputs().forEach((e) => {
@@ -1618,9 +1627,9 @@ var pn = class {
1618
1627
  }), this.config.live && this.addEventListeners(), this.emitEvent(document, o("ready"), { validator: this });
1619
1628
  }
1620
1629
  inputs(e = null) {
1621
- if (U(e)) return k(e) ? [] : [e];
1630
+ if (W(e)) return j(e) ? [] : [e];
1622
1631
  let t = e || this.form;
1623
- return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => U(e) && !k(e));
1632
+ return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => W(e) && !j(e));
1624
1633
  }
1625
1634
  getInputValue(e) {
1626
1635
  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 ?? "";
@@ -1638,29 +1647,29 @@ var pn = class {
1638
1647
  this.errors = [];
1639
1648
  let n = /* @__PURE__ */ new Set();
1640
1649
  return this.inputs(e).forEach((e) => {
1641
- let r = !1;
1650
+ let r = !1, i = t.renderErrors !== !1 && this.shouldShowError(e);
1642
1651
  if (!this.isVisible(e, t)) return;
1643
- let i = e.closest("[data-formie-field-handle]"), a = e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? `${i?.getAttribute("data-formie-field-handle") || ""}:${e.name}` : null;
1644
- if (a) {
1645
- if (n.has(a)) return;
1646
- n.add(a);
1652
+ let a = e.closest("[data-formie-field-handle]"), o = e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? `${a?.getAttribute("data-formie-field-handle") || ""}:${e.name}` : null;
1653
+ if (o) {
1654
+ if (n.has(o)) return;
1655
+ n.add(o);
1647
1656
  }
1648
- this.shouldShowError(e) && this.removeError(e);
1649
- let o = this.getValidatorCallbackOptions(e);
1657
+ i && this.removeError(e);
1658
+ let s = this.getValidatorCallbackOptions(e);
1650
1659
  Object.entries(this.validators).forEach(([t, n]) => {
1651
- if (!n.validate(o)) {
1652
- let i = this.getErrorMessage(e, t, n, o);
1653
- this.shouldShowError(e) && !r && this.showError(e, t, i), this.errors.push({
1660
+ if (!n.validate(s)) {
1661
+ let a = this.getErrorMessage(e, t, n, s);
1662
+ i && !r && this.showError(e, t, a), this.errors.push({
1654
1663
  input: e,
1655
- field: o.field,
1664
+ field: s.field,
1656
1665
  validator: t,
1657
- message: i,
1658
- handle: o.field?.getAttribute("data-formie-field-handle") || null,
1666
+ message: a,
1667
+ handle: s.field?.getAttribute("data-formie-field-handle") || null,
1659
1668
  result: !1
1660
1669
  }), r = !0;
1661
1670
  }
1662
- }), !r && this.shouldShowError(e) && this.removeError(e);
1663
- }), H.log("Validation pass complete.", {
1671
+ }), !r && i && this.removeError(e);
1672
+ }), U.log("Validation pass complete.", {
1664
1673
  errorCount: this.errors.length,
1665
1674
  includeHiddenPages: t.includeHiddenPages === !0
1666
1675
  }), this.errors;
@@ -1681,38 +1690,38 @@ var pn = class {
1681
1690
  e.remove();
1682
1691
  }), n && (n.innerHTML = ""), t.querySelectorAll("input, select, textarea").forEach((e) => {
1683
1692
  let t = e;
1684
- t.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && t.classList.remove(...this.config.inputErrorClass), t.removeAttribute("data-formie-input-has-error"), Re(t, r);
1693
+ t.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && t.classList.remove(...this.config.inputErrorClass), t.removeAttribute("data-formie-input-has-error"), ze(t, r);
1685
1694
  });
1686
1695
  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");
1687
- this.emitEvent(e, o("clear-error"), { validator: this }), C(this.form);
1696
+ this.emitEvent(e, o("clear-error"), { validator: this }), h(this.form);
1688
1697
  }
1689
1698
  showError(e, t, n) {
1690
1699
  let r = e.closest("[data-formie-field-handle]");
1691
1700
  if (!r) return;
1692
1701
  let i = r.querySelector("[data-formie-field-errors]");
1693
- i ||= ut(r, (e) => {
1702
+ i ||= pt(r, (e) => {
1694
1703
  this.config.messagesClass.length && e.classList.add(...this.config.messagesClass);
1695
1704
  }), this.config.messagesClass.length && i.classList.add(...this.config.messagesClass), i.innerHTML = "";
1696
1705
  let a = r.getAttribute("data-formie-field-handle") || "field";
1697
1706
  i.id = i.id || `${e.id || `${this.form.id}-${a}`}-errors`;
1698
1707
  let s = `${i.id}-1`;
1699
- Fe(i, Ne(this.config.errorAriaLive, this.submitted));
1708
+ Ie(i, Pe(this.config.errorAriaLive, this.submitted));
1700
1709
  let c = document.createElement("div");
1701
1710
  c.setAttribute("data-formie-field-error", "true"), c.setAttribute(`data-formie-field-error-${t}`, "true"), c.setAttribute("id", s), this.config.messageClass.length && c.classList.add(...this.config.messageClass), c.textContent = n, i.appendChild(c), r.setAttribute("data-formie-field-has-error", "true"), r.querySelectorAll("input, select, textarea").forEach((e) => {
1702
1711
  let t = e;
1703
- k(t) || (t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), M(t, s));
1712
+ j(t) || (t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), P(t, s));
1704
1713
  });
1705
1714
  for (let e = r; 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");
1706
1715
  this.emitEvent(e, o("show-error"), {
1707
1716
  validator: this,
1708
1717
  validatorName: t,
1709
1718
  errorMessage: n
1710
- }), C(this.form);
1719
+ }), h(this.form);
1711
1720
  }
1712
1721
  getValidatorCallbackOptions(e) {
1713
1722
  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"));
1714
1723
  return {
1715
- t: ce,
1724
+ t: le,
1716
1725
  input: e,
1717
1726
  label: n,
1718
1727
  field: t,
@@ -1723,7 +1732,7 @@ var pn = class {
1723
1732
  };
1724
1733
  }
1725
1734
  getErrorMessage(e, t, n, r) {
1726
- return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? ce("{label} is invalid.", { label: r.label });
1735
+ return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? le("{label} is invalid.", { label: r.label });
1727
1736
  }
1728
1737
  getErrors() {
1729
1738
  return this.errors;
@@ -1746,7 +1755,7 @@ var pn = class {
1746
1755
  try {
1747
1756
  n = JSON.parse(e);
1748
1757
  } catch {
1749
- return H.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
1758
+ return U.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
1750
1759
  }
1751
1760
  return Array.isArray(n) && n.forEach((e) => {
1752
1761
  if (!e || typeof e != "object" || Array.isArray(e)) return;
@@ -1755,45 +1764,39 @@ var pn = class {
1755
1764
  }), t;
1756
1765
  }
1757
1766
  destroy() {
1758
- H.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, o("destroy"), { validator: this });
1767
+ U.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, o("destroy"), { validator: this });
1759
1768
  }
1760
1769
  isVisible(e, t = {}) {
1761
1770
  if (e.disabled || e.hasAttribute("data-formie-conditions-disabled") || e.closest("[data-formie-conditions-disabled]") || e.closest("[data-formie-conditionally-hidden]")) return !1;
1762
1771
  if (e.closest("[data-formie-page-hidden]")) return !!t.includeHiddenPages;
1763
- let n = e.closest("[data-formie-field-handle]")?.querySelector("[data-formie-rich-text]");
1764
- if (n instanceof HTMLElement) return fn(n);
1772
+ let n = e.closest("[data-formie-field-handle]"), r = n?.querySelector("[data-formie-rich-text]");
1773
+ if (r instanceof HTMLElement) return G(r);
1765
1774
  if (e instanceof HTMLSelectElement && e.hasAttribute("data-formie-combobox-input")) {
1766
1775
  let t = e.nextElementSibling;
1767
- if (t instanceof HTMLElement && t.classList.contains("formie-combobox")) return fn(t);
1776
+ if (t instanceof HTMLElement && t.classList.contains("formie-combobox")) return G(t);
1768
1777
  }
1769
- return fn(e);
1778
+ return e instanceof HTMLSelectElement && n instanceof HTMLElement ? G(e) || G(n) : G(e);
1770
1779
  }
1771
1780
  blurHandler(e) {
1772
- e.target instanceof HTMLElement && U(e.target) && !k(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)));
1781
+ e.target instanceof HTMLElement && W(e.target) && !j(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)));
1773
1782
  }
1774
1783
  changeHandler(e) {
1775
- if (e.target instanceof HTMLElement && U(e.target) && !k(e.target) && e.target.form?.isSameNode(this.form) && !(e instanceof CustomEvent)) {
1776
- if (e.target instanceof HTMLSelectElement) {
1777
- this.activated.add(e.target), this.validate(e.target);
1778
- return;
1779
- }
1780
- e.target instanceof HTMLInputElement && (e.target.type === "file" || e.target.type === "checkbox" || e.target.type === "radio") && (this.activated.add(e.target), this.validate(e.target));
1781
- }
1784
+ e.target instanceof HTMLElement && W(e.target) && !j(e.target) && e.target.form?.isSameNode(this.form) && (e instanceof CustomEvent || (e.target instanceof HTMLSelectElement || e.target instanceof HTMLInputElement && (e.target.type === "file" || e.target.type === "checkbox" || e.target.type === "radio")) && (this.activated.add(e.target), this.validate(e.target)));
1782
1785
  }
1783
1786
  inputHandler(e) {
1784
- e.target instanceof HTMLElement && U(e.target) && !k(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));
1787
+ e.target instanceof HTMLElement && W(e.target) && !j(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));
1785
1788
  }
1786
1789
  submit(e = null, { final: t = !1 } = {}) {
1787
- return this.submitted = !0, H.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
1790
+ return this.submitted = !0, U.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
1788
1791
  }
1789
1792
  resetLiveState() {
1790
1793
  this.submitted = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.errors = [], this.removeAllErrors();
1791
1794
  }
1792
1795
  addEventListeners() {
1793
- 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, H.log("Event listeners attached."));
1796
+ 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, U.log("Event listeners attached."));
1794
1797
  }
1795
1798
  removeEventListeners() {
1796
- this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, H.log("Event listeners removed.");
1799
+ this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, U.log("Event listeners removed.");
1797
1800
  }
1798
1801
  emitEvent(e, t, n = {}) {
1799
1802
  e.dispatchEvent(new CustomEvent(t, {
@@ -1813,25 +1816,25 @@ var pn = class {
1813
1816
  };
1814
1817
  //#endregion
1815
1818
  //#region src/js/validation/enter-key-guard.ts
1816
- function mn(e) {
1819
+ function hn(e) {
1817
1820
  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]");
1818
1821
  }
1819
- function hn(e, t) {
1822
+ function gn(e, t) {
1820
1823
  let n = e.querySelectorAll(`[data-formie-action="${t}"]`);
1821
- return Array.from(n).some((e) => !mn(e));
1822
- }
1823
- function gn(e) {
1824
- let { final: t } = g(e);
1825
- return "submit";
1824
+ return Array.from(n).some((e) => !hn(e));
1826
1825
  }
1827
1826
  function _n(e) {
1828
- return !hn(e, gn(e));
1827
+ let { final: t } = m(e);
1828
+ return "submit";
1829
1829
  }
1830
1830
  function vn(e) {
1831
+ return !gn(e, _n(e));
1832
+ }
1833
+ function yn(e) {
1831
1834
  let t = (t) => {
1832
1835
  if (t.key !== "Enter" || t.defaultPrevented) return;
1833
1836
  let n = t.target;
1834
- (n instanceof HTMLInputElement || n instanceof HTMLSelectElement) && (n instanceof HTMLInputElement && (n.type === "button" || n.type === "submit" || n.type === "reset" || n.type === "file") || _n(e) && t.preventDefault());
1837
+ (n instanceof HTMLInputElement || n instanceof HTMLSelectElement) && (n instanceof HTMLInputElement && (n.type === "button" || n.type === "submit" || n.type === "reset" || n.type === "file") || vn(e) && t.preventDefault());
1835
1838
  };
1836
1839
  return e.addEventListener("keydown", t, !0), () => {
1837
1840
  e.removeEventListener("keydown", t, !0);
@@ -1839,16 +1842,16 @@ function vn(e) {
1839
1842
  }
1840
1843
  //#endregion
1841
1844
  //#region src/js/core/create-formie-client.ts
1842
- var W = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", yn = 300, bn = "/actions/formie/server/forms/render", xn = "/api", Sn = "/actions/formie/server/forms/refresh-tokens", Cn = "/actions/formie/server/submissions/submit", wn = "/actions/formie/server/submissions/set-page", Tn = "/actions/formie/server/submissions/clear-submission", En = "/actions/formie/file-upload/hydrate", G = E("general", "client"), Dn = /* @__PURE__ */ new Set();
1843
- function K(e, t) {
1845
+ var K = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", bn = 300, xn = "/actions/formie/server/forms/render", Sn = "/api", Cn = "/actions/formie/server/forms/refresh-tokens", wn = "/actions/formie/server/submissions/submit", Tn = "/actions/formie/server/submissions/set-page", En = "/actions/formie/server/submissions/clear-submission", Dn = "/actions/formie/file-upload/hydrate", q = O("general", "client"), On = /* @__PURE__ */ new Set();
1846
+ function J(e, t) {
1844
1847
  if (e == null || e === "") return t;
1845
1848
  let n = e.toLowerCase();
1846
1849
  return n !== "false" && n !== "0" && n !== "off";
1847
1850
  }
1848
- function On(e) {
1849
- return e.formieRefreshTokens == null ? e.formieStaticCache != null && K(e.formieStaticCache, !0) : K(e.formieRefreshTokens, !0);
1851
+ function kn(e) {
1852
+ return e.formieRefreshTokens == null ? e.formieStaticCache != null && J(e.formieStaticCache, !0) : J(e.formieRefreshTokens, !0);
1850
1853
  }
1851
- function q(e) {
1854
+ function Y(e) {
1852
1855
  let t = e instanceof HTMLElement ? e.dataset : {};
1853
1856
  return {
1854
1857
  mode: "server-rendered",
@@ -1856,25 +1859,25 @@ function q(e) {
1856
1859
  profile: t.formieRequestProfile,
1857
1860
  formHandle: t.formieHandle,
1858
1861
  endpoint: t.formieEndpoint,
1859
- staticCache: On(t),
1860
- autoVisible: K(t.formieAutoVisible, !0),
1861
- compatibility: K(t.formieCompatibility, !1)
1862
+ staticCache: kn(t),
1863
+ autoVisible: J(t.formieAutoVisible, !0),
1864
+ compatibility: J(t.formieCompatibility, !1)
1862
1865
  };
1863
1866
  }
1864
- function kn(e) {
1867
+ function An(e) {
1865
1868
  if (e && e !== "server-rendered") throw Error("@verbb/formie-browser enhances server-rendered HTML only. Use @verbb/formie-core for client-rendered forms.");
1866
1869
  return "server-rendered";
1867
1870
  }
1868
- function An(e) {
1871
+ function jn(e) {
1869
1872
  return e || "rest";
1870
1873
  }
1871
- function jn(e) {
1874
+ function Mn(e) {
1872
1875
  return e instanceof HTMLFormElement ? e : e.querySelector("form");
1873
1876
  }
1874
- function Mn(e, t) {
1875
- Dn.has(e) || (Dn.add(e), G.warn(t));
1876
- }
1877
1877
  function Nn(e, t) {
1878
+ On.has(e) || (On.add(e), q.warn(t));
1879
+ }
1880
+ function Pn(e, t) {
1878
1881
  if (!e) return e;
1879
1882
  try {
1880
1883
  return new URL(e).toString();
@@ -1886,21 +1889,21 @@ function Nn(e, t) {
1886
1889
  return e;
1887
1890
  }
1888
1891
  }
1889
- function J(e, t) {
1892
+ function X(e, t) {
1890
1893
  let n = (e || "").trim();
1891
- return n ? n.includes(t) ? n : Nn(t, n) : t;
1892
- }
1893
- function Pn(e, t) {
1894
- return J(e.endpoint || t.dataset.formieEndpoint, bn);
1894
+ return n ? n.includes(t) ? n : Pn(t, n) : t;
1895
1895
  }
1896
1896
  function Fn(e, t) {
1897
- let n = (e.endpoint || t.dataset.formieEndpoint || "").trim();
1898
- return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : Nn(xn, n) : xn;
1897
+ return X(e.endpoint || t.dataset.formieEndpoint, xn);
1899
1898
  }
1900
1899
  function In(e, t) {
1901
- return J(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, Sn);
1900
+ let n = (e.endpoint || t.dataset.formieEndpoint || "").trim();
1901
+ return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : Pn(Sn, n) : Sn;
1902
1902
  }
1903
1903
  function Ln(e, t) {
1904
+ return X(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, Cn);
1905
+ }
1906
+ function Rn(e, t) {
1904
1907
  if (!e) return t;
1905
1908
  try {
1906
1909
  let n = new URL(e, window.location.origin), r = new URL(t, window.location.origin);
@@ -1911,39 +1914,39 @@ function Ln(e, t) {
1911
1914
  return t;
1912
1915
  }
1913
1916
  }
1914
- function Rn(e, t, n) {
1915
- let r = n.endpoint || e.dataset.formieEndpoint, i = J(r, Cn), a = t.getAttribute("action");
1916
- t.setAttribute("action", Ln(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1917
- let t = e.getAttribute("href"), n = J(r, wn);
1918
- e.setAttribute("href", Ln(t, n));
1917
+ function zn(e, t, n) {
1918
+ let r = n.endpoint || e.dataset.formieEndpoint, i = X(r, wn), a = t.getAttribute("action");
1919
+ t.setAttribute("action", Rn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
1920
+ let t = e.getAttribute("href"), n = X(r, Tn);
1921
+ e.setAttribute("href", Rn(t, n));
1919
1922
  }), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((e) => {
1920
- e.setAttribute("data-formie-file-upload-hydrate-endpoint", J(r, En));
1923
+ e.setAttribute("data-formie-file-upload-hydrate-endpoint", X(r, Dn));
1921
1924
  });
1922
1925
  }
1923
- function zn(e) {
1926
+ function Bn(e) {
1924
1927
  if (e == null) return !1;
1925
1928
  let t = e.trim().toLowerCase();
1926
1929
  return t === "true" || t === "1" || t === "";
1927
1930
  }
1928
- function Bn(e) {
1929
- return K(e.dataset.formieAutomaticSubmissionState, !0);
1931
+ function Vn(e) {
1932
+ return J(e.dataset.formieAutomaticSubmissionState, !0);
1930
1933
  }
1931
- function Vn(e, t, n) {
1932
- return J(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, Tn);
1934
+ function Hn(e, t, n) {
1935
+ return X(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, En);
1933
1936
  }
1934
- function Hn(e) {
1935
- return zn(e.dataset.formieUnloadWarning);
1937
+ function Un(e) {
1938
+ return Bn(e.dataset.formieUnloadWarning);
1936
1939
  }
1937
- function Un(e, t) {
1940
+ function Wn(e, t) {
1938
1941
  e.setAttribute("data-formie-internal-navigation", t);
1939
1942
  }
1940
- function Y(e) {
1943
+ function Gn(e) {
1941
1944
  e.removeAttribute("data-formie-internal-navigation");
1942
1945
  }
1943
- function Wn(e) {
1946
+ function Kn(e) {
1944
1947
  return e.getAttribute("data-formie-internal-navigation") !== null;
1945
1948
  }
1946
- function Gn(e, t) {
1949
+ function qn(e, t) {
1947
1950
  if (!e) return !1;
1948
1951
  try {
1949
1952
  return new URL(e, window.location.origin).searchParams.has(t);
@@ -1951,30 +1954,30 @@ function Gn(e, t) {
1951
1954
  return !1;
1952
1955
  }
1953
1956
  }
1954
- function Kn(e) {
1955
- return Gn(window.location.href, "resumeToken") || Gn(e.getAttribute("action"), "resumeToken");
1957
+ function Jn(e) {
1958
+ return qn(window.location.href, "resumeToken") || qn(e.getAttribute("action"), "resumeToken");
1956
1959
  }
1957
- function qn(e) {
1960
+ function Yn(e) {
1958
1961
  return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
1959
1962
  }
1960
- function Jn(e, t = 0) {
1963
+ function Xn(e, t = 0) {
1961
1964
  if (!e) return t;
1962
1965
  let n = Number.parseInt(e, 10);
1963
1966
  return Number.isFinite(n) ? n : t;
1964
1967
  }
1965
- function Yn(e) {
1966
- return Math.max(0, Jn(e.dataset.formieSubmitDelay, yn));
1968
+ function Zn(e) {
1969
+ return Math.max(0, Xn(e.dataset.formieSubmitDelay, bn));
1967
1970
  }
1968
- function X(e) {
1969
- return zn(e.dataset.formieValidationOnSubmit);
1971
+ function Z(e) {
1972
+ return Bn(e.dataset.formieValidationOnSubmit);
1970
1973
  }
1971
- async function Xn(e) {
1972
- let t = Yn(e);
1973
- t < 1 || await new Promise((e) => {
1974
+ async function Qn(e) {
1975
+ let t = Zn(e);
1976
+ await new Promise((e) => {
1974
1977
  window.setTimeout(e, t);
1975
1978
  });
1976
1979
  }
1977
- function Zn(e, t) {
1980
+ function $n(e, t) {
1978
1981
  let n = e?.getAttribute(t)?.trim();
1979
1982
  if (!n) return null;
1980
1983
  try {
@@ -1984,29 +1987,29 @@ function Zn(e, t) {
1984
1987
  return console.error(`[formie] Failed to parse ${t}.`, e), null;
1985
1988
  }
1986
1989
  }
1987
- function Qn(e, t) {
1990
+ function er(e, t) {
1988
1991
  let n = t || (e instanceof HTMLFormElement ? e : null);
1989
1992
  if (!n) return null;
1990
- let r = Zn(n, "data-formie-modules"), i = Zn(n, "data-formie-theme-classes") || Zn(n, "data-formie-theme");
1993
+ let r = $n(n, "data-formie-modules"), i = $n(n, "data-formie-theme-classes") || $n(n, "data-formie-theme");
1991
1994
  return !r && !i ? null : {
1992
1995
  modules: r || void 0,
1993
1996
  theme: i || void 0
1994
1997
  };
1995
1998
  }
1996
- function $n(e) {
1999
+ function tr(e) {
1997
2000
  if (!(e instanceof HTMLElement)) return !0;
1998
2001
  if (!e.isConnected || e.hidden || e.closest("[hidden]")) return !1;
1999
2002
  let t = window.getComputedStyle(e);
2000
2003
  return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
2001
2004
  }
2002
- function er(e, t) {
2005
+ function nr(e, t) {
2003
2006
  return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
2004
2007
  }
2005
- function Z(e) {
2008
+ function Q(e) {
2006
2009
  let t = e, n = t.id ? `#${t.id}` : "", r = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
2007
2010
  return `${t.tagName ? t.tagName.toLowerCase() : "element"}${n}${r}`;
2008
2011
  }
2009
- function tr(e, t) {
2012
+ function rr(e, t) {
2010
2013
  if (t) {
2011
2014
  if (t.csrf?.param && t.csrf?.token) {
2012
2015
  let n = e.querySelector(`input[name="${t.csrf.param}"]`);
@@ -2033,11 +2036,11 @@ function tr(e, t) {
2033
2036
  });
2034
2037
  }
2035
2038
  }
2036
- async function nr(e, t) {
2037
- let n = kn(t.mode), r = An(t.transport);
2039
+ async function ir(e, t) {
2040
+ let n = An(t.mode), r = jn(t.transport);
2038
2041
  if (n !== "server-rendered") return null;
2039
2042
  if (t.payload) return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
2040
- let i = !!jn(e), a = t.formHandle || e.dataset.formieHandle;
2043
+ let i = !!Mn(e), a = t.formHandle || e.dataset.formieHandle;
2041
2044
  if (i || !a) return null;
2042
2045
  let o = {
2043
2046
  mode: n,
@@ -2046,33 +2049,26 @@ async function nr(e, t) {
2046
2049
  siteId: t.siteId,
2047
2050
  theme: t.theme,
2048
2051
  themeConfig: t.themeConfig
2049
- }, s = r === "graphql" ? Fn(t, e) : Pn(t, e), c = r === "graphql" ? await Je(s, a, o, t) : await qe(s, a, {
2052
+ }, s = r === "graphql" ? In(t, e) : Fn(t, e), c = r === "graphql" ? await Ye(s, a, o, t) : await Je(s, a, {
2050
2053
  ...o,
2051
2054
  endpoint: s
2052
2055
  }, t);
2053
2056
  return c?.html && (e.innerHTML = c.html), c;
2054
2057
  }
2055
- async function rr(e, t, n) {
2058
+ async function ar(e, t, n) {
2056
2059
  if (t.refreshTokens === !1) return;
2057
2060
  let r = t.formHandle || e.dataset.formieHandle;
2058
2061
  if (!r) return;
2059
- let i = await P(In(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2060
- tr(n, i), y(e, "formie:refresh-tokens:refreshed", i);
2062
+ let i = await Xe(Ln(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2063
+ rr(n, i), g(e, "formie:refresh-tokens:refreshed", i);
2061
2064
  }
2062
- function ir(e, t, n, r, i, a) {
2063
- let o = () => {};
2065
+ function or(e, t, n, r, i, a) {
2064
2066
  t.dataset.formieRequestProfile = n.profile ?? "same-origin-browser", n.profile === "cross-origin-public" && (t.dataset.formieSubmitMethod = "ajax");
2065
- let s = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), c = Vn(n, e, t), l = !1, u = t.querySelectorAll("[data-formie-action]"), d = (e) => {
2066
- if (e) {
2067
- t.setAttribute("data-formie-pending-action", e);
2068
- return;
2069
- }
2070
- t.removeAttribute("data-formie-pending-action");
2067
+ let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = Hn(n, e, t), c = !1, l = t.querySelectorAll("[data-formie-action]"), u = (e) => {
2068
+ e ? t.setAttribute("data-formie-pending-action", e) : t.removeAttribute("data-formie-pending-action");
2071
2069
  };
2072
- if (Hn(t)) {
2073
- let n = on(t, { shouldWarn: () => !Wn(t) });
2074
- o = n.scheduleBaselineCapture;
2075
- let r = (e) => {
2070
+ if (Un(t)) {
2071
+ let n = cn(t, { shouldWarn: () => !Kn(t) }), r = (e) => {
2076
2072
  if (!(e instanceof CustomEvent)) return;
2077
2073
  let t = e.detail;
2078
2074
  t?.ok && (t.action === "save" || t.outcome === "revised") && n.scheduleBaselineCapture();
@@ -2083,41 +2079,41 @@ function ir(e, t, n, r, i, a) {
2083
2079
  e.removeEventListener("formie:submit:result", r), t.removeEventListener("formie:state:reset", i), n.destroy();
2084
2080
  });
2085
2081
  }
2086
- if (u.forEach((e) => {
2082
+ if (l.forEach((e) => {
2087
2083
  let n = (e) => {
2088
2084
  let n = e.currentTarget.getAttribute("data-formie-action"), r = t.querySelector("input[name=\"submitAction\"]");
2089
- d(n), n && r && (r.value = n);
2085
+ u(n), n && r && (r.value = n);
2090
2086
  };
2091
2087
  e.addEventListener("click", n), a.push(() => {
2092
2088
  e.removeEventListener("click", n);
2093
2089
  });
2094
2090
  }), t.querySelectorAll("[data-formie-tab-link]").forEach((n) => {
2095
2091
  let r = async (n) => {
2096
- if (s !== "ajax") {
2097
- qn(n) && Un(t, "set-page");
2092
+ if (o !== "ajax") {
2093
+ Yn(n) && Wn(t, "set-page");
2098
2094
  return;
2099
2095
  }
2100
2096
  n.preventDefault();
2101
2097
  let r = n.currentTarget, i = r?.getAttribute("data-formie-page-id"), a = r?.getAttribute("href");
2102
2098
  if (i && a) {
2103
- y(e, "formie:page:navigate", {
2099
+ g(e, "formie:page:navigate", {
2104
2100
  pageId: i,
2105
2101
  href: a
2106
2102
  });
2107
2103
  try {
2108
- let n = await Ye(a, t, i);
2109
- if (n.pageId && _(t, String(n.pageId)), !n.success) {
2104
+ let n = await Ze(a, t, i);
2105
+ if (n.pageId && S(t, String(n.pageId)), !n.success) {
2110
2106
  let { form: e = [], ...r } = n.errors ?? {};
2111
- Lt(t), Ot(t, r), kt(t, e), We(t);
2107
+ Vt(t), Mt(t, r), Nt(t, e), F(t);
2112
2108
  return;
2113
2109
  }
2114
- y(e, "formie:page:navigate:after", {
2110
+ g(e, "formie:page:navigate:after", {
2115
2111
  pageId: i,
2116
2112
  href: a,
2117
2113
  response: n
2118
2114
  });
2119
2115
  } catch (t) {
2120
- console.error("[formie] Failed to persist page navigation state.", t), y(e, "formie:page:navigate:error", {
2116
+ console.error("[formie] Failed to persist page navigation state.", t), g(e, "formie:page:navigate:error", {
2121
2117
  pageId: i,
2122
2118
  href: a,
2123
2119
  error: t
@@ -2128,49 +2124,49 @@ function ir(e, t, n, r, i, a) {
2128
2124
  n.addEventListener("click", r), a.push(() => {
2129
2125
  n.removeEventListener("click", r);
2130
2126
  });
2131
- }), !Bn(t)) {
2127
+ }), !Vn(t)) {
2132
2128
  let e = !1, n = () => {
2133
- e || Wn(t) || Kn(t) || (e = !0, Xe(c, t));
2129
+ e || Kn(t) || Jn(t) || (e = !0, Qe(s, t));
2134
2130
  };
2135
2131
  window.addEventListener("pagehide", n), window.addEventListener("beforeunload", n), a.push(() => {
2136
2132
  window.removeEventListener("pagehide", n), window.removeEventListener("beforeunload", n);
2137
2133
  });
2138
2134
  }
2139
- let f = async (a) => {
2140
- if (l) return;
2141
- let o = s === "ajax";
2135
+ let d = async (a) => {
2136
+ if (c) return;
2137
+ let s = o === "ajax";
2142
2138
  if (a.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
2143
2139
  if (t.getAttribute("data-formie-internal-resubmit") !== "true") return;
2144
2140
  t.removeAttribute("data-formie-internal-resubmit");
2145
2141
  } else t.removeAttribute("data-formie-internal-resubmit");
2146
- let c = a.submitter, u = c?.getAttribute("data-formie-action"), f = t.getAttribute("data-formie-pending-action"), m = t.querySelector("input[name=\"submitAction\"]"), _ = u || f || m?.value || "submit", b = null, x = !1;
2142
+ let l = a.submitter, d = l?.getAttribute("data-formie-action"), p = t.getAttribute("data-formie-pending-action"), h = t.querySelector("input[name=\"submitAction\"]"), _ = d || p || h?.value || "submit", v = null, y = !1;
2147
2143
  try {
2148
- if (o) b = await Rt({
2144
+ if (s) v = await Ht({
2149
2145
  target: e,
2150
2146
  form: t,
2151
2147
  bus: r,
2152
2148
  validator: i,
2153
- validateOnSubmit: X(t),
2149
+ validateOnSubmit: Z(t),
2154
2150
  action: _,
2155
- submitter: c,
2156
- waitForSubmitDelay: Xn,
2151
+ submitter: l,
2152
+ waitForSubmitDelay: Qn,
2157
2153
  onRefreshTokensAfterSubmit: async () => {
2158
- await rr(e, n, t);
2154
+ await ar(e, n, t);
2159
2155
  },
2160
2156
  dispatchSubmitResult: (t) => {
2161
- y(e, "formie:submit:result", t);
2157
+ g(e, "formie:submit:result", t);
2162
2158
  }
2163
2159
  });
2164
2160
  else {
2165
- if (Lt(t), v(t, c), await Xn(t), b = await ct(t, _, r, {
2161
+ if (Vt(t), C(t, l), await Qn(t), v = await dt(t, _, r, {
2166
2162
  validator: i,
2167
- validateOnSubmit: X(t),
2163
+ validateOnSubmit: Z(t),
2168
2164
  preflightOnly: !0
2169
- }), b.ok) {
2170
- p(t, _), l = !0, Un(t, "submit"), d(null);
2165
+ }), v.ok) {
2166
+ x(t, _), c = !0, Wn(t, "submit"), u(null);
2171
2167
  let e = !1, n = () => {
2172
- if (e = !0, l = !1, Y(t), h(t), i && X(t)) {
2173
- let { scope: e, final: n } = g(t), r = i.submit(n ? t : e, { final: n });
2168
+ if (e = !0, c = !1, Gn(t), f(t), i && Z(t)) {
2169
+ let { scope: e, final: n } = m(t), r = i.submit(n ? t : e, { final: n });
2174
2170
  r.length > 0 && z(t, {
2175
2171
  ok: !1,
2176
2172
  stage: "validate",
@@ -2190,34 +2186,34 @@ function ir(e, t, n, r, i, a) {
2190
2186
  }
2191
2187
  } else t.submit();
2192
2188
  if (e) return;
2193
- x = !0;
2189
+ y = !0;
2194
2190
  return;
2195
2191
  }
2196
- z(t, b), y(e, "formie:submit:result", b), Y(t);
2192
+ z(t, v), g(e, "formie:submit:result", v), Gn(t);
2197
2193
  }
2198
2194
  } catch (n) {
2199
- l = !1, b = {
2195
+ c = !1, v = {
2200
2196
  ok: !1,
2201
2197
  code: "SUBMIT_ERROR",
2202
2198
  message: n instanceof Error ? n.message : "Submission failed.",
2203
2199
  formErrors: [n instanceof Error ? n.message : "Submission failed."]
2204
- }, z(t, b), y(e, "formie:submit:result", b), Y(t);
2200
+ }, z(t, v), g(e, "formie:submit:result", v), Gn(t);
2205
2201
  } finally {
2206
- d(null), !o && !x && !It(b) && h(t);
2202
+ u(null), !s && !y && !Bt(v) && f(t);
2207
2203
  }
2208
2204
  };
2209
- return t.addEventListener("submit", f), a.push(() => {
2210
- t.removeEventListener("submit", f);
2211
- }), o;
2205
+ t.addEventListener("submit", d), a.push(() => {
2206
+ t.removeEventListener("submit", d);
2207
+ });
2212
2208
  }
2213
- async function ar(e, t, n) {
2209
+ async function sr(e, t, n) {
2214
2210
  if (t.refreshTokens === !1 || !t.staticCache) return;
2215
- let r = t.formHandle || e.dataset.formieHandle, i = In(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
2211
+ let r = t.formHandle || e.dataset.formieHandle, i = Ln(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
2216
2212
  if (!r) return;
2217
- let o = await P(i, r, a, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2218
- o && n && (tr(n, o), y(e, "formie:refresh-tokens:after", o));
2213
+ let o = await Xe(i, r, a, t, n?.querySelector("input[name=\"requestToken\"]")?.value);
2214
+ o && n && (rr(n, o), g(e, "formie:refresh-tokens:after", o));
2219
2215
  }
2220
- function or() {
2216
+ function cr() {
2221
2217
  let t = /* @__PURE__ */ new Map(), r = new B(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = [
2222
2218
  "prepare",
2223
2219
  "normalize",
@@ -2233,161 +2229,157 @@ function or() {
2233
2229
  return;
2234
2230
  }
2235
2231
  let r = (async () => {
2236
- G.log("Unmount requested.", { target: Z(e) });
2232
+ q.log("Unmount requested.", { target: Q(e) });
2237
2233
  let n = i.get(e);
2238
2234
  n && (n(), i.delete(e));
2239
2235
  let r = t.get(e);
2240
- if (!r) {
2241
- G.log("Unmount skipped (no mounted state).", { target: Z(e) });
2242
- return;
2243
- }
2244
- y(e, "formie:unmount:before", { id: r.instance.id }), r.unbinds.forEach((e) => {
2236
+ r ? (g(e, "formie:unmount:before", { id: r.instance.id }), r.unbinds.forEach((e) => {
2245
2237
  e();
2246
- }), r.unbinds = [], r.validator?.destroy(), r.validator = null, await r.modules.destroy(), r.bus.clear(), t.delete(e), y(e, "formie:unmount:after", { id: r.instance.id }), G.log("Unmount complete.", {
2238
+ }), r.unbinds = [], r.validator?.destroy(), r.validator = null, await r.modules.destroy(), r.bus.clear(), t.delete(e), g(e, "formie:unmount:after", { id: r.instance.id }), r.unbindEventContext(), q.log("Unmount complete.", {
2247
2239
  id: r.instance.id,
2248
- target: Z(e)
2249
- });
2240
+ target: Q(e)
2241
+ })) : q.log("Unmount skipped (no mounted state).", { target: Q(e) });
2250
2242
  })().finally(() => {
2251
2243
  a.delete(e);
2252
2244
  });
2253
2245
  a.set(e, r), await r;
2254
2246
  }, c = async (a, c) => {
2255
- G.log("Mount requested.", {
2256
- target: Z(a),
2247
+ q.log("Mount requested.", {
2248
+ target: Q(a),
2257
2249
  mode: c.mode,
2258
2250
  autoVisible: c.autoVisible
2259
2251
  });
2260
2252
  let l = i.get(a);
2261
2253
  l && (l(), i.delete(a));
2262
2254
  let u = t.get(a);
2263
- if (u) return G.log("Mount skipped (already mounted).", {
2255
+ if (u) return q.log("Mount skipped (already mounted).", {
2264
2256
  id: u.instance.id,
2265
- target: Z(a)
2257
+ target: Q(a)
2266
2258
  }), u.instance;
2267
- let d = new zt(), f = [], p = a?.id || `formie-${t.size + 1}`, h = q(a), g = {
2268
- ...h,
2259
+ let d = new Ut(), f = [], m = a?.id || `formie-${t.size + 1}`, v = Y(a), b = {
2260
+ ...v,
2269
2261
  ...c,
2270
- mode: kn(c.mode ?? h.mode),
2271
- transport: An(c.transport ?? h.transport)
2272
- }, _ = await nr(a, g), v = jn(a);
2273
- c.compatibility === void 0 && v?.hasAttribute("data-formie-compatibility") && (g.compatibility = q(v).compatibility);
2274
- let b = we(g.compatibility);
2275
- v && e(v, g), g.staticCache = c.staticCache ?? On(v ? v.dataset : a.dataset);
2276
- let S;
2262
+ mode: An(c.mode ?? v.mode),
2263
+ transport: jn(c.transport ?? v.transport)
2264
+ }, x = await ir(a, b), S = Mn(a);
2265
+ c.compatibility === void 0 && S?.hasAttribute("data-formie-compatibility") && (b.compatibility = Y(S).compatibility);
2266
+ let C = Te(b.compatibility);
2267
+ S && e(S, b), b.staticCache = c.staticCache ?? kn(S ? S.dataset : a.dataset);
2268
+ let w;
2277
2269
  try {
2278
- S = Qn(a, v), _?.modules && n(_.modules), S?.modules && n(S.modules);
2270
+ w = er(a, S), x?.modules && n(x.modules), w?.modules && n(w.modules);
2279
2271
  } catch (e) {
2280
- if (v) {
2281
- v.addEventListener("submit", (e) => {
2272
+ if (S) {
2273
+ S.addEventListener("submit", (e) => {
2282
2274
  e.preventDefault(), e.stopImmediatePropagation();
2283
2275
  }, !0);
2284
2276
  let e = document.createElement("div");
2285
- e.setAttribute("role", "alert"), e.textContent = "This form requires a compatible Formie browser package. Update Formie and its browser packages together.", v.prepend(e);
2277
+ e.setAttribute("role", "alert"), e.textContent = "This form requires a compatible Formie browser package. Update Formie and its browser packages together.", S.prepend(e);
2286
2278
  }
2287
2279
  throw e;
2288
2280
  }
2289
- let ee = _ || S ? {
2290
- ..._ || {},
2291
- ...S || {}
2292
- } : null, te = ee?.theme, w = {}, T = ee?.modules ?? {
2281
+ let T = x || w ? {
2282
+ ...x || {},
2283
+ ...w || {}
2284
+ } : null, te = T?.theme, ne = {}, E = T?.modules ?? {
2293
2285
  contractVersion: 2,
2294
2286
  surface: "server-rendered",
2295
2287
  entries: []
2296
2288
  };
2297
- n(T), G.log("Resolved mount payload.", {
2298
- target: Z(a),
2299
- hasRenderPayload: !!_,
2300
- hasEmbeddedPayload: !!S,
2301
- moduleCount: T.entries.length
2289
+ n(E), q.log("Resolved mount payload.", {
2290
+ target: Q(a),
2291
+ hasRenderPayload: !!x,
2292
+ hasEmbeddedPayload: !!w,
2293
+ moduleCount: E.entries.length
2302
2294
  });
2303
- let E = ne(a, te, v), D = v ? new pn(v, {
2304
- live: zn(v.dataset.formieValidationOnFocus),
2305
- errorAriaLive: Me(v),
2306
- errorMessage: v.dataset.formieErrorMessage || "",
2307
- fieldContainerErrorClass: E.fieldLayoutError || [],
2308
- inputErrorClass: E.fieldControlError || [],
2309
- messagesClass: E.fieldErrors || [],
2310
- messageClass: E.fieldError || []
2295
+ let D = re(a, te, S), O = S ? new mn(S, {
2296
+ live: Bn(S.dataset.formieValidationOnFocus),
2297
+ errorAriaLive: Ne(S),
2298
+ errorMessage: S.dataset.formieErrorMessage || "",
2299
+ fieldContainerErrorClass: D.fieldLayoutError || [],
2300
+ inputErrorClass: D.fieldControlError || [],
2301
+ messagesClass: D.fieldErrors || [],
2302
+ messageClass: D.fieldError || []
2311
2303
  }) : null;
2312
- if (v && D) {
2313
- let e = v;
2314
- e.formieValidation = D, w.validation = D;
2304
+ if (S && O) {
2305
+ let e = S;
2306
+ e.formieValidation = O, ne.validation = O;
2315
2307
  let t = {
2316
- validator: D,
2317
- addValidator: D.addValidator.bind(D),
2318
- removeValidator: D.removeValidator.bind(D)
2308
+ validator: O,
2309
+ addValidator: O.addValidator.bind(O),
2310
+ removeValidator: O.removeValidator.bind(O)
2319
2311
  };
2320
- y(v, "formie:validator:ready", t), y(a, "formie:validator:ready", t);
2312
+ g(S, "formie:validator:ready", t), g(a, "formie:validator:ready", t);
2321
2313
  }
2322
- v && ($t(v), (_ || g.endpoint || a.dataset.formieEndpoint) && Rn(a, v, g), g.mode === "server-rendered" && Ue(v) && (He(v), We(v)), C(v)), Object.keys(E).length && y(a, "formie:theme:applied", { hasClasses: !0 }), v?.querySelector("craft-csrf-input") && await oe("craft-csrf-input", v);
2323
- let O = await Zt(T, {
2314
+ S && (y(S), (x || b.endpoint || a.dataset.formieEndpoint) && zn(a, S, b), b.mode === "server-rendered" && Ge(S) && (We(S), F(S)), h(S)), Object.keys(D).length && g(a, "formie:theme:applied", { hasClasses: !0 }), S?.querySelector("craft-csrf-input") && await se("craft-csrf-input", S);
2315
+ let k = await tn(E, {
2324
2316
  registry: r,
2325
2317
  matchContext: {
2326
2318
  root: a,
2327
- form: v,
2328
- surface: T.surface
2319
+ form: S,
2320
+ surface: E.surface
2329
2321
  },
2330
2322
  setupContext: {
2331
- formId: p,
2323
+ formId: m,
2332
2324
  root: a,
2333
- form: v,
2325
+ form: S,
2334
2326
  target: a,
2335
2327
  scope: "form",
2336
- surface: T.surface,
2337
- state: w,
2328
+ surface: E.surface,
2329
+ state: ne,
2338
2330
  on: (e, t) => d.on(e, t),
2339
- emit: (e, t) => (y(a, e, t), d.emitSafe(e, t).then((t) => {
2340
- t.failed.length > 0 && G.warn("Lifecycle listeners failed.", {
2331
+ emit: (e, t) => (g(a, e, t), d.emitSafe(e, t).then((t) => {
2332
+ t.failed.length > 0 && q.warn("Lifecycle listeners failed.", {
2341
2333
  eventName: e,
2342
2334
  failed: t.failed.length
2343
2335
  });
2344
2336
  }))
2345
2337
  }
2346
2338
  });
2347
- G.log("Module setup complete.", {
2348
- target: Z(a),
2349
- moduleInstances: O.instances.length
2339
+ q.log("Module setup complete.", {
2340
+ target: Q(a),
2341
+ moduleInstances: k.instances.length
2350
2342
  });
2351
- let k = {
2352
- id: p,
2343
+ let A = {
2344
+ id: m,
2353
2345
  root: a,
2354
2346
  submit: async (e = "submit") => {
2355
- if (G.log("Submit requested.", {
2356
- id: p,
2357
- target: Z(a),
2347
+ if (q.log("Submit requested.", {
2348
+ id: m,
2349
+ target: Q(a),
2358
2350
  action: e
2359
- }), !v) return {
2351
+ }), !S) return {
2360
2352
  ok: !1,
2361
2353
  code: "FORM_NOT_FOUND",
2362
2354
  message: "No form element found for mount target.",
2363
2355
  formErrors: ["No form element found for mount target."]
2364
2356
  };
2365
- let t = v.querySelector("input[name=\"submitAction\"]");
2366
- if (t && (t.value = e), v.getAttribute("data-formie-loading") === "true") return {
2357
+ let t = S.querySelector("input[name=\"submitAction\"]");
2358
+ if (t && (t.value = e), S.getAttribute("data-formie-loading") === "true") return {
2367
2359
  ok: !1,
2368
2360
  code: "SUBMIT_IN_PROGRESS",
2369
2361
  message: "Submission already in progress.",
2370
2362
  formErrors: []
2371
2363
  };
2372
- let n = v.querySelector(`[data-formie-action="${e}"]`), r = await Rt({
2373
- id: p,
2364
+ let n = S.querySelector(`[data-formie-action="${e}"]`), r = await Ht({
2365
+ id: m,
2374
2366
  target: a,
2375
- form: v,
2367
+ form: S,
2376
2368
  bus: d,
2377
- validator: D,
2378
- validateOnSubmit: X(v),
2369
+ validator: O,
2370
+ validateOnSubmit: Z(S),
2379
2371
  action: e,
2380
2372
  submitter: n,
2381
- waitForSubmitDelay: Xn,
2373
+ waitForSubmitDelay: Qn,
2382
2374
  onRefreshTokensAfterSubmit: async () => {
2383
- await rr(a, g, v);
2375
+ await ar(a, b, S);
2384
2376
  },
2385
2377
  dispatchSubmitResult: (e) => {
2386
- y(a, "formie:submit:result", e);
2378
+ g(a, "formie:submit:result", e);
2387
2379
  }
2388
2380
  });
2389
- return G.log("Submit completed.", {
2390
- id: p,
2381
+ return q.log("Submit completed.", {
2382
+ id: m,
2391
2383
  action: e,
2392
2384
  ok: r.ok,
2393
2385
  code: r.code,
@@ -2398,32 +2390,34 @@ function or() {
2398
2390
  await s(a);
2399
2391
  },
2400
2392
  on: (e, t) => d.on(e, t)
2401
- };
2402
- if (v && (je({
2393
+ }, j = _(a, S, A);
2394
+ if (S && (Me({
2403
2395
  target: a,
2404
- form: v,
2405
- validatorDetail: D ? {
2406
- validator: D,
2407
- addValidator: D.addValidator.bind(D),
2408
- removeValidator: D.removeValidator.bind(D)
2396
+ form: S,
2397
+ validatorDetail: O ? {
2398
+ validator: O,
2399
+ addValidator: O.addValidator.bind(O),
2400
+ removeValidator: O.removeValidator.bind(O)
2409
2401
  } : null,
2410
- options: b,
2402
+ options: C,
2411
2403
  unbinds: f
2412
- }), ke({
2404
+ }), Ae({
2413
2405
  target: a,
2414
- form: v,
2415
- instance: k,
2416
- options: b,
2406
+ form: S,
2407
+ instance: A,
2408
+ options: C,
2417
2409
  unbinds: f
2418
- })), v) {
2419
- let e = ir(a, v, g, d, D, f);
2420
- D && (f.push(x(v, D, a)), f.push(vn(v))), await ar(a, g, v), e();
2421
- let t = window.setTimeout(e, 350);
2422
- f.push(() => window.clearTimeout(t));
2410
+ })), S) {
2411
+ or(a, S, b, d, O, f), O && (f.push(p(S, O, a)), f.push(yn(S)));
2412
+ try {
2413
+ await sr(a, b, S);
2414
+ } catch (e) {
2415
+ throw j(), e;
2416
+ }
2423
2417
  }
2424
2418
  o.forEach((e) => {
2425
2419
  let t = d.on(`formie:stage:${e}:before`, async (t) => {
2426
- y(a, `formie:stage:${e}:before`, t);
2420
+ g(a, `formie:stage:${e}:before`, t);
2427
2421
  }), n = d.on(`formie:stage:${e}:before`, async (t) => {
2428
2422
  let n = {
2429
2423
  core: "prepare",
@@ -2433,12 +2427,12 @@ function or() {
2433
2427
  payment: "payment"
2434
2428
  }, r = t;
2435
2429
  if (e === "prepare") try {
2436
- O.assertReady();
2430
+ k.assertReady();
2437
2431
  } catch {
2438
2432
  r.abort("A required form feature could not start. Reload the page or contact the site administrator.");
2439
2433
  return;
2440
2434
  }
2441
- for (let t of O.instances) if (t.beforeSubmit && n[t.kind ?? "core"] === e) {
2435
+ for (let t of k.instances) if (t.beforeSubmit && n[t.kind ?? "core"] === e) {
2442
2436
  let { form: e, action: n, formData: i, abort: a, isAborted: o, abortReason: s } = r;
2443
2437
  await t.beforeSubmit({
2444
2438
  form: e,
@@ -2450,56 +2444,58 @@ function or() {
2450
2444
  });
2451
2445
  }
2452
2446
  }), r = d.on(`formie:stage:${e}:after`, async (t) => {
2453
- y(a, `formie:stage:${e}:after`, t);
2447
+ g(a, `formie:stage:${e}:after`, t);
2454
2448
  });
2455
2449
  f.push(t, n, r);
2456
2450
  });
2457
- let re = d.on("formie:submit:before", async (e) => {
2458
- y(a, "formie:submit:before", e);
2459
- }), ie = d.on("formie:submit:after", async (e) => {
2460
- if (y(a, "formie:submit:after", e), !v) return;
2451
+ let ie = d.on("formie:submit:before", async (e) => {
2452
+ g(a, "formie:submit:before", e);
2453
+ }), ae = d.on("formie:submit:after", async (e) => {
2454
+ if (g(a, "formie:submit:after", e), !S) return;
2461
2455
  let t = e;
2462
2456
  if (t.code === "PREFLIGHT_COMPLETE") return;
2463
2457
  let n = {
2464
- form: v,
2458
+ form: S,
2465
2459
  action: t.action ?? "submit",
2466
- formData: new FormData(v)
2460
+ formData: new FormData(S)
2467
2461
  };
2468
- for (let e of O.instances) await e.afterSubmit?.(n, t);
2469
- }), A = d.on("formie:submit:final:before", async (e) => {
2470
- y(a, "formie:submit:final:before", e);
2471
- }), ae = d.on("formie:submit:final:after", async (e) => {
2472
- y(a, "formie:submit:final:after", e);
2462
+ for (let e of k.instances) await e.afterSubmit?.(n, t);
2463
+ }), M = d.on("formie:submit:final:before", async (e) => {
2464
+ g(a, "formie:submit:final:before", e);
2465
+ }), oe = d.on("formie:submit:final:after", async (e) => {
2466
+ g(a, "formie:submit:final:after", e);
2473
2467
  });
2474
- return f.push(re, ie, A, ae), t.set(a, {
2475
- options: g,
2468
+ return f.push(ie, ae, M, oe), t.set(a, {
2469
+ options: b,
2476
2470
  bus: d,
2477
- form: v,
2478
- validator: D,
2479
- modules: O,
2471
+ form: S,
2472
+ validator: O,
2473
+ modules: k,
2480
2474
  unbinds: f,
2481
- instance: k
2482
- }), y(a, "formie:mount:after", {
2483
- id: p,
2484
- mode: g.mode
2485
- }), v instanceof HTMLFormElement && m(v), G.log("Mount complete.", {
2486
- id: p,
2487
- target: Z(a),
2488
- mode: g.mode
2489
- }), k;
2475
+ instance: A,
2476
+ unbindEventContext: j
2477
+ }), g(a, "formie:mount:after", {
2478
+ id: m,
2479
+ mode: b.mode,
2480
+ instance: A
2481
+ }), S instanceof HTMLFormElement && ee(S), q.log("Mount complete.", {
2482
+ id: m,
2483
+ target: Q(a),
2484
+ mode: b.mode
2485
+ }), A;
2490
2486
  }, l = (e, n) => {
2491
- if (!n.autoVisible || $n(e) || typeof IntersectionObserver > "u") return c(e, n);
2487
+ if (!n.autoVisible || tr(e) || typeof IntersectionObserver > "u") return c(e, n);
2492
2488
  if (t.has(e)) return Promise.resolve(t.get(e)?.instance || null);
2493
- if (i.has(e)) return G.log("Mount deferred (already waiting visibility).", { target: Z(e) }), Promise.resolve(null);
2489
+ if (i.has(e)) return q.log("Mount deferred (already waiting visibility).", { target: Q(e) }), Promise.resolve(null);
2494
2490
  let r = new IntersectionObserver((t) => {
2495
- t.some((t) => t.target === e && t.isIntersecting) && (r.disconnect(), i.delete(e), G.log("Visibility reached, proceeding mount.", { target: Z(e) }), c(e, {
2491
+ t.some((t) => t.target === e && t.isIntersecting) && (r.disconnect(), i.delete(e), q.log("Visibility reached, proceeding mount.", { target: Q(e) }), c(e, {
2496
2492
  ...n,
2497
2493
  autoVisible: !1
2498
2494
  }));
2499
2495
  }, { threshold: .01 });
2500
2496
  return r.observe(e), i.set(e, () => {
2501
2497
  r.disconnect();
2502
- }), G.log("Mount deferred until visible.", { target: Z(e) }), Promise.resolve(null);
2498
+ }), q.log("Mount deferred until visible.", { target: Q(e) }), Promise.resolve(null);
2503
2499
  };
2504
2500
  return {
2505
2501
  mount: c,
@@ -2507,7 +2503,7 @@ function or() {
2507
2503
  update: async (e, n) => {
2508
2504
  let r = t.get(e);
2509
2505
  if (!r) return c(e, {
2510
- ...q(e),
2506
+ ...Y(e),
2511
2507
  ...n,
2512
2508
  mode: n.mode || "server-rendered"
2513
2509
  });
@@ -2515,32 +2511,32 @@ function or() {
2515
2511
  ...r.options,
2516
2512
  ...n
2517
2513
  };
2518
- let i = n.payload?.theme || r.options.payload?.theme || Qn(e, r.form)?.theme, a = ne(e, i, r.form);
2519
- return r.validator && (r.validator.config.fieldContainerErrorClass = a.fieldLayoutError || [], r.validator.config.inputErrorClass = a.fieldControlError || [], r.validator.config.messagesClass = a.fieldErrors || [], r.validator.config.messageClass = a.fieldError || []), Object.keys(a).length && y(e, "formie:theme:applied", {
2514
+ let i = n.payload?.theme || r.options.payload?.theme || er(e, r.form)?.theme, a = re(e, i, r.form);
2515
+ return r.validator && (r.validator.config.fieldContainerErrorClass = a.fieldLayoutError || [], r.validator.config.inputErrorClass = a.fieldControlError || [], r.validator.config.messagesClass = a.fieldErrors || [], r.validator.config.messageClass = a.fieldError || []), Object.keys(a).length && g(e, "formie:theme:applied", {
2520
2516
  hasClasses: !0,
2521
2517
  reason: "update"
2522
2518
  }), r.instance;
2523
2519
  },
2524
2520
  getInstance: (e) => t.get(e)?.instance || null,
2525
2521
  refreshForCache: async (e) => {
2526
- Mn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2522
+ Nn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
2527
2523
  let n = null;
2528
2524
  if (n = typeof e == "string" ? document.getElementById(e) || document.querySelector(`[data-formie-form-id="${e}"]`) : e, !n) {
2529
- G.warn("refreshForCache target not found.", { targetOrId: e });
2525
+ q.warn("refreshForCache target not found.", { targetOrId: e });
2530
2526
  return;
2531
2527
  }
2532
- let r = t.get(n), i = jn(n), a = r?.options || q(n);
2528
+ let r = t.get(n), i = Mn(n), a = r?.options || Y(n);
2533
2529
  if (!i) {
2534
- G.warn("refreshForCache found no form element for target.", { target: Z(n) });
2530
+ q.warn("refreshForCache found no form element for target.", { target: Q(n) });
2535
2531
  return;
2536
2532
  }
2537
- let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = In(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2533
+ let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Ln(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
2538
2534
  if (!o) {
2539
- G.warn("refreshForCache found no form handle for target.", { target: Z(n) });
2535
+ q.warn("refreshForCache found no form handle for target.", { target: Q(n) });
2540
2536
  return;
2541
2537
  }
2542
- let l = await P(s, o, c, a, i?.querySelector("input[name=\"requestToken\"]")?.value);
2543
- l && (tr(i, l), y(n, "formie:refresh-tokens:after", l));
2538
+ let l = await Xe(s, o, c, a, i?.querySelector("input[name=\"requestToken\"]")?.value);
2539
+ l && (rr(i, l), g(n, "formie:refresh-tokens:after", l));
2544
2540
  },
2545
2541
  registerModule: (e, t) => r.register(e, t),
2546
2542
  unregisterModule: (e) => {
@@ -2548,16 +2544,16 @@ function or() {
2548
2544
  },
2549
2545
  getRegisteredModules: () => r.getAll(),
2550
2546
  scan: async (e) => {
2551
- let t = e || document, n = Array.from(t.querySelectorAll(W));
2552
- G.log("Scan started.", {
2547
+ let t = e || document, n = Array.from(t.querySelectorAll(K));
2548
+ q.log("Scan started.", {
2553
2549
  scope: t === document ? "document" : t,
2554
2550
  targetCount: n.length
2555
2551
  });
2556
2552
  let r = (await Promise.all(n.map((e) => {
2557
- let t = q(e);
2553
+ let t = Y(e);
2558
2554
  return l(e, t);
2559
2555
  }))).filter((e) => !!e);
2560
- return G.log("Scan finished.", {
2556
+ return q.log("Scan finished.", {
2561
2557
  mountedCount: r.length,
2562
2558
  deferredCount: n.length - r.length
2563
2559
  }), r;
@@ -2565,16 +2561,16 @@ function or() {
2565
2561
  observe: (e) => {
2566
2562
  if (typeof MutationObserver > "u") return () => {};
2567
2563
  let n = e || document;
2568
- G.log("Observer started.", { scope: n === document ? "document" : n });
2564
+ q.log("Observer started.", { scope: n === document ? "document" : n });
2569
2565
  let r = new MutationObserver((e) => {
2570
2566
  e.forEach((e) => {
2571
2567
  e.addedNodes.forEach((e) => {
2572
- e instanceof Element && (e.matches(W) && (G.log("Observer detected new root.", { target: Z(e) }), l(e, q(e))), e.querySelectorAll(W).forEach((e) => {
2573
- G.log("Observer detected new nested root.", { target: Z(e) }), l(e, q(e));
2568
+ e instanceof Element && (e.matches(K) && (q.log("Observer detected new root.", { target: Q(e) }), l(e, Y(e))), e.querySelectorAll(K).forEach((e) => {
2569
+ q.log("Observer detected new nested root.", { target: Q(e) }), l(e, Y(e));
2574
2570
  }));
2575
2571
  }), e.removedNodes.forEach((e) => {
2576
- e instanceof Element && (t.has(e) && (G.log("Observer detected removed root.", { target: Z(e) }), s(e)), e.querySelectorAll(W).forEach((e) => {
2577
- t.has(e) && (G.log("Observer detected removed nested root.", { target: Z(e) }), s(e));
2572
+ e instanceof Element && (t.has(e) && (q.log("Observer detected removed root.", { target: Q(e) }), s(e)), e.querySelectorAll(K).forEach((e) => {
2573
+ t.has(e) && (q.log("Observer detected removed nested root.", { target: Q(e) }), s(e));
2578
2574
  }));
2579
2575
  });
2580
2576
  });
@@ -2583,11 +2579,11 @@ function or() {
2583
2579
  childList: !0,
2584
2580
  subtree: !0
2585
2581
  }), () => {
2586
- r.disconnect(), G.log("Observer stopped."), i.forEach((e, t) => {
2587
- er(t, n) && (e(), i.delete(t));
2582
+ r.disconnect(), q.log("Observer stopped."), i.forEach((e, t) => {
2583
+ nr(t, n) && (e(), i.delete(t));
2588
2584
  });
2589
2585
  let e = [];
2590
- n instanceof Element && n.matches(W) && e.push(n), n.querySelectorAll(W).forEach((t) => {
2586
+ n instanceof Element && n.matches(K) && e.push(n), n.querySelectorAll(K).forEach((t) => {
2591
2587
  e.push(t);
2592
2588
  }), e.forEach((e) => {
2593
2589
  t.has(e) && s(e);
@@ -2598,13 +2594,13 @@ function or() {
2598
2594
  }
2599
2595
  //#endregion
2600
2596
  //#region src/js/core/hydrate-modules.ts
2601
- var sr = E("general", "module-hydrator");
2602
- async function cr(e) {
2597
+ var lr = O("general", "module-hydrator");
2598
+ async function ur(e) {
2603
2599
  let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form") ?? t.querySelector("form")), r = e.surface ?? "cp-edit", i = e.modules ?? {
2604
2600
  contractVersion: 2,
2605
2601
  surface: r,
2606
2602
  entries: []
2607
- }, a = e.registry ?? new B(), o = new zt(), s = await Zt(i, {
2603
+ }, a = e.registry ?? new B(), o = new Ut(), s = await tn(i, {
2608
2604
  registry: a,
2609
2605
  setupContext: {
2610
2606
  formId: n?.id || t.id || "formie-modules",
@@ -2629,7 +2625,7 @@ async function cr(e) {
2629
2625
  surface: r
2630
2626
  }
2631
2627
  });
2632
- return sr.log("Hydrated module manifest.", {
2628
+ return lr.log("Hydrated module manifest.", {
2633
2629
  moduleCount: i.entries.length,
2634
2630
  instanceCount: s.instances.length,
2635
2631
  surface: r
@@ -2696,44 +2692,44 @@ async function cr(e) {
2696
2692
  }
2697
2693
  //#endregion
2698
2694
  //#region src/js/core/formie.ts
2699
- function Q(e) {
2695
+ function $(e) {
2700
2696
  return e instanceof Element;
2701
2697
  }
2702
- function lr(e) {
2698
+ function dr(e) {
2703
2699
  return e.ok;
2704
2700
  }
2705
- function ur(e) {
2706
- return typeof e == "string" ? `selector "${e}"` : Q(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2701
+ function fr(e) {
2702
+ return typeof e == "string" ? `selector "${e}"` : $(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
2707
2703
  }
2708
- function dr(e) {
2704
+ function pr(e) {
2709
2705
  let t = /* @__PURE__ */ new Set(), n = [];
2710
- for (let r of e) Q(r) && !t.has(r) && (t.add(r), n.push(r));
2706
+ for (let r of e) $(r) && !t.has(r) && (t.add(r), n.push(r));
2711
2707
  return n;
2712
2708
  }
2713
- function $(e) {
2714
- return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : Q(e) ? [e] : dr(e);
2709
+ function mr(e) {
2710
+ return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : pr(e);
2715
2711
  }
2716
- function fr() {
2712
+ function hr() {
2717
2713
  return document.readyState === "loading" ? new Promise((e) => {
2718
2714
  document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
2719
2715
  }) : Promise.resolve();
2720
2716
  }
2721
- async function pr(e) {
2722
- let t = $(e);
2723
- return t.length > 0 || typeof e != "string" ? t : (await fr(), $(e));
2717
+ async function gr(e) {
2718
+ let t = mr(e);
2719
+ return t.length > 0 || typeof e != "string" ? t : (await hr(), mr(e));
2724
2720
  }
2725
- function mr(e) {
2726
- return typeof e == "string" ? document : Q(e) ? e.getRootNode() : document;
2721
+ function _r(e) {
2722
+ return typeof e == "string" ? document : $(e) ? e.getRootNode() : document;
2727
2723
  }
2728
- function hr(e) {
2724
+ function vr(e) {
2729
2725
  let { element: t, observe: n, allowEmpty: r, client: i, onReady: a, onResult: o, onSuccess: s, onError: c, onEvent: l, ...u } = e;
2730
2726
  return {
2731
2727
  mode: "server-rendered",
2732
2728
  ...u
2733
2729
  };
2734
2730
  }
2735
- async function gr(e, t, n, r) {
2736
- let i = [], a = hr(e);
2731
+ async function yr(e, t, n, r) {
2732
+ let i = [], a = vr(e);
2737
2733
  for (let o of r) {
2738
2734
  let r = n.get(o);
2739
2735
  if (r) {
@@ -2743,7 +2739,7 @@ async function gr(e, t, n, r) {
2743
2739
  let s = await t.mount(o, a), c = [];
2744
2740
  if (e.onReady?.(s), c.push(s.on("formie:submit:result", (t) => {
2745
2741
  let n = t;
2746
- e.onResult?.(n, s), lr(n) ? e.onSuccess?.(n, s) : e.onError?.(n, s);
2742
+ e.onResult?.(n, s), dr(n) ? e.onSuccess?.(n, s) : e.onError?.(n, s);
2747
2743
  })), e.onEvent) for (let t of l) c.push(s.on(t, (n) => {
2748
2744
  e.onEvent?.({
2749
2745
  name: t,
@@ -2757,11 +2753,11 @@ async function gr(e, t, n, r) {
2757
2753
  }
2758
2754
  return i;
2759
2755
  }
2760
- async function _r(e) {
2761
- let t = e.client ?? or(), n = /* @__PURE__ */ new Map(), r = await pr(e.element);
2762
- if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${ur(e.element)}.`);
2763
- await gr(e, t, n, r);
2764
- let i = e.observe ? t.observe(mr(e.element)) : null;
2756
+ async function br(e) {
2757
+ let t = e.client ?? cr(), n = /* @__PURE__ */ new Map(), r = await gr(e.element);
2758
+ if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${fr(e.element)}.`);
2759
+ await yr(e, t, n, r);
2760
+ let i = e.observe ? t.observe(_r(e.element)) : null;
2765
2761
  return {
2766
2762
  client: t,
2767
2763
  get instances() {
@@ -2772,8 +2768,8 @@ async function _r(e) {
2772
2768
  return r ? n.get(r)?.instance ?? t.getInstance(r) : null;
2773
2769
  },
2774
2770
  async rescan() {
2775
- let r = $(e.element);
2776
- return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : gr(e, t, n, r);
2771
+ let r = mr(e.element);
2772
+ return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : yr(e, t, n, r);
2777
2773
  },
2778
2774
  async destroy() {
2779
2775
  i?.();
@@ -2784,7 +2780,7 @@ async function _r(e) {
2784
2780
  }
2785
2781
  //#endregion
2786
2782
  //#region src/js/core/client-rendered-modules.ts
2787
- var vr = {
2783
+ var xr = {
2788
2784
  conditions: {
2789
2785
  kind: "core",
2790
2786
  reason: "Core evaluates structured conditions and the adapter renders visibility."
@@ -2818,8 +2814,8 @@ var vr = {
2818
2814
  reason: "The adapter renders the structured date input contract."
2819
2815
  }
2820
2816
  };
2821
- async function yr(t, n, r = Bt) {
2822
- for (let [e, t] of Object.entries(vr)) {
2817
+ async function Sr(t, n, r = Wt) {
2818
+ for (let [e, t] of Object.entries(xr)) {
2823
2819
  let n = `formie:${e}`;
2824
2820
  r.get(n) || r.register({
2825
2821
  moduleId: n,
@@ -2847,7 +2843,7 @@ async function yr(t, n, r = Bt) {
2847
2843
  }
2848
2844
  };
2849
2845
  a();
2850
- let o = n.subscribe(a), s = await cr({
2846
+ let o = n.subscribe(a), s = await ur({
2851
2847
  root: t,
2852
2848
  modules: n.getState().definition.modules,
2853
2849
  surface: "client-rendered",
@@ -2881,4 +2877,4 @@ async function yr(t, n, r = Bt) {
2881
2877
  };
2882
2878
  }
2883
2879
  //#endregion
2884
- export { l as FORMIE_HTML_EVENT_NAMES, pn as FormieValidator, Se as LEGACY_FORMIE_DOM_EVENT_BRIDGES, Ce as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, B as ModuleRegistry, ke as bindLegacyDomEventCompatibility, je as bindLegacyValidatorCompatibility, ye as buildFieldValueRegistry, Bt as clientRenderedModuleRegistry, E as createDebug, or as createFormieClient, w as debugLog, T as debugWarn, xe as defineAddressModule, pe as defineCaptchaModule, fe as definePassiveCaptchaModule, S as definePaymentModule, ge as fieldKeyToInputName, _r as formie, c as getFieldModuleEventName, de as getFormieTranslations, s as getGlobalModuleLifecycleEventName, i as getScopedModuleLifecycleEventName, cr as hydrateFormieModules, me as inputNameToFieldKey, te as isFormieDebugEnabled, le as mergeFormieTranslations, yr as mountClientRenderedModules, he as normalizeFieldKey, u as normalizeFormieEventName, _e as parseFieldReference, be as resolveFieldReferenceFromFormData, ve as resolveFieldReferenceLive, we as resolveLegacyCompatibilityOptions, ee as setFormieDebugEnabled, ue as setFormieTranslations, ce as t, a as toDomEventName, se as translate };
2880
+ export { l as FORMIE_HTML_EVENT_NAMES, mn as FormieValidator, Ce as LEGACY_FORMIE_DOM_EVENT_BRIDGES, we as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, B as ModuleRegistry, Ae as bindLegacyDomEventCompatibility, Me as bindLegacyValidatorCompatibility, be as buildFieldValueRegistry, Wt as clientRenderedModuleRegistry, O as createDebug, cr as createFormieClient, E as debugLog, D as debugWarn, Se as defineAddressModule, me as defineCaptchaModule, pe as definePassiveCaptchaModule, w as definePaymentModule, _e as fieldKeyToInputName, br as formie, c as getFieldModuleEventName, fe as getFormieTranslations, s as getGlobalModuleLifecycleEventName, i as getScopedModuleLifecycleEventName, ur as hydrateFormieModules, he as inputNameToFieldKey, ne as isFormieDebugEnabled, ue as mergeFormieTranslations, Sr as mountClientRenderedModules, ge as normalizeFieldKey, u as normalizeFormieEventName, ve as parseFieldReference, xe as resolveFieldReferenceFromFormData, ye as resolveFieldReferenceLive, Te as resolveLegacyCompatibilityOptions, te as setFormieDebugEnabled, de as setFormieTranslations, le as t, a as toDomEventName, ce as translate };