@verbb/formie-browser 1.0.3 → 1.0.5

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 (206) hide show
  1. package/CHANGELOG.md +65 -17
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BF5GU3_9.js +2674 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-CpgqHCEx.js +463 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-B09elPDB.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  70. package/dist/css/formie-theme.css +2 -0
  71. package/dist/css/theme/fields/_address-state.css +94 -0
  72. package/dist/css/theme/fields/_combobox.css +246 -0
  73. package/dist/css/theme/fields/_select.css +13 -0
  74. package/dist/index.js +2447 -39
  75. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  76. package/dist/js/core/field-error-container.d.ts +4 -0
  77. package/dist/js/core/field-error-container.d.ts.map +1 -0
  78. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  79. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  80. package/dist/js/core/validation-focus.d.ts +4 -0
  81. package/dist/js/core/validation-focus.d.ts.map +1 -0
  82. package/dist/js/modules/address/api.d.ts +1 -0
  83. package/dist/js/modules/address/api.d.ts.map +1 -1
  84. package/dist/js/modules/address/constants.d.ts +22 -1
  85. package/dist/js/modules/address/constants.d.ts.map +1 -1
  86. package/dist/js/modules/address/host.d.ts +2 -2
  87. package/dist/js/modules/address/host.d.ts.map +1 -1
  88. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  89. package/dist/js/modules/fields/address-country.d.ts +3 -0
  90. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  91. package/dist/js/modules/fields/address-state.d.ts +3 -0
  92. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  93. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  94. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  95. package/dist/js/modules/fields/combobox.d.ts +17 -0
  96. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  97. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  98. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  99. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  100. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  101. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  102. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  103. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  104. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  105. package/dist/js/modules/fields/index.d.ts.map +1 -1
  106. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  107. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  108. package/dist/js/submit/pipeline.d.ts.map +1 -1
  109. package/dist/js/utils/country-from-ip.d.ts +7 -0
  110. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  111. package/dist/js/utils/field-references.d.ts +1 -0
  112. package/dist/js/utils/field-references.d.ts.map +1 -1
  113. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  114. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  115. package/dist/js/utils/i18n.d.ts.map +1 -1
  116. package/dist/js/validation/rules/email.d.ts.map +1 -1
  117. package/dist/js/validation/rules/number.d.ts.map +1 -1
  118. package/dist/js/validation/validator.d.ts.map +1 -1
  119. package/package.json +6 -3
  120. package/src/css/formie-theme.css +2 -0
  121. package/src/css/theme/fields/_address-state.css +94 -0
  122. package/src/css/theme/fields/_combobox.css +246 -0
  123. package/src/css/theme/fields/_select.css +13 -0
  124. package/src/js/core/create-formie-client.ts +27 -0
  125. package/src/js/core/field-error-container.ts +39 -0
  126. package/src/js/core/submit-result-state.ts +12 -2
  127. package/src/js/core/submit-result-ui.ts +7 -13
  128. package/src/js/core/validation-focus.ts +117 -0
  129. package/src/js/modules/address/api.ts +7 -0
  130. package/src/js/modules/address/constants.ts +82 -2
  131. package/src/js/modules/address/host.ts +16 -6
  132. package/src/js/modules/address/loqate.ts +3 -17
  133. package/src/js/modules/fields/address-country.ts +156 -0
  134. package/src/js/modules/fields/address-state.ts +946 -0
  135. package/src/js/modules/fields/calculations.ts +32 -0
  136. package/src/js/modules/fields/checkbox-radio.ts +21 -15
  137. package/src/js/modules/fields/combobox.ts +188 -0
  138. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  139. package/src/js/modules/fields/custom-link.ts +95 -0
  140. package/src/js/modules/fields/custom-maps.ts +339 -0
  141. package/src/js/modules/fields/date-picker.ts +96 -3
  142. package/src/js/modules/fields/file-upload.ts +12 -9
  143. package/src/js/modules/fields/index.ts +6 -0
  144. package/src/js/modules/fields/phone-country.ts +6 -0
  145. package/src/js/modules/fields/text-limit.ts +87 -22
  146. package/src/js/submit/pipeline.ts +11 -1
  147. package/src/js/utils/country-from-ip.ts +54 -0
  148. package/src/js/utils/field-references.row-scope.ts +303 -0
  149. package/src/js/utils/field-references.ts +1 -0
  150. package/src/js/utils/i18n.ts +184 -5
  151. package/src/js/validation/rules/email.ts +3 -2
  152. package/src/js/validation/rules/match.ts +2 -2
  153. package/src/js/validation/rules/minmax.ts +4 -4
  154. package/src/js/validation/rules/number.ts +9 -5
  155. package/src/js/validation/rules/pattern.ts +4 -4
  156. package/src/js/validation/rules/required.ts +1 -1
  157. package/src/js/validation/rules/url.ts +1 -1
  158. package/src/js/validation/validator.ts +7 -7
  159. package/dist/chunks/address-finder-BjMuEiwF.js +0 -37
  160. package/dist/chunks/bpoint-KudsBCo2.js +0 -26
  161. package/dist/chunks/calculations-DlGSkQ3W.js +0 -147
  162. package/dist/chunks/captcha-eu-CterYFok.js +0 -34
  163. package/dist/chunks/checkbox-radio-CBvgk3hR.js +0 -136
  164. package/dist/chunks/conditions-DYy1-Hwt.js +0 -459
  165. package/dist/chunks/date-picker-BlD--zfe.js +0 -4994
  166. package/dist/chunks/eway-qwc-B5Us.js +0 -74
  167. package/dist/chunks/file-upload-CIgHrXfp.js +0 -316
  168. package/dist/chunks/friendly-captcha-v1-EDFac33c.js +0 -33
  169. package/dist/chunks/friendly-captcha-v2-BDpSvFGR.js +0 -38
  170. package/dist/chunks/go-cardless-DuDMVsnz.js +0 -24
  171. package/dist/chunks/google-address-Bmjp01pH.js +0 -181
  172. package/dist/chunks/hcaptcha-BTQ6An6g.js +0 -56
  173. package/dist/chunks/hidden-DbPdOxKb.js +0 -31
  174. package/dist/chunks/index-BEsfee-D.js +0 -1839
  175. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  176. package/dist/chunks/index-BcqwpPNE.js +0 -4314
  177. package/dist/chunks/loqate-BdNGv93o.js +0 -55
  178. package/dist/chunks/mollie-DFOjTuGX.js +0 -24
  179. package/dist/chunks/moneris-BbFfl-EL.js +0 -101
  180. package/dist/chunks/opayo-CmgYa9ya.js +0 -122
  181. package/dist/chunks/paddle-BUi7w1_o.js +0 -60
  182. package/dist/chunks/paypal-A-ePfh6k.js +0 -100
  183. package/dist/chunks/payway-BqFCbhyo.js +0 -56
  184. package/dist/chunks/phone-country-DPMiqk4L.js +0 -3765
  185. package/dist/chunks/place-kit-CX7tamAg.js +0 -42
  186. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  187. package/dist/chunks/recaptcha-enterprise-DxF6cW95.js +0 -71
  188. package/dist/chunks/recaptcha-shared-DhGcbiaq.js +0 -15
  189. package/dist/chunks/recaptcha-v2-checkbox-R9EfbZ4k.js +0 -41
  190. package/dist/chunks/recaptcha-v2-invisible-DV9hswAp.js +0 -59
  191. package/dist/chunks/recaptcha-v3-V0xc-Edh.js +0 -28
  192. package/dist/chunks/repeater-DKUT6TGI.js +0 -124
  193. package/dist/chunks/rich-text-SH7KiaKH.js +0 -304
  194. package/dist/chunks/scripts-D9N2d5rN.js +0 -36
  195. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  196. package/dist/chunks/shared-BmntPmnW.js +0 -80
  197. package/dist/chunks/signature-BA3tQsGT.js +0 -550
  198. package/dist/chunks/snaptcha-DV7p6J9k.js +0 -8
  199. package/dist/chunks/square-Bs-ndqYK.js +0 -46
  200. package/dist/chunks/stripe-DkZAHxtn.js +0 -202
  201. package/dist/chunks/styles-C3aqgtek.js +0 -21
  202. package/dist/chunks/summary-Dq2i9TQk.js +0 -126
  203. package/dist/chunks/table-Cu4WfVcw.js +0 -95
  204. package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
  205. package/dist/chunks/turnstile-CId90tRr.js +0 -59
  206. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -0,0 +1,412 @@
1
+ import { t as e } from "./debug-BV0DvdHx.js";
2
+ import { t } from "./field-references.keys-58ZSTrCW.js";
3
+ import { n } from "./shared-Bx9s0i0P.js";
4
+ import { i as r, n as i } from "./dist-BF5GU3_9.js";
5
+ //#region src/js/modules/fields/conditions/config.ts
6
+ var a = "[data-formie-conditions]";
7
+ function o(e) {
8
+ if (!e || typeof e != "object") return null;
9
+ let t = e, n = t.transformerParams;
10
+ return {
11
+ raw: typeof t.raw == "string" ? t.raw : "",
12
+ target: typeof t.target == "string" ? t.target : "",
13
+ handle: typeof t.handle == "string" ? t.handle : "",
14
+ selector: typeof t.selector == "string" ? t.selector : "",
15
+ defaultValue: typeof t.defaultValue == "string" ? t.defaultValue : "",
16
+ transformerId: typeof t.transformerId == "string" ? t.transformerId : "",
17
+ transformerParams: n && typeof n == "object" ? Object.fromEntries(Object.entries(n).map(([e, t]) => [e, String(t ?? "")])) : {},
18
+ isValid: t.isValid !== !1
19
+ };
20
+ }
21
+ function s(e) {
22
+ let t = Array.from(e.querySelectorAll(a));
23
+ return e.matches("[data-formie-conditions]") ? [e, ...t] : t;
24
+ }
25
+ function c(e) {
26
+ let t = e.getAttribute("data-formie-conditions");
27
+ if (!t) return null;
28
+ try {
29
+ let e = JSON.parse(t), n = Array.isArray(e.conditions) ? e.conditions.filter((e) => {
30
+ if (!e || typeof e != "object") return !1;
31
+ let t = e;
32
+ return typeof t.field == "string" && typeof t.condition == "string";
33
+ }).map((e) => {
34
+ let t = e;
35
+ return {
36
+ field: e.field,
37
+ source: o(t.source),
38
+ condition: e.condition,
39
+ value: e.value
40
+ };
41
+ }) : [];
42
+ return {
43
+ showRule: e.showRule === "hide" ? "hide" : "show",
44
+ conditionRule: e.conditionRule === "any" ? "any" : "all",
45
+ clearOnHide: e.clearOnHide !== !1,
46
+ isNested: !!e.isNested,
47
+ conditions: n
48
+ };
49
+ } catch (e) {
50
+ return console.error("[formie] Invalid condition JSON.", e), null;
51
+ }
52
+ }
53
+ //#endregion
54
+ //#region src/js/modules/fields/conditions/effects.ts
55
+ var l = "data-formie-conditions-disabled", u = "data-formie-preserve-disabled", d = "data-formie-conditionally-hidden", f = "data-formie-page-hidden", p = "formie-conditionally-hidden", m = "fui-cp-muted-conditional-field", h = "fui-cp-muted-conditional-field--expanded", g = "data-formie-cp-muted", _ = "formie-page-hidden", v = "data-formie-row-hidden", y = "formie-row-hidden", b = "data-formie-field-count", x = "[data-formie-row], [data-formie-subfield-row], [data-formie-nested-field-row]", S = ":scope > [data-formie-field]";
56
+ function C(e) {
57
+ e.querySelectorAll("input, select, textarea").forEach((e) => {
58
+ !(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement) || (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio" ? e.checked = !1 : e.type !== "hidden" && (e.value = "")), e instanceof HTMLSelectElement && (e.multiple ? Array.from(e.options).forEach((e) => {
59
+ e.selected = !1;
60
+ }) : e.selectedIndex = 0), e instanceof HTMLTextAreaElement && (e.value = ""));
61
+ });
62
+ }
63
+ function w(e, t) {
64
+ let n = e.hasAttribute("data-formie-page"), r = n ? f : d, i = n ? _ : p, a = e.hasAttribute(r);
65
+ return t ? (a || e.setAttribute(r, "true"), e.classList.contains(i) || e.classList.add(i)) : (a && e.removeAttribute(r), e.classList.contains(i) && e.classList.remove(i)), a !== t;
66
+ }
67
+ function ee(e, t) {
68
+ e.querySelectorAll("input, textarea, select").forEach((e) => {
69
+ if (t) {
70
+ e.hasAttribute(l) || (e.hasAttribute("disabled") && e.setAttribute(u, "true"), e.setAttribute(l, "true")), e.setAttribute("disabled", "true");
71
+ return;
72
+ }
73
+ e.hasAttribute(l) && (e.hasAttribute(u) ? (e.setAttribute("disabled", "true"), e.removeAttribute(u)) : e.removeAttribute("disabled"), e.removeAttribute(l));
74
+ });
75
+ }
76
+ function te(e) {
77
+ return !e.hasAttribute(d) && !e.hasAttribute(f) && !e.hasAttribute(v) && !e.hasAttribute("hidden");
78
+ }
79
+ function ne(e) {
80
+ let t = Array.from(e.querySelectorAll(S)).filter((e) => te(e)).length;
81
+ if (t > 0) {
82
+ let n = String(t);
83
+ e.getAttribute(b) !== n && e.setAttribute(b, n), e.hasAttribute(v) && e.removeAttribute(v), e.classList.contains(y) && e.classList.remove(y);
84
+ return;
85
+ }
86
+ e.hasAttribute(b) && e.removeAttribute(b), e.hasAttribute(v) || e.setAttribute(v, "true"), e.classList.contains(y) || e.classList.add(y);
87
+ }
88
+ function T(e) {
89
+ e.removeAttribute(g), e.classList.remove(m), e.classList.remove(h);
90
+ }
91
+ function E(e) {
92
+ e.removeAttribute(d), e.removeAttribute(f), e.classList.remove(p), e.classList.remove(_);
93
+ }
94
+ function D(e) {
95
+ let t = e.closest(x);
96
+ for (; t;) ne(t), t = t.parentElement?.closest(x) || null;
97
+ }
98
+ function O(e, t, n, r = {}) {
99
+ if (r.displayMode === "muted") return re(e, t);
100
+ let i = !1;
101
+ return (e.hasAttribute(g) || e.classList.contains(m) || e.classList.contains(h)) && (T(e), i = !0), i = w(e, t) || i, ee(e, t), D(e), t && n && i && C(e), i;
102
+ }
103
+ function re(e, t) {
104
+ let n = !1;
105
+ return t ? ((e.hasAttribute(d) || e.hasAttribute(f) || e.classList.contains(p) || e.classList.contains(_)) && (E(e), n = !0), e.hasAttribute(g) || (e.setAttribute(g, "true"), n = !0), e.classList.contains(m) || (e.classList.add(m), n = !0)) : ((e.hasAttribute(g) || e.classList.contains(m) || e.classList.contains(h)) && (T(e), n = !0), (e.hasAttribute(d) || e.hasAttribute(f) || e.classList.contains(p) || e.classList.contains(_)) && (E(e), n = !0)), D(e), n;
106
+ }
107
+ //#endregion
108
+ //#region src/js/modules/fields/conditions/references.ts
109
+ var k = "input, select, textarea", ie = "[data-formie-repeater-item], [data-formie-table-row]";
110
+ function A(e) {
111
+ return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
112
+ }
113
+ function ae(e) {
114
+ let t = e.querySelector(k);
115
+ if (!t) return null;
116
+ let n = t.getAttribute("name") || "", r = Array.from(n.matchAll(/\[(\d+)\]/g));
117
+ return r.length && r[r.length - 1]?.[1] || null;
118
+ }
119
+ function j(e) {
120
+ return e.closest(ie);
121
+ }
122
+ function M(e) {
123
+ return Array.from(e.querySelectorAll(k)).filter((e) => A(e));
124
+ }
125
+ function N(e) {
126
+ let t = e.getAttribute("name") || "";
127
+ return Array.from(t.matchAll(/\[([^\]]+)\]/g)).map((e) => e[1] || "").filter(Boolean);
128
+ }
129
+ function P(e, t) {
130
+ if (!t) return !0;
131
+ let n = t.split(/[.:]/).filter(Boolean);
132
+ if (!n.length) return !0;
133
+ let r = N(e);
134
+ return r.length < n.length ? !1 : n.every((e, t) => r[r.length - n.length + t] === e);
135
+ }
136
+ function F(e, t) {
137
+ if (!t) return e;
138
+ let n = e.filter((e) => P(e, t));
139
+ return n.length ? n : e;
140
+ }
141
+ function I(e, t) {
142
+ let n = j(e);
143
+ if (!n) return t;
144
+ let r = t.filter((e) => j(e) === n);
145
+ return r.length ? r : t;
146
+ }
147
+ function L(e) {
148
+ return e.source?.target === "field" && e.source.handle ? e.source : null;
149
+ }
150
+ function R(e, r, i) {
151
+ let a = L(i);
152
+ if (!a || a.target !== "field" || !a.handle) return [];
153
+ let o = n(a.handle), s = Array.from(e.querySelectorAll(`[data-formie-field-handle="${o}"]`));
154
+ if (s.length) return I(r, s).flatMap((e) => F(M(e), a.selector));
155
+ let c = n(t(a.handle)), l = Array.from(e.querySelectorAll(`[name="${c}"]`)).filter((e) => A(e)), u = Array.from(e.querySelectorAll(`[name="${c}[]"]`)).filter((e) => A(e));
156
+ if (l.length || u.length) return I(r, [...l, ...u]);
157
+ if (!a.handle.includes("__ROW__")) return [];
158
+ let d = ae(r);
159
+ if (d) {
160
+ let r = n(t(a.handle.replace(/__ROW__/g, d))), i = Array.from(e.querySelectorAll(`[name="${r}"]`)).filter((e) => A(e)), o = Array.from(e.querySelectorAll(`[name="${r}[]"]`)).filter((e) => A(e));
161
+ if (i.length || o.length) return [...i, ...o];
162
+ }
163
+ let f = t(a.handle).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/__ROW__/g, "\\d+"), p = new RegExp(f);
164
+ return Array.from(e.querySelectorAll("[name]")).filter((e) => A(e) && p.test(e.getAttribute("name") || ""));
165
+ }
166
+ //#endregion
167
+ //#region src/js/modules/fields/conditions/transforms.ts
168
+ function z(e) {
169
+ return e == null ? "" : String(e);
170
+ }
171
+ function B(e) {
172
+ if (typeof e == "boolean") return e;
173
+ if (typeof e == "number") return e !== 0;
174
+ let t = z(e).trim().toLowerCase();
175
+ return !(!t || [
176
+ "0",
177
+ "false",
178
+ "no",
179
+ "off"
180
+ ].includes(t));
181
+ }
182
+ function V(e) {
183
+ return e.toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase());
184
+ }
185
+ function H(e, t) {
186
+ let n = Number.isFinite(Number(t.decimals)) ? Number(t.decimals) : 0, r = t.decimalPoint ?? ".", i = t.thousandsSeparator ?? ",", [a, o = ""] = e.toFixed(n).split("."), s = a.replace(/\B(?=(\d{3})+(?!\d))/g, i);
187
+ return n === 0 ? s : `${s}${r}${o}`;
188
+ }
189
+ function U(e) {
190
+ return String(e).padStart(2, "0");
191
+ }
192
+ function W(e, t) {
193
+ return [
194
+ ["Y", String(e.getFullYear())],
195
+ ["m", U(e.getMonth() + 1)],
196
+ ["d", U(e.getDate())],
197
+ ["j", String(e.getDate())],
198
+ ["H", U(e.getHours())],
199
+ ["h", U((e.getHours() + 11) % 12 + 1)],
200
+ ["i", U(e.getMinutes())],
201
+ ["A", e.getHours() >= 12 ? "PM" : "AM"],
202
+ ["F", e.toLocaleString(void 0, { month: "long" })]
203
+ ].reduce((e, [t, n]) => e.replaceAll(t, n), t);
204
+ }
205
+ function G(e) {
206
+ switch (e) {
207
+ case "datetimeUs12": return "m/d/Y h:i A";
208
+ case "datetimeEu12": return "d/m/Y h:i A";
209
+ case "datetimeEu24": return "d/m/Y H:i";
210
+ case "datetimeIso24": return "Y-m-d H:i";
211
+ case "dateUs": return "m/d/Y";
212
+ case "dateEu": return "d/m/Y";
213
+ case "isoDate": return "Y-m-d";
214
+ case "dateLong": return "F j, Y";
215
+ case "time12": return "h:i A";
216
+ case "time24": return "H:i";
217
+ default: return "";
218
+ }
219
+ }
220
+ function K(e, t) {
221
+ let n = t.transformerId, r = t.transformerParams;
222
+ switch (n) {
223
+ case "round":
224
+ case "floor":
225
+ case "ceil": {
226
+ let t = Number(e);
227
+ return Number.isFinite(t) ? String(n === "round" ? Math.round(t) : n === "floor" ? Math.floor(t) : Math.ceil(t)) : e;
228
+ }
229
+ case "format": {
230
+ let t = Number(e);
231
+ if (Number.isFinite(t) && e.trim() !== "") return H(t, r);
232
+ let n = r.preset || "", i = n === "custom" ? r.pattern || "" : G(n);
233
+ if (!i) return e;
234
+ let a = new Date(e);
235
+ return Number.isNaN(a.getTime()) ? e : W(a, i);
236
+ }
237
+ case "lower": return e.toLowerCase();
238
+ case "upper": return e.toUpperCase();
239
+ case "title": return V(e);
240
+ case "capitalize": return e && e.charAt(0).toUpperCase() + e.slice(1);
241
+ case "replace": {
242
+ let t = r.search || "";
243
+ return t ? e.split(t).join(r.replace || "") : e;
244
+ }
245
+ case "truncate": {
246
+ let t = Math.max(1, Number.parseInt(r.length || "50", 10) || 50), n = r.suffix || "...";
247
+ return e.length <= t ? e : `${e.slice(0, Math.max(0, t - n.length))}${n}`;
248
+ }
249
+ case "map": return B(e) ? r.trueLabel || "Yes" : r.falseLabel || "No";
250
+ default: return e;
251
+ }
252
+ }
253
+ function q(e, t) {
254
+ if (!t) return e;
255
+ let n = t.transformerId ? e.map((e) => K(e, t)) : e;
256
+ return (n.length === 0 || n.every((e) => e.trim() === "")) && t.defaultValue ? [t.defaultValue] : n;
257
+ }
258
+ //#endregion
259
+ //#region src/js/modules/fields/conditions/values.ts
260
+ function oe(e, t) {
261
+ return e.name || `__condition_input_${t}`;
262
+ }
263
+ function J(e) {
264
+ return (e.id ? e.ownerDocument.querySelector(`label[for="${e.id}"]`)?.textContent?.trim() : "") || e.closest("label")?.textContent?.trim() || "";
265
+ }
266
+ function se(e, t = "") {
267
+ let n = e[0];
268
+ if (!n) return [];
269
+ if (n instanceof HTMLInputElement) {
270
+ if (n.type === "checkbox") {
271
+ let n = e.filter((e) => e instanceof HTMLInputElement && e.checked);
272
+ return t === "label" ? n.map((e) => J(e)).filter(Boolean) : n.map((e) => e.value);
273
+ }
274
+ if (n.type === "radio") {
275
+ let n = e.filter((e) => e instanceof HTMLInputElement && e.checked);
276
+ return t === "label" ? n.map((e) => J(e)).filter(Boolean) : n.map((e) => e.value);
277
+ }
278
+ if (n.type === "file") return Array.from(n.files || []).map((e) => e.name);
279
+ }
280
+ return n instanceof HTMLSelectElement && n.multiple ? t === "label" ? Array.from(n.selectedOptions).map((e) => e.label || e.text) : Array.from(n.selectedOptions).map((e) => e.value) : n instanceof HTMLSelectElement && t === "label" ? Array.from(n.selectedOptions).map((e) => e.label || e.text) : e.map((e) => e.value);
281
+ }
282
+ function Y(e) {
283
+ return ["input", "change"];
284
+ }
285
+ function ce(e, t = null) {
286
+ let n = /* @__PURE__ */ new Map();
287
+ return e.forEach((e, t) => {
288
+ let r = oe(e, t), i = n.get(r) || [];
289
+ i.push(e), n.set(r, i);
290
+ }), q(Array.from(n.values()).flatMap((e) => se(e, t?.selector || "")), t);
291
+ }
292
+ //#endregion
293
+ //#region src/js/modules/fields/conditions/evaluator.ts
294
+ function le(e) {
295
+ return e.closest("[data-formie-conditionally-hidden]") || e.closest("[data-formie-page-hidden]") || e.closest("[hidden]") || e.closest("[aria-hidden=\"true\"]") ? !1 : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
296
+ }
297
+ function X(e) {
298
+ return e.length ? e.some((e) => le(e)) : null;
299
+ }
300
+ function ue(e, t) {
301
+ return i(e, e.conditions.map((e) => {
302
+ let n = t(e);
303
+ return r(e, ce(n, L(e)), { visibility: X(n) });
304
+ }));
305
+ }
306
+ //#endregion
307
+ //#region src/js/modules/fields/conditions.ts
308
+ var Z = 4, Q = e("conditions");
309
+ function $(e) {
310
+ let t = /* @__PURE__ */ new Set();
311
+ return e.filter((e) => t.has(e) ? !1 : (t.add(e), !0));
312
+ }
313
+ var de = {
314
+ id: "conditions",
315
+ kind: "field",
316
+ match: (e) => e.target instanceof HTMLElement && (e.target.matches("[data-formie-conditions]") || !!e.target.querySelector("[data-formie-conditions]")),
317
+ setup: async (e) => {
318
+ let t = e.target instanceof HTMLElement ? e.target : e.root;
319
+ if (!s(t).length) {
320
+ Q.log("No condition nodes in scope.");
321
+ return;
322
+ }
323
+ let n = [], r = [], i = !1, a = !1, o = () => {
324
+ n.forEach((e) => {
325
+ e();
326
+ }), n.length = 0;
327
+ }, l = () => s(t).flatMap((e) => {
328
+ let n = c(e);
329
+ return !n || !n.conditions.length ? [] : [{
330
+ node: e,
331
+ settings: n,
332
+ sourceInputs: $(n.conditions.flatMap((n) => R(t, e, n)))
333
+ }];
334
+ }), u = e.options?.cpDisplayMode === "muted" ? "muted" : "hide", d = !1, f = () => {
335
+ let n = !1;
336
+ return r.forEach((r) => {
337
+ let i = ue(r.settings, (e) => R(t, r.node, e)), a = r.node.hasAttribute("data-formie-page") ? "hide" : u, o = O(r.node, i.shouldHide, r.settings.clearOnHide, { displayMode: a });
338
+ n ||= o, Q.log("Condition evaluated.", {
339
+ shouldHide: i.shouldHide,
340
+ finalResult: i.finalResult,
341
+ stateChanged: o
342
+ }), e.emit("formie:conditions:evaluated", {
343
+ node: r.node,
344
+ shouldHide: i.shouldHide,
345
+ finalResult: i.finalResult,
346
+ clearOnHide: r.settings.clearOnHide
347
+ });
348
+ }), n;
349
+ }, p = () => {
350
+ if (!d) {
351
+ d = !0;
352
+ try {
353
+ for (let e = 0; e < Z && f(); e += 1) e === Z - 1 && Q.warn("Reached max evaluation passes.", { maxPasses: Z });
354
+ } finally {
355
+ d = !1;
356
+ }
357
+ }
358
+ }, m = () => {
359
+ d || i || (i = !0, requestAnimationFrame(() => {
360
+ i = !1, !d && p();
361
+ }));
362
+ }, h = () => {
363
+ if ($(r.flatMap((e) => e.sourceInputs)).forEach((e) => {
364
+ let t = () => {
365
+ m();
366
+ };
367
+ Y(e).forEach((n) => {
368
+ e.addEventListener(n, t);
369
+ }), n.push(() => {
370
+ Y(e).forEach((n) => {
371
+ e.removeEventListener(n, t);
372
+ });
373
+ });
374
+ }), e.form) {
375
+ let t = () => {
376
+ window.setTimeout(() => {
377
+ m();
378
+ }, 0);
379
+ };
380
+ e.form.addEventListener("reset", t), n.push(() => {
381
+ e.form?.removeEventListener("reset", t);
382
+ });
383
+ }
384
+ }, g = () => {
385
+ o(), r = l(), h(), Q.log("Rebuilt condition graph.", { entryCount: r.length }), m();
386
+ }, _ = () => {
387
+ d || a || (a = !0, requestAnimationFrame(() => {
388
+ a = !1, !d && g();
389
+ }));
390
+ }, v = new MutationObserver((e) => {
391
+ if (d) return;
392
+ let t = e.some((e) => e.type === "childList" && (e.addedNodes.length > 0 || e.removedNodes.length > 0)), n = e.some((e) => e.type === "attributes");
393
+ t ? _() : n && m();
394
+ });
395
+ return v.observe(t, {
396
+ childList: !0,
397
+ subtree: !0,
398
+ attributes: !0,
399
+ attributeFilter: [
400
+ "hidden",
401
+ "aria-hidden",
402
+ "data-formie-conditionally-hidden",
403
+ "data-formie-page-hidden",
404
+ "data-formie-row-hidden"
405
+ ]
406
+ }), g(), await e.emit("formie:module:conditions:init", { count: r.length }), Q.log("Module setup complete.", { entryCount: r.length }), { destroy: () => {
407
+ o(), v.disconnect(), Q.log("Module destroy."), e.emit("formie:module:conditions:destroy", {});
408
+ } };
409
+ }
410
+ };
411
+ //#endregion
412
+ export { de as conditionsModule };
@@ -0,0 +1,38 @@
1
+ //#region src/js/modules/address/constants.ts
2
+ var e = "[data-formie-address-autocomplete-input]", t = "[data-formie-address-location]", n = {
3
+ autoComplete: "[data-formie-address-autocomplete-input]",
4
+ address1: "[data-formie-address-line1-input]",
5
+ address2: "[data-formie-address-line2-input]",
6
+ address3: "[data-formie-address-line3-input]",
7
+ city: "[data-formie-address-city-input]",
8
+ state: "[data-formie-address-state-input]",
9
+ zip: "[data-formie-address-zip-input]",
10
+ country: "[data-formie-address-country-input]"
11
+ }, r = {
12
+ autoComplete: "[data-formie-address-autocomplete-input]",
13
+ address1: "[data-address1]",
14
+ address2: "[data-address2]",
15
+ address3: "[data-address3]",
16
+ city: "[data-city]",
17
+ state: "[data-state]",
18
+ zip: "[data-zip]",
19
+ country: "[data-country]"
20
+ }, i = {
21
+ autoComplete: [n.autoComplete, r.autoComplete],
22
+ address1: [n.address1, r.address1],
23
+ address2: [n.address2, r.address2],
24
+ address3: [n.address3, r.address3],
25
+ city: [n.city, r.city],
26
+ state: [n.state, r.state],
27
+ zip: [n.zip, r.zip],
28
+ country: [n.country, r.country]
29
+ };
30
+ function a(e, t) {
31
+ for (let n of i[t]) {
32
+ let t = e.querySelector(n);
33
+ if (t instanceof HTMLInputElement || t instanceof HTMLSelectElement) return t;
34
+ }
35
+ return null;
36
+ }
37
+ //#endregion
38
+ export { a as i, n, e as r, t };
@@ -0,0 +1,26 @@
1
+ //#region src/js/utils/country-from-ip.ts
2
+ var e = "formie/address/country-from-ip", t = null;
3
+ function n(e) {
4
+ return new URL(e.startsWith("/") ? e : `/actions/${e}`, window.location.origin).toString();
5
+ }
6
+ async function r(r = e) {
7
+ return t ||= (async () => {
8
+ try {
9
+ let e = await fetch(n(r), { headers: { Accept: "application/json" } });
10
+ if (!e.ok) return null;
11
+ let t = await e.json();
12
+ return t?.countryCode ? t : null;
13
+ } catch {
14
+ return null;
15
+ }
16
+ })(), t;
17
+ }
18
+ function i(t = e) {
19
+ return (e) => {
20
+ r(t).then((t) => {
21
+ e(t?.countryCode?.toLowerCase() || "");
22
+ });
23
+ };
24
+ }
25
+ //#endregion
26
+ export { r as n, i as t };
@@ -0,0 +1,194 @@
1
+ import { i as e, s as t } from "./shared-Bx9s0i0P.js";
2
+ //#region src/js/modules/fields/custom-google-maps.ts
3
+ var n = "custom-google-maps", r = "[data-formie-custom-google-maps]", i = null;
4
+ function a(e) {
5
+ return e instanceof HTMLElement && e.matches(r);
6
+ }
7
+ function o(e) {
8
+ let t = e.getAttribute("data-formie-custom-google-maps-settings");
9
+ if (!t) return {};
10
+ try {
11
+ return JSON.parse(t);
12
+ } catch {
13
+ return {};
14
+ }
15
+ }
16
+ function s(e) {
17
+ let t = {};
18
+ return e.querySelectorAll("[data-formie-custom-google-maps-field]").forEach((e) => {
19
+ let n = e.getAttribute("data-formie-custom-google-maps-field");
20
+ n && (t[n] = e);
21
+ }), {
22
+ root: e,
23
+ canvas: e.querySelector("[data-formie-custom-google-maps-canvas]"),
24
+ searchInput: e.querySelector("[data-formie-custom-google-maps-search]"),
25
+ currentLocationButton: e.querySelector("[data-formie-custom-google-maps-current-location]"),
26
+ inputs: t
27
+ };
28
+ }
29
+ function c(e) {
30
+ if (e == null || e === "") return null;
31
+ let t = Number(e);
32
+ return Number.isFinite(t) ? t : null;
33
+ }
34
+ function l(e, t) {
35
+ return {
36
+ lat: c(e.inputs.lat?.value) ?? t.defaultLat ?? -37.7841813,
37
+ lng: c(e.inputs.lng?.value) ?? t.defaultLng ?? 144.9378721
38
+ };
39
+ }
40
+ function u(e, t) {
41
+ return c(e.inputs.zoom?.value) ?? t.defaultZoom ?? 11;
42
+ }
43
+ function d(e, t) {
44
+ e && (e.value = t == null ? "" : String(t), e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 })));
45
+ }
46
+ function f(e) {
47
+ return new Promise((t, n) => {
48
+ let r = Array.from(document.scripts).find((t) => t.src === e);
49
+ if (window.google?.maps?.places) {
50
+ t();
51
+ return;
52
+ }
53
+ if (r) {
54
+ r.addEventListener("load", () => t(), { once: !0 }), r.addEventListener("error", () => n(/* @__PURE__ */ Error(`Failed to load ${e}`)), { once: !0 });
55
+ return;
56
+ }
57
+ let i = document.createElement("script");
58
+ i.src = e, i.async = !0, i.onload = () => t(), i.onerror = () => n(/* @__PURE__ */ Error(`Failed to load ${e}`)), document.head.appendChild(i);
59
+ });
60
+ }
61
+ function p(e) {
62
+ return new Promise((t) => {
63
+ window.setTimeout(t, e);
64
+ });
65
+ }
66
+ async function m(e = 12e3, t = 50) {
67
+ let n = Date.now();
68
+ for (; Date.now() - n < e;) {
69
+ let e = window.google?.maps;
70
+ if (e?.importLibrary) try {
71
+ e.Map || await e.importLibrary("maps"), e.Marker || await e.importLibrary("marker"), e.places?.Autocomplete || await e.importLibrary("places");
72
+ } catch {}
73
+ if (window.google?.maps?.Map && window.google.maps.Marker && window.google.maps.places?.Autocomplete) return window.google;
74
+ await p(t);
75
+ }
76
+ throw Error("Google Maps Places API did not initialize.");
77
+ }
78
+ function h(e) {
79
+ return e.apiUrl ? (i ||= f(e.apiUrl).then(() => m()), i) : Promise.reject(/* @__PURE__ */ Error("Google Maps API URL is missing."));
80
+ }
81
+ function g(e, t, n = !1) {
82
+ let r = e?.find((e) => e.types.includes(t));
83
+ return n ? r?.short_name || "" : r?.long_name || "";
84
+ }
85
+ function _(e) {
86
+ let t = e.address_components || [], n = [g(t, "street_number"), g(t, "route")].filter(Boolean).join(" "), r = e.geometry?.location?.lat(), i = e.geometry?.location?.lng();
87
+ return {
88
+ formatted: e.formatted_address || "",
89
+ raw: JSON.stringify(e),
90
+ name: e.name || "",
91
+ street1: n,
92
+ city: g(t, "locality") || g(t, "postal_town") || g(t, "administrative_area_level_2"),
93
+ state: g(t, "administrative_area_level_1", !0),
94
+ zip: g(t, "postal_code"),
95
+ neighborhood: g(t, "neighborhood") || g(t, "sublocality"),
96
+ county: g(t, "administrative_area_level_2"),
97
+ country: g(t, "country"),
98
+ countryCode: g(t, "country", !0),
99
+ placeId: e.place_id || "",
100
+ lat: r === void 0 ? "" : String(r),
101
+ lng: i === void 0 ? "" : String(i)
102
+ };
103
+ }
104
+ function v(e, t, n, r) {
105
+ Object.entries(t).forEach(([t, n]) => {
106
+ d(e.inputs[t], n);
107
+ }), t.formatted !== void 0 && d(e.searchInput, t.formatted);
108
+ let i = c(t.lat), a = c(t.lng);
109
+ if (i !== null && a !== null) {
110
+ let e = {
111
+ lat: i,
112
+ lng: a
113
+ };
114
+ r?.setPosition(e), n?.setCenter(e);
115
+ }
116
+ }
117
+ async function y(e, t) {
118
+ let n = await h(t), r = l(e, t), i = u(e, t), a, o;
119
+ e.canvas && (a = new n.maps.Map(e.canvas, {
120
+ center: r,
121
+ zoom: i,
122
+ minZoom: t.minZoom ?? void 0,
123
+ maxZoom: t.maxZoom ?? void 0
124
+ }), o = new n.maps.Marker({
125
+ position: r,
126
+ map: a,
127
+ draggable: !0
128
+ }), a.addListener("click", (t) => {
129
+ let n = t.latLng?.lat(), r = t.latLng?.lng();
130
+ n === void 0 || r === void 0 || v(e, {
131
+ lat: n,
132
+ lng: r,
133
+ zoom: a?.getZoom() || i
134
+ }, a, o);
135
+ }), o.addListener("dragend", () => {
136
+ let t = o?.getPosition();
137
+ t && v(e, {
138
+ lat: t.lat(),
139
+ lng: t.lng(),
140
+ zoom: a?.getZoom() || i
141
+ }, a, o);
142
+ }));
143
+ let s = null;
144
+ e.searchInput && (s = new n.maps.places.Autocomplete(e.searchInput, {
145
+ fields: [
146
+ "address_components",
147
+ "formatted_address",
148
+ "geometry",
149
+ "name",
150
+ "place_id"
151
+ ],
152
+ componentRestrictions: t.country ? { country: t.country.toLowerCase() } : void 0
153
+ }), s.addListener("place_changed", () => {
154
+ let t = s?.getPlace();
155
+ t && v(e, _(t), a, o);
156
+ }));
157
+ let c = () => {
158
+ navigator.geolocation?.getCurrentPosition((t) => {
159
+ v(e, {
160
+ lat: t.coords.latitude,
161
+ lng: t.coords.longitude,
162
+ zoom: a?.getZoom() || i
163
+ }, a, o);
164
+ });
165
+ };
166
+ return e.currentLocationButton?.addEventListener("click", c), () => {
167
+ e.currentLocationButton?.removeEventListener("click", c);
168
+ };
169
+ }
170
+ function b(e) {
171
+ let t = s(e), n = o(e), r = null, i = !1;
172
+ return y(t, n).then((e) => {
173
+ if (i) {
174
+ e();
175
+ return;
176
+ }
177
+ r = e;
178
+ }).catch((e) => {
179
+ console.warn("[Formie] Unable to initialize Google Maps custom field.", e);
180
+ }), () => {
181
+ i = !0, r?.();
182
+ };
183
+ }
184
+ var x = {
185
+ id: n,
186
+ kind: "field",
187
+ match: ({ target: e }) => e instanceof Element && (e.matches(r) || !!e.querySelector(r)),
188
+ setup: async (n) => {
189
+ let i = e(n) || n.target;
190
+ if (i instanceof Element) return { destroy: t(i, r, a, b) };
191
+ }
192
+ };
193
+ //#endregion
194
+ export { x as customGoogleMapsModule };