@verbb/formie-browser 1.0.4 → 1.0.6
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 +76 -22
- package/dist/chunks/address-country-Rx6GQTND.js +68 -0
- package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
- package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
- package/dist/chunks/api-CmwLRq_n.js +780 -0
- package/dist/chunks/api-DMK8NSUI.js +407 -0
- package/dist/chunks/api-sPqGbOww.js +125 -0
- package/dist/chunks/async-nPFRNQ06.js +25 -0
- package/dist/chunks/bpoint-DSjqRv63.js +24 -0
- package/dist/chunks/calculations-CeDgB9jt.js +299 -0
- package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
- package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
- package/dist/chunks/chunk-3b4jIN3o.js +13 -0
- package/dist/chunks/combobox-D-2b42wn.js +1954 -0
- package/dist/chunks/conditions-DjZOtHfS.js +412 -0
- package/dist/chunks/constants-DVcJAvc5.js +38 -0
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
- package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
- package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
- package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
- package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
- package/dist/chunks/debug-BV0DvdHx.js +41 -0
- package/dist/chunks/dist-BQ4a9hmy.js +2659 -0
- package/dist/chunks/event-names-BCI2FLD8.js +51 -0
- package/dist/chunks/eway-D3ctTbEk.js +70 -0
- package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
- package/dist/chunks/file-upload-D49m8-DR.js +287 -0
- package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
- package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
- package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
- package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
- package/dist/chunks/google-address-OhKilPWE.js +161 -0
- package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
- package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
- package/dist/chunks/http-D-JExro7.js +27 -0
- package/dist/chunks/i18n-BY1ds1BL.js +121 -0
- package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
- package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
- package/dist/chunks/mollie-COG-ko2D.js +23 -0
- package/dist/chunks/moneris-CMH8PlRc.js +117 -0
- package/dist/chunks/opayo-D2jsR5vh.js +113 -0
- package/dist/chunks/paddle-DxF88RfC.js +55 -0
- package/dist/chunks/paypal-b5pnwrA2.js +95 -0
- package/dist/chunks/payway-BJYu9DIR.js +55 -0
- package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
- package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
- package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
- package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
- package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
- package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
- package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
- package/dist/chunks/repeater-B5leVxZU.js +102 -0
- package/dist/chunks/rich-text-D0sb8bmX.js +349 -0
- package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
- package/dist/chunks/sdk-BhHAYgga.js +1397 -0
- package/dist/chunks/shared-Bx9s0i0P.js +100 -0
- package/dist/chunks/signature-xz4QO7CR.js +536 -0
- package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
- package/dist/chunks/square-BP8RWAKB.js +40 -0
- package/dist/chunks/stripe-MihN63uC.js +184 -0
- package/dist/chunks/styles-BfoIZwJp.js +19 -0
- package/dist/chunks/summary-D3AjxpYN.js +114 -0
- package/dist/chunks/table-C-lkQN6I.js +78 -0
- package/dist/chunks/text-limit-DbgEFHLO.js +125 -0
- package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
- package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
- package/dist/chunks/upload-manager-BpqWSHmU.js +2558 -0
- package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
- package/dist/css/formie-theme.css +2 -0
- package/dist/css/theme/_buttons.css +16 -0
- package/dist/css/theme/_tokens.css +2 -0
- package/dist/css/theme/fields/_address-state.css +94 -0
- package/dist/css/theme/fields/_combobox.css +246 -0
- package/dist/css/theme/fields/_select.css +13 -0
- package/dist/css/theme/fields/_signature.css +19 -0
- package/dist/css/theme/fields/_upload-manager.css +279 -0
- package/dist/index.js +2448 -39
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts +4 -0
- package/dist/js/core/validation-focus.d.ts.map +1 -0
- package/dist/js/modules/address/api.d.ts +1 -0
- package/dist/js/modules/address/api.d.ts.map +1 -1
- package/dist/js/modules/address/constants.d.ts +22 -1
- package/dist/js/modules/address/constants.d.ts.map +1 -1
- package/dist/js/modules/address/host.d.ts +2 -2
- package/dist/js/modules/address/host.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +3 -0
- package/dist/js/modules/fields/address-country.d.ts.map +1 -0
- package/dist/js/modules/fields/address-state.d.ts +3 -0
- package/dist/js/modules/fields/address-state.d.ts.map +1 -0
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +17 -0
- package/dist/js/modules/fields/combobox.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-link.d.ts +3 -0
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-maps.d.ts +3 -0
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/signature.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts +3 -0
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -0
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +7 -0
- package/dist/js/utils/country-from-ip.d.ts.map +1 -0
- package/dist/js/utils/field-references.d.ts +1 -0
- package/dist/js/utils/field-references.d.ts.map +1 -1
- package/dist/js/utils/field-references.row-scope.d.ts +11 -0
- package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
- package/package.json +8 -3
- package/src/css/formie-theme.css +2 -0
- package/src/css/theme/_buttons.css +16 -0
- package/src/css/theme/_tokens.css +2 -0
- package/src/css/theme/fields/_address-state.css +94 -0
- package/src/css/theme/fields/_combobox.css +246 -0
- package/src/css/theme/fields/_select.css +13 -0
- package/src/css/theme/fields/_signature.css +19 -0
- package/src/css/theme/fields/_upload-manager.css +279 -0
- package/src/js/core/create-formie-client.ts +27 -0
- package/src/js/core/submit-result-ui.ts +4 -4
- package/src/js/core/validation-focus.ts +117 -0
- package/src/js/modules/address/api.ts +7 -0
- package/src/js/modules/address/constants.ts +82 -2
- package/src/js/modules/address/host.ts +16 -6
- package/src/js/modules/address/loqate.ts +3 -17
- package/src/js/modules/fields/address-country.ts +156 -0
- package/src/js/modules/fields/address-state.ts +946 -0
- package/src/js/modules/fields/calculations.ts +32 -0
- package/src/js/modules/fields/combobox.ts +188 -0
- package/src/js/modules/fields/custom-google-maps.ts +416 -0
- package/src/js/modules/fields/custom-link.ts +95 -0
- package/src/js/modules/fields/custom-maps.ts +339 -0
- package/src/js/modules/fields/date-picker.ts +96 -3
- package/src/js/modules/fields/index.ts +7 -0
- package/src/js/modules/fields/phone-country.ts +6 -0
- package/src/js/modules/fields/signature.ts +199 -15
- package/src/js/modules/fields/upload-manager.ts +1277 -0
- package/src/js/submit/pipeline.ts +11 -1
- package/src/js/utils/country-from-ip.ts +54 -0
- package/src/js/utils/field-references.row-scope.ts +303 -0
- package/src/js/utils/field-references.ts +1 -0
- package/src/vendor.d.ts +1 -1
- package/dist/chunks/address-finder-BU4roxT6.js +0 -37
- package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
- package/dist/chunks/calculations-C9t6Zop9.js +0 -147
- package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
- package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
- package/dist/chunks/conditions-DKxVCsjD.js +0 -459
- package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
- package/dist/chunks/eway-DCielIML.js +0 -74
- package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
- package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
- package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
- package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
- package/dist/chunks/google-address-BD8IZ86V.js +0 -181
- package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
- package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
- package/dist/chunks/index-BEsfee-D.js +0 -1839
- package/dist/chunks/index-BP7Unm5Y.js +0 -863
- package/dist/chunks/index-D6npYxvr.js +0 -4423
- package/dist/chunks/loqate-B-ZNS65B.js +0 -55
- package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
- package/dist/chunks/moneris-B1b0uEtY.js +0 -101
- package/dist/chunks/opayo-CC5hraHo.js +0 -122
- package/dist/chunks/paddle-B4GmrDsq.js +0 -60
- package/dist/chunks/paypal-BFS6XsIS.js +0 -100
- package/dist/chunks/payway-DekoJead.js +0 -56
- package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
- package/dist/chunks/place-kit-DizZWV_e.js +0 -42
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
- package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
- package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
- package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
- package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
- package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
- package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
- package/dist/chunks/rich-text-C8aGYp70.js +0 -304
- package/dist/chunks/scripts-CKTFtxPO.js +0 -36
- package/dist/chunks/sdk-3SicTWby.js +0 -1559
- package/dist/chunks/shared--BU5CFoL.js +0 -80
- package/dist/chunks/signature-pFhZfH7d.js +0 -550
- package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
- package/dist/chunks/square-BR9pvToy.js +0 -46
- package/dist/chunks/stripe-OHUwoV9g.js +0 -202
- package/dist/chunks/styles-C3aqgtek.js +0 -21
- package/dist/chunks/summary-Da7Ktg3N.js +0 -126
- package/dist/chunks/table-C0PmR9bI.js +0 -95
- package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
- package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
- package/dist/chunks/utils-BntI3W4S.js +0 -6149
package/dist/index.js
CHANGED
|
@@ -1,40 +1,2449 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import { c as e, d as t, l as n, o as r, r as i, t as a, u as o } from "./chunks/event-names-BCI2FLD8.js";
|
|
2
|
+
import { a as s, i as c, n as l, r as u, t as d } from "./chunks/debug-BV0DvdHx.js";
|
|
3
|
+
import { a as f, c as p, d as ee, i as m, l as h, n as g, o as _, r as v, s as y, t as b, u as x } from "./chunks/api-CmwLRq_n.js";
|
|
4
|
+
import { n as te, r as S, t as C } from "./chunks/theme-classes-Tv7q7ToE.js";
|
|
5
|
+
import { t as w } from "./chunks/http-D-JExro7.js";
|
|
6
|
+
import { a as T, i as E, n as ne, r as re, t as ie } from "./chunks/i18n-BY1ds1BL.js";
|
|
7
|
+
import { n as ae, t as oe } from "./chunks/api-DMK8NSUI.js";
|
|
8
|
+
import { n as se, r as ce, t as le } from "./chunks/field-references.keys-58ZSTrCW.js";
|
|
9
|
+
import { i as ue, n as de, r as fe, t as pe } from "./chunks/field-references.resolver-CHwn0G0L.js";
|
|
10
|
+
import { t as me } from "./chunks/api-sPqGbOww.js";
|
|
11
|
+
//#region src/js/compatibility/event-map.ts
|
|
12
|
+
var he = [
|
|
13
|
+
{
|
|
14
|
+
legacyEvent: "onFormieLoaded",
|
|
15
|
+
canonicalEvent: "formie:mount:after",
|
|
16
|
+
disposition: "approximate",
|
|
17
|
+
target: "document"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
legacyEvent: "onFormieInit",
|
|
21
|
+
canonicalEvent: "formie:mount:after",
|
|
22
|
+
disposition: "approximate",
|
|
23
|
+
target: "document"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
legacyEvent: "onFormieReady",
|
|
27
|
+
canonicalEvent: "formie:mount:after",
|
|
28
|
+
disposition: "safe"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
legacyEvent: "onAfterFormieSubmit",
|
|
32
|
+
canonicalEvent: "formie:submit:result",
|
|
33
|
+
disposition: "safe"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
legacyEvent: "onFormieSubmitError",
|
|
37
|
+
canonicalEvent: "formie:submit:result",
|
|
38
|
+
disposition: "safe"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
legacyEvent: "onFormiePageToggle",
|
|
42
|
+
canonicalEvent: "formie:page:navigate:after",
|
|
43
|
+
disposition: "safe"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
legacyEvent: "onBeforeFormieSubmit",
|
|
47
|
+
canonicalEvent: "formie:submit:before",
|
|
48
|
+
disposition: "approximate"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
legacyEvent: "onFormieValidate",
|
|
52
|
+
canonicalEvent: "formie:stage:validate:before",
|
|
53
|
+
disposition: "approximate"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
legacyEvent: "onAfterFormieValidate",
|
|
57
|
+
canonicalEvent: "formie:stage:validate:after",
|
|
58
|
+
disposition: "approximate"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
legacyEvent: "onFormieSubmit",
|
|
62
|
+
canonicalEvent: "formie:submit:after",
|
|
63
|
+
disposition: "approximate"
|
|
64
|
+
}
|
|
65
|
+
], ge = [
|
|
66
|
+
{
|
|
67
|
+
legacyEvent: "formieValidatorInitialized",
|
|
68
|
+
canonicalEvent: "formie:validator:ready",
|
|
69
|
+
disposition: "safe"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
legacyEvent: "formieValidatorDestroyed",
|
|
73
|
+
canonicalEvent: "formie:validator:destroy",
|
|
74
|
+
disposition: "safe"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
legacyEvent: "formieValidatorShowError",
|
|
78
|
+
canonicalEvent: "formie:validator:show-error",
|
|
79
|
+
disposition: "safe"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
legacyEvent: "formieValidatorClearError",
|
|
83
|
+
canonicalEvent: "formie:validator:clear-error",
|
|
84
|
+
disposition: "safe"
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
function _e(e) {
|
|
88
|
+
if (!e) return {
|
|
89
|
+
enabled: !1,
|
|
90
|
+
legacyDomEvents: !1,
|
|
91
|
+
legacyValidatorEvents: !1
|
|
92
|
+
};
|
|
93
|
+
if (e === !0) return {
|
|
94
|
+
enabled: !0,
|
|
95
|
+
legacyDomEvents: !0,
|
|
96
|
+
legacyValidatorEvents: !0
|
|
97
|
+
};
|
|
98
|
+
let t = e.legacyDomEvents ?? !0, n = e.legacyValidatorEvents ?? !0;
|
|
99
|
+
return {
|
|
100
|
+
enabled: t || n,
|
|
101
|
+
legacyDomEvents: t,
|
|
102
|
+
legacyValidatorEvents: n
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/js/compatibility/dom-adapter.ts
|
|
107
|
+
function ve(e, t, n) {
|
|
108
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
109
|
+
bubbles: !0,
|
|
110
|
+
detail: n
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
function ye(e, t) {
|
|
114
|
+
if (e.canonicalEvent !== "formie:submit:result") return !0;
|
|
115
|
+
let n = t;
|
|
116
|
+
return e.legacyEvent === "onAfterFormieSubmit" ? !!n?.ok : e.legacyEvent === "onFormieSubmitError" ? n?.ok === !1 : !0;
|
|
117
|
+
}
|
|
118
|
+
function be(e, t) {
|
|
119
|
+
let n = t && typeof t == "object" ? t : {}, r = typeof n.pageId == "string" ? n.pageId : "", i = Array.from(e.querySelectorAll("[data-formie-page-id]"));
|
|
120
|
+
return { data: {
|
|
121
|
+
nextPageId: r,
|
|
122
|
+
nextPageIndex: i.findIndex((e) => e.getAttribute("data-formie-page-id") === r),
|
|
123
|
+
totalPages: i.length
|
|
124
|
+
} };
|
|
125
|
+
}
|
|
126
|
+
function xe(e, t, n, r, i) {
|
|
127
|
+
let a = globalThis.Formie || i;
|
|
128
|
+
return e.legacyEvent === "onFormieLoaded" ? { formie: a } : e.legacyEvent === "onFormieInit" ? {
|
|
129
|
+
formie: a,
|
|
130
|
+
form: i,
|
|
131
|
+
$form: r,
|
|
132
|
+
formId: i.id
|
|
133
|
+
} : e.legacyEvent === "onFormieReady" ? {
|
|
134
|
+
...t && typeof t == "object" ? t : {},
|
|
135
|
+
form: r,
|
|
136
|
+
target: n,
|
|
137
|
+
instance: i
|
|
138
|
+
} : e.legacyEvent === "onFormiePageToggle" ? be(r, t) : t;
|
|
139
|
+
}
|
|
140
|
+
function Se({ target: e, form: n, instance: r, options: i, unbinds: a }) {
|
|
141
|
+
i.legacyDomEvents && he.forEach((i) => {
|
|
142
|
+
let o = (t) => {
|
|
143
|
+
!(t instanceof CustomEvent) || !ye(i, t.detail) || ve(i.target === "document" ? document : n, i.legacyEvent, xe(i, t.detail, e, n, r));
|
|
144
|
+
};
|
|
145
|
+
e.addEventListener(t(i.canonicalEvent), o), a.push(() => {
|
|
146
|
+
e.removeEventListener(t(i.canonicalEvent), o);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/js/compatibility/validator-adapter.ts
|
|
152
|
+
function D(e, t, n) {
|
|
153
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
154
|
+
bubbles: !0,
|
|
155
|
+
detail: n
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
function Ce(e, t) {
|
|
159
|
+
return !!e && typeof e == "object" && e.validator === t;
|
|
160
|
+
}
|
|
161
|
+
function we({ target: e, form: t, validatorDetail: n, options: r, unbinds: i }) {
|
|
162
|
+
if (!r.legacyValidatorEvents || !n) return;
|
|
163
|
+
let { validator: a, addValidator: o, removeValidator: s } = n, c = {
|
|
164
|
+
...n,
|
|
165
|
+
form: t,
|
|
166
|
+
target: e
|
|
167
|
+
};
|
|
168
|
+
D(document, "formieValidatorInitialized", c);
|
|
169
|
+
let l = (e) => {
|
|
170
|
+
!(e instanceof CustomEvent) || !Ce(e.detail, a) || D(document, "formieValidatorDestroyed", {
|
|
171
|
+
...c,
|
|
172
|
+
...e.detail
|
|
173
|
+
});
|
|
174
|
+
}, u = (n) => {
|
|
175
|
+
!(n instanceof CustomEvent) || !Ce(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && D(n.target, "formieValidatorShowError", {
|
|
176
|
+
...n.detail,
|
|
177
|
+
addValidator: o,
|
|
178
|
+
removeValidator: s,
|
|
179
|
+
form: t,
|
|
180
|
+
target: e
|
|
181
|
+
});
|
|
182
|
+
}, d = (n) => {
|
|
183
|
+
!(n instanceof CustomEvent) || !Ce(n.detail, a) || !(n.target instanceof Element) || t.contains(n.target) && D(n.target, "formieValidatorClearError", {
|
|
184
|
+
...n.detail,
|
|
185
|
+
addValidator: o,
|
|
186
|
+
removeValidator: s,
|
|
187
|
+
form: t,
|
|
188
|
+
target: e
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
document.addEventListener("formie:validator:destroy", l), document.addEventListener("formie:validator:show-error", u), document.addEventListener("formie:validator:clear-error", d), i.push(() => {
|
|
192
|
+
document.removeEventListener("formie:validator:destroy", l), document.removeEventListener("formie:validator:show-error", u), document.removeEventListener("formie:validator:clear-error", d);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/js/core/dom-events.ts
|
|
197
|
+
function O(e, n, r) {
|
|
198
|
+
e.dispatchEvent(new CustomEvent(t(n), {
|
|
199
|
+
bubbles: !0,
|
|
200
|
+
detail: r
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/js/core/validation-focus.ts
|
|
205
|
+
function Te(e, t) {
|
|
206
|
+
let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
|
|
207
|
+
r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
|
|
208
|
+
}
|
|
209
|
+
function Ee(e) {
|
|
210
|
+
return Array.from(e.querySelectorAll("[data-formie-field-handle]")).find((e) => e.getAttribute("data-formie-field-has-error") === "true" ? !0 : e.querySelector("[data-formie-field-error]") !== null) || null;
|
|
211
|
+
}
|
|
212
|
+
function De(e) {
|
|
213
|
+
return e.querySelector("[aria-invalid=\"true\"]") || e.querySelector("input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])");
|
|
214
|
+
}
|
|
215
|
+
function Oe(e) {
|
|
216
|
+
return e.querySelector("[data-formie-message-error], [data-formie-error-container], [data-formie-errors]");
|
|
217
|
+
}
|
|
218
|
+
function ke(e) {
|
|
219
|
+
e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
|
|
220
|
+
let n = t;
|
|
221
|
+
if (!(n.getAttribute("data-formie-field-has-error") === "true" || n.querySelector("[data-formie-field-error]") !== null)) return;
|
|
222
|
+
n.setAttribute("data-formie-field-has-error", "true"), C(n, e, "fieldLayoutError");
|
|
223
|
+
let r = n.querySelector("[data-formie-field-errors]")?.id || "", i = n.querySelector("[data-formie-field-error]")?.id || "";
|
|
224
|
+
n.querySelectorAll("input, select, textarea").forEach((t) => {
|
|
225
|
+
let n = t;
|
|
226
|
+
n.setAttribute("aria-invalid", "true"), C(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), r && Te(n, r), i && n.setAttribute("aria-errormessage", i);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function Ae(e) {
|
|
231
|
+
return !!Ee(e) || !!Oe(e);
|
|
232
|
+
}
|
|
233
|
+
function je(e) {
|
|
234
|
+
let t = Ee(e);
|
|
235
|
+
if (t) {
|
|
236
|
+
let e = De(t);
|
|
237
|
+
if (e) {
|
|
238
|
+
if (e.scrollIntoView({
|
|
239
|
+
behavior: "smooth",
|
|
240
|
+
block: "center"
|
|
241
|
+
}), typeof e.focus == "function") try {
|
|
242
|
+
e.focus({ preventScroll: !0 });
|
|
243
|
+
} catch {
|
|
244
|
+
e.focus();
|
|
245
|
+
}
|
|
246
|
+
return !0;
|
|
247
|
+
}
|
|
248
|
+
return t.scrollIntoView({
|
|
249
|
+
behavior: "smooth",
|
|
250
|
+
block: "center"
|
|
251
|
+
}), !0;
|
|
252
|
+
}
|
|
253
|
+
let n = Oe(e);
|
|
254
|
+
return n ? (n.scrollIntoView({
|
|
255
|
+
behavior: "smooth",
|
|
256
|
+
block: "center"
|
|
257
|
+
}), !0) : !1;
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/js/events/event-bus.ts
|
|
261
|
+
var Me = class {
|
|
262
|
+
constructor() {
|
|
263
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
264
|
+
}
|
|
265
|
+
on(e, t) {
|
|
266
|
+
return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e)?.add(t), () => {
|
|
267
|
+
this.listeners.get(e)?.delete(t);
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
async emit(e, t) {
|
|
271
|
+
let n = this.listeners.get(e);
|
|
272
|
+
if (!(!n || n.size === 0)) for (let e of n) await e(t);
|
|
273
|
+
}
|
|
274
|
+
async emitSafe(e, t) {
|
|
275
|
+
let n = this.listeners.get(e), r = {
|
|
276
|
+
eventName: e,
|
|
277
|
+
total: n?.size || 0,
|
|
278
|
+
succeeded: 0,
|
|
279
|
+
failed: []
|
|
280
|
+
};
|
|
281
|
+
if (!n || n.size === 0) return r;
|
|
282
|
+
let i = 0;
|
|
283
|
+
for (let e of n) {
|
|
284
|
+
try {
|
|
285
|
+
await e(t), r.succeeded += 1;
|
|
286
|
+
} catch (e) {
|
|
287
|
+
r.failed.push({
|
|
288
|
+
index: i,
|
|
289
|
+
error: e
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
i += 1;
|
|
293
|
+
}
|
|
294
|
+
return r;
|
|
295
|
+
}
|
|
296
|
+
async emitParallelSafe(e, t) {
|
|
297
|
+
let n = this.listeners.get(e), r = {
|
|
298
|
+
eventName: e,
|
|
299
|
+
total: n?.size || 0,
|
|
300
|
+
succeeded: 0,
|
|
301
|
+
failed: []
|
|
302
|
+
};
|
|
303
|
+
return !n || n.size === 0 || (await Promise.allSettled(Array.from(n).map(async (e) => e(t)))).forEach((e, t) => {
|
|
304
|
+
if (e.status === "fulfilled") {
|
|
305
|
+
r.succeeded += 1;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
r.failed.push({
|
|
309
|
+
index: t,
|
|
310
|
+
error: e.reason
|
|
311
|
+
});
|
|
312
|
+
}), r;
|
|
313
|
+
}
|
|
314
|
+
clear() {
|
|
315
|
+
this.listeners.clear();
|
|
316
|
+
}
|
|
317
|
+
}, k = d("general", "transport");
|
|
318
|
+
function Ne(e) {
|
|
319
|
+
let t = {};
|
|
320
|
+
return [
|
|
321
|
+
"theme",
|
|
322
|
+
"themeConfig",
|
|
323
|
+
"locale",
|
|
324
|
+
"siteId"
|
|
325
|
+
].forEach((n) => {
|
|
326
|
+
e[n] !== void 0 && (t[n] = e[n]);
|
|
327
|
+
}), t;
|
|
328
|
+
}
|
|
329
|
+
function Pe(e, t = "", n = {}) {
|
|
330
|
+
if (Array.isArray(e)) {
|
|
331
|
+
let r = e.map((e) => typeof e == "string" ? e : String(e ?? "")).filter((e) => e.trim() !== "");
|
|
332
|
+
return t && r.length && (n[t] = (n[t] || []).concat(r)), n;
|
|
333
|
+
}
|
|
334
|
+
return e && typeof e == "object" && Object.entries(e).forEach(([e, r]) => {
|
|
335
|
+
Pe(r, t ? `${t}.${e}` : e, n);
|
|
336
|
+
}), n;
|
|
337
|
+
}
|
|
338
|
+
function Fe(e, t) {
|
|
339
|
+
let n = e.success === !0, r = e.keepSubmitLoading === !0, i = e.errors, a = Pe(i || {}), o = a.form || [], s = {};
|
|
340
|
+
Object.entries(a).forEach(([e, t]) => {
|
|
341
|
+
if (e === "form") return;
|
|
342
|
+
let n = e.split(".")[0];
|
|
343
|
+
s[n] = (s[n] || []).concat(t);
|
|
344
|
+
});
|
|
345
|
+
let c = !n && o.length === 0 && Object.keys(s).length > 0 ? [t || "Submission failed."] : o, l = !n && r && c.length === 0 && Object.keys(s).length === 0;
|
|
346
|
+
return {
|
|
347
|
+
ok: n,
|
|
348
|
+
action: e.submitAction === "back" || e.submitAction === "save" || e.submitAction === "submit" ? e.submitAction : void 0,
|
|
349
|
+
message: e.submitActionMessage || (n ? "Submission completed." : l ? "" : c[0] || "Submission failed."),
|
|
350
|
+
code: n ? void 0 : String(e.code || "SUBMIT_ERROR"),
|
|
351
|
+
keepSubmitLoading: r,
|
|
352
|
+
fieldErrors: Object.keys(s).length ? s : void 0,
|
|
353
|
+
formErrors: c.length ? c : void 0,
|
|
354
|
+
nextPage: e.nextPageId ? { id: String(e.nextPageId) } : null,
|
|
355
|
+
redirect: e.redirectUrl ? {
|
|
356
|
+
url: String(e.redirectUrl),
|
|
357
|
+
target: e.submitActionTab === "new-tab" ? "new-tab" : "same-tab"
|
|
358
|
+
} : null,
|
|
359
|
+
submitData: Array.isArray(e.submitData) ? e.submitData : void 0,
|
|
360
|
+
meta: e
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
async function Ie(e, t, n = {}) {
|
|
364
|
+
let r = JSON.stringify({
|
|
365
|
+
handle: t,
|
|
366
|
+
renderOptions: n
|
|
367
|
+
});
|
|
368
|
+
k.log("requestRender start.", {
|
|
369
|
+
endpoint: e,
|
|
370
|
+
handle: t
|
|
371
|
+
});
|
|
372
|
+
let i = await w(e, {
|
|
373
|
+
method: "POST",
|
|
374
|
+
body: r,
|
|
375
|
+
headers: { "Content-Type": "application/json" }
|
|
376
|
+
});
|
|
377
|
+
return k.log("requestRender complete.", { hasHtml: !!i.html }), i;
|
|
378
|
+
}
|
|
379
|
+
async function Le(e, t, n = {}) {
|
|
380
|
+
let r = JSON.stringify({
|
|
381
|
+
query: "\nquery FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {\n formieHtmlForm(handle: $handle, input: $input) {\n html\n }\n}",
|
|
382
|
+
variables: {
|
|
383
|
+
handle: t,
|
|
384
|
+
input: Ne(n)
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
k.log("requestGraphqlRender start.", {
|
|
388
|
+
endpoint: e,
|
|
389
|
+
handle: t
|
|
390
|
+
});
|
|
391
|
+
let i = await w(e, {
|
|
392
|
+
method: "POST",
|
|
393
|
+
body: r,
|
|
394
|
+
headers: { "Content-Type": "application/json" }
|
|
395
|
+
});
|
|
396
|
+
if (Array.isArray(i.errors) && i.errors.length > 0) throw Error(i.errors.map((e) => e.message || "Unknown GraphQL error").join("; "));
|
|
397
|
+
if (!i.data?.formieHtmlForm) throw Error(`Form not found for handle "${t}".`);
|
|
398
|
+
let a = i.data.formieHtmlForm;
|
|
399
|
+
return k.log("requestGraphqlRender complete.", { hasHtml: !!a.html }), a;
|
|
400
|
+
}
|
|
401
|
+
async function Re(e, t, n) {
|
|
402
|
+
let r = new URL(e, window.location.origin);
|
|
403
|
+
r.searchParams.set("handle", t), n && r.searchParams.set("renderId", n), k.log("requestRefreshTokens start.", {
|
|
404
|
+
endpoint: r.toString(),
|
|
405
|
+
handle: t,
|
|
406
|
+
hasRenderId: !!n
|
|
407
|
+
});
|
|
408
|
+
let i = await w(r.toString());
|
|
409
|
+
return k.log("requestRefreshTokens complete.", { hasRefreshTokens: !!i.refreshTokens }), i.refreshTokens || i;
|
|
410
|
+
}
|
|
411
|
+
async function ze(e, t, n) {
|
|
412
|
+
let r = new URL(e, window.location.origin), i = new FormData();
|
|
413
|
+
if (n && i.append("pageId", n), t) {
|
|
414
|
+
[
|
|
415
|
+
"handle",
|
|
416
|
+
"renderId",
|
|
417
|
+
"draftContextToken",
|
|
418
|
+
"draftContext",
|
|
419
|
+
"continuationToken"
|
|
420
|
+
].forEach((e) => {
|
|
421
|
+
let n = t.querySelector(`input[name="${e}"]`)?.value?.trim();
|
|
422
|
+
n && i.append(e, n);
|
|
423
|
+
});
|
|
424
|
+
let e = t.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]")?.value?.trim();
|
|
425
|
+
e && i.append("CRAFT_CSRF_TOKEN", e);
|
|
426
|
+
}
|
|
427
|
+
k.log("requestSetPage start.", {
|
|
428
|
+
requestUrl: r.toString(),
|
|
429
|
+
pageId: n || null
|
|
430
|
+
});
|
|
431
|
+
let a = await w(r.toString(), {
|
|
432
|
+
method: "POST",
|
|
433
|
+
body: i
|
|
434
|
+
});
|
|
435
|
+
return k.log("requestSetPage complete.", a), a;
|
|
436
|
+
}
|
|
437
|
+
function Be(e, t) {
|
|
438
|
+
let n = new URL(e, window.location.origin), r = new FormData();
|
|
439
|
+
[
|
|
440
|
+
"handle",
|
|
441
|
+
"renderId",
|
|
442
|
+
"draftContextToken",
|
|
443
|
+
"draftContext"
|
|
444
|
+
].forEach((e) => {
|
|
445
|
+
let n = t.querySelector(`input[name="${e}"]`)?.value?.trim();
|
|
446
|
+
n && r.append(e, n);
|
|
447
|
+
});
|
|
448
|
+
let i = t.querySelector("input[name=\"CRAFT_CSRF_TOKEN\"]")?.value?.trim();
|
|
449
|
+
i && r.append("CRAFT_CSRF_TOKEN", i), k.log("clearSubmissionOnUnload start.", { requestUrl: n.toString() });
|
|
450
|
+
try {
|
|
451
|
+
if (typeof navigator.sendBeacon == "function" && navigator.sendBeacon(n.toString(), r)) return;
|
|
452
|
+
} catch {}
|
|
453
|
+
fetch(n.toString(), {
|
|
454
|
+
method: "POST",
|
|
455
|
+
body: r,
|
|
456
|
+
credentials: "include",
|
|
457
|
+
keepalive: !0,
|
|
458
|
+
headers: { Accept: "application/json" }
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
async function Ve(e, t) {
|
|
462
|
+
let n = (e.getAttribute("method") || "POST").toUpperCase(), r = e.getAttribute("action") || window.location.href, i = e.dataset.formieErrorMessage?.trim() || "Submission failed.";
|
|
463
|
+
k.log("submitForm start.", {
|
|
464
|
+
method: n,
|
|
465
|
+
action: r,
|
|
466
|
+
submitAction: t.get("submitAction")
|
|
467
|
+
});
|
|
468
|
+
let a = await fetch(r, {
|
|
469
|
+
method: n,
|
|
470
|
+
body: t,
|
|
471
|
+
credentials: "include",
|
|
472
|
+
headers: { Accept: "application/json" }
|
|
473
|
+
}), o = a.headers.get("content-type") || "";
|
|
474
|
+
if (!o.includes("application/json")) return a.ok ? (k.log("submitForm non-JSON success response.", {
|
|
475
|
+
status: a.status,
|
|
476
|
+
contentType: o
|
|
477
|
+
}), {
|
|
478
|
+
ok: !0,
|
|
479
|
+
message: "Submission completed."
|
|
480
|
+
}) : (k.warn("submitForm non-JSON HTTP error.", {
|
|
481
|
+
status: a.status,
|
|
482
|
+
contentType: o
|
|
483
|
+
}), {
|
|
484
|
+
ok: !1,
|
|
485
|
+
code: "HTTP_ERROR",
|
|
486
|
+
message: `Request failed (${a.status}).`,
|
|
487
|
+
formErrors: [`Request failed (${a.status}).`]
|
|
488
|
+
});
|
|
489
|
+
let s = Fe(await a.json(), i);
|
|
490
|
+
return k.log("submitForm JSON response normalized.", {
|
|
491
|
+
ok: s.ok,
|
|
492
|
+
code: s.code,
|
|
493
|
+
hasRedirect: !!s.redirect?.url,
|
|
494
|
+
hasSubmitData: Array.isArray(s.submitData) && s.submitData.length > 0
|
|
495
|
+
}), s;
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/js/submit/pipeline.ts
|
|
499
|
+
var He = [
|
|
500
|
+
"prepare",
|
|
501
|
+
"normalize",
|
|
502
|
+
"validate",
|
|
503
|
+
"screen",
|
|
504
|
+
"authorize",
|
|
505
|
+
"dispatch",
|
|
506
|
+
"finalize"
|
|
507
|
+
], Ue = [
|
|
508
|
+
"prepare",
|
|
509
|
+
"normalize",
|
|
510
|
+
"validate",
|
|
511
|
+
"screen",
|
|
512
|
+
"authorize"
|
|
513
|
+
], A = d("general", "pipeline");
|
|
514
|
+
function We(e, t) {
|
|
515
|
+
return {
|
|
516
|
+
ok: !1,
|
|
517
|
+
stage: e,
|
|
518
|
+
code: "ABORTED",
|
|
519
|
+
message: t || "Submission aborted.",
|
|
520
|
+
formErrors: [t || "Submission aborted."]
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function Ge(e) {
|
|
524
|
+
return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
|
|
525
|
+
}
|
|
526
|
+
function Ke(e) {
|
|
527
|
+
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)));
|
|
528
|
+
}
|
|
529
|
+
function qe(e, t) {
|
|
530
|
+
if (t instanceof HTMLInputElement) {
|
|
531
|
+
if (t.type === "file") {
|
|
532
|
+
Array.from(t.files || []).forEach((n) => {
|
|
533
|
+
e.append(t.name, n);
|
|
534
|
+
});
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
e.append(t.name, t.value);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (t instanceof HTMLSelectElement && t.multiple) {
|
|
541
|
+
Array.from(t.selectedOptions).forEach((n) => {
|
|
542
|
+
e.append(t.name, n.value);
|
|
543
|
+
});
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
e.append(t.name, t.value);
|
|
547
|
+
}
|
|
548
|
+
function Je(e, t) {
|
|
549
|
+
t.querySelectorAll("input, select, textarea").forEach((t) => {
|
|
550
|
+
let n = Ge(t) ? t : null;
|
|
551
|
+
!n || n.closest("[data-formie-page]") || Ke(n) && qe(e, n);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
function Ye(e, t) {
|
|
555
|
+
let n = /* @__PURE__ */ new Set();
|
|
556
|
+
return t.querySelectorAll("input, select, textarea").forEach((t) => {
|
|
557
|
+
let r = Ge(t) ? t : null;
|
|
558
|
+
!r || !r.name || r.disabled || r instanceof HTMLInputElement && (r.type === "submit" || r.type === "button" || r.type === "reset" || r.type === "image") || (r.name.startsWith("fields[") && n.add(r.name), Ke(r) && qe(e, r));
|
|
559
|
+
}), n;
|
|
560
|
+
}
|
|
561
|
+
function Xe(e, t) {
|
|
562
|
+
t.forEach((t) => {
|
|
563
|
+
e.has(t) || e.append(t, "");
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function Ze(e, t) {
|
|
567
|
+
let n = p(e), r = n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || null;
|
|
568
|
+
if (!n.length || !r) {
|
|
569
|
+
let n = new FormData(e);
|
|
570
|
+
return n.set("submitAction", t), n;
|
|
571
|
+
}
|
|
572
|
+
let i = new FormData();
|
|
573
|
+
return Je(i, e), Xe(i, Ye(i, r)), i.set("submitAction", t), i;
|
|
574
|
+
}
|
|
575
|
+
function Qe(e, t) {
|
|
576
|
+
if (t !== "submit") return !1;
|
|
577
|
+
let n = p(e);
|
|
578
|
+
return n.length ? (n.find((e) => !e.hasAttribute("data-formie-page-hidden")) || n[n.length - 1]) === n[n.length - 1] : !0;
|
|
579
|
+
}
|
|
580
|
+
async function $e(e, t, n, r = {}) {
|
|
581
|
+
A.log("Starting submit pipeline.", {
|
|
582
|
+
action: t,
|
|
583
|
+
preflightOnly: r.preflightOnly === !0
|
|
584
|
+
});
|
|
585
|
+
let i = !1, a, o = null, s = Qe(e, t), c = {
|
|
586
|
+
form: e,
|
|
587
|
+
action: t,
|
|
588
|
+
formData: Ze(e, t),
|
|
589
|
+
abort: (e) => {
|
|
590
|
+
i = !0, a = e, A.warn("Pipeline aborted.", { reason: e });
|
|
591
|
+
},
|
|
592
|
+
isAborted: () => i,
|
|
593
|
+
abortReason: () => a
|
|
594
|
+
}, l = {
|
|
595
|
+
prepare: async (e) => {
|
|
596
|
+
let t = e.form.querySelector("input[name=\"submitAction\"]");
|
|
597
|
+
return t && (t.value = e.action), e.formData.set("submitAction", e.action), null;
|
|
598
|
+
},
|
|
599
|
+
normalize: async () => null,
|
|
600
|
+
validate: async (e) => {
|
|
601
|
+
if (e.action !== "submit" || r.validateOnSubmit === !1) return null;
|
|
602
|
+
if (r.validator) {
|
|
603
|
+
let { scope: t, final: n } = h(e.form), i = r.validator.submit(n ? e.form : t, { final: n });
|
|
604
|
+
if (i.length > 0) {
|
|
605
|
+
let e = i[0]?.input;
|
|
606
|
+
if (e) {
|
|
607
|
+
e.scrollIntoView({
|
|
608
|
+
behavior: "smooth",
|
|
609
|
+
block: "center"
|
|
610
|
+
});
|
|
611
|
+
try {
|
|
612
|
+
e.focus({ preventScroll: !0 });
|
|
613
|
+
} catch {
|
|
614
|
+
e.focus();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return {
|
|
618
|
+
ok: !1,
|
|
619
|
+
stage: "validate",
|
|
620
|
+
code: "VALIDATION_FAILED",
|
|
621
|
+
message: r.validator.config.errorMessage || "Validation failed.",
|
|
622
|
+
fieldErrors: r.validator.getFieldErrors(i),
|
|
623
|
+
formErrors: [r.validator.config.errorMessage || "Validation failed."]
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
return null;
|
|
627
|
+
}
|
|
628
|
+
return e.form.checkValidity() ? null : (e.form.querySelector(":invalid")?.focus(), {
|
|
629
|
+
ok: !1,
|
|
630
|
+
stage: "validate",
|
|
631
|
+
code: "VALIDATION_FAILED",
|
|
632
|
+
message: "Validation failed.",
|
|
633
|
+
formErrors: ["Validation failed."]
|
|
634
|
+
});
|
|
635
|
+
},
|
|
636
|
+
screen: async () => null,
|
|
637
|
+
authorize: async () => null,
|
|
638
|
+
dispatch: async (e) => {
|
|
639
|
+
e.formData = Ze(e.form, e.action);
|
|
640
|
+
let t = await Ve(e.form, e.formData);
|
|
641
|
+
return o = t, t;
|
|
642
|
+
},
|
|
643
|
+
finalize: async (e) => (o && o.ok && o.redirect?.url && (o.redirect.target === "new-tab" ? window.open(o.redirect.url, "_blank") : window.location.href = o.redirect.url), null)
|
|
644
|
+
};
|
|
645
|
+
{
|
|
646
|
+
let e = await n.emitSafe("formie:submit:before", c);
|
|
647
|
+
e.failed.length > 0 && A.warn("Submit before listeners failed.", {
|
|
648
|
+
eventName: e.eventName,
|
|
649
|
+
failed: e.failed.length
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
if (s) {
|
|
653
|
+
let e = await n.emitSafe("formie:submit:final:before", c);
|
|
654
|
+
e.failed.length > 0 && A.warn("Final submit before listeners failed.", {
|
|
655
|
+
eventName: e.eventName,
|
|
656
|
+
failed: e.failed.length
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
let u = r.preflightOnly ? Ue : He;
|
|
660
|
+
for (let e of u) {
|
|
661
|
+
if (A.log("Stage start.", {
|
|
662
|
+
stage: e,
|
|
663
|
+
action: t
|
|
664
|
+
}), i) return A.warn("Stage skipped due to abort.", {
|
|
665
|
+
stage: e,
|
|
666
|
+
reason: a
|
|
667
|
+
}), We(e, a);
|
|
668
|
+
{
|
|
669
|
+
let t = await n.emitSafe(`formie:stage:${e}:before`, {
|
|
670
|
+
...c,
|
|
671
|
+
stage: e
|
|
672
|
+
});
|
|
673
|
+
t.failed.length > 0 && A.warn("Stage before listeners failed.", {
|
|
674
|
+
stage: e,
|
|
675
|
+
failed: t.failed.length
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
if (i) {
|
|
679
|
+
let t = We(e, a);
|
|
680
|
+
{
|
|
681
|
+
let r = await n.emitSafe("formie:submit:after", t);
|
|
682
|
+
r.failed.length > 0 && A.warn("Submit after listeners failed (abort before stage).", {
|
|
683
|
+
stage: e,
|
|
684
|
+
failed: r.failed.length
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
if (s) {
|
|
688
|
+
let r = await n.emitSafe("formie:submit:final:after", t);
|
|
689
|
+
r.failed.length > 0 && A.warn("Final submit after listeners failed (abort before stage).", {
|
|
690
|
+
stage: e,
|
|
691
|
+
failed: r.failed.length
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
return A.warn("Aborted after stage before-hooks.", {
|
|
695
|
+
stage: e,
|
|
696
|
+
reason: a
|
|
697
|
+
}), t;
|
|
698
|
+
}
|
|
699
|
+
let r = await l[e](c);
|
|
700
|
+
A.log("Stage runner complete.", {
|
|
701
|
+
stage: e,
|
|
702
|
+
hasResult: !!r,
|
|
703
|
+
ok: r ? r.ok : void 0,
|
|
704
|
+
code: r?.code
|
|
705
|
+
});
|
|
706
|
+
{
|
|
707
|
+
let t = await n.emitSafe(`formie:stage:${e}:after`, {
|
|
708
|
+
...c,
|
|
709
|
+
stage: e,
|
|
710
|
+
result: r
|
|
711
|
+
});
|
|
712
|
+
t.failed.length > 0 && A.warn("Stage after listeners failed.", {
|
|
713
|
+
stage: e,
|
|
714
|
+
failed: t.failed.length
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
if (i) {
|
|
718
|
+
let t = We(e, a);
|
|
719
|
+
{
|
|
720
|
+
let r = await n.emitSafe("formie:submit:after", t);
|
|
721
|
+
r.failed.length > 0 && A.warn("Submit after listeners failed (abort after stage).", {
|
|
722
|
+
stage: e,
|
|
723
|
+
failed: r.failed.length
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
if (s) {
|
|
727
|
+
let r = await n.emitSafe("formie:submit:final:after", t);
|
|
728
|
+
r.failed.length > 0 && A.warn("Final submit after listeners failed (abort after stage).", {
|
|
729
|
+
stage: e,
|
|
730
|
+
failed: r.failed.length
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
return A.warn("Aborted after stage after-hooks.", {
|
|
734
|
+
stage: e,
|
|
735
|
+
reason: a
|
|
736
|
+
}), t;
|
|
737
|
+
}
|
|
738
|
+
if (r && !r.ok) {
|
|
739
|
+
{
|
|
740
|
+
let t = await n.emitSafe("formie:submit:after", r);
|
|
741
|
+
t.failed.length > 0 && A.warn("Submit after listeners failed (failed stage).", {
|
|
742
|
+
stage: e,
|
|
743
|
+
failed: t.failed.length
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
if (s) {
|
|
747
|
+
let t = await n.emitSafe("formie:submit:final:after", r);
|
|
748
|
+
t.failed.length > 0 && A.warn("Final submit after listeners failed (failed stage).", {
|
|
749
|
+
stage: e,
|
|
750
|
+
failed: t.failed.length
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
return A.warn("Pipeline short-circuited by failed stage.", {
|
|
754
|
+
stage: e,
|
|
755
|
+
code: r.code,
|
|
756
|
+
message: r.message
|
|
757
|
+
}), r;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
let d = o || {
|
|
761
|
+
ok: !0,
|
|
762
|
+
stage: r.preflightOnly ? "authorize" : "finalize",
|
|
763
|
+
message: r.preflightOnly ? "Submission preflight completed." : "Submission completed."
|
|
764
|
+
};
|
|
765
|
+
{
|
|
766
|
+
let e = await n.emitSafe("formie:submit:after", d);
|
|
767
|
+
e.failed.length > 0 && A.warn("Submit after listeners failed (success).", { failed: e.failed.length });
|
|
768
|
+
}
|
|
769
|
+
if (s) {
|
|
770
|
+
let e = await n.emitSafe("formie:submit:final:after", d);
|
|
771
|
+
e.failed.length > 0 && A.warn("Final submit after listeners failed (success).", { failed: e.failed.length });
|
|
772
|
+
}
|
|
773
|
+
return A.log("Pipeline completed.", {
|
|
774
|
+
ok: d.ok,
|
|
775
|
+
stage: d.stage,
|
|
776
|
+
code: d.code
|
|
777
|
+
}), d;
|
|
778
|
+
}
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/js/core/field-error-container.ts
|
|
781
|
+
function et(e) {
|
|
782
|
+
return e.querySelector("[data-formie-field-layout]")?.getAttribute("data-formie-error-position")?.trim() === "above" ? "above" : "below";
|
|
783
|
+
}
|
|
784
|
+
function tt(e, t) {
|
|
785
|
+
let n = e.querySelector("[data-formie-field-errors]");
|
|
786
|
+
if (n) return n;
|
|
787
|
+
let r = e.querySelector("[data-formie-field-content]"), i = e.querySelector("[data-formie-field-control]"), a = et(e), o = document.createElement("div");
|
|
788
|
+
return o.setAttribute("data-formie-field-errors", "true"), t?.(o), r && i ? a === "above" ? r.insertBefore(o, i) : r.appendChild(o) : e.appendChild(o), o;
|
|
789
|
+
}
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/js/validation/rules/email.ts
|
|
792
|
+
var nt = {
|
|
793
|
+
rule: ({ input: e, getRule: t }) => !t("email") || !e.value || e.value.length < 1 ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.value),
|
|
794
|
+
message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-validation-email-message") ?? e.getAttribute("data-formie-pattern-email-message") ?? e.getAttribute("data-pattern-email-message") ?? n("{label} is not a valid email address.", { label: t })
|
|
40
795
|
};
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region src/js/validation/rules/shared.ts
|
|
798
|
+
function rt(e) {
|
|
799
|
+
return e?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() || "";
|
|
800
|
+
}
|
|
801
|
+
function it(e) {
|
|
802
|
+
let t = e.getRule("match");
|
|
803
|
+
if (!t || t === !0 || typeof t != "object" || !e.field) return null;
|
|
804
|
+
let n = typeof t.fieldHandle == "string" ? t.fieldHandle.trim() : "";
|
|
805
|
+
if (!n) return null;
|
|
806
|
+
let r = e.form.querySelector(`[data-formie-field-handle="${n}"]`);
|
|
807
|
+
return r ? r.querySelector(e.config.fieldsSelector) : null;
|
|
808
|
+
}
|
|
809
|
+
//#endregion
|
|
810
|
+
//#region src/js/validation/rules.ts
|
|
811
|
+
var at = {
|
|
812
|
+
required: {
|
|
813
|
+
rule: ({ input: e, getRule: t }) => {
|
|
814
|
+
if (!t("required") || e.type === "hidden") return !0;
|
|
815
|
+
if (e.type === "checkbox" || e.type === "radio") {
|
|
816
|
+
let t = e.form?.querySelectorAll(`[name="${e.name}"]:not([type="hidden"]):not([disabled])`) || [];
|
|
817
|
+
return t.length ? Array.from(t).some((e) => e instanceof HTMLInputElement && e.checked) : e instanceof HTMLInputElement ? e.checked : !0;
|
|
818
|
+
}
|
|
819
|
+
return e.value.trim() !== "";
|
|
820
|
+
},
|
|
821
|
+
message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-required-message") ?? e.getAttribute("data-required-message") ?? n("{label} cannot be blank.", { label: t })
|
|
822
|
+
},
|
|
823
|
+
email: nt,
|
|
824
|
+
url: {
|
|
825
|
+
rule: ({ input: e, getRule: t }) => {
|
|
826
|
+
if (!t("url") || !e.value || e.value.length < 1) return !0;
|
|
827
|
+
try {
|
|
828
|
+
return new URL(e.value), !0;
|
|
829
|
+
} catch {
|
|
830
|
+
return !1;
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
message: ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-pattern-url-message") ?? e.getAttribute("data-pattern-url-message") ?? n("{label} is not a valid URL.", { label: t })
|
|
834
|
+
},
|
|
835
|
+
number: {
|
|
836
|
+
rule: ({ input: e, getRule: t }) => {
|
|
837
|
+
let n = t("number");
|
|
838
|
+
if (!n || !e.value || e.value.trim() === "") return !0;
|
|
839
|
+
let r = parseFloat(e.value);
|
|
840
|
+
if (Number.isNaN(r)) return !1;
|
|
841
|
+
if (n !== !0 && typeof n == "object") {
|
|
842
|
+
let e = typeof n.min == "number" ? n.min : null, t = typeof n.max == "number" ? n.max : null;
|
|
843
|
+
if (e !== null && r < e || t !== null && r > t) return !1;
|
|
844
|
+
}
|
|
845
|
+
return !0;
|
|
846
|
+
},
|
|
847
|
+
message: ({ input: e, label: t, getRule: n, t: r }) => {
|
|
848
|
+
let i = n("number"), a = i !== !0 && i && typeof i == "object" && typeof i.min == "number" ? i.min : null, o = i !== !0 && i && typeof i == "object" && typeof i.max == "number" ? i.max : null;
|
|
849
|
+
return a !== null && o !== null ? e.getAttribute("data-formie-validation-number-min-message") ?? r("{label} must be between {min} and {max}.", {
|
|
850
|
+
label: t,
|
|
851
|
+
min: a,
|
|
852
|
+
max: o
|
|
853
|
+
}) : a === null ? o === null ? e.getAttribute("data-formie-validation-number-message") ?? e.getAttribute("data-formie-pattern-number-message") ?? e.getAttribute("data-pattern-number-message") ?? r("{label} is not a valid number.", { label: t }) : e.getAttribute("data-formie-validation-number-max-message") ?? r("{label} must be no greater than {max}.", {
|
|
854
|
+
label: t,
|
|
855
|
+
max: o
|
|
856
|
+
}) : e.getAttribute("data-formie-validation-number-min-message") ?? r("{label} must be no less than {min}.", {
|
|
857
|
+
label: t,
|
|
858
|
+
min: a
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
match: {
|
|
863
|
+
rule: (e) => {
|
|
864
|
+
let t = it(e);
|
|
865
|
+
return t ? t.value === e.input.value : !0;
|
|
866
|
+
},
|
|
867
|
+
message: (e) => {
|
|
868
|
+
let t = it(e)?.closest("[data-formie-field-handle]"), n = rt(t);
|
|
869
|
+
return e.t("{label} must match {value}.", {
|
|
870
|
+
label: e.label,
|
|
871
|
+
value: n
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}, ot = {
|
|
876
|
+
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,})+$/,
|
|
877
|
+
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*)?$/,
|
|
878
|
+
number: /^(?:[-+]?[0-9]*[.,]?[0-9]+)$/,
|
|
879
|
+
color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
|
|
880
|
+
date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,
|
|
881
|
+
time: /^(?:(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]))$/,
|
|
882
|
+
month: /^(?:(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])))$/
|
|
883
|
+
}, j = d("general", "validator");
|
|
884
|
+
function M(e) {
|
|
885
|
+
return !!e && (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement);
|
|
886
|
+
}
|
|
887
|
+
function st(e, t) {
|
|
888
|
+
let n = (e.getAttribute("aria-describedby") || "").trim();
|
|
889
|
+
if (!n) return;
|
|
890
|
+
let r = n.split(/\s+/).filter((e) => e !== t);
|
|
891
|
+
if (r.length) {
|
|
892
|
+
e.setAttribute("aria-describedby", r.join(" "));
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
e.removeAttribute("aria-describedby");
|
|
896
|
+
}
|
|
897
|
+
function ct(e, t) {
|
|
898
|
+
let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
|
|
899
|
+
r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
|
|
900
|
+
}
|
|
901
|
+
function lt(e, t) {
|
|
902
|
+
e.setAttribute("aria-errormessage", t);
|
|
903
|
+
}
|
|
904
|
+
function ut(e, t) {
|
|
905
|
+
e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
|
|
906
|
+
}
|
|
907
|
+
var dt = class {
|
|
908
|
+
constructor(e, t = {}) {
|
|
909
|
+
this.errors = [], this.validators = {}, this.boundListeners = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.submitted = !1, this.initialValues = /* @__PURE__ */ new WeakMap(), this.form = e, this.onBlur = this.blurHandler.bind(this), this.onChange = this.changeHandler.bind(this), this.onInput = this.inputHandler.bind(this), this.config = {
|
|
910
|
+
live: !1,
|
|
911
|
+
errorMessage: "",
|
|
912
|
+
fieldContainerErrorClass: [],
|
|
913
|
+
inputErrorClass: [],
|
|
914
|
+
messagesClass: [],
|
|
915
|
+
messageClass: [],
|
|
916
|
+
fieldsSelector: "input:not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([disabled]), select:not([disabled]), textarea:not([disabled])",
|
|
917
|
+
patterns: ot,
|
|
918
|
+
...t
|
|
919
|
+
}, Object.entries(at).forEach(([e, t]) => {
|
|
920
|
+
this.addValidator(e, t.rule, t.message);
|
|
921
|
+
}), this.init();
|
|
922
|
+
}
|
|
923
|
+
init() {
|
|
924
|
+
j.log("Initializing validator.", {
|
|
925
|
+
formId: this.form.id || null,
|
|
926
|
+
live: this.config.live
|
|
927
|
+
}), this.form.setAttribute("novalidate", "true"), this.inputs().forEach((e) => {
|
|
928
|
+
this.initialValues.set(e, this.getInputValue(e));
|
|
929
|
+
}), this.config.live && this.addEventListeners(), this.emitEvent(document, n("ready"), { validator: this });
|
|
930
|
+
}
|
|
931
|
+
inputs(e = null) {
|
|
932
|
+
if (M(e)) return [e];
|
|
933
|
+
let t = e || this.form;
|
|
934
|
+
return Array.from(t.querySelectorAll(this.config.fieldsSelector)).filter((e) => M(e));
|
|
935
|
+
}
|
|
936
|
+
getInputValue(e) {
|
|
937
|
+
return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? e.checked : e instanceof HTMLInputElement && e.type === "file" ? e.files?.length ? Array.from(e.files).map((e) => e.name).join("|") : "" : e.value ?? "";
|
|
938
|
+
}
|
|
939
|
+
isDirty(e) {
|
|
940
|
+
return this.initialValues.has(e) ? this.getInputValue(e) !== this.initialValues.get(e) : (this.initialValues.set(e, this.getInputValue(e)), !1);
|
|
941
|
+
}
|
|
942
|
+
shouldShowError(e) {
|
|
943
|
+
return this.submitted || this.activated.has(e);
|
|
944
|
+
}
|
|
945
|
+
isValid(e = null, t = {}) {
|
|
946
|
+
return this.validate(e, t).length === 0;
|
|
947
|
+
}
|
|
948
|
+
validate(e = null, t = {}) {
|
|
949
|
+
this.errors = [];
|
|
950
|
+
let n = /* @__PURE__ */ new Set();
|
|
951
|
+
return this.inputs(e).forEach((e) => {
|
|
952
|
+
let r = !1;
|
|
953
|
+
if (!this.isVisible(e, t)) return;
|
|
954
|
+
let i = e.closest("[data-formie-field-handle]"), a = e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? `${i?.getAttribute("data-formie-field-handle") || ""}:${e.name}` : null;
|
|
955
|
+
if (a) {
|
|
956
|
+
if (n.has(a)) return;
|
|
957
|
+
n.add(a);
|
|
958
|
+
}
|
|
959
|
+
this.shouldShowError(e) && this.removeError(e);
|
|
960
|
+
let o = this.getValidatorCallbackOptions(e);
|
|
961
|
+
Object.entries(this.validators).forEach(([t, n]) => {
|
|
962
|
+
if (!n.validate(o)) {
|
|
963
|
+
let i = this.getErrorMessage(e, t, n, o);
|
|
964
|
+
this.shouldShowError(e) && !r && this.showError(e, t, i), this.errors.push({
|
|
965
|
+
input: e,
|
|
966
|
+
field: o.field,
|
|
967
|
+
validator: t,
|
|
968
|
+
message: i,
|
|
969
|
+
handle: o.field?.getAttribute("data-formie-field-handle") || null,
|
|
970
|
+
result: !1
|
|
971
|
+
}), r = !0;
|
|
972
|
+
}
|
|
973
|
+
}), !r && this.shouldShowError(e) && this.removeError(e);
|
|
974
|
+
}), j.log("Validation pass complete.", {
|
|
975
|
+
errorCount: this.errors.length,
|
|
976
|
+
includeHiddenPages: t.includeHiddenPages === !0
|
|
977
|
+
}), this.errors;
|
|
978
|
+
}
|
|
979
|
+
removeAllErrors() {
|
|
980
|
+
this.inputs().forEach((e) => {
|
|
981
|
+
this.removeError(e);
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
removeError(e) {
|
|
985
|
+
let t = e.closest("[data-formie-field-handle]");
|
|
986
|
+
if (!t) {
|
|
987
|
+
e.removeAttribute("aria-invalid");
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
let r = t.querySelector("[data-formie-field-errors]"), i = r?.id || "";
|
|
991
|
+
t.querySelectorAll("[data-formie-field-error]").forEach((e) => {
|
|
992
|
+
e.remove();
|
|
993
|
+
}), r && (r.innerHTML = ""), t.querySelectorAll("input, select, textarea").forEach((e) => {
|
|
994
|
+
let n = e;
|
|
995
|
+
n.removeAttribute("aria-invalid"), this.config.inputErrorClass.length && n.classList.remove(...this.config.inputErrorClass), n.removeAttribute("data-formie-input-has-error"), i && st(n, i), t.querySelectorAll("[data-formie-field-error]").forEach((e) => {
|
|
996
|
+
let t = e.id;
|
|
997
|
+
t && ut(n, t);
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
for (let e = t; e; e = e.parentElement?.closest("[data-formie-field-handle]")) this.config.fieldContainerErrorClass.length && e.classList.remove(...this.config.fieldContainerErrorClass), e.removeAttribute("data-formie-field-has-error");
|
|
1001
|
+
this.emitEvent(e, n("clear-error"), { validator: this }), x(this.form);
|
|
1002
|
+
}
|
|
1003
|
+
showError(e, t, r) {
|
|
1004
|
+
let i = e.closest("[data-formie-field-handle]");
|
|
1005
|
+
if (!i) return;
|
|
1006
|
+
let a = i.querySelector("[data-formie-field-errors]");
|
|
1007
|
+
a ||= tt(i, (e) => {
|
|
1008
|
+
this.config.messagesClass.length && e.classList.add(...this.config.messagesClass);
|
|
1009
|
+
}), this.config.messagesClass.length && a.classList.add(...this.config.messagesClass), a.innerHTML = "";
|
|
1010
|
+
let o = i.getAttribute("data-formie-field-handle") || "field", s = `${o}-error`;
|
|
1011
|
+
a.id = a.id || `${o}-errors`, a.setAttribute("aria-live", "polite"), a.setAttribute("aria-atomic", "true");
|
|
1012
|
+
let c = document.createElement("div");
|
|
1013
|
+
c.setAttribute("data-formie-field-error", "true"), c.setAttribute(`data-formie-field-error-${t}`, "true"), c.setAttribute("id", s), c.setAttribute("role", "alert"), this.config.messageClass.length && c.classList.add(...this.config.messageClass), c.textContent = r, a.appendChild(c), i.setAttribute("data-formie-field-has-error", "true"), i.querySelectorAll("input, select, textarea").forEach((e) => {
|
|
1014
|
+
let t = e;
|
|
1015
|
+
t.setAttribute("aria-invalid", "true"), this.config.inputErrorClass.length && t.classList.add(...this.config.inputErrorClass), t.setAttribute("data-formie-input-has-error", "true"), ct(t, a.id), lt(t, s);
|
|
1016
|
+
});
|
|
1017
|
+
for (let e = i; e; e = e.parentElement?.closest("[data-formie-field-handle]")) this.config.fieldContainerErrorClass.length && e.classList.add(...this.config.fieldContainerErrorClass), e.setAttribute("data-formie-field-has-error", "true");
|
|
1018
|
+
this.emitEvent(e, n("show-error"), {
|
|
1019
|
+
validator: this,
|
|
1020
|
+
validatorName: t,
|
|
1021
|
+
errorMessage: r
|
|
1022
|
+
}), x(this.form);
|
|
1023
|
+
}
|
|
1024
|
+
getValidatorCallbackOptions(e) {
|
|
1025
|
+
let t = e.closest("[data-formie-field-handle]"), n = t?.querySelector("[data-formie-field-label]")?.childNodes[0]?.textContent?.trim() ?? "", r = this.parseValidationRules(t?.getAttribute("data-formie-validation"));
|
|
1026
|
+
return {
|
|
1027
|
+
t: E,
|
|
1028
|
+
input: e,
|
|
1029
|
+
label: n,
|
|
1030
|
+
field: t,
|
|
1031
|
+
form: this.form,
|
|
1032
|
+
config: this.config,
|
|
1033
|
+
rules: r,
|
|
1034
|
+
getRule: (e) => this.getRule(t, e)
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
getErrorMessage(e, t, n, r) {
|
|
1038
|
+
return (typeof n.errorMessage == "function" ? n.errorMessage(r) : n.errorMessage) ?? E("{label} is invalid.", { label: r.label });
|
|
1039
|
+
}
|
|
1040
|
+
getErrors() {
|
|
1041
|
+
return this.errors;
|
|
1042
|
+
}
|
|
1043
|
+
getFieldErrors(e = this.errors) {
|
|
1044
|
+
let t = {};
|
|
1045
|
+
return e.forEach((e) => {
|
|
1046
|
+
!e.handle || t[e.handle]?.length || (t[e.handle] = [e.message]);
|
|
1047
|
+
}), t;
|
|
1048
|
+
}
|
|
1049
|
+
getRule(e, t) {
|
|
1050
|
+
if (!e) return !1;
|
|
1051
|
+
let n = this.parseValidationRules(e.getAttribute("data-formie-validation"));
|
|
1052
|
+
return Object.prototype.hasOwnProperty.call(n, t) ? n[t] : !1;
|
|
1053
|
+
}
|
|
1054
|
+
parseValidationRules(e) {
|
|
1055
|
+
let t = {};
|
|
1056
|
+
if (!e) return t;
|
|
1057
|
+
let n = null;
|
|
1058
|
+
try {
|
|
1059
|
+
n = JSON.parse(e);
|
|
1060
|
+
} catch {
|
|
1061
|
+
return j.warn("Invalid validation rules payload.", { formId: this.form.id || null }), t;
|
|
1062
|
+
}
|
|
1063
|
+
return Array.isArray(n) && n.forEach((e) => {
|
|
1064
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
1065
|
+
let n = e, r = typeof n.type == "string" ? n.type.trim() : "";
|
|
1066
|
+
r && (t[r] = n);
|
|
1067
|
+
}), t;
|
|
1068
|
+
}
|
|
1069
|
+
destroy() {
|
|
1070
|
+
j.log("Destroying validator.", { formId: this.form.id || null }), this.removeEventListeners(), this.form.removeAttribute("novalidate"), this.emitEvent(document, n("destroy"), { validator: this });
|
|
1071
|
+
}
|
|
1072
|
+
isVisible(e, t = {}) {
|
|
1073
|
+
return e.closest("[data-formie-conditionally-hidden]") ? !1 : e.closest("[data-formie-page-hidden]") ? !!t.includeHiddenPages : !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length);
|
|
1074
|
+
}
|
|
1075
|
+
blurHandler(e) {
|
|
1076
|
+
!(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form) || e instanceof CustomEvent || e.target instanceof HTMLInputElement && e.target.type === "file" || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || (this.isDirty(e.target) && this.activated.add(e.target), this.shouldShowError(e.target) && this.validate(e.target));
|
|
1077
|
+
}
|
|
1078
|
+
changeHandler(e) {
|
|
1079
|
+
if (!(!(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form)) && !(e instanceof CustomEvent)) {
|
|
1080
|
+
if (e.target instanceof HTMLSelectElement) {
|
|
1081
|
+
this.activated.add(e.target), this.validate(e.target);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
e.target instanceof HTMLInputElement && (e.target.type !== "file" && e.target.type !== "checkbox" && e.target.type !== "radio" || (this.activated.add(e.target), this.validate(e.target)));
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
inputHandler(e) {
|
|
1088
|
+
!(e.target instanceof HTMLElement) || !M(e.target) || !e.target.form?.isSameNode(this.form) || e instanceof CustomEvent || e.target instanceof HTMLInputElement && (e.target.type === "checkbox" || e.target.type === "radio") || this.shouldShowError(e.target) && this.validate(e.target);
|
|
1089
|
+
}
|
|
1090
|
+
submit(e = null, { final: t = !1 } = {}) {
|
|
1091
|
+
return this.submitted = !0, j.log("Submit validation requested.", { final: t }), this.boundListeners || this.addEventListeners(), this.removeAllErrors(), this.validate(e, { includeHiddenPages: t });
|
|
1092
|
+
}
|
|
1093
|
+
resetLiveState() {
|
|
1094
|
+
this.submitted = !1, this.activated = /* @__PURE__ */ new WeakSet(), this.errors = [], this.removeAllErrors();
|
|
1095
|
+
}
|
|
1096
|
+
addEventListeners() {
|
|
1097
|
+
this.boundListeners || (this.form.addEventListener("blur", this.onBlur, !0), this.form.addEventListener("change", this.onChange, !1), this.form.addEventListener("input", this.onInput, !1), this.boundListeners = !0, j.log("Event listeners attached."));
|
|
1098
|
+
}
|
|
1099
|
+
removeEventListeners() {
|
|
1100
|
+
this.form.removeEventListener("blur", this.onBlur, !0), this.form.removeEventListener("change", this.onChange, !1), this.form.removeEventListener("input", this.onInput, !1), this.boundListeners = !1, j.log("Event listeners removed.");
|
|
1101
|
+
}
|
|
1102
|
+
emitEvent(e, t, n = {}) {
|
|
1103
|
+
e.dispatchEvent(new CustomEvent(t, {
|
|
1104
|
+
bubbles: !0,
|
|
1105
|
+
detail: n
|
|
1106
|
+
}));
|
|
1107
|
+
}
|
|
1108
|
+
addValidator(e, t, n) {
|
|
1109
|
+
this.validators[e] = {
|
|
1110
|
+
validate: t,
|
|
1111
|
+
errorMessage: n
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
removeValidator(e) {
|
|
1115
|
+
delete this.validators[e];
|
|
1116
|
+
}
|
|
1117
|
+
}, N = /* @__PURE__ */ new WeakMap();
|
|
1118
|
+
function ft(e) {
|
|
1119
|
+
return (e.dataset.formieSubmitAction || "").trim();
|
|
1120
|
+
}
|
|
1121
|
+
function pt(e) {
|
|
1122
|
+
return (e.dataset.formieErrorMessagePosition || "top-form").trim() || "top-form";
|
|
1123
|
+
}
|
|
1124
|
+
function mt(e) {
|
|
1125
|
+
return (e.dataset.formieSubmitActionMessagePosition || "").trim();
|
|
1126
|
+
}
|
|
1127
|
+
function ht(e) {
|
|
1128
|
+
let t = (e.dataset.formieSubmitActionMessageTimeout || "").trim();
|
|
1129
|
+
if (!t) return null;
|
|
1130
|
+
let n = Number.parseFloat(t);
|
|
1131
|
+
return !Number.isFinite(n) || n < 0 ? null : Math.round(n * 1e3);
|
|
1132
|
+
}
|
|
1133
|
+
function P(e) {
|
|
1134
|
+
let t = e.dataset.formieSubmitActionFormHide;
|
|
1135
|
+
if (t === void 0) return !1;
|
|
1136
|
+
let n = t.trim().toLowerCase();
|
|
1137
|
+
return n === "true" || n === "1" || n === "";
|
|
1138
|
+
}
|
|
1139
|
+
function gt(e) {
|
|
1140
|
+
let t = N.get(e);
|
|
1141
|
+
typeof t == "number" && (window.clearTimeout(t), N.delete(e));
|
|
1142
|
+
}
|
|
1143
|
+
function _t(e) {
|
|
1144
|
+
return e.querySelector("[data-formie-form-messages-top]") || e;
|
|
1145
|
+
}
|
|
1146
|
+
function vt(e) {
|
|
1147
|
+
return e.querySelector("[data-formie-form-messages-bottom]") || e;
|
|
1148
|
+
}
|
|
1149
|
+
function yt(e, t) {
|
|
1150
|
+
return t === "bottom-form" ? vt(e) : _t(e);
|
|
1151
|
+
}
|
|
1152
|
+
function bt(e, t) {
|
|
1153
|
+
return t === "top-form" ? _t(e) : t === "bottom-form" && !P(e) ? vt(e) : e;
|
|
1154
|
+
}
|
|
1155
|
+
function xt(e) {
|
|
1156
|
+
let t = pt(e), n = yt(e, t), r = n.querySelector("[data-formie-error-container], [data-formie-errors]");
|
|
1157
|
+
return r || (r = document.createElement("div"), r.setAttribute("data-formie-errors", "true"), C(r, e, "errors")), r.setAttribute("data-formie-error-container", "true"), t === "bottom-form" ? n.append(r) : n.prepend(r), r;
|
|
1158
|
+
}
|
|
1159
|
+
function St(e, t) {
|
|
1160
|
+
let n = t.querySelector("[data-formie-error-message-container], [data-formie-message][data-formie-message-error]");
|
|
1161
|
+
return n || (n = document.createElement("div"), n.setAttribute("data-formie-error-message-container", "true"), t.appendChild(n)), n.setAttribute("data-formie-message", "true"), n.setAttribute("data-formie-message-error", "true"), C(n, e, "message", "messageError"), n.setAttribute("role", "alert"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-atomic", "true"), n;
|
|
1162
|
+
}
|
|
1163
|
+
function Ct(e, t) {
|
|
1164
|
+
let n = e.querySelector("[data-formie-success-container]"), r = bt(e, t);
|
|
1165
|
+
return n || (n = document.createElement("div"), n.setAttribute("data-formie-success-container", "true"), C(n, e, "successes")), t === "bottom-form" ? r.append(n) : r.prepend(n), n;
|
|
1166
|
+
}
|
|
1167
|
+
function wt(e) {
|
|
1168
|
+
return tt(e, (t) => {
|
|
1169
|
+
C(t, e, "fieldErrors");
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
function Tt(e, t) {
|
|
1173
|
+
let n = (e.getAttribute("aria-describedby") || "").trim();
|
|
1174
|
+
if (!n) return;
|
|
1175
|
+
let r = n.split(/\s+/).filter((e) => e !== t).join(" ").trim();
|
|
1176
|
+
if (r) {
|
|
1177
|
+
e.setAttribute("aria-describedby", r);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
e.removeAttribute("aria-describedby");
|
|
1181
|
+
}
|
|
1182
|
+
function Et(e, t) {
|
|
1183
|
+
e.setAttribute("aria-errormessage", t);
|
|
1184
|
+
}
|
|
1185
|
+
function Dt(e, t) {
|
|
1186
|
+
e.getAttribute("aria-errormessage") === t && e.removeAttribute("aria-errormessage");
|
|
1187
|
+
}
|
|
1188
|
+
function Ot(e) {
|
|
1189
|
+
e.querySelectorAll("[data-formie-field-handle]").forEach((t) => {
|
|
1190
|
+
let n = t, r = n.querySelector("[data-formie-field-errors]"), i = r?.id || "", a = Array.from(n.querySelectorAll("[data-formie-field-error]")).map((e) => e.id).filter(Boolean);
|
|
1191
|
+
S(n, e, "fieldLayoutError"), n.removeAttribute("data-formie-field-has-error"), n.querySelectorAll("[data-formie-field-error]").forEach((e) => {
|
|
1192
|
+
e.remove();
|
|
1193
|
+
}), r && !r.querySelector("[data-formie-field-error]") && (r.innerHTML = ""), n.querySelectorAll("input, select, textarea").forEach((t) => {
|
|
1194
|
+
let n = t;
|
|
1195
|
+
n.removeAttribute("aria-invalid"), S(n, e, "fieldControlError"), n.removeAttribute("data-formie-input-has-error"), i && Tt(n, i), a.forEach((e) => {
|
|
1196
|
+
Dt(n, e);
|
|
1197
|
+
});
|
|
1198
|
+
});
|
|
1199
|
+
}), x(e);
|
|
1200
|
+
}
|
|
1201
|
+
function kt(e) {
|
|
1202
|
+
e.querySelectorAll("[data-formie-error-container], [data-formie-errors]").forEach((t) => {
|
|
1203
|
+
let n = t;
|
|
1204
|
+
n.querySelectorAll("[data-formie-error]").forEach((e) => {
|
|
1205
|
+
e.remove();
|
|
1206
|
+
}), S(n, e, "message", "messageError"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-error"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-error]") || (n.innerHTML = "");
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
function F(e) {
|
|
1210
|
+
gt(e), e.querySelectorAll("[data-formie-message-success]:not([data-formie-success-container])").forEach((e) => {
|
|
1211
|
+
e.remove();
|
|
1212
|
+
}), e.querySelectorAll("[data-formie-success-container]").forEach((t) => {
|
|
1213
|
+
let n = t;
|
|
1214
|
+
n.querySelectorAll("[data-formie-success]").forEach((e) => {
|
|
1215
|
+
e.remove();
|
|
1216
|
+
}), S(n, e, "message", "messageSuccess"), n.removeAttribute("data-formie-message"), n.removeAttribute("data-formie-message-success"), n.removeAttribute("role"), n.removeAttribute("aria-live"), n.removeAttribute("aria-atomic"), n.querySelector("[data-formie-success]") || (n.innerHTML = "");
|
|
1217
|
+
}), ft(e) === "message" && P(e) || f(e, !1);
|
|
1218
|
+
}
|
|
1219
|
+
function At(e) {
|
|
1220
|
+
e.querySelectorAll("[aria-invalid=\"true\"]").forEach((e) => {
|
|
1221
|
+
e.removeAttribute("aria-invalid");
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
function jt(e, t) {
|
|
1225
|
+
let n = (e.getAttribute("aria-describedby") || "").trim(), r = n ? n.split(/\s+/) : [];
|
|
1226
|
+
r.includes(t) || r.push(t), e.setAttribute("aria-describedby", r.join(" ").trim());
|
|
1227
|
+
}
|
|
1228
|
+
function Mt(e, t) {
|
|
1229
|
+
Object.entries(t).forEach(([t, n]) => {
|
|
1230
|
+
let r = e.querySelector(`[data-formie-field-handle="${t}"]`);
|
|
1231
|
+
if (!r) return;
|
|
1232
|
+
let i = wt(r), a = i.id && i.id.trim() ? i.id : `${t}-errors`;
|
|
1233
|
+
i.id = a, i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), C(r, e, "fieldLayoutError"), r.setAttribute("data-formie-field-has-error", "true"), n.forEach((t, n) => {
|
|
1234
|
+
let r = document.createElement("div");
|
|
1235
|
+
r.setAttribute("data-formie-field-error", "true"), r.setAttribute("role", "alert"), r.id = `${a}-${n + 1}`, C(r, e, "fieldError"), r.textContent = t, i.appendChild(r);
|
|
1236
|
+
});
|
|
1237
|
+
let o = i.querySelector("[data-formie-field-error]")?.id;
|
|
1238
|
+
r.querySelectorAll("input, select, textarea").forEach((t) => {
|
|
1239
|
+
let n = t;
|
|
1240
|
+
n.setAttribute("aria-invalid", "true"), C(n, e, "fieldControlError"), n.setAttribute("data-formie-input-has-error", "true"), jt(n, a), o && Et(n, o);
|
|
1241
|
+
let i = r.querySelector("[data-formie-instructions]");
|
|
1242
|
+
i?.id && jt(n, i.id);
|
|
1243
|
+
});
|
|
1244
|
+
}), x(e);
|
|
1245
|
+
}
|
|
1246
|
+
function Nt(e, t) {
|
|
1247
|
+
let n = xt(e), r = St(e, n);
|
|
1248
|
+
C(n, e, "errors"), t.forEach((t) => {
|
|
1249
|
+
let n = document.createElement("div");
|
|
1250
|
+
n.setAttribute("data-formie-error", "true"), n.setAttribute("role", "alert"), C(n, e, "error"), n.innerHTML = t, r.appendChild(n);
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
function Pt(e, t) {
|
|
1254
|
+
return !t.message || t.nextPage || t.redirect ? !1 : t.action === "save" ? !0 : ft(e) === "message" && mt(e) !== "";
|
|
1255
|
+
}
|
|
1256
|
+
function Ft(e, t) {
|
|
1257
|
+
let n = mt(e);
|
|
1258
|
+
if (!n) return;
|
|
1259
|
+
let r = Ct(e, n);
|
|
1260
|
+
C(r, e, "message", "messageSuccess"), r.setAttribute("data-formie-message", "true"), r.setAttribute("data-formie-message-success", "true"), r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true");
|
|
1261
|
+
let i = document.createElement("div");
|
|
1262
|
+
i.setAttribute("data-formie-success", "true"), C(i, e, "success"), i.innerHTML = t, r.appendChild(i), P(e) && f(e, !0);
|
|
1263
|
+
let a = ht(e);
|
|
1264
|
+
if (a !== null) {
|
|
1265
|
+
let t = window.setTimeout(() => {
|
|
1266
|
+
N.delete(e), F(e);
|
|
1267
|
+
}, a);
|
|
1268
|
+
N.set(e, t);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
function I(e, t) {
|
|
1272
|
+
if (Ot(e), kt(e), F(e), At(e), t.ok) {
|
|
1273
|
+
Pt(e, t) && Ft(e, t.message || "");
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
t.fieldErrors && Mt(e, t.fieldErrors), t.formErrors?.length ? Nt(e, t.formErrors) : !t.fieldErrors && t.message && Nt(e, [t.message]), je(e);
|
|
1277
|
+
}
|
|
1278
|
+
//#endregion
|
|
1279
|
+
//#region src/js/core/submit-flow.ts
|
|
1280
|
+
var It = d("general", "submit-flow");
|
|
1281
|
+
function Lt(e) {
|
|
1282
|
+
return !(!e.ok && e.stage === "validate");
|
|
1283
|
+
}
|
|
1284
|
+
function Rt(e) {
|
|
1285
|
+
return e ? !!(e.keepSubmitLoading === !0 || e.ok && e.redirect?.url && e.redirect.target !== "new-tab") : !1;
|
|
1286
|
+
}
|
|
1287
|
+
function zt(e) {
|
|
1288
|
+
Ot(e), kt(e), F(e), At(e);
|
|
1289
|
+
}
|
|
1290
|
+
async function Bt(e) {
|
|
1291
|
+
let { id: t, target: n, form: r, bus: i, validator: a, validateOnSubmit: o, action: s, submitter: c, waitForSubmitDelay: l, onRefreshTokensAfterSubmit: u, dispatchSubmitResult: d } = e;
|
|
1292
|
+
zt(r), _(r, c || null);
|
|
1293
|
+
let f = {
|
|
1294
|
+
ok: !1,
|
|
1295
|
+
code: "SUBMIT_ERROR",
|
|
1296
|
+
message: "Submission failed.",
|
|
1297
|
+
formErrors: ["Submission failed."]
|
|
1298
|
+
};
|
|
1299
|
+
try {
|
|
1300
|
+
await l(r), f = await $e(r, s, i, {
|
|
1301
|
+
validator: a,
|
|
1302
|
+
validateOnSubmit: o
|
|
1303
|
+
}), I(r, f), v(r, f, s), Lt(f) && await u(f), d(f);
|
|
1304
|
+
} catch (e) {
|
|
1305
|
+
f = {
|
|
1306
|
+
ok: !1,
|
|
1307
|
+
code: "SUBMIT_ERROR",
|
|
1308
|
+
message: e instanceof Error ? e.message : "Submission failed.",
|
|
1309
|
+
formErrors: [e instanceof Error ? e.message : "Submission failed."]
|
|
1310
|
+
}, I(r, f), d(f), It.warn("Submit failed with exception.", {
|
|
1311
|
+
id: t,
|
|
1312
|
+
action: s,
|
|
1313
|
+
target: n,
|
|
1314
|
+
error: e instanceof Error ? e.message : e
|
|
1315
|
+
});
|
|
1316
|
+
} finally {
|
|
1317
|
+
Rt(f) || m(r);
|
|
1318
|
+
}
|
|
1319
|
+
return f;
|
|
1320
|
+
}
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region src/js/modules/registry.ts
|
|
1323
|
+
var Vt = class {
|
|
1324
|
+
constructor() {
|
|
1325
|
+
this.modules = /* @__PURE__ */ new Map();
|
|
1326
|
+
}
|
|
1327
|
+
register(e, t = {}) {
|
|
1328
|
+
let n = this.modules.get(e.id);
|
|
1329
|
+
return n === e ? !0 : n && !t.replace ? (console.warn(`[formie] Module "${e.id}" is already registered. Pass { replace: true } to override the existing definition.`), !1) : (this.modules.set(e.id, e), !0);
|
|
1330
|
+
}
|
|
1331
|
+
unregister(e) {
|
|
1332
|
+
this.modules.delete(e);
|
|
1333
|
+
}
|
|
1334
|
+
get(e) {
|
|
1335
|
+
return this.modules.get(e) || null;
|
|
1336
|
+
}
|
|
1337
|
+
getAll() {
|
|
1338
|
+
return Array.from(this.modules.values());
|
|
1339
|
+
}
|
|
1340
|
+
}, Ht = {
|
|
1341
|
+
"address-finder": () => import("./chunks/address-finder-yXU5yMjG.js").then((e) => e.addressFinderModule),
|
|
1342
|
+
"google-address": () => import("./chunks/google-address-OhKilPWE.js").then((e) => e.googleAddressModule),
|
|
1343
|
+
loqate: () => import("./chunks/loqate-Cp2zvwpE.js").then((e) => e.loqateModule),
|
|
1344
|
+
"place-kit": () => import("./chunks/place-kit-BGHklIZ-.js").then((e) => e.placeKitModule)
|
|
1345
|
+
}, Ut = {
|
|
1346
|
+
"captcha-eu": () => import("./chunks/captcha-eu-CWJb64_j.js").then((e) => e.captchaEuModule),
|
|
1347
|
+
"friendly-captcha-v1": () => import("./chunks/friendly-captcha-v1-ByXzENYZ.js").then((e) => e.friendlyCaptchaV1Module),
|
|
1348
|
+
"friendly-captcha-v2": () => import("./chunks/friendly-captcha-v2-BPdlmhQu.js").then((e) => e.friendlyCaptchaV2Module),
|
|
1349
|
+
hcaptcha: () => import("./chunks/hcaptcha-CdCd9oEi.js").then((e) => e.hcaptchaModule),
|
|
1350
|
+
"recaptcha-enterprise": () => import("./chunks/recaptcha-enterprise-BSwi8IVX.js").then((e) => e.recaptchaEnterpriseModule),
|
|
1351
|
+
"recaptcha-v2-checkbox": () => import("./chunks/recaptcha-v2-checkbox-CnDQmsKa.js").then((e) => e.recaptchaV2CheckboxModule),
|
|
1352
|
+
"recaptcha-v2-invisible": () => import("./chunks/recaptcha-v2-invisible-Cz5uIlp-.js").then((e) => e.recaptchaV2InvisibleModule),
|
|
1353
|
+
"recaptcha-v3": () => import("./chunks/recaptcha-v3-BtbbP111.js").then((e) => e.recaptchaV3Module),
|
|
1354
|
+
snaptcha: () => import("./chunks/snaptcha-vz1RnZ15.js").then((e) => e.snaptchaModule),
|
|
1355
|
+
turnstile: () => import("./chunks/turnstile-D_Pi1CKM.js").then((e) => e.turnstileModule)
|
|
1356
|
+
}, Wt = {
|
|
1357
|
+
calculations: () => import("./chunks/calculations-CeDgB9jt.js").then((e) => e.calculationsModule),
|
|
1358
|
+
"checkbox-radio": () => import("./chunks/checkbox-radio-DQ0H67Tj.js").then((e) => e.checkboxRadioModule),
|
|
1359
|
+
combobox: () => import("./chunks/combobox-D-2b42wn.js").then((e) => e.comboboxModule),
|
|
1360
|
+
conditions: () => import("./chunks/conditions-DjZOtHfS.js").then((e) => e.conditionsModule),
|
|
1361
|
+
"custom-google-maps": () => import("./chunks/custom-google-maps-BsaSirEZ.js").then((e) => e.customGoogleMapsModule),
|
|
1362
|
+
"custom-link": () => import("./chunks/custom-link-CJ1-FjEM.js").then((e) => e.customLinkModule),
|
|
1363
|
+
"custom-maps": () => import("./chunks/custom-maps-DYW_pBid.js").then((e) => e.customMapsModule),
|
|
1364
|
+
"date-picker": () => import("./chunks/date-picker-5CA_-zGb.js").then((e) => e.datePickerModule),
|
|
1365
|
+
"file-upload": () => import("./chunks/file-upload-D49m8-DR.js").then((e) => e.fileUploadModule),
|
|
1366
|
+
"upload-manager": () => import("./chunks/upload-manager-BpqWSHmU.js").then((e) => e.uploadManagerModule),
|
|
1367
|
+
hidden: () => import("./chunks/hidden-D7_Ch-QN.js").then((e) => e.hiddenModule),
|
|
1368
|
+
"phone-country": () => import("./chunks/phone-country-D3ayr60L.js").then((e) => e.phoneCountryModule),
|
|
1369
|
+
"address-country": () => import("./chunks/address-country-Rx6GQTND.js").then((e) => e.addressCountryModule),
|
|
1370
|
+
"address-state": () => import("./chunks/address-state-BQ0xGV9n.js").then((e) => e.addressStateModule),
|
|
1371
|
+
repeater: () => import("./chunks/repeater-B5leVxZU.js").then((e) => e.repeaterModule),
|
|
1372
|
+
"rich-text": () => import("./chunks/rich-text-D0sb8bmX.js").then((e) => e.richTextModule),
|
|
1373
|
+
signature: () => import("./chunks/signature-xz4QO7CR.js").then((e) => e.signatureModule),
|
|
1374
|
+
summary: () => import("./chunks/summary-D3AjxpYN.js").then((e) => e.summaryModule),
|
|
1375
|
+
table: () => import("./chunks/table-C-lkQN6I.js").then((e) => e.tableModule),
|
|
1376
|
+
"text-limit": () => import("./chunks/text-limit-DbgEFHLO.js").then((e) => e.textLimitModule)
|
|
1377
|
+
}, Gt = {
|
|
1378
|
+
bpoint: () => import("./chunks/bpoint-DSjqRv63.js").then((e) => e.bpointModule),
|
|
1379
|
+
eway: () => import("./chunks/eway-D3ctTbEk.js").then((e) => e.ewayModule),
|
|
1380
|
+
"go-cardless": () => import("./chunks/go-cardless-BwASSYSK.js").then((e) => e.goCardlessModule),
|
|
1381
|
+
mollie: () => import("./chunks/mollie-COG-ko2D.js").then((e) => e.mollieModule),
|
|
1382
|
+
moneris: () => import("./chunks/moneris-CMH8PlRc.js").then((e) => e.monerisModule),
|
|
1383
|
+
opayo: () => import("./chunks/opayo-D2jsR5vh.js").then((e) => e.opayoModule),
|
|
1384
|
+
paddle: () => import("./chunks/paddle-DxF88RfC.js").then((e) => e.paddleModule),
|
|
1385
|
+
paypal: () => import("./chunks/paypal-b5pnwrA2.js").then((e) => e.paypalModule),
|
|
1386
|
+
payway: () => import("./chunks/payway-BJYu9DIR.js").then((e) => e.paywayModule),
|
|
1387
|
+
square: () => import("./chunks/square-BP8RWAKB.js").then((e) => e.squareModule),
|
|
1388
|
+
stripe: () => import("./chunks/stripe-MihN63uC.js").then((e) => e.stripeModule)
|
|
1389
|
+
}, Kt = {
|
|
1390
|
+
...Wt,
|
|
1391
|
+
...Ht,
|
|
1392
|
+
...Ut,
|
|
1393
|
+
...Gt
|
|
1394
|
+
}, L = /* @__PURE__ */ new Map(), R = d("general", "loader"), qt = Function("src", "return import(src);");
|
|
1395
|
+
async function z(t, n, i, a) {
|
|
1396
|
+
await t(r(i), a), await t(e(n, i), a);
|
|
1397
|
+
}
|
|
1398
|
+
function Jt(e) {
|
|
1399
|
+
return !!e && typeof e == "object" && typeof e.id == "string" && typeof e.setup == "function" && typeof e.match == "function";
|
|
1400
|
+
}
|
|
1401
|
+
async function Yt(e, t) {
|
|
1402
|
+
let n = Kt[e];
|
|
1403
|
+
return n ? (L.has(e) || L.set(e, (async () => {
|
|
1404
|
+
try {
|
|
1405
|
+
let e = await n();
|
|
1406
|
+
return Jt(e) ? (t.registry.register(e), e) : null;
|
|
1407
|
+
} catch (t) {
|
|
1408
|
+
return console.error("[formie] Failed to load builtin module:", e, t), R.warn("Failed loading builtin module.", {
|
|
1409
|
+
moduleId: e,
|
|
1410
|
+
error: t
|
|
1411
|
+
}), null;
|
|
1412
|
+
}
|
|
1413
|
+
})()), L.get(e) || null) : null;
|
|
1414
|
+
}
|
|
1415
|
+
async function Xt(e) {
|
|
1416
|
+
try {
|
|
1417
|
+
let t = await qt(e), n = t?.default || t?.formieModule || null;
|
|
1418
|
+
return Jt(n) ? n : null;
|
|
1419
|
+
} catch (t) {
|
|
1420
|
+
return console.error("[formie] Failed to load module from src:", e, t), R.warn("Failed loading module from src.", {
|
|
1421
|
+
src: e,
|
|
1422
|
+
error: t
|
|
1423
|
+
}), null;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
async function Zt(e, t) {
|
|
1427
|
+
let n = t.registry.get(e.id);
|
|
1428
|
+
if (n) return n;
|
|
1429
|
+
let r = await Yt(e.id, t);
|
|
1430
|
+
if (r) return r;
|
|
1431
|
+
if (e.src) {
|
|
1432
|
+
let n = await Xt(e.src);
|
|
1433
|
+
if (n) return t.registry.register(n), n;
|
|
1434
|
+
}
|
|
1435
|
+
return null;
|
|
1436
|
+
}
|
|
1437
|
+
function B(e) {
|
|
1438
|
+
return typeof window.CSS?.escape == "function" ? window.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
1439
|
+
}
|
|
1440
|
+
function V(e, t) {
|
|
1441
|
+
return e.matches(t) ? [e, ...Array.from(e.querySelectorAll(t))] : Array.from(e.querySelectorAll(t));
|
|
1442
|
+
}
|
|
1443
|
+
function Qt(e, t) {
|
|
1444
|
+
let n = t.setupContext.root, r = t.setupContext.form, i = e.targetType, a = e.targetId;
|
|
1445
|
+
return i === "selector" ? V(n, a).map((e) => ({
|
|
1446
|
+
scope: i,
|
|
1447
|
+
element: e
|
|
1448
|
+
})) : i === "field" ? V(n, `[data-formie-field-handle="${B(a)}"]`).map((e) => ({
|
|
1449
|
+
scope: i,
|
|
1450
|
+
element: e
|
|
1451
|
+
})) : i === "page" ? V(n, `[data-formie-page-id="${B(a)}"]`).map((e) => ({
|
|
1452
|
+
scope: i,
|
|
1453
|
+
element: e
|
|
1454
|
+
})) : i === "button" ? V(n, `[data-formie-action="${B(a)}"]`).map((e) => ({
|
|
1455
|
+
scope: i,
|
|
1456
|
+
element: e
|
|
1457
|
+
})) : [{
|
|
1458
|
+
scope: "form",
|
|
1459
|
+
element: r || n
|
|
1460
|
+
}];
|
|
1461
|
+
}
|
|
1462
|
+
function $t(e, t) {
|
|
1463
|
+
return (e.targets && e.targets.length > 0 ? e.targets : [{
|
|
1464
|
+
targetType: "form",
|
|
1465
|
+
targetId: "form"
|
|
1466
|
+
}]).flatMap((e) => Qt(e, t));
|
|
1467
|
+
}
|
|
1468
|
+
async function en(e, t) {
|
|
1469
|
+
let n = [];
|
|
1470
|
+
R.log("Loading module manifest.", { manifestCount: e.length });
|
|
1471
|
+
for (let r of e) {
|
|
1472
|
+
let e = await Zt(r, t);
|
|
1473
|
+
if (!e) {
|
|
1474
|
+
R.warn("Skipping manifest item (definition not resolved).", {
|
|
1475
|
+
moduleId: r.id,
|
|
1476
|
+
src: r.src
|
|
1477
|
+
});
|
|
1478
|
+
continue;
|
|
1479
|
+
}
|
|
1480
|
+
let i = $t(r, t);
|
|
1481
|
+
R.log("Resolved module targets.", {
|
|
1482
|
+
moduleId: e.id,
|
|
1483
|
+
targets: r.targets || [],
|
|
1484
|
+
targetCount: i.length
|
|
1485
|
+
}), i.length === 0 && e.kind === "address" && console.warn(`[formie] Address module "${r.id}" skipped: no target element found for fieldHandle="${r.targets?.find((e) => e.targetType === "field")?.targetId ?? "?"}". Check that the Address field exists in the rendered form.`);
|
|
1486
|
+
for (let a of i) {
|
|
1487
|
+
let i = {
|
|
1488
|
+
...t.matchContext,
|
|
1489
|
+
target: a.element,
|
|
1490
|
+
scope: a.scope,
|
|
1491
|
+
manifestItem: r
|
|
1492
|
+
};
|
|
1493
|
+
if (!e.match(i)) {
|
|
1494
|
+
e.kind === "address" && console.warn(`[formie] Address module "${e.id}" skipped: target element does not contain [data-formie-address-autocomplete-input]. Enable the Auto-Complete subfield.`), R.log("Module target did not match predicate.", {
|
|
1495
|
+
moduleId: e.id,
|
|
1496
|
+
scope: a.scope
|
|
1497
|
+
});
|
|
1498
|
+
continue;
|
|
1499
|
+
}
|
|
1500
|
+
let o = r.config || t.setupContext.options, s = e.id, c = {
|
|
1501
|
+
moduleId: e.id,
|
|
1502
|
+
moduleKind: e.kind,
|
|
1503
|
+
target: a.element,
|
|
1504
|
+
scope: a.scope,
|
|
1505
|
+
options: o,
|
|
1506
|
+
manifestItem: r
|
|
1507
|
+
};
|
|
1508
|
+
await z(t.setupContext.emit, s, "before-setup", c);
|
|
1509
|
+
let l = null;
|
|
1510
|
+
try {
|
|
1511
|
+
let n = await e.setup({
|
|
1512
|
+
...t.setupContext,
|
|
1513
|
+
target: a.element,
|
|
1514
|
+
scope: a.scope,
|
|
1515
|
+
options: o
|
|
1516
|
+
});
|
|
1517
|
+
n && (l = n);
|
|
1518
|
+
} catch (t) {
|
|
1519
|
+
console.error(`[formie] Module "${e.id}" setup failed:`, t), R.warn("Module setup failed.", {
|
|
1520
|
+
moduleId: e.id,
|
|
1521
|
+
scope: a.scope,
|
|
1522
|
+
error: t
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
await z(t.setupContext.emit, s, "after-setup", {
|
|
1526
|
+
...c,
|
|
1527
|
+
instanceCreated: !!l
|
|
1528
|
+
}), l && (R.log("Module instance created.", {
|
|
1529
|
+
moduleId: e.id,
|
|
1530
|
+
scope: a.scope
|
|
1531
|
+
}), n.push({
|
|
1532
|
+
...l,
|
|
1533
|
+
destroy: async () => {
|
|
1534
|
+
R.log("Destroying module instance.", {
|
|
1535
|
+
moduleId: e.id,
|
|
1536
|
+
scope: a.scope
|
|
1537
|
+
}), await z(t.setupContext.emit, s, "before-destroy", c), await l.destroy(), await z(t.setupContext.emit, s, "after-destroy", c), R.log("Module instance destroyed.", {
|
|
1538
|
+
moduleId: e.id,
|
|
1539
|
+
scope: a.scope
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
}));
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
return R.log("Module manifest processing complete.", { instanceCount: n.length }), n;
|
|
1546
|
+
}
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/js/utils/unload-warning.ts
|
|
1549
|
+
var tn = new Set([
|
|
1550
|
+
"CRAFT_CSRF_TOKEN",
|
|
1551
|
+
"action",
|
|
1552
|
+
"redirect",
|
|
1553
|
+
"requestToken",
|
|
1554
|
+
"renderId",
|
|
1555
|
+
"submitAction",
|
|
1556
|
+
"pageId",
|
|
1557
|
+
"draftContextToken",
|
|
1558
|
+
"draftContext",
|
|
1559
|
+
"continuationToken"
|
|
1560
|
+
]);
|
|
1561
|
+
function nn(e, t) {
|
|
1562
|
+
if (e == null) return String(e);
|
|
1563
|
+
if (typeof e == "string") return JSON.stringify(e);
|
|
1564
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1565
|
+
if (typeof e == "function") return "[function]";
|
|
1566
|
+
if (typeof File < "u" && e instanceof File) return `[file:${e.name}:${e.size}:${e.type}]`;
|
|
1567
|
+
if (typeof Blob < "u" && e instanceof Blob) return `[blob:${e.size}:${e.type}]`;
|
|
1568
|
+
if (Array.isArray(e)) return `[${e.map((e) => nn(e, t)).join(",")}]`;
|
|
1569
|
+
if (typeof e == "object") {
|
|
1570
|
+
if (t.has(e)) return "[circular]";
|
|
1571
|
+
t.add(e);
|
|
1572
|
+
let n = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => `${JSON.stringify(e)}:${nn(n, t)}`);
|
|
1573
|
+
return t.delete(e), `{${n.join(",")}}`;
|
|
1574
|
+
}
|
|
1575
|
+
return JSON.stringify(String(e));
|
|
1576
|
+
}
|
|
1577
|
+
function rn(e) {
|
|
1578
|
+
return nn(e, /* @__PURE__ */ new WeakSet());
|
|
1579
|
+
}
|
|
1580
|
+
function an(e) {
|
|
1581
|
+
if (!e) return !1;
|
|
1582
|
+
let t = e.endsWith("[]") ? e.slice(0, -2) : e;
|
|
1583
|
+
return !tn.has(t);
|
|
1584
|
+
}
|
|
1585
|
+
function on(e) {
|
|
1586
|
+
return rn(Array.from(new FormData(e).entries()).filter(([e]) => an(String(e || ""))));
|
|
1587
|
+
}
|
|
1588
|
+
function sn(e, t = {}) {
|
|
1589
|
+
let n = null, r = !1, i = !1, a = null, o = null, s = null, c = () => {
|
|
1590
|
+
a !== null && (window.cancelAnimationFrame(a), a = null), o !== null && (window.clearTimeout(o), o = null), s !== null && (window.clearTimeout(s), s = null);
|
|
1591
|
+
}, l = () => r ? (i = on(e) !== n, i) : !1, u = () => {
|
|
1592
|
+
n = on(e), r = !0, i = !1;
|
|
1593
|
+
}, d = () => {
|
|
1594
|
+
c(), r = !1, a = window.requestAnimationFrame(() => {
|
|
1595
|
+
a = null, s = window.setTimeout(() => {
|
|
1596
|
+
s = null, u();
|
|
1597
|
+
}, 0);
|
|
1598
|
+
});
|
|
1599
|
+
}, f = () => {
|
|
1600
|
+
o !== null && window.clearTimeout(o), o = window.setTimeout(() => {
|
|
1601
|
+
o = null, l();
|
|
1602
|
+
}, 120);
|
|
1603
|
+
}, p = (e) => {
|
|
1604
|
+
t.shouldWarn && !t.shouldWarn() || l() && (e.preventDefault(), e.returnValue = "");
|
|
1605
|
+
};
|
|
1606
|
+
return e.addEventListener("input", f), e.addEventListener("change", f), window.addEventListener("beforeunload", p), d(), {
|
|
1607
|
+
captureBaseline: u,
|
|
1608
|
+
scheduleBaselineCapture: d,
|
|
1609
|
+
refreshDirtyState: l,
|
|
1610
|
+
destroy: () => {
|
|
1611
|
+
c(), e.removeEventListener("input", f), e.removeEventListener("change", f), window.removeEventListener("beforeunload", p);
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region src/js/core/create-formie-client.ts
|
|
1617
|
+
var H = "[data-formie]:not([data-formie-init=\"false\"]), [data-formie-form]:not([data-formie-init=\"false\"])", cn = 300, ln = "/actions/formie/server/forms/render", un = "/api", dn = "/actions/formie/server/forms/refresh-tokens", fn = "/actions/formie/server/submissions/submit", pn = "/actions/formie/server/submissions/set-page", mn = "/actions/formie/server/submissions/clear-submission", hn = "/actions/formie/file-upload/hydrate", U = d("general", "client"), gn = /* @__PURE__ */ new Set();
|
|
1618
|
+
function W(e, t) {
|
|
1619
|
+
if (e == null || e === "") return t;
|
|
1620
|
+
let n = e.toLowerCase();
|
|
1621
|
+
return !(n === "false" || n === "0" || n === "off");
|
|
1622
|
+
}
|
|
1623
|
+
function _n(e) {
|
|
1624
|
+
return e.formieRefreshTokens != null && e.formieRefreshTokens !== "" ? W(e.formieRefreshTokens, !1) : e.formieStaticCache != null && e.formieStaticCache !== "" ? W(e.formieStaticCache, !1) : !1;
|
|
1625
|
+
}
|
|
1626
|
+
function G(e) {
|
|
1627
|
+
let t = e instanceof HTMLElement ? e.dataset : {};
|
|
1628
|
+
return {
|
|
1629
|
+
mode: "server-rendered",
|
|
1630
|
+
transport: t.formieTransport || "rest",
|
|
1631
|
+
formHandle: t.formieHandle,
|
|
1632
|
+
endpoint: t.formieEndpoint,
|
|
1633
|
+
staticCache: _n(t),
|
|
1634
|
+
autoVisible: W(t.formieAutoVisible, !0),
|
|
1635
|
+
compatibility: W(t.formieCompatibility, !1)
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
function K(e) {
|
|
1639
|
+
return e || "server-rendered";
|
|
1640
|
+
}
|
|
1641
|
+
function q(e) {
|
|
1642
|
+
return e || "rest";
|
|
1643
|
+
}
|
|
1644
|
+
function J(e) {
|
|
1645
|
+
return e instanceof HTMLFormElement ? e : e.querySelector("form");
|
|
1646
|
+
}
|
|
1647
|
+
function vn(e, t) {
|
|
1648
|
+
gn.has(e) || (gn.add(e), U.warn(t));
|
|
1649
|
+
}
|
|
1650
|
+
function yn(e, t) {
|
|
1651
|
+
if (!e) return e;
|
|
1652
|
+
try {
|
|
1653
|
+
return new URL(e).toString();
|
|
1654
|
+
} catch {}
|
|
1655
|
+
if (!t) return e;
|
|
1656
|
+
try {
|
|
1657
|
+
return new URL(e, t).toString();
|
|
1658
|
+
} catch {
|
|
1659
|
+
return e;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function Y(e, t) {
|
|
1663
|
+
let n = (e || "").trim();
|
|
1664
|
+
return n ? n.includes("/actions/") ? n : yn(t, n) : t;
|
|
1665
|
+
}
|
|
1666
|
+
function bn(e, t) {
|
|
1667
|
+
return Y(e.endpoint || t.dataset.formieEndpoint, ln);
|
|
1668
|
+
}
|
|
1669
|
+
function xn(e, t) {
|
|
1670
|
+
let n = (e.endpoint || t.dataset.formieEndpoint || "").trim();
|
|
1671
|
+
return n ? n.includes("/graphql") || n.endsWith("/api") || n.includes("/actions/graphql/") ? n : yn(un, n) : un;
|
|
1672
|
+
}
|
|
1673
|
+
function Sn(e, t) {
|
|
1674
|
+
return Y(t.dataset.formieRefreshTokensEndpoint || e.endpoint || t.dataset.formieEndpoint, dn);
|
|
1675
|
+
}
|
|
1676
|
+
function Cn(e, t) {
|
|
1677
|
+
if (!e) return t;
|
|
1678
|
+
try {
|
|
1679
|
+
let n = new URL(e, window.location.origin), r = new URL(t, window.location.origin);
|
|
1680
|
+
return n.searchParams.forEach((e, t) => {
|
|
1681
|
+
r.searchParams.has(t) || r.searchParams.set(t, e);
|
|
1682
|
+
}), r.toString();
|
|
1683
|
+
} catch {
|
|
1684
|
+
return t;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function wn(e, t, n) {
|
|
1688
|
+
let r = n.endpoint || e.dataset.formieEndpoint, i = Y(r, fn), a = t.getAttribute("action");
|
|
1689
|
+
t.setAttribute("action", Cn(a, i)), t.querySelectorAll("[data-formie-tab-link]").forEach((e) => {
|
|
1690
|
+
let t = e.getAttribute("href"), n = Y(r, pn);
|
|
1691
|
+
e.setAttribute("href", Cn(t, n));
|
|
1692
|
+
}), t.querySelectorAll("[data-formie-file-upload-hydrate-endpoint]").forEach((e) => {
|
|
1693
|
+
e.setAttribute("data-formie-file-upload-hydrate-endpoint", Y(r, hn));
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
function Tn(e, t) {
|
|
1697
|
+
if (e === "graphql" && t !== "server-rendered") throw Error(`Formie ${t} mode does not support GraphQL transport yet.`);
|
|
1698
|
+
}
|
|
1699
|
+
function En(e) {
|
|
1700
|
+
if (e == null) return !1;
|
|
1701
|
+
let t = e.trim().toLowerCase();
|
|
1702
|
+
return t === "true" || t === "1" || t === "";
|
|
1703
|
+
}
|
|
1704
|
+
function Dn(e) {
|
|
1705
|
+
return W(e.dataset.formieAutomaticSubmissionState, !0);
|
|
1706
|
+
}
|
|
1707
|
+
function On(e, t, n) {
|
|
1708
|
+
return Y(n.dataset.formieClearSubmissionEndpoint || e.endpoint || t.dataset.formieEndpoint, mn);
|
|
1709
|
+
}
|
|
1710
|
+
function kn(e) {
|
|
1711
|
+
return En(e.dataset.formieUnloadWarning);
|
|
1712
|
+
}
|
|
1713
|
+
function An(e, t) {
|
|
1714
|
+
e.setAttribute("data-formie-internal-navigation", t);
|
|
1715
|
+
}
|
|
1716
|
+
function jn(e) {
|
|
1717
|
+
e.removeAttribute("data-formie-internal-navigation");
|
|
1718
|
+
}
|
|
1719
|
+
function Mn(e) {
|
|
1720
|
+
return e.getAttribute("data-formie-internal-navigation") !== null;
|
|
1721
|
+
}
|
|
1722
|
+
function Nn(e, t) {
|
|
1723
|
+
if (!e) return !1;
|
|
1724
|
+
try {
|
|
1725
|
+
return new URL(e, window.location.origin).searchParams.has(t);
|
|
1726
|
+
} catch {
|
|
1727
|
+
return !1;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
function Pn(e) {
|
|
1731
|
+
return Nn(window.location.href, "resumeToken") || Nn(e.getAttribute("action"), "resumeToken");
|
|
1732
|
+
}
|
|
1733
|
+
function Fn(e) {
|
|
1734
|
+
return e instanceof MouseEvent ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey : !0;
|
|
1735
|
+
}
|
|
1736
|
+
function In(e, t = 0) {
|
|
1737
|
+
if (!e) return t;
|
|
1738
|
+
let n = Number.parseInt(e, 10);
|
|
1739
|
+
return Number.isFinite(n) ? n : t;
|
|
1740
|
+
}
|
|
1741
|
+
function Ln(e) {
|
|
1742
|
+
return Math.max(0, In(e.dataset.formieSubmitDelay, cn));
|
|
1743
|
+
}
|
|
1744
|
+
function X(e) {
|
|
1745
|
+
return En(e.dataset.formieValidationOnSubmit);
|
|
1746
|
+
}
|
|
1747
|
+
async function Z(e) {
|
|
1748
|
+
let t = Ln(e);
|
|
1749
|
+
t < 1 || await new Promise((e) => {
|
|
1750
|
+
window.setTimeout(e, t);
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
function Rn(e, t) {
|
|
1754
|
+
let n = e?.getAttribute(t)?.trim();
|
|
1755
|
+
if (!n) return null;
|
|
1756
|
+
try {
|
|
1757
|
+
return JSON.parse(n);
|
|
1758
|
+
} catch (e) {
|
|
1759
|
+
return console.error(`[formie] Failed to parse ${t}.`, e), null;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
function zn(e, t) {
|
|
1763
|
+
let n = t || (e instanceof HTMLFormElement ? e : null);
|
|
1764
|
+
if (!n) return null;
|
|
1765
|
+
let r = Rn(n, "data-formie-modules"), i = Rn(n, "data-formie-theme");
|
|
1766
|
+
return !r && !i ? null : {
|
|
1767
|
+
modules: r || void 0,
|
|
1768
|
+
theme: i || void 0
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
function Bn(e) {
|
|
1772
|
+
if (!(e instanceof HTMLElement)) return !0;
|
|
1773
|
+
if (!e.isConnected || e.hidden || e.closest("[hidden]")) return !1;
|
|
1774
|
+
let t = window.getComputedStyle(e);
|
|
1775
|
+
return t.display === "none" || t.visibility === "hidden" ? !1 : e.getClientRects().length > 0;
|
|
1776
|
+
}
|
|
1777
|
+
function Vn(e, t) {
|
|
1778
|
+
return t === document ? !0 : t instanceof Element ? t === e || t.contains(e) : !0;
|
|
1779
|
+
}
|
|
1780
|
+
function Q(e) {
|
|
1781
|
+
let t = e, n = t.id ? `#${t.id}` : "", r = t.dataset?.formieHandle ? `[handle="${t.dataset.formieHandle}"]` : "";
|
|
1782
|
+
return `${t.tagName ? t.tagName.toLowerCase() : "element"}${n}${r}`;
|
|
1783
|
+
}
|
|
1784
|
+
function Hn(e, t) {
|
|
1785
|
+
if (t) {
|
|
1786
|
+
if (t.csrf?.param && t.csrf?.token) {
|
|
1787
|
+
let n = e.querySelector(`input[name="${t.csrf.param}"]`);
|
|
1788
|
+
n && (n.value = t.csrf.token);
|
|
1789
|
+
}
|
|
1790
|
+
if (t.requestToken) {
|
|
1791
|
+
let n = e.querySelector("input[name=\"requestToken\"]");
|
|
1792
|
+
n && (n.value = t.requestToken);
|
|
1793
|
+
}
|
|
1794
|
+
if (t.renderId) {
|
|
1795
|
+
let n = e.querySelector("input[name=\"renderId\"]");
|
|
1796
|
+
n && (n.value = t.renderId);
|
|
1797
|
+
}
|
|
1798
|
+
t.captchas && typeof t.captchas == "object" && Object.values(t.captchas).forEach((t) => {
|
|
1799
|
+
if (!t || typeof t != "object") return;
|
|
1800
|
+
let n = t;
|
|
1801
|
+
if (!n.sessionKey) return;
|
|
1802
|
+
let r = e.querySelector(`input[name="${n.sessionKey}"]`);
|
|
1803
|
+
r && typeof n.value == "string" && (r.value = n.value);
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
async function Un(e, t) {
|
|
1808
|
+
let n = K(t.mode), r = q(t.transport);
|
|
1809
|
+
if (n !== "server-rendered") return null;
|
|
1810
|
+
if (t.payload) return t.payload.html && (e.innerHTML = t.payload.html), t.payload;
|
|
1811
|
+
Tn(r, n);
|
|
1812
|
+
let i = !!J(e), a = t.formHandle || e.dataset.formieHandle;
|
|
1813
|
+
if (i || !a) return null;
|
|
1814
|
+
let o = {
|
|
1815
|
+
mode: n,
|
|
1816
|
+
endpoint: t.endpoint,
|
|
1817
|
+
locale: t.locale,
|
|
1818
|
+
siteId: t.siteId,
|
|
1819
|
+
theme: t.theme,
|
|
1820
|
+
themeConfig: t.themeConfig
|
|
1821
|
+
}, s = r === "graphql" ? xn(t, e) : bn(t, e), c = r === "graphql" ? await Le(s, a, o) : await Ie(s, a, {
|
|
1822
|
+
...o,
|
|
1823
|
+
endpoint: s
|
|
1824
|
+
});
|
|
1825
|
+
return c?.html && (e.innerHTML = c.html), c;
|
|
1826
|
+
}
|
|
1827
|
+
async function Wn(e, t, n) {
|
|
1828
|
+
if (t.refreshTokens === !1) return;
|
|
1829
|
+
Tn(q(t.transport), K(t.mode));
|
|
1830
|
+
let r = t.formHandle || e.dataset.formieHandle;
|
|
1831
|
+
if (!r) return;
|
|
1832
|
+
let i = await Re(Sn(t, e), r, n.querySelector("input[name=\"renderId\"]")?.value || void 0);
|
|
1833
|
+
Hn(n, i), O(e, "formie:refresh-tokens:refreshed", i);
|
|
1834
|
+
}
|
|
1835
|
+
function Gn(e, t, n, r, i, a) {
|
|
1836
|
+
let o = String(t.dataset.formieSubmitMethod || "").trim().toLowerCase(), s = On(n, e, t), c = !1, l = t.querySelectorAll("[data-formie-action]"), u = (e) => {
|
|
1837
|
+
if (e) {
|
|
1838
|
+
t.setAttribute("data-formie-pending-action", e);
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
t.removeAttribute("data-formie-pending-action");
|
|
1842
|
+
};
|
|
1843
|
+
if (kn(t)) {
|
|
1844
|
+
let n = sn(t, { shouldWarn: () => !Mn(t) }), r = (e) => {
|
|
1845
|
+
if (!(e instanceof CustomEvent)) return;
|
|
1846
|
+
let t = e.detail;
|
|
1847
|
+
t?.ok && t.action === "save" && n.scheduleBaselineCapture();
|
|
1848
|
+
}, i = () => {
|
|
1849
|
+
n.scheduleBaselineCapture();
|
|
1850
|
+
};
|
|
1851
|
+
e.addEventListener("formie:submit:result", r), t.addEventListener("formie:state:reset", i), a.push(() => {
|
|
1852
|
+
e.removeEventListener("formie:submit:result", r), t.removeEventListener("formie:state:reset", i), n.destroy();
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
if (l.forEach((e) => {
|
|
1856
|
+
let n = (e) => {
|
|
1857
|
+
let n = e.currentTarget.getAttribute("data-formie-action"), r = t.querySelector("input[name=\"submitAction\"]");
|
|
1858
|
+
u(n), n && r && (r.value = n);
|
|
1859
|
+
};
|
|
1860
|
+
e.addEventListener("click", n), a.push(() => {
|
|
1861
|
+
e.removeEventListener("click", n);
|
|
1862
|
+
});
|
|
1863
|
+
}), t.querySelectorAll("[data-formie-tab-link]").forEach((n) => {
|
|
1864
|
+
let r = async (n) => {
|
|
1865
|
+
if (o !== "ajax") {
|
|
1866
|
+
Fn(n) && An(t, "set-page");
|
|
1867
|
+
return;
|
|
1868
|
+
}
|
|
1869
|
+
n.preventDefault();
|
|
1870
|
+
let r = n.currentTarget, i = r?.getAttribute("data-formie-page-id"), a = r?.getAttribute("href");
|
|
1871
|
+
if (!(!i || !a)) {
|
|
1872
|
+
g(t, i), O(e, "formie:page:navigate", {
|
|
1873
|
+
pageId: i,
|
|
1874
|
+
href: a
|
|
1875
|
+
});
|
|
1876
|
+
try {
|
|
1877
|
+
O(e, "formie:page:navigate:after", {
|
|
1878
|
+
pageId: i,
|
|
1879
|
+
href: a,
|
|
1880
|
+
response: await ze(a, t, i)
|
|
1881
|
+
});
|
|
1882
|
+
} catch (t) {
|
|
1883
|
+
console.error("[formie] Failed to persist page navigation state.", t), O(e, "formie:page:navigate:error", {
|
|
1884
|
+
pageId: i,
|
|
1885
|
+
href: a,
|
|
1886
|
+
error: t
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1891
|
+
n.addEventListener("click", r), a.push(() => {
|
|
1892
|
+
n.removeEventListener("click", r);
|
|
1893
|
+
});
|
|
1894
|
+
}), !Dn(t)) {
|
|
1895
|
+
let e = !1, n = () => {
|
|
1896
|
+
e || Mn(t) || Pn(t) || (e = !0, Be(s, t));
|
|
1897
|
+
};
|
|
1898
|
+
window.addEventListener("pagehide", n), window.addEventListener("beforeunload", n), a.push(() => {
|
|
1899
|
+
window.removeEventListener("pagehide", n), window.removeEventListener("beforeunload", n);
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
let d = async (a) => {
|
|
1903
|
+
if (c) return;
|
|
1904
|
+
let s = o === "ajax";
|
|
1905
|
+
if (a.preventDefault(), t.getAttribute("data-formie-loading") === "true") {
|
|
1906
|
+
if (t.getAttribute("data-formie-internal-resubmit") !== "true") return;
|
|
1907
|
+
t.removeAttribute("data-formie-internal-resubmit");
|
|
1908
|
+
} else t.removeAttribute("data-formie-internal-resubmit");
|
|
1909
|
+
let l = a.submitter, d = l?.getAttribute("data-formie-action"), f = t.getAttribute("data-formie-pending-action"), p = t.querySelector("input[name=\"submitAction\"]"), g = d || f || p?.value || "submit", v = null, y = !1;
|
|
1910
|
+
try {
|
|
1911
|
+
if (s) v = await Bt({
|
|
1912
|
+
target: e,
|
|
1913
|
+
form: t,
|
|
1914
|
+
bus: r,
|
|
1915
|
+
validator: i,
|
|
1916
|
+
validateOnSubmit: X(t),
|
|
1917
|
+
action: g,
|
|
1918
|
+
submitter: l,
|
|
1919
|
+
waitForSubmitDelay: Z,
|
|
1920
|
+
onRefreshTokensAfterSubmit: async () => {
|
|
1921
|
+
await Wn(e, n, t);
|
|
1922
|
+
},
|
|
1923
|
+
dispatchSubmitResult: (t) => {
|
|
1924
|
+
O(e, "formie:submit:result", t);
|
|
1925
|
+
}
|
|
1926
|
+
});
|
|
1927
|
+
else {
|
|
1928
|
+
if (zt(t), _(t, l), await Z(t), v = await $e(t, g, r, {
|
|
1929
|
+
validator: i,
|
|
1930
|
+
validateOnSubmit: X(t),
|
|
1931
|
+
preflightOnly: !0
|
|
1932
|
+
}), v.ok) {
|
|
1933
|
+
ee(t, g), c = !0, An(t, "submit"), u(null);
|
|
1934
|
+
let e = !1, n = () => {
|
|
1935
|
+
if (e = !0, c = !1, jn(t), m(t), i && X(t)) {
|
|
1936
|
+
let { scope: e, final: n } = h(t), r = i.submit(n ? t : e, { final: n });
|
|
1937
|
+
r.length > 0 && I(t, {
|
|
1938
|
+
ok: !1,
|
|
1939
|
+
stage: "validate",
|
|
1940
|
+
code: "VALIDATION_FAILED",
|
|
1941
|
+
message: i.config.errorMessage || "Validation failed.",
|
|
1942
|
+
fieldErrors: i.getFieldErrors(r),
|
|
1943
|
+
formErrors: [i.config.errorMessage || "Validation failed."]
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
if (typeof t.requestSubmit == "function") {
|
|
1948
|
+
t.addEventListener("invalid", n, !0);
|
|
1949
|
+
try {
|
|
1950
|
+
t.requestSubmit();
|
|
1951
|
+
} finally {
|
|
1952
|
+
t.removeEventListener("invalid", n, !0);
|
|
1953
|
+
}
|
|
1954
|
+
} else t.submit();
|
|
1955
|
+
if (e) return;
|
|
1956
|
+
y = !0;
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
I(t, v), O(e, "formie:submit:result", v), jn(t);
|
|
1960
|
+
}
|
|
1961
|
+
} catch (n) {
|
|
1962
|
+
c = !1, v = {
|
|
1963
|
+
ok: !1,
|
|
1964
|
+
code: "SUBMIT_ERROR",
|
|
1965
|
+
message: n instanceof Error ? n.message : "Submission failed.",
|
|
1966
|
+
formErrors: [n instanceof Error ? n.message : "Submission failed."]
|
|
1967
|
+
}, I(t, v), O(e, "formie:submit:result", v), jn(t);
|
|
1968
|
+
} finally {
|
|
1969
|
+
u(null), !s && !y && !Rt(v) && m(t);
|
|
1970
|
+
}
|
|
1971
|
+
};
|
|
1972
|
+
t.addEventListener("submit", d), a.push(() => {
|
|
1973
|
+
t.removeEventListener("submit", d);
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
async function Kn(e, t, n) {
|
|
1977
|
+
if (t.refreshTokens === !1 || !t.staticCache) return;
|
|
1978
|
+
Tn(q(t.transport), K(t.mode));
|
|
1979
|
+
let r = t.formHandle || e.dataset.formieHandle, i = Sn(t, e), a = n?.querySelector("input[name=\"renderId\"]")?.value || void 0;
|
|
1980
|
+
if (!r) return;
|
|
1981
|
+
let o = await Re(i, r, a);
|
|
1982
|
+
!o || !n || (Hn(n, o), O(e, "formie:refresh-tokens:after", o));
|
|
1983
|
+
}
|
|
1984
|
+
function qn() {
|
|
1985
|
+
let e = /* @__PURE__ */ new Map(), t = new Vt(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [
|
|
1986
|
+
"prepare",
|
|
1987
|
+
"normalize",
|
|
1988
|
+
"validate",
|
|
1989
|
+
"screen",
|
|
1990
|
+
"authorize",
|
|
1991
|
+
"dispatch",
|
|
1992
|
+
"finalize"
|
|
1993
|
+
], a = async (t) => {
|
|
1994
|
+
let i = r.get(t);
|
|
1995
|
+
if (i) {
|
|
1996
|
+
await i;
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
let a = (async () => {
|
|
2000
|
+
U.log("Unmount requested.", { target: Q(t) });
|
|
2001
|
+
let r = n.get(t);
|
|
2002
|
+
r && (r(), n.delete(t));
|
|
2003
|
+
let i = e.get(t);
|
|
2004
|
+
if (!i) {
|
|
2005
|
+
U.log("Unmount skipped (no mounted state).", { target: Q(t) });
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
O(t, "formie:unmount:before", { id: i.instance.id }), i.unbinds.forEach((e) => {
|
|
2009
|
+
e();
|
|
2010
|
+
}), i.unbinds = [], i.validator?.destroy(), i.validator = null;
|
|
2011
|
+
for (let e of i.modules) await e.destroy();
|
|
2012
|
+
i.modules = [], i.bus.clear(), e.delete(t), O(t, "formie:unmount:after", { id: i.instance.id }), U.log("Unmount complete.", {
|
|
2013
|
+
id: i.instance.id,
|
|
2014
|
+
target: Q(t)
|
|
2015
|
+
});
|
|
2016
|
+
})().finally(() => {
|
|
2017
|
+
r.delete(t);
|
|
2018
|
+
});
|
|
2019
|
+
r.set(t, a), await a;
|
|
2020
|
+
}, o = async (r, o) => {
|
|
2021
|
+
U.log("Mount requested.", {
|
|
2022
|
+
target: Q(r),
|
|
2023
|
+
mode: o.mode,
|
|
2024
|
+
autoVisible: o.autoVisible
|
|
2025
|
+
});
|
|
2026
|
+
let s = n.get(r);
|
|
2027
|
+
s && (s(), n.delete(r));
|
|
2028
|
+
let c = e.get(r);
|
|
2029
|
+
if (c) return U.log("Mount skipped (already mounted).", {
|
|
2030
|
+
id: c.instance.id,
|
|
2031
|
+
target: Q(r)
|
|
2032
|
+
}), c.instance;
|
|
2033
|
+
let l = new Me(), u = [], d = r?.id || `formie-${e.size + 1}`, f = G(r), p = {
|
|
2034
|
+
...f,
|
|
2035
|
+
...o,
|
|
2036
|
+
mode: K(o.mode ?? f.mode),
|
|
2037
|
+
transport: q(o.transport ?? f.transport)
|
|
2038
|
+
}, ee = _e(p.compatibility);
|
|
2039
|
+
if (p.mode !== "server-rendered" && !J(r)) throw Error(`Formie ${p.mode} mode is not implemented yet in the browser client.`);
|
|
2040
|
+
let m = await Un(r, p), h = J(r);
|
|
2041
|
+
p.staticCache = o.staticCache ?? _n(h ? h.dataset : r.dataset);
|
|
2042
|
+
let g = zn(r, h), _ = m || g ? {
|
|
2043
|
+
...m || {},
|
|
2044
|
+
...g || {}
|
|
2045
|
+
} : null, v = _?.theme, b = {}, S = (_?.modules || []).filter((e) => !!e?.id && !!e?.type);
|
|
2046
|
+
U.log("Resolved mount payload.", {
|
|
2047
|
+
target: Q(r),
|
|
2048
|
+
hasRenderPayload: !!m,
|
|
2049
|
+
hasEmbeddedPayload: !!g,
|
|
2050
|
+
moduleCount: S.length
|
|
2051
|
+
});
|
|
2052
|
+
let C = te(r, v, h), w = h ? new dt(h, {
|
|
2053
|
+
live: En(h.dataset.formieValidationOnFocus),
|
|
2054
|
+
errorMessage: h.dataset.formieErrorMessage || "",
|
|
2055
|
+
fieldContainerErrorClass: C.fieldLayoutError || [],
|
|
2056
|
+
inputErrorClass: C.fieldControlError || [],
|
|
2057
|
+
messagesClass: C.fieldErrors || [],
|
|
2058
|
+
messageClass: C.fieldError || []
|
|
2059
|
+
}) : null;
|
|
2060
|
+
if (h && w) {
|
|
2061
|
+
let e = h;
|
|
2062
|
+
e.formieValidation = w, b.validation = w;
|
|
2063
|
+
let t = {
|
|
2064
|
+
validator: w,
|
|
2065
|
+
addValidator: w.addValidator.bind(w),
|
|
2066
|
+
removeValidator: w.removeValidator.bind(w)
|
|
2067
|
+
};
|
|
2068
|
+
O(h, "formie:validator:ready", t), O(r, "formie:validator:ready", t);
|
|
2069
|
+
}
|
|
2070
|
+
h && ((m || p.endpoint || r.dataset.formieEndpoint) && wn(r, h, p), p.mode === "server-rendered" && Ae(h) && (ke(h), je(h)), x(h)), Object.keys(C).length && O(r, "formie:theme:applied", { hasClasses: !0 });
|
|
2071
|
+
let T = await en(S, {
|
|
2072
|
+
registry: t,
|
|
2073
|
+
matchContext: {
|
|
2074
|
+
root: r,
|
|
2075
|
+
form: h,
|
|
2076
|
+
mode: p.mode
|
|
2077
|
+
},
|
|
2078
|
+
setupContext: {
|
|
2079
|
+
formId: d,
|
|
2080
|
+
root: r,
|
|
2081
|
+
form: h,
|
|
2082
|
+
target: r,
|
|
2083
|
+
scope: "form",
|
|
2084
|
+
state: b,
|
|
2085
|
+
on: (e, t) => l.on(e, t),
|
|
2086
|
+
emit: (e, t) => (O(r, e, t), l.emitSafe(e, t).then((t) => {
|
|
2087
|
+
t.failed.length > 0 && U.warn("Lifecycle listeners failed.", {
|
|
2088
|
+
eventName: e,
|
|
2089
|
+
failed: t.failed.length
|
|
2090
|
+
});
|
|
2091
|
+
}))
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
U.log("Module setup complete.", {
|
|
2095
|
+
target: Q(r),
|
|
2096
|
+
moduleInstances: T.length
|
|
2097
|
+
});
|
|
2098
|
+
let E = {
|
|
2099
|
+
id: d,
|
|
2100
|
+
root: r,
|
|
2101
|
+
submit: async (e = "submit") => {
|
|
2102
|
+
if (U.log("Submit requested.", {
|
|
2103
|
+
id: d,
|
|
2104
|
+
target: Q(r),
|
|
2105
|
+
action: e
|
|
2106
|
+
}), !h) return {
|
|
2107
|
+
ok: !1,
|
|
2108
|
+
code: "FORM_NOT_FOUND",
|
|
2109
|
+
message: "No form element found for mount target.",
|
|
2110
|
+
formErrors: ["No form element found for mount target."]
|
|
2111
|
+
};
|
|
2112
|
+
let t = h.querySelector("input[name=\"submitAction\"]");
|
|
2113
|
+
if (t && (t.value = e), h.getAttribute("data-formie-loading") === "true") return {
|
|
2114
|
+
ok: !1,
|
|
2115
|
+
code: "SUBMIT_IN_PROGRESS",
|
|
2116
|
+
message: "Submission already in progress.",
|
|
2117
|
+
formErrors: []
|
|
2118
|
+
};
|
|
2119
|
+
let n = h.querySelector(`[data-formie-action="${e}"]`), i = await Bt({
|
|
2120
|
+
id: d,
|
|
2121
|
+
target: r,
|
|
2122
|
+
form: h,
|
|
2123
|
+
bus: l,
|
|
2124
|
+
validator: w,
|
|
2125
|
+
validateOnSubmit: X(h),
|
|
2126
|
+
action: e,
|
|
2127
|
+
submitter: n,
|
|
2128
|
+
waitForSubmitDelay: Z,
|
|
2129
|
+
onRefreshTokensAfterSubmit: async () => {
|
|
2130
|
+
await Wn(r, p, h);
|
|
2131
|
+
},
|
|
2132
|
+
dispatchSubmitResult: (e) => {
|
|
2133
|
+
O(r, "formie:submit:result", e);
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
return U.log("Submit completed.", {
|
|
2137
|
+
id: d,
|
|
2138
|
+
action: e,
|
|
2139
|
+
ok: i.ok,
|
|
2140
|
+
code: i.code,
|
|
2141
|
+
message: i.message
|
|
2142
|
+
}), i;
|
|
2143
|
+
},
|
|
2144
|
+
destroy: async () => {
|
|
2145
|
+
await a(r);
|
|
2146
|
+
},
|
|
2147
|
+
on: (e, t) => l.on(e, t)
|
|
2148
|
+
};
|
|
2149
|
+
h && (we({
|
|
2150
|
+
target: r,
|
|
2151
|
+
form: h,
|
|
2152
|
+
validatorDetail: w ? {
|
|
2153
|
+
validator: w,
|
|
2154
|
+
addValidator: w.addValidator.bind(w),
|
|
2155
|
+
removeValidator: w.removeValidator.bind(w)
|
|
2156
|
+
} : null,
|
|
2157
|
+
options: ee,
|
|
2158
|
+
unbinds: u
|
|
2159
|
+
}), Se({
|
|
2160
|
+
target: r,
|
|
2161
|
+
form: h,
|
|
2162
|
+
instance: E,
|
|
2163
|
+
options: ee,
|
|
2164
|
+
unbinds: u
|
|
2165
|
+
})), h && (Gn(r, h, p, l, w, u), w && u.push(y(h, w, r)), await Kn(r, p, h)), i.forEach((e) => {
|
|
2166
|
+
let t = l.on(`formie:stage:${e}:before`, async (t) => {
|
|
2167
|
+
O(r, `formie:stage:${e}:before`, t);
|
|
2168
|
+
}), n = l.on(`formie:stage:${e}:before`, async (e) => {
|
|
2169
|
+
for (let t of T) t.onBeforeStage && await t.onBeforeStage(e);
|
|
2170
|
+
}), i = l.on(`formie:stage:${e}:after`, async (t) => {
|
|
2171
|
+
O(r, `formie:stage:${e}:after`, t);
|
|
2172
|
+
}), a = l.on(`formie:stage:${e}:after`, async (e) => {
|
|
2173
|
+
let t = e;
|
|
2174
|
+
for (let e of T) e.onAfterStage && await e.onAfterStage(t, t.result);
|
|
2175
|
+
});
|
|
2176
|
+
u.push(t, n, i, a);
|
|
2177
|
+
});
|
|
2178
|
+
let ne = l.on("formie:submit:before", async (e) => {
|
|
2179
|
+
O(r, "formie:submit:before", e);
|
|
2180
|
+
}), re = l.on("formie:submit:after", async (e) => {
|
|
2181
|
+
O(r, "formie:submit:after", e);
|
|
2182
|
+
}), ie = l.on("formie:submit:final:before", async (e) => {
|
|
2183
|
+
O(r, "formie:submit:final:before", e);
|
|
2184
|
+
}), ae = l.on("formie:submit:final:after", async (e) => {
|
|
2185
|
+
O(r, "formie:submit:final:after", e);
|
|
2186
|
+
});
|
|
2187
|
+
return u.push(ne, re, ie, ae), e.set(r, {
|
|
2188
|
+
options: p,
|
|
2189
|
+
bus: l,
|
|
2190
|
+
form: h,
|
|
2191
|
+
validator: w,
|
|
2192
|
+
modules: T,
|
|
2193
|
+
unbinds: u,
|
|
2194
|
+
instance: E
|
|
2195
|
+
}), O(r, "formie:mount:after", {
|
|
2196
|
+
id: d,
|
|
2197
|
+
mode: p.mode
|
|
2198
|
+
}), U.log("Mount complete.", {
|
|
2199
|
+
id: d,
|
|
2200
|
+
target: Q(r),
|
|
2201
|
+
mode: p.mode
|
|
2202
|
+
}), E;
|
|
2203
|
+
}, s = (t, r) => {
|
|
2204
|
+
if (!r.autoVisible || Bn(t) || typeof IntersectionObserver > "u") return o(t, r);
|
|
2205
|
+
if (e.has(t)) return Promise.resolve(e.get(t)?.instance || null);
|
|
2206
|
+
if (n.has(t)) return U.log("Mount deferred (already waiting visibility).", { target: Q(t) }), Promise.resolve(null);
|
|
2207
|
+
let i = new IntersectionObserver((e) => {
|
|
2208
|
+
e.some((e) => e.target === t && e.isIntersecting) && (i.disconnect(), n.delete(t), U.log("Visibility reached, proceeding mount.", { target: Q(t) }), o(t, {
|
|
2209
|
+
...r,
|
|
2210
|
+
autoVisible: !1
|
|
2211
|
+
}));
|
|
2212
|
+
}, { threshold: .01 });
|
|
2213
|
+
return i.observe(t), n.set(t, () => {
|
|
2214
|
+
i.disconnect();
|
|
2215
|
+
}), U.log("Mount deferred until visible.", { target: Q(t) }), Promise.resolve(null);
|
|
2216
|
+
};
|
|
2217
|
+
return {
|
|
2218
|
+
mount: o,
|
|
2219
|
+
unmount: a,
|
|
2220
|
+
update: async (t, n) => {
|
|
2221
|
+
let r = e.get(t);
|
|
2222
|
+
if (!r) return o(t, {
|
|
2223
|
+
...G(t),
|
|
2224
|
+
...n,
|
|
2225
|
+
mode: n.mode || "server-rendered"
|
|
2226
|
+
});
|
|
2227
|
+
r.options = {
|
|
2228
|
+
...r.options,
|
|
2229
|
+
...n
|
|
2230
|
+
};
|
|
2231
|
+
let i = te(t, n.payload?.theme || r.options.payload?.theme || zn(t, r.form)?.theme, r.form);
|
|
2232
|
+
return r.validator && (r.validator.config.fieldContainerErrorClass = i.fieldLayoutError || [], r.validator.config.inputErrorClass = i.fieldControlError || [], r.validator.config.messagesClass = i.fieldErrors || [], r.validator.config.messageClass = i.fieldError || []), Object.keys(i).length && O(t, "formie:theme:applied", {
|
|
2233
|
+
hasClasses: !0,
|
|
2234
|
+
reason: "update"
|
|
2235
|
+
}), r.instance;
|
|
2236
|
+
},
|
|
2237
|
+
getInstance: (t) => e.get(t)?.instance || null,
|
|
2238
|
+
refreshForCache: async (t) => {
|
|
2239
|
+
vn("refreshForCache", "Global `Formie.refreshForCache()` has been deprecated. Use built-in static-cache token refresh handling instead.");
|
|
2240
|
+
let n = null;
|
|
2241
|
+
if (n = typeof t == "string" ? document.getElementById(t) || document.querySelector(`[data-formie-form-id="${t}"]`) : t, !n) {
|
|
2242
|
+
U.warn("refreshForCache target not found.", { targetOrId: t });
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
let r = e.get(n), i = J(n), a = r?.options || G(n);
|
|
2246
|
+
if (!i) {
|
|
2247
|
+
U.warn("refreshForCache found no form element for target.", { target: Q(n) });
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2250
|
+
let o = a.formHandle || n.dataset.formieHandle || i.dataset.formieHandle, s = Sn(a, n), c = i.querySelector("input[name=\"renderId\"]")?.value || void 0;
|
|
2251
|
+
if (!o) {
|
|
2252
|
+
U.warn("refreshForCache found no form handle for target.", { target: Q(n) });
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
let l = await Re(s, o, c);
|
|
2256
|
+
l && (Hn(i, l), O(n, "formie:refresh-tokens:after", l));
|
|
2257
|
+
},
|
|
2258
|
+
registerModule: (e, n) => t.register(e, n),
|
|
2259
|
+
unregisterModule: (e) => {
|
|
2260
|
+
t.unregister(e);
|
|
2261
|
+
},
|
|
2262
|
+
getRegisteredModules: () => t.getAll(),
|
|
2263
|
+
scan: async (e) => {
|
|
2264
|
+
let t = e || document, n = Array.from(t.querySelectorAll(H));
|
|
2265
|
+
U.log("Scan started.", {
|
|
2266
|
+
scope: t === document ? "document" : t,
|
|
2267
|
+
targetCount: n.length
|
|
2268
|
+
});
|
|
2269
|
+
let r = (await Promise.all(n.map((e) => s(e, G(e))))).filter((e) => !!e);
|
|
2270
|
+
return U.log("Scan finished.", {
|
|
2271
|
+
mountedCount: r.length,
|
|
2272
|
+
deferredCount: n.length - r.length
|
|
2273
|
+
}), r;
|
|
2274
|
+
},
|
|
2275
|
+
observe: (t) => {
|
|
2276
|
+
if (typeof MutationObserver > "u") return () => {};
|
|
2277
|
+
let r = t || document;
|
|
2278
|
+
U.log("Observer started.", { scope: r === document ? "document" : r });
|
|
2279
|
+
let i = new MutationObserver((t) => {
|
|
2280
|
+
t.forEach((t) => {
|
|
2281
|
+
t.addedNodes.forEach((e) => {
|
|
2282
|
+
e instanceof Element && (e.matches(H) && (U.log("Observer detected new root.", { target: Q(e) }), s(e, G(e))), e.querySelectorAll(H).forEach((e) => {
|
|
2283
|
+
U.log("Observer detected new nested root.", { target: Q(e) }), s(e, G(e));
|
|
2284
|
+
}));
|
|
2285
|
+
}), t.removedNodes.forEach((t) => {
|
|
2286
|
+
t instanceof Element && (e.has(t) && (U.log("Observer detected removed root.", { target: Q(t) }), a(t)), t.querySelectorAll(H).forEach((t) => {
|
|
2287
|
+
e.has(t) && (U.log("Observer detected removed nested root.", { target: Q(t) }), a(t));
|
|
2288
|
+
}));
|
|
2289
|
+
});
|
|
2290
|
+
});
|
|
2291
|
+
});
|
|
2292
|
+
return i.observe(r, {
|
|
2293
|
+
childList: !0,
|
|
2294
|
+
subtree: !0
|
|
2295
|
+
}), () => {
|
|
2296
|
+
i.disconnect(), U.log("Observer stopped."), n.forEach((e, t) => {
|
|
2297
|
+
Vn(t, r) && (e(), n.delete(t));
|
|
2298
|
+
});
|
|
2299
|
+
let t = [];
|
|
2300
|
+
r instanceof Element && r.matches(H) && t.push(r), r.querySelectorAll(H).forEach((e) => {
|
|
2301
|
+
t.push(e);
|
|
2302
|
+
}), t.forEach((t) => {
|
|
2303
|
+
e.has(t) && a(t);
|
|
2304
|
+
});
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
//#endregion
|
|
2310
|
+
//#region src/js/core/hydrate-modules.ts
|
|
2311
|
+
var Jn = d("general", "module-hydrator");
|
|
2312
|
+
async function Yn(e) {
|
|
2313
|
+
let t = e.root, n = e.form ?? (t instanceof HTMLFormElement ? t : t.closest("form")), r = e.modules ?? [], i = e.mode ?? "server-rendered", a = e.registry ?? new Vt(), o = new Me(), s = await en(r, {
|
|
2314
|
+
registry: a,
|
|
2315
|
+
setupContext: {
|
|
2316
|
+
formId: n?.id || t.id || "formie-modules",
|
|
2317
|
+
root: t,
|
|
2318
|
+
form: n,
|
|
2319
|
+
target: t,
|
|
2320
|
+
scope: "form",
|
|
2321
|
+
state: {},
|
|
2322
|
+
options: {},
|
|
2323
|
+
on: (e, t) => o.on(e, t),
|
|
2324
|
+
emit: async (e, t) => {
|
|
2325
|
+
await o.emit(e, t);
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2328
|
+
matchContext: {
|
|
2329
|
+
root: t,
|
|
2330
|
+
form: n,
|
|
2331
|
+
mode: i
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
return Jn.log("Hydrated module manifest.", {
|
|
2335
|
+
moduleCount: r.length,
|
|
2336
|
+
instanceCount: s.length,
|
|
2337
|
+
mode: i
|
|
2338
|
+
}), {
|
|
2339
|
+
destroy: async () => {
|
|
2340
|
+
await Xn(s), o.clear();
|
|
2341
|
+
},
|
|
2342
|
+
on: (e, t) => o.on(e, t),
|
|
2343
|
+
emit: async (e, t) => {
|
|
2344
|
+
await o.emit(e, t);
|
|
2345
|
+
},
|
|
2346
|
+
registerModule: (e, t = {}) => a.register(e, t),
|
|
2347
|
+
unregisterModule: (e) => {
|
|
2348
|
+
a.unregister(e);
|
|
2349
|
+
},
|
|
2350
|
+
getRegisteredModules: () => a.getAll()
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2353
|
+
async function Xn(e) {
|
|
2354
|
+
for (let t of e) try {
|
|
2355
|
+
await t.destroy();
|
|
2356
|
+
} catch (e) {
|
|
2357
|
+
console.error("[formie] Failed to destroy module instance.", e), Jn.warn("Failed destroying module instance.", { error: e });
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
//#endregion
|
|
2361
|
+
//#region src/js/core/formie.ts
|
|
2362
|
+
function $(e) {
|
|
2363
|
+
return e instanceof Element;
|
|
2364
|
+
}
|
|
2365
|
+
function Zn(e) {
|
|
2366
|
+
return e.ok;
|
|
2367
|
+
}
|
|
2368
|
+
function Qn(e) {
|
|
2369
|
+
return typeof e == "string" ? `selector "${e}"` : $(e) ? `element "${e.tagName.toLowerCase()}"` : "provided element collection";
|
|
2370
|
+
}
|
|
2371
|
+
function $n(e) {
|
|
2372
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2373
|
+
for (let r of e) !$(r) || t.has(r) || (t.add(r), n.push(r));
|
|
2374
|
+
return n;
|
|
2375
|
+
}
|
|
2376
|
+
function er(e) {
|
|
2377
|
+
return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : $(e) ? [e] : $n(e);
|
|
2378
|
+
}
|
|
2379
|
+
function tr() {
|
|
2380
|
+
return document.readyState === "loading" ? new Promise((e) => {
|
|
2381
|
+
document.addEventListener("DOMContentLoaded", () => e(), { once: !0 });
|
|
2382
|
+
}) : Promise.resolve();
|
|
2383
|
+
}
|
|
2384
|
+
async function nr(e) {
|
|
2385
|
+
let t = er(e);
|
|
2386
|
+
return t.length > 0 || typeof e != "string" ? t : (await tr(), er(e));
|
|
2387
|
+
}
|
|
2388
|
+
function rr(e) {
|
|
2389
|
+
return typeof e == "string" ? document : $(e) ? e.getRootNode() : document;
|
|
2390
|
+
}
|
|
2391
|
+
function ir(e) {
|
|
2392
|
+
let { element: t, observe: n, allowEmpty: r, client: i, onReady: a, onResult: o, onSuccess: s, onError: c, onEvent: l, ...u } = e;
|
|
2393
|
+
return {
|
|
2394
|
+
mode: "server-rendered",
|
|
2395
|
+
...u
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2398
|
+
async function ar(e, t, n, r) {
|
|
2399
|
+
let i = [], o = ir(e);
|
|
2400
|
+
for (let s of r) {
|
|
2401
|
+
let r = n.get(s);
|
|
2402
|
+
if (r) {
|
|
2403
|
+
i.push(r.instance);
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
let c = await t.mount(s, o), l = [];
|
|
2407
|
+
if (e.onReady?.(c), l.push(c.on("formie:submit:result", (t) => {
|
|
2408
|
+
let n = t;
|
|
2409
|
+
e.onResult?.(n, c), Zn(n) ? e.onSuccess?.(n, c) : e.onError?.(n, c);
|
|
2410
|
+
})), e.onEvent) for (let t of a) l.push(c.on(t, (n) => {
|
|
2411
|
+
e.onEvent?.({
|
|
2412
|
+
name: t,
|
|
2413
|
+
payload: n
|
|
2414
|
+
}, c);
|
|
2415
|
+
}));
|
|
2416
|
+
n.set(s, {
|
|
2417
|
+
instance: c,
|
|
2418
|
+
unsubs: l
|
|
2419
|
+
}), i.push(c);
|
|
2420
|
+
}
|
|
2421
|
+
return i;
|
|
2422
|
+
}
|
|
2423
|
+
async function or(e) {
|
|
2424
|
+
let t = e.client ?? qn(), n = /* @__PURE__ */ new Map(), r = await nr(e.element);
|
|
2425
|
+
if (r.length === 0 && !e.allowEmpty) throw Error(`Formie could not find any elements for ${Qn(e.element)}.`);
|
|
2426
|
+
await ar(e, t, n, r);
|
|
2427
|
+
let i = e.observe ? t.observe(rr(e.element)) : null;
|
|
2428
|
+
return {
|
|
2429
|
+
client: t,
|
|
2430
|
+
get instances() {
|
|
2431
|
+
return Array.from(n.values()).map(({ instance: e }) => e);
|
|
2432
|
+
},
|
|
2433
|
+
get(e) {
|
|
2434
|
+
let r = typeof e == "string" ? document.querySelector(e) : e;
|
|
2435
|
+
return r ? n.get(r)?.instance ?? t.getInstance(r) : null;
|
|
2436
|
+
},
|
|
2437
|
+
async rescan() {
|
|
2438
|
+
let r = er(e.element);
|
|
2439
|
+
return r.length === 0 ? Array.from(n.values()).map(({ instance: e }) => e) : ar(e, t, n, r);
|
|
2440
|
+
},
|
|
2441
|
+
async destroy() {
|
|
2442
|
+
i?.();
|
|
2443
|
+
let e = Array.from(n.entries());
|
|
2444
|
+
for (let [r, i] of e) i.unsubs.forEach((e) => e()), await t.unmount(r), n.delete(r);
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
//#endregion
|
|
2449
|
+
export { a as FORMIE_HTML_EVENT_NAMES, dt as FormieValidator, he as LEGACY_FORMIE_DOM_EVENT_BRIDGES, ge as LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES, Vt as ModuleRegistry, Se as bindLegacyDomEventCompatibility, we as bindLegacyValidatorCompatibility, fe as buildFieldValueRegistry, d as createDebug, qn as createFormieClient, l as debugLog, u as debugWarn, me as defineAddressModule, oe as defineCaptchaModule, ae as definePassiveCaptchaModule, b as definePaymentModule, le as fieldKeyToInputName, or as formie, i as getFieldModuleEventName, ie as getFormieTranslations, r as getGlobalModuleLifecycleEventName, e as getScopedModuleLifecycleEventName, Yn as hydrateFormieModules, se as inputNameToFieldKey, c as isFormieDebugEnabled, ne as mergeFormieTranslations, ce as normalizeFieldKey, o as normalizeFormieEventName, ue as parseFieldReference, pe as resolveFieldReferenceFromFormData, de as resolveFieldReferenceLive, _e as resolveLegacyCompatibilityOptions, s as setFormieDebugEnabled, re as setFormieTranslations, E as t, t as toDomEventName, T as translate };
|