@verbb/formie-browser 1.0.15 → 1.0.17-next.10.g9cef3233dddb

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 (160) hide show
  1. package/CHANGELOG.md +57 -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-OHeW8r8p.js} +26 -35
  5. package/dist/chunks/{api-BK9b340y.js → api-BPtH5RBA.js} +152 -120
  6. package/dist/chunks/{api-ghNr2uxX.js → api-CmuOZ0i3.js} +1 -1
  7. package/dist/chunks/{api-Dxl_CKw-.js → api-DlW6054X.js} +308 -301
  8. package/dist/chunks/{bpoint-BwtuyN_O.js → bpoint-BKRpTj1e.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-CTfq6v4y.js} +301 -335
  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-dp41TnRq.js +5351 -0
  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-9ZTEmiod.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-Bhxg5QZe.js} +116 -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-BN096eDZ.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-lseqzFTP.js} +14 -14
  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-DCBzpCmt.js} +2 -6
  35. package/dist/chunks/{moneris-BRbUvI4t.js → moneris-CeryRRRJ.js} +1 -1
  36. package/dist/chunks/opayo-D5cbEqJy.js +159 -0
  37. package/dist/chunks/{paddle-CympHVvd.js → paddle-CDiiBCJ8.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-CA-kRKlJ.js} +1 -1
  40. package/dist/chunks/{payway-C9rHTCC_.js → payway-K9eUUMvk.js} +3 -11
  41. package/dist/chunks/phone-country-BMyw-Qcz.js +2647 -0
  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-Bn6y1M0R.js} +1 -1
  57. package/dist/chunks/{stripe-Dmkdkq1y.js → stripe-CmzSSdMg.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-cGKWwGhu.js} +206 -216
  66. package/dist/css/formie-base.css +26 -26
  67. package/dist/css/theme-base/_primitives.css +9 -8
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +784 -759
  71. package/dist/js/core/client-rendered-modules.d.ts +6 -6
  72. package/dist/js/core/client-rendered-modules.d.ts.map +1 -1
  73. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  74. package/dist/js/core/dom-events.d.ts +5 -0
  75. package/dist/js/core/dom-events.d.ts.map +1 -1
  76. package/dist/js/core/page-client-event.d.ts.map +1 -1
  77. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  78. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  79. package/dist/js/core/validation-focus.d.ts +1 -0
  80. package/dist/js/core/validation-focus.d.ts.map +1 -1
  81. package/dist/js/modules/captchas/factories.d.ts.map +1 -1
  82. package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
  83. package/dist/js/modules/captchas/host.d.ts +4 -1
  84. package/dist/js/modules/captchas/host.d.ts.map +1 -1
  85. package/dist/js/modules/captchas/recaptcha-shared.d.ts +1 -1
  86. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -1
  87. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
  88. package/dist/js/modules/fields/address-state.d.ts.map +1 -1
  89. package/dist/js/modules/fields/combobox.d.ts +2 -0
  90. package/dist/js/modules/fields/combobox.d.ts.map +1 -1
  91. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  92. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  93. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  94. package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
  95. package/dist/js/modules/fields/summary.d.ts.map +1 -1
  96. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  97. package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
  98. package/dist/js/modules/loader.d.ts.map +1 -1
  99. package/dist/js/modules/payments/factories.d.ts.map +1 -1
  100. package/dist/js/modules/payments/opayo.d.ts.map +1 -1
  101. package/dist/js/submit/pipeline.d.ts +2 -0
  102. package/dist/js/submit/pipeline.d.ts.map +1 -1
  103. package/dist/js/theme/message-attributes.d.ts +4 -0
  104. package/dist/js/theme/message-attributes.d.ts.map +1 -0
  105. package/dist/js/transport/forms-api.d.ts +1 -1
  106. package/dist/js/transport/forms-api.d.ts.map +1 -1
  107. package/dist/js/utils/form-started-at.d.ts +1 -0
  108. package/dist/js/utils/form-started-at.d.ts.map +1 -1
  109. package/dist/js/utils/unload-warning.d.ts +4 -0
  110. package/dist/js/utils/unload-warning.d.ts.map +1 -1
  111. package/dist/js/validation/rules/required.d.ts.map +1 -1
  112. package/dist/js/validation/submit-readiness.d.ts.map +1 -1
  113. package/dist/js/validation/validator.d.ts +1 -0
  114. package/dist/js/validation/validator.d.ts.map +1 -1
  115. package/package.json +7 -5
  116. package/src/css/formie-base.css +26 -26
  117. package/src/css/theme-base/_primitives.css +9 -8
  118. package/src/index.ts +1 -0
  119. package/src/js/core/client-rendered-modules.ts +1 -1
  120. package/src/js/core/create-formie-client.ts +74 -51
  121. package/src/js/core/dom-events.ts +30 -1
  122. package/src/js/core/page-client-event.ts +5 -7
  123. package/src/js/core/submit-flow.ts +2 -2
  124. package/src/js/core/submit-result-state.ts +18 -2
  125. package/src/js/core/submit-result-ui.ts +31 -2
  126. package/src/js/core/validation-focus.ts +52 -13
  127. package/src/js/modules/captchas/factories.ts +241 -101
  128. package/src/js/modules/captchas/hcaptcha.ts +3 -2
  129. package/src/js/modules/captchas/host.ts +16 -0
  130. package/src/js/modules/captchas/recaptcha-enterprise.ts +1 -1
  131. package/src/js/modules/captchas/recaptcha-shared.ts +23 -5
  132. package/src/js/modules/captchas/recaptcha-v3.ts +23 -14
  133. package/src/js/modules/fields/address-state.ts +6 -4
  134. package/src/js/modules/fields/combobox.ts +46 -3
  135. package/src/js/modules/fields/conditions.ts +3 -0
  136. package/src/js/modules/fields/date-picker.ts +3 -3
  137. package/src/js/modules/fields/file-upload.ts +18 -4
  138. package/src/js/modules/fields/phone-country.ts +42 -11
  139. package/src/js/modules/fields/rich-text.ts +33 -0
  140. package/src/js/modules/fields/summary.ts +63 -10
  141. package/src/js/modules/fields/text-limit.ts +11 -0
  142. package/src/js/modules/fields/upload-manager.ts +30 -14
  143. package/src/js/modules/loader.ts +7 -0
  144. package/src/js/modules/payments/factories.ts +87 -54
  145. package/src/js/modules/payments/opayo.ts +7 -0
  146. package/src/js/submit/pipeline.ts +16 -9
  147. package/src/js/theme/message-attributes.ts +54 -0
  148. package/src/js/transport/forms-api.ts +6 -1
  149. package/src/js/utils/country-from-ip.ts +1 -1
  150. package/src/js/utils/form-started-at.ts +19 -4
  151. package/src/js/utils/unload-warning.ts +63 -7
  152. package/src/js/validation/rules/required.ts +6 -0
  153. package/src/js/validation/submit-readiness.ts +2 -0
  154. package/src/js/validation/validator.ts +16 -4
  155. package/src/vendor.d.ts +4 -3
  156. package/dist/chunks/date-picker-DaPvMrop.js +0 -5338
  157. package/dist/chunks/opayo-BwWdInEP.js +0 -188
  158. package/dist/chunks/phone-country-B8fv-L5_.js +0 -2662
  159. package/dist/chunks/recaptcha-shared-DTbTw-MF.js +0 -27
  160. package/dist/chunks/recaptcha-v3-CflUHeZD.js +0 -28
package/CHANGELOG.md CHANGED
@@ -2,6 +2,63 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Changed
6
+ - Changed the `@verbb/formie-*` package versions to match the Formie plugin, so Formie 4.0.7 pairs with version 4.0.7 of each package. The jump from 1.x has no breaking changes, but version ranges such as `^1.0.16` need updating once. ([#3081](https://github.com/verbb/formie/issues/3081))
7
+
8
+ ### Fixed
9
+ - Fixed base reset selectors overriding the default theme when styles are compiled without CSS layers.
10
+ - Fixed File Upload fields retaining completed attachments after AJAX form resets, and duplicate advanced upload rows after Back navigation.
11
+ - Fixed TypeScript errors in projects using NodeNext module resolution.
12
+ - Fixed a server-rendered error on a field inside a Group or Repeater marking every other field around it as invalid.
13
+ - Fixed focus not moving to Checkboxes, Agree, searchable Dropdown and Rich Text fields after a validation error.
14
+ - Fixed searchable dropdown selections being cleared during AJAX page navigation. ([#3088](https://github.com/verbb/formie/issues/3088))
15
+ - Fixed required field and core modules blocking submission when there’s nothing rendered for them to enhance yet, such as conditions inside a Repeater with no rows.
16
+ - Fixed browser requests failing when Craft uses a custom action trigger, including token refresh after AJAX submissions. ([#3068](https://github.com/verbb/formie/issues/3068))
17
+ - Fixed upload manager file order and move button states becoming inconsistent after reordering files. ([#3070](https://github.com/verbb/formie/issues/3070))
18
+ - Fixed searchable dropdown placeholders not appearing until a form field is focused. ([#3072](https://github.com/verbb/formie/issues/3072))
19
+ - Fixed Date pickers displaying calendar labels in English on non-English sites. ([#3076](https://github.com/verbb/formie/issues/3076))
20
+ - Fixed required advanced Date pickers being skipped by client-side validation. ([#3077](https://github.com/verbb/formie/issues/3077))
21
+ - Fixed Phone country dropdowns selecting the first allowed country when the default is None, and not restoring None when forms reset. ([#3071](https://github.com/verbb/formie/issues/3071))
22
+ - Fixed invisible hCaptcha challenges timing out before they could be completed, requiring a second submit click. ([#3067](https://github.com/verbb/formie/issues/3067))
23
+ - Fixed token refreshes losing the form's site on multisite installations with path-based URLs. ([#3064](https://github.com/verbb/formie/issues/3064))
24
+ - Fixed theme attributes not being applied to AJAX success and error messages. ([#3061](https://github.com/verbb/formie/issues/3061))
25
+ - Fixed nested alert roles in form error messages that could cause duplicate screen reader announcements. ([#3062](https://github.com/verbb/formie/issues/3062))
26
+ - Fixed AJAX submissions showing the form error message when Error Message Position is set to None.
27
+ - Fixed Opayo re-tokenizing cards and requesting unnecessary merchant sessions after completing a 3D Secure challenge. ([#3048](https://github.com/verbb/formie/issues/3048))
28
+
29
+ ## 1.0.16 - 2026-10-28
30
+
31
+ ### Added
32
+ - Added configurable display limits for searchable dropdowns, defaulting to 100 while searching all options. ([#3059](https://github.com/verbb/formie/issues/3059))
33
+ - Add a keyboard-accessible clear button for single searchable Dropdown fields with placeholders. ([#3058](https://github.com/verbb/formie/issues/3058))
34
+ - Add the `formie:unload-warning:collect-exclusions` event for integrations to exclude automatically updated transport fields from unsaved-changes checks.
35
+
36
+ ### Changed
37
+ - Updated the package build toolchain to Vite 8.3.4.
38
+
39
+ ### Fixed
40
+ - Fixed concurrent payment widget mounts when fields become visible, including duplicate Opayo Drop-in sessions, unhandled mount errors and incomplete teardown during initialization. ([#3048](https://github.com/verbb/formie/issues/3048))
41
+ - Fixed required dropdowns enhanced with third-party libraries such as Choices.js failing validation when options are selected, and preserved custom required messages. ([#3046](https://github.com/verbb/formie/issues/3046))
42
+ - Fixed page-reload submissions stalling when the submit delay is zero.
43
+ - Fixed mounted form lifecycle events omitting the form instance, including submission, page navigation, token refresh and teardown hooks. ([#3032](https://github.com/verbb/formie/issues/3032))
44
+ - Fixed “Scroll To Top” having no effect after successful AJAX submissions. ([#3023](https://github.com/verbb/formie/issues/3023))
45
+ - Fixed summary fields remaining blank after AJAX page navigation.
46
+ - Fixed summary fields repeatedly retrying failed requests.
47
+ - Fixed text counters and phone countries not returning to their initial values when forms reset.
48
+ - Fixed rich-text validation errors failing to focus and describe the editable control.
49
+ - Fixed required table fields incorrectly requiring every cell to have a value.
50
+ - Fixed dependent calculations using number prefixes or suffixes returning incorrect results.
51
+ - Fixed fresh visits and completed submissions retaining an earlier spam-protection timer.
52
+ - Fixed forms freezing when live validation and disabling the submit button until valid are both enabled.
53
+ - Fixed native file input metadata requests omitting CSRF tokens and form context after navigating between pages.
54
+ - Fixed reCAPTCHA loading the wrong SDK or readiness queue when standard and Enterprise APIs share a page, and v3 failing when an existing script has not loaded the configured site key.
55
+ - Fixed reCAPTCHA v3 inline badges rendering outside the form. ([#3016](https://github.com/verbb/formie/issues/3016))
56
+ - Fixed CAPTCHA token updates triggering unsaved-changes warnings on untouched forms, including custom or changing token field names. ([#3008](https://github.com/verbb/formie/issues/3008))
57
+ - Fixed initial conditional field visibility triggering an unsaved-changes warning after native submissions.
58
+ - Fixed edits made immediately after mounting a form being treated as saved.
59
+ - Fixed CAPTCHA teardown leaving widgets or callbacks active after failed setup, pending mounts or provider cleanup errors.
60
+ - Fixed CAPTCHA widgets with a numeric zero handle failing to challenge or reset.
61
+
5
62
  ## 1.0.15 - 2026-10-15
6
63
 
7
64
  ### Changed
@@ -1,7 +1,7 @@
1
- import { t as e } from "./debug-BV0DvdHx.js";
1
+ import { t as e } from "./debug-rhzqP1j2.js";
2
2
  import { i as t, n } from "./constants-DVcJAvc5.js";
3
- import { i as r } from "./shared-OKhSay59.js";
4
- import { n as i } from "./country-from-ip-DDj_mFki.js";
3
+ import { i as r } from "./shared-CJ1LIEh3.js";
4
+ import { n as i } from "./country-from-ip-BqQ-BqLH.js";
5
5
  //#region src/js/modules/fields/address-country.ts
6
6
  var a = "address-country", o = n.country, s = e("fields", "address-country");
7
7
  function c(e, t, n) {
@@ -42,11 +42,7 @@ async function f(e, n) {
42
42
  return;
43
43
  }
44
44
  let o = n.countryOptionValue === "full" ? "full" : "short", f = c(a.countryCode, a.countryName, o);
45
- if (!u(r, f)) {
46
- s.warn("Detected country is not available in the country dropdown; skipping preselect.", { selectValue: f });
47
- return;
48
- }
49
- await d(r, f), s.log("Preselected country from IP.", { selectValue: f });
45
+ u(r, f) ? (await d(r, f), s.log("Preselected country from IP.", { selectValue: f })) : s.warn("Detected country is not available in the country dropdown; skipping preselect.", { selectValue: f });
50
46
  }
51
47
  var p = {
52
48
  moduleId: `formie:${a}`,
@@ -1,5 +1,5 @@
1
1
  import { n as e } from "./event-names-BCI2FLD8.js";
2
- import { t } from "./api-ghNr2uxX.js";
2
+ import { t } from "./api-CmuOZ0i3.js";
3
3
  import { r as n } from "./scripts-DrccjrFv.js";
4
4
  //#region src/js/modules/address/address-finder.ts
5
5
  var r = "FORMIE_ADDRESS_FINDER_SCRIPT", i = t({
@@ -1,10 +1,10 @@
1
1
  import { t as e } from "./request-profile-DhwkeCpS.js";
2
- import { t } from "./dist-ZLeW0zZ3.js";
3
- import { t as n } from "./debug-BV0DvdHx.js";
2
+ import { t } from "./dist-CJReDlDK.js";
3
+ import { t as n } from "./debug-rhzqP1j2.js";
4
4
  import { a as r, n as i } from "./theme-classes-DAQuEqdP.js";
5
5
  import { n as a } from "./constants-DVcJAvc5.js";
6
- import { i as o, n as s } from "./shared-OKhSay59.js";
7
- import { initFormieCombobox as c } from "./combobox-Ba08_cHL.js";
6
+ import { i as o, n as s } from "./shared-CJ1LIEh3.js";
7
+ import { initFormieCombobox as c } from "./combobox-CTfq6v4y.js";
8
8
  //#region src/js/modules/fields/address-state.ts
9
9
  var l = "[data-formie-address-state-dynamic]", u = "[data-formie-address-state-input]", d = "[data-formie-address-state-autofill-anchor]", f = "formie-address-autofill-start", p = a.country, m = "address-state", h = "formie/address/subdivisions", g = ["formie-select", "formie-dropdown-input"], _ = [
10
10
  0,
@@ -123,11 +123,7 @@ function L(e, t) {
123
123
  "data-formie-address-state-option-value"
124
124
  ].forEach((n) => {
125
125
  let r = e.getAttribute(n);
126
- if (r === null) {
127
- t.removeAttribute(n);
128
- return;
129
- }
130
- t.setAttribute(n, r);
126
+ r === null ? t.removeAttribute(n) : t.setAttribute(n, r);
131
127
  });
132
128
  }
133
129
  function R(e, t) {
@@ -172,11 +168,7 @@ function W(e, t, n, r) {
172
168
  }
173
169
  function G(e, t) {
174
170
  let { stateField: n, stateControl: i, required: a } = e;
175
- if (r(n, n, "conditionalHidden", !t), n.toggleAttribute("data-formie-address-state-hidden", !t), !t) {
176
- i.required = !1, i.disabled = !e.isCpEdit;
177
- return;
178
- }
179
- i.disabled = !1, i.required = a;
171
+ r(n, n, "conditionalHidden", !t), n.toggleAttribute("data-formie-address-state-hidden", !t), t ? (i.disabled = !1, i.required = a) : (i.required = !1, i.disabled = !e.isCpEdit);
180
172
  }
181
173
  function K(e) {
182
174
  if (e.fetchingAnnouncementEl) return e.fetchingAnnouncementEl;
@@ -203,16 +195,25 @@ function X(e, t) {
203
195
  let r = n.querySelector("[data-formie-field-required], .required");
204
196
  n.textContent = t, r && n.appendChild(r);
205
197
  }
206
- function Z(e, t) {
198
+ function Z(e, t, n) {
207
199
  e.setAttribute("data-formie-combobox-input", "true"), s(e, "combobox", "before-init", {
208
200
  select: e,
209
- options: { placeholder: t }
201
+ options: {
202
+ placeholder: t,
203
+ maxOptions: n
204
+ }
205
+ });
206
+ let r = c(e, {
207
+ placeholder: t,
208
+ maxOptions: n
210
209
  });
211
- let n = c(e, { placeholder: t });
212
210
  return s(e, "combobox", "after-init", {
213
211
  combobox: e._formieTomSelect,
214
- options: { placeholder: t }
215
- }), n;
212
+ options: {
213
+ placeholder: t,
214
+ maxOptions: n
215
+ }
216
+ }), r;
216
217
  }
217
218
  async function Q(t, n) {
218
219
  let { hideWhenUnused: r = !0, useSearchable: i = !0, useDatalist: a = !0, optionLabel: o = "name", optionValue: s = "name", placeholder: c = null, subdivisionsAction: l = h } = n, u = t.countryControl?.value?.trim() || "";
@@ -245,7 +246,7 @@ async function Q(t, n) {
245
246
  }
246
247
  if (G(t, !0), X(t.stateField, v), g.length > 0) {
247
248
  let e = t.stateControl instanceof HTMLSelectElement ? t.stateControl : U(t.stateControl, d, g, c);
248
- t.stateControl === e ? (z(t.stateControl, e), H(e, g, c, e.value)) : t.stateControl = B(t.stateControl, e), i ? t.comboboxCleanup = Z(e, c) : e.removeAttribute("data-formie-combobox-input"), D(e, I(d, g) || d), j(t);
249
+ t.stateControl === e ? (z(t.stateControl, e), H(e, g, c, e.value)) : t.stateControl = B(t.stateControl, e), i ? t.comboboxCleanup = Z(e, c, n.searchableOptionLimit) : e.removeAttribute("data-formie-combobox-input"), D(e, I(d, g) || d), j(t);
249
250
  return;
250
251
  }
251
252
  let y = t.stateControl instanceof HTMLInputElement ? t.stateControl : V(t.stateControl, d);
@@ -311,15 +312,9 @@ function ne(e, t) {
311
312
  let n = e.target;
312
313
  if (!(n instanceof HTMLInputElement || n instanceof HTMLSelectElement)) return;
313
314
  let r = n === a.autofillAnchor, i = n.matches(l) || n.matches(u);
314
- if ((r || i) && (i && !r && (O(a, n.value), a.pendingStateValue = n.value), k(a), a.countryControl?.value?.trim())) {
315
- if (a.lastSubdivisions.length > 0) {
316
- j(a);
317
- return;
318
- }
319
- a.lastCountry = "", Q(a, t).then(() => {
320
- j(a);
321
- });
322
- }
315
+ (r || i) && (i && !r && (O(a, n.value), a.pendingStateValue = n.value), k(a), a.countryControl?.value?.trim() && (a.lastSubdivisions.length > 0 ? j(a) : (a.lastCountry = "", Q(a, t).then(() => {
316
+ j(a);
317
+ }))));
323
318
  }, g = (e) => {
324
319
  if (e.animationName !== f) return;
325
320
  let r = e.target;
@@ -328,13 +323,9 @@ function ne(e, t) {
328
323
  })));
329
324
  }, _ = (e) => {
330
325
  let n = e.detail?.state?.trim();
331
- if (!n) {
332
- p();
333
- return;
334
- }
335
- a.pendingStateValue = n, O(a, n), Q(a, t).then(() => {
326
+ n ? (a.pendingStateValue = n, O(a, n), Q(a, t).then(() => {
336
327
  j(a), a.lastCountry = a.countryControl?.value?.trim() || "";
337
- });
328
+ })) : p();
338
329
  }, y = (e) => {
339
330
  d !== null && window.clearTimeout(d), d = window.setTimeout(() => {
340
331
  d = null, !(e.defaultPrevented || c) && ($(a), a.stateControl.value = "", a.pendingStateValue = o, O(a, o), p(!0));
@@ -1,5 +1,5 @@
1
1
  import { a as e } from "./event-names-BCI2FLD8.js";
2
- import { t } from "./debug-BV0DvdHx.js";
2
+ import { t } from "./debug-rhzqP1j2.js";
3
3
  import { t as n } from "./theme-classes-DAQuEqdP.js";
4
4
  import { n as r, t as i } from "./async-2GdXNFCE.js";
5
5
  import { i as a } from "./i18n-BY1ds1BL.js";
@@ -98,17 +98,18 @@ function O(e, t) {
98
98
  return !n || typeof n != "object" ? null : n;
99
99
  }
100
100
  function k(e, t, n, r) {
101
- let a = /* @__PURE__ */ new Set(), o = () => {
102
- let i = x(e, t), o = new Set(i.filter((e) => S(e)));
101
+ let a = /* @__PURE__ */ new Set(), o = !0, s = () => {
102
+ if (!o) return;
103
+ let i = x(e, t), s = new Set(i.filter((e) => S(e)));
103
104
  i.forEach((e) => {
104
- o.has(e) && !a.has(e) && (a.add(e), n(e));
105
+ s.has(e) && !a.has(e) && (a.add(e), n(e));
105
106
  }), Array.from(a).forEach((e) => {
106
- o.has(e) || (a.delete(e), r(e));
107
+ s.has(e) || (a.delete(e), r(e));
107
108
  });
108
- }, s = i(o, 20), c = new MutationObserver(() => {
109
- s();
109
+ }, c = i(s, 20), l = new MutationObserver(() => {
110
+ c();
110
111
  });
111
- c.observe(e, {
112
+ l.observe(e, {
112
113
  childList: !0,
113
114
  subtree: !0,
114
115
  attributes: !0,
@@ -120,25 +121,21 @@ function k(e, t, n, r) {
120
121
  "data-formie-page-hidden"
121
122
  ]
122
123
  });
123
- let l = [b(window, "resize", () => {
124
- s();
124
+ let u = [b(window, "resize", () => {
125
+ c();
125
126
  }), ...v.map((t) => b(e, t, () => {
126
- if (y.has(t)) {
127
- o();
128
- return;
129
- }
130
- s();
127
+ y.has(t) ? s() : c();
131
128
  }))];
132
- return o(), {
129
+ return s(), {
133
130
  cleanup: () => {
134
- c.disconnect(), l.forEach((e) => {
131
+ o && (o = !1, l.disconnect(), u.forEach((e) => {
135
132
  e();
136
133
  }), Array.from(a).forEach((e) => {
137
134
  r(e);
138
- }), a.clear();
135
+ }), a.clear());
139
136
  },
140
- reconcile: s,
141
- reconcileImmediate: o,
137
+ reconcile: c,
138
+ reconcileImmediate: s,
142
139
  getVisible: () => x(e, t).filter((e) => S(e))
143
140
  };
144
141
  }
@@ -162,15 +159,15 @@ function j(e, t, { defaultPlaceholderSelector: n, defaultTokenFieldNames: r = []
162
159
  provider: c
163
160
  };
164
161
  }
165
- function M(e, t) {
166
- let n = e.form || e.root, r = t.ui.placeholderSelector, i = t.handle;
162
+ function M(e, t, n = {}) {
163
+ let r = e.form || e.root, i = t.ui.placeholderSelector, a = t.handle;
167
164
  return {
168
165
  form: e.form,
169
166
  root: e.root,
170
167
  placeholder: {
171
- query: () => x(e.root, r),
172
- getPrimary: () => C(e.root, r),
173
- observe: (t, n) => k(e.root, r, t, n),
168
+ query: () => x(e.root, i),
169
+ getPrimary: () => C(e.root, i),
170
+ observe: (t, n) => k(e.root, i, t, n),
174
171
  createContainer: (e) => w(e),
175
172
  clear: (e) => {
176
173
  e && (T(e), e.innerHTML = "");
@@ -178,35 +175,35 @@ function M(e, t) {
178
175
  },
179
176
  errors: {
180
177
  getDefaultMessage: () => t.ui.errorMessage,
181
- show: (n, i) => {
182
- E(i || C(e.root, r), n || t.ui.errorMessage, e.form || e.root);
178
+ show: (r, a) => {
179
+ n.isActive?.() !== !1 && E(a || C(e.root, i), r || t.ui.errorMessage, e.form || e.root);
183
180
  },
184
181
  clear: (t) => {
185
- T(t || C(e.root, r));
182
+ n.isActive?.() !== !1 && T(t || C(e.root, i));
186
183
  }
187
184
  },
188
185
  tokens: {
189
186
  names: t.transport.tokenFieldNames,
190
- has: (e = t.transport.tokenFieldNames, r = n) => f(r, e),
191
- read: (e = t.transport.tokenFieldNames[0], r = n) => e ? d(r, e) : "",
192
- write: (r, { names: i = t.transport.tokenFieldNames, root: a = n, container: o = e.form } = {}) => {
193
- i.forEach((e) => {
194
- m(a, e, {
195
- value: r,
196
- container: o
187
+ has: (e = t.transport.tokenFieldNames, n = r) => f(n, e),
188
+ read: (e = t.transport.tokenFieldNames[0], n = r) => e ? d(n, e) : "",
189
+ write: (i, { names: a = t.transport.tokenFieldNames, root: o = r, container: s = e.form } = {}) => {
190
+ n.isActive?.() !== !1 && (n.onTokenFieldNames?.(a), a.forEach((e) => {
191
+ m(o, e, {
192
+ value: i,
193
+ container: s
197
194
  });
198
- });
195
+ }));
199
196
  },
200
- clear: (e = t.transport.tokenFieldNames, r = n) => {
201
- p(r, e);
197
+ clear: (e = t.transport.tokenFieldNames, i = r) => {
198
+ n.isActive?.() !== !1 && p(i, e);
202
199
  },
203
- wait: (e = t.transport.waitForValueMs, r = t.transport.tokenFieldNames, i = n) => h(i, r, e)
200
+ wait: (e = t.transport.waitForValueMs, n = t.transport.tokenFieldNames, i = r) => h(i, n, e)
204
201
  },
205
202
  refresh: {
206
- providerHandle: i,
203
+ providerHandle: a,
207
204
  onTokensRefreshed: (t) => {
208
205
  let n = ["formie:refresh-tokens:after", "formie:refresh-tokens:refreshed"].map((n) => b(e.root, n, (e) => {
209
- let n = O(D(e), i);
206
+ let n = O(D(e), a);
210
207
  n && t(n);
211
208
  }));
212
209
  return () => {
@@ -249,22 +246,45 @@ function P({ moduleId: e, defaultPlaceholderSelector: t, defaultTokenFieldNames:
249
246
  if (!e) throw Error("The CAPTCHA needs a supported placeholder in the client-rendered form.");
250
247
  s = document.createElement("div"), s.setAttribute(e, ""), (a.form ?? a.root).append(s);
251
248
  }
252
- let c = M(a, o), l = await i({
253
- ...a,
254
- options: o,
255
- services: c
256
- });
257
- if (!l) {
258
- s?.remove();
259
- return;
260
- }
261
- let u = l.destroy;
262
- return {
263
- ...l,
264
- destroy: async () => {
265
- await u(), s?.remove();
266
- }
249
+ let c = new Set(o.transport.tokenFieldNames), l = !0, u = (e) => {
250
+ e.filter(Boolean).forEach((e) => c.add(e));
267
251
  };
252
+ u(o.transport.sessionKey ? [o.transport.sessionKey] : []);
253
+ let d = M(a, o, {
254
+ onTokenFieldNames: u,
255
+ isActive: () => l
256
+ }), f = d.events.onForm("formie:unload-warning:collect-exclusions", (e) => {
257
+ let t = e.detail;
258
+ t?.form === a.form && t.exclude(...c);
259
+ }), p = d.refresh.onTokensRefreshed((e) => {
260
+ typeof e.sessionKey == "string" && e.sessionKey.trim() !== "" && u([e.sessionKey.trim()]);
261
+ }), m = () => {
262
+ l = !1, f(), p(), s?.remove();
263
+ };
264
+ try {
265
+ let e = await i({
266
+ ...a,
267
+ options: o,
268
+ services: d
269
+ });
270
+ if (!e) {
271
+ m();
272
+ return;
273
+ }
274
+ let t = e.destroy;
275
+ return {
276
+ ...e,
277
+ destroy: async () => {
278
+ try {
279
+ await t();
280
+ } finally {
281
+ m();
282
+ }
283
+ }
284
+ };
285
+ } catch (e) {
286
+ throw m(), e;
287
+ }
268
288
  }
269
289
  };
270
290
  }
@@ -316,28 +336,38 @@ function I(t) {
316
336
  defaultPlaceholderSelector: t.defaultPlaceholderSelector,
317
337
  defaultTokenFieldNames: t.defaultTokenFieldNames,
318
338
  setup: async (n) => {
319
- let r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = n.services.placeholder.getPrimary(), s = !1, c, l = null, u = async () => (l ||= (N.log("Loading captcha provider API.", { moduleId: t.moduleId }), t.load(n)), l), d = async (e) => {
320
- let r = i.get(e);
321
- if (n.services.errors.clear(e), !r) {
322
- e.innerHTML = "";
323
- return;
324
- }
325
- let a = await u();
326
- t.unmount && await t.unmount({
327
- api: a,
328
- widget: r,
329
- placeholder: e,
330
- services: n.services,
331
- options: n.options,
332
- provider: n.options.provider
333
- }), i.delete(e), e.innerHTML = "", n.services.tokens.clear(), N.log("Unmounted captcha placeholder widget.", { moduleId: t.moduleId }), o === e && (o = n.services.placeholder.getPrimary());
334
- }, f = async (e) => {
335
- if (s || i.has(e)) return;
339
+ let r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = null, c = n.services.placeholder.getPrimary(), l = !1, u, d = null, f = async () => (d ||= (N.log("Loading captcha provider API.", { moduleId: t.moduleId }), t.load(n)), d), p = (e) => {
340
+ let r = o.get(e);
341
+ if (r) return r;
342
+ let s = (async () => {
343
+ await a.get(e)?.catch(() => {}), n.services.errors.clear(e);
344
+ let r = i.has(e), o = i.get(e);
345
+ i.delete(e);
346
+ try {
347
+ if (r && t.unmount) {
348
+ let r = await f();
349
+ await t.unmount({
350
+ api: r,
351
+ widget: o,
352
+ placeholder: e,
353
+ services: n.services,
354
+ options: n.options,
355
+ provider: n.options.provider
356
+ });
357
+ }
358
+ } finally {
359
+ e.innerHTML = "", n.services.tokens.clear(), c === e && (c = n.services.placeholder.getPrimary());
360
+ }
361
+ })().finally(() => o.delete(e));
362
+ return o.set(e, s), s;
363
+ }, m = async (e) => {
364
+ let r = o.get(e);
365
+ if (r && await r, l || i.has(e)) return;
336
366
  if (a.has(e)) return a.get(e);
337
- let r = (async () => {
338
- let r = await u();
339
- if (s || i.has(e)) return;
340
- let a = n.services.placeholder.createContainer(e), c = await t.mount({
367
+ let s = (async () => {
368
+ let r = await f();
369
+ if (l || i.has(e)) return;
370
+ let a = n.services.placeholder.createContainer(e), o = await t.mount({
341
371
  api: r,
342
372
  placeholder: e,
343
373
  container: a,
@@ -345,30 +375,29 @@ function I(t) {
345
375
  options: n.options,
346
376
  provider: n.options.provider
347
377
  });
348
- i.set(e, c), o = e, N.log("Mounted captcha placeholder widget.", { moduleId: t.moduleId });
378
+ i.set(e, o), c = e, N.log("Mounted captcha placeholder widget.", { moduleId: t.moduleId });
349
379
  })().finally(() => {
350
380
  a.delete(e);
351
381
  });
352
- a.set(e, r), await r;
353
- }, p = n.services.placeholder.observe((e) => {
354
- o = e, f(e).catch((e) => {
355
- c = e;
382
+ a.set(e, s), await s;
383
+ }, h = n.services.placeholder.observe((e) => {
384
+ c = e, m(e).catch((e) => {
385
+ u = e;
356
386
  });
357
387
  }, (e) => {
358
- d(e);
388
+ l || p(e).catch((e) => {
389
+ u = e;
390
+ });
359
391
  });
360
- r.push(p.cleanup);
361
- let m = async (e) => {
362
- let r = p.getVisible();
392
+ r.push(h.cleanup);
393
+ let g = async (e) => {
394
+ if (l) return;
395
+ let r = h.getVisible();
363
396
  if (t.reset) {
364
- let a = await u();
397
+ let a = await f();
365
398
  for (let o of r) {
366
399
  let r = i.get(o);
367
- if (!r) {
368
- await f(o);
369
- continue;
370
- }
371
- await t.reset({
400
+ i.has(o) ? (await t.reset({
372
401
  api: a,
373
402
  widget: r,
374
403
  placeholder: o,
@@ -376,55 +405,58 @@ function I(t) {
376
405
  options: n.options,
377
406
  provider: n.options.provider,
378
407
  reason: e
379
- }), n.services.tokens.clear(), n.services.errors.clear(o);
408
+ }), n.services.tokens.clear(), n.services.errors.clear(o)) : await m(o);
380
409
  }
381
- p.reconcile();
382
- return;
410
+ h.reconcile();
411
+ } else {
412
+ for (let e of Array.from(i.keys())) await p(e);
413
+ for (let e of r) await m(e);
414
+ h.reconcile();
383
415
  }
384
- for (let e of Array.from(i.keys())) await d(e);
385
- for (let e of r) await f(e);
386
- p.reconcile();
387
416
  };
388
417
  r.push(n.services.events.onRoot("formie:submit:result", (e) => {
389
418
  let t = e instanceof CustomEvent ? e.detail : null;
390
- t?.stage !== "validate" && (t?.ok !== !1 || t?.stage !== "challenge") && t?.ok !== !0 && m("submit-result");
419
+ t?.stage !== "validate" && (t?.ok !== !1 || t?.stage !== "challenge") && t?.ok !== !0 && g("submit-result");
391
420
  })), n.form && r.push(n.services.events.onForm(e("reset"), () => {
392
- o = n.services.placeholder.getPrimary() || o, window.setTimeout(() => {
393
- m("reset-state");
421
+ c = n.services.placeholder.getPrimary() || c, window.setTimeout(() => {
422
+ g("reset-state");
394
423
  }, 0);
395
- })), p.reconcileImmediate();
424
+ }));
425
+ let _ = () => s || (l = !0, s = (async () => {
426
+ r.forEach((e) => e()), await Promise.allSettled([...a.values()]);
427
+ let e = (await Promise.allSettled(/* @__PURE__ */ new Set([...o.values(), ...Array.from(i.keys(), p)]))).flatMap((e) => e.status === "rejected" ? [e.reason] : []);
428
+ if (e.length) throw AggregateError(e, "CAPTCHA widgets could not clean up.");
429
+ })(), s);
430
+ h.reconcileImmediate();
396
431
  try {
397
- if (await Promise.all([...a.values()]), c) throw c;
432
+ if (await Promise.all([...a.values()]), u) throw u;
398
433
  } catch (e) {
399
- throw s = !0, r.forEach((e) => e()), e;
434
+ throw await _().catch((e) => {
435
+ N.warn("Captcha cleanup after failed setup.", { error: e });
436
+ }), e;
400
437
  }
401
438
  return {
402
439
  assertReady: () => {
403
- if (c) throw c;
404
- },
405
- destroy: async () => {
406
- s = !0, r.forEach((e) => {
407
- e();
408
- });
409
- for (let e of Array.from(i.keys())) await d(e);
440
+ if (u) throw u;
410
441
  },
442
+ destroy: _,
411
443
  beforeSubmit: async (e) => {
412
444
  if (e.action !== "submit") return;
413
- p.reconcileImmediate();
414
- let r = p.getVisible();
445
+ h.reconcileImmediate();
446
+ let r = h.getVisible();
415
447
  if (r.length === 0) return;
416
- let a = r.find((e) => e === o) || r[0];
417
- await f(a), a = o || a, n.services.errors.clear(a);
418
- let s = i.get(a);
419
- if (!s) {
448
+ let a = r.find((e) => e === c) || r[0];
449
+ await m(a), a = c || a, n.services.errors.clear(a);
450
+ let o = i.get(a);
451
+ if (!i.has(a)) {
420
452
  let r = n.services.errors.getDefaultMessage();
421
453
  n.services.errors.show(r, a), N.warn("Captcha widget unavailable at challenge stage.", { moduleId: t.moduleId }), e.abort(r);
422
454
  return;
423
455
  }
424
- let c = await u();
456
+ let s = await f();
425
457
  await t.challenge({
426
- api: c,
427
- widget: s,
458
+ api: s,
459
+ widget: o,
428
460
  placeholder: a,
429
461
  services: n.services,
430
462
  options: n.options,
@@ -1,4 +1,4 @@
1
- import { t as e } from "./debug-BV0DvdHx.js";
1
+ import { t as e } from "./debug-rhzqP1j2.js";
2
2
  import { i as t, r as n, t as r } from "./constants-DVcJAvc5.js";
3
3
  //#region src/js/modules/address/host.ts
4
4
  var i = /* @__PURE__ */ new Set(["handle"]);