@verbb/formie-browser 1.0.0 → 1.0.2

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 (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/address-finder-CQW81kY0.js +37 -0
  3. package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
  4. package/dist/chunks/calculations-BqZsENCq.js +147 -0
  5. package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
  6. package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
  7. package/dist/chunks/conditions-BVl6jTYo.js +433 -0
  8. package/dist/chunks/date-picker-69TgvErA.js +4994 -0
  9. package/dist/chunks/eway-1GPxH6DU.js +74 -0
  10. package/dist/chunks/file-upload-BDZZftgL.js +281 -0
  11. package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
  12. package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
  13. package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
  14. package/dist/chunks/google-address-BcTBncyS.js +162 -0
  15. package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
  16. package/dist/chunks/hidden-D8RqSPt7.js +31 -0
  17. package/dist/chunks/index-BEsfee-D.js +1839 -0
  18. package/dist/chunks/index-BP7Unm5Y.js +863 -0
  19. package/dist/chunks/index-C1ZOKiAi.js +4229 -0
  20. package/dist/chunks/loqate-nXuTX7In.js +55 -0
  21. package/dist/chunks/mollie-qdCynQCd.js +24 -0
  22. package/dist/chunks/moneris-BNEA-laO.js +101 -0
  23. package/dist/chunks/opayo-BJtXOkuK.js +122 -0
  24. package/dist/chunks/paddle-D72Pa8kr.js +60 -0
  25. package/dist/chunks/paypal-Cqt2bned.js +100 -0
  26. package/dist/chunks/payway-BjCqsc0H.js +56 -0
  27. package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
  28. package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
  29. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
  30. package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
  31. package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
  32. package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
  33. package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
  34. package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
  35. package/dist/chunks/repeater-CB7Yojvx.js +124 -0
  36. package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
  37. package/dist/chunks/scripts-BkAAux0i.js +36 -0
  38. package/dist/chunks/sdk-3SicTWby.js +1559 -0
  39. package/dist/chunks/shared-DGqeMvcJ.js +80 -0
  40. package/dist/chunks/signature-BT6CsQ6n.js +550 -0
  41. package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
  42. package/dist/chunks/square-C5AH3trb.js +46 -0
  43. package/dist/chunks/stripe-EJK0RyUv.js +202 -0
  44. package/dist/chunks/styles-C3aqgtek.js +21 -0
  45. package/dist/chunks/summary-DC_ipXCU.js +126 -0
  46. package/dist/chunks/table-BEAI99qo.js +95 -0
  47. package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
  48. package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
  49. package/dist/chunks/utils-BntI3W4S.js +6149 -0
  50. package/dist/index.js +39 -3205
  51. package/package.json +5 -5
  52. package/src/js/modules/fields/file-upload.ts +1 -1
  53. package/src/js/modules/fields/repeater.ts +1 -1
  54. package/src/js/modules/fields/rich-text.ts +2 -2
  55. package/src/js/modules/fields/signature.ts +1 -1
  56. package/src/js/modules/fields/summary.ts +1 -1
  57. package/src/js/modules/fields/table.ts +1 -1
  58. package/src/js/modules/fields/text-limit.ts +1 -1
  59. package/src/js/modules/payments/paypal.ts +1 -1
  60. package/src/js/modules/payments/payway.ts +1 -1
  61. package/src/js/modules/payments/stripe.ts +1 -1
  62. package/dist/chunks/address-finder-DfMCiW89.js +0 -47
  63. package/dist/chunks/api-CbqEMQT5.js +0 -181
  64. package/dist/chunks/api-DE7LfK-R.js +0 -960
  65. package/dist/chunks/api-DOfDzYC_.js +0 -538
  66. package/dist/chunks/async-B3DUf1GZ.js +0 -26
  67. package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
  68. package/dist/chunks/calculations-CkYAqO_-.js +0 -197
  69. package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
  70. package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
  71. package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
  72. package/dist/chunks/conditions-4fXKhEJS.js +0 -609
  73. package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
  74. package/dist/chunks/debug-KnZeKYBI.js +0 -39
  75. package/dist/chunks/dist-D09GnXMW.js +0 -2663
  76. package/dist/chunks/event-names-DamGPtXR.js +0 -51
  77. package/dist/chunks/eway-DEAYcwT0.js +0 -86
  78. package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
  79. package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
  80. package/dist/chunks/file-upload-Bh63PQSE.js +0 -430
  81. package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
  82. package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
  83. package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
  84. package/dist/chunks/go-cardless-CuND59rR.js +0 -26
  85. package/dist/chunks/google-address--uR8WDSm.js +0 -208
  86. package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
  87. package/dist/chunks/hidden-CYnZYple.js +0 -36
  88. package/dist/chunks/http-18nn97DZ.js +0 -29
  89. package/dist/chunks/i18n-vUh-KGiH.js +0 -55
  90. package/dist/chunks/loqate-BICNJlVK.js +0 -97
  91. package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
  92. package/dist/chunks/moneris-B_IFZFTx.js +0 -159
  93. package/dist/chunks/opayo-U2x_TOII.js +0 -192
  94. package/dist/chunks/paddle-BqXFrc79.js +0 -75
  95. package/dist/chunks/paypal-Cn_DYGDb.js +0 -121
  96. package/dist/chunks/payway-Rnq796eC.js +0 -75
  97. package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
  98. package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
  99. package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
  100. package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
  101. package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
  102. package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
  103. package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
  104. package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
  105. package/dist/chunks/repeater-CXD1eLSn.js +0 -151
  106. package/dist/chunks/rich-text-DkmZRhGj.js +0 -442
  107. package/dist/chunks/scripts-BGD_iU_6.js +0 -41
  108. package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
  109. package/dist/chunks/shared-DC6_1u8X.js +0 -85
  110. package/dist/chunks/signature-E9KyYXS1.js +0 -765
  111. package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
  112. package/dist/chunks/square-BLqK51rS.js +0 -61
  113. package/dist/chunks/stripe-B8gHpZNC.js +0 -273
  114. package/dist/chunks/styles-BIh6g7V_.js +0 -22
  115. package/dist/chunks/summary-EcNE0cvg.js +0 -191
  116. package/dist/chunks/table-yxEDL6kA.js +0 -124
  117. package/dist/chunks/text-limit-D0H_Ca2c.js +0 -179
  118. package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
  119. package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
  120. package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
@@ -0,0 +1,74 @@
1
+ import { u as f, w } from "./index-C1ZOKiAi.js";
2
+ import { l as m } from "./scripts-BkAAux0i.js";
3
+ const s = [
4
+ {
5
+ id: "FORMIE_EWAY_SCRIPT_MIN",
6
+ src: "https://secure.ewaypayments.com/scripts/eCrypt.min.js"
7
+ },
8
+ {
9
+ id: "FORMIE_EWAY_SCRIPT",
10
+ src: "https://secure.ewaypayments.com/scripts/eCrypt.js"
11
+ }
12
+ ];
13
+ async function i() {
14
+ let t = null;
15
+ for (const r of s) {
16
+ try {
17
+ return await m("eCrypt", {
18
+ id: r.id,
19
+ src: r.src,
20
+ timeoutMs: 1e4
21
+ }), await w(() => {
22
+ const o = window.eCrypt;
23
+ return o && typeof o.encryptValue == "function" ? o : null;
24
+ }, {
25
+ timeoutMs: 1e4,
26
+ intervalMs: 50
27
+ });
28
+ } catch (e) {
29
+ t = e instanceof Error ? e : new Error("Unknown eWay script load error.");
30
+ }
31
+ s.forEach(({ id: e }) => {
32
+ document.getElementById(e)?.remove();
33
+ });
34
+ }
35
+ throw t || new Error("Eway encryption script failed to load.");
36
+ }
37
+ const C = f({
38
+ id: "eway",
39
+ defaultRequiredInputSuffixes: ["ewayTokenData"],
40
+ load: async (t) => {
41
+ const { provider: r } = t.options;
42
+ return r.cseKey?.trim() ? i() : (console.error("[formie] Missing cseKey for Eway."), null);
43
+ },
44
+ onBeforeAuthorize: async (t) => {
45
+ const { field: r, services: e, provider: o, api: y } = t, n = o.cseKey;
46
+ if (!n?.trim())
47
+ return e.addError("Missing cseKey for Eway."), !1;
48
+ let c = y;
49
+ if (!c?.encryptValue)
50
+ try {
51
+ c = await i();
52
+ } catch (a) {
53
+ return e.addError(a instanceof Error ? a.message : "Eway encryption script failed to load."), !1;
54
+ }
55
+ const d = r.querySelector('[data-eway-card="cardholder-name"]')?.value ?? "", u = r.querySelector('[data-eway-card="card-number"]')?.value ?? "", l = r.querySelector('[data-eway-card="expiry-date"]')?.value ?? "", p = r.querySelector('[data-eway-card="security-code"]')?.value ?? "";
56
+ try {
57
+ const a = {
58
+ cardholderName: d,
59
+ cardNumber: c.encryptValue(u, n),
60
+ expiryDate: l,
61
+ securityCode: c.encryptValue(p, n)
62
+ };
63
+ return e.updateInputs("ewayTokenData", JSON.stringify(a)), !0;
64
+ } catch (a) {
65
+ return e.addError(a instanceof Error ? a.message : "Failed to encrypt card details."), !1;
66
+ }
67
+ },
68
+ onAfterSubmit: async ({ services: t }) => {
69
+ t.updateInputs("ewayTokenData", "");
70
+ }
71
+ });
72
+ export {
73
+ C as ewayModule
74
+ };
@@ -0,0 +1,281 @@
1
+ import { b as R, r as D, d as K, a as P } from "./shared-DGqeMvcJ.js";
2
+ import { e as V } from "./styles-C3aqgtek.js";
3
+ import { k as C, l as x, m as O } from "./index-C1ZOKiAi.js";
4
+ const B = "@layer formie-theme{.formie-file-input{padding:var(--formie-space-1);line-height:var(--formie-line-height-base);cursor:pointer}.formie-file-input::file-selector-button,.formie-file-input::-webkit-file-upload-button{appearance:none;-webkit-appearance:none;margin-inline-end:var(--formie-space-2);padding:calc(var(--formie-control-padding-y) - 1px) var(--formie-space-2);min-height:calc(var(--formie-control-height) - (var(--formie-space-1) * 2));border:var(--formie-border-width) solid var(--formie-color-border);border-radius:calc(var(--formie-radius-sm) - 1px);background:var(--formie-color-surface-subtle);color:var(--formie-color-heading);font-weight:var(--formie-font-weight-normal);font-size:var(--formie-font-size-xs);line-height:1.1;white-space:nowrap;cursor:pointer;transition:border-color .15s ease,background-color .15s ease,color .15s ease,box-shadow .15s ease}.formie-file-input:hover::file-selector-button,.formie-file-input:hover::-webkit-file-upload-button{border-color:color-mix(in srgb,var(--formie-color-border) 70%,var(--formie-color-heading) 30%);background:var(--formie-color-surface-muted)}.formie-file-input:focus{outline:0}.formie-file-input:focus-visible::file-selector-button,.formie-file-input:focus-visible::-webkit-file-upload-button{border-color:var(--formie-color-focus-ring)}.formie-field-has-error .formie-file-input::file-selector-button,.formie-field-has-error .formie-file-input::-webkit-file-upload-button{border-color:var(--formie-color-danger)}.formie-file-summary{padding:var(--formie-file-summary-padding);gap:var(--formie-gap-file-summary);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm)}.formie-file-summary-container{margin:0;padding-left:var(--formie-list-indent)}}", F = 'input[type="file"][data-formie-file-input]', N = C("uploaded"), L = x("reset"), q = "data-formie-file-upload-key", j = "data-formie-file-upload-hydrate-endpoint", b = "data-formie-file-upload-anchor", Y = "data-formie-file-upload-asset-id", $ = [
5
+ "fileLimit",
6
+ "fileSizeMinLimit",
7
+ "fileSizeMaxLimit"
8
+ ], U = "file-upload", I = "file-upload";
9
+ V(I, [B]);
10
+ function A(e) {
11
+ return !!e && typeof e == "object" && !Array.isArray(e);
12
+ }
13
+ function v(e) {
14
+ const r = Number(e);
15
+ return Number.isInteger(r) && r > 0 ? r : null;
16
+ }
17
+ function p(e) {
18
+ return typeof e == "string" ? e.trim() : "";
19
+ }
20
+ function J(e) {
21
+ return e.getAttribute("data-formie-field-handle")?.trim() || "";
22
+ }
23
+ function H(e) {
24
+ return e.name.endsWith("[]") ? e.name.slice(0, -2) : e.name;
25
+ }
26
+ function _(e) {
27
+ return `${H(e)}[]`;
28
+ }
29
+ function W(e) {
30
+ return e.getAttribute(q)?.trim() || e.getAttribute("data-formie-input-id")?.trim() || "";
31
+ }
32
+ function w(e) {
33
+ return Array.from(e.querySelectorAll('input[type="hidden"]')).filter((r) => r instanceof HTMLInputElement);
34
+ }
35
+ function k(e, r) {
36
+ const t = _(r);
37
+ return w(e).filter((i) => i.name === t && i.value.trim() !== "");
38
+ }
39
+ function G(e, r) {
40
+ const t = H(r), i = w(e).find((a) => a.hasAttribute(b) || a.name === t && a.value === "");
41
+ if (i)
42
+ return i.setAttribute(b, "true"), i.name = t, i.value = "", i;
43
+ const n = document.createElement("input");
44
+ return n.type = "hidden", n.name = t, n.value = "", n.setAttribute(b, "true"), r.insertAdjacentElement("afterend", n), n;
45
+ }
46
+ function T(e) {
47
+ if (Array.isArray(e))
48
+ return null;
49
+ const r = v(e);
50
+ if (r)
51
+ return {
52
+ assetId: r,
53
+ filename: ""
54
+ };
55
+ if (!A(e))
56
+ return null;
57
+ const t = v(e.assetId ?? e.id ?? e.value), i = p(e.filename ?? e.title ?? e.label ?? e.name), n = p(e.url) || null;
58
+ return !t && !i ? null : {
59
+ assetId: t,
60
+ filename: i,
61
+ url: n
62
+ };
63
+ }
64
+ function E(e) {
65
+ if (!Array.isArray(e)) {
66
+ const r = T(e);
67
+ return r ? [r] : [];
68
+ }
69
+ return e.flatMap((r) => {
70
+ if (Array.isArray(r))
71
+ return E(r);
72
+ const t = T(r);
73
+ return t ? [t] : [];
74
+ });
75
+ }
76
+ function Q(e) {
77
+ return e ? Array.from(e.querySelectorAll("[data-formie-file-summary-item]")).map((r) => ({
78
+ assetId: null,
79
+ filename: r.textContent?.trim() || ""
80
+ })).filter((r) => r.filename !== "") : [];
81
+ }
82
+ function X(e, r) {
83
+ return k(e, r).map((t) => ({
84
+ assetId: v(t.value),
85
+ filename: ""
86
+ })).filter((t) => t.assetId !== null);
87
+ }
88
+ function Z(e, r) {
89
+ return e.length ? e.map((t, i) => ({
90
+ assetId: t.assetId,
91
+ filename: r[i]?.filename || ""
92
+ })) : r;
93
+ }
94
+ function z(e) {
95
+ return e.map((r) => r.trim().toLowerCase()).filter(Boolean);
96
+ }
97
+ function ee(e, r) {
98
+ const t = z(e.map((n) => n.filename)), i = z(r);
99
+ return !t.length || !i.length ? !1 : t.every((n) => i.includes(n));
100
+ }
101
+ function te(e) {
102
+ D(e, U, (r) => {
103
+ r.addValidator("fileLimit", ({ input: t }) => {
104
+ const i = parseInt(t.getAttribute("data-formie-file-limit") || "", 10);
105
+ return t.type !== "file" || !i || !("files" in t) || !t.files?.length ? !0 : t.files.length <= i;
106
+ }, ({ input: t, t: i }) => i("Choose up to {files} files.", {
107
+ files: t.getAttribute("data-formie-file-limit") || ""
108
+ })), r.addValidator("fileSizeMinLimit", ({ input: t }) => {
109
+ const n = parseFloat(t.getAttribute("data-formie-size-min-limit") || "") * 1e3 * 1e3;
110
+ return t.type !== "file" || !n || !("files" in t) || !t.files?.length ? !0 : Array.from(t.files).every((a) => a.size >= n);
111
+ }, ({ input: t, t: i }) => i("File must be larger than {filesize} MB.", {
112
+ filesize: t.getAttribute("data-formie-size-min-limit") || ""
113
+ })), r.addValidator("fileSizeMaxLimit", ({ input: t }) => {
114
+ const n = parseFloat(t.getAttribute("data-formie-size-max-limit") || "") * 1e3 * 1e3;
115
+ return t.type !== "file" || !n || !("files" in t) || !t.files?.length ? !0 : Array.from(t.files).every((a) => a.size <= n);
116
+ }, ({ input: t, t: i }) => i("File must be smaller than {filesize} MB.", {
117
+ filesize: t.getAttribute("data-formie-size-max-limit") || ""
118
+ }));
119
+ });
120
+ }
121
+ function re(e) {
122
+ P(e, U, $);
123
+ }
124
+ function M(e, r) {
125
+ const t = e.querySelector("[data-formie-file-summary]");
126
+ if (t)
127
+ return t;
128
+ const i = document.createElement("div");
129
+ return i.className = "formie-file-summary", i.setAttribute("data-formie-file-summary", "true"), r.insertAdjacentElement("afterend", i), i;
130
+ }
131
+ function h(e) {
132
+ const r = e.pendingFiles.length ? e.pendingFiles : e.uploadedAssets.map((a) => a.filename || (a.assetId ? `Asset #${a.assetId}` : "")).filter(Boolean), t = e.summaryRoot || e.field.querySelector("[data-formie-file-summary]");
133
+ if (!r.length) {
134
+ t && (t.replaceChildren(), t.hidden = !0), e.summaryRoot = t;
135
+ return;
136
+ }
137
+ const i = t || M(e.field, e.input);
138
+ if (!i)
139
+ return;
140
+ i.hidden = !1, e.summaryRoot = i;
141
+ const n = document.createElement("ul");
142
+ n.className = "formie-file-summary-container", n.setAttribute("data-formie-file-summary-container", "true"), r.forEach((a) => {
143
+ const o = document.createElement("li");
144
+ o.className = "formie-file-summary-item", o.setAttribute("data-formie-file-summary-item", "true"), o.textContent = a, n.appendChild(o);
145
+ }), i.replaceChildren(n);
146
+ }
147
+ function S(e, r, t) {
148
+ let n = G(e, r);
149
+ const a = _(r);
150
+ k(e, r).forEach((o) => {
151
+ o.remove();
152
+ }), t.forEach((o) => {
153
+ if (!o.assetId)
154
+ return;
155
+ const s = document.createElement("input");
156
+ s.type = "hidden", s.name = a, s.value = String(o.assetId), s.setAttribute(Y, "true"), n.insertAdjacentElement("afterend", s), n = s;
157
+ }), r.value = "";
158
+ }
159
+ async function ie(e, r, t) {
160
+ const i = t.map((l) => l.assetId).filter((l) => l !== null);
161
+ if (!i.length)
162
+ return t;
163
+ const n = r.getAttribute(j)?.trim() || "/actions/formie/file-upload/hydrate", a = new FormData();
164
+ i.forEach((l) => {
165
+ a.append("assetIds[]", String(l));
166
+ });
167
+ const o = await O(n, {
168
+ method: "POST",
169
+ body: a
170
+ }), s = E(o.assets);
171
+ if (!s.length)
172
+ return t;
173
+ const c = new Map(s.map((l) => [l.assetId, l]));
174
+ return t.map((l) => {
175
+ if (!l.assetId || !c.has(l.assetId))
176
+ return l;
177
+ const f = c.get(l.assetId);
178
+ return {
179
+ assetId: l.assetId,
180
+ filename: f.filename || l.filename,
181
+ url: f.url ?? l.url
182
+ };
183
+ });
184
+ }
185
+ function ne(e, r) {
186
+ const t = e.detail;
187
+ if (!A(t))
188
+ return [];
189
+ const i = p(t.fieldHandle), n = p(t.inputKey), a = p(t.inputName ?? t.name), o = A(t.data) ? t.data : null, s = p(o?.fieldHandle), c = p(o?.inputKey), l = p(o?.inputName ?? o?.name), f = [];
190
+ let y = !1, g = !1, u = !1;
191
+ if (n !== "" && n === r.inputKey && (y = !0, f.push(t.assets, t.assetIds, t.data)), a !== "" && a === r.inputName && (g = !0, f.push(t.assets, t.assetIds, t.data)), i === r.fieldHandle && (u = !0, f.push(t.assets, t.assetIds, t.data)), o) {
192
+ const d = [
193
+ o.assets,
194
+ o.assetIds,
195
+ o.uploadedAssets,
196
+ o.data
197
+ ];
198
+ c !== "" && c === r.inputKey && (y = !0, f.push(...d)), l !== "" && l === r.inputName && (g = !0, f.push(...d)), s === r.fieldHandle && (u = !0, f.push(...d));
199
+ }
200
+ [t.assets, t.assetIds, t.data].forEach((d) => {
201
+ A(d) && (r.inputKey && r.inputKey in d && (y = !0, f.push(d[r.inputKey])), r.inputName in d && (g = !0, f.push(d[r.inputName])), r.fieldHandle in d && f.push(d[r.fieldHandle]));
202
+ });
203
+ for (const d of f) {
204
+ const m = E(d);
205
+ if (m.length && (y || g || u || ee(m, r.pendingFiles)))
206
+ return m;
207
+ }
208
+ return [];
209
+ }
210
+ const le = {
211
+ id: I,
212
+ kind: "field",
213
+ match: (e) => !!e.target.querySelector(F),
214
+ setup: async (e) => {
215
+ const r = R(e), t = r || e.target, i = Array.from(t.querySelectorAll(F)).filter((o) => o instanceof HTMLInputElement), n = e.form;
216
+ te(n);
217
+ const a = i.map((o) => {
218
+ if (!(r instanceof HTMLElement))
219
+ return () => {
220
+ };
221
+ const s = {
222
+ field: r,
223
+ input: o,
224
+ summaryRoot: M(r, o),
225
+ uploadedAssets: Z(
226
+ X(r, o),
227
+ Q(r.querySelector("[data-formie-file-summary]"))
228
+ ),
229
+ pendingFiles: [],
230
+ hydrationToken: 0
231
+ }, c = () => {
232
+ s.pendingFiles = Array.from(o.files || []).map((u) => u.name), h(s);
233
+ }, l = async (u) => {
234
+ s.hydrationToken += 1;
235
+ const d = s.hydrationToken;
236
+ s.pendingFiles = [], s.uploadedAssets = u, S(r, o, u), h(s);
237
+ try {
238
+ const m = await ie(r, o, u);
239
+ if (d !== s.hydrationToken)
240
+ return;
241
+ s.uploadedAssets = m, h(s), K(r, I, "uploaded-assets-sync", {
242
+ fileUpload: r,
243
+ assets: m
244
+ });
245
+ } catch (m) {
246
+ console.error("[formie] Failed to hydrate uploaded file details.", m);
247
+ }
248
+ }, f = () => {
249
+ s.hydrationToken += 1, s.pendingFiles = [], s.uploadedAssets = [], S(r, o, []), h(s);
250
+ }, y = (u) => {
251
+ const d = J(r);
252
+ if (!d)
253
+ return;
254
+ const m = ne(u, {
255
+ fieldHandle: d,
256
+ inputKey: W(o),
257
+ inputName: o.name,
258
+ pendingFiles: s.pendingFiles
259
+ });
260
+ m.length && l(m);
261
+ }, g = () => {
262
+ f();
263
+ };
264
+ return o.addEventListener("change", c), n?.addEventListener(N, y), n?.addEventListener(L, g), h(s), () => {
265
+ o.removeEventListener("change", c), n?.removeEventListener(N, y), n?.removeEventListener(L, g);
266
+ };
267
+ });
268
+ return await e.emit("formie:module:file-upload:init", {
269
+ count: i.length
270
+ }), {
271
+ destroy: () => {
272
+ a.forEach((o) => {
273
+ o();
274
+ }), re(n), e.emit("formie:module:file-upload:destroy", {});
275
+ }
276
+ };
277
+ }
278
+ };
279
+ export {
280
+ le as fileUploadModule
281
+ };
@@ -0,0 +1,33 @@
1
+ import { a as l } from "./index-C1ZOKiAi.js";
2
+ const c = l({
3
+ id: "friendly-captcha-v1",
4
+ defaultPlaceholderSelector: "[data-friendly-captcha-placeholder]",
5
+ defaultTokenFieldNames: ["frc-captcha-solution"],
6
+ load: async () => import("./index-BP7Unm5Y.js"),
7
+ mount: ({ api: e, container: t, provider: a, services: o }) => new e.WidgetInstance(t, {
8
+ sitekey: a.siteKey || "",
9
+ startMode: a.startMode || "none",
10
+ language: a.language || "en",
11
+ solutionFieldName: "frc-captcha-solution",
12
+ doneCallback: (n) => {
13
+ typeof n == "string" && n.trim() !== "" && o.tokens.write(n.trim()), o.errors.clear();
14
+ },
15
+ errorCallback: () => {
16
+ o.tokens.clear();
17
+ }
18
+ }),
19
+ screen: async ({ widget: e, placeholder: t, services: a, stageCtx: o }) => {
20
+ if (a.tokens.has())
21
+ return;
22
+ if (await e.start(), !await a.tokens.wait()) {
23
+ const r = a.errors.getDefaultMessage();
24
+ a.errors.show(r, t), o.abort(r);
25
+ }
26
+ },
27
+ unmount: ({ widget: e, services: t }) => {
28
+ e.destroy(), t.tokens.clear();
29
+ }
30
+ });
31
+ export {
32
+ c as friendlyCaptchaV1Module
33
+ };
@@ -0,0 +1,38 @@
1
+ import { a as l } from "./index-C1ZOKiAi.js";
2
+ const i = l({
3
+ id: "friendly-captcha-v2",
4
+ defaultPlaceholderSelector: "[data-friendly-captcha-placeholder]",
5
+ defaultTokenFieldNames: ["frc-captcha-response"],
6
+ load: async () => import("./sdk-3SicTWby.js"),
7
+ mount: ({ api: r, container: n, provider: e, services: t }) => {
8
+ const a = new r.FriendlyCaptchaSDK().createWidget({
9
+ element: n,
10
+ sitekey: e.siteKey || "",
11
+ formFieldName: "frc-captcha-response",
12
+ language: e.language,
13
+ startMode: e.startMode || "none"
14
+ });
15
+ return a.addEventListener("frc:widget.complete", (s) => {
16
+ const o = s.detail;
17
+ typeof o?.response == "string" && o.response.trim() !== "" && t.tokens.write(o.response.trim()), t.errors.clear();
18
+ }), a.addEventListener("frc:widget.expire", () => {
19
+ t.tokens.clear(), t.errors.clear();
20
+ }), a.addEventListener("frc:widget.error", (s) => {
21
+ s.detail?.error && t.tokens.clear();
22
+ }), a;
23
+ },
24
+ screen: async ({ widget: r, placeholder: n, services: e, stageCtx: t }) => {
25
+ if (e.tokens.has())
26
+ return;
27
+ if (r.start(), !await e.tokens.wait()) {
28
+ const a = e.errors.getDefaultMessage();
29
+ e.errors.show(a, n), t.abort(a);
30
+ }
31
+ },
32
+ unmount: ({ widget: r, services: n }) => {
33
+ r.destroy(), n.tokens.clear();
34
+ }
35
+ });
36
+ export {
37
+ i as friendlyCaptchaV2Module
38
+ };
@@ -0,0 +1,24 @@
1
+ import { u as a, v as o } from "./index-C1ZOKiAi.js";
2
+ const d = o("go-cardless", "redirect"), l = a({
3
+ id: "go-cardless",
4
+ defaultRequiredInputSuffixes: [],
5
+ load: async () => null,
6
+ setup: async ({ services: n, root: e }) => {
7
+ const r = (s) => {
8
+ const t = s.detail?.data;
9
+ if (!t?.redirectUrl) {
10
+ n.addError("Missing GoCardless redirect URL.");
11
+ return;
12
+ }
13
+ window.location.href = t.redirectUrl;
14
+ };
15
+ return e.addEventListener(d, r), {
16
+ destroy: () => {
17
+ e.removeEventListener(d, r);
18
+ }
19
+ };
20
+ }
21
+ });
22
+ export {
23
+ l as goCardlessModule
24
+ };
@@ -0,0 +1,162 @@
1
+ import { d as v, g as C } from "./index-C1ZOKiAi.js";
2
+ import { e as E, a as L } from "./scripts-BkAAux0i.js";
3
+ const w = "FORMIE_GOOGLE_ADDRESS_SCRIPT", m = "formieGoogleMapsReady";
4
+ let f = null;
5
+ async function S(t) {
6
+ const e = window, r = e.google;
7
+ if (typeof r < "u" && r !== null) {
8
+ const s = r.maps;
9
+ if (s?.places?.PlaceAutocompleteElement)
10
+ return r;
11
+ const i = s;
12
+ return typeof i?.importLibrary == "function" && await i.importLibrary("places"), r;
13
+ }
14
+ if (f)
15
+ return f;
16
+ if (document.getElementById(w)) {
17
+ const s = await E("google", 1e4), i = s?.maps;
18
+ return typeof i?.importLibrary == "function" && await i.importLibrary("places"), s;
19
+ }
20
+ const o = new URL("https://maps.googleapis.com/maps/api/js");
21
+ o.searchParams.set("key", t), o.searchParams.set("loading", "async"), o.searchParams.set("libraries", "places"), o.searchParams.set("callback", m), f = (async () => {
22
+ const s = new Promise((c, n) => {
23
+ const u = setTimeout(() => {
24
+ e[m] && (delete e[m], n(new Error("Google Maps API load timeout")));
25
+ }, 15e3);
26
+ e[m] = () => {
27
+ clearTimeout(u), delete e[m], c(e.google);
28
+ };
29
+ });
30
+ await L({
31
+ id: w,
32
+ src: o.toString(),
33
+ async: !0,
34
+ defer: !0
35
+ });
36
+ const i = await s, a = i?.maps;
37
+ return typeof a?.importLibrary == "function" && await a.importLibrary("places"), i;
38
+ })();
39
+ try {
40
+ return await f;
41
+ } catch (s) {
42
+ throw f = null, s;
43
+ }
44
+ }
45
+ function b(t, e) {
46
+ e.formattedAddress && t.input.setValue("autoComplete", e.formattedAddress), e.address1 && t.input.setValue("address1", e.address1), e.city !== void 0 && t.input.setValue("city", e.city), e.state !== void 0 && t.input.setValue("state", e.state), e.zip !== void 0 && t.input.setValue("zip", e.zip), e.country !== void 0 && t.input.setValue("country", e.country);
47
+ }
48
+ function T() {
49
+ return {
50
+ subpremise: "shortText",
51
+ street_number: "shortText",
52
+ route: "longText",
53
+ postal_town: "longText",
54
+ locality: "longText",
55
+ administrative_area_level_1: "shortText",
56
+ country: "shortText",
57
+ postal_code: "shortText"
58
+ };
59
+ }
60
+ function A(t) {
61
+ const e = T(), r = {};
62
+ for (const d of t) {
63
+ const o = d.types?.[0];
64
+ if (!o || !e[o]) continue;
65
+ const s = e[o], i = d[s] ?? d.short_text ?? d.long_text ?? "";
66
+ r[o] = i;
67
+ }
68
+ return r;
69
+ }
70
+ function P(t) {
71
+ let e = "";
72
+ return (t.street_number || t.route) && (e = [t.street_number, t.route].filter(Boolean).join(" "), t.subpremise && (e = `${t.subpremise}/${e}`)), {
73
+ address1: e,
74
+ city: t.locality || t.postal_town || "",
75
+ state: t.administrative_area_level_1 || "",
76
+ zip: t.postal_code || "",
77
+ country: t.country || ""
78
+ };
79
+ }
80
+ const I = v({
81
+ id: "google-address",
82
+ load: async ({ options: t }) => {
83
+ const e = t.provider.apiKey;
84
+ if (!e)
85
+ throw new Error("Google Places API key is required");
86
+ return S(e);
87
+ },
88
+ mount: async ({ api: t, field: e, services: r, provider: d }) => {
89
+ const o = r.input.getAutocomplete(), s = t?.maps?.places?.PlaceAutocompleteElement;
90
+ if (!o || typeof s != "function")
91
+ return console.warn("[formie] Google Places API not ready; address autocomplete skipped."), null;
92
+ const i = { types: ["geocode"], ...d.options || {} }, a = new s(i), c = window.getComputedStyle(o).height;
93
+ a.style.height = c, a.style.boxSizing = "border-box";
94
+ let n = o.parentElement;
95
+ n?.classList.contains("formie-autocomplete-wrapper") || (n = document.createElement("div"), n.classList.add("formie-autocomplete-wrapper"), o.parentNode?.insertBefore(n, o), n.appendChild(o));
96
+ const u = o.value;
97
+ if (u) {
98
+ const l = document.createElement("div");
99
+ l.classList.add("formie-autocomplete-placeholder"), l.textContent = u, n.style.position = "relative", l.style.cssText = `
100
+ position: absolute; left: 0; top: 0; height: ${c};
101
+ line-height: ${c}; width: 100%; padding: 0 2.5rem;
102
+ pointer-events: none; color: #6B7280; font-size: 14px; z-index: 1;
103
+ `, n.appendChild(l), a.addEventListener("focusin", () => {
104
+ l.style.display = "none";
105
+ }), a.addEventListener("focusout", () => {
106
+ o.value && (l.style.display = "");
107
+ });
108
+ }
109
+ n.replaceChild(a, o), o.type = "hidden", o.name = o.getAttribute("name") || "", n.appendChild(o);
110
+ const y = async (l) => {
111
+ const h = l.placePrediction;
112
+ if (!h) return;
113
+ const p = await h.toPlace();
114
+ if (await p.fetchFields({ fields: ["addressComponents", "formattedAddress"] }), !p.addressComponents) return;
115
+ const _ = A(
116
+ p.addressComponents
117
+ ), x = P(_);
118
+ b(r, {
119
+ ...x,
120
+ formattedAddress: p.formattedAddress
121
+ }), e.dispatchEvent(
122
+ new CustomEvent(C("google", "populate"), {
123
+ bubbles: !0,
124
+ detail: {
125
+ addressProvider: "google",
126
+ place: p,
127
+ formattedAddress: p.formattedAddress,
128
+ addressComponents: p.addressComponents
129
+ }
130
+ })
131
+ );
132
+ };
133
+ return a.addEventListener("gmp-select", y), a;
134
+ },
135
+ onCurrentLocation: async (t, { field: e, services: r }) => {
136
+ const { latitude: d, longitude: o } = t.coords, s = r.form, i = s?.action || window.location.href, a = e.getAttribute("data-formie-field-handle")?.trim(), c = s?.querySelector('[name="handle"]')?.value?.trim();
137
+ if (!(!c || !a))
138
+ try {
139
+ const n = new FormData();
140
+ n.append("action", "formie/address/google-places-geocode"), n.append("latlng", `${d},${o}`), n.append("handle", c), n.append("fieldHandle", a);
141
+ const y = await (await fetch(i, {
142
+ method: "POST",
143
+ body: n,
144
+ credentials: "include",
145
+ headers: {
146
+ "X-Requested-With": "XMLHttpRequest",
147
+ Accept: "application/json"
148
+ }
149
+ })).json();
150
+ if (y?.results?.[0]?.address_components) {
151
+ const l = A(
152
+ y.results[0].address_components
153
+ ), g = P(l);
154
+ b(r, g);
155
+ }
156
+ } catch {
157
+ }
158
+ }
159
+ });
160
+ export {
161
+ I as googleAddressModule
162
+ };
@@ -0,0 +1,56 @@
1
+ import { a as h, b as i, C as d } from "./index-C1ZOKiAi.js";
2
+ import { a as p, e as m } from "./scripts-BkAAux0i.js";
3
+ async function u(a) {
4
+ const o = typeof a.language == "string" && a.language.trim() !== "" ? a.language.trim() : "en", { async: t, defer: e } = i(a.loadingMethod), r = "FORMIE_HCAPTCHA_ONLOAD", c = window, l = c.hcaptcha;
5
+ if (l)
6
+ return l;
7
+ const n = new Promise((s) => {
8
+ c[r] = () => {
9
+ delete c[r], s();
10
+ };
11
+ });
12
+ return await p({
13
+ id: "FORMIE_HCAPTCHA_SCRIPT",
14
+ src: `https://js.hcaptcha.com/1/api.js?recaptchacompat=off&render=explicit&onload=${encodeURIComponent(r)}&hl=${encodeURIComponent(o)}`,
15
+ async: t,
16
+ defer: e
17
+ }), await n, m("hcaptcha", d);
18
+ }
19
+ const k = h({
20
+ id: "hcaptcha",
21
+ defaultPlaceholderSelector: "[data-hcaptcha-placeholder]",
22
+ defaultTokenFieldNames: ["h-captcha-response"],
23
+ load: ({ options: a }) => u(a.provider),
24
+ mount: ({ api: a, container: o, provider: t, services: e }) => a.render(o, {
25
+ sitekey: t.siteKey || "",
26
+ theme: t.theme || "light",
27
+ size: t.size || "normal",
28
+ callback: (r) => {
29
+ typeof r == "string" && r.trim() !== "" && e.tokens.write(r.trim()), e.errors.clear();
30
+ },
31
+ "expired-callback": () => {
32
+ e.tokens.clear(), e.errors.clear();
33
+ },
34
+ "chalexpired-callback": () => {
35
+ e.tokens.clear(), e.errors.clear();
36
+ },
37
+ "error-callback": () => {
38
+ e.tokens.clear();
39
+ }
40
+ }),
41
+ screen: ({ api: a, widget: o, placeholder: t, services: e, stageCtx: r }) => {
42
+ if (!e.tokens.has())
43
+ return a.execute(o), e.tokens.wait().then((c) => {
44
+ if (!c) {
45
+ const l = e.errors.getDefaultMessage();
46
+ e.errors.show(l, t), r.abort(l);
47
+ }
48
+ });
49
+ },
50
+ unmount: ({ api: a, widget: o, services: t }) => {
51
+ a.reset(o), t.tokens.clear();
52
+ }
53
+ });
54
+ export {
55
+ k as hcaptchaModule
56
+ };