@verbb/formie-browser 1.0.2 → 1.0.3
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.
- package/CHANGELOG.md +8 -0
- package/dist/chunks/{address-finder-CQW81kY0.js → address-finder-BjMuEiwF.js} +2 -2
- package/dist/chunks/{bpoint-D8OjLmsn.js → bpoint-KudsBCo2.js} +1 -1
- package/dist/chunks/{calculations-BqZsENCq.js → calculations-DlGSkQ3W.js} +2 -2
- package/dist/chunks/{captcha-eu-DIa6aUWz.js → captcha-eu-CterYFok.js} +2 -2
- package/dist/chunks/{checkbox-radio-BI-UjgMF.js → checkbox-radio-CBvgk3hR.js} +2 -2
- package/dist/chunks/{conditions-BVl6jTYo.js → conditions-DYy1-Hwt.js} +189 -163
- package/dist/chunks/{date-picker-69TgvErA.js → date-picker-BlD--zfe.js} +2 -2
- package/dist/chunks/{eway-1GPxH6DU.js → eway-qwc-B5Us.js} +2 -2
- package/dist/chunks/file-upload-CIgHrXfp.js +316 -0
- package/dist/chunks/{friendly-captcha-v1-DA2QPKA3.js → friendly-captcha-v1-EDFac33c.js} +1 -1
- package/dist/chunks/{friendly-captcha-v2-BorOWiz_.js → friendly-captcha-v2-BDpSvFGR.js} +1 -1
- package/dist/chunks/{go-cardless-DwBgERcA.js → go-cardless-DuDMVsnz.js} +1 -1
- package/dist/chunks/{google-address-BcTBncyS.js → google-address-Bmjp01pH.js} +77 -58
- package/dist/chunks/{hcaptcha-BchdVCqq.js → hcaptcha-BTQ6An6g.js} +2 -2
- package/dist/chunks/{hidden-D8RqSPt7.js → hidden-DbPdOxKb.js} +1 -1
- package/dist/chunks/{index-C1ZOKiAi.js → index-BcqwpPNE.js} +1261 -1176
- package/dist/chunks/{loqate-nXuTX7In.js → loqate-BdNGv93o.js} +2 -2
- package/dist/chunks/{mollie-qdCynQCd.js → mollie-DFOjTuGX.js} +1 -1
- package/dist/chunks/{moneris-BNEA-laO.js → moneris-BbFfl-EL.js} +1 -1
- package/dist/chunks/{opayo-BJtXOkuK.js → opayo-CmgYa9ya.js} +2 -2
- package/dist/chunks/{paddle-D72Pa8kr.js → paddle-BUi7w1_o.js} +2 -2
- package/dist/chunks/{paypal-Cqt2bned.js → paypal-A-ePfh6k.js} +2 -2
- package/dist/chunks/{payway-BjCqsc0H.js → payway-BqFCbhyo.js} +2 -2
- package/dist/chunks/{phone-country-K9pYAlzM.js → phone-country-DPMiqk4L.js} +2 -2
- package/dist/chunks/{place-kit-Dg6f_UoM.js → place-kit-CX7tamAg.js} +1 -1
- package/dist/chunks/{recaptcha-enterprise--VYAeeqz.js → recaptcha-enterprise-DxF6cW95.js} +2 -2
- package/dist/chunks/{recaptcha-shared-PSIEEEe1.js → recaptcha-shared-DhGcbiaq.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-atBNe5ml.js → recaptcha-v2-checkbox-R9EfbZ4k.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-DnBufNPT.js → recaptcha-v2-invisible-DV9hswAp.js} +2 -2
- package/dist/chunks/{recaptcha-v3-CF6O8rDj.js → recaptcha-v3-V0xc-Edh.js} +2 -2
- package/dist/chunks/{repeater-CB7Yojvx.js → repeater-DKUT6TGI.js} +2 -2
- package/dist/chunks/{rich-text-nAV_SQZo.js → rich-text-SH7KiaKH.js} +1 -1
- package/dist/chunks/{scripts-BkAAux0i.js → scripts-D9N2d5rN.js} +1 -1
- package/dist/chunks/{shared-DGqeMvcJ.js → shared-BmntPmnW.js} +4 -4
- package/dist/chunks/{signature-BT6CsQ6n.js → signature-BA3tQsGT.js} +1 -1
- package/dist/chunks/{snaptcha-C7qQo02f.js → snaptcha-DV7p6J9k.js} +1 -1
- package/dist/chunks/{square-C5AH3trb.js → square-Bs-ndqYK.js} +2 -2
- package/dist/chunks/{stripe-EJK0RyUv.js → stripe-DkZAHxtn.js} +2 -2
- package/dist/chunks/{summary-DC_ipXCU.js → summary-Dq2i9TQk.js} +2 -2
- package/dist/chunks/{table-BEAI99qo.js → table-Cu4WfVcw.js} +2 -2
- package/dist/chunks/{text-limit-Blgq5G-G.js → text-limit-2ycmB-Ae.js} +1 -1
- package/dist/chunks/{turnstile-_uCRwnU-.js → turnstile-CId90tRr.js} +2 -2
- package/dist/css/theme/forms/_form.css +28 -0
- package/dist/index.js +1 -1
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +7 -0
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts +3 -1
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/validation/scope.d.ts +6 -0
- package/dist/js/validation/scope.d.ts.map +1 -0
- package/dist/js/validation/submit-readiness.d.ts +4 -0
- package/dist/js/validation/submit-readiness.d.ts.map +1 -0
- package/dist/js/validation/validator.d.ts +1 -0
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/css/theme/forms/_form.css +28 -0
- package/src/js/core/create-formie-client.ts +6 -0
- package/src/js/core/submit-result-state.ts +17 -0
- package/src/js/modules/address/google-address.ts +33 -1
- package/src/js/modules/fields/conditions/effects.ts +79 -2
- package/src/js/modules/fields/conditions.ts +53 -11
- package/src/js/modules/fields/file-upload.ts +188 -96
- package/src/js/submit/pipeline.ts +3 -28
- package/src/js/validation/scope.ts +25 -0
- package/src/js/validation/submit-readiness.ts +157 -0
- package/src/js/validation/validator.ts +4 -0
- package/dist/chunks/file-upload-BDZZftgL.js +0 -281
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _r = [
|
|
2
2
|
{ legacyEvent: "onFormieLoaded", canonicalEvent: "formie:mount:after", disposition: "approximate", target: "document" },
|
|
3
3
|
{ legacyEvent: "onFormieInit", canonicalEvent: "formie:mount:after", disposition: "approximate", target: "document" },
|
|
4
4
|
{ legacyEvent: "onFormieReady", canonicalEvent: "formie:mount:after", disposition: "safe" },
|
|
@@ -9,13 +9,13 @@ const Pr = [
|
|
|
9
9
|
{ legacyEvent: "onFormieValidate", canonicalEvent: "formie:stage:validate:before", disposition: "approximate" },
|
|
10
10
|
{ legacyEvent: "onAfterFormieValidate", canonicalEvent: "formie:stage:validate:after", disposition: "approximate" },
|
|
11
11
|
{ legacyEvent: "onFormieSubmit", canonicalEvent: "formie:submit:after", disposition: "approximate" }
|
|
12
|
-
],
|
|
12
|
+
], Yo = [
|
|
13
13
|
{ legacyEvent: "formieValidatorInitialized", canonicalEvent: "formie:validator:ready", disposition: "safe" },
|
|
14
14
|
{ legacyEvent: "formieValidatorDestroyed", canonicalEvent: "formie:validator:destroy", disposition: "safe" },
|
|
15
15
|
{ legacyEvent: "formieValidatorShowError", canonicalEvent: "formie:validator:show-error", disposition: "safe" },
|
|
16
16
|
{ legacyEvent: "formieValidatorClearError", canonicalEvent: "formie:validator:clear-error", disposition: "safe" }
|
|
17
17
|
];
|
|
18
|
-
function
|
|
18
|
+
function Dr(e) {
|
|
19
19
|
if (!e)
|
|
20
20
|
return {
|
|
21
21
|
enabled: !1,
|
|
@@ -35,7 +35,7 @@ function $r(e) {
|
|
|
35
35
|
legacyValidatorEvents: r
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const xr = [
|
|
39
39
|
"formie:mount:after",
|
|
40
40
|
"formie:unmount:before",
|
|
41
41
|
"formie:unmount:after",
|
|
@@ -53,49 +53,49 @@ const Vr = [
|
|
|
53
53
|
"formie:refresh-tokens:after",
|
|
54
54
|
"formie:refresh-tokens:refreshed"
|
|
55
55
|
];
|
|
56
|
-
function
|
|
56
|
+
function ze(e) {
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Zo(e) {
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Qo(e, t) {
|
|
63
63
|
return `formie:field:${e}:${t}`;
|
|
64
64
|
}
|
|
65
65
|
function pe(e) {
|
|
66
66
|
return `formie:validator:${e}`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Xo(e, t) {
|
|
69
69
|
return `formie:address:${e}:${t}`;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function ea(e) {
|
|
72
72
|
return `formie:file-upload:${e}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function ta(e, t) {
|
|
75
75
|
return `formie:payment:${e}:${t}`;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function Be(e) {
|
|
78
78
|
return `formie:state:${e}`;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Nr(e, t) {
|
|
81
81
|
return `formie:module:${e}:${t}`;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Ur(e) {
|
|
84
84
|
return `formie:module:${e}`;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function zr(e, t, r) {
|
|
87
87
|
e.dispatchEvent(new CustomEvent(t, {
|
|
88
88
|
bubbles: !0,
|
|
89
89
|
detail: r
|
|
90
90
|
}));
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Br(e, t) {
|
|
93
93
|
if (e.canonicalEvent !== "formie:submit:result")
|
|
94
94
|
return !0;
|
|
95
95
|
const r = t;
|
|
96
96
|
return e.legacyEvent === "onAfterFormieSubmit" ? !!r?.ok : e.legacyEvent === "onFormieSubmitError" ? r?.ok === !1 : !0;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function jr(e, t) {
|
|
99
99
|
const r = t && typeof t == "object" ? t : {}, n = typeof r.pageId == "string" ? r.pageId : "", i = Array.from(e.querySelectorAll("[data-formie-page-id]")), o = i.findIndex((a) => a.getAttribute("data-formie-page-id") === n);
|
|
100
100
|
return {
|
|
101
101
|
data: {
|
|
@@ -105,7 +105,7 @@ function xr(e, t) {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Wr(e, t, r, n, i) {
|
|
109
109
|
const o = globalThis.Formie || i;
|
|
110
110
|
return e.legacyEvent === "onFormieLoaded" ? {
|
|
111
111
|
formie: o
|
|
@@ -119,24 +119,24 @@ function Nr(e, t, r, n, i) {
|
|
|
119
119
|
form: n,
|
|
120
120
|
target: r,
|
|
121
121
|
instance: i
|
|
122
|
-
} : e.legacyEvent === "onFormiePageToggle" ?
|
|
122
|
+
} : e.legacyEvent === "onFormiePageToggle" ? jr(n, t) : t;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Kr({
|
|
125
125
|
target: e,
|
|
126
126
|
form: t,
|
|
127
127
|
instance: r,
|
|
128
128
|
options: n,
|
|
129
129
|
unbinds: i
|
|
130
130
|
}) {
|
|
131
|
-
n.legacyDomEvents &&
|
|
131
|
+
n.legacyDomEvents && _r.forEach((o) => {
|
|
132
132
|
const a = (s) => {
|
|
133
|
-
if (!(s instanceof CustomEvent) || !
|
|
133
|
+
if (!(s instanceof CustomEvent) || !Br(o, s.detail))
|
|
134
134
|
return;
|
|
135
135
|
const l = o.target === "document" ? document : t;
|
|
136
|
-
|
|
136
|
+
zr(l, o.legacyEvent, Wr(o, s.detail, e, t, r));
|
|
137
137
|
};
|
|
138
|
-
e.addEventListener(
|
|
139
|
-
e.removeEventListener(
|
|
138
|
+
e.addEventListener(ze(o.canonicalEvent), a), i.push(() => {
|
|
139
|
+
e.removeEventListener(ze(o.canonicalEvent), a);
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -149,7 +149,7 @@ function ge(e, t, r) {
|
|
|
149
149
|
function $e(e, t) {
|
|
150
150
|
return !!e && typeof e == "object" && e.validator === t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Gr({
|
|
153
153
|
target: e,
|
|
154
154
|
form: t,
|
|
155
155
|
validatorDetail: r,
|
|
@@ -164,49 +164,49 @@ function zr({
|
|
|
164
164
|
target: e
|
|
165
165
|
};
|
|
166
166
|
ge(document, "formieValidatorInitialized", l);
|
|
167
|
-
const d = (
|
|
168
|
-
!(
|
|
167
|
+
const d = (u) => {
|
|
168
|
+
!(u instanceof CustomEvent) || !$e(u.detail, o) || ge(document, "formieValidatorDestroyed", {
|
|
169
169
|
...l,
|
|
170
|
-
...
|
|
170
|
+
...u.detail
|
|
171
171
|
});
|
|
172
|
-
}, p = (
|
|
173
|
-
!(
|
|
174
|
-
...
|
|
172
|
+
}, p = (u) => {
|
|
173
|
+
!(u instanceof CustomEvent) || !$e(u.detail, o) || !(u.target instanceof Element) || t.contains(u.target) && ge(u.target, "formieValidatorShowError", {
|
|
174
|
+
...u.detail,
|
|
175
175
|
addValidator: a,
|
|
176
176
|
removeValidator: s,
|
|
177
177
|
form: t,
|
|
178
178
|
target: e
|
|
179
179
|
});
|
|
180
|
-
},
|
|
181
|
-
!(
|
|
182
|
-
...
|
|
180
|
+
}, h = (u) => {
|
|
181
|
+
!(u instanceof CustomEvent) || !$e(u.detail, o) || !(u.target instanceof Element) || t.contains(u.target) && ge(u.target, "formieValidatorClearError", {
|
|
182
|
+
...u.detail,
|
|
183
183
|
addValidator: a,
|
|
184
184
|
removeValidator: s,
|
|
185
185
|
form: t,
|
|
186
186
|
target: e
|
|
187
187
|
});
|
|
188
188
|
};
|
|
189
|
-
document.addEventListener("formie:validator:destroy", d), document.addEventListener("formie:validator:show-error", p), document.addEventListener("formie:validator:clear-error",
|
|
190
|
-
document.removeEventListener("formie:validator:destroy", d), document.removeEventListener("formie:validator:show-error", p), document.removeEventListener("formie:validator:clear-error",
|
|
189
|
+
document.addEventListener("formie:validator:destroy", d), document.addEventListener("formie:validator:show-error", p), document.addEventListener("formie:validator:clear-error", h), i.push(() => {
|
|
190
|
+
document.removeEventListener("formie:validator:destroy", d), document.removeEventListener("formie:validator:show-error", p), document.removeEventListener("formie:validator:clear-error", h);
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
function I(e, t, r) {
|
|
194
|
-
e.dispatchEvent(new CustomEvent(
|
|
194
|
+
e.dispatchEvent(new CustomEvent(ze(t), {
|
|
195
195
|
bubbles: !0,
|
|
196
196
|
detail: r
|
|
197
197
|
}));
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function jt() {
|
|
200
200
|
return globalThis;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
return
|
|
202
|
+
function Wt() {
|
|
203
|
+
return jt().__FORMIE_DEBUG__ === !0;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
|
|
205
|
+
function ra(e) {
|
|
206
|
+
jt().__FORMIE_DEBUG__ = e;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
if (
|
|
208
|
+
function Jr(e, t, r) {
|
|
209
|
+
if (Wt()) {
|
|
210
210
|
if (typeof r > "u") {
|
|
211
211
|
console.log(`[formie:${e}] ${t}`);
|
|
212
212
|
return;
|
|
@@ -214,8 +214,8 @@ function jr(e, t, r) {
|
|
|
214
214
|
console.log(`[formie:${e}] ${t}`, r);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
if (
|
|
217
|
+
function Yr(e, t, r) {
|
|
218
|
+
if (Wt()) {
|
|
219
219
|
if (typeof r > "u") {
|
|
220
220
|
console.warn(`[formie:${e}] ${t}`);
|
|
221
221
|
return;
|
|
@@ -227,117 +227,117 @@ function _(e, t) {
|
|
|
227
227
|
const r = t ? `${e}:${t}` : e;
|
|
228
228
|
return {
|
|
229
229
|
log: (n, i) => {
|
|
230
|
-
|
|
230
|
+
Jr(r, n, i);
|
|
231
231
|
},
|
|
232
232
|
warn: (n, i) => {
|
|
233
|
-
|
|
233
|
+
Yr(r, n, i);
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
237
|
+
const Ee = _("general", "page-client-event"), Zr = "data-formie-client-event";
|
|
238
|
+
function Qr(e) {
|
|
239
239
|
return typeof window < "u" && window.CSS?.escape ? window.CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Xr(e) {
|
|
242
242
|
const r = e.querySelector('input[name="pageId"]')?.value?.trim();
|
|
243
243
|
if (r)
|
|
244
244
|
return r;
|
|
245
245
|
const i = e.querySelector("[data-formie-page]:not([data-formie-page-hidden])")?.getAttribute("data-formie-page-id")?.trim();
|
|
246
246
|
return i || e.querySelector("[data-formie-page]")?.getAttribute("data-formie-page-id")?.trim() || null;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function en(e) {
|
|
249
249
|
if (!e?.trim())
|
|
250
250
|
return null;
|
|
251
251
|
try {
|
|
252
252
|
const t = JSON.parse(e);
|
|
253
253
|
return t && typeof t == "object" ? t : null;
|
|
254
254
|
} catch {
|
|
255
|
-
return
|
|
255
|
+
return Ee.warn("Invalid data-formie-client-event JSON.", {
|
|
256
256
|
rawPreview: e.slice(0, 80)
|
|
257
257
|
}), null;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function tn(e) {
|
|
261
261
|
const t = {};
|
|
262
262
|
return e.forEach((r) => {
|
|
263
263
|
const n = typeof r.label == "string" ? r.label.trim() : "";
|
|
264
264
|
n && (t[n] = typeof r.value == "string" ? r.value : "");
|
|
265
265
|
}), t;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Kt(e, t) {
|
|
268
268
|
if (t !== "submit")
|
|
269
269
|
return;
|
|
270
|
-
const r =
|
|
270
|
+
const r = Xr(e);
|
|
271
271
|
if (!r) {
|
|
272
|
-
|
|
272
|
+
Ee.log("No submitted page id; skipping client event.");
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
275
|
const n = e.querySelector(
|
|
276
|
-
`[data-formie-page][data-formie-page-id="${
|
|
276
|
+
`[data-formie-page][data-formie-page-id="${Qr(r)}"]`
|
|
277
277
|
);
|
|
278
278
|
if (!n) {
|
|
279
|
-
|
|
279
|
+
Ee.log("No page section for id; skipping client event.", { pageId: r });
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
const i = n.getAttribute(
|
|
282
|
+
const i = n.getAttribute(Zr);
|
|
283
283
|
if (i === null)
|
|
284
284
|
return;
|
|
285
|
-
const o =
|
|
285
|
+
const o = en(i);
|
|
286
286
|
if (!o || !Array.isArray(o.fields))
|
|
287
287
|
return;
|
|
288
|
-
const a =
|
|
288
|
+
const a = tn(o.fields), s = window;
|
|
289
289
|
s.dataLayer = s.dataLayer || [], s.dataLayer.push(a), e.dispatchEvent(new CustomEvent("formie:client-event", {
|
|
290
290
|
bubbles: !0,
|
|
291
291
|
detail: { payload: a }
|
|
292
|
-
})),
|
|
292
|
+
})), Ee.log("Dispatched page client event.", {
|
|
293
293
|
pageId: r,
|
|
294
294
|
keys: Object.keys(a)
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
const
|
|
298
|
-
function
|
|
297
|
+
const we = /* @__PURE__ */ new WeakMap(), rn = "[data-formie-form], [data-formie], form";
|
|
298
|
+
function nn(e) {
|
|
299
299
|
return e ? (Array.isArray(e) ? e : [e]).flatMap((r) => String(r).split(/\s+/)).map((r) => r.trim()).filter(Boolean) : [];
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function tt(e) {
|
|
302
302
|
return Array.from(new Set(e));
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function on(e) {
|
|
305
305
|
if (!e)
|
|
306
306
|
return {};
|
|
307
|
-
const t =
|
|
307
|
+
const t = we.get(e);
|
|
308
308
|
if (t)
|
|
309
309
|
return t;
|
|
310
|
-
const r = e.closest(
|
|
311
|
-
return r ?
|
|
310
|
+
const r = e.closest(rn);
|
|
311
|
+
return r ? we.get(r) || {} : {};
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function an(e) {
|
|
314
314
|
const t = {};
|
|
315
315
|
return Object.entries(e || {}).forEach(([r, n]) => {
|
|
316
|
-
const i =
|
|
316
|
+
const i = tt(nn(n));
|
|
317
317
|
i.length && (t[r] = i);
|
|
318
318
|
}), t;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
const n =
|
|
322
|
-
return
|
|
320
|
+
function yt(e, t, r) {
|
|
321
|
+
const n = an(t), i = r || (e instanceof HTMLFormElement ? e : e.querySelector("form"));
|
|
322
|
+
return we.set(e, n), i && we.set(i, n), n;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
325
|
-
return
|
|
324
|
+
function rt(e, t) {
|
|
325
|
+
return on(e)[t] || [];
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
const n =
|
|
327
|
+
function $(e, t, ...r) {
|
|
328
|
+
const n = tt(r.flatMap((i) => rt(t, i)));
|
|
329
329
|
n.length && e.classList.add(...n);
|
|
330
330
|
}
|
|
331
331
|
function le(e, t, ...r) {
|
|
332
|
-
const n =
|
|
332
|
+
const n = tt(r.flatMap((i) => rt(t, i)));
|
|
333
333
|
n.length && e.classList.remove(...n);
|
|
334
334
|
}
|
|
335
335
|
function ue(e, t, r, n) {
|
|
336
|
-
|
|
336
|
+
rt(t, r).forEach((i) => {
|
|
337
337
|
e.classList.toggle(i, n);
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function sn(e, t) {
|
|
341
341
|
if (ue(e, e, "tabError", t), t) {
|
|
342
342
|
e.setAttribute("data-formie-tab-error", "true");
|
|
343
343
|
return;
|
|
@@ -351,10 +351,10 @@ function J(e) {
|
|
|
351
351
|
i && n.querySelector("[data-formie-field-has-error]") && t.add(i);
|
|
352
352
|
}), e.querySelectorAll("[data-formie-tab]").forEach((r) => {
|
|
353
353
|
const n = r, i = n.getAttribute("data-formie-page-id");
|
|
354
|
-
|
|
354
|
+
sn(n, !!i && t.has(i));
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
|
-
class
|
|
357
|
+
class Gt {
|
|
358
358
|
constructor() {
|
|
359
359
|
this.listeners = /* @__PURE__ */ new Map();
|
|
360
360
|
}
|
|
@@ -414,7 +414,7 @@ class Bt {
|
|
|
414
414
|
this.listeners.clear();
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
async function
|
|
417
|
+
async function Jt(e, t = {}) {
|
|
418
418
|
const r = {
|
|
419
419
|
Accept: "application/json",
|
|
420
420
|
...t.headers || {}
|
|
@@ -432,42 +432,42 @@ async function Wt(e, t = {}) {
|
|
|
432
432
|
credentials: "same-origin"
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
async function
|
|
436
|
-
const r = await
|
|
435
|
+
async function Fe(e, t = {}) {
|
|
436
|
+
const r = await Jt(e, t);
|
|
437
437
|
if (!r.ok)
|
|
438
438
|
throw new Error(`Request failed (${r.status}) for ${String(e)}`);
|
|
439
439
|
return r.json();
|
|
440
440
|
}
|
|
441
|
-
async function
|
|
442
|
-
const r = await
|
|
441
|
+
async function na(e, t = {}) {
|
|
442
|
+
const r = await Jt(e, t);
|
|
443
443
|
if (!r.ok)
|
|
444
444
|
throw new Error(`Request failed (${r.status}) for ${String(e)}`);
|
|
445
445
|
return r.text();
|
|
446
446
|
}
|
|
447
|
-
const
|
|
448
|
-
function
|
|
447
|
+
const O = _("general", "transport");
|
|
448
|
+
function ln(e) {
|
|
449
449
|
const t = {};
|
|
450
450
|
return ["theme", "themeConfig", "locale", "siteId"].forEach((r) => {
|
|
451
451
|
e[r] !== void 0 && (t[r] = e[r]);
|
|
452
452
|
}), t;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function Yt(e, t = "", r = {}) {
|
|
455
455
|
if (Array.isArray(e)) {
|
|
456
456
|
const n = e.map((i) => typeof i == "string" ? i : String(i ?? "")).filter((i) => i.trim() !== "");
|
|
457
457
|
return t && n.length && (r[t] = (r[t] || []).concat(n)), r;
|
|
458
458
|
}
|
|
459
459
|
return e && typeof e == "object" && Object.entries(e).forEach(([n, i]) => {
|
|
460
460
|
const o = t ? `${t}.${n}` : n;
|
|
461
|
-
|
|
461
|
+
Yt(i, o, r);
|
|
462
462
|
}), r;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
const r = e.success === !0, n = e.keepSubmitLoading === !0, i = e.errors, o =
|
|
466
|
-
Object.entries(o).forEach(([
|
|
467
|
-
if (
|
|
464
|
+
function un(e, t) {
|
|
465
|
+
const r = e.success === !0, n = e.keepSubmitLoading === !0, i = e.errors, o = Yt(i || {}), a = o.form || [], s = {};
|
|
466
|
+
Object.entries(o).forEach(([h, u]) => {
|
|
467
|
+
if (h === "form")
|
|
468
468
|
return;
|
|
469
|
-
const
|
|
470
|
-
s[
|
|
469
|
+
const c = h.split(".")[0];
|
|
470
|
+
s[c] = (s[c] || []).concat(u);
|
|
471
471
|
});
|
|
472
472
|
const l = !r && a.length === 0 && Object.keys(s).length > 0 ? [t || "Submission failed."] : a, d = !r && n && l.length === 0 && Object.keys(s).length === 0;
|
|
473
473
|
return {
|
|
@@ -489,24 +489,24 @@ function nn(e, t) {
|
|
|
489
489
|
meta: e
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
async function
|
|
492
|
+
async function cn(e, t, r = {}) {
|
|
493
493
|
const n = JSON.stringify({
|
|
494
494
|
handle: t,
|
|
495
495
|
renderOptions: r
|
|
496
496
|
});
|
|
497
|
-
|
|
498
|
-
const i = await
|
|
497
|
+
O.log("requestRender start.", { endpoint: e, handle: t });
|
|
498
|
+
const i = await Fe(e, {
|
|
499
499
|
method: "POST",
|
|
500
500
|
body: n,
|
|
501
501
|
headers: {
|
|
502
502
|
"Content-Type": "application/json"
|
|
503
503
|
}
|
|
504
504
|
});
|
|
505
|
-
return
|
|
505
|
+
return O.log("requestRender complete.", {
|
|
506
506
|
hasHtml: !!i.html
|
|
507
507
|
}), i;
|
|
508
508
|
}
|
|
509
|
-
async function
|
|
509
|
+
async function dn(e, t, r = {}) {
|
|
510
510
|
const i = JSON.stringify({
|
|
511
511
|
query: `
|
|
512
512
|
query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
@@ -516,11 +516,11 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
|
516
516
|
}`,
|
|
517
517
|
variables: {
|
|
518
518
|
handle: t,
|
|
519
|
-
input:
|
|
519
|
+
input: ln(r)
|
|
520
520
|
}
|
|
521
521
|
});
|
|
522
|
-
|
|
523
|
-
const o = await
|
|
522
|
+
O.log("requestGraphqlRender start.", { endpoint: e, handle: t });
|
|
523
|
+
const o = await Fe(e, {
|
|
524
524
|
method: "POST",
|
|
525
525
|
body: i,
|
|
526
526
|
headers: {
|
|
@@ -532,50 +532,50 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
|
532
532
|
if (!o.data?.formieHtmlForm)
|
|
533
533
|
throw new Error(`Form not found for handle "${t}".`);
|
|
534
534
|
const a = o.data.formieHtmlForm;
|
|
535
|
-
return
|
|
535
|
+
return O.log("requestGraphqlRender complete.", {
|
|
536
536
|
hasHtml: !!a.html
|
|
537
537
|
}), a;
|
|
538
538
|
}
|
|
539
|
-
async function
|
|
539
|
+
async function nt(e, t, r) {
|
|
540
540
|
const n = new URL(e, window.location.origin);
|
|
541
|
-
n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r),
|
|
541
|
+
n.searchParams.set("handle", t), r && n.searchParams.set("renderId", r), O.log("requestRefreshTokens start.", {
|
|
542
542
|
endpoint: n.toString(),
|
|
543
543
|
handle: t,
|
|
544
544
|
hasRenderId: !!r
|
|
545
545
|
});
|
|
546
|
-
const i = await
|
|
547
|
-
return
|
|
546
|
+
const i = await Fe(n.toString());
|
|
547
|
+
return O.log("requestRefreshTokens complete.", {
|
|
548
548
|
hasRefreshTokens: !!i.refreshTokens
|
|
549
549
|
}), i.refreshTokens || i;
|
|
550
550
|
}
|
|
551
|
-
async function
|
|
551
|
+
async function fn(e, t, r) {
|
|
552
552
|
const n = new URL(e, window.location.origin), i = new FormData();
|
|
553
553
|
if (r && i.append("pageId", r), t) {
|
|
554
554
|
["handle", "renderId", "draftContextToken", "draftContext", "continuationToken"].forEach((d) => {
|
|
555
|
-
const
|
|
556
|
-
|
|
555
|
+
const h = t.querySelector(`input[name="${d}"]`)?.value?.trim();
|
|
556
|
+
h && i.append(d, h);
|
|
557
557
|
});
|
|
558
558
|
const l = t.querySelector('input[name="CRAFT_CSRF_TOKEN"]')?.value?.trim();
|
|
559
559
|
l && i.append("CRAFT_CSRF_TOKEN", l);
|
|
560
560
|
}
|
|
561
|
-
|
|
561
|
+
O.log("requestSetPage start.", {
|
|
562
562
|
requestUrl: n.toString(),
|
|
563
563
|
pageId: r || null
|
|
564
564
|
});
|
|
565
|
-
const o = await
|
|
565
|
+
const o = await Fe(n.toString(), {
|
|
566
566
|
method: "POST",
|
|
567
567
|
body: i
|
|
568
568
|
});
|
|
569
|
-
return
|
|
569
|
+
return O.log("requestSetPage complete.", o), o;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function mn(e, t) {
|
|
572
572
|
const r = new URL(e, window.location.origin), n = new FormData();
|
|
573
573
|
["handle", "renderId", "draftContextToken", "draftContext"].forEach((s) => {
|
|
574
574
|
const d = t.querySelector(`input[name="${s}"]`)?.value?.trim();
|
|
575
575
|
d && n.append(s, d);
|
|
576
576
|
});
|
|
577
577
|
const a = t.querySelector('input[name="CRAFT_CSRF_TOKEN"]')?.value?.trim();
|
|
578
|
-
a && n.append("CRAFT_CSRF_TOKEN", a),
|
|
578
|
+
a && n.append("CRAFT_CSRF_TOKEN", a), O.log("clearSubmissionOnUnload start.", {
|
|
579
579
|
requestUrl: r.toString()
|
|
580
580
|
});
|
|
581
581
|
try {
|
|
@@ -593,9 +593,9 @@ function ln(e, t) {
|
|
|
593
593
|
}
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
|
-
async function
|
|
596
|
+
async function pn(e, t) {
|
|
597
597
|
const r = (e.getAttribute("method") || "POST").toUpperCase(), n = e.getAttribute("action") || window.location.href, i = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
|
|
598
|
-
|
|
598
|
+
O.log("submitForm start.", {
|
|
599
599
|
method: r,
|
|
600
600
|
action: n,
|
|
601
601
|
submitAction: t.get("submitAction")
|
|
@@ -609,13 +609,13 @@ async function un(e, t) {
|
|
|
609
609
|
}
|
|
610
610
|
}), a = o.headers.get("content-type") || "";
|
|
611
611
|
if (!a.includes("application/json"))
|
|
612
|
-
return o.ok ? (
|
|
612
|
+
return o.ok ? (O.log("submitForm non-JSON success response.", {
|
|
613
613
|
status: o.status,
|
|
614
614
|
contentType: a
|
|
615
615
|
}), {
|
|
616
616
|
ok: !0,
|
|
617
617
|
message: "Submission completed."
|
|
618
|
-
}) : (
|
|
618
|
+
}) : (O.warn("submitForm non-JSON HTTP error.", {
|
|
619
619
|
status: o.status,
|
|
620
620
|
contentType: a
|
|
621
621
|
}), {
|
|
@@ -624,29 +624,19 @@ async function un(e, t) {
|
|
|
624
624
|
message: `Request failed (${o.status}).`,
|
|
625
625
|
formErrors: [`Request failed (${o.status}).`]
|
|
626
626
|
});
|
|
627
|
-
const s = await o.json(), l =
|
|
628
|
-
return
|
|
627
|
+
const s = await o.json(), l = un(s, i);
|
|
628
|
+
return O.log("submitForm JSON response normalized.", {
|
|
629
629
|
ok: l.ok,
|
|
630
630
|
code: l.code,
|
|
631
631
|
hasRedirect: !!l.redirect?.url,
|
|
632
632
|
hasSubmitData: Array.isArray(l.submitData) && l.submitData.length > 0
|
|
633
633
|
}), l;
|
|
634
634
|
}
|
|
635
|
-
|
|
636
|
-
function Ve(e, t) {
|
|
637
|
-
return {
|
|
638
|
-
ok: !1,
|
|
639
|
-
stage: e,
|
|
640
|
-
code: "ABORTED",
|
|
641
|
-
message: t || "Submission aborted.",
|
|
642
|
-
formErrors: [t || "Submission aborted."]
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
function rt(e) {
|
|
635
|
+
function it(e) {
|
|
646
636
|
return Array.from(e.querySelectorAll("[data-formie-page]"));
|
|
647
637
|
}
|
|
648
|
-
function
|
|
649
|
-
const t =
|
|
638
|
+
function Zt(e) {
|
|
639
|
+
const t = it(e);
|
|
650
640
|
if (!t.length)
|
|
651
641
|
return {
|
|
652
642
|
scope: e,
|
|
@@ -658,13 +648,23 @@ function fn(e) {
|
|
|
658
648
|
final: r === t[t.length - 1]
|
|
659
649
|
};
|
|
660
650
|
}
|
|
661
|
-
|
|
651
|
+
const gn = ["prepare", "normalize", "validate", "screen", "authorize", "dispatch", "finalize"], hn = ["prepare", "normalize", "validate", "screen", "authorize"], R = _("general", "pipeline");
|
|
652
|
+
function He(e, t) {
|
|
653
|
+
return {
|
|
654
|
+
ok: !1,
|
|
655
|
+
stage: e,
|
|
656
|
+
code: "ABORTED",
|
|
657
|
+
message: t || "Submission aborted.",
|
|
658
|
+
formErrors: [t || "Submission aborted."]
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function Qt(e) {
|
|
662
662
|
return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function Xt(e) {
|
|
665
665
|
return !(!e.name || e.disabled || e instanceof HTMLInputElement && (e.type === "submit" || e.type === "button" || e.type === "reset" || e.type === "image" || (e.type === "checkbox" || e.type === "radio") && !e.checked || e.type === "file" && (!e.files || e.files.length === 0)));
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function er(e, t) {
|
|
668
668
|
if (t instanceof HTMLInputElement) {
|
|
669
669
|
if (t.type === "file") {
|
|
670
670
|
Array.from(t.files || []).forEach((r) => {
|
|
@@ -683,67 +683,67 @@ function Yt(e, t) {
|
|
|
683
683
|
}
|
|
684
684
|
e.append(t.name, t.value);
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function bn(e, t) {
|
|
687
687
|
t.querySelectorAll("input, select, textarea").forEach((r) => {
|
|
688
|
-
const n =
|
|
689
|
-
!n || n.closest("[data-formie-page]") ||
|
|
688
|
+
const n = Qt(r) ? r : null;
|
|
689
|
+
!n || n.closest("[data-formie-page]") || Xt(n) && er(e, n);
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function yn(e, t) {
|
|
693
693
|
const r = /* @__PURE__ */ new Set();
|
|
694
694
|
return t.querySelectorAll("input, select, textarea").forEach((n) => {
|
|
695
|
-
const i =
|
|
696
|
-
!i || !i.name || i.disabled || i instanceof HTMLInputElement && (i.type === "submit" || i.type === "button" || i.type === "reset" || i.type === "image") || (i.name.startsWith("fields[") && r.add(i.name),
|
|
695
|
+
const i = Qt(n) ? n : null;
|
|
696
|
+
!i || !i.name || i.disabled || i instanceof HTMLInputElement && (i.type === "submit" || i.type === "button" || i.type === "reset" || i.type === "image") || (i.name.startsWith("fields[") && r.add(i.name), Xt(i) && er(e, i));
|
|
697
697
|
}), r;
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function vn(e, t) {
|
|
700
700
|
t.forEach((r) => {
|
|
701
701
|
e.has(r) || e.append(r, "");
|
|
702
702
|
});
|
|
703
703
|
}
|
|
704
|
-
function
|
|
705
|
-
const r =
|
|
704
|
+
function vt(e, t) {
|
|
705
|
+
const r = it(e), n = r.find((a) => !a.hasAttribute("data-formie-page-hidden")) || null;
|
|
706
706
|
if (!r.length || !n) {
|
|
707
707
|
const a = new FormData(e);
|
|
708
708
|
return a.set("submitAction", t), a;
|
|
709
709
|
}
|
|
710
710
|
const i = new FormData();
|
|
711
|
-
|
|
712
|
-
const o =
|
|
713
|
-
return
|
|
711
|
+
bn(i, e);
|
|
712
|
+
const o = yn(i, n);
|
|
713
|
+
return vn(i, o), i.set("submitAction", t), i;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function En(e, t) {
|
|
716
716
|
if (t !== "submit")
|
|
717
717
|
return !1;
|
|
718
|
-
const r =
|
|
718
|
+
const r = it(e);
|
|
719
719
|
return r.length ? (r.find((i) => !i.hasAttribute("data-formie-page-hidden")) || r[r.length - 1]) === r[r.length - 1] : !0;
|
|
720
720
|
}
|
|
721
|
-
async function
|
|
721
|
+
async function tr(e, t, r, n = {}) {
|
|
722
722
|
R.log("Starting submit pipeline.", {
|
|
723
723
|
action: t,
|
|
724
724
|
preflightOnly: n.preflightOnly === !0
|
|
725
725
|
});
|
|
726
726
|
let i = !1, o, a = null;
|
|
727
|
-
const s =
|
|
727
|
+
const s = En(e, t), l = {
|
|
728
728
|
form: e,
|
|
729
729
|
action: t,
|
|
730
|
-
formData:
|
|
731
|
-
abort: (
|
|
732
|
-
i = !0, o =
|
|
730
|
+
formData: vt(e, t),
|
|
731
|
+
abort: (u) => {
|
|
732
|
+
i = !0, o = u, R.warn("Pipeline aborted.", { reason: u });
|
|
733
733
|
},
|
|
734
734
|
isAborted: () => i,
|
|
735
735
|
abortReason: () => o
|
|
736
736
|
}, d = {
|
|
737
|
-
prepare: async (
|
|
738
|
-
const
|
|
739
|
-
return
|
|
737
|
+
prepare: async (u) => {
|
|
738
|
+
const c = u.form.querySelector('input[name="submitAction"]');
|
|
739
|
+
return c && (c.value = u.action), u.formData.set("submitAction", u.action), null;
|
|
740
740
|
},
|
|
741
741
|
normalize: async () => null,
|
|
742
|
-
validate: async (
|
|
743
|
-
if (
|
|
742
|
+
validate: async (u) => {
|
|
743
|
+
if (u.action !== "submit" || n.validateOnSubmit === !1)
|
|
744
744
|
return null;
|
|
745
745
|
if (n.validator) {
|
|
746
|
-
const { scope:
|
|
746
|
+
const { scope: c, final: b } = Zt(u.form), A = n.validator.submit(b ? u.form : c, { final: b });
|
|
747
747
|
return A.length > 0 ? (A[0]?.input.focus(), {
|
|
748
748
|
ok: !1,
|
|
749
749
|
stage: "validate",
|
|
@@ -753,7 +753,7 @@ async function Zt(e, t, r, n = {}) {
|
|
|
753
753
|
formErrors: [n.validator.config.errorMessage || "Validation failed."]
|
|
754
754
|
}) : null;
|
|
755
755
|
}
|
|
756
|
-
return
|
|
756
|
+
return u.form.checkValidity() ? null : (u.form.querySelector(":invalid")?.focus(), {
|
|
757
757
|
ok: !1,
|
|
758
758
|
stage: "validate",
|
|
759
759
|
code: "VALIDATION_FAILED",
|
|
@@ -763,148 +763,148 @@ async function Zt(e, t, r, n = {}) {
|
|
|
763
763
|
},
|
|
764
764
|
screen: async () => null,
|
|
765
765
|
authorize: async () => null,
|
|
766
|
-
dispatch: async (
|
|
767
|
-
|
|
768
|
-
const
|
|
769
|
-
return a =
|
|
766
|
+
dispatch: async (u) => {
|
|
767
|
+
u.formData = vt(u.form, u.action);
|
|
768
|
+
const c = await pn(u.form, u.formData);
|
|
769
|
+
return a = c, c;
|
|
770
770
|
},
|
|
771
|
-
finalize: async (
|
|
771
|
+
finalize: async (u) => (a && a.ok && a.redirect?.url && (a.redirect.target === "new-tab" ? window.open(a.redirect.url, "_blank") : window.location.href = a.redirect.url), null)
|
|
772
772
|
};
|
|
773
773
|
{
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
eventName:
|
|
777
|
-
failed:
|
|
774
|
+
const u = await r.emitSafe("formie:submit:before", l);
|
|
775
|
+
u.failed.length > 0 && R.warn("Submit before listeners failed.", {
|
|
776
|
+
eventName: u.eventName,
|
|
777
|
+
failed: u.failed.length
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
if (s) {
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
eventName:
|
|
784
|
-
failed:
|
|
781
|
+
const u = await r.emitSafe("formie:submit:final:before", l);
|
|
782
|
+
u.failed.length > 0 && R.warn("Final submit before listeners failed.", {
|
|
783
|
+
eventName: u.eventName,
|
|
784
|
+
failed: u.failed.length
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
|
-
const p = n.preflightOnly ?
|
|
788
|
-
for (const
|
|
789
|
-
if (R.log("Stage start.", { stage:
|
|
790
|
-
return R.warn("Stage skipped due to abort.", { stage:
|
|
787
|
+
const p = n.preflightOnly ? hn : gn;
|
|
788
|
+
for (const u of p) {
|
|
789
|
+
if (R.log("Stage start.", { stage: u, action: t }), i)
|
|
790
|
+
return R.warn("Stage skipped due to abort.", { stage: u, reason: o }), He(u, o);
|
|
791
791
|
{
|
|
792
|
-
const
|
|
792
|
+
const b = await r.emitSafe(`formie:stage:${u}:before`, {
|
|
793
793
|
...l,
|
|
794
|
-
stage:
|
|
794
|
+
stage: u
|
|
795
795
|
});
|
|
796
|
-
|
|
797
|
-
stage:
|
|
798
|
-
failed:
|
|
796
|
+
b.failed.length > 0 && R.warn("Stage before listeners failed.", {
|
|
797
|
+
stage: u,
|
|
798
|
+
failed: b.failed.length
|
|
799
799
|
});
|
|
800
800
|
}
|
|
801
801
|
if (i) {
|
|
802
|
-
const
|
|
802
|
+
const b = He(u, o);
|
|
803
803
|
{
|
|
804
|
-
const A = await r.emitSafe("formie:submit:after",
|
|
804
|
+
const A = await r.emitSafe("formie:submit:after", b);
|
|
805
805
|
A.failed.length > 0 && R.warn("Submit after listeners failed (abort before stage).", {
|
|
806
|
-
stage:
|
|
806
|
+
stage: u,
|
|
807
807
|
failed: A.failed.length
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
if (s) {
|
|
811
|
-
const A = await r.emitSafe("formie:submit:final:after",
|
|
811
|
+
const A = await r.emitSafe("formie:submit:final:after", b);
|
|
812
812
|
A.failed.length > 0 && R.warn("Final submit after listeners failed (abort before stage).", {
|
|
813
|
-
stage:
|
|
813
|
+
stage: u,
|
|
814
814
|
failed: A.failed.length
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
|
-
return R.warn("Aborted after stage before-hooks.", { stage:
|
|
817
|
+
return R.warn("Aborted after stage before-hooks.", { stage: u, reason: o }), b;
|
|
818
818
|
}
|
|
819
|
-
const
|
|
819
|
+
const c = await d[u](l);
|
|
820
820
|
R.log("Stage runner complete.", {
|
|
821
|
-
stage:
|
|
822
|
-
hasResult: !!
|
|
823
|
-
ok:
|
|
824
|
-
code:
|
|
821
|
+
stage: u,
|
|
822
|
+
hasResult: !!c,
|
|
823
|
+
ok: c ? c.ok : void 0,
|
|
824
|
+
code: c?.code
|
|
825
825
|
});
|
|
826
826
|
{
|
|
827
|
-
const
|
|
827
|
+
const b = await r.emitSafe(`formie:stage:${u}:after`, {
|
|
828
828
|
...l,
|
|
829
|
-
stage:
|
|
830
|
-
result:
|
|
829
|
+
stage: u,
|
|
830
|
+
result: c
|
|
831
831
|
});
|
|
832
|
-
|
|
833
|
-
stage:
|
|
834
|
-
failed:
|
|
832
|
+
b.failed.length > 0 && R.warn("Stage after listeners failed.", {
|
|
833
|
+
stage: u,
|
|
834
|
+
failed: b.failed.length
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
837
|
if (i) {
|
|
838
|
-
const
|
|
838
|
+
const b = He(u, o);
|
|
839
839
|
{
|
|
840
|
-
const A = await r.emitSafe("formie:submit:after",
|
|
840
|
+
const A = await r.emitSafe("formie:submit:after", b);
|
|
841
841
|
A.failed.length > 0 && R.warn("Submit after listeners failed (abort after stage).", {
|
|
842
|
-
stage:
|
|
842
|
+
stage: u,
|
|
843
843
|
failed: A.failed.length
|
|
844
844
|
});
|
|
845
845
|
}
|
|
846
846
|
if (s) {
|
|
847
|
-
const A = await r.emitSafe("formie:submit:final:after",
|
|
847
|
+
const A = await r.emitSafe("formie:submit:final:after", b);
|
|
848
848
|
A.failed.length > 0 && R.warn("Final submit after listeners failed (abort after stage).", {
|
|
849
|
-
stage:
|
|
849
|
+
stage: u,
|
|
850
850
|
failed: A.failed.length
|
|
851
851
|
});
|
|
852
852
|
}
|
|
853
|
-
return R.warn("Aborted after stage after-hooks.", { stage:
|
|
853
|
+
return R.warn("Aborted after stage after-hooks.", { stage: u, reason: o }), b;
|
|
854
854
|
}
|
|
855
|
-
if (
|
|
855
|
+
if (c && !c.ok) {
|
|
856
856
|
{
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
stage:
|
|
860
|
-
failed:
|
|
857
|
+
const b = await r.emitSafe("formie:submit:after", c);
|
|
858
|
+
b.failed.length > 0 && R.warn("Submit after listeners failed (failed stage).", {
|
|
859
|
+
stage: u,
|
|
860
|
+
failed: b.failed.length
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
863
|
if (s) {
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
stage:
|
|
867
|
-
failed:
|
|
864
|
+
const b = await r.emitSafe("formie:submit:final:after", c);
|
|
865
|
+
b.failed.length > 0 && R.warn("Final submit after listeners failed (failed stage).", {
|
|
866
|
+
stage: u,
|
|
867
|
+
failed: b.failed.length
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
870
|
return R.warn("Pipeline short-circuited by failed stage.", {
|
|
871
|
-
stage:
|
|
872
|
-
code:
|
|
873
|
-
message:
|
|
874
|
-
}),
|
|
871
|
+
stage: u,
|
|
872
|
+
code: c.code,
|
|
873
|
+
message: c.message
|
|
874
|
+
}), c;
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
|
-
const
|
|
877
|
+
const h = a || {
|
|
878
878
|
ok: !0,
|
|
879
879
|
stage: n.preflightOnly ? "authorize" : "finalize",
|
|
880
880
|
message: n.preflightOnly ? "Submission preflight completed." : "Submission completed."
|
|
881
881
|
};
|
|
882
882
|
{
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
failed:
|
|
883
|
+
const u = await r.emitSafe("formie:submit:after", h);
|
|
884
|
+
u.failed.length > 0 && R.warn("Submit after listeners failed (success).", {
|
|
885
|
+
failed: u.failed.length
|
|
886
886
|
});
|
|
887
887
|
}
|
|
888
888
|
if (s) {
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
failed:
|
|
889
|
+
const u = await r.emitSafe("formie:submit:final:after", h);
|
|
890
|
+
u.failed.length > 0 && R.warn("Final submit after listeners failed (success).", {
|
|
891
|
+
failed: u.failed.length
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
894
|
return R.log("Pipeline completed.", {
|
|
895
|
-
ok:
|
|
896
|
-
stage:
|
|
897
|
-
code:
|
|
898
|
-
}),
|
|
895
|
+
ok: h.ok,
|
|
896
|
+
stage: h.stage,
|
|
897
|
+
code: h.code
|
|
898
|
+
}), h;
|
|
899
899
|
}
|
|
900
|
-
const
|
|
900
|
+
const Sn = {
|
|
901
901
|
rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
|
|
902
902
|
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? r("{attribute} is not a valid email address.", { attribute: t })
|
|
903
903
|
};
|
|
904
|
-
function
|
|
904
|
+
function An(e) {
|
|
905
905
|
return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function Et(e) {
|
|
908
908
|
const t = e.getRule("match");
|
|
909
909
|
if (!t || t === !0 || typeof t != "object" || !e.field)
|
|
910
910
|
return null;
|
|
@@ -914,19 +914,19 @@ function bt(e) {
|
|
|
914
914
|
const n = e.form.querySelector(`[data-formie-field-handle="${r}"]`);
|
|
915
915
|
return n ? n.querySelector(e.config.fieldsSelector) : null;
|
|
916
916
|
}
|
|
917
|
-
const
|
|
917
|
+
const wn = {
|
|
918
918
|
rule: (e) => {
|
|
919
|
-
const t =
|
|
919
|
+
const t = Et(e);
|
|
920
920
|
return t ? t.value === e.input.value : !0;
|
|
921
921
|
},
|
|
922
922
|
message: (e) => {
|
|
923
|
-
const r =
|
|
923
|
+
const r = Et(e)?.closest("[data-formie-field-handle]"), n = An(r);
|
|
924
924
|
return e.t("{name} must match {value}.", {
|
|
925
925
|
name: e.label,
|
|
926
926
|
value: n
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
|
-
},
|
|
929
|
+
}, Tn = {
|
|
930
930
|
rule: ({ input: e, getRule: t }) => {
|
|
931
931
|
const r = t("number");
|
|
932
932
|
if (!r || !e.value || e.value.trim() === "")
|
|
@@ -945,7 +945,7 @@ const vn = {
|
|
|
945
945
|
const i = r("number"), o = i !== !0 && i && typeof i == "object" && typeof i.min == "number" ? i.min : null, a = i !== !0 && i && typeof i == "object" && typeof i.max == "number" ? i.max : null;
|
|
946
946
|
return o !== null && a !== null ? n("{attribute} must be between {min} and {max}.", { attribute: t, min: o, max: a }) : o !== null ? n("{attribute} must be no less than {min}.", { attribute: t, min: o }) : a !== null ? n("{attribute} must be no greater than {max}.", { attribute: t, max: a }) : e.getAttribute("data-formie-pattern-number-message") ?? e.getAttribute("data-pattern-number-message") ?? n("{attribute} is not a valid number.", { attribute: t });
|
|
947
947
|
}
|
|
948
|
-
},
|
|
948
|
+
}, Mn = {
|
|
949
949
|
rule: ({ input: e, getRule: t }) => {
|
|
950
950
|
if (!t("required") || e.type === "hidden")
|
|
951
951
|
return !0;
|
|
@@ -956,7 +956,7 @@ const vn = {
|
|
|
956
956
|
return e.value.trim() !== "";
|
|
957
957
|
},
|
|
958
958
|
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? r("{attribute} cannot be blank.", { attribute: t })
|
|
959
|
-
},
|
|
959
|
+
}, Cn = {
|
|
960
960
|
rule: ({ input: e, getRule: t }) => {
|
|
961
961
|
if (!t("url") || !e.value || e.value.length < 1)
|
|
962
962
|
return !0;
|
|
@@ -967,19 +967,19 @@ const vn = {
|
|
|
967
967
|
}
|
|
968
968
|
},
|
|
969
969
|
message: ({ input: e, label: t, t: r }) => e.getAttribute("data-formie-pattern-url-message") ?? e.getAttribute("data-pattern-url-message") ?? r("{attribute} is not a valid URL.", { attribute: t })
|
|
970
|
-
},
|
|
970
|
+
}, Ln = {
|
|
971
971
|
// Keep the core validator registry centralized so FormieValidator can extend
|
|
972
972
|
// it at runtime while still shipping one predictable builtin rule surface.
|
|
973
|
-
required:
|
|
974
|
-
email:
|
|
975
|
-
url:
|
|
976
|
-
number:
|
|
977
|
-
match:
|
|
973
|
+
required: Mn,
|
|
974
|
+
email: Sn,
|
|
975
|
+
url: Cn,
|
|
976
|
+
number: Tn,
|
|
977
|
+
match: wn
|
|
978
978
|
};
|
|
979
|
-
function
|
|
979
|
+
function rr() {
|
|
980
980
|
return window.FormieTranslations || {};
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function In() {
|
|
983
983
|
if (typeof document > "u")
|
|
984
984
|
return;
|
|
985
985
|
const e = Array.from(document.querySelectorAll('script[type="application/json"][data-formie-translations]:not([data-formie-translations-loaded="true"])'));
|
|
@@ -995,7 +995,7 @@ function Tn() {
|
|
|
995
995
|
if (!i || Array.isArray(i) || typeof i != "object")
|
|
996
996
|
continue;
|
|
997
997
|
t = {
|
|
998
|
-
...t ??
|
|
998
|
+
...t ?? rr(),
|
|
999
999
|
...i
|
|
1000
1000
|
};
|
|
1001
1001
|
} catch {
|
|
@@ -1004,26 +1004,26 @@ function Tn() {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
t && (window.FormieTranslations = t);
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
return
|
|
1007
|
+
function ot() {
|
|
1008
|
+
return In(), rr();
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
return { ...
|
|
1010
|
+
function nr() {
|
|
1011
|
+
return { ...ot() };
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return window.FormieTranslations = { ...e },
|
|
1013
|
+
function ia(e) {
|
|
1014
|
+
return window.FormieTranslations = { ...e }, nr();
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function oa(e) {
|
|
1017
1017
|
return window.FormieTranslations = {
|
|
1018
|
-
...
|
|
1018
|
+
...ot(),
|
|
1019
1019
|
...e
|
|
1020
|
-
},
|
|
1020
|
+
}, nr();
|
|
1021
1021
|
}
|
|
1022
1022
|
function x(e, t = {}) {
|
|
1023
|
-
let r =
|
|
1023
|
+
let r = ot()[e] || e;
|
|
1024
1024
|
return r = r.replace(/{([a-zA-Z0-9]+)}/g, (n, i) => Object.prototype.hasOwnProperty.call(t, i) ? String(t[i]) : n), r;
|
|
1025
1025
|
}
|
|
1026
|
-
const
|
|
1026
|
+
const aa = x, Fn = {
|
|
1027
1027
|
// eslint-disable-next-line
|
|
1028
1028
|
email: /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$/,
|
|
1029
1029
|
url: /^(?:(?:https?|HTTPS?|ftp|FTP):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)(?:\.(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)*(?:\.(?:[a-zA-Z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/,
|
|
@@ -1036,7 +1036,7 @@ const Qo = x, Cn = {
|
|
|
1036
1036
|
function oe(e) {
|
|
1037
1037
|
return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Rn(e, t) {
|
|
1040
1040
|
const r = (e.getAttribute("aria-describedby") || "").trim();
|
|
1041
1041
|
if (!r)
|
|
1042
1042
|
return;
|
|
@@ -1047,17 +1047,17 @@ function Mn(e, t) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
e.removeAttribute("aria-describedby");
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1050
|
+
function kn(e, t) {
|
|
1051
1051
|
const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
|
|
1052
1052
|
n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1054
|
+
function qn(e, t) {
|
|
1055
1055
|
e.setAttribute("aria-errormessage", t);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Pn(e, t) {
|
|
1058
1058
|
e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
|
|
1059
1059
|
}
|
|
1060
|
-
class
|
|
1060
|
+
class Vn {
|
|
1061
1061
|
constructor(t, r = {}) {
|
|
1062
1062
|
this.errors = [], this.validators = {}, this.boundListeners = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.submitted = !1, this.initialValues = /* @__PURE__ */ new WeakMap(), this.form = t, this.onBlur = this.blurHandler.bind(this), this.onChange = this.changeHandler.bind(this), this.onInput = this.inputHandler.bind(this), this.config = {
|
|
1063
1063
|
live: !1,
|
|
@@ -1067,9 +1067,9 @@ class Rn {
|
|
|
1067
1067
|
messagesClass: [],
|
|
1068
1068
|
messageClass: [],
|
|
1069
1069
|
fieldsSelector: 'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([disabled]), select:not([disabled]), textarea:not([disabled])',
|
|
1070
|
-
patterns:
|
|
1070
|
+
patterns: Fn,
|
|
1071
1071
|
...r
|
|
1072
|
-
}, Object.entries(
|
|
1072
|
+
}, Object.entries(Ln).forEach(([n, i]) => {
|
|
1073
1073
|
this.addValidator(n, i.rule, i.message);
|
|
1074
1074
|
}), this.init();
|
|
1075
1075
|
}
|
|
@@ -1098,6 +1098,9 @@ class Rn {
|
|
|
1098
1098
|
shouldShowError(t) {
|
|
1099
1099
|
return this.submitted || this.activated.has(t);
|
|
1100
1100
|
}
|
|
1101
|
+
isValid(t = null, r = {}) {
|
|
1102
|
+
return this.validate(t, r).length === 0;
|
|
1103
|
+
}
|
|
1101
1104
|
validate(t = null, r = {}) {
|
|
1102
1105
|
this.errors = [];
|
|
1103
1106
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -1115,12 +1118,12 @@ class Rn {
|
|
|
1115
1118
|
const l = this.getValidatorCallbackOptions(i);
|
|
1116
1119
|
Object.entries(this.validators).forEach(([d, p]) => {
|
|
1117
1120
|
if (!p.validate(l)) {
|
|
1118
|
-
const
|
|
1119
|
-
this.shouldShowError(i) && !o && this.showError(i, d,
|
|
1121
|
+
const u = this.getErrorMessage(i, d, p, l);
|
|
1122
|
+
this.shouldShowError(i) && !o && this.showError(i, d, u), this.errors.push({
|
|
1120
1123
|
input: i,
|
|
1121
1124
|
field: l.field,
|
|
1122
1125
|
validator: d,
|
|
1123
|
-
message:
|
|
1126
|
+
message: u,
|
|
1124
1127
|
handle: l.field?.getAttribute("data-formie-field-handle") || null,
|
|
1125
1128
|
result: !1
|
|
1126
1129
|
}), o = !0;
|
|
@@ -1147,9 +1150,9 @@ class Rn {
|
|
|
1147
1150
|
o.remove();
|
|
1148
1151
|
}), n && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((o) => {
|
|
1149
1152
|
const a = o;
|
|
1150
|
-
a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i &&
|
|
1153
|
+
a.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && a.classList.remove(...this.config.inputErrorClass), a.removeAttribute("data-formie-input-has-error"), i && Rn(a, i), r.querySelectorAll("[data-formie-field-error]").forEach((s) => {
|
|
1151
1154
|
const l = s.id;
|
|
1152
|
-
l &&
|
|
1155
|
+
l && Pn(a, l);
|
|
1153
1156
|
});
|
|
1154
1157
|
});
|
|
1155
1158
|
for (let o = r; o; o = o.parentElement?.closest("[data-formie-field-handle]"))
|
|
@@ -1169,7 +1172,7 @@ class Rn {
|
|
|
1169
1172
|
const l = document.createElement("div");
|
|
1170
1173
|
l.setAttribute("data-formie-field-error", "true"), l.setAttribute(`data-formie-field-error-${r}`, "true"), l.setAttribute("id", s), l.setAttribute("role", "alert"), this.config.messageClass.length && l.classList.add(...this.config.messageClass), l.textContent = n, o.appendChild(l), i.setAttribute("data-formie-field-has-error", "true"), i.querySelectorAll("input, select, textarea").forEach((d) => {
|
|
1171
1174
|
const p = d;
|
|
1172
|
-
p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"),
|
|
1175
|
+
p.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && p.classList.add(...this.config.inputErrorClass), p.setAttribute("data-formie-input-has-error", "true"), kn(p, o.id), qn(p, s);
|
|
1173
1176
|
});
|
|
1174
1177
|
for (let d = i; d; d = d.parentElement?.closest("[data-formie-field-handle]"))
|
|
1175
1178
|
this.config.fieldContainerErrorClass.length && d.classList.add(...this.config.fieldContainerErrorClass), d.setAttribute("data-formie-field-has-error", "true");
|
|
@@ -1286,18 +1289,94 @@ class Rn {
|
|
|
1286
1289
|
delete this.validators[t];
|
|
1287
1290
|
}
|
|
1288
1291
|
}
|
|
1289
|
-
const
|
|
1290
|
-
function
|
|
1292
|
+
const he = "data-formie-submit-validation-disabled", Oe = "data-formie-preserve-disabled", $n = "data-formie-submit-ready";
|
|
1293
|
+
function ir(e) {
|
|
1294
|
+
return e.dataset.formieDisableSubmitUntilValid === "true";
|
|
1295
|
+
}
|
|
1296
|
+
function Hn(e) {
|
|
1297
|
+
return Array.from(e.querySelectorAll('button[data-formie-action="submit"]')).filter((t) => t instanceof HTMLButtonElement);
|
|
1298
|
+
}
|
|
1299
|
+
function On(e) {
|
|
1300
|
+
return !e.hasAttribute("data-formie-conditionally-hidden") && !e.closest("[data-formie-conditionally-hidden]");
|
|
1301
|
+
}
|
|
1302
|
+
function at(e, t) {
|
|
1303
|
+
if (!ir(e) || e.getAttribute("data-formie-loading") === "true")
|
|
1304
|
+
return;
|
|
1305
|
+
const { scope: r, final: n } = Zt(e), i = t.isValid(r, {
|
|
1306
|
+
includeHiddenPages: n
|
|
1307
|
+
});
|
|
1308
|
+
e.setAttribute($n, i ? "true" : "false"), Hn(e).forEach((o) => {
|
|
1309
|
+
if (On(o)) {
|
|
1310
|
+
if (i) {
|
|
1311
|
+
if (!o.hasAttribute(he))
|
|
1312
|
+
return;
|
|
1313
|
+
o.hasAttribute(Oe) ? (o.disabled = !0, o.removeAttribute(Oe)) : o.disabled = !1, o.removeAttribute(he);
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
o.hasAttribute(he) || (o.disabled && o.setAttribute(Oe, "true"), o.setAttribute(he, "true")), o.disabled = !0;
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
function _n(e, t, r) {
|
|
1321
|
+
if (!ir(e))
|
|
1322
|
+
return () => {
|
|
1323
|
+
};
|
|
1324
|
+
let n = !1;
|
|
1325
|
+
const i = () => {
|
|
1326
|
+
n || (n = !0, queueMicrotask(() => {
|
|
1327
|
+
n = !1, at(e, t);
|
|
1328
|
+
}));
|
|
1329
|
+
};
|
|
1330
|
+
i();
|
|
1331
|
+
const o = () => {
|
|
1332
|
+
i();
|
|
1333
|
+
};
|
|
1334
|
+
e.addEventListener("input", o, !0), e.addEventListener("change", o, !0);
|
|
1335
|
+
const a = () => {
|
|
1336
|
+
window.setTimeout(() => {
|
|
1337
|
+
i();
|
|
1338
|
+
}, 0);
|
|
1339
|
+
};
|
|
1340
|
+
e.addEventListener("reset", a);
|
|
1341
|
+
const s = () => {
|
|
1342
|
+
i();
|
|
1343
|
+
};
|
|
1344
|
+
r.addEventListener("formie:conditions:evaluated", s);
|
|
1345
|
+
const l = new MutationObserver((d) => {
|
|
1346
|
+
d.some((h) => {
|
|
1347
|
+
if (h.type === "attributes") {
|
|
1348
|
+
const u = h.attributeName || "";
|
|
1349
|
+
return u === "data-formie-page-hidden" || u === "data-formie-conditionally-hidden" || u === "data-formie-loading" || u === "disabled";
|
|
1350
|
+
}
|
|
1351
|
+
return h.type === "childList";
|
|
1352
|
+
}) && i();
|
|
1353
|
+
});
|
|
1354
|
+
return l.observe(e, {
|
|
1355
|
+
childList: !0,
|
|
1356
|
+
subtree: !0,
|
|
1357
|
+
attributes: !0,
|
|
1358
|
+
attributeFilter: [
|
|
1359
|
+
"data-formie-page-hidden",
|
|
1360
|
+
"data-formie-conditionally-hidden",
|
|
1361
|
+
"data-formie-loading",
|
|
1362
|
+
"disabled"
|
|
1363
|
+
]
|
|
1364
|
+
}), () => {
|
|
1365
|
+
e.removeEventListener("input", o, !0), e.removeEventListener("change", o, !0), e.removeEventListener("reset", a), r.removeEventListener("formie:conditions:evaluated", s), l.disconnect();
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
const Dn = "STALE_SUBMISSION_STATE", St = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), B = _("general", "submit-result");
|
|
1369
|
+
function je(e, t, r) {
|
|
1291
1370
|
let n = e.querySelector(`input[name="${t}"]`);
|
|
1292
1371
|
n || (n = document.createElement("input"), n.type = "hidden", n.name = t, e.appendChild(n)), n.value = r;
|
|
1293
1372
|
}
|
|
1294
|
-
function
|
|
1373
|
+
function At(e, t) {
|
|
1295
1374
|
e.setAttribute("data-formie-internal-navigation", t);
|
|
1296
1375
|
}
|
|
1297
1376
|
function ae(e, t) {
|
|
1298
1377
|
e.querySelector(`input[name="${t}"]`)?.remove();
|
|
1299
1378
|
}
|
|
1300
|
-
function
|
|
1379
|
+
function xn(e, t) {
|
|
1301
1380
|
try {
|
|
1302
1381
|
const r = new URL(e, window.location.href);
|
|
1303
1382
|
return r.searchParams.delete(t), r.toString();
|
|
@@ -1305,36 +1384,36 @@ function qn(e, t) {
|
|
|
1305
1384
|
return e;
|
|
1306
1385
|
}
|
|
1307
1386
|
}
|
|
1308
|
-
function
|
|
1387
|
+
function Nn(e) {
|
|
1309
1388
|
try {
|
|
1310
1389
|
return new URL(e, window.location.href).origin === window.location.origin;
|
|
1311
1390
|
} catch {
|
|
1312
1391
|
return !1;
|
|
1313
1392
|
}
|
|
1314
1393
|
}
|
|
1315
|
-
function
|
|
1394
|
+
function or(e) {
|
|
1316
1395
|
return Array.from(e.querySelectorAll("[data-formie-page]"));
|
|
1317
1396
|
}
|
|
1318
|
-
function
|
|
1397
|
+
function Un(e) {
|
|
1319
1398
|
return Array.from(e.querySelectorAll("[data-formie-tab]"));
|
|
1320
1399
|
}
|
|
1321
|
-
function
|
|
1400
|
+
function zn(e, t, r) {
|
|
1322
1401
|
return t < 0 || r < 1 ? 0 : (e.dataset.formieProgressCalculation === "page-position" ? "page-position" : "completion") === "page-position" ? Math.round((t + 1) / r * 100) : Math.round(t / r * 100);
|
|
1323
1402
|
}
|
|
1324
|
-
function
|
|
1403
|
+
function Bn(e) {
|
|
1325
1404
|
return e <= 0 ? "start" : e >= 100 ? "end" : "middle";
|
|
1326
1405
|
}
|
|
1327
|
-
function
|
|
1406
|
+
function wt(e) {
|
|
1328
1407
|
return (e.dataset.formieSubmitAction || "").trim();
|
|
1329
1408
|
}
|
|
1330
|
-
function
|
|
1409
|
+
function Tt(e) {
|
|
1331
1410
|
const t = e.dataset.formieSubmitActionFormHide;
|
|
1332
1411
|
if (t === void 0)
|
|
1333
1412
|
return !1;
|
|
1334
1413
|
const r = t.trim().toLowerCase();
|
|
1335
1414
|
return r === "true" || r === "1" || r === "";
|
|
1336
1415
|
}
|
|
1337
|
-
function
|
|
1416
|
+
function st(e, t) {
|
|
1338
1417
|
const r = [
|
|
1339
1418
|
"[data-formie-form-header]",
|
|
1340
1419
|
"[data-formie-form-navigation]",
|
|
@@ -1349,78 +1428,84 @@ function it(e, t) {
|
|
|
1349
1428
|
});
|
|
1350
1429
|
}
|
|
1351
1430
|
function z(e) {
|
|
1352
|
-
const t =
|
|
1353
|
-
typeof t == "number" && (window.clearTimeout(t),
|
|
1431
|
+
const t = St.get(e);
|
|
1432
|
+
typeof t == "number" && (window.clearTimeout(t), St.delete(e));
|
|
1354
1433
|
}
|
|
1355
|
-
function
|
|
1356
|
-
|
|
1434
|
+
function jn(e, t) {
|
|
1435
|
+
Te.has(e) || Te.set(e, e.innerHTML), e.textContent = t;
|
|
1357
1436
|
}
|
|
1358
|
-
function
|
|
1359
|
-
const t =
|
|
1360
|
-
t !== void 0 && (e.innerHTML = t,
|
|
1437
|
+
function We(e) {
|
|
1438
|
+
const t = Te.get(e);
|
|
1439
|
+
t !== void 0 && (e.innerHTML = t, Te.delete(e));
|
|
1361
1440
|
}
|
|
1362
|
-
function
|
|
1441
|
+
function Wn(e, t) {
|
|
1363
1442
|
const r = e.querySelector("[data-formie-progress-bar]"), n = e.querySelector("[data-formie-progress-value]");
|
|
1364
|
-
r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state",
|
|
1443
|
+
r && (r.style.width = `${t}%`, r.setAttribute("aria-valuenow", `${t}`), r.setAttribute("data-formie-progress-state", Bn(t)), n && (n.textContent = `${t}%`, n.setAttribute("data-formie-progress-value", `${t}`)));
|
|
1365
1444
|
}
|
|
1366
|
-
function
|
|
1445
|
+
function Kn(e, t) {
|
|
1367
1446
|
if (!t)
|
|
1368
1447
|
return;
|
|
1369
1448
|
const r = (e.dataset.formieLoadingIndicator || "").trim();
|
|
1370
1449
|
if (r) {
|
|
1371
1450
|
if (t.setAttribute("data-formie-loading-indicator", r), r === "spinner") {
|
|
1372
|
-
ue(t, e, "loading", !0),
|
|
1451
|
+
ue(t, e, "loading", !0), We(t), t.removeAttribute("data-formie-loading-text");
|
|
1373
1452
|
return;
|
|
1374
1453
|
}
|
|
1375
1454
|
if (r === "text") {
|
|
1376
1455
|
const n = (e.dataset.formieLoadingIndicatorText || "").trim(), i = t.textContent?.trim() || "", o = n || i;
|
|
1377
|
-
t.setAttribute("data-formie-loading-text", o),
|
|
1456
|
+
t.setAttribute("data-formie-loading-text", o), jn(t, o);
|
|
1378
1457
|
return;
|
|
1379
1458
|
}
|
|
1380
|
-
|
|
1459
|
+
We(t), t.removeAttribute("data-formie-loading-text");
|
|
1381
1460
|
}
|
|
1382
1461
|
}
|
|
1383
|
-
function
|
|
1462
|
+
function ar(e) {
|
|
1384
1463
|
return Array.from(e.querySelectorAll("[data-formie-action]"));
|
|
1385
1464
|
}
|
|
1386
|
-
function
|
|
1465
|
+
function sr(e, t) {
|
|
1387
1466
|
if (e.getAttribute("data-formie-loading") === "true")
|
|
1388
1467
|
return;
|
|
1389
|
-
e.setAttribute("data-formie-loading", "true"),
|
|
1468
|
+
e.setAttribute("data-formie-loading", "true"), ar(e).forEach((n) => {
|
|
1390
1469
|
"disabled" in n && (n.disabled ? n.setAttribute("data-formie-was-disabled", "true") : n.removeAttribute("data-formie-was-disabled"), n.disabled = !0);
|
|
1391
|
-
}), t && (t.setAttribute("data-formie-loading", "true"),
|
|
1470
|
+
}), t && (t.setAttribute("data-formie-loading", "true"), Kn(e, t));
|
|
1392
1471
|
}
|
|
1393
|
-
function
|
|
1394
|
-
e.removeAttribute("data-formie-loading"),
|
|
1472
|
+
function Me(e) {
|
|
1473
|
+
if (e.removeAttribute("data-formie-loading"), ar(e).forEach((r) => {
|
|
1395
1474
|
if ("disabled" in r) {
|
|
1396
1475
|
const n = r, i = n.getAttribute("data-formie-was-disabled") === "true";
|
|
1397
1476
|
n.disabled = i;
|
|
1398
1477
|
}
|
|
1399
|
-
|
|
1400
|
-
})
|
|
1478
|
+
We(r), r.removeAttribute("data-formie-was-disabled"), r.removeAttribute("data-formie-loading"), ue(r, e, "loading", !1), r.removeAttribute("data-formie-loading-indicator"), r.removeAttribute("data-formie-loading-text");
|
|
1479
|
+
}), e.dataset.formieDisableSubmitUntilValid === "true") {
|
|
1480
|
+
const r = e;
|
|
1481
|
+
r.formieValidation && at(e, r.formieValidation);
|
|
1482
|
+
}
|
|
1401
1483
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const r =
|
|
1484
|
+
function lt(e, t) {
|
|
1485
|
+
const r = or(e), n = Un(e), i = r.findIndex((o) => o.getAttribute("data-formie-page-id") === t);
|
|
1404
1486
|
if (r.forEach((o) => {
|
|
1405
|
-
o.getAttribute("data-formie-page-id") === t ? (o.removeAttribute("data-formie-page-hidden"), le(o, e, "pageHidden")) : (o.setAttribute("data-formie-page-hidden", "true"),
|
|
1487
|
+
o.getAttribute("data-formie-page-id") === t ? (o.removeAttribute("data-formie-page-hidden"), le(o, e, "pageHidden")) : (o.setAttribute("data-formie-page-hidden", "true"), $(o, e, "pageHidden"));
|
|
1406
1488
|
}), n.forEach((o, a) => {
|
|
1407
1489
|
const s = o.getAttribute("data-formie-page-id") === t, l = i > -1 && a < i;
|
|
1408
1490
|
ue(o, e, "tabCurrent", s), ue(o, e, "tabComplete", l), s ? o.setAttribute("aria-current", "page") : o.removeAttribute("aria-current"), l ? o.setAttribute("data-formie-tab-complete", "true") : o.removeAttribute("data-formie-tab-complete");
|
|
1409
1491
|
}), i > -1 && r.length > 0) {
|
|
1410
|
-
const o =
|
|
1411
|
-
|
|
1492
|
+
const o = zn(e, i, r.length);
|
|
1493
|
+
Wn(e, o);
|
|
1494
|
+
}
|
|
1495
|
+
if (je(e, "pageId", t), J(e), e.dataset.formieDisableSubmitUntilValid === "true") {
|
|
1496
|
+
const o = e;
|
|
1497
|
+
o.formieValidation && at(e, o.formieValidation);
|
|
1412
1498
|
}
|
|
1413
|
-
ze(e, "pageId", t), J(e);
|
|
1414
1499
|
}
|
|
1415
|
-
function
|
|
1500
|
+
function Gn(e, t) {
|
|
1416
1501
|
const r = t.meta?.submissionUid;
|
|
1417
|
-
typeof r == "string" && r.trim() !== "" &&
|
|
1502
|
+
typeof r == "string" && r.trim() !== "" && je(e, "submissionUid", r);
|
|
1418
1503
|
const n = t.meta?.session?.continuation?.continuationToken;
|
|
1419
|
-
typeof n == "string" && n.trim() !== "" ?
|
|
1504
|
+
typeof n == "string" && n.trim() !== "" ? je(e, "continuationToken", n) : ae(e, "continuationToken");
|
|
1420
1505
|
}
|
|
1421
|
-
function
|
|
1506
|
+
function Jn(e) {
|
|
1422
1507
|
const t = e.getAttribute("action");
|
|
1423
|
-
t && e.setAttribute("action",
|
|
1508
|
+
t && e.setAttribute("action", xn(t, "resumeToken"));
|
|
1424
1509
|
try {
|
|
1425
1510
|
const r = new URL(window.location.href);
|
|
1426
1511
|
if (!r.searchParams.has("resumeToken"))
|
|
@@ -1429,12 +1514,12 @@ function Nn(e) {
|
|
|
1429
1514
|
} catch {
|
|
1430
1515
|
}
|
|
1431
1516
|
}
|
|
1432
|
-
function
|
|
1517
|
+
function Yn(e, t) {
|
|
1433
1518
|
const r = t.meta?.resumeUrl;
|
|
1434
1519
|
if (typeof r != "string" || r.trim() === "")
|
|
1435
1520
|
return;
|
|
1436
1521
|
const n = r.trim();
|
|
1437
|
-
if (!
|
|
1522
|
+
if (!Nn(n))
|
|
1438
1523
|
return;
|
|
1439
1524
|
e.getAttribute("action") && e.setAttribute("action", n);
|
|
1440
1525
|
try {
|
|
@@ -1443,31 +1528,31 @@ function Un(e, t) {
|
|
|
1443
1528
|
} catch {
|
|
1444
1529
|
}
|
|
1445
1530
|
}
|
|
1446
|
-
function
|
|
1447
|
-
const n = e.formieValidation, i =
|
|
1448
|
-
if (z(e), e.reset(), t.preserveHiddenState ||
|
|
1449
|
-
|
|
1531
|
+
function be(e, t = {}) {
|
|
1532
|
+
const n = e.formieValidation, i = or(e)[0]?.getAttribute("data-formie-page-id");
|
|
1533
|
+
if (z(e), e.reset(), t.preserveHiddenState || st(e, !1), ae(e, "submissionId"), ae(e, "submissionUid"), ae(e, "continuationToken"), ae(e, "pageId"), Jn(e), n?.resetLiveState(), i) {
|
|
1534
|
+
lt(e, i), e.dispatchEvent(new CustomEvent(Be("reset"), { bubbles: !0 }));
|
|
1450
1535
|
return;
|
|
1451
1536
|
}
|
|
1452
|
-
J(e), e.dispatchEvent(new CustomEvent(
|
|
1537
|
+
J(e), e.dispatchEvent(new CustomEvent(Be("reset"), { bubbles: !0 }));
|
|
1453
1538
|
}
|
|
1454
|
-
function
|
|
1455
|
-
return e.code ===
|
|
1539
|
+
function Zn(e) {
|
|
1540
|
+
return e.code === Dn || e.meta?.resetState === !0;
|
|
1456
1541
|
}
|
|
1457
|
-
function
|
|
1542
|
+
function Qn(e, t) {
|
|
1458
1543
|
const r = t.submitData, n = /* @__PURE__ */ new Set();
|
|
1459
1544
|
let i = !1;
|
|
1460
1545
|
if (Array.isArray(r) && r.length > 0) {
|
|
1461
1546
|
const p = r.filter(
|
|
1462
|
-
(
|
|
1547
|
+
(h) => typeof h == "object" && h !== null && "event" in h && typeof h.event == "string"
|
|
1463
1548
|
);
|
|
1464
|
-
for (const
|
|
1465
|
-
const
|
|
1466
|
-
n.add(
|
|
1467
|
-
eventName:
|
|
1468
|
-
}),
|
|
1549
|
+
for (const h of p) {
|
|
1550
|
+
const u = h.event;
|
|
1551
|
+
n.add(u), B.log("Dispatching submitData event.", {
|
|
1552
|
+
eventName: u
|
|
1553
|
+
}), u.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(u, {
|
|
1469
1554
|
bubbles: !0,
|
|
1470
|
-
detail: { data:
|
|
1555
|
+
detail: { data: h.data }
|
|
1471
1556
|
}));
|
|
1472
1557
|
}
|
|
1473
1558
|
}
|
|
@@ -1475,122 +1560,122 @@ function jn(e, t) {
|
|
|
1475
1560
|
return d && !n.has(d) && (d.startsWith("formie:payment:") && (i = !0), e.dispatchEvent(new CustomEvent(d, {
|
|
1476
1561
|
bubbles: !0,
|
|
1477
1562
|
detail: { data: l }
|
|
1478
|
-
})),
|
|
1563
|
+
})), B.log("Dispatching fallback payment action event.", {
|
|
1479
1564
|
eventName: d
|
|
1480
1565
|
})), { hasPaymentFollowUpEvent: i };
|
|
1481
1566
|
}
|
|
1482
|
-
function
|
|
1483
|
-
if (
|
|
1567
|
+
function Xn(e, t, r) {
|
|
1568
|
+
if (B.log("Applying submit result state.", {
|
|
1484
1569
|
ok: t.ok,
|
|
1485
1570
|
action: r,
|
|
1486
1571
|
code: t.code,
|
|
1487
1572
|
hasRedirect: !!t.redirect?.url,
|
|
1488
1573
|
hasSubmitData: Array.isArray(t.submitData) && t.submitData.length > 0
|
|
1489
|
-
}),
|
|
1490
|
-
|
|
1574
|
+
}), Zn(t)) {
|
|
1575
|
+
be(e), B.log("Resetting state due to stale/reset marker.");
|
|
1491
1576
|
return;
|
|
1492
1577
|
}
|
|
1493
|
-
const n =
|
|
1578
|
+
const n = Qn(e, t);
|
|
1494
1579
|
if (!t.ok && t.redirect?.url && !n.hasPaymentFollowUpEvent) {
|
|
1495
|
-
|
|
1580
|
+
B.log("Applying redirect fallback for failed result.", {
|
|
1496
1581
|
url: t.redirect.url,
|
|
1497
1582
|
target: t.redirect.target
|
|
1498
|
-
}), z(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (
|
|
1583
|
+
}), z(e), t.redirect.target === "new-tab" ? window.open(t.redirect.url, "_blank") : (At(e, "redirect"), window.location.href = t.redirect.url);
|
|
1499
1584
|
return;
|
|
1500
1585
|
}
|
|
1501
|
-
if (
|
|
1502
|
-
|
|
1586
|
+
if (Gn(e, t), !t.ok) {
|
|
1587
|
+
B.log("Non-redirect failure; keeping current form state."), z(e);
|
|
1503
1588
|
return;
|
|
1504
1589
|
}
|
|
1505
|
-
if (
|
|
1506
|
-
z(e), e.formieValidation?.resetLiveState(),
|
|
1590
|
+
if (Kt(e, r), t.nextPage?.id) {
|
|
1591
|
+
z(e), e.formieValidation?.resetLiveState(), lt(e, t.nextPage.id), B.log("Advanced to next page.", {
|
|
1507
1592
|
nextPageId: t.nextPage.id
|
|
1508
1593
|
});
|
|
1509
1594
|
return;
|
|
1510
1595
|
}
|
|
1511
1596
|
if (r === "save") {
|
|
1512
|
-
z(e),
|
|
1597
|
+
z(e), Yn(e, t), B.log("Applied save/resume token state.");
|
|
1513
1598
|
return;
|
|
1514
1599
|
}
|
|
1515
1600
|
if (r === "submit" && !t.redirect?.url) {
|
|
1516
|
-
const i =
|
|
1601
|
+
const i = wt(e), o = i === "message" && Tt(e);
|
|
1517
1602
|
if (i === "reload") {
|
|
1518
|
-
z(e),
|
|
1603
|
+
z(e), At(e, "reload"), window.location.reload();
|
|
1519
1604
|
return;
|
|
1520
1605
|
}
|
|
1521
1606
|
if (i === "reset") {
|
|
1522
|
-
|
|
1607
|
+
be(e);
|
|
1523
1608
|
return;
|
|
1524
1609
|
}
|
|
1525
|
-
z(e),
|
|
1610
|
+
z(e), be(e, { preserveHiddenState: o });
|
|
1526
1611
|
return;
|
|
1527
1612
|
}
|
|
1528
1613
|
if (r === "submit" && t.redirect?.url && t.redirect.target === "new-tab") {
|
|
1529
|
-
const o =
|
|
1530
|
-
z(e),
|
|
1614
|
+
const o = wt(e) === "message" && Tt(e);
|
|
1615
|
+
z(e), be(e, { preserveHiddenState: o });
|
|
1531
1616
|
return;
|
|
1532
1617
|
}
|
|
1533
1618
|
z(e);
|
|
1534
1619
|
}
|
|
1535
1620
|
const Ce = /* @__PURE__ */ new WeakMap();
|
|
1536
|
-
function
|
|
1621
|
+
function lr(e) {
|
|
1537
1622
|
return (e.dataset.formieSubmitAction || "").trim();
|
|
1538
1623
|
}
|
|
1539
|
-
function
|
|
1624
|
+
function ei(e) {
|
|
1540
1625
|
return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
|
|
1541
1626
|
}
|
|
1542
|
-
function
|
|
1627
|
+
function ur(e) {
|
|
1543
1628
|
return (e.dataset.formieSubmitActionMessagePosition || "").trim();
|
|
1544
1629
|
}
|
|
1545
|
-
function
|
|
1630
|
+
function ti(e) {
|
|
1546
1631
|
const t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
|
|
1547
1632
|
if (!t)
|
|
1548
1633
|
return null;
|
|
1549
1634
|
const r = Number.parseFloat(t);
|
|
1550
1635
|
return !Number.isFinite(r) || r < 0 ? null : Math.round(r * 1e3);
|
|
1551
1636
|
}
|
|
1552
|
-
function
|
|
1637
|
+
function ut(e) {
|
|
1553
1638
|
const t = e.dataset.formieSubmitActionFormHide;
|
|
1554
1639
|
if (t === void 0)
|
|
1555
1640
|
return !1;
|
|
1556
1641
|
const r = t.trim().toLowerCase();
|
|
1557
1642
|
return r === "true" || r === "1" || r === "";
|
|
1558
1643
|
}
|
|
1559
|
-
function
|
|
1644
|
+
function ri(e) {
|
|
1560
1645
|
const t = Ce.get(e);
|
|
1561
1646
|
typeof t == "number" && (window.clearTimeout(t), Ce.delete(e));
|
|
1562
1647
|
}
|
|
1563
|
-
function
|
|
1648
|
+
function cr(e) {
|
|
1564
1649
|
return e.querySelector("[data-formie-form-messages-top]") || e;
|
|
1565
1650
|
}
|
|
1566
|
-
function
|
|
1651
|
+
function dr(e) {
|
|
1567
1652
|
return e.querySelector("[data-formie-form-messages-bottom]") || e;
|
|
1568
1653
|
}
|
|
1569
|
-
function
|
|
1570
|
-
return t === "bottom-form" ?
|
|
1654
|
+
function ni(e, t) {
|
|
1655
|
+
return t === "bottom-form" ? dr(e) : cr(e);
|
|
1571
1656
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return t === "top-form" ?
|
|
1657
|
+
function ii(e, t) {
|
|
1658
|
+
return t === "top-form" ? cr(e) : t === "bottom-form" && !ut(e) ? dr(e) : e;
|
|
1574
1659
|
}
|
|
1575
|
-
function
|
|
1576
|
-
const t =
|
|
1660
|
+
function oi(e) {
|
|
1661
|
+
const t = ei(e), r = ni(e, t);
|
|
1577
1662
|
let n = r.querySelector("[data-formie-error-container], [data-formie-errors]");
|
|
1578
|
-
return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"),
|
|
1663
|
+
return n || (n = document.createElement("div"), n.setAttribute("data-formie-errors", "true"), $(n, e, "errors")), n.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
|
|
1579
1664
|
}
|
|
1580
|
-
function
|
|
1665
|
+
function ai(e, t) {
|
|
1581
1666
|
let r = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
|
|
1582
|
-
return r || (r = document.createElement("div"), r.setAttribute("data-formie-error-message-container", "true"), t.appendChild(r)), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-error", "true"),
|
|
1667
|
+
return r || (r = document.createElement("div"), r.setAttribute("data-formie-error-message-container", "true"), t.appendChild(r)), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-error", "true"), $(r, e, "message", "messageError"), r.setAttribute("role", "alert"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r;
|
|
1583
1668
|
}
|
|
1584
|
-
function
|
|
1669
|
+
function si(e, t) {
|
|
1585
1670
|
let r = e.querySelector("[data-formie-success-container]");
|
|
1586
|
-
const n =
|
|
1587
|
-
return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"),
|
|
1671
|
+
const n = ii(e, t);
|
|
1672
|
+
return r || (r = document.createElement("div"), r.setAttribute("data-formie-success-container", "true"), $(r, e, "successes")), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
|
|
1588
1673
|
}
|
|
1589
|
-
function
|
|
1674
|
+
function li(e) {
|
|
1590
1675
|
let t = e.querySelector("[data-formie-field-errors]");
|
|
1591
|
-
return t || (t = document.createElement("div"), t.setAttribute("data-formie-field-errors", "true"),
|
|
1676
|
+
return t || (t = document.createElement("div"), t.setAttribute("data-formie-field-errors", "true"), $(t, e, "fieldErrors"), e.appendChild(t)), t;
|
|
1592
1677
|
}
|
|
1593
|
-
function
|
|
1678
|
+
function ui(e, t) {
|
|
1594
1679
|
const r = (e.getAttribute("aria-describedby") || "").trim();
|
|
1595
1680
|
if (!r)
|
|
1596
1681
|
return;
|
|
@@ -1601,26 +1686,26 @@ function ti(e, t) {
|
|
|
1601
1686
|
}
|
|
1602
1687
|
e.removeAttribute("aria-describedby");
|
|
1603
1688
|
}
|
|
1604
|
-
function
|
|
1689
|
+
function ci(e, t) {
|
|
1605
1690
|
e.setAttribute("aria-errormessage", t);
|
|
1606
1691
|
}
|
|
1607
|
-
function
|
|
1692
|
+
function di(e, t) {
|
|
1608
1693
|
e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
|
|
1609
1694
|
}
|
|
1610
|
-
function
|
|
1695
|
+
function fr(e) {
|
|
1611
1696
|
e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
|
|
1612
1697
|
const r = t, n = r.querySelector("[data-formie-field-errors]"), i = n?.id || "", o = Array.from(r.querySelectorAll("[data-formie-field-error]")).map((a) => a.id).filter(Boolean);
|
|
1613
1698
|
le(r, e, "fieldLayoutError"), r.removeAttribute("data-formie-field-has-error"), r.querySelectorAll("[data-formie-field-error]").forEach((a) => {
|
|
1614
1699
|
a.remove();
|
|
1615
1700
|
}), n && !n.querySelector("[data-formie-field-error]") && (n.innerHTML = ""), r.querySelectorAll("input, select, textarea").forEach((a) => {
|
|
1616
1701
|
const s = a;
|
|
1617
|
-
s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i &&
|
|
1618
|
-
|
|
1702
|
+
s.removeAttribute("aria-invalid"), le(s, e, "fieldControlError"), s.removeAttribute("data-formie-input-has-error"), i && ui(s, i), o.forEach((l) => {
|
|
1703
|
+
di(s, l);
|
|
1619
1704
|
});
|
|
1620
1705
|
});
|
|
1621
1706
|
}), J(e);
|
|
1622
1707
|
}
|
|
1623
|
-
function
|
|
1708
|
+
function mr(e) {
|
|
1624
1709
|
e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
|
|
1625
1710
|
const r = t;
|
|
1626
1711
|
r.querySelectorAll("[data-formie-error]").forEach((n) => {
|
|
@@ -1628,92 +1713,92 @@ function lr(e) {
|
|
|
1628
1713
|
}), le(r, e, "message", "messageError"), r.removeAttribute("data-formie-message"), r.removeAttribute("data-formie-message-error"), r.removeAttribute("role"), r.removeAttribute("aria-live"), r.removeAttribute("aria-atomic"), r.querySelector("[data-formie-error]") || (r.innerHTML = "");
|
|
1629
1714
|
});
|
|
1630
1715
|
}
|
|
1631
|
-
function
|
|
1632
|
-
|
|
1716
|
+
function ct(e) {
|
|
1717
|
+
ri(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((t) => {
|
|
1633
1718
|
t.remove();
|
|
1634
1719
|
}), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
|
|
1635
1720
|
const r = t;
|
|
1636
1721
|
r.querySelectorAll("[data-formie-success]").forEach((n) => {
|
|
1637
1722
|
n.remove();
|
|
1638
1723
|
}), le(r, e, "message", "messageSuccess"), r.removeAttribute("data-formie-message"), r.removeAttribute("data-formie-message-success"), r.removeAttribute("role"), r.removeAttribute("aria-live"), r.removeAttribute("aria-atomic"), r.querySelector("[data-formie-success]") || (r.innerHTML = "");
|
|
1639
|
-
}),
|
|
1724
|
+
}), lr(e) === "message" && ut(e) || st(e, !1);
|
|
1640
1725
|
}
|
|
1641
|
-
function
|
|
1726
|
+
function pr(e) {
|
|
1642
1727
|
e.querySelectorAll('[aria-invalid="true"]').forEach((t) => {
|
|
1643
1728
|
t.removeAttribute("aria-invalid");
|
|
1644
1729
|
});
|
|
1645
1730
|
}
|
|
1646
|
-
function
|
|
1731
|
+
function Mt(e, t) {
|
|
1647
1732
|
const r = (e.getAttribute("aria-describedby") || "").trim(), n = r ? r.split(/\s+/) : [];
|
|
1648
1733
|
n.includes(t) || n.push(t), e.setAttribute("aria-describedby", n.join(" ").trim());
|
|
1649
1734
|
}
|
|
1650
|
-
function
|
|
1735
|
+
function fi(e, t) {
|
|
1651
1736
|
Object.entries(t).forEach(([r, n]) => {
|
|
1652
1737
|
const i = e.querySelector(`[data-formie-field-handle="${r}"]`);
|
|
1653
1738
|
if (!i)
|
|
1654
1739
|
return;
|
|
1655
|
-
const o =
|
|
1656
|
-
o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"),
|
|
1740
|
+
const o = li(i), a = o.id && o.id.trim() ? o.id : `${r}-errors`;
|
|
1741
|
+
o.id = a, o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), $(i, e, "fieldLayoutError"), i.setAttribute("data-formie-field-has-error", "true"), n.forEach((l, d) => {
|
|
1657
1742
|
const p = document.createElement("div");
|
|
1658
|
-
p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`,
|
|
1743
|
+
p.setAttribute("data-formie-field-error", "true"), p.setAttribute("role", "alert"), p.id = `${a}-${d + 1}`, $(p, e, "fieldError"), p.textContent = l, o.appendChild(p);
|
|
1659
1744
|
});
|
|
1660
1745
|
const s = o.querySelector("[data-formie-field-error]")?.id;
|
|
1661
1746
|
i.querySelectorAll("input, select, textarea").forEach((l) => {
|
|
1662
1747
|
const d = l;
|
|
1663
|
-
d.setAttribute("aria-invalid", "true"),
|
|
1748
|
+
d.setAttribute("aria-invalid", "true"), $(d, e, "fieldControlError"), d.setAttribute("data-formie-input-has-error", "true"), Mt(d, a), s && ci(d, s);
|
|
1664
1749
|
const p = i.querySelector("[data-formie-instructions]");
|
|
1665
|
-
p?.id &&
|
|
1750
|
+
p?.id && Mt(d, p.id);
|
|
1666
1751
|
});
|
|
1667
1752
|
}), J(e);
|
|
1668
1753
|
}
|
|
1669
|
-
function
|
|
1670
|
-
const r =
|
|
1671
|
-
|
|
1754
|
+
function Ct(e, t) {
|
|
1755
|
+
const r = oi(e), n = ai(e, r);
|
|
1756
|
+
$(r, e, "errors"), t.forEach((i) => {
|
|
1672
1757
|
const o = document.createElement("div");
|
|
1673
|
-
o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"),
|
|
1758
|
+
o.setAttribute("data-formie-error", "true"), o.setAttribute("role", "alert"), $(o, e, "error"), o.innerHTML = i, n.appendChild(o);
|
|
1674
1759
|
});
|
|
1675
1760
|
}
|
|
1676
|
-
function
|
|
1677
|
-
return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 :
|
|
1761
|
+
function mi(e, t) {
|
|
1762
|
+
return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : lr(e) === "message" && ur(e) !== "";
|
|
1678
1763
|
}
|
|
1679
|
-
function
|
|
1680
|
-
const r =
|
|
1764
|
+
function pi(e, t) {
|
|
1765
|
+
const r = ur(e);
|
|
1681
1766
|
if (!r)
|
|
1682
1767
|
return;
|
|
1683
|
-
const n =
|
|
1684
|
-
|
|
1768
|
+
const n = si(e, r);
|
|
1769
|
+
$(n, e, "message", "messageSuccess"), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-success", "true"), n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true");
|
|
1685
1770
|
const i = document.createElement("div");
|
|
1686
|
-
i.setAttribute("data-formie-success", "true"),
|
|
1687
|
-
const o =
|
|
1771
|
+
i.setAttribute("data-formie-success", "true"), $(i, e, "success"), i.innerHTML = t, n.appendChild(i), ut(e) && st(e, !0);
|
|
1772
|
+
const o = ti(e);
|
|
1688
1773
|
if (o !== null) {
|
|
1689
1774
|
const a = window.setTimeout(() => {
|
|
1690
|
-
Ce.delete(e),
|
|
1775
|
+
Ce.delete(e), ct(e);
|
|
1691
1776
|
}, o);
|
|
1692
1777
|
Ce.set(e, a);
|
|
1693
1778
|
}
|
|
1694
1779
|
}
|
|
1695
|
-
function
|
|
1696
|
-
if (
|
|
1697
|
-
|
|
1780
|
+
function Le(e, t) {
|
|
1781
|
+
if (fr(e), mr(e), ct(e), pr(e), t.ok) {
|
|
1782
|
+
mi(e, t) && pi(e, t.message || "");
|
|
1698
1783
|
return;
|
|
1699
1784
|
}
|
|
1700
|
-
if (t.fieldErrors &&
|
|
1701
|
-
|
|
1785
|
+
if (t.fieldErrors && fi(e, t.fieldErrors), t.formErrors?.length) {
|
|
1786
|
+
Ct(e, t.formErrors);
|
|
1702
1787
|
return;
|
|
1703
1788
|
}
|
|
1704
|
-
!t.fieldErrors && t.message &&
|
|
1789
|
+
!t.fieldErrors && t.message && Ct(e, [t.message]);
|
|
1705
1790
|
}
|
|
1706
|
-
const
|
|
1707
|
-
function
|
|
1791
|
+
const gi = _("general", "submit-flow");
|
|
1792
|
+
function hi(e) {
|
|
1708
1793
|
return !(!e.ok && e.stage === "validate");
|
|
1709
1794
|
}
|
|
1710
|
-
function
|
|
1795
|
+
function gr(e) {
|
|
1711
1796
|
return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
|
|
1712
1797
|
}
|
|
1713
|
-
function
|
|
1714
|
-
|
|
1798
|
+
function hr(e) {
|
|
1799
|
+
fr(e), mr(e), ct(e), pr(e);
|
|
1715
1800
|
}
|
|
1716
|
-
async function
|
|
1801
|
+
async function br(e) {
|
|
1717
1802
|
const {
|
|
1718
1803
|
id: t,
|
|
1719
1804
|
target: r,
|
|
@@ -1725,38 +1810,38 @@ async function fr(e) {
|
|
|
1725
1810
|
submitter: l,
|
|
1726
1811
|
waitForSubmitDelay: d,
|
|
1727
1812
|
onRefreshTokensAfterSubmit: p,
|
|
1728
|
-
dispatchSubmitResult:
|
|
1813
|
+
dispatchSubmitResult: h
|
|
1729
1814
|
} = e;
|
|
1730
|
-
|
|
1731
|
-
let
|
|
1815
|
+
hr(n), sr(n, l || null);
|
|
1816
|
+
let u = {
|
|
1732
1817
|
ok: !1,
|
|
1733
1818
|
code: "SUBMIT_ERROR",
|
|
1734
1819
|
message: "Submission failed.",
|
|
1735
1820
|
formErrors: ["Submission failed."]
|
|
1736
1821
|
};
|
|
1737
1822
|
try {
|
|
1738
|
-
await d(n),
|
|
1823
|
+
await d(n), u = await tr(n, s, i, {
|
|
1739
1824
|
validator: o,
|
|
1740
1825
|
validateOnSubmit: a
|
|
1741
|
-
}),
|
|
1742
|
-
} catch (
|
|
1743
|
-
|
|
1826
|
+
}), Le(n, u), Xn(n, u, s), hi(u) && await p(u), h(u);
|
|
1827
|
+
} catch (c) {
|
|
1828
|
+
u = {
|
|
1744
1829
|
ok: !1,
|
|
1745
1830
|
code: "SUBMIT_ERROR",
|
|
1746
|
-
message:
|
|
1747
|
-
formErrors: [
|
|
1748
|
-
},
|
|
1831
|
+
message: c instanceof Error ? c.message : "Submission failed.",
|
|
1832
|
+
formErrors: [c instanceof Error ? c.message : "Submission failed."]
|
|
1833
|
+
}, Le(n, u), h(u), gi.warn("Submit failed with exception.", {
|
|
1749
1834
|
id: t,
|
|
1750
1835
|
action: s,
|
|
1751
1836
|
target: r,
|
|
1752
|
-
error:
|
|
1837
|
+
error: c instanceof Error ? c.message : c
|
|
1753
1838
|
});
|
|
1754
1839
|
} finally {
|
|
1755
|
-
|
|
1840
|
+
gr(u) || Me(n);
|
|
1756
1841
|
}
|
|
1757
|
-
return
|
|
1842
|
+
return u;
|
|
1758
1843
|
}
|
|
1759
|
-
class
|
|
1844
|
+
class yr {
|
|
1760
1845
|
constructor() {
|
|
1761
1846
|
this.modules = /* @__PURE__ */ new Map();
|
|
1762
1847
|
}
|
|
@@ -1776,127 +1861,127 @@ class mr {
|
|
|
1776
1861
|
return Array.from(this.modules.values());
|
|
1777
1862
|
}
|
|
1778
1863
|
}
|
|
1779
|
-
const
|
|
1864
|
+
const bi = {
|
|
1780
1865
|
// Address providers stay behind lazy importer entries because their SDKs are
|
|
1781
1866
|
// optional and often much heavier than the base form client.
|
|
1782
|
-
"address-finder": () => import("./address-finder-
|
|
1783
|
-
"google-address": () => import("./google-address-
|
|
1784
|
-
loqate: () => import("./loqate-
|
|
1785
|
-
"place-kit": () => import("./place-kit-
|
|
1786
|
-
},
|
|
1867
|
+
"address-finder": () => import("./address-finder-BjMuEiwF.js").then((e) => e.addressFinderModule),
|
|
1868
|
+
"google-address": () => import("./google-address-Bmjp01pH.js").then((e) => e.googleAddressModule),
|
|
1869
|
+
loqate: () => import("./loqate-BdNGv93o.js").then((e) => e.loqateModule),
|
|
1870
|
+
"place-kit": () => import("./place-kit-CX7tamAg.js").then((e) => e.placeKitModule)
|
|
1871
|
+
}, yi = {
|
|
1787
1872
|
// Module ids map directly to importer functions so the loader can fetch only
|
|
1788
1873
|
// the captcha chunks required by the current form manifest.
|
|
1789
|
-
"captcha-eu": () => import("./captcha-eu-
|
|
1790
|
-
"friendly-captcha-v1": () => import("./friendly-captcha-v1-
|
|
1791
|
-
"friendly-captcha-v2": () => import("./friendly-captcha-v2-
|
|
1792
|
-
hcaptcha: () => import("./hcaptcha-
|
|
1793
|
-
"recaptcha-enterprise": () => import("./recaptcha-enterprise
|
|
1794
|
-
"recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-
|
|
1795
|
-
"recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-
|
|
1796
|
-
"recaptcha-v3": () => import("./recaptcha-v3-
|
|
1797
|
-
snaptcha: () => import("./snaptcha-
|
|
1798
|
-
turnstile: () => import("./turnstile-
|
|
1799
|
-
},
|
|
1874
|
+
"captcha-eu": () => import("./captcha-eu-CterYFok.js").then((e) => e.captchaEuModule),
|
|
1875
|
+
"friendly-captcha-v1": () => import("./friendly-captcha-v1-EDFac33c.js").then((e) => e.friendlyCaptchaV1Module),
|
|
1876
|
+
"friendly-captcha-v2": () => import("./friendly-captcha-v2-BDpSvFGR.js").then((e) => e.friendlyCaptchaV2Module),
|
|
1877
|
+
hcaptcha: () => import("./hcaptcha-BTQ6An6g.js").then((e) => e.hcaptchaModule),
|
|
1878
|
+
"recaptcha-enterprise": () => import("./recaptcha-enterprise-DxF6cW95.js").then((e) => e.recaptchaEnterpriseModule),
|
|
1879
|
+
"recaptcha-v2-checkbox": () => import("./recaptcha-v2-checkbox-R9EfbZ4k.js").then((e) => e.recaptchaV2CheckboxModule),
|
|
1880
|
+
"recaptcha-v2-invisible": () => import("./recaptcha-v2-invisible-DV9hswAp.js").then((e) => e.recaptchaV2InvisibleModule),
|
|
1881
|
+
"recaptcha-v3": () => import("./recaptcha-v3-V0xc-Edh.js").then((e) => e.recaptchaV3Module),
|
|
1882
|
+
snaptcha: () => import("./snaptcha-DV7p6J9k.js").then((e) => e.snaptchaModule),
|
|
1883
|
+
turnstile: () => import("./turnstile-CId90tRr.js").then((e) => e.turnstileModule)
|
|
1884
|
+
}, vi = {
|
|
1800
1885
|
// Keep the builtin map flat and explicit so manifest ids remain the source of
|
|
1801
1886
|
// truth for lazy-loading first-party field enhancements.
|
|
1802
|
-
calculations: () => import("./calculations-
|
|
1803
|
-
"checkbox-radio": () => import("./checkbox-radio-
|
|
1804
|
-
conditions: () => import("./conditions-
|
|
1805
|
-
"date-picker": () => import("./date-picker-
|
|
1806
|
-
"file-upload": () => import("./file-upload-
|
|
1807
|
-
hidden: () => import("./hidden-
|
|
1808
|
-
"phone-country": () => import("./phone-country-
|
|
1809
|
-
repeater: () => import("./repeater-
|
|
1810
|
-
"rich-text": () => import("./rich-text-
|
|
1811
|
-
signature: () => import("./signature-
|
|
1812
|
-
summary: () => import("./summary-
|
|
1813
|
-
table: () => import("./table-
|
|
1814
|
-
"text-limit": () => import("./text-limit-
|
|
1815
|
-
},
|
|
1887
|
+
calculations: () => import("./calculations-DlGSkQ3W.js").then((e) => e.calculationsModule),
|
|
1888
|
+
"checkbox-radio": () => import("./checkbox-radio-CBvgk3hR.js").then((e) => e.checkboxRadioModule),
|
|
1889
|
+
conditions: () => import("./conditions-DYy1-Hwt.js").then((e) => e.conditionsModule),
|
|
1890
|
+
"date-picker": () => import("./date-picker-BlD--zfe.js").then((e) => e.datePickerModule),
|
|
1891
|
+
"file-upload": () => import("./file-upload-CIgHrXfp.js").then((e) => e.fileUploadModule),
|
|
1892
|
+
hidden: () => import("./hidden-DbPdOxKb.js").then((e) => e.hiddenModule),
|
|
1893
|
+
"phone-country": () => import("./phone-country-DPMiqk4L.js").then((e) => e.phoneCountryModule),
|
|
1894
|
+
repeater: () => import("./repeater-DKUT6TGI.js").then((e) => e.repeaterModule),
|
|
1895
|
+
"rich-text": () => import("./rich-text-SH7KiaKH.js").then((e) => e.richTextModule),
|
|
1896
|
+
signature: () => import("./signature-BA3tQsGT.js").then((e) => e.signatureModule),
|
|
1897
|
+
summary: () => import("./summary-Dq2i9TQk.js").then((e) => e.summaryModule),
|
|
1898
|
+
table: () => import("./table-Cu4WfVcw.js").then((e) => e.tableModule),
|
|
1899
|
+
"text-limit": () => import("./text-limit-2ycmB-Ae.js").then((e) => e.textLimitModule)
|
|
1900
|
+
}, Ei = {
|
|
1816
1901
|
// Keep payment providers lazy and separately addressable so forms only ship
|
|
1817
1902
|
// the payment SDK wrapper code they actually declare in their manifest.
|
|
1818
|
-
bpoint: () => import("./bpoint-
|
|
1819
|
-
eway: () => import("./eway-
|
|
1820
|
-
"go-cardless": () => import("./go-cardless-
|
|
1821
|
-
mollie: () => import("./mollie-
|
|
1822
|
-
moneris: () => import("./moneris-
|
|
1823
|
-
opayo: () => import("./opayo-
|
|
1824
|
-
paddle: () => import("./paddle-
|
|
1825
|
-
paypal: () => import("./paypal-
|
|
1826
|
-
payway: () => import("./payway-
|
|
1827
|
-
square: () => import("./square-
|
|
1828
|
-
stripe: () => import("./stripe-
|
|
1829
|
-
},
|
|
1830
|
-
...
|
|
1831
|
-
...
|
|
1832
|
-
...
|
|
1833
|
-
...
|
|
1834
|
-
},
|
|
1835
|
-
async function
|
|
1836
|
-
await e(
|
|
1837
|
-
}
|
|
1838
|
-
function
|
|
1903
|
+
bpoint: () => import("./bpoint-KudsBCo2.js").then((e) => e.bpointModule),
|
|
1904
|
+
eway: () => import("./eway-qwc-B5Us.js").then((e) => e.ewayModule),
|
|
1905
|
+
"go-cardless": () => import("./go-cardless-DuDMVsnz.js").then((e) => e.goCardlessModule),
|
|
1906
|
+
mollie: () => import("./mollie-DFOjTuGX.js").then((e) => e.mollieModule),
|
|
1907
|
+
moneris: () => import("./moneris-BbFfl-EL.js").then((e) => e.monerisModule),
|
|
1908
|
+
opayo: () => import("./opayo-CmgYa9ya.js").then((e) => e.opayoModule),
|
|
1909
|
+
paddle: () => import("./paddle-BUi7w1_o.js").then((e) => e.paddleModule),
|
|
1910
|
+
paypal: () => import("./paypal-A-ePfh6k.js").then((e) => e.paypalModule),
|
|
1911
|
+
payway: () => import("./payway-BqFCbhyo.js").then((e) => e.paywayModule),
|
|
1912
|
+
square: () => import("./square-Bs-ndqYK.js").then((e) => e.squareModule),
|
|
1913
|
+
stripe: () => import("./stripe-DkZAHxtn.js").then((e) => e.stripeModule)
|
|
1914
|
+
}, Si = {
|
|
1915
|
+
...vi,
|
|
1916
|
+
...bi,
|
|
1917
|
+
...yi,
|
|
1918
|
+
...Ei
|
|
1919
|
+
}, _e = /* @__PURE__ */ new Map(), D = _("general", "loader"), Ai = new Function("src", "return import(src);");
|
|
1920
|
+
async function ye(e, t, r, n) {
|
|
1921
|
+
await e(Ur(r), n), await e(Nr(t, r), n);
|
|
1922
|
+
}
|
|
1923
|
+
function vr(e) {
|
|
1839
1924
|
return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
|
|
1840
1925
|
}
|
|
1841
|
-
async function
|
|
1842
|
-
const r =
|
|
1843
|
-
return r ? (
|
|
1926
|
+
async function wi(e, t) {
|
|
1927
|
+
const r = Si[e];
|
|
1928
|
+
return r ? (_e.has(e) || _e.set(e, (async () => {
|
|
1844
1929
|
try {
|
|
1845
1930
|
const n = await r();
|
|
1846
|
-
return
|
|
1931
|
+
return vr(n) ? (t.registry.register(n), n) : null;
|
|
1847
1932
|
} catch (n) {
|
|
1848
1933
|
return console.error("[formie] Failed to load builtin module:", e, n), D.warn("Failed loading builtin module.", { moduleId: e, error: n }), null;
|
|
1849
1934
|
}
|
|
1850
|
-
})()),
|
|
1935
|
+
})()), _e.get(e) || null) : null;
|
|
1851
1936
|
}
|
|
1852
|
-
async function
|
|
1937
|
+
async function Ti(e) {
|
|
1853
1938
|
try {
|
|
1854
|
-
const t = await
|
|
1855
|
-
return
|
|
1939
|
+
const t = await Ai(e), r = t?.default || t?.formieModule || null;
|
|
1940
|
+
return vr(r) ? r : null;
|
|
1856
1941
|
} catch (t) {
|
|
1857
1942
|
return console.error("[formie] Failed to load module from src:", e, t), D.warn("Failed loading module from src.", { src: e, error: t }), null;
|
|
1858
1943
|
}
|
|
1859
1944
|
}
|
|
1860
|
-
async function
|
|
1945
|
+
async function Mi(e, t) {
|
|
1861
1946
|
const r = t.registry.get(e.id);
|
|
1862
1947
|
if (r)
|
|
1863
1948
|
return r;
|
|
1864
|
-
const n = await
|
|
1949
|
+
const n = await wi(e.id, t);
|
|
1865
1950
|
if (n)
|
|
1866
1951
|
return n;
|
|
1867
1952
|
if (e.src) {
|
|
1868
|
-
const i = await
|
|
1953
|
+
const i = await Ti(e.src);
|
|
1869
1954
|
if (i)
|
|
1870
1955
|
return t.registry.register(i), i;
|
|
1871
1956
|
}
|
|
1872
1957
|
return null;
|
|
1873
1958
|
}
|
|
1874
|
-
function
|
|
1959
|
+
function De(e) {
|
|
1875
1960
|
return typeof window.CSS?.escape == "function" ? window.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
1876
1961
|
}
|
|
1877
|
-
function
|
|
1962
|
+
function ve(e, t) {
|
|
1878
1963
|
return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
|
|
1879
1964
|
}
|
|
1880
|
-
function
|
|
1965
|
+
function Ci(e, t) {
|
|
1881
1966
|
const r = t.setupContext.root, n = t.setupContext.form, i = e.targetType, o = e.targetId;
|
|
1882
|
-
return i === "selector" ?
|
|
1967
|
+
return i === "selector" ? ve(r, o).map((a) => ({ scope: i, element: a })) : i === "field" ? ve(r, `[data-formie-field-handle="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "page" ? ve(r, `[data-formie-page-id="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : i === "button" ? ve(r, `[data-formie-action="${De(o)}"]`).map((a) => ({ scope: i, element: a })) : [{
|
|
1883
1968
|
scope: "form",
|
|
1884
1969
|
element: n || r
|
|
1885
1970
|
}];
|
|
1886
1971
|
}
|
|
1887
|
-
function
|
|
1972
|
+
function Li(e, t) {
|
|
1888
1973
|
return (e.targets && e.targets.length > 0 ? e.targets : [{
|
|
1889
1974
|
targetType: "form",
|
|
1890
1975
|
targetId: "form"
|
|
1891
|
-
}]).flatMap((n) =>
|
|
1976
|
+
}]).flatMap((n) => Ci(n, t));
|
|
1892
1977
|
}
|
|
1893
|
-
async function
|
|
1978
|
+
async function Er(e, t) {
|
|
1894
1979
|
const r = [];
|
|
1895
1980
|
D.log("Loading module manifest.", {
|
|
1896
1981
|
manifestCount: e.length
|
|
1897
1982
|
});
|
|
1898
1983
|
for (const n of e) {
|
|
1899
|
-
const i = await
|
|
1984
|
+
const i = await Mi(n, t);
|
|
1900
1985
|
if (!i) {
|
|
1901
1986
|
D.warn("Skipping manifest item (definition not resolved).", {
|
|
1902
1987
|
moduleId: n.id,
|
|
@@ -1904,7 +1989,7 @@ async function gr(e, t) {
|
|
|
1904
1989
|
});
|
|
1905
1990
|
continue;
|
|
1906
1991
|
}
|
|
1907
|
-
const o =
|
|
1992
|
+
const o = Li(n, t);
|
|
1908
1993
|
D.log("Resolved module targets.", {
|
|
1909
1994
|
moduleId: i.id,
|
|
1910
1995
|
targets: n.targets || [],
|
|
@@ -1936,36 +2021,36 @@ async function gr(e, t) {
|
|
|
1936
2021
|
options: l,
|
|
1937
2022
|
manifestItem: n
|
|
1938
2023
|
};
|
|
1939
|
-
await
|
|
1940
|
-
let
|
|
2024
|
+
await ye(t.setupContext.emit, d, "before-setup", p);
|
|
2025
|
+
let h = null;
|
|
1941
2026
|
try {
|
|
1942
|
-
const
|
|
2027
|
+
const u = await i.setup({
|
|
1943
2028
|
...t.setupContext,
|
|
1944
2029
|
target: a.element,
|
|
1945
2030
|
scope: a.scope,
|
|
1946
2031
|
options: l
|
|
1947
2032
|
});
|
|
1948
|
-
|
|
1949
|
-
} catch (
|
|
1950
|
-
console.error(`[formie] Module "${i.id}" setup failed:`,
|
|
2033
|
+
u && (h = u);
|
|
2034
|
+
} catch (u) {
|
|
2035
|
+
console.error(`[formie] Module "${i.id}" setup failed:`, u), D.warn("Module setup failed.", {
|
|
1951
2036
|
moduleId: i.id,
|
|
1952
2037
|
scope: a.scope,
|
|
1953
|
-
error:
|
|
2038
|
+
error: u
|
|
1954
2039
|
});
|
|
1955
2040
|
}
|
|
1956
|
-
await
|
|
2041
|
+
await ye(t.setupContext.emit, d, "after-setup", {
|
|
1957
2042
|
...p,
|
|
1958
|
-
instanceCreated: !!
|
|
1959
|
-
}),
|
|
2043
|
+
instanceCreated: !!h
|
|
2044
|
+
}), h && (D.log("Module instance created.", {
|
|
1960
2045
|
moduleId: i.id,
|
|
1961
2046
|
scope: a.scope
|
|
1962
2047
|
}), r.push({
|
|
1963
|
-
...
|
|
2048
|
+
...h,
|
|
1964
2049
|
destroy: async () => {
|
|
1965
2050
|
D.log("Destroying module instance.", {
|
|
1966
2051
|
moduleId: i.id,
|
|
1967
2052
|
scope: a.scope
|
|
1968
|
-
}), await
|
|
2053
|
+
}), await ye(t.setupContext.emit, d, "before-destroy", p), await h.destroy(), await ye(t.setupContext.emit, d, "after-destroy", p), D.log("Module instance destroyed.", {
|
|
1969
2054
|
moduleId: i.id,
|
|
1970
2055
|
scope: a.scope
|
|
1971
2056
|
});
|
|
@@ -1977,7 +2062,7 @@ async function gr(e, t) {
|
|
|
1977
2062
|
instanceCount: r.length
|
|
1978
2063
|
}), r;
|
|
1979
2064
|
}
|
|
1980
|
-
const
|
|
2065
|
+
const Ii = /* @__PURE__ */ new Set([
|
|
1981
2066
|
"CRAFT_CSRF_TOKEN",
|
|
1982
2067
|
"action",
|
|
1983
2068
|
"redirect",
|
|
@@ -1989,7 +2074,7 @@ const Ei = /* @__PURE__ */ new Set([
|
|
|
1989
2074
|
"draftContext",
|
|
1990
2075
|
"continuationToken"
|
|
1991
2076
|
]);
|
|
1992
|
-
function
|
|
2077
|
+
function Ke(e, t) {
|
|
1993
2078
|
if (e == null)
|
|
1994
2079
|
return String(e);
|
|
1995
2080
|
if (typeof e == "string")
|
|
@@ -2003,65 +2088,65 @@ function Be(e, t) {
|
|
|
2003
2088
|
if (typeof Blob < "u" && e instanceof Blob)
|
|
2004
2089
|
return `[blob:${e.size}:${e.type}]`;
|
|
2005
2090
|
if (Array.isArray(e))
|
|
2006
|
-
return `[${e.map((r) =>
|
|
2091
|
+
return `[${e.map((r) => Ke(r, t)).join(",")}]`;
|
|
2007
2092
|
if (typeof e == "object") {
|
|
2008
2093
|
if (t.has(e))
|
|
2009
2094
|
return "[circular]";
|
|
2010
2095
|
t.add(e);
|
|
2011
|
-
const r = Object.entries(e).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${
|
|
2096
|
+
const r = Object.entries(e).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${Ke(i, t)}`);
|
|
2012
2097
|
return t.delete(e), `{${r.join(",")}}`;
|
|
2013
2098
|
}
|
|
2014
2099
|
return JSON.stringify(String(e));
|
|
2015
2100
|
}
|
|
2016
|
-
function
|
|
2017
|
-
return
|
|
2101
|
+
function Fi(e) {
|
|
2102
|
+
return Ke(e, /* @__PURE__ */ new WeakSet());
|
|
2018
2103
|
}
|
|
2019
|
-
function
|
|
2104
|
+
function Ri(e) {
|
|
2020
2105
|
if (!e)
|
|
2021
2106
|
return !1;
|
|
2022
2107
|
const t = e.endsWith("[]") ? e.slice(0, -2) : e;
|
|
2023
|
-
return !
|
|
2108
|
+
return !Ii.has(t);
|
|
2024
2109
|
}
|
|
2025
|
-
function
|
|
2026
|
-
const t = Array.from(new FormData(e).entries()).filter(([r]) =>
|
|
2027
|
-
return
|
|
2110
|
+
function Lt(e) {
|
|
2111
|
+
const t = Array.from(new FormData(e).entries()).filter(([r]) => Ri(String(r || "")));
|
|
2112
|
+
return Fi(t);
|
|
2028
2113
|
}
|
|
2029
|
-
function
|
|
2114
|
+
function ki(e, t = {}) {
|
|
2030
2115
|
let r = null, n = !1, i = !1, o = null, a = null, s = null;
|
|
2031
2116
|
const l = () => {
|
|
2032
2117
|
o !== null && (window.cancelAnimationFrame(o), o = null), a !== null && (window.clearTimeout(a), a = null), s !== null && (window.clearTimeout(s), s = null);
|
|
2033
|
-
}, d = () => n ? (i =
|
|
2034
|
-
r =
|
|
2035
|
-
},
|
|
2118
|
+
}, d = () => n ? (i = Lt(e) !== r, i) : !1, p = () => {
|
|
2119
|
+
r = Lt(e), n = !0, i = !1;
|
|
2120
|
+
}, h = () => {
|
|
2036
2121
|
l(), n = !1, o = window.requestAnimationFrame(() => {
|
|
2037
2122
|
o = null, s = window.setTimeout(() => {
|
|
2038
2123
|
s = null, p();
|
|
2039
2124
|
}, 0);
|
|
2040
2125
|
});
|
|
2041
|
-
},
|
|
2126
|
+
}, u = () => {
|
|
2042
2127
|
a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
2043
2128
|
a = null, d();
|
|
2044
2129
|
}, 120);
|
|
2045
|
-
},
|
|
2046
|
-
t.shouldWarn && !t.shouldWarn() || d() && (
|
|
2130
|
+
}, c = (b) => {
|
|
2131
|
+
t.shouldWarn && !t.shouldWarn() || d() && (b.preventDefault(), b.returnValue = "");
|
|
2047
2132
|
};
|
|
2048
|
-
return e.addEventListener("input",
|
|
2133
|
+
return e.addEventListener("input", u), e.addEventListener("change", u), window.addEventListener("beforeunload", c), h(), {
|
|
2049
2134
|
captureBaseline: p,
|
|
2050
|
-
scheduleBaselineCapture:
|
|
2135
|
+
scheduleBaselineCapture: h,
|
|
2051
2136
|
refreshDirtyState: d,
|
|
2052
2137
|
destroy: () => {
|
|
2053
|
-
l(), e.removeEventListener("input",
|
|
2138
|
+
l(), e.removeEventListener("input", u), e.removeEventListener("change", u), window.removeEventListener("beforeunload", c);
|
|
2054
2139
|
}
|
|
2055
2140
|
};
|
|
2056
2141
|
}
|
|
2057
|
-
const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])',
|
|
2142
|
+
const X = '[data-formie]:not([data-formie-init="false"]), [data-formie-form]:not([data-formie-init="false"])', qi = 300, Pi = "/actions/formie/server/forms/render", It = "/api", Vi = "/actions/formie/server/forms/refresh-tokens", $i = "/actions/formie/server/submissions/submit", Hi = "/actions/formie/server/submissions/set-page", Oi = "/actions/formie/server/submissions/clear-submission", _i = "/actions/formie/file-upload/hydrate", L = _("general", "client"), Ft = /* @__PURE__ */ new Set();
|
|
2058
2143
|
function ce(e, t) {
|
|
2059
2144
|
if (e == null || e === "")
|
|
2060
2145
|
return t;
|
|
2061
2146
|
const r = e.toLowerCase();
|
|
2062
2147
|
return !(r === "false" || r === "0" || r === "off");
|
|
2063
2148
|
}
|
|
2064
|
-
function
|
|
2149
|
+
function Ge(e) {
|
|
2065
2150
|
return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? ce(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? ce(e.formieStaticCache, !1) : !1;
|
|
2066
2151
|
}
|
|
2067
2152
|
function ee(e) {
|
|
@@ -2071,24 +2156,24 @@ function ee(e) {
|
|
|
2071
2156
|
transport: t.formieTransport || "rest",
|
|
2072
2157
|
formHandle: t.formieHandle,
|
|
2073
2158
|
endpoint: t.formieEndpoint,
|
|
2074
|
-
staticCache:
|
|
2159
|
+
staticCache: Ge(t),
|
|
2075
2160
|
autoVisible: ce(t.formieAutoVisible, !0),
|
|
2076
2161
|
compatibility: ce(t.formieCompatibility, !1)
|
|
2077
2162
|
};
|
|
2078
2163
|
}
|
|
2079
|
-
function
|
|
2164
|
+
function Re(e) {
|
|
2080
2165
|
return e || "server-rendered";
|
|
2081
2166
|
}
|
|
2082
|
-
function
|
|
2167
|
+
function ke(e) {
|
|
2083
2168
|
return e || "rest";
|
|
2084
2169
|
}
|
|
2085
|
-
function
|
|
2170
|
+
function Se(e) {
|
|
2086
2171
|
return e instanceof HTMLFormElement ? e : e.querySelector("form");
|
|
2087
2172
|
}
|
|
2088
|
-
function
|
|
2089
|
-
|
|
2173
|
+
function Di(e, t) {
|
|
2174
|
+
Ft.has(e) || (Ft.add(e), L.warn(t));
|
|
2090
2175
|
}
|
|
2091
|
-
function
|
|
2176
|
+
function Sr(e, t) {
|
|
2092
2177
|
if (!e)
|
|
2093
2178
|
return e;
|
|
2094
2179
|
try {
|
|
@@ -2105,22 +2190,22 @@ function hr(e, t) {
|
|
|
2105
2190
|
}
|
|
2106
2191
|
function re(e, t) {
|
|
2107
2192
|
const r = (e || "").trim();
|
|
2108
|
-
return r ? r.includes("/actions/") ? r :
|
|
2193
|
+
return r ? r.includes("/actions/") ? r : Sr(t, r) : t;
|
|
2109
2194
|
}
|
|
2110
|
-
function
|
|
2111
|
-
return re(e.endpoint || t.dataset.formieEndpoint,
|
|
2195
|
+
function xi(e, t) {
|
|
2196
|
+
return re(e.endpoint || t.dataset.formieEndpoint, Pi);
|
|
2112
2197
|
}
|
|
2113
|
-
function
|
|
2198
|
+
function Ni(e, t) {
|
|
2114
2199
|
const r = (e.endpoint || t.dataset.formieEndpoint || "").trim();
|
|
2115
|
-
return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r :
|
|
2200
|
+
return r ? r.includes("/graphql") || r.endsWith("/api") || r.includes("/actions/graphql/") ? r : Sr(It, r) : It;
|
|
2116
2201
|
}
|
|
2117
|
-
function
|
|
2202
|
+
function dt(e, t) {
|
|
2118
2203
|
return re(
|
|
2119
2204
|
t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint,
|
|
2120
|
-
|
|
2205
|
+
Vi
|
|
2121
2206
|
);
|
|
2122
2207
|
}
|
|
2123
|
-
function
|
|
2208
|
+
function Rt(e, t) {
|
|
2124
2209
|
if (!e)
|
|
2125
2210
|
return t;
|
|
2126
2211
|
try {
|
|
@@ -2132,50 +2217,50 @@ function Lt(e, t) {
|
|
|
2132
2217
|
return t;
|
|
2133
2218
|
}
|
|
2134
2219
|
}
|
|
2135
|
-
function
|
|
2136
|
-
const n = r.endpoint || e.dataset.formieEndpoint, i = re(n,
|
|
2137
|
-
t.setAttribute("action",
|
|
2138
|
-
const s = a.getAttribute("href"), l = re(n,
|
|
2139
|
-
a.setAttribute("href",
|
|
2220
|
+
function Ui(e, t, r) {
|
|
2221
|
+
const n = r.endpoint || e.dataset.formieEndpoint, i = re(n, $i), o = t.getAttribute("action");
|
|
2222
|
+
t.setAttribute("action", Rt(o, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((a) => {
|
|
2223
|
+
const s = a.getAttribute("href"), l = re(n, Hi);
|
|
2224
|
+
a.setAttribute("href", Rt(s, l));
|
|
2140
2225
|
}), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((a) => {
|
|
2141
2226
|
a.setAttribute(
|
|
2142
2227
|
"data-formie-file-upload-hydrate-endpoint",
|
|
2143
|
-
re(n,
|
|
2228
|
+
re(n, _i)
|
|
2144
2229
|
);
|
|
2145
2230
|
});
|
|
2146
2231
|
}
|
|
2147
|
-
function
|
|
2232
|
+
function ft(e, t) {
|
|
2148
2233
|
if (e === "graphql" && t !== "server-rendered")
|
|
2149
2234
|
throw new Error(`Formie ${t} mode does not support GraphQL transport yet.`);
|
|
2150
2235
|
}
|
|
2151
|
-
function
|
|
2236
|
+
function mt(e) {
|
|
2152
2237
|
if (e == null)
|
|
2153
2238
|
return !1;
|
|
2154
2239
|
const t = e.trim().toLowerCase();
|
|
2155
2240
|
return t === "true" || t === "1" || t === "";
|
|
2156
2241
|
}
|
|
2157
|
-
function
|
|
2242
|
+
function zi(e) {
|
|
2158
2243
|
return ce(e.dataset.formieAutomaticSubmissionState, !0);
|
|
2159
2244
|
}
|
|
2160
|
-
function
|
|
2245
|
+
function Bi(e, t, r) {
|
|
2161
2246
|
return re(
|
|
2162
2247
|
r.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint,
|
|
2163
|
-
|
|
2248
|
+
Oi
|
|
2164
2249
|
);
|
|
2165
2250
|
}
|
|
2166
|
-
function
|
|
2167
|
-
return
|
|
2251
|
+
function ji(e) {
|
|
2252
|
+
return mt(e.dataset.formieUnloadWarning);
|
|
2168
2253
|
}
|
|
2169
|
-
function
|
|
2254
|
+
function kt(e, t) {
|
|
2170
2255
|
e.setAttribute("data-formie-internal-navigation", t);
|
|
2171
2256
|
}
|
|
2172
|
-
function
|
|
2257
|
+
function xe(e) {
|
|
2173
2258
|
e.removeAttribute("data-formie-internal-navigation");
|
|
2174
2259
|
}
|
|
2175
|
-
function
|
|
2260
|
+
function qt(e) {
|
|
2176
2261
|
return e.getAttribute("data-formie-internal-navigation") !== null;
|
|
2177
2262
|
}
|
|
2178
|
-
function
|
|
2263
|
+
function Pt(e, t) {
|
|
2179
2264
|
if (!e)
|
|
2180
2265
|
return !1;
|
|
2181
2266
|
try {
|
|
@@ -2184,31 +2269,31 @@ function Rt(e, t) {
|
|
|
2184
2269
|
return !1;
|
|
2185
2270
|
}
|
|
2186
2271
|
}
|
|
2187
|
-
function
|
|
2188
|
-
return
|
|
2272
|
+
function Wi(e) {
|
|
2273
|
+
return Pt(window.location.href, "resumeToken") || Pt(e.getAttribute("action"), "resumeToken");
|
|
2189
2274
|
}
|
|
2190
|
-
function
|
|
2275
|
+
function Ki(e) {
|
|
2191
2276
|
return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
|
|
2192
2277
|
}
|
|
2193
|
-
function
|
|
2278
|
+
function Gi(e, t = 0) {
|
|
2194
2279
|
if (!e)
|
|
2195
2280
|
return t;
|
|
2196
2281
|
const r = Number.parseInt(e, 10);
|
|
2197
2282
|
return Number.isFinite(r) ? r : t;
|
|
2198
2283
|
}
|
|
2199
|
-
function
|
|
2200
|
-
return Math.max(0,
|
|
2284
|
+
function Ji(e) {
|
|
2285
|
+
return Math.max(0, Gi(e.dataset.formieSubmitDelay, qi));
|
|
2201
2286
|
}
|
|
2202
|
-
function
|
|
2203
|
-
return
|
|
2287
|
+
function Je(e) {
|
|
2288
|
+
return mt(e.dataset.formieValidationOnSubmit);
|
|
2204
2289
|
}
|
|
2205
|
-
async function
|
|
2206
|
-
const t =
|
|
2290
|
+
async function Ye(e) {
|
|
2291
|
+
const t = Ji(e);
|
|
2207
2292
|
t < 1 || await new Promise((r) => {
|
|
2208
2293
|
window.setTimeout(r, t);
|
|
2209
2294
|
});
|
|
2210
2295
|
}
|
|
2211
|
-
function
|
|
2296
|
+
function Vt(e, t) {
|
|
2212
2297
|
const r = e?.getAttribute(t)?.trim();
|
|
2213
2298
|
if (!r)
|
|
2214
2299
|
return null;
|
|
@@ -2218,17 +2303,17 @@ function kt(e, t) {
|
|
|
2218
2303
|
return console.error(`[formie] Failed to parse ${t}.`, n), null;
|
|
2219
2304
|
}
|
|
2220
2305
|
}
|
|
2221
|
-
function
|
|
2306
|
+
function $t(e, t) {
|
|
2222
2307
|
const r = t || (e instanceof HTMLFormElement ? e : null);
|
|
2223
2308
|
if (!r)
|
|
2224
2309
|
return null;
|
|
2225
|
-
const n =
|
|
2310
|
+
const n = Vt(r, "data-formie-modules"), i = Vt(r, "data-formie-theme");
|
|
2226
2311
|
return !n && !i ? null : {
|
|
2227
2312
|
modules: n || void 0,
|
|
2228
2313
|
theme: i || void 0
|
|
2229
2314
|
};
|
|
2230
2315
|
}
|
|
2231
|
-
function
|
|
2316
|
+
function Yi(e) {
|
|
2232
2317
|
if (!(e instanceof HTMLElement))
|
|
2233
2318
|
return !0;
|
|
2234
2319
|
if (!e.isConnected || e.hidden || e.closest("[hidden]"))
|
|
@@ -2236,14 +2321,14 @@ function Ui(e) {
|
|
|
2236
2321
|
const t = window.getComputedStyle(e);
|
|
2237
2322
|
return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
|
|
2238
2323
|
}
|
|
2239
|
-
function
|
|
2324
|
+
function Zi(e, t) {
|
|
2240
2325
|
return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
|
|
2241
2326
|
}
|
|
2242
|
-
function
|
|
2327
|
+
function V(e) {
|
|
2243
2328
|
const t = e, r = t.id ? `#${t.id}` : "", n = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
|
|
2244
2329
|
return `${t.tagName ? t.tagName.toLowerCase() : "element"}${r}${n}`;
|
|
2245
2330
|
}
|
|
2246
|
-
function
|
|
2331
|
+
function pt(e, t) {
|
|
2247
2332
|
if (t) {
|
|
2248
2333
|
if (t.csrf?.param && t.csrf?.token) {
|
|
2249
2334
|
const r = e.querySelector(`input[name="${t.csrf.param}"]`);
|
|
@@ -2268,14 +2353,14 @@ function dt(e, t) {
|
|
|
2268
2353
|
});
|
|
2269
2354
|
}
|
|
2270
2355
|
}
|
|
2271
|
-
async function
|
|
2272
|
-
const r =
|
|
2356
|
+
async function Qi(e, t) {
|
|
2357
|
+
const r = Re(t.mode), n = ke(t.transport);
|
|
2273
2358
|
if (r !== "server-rendered")
|
|
2274
2359
|
return null;
|
|
2275
2360
|
if (t.payload)
|
|
2276
2361
|
return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
|
|
2277
|
-
|
|
2278
|
-
const i = !!
|
|
2362
|
+
ft(n, r);
|
|
2363
|
+
const i = !!Se(e), o = t.formHandle || e.dataset.formieHandle;
|
|
2279
2364
|
if (i || !o)
|
|
2280
2365
|
return null;
|
|
2281
2366
|
const a = {
|
|
@@ -2285,138 +2370,138 @@ async function ji(e, t) {
|
|
|
2285
2370
|
siteId: t.siteId,
|
|
2286
2371
|
theme: t.theme,
|
|
2287
2372
|
themeConfig: t.themeConfig
|
|
2288
|
-
}, s = n === "graphql" ?
|
|
2373
|
+
}, s = n === "graphql" ? Ni(t, e) : xi(t, e), l = n === "graphql" ? await dn(s, o, a) : await cn(s, o, {
|
|
2289
2374
|
...a,
|
|
2290
2375
|
endpoint: s
|
|
2291
2376
|
});
|
|
2292
2377
|
return l?.html && (e.innerHTML = l.html), l;
|
|
2293
2378
|
}
|
|
2294
|
-
async function
|
|
2379
|
+
async function Ar(e, t, r) {
|
|
2295
2380
|
if (t.refreshTokens === !1)
|
|
2296
2381
|
return;
|
|
2297
|
-
|
|
2382
|
+
ft(ke(t.transport), Re(t.mode));
|
|
2298
2383
|
const n = t.formHandle || e.dataset.formieHandle;
|
|
2299
2384
|
if (!n)
|
|
2300
2385
|
return;
|
|
2301
|
-
const i =
|
|
2302
|
-
|
|
2386
|
+
const i = dt(t, e), a = r.querySelector('input[name="renderId"]')?.value || void 0, s = await nt(i, n, a);
|
|
2387
|
+
pt(r, s), I(e, "formie:refresh-tokens:refreshed", s);
|
|
2303
2388
|
}
|
|
2304
|
-
function
|
|
2389
|
+
function Xi(e, t, r, n, i, o) {
|
|
2305
2390
|
const a = String(
|
|
2306
2391
|
t.dataset.formieSubmitMethod || ""
|
|
2307
|
-
).trim().toLowerCase(), s =
|
|
2392
|
+
).trim().toLowerCase(), s = Bi(r, e, t);
|
|
2308
2393
|
let l = !1;
|
|
2309
|
-
const d = t.querySelectorAll("[data-formie-action]"), p = (
|
|
2310
|
-
if (
|
|
2311
|
-
t.setAttribute("data-formie-pending-action",
|
|
2394
|
+
const d = t.querySelectorAll("[data-formie-action]"), p = (c) => {
|
|
2395
|
+
if (c) {
|
|
2396
|
+
t.setAttribute("data-formie-pending-action", c);
|
|
2312
2397
|
return;
|
|
2313
2398
|
}
|
|
2314
2399
|
t.removeAttribute("data-formie-pending-action");
|
|
2315
2400
|
};
|
|
2316
|
-
if (
|
|
2317
|
-
const
|
|
2318
|
-
shouldWarn: () => !
|
|
2319
|
-
}),
|
|
2401
|
+
if (ji(t)) {
|
|
2402
|
+
const c = ki(t, {
|
|
2403
|
+
shouldWarn: () => !qt(t)
|
|
2404
|
+
}), b = (f) => {
|
|
2320
2405
|
if (!(f instanceof CustomEvent))
|
|
2321
2406
|
return;
|
|
2322
2407
|
const v = f.detail;
|
|
2323
|
-
v?.ok && v.action === "save" &&
|
|
2408
|
+
v?.ok && v.action === "save" && c.scheduleBaselineCapture();
|
|
2324
2409
|
}, A = () => {
|
|
2325
|
-
|
|
2410
|
+
c.scheduleBaselineCapture();
|
|
2326
2411
|
};
|
|
2327
|
-
e.addEventListener("formie:submit:result",
|
|
2328
|
-
e.removeEventListener("formie:submit:result",
|
|
2412
|
+
e.addEventListener("formie:submit:result", b), t.addEventListener("formie:state:reset", A), o.push(() => {
|
|
2413
|
+
e.removeEventListener("formie:submit:result", b), t.removeEventListener("formie:state:reset", A), c.destroy();
|
|
2329
2414
|
});
|
|
2330
2415
|
}
|
|
2331
|
-
if (d.forEach((
|
|
2332
|
-
const
|
|
2416
|
+
if (d.forEach((c) => {
|
|
2417
|
+
const b = (A) => {
|
|
2333
2418
|
const f = A.currentTarget.getAttribute("data-formie-action"), v = t.querySelector('input[name="submitAction"]');
|
|
2334
2419
|
p(f), f && v && (v.value = f);
|
|
2335
2420
|
};
|
|
2336
|
-
|
|
2337
|
-
|
|
2421
|
+
c.addEventListener("click", b), o.push(() => {
|
|
2422
|
+
c.removeEventListener("click", b);
|
|
2338
2423
|
});
|
|
2339
|
-
}), t.querySelectorAll("[data-formie-tab-link]").forEach((
|
|
2340
|
-
const
|
|
2424
|
+
}), t.querySelectorAll("[data-formie-tab-link]").forEach((c) => {
|
|
2425
|
+
const b = async (A) => {
|
|
2341
2426
|
if (a !== "ajax") {
|
|
2342
|
-
|
|
2427
|
+
Ki(A) && kt(t, "set-page");
|
|
2343
2428
|
return;
|
|
2344
2429
|
}
|
|
2345
2430
|
A.preventDefault();
|
|
2346
2431
|
const f = A.currentTarget, v = f?.getAttribute("data-formie-page-id"), E = f?.getAttribute("href");
|
|
2347
2432
|
if (!(!v || !E)) {
|
|
2348
|
-
|
|
2433
|
+
lt(t, v), I(e, "formie:page:navigate", {
|
|
2349
2434
|
pageId: v,
|
|
2350
2435
|
href: E
|
|
2351
2436
|
});
|
|
2352
2437
|
try {
|
|
2353
|
-
const
|
|
2438
|
+
const y = await fn(E, t, v);
|
|
2354
2439
|
I(e, "formie:page:navigate:after", {
|
|
2355
2440
|
pageId: v,
|
|
2356
2441
|
href: E,
|
|
2357
|
-
response:
|
|
2442
|
+
response: y
|
|
2358
2443
|
});
|
|
2359
|
-
} catch (
|
|
2360
|
-
console.error("[formie] Failed to persist page navigation state.",
|
|
2444
|
+
} catch (y) {
|
|
2445
|
+
console.error("[formie] Failed to persist page navigation state.", y), I(e, "formie:page:navigate:error", {
|
|
2361
2446
|
pageId: v,
|
|
2362
2447
|
href: E,
|
|
2363
|
-
error:
|
|
2448
|
+
error: y
|
|
2364
2449
|
});
|
|
2365
2450
|
}
|
|
2366
2451
|
}
|
|
2367
2452
|
};
|
|
2368
|
-
|
|
2369
|
-
|
|
2453
|
+
c.addEventListener("click", b), o.push(() => {
|
|
2454
|
+
c.removeEventListener("click", b);
|
|
2370
2455
|
});
|
|
2371
|
-
}), !
|
|
2372
|
-
let
|
|
2373
|
-
const
|
|
2374
|
-
|
|
2456
|
+
}), !zi(t)) {
|
|
2457
|
+
let c = !1;
|
|
2458
|
+
const b = () => {
|
|
2459
|
+
c || qt(t) || Wi(t) || (c = !0, mn(s, t));
|
|
2375
2460
|
};
|
|
2376
|
-
window.addEventListener("pagehide",
|
|
2377
|
-
window.removeEventListener("pagehide",
|
|
2461
|
+
window.addEventListener("pagehide", b), window.addEventListener("beforeunload", b), o.push(() => {
|
|
2462
|
+
window.removeEventListener("pagehide", b), window.removeEventListener("beforeunload", b);
|
|
2378
2463
|
});
|
|
2379
2464
|
}
|
|
2380
|
-
const
|
|
2465
|
+
const u = async (c) => {
|
|
2381
2466
|
if (l)
|
|
2382
2467
|
return;
|
|
2383
|
-
const
|
|
2384
|
-
if (
|
|
2468
|
+
const b = a === "ajax";
|
|
2469
|
+
if (c.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
|
|
2385
2470
|
if (!(t.getAttribute("data-formie-internal-resubmit") === "true"))
|
|
2386
2471
|
return;
|
|
2387
2472
|
t.removeAttribute("data-formie-internal-resubmit");
|
|
2388
2473
|
} else
|
|
2389
2474
|
t.removeAttribute("data-formie-internal-resubmit");
|
|
2390
|
-
const f =
|
|
2475
|
+
const f = c.submitter, v = f?.getAttribute("data-formie-action"), E = t.getAttribute("data-formie-pending-action"), y = t.querySelector('input[name="submitAction"]'), m = v || E || y?.value || "submit";
|
|
2391
2476
|
let g = null, S = !1;
|
|
2392
2477
|
try {
|
|
2393
|
-
if (
|
|
2394
|
-
g = await
|
|
2478
|
+
if (b)
|
|
2479
|
+
g = await br({
|
|
2395
2480
|
target: e,
|
|
2396
2481
|
form: t,
|
|
2397
2482
|
bus: n,
|
|
2398
2483
|
validator: i,
|
|
2399
|
-
validateOnSubmit:
|
|
2484
|
+
validateOnSubmit: Je(t),
|
|
2400
2485
|
action: m,
|
|
2401
2486
|
submitter: f,
|
|
2402
|
-
waitForSubmitDelay:
|
|
2487
|
+
waitForSubmitDelay: Ye,
|
|
2403
2488
|
onRefreshTokensAfterSubmit: async () => {
|
|
2404
|
-
await
|
|
2489
|
+
await Ar(e, r, t);
|
|
2405
2490
|
},
|
|
2406
|
-
dispatchSubmitResult: (
|
|
2407
|
-
I(e, "formie:submit:result",
|
|
2491
|
+
dispatchSubmitResult: (M) => {
|
|
2492
|
+
I(e, "formie:submit:result", M);
|
|
2408
2493
|
}
|
|
2409
2494
|
});
|
|
2410
2495
|
else {
|
|
2411
|
-
if (
|
|
2496
|
+
if (hr(t), sr(t, f), await Ye(t), g = await tr(t, m, n, {
|
|
2412
2497
|
validator: i,
|
|
2413
|
-
validateOnSubmit:
|
|
2498
|
+
validateOnSubmit: Je(t),
|
|
2414
2499
|
preflightOnly: !0
|
|
2415
2500
|
}), g.ok) {
|
|
2416
|
-
|
|
2417
|
-
let
|
|
2501
|
+
Kt(t, m), l = !0, kt(t, "submit"), p(null);
|
|
2502
|
+
let M = !1;
|
|
2418
2503
|
const T = () => {
|
|
2419
|
-
|
|
2504
|
+
M = !0, l = !1, xe(t), Me(t);
|
|
2420
2505
|
};
|
|
2421
2506
|
if (typeof t.requestSubmit == "function") {
|
|
2422
2507
|
t.addEventListener("invalid", T, !0);
|
|
@@ -2427,40 +2512,40 @@ function Bi(e, t, r, n, i, o) {
|
|
|
2427
2512
|
}
|
|
2428
2513
|
} else
|
|
2429
2514
|
t.submit();
|
|
2430
|
-
if (
|
|
2515
|
+
if (M)
|
|
2431
2516
|
return;
|
|
2432
2517
|
S = !0;
|
|
2433
2518
|
return;
|
|
2434
2519
|
}
|
|
2435
|
-
|
|
2520
|
+
Le(t, g), I(e, "formie:submit:result", g), xe(t);
|
|
2436
2521
|
}
|
|
2437
|
-
} catch (
|
|
2522
|
+
} catch (M) {
|
|
2438
2523
|
l = !1, g = {
|
|
2439
2524
|
ok: !1,
|
|
2440
2525
|
code: "SUBMIT_ERROR",
|
|
2441
|
-
message:
|
|
2442
|
-
formErrors: [
|
|
2443
|
-
},
|
|
2526
|
+
message: M instanceof Error ? M.message : "Submission failed.",
|
|
2527
|
+
formErrors: [M instanceof Error ? M.message : "Submission failed."]
|
|
2528
|
+
}, Le(t, g), I(e, "formie:submit:result", g), xe(t);
|
|
2444
2529
|
} finally {
|
|
2445
|
-
p(null), !
|
|
2530
|
+
p(null), !b && !S && !gr(g) && Me(t);
|
|
2446
2531
|
}
|
|
2447
2532
|
};
|
|
2448
|
-
t.addEventListener("submit",
|
|
2449
|
-
t.removeEventListener("submit",
|
|
2533
|
+
t.addEventListener("submit", u), o.push(() => {
|
|
2534
|
+
t.removeEventListener("submit", u);
|
|
2450
2535
|
});
|
|
2451
2536
|
}
|
|
2452
|
-
async function
|
|
2537
|
+
async function eo(e, t, r) {
|
|
2453
2538
|
if (t.refreshTokens === !1 || !t.staticCache)
|
|
2454
2539
|
return;
|
|
2455
|
-
|
|
2456
|
-
const n = t.formHandle || e.dataset.formieHandle, i =
|
|
2540
|
+
ft(ke(t.transport), Re(t.mode));
|
|
2541
|
+
const n = t.formHandle || e.dataset.formieHandle, i = dt(t, e), a = r?.querySelector('input[name="renderId"]')?.value || void 0;
|
|
2457
2542
|
if (!n)
|
|
2458
2543
|
return;
|
|
2459
|
-
const s = await
|
|
2460
|
-
!s || !r || (
|
|
2544
|
+
const s = await nt(i, n, a);
|
|
2545
|
+
!s || !r || (pt(r, s), I(e, "formie:refresh-tokens:after", s));
|
|
2461
2546
|
}
|
|
2462
|
-
function
|
|
2463
|
-
const e = /* @__PURE__ */ new Map(), t = new
|
|
2547
|
+
function to() {
|
|
2548
|
+
const e = /* @__PURE__ */ new Map(), t = new yr(), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = [
|
|
2464
2549
|
"prepare",
|
|
2465
2550
|
"normalize",
|
|
2466
2551
|
"validate",
|
|
@@ -2475,12 +2560,12 @@ function Ki() {
|
|
|
2475
2560
|
return;
|
|
2476
2561
|
}
|
|
2477
2562
|
const E = (async () => {
|
|
2478
|
-
L.log("Unmount requested.", { target:
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2563
|
+
L.log("Unmount requested.", { target: V(f) });
|
|
2564
|
+
const y = r.get(f);
|
|
2565
|
+
y && (y(), r.delete(f));
|
|
2481
2566
|
const m = e.get(f);
|
|
2482
2567
|
if (!m) {
|
|
2483
|
-
L.log("Unmount skipped (no mounted state).", { target:
|
|
2568
|
+
L.log("Unmount skipped (no mounted state).", { target: V(f) });
|
|
2484
2569
|
return;
|
|
2485
2570
|
}
|
|
2486
2571
|
I(f, "formie:unmount:before", {
|
|
@@ -2492,67 +2577,67 @@ function Ki() {
|
|
|
2492
2577
|
await g.destroy();
|
|
2493
2578
|
m.modules = [], m.bus.clear(), e.delete(f), I(f, "formie:unmount:after", {
|
|
2494
2579
|
id: m.instance.id
|
|
2495
|
-
}), L.log("Unmount complete.", { id: m.instance.id, target:
|
|
2580
|
+
}), L.log("Unmount complete.", { id: m.instance.id, target: V(f) });
|
|
2496
2581
|
})().finally(() => {
|
|
2497
2582
|
n.delete(f);
|
|
2498
2583
|
});
|
|
2499
2584
|
n.set(f, E), await E;
|
|
2500
2585
|
}, a = async (f, v) => {
|
|
2501
2586
|
L.log("Mount requested.", {
|
|
2502
|
-
target:
|
|
2587
|
+
target: V(f),
|
|
2503
2588
|
mode: v.mode,
|
|
2504
2589
|
autoVisible: v.autoVisible
|
|
2505
2590
|
});
|
|
2506
2591
|
const E = r.get(f);
|
|
2507
2592
|
E && (E(), r.delete(f));
|
|
2508
|
-
const
|
|
2509
|
-
if (
|
|
2593
|
+
const y = e.get(f);
|
|
2594
|
+
if (y)
|
|
2510
2595
|
return L.log("Mount skipped (already mounted).", {
|
|
2511
|
-
id:
|
|
2512
|
-
target:
|
|
2513
|
-
}),
|
|
2514
|
-
const m = new
|
|
2515
|
-
...
|
|
2596
|
+
id: y.instance.id,
|
|
2597
|
+
target: V(f)
|
|
2598
|
+
}), y.instance;
|
|
2599
|
+
const m = new Gt(), g = [], S = f?.id || `formie-${e.size + 1}`, M = ee(f), T = {
|
|
2600
|
+
...M,
|
|
2516
2601
|
...v,
|
|
2517
|
-
mode:
|
|
2518
|
-
transport:
|
|
2519
|
-
}, F =
|
|
2520
|
-
if (T.mode !== "server-rendered" && !
|
|
2602
|
+
mode: Re(v.mode ?? M.mode),
|
|
2603
|
+
transport: ke(v.transport ?? M.transport)
|
|
2604
|
+
}, F = Dr(T.compatibility);
|
|
2605
|
+
if (T.mode !== "server-rendered" && !Se(f))
|
|
2521
2606
|
throw new Error(`Formie ${T.mode} mode is not implemented yet in the browser client.`);
|
|
2522
|
-
const
|
|
2523
|
-
T.staticCache = v.staticCache ??
|
|
2524
|
-
const
|
|
2525
|
-
...
|
|
2526
|
-
...
|
|
2527
|
-
} : null,
|
|
2607
|
+
const q = await Qi(f, T), w = Se(f);
|
|
2608
|
+
T.staticCache = v.staticCache ?? Ge(w ? w.dataset : f.dataset);
|
|
2609
|
+
const P = $t(f, w), N = q || P ? {
|
|
2610
|
+
...q || {},
|
|
2611
|
+
...P || {}
|
|
2612
|
+
} : null, j = N?.theme, Y = {}, fe = (N?.modules || []).filter((C) => !!C?.id && !!C?.type);
|
|
2528
2613
|
L.log("Resolved mount payload.", {
|
|
2529
|
-
target:
|
|
2530
|
-
hasRenderPayload: !!
|
|
2531
|
-
hasEmbeddedPayload: !!
|
|
2614
|
+
target: V(f),
|
|
2615
|
+
hasRenderPayload: !!q,
|
|
2616
|
+
hasEmbeddedPayload: !!P,
|
|
2532
2617
|
moduleCount: fe.length
|
|
2533
2618
|
});
|
|
2534
|
-
const ne =
|
|
2535
|
-
live:
|
|
2619
|
+
const ne = yt(f, j, w), k = w ? new Vn(w, {
|
|
2620
|
+
live: mt(w.dataset.formieValidationOnFocus),
|
|
2536
2621
|
errorMessage: w.dataset.formieErrorMessage || "",
|
|
2537
2622
|
fieldContainerErrorClass: ne.fieldLayoutError || [],
|
|
2538
2623
|
inputErrorClass: ne.fieldControlError || [],
|
|
2539
2624
|
messagesClass: ne.fieldErrors || [],
|
|
2540
2625
|
messageClass: ne.fieldError || []
|
|
2541
2626
|
}) : null;
|
|
2542
|
-
if (w &&
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
validator:
|
|
2547
|
-
addValidator:
|
|
2548
|
-
removeValidator:
|
|
2627
|
+
if (w && k) {
|
|
2628
|
+
const C = w;
|
|
2629
|
+
C.formieValidation = k, Y.validation = k;
|
|
2630
|
+
const H = {
|
|
2631
|
+
validator: k,
|
|
2632
|
+
addValidator: k.addValidator.bind(k),
|
|
2633
|
+
removeValidator: k.removeValidator.bind(k)
|
|
2549
2634
|
};
|
|
2550
|
-
I(w, "formie:validator:ready",
|
|
2635
|
+
I(w, "formie:validator:ready", H), I(f, "formie:validator:ready", H);
|
|
2551
2636
|
}
|
|
2552
|
-
w && ((
|
|
2637
|
+
w && ((q || T.endpoint || f.dataset.formieEndpoint) && Ui(f, w, T), J(w)), Object.keys(ne).length && I(f, "formie:theme:applied", {
|
|
2553
2638
|
hasClasses: !0
|
|
2554
2639
|
});
|
|
2555
|
-
const me = await
|
|
2640
|
+
const me = await Er(fe, {
|
|
2556
2641
|
registry: t,
|
|
2557
2642
|
matchContext: {
|
|
2558
2643
|
root: f,
|
|
@@ -2566,27 +2651,27 @@ function Ki() {
|
|
|
2566
2651
|
target: f,
|
|
2567
2652
|
scope: "form",
|
|
2568
2653
|
state: Y,
|
|
2569
|
-
on: (
|
|
2570
|
-
emit: (
|
|
2654
|
+
on: (C, H) => m.on(C, H),
|
|
2655
|
+
emit: (C, H) => (I(f, C, H), m.emitSafe(C, H).then((Z) => {
|
|
2571
2656
|
Z.failed.length > 0 && L.warn("Lifecycle listeners failed.", {
|
|
2572
|
-
eventName:
|
|
2657
|
+
eventName: C,
|
|
2573
2658
|
failed: Z.failed.length
|
|
2574
2659
|
});
|
|
2575
2660
|
}))
|
|
2576
2661
|
}
|
|
2577
2662
|
});
|
|
2578
2663
|
L.log("Module setup complete.", {
|
|
2579
|
-
target:
|
|
2664
|
+
target: V(f),
|
|
2580
2665
|
moduleInstances: me.length
|
|
2581
2666
|
});
|
|
2582
|
-
const
|
|
2667
|
+
const Pe = {
|
|
2583
2668
|
id: S,
|
|
2584
2669
|
root: f,
|
|
2585
|
-
submit: async (
|
|
2670
|
+
submit: async (C = "submit") => {
|
|
2586
2671
|
if (L.log("Submit requested.", {
|
|
2587
2672
|
id: S,
|
|
2588
|
-
target:
|
|
2589
|
-
action:
|
|
2673
|
+
target: V(f),
|
|
2674
|
+
action: C
|
|
2590
2675
|
}), !w)
|
|
2591
2676
|
return {
|
|
2592
2677
|
ok: !1,
|
|
@@ -2594,34 +2679,34 @@ function Ki() {
|
|
|
2594
2679
|
message: "No form element found for mount target.",
|
|
2595
2680
|
formErrors: ["No form element found for mount target."]
|
|
2596
2681
|
};
|
|
2597
|
-
const
|
|
2598
|
-
if (
|
|
2682
|
+
const H = w.querySelector('input[name="submitAction"]');
|
|
2683
|
+
if (H && (H.value = C), w.getAttribute("data-formie-loading") === "true")
|
|
2599
2684
|
return {
|
|
2600
2685
|
ok: !1,
|
|
2601
2686
|
code: "SUBMIT_IN_PROGRESS",
|
|
2602
2687
|
message: "Submission already in progress.",
|
|
2603
2688
|
formErrors: []
|
|
2604
2689
|
};
|
|
2605
|
-
const Z = w.querySelector(`[data-formie-action="${
|
|
2690
|
+
const Z = w.querySelector(`[data-formie-action="${C}"]`), Q = await br({
|
|
2606
2691
|
id: S,
|
|
2607
2692
|
target: f,
|
|
2608
2693
|
form: w,
|
|
2609
2694
|
bus: m,
|
|
2610
|
-
validator:
|
|
2611
|
-
validateOnSubmit:
|
|
2612
|
-
action:
|
|
2695
|
+
validator: k,
|
|
2696
|
+
validateOnSubmit: Je(w),
|
|
2697
|
+
action: C,
|
|
2613
2698
|
submitter: Z,
|
|
2614
|
-
waitForSubmitDelay:
|
|
2699
|
+
waitForSubmitDelay: Ye,
|
|
2615
2700
|
onRefreshTokensAfterSubmit: async () => {
|
|
2616
|
-
await
|
|
2701
|
+
await Ar(f, T, w);
|
|
2617
2702
|
},
|
|
2618
|
-
dispatchSubmitResult: (
|
|
2619
|
-
I(f, "formie:submit:result",
|
|
2703
|
+
dispatchSubmitResult: (Ve) => {
|
|
2704
|
+
I(f, "formie:submit:result", Ve);
|
|
2620
2705
|
}
|
|
2621
2706
|
});
|
|
2622
2707
|
return L.log("Submit completed.", {
|
|
2623
2708
|
id: S,
|
|
2624
|
-
action:
|
|
2709
|
+
action: C,
|
|
2625
2710
|
ok: Q.ok,
|
|
2626
2711
|
code: Q.code,
|
|
2627
2712
|
message: Q.message
|
|
@@ -2630,81 +2715,81 @@ function Ki() {
|
|
|
2630
2715
|
destroy: async () => {
|
|
2631
2716
|
await o(f);
|
|
2632
2717
|
},
|
|
2633
|
-
on: (
|
|
2718
|
+
on: (C, H) => m.on(C, H)
|
|
2634
2719
|
};
|
|
2635
|
-
w && (
|
|
2720
|
+
w && (Gr({
|
|
2636
2721
|
target: f,
|
|
2637
2722
|
form: w,
|
|
2638
|
-
validatorDetail:
|
|
2639
|
-
validator:
|
|
2640
|
-
addValidator:
|
|
2641
|
-
removeValidator:
|
|
2723
|
+
validatorDetail: k ? {
|
|
2724
|
+
validator: k,
|
|
2725
|
+
addValidator: k.addValidator.bind(k),
|
|
2726
|
+
removeValidator: k.removeValidator.bind(k)
|
|
2642
2727
|
} : null,
|
|
2643
2728
|
options: F,
|
|
2644
2729
|
unbinds: g
|
|
2645
|
-
}),
|
|
2730
|
+
}), Kr({
|
|
2646
2731
|
target: f,
|
|
2647
2732
|
form: w,
|
|
2648
|
-
instance:
|
|
2733
|
+
instance: Pe,
|
|
2649
2734
|
options: F,
|
|
2650
2735
|
unbinds: g
|
|
2651
|
-
})), w && (
|
|
2652
|
-
const
|
|
2653
|
-
I(f, `formie:stage:${
|
|
2654
|
-
}), Z = m.on(`formie:stage:${
|
|
2736
|
+
})), w && (Xi(f, w, T, m, k, g), k && g.push(_n(w, k, f)), await eo(f, T, w)), i.forEach((C) => {
|
|
2737
|
+
const H = m.on(`formie:stage:${C}:before`, async (W) => {
|
|
2738
|
+
I(f, `formie:stage:${C}:before`, W);
|
|
2739
|
+
}), Z = m.on(`formie:stage:${C}:before`, async (W) => {
|
|
2655
2740
|
for (const ie of me)
|
|
2656
2741
|
ie.onBeforeStage && await ie.onBeforeStage(W);
|
|
2657
|
-
}), Q = m.on(`formie:stage:${
|
|
2658
|
-
I(f, `formie:stage:${
|
|
2659
|
-
}),
|
|
2742
|
+
}), Q = m.on(`formie:stage:${C}:after`, async (W) => {
|
|
2743
|
+
I(f, `formie:stage:${C}:after`, W);
|
|
2744
|
+
}), Ve = m.on(`formie:stage:${C}:after`, async (W) => {
|
|
2660
2745
|
const ie = W;
|
|
2661
|
-
for (const
|
|
2662
|
-
|
|
2746
|
+
for (const bt of me)
|
|
2747
|
+
bt.onAfterStage && await bt.onAfterStage(ie, ie.result);
|
|
2663
2748
|
});
|
|
2664
|
-
g.push(
|
|
2749
|
+
g.push(H, Z, Q, Ve);
|
|
2665
2750
|
});
|
|
2666
|
-
const
|
|
2667
|
-
I(f, "formie:submit:before",
|
|
2668
|
-
}),
|
|
2669
|
-
I(f, "formie:submit:after",
|
|
2670
|
-
}),
|
|
2671
|
-
I(f, "formie:submit:final:before",
|
|
2672
|
-
}),
|
|
2673
|
-
I(f, "formie:submit:final:after",
|
|
2751
|
+
const Vr = m.on("formie:submit:before", async (C) => {
|
|
2752
|
+
I(f, "formie:submit:before", C);
|
|
2753
|
+
}), $r = m.on("formie:submit:after", async (C) => {
|
|
2754
|
+
I(f, "formie:submit:after", C);
|
|
2755
|
+
}), Hr = m.on("formie:submit:final:before", async (C) => {
|
|
2756
|
+
I(f, "formie:submit:final:before", C);
|
|
2757
|
+
}), Or = m.on("formie:submit:final:after", async (C) => {
|
|
2758
|
+
I(f, "formie:submit:final:after", C);
|
|
2674
2759
|
});
|
|
2675
2760
|
return g.push(
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2761
|
+
Vr,
|
|
2762
|
+
$r,
|
|
2763
|
+
Hr,
|
|
2764
|
+
Or
|
|
2680
2765
|
), e.set(f, {
|
|
2681
2766
|
options: T,
|
|
2682
2767
|
bus: m,
|
|
2683
2768
|
form: w,
|
|
2684
|
-
validator:
|
|
2769
|
+
validator: k,
|
|
2685
2770
|
modules: me,
|
|
2686
2771
|
unbinds: g,
|
|
2687
|
-
instance:
|
|
2772
|
+
instance: Pe
|
|
2688
2773
|
}), I(f, "formie:mount:after", {
|
|
2689
2774
|
id: S,
|
|
2690
2775
|
mode: T.mode
|
|
2691
2776
|
}), L.log("Mount complete.", {
|
|
2692
2777
|
id: S,
|
|
2693
|
-
target:
|
|
2778
|
+
target: V(f),
|
|
2694
2779
|
mode: T.mode
|
|
2695
|
-
}),
|
|
2780
|
+
}), Pe;
|
|
2696
2781
|
}, s = (f, v) => {
|
|
2697
|
-
if (!v.autoVisible ||
|
|
2782
|
+
if (!v.autoVisible || Yi(f) || typeof IntersectionObserver > "u")
|
|
2698
2783
|
return a(f, v);
|
|
2699
2784
|
if (e.has(f))
|
|
2700
2785
|
return Promise.resolve(e.get(f)?.instance || null);
|
|
2701
2786
|
if (r.has(f))
|
|
2702
2787
|
return L.log("Mount deferred (already waiting visibility).", {
|
|
2703
|
-
target:
|
|
2788
|
+
target: V(f)
|
|
2704
2789
|
}), Promise.resolve(null);
|
|
2705
|
-
const E = new IntersectionObserver((
|
|
2706
|
-
|
|
2707
|
-
target:
|
|
2790
|
+
const E = new IntersectionObserver((y) => {
|
|
2791
|
+
y.some((g) => g.target === f && g.isIntersecting) && (E.disconnect(), r.delete(f), L.log("Visibility reached, proceeding mount.", {
|
|
2792
|
+
target: V(f)
|
|
2708
2793
|
}), a(f, {
|
|
2709
2794
|
...v,
|
|
2710
2795
|
autoVisible: !1
|
|
@@ -2715,7 +2800,7 @@ function Ki() {
|
|
|
2715
2800
|
return E.observe(f), r.set(f, () => {
|
|
2716
2801
|
E.disconnect();
|
|
2717
2802
|
}), L.log("Mount deferred until visible.", {
|
|
2718
|
-
target:
|
|
2803
|
+
target: V(f)
|
|
2719
2804
|
}), Promise.resolve(null);
|
|
2720
2805
|
};
|
|
2721
2806
|
return {
|
|
@@ -2733,7 +2818,7 @@ function Ki() {
|
|
|
2733
2818
|
...E.options,
|
|
2734
2819
|
...v
|
|
2735
2820
|
};
|
|
2736
|
-
const
|
|
2821
|
+
const y = v.payload?.theme || E.options.payload?.theme || $t(f, E.form)?.theme, m = yt(f, y, E.form);
|
|
2737
2822
|
return E.validator && (E.validator.config.fieldContainerErrorClass = m.fieldLayoutError || [], E.validator.config.inputErrorClass = m.fieldControlError || [], E.validator.config.messagesClass = m.fieldErrors || [], E.validator.config.messageClass = m.fieldError || []), Object.keys(m).length && I(f, "formie:theme:applied", {
|
|
2738
2823
|
hasClasses: !0,
|
|
2739
2824
|
reason: "update"
|
|
@@ -2741,14 +2826,14 @@ function Ki() {
|
|
|
2741
2826
|
},
|
|
2742
2827
|
getInstance: (f) => e.get(f)?.instance || null,
|
|
2743
2828
|
refreshForCache: async (f) => {
|
|
2744
|
-
|
|
2829
|
+
Di(
|
|
2745
2830
|
"refreshForCache",
|
|
2746
2831
|
"Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead."
|
|
2747
2832
|
);
|
|
2748
2833
|
let v = null;
|
|
2749
2834
|
if (typeof f == "string") {
|
|
2750
|
-
const
|
|
2751
|
-
|
|
2835
|
+
const q = document.getElementById(f);
|
|
2836
|
+
q ? v = q : v = document.querySelector(`[data-formie-form-id="${f}"]`);
|
|
2752
2837
|
} else
|
|
2753
2838
|
v = f;
|
|
2754
2839
|
if (!v) {
|
|
@@ -2757,22 +2842,22 @@ function Ki() {
|
|
|
2757
2842
|
});
|
|
2758
2843
|
return;
|
|
2759
2844
|
}
|
|
2760
|
-
const E = e.get(v),
|
|
2761
|
-
if (!
|
|
2845
|
+
const E = e.get(v), y = Se(v), m = E?.options || ee(v);
|
|
2846
|
+
if (!y) {
|
|
2762
2847
|
L.warn("refreshForCache found no form element for target.", {
|
|
2763
|
-
target:
|
|
2848
|
+
target: V(v)
|
|
2764
2849
|
});
|
|
2765
2850
|
return;
|
|
2766
2851
|
}
|
|
2767
|
-
const g = m.formHandle || v.dataset.formieHandle ||
|
|
2852
|
+
const g = m.formHandle || v.dataset.formieHandle || y.dataset.formieHandle, S = dt(m, v), T = y.querySelector('input[name="renderId"]')?.value || void 0;
|
|
2768
2853
|
if (!g) {
|
|
2769
2854
|
L.warn("refreshForCache found no form handle for target.", {
|
|
2770
|
-
target:
|
|
2855
|
+
target: V(v)
|
|
2771
2856
|
});
|
|
2772
2857
|
return;
|
|
2773
2858
|
}
|
|
2774
|
-
const F = await
|
|
2775
|
-
F && (
|
|
2859
|
+
const F = await nt(S, g, T);
|
|
2860
|
+
F && (pt(y, F), I(v, "formie:refresh-tokens:after", F));
|
|
2776
2861
|
},
|
|
2777
2862
|
registerModule: (f, v) => t.register(f, v),
|
|
2778
2863
|
unregisterModule: (f) => {
|
|
@@ -2802,22 +2887,22 @@ function Ki() {
|
|
|
2802
2887
|
L.log("Observer started.", {
|
|
2803
2888
|
scope: v === document ? "document" : v
|
|
2804
2889
|
});
|
|
2805
|
-
const E = new MutationObserver((
|
|
2806
|
-
|
|
2890
|
+
const E = new MutationObserver((y) => {
|
|
2891
|
+
y.forEach((m) => {
|
|
2807
2892
|
m.addedNodes.forEach((g) => {
|
|
2808
2893
|
g instanceof Element && (g.matches(X) && (L.log("Observer detected new root.", {
|
|
2809
|
-
target:
|
|
2894
|
+
target: V(g)
|
|
2810
2895
|
}), s(g, ee(g))), g.querySelectorAll(X).forEach((S) => {
|
|
2811
2896
|
L.log("Observer detected new nested root.", {
|
|
2812
|
-
target:
|
|
2897
|
+
target: V(S)
|
|
2813
2898
|
}), s(S, ee(S));
|
|
2814
2899
|
}));
|
|
2815
2900
|
}), m.removedNodes.forEach((g) => {
|
|
2816
2901
|
g instanceof Element && (e.has(g) && (L.log("Observer detected removed root.", {
|
|
2817
|
-
target:
|
|
2902
|
+
target: V(g)
|
|
2818
2903
|
}), o(g)), g.querySelectorAll(X).forEach((S) => {
|
|
2819
2904
|
e.has(S) && (L.log("Observer detected removed nested root.", {
|
|
2820
|
-
target:
|
|
2905
|
+
target: V(S)
|
|
2821
2906
|
}), o(S));
|
|
2822
2907
|
}));
|
|
2823
2908
|
});
|
|
@@ -2828,21 +2913,21 @@ function Ki() {
|
|
|
2828
2913
|
subtree: !0
|
|
2829
2914
|
}), () => {
|
|
2830
2915
|
E.disconnect(), L.log("Observer stopped."), r.forEach((m, g) => {
|
|
2831
|
-
|
|
2916
|
+
Zi(g, v) && (m(), r.delete(g));
|
|
2832
2917
|
});
|
|
2833
|
-
const
|
|
2834
|
-
v instanceof Element && v.matches(X) &&
|
|
2835
|
-
|
|
2836
|
-
}),
|
|
2918
|
+
const y = [];
|
|
2919
|
+
v instanceof Element && v.matches(X) && y.push(v), v.querySelectorAll(X).forEach((m) => {
|
|
2920
|
+
y.push(m);
|
|
2921
|
+
}), y.forEach((m) => {
|
|
2837
2922
|
e.has(m) && o(m);
|
|
2838
2923
|
});
|
|
2839
2924
|
};
|
|
2840
2925
|
}
|
|
2841
2926
|
};
|
|
2842
2927
|
}
|
|
2843
|
-
const
|
|
2844
|
-
async function
|
|
2845
|
-
const t = e.root, r = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), n = e.modules ?? [], i = e.mode ?? "server-rendered", o = e.registry ?? new
|
|
2928
|
+
const wr = _("general", "module-hydrator");
|
|
2929
|
+
async function sa(e) {
|
|
2930
|
+
const t = e.root, r = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), n = e.modules ?? [], i = e.mode ?? "server-rendered", o = e.registry ?? new yr(), a = new Gt(), s = await Er(n, {
|
|
2846
2931
|
registry: o,
|
|
2847
2932
|
setupContext: {
|
|
2848
2933
|
formId: r?.id || t.id || "formie-modules",
|
|
@@ -2863,13 +2948,13 @@ async function Xo(e) {
|
|
|
2863
2948
|
mode: i
|
|
2864
2949
|
}
|
|
2865
2950
|
});
|
|
2866
|
-
return
|
|
2951
|
+
return wr.log("Hydrated module manifest.", {
|
|
2867
2952
|
moduleCount: n.length,
|
|
2868
2953
|
instanceCount: s.length,
|
|
2869
2954
|
mode: i
|
|
2870
2955
|
}), {
|
|
2871
2956
|
destroy: async () => {
|
|
2872
|
-
await
|
|
2957
|
+
await ro(s), a.clear();
|
|
2873
2958
|
},
|
|
2874
2959
|
on: (l, d) => a.on(l, d),
|
|
2875
2960
|
emit: async (l, d) => {
|
|
@@ -2882,45 +2967,45 @@ async function Xo(e) {
|
|
|
2882
2967
|
getRegisteredModules: () => o.getAll()
|
|
2883
2968
|
};
|
|
2884
2969
|
}
|
|
2885
|
-
async function
|
|
2970
|
+
async function ro(e) {
|
|
2886
2971
|
for (const t of e)
|
|
2887
2972
|
try {
|
|
2888
2973
|
await t.destroy();
|
|
2889
2974
|
} catch (r) {
|
|
2890
|
-
console.error("[formie] Failed to destroy module instance.", r),
|
|
2975
|
+
console.error("[formie] Failed to destroy module instance.", r), wr.warn("Failed destroying module instance.", { error: r });
|
|
2891
2976
|
}
|
|
2892
2977
|
}
|
|
2893
|
-
function
|
|
2978
|
+
function qe(e) {
|
|
2894
2979
|
return e instanceof Element;
|
|
2895
2980
|
}
|
|
2896
|
-
function
|
|
2981
|
+
function no(e) {
|
|
2897
2982
|
return e.ok;
|
|
2898
2983
|
}
|
|
2899
|
-
function
|
|
2900
|
-
return typeof e == "string" ? `selector "${e}"` :
|
|
2984
|
+
function io(e) {
|
|
2985
|
+
return typeof e == "string" ? `selector "${e}"` : qe(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
|
|
2901
2986
|
}
|
|
2902
|
-
function
|
|
2987
|
+
function oo(e) {
|
|
2903
2988
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
2904
2989
|
for (const n of e)
|
|
2905
|
-
!
|
|
2990
|
+
!qe(n) || t.has(n) || (t.add(n), r.push(n));
|
|
2906
2991
|
return r;
|
|
2907
2992
|
}
|
|
2908
|
-
function
|
|
2909
|
-
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) :
|
|
2993
|
+
function Ze(e) {
|
|
2994
|
+
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : qe(e) ? [e] : oo(e);
|
|
2910
2995
|
}
|
|
2911
|
-
function
|
|
2996
|
+
function ao() {
|
|
2912
2997
|
return document.readyState !== "loading" ? Promise.resolve() : new Promise((e) => {
|
|
2913
2998
|
document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
|
|
2914
2999
|
});
|
|
2915
3000
|
}
|
|
2916
|
-
async function
|
|
2917
|
-
const t =
|
|
2918
|
-
return t.length > 0 || typeof e != "string" ? t : (await
|
|
3001
|
+
async function so(e) {
|
|
3002
|
+
const t = Ze(e);
|
|
3003
|
+
return t.length > 0 || typeof e != "string" ? t : (await ao(), Ze(e));
|
|
2919
3004
|
}
|
|
2920
|
-
function
|
|
2921
|
-
return typeof e == "string" ? document :
|
|
3005
|
+
function lo(e) {
|
|
3006
|
+
return typeof e == "string" ? document : qe(e) ? e.getRootNode() : document;
|
|
2922
3007
|
}
|
|
2923
|
-
function
|
|
3008
|
+
function uo(e) {
|
|
2924
3009
|
const {
|
|
2925
3010
|
element: t,
|
|
2926
3011
|
observe: r,
|
|
@@ -2938,8 +3023,8 @@ function to(e) {
|
|
|
2938
3023
|
...p
|
|
2939
3024
|
};
|
|
2940
3025
|
}
|
|
2941
|
-
async function
|
|
2942
|
-
const i = [], o =
|
|
3026
|
+
async function Ht(e, t, r, n) {
|
|
3027
|
+
const i = [], o = uo(e);
|
|
2943
3028
|
for (const a of n) {
|
|
2944
3029
|
const s = r.get(a);
|
|
2945
3030
|
if (s) {
|
|
@@ -2948,14 +3033,14 @@ async function Pt(e, t, r, n) {
|
|
|
2948
3033
|
}
|
|
2949
3034
|
const l = await t.mount(a, o), d = [];
|
|
2950
3035
|
if (e.onReady?.(l), d.push(l.on("formie:submit:result", (p) => {
|
|
2951
|
-
const
|
|
2952
|
-
e.onResult?.(
|
|
3036
|
+
const h = p;
|
|
3037
|
+
e.onResult?.(h, l), no(h) ? e.onSuccess?.(h, l) : e.onError?.(h, l);
|
|
2953
3038
|
})), e.onEvent)
|
|
2954
|
-
for (const p of
|
|
2955
|
-
d.push(l.on(p, (
|
|
3039
|
+
for (const p of xr)
|
|
3040
|
+
d.push(l.on(p, (h) => {
|
|
2956
3041
|
e.onEvent?.({
|
|
2957
3042
|
name: p,
|
|
2958
|
-
payload:
|
|
3043
|
+
payload: h
|
|
2959
3044
|
}, l);
|
|
2960
3045
|
}));
|
|
2961
3046
|
r.set(a, {
|
|
@@ -2965,12 +3050,12 @@ async function Pt(e, t, r, n) {
|
|
|
2965
3050
|
}
|
|
2966
3051
|
return i;
|
|
2967
3052
|
}
|
|
2968
|
-
async function
|
|
2969
|
-
const t = e.client ??
|
|
3053
|
+
async function la(e) {
|
|
3054
|
+
const t = e.client ?? to(), r = /* @__PURE__ */ new Map(), n = await so(e.element);
|
|
2970
3055
|
if (n.length === 0 && !e.allowEmpty)
|
|
2971
|
-
throw new Error(`Formie could not find any elements for ${
|
|
2972
|
-
await
|
|
2973
|
-
const i = e.observe ? t.observe(
|
|
3056
|
+
throw new Error(`Formie could not find any elements for ${io(e.element)}.`);
|
|
3057
|
+
await Ht(e, t, r, n);
|
|
3058
|
+
const i = e.observe ? t.observe(lo(e.element)) : null;
|
|
2974
3059
|
return {
|
|
2975
3060
|
client: t,
|
|
2976
3061
|
get instances() {
|
|
@@ -2981,8 +3066,8 @@ async function ea(e) {
|
|
|
2981
3066
|
return a ? r.get(a)?.instance ?? t.getInstance(a) : null;
|
|
2982
3067
|
},
|
|
2983
3068
|
async rescan() {
|
|
2984
|
-
const o =
|
|
2985
|
-
return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) :
|
|
3069
|
+
const o = Ze(e.element);
|
|
3070
|
+
return o.length === 0 ? Array.from(r.values()).map(({ instance: a }) => a) : Ht(e, t, r, o);
|
|
2986
3071
|
},
|
|
2987
3072
|
async destroy() {
|
|
2988
3073
|
i?.();
|
|
@@ -2992,13 +3077,13 @@ async function ea(e) {
|
|
|
2992
3077
|
}
|
|
2993
3078
|
};
|
|
2994
3079
|
}
|
|
2995
|
-
const
|
|
2996
|
-
async function
|
|
3080
|
+
const gt = 2e3, ua = 5e3, ca = 5e3, da = 12e4;
|
|
3081
|
+
async function ht(e) {
|
|
2997
3082
|
await new Promise((t) => {
|
|
2998
3083
|
window.setTimeout(t, Math.max(e, 0));
|
|
2999
3084
|
});
|
|
3000
3085
|
}
|
|
3001
|
-
async function
|
|
3086
|
+
async function fa(e, {
|
|
3002
3087
|
timeoutMs: t = 5e3,
|
|
3003
3088
|
intervalMs: r = 30
|
|
3004
3089
|
} = {}) {
|
|
@@ -3007,11 +3092,11 @@ async function ia(e, {
|
|
|
3007
3092
|
const i = e();
|
|
3008
3093
|
if (i)
|
|
3009
3094
|
return i;
|
|
3010
|
-
await
|
|
3095
|
+
await ht(r);
|
|
3011
3096
|
}
|
|
3012
3097
|
throw new Error("Timed out waiting for async condition.");
|
|
3013
3098
|
}
|
|
3014
|
-
function
|
|
3099
|
+
function Tr(e, t) {
|
|
3015
3100
|
let r = null;
|
|
3016
3101
|
return (...n) => {
|
|
3017
3102
|
r !== null && window.clearTimeout(r), r = window.setTimeout(() => {
|
|
@@ -3019,14 +3104,14 @@ function vr(e, t) {
|
|
|
3019
3104
|
}, Math.max(t, 0));
|
|
3020
3105
|
};
|
|
3021
3106
|
}
|
|
3022
|
-
function
|
|
3107
|
+
function ma(e) {
|
|
3023
3108
|
const t = String(e || "asyncDefer").toLowerCase();
|
|
3024
3109
|
return {
|
|
3025
3110
|
async: t.includes("async"),
|
|
3026
3111
|
defer: t.includes("defer")
|
|
3027
3112
|
};
|
|
3028
3113
|
}
|
|
3029
|
-
function
|
|
3114
|
+
function Mr(e, t) {
|
|
3030
3115
|
const r = Array.from(e.querySelectorAll(`input[name="${t}"], textarea[name="${t}"]`));
|
|
3031
3116
|
for (const n of r) {
|
|
3032
3117
|
const i = String(n.value || "").trim();
|
|
@@ -3035,39 +3120,39 @@ function Er(e, t) {
|
|
|
3035
3120
|
}
|
|
3036
3121
|
return "";
|
|
3037
3122
|
}
|
|
3038
|
-
function
|
|
3039
|
-
return t.some((r) =>
|
|
3123
|
+
function Qe(e, t) {
|
|
3124
|
+
return t.some((r) => Mr(e, r) !== "");
|
|
3040
3125
|
}
|
|
3041
|
-
function
|
|
3126
|
+
function co(e, t) {
|
|
3042
3127
|
t.forEach((r) => {
|
|
3043
3128
|
Array.from(e.querySelectorAll(`input[name="${r}"], textarea[name="${r}"]`)).forEach((i) => {
|
|
3044
3129
|
i.value = "";
|
|
3045
3130
|
});
|
|
3046
3131
|
});
|
|
3047
3132
|
}
|
|
3048
|
-
function
|
|
3133
|
+
function Cr(e, t, {
|
|
3049
3134
|
value: r = "",
|
|
3050
3135
|
container: n
|
|
3051
3136
|
} = {}) {
|
|
3052
3137
|
let i = e.querySelector(`input[name="${t}"]`);
|
|
3053
3138
|
return i || (i = document.createElement("input"), i.type = "hidden", i.name = t, (n || (e instanceof HTMLElement ? e : null))?.appendChild(i)), i.value = r, i;
|
|
3054
3139
|
}
|
|
3055
|
-
async function
|
|
3056
|
-
if (
|
|
3140
|
+
async function Lr(e, t, r) {
|
|
3141
|
+
if (Qe(e, t))
|
|
3057
3142
|
return !0;
|
|
3058
3143
|
const n = Date.now() + Math.max(r, 0);
|
|
3059
3144
|
for (; Date.now() < n; )
|
|
3060
|
-
if (await
|
|
3145
|
+
if (await ht(120), Qe(e, t))
|
|
3061
3146
|
return !0;
|
|
3062
3147
|
return !1;
|
|
3063
3148
|
}
|
|
3064
|
-
const
|
|
3149
|
+
const fo = /* @__PURE__ */ new Set([
|
|
3065
3150
|
"handle",
|
|
3066
3151
|
"placeholderSelector",
|
|
3067
3152
|
"errorMessage",
|
|
3068
3153
|
"sessionKey",
|
|
3069
3154
|
"value"
|
|
3070
|
-
]),
|
|
3155
|
+
]), mo = "[data-formie-captcha-error-container]", po = [
|
|
3071
3156
|
"formie:page:navigate",
|
|
3072
3157
|
"formie:page:navigate:after",
|
|
3073
3158
|
"formie:submit:result"
|
|
@@ -3077,55 +3162,55 @@ function se(e, t, r) {
|
|
|
3077
3162
|
e.removeEventListener(t, r);
|
|
3078
3163
|
};
|
|
3079
3164
|
}
|
|
3080
|
-
function
|
|
3165
|
+
function Ie(e, t) {
|
|
3081
3166
|
return e instanceof HTMLElement && e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
|
|
3082
3167
|
}
|
|
3083
|
-
function
|
|
3168
|
+
function Xe(e) {
|
|
3084
3169
|
if (!(e instanceof HTMLElement) || !e.isConnected || e.hidden || e.closest("[hidden]") || e.closest("[data-formie-page-hidden]") || e.closest('[aria-hidden="true"]'))
|
|
3085
3170
|
return !1;
|
|
3086
3171
|
const t = window.getComputedStyle(e);
|
|
3087
3172
|
return t.display !== "none" && t.visibility !== "hidden";
|
|
3088
3173
|
}
|
|
3089
|
-
function
|
|
3090
|
-
const r =
|
|
3091
|
-
return r.find((n) =>
|
|
3174
|
+
function Ne(e, t) {
|
|
3175
|
+
const r = Ie(e, t);
|
|
3176
|
+
return r.find((n) => Xe(n)) || r[0] || null;
|
|
3092
3177
|
}
|
|
3093
|
-
function
|
|
3178
|
+
function go(e) {
|
|
3094
3179
|
e.innerHTML = "";
|
|
3095
3180
|
const t = document.createElement("div");
|
|
3096
3181
|
return e.appendChild(t), t;
|
|
3097
3182
|
}
|
|
3098
|
-
function
|
|
3099
|
-
e?.querySelector(
|
|
3183
|
+
function et(e) {
|
|
3184
|
+
e?.querySelector(mo)?.remove();
|
|
3100
3185
|
}
|
|
3101
|
-
function
|
|
3186
|
+
function ho(e, t, r) {
|
|
3102
3187
|
if (!e)
|
|
3103
3188
|
return;
|
|
3104
|
-
|
|
3189
|
+
et(e);
|
|
3105
3190
|
const n = document.createElement("div");
|
|
3106
|
-
n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"),
|
|
3191
|
+
n.setAttribute("data-formie-captcha-error-container", ""), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), $(n, r || e, "fieldErrors");
|
|
3107
3192
|
const i = document.createElement("div");
|
|
3108
|
-
i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"),
|
|
3193
|
+
i.setAttribute("data-formie-captcha-error", ""), i.setAttribute("role", "alert"), $(i, r || e, "fieldError"), i.textContent = t, n.appendChild(i), e.appendChild(n);
|
|
3109
3194
|
}
|
|
3110
|
-
function
|
|
3195
|
+
function bo(e) {
|
|
3111
3196
|
const t = e instanceof CustomEvent ? e.detail : null;
|
|
3112
3197
|
return !t || typeof t != "object" ? null : t;
|
|
3113
3198
|
}
|
|
3114
|
-
function
|
|
3199
|
+
function yo(e, t) {
|
|
3115
3200
|
if (!e?.captchas || typeof e.captchas != "object")
|
|
3116
3201
|
return null;
|
|
3117
3202
|
const r = e.captchas[t];
|
|
3118
3203
|
return !r || typeof r != "object" ? null : r;
|
|
3119
3204
|
}
|
|
3120
|
-
function
|
|
3205
|
+
function vo(e, t, r, n) {
|
|
3121
3206
|
const i = /* @__PURE__ */ new Set(), o = () => {
|
|
3122
|
-
const d =
|
|
3123
|
-
d.forEach((
|
|
3124
|
-
p.has(
|
|
3125
|
-
}), Array.from(i).forEach((
|
|
3126
|
-
p.has(
|
|
3207
|
+
const d = Ie(e, t), p = new Set(d.filter((h) => Xe(h)));
|
|
3208
|
+
d.forEach((h) => {
|
|
3209
|
+
p.has(h) && !i.has(h) && (i.add(h), r(h));
|
|
3210
|
+
}), Array.from(i).forEach((h) => {
|
|
3211
|
+
p.has(h) || (i.delete(h), n(h));
|
|
3127
3212
|
});
|
|
3128
|
-
}, a =
|
|
3213
|
+
}, a = Tr(o, 20), s = new MutationObserver(() => {
|
|
3129
3214
|
a();
|
|
3130
3215
|
});
|
|
3131
3216
|
s.observe(e, {
|
|
@@ -3138,7 +3223,7 @@ function co(e, t, r, n) {
|
|
|
3138
3223
|
se(window, "resize", () => {
|
|
3139
3224
|
a();
|
|
3140
3225
|
}),
|
|
3141
|
-
...
|
|
3226
|
+
...po.map((d) => se(e, d, () => {
|
|
3142
3227
|
a();
|
|
3143
3228
|
}))
|
|
3144
3229
|
];
|
|
@@ -3151,20 +3236,20 @@ function co(e, t, r, n) {
|
|
|
3151
3236
|
}), i.clear();
|
|
3152
3237
|
},
|
|
3153
3238
|
reconcile: a,
|
|
3154
|
-
getVisible: () =>
|
|
3239
|
+
getVisible: () => Ie(e, t).filter((d) => Xe(d))
|
|
3155
3240
|
};
|
|
3156
3241
|
}
|
|
3157
|
-
function
|
|
3242
|
+
function Eo(e, t) {
|
|
3158
3243
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
3159
3244
|
}
|
|
3160
|
-
function
|
|
3245
|
+
function So(e, t, {
|
|
3161
3246
|
defaultPlaceholderSelector: r,
|
|
3162
3247
|
defaultTokenFieldNames: n = [],
|
|
3163
|
-
defaultWaitForValueMs: i =
|
|
3248
|
+
defaultWaitForValueMs: i = gt
|
|
3164
3249
|
}) {
|
|
3165
|
-
const o = t || {}, a = Object.entries(o).reduce((
|
|
3250
|
+
const o = t || {}, a = Object.entries(o).reduce((c, [b, A]) => (fo.has(b) || (c[b] = A), c), {}), s = n.map(String).filter(Boolean), l = Number(i), d = typeof o.placeholderSelector == "string" && o.placeholderSelector.trim() !== "" ? o.placeholderSelector.trim() : r, p = typeof o.errorMessage == "string" && o.errorMessage.trim() !== "" ? o.errorMessage.trim() : x("Captcha challenge must be completed."), h = typeof o.sessionKey == "string" && o.sessionKey.trim() !== "" ? o.sessionKey.trim() : null, u = typeof o.value == "string" ? o.value : null;
|
|
3166
3251
|
return {
|
|
3167
|
-
handle:
|
|
3252
|
+
handle: Eo(e, o),
|
|
3168
3253
|
ui: {
|
|
3169
3254
|
placeholderSelector: d,
|
|
3170
3255
|
errorMessage: p
|
|
@@ -3172,61 +3257,61 @@ function mo(e, t, {
|
|
|
3172
3257
|
transport: {
|
|
3173
3258
|
tokenFieldNames: s,
|
|
3174
3259
|
waitForValueMs: Number.isFinite(l) ? l : i,
|
|
3175
|
-
sessionKey:
|
|
3176
|
-
value:
|
|
3260
|
+
sessionKey: h,
|
|
3261
|
+
value: u
|
|
3177
3262
|
},
|
|
3178
3263
|
provider: a
|
|
3179
3264
|
};
|
|
3180
3265
|
}
|
|
3181
|
-
function
|
|
3266
|
+
function Ao(e, t) {
|
|
3182
3267
|
const r = e.form || e.root, n = t.ui.placeholderSelector, i = t.handle;
|
|
3183
3268
|
return {
|
|
3184
3269
|
form: e.form,
|
|
3185
3270
|
root: e.root,
|
|
3186
3271
|
placeholder: {
|
|
3187
|
-
query: () =>
|
|
3188
|
-
getPrimary: () =>
|
|
3189
|
-
observe: (o, a) =>
|
|
3190
|
-
createContainer: (o) =>
|
|
3272
|
+
query: () => Ie(e.root, n),
|
|
3273
|
+
getPrimary: () => Ne(e.root, n),
|
|
3274
|
+
observe: (o, a) => vo(e.root, n, o, a),
|
|
3275
|
+
createContainer: (o) => go(o),
|
|
3191
3276
|
clear: (o) => {
|
|
3192
|
-
o && (
|
|
3277
|
+
o && (et(o), o.innerHTML = "");
|
|
3193
3278
|
}
|
|
3194
3279
|
},
|
|
3195
3280
|
errors: {
|
|
3196
3281
|
getDefaultMessage: () => t.ui.errorMessage,
|
|
3197
3282
|
show: (o, a) => {
|
|
3198
|
-
|
|
3283
|
+
ho(a || Ne(e.root, n), o || t.ui.errorMessage, e.form || e.root);
|
|
3199
3284
|
},
|
|
3200
3285
|
clear: (o) => {
|
|
3201
|
-
|
|
3286
|
+
et(o || Ne(e.root, n));
|
|
3202
3287
|
}
|
|
3203
3288
|
},
|
|
3204
3289
|
tokens: {
|
|
3205
3290
|
names: t.transport.tokenFieldNames,
|
|
3206
|
-
has: (o = t.transport.tokenFieldNames, a = r) =>
|
|
3207
|
-
read: (o = t.transport.tokenFieldNames[0], a = r) => o ?
|
|
3291
|
+
has: (o = t.transport.tokenFieldNames, a = r) => Qe(a, o),
|
|
3292
|
+
read: (o = t.transport.tokenFieldNames[0], a = r) => o ? Mr(a, o) : "",
|
|
3208
3293
|
write: (o, {
|
|
3209
3294
|
names: a = t.transport.tokenFieldNames,
|
|
3210
3295
|
root: s = r,
|
|
3211
3296
|
container: l = e.form
|
|
3212
3297
|
} = {}) => {
|
|
3213
3298
|
a.forEach((d) => {
|
|
3214
|
-
|
|
3299
|
+
Cr(s, d, {
|
|
3215
3300
|
value: o,
|
|
3216
3301
|
container: l
|
|
3217
3302
|
});
|
|
3218
3303
|
});
|
|
3219
3304
|
},
|
|
3220
3305
|
clear: (o = t.transport.tokenFieldNames, a = r) => {
|
|
3221
|
-
|
|
3306
|
+
co(a, o);
|
|
3222
3307
|
},
|
|
3223
|
-
wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) =>
|
|
3308
|
+
wait: (o = t.transport.waitForValueMs, a = t.transport.tokenFieldNames, s = r) => Lr(s, a, o)
|
|
3224
3309
|
},
|
|
3225
3310
|
refresh: {
|
|
3226
3311
|
providerHandle: i,
|
|
3227
3312
|
onTokensRefreshed: (o) => {
|
|
3228
3313
|
const a = ["formie:refresh-tokens:after", "formie:refresh-tokens:refreshed"].map((s) => se(e.root, s, (l) => {
|
|
3229
|
-
const d =
|
|
3314
|
+
const d = bo(l), p = yo(d, i);
|
|
3230
3315
|
p && o(p);
|
|
3231
3316
|
}));
|
|
3232
3317
|
return () => {
|
|
@@ -3244,11 +3329,11 @@ function po(e, t) {
|
|
|
3244
3329
|
};
|
|
3245
3330
|
}
|
|
3246
3331
|
const G = _("captchas");
|
|
3247
|
-
function
|
|
3332
|
+
function Ir({
|
|
3248
3333
|
id: e,
|
|
3249
3334
|
defaultPlaceholderSelector: t,
|
|
3250
3335
|
defaultTokenFieldNames: r = [],
|
|
3251
|
-
defaultWaitForValueMs: n =
|
|
3336
|
+
defaultWaitForValueMs: n = gt,
|
|
3252
3337
|
setup: i
|
|
3253
3338
|
}) {
|
|
3254
3339
|
return {
|
|
@@ -3256,7 +3341,7 @@ function wr({
|
|
|
3256
3341
|
kind: "captcha",
|
|
3257
3342
|
match: () => !0,
|
|
3258
3343
|
setup: async (o) => {
|
|
3259
|
-
const a =
|
|
3344
|
+
const a = So(e, o.options || {}, {
|
|
3260
3345
|
defaultPlaceholderSelector: t,
|
|
3261
3346
|
defaultTokenFieldNames: r,
|
|
3262
3347
|
defaultWaitForValueMs: n
|
|
@@ -3266,7 +3351,7 @@ function wr({
|
|
|
3266
3351
|
placeholderSelector: a.ui.placeholderSelector,
|
|
3267
3352
|
tokenFieldNames: a.transport.tokenFieldNames
|
|
3268
3353
|
});
|
|
3269
|
-
const s =
|
|
3354
|
+
const s = Ao(o, a);
|
|
3270
3355
|
return i({
|
|
3271
3356
|
...o,
|
|
3272
3357
|
options: a,
|
|
@@ -3275,13 +3360,13 @@ function wr({
|
|
|
3275
3360
|
}
|
|
3276
3361
|
};
|
|
3277
3362
|
}
|
|
3278
|
-
function
|
|
3363
|
+
function wo({
|
|
3279
3364
|
id: e,
|
|
3280
3365
|
defaultPlaceholderSelector: t,
|
|
3281
3366
|
defaultTokenFieldNames: r = [],
|
|
3282
|
-
defaultWaitForValueMs: n =
|
|
3367
|
+
defaultWaitForValueMs: n = gt
|
|
3283
3368
|
}) {
|
|
3284
|
-
return
|
|
3369
|
+
return Ir({
|
|
3285
3370
|
id: e,
|
|
3286
3371
|
defaultPlaceholderSelector: t,
|
|
3287
3372
|
defaultTokenFieldNames: r,
|
|
@@ -3289,51 +3374,51 @@ function go({
|
|
|
3289
3374
|
setup: async ({ services: i, options: o, root: a }) => {
|
|
3290
3375
|
const s = [];
|
|
3291
3376
|
let l = i.placeholder.getPrimary(), d = o.transport.sessionKey, p = o.transport.value || "";
|
|
3292
|
-
const
|
|
3293
|
-
!
|
|
3377
|
+
const h = (c) => {
|
|
3378
|
+
!c || !d || (c.innerHTML = "", Cr(c, d, {
|
|
3294
3379
|
value: p,
|
|
3295
|
-
container:
|
|
3380
|
+
container: c
|
|
3296
3381
|
}));
|
|
3297
|
-
},
|
|
3298
|
-
(
|
|
3299
|
-
l =
|
|
3382
|
+
}, u = i.placeholder.observe(
|
|
3383
|
+
(c) => {
|
|
3384
|
+
l = c, G.log("Passive placeholder visible.", {
|
|
3300
3385
|
moduleId: e
|
|
3301
|
-
}),
|
|
3386
|
+
}), h(c);
|
|
3302
3387
|
},
|
|
3303
|
-
(
|
|
3304
|
-
l ===
|
|
3388
|
+
(c) => {
|
|
3389
|
+
l === c && (l = i.placeholder.getPrimary()), c.innerHTML = "";
|
|
3305
3390
|
}
|
|
3306
3391
|
);
|
|
3307
|
-
return s.push(
|
|
3308
|
-
d = typeof
|
|
3309
|
-
const
|
|
3310
|
-
l =
|
|
3392
|
+
return s.push(u.cleanup), h(l), s.push(i.refresh.onTokensRefreshed((c) => {
|
|
3393
|
+
d = typeof c.sessionKey == "string" && c.sessionKey.trim() !== "" ? c.sessionKey.trim() : d, p = typeof c.value == "string" ? c.value : "";
|
|
3394
|
+
const b = i.placeholder.getPrimary() || l;
|
|
3395
|
+
l = b, h(b);
|
|
3311
3396
|
})), {
|
|
3312
3397
|
destroy: () => {
|
|
3313
|
-
s.forEach((
|
|
3314
|
-
|
|
3398
|
+
s.forEach((c) => {
|
|
3399
|
+
c();
|
|
3315
3400
|
});
|
|
3316
3401
|
},
|
|
3317
|
-
onBeforeStage: async (
|
|
3318
|
-
if (
|
|
3402
|
+
onBeforeStage: async (c) => {
|
|
3403
|
+
if (c.stage !== "screen" || c.action !== "submit")
|
|
3319
3404
|
return;
|
|
3320
|
-
const
|
|
3321
|
-
if (
|
|
3405
|
+
const b = d ? [d] : o.transport.tokenFieldNames;
|
|
3406
|
+
if (b.length === 0)
|
|
3322
3407
|
return;
|
|
3323
|
-
if (!await
|
|
3408
|
+
if (!await Lr(a, b, o.transport.waitForValueMs)) {
|
|
3324
3409
|
const f = i.errors.getDefaultMessage();
|
|
3325
3410
|
i.errors.show(f, l), G.warn("Passive captcha missing token.", {
|
|
3326
3411
|
moduleId: e,
|
|
3327
|
-
tokenFieldNames:
|
|
3328
|
-
}),
|
|
3412
|
+
tokenFieldNames: b
|
|
3413
|
+
}), c.abort(f);
|
|
3329
3414
|
}
|
|
3330
3415
|
}
|
|
3331
3416
|
};
|
|
3332
3417
|
}
|
|
3333
3418
|
});
|
|
3334
3419
|
}
|
|
3335
|
-
function
|
|
3336
|
-
return
|
|
3420
|
+
function To(e) {
|
|
3421
|
+
return Ir({
|
|
3337
3422
|
id: e.id,
|
|
3338
3423
|
defaultPlaceholderSelector: e.defaultPlaceholderSelector,
|
|
3339
3424
|
defaultTokenFieldNames: e.defaultTokenFieldNames,
|
|
@@ -3342,56 +3427,56 @@ function ho(e) {
|
|
|
3342
3427
|
let o = t.services.placeholder.getPrimary(), a = !1, s = null;
|
|
3343
3428
|
const l = async () => (s || (G.log("Loading captcha provider API.", {
|
|
3344
3429
|
moduleId: e.id
|
|
3345
|
-
}), s = e.load(t)), s), d = async (
|
|
3346
|
-
const
|
|
3347
|
-
if (t.services.errors.clear(
|
|
3348
|
-
|
|
3430
|
+
}), s = e.load(t)), s), d = async (c) => {
|
|
3431
|
+
const b = n.get(c);
|
|
3432
|
+
if (t.services.errors.clear(c), !b) {
|
|
3433
|
+
c.innerHTML = "";
|
|
3349
3434
|
return;
|
|
3350
3435
|
}
|
|
3351
3436
|
const A = await l();
|
|
3352
3437
|
e.unmount && await e.unmount({
|
|
3353
3438
|
api: A,
|
|
3354
|
-
widget:
|
|
3355
|
-
placeholder:
|
|
3439
|
+
widget: b,
|
|
3440
|
+
placeholder: c,
|
|
3356
3441
|
services: t.services,
|
|
3357
3442
|
options: t.options,
|
|
3358
3443
|
provider: t.options.provider
|
|
3359
|
-
}), n.delete(
|
|
3444
|
+
}), n.delete(c), c.innerHTML = "", t.services.tokens.clear(), G.log("Unmounted captcha placeholder widget.", {
|
|
3360
3445
|
moduleId: e.id
|
|
3361
|
-
}), o ===
|
|
3362
|
-
}, p = async (
|
|
3363
|
-
if (a || n.has(
|
|
3446
|
+
}), o === c && (o = t.services.placeholder.getPrimary());
|
|
3447
|
+
}, p = async (c) => {
|
|
3448
|
+
if (a || n.has(c) || i.has(c))
|
|
3364
3449
|
return;
|
|
3365
|
-
const
|
|
3450
|
+
const b = (async () => {
|
|
3366
3451
|
const A = await l();
|
|
3367
|
-
if (a || n.has(
|
|
3452
|
+
if (a || n.has(c))
|
|
3368
3453
|
return;
|
|
3369
|
-
const f = t.services.placeholder.createContainer(
|
|
3454
|
+
const f = t.services.placeholder.createContainer(c), v = await e.mount({
|
|
3370
3455
|
api: A,
|
|
3371
|
-
placeholder:
|
|
3456
|
+
placeholder: c,
|
|
3372
3457
|
container: f,
|
|
3373
3458
|
services: t.services,
|
|
3374
3459
|
options: t.options,
|
|
3375
3460
|
provider: t.options.provider
|
|
3376
3461
|
});
|
|
3377
|
-
n.set(
|
|
3462
|
+
n.set(c, v), o = c, G.log("Mounted captcha placeholder widget.", {
|
|
3378
3463
|
moduleId: e.id
|
|
3379
3464
|
});
|
|
3380
3465
|
})().finally(() => {
|
|
3381
|
-
i.delete(
|
|
3466
|
+
i.delete(c);
|
|
3382
3467
|
});
|
|
3383
|
-
i.set(
|
|
3384
|
-
},
|
|
3385
|
-
(
|
|
3386
|
-
o =
|
|
3468
|
+
i.set(c, b), await b;
|
|
3469
|
+
}, h = t.services.placeholder.observe(
|
|
3470
|
+
(c) => {
|
|
3471
|
+
o = c, p(c);
|
|
3387
3472
|
},
|
|
3388
|
-
(
|
|
3389
|
-
d(
|
|
3473
|
+
(c) => {
|
|
3474
|
+
d(c);
|
|
3390
3475
|
}
|
|
3391
3476
|
);
|
|
3392
|
-
r.push(
|
|
3393
|
-
const
|
|
3394
|
-
const A =
|
|
3477
|
+
r.push(h.cleanup);
|
|
3478
|
+
const u = async (c) => {
|
|
3479
|
+
const A = h.getVisible();
|
|
3395
3480
|
if (e.reset) {
|
|
3396
3481
|
const f = await l();
|
|
3397
3482
|
for (const v of A) {
|
|
@@ -3407,47 +3492,47 @@ function ho(e) {
|
|
|
3407
3492
|
services: t.services,
|
|
3408
3493
|
options: t.options,
|
|
3409
3494
|
provider: t.options.provider,
|
|
3410
|
-
reason:
|
|
3495
|
+
reason: c
|
|
3411
3496
|
}), t.services.tokens.clear(), t.services.errors.clear(v);
|
|
3412
3497
|
}
|
|
3413
|
-
|
|
3498
|
+
h.reconcile();
|
|
3414
3499
|
return;
|
|
3415
3500
|
}
|
|
3416
3501
|
for (const f of Array.from(n.keys()))
|
|
3417
3502
|
await d(f);
|
|
3418
3503
|
for (const f of A)
|
|
3419
3504
|
await p(f);
|
|
3420
|
-
|
|
3505
|
+
h.reconcile();
|
|
3421
3506
|
};
|
|
3422
|
-
return r.push(t.services.events.onRoot("formie:submit:result", (
|
|
3423
|
-
const
|
|
3424
|
-
|
|
3425
|
-
})), t.form && r.push(t.services.events.onForm(
|
|
3507
|
+
return r.push(t.services.events.onRoot("formie:submit:result", (c) => {
|
|
3508
|
+
const b = c instanceof CustomEvent ? c.detail : null;
|
|
3509
|
+
b?.stage !== "validate" && (b?.ok === !1 && b?.stage === "screen" || b?.ok !== !0 && u("submit-result"));
|
|
3510
|
+
})), t.form && r.push(t.services.events.onForm(Be("reset"), () => {
|
|
3426
3511
|
o = t.services.placeholder.getPrimary() || o, window.setTimeout(() => {
|
|
3427
|
-
|
|
3512
|
+
u("reset-state");
|
|
3428
3513
|
}, 0);
|
|
3429
3514
|
})), {
|
|
3430
3515
|
destroy: async () => {
|
|
3431
|
-
a = !0, r.forEach((
|
|
3432
|
-
|
|
3516
|
+
a = !0, r.forEach((c) => {
|
|
3517
|
+
c();
|
|
3433
3518
|
});
|
|
3434
|
-
for (const
|
|
3435
|
-
await d(
|
|
3519
|
+
for (const c of Array.from(n.keys()))
|
|
3520
|
+
await d(c);
|
|
3436
3521
|
},
|
|
3437
|
-
onBeforeStage: async (
|
|
3438
|
-
if (
|
|
3522
|
+
onBeforeStage: async (c) => {
|
|
3523
|
+
if (c.stage !== "screen" || c.action !== "submit")
|
|
3439
3524
|
return;
|
|
3440
|
-
const
|
|
3441
|
-
if (
|
|
3525
|
+
const b = h.getVisible();
|
|
3526
|
+
if (b.length === 0)
|
|
3442
3527
|
return;
|
|
3443
|
-
let A =
|
|
3528
|
+
let A = b.find((E) => E === o) || b[0];
|
|
3444
3529
|
await p(A), A = o || A, t.services.errors.clear(A);
|
|
3445
3530
|
const f = n.get(A);
|
|
3446
3531
|
if (!f) {
|
|
3447
3532
|
const E = t.services.errors.getDefaultMessage();
|
|
3448
3533
|
t.services.errors.show(E, A), G.warn("Captcha widget unavailable at screen stage.", {
|
|
3449
3534
|
moduleId: e.id
|
|
3450
|
-
}),
|
|
3535
|
+
}), c.abort(E);
|
|
3451
3536
|
return;
|
|
3452
3537
|
}
|
|
3453
3538
|
const v = await l();
|
|
@@ -3458,14 +3543,14 @@ function ho(e) {
|
|
|
3458
3543
|
services: t.services,
|
|
3459
3544
|
options: t.options,
|
|
3460
3545
|
provider: t.options.provider,
|
|
3461
|
-
stageCtx:
|
|
3546
|
+
stageCtx: c
|
|
3462
3547
|
});
|
|
3463
3548
|
}
|
|
3464
3549
|
};
|
|
3465
3550
|
}
|
|
3466
3551
|
});
|
|
3467
3552
|
}
|
|
3468
|
-
const
|
|
3553
|
+
const pa = To, ga = wo, Ot = 2500, Mo = {
|
|
3469
3554
|
bpoint: ["bpointToken"],
|
|
3470
3555
|
stripe: ["stripePaymentIntentId"],
|
|
3471
3556
|
paypal: ["paypalOrderId", "paypalAuthId"],
|
|
@@ -3478,18 +3563,18 @@ const aa = ho, sa = go, $t = 2500, bo = {
|
|
|
3478
3563
|
paddle: ["paddleTransactionId"],
|
|
3479
3564
|
square: ["squarePaymentId"]
|
|
3480
3565
|
};
|
|
3481
|
-
function
|
|
3566
|
+
function Co(e) {
|
|
3482
3567
|
return e.replace("{field:", "").replace("{", "").replace("}", "").replace("]", "").split("[").join("][");
|
|
3483
3568
|
}
|
|
3484
|
-
function
|
|
3485
|
-
return `fields[${
|
|
3569
|
+
function Lo(e) {
|
|
3570
|
+
return `fields[${Co(e)}]`;
|
|
3486
3571
|
}
|
|
3487
|
-
function
|
|
3488
|
-
const r =
|
|
3572
|
+
function Io(e, t) {
|
|
3573
|
+
const r = Lo(t), n = Array.from(e.querySelectorAll(`[name="${r}"]`)), i = Array.from(e.querySelectorAll(`[name="${r}[]"]`));
|
|
3489
3574
|
return (i.length ? i : n).filter((o) => o instanceof HTMLElement);
|
|
3490
3575
|
}
|
|
3491
|
-
function
|
|
3492
|
-
const r =
|
|
3576
|
+
function _t(e, t) {
|
|
3577
|
+
const r = Io(e, t);
|
|
3493
3578
|
for (const n of r) {
|
|
3494
3579
|
const o = n.closest("[data-formie-field-handle]")?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim();
|
|
3495
3580
|
if (o)
|
|
@@ -3497,32 +3582,32 @@ function Vt(e, t) {
|
|
|
3497
3582
|
}
|
|
3498
3583
|
return "";
|
|
3499
3584
|
}
|
|
3500
|
-
function
|
|
3585
|
+
function Ue(e) {
|
|
3501
3586
|
let t = e.replace(/[^\d.,-]/g, "");
|
|
3502
3587
|
const r = t.includes(","), n = t.includes(".");
|
|
3503
3588
|
return r && n ? t = t.replace(/\./g, "").replace(/,/, ".") : r && !n ? t = t.replace(/,/, ".") : t = t.replace(/,/g, ""), parseFloat(t);
|
|
3504
3589
|
}
|
|
3505
|
-
function
|
|
3590
|
+
function Fo(e) {
|
|
3506
3591
|
return e.replace(/^\{field:/, "").replace(/^\{/, "").replace(/\}$/, "").trim();
|
|
3507
3592
|
}
|
|
3508
3593
|
function de(e) {
|
|
3509
|
-
return
|
|
3594
|
+
return Fo(e).replace(/\]/g, "").split("[").join(".").replace(/\.+/g, ".").replace(/^\./, "").replace(/\.$/, "");
|
|
3510
3595
|
}
|
|
3511
|
-
function
|
|
3596
|
+
function Fr(e) {
|
|
3512
3597
|
const r = de(e).split(".").filter(Boolean);
|
|
3513
3598
|
if (!r.length)
|
|
3514
3599
|
return "";
|
|
3515
3600
|
const [n, ...i] = r;
|
|
3516
3601
|
return `fields[${n}]${i.map((o) => `[${o}]`).join("")}`;
|
|
3517
3602
|
}
|
|
3518
|
-
function
|
|
3603
|
+
function Ro(e) {
|
|
3519
3604
|
const r = String(e || "").trim().match(/^fields\[([^\]]+)\](.*)$/);
|
|
3520
3605
|
if (!r)
|
|
3521
3606
|
return "";
|
|
3522
3607
|
const n = r[1] || "", i = r[2] || "", o = Array.from(i.matchAll(/\[([^\]]+)\]/g)).map((a) => a[1] || "").filter(Boolean);
|
|
3523
3608
|
return [n, ...o].join(".");
|
|
3524
3609
|
}
|
|
3525
|
-
function
|
|
3610
|
+
function ko(e) {
|
|
3526
3611
|
const t = e.split(";").map((a) => a.trim()).filter(Boolean);
|
|
3527
3612
|
if (!t.length)
|
|
3528
3613
|
return {
|
|
@@ -3548,7 +3633,7 @@ function wo(e) {
|
|
|
3548
3633
|
transforms: i
|
|
3549
3634
|
};
|
|
3550
3635
|
}
|
|
3551
|
-
function
|
|
3636
|
+
function Rr(e) {
|
|
3552
3637
|
const t = String(e || "").trim();
|
|
3553
3638
|
if (!t)
|
|
3554
3639
|
return {
|
|
@@ -3573,7 +3658,7 @@ function Cr(e) {
|
|
|
3573
3658
|
isToken: !1,
|
|
3574
3659
|
isValid: !0
|
|
3575
3660
|
};
|
|
3576
|
-
const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } =
|
|
3661
|
+
const n = (r[1] || "").trim().toLowerCase(), i = (r[2] || "").trim(), [o, a = ""] = i.split("|", 2), { source: s, transforms: l } = ko(o || "");
|
|
3577
3662
|
if (n !== "field")
|
|
3578
3663
|
return {
|
|
3579
3664
|
raw: t,
|
|
@@ -3585,22 +3670,22 @@ function Cr(e) {
|
|
|
3585
3670
|
isToken: !0,
|
|
3586
3671
|
isValid: !1
|
|
3587
3672
|
};
|
|
3588
|
-
const d = s.indexOf(":"), p = d === -1 ? s : s.slice(0, d),
|
|
3673
|
+
const d = s.indexOf(":"), p = d === -1 ? s : s.slice(0, d), h = d === -1 ? "" : s.slice(d + 1), u = de(p);
|
|
3589
3674
|
return {
|
|
3590
3675
|
raw: t,
|
|
3591
3676
|
target: "field",
|
|
3592
|
-
key:
|
|
3593
|
-
selector:
|
|
3677
|
+
key: u,
|
|
3678
|
+
selector: h.trim(),
|
|
3594
3679
|
defaultValue: a.trim(),
|
|
3595
3680
|
transforms: l,
|
|
3596
3681
|
isToken: !0,
|
|
3597
|
-
isValid:
|
|
3682
|
+
isValid: u !== ""
|
|
3598
3683
|
};
|
|
3599
3684
|
}
|
|
3600
|
-
function
|
|
3685
|
+
function qo(e) {
|
|
3601
3686
|
return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
|
|
3602
3687
|
}
|
|
3603
|
-
function
|
|
3688
|
+
function Po(e, t, r) {
|
|
3604
3689
|
const n = t.trim(), i = String(r.name || "").trim();
|
|
3605
3690
|
if (!n || !i)
|
|
3606
3691
|
return;
|
|
@@ -3611,14 +3696,14 @@ function Co(e, t, r) {
|
|
|
3611
3696
|
};
|
|
3612
3697
|
o.names.includes(i) || o.names.push(i), o.inputs.includes(r) || o.inputs.push(r), e.set(n, o);
|
|
3613
3698
|
}
|
|
3614
|
-
function
|
|
3699
|
+
function Vo(e) {
|
|
3615
3700
|
const t = /* @__PURE__ */ new Map();
|
|
3616
|
-
return Array.from(e.querySelectorAll("[name]")).filter((n) =>
|
|
3617
|
-
const i =
|
|
3618
|
-
i &&
|
|
3701
|
+
return Array.from(e.querySelectorAll("[name]")).filter((n) => qo(n)).forEach((n) => {
|
|
3702
|
+
const i = Ro(n.name);
|
|
3703
|
+
i && Po(t, i, n);
|
|
3619
3704
|
}), t;
|
|
3620
3705
|
}
|
|
3621
|
-
function
|
|
3706
|
+
function $o(e) {
|
|
3622
3707
|
if (!e.length)
|
|
3623
3708
|
return "";
|
|
3624
3709
|
const t = e[0];
|
|
@@ -3630,33 +3715,33 @@ function Lo(e) {
|
|
|
3630
3715
|
}
|
|
3631
3716
|
return t.value;
|
|
3632
3717
|
}
|
|
3633
|
-
function
|
|
3718
|
+
function kr(e, t) {
|
|
3634
3719
|
return e.get(de(t)) || null;
|
|
3635
3720
|
}
|
|
3636
|
-
function
|
|
3637
|
-
const r =
|
|
3721
|
+
function Ho(e, t) {
|
|
3722
|
+
const r = Rr(e), n = r.key, i = kr(t, n);
|
|
3638
3723
|
if (!i)
|
|
3639
3724
|
return {
|
|
3640
3725
|
key: n,
|
|
3641
3726
|
value: r.defaultValue,
|
|
3642
3727
|
found: !1
|
|
3643
3728
|
};
|
|
3644
|
-
const o =
|
|
3729
|
+
const o = $o(i.inputs);
|
|
3645
3730
|
return {
|
|
3646
3731
|
key: n,
|
|
3647
3732
|
value: o === "" && r.defaultValue !== "" ? r.defaultValue : o,
|
|
3648
3733
|
found: !0
|
|
3649
3734
|
};
|
|
3650
3735
|
}
|
|
3651
|
-
function
|
|
3652
|
-
const n =
|
|
3736
|
+
function ha(e, t, r) {
|
|
3737
|
+
const n = Rr(e), i = n.key;
|
|
3653
3738
|
if (!i)
|
|
3654
3739
|
return {
|
|
3655
3740
|
key: i,
|
|
3656
3741
|
value: n.defaultValue,
|
|
3657
3742
|
found: !1
|
|
3658
3743
|
};
|
|
3659
|
-
const o = r ?
|
|
3744
|
+
const o = r ? kr(r, i) : null, s = (o?.names?.length ? o.names : [Fr(i)]).flatMap((l) => {
|
|
3660
3745
|
const d = t.getAll(l).map((p) => String(p ?? ""));
|
|
3661
3746
|
return d.length ? d : t.getAll(`${l}[]`).map((p) => String(p ?? ""));
|
|
3662
3747
|
}).filter((l) => l !== "");
|
|
@@ -3670,13 +3755,13 @@ function la(e, t, r) {
|
|
|
3670
3755
|
found: !1
|
|
3671
3756
|
};
|
|
3672
3757
|
}
|
|
3673
|
-
function
|
|
3758
|
+
function qr(e, t) {
|
|
3674
3759
|
const r = t.replace(/"/g, '\\"');
|
|
3675
3760
|
return e.querySelector(`input[name$="[${r}]"]`) || e.querySelector(`input[name$="${r}"]`);
|
|
3676
3761
|
}
|
|
3677
|
-
function
|
|
3762
|
+
function Ae(e, t) {
|
|
3678
3763
|
const r = t.find((n) => {
|
|
3679
|
-
const i =
|
|
3764
|
+
const i = qr(e, n);
|
|
3680
3765
|
return !i || String(i.value || "").trim() === "";
|
|
3681
3766
|
});
|
|
3682
3767
|
return {
|
|
@@ -3684,98 +3769,98 @@ function Se(e, t) {
|
|
|
3684
3769
|
missingSuffix: r
|
|
3685
3770
|
};
|
|
3686
3771
|
}
|
|
3687
|
-
async function
|
|
3688
|
-
const n =
|
|
3772
|
+
async function Pr(e, t, r) {
|
|
3773
|
+
const n = Ae(e, t);
|
|
3689
3774
|
if (n.ok)
|
|
3690
3775
|
return n;
|
|
3691
3776
|
const i = Date.now() + Math.max(r, 0);
|
|
3692
3777
|
for (; Date.now() < i; ) {
|
|
3693
|
-
await
|
|
3694
|
-
const o =
|
|
3778
|
+
await ht(120);
|
|
3779
|
+
const o = Ae(e, t);
|
|
3695
3780
|
if (o.ok)
|
|
3696
3781
|
return o;
|
|
3697
3782
|
}
|
|
3698
|
-
return
|
|
3783
|
+
return Ae(e, t);
|
|
3699
3784
|
}
|
|
3700
|
-
const
|
|
3785
|
+
const Oo = /* @__PURE__ */ new Set([
|
|
3701
3786
|
"handle",
|
|
3702
3787
|
"requiredInputSuffixes",
|
|
3703
3788
|
"waitForValueMs",
|
|
3704
3789
|
"errorMessage"
|
|
3705
|
-
]),
|
|
3706
|
-
function
|
|
3790
|
+
]), Dt = "[data-payment-success]", xt = "[data-payment-error]";
|
|
3791
|
+
function _o(e, t) {
|
|
3707
3792
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
3708
3793
|
}
|
|
3709
|
-
function
|
|
3710
|
-
const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (
|
|
3794
|
+
function Do(e, t, r) {
|
|
3795
|
+
const n = t || {}, i = Object.entries(n).reduce((l, [d, p]) => (Oo.has(d) || (l[d] = p), l), {}), o = Array.isArray(n.requiredInputSuffixes) ? n.requiredInputSuffixes.map(String).filter(Boolean) : r.defaultRequiredInputSuffixes || [], a = Number(n.waitForValueMs ?? r.defaultWaitForValueMs ?? Ot), s = typeof n.errorMessage == "string" && n.errorMessage.trim() !== "" ? n.errorMessage.trim() : "Payment authorization is incomplete.";
|
|
3711
3796
|
return {
|
|
3712
|
-
handle:
|
|
3797
|
+
handle: _o(e, n),
|
|
3713
3798
|
transport: {
|
|
3714
3799
|
requiredInputSuffixes: o,
|
|
3715
|
-
waitForValueMs: Number.isFinite(a) ? a :
|
|
3800
|
+
waitForValueMs: Number.isFinite(a) ? a : Ot,
|
|
3716
3801
|
errorMessage: s
|
|
3717
3802
|
},
|
|
3718
3803
|
provider: i
|
|
3719
3804
|
};
|
|
3720
3805
|
}
|
|
3721
|
-
function
|
|
3806
|
+
function Nt(e, t, r) {
|
|
3722
3807
|
return e.addEventListener(t, r), () => {
|
|
3723
3808
|
e.removeEventListener(t, r);
|
|
3724
3809
|
};
|
|
3725
3810
|
}
|
|
3726
|
-
function
|
|
3727
|
-
const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () =>
|
|
3728
|
-
const g =
|
|
3811
|
+
function xo(e, t) {
|
|
3812
|
+
const r = e.target, n = e.form, i = e.root, o = n || i, a = t.transport.requiredInputSuffixes, s = () => Vo(n || i), l = (y) => {
|
|
3813
|
+
const g = Ho(y, s()).value;
|
|
3729
3814
|
return Array.isArray(g) ? g[0] || "" : String(g || "");
|
|
3730
3815
|
};
|
|
3731
3816
|
return {
|
|
3732
3817
|
root: i,
|
|
3733
3818
|
form: n,
|
|
3734
3819
|
field: r,
|
|
3735
|
-
updateInputs: (
|
|
3736
|
-
const g = Array.isArray(
|
|
3820
|
+
updateInputs: (y, m) => {
|
|
3821
|
+
const g = Array.isArray(y) ? y : [y];
|
|
3737
3822
|
for (const S of g) {
|
|
3738
|
-
const
|
|
3739
|
-
|
|
3823
|
+
const M = qr(o, S) ?? r.querySelector(`input[name*="${S}"]`);
|
|
3824
|
+
M && (M.value = m);
|
|
3740
3825
|
}
|
|
3741
3826
|
},
|
|
3742
|
-
addError: (
|
|
3743
|
-
const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(
|
|
3827
|
+
addError: (y) => {
|
|
3828
|
+
const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(xt);
|
|
3744
3829
|
g && g.remove();
|
|
3745
3830
|
const S = document.createElement("div");
|
|
3746
|
-
S.setAttribute("data-payment-error", ""), S.textContent =
|
|
3831
|
+
S.setAttribute("data-payment-error", ""), S.textContent = y, $(S, n || i, "fieldError"), m.appendChild(S);
|
|
3747
3832
|
},
|
|
3748
3833
|
removeError: () => {
|
|
3749
|
-
r.querySelector(
|
|
3834
|
+
r.querySelector(xt)?.remove();
|
|
3750
3835
|
},
|
|
3751
|
-
addSuccess: (
|
|
3752
|
-
const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(
|
|
3836
|
+
addSuccess: (y) => {
|
|
3837
|
+
const m = r.querySelector("[data-formie-field-type] > div, [data-field-type] > div") || r, g = m.querySelector(Dt);
|
|
3753
3838
|
g && g.remove();
|
|
3754
3839
|
const S = document.createElement("div");
|
|
3755
|
-
S.setAttribute("data-payment-success", ""), S.textContent =
|
|
3840
|
+
S.setAttribute("data-payment-success", ""), S.textContent = y, $(S, n || i, "successMessage"), m.appendChild(S);
|
|
3756
3841
|
},
|
|
3757
3842
|
removeSuccess: () => {
|
|
3758
|
-
r.querySelector(
|
|
3843
|
+
r.querySelector(Dt)?.remove();
|
|
3759
3844
|
},
|
|
3760
|
-
hasToken: () =>
|
|
3761
|
-
waitForToken: (
|
|
3762
|
-
getFieldValue: (
|
|
3763
|
-
const g = l(
|
|
3764
|
-
return m === "float" || m === "int" || m === "number" ?
|
|
3845
|
+
hasToken: () => Ae(o, a).ok,
|
|
3846
|
+
waitForToken: (y = t.transport.waitForValueMs) => Pr(o, a, y).then((m) => m.ok),
|
|
3847
|
+
getFieldValue: (y, m = "string") => {
|
|
3848
|
+
const g = l(y);
|
|
3849
|
+
return m === "float" || m === "int" || m === "number" ? Ue(g) : g;
|
|
3765
3850
|
},
|
|
3766
|
-
resolveAmount: (
|
|
3767
|
-
const m = n || i, S = String(
|
|
3851
|
+
resolveAmount: (y) => {
|
|
3852
|
+
const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed), T = String(M ?? "").trim(), F = typeof M == "number" ? M : Ue(T);
|
|
3768
3853
|
if (Number.isFinite(F) && F > 0)
|
|
3769
3854
|
return { ok: !0, value: F };
|
|
3770
3855
|
if (T !== "") {
|
|
3771
|
-
const
|
|
3856
|
+
const q = l(T), w = Ue(q);
|
|
3772
3857
|
if (Number.isFinite(w) && w > 0)
|
|
3773
3858
|
return { ok: !0, value: w };
|
|
3774
|
-
const
|
|
3775
|
-
if (!
|
|
3859
|
+
const P = _t(m, T);
|
|
3860
|
+
if (!q)
|
|
3776
3861
|
return {
|
|
3777
3862
|
ok: !1,
|
|
3778
|
-
error:
|
|
3863
|
+
error: P ? x('Provide a value for "{label}" to proceed.', { label: P }) : x("Provide a payment amount to proceed.")
|
|
3779
3864
|
};
|
|
3780
3865
|
}
|
|
3781
3866
|
return {
|
|
@@ -3783,19 +3868,19 @@ function qo(e, t) {
|
|
|
3783
3868
|
error: x("Payment amount must be greater than 0.")
|
|
3784
3869
|
};
|
|
3785
3870
|
},
|
|
3786
|
-
resolveCurrency: (
|
|
3787
|
-
const m = n || i, S = String(
|
|
3871
|
+
resolveCurrency: (y) => {
|
|
3872
|
+
const m = n || i, S = String(y.type || "").toLowerCase() === "dynamic" && typeof y.variable == "string" && y.variable.trim() !== "", M = y.value ?? (S ? y.variable : y.fixed ?? y.defaultCurrency ?? ""), T = String(M ?? "").trim(), F = T.toUpperCase();
|
|
3788
3873
|
if (/^[A-Z]{3}$/.test(F) && !S)
|
|
3789
3874
|
return { ok: !0, value: F };
|
|
3790
3875
|
if (T !== "") {
|
|
3791
|
-
const
|
|
3876
|
+
const q = String(l(T) || "").trim(), w = q.toUpperCase();
|
|
3792
3877
|
if (/^[A-Z]{3}$/.test(w))
|
|
3793
3878
|
return { ok: !0, value: w };
|
|
3794
|
-
const
|
|
3795
|
-
if (!
|
|
3879
|
+
const P = _t(m, T);
|
|
3880
|
+
if (!q)
|
|
3796
3881
|
return {
|
|
3797
3882
|
ok: !1,
|
|
3798
|
-
error:
|
|
3883
|
+
error: P ? x('Provide a value for "{label}" to proceed.', { label: P }) : x("Provide a payment currency to proceed.")
|
|
3799
3884
|
};
|
|
3800
3885
|
}
|
|
3801
3886
|
return {
|
|
@@ -3803,28 +3888,28 @@ function qo(e, t) {
|
|
|
3803
3888
|
error: x("Payment currency must be a valid 3-letter code.")
|
|
3804
3889
|
};
|
|
3805
3890
|
},
|
|
3806
|
-
watchFieldValueChanges: (
|
|
3807
|
-
const S = n || i,
|
|
3808
|
-
if (
|
|
3891
|
+
watchFieldValueChanges: (y, m, g = 600) => {
|
|
3892
|
+
const S = n || i, M = y.map((P) => String(P || "").trim()).filter(Boolean);
|
|
3893
|
+
if (M.length === 0)
|
|
3809
3894
|
return () => {
|
|
3810
3895
|
};
|
|
3811
3896
|
const T = s(), F = /* @__PURE__ */ new Set();
|
|
3812
|
-
|
|
3813
|
-
const N = de(
|
|
3814
|
-
if (
|
|
3815
|
-
|
|
3897
|
+
M.forEach((P) => {
|
|
3898
|
+
const N = de(P), j = T.get(N);
|
|
3899
|
+
if (j?.names?.length) {
|
|
3900
|
+
j.names.forEach((fe) => {
|
|
3816
3901
|
F.add(fe);
|
|
3817
3902
|
});
|
|
3818
3903
|
return;
|
|
3819
3904
|
}
|
|
3820
|
-
const Y =
|
|
3905
|
+
const Y = Fr(N);
|
|
3821
3906
|
Y && (F.add(Y), F.add(`${Y}[]`));
|
|
3822
3907
|
});
|
|
3823
|
-
const
|
|
3908
|
+
const q = Tr(() => {
|
|
3824
3909
|
m();
|
|
3825
|
-
}, g), w = (
|
|
3826
|
-
const
|
|
3827
|
-
!
|
|
3910
|
+
}, g), w = (P) => {
|
|
3911
|
+
const j = P.target?.name || "";
|
|
3912
|
+
!j || !F.has(j) || q();
|
|
3828
3913
|
};
|
|
3829
3914
|
return S.addEventListener("input", w), S.addEventListener("change", w), () => {
|
|
3830
3915
|
S.removeEventListener("input", w), S.removeEventListener("change", w);
|
|
@@ -3834,40 +3919,40 @@ function qo(e, t) {
|
|
|
3834
3919
|
n && n.setAttribute("data-formie-internal-resubmit", "true"), n && typeof n.requestSubmit == "function" ? n.requestSubmit() : n && n.submit();
|
|
3835
3920
|
},
|
|
3836
3921
|
releaseSubmitLoading: () => {
|
|
3837
|
-
n && (n.removeAttribute("data-formie-internal-resubmit"),
|
|
3922
|
+
n && (n.removeAttribute("data-formie-internal-resubmit"), Me(n));
|
|
3838
3923
|
},
|
|
3839
|
-
getBillingData: (
|
|
3924
|
+
getBillingData: (y) => {
|
|
3840
3925
|
const m = {};
|
|
3841
|
-
if (!
|
|
3926
|
+
if (!y || typeof y != "object")
|
|
3842
3927
|
return { billing_details: m };
|
|
3843
|
-
if (
|
|
3844
|
-
const g = l(
|
|
3928
|
+
if (y.billingName) {
|
|
3929
|
+
const g = l(y.billingName);
|
|
3845
3930
|
g && (m.name = g);
|
|
3846
3931
|
}
|
|
3847
|
-
if (
|
|
3848
|
-
const g = l(
|
|
3932
|
+
if (y.billingEmail) {
|
|
3933
|
+
const g = l(y.billingEmail);
|
|
3849
3934
|
g && (m.email = g);
|
|
3850
3935
|
}
|
|
3851
|
-
if (
|
|
3852
|
-
const g =
|
|
3853
|
-
|
|
3936
|
+
if (y.billingAddress) {
|
|
3937
|
+
const g = y.billingAddress, S = {}, M = l(`${g}.address1`), T = l(`${g}.address2`), F = l(`${g}.address3`), q = l(`${g}.city`), w = l(`${g}.zip`), P = l(`${g}.state`), N = l(`${g}.country`);
|
|
3938
|
+
M && (S.line1 = M), T && (S.line2 = T), F && (S.line3 = F), q && (S.city = q), w && (S.postal_code = w), P && (S.state = P), N && (S.country = N), Object.keys(S).length && (m.address = S);
|
|
3854
3939
|
}
|
|
3855
3940
|
return { billing_details: m };
|
|
3856
3941
|
},
|
|
3857
3942
|
events: {
|
|
3858
|
-
onForm: (
|
|
3943
|
+
onForm: (y, m) => n ? Nt(n, y, m) : () => {
|
|
3859
3944
|
},
|
|
3860
|
-
onRoot: (
|
|
3945
|
+
onRoot: (y, m) => Nt(i, y, m)
|
|
3861
3946
|
}
|
|
3862
3947
|
};
|
|
3863
3948
|
}
|
|
3864
3949
|
const U = _("payments");
|
|
3865
|
-
function
|
|
3950
|
+
function Ut(e) {
|
|
3866
3951
|
const t = e;
|
|
3867
3952
|
return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
|
|
3868
3953
|
}
|
|
3869
|
-
function
|
|
3870
|
-
const t = e.defaultRequiredInputSuffixes ??
|
|
3954
|
+
function No(e) {
|
|
3955
|
+
const t = e.defaultRequiredInputSuffixes ?? Mo[e.id] ?? [];
|
|
3871
3956
|
return {
|
|
3872
3957
|
id: e.id,
|
|
3873
3958
|
kind: "payment",
|
|
@@ -3885,24 +3970,24 @@ function Po(e) {
|
|
|
3885
3970
|
} catch {
|
|
3886
3971
|
}
|
|
3887
3972
|
}
|
|
3888
|
-
const a =
|
|
3973
|
+
const a = Do(
|
|
3889
3974
|
e.id,
|
|
3890
3975
|
r.options || {},
|
|
3891
3976
|
{
|
|
3892
3977
|
defaultRequiredInputSuffixes: t
|
|
3893
3978
|
}
|
|
3894
|
-
), s =
|
|
3979
|
+
), s = xo(r, a), l = {
|
|
3895
3980
|
...r,
|
|
3896
3981
|
options: a,
|
|
3897
3982
|
services: s
|
|
3898
3983
|
}, d = [];
|
|
3899
|
-
let p = null,
|
|
3900
|
-
const
|
|
3901
|
-
if (!e.mount ||
|
|
3984
|
+
let p = null, h = null, u = null, c = null;
|
|
3985
|
+
const b = async () => (p || (U.log("Loading payment provider API.", { moduleId: e.id }), p = e.load(l)), p), A = async () => {
|
|
3986
|
+
if (!e.mount || h || !Ut(r.target))
|
|
3902
3987
|
return;
|
|
3903
|
-
const E = await
|
|
3988
|
+
const E = await b();
|
|
3904
3989
|
try {
|
|
3905
|
-
|
|
3990
|
+
h = await e.mount({
|
|
3906
3991
|
api: E,
|
|
3907
3992
|
field: r.target,
|
|
3908
3993
|
services: s,
|
|
@@ -3923,25 +4008,25 @@ function Po(e) {
|
|
|
3923
4008
|
s.removeError(), s.removeSuccess();
|
|
3924
4009
|
})), e.setup) {
|
|
3925
4010
|
const E = r.root || r.form || r.target;
|
|
3926
|
-
|
|
4011
|
+
u = await e.setup({ ...l, root: E }), u.destroy && d.push(u.destroy);
|
|
3927
4012
|
}
|
|
3928
|
-
e.mount &&
|
|
3929
|
-
const
|
|
4013
|
+
e.mount && Ut(r.target) && await A(), ["formie:page:navigate:after", "formie:submit:result"].forEach((E) => {
|
|
4014
|
+
const y = () => {
|
|
3930
4015
|
A();
|
|
3931
4016
|
};
|
|
3932
|
-
r.root.addEventListener(E,
|
|
3933
|
-
r.root.removeEventListener(E,
|
|
4017
|
+
r.root.addEventListener(E, y), d.push(() => {
|
|
4018
|
+
r.root.removeEventListener(E, y);
|
|
3934
4019
|
});
|
|
3935
4020
|
});
|
|
3936
4021
|
const v = async () => {
|
|
3937
4022
|
if (U.log("Destroying payment module.", {
|
|
3938
4023
|
moduleId: e.id,
|
|
3939
4024
|
handle: a.handle
|
|
3940
|
-
}), d.forEach((E) => E()),
|
|
3941
|
-
const E = await
|
|
4025
|
+
}), d.forEach((E) => E()), h && e.unmount) {
|
|
4026
|
+
const E = await b();
|
|
3942
4027
|
await e.unmount({
|
|
3943
4028
|
api: E,
|
|
3944
|
-
widget:
|
|
4029
|
+
widget: h,
|
|
3945
4030
|
field: r.target,
|
|
3946
4031
|
services: s,
|
|
3947
4032
|
options: a,
|
|
@@ -3959,27 +4044,27 @@ function Po(e) {
|
|
|
3959
4044
|
return i[e.id] = { destroy: v }, {
|
|
3960
4045
|
destroy: v,
|
|
3961
4046
|
onBeforeStage: async (E) => {
|
|
3962
|
-
if (
|
|
3963
|
-
await
|
|
4047
|
+
if (u?.onBeforeStage) {
|
|
4048
|
+
await u.onBeforeStage(E);
|
|
3964
4049
|
return;
|
|
3965
4050
|
}
|
|
3966
4051
|
if (E.stage !== "authorize" || E.action !== "submit" || r.target.closest("[data-formie-page]")?.hasAttribute("data-formie-page-hidden"))
|
|
3967
4052
|
return;
|
|
3968
4053
|
await A();
|
|
3969
|
-
const g = await
|
|
4054
|
+
const g = await b();
|
|
3970
4055
|
if (e.onBeforeAuthorize) {
|
|
3971
|
-
|
|
4056
|
+
c || (c = (async () => e.onBeforeAuthorize({
|
|
3972
4057
|
api: g,
|
|
3973
|
-
widget:
|
|
4058
|
+
widget: h,
|
|
3974
4059
|
field: r.target,
|
|
3975
4060
|
services: s,
|
|
3976
4061
|
options: a,
|
|
3977
4062
|
provider: a.provider,
|
|
3978
4063
|
stageCtx: E
|
|
3979
4064
|
}))().finally(() => {
|
|
3980
|
-
|
|
4065
|
+
c = null;
|
|
3981
4066
|
}));
|
|
3982
|
-
const T = await
|
|
4067
|
+
const T = await c;
|
|
3983
4068
|
if (U.log("onBeforeAuthorize resolved.", {
|
|
3984
4069
|
moduleId: e.id,
|
|
3985
4070
|
handle: a.handle,
|
|
@@ -3992,31 +4077,31 @@ function Po(e) {
|
|
|
3992
4077
|
}
|
|
3993
4078
|
if (a.transport.requiredInputSuffixes.length === 0)
|
|
3994
4079
|
return;
|
|
3995
|
-
const S = r.form || r.root,
|
|
4080
|
+
const S = r.form || r.root, M = await Pr(
|
|
3996
4081
|
S,
|
|
3997
4082
|
a.transport.requiredInputSuffixes,
|
|
3998
4083
|
a.transport.waitForValueMs
|
|
3999
4084
|
);
|
|
4000
|
-
|
|
4085
|
+
M.ok || (U.warn("Required payment input(s) missing.", {
|
|
4001
4086
|
moduleId: e.id,
|
|
4002
4087
|
handle: a.handle,
|
|
4003
|
-
missingSuffix:
|
|
4088
|
+
missingSuffix: M.missingSuffix
|
|
4004
4089
|
}), E.abort(a.transport.errorMessage));
|
|
4005
4090
|
},
|
|
4006
|
-
onAfterStage: async (E,
|
|
4091
|
+
onAfterStage: async (E, y) => {
|
|
4007
4092
|
E.stage !== "dispatch" || !e.onAfterSubmit || await e.onAfterSubmit({
|
|
4008
4093
|
field: r.target,
|
|
4009
4094
|
services: s,
|
|
4010
4095
|
options: a,
|
|
4011
4096
|
provider: a.provider,
|
|
4012
|
-
result:
|
|
4097
|
+
result: y
|
|
4013
4098
|
});
|
|
4014
4099
|
}
|
|
4015
4100
|
};
|
|
4016
4101
|
}
|
|
4017
4102
|
};
|
|
4018
4103
|
}
|
|
4019
|
-
const
|
|
4104
|
+
const ba = No, Uo = "[data-formie-address-autocomplete-input]", zt = "[data-formie-address-location]", zo = {
|
|
4020
4105
|
autoComplete: "[data-formie-address-autocomplete-input]",
|
|
4021
4106
|
address1: "[data-formie-address-line1-input]",
|
|
4022
4107
|
address2: "[data-formie-address-line2-input]",
|
|
@@ -4025,24 +4110,24 @@ const ua = Po, $o = "[data-formie-address-autocomplete-input]", xt = "[data-form
|
|
|
4025
4110
|
state: "[data-formie-address-state-input]",
|
|
4026
4111
|
zip: "[data-formie-address-zip-input]",
|
|
4027
4112
|
country: "[data-formie-address-country-input]"
|
|
4028
|
-
},
|
|
4029
|
-
function
|
|
4113
|
+
}, Bo = /* @__PURE__ */ new Set(["handle"]);
|
|
4114
|
+
function jo(e, t) {
|
|
4030
4115
|
return (typeof t.handle == "string" && t.handle.trim() !== "" ? t.handle.trim() : "") || e;
|
|
4031
4116
|
}
|
|
4032
|
-
function
|
|
4033
|
-
const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (
|
|
4117
|
+
function Wo(e, t) {
|
|
4118
|
+
const r = t || {}, n = Object.entries(r).reduce((i, [o, a]) => (Bo.has(o) || (i[o] = a), i), {});
|
|
4034
4119
|
return {
|
|
4035
|
-
handle:
|
|
4120
|
+
handle: jo(e, r),
|
|
4036
4121
|
provider: n
|
|
4037
4122
|
};
|
|
4038
4123
|
}
|
|
4039
|
-
function
|
|
4124
|
+
function Ko(e, t, r) {
|
|
4040
4125
|
return e.addEventListener(t, r), () => {
|
|
4041
4126
|
e.removeEventListener(t, r);
|
|
4042
4127
|
};
|
|
4043
4128
|
}
|
|
4044
|
-
function
|
|
4045
|
-
const t = e.target, r = e.form, n = e.root, i =
|
|
4129
|
+
function Go(e) {
|
|
4130
|
+
const t = e.target, r = e.form, n = e.root, i = Uo;
|
|
4046
4131
|
return {
|
|
4047
4132
|
root: n,
|
|
4048
4133
|
field: t,
|
|
@@ -4050,14 +4135,14 @@ function xo(e) {
|
|
|
4050
4135
|
input: {
|
|
4051
4136
|
getAutocomplete: () => t.querySelector(i),
|
|
4052
4137
|
setValue: (o, a, s) => {
|
|
4053
|
-
const l =
|
|
4138
|
+
const l = zo[o], d = t.querySelector(l);
|
|
4054
4139
|
d && (d.value = a || s || "");
|
|
4055
4140
|
}
|
|
4056
4141
|
},
|
|
4057
4142
|
location: {
|
|
4058
|
-
getButton: () => t.querySelector(
|
|
4143
|
+
getButton: () => t.querySelector(zt),
|
|
4059
4144
|
onUseLocation: (o) => {
|
|
4060
|
-
const a = t.querySelector(
|
|
4145
|
+
const a = t.querySelector(zt);
|
|
4061
4146
|
if (!a)
|
|
4062
4147
|
return () => {
|
|
4063
4148
|
};
|
|
@@ -4075,22 +4160,22 @@ function xo(e) {
|
|
|
4075
4160
|
}
|
|
4076
4161
|
},
|
|
4077
4162
|
events: {
|
|
4078
|
-
onField: (o, a) =>
|
|
4163
|
+
onField: (o, a) => Ko(t, o, a)
|
|
4079
4164
|
}
|
|
4080
4165
|
};
|
|
4081
4166
|
}
|
|
4082
4167
|
const te = _("address");
|
|
4083
|
-
function
|
|
4168
|
+
function Bt(e) {
|
|
4084
4169
|
const t = e;
|
|
4085
4170
|
return !t.closest("[data-formie-page-hidden]") && !t.closest("[hidden]");
|
|
4086
4171
|
}
|
|
4087
|
-
function
|
|
4172
|
+
function Jo(e) {
|
|
4088
4173
|
return {
|
|
4089
4174
|
id: e.id,
|
|
4090
4175
|
kind: "address",
|
|
4091
4176
|
match: (t) => !!t.target.querySelector("[data-formie-address-autocomplete-input]"),
|
|
4092
4177
|
setup: async (t) => {
|
|
4093
|
-
const r =
|
|
4178
|
+
const r = Wo(e.id, t.options || {}), n = Go(t);
|
|
4094
4179
|
te.log("Setup module.", {
|
|
4095
4180
|
moduleId: e.id
|
|
4096
4181
|
});
|
|
@@ -4112,11 +4197,11 @@ function No(e) {
|
|
|
4112
4197
|
const d = async () => (a || (te.log("Loading provider API.", {
|
|
4113
4198
|
moduleId: e.id
|
|
4114
4199
|
}), a = e.load(i)), a), p = async () => {
|
|
4115
|
-
if (s || !
|
|
4200
|
+
if (s || !Bt(t.target))
|
|
4116
4201
|
return;
|
|
4117
|
-
const
|
|
4202
|
+
const c = await d();
|
|
4118
4203
|
s = await e.mount({
|
|
4119
|
-
api:
|
|
4204
|
+
api: c,
|
|
4120
4205
|
field: t.target,
|
|
4121
4206
|
services: n,
|
|
4122
4207
|
options: r,
|
|
@@ -4125,21 +4210,21 @@ function No(e) {
|
|
|
4125
4210
|
moduleId: e.id
|
|
4126
4211
|
});
|
|
4127
4212
|
};
|
|
4128
|
-
|
|
4129
|
-
const
|
|
4213
|
+
Bt(t.target) && await p(), ["formie:page:navigate:after", "formie:submit:result"].forEach((c) => {
|
|
4214
|
+
const b = () => {
|
|
4130
4215
|
p();
|
|
4131
4216
|
};
|
|
4132
|
-
t.root.addEventListener(
|
|
4133
|
-
t.root.removeEventListener(
|
|
4217
|
+
t.root.addEventListener(c, b), o.push(() => {
|
|
4218
|
+
t.root.removeEventListener(c, b);
|
|
4134
4219
|
});
|
|
4135
4220
|
});
|
|
4136
|
-
const
|
|
4221
|
+
const u = n.location.onUseLocation((c) => {
|
|
4137
4222
|
e.onCurrentLocation && (async () => {
|
|
4138
4223
|
if (await p(), !s)
|
|
4139
4224
|
return;
|
|
4140
|
-
const
|
|
4141
|
-
await e.onCurrentLocation?.(
|
|
4142
|
-
api:
|
|
4225
|
+
const b = await d();
|
|
4226
|
+
await e.onCurrentLocation?.(c, {
|
|
4227
|
+
api: b,
|
|
4143
4228
|
widget: s,
|
|
4144
4229
|
field: t.target,
|
|
4145
4230
|
services: n,
|
|
@@ -4148,14 +4233,14 @@ function No(e) {
|
|
|
4148
4233
|
});
|
|
4149
4234
|
})();
|
|
4150
4235
|
});
|
|
4151
|
-
return
|
|
4236
|
+
return u && o.push(u), {
|
|
4152
4237
|
destroy: async () => {
|
|
4153
4238
|
if (te.log("Destroying module.", {
|
|
4154
4239
|
moduleId: e.id
|
|
4155
|
-
}), o.forEach((
|
|
4156
|
-
const
|
|
4240
|
+
}), o.forEach((c) => c()), s && e.unmount) {
|
|
4241
|
+
const c = await d();
|
|
4157
4242
|
await e.unmount({
|
|
4158
|
-
api:
|
|
4243
|
+
api: c,
|
|
4159
4244
|
widget: s,
|
|
4160
4245
|
field: t.target,
|
|
4161
4246
|
services: n,
|
|
@@ -4170,60 +4255,60 @@ function No(e) {
|
|
|
4170
4255
|
}
|
|
4171
4256
|
};
|
|
4172
4257
|
}
|
|
4173
|
-
const
|
|
4258
|
+
const ya = Jo;
|
|
4174
4259
|
export {
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4260
|
+
aa as $,
|
|
4261
|
+
zo as A,
|
|
4262
|
+
Yo as B,
|
|
4263
|
+
ua as C,
|
|
4264
|
+
Kr as D,
|
|
4265
|
+
Gr as E,
|
|
4266
|
+
xr as F,
|
|
4267
|
+
to as G,
|
|
4268
|
+
Jr as H,
|
|
4269
|
+
Yr as I,
|
|
4270
|
+
la as J,
|
|
4271
|
+
nr as K,
|
|
4272
|
+
_r as L,
|
|
4273
|
+
yr as M,
|
|
4274
|
+
Ur as N,
|
|
4275
|
+
Nr as O,
|
|
4276
|
+
sa as P,
|
|
4277
|
+
Ro as Q,
|
|
4278
|
+
Wt as R,
|
|
4279
|
+
oa as S,
|
|
4280
|
+
Zo as T,
|
|
4281
|
+
Rr as U,
|
|
4282
|
+
ha as V,
|
|
4283
|
+
Dr as W,
|
|
4284
|
+
ra as X,
|
|
4285
|
+
ia as Y,
|
|
4201
4286
|
x as Z,
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4287
|
+
ze as _,
|
|
4288
|
+
pa as a,
|
|
4289
|
+
ma as b,
|
|
4290
|
+
da as c,
|
|
4291
|
+
ya as d,
|
|
4292
|
+
ga as e,
|
|
4293
|
+
ca as f,
|
|
4294
|
+
Xo as g,
|
|
4210
4295
|
_ as h,
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4296
|
+
Vo as i,
|
|
4297
|
+
Fr as j,
|
|
4298
|
+
Qo as k,
|
|
4299
|
+
ea as l,
|
|
4300
|
+
Be as m,
|
|
4216
4301
|
de as n,
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4302
|
+
Fe as o,
|
|
4303
|
+
Tr as p,
|
|
4304
|
+
na as q,
|
|
4305
|
+
Ho as r,
|
|
4306
|
+
ht as s,
|
|
4222
4307
|
ue as t,
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4308
|
+
ba as u,
|
|
4309
|
+
ta as v,
|
|
4310
|
+
fa as w,
|
|
4311
|
+
$ as x,
|
|
4227
4312
|
le as y,
|
|
4228
|
-
|
|
4313
|
+
Vn as z
|
|
4229
4314
|
};
|