cja-phoenix 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cja-phoenix.es.js +3134 -63
- package/dist/fonts/ProximaNova-Black.woff +0 -0
- package/dist/fonts/ProximaNova-Black.woff2 +0 -0
- package/dist/fonts/ProximaNova-Bold.woff +0 -0
- package/dist/fonts/ProximaNova-Bold.woff2 +0 -0
- package/dist/fonts/ProximaNova-Extrabld.woff +0 -0
- package/dist/fonts/ProximaNova-Extrabld.woff2 +0 -0
- package/dist/fonts/ProximaNova-Regular.woff +0 -0
- package/dist/fonts/ProximaNova-Regular.woff2 +0 -0
- package/dist/fonts/ProximaNovaT-Thin.woff +0 -0
- package/dist/fonts/ProximaNovaT-Thin.woff2 +0 -0
- package/dist/iconia/fonts/CGG-icomoon.eot +0 -0
- package/dist/iconia/fonts/CGG-icomoon.svg +507 -0
- package/dist/iconia/fonts/CGG-icomoon.ttf +0 -0
- package/dist/iconia/fonts/CGG-icomoon.woff +0 -0
- package/dist/iconia/selection.json +1 -0
- package/dist/iconia/style.css +1529 -0
- package/dist/style.css +1 -1
- package/dist/types/components/CheckboxInput.vue.d.ts +14 -0
- package/dist/types/components/CjaButton.vue.d.ts +9 -0
- package/dist/types/components/ComponentA.vue.d.ts +4 -4
- package/dist/types/components/ComponentB.vue.d.ts +1 -1
- package/dist/types/components/Modal.vue.d.ts +32 -0
- package/dist/types/components/PhoneInput.vue.d.ts +62 -0
- package/dist/types/components/TextInput.vue.d.ts +58 -0
- package/dist/types/components/index.d.ts +8 -3
- package/dist/types/stories/Modal.story.vue.d.ts +2 -0
- package/package.json +18 -6
- package/src/assets/fonts.scss +44 -0
- package/src/assets/forms.scss +375 -0
- package/src/assets/main.scss +9 -12
- package/src/components/CheckboxInput.vue +27 -0
- package/src/components/CjaButton.vue +65 -0
- package/src/components/Modal.vue +191 -0
- package/src/components/PhoneInput.vue +91 -0
- package/src/components/TextInput.vue +72 -0
- package/src/components/index.ts +14 -4
- package/src/env.d.ts +5 -4
- package/src/index.ts +3 -0
- package/src/stories/Modal.story.vue +18 -0
- package/src/assets/fonts/myfont.woff +0 -0
package/dist/cja-phoenix.es.js
CHANGED
|
@@ -1,79 +1,3150 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createTextVNode, toDisplayString, pushScopeId, popScopeId, createElementVNode, ref } from "vue";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
const _withScopeId$1 = (n) => (pushScopeId("data-v-5800c09e"), n = n(), popScopeId(), n);
|
|
11
|
-
const _hoisted_1$1 = { class: "component-a-container" };
|
|
12
|
-
const _hoisted_2$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "icon-heart" }, null, -1));
|
|
13
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1
|
+
import { defineComponent as oe, openBlock as ee, createElementBlock as ne, createTextVNode as cn, toDisplayString as he, pushScopeId as at, popScopeId as ot, createElementVNode as U, ref as Y, watch as J, createBlock as fn, Teleport as hn, createVNode as vn, Transition as pn, withCtx as mn, withDirectives as lt, withModifiers as gn, normalizeClass as st, createCommentVNode as ge, renderSlot as Ye, vShow as yn, unref as _, computed as $, onMounted as ut, provide as Dt, isRef as Ue, getCurrentInstance as Te, onBeforeUnmount as Tt, toRef as ce, resolveDynamicComponent as dt, h as Re, inject as Mt, reactive as ct, onUnmounted as jt, nextTick as Ce, warn as Pt, watchEffect as _n, markRaw as bn, resolveDirective as Bt } from "vue";
|
|
2
|
+
const $e = (e, t) => {
|
|
3
|
+
const n = e.__vccOpts || e;
|
|
4
|
+
for (const [i, r] of t)
|
|
5
|
+
n[i] = r;
|
|
6
|
+
return n;
|
|
7
|
+
}, Cn = (e) => (at("data-v-5800c09e"), e = e(), ot(), e), wn = { class: "component-a-container" }, kn = /* @__PURE__ */ Cn(() => /* @__PURE__ */ U("span", { class: "icon-heart" }, null, -1)), In = /* @__PURE__ */ oe({
|
|
8
|
+
__name: "ComponentA",
|
|
14
9
|
props: {
|
|
15
10
|
msg: null
|
|
16
11
|
},
|
|
17
|
-
setup(
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
setup(e) {
|
|
13
|
+
return (t, n) => (ee(), ne("div", wn, [
|
|
14
|
+
cn(" Hello " + he(e.msg) + "! ", 1),
|
|
15
|
+
kn
|
|
16
|
+
]));
|
|
17
|
+
}
|
|
18
|
+
}), Sn = /* @__PURE__ */ $e(In, [["__scopeId", "data-v-5800c09e"]]);
|
|
19
|
+
const On = (e) => (at("data-v-2c22e62b"), e = e(), ot(), e), An = { class: "flex align-content-center flex-wrap counter" }, En = /* @__PURE__ */ On(() => /* @__PURE__ */ U("label", { class: "flex align-items-center justify-content-center" }, "Counter:", -1)), Vn = { class: "flex align-items-center justify-content-center count" }, Ln = /* @__PURE__ */ oe({
|
|
20
|
+
__name: "ComponentB",
|
|
21
|
+
setup(e) {
|
|
22
|
+
const t = Y(0);
|
|
23
|
+
return (n, i) => (ee(), ne("div", An, [
|
|
24
|
+
En,
|
|
25
|
+
U("button", {
|
|
26
|
+
icon: "pi pi-plus",
|
|
27
|
+
class: "p-button-sm flex align-items-center justify-content-center",
|
|
28
|
+
onClick: i[0] || (i[0] = (r) => t.value++)
|
|
29
|
+
}),
|
|
30
|
+
U("span", Vn, he(t.value), 1),
|
|
31
|
+
U("button", {
|
|
32
|
+
icon: "pi pi-minus",
|
|
33
|
+
class: "p-button-sm flex align-items-center justify-content-center",
|
|
34
|
+
onClick: i[1] || (i[1] = (r) => t.value--)
|
|
35
|
+
})
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
}), Fn = /* @__PURE__ */ $e(Ln, [["__scopeId", "data-v-2c22e62b"]]);
|
|
39
|
+
const Nn = (e) => (at("data-v-4c7349cf"), e = e(), ot(), e), Dn = { class: "modal-backdrop" }, Tn = ["onClick"], Mn = /* @__PURE__ */ Nn(() => /* @__PURE__ */ U("span", { class: "m-cgg-icon--cross" }, null, -1)), jn = [
|
|
40
|
+
Mn
|
|
41
|
+
], Pn = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "modal-header"
|
|
44
|
+
}, Bn = { class: "modal-body" }, xn = {
|
|
45
|
+
key: 1,
|
|
46
|
+
class: "modal-footer"
|
|
47
|
+
}, Un = /* @__PURE__ */ oe({
|
|
48
|
+
__name: "Modal",
|
|
49
|
+
props: {
|
|
50
|
+
title: null,
|
|
51
|
+
class: null
|
|
52
|
+
},
|
|
53
|
+
emits: ["close"],
|
|
54
|
+
setup(e, { expose: t, emit: n }) {
|
|
55
|
+
const i = Y(!1), r = Y();
|
|
56
|
+
J(
|
|
57
|
+
() => i.value,
|
|
58
|
+
(m) => {
|
|
59
|
+
m ? document.body.classList.add("modal-active") : document.body.classList.remove("modal-active");
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
const o = () => {
|
|
63
|
+
i.value = !0;
|
|
64
|
+
}, u = () => {
|
|
65
|
+
i.value = !1, n("close");
|
|
66
|
+
};
|
|
67
|
+
return t({ active: i, openModal: o, closeModal: u, toggleModal: () => {
|
|
68
|
+
i.value = !i.value;
|
|
69
|
+
} }), (m, p) => (ee(), fn(hn, { to: "body" }, [
|
|
70
|
+
vn(pn, { name: "fade" }, {
|
|
71
|
+
default: mn(() => [
|
|
72
|
+
lt(U("div", Dn, [
|
|
73
|
+
U("div", {
|
|
74
|
+
class: "modal-overlay",
|
|
75
|
+
onClick: gn(u, ["self"])
|
|
76
|
+
}, [
|
|
77
|
+
U("div", {
|
|
78
|
+
class: st(["modal-container", e.class]),
|
|
79
|
+
ref_key: "modalContainer",
|
|
80
|
+
ref: r
|
|
81
|
+
}, [
|
|
82
|
+
U("button", {
|
|
83
|
+
type: "button",
|
|
84
|
+
class: "btn-close",
|
|
85
|
+
"aria-label": "Close",
|
|
86
|
+
onClick: u
|
|
87
|
+
}, jn),
|
|
88
|
+
e.title ? (ee(), ne("div", Pn, he(e.title), 1)) : ge("", !0),
|
|
89
|
+
U("div", Bn, [
|
|
90
|
+
Ye(m.$slots, "body", {}, void 0, !0)
|
|
91
|
+
]),
|
|
92
|
+
m.$slots.footer ? (ee(), ne("div", xn, [
|
|
93
|
+
Ye(m.$slots, "footer", {}, void 0, !0)
|
|
94
|
+
])) : ge("", !0)
|
|
95
|
+
], 2)
|
|
96
|
+
], 8, Tn)
|
|
97
|
+
], 512), [
|
|
98
|
+
[yn, i.value]
|
|
99
|
+
])
|
|
100
|
+
]),
|
|
101
|
+
_: 3
|
|
102
|
+
})
|
|
103
|
+
]));
|
|
104
|
+
}
|
|
105
|
+
}), Rn = /* @__PURE__ */ $e(Un, [["__scopeId", "data-v-4c7349cf"]]);
|
|
106
|
+
const zn = {}, $n = { class: "cja-btn" };
|
|
107
|
+
function Gn(e, t) {
|
|
108
|
+
return ee(), ne("button", $n, [
|
|
109
|
+
Ye(e.$slots, "default", {}, void 0, !0)
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
const Hn = /* @__PURE__ */ $e(zn, [["render", Gn], ["__scopeId", "data-v-2bfec323"]]);
|
|
113
|
+
function Kn() {
|
|
114
|
+
return xt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
115
|
+
}
|
|
116
|
+
function xt() {
|
|
117
|
+
return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
118
|
+
}
|
|
119
|
+
const qn = typeof Proxy == "function", Wn = "devtools-plugin:setup", Jn = "plugin:settings:set";
|
|
120
|
+
let be, Xe;
|
|
121
|
+
function Qn() {
|
|
122
|
+
var e;
|
|
123
|
+
return be !== void 0 || (typeof window < "u" && window.performance ? (be = !0, Xe = window.performance) : typeof global < "u" && ((e = global.perf_hooks) === null || e === void 0 ? void 0 : e.performance) ? (be = !0, Xe = global.perf_hooks.performance) : be = !1), be;
|
|
124
|
+
}
|
|
125
|
+
function Zn() {
|
|
126
|
+
return Qn() ? Xe.now() : Date.now();
|
|
127
|
+
}
|
|
128
|
+
class Yn {
|
|
129
|
+
constructor(t, n) {
|
|
130
|
+
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
|
|
131
|
+
const i = {};
|
|
132
|
+
if (t.settings)
|
|
133
|
+
for (const u in t.settings) {
|
|
134
|
+
const d = t.settings[u];
|
|
135
|
+
i[u] = d.defaultValue;
|
|
136
|
+
}
|
|
137
|
+
const r = `__vue-devtools-plugin-settings__${t.id}`;
|
|
138
|
+
let o = Object.assign({}, i);
|
|
139
|
+
try {
|
|
140
|
+
const u = localStorage.getItem(r), d = JSON.parse(u);
|
|
141
|
+
Object.assign(o, d);
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
this.fallbacks = {
|
|
145
|
+
getSettings() {
|
|
146
|
+
return o;
|
|
147
|
+
},
|
|
148
|
+
setSettings(u) {
|
|
149
|
+
try {
|
|
150
|
+
localStorage.setItem(r, JSON.stringify(u));
|
|
151
|
+
} catch {
|
|
152
|
+
}
|
|
153
|
+
o = u;
|
|
154
|
+
},
|
|
155
|
+
now() {
|
|
156
|
+
return Zn();
|
|
157
|
+
}
|
|
158
|
+
}, n && n.on(Jn, (u, d) => {
|
|
159
|
+
u === this.plugin.id && this.fallbacks.setSettings(d);
|
|
160
|
+
}), this.proxiedOn = new Proxy({}, {
|
|
161
|
+
get: (u, d) => this.target ? this.target.on[d] : (...m) => {
|
|
162
|
+
this.onQueue.push({
|
|
163
|
+
method: d,
|
|
164
|
+
args: m
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}), this.proxiedTarget = new Proxy({}, {
|
|
168
|
+
get: (u, d) => this.target ? this.target[d] : d === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(d) ? (...m) => (this.targetQueue.push({
|
|
169
|
+
method: d,
|
|
170
|
+
args: m,
|
|
171
|
+
resolve: () => {
|
|
172
|
+
}
|
|
173
|
+
}), this.fallbacks[d](...m)) : (...m) => new Promise((p) => {
|
|
174
|
+
this.targetQueue.push({
|
|
175
|
+
method: d,
|
|
176
|
+
args: m,
|
|
177
|
+
resolve: p
|
|
178
|
+
});
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async setRealTarget(t) {
|
|
183
|
+
this.target = t;
|
|
184
|
+
for (const n of this.onQueue)
|
|
185
|
+
this.target.on[n.method](...n.args);
|
|
186
|
+
for (const n of this.targetQueue)
|
|
187
|
+
n.resolve(await this.target[n.method](...n.args));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function Xn(e, t) {
|
|
191
|
+
const n = e, i = xt(), r = Kn(), o = qn && n.enableEarlyProxy;
|
|
192
|
+
if (r && (i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !o))
|
|
193
|
+
r.emit(Wn, e, t);
|
|
194
|
+
else {
|
|
195
|
+
const u = o ? new Yn(n, r) : null;
|
|
196
|
+
(i.__VUE_DEVTOOLS_PLUGINS__ = i.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
197
|
+
pluginDescriptor: n,
|
|
198
|
+
setupFn: t,
|
|
199
|
+
proxy: u
|
|
200
|
+
}), u && t(u.proxiedTarget);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* vee-validate v4.7.4
|
|
205
|
+
* (c) 2023 Abdelrahman Awad
|
|
206
|
+
* @license MIT
|
|
207
|
+
*/
|
|
208
|
+
function ke(e) {
|
|
209
|
+
return typeof e == "function";
|
|
210
|
+
}
|
|
211
|
+
function Le(e) {
|
|
212
|
+
return e == null;
|
|
213
|
+
}
|
|
214
|
+
const ve = (e) => e !== null && !!e && typeof e == "object" && !Array.isArray(e);
|
|
215
|
+
function Ut(e) {
|
|
216
|
+
return Number(e) >= 0;
|
|
217
|
+
}
|
|
218
|
+
function ei(e) {
|
|
219
|
+
const t = parseFloat(e);
|
|
220
|
+
return isNaN(t) ? e : t;
|
|
221
|
+
}
|
|
222
|
+
const ti = {};
|
|
223
|
+
function ni(e) {
|
|
224
|
+
return ti[e];
|
|
225
|
+
}
|
|
226
|
+
const Me = Symbol("vee-validate-form"), ii = Symbol("vee-validate-field-instance"), ze = Symbol("Default empty value"), ri = typeof window < "u";
|
|
227
|
+
function et(e) {
|
|
228
|
+
return ke(e) && !!e.__locatorRef;
|
|
229
|
+
}
|
|
230
|
+
function Fe(e) {
|
|
231
|
+
return !!e && ke(e.validate);
|
|
232
|
+
}
|
|
233
|
+
function Ie(e) {
|
|
234
|
+
return e === "checkbox" || e === "radio";
|
|
235
|
+
}
|
|
236
|
+
function ai(e) {
|
|
237
|
+
return ve(e) || Array.isArray(e);
|
|
238
|
+
}
|
|
239
|
+
function Rt(e) {
|
|
240
|
+
return Array.isArray(e) ? e.length === 0 : ve(e) && Object.keys(e).length === 0;
|
|
241
|
+
}
|
|
242
|
+
function Ge(e) {
|
|
243
|
+
return /^\[.+\]$/i.test(e);
|
|
244
|
+
}
|
|
245
|
+
function oi(e) {
|
|
246
|
+
return zt(e) && e.multiple;
|
|
247
|
+
}
|
|
248
|
+
function zt(e) {
|
|
249
|
+
return e.tagName === "SELECT";
|
|
250
|
+
}
|
|
251
|
+
function li(e, t) {
|
|
252
|
+
const n = ![!1, null, void 0, 0].includes(t.multiple) && !Number.isNaN(t.multiple);
|
|
253
|
+
return e === "select" && "multiple" in t && n;
|
|
254
|
+
}
|
|
255
|
+
function si(e, t) {
|
|
256
|
+
return !li(e, t) && t.type !== "file" && !Ie(t.type);
|
|
257
|
+
}
|
|
258
|
+
function $t(e) {
|
|
259
|
+
return ft(e) && e.target && "submit" in e.target;
|
|
260
|
+
}
|
|
261
|
+
function ft(e) {
|
|
262
|
+
return e ? !!(typeof Event < "u" && ke(Event) && e instanceof Event || e && e.srcElement) : !1;
|
|
263
|
+
}
|
|
264
|
+
function Ct(e, t) {
|
|
265
|
+
return t in e && e[t] !== ze;
|
|
266
|
+
}
|
|
267
|
+
function G(e, t) {
|
|
268
|
+
if (e === t)
|
|
269
|
+
return !0;
|
|
270
|
+
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
271
|
+
if (e.constructor !== t.constructor)
|
|
272
|
+
return !1;
|
|
273
|
+
var n, i, r;
|
|
274
|
+
if (Array.isArray(e)) {
|
|
275
|
+
if (n = e.length, n != t.length)
|
|
276
|
+
return !1;
|
|
277
|
+
for (i = n; i-- !== 0; )
|
|
278
|
+
if (!G(e[i], t[i]))
|
|
279
|
+
return !1;
|
|
280
|
+
return !0;
|
|
281
|
+
}
|
|
282
|
+
if (e instanceof Map && t instanceof Map) {
|
|
283
|
+
if (e.size !== t.size)
|
|
284
|
+
return !1;
|
|
285
|
+
for (i of e.entries())
|
|
286
|
+
if (!t.has(i[0]))
|
|
287
|
+
return !1;
|
|
288
|
+
for (i of e.entries())
|
|
289
|
+
if (!G(i[1], t.get(i[0])))
|
|
290
|
+
return !1;
|
|
291
|
+
return !0;
|
|
292
|
+
}
|
|
293
|
+
if (wt(e) && wt(t))
|
|
294
|
+
return !(e.size !== t.size || e.name !== t.name || e.lastModified !== t.lastModified || e.type !== t.type);
|
|
295
|
+
if (e instanceof Set && t instanceof Set) {
|
|
296
|
+
if (e.size !== t.size)
|
|
297
|
+
return !1;
|
|
298
|
+
for (i of e.entries())
|
|
299
|
+
if (!t.has(i[0]))
|
|
300
|
+
return !1;
|
|
301
|
+
return !0;
|
|
302
|
+
}
|
|
303
|
+
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
|
304
|
+
if (n = e.length, n != t.length)
|
|
305
|
+
return !1;
|
|
306
|
+
for (i = n; i-- !== 0; )
|
|
307
|
+
if (e[i] !== t[i])
|
|
308
|
+
return !1;
|
|
309
|
+
return !0;
|
|
310
|
+
}
|
|
311
|
+
if (e.constructor === RegExp)
|
|
312
|
+
return e.source === t.source && e.flags === t.flags;
|
|
313
|
+
if (e.valueOf !== Object.prototype.valueOf)
|
|
314
|
+
return e.valueOf() === t.valueOf();
|
|
315
|
+
if (e.toString !== Object.prototype.toString)
|
|
316
|
+
return e.toString() === t.toString();
|
|
317
|
+
if (r = Object.keys(e), n = r.length, n !== Object.keys(t).length)
|
|
318
|
+
return !1;
|
|
319
|
+
for (i = n; i-- !== 0; )
|
|
320
|
+
if (!Object.prototype.hasOwnProperty.call(t, r[i]))
|
|
321
|
+
return !1;
|
|
322
|
+
for (i = n; i-- !== 0; ) {
|
|
323
|
+
var o = r[i];
|
|
324
|
+
if (!G(e[o], t[o]))
|
|
325
|
+
return !1;
|
|
326
|
+
}
|
|
327
|
+
return !0;
|
|
328
|
+
}
|
|
329
|
+
return e !== e && t !== t;
|
|
330
|
+
}
|
|
331
|
+
function wt(e) {
|
|
332
|
+
return ri ? e instanceof File : !1;
|
|
333
|
+
}
|
|
334
|
+
function kt(e, t, n) {
|
|
335
|
+
typeof n.value == "object" && (n.value = T(n.value)), !n.enumerable || n.get || n.set || !n.configurable || !n.writable || t === "__proto__" ? Object.defineProperty(e, t, n) : e[t] = n.value;
|
|
336
|
+
}
|
|
337
|
+
function T(e) {
|
|
338
|
+
if (typeof e != "object")
|
|
339
|
+
return e;
|
|
340
|
+
var t = 0, n, i, r, o = Object.prototype.toString.call(e);
|
|
341
|
+
if (o === "[object Object]" ? r = Object.create(e.__proto__ || null) : o === "[object Array]" ? r = Array(e.length) : o === "[object Set]" ? (r = /* @__PURE__ */ new Set(), e.forEach(function(u) {
|
|
342
|
+
r.add(T(u));
|
|
343
|
+
})) : o === "[object Map]" ? (r = /* @__PURE__ */ new Map(), e.forEach(function(u, d) {
|
|
344
|
+
r.set(T(d), T(u));
|
|
345
|
+
})) : o === "[object Date]" ? r = new Date(+e) : o === "[object RegExp]" ? r = new RegExp(e.source, e.flags) : o === "[object DataView]" ? r = new e.constructor(T(e.buffer)) : o === "[object ArrayBuffer]" ? r = e.slice(0) : o.slice(-6) === "Array]" && (r = new e.constructor(e)), r) {
|
|
346
|
+
for (i = Object.getOwnPropertySymbols(e); t < i.length; t++)
|
|
347
|
+
kt(r, i[t], Object.getOwnPropertyDescriptor(e, i[t]));
|
|
348
|
+
for (t = 0, i = Object.getOwnPropertyNames(e); t < i.length; t++)
|
|
349
|
+
Object.hasOwnProperty.call(r, n = i[t]) && r[n] === e[n] || kt(r, n, Object.getOwnPropertyDescriptor(e, n));
|
|
350
|
+
}
|
|
351
|
+
return r || e;
|
|
352
|
+
}
|
|
353
|
+
function ht(e) {
|
|
354
|
+
return Ge(e) ? e.replace(/\[|\]/gi, "") : e;
|
|
355
|
+
}
|
|
356
|
+
function x(e, t, n) {
|
|
357
|
+
return e ? Ge(t) ? e[ht(t)] : (t || "").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((r, o) => ai(r) && o in r ? r[o] : n, e) : n;
|
|
358
|
+
}
|
|
359
|
+
function ue(e, t, n) {
|
|
360
|
+
if (Ge(t)) {
|
|
361
|
+
e[ht(t)] = n;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const i = t.split(/\.|\[(\d+)\]/).filter(Boolean);
|
|
365
|
+
let r = e;
|
|
366
|
+
for (let o = 0; o < i.length; o++) {
|
|
367
|
+
if (o === i.length - 1) {
|
|
368
|
+
r[i[o]] = n;
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
(!(i[o] in r) || Le(r[i[o]])) && (r[i[o]] = Ut(i[o + 1]) ? [] : {}), r = r[i[o]];
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function We(e, t) {
|
|
375
|
+
if (Array.isArray(e) && Ut(t)) {
|
|
376
|
+
e.splice(Number(t), 1);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
ve(e) && delete e[t];
|
|
380
|
+
}
|
|
381
|
+
function Be(e, t) {
|
|
382
|
+
if (Ge(t)) {
|
|
383
|
+
delete e[ht(t)];
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
const n = t.split(/\.|\[(\d+)\]/).filter(Boolean);
|
|
387
|
+
let i = e;
|
|
388
|
+
for (let o = 0; o < n.length; o++) {
|
|
389
|
+
if (o === n.length - 1) {
|
|
390
|
+
We(i, n[o]);
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
if (!(n[o] in i) || Le(i[n[o]]))
|
|
394
|
+
break;
|
|
395
|
+
i = i[n[o]];
|
|
396
|
+
}
|
|
397
|
+
const r = n.map((o, u) => x(e, n.slice(0, u).join(".")));
|
|
398
|
+
for (let o = r.length - 1; o >= 0; o--)
|
|
399
|
+
if (!!Rt(r[o])) {
|
|
400
|
+
if (o === 0) {
|
|
401
|
+
We(e, n[0]);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
We(r[o - 1], n[o - 1]);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function z(e) {
|
|
408
|
+
return Object.keys(e);
|
|
409
|
+
}
|
|
410
|
+
function vt(e, t = void 0) {
|
|
411
|
+
const n = Te();
|
|
412
|
+
return (n == null ? void 0 : n.provides[e]) || Mt(e, t);
|
|
413
|
+
}
|
|
414
|
+
function Je(e) {
|
|
415
|
+
Pt(`[vee-validate]: ${e}`);
|
|
416
|
+
}
|
|
417
|
+
function ui(e) {
|
|
418
|
+
return Array.isArray(e) ? e[0] : e;
|
|
419
|
+
}
|
|
420
|
+
function tt(e, t, n) {
|
|
421
|
+
if (Array.isArray(e)) {
|
|
422
|
+
const i = [...e], r = i.findIndex((o) => G(o, t));
|
|
423
|
+
return r >= 0 ? i.splice(r, 1) : i.push(t), i;
|
|
424
|
+
}
|
|
425
|
+
return G(e, t) ? n : t;
|
|
426
|
+
}
|
|
427
|
+
function di(e, t) {
|
|
428
|
+
let n, i;
|
|
429
|
+
return function(...r) {
|
|
430
|
+
const o = this;
|
|
431
|
+
return n || (n = !0, setTimeout(() => n = !1, t), i = e.apply(o, r)), i;
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function It(e, t = 0) {
|
|
435
|
+
let n = null, i = [];
|
|
436
|
+
return function(...r) {
|
|
437
|
+
return n && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
438
|
+
const o = e(...r);
|
|
439
|
+
i.forEach((u) => u(o)), i = [];
|
|
440
|
+
}, t), new Promise((o) => i.push(o));
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function ci(e, t) {
|
|
444
|
+
return ve(t) && t.number ? ei(e) : e;
|
|
445
|
+
}
|
|
446
|
+
function nt(e, t) {
|
|
447
|
+
let n;
|
|
448
|
+
return async function(...r) {
|
|
449
|
+
const o = e(...r);
|
|
450
|
+
n = o;
|
|
451
|
+
const u = await o;
|
|
452
|
+
return o !== n || (n = void 0, t(u, r)), u;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function fi({ get: e, set: t }) {
|
|
456
|
+
const n = Y(T(e()));
|
|
457
|
+
return J(e, (i) => {
|
|
458
|
+
G(i, n.value) || (n.value = T(i));
|
|
459
|
+
}, {
|
|
460
|
+
deep: !0
|
|
461
|
+
}), J(n, (i) => {
|
|
462
|
+
G(i, e()) || t(T(i));
|
|
463
|
+
}, {
|
|
464
|
+
deep: !0
|
|
465
|
+
}), n;
|
|
466
|
+
}
|
|
467
|
+
const He = (e, t, n) => t.slots.default ? typeof e == "string" || !e ? t.slots.default(n()) : {
|
|
468
|
+
default: () => {
|
|
469
|
+
var i, r;
|
|
470
|
+
return (r = (i = t.slots).default) === null || r === void 0 ? void 0 : r.call(i, n());
|
|
471
|
+
}
|
|
472
|
+
} : t.slots.default;
|
|
473
|
+
function Qe(e) {
|
|
474
|
+
if (Gt(e))
|
|
475
|
+
return e._value;
|
|
476
|
+
}
|
|
477
|
+
function Gt(e) {
|
|
478
|
+
return "_value" in e;
|
|
479
|
+
}
|
|
480
|
+
function pt(e) {
|
|
481
|
+
if (!ft(e))
|
|
482
|
+
return e;
|
|
483
|
+
const t = e.target;
|
|
484
|
+
if (Ie(t.type) && Gt(t))
|
|
485
|
+
return Qe(t);
|
|
486
|
+
if (t.type === "file" && t.files) {
|
|
487
|
+
const n = Array.from(t.files);
|
|
488
|
+
return t.multiple ? n : n[0];
|
|
489
|
+
}
|
|
490
|
+
if (oi(t))
|
|
491
|
+
return Array.from(t.options).filter((n) => n.selected && !n.disabled).map(Qe);
|
|
492
|
+
if (zt(t)) {
|
|
493
|
+
const n = Array.from(t.options).find((i) => i.selected);
|
|
494
|
+
return n ? Qe(n) : t.value;
|
|
495
|
+
}
|
|
496
|
+
return t.value;
|
|
497
|
+
}
|
|
498
|
+
function Ht(e) {
|
|
499
|
+
const t = {};
|
|
500
|
+
return Object.defineProperty(t, "_$$isNormalized", {
|
|
501
|
+
value: !0,
|
|
502
|
+
writable: !1,
|
|
503
|
+
enumerable: !1,
|
|
504
|
+
configurable: !1
|
|
505
|
+
}), e ? ve(e) && e._$$isNormalized ? e : ve(e) ? Object.keys(e).reduce((n, i) => {
|
|
506
|
+
const r = hi(e[i]);
|
|
507
|
+
return e[i] !== !1 && (n[i] = St(r)), n;
|
|
508
|
+
}, t) : typeof e != "string" ? t : e.split("|").reduce((n, i) => {
|
|
509
|
+
const r = vi(i);
|
|
510
|
+
return r.name && (n[r.name] = St(r.params)), n;
|
|
511
|
+
}, t) : t;
|
|
512
|
+
}
|
|
513
|
+
function hi(e) {
|
|
514
|
+
return e === !0 ? [] : Array.isArray(e) || ve(e) ? e : [e];
|
|
515
|
+
}
|
|
516
|
+
function St(e) {
|
|
517
|
+
const t = (n) => typeof n == "string" && n[0] === "@" ? pi(n.slice(1)) : n;
|
|
518
|
+
return Array.isArray(e) ? e.map(t) : e instanceof RegExp ? [e] : Object.keys(e).reduce((n, i) => (n[i] = t(e[i]), n), {});
|
|
519
|
+
}
|
|
520
|
+
const vi = (e) => {
|
|
521
|
+
let t = [];
|
|
522
|
+
const n = e.split(":")[0];
|
|
523
|
+
return e.includes(":") && (t = e.split(":").slice(1).join(":").split(",")), { name: n, params: t };
|
|
524
|
+
};
|
|
525
|
+
function pi(e) {
|
|
526
|
+
const t = (n) => x(n, e) || n[e];
|
|
527
|
+
return t.__locatorRef = e, t;
|
|
528
|
+
}
|
|
529
|
+
function mi(e) {
|
|
530
|
+
return Array.isArray(e) ? e.filter(et) : z(e).filter((t) => et(e[t])).map((t) => e[t]);
|
|
531
|
+
}
|
|
532
|
+
const gi = {
|
|
533
|
+
generateMessage: ({ field: e }) => `${e} is not valid.`,
|
|
534
|
+
bails: !0,
|
|
535
|
+
validateOnBlur: !0,
|
|
536
|
+
validateOnChange: !0,
|
|
537
|
+
validateOnInput: !1,
|
|
538
|
+
validateOnModelUpdate: !0
|
|
539
|
+
};
|
|
540
|
+
let yi = Object.assign({}, gi);
|
|
541
|
+
const mt = () => yi;
|
|
542
|
+
async function Kt(e, t, n = {}) {
|
|
543
|
+
const i = n == null ? void 0 : n.bails, r = {
|
|
544
|
+
name: (n == null ? void 0 : n.name) || "{field}",
|
|
545
|
+
rules: t,
|
|
546
|
+
label: n == null ? void 0 : n.label,
|
|
547
|
+
bails: i != null ? i : !0,
|
|
548
|
+
formData: (n == null ? void 0 : n.values) || {}
|
|
549
|
+
}, u = (await _i(r, e)).errors;
|
|
550
|
+
return {
|
|
551
|
+
errors: u,
|
|
552
|
+
valid: !u.length
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
async function _i(e, t) {
|
|
556
|
+
if (Fe(e.rules))
|
|
557
|
+
return bi(t, e.rules, { bails: e.bails });
|
|
558
|
+
if (ke(e.rules) || Array.isArray(e.rules)) {
|
|
559
|
+
const u = {
|
|
560
|
+
field: e.label || e.name,
|
|
561
|
+
name: e.name,
|
|
562
|
+
label: e.label,
|
|
563
|
+
form: e.formData,
|
|
564
|
+
value: t
|
|
565
|
+
}, d = Array.isArray(e.rules) ? e.rules : [e.rules], m = d.length, p = [];
|
|
566
|
+
for (let b = 0; b < m; b++) {
|
|
567
|
+
const k = d[b], S = await k(t, u);
|
|
568
|
+
if (typeof S != "string" && S)
|
|
569
|
+
continue;
|
|
570
|
+
const P = typeof S == "string" ? S : qt(u);
|
|
571
|
+
if (p.push(P), e.bails)
|
|
572
|
+
return {
|
|
573
|
+
errors: p
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
return {
|
|
577
|
+
errors: p
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
const n = Object.assign(Object.assign({}, e), { rules: Ht(e.rules) }), i = [], r = Object.keys(n.rules), o = r.length;
|
|
581
|
+
for (let u = 0; u < o; u++) {
|
|
582
|
+
const d = r[u], m = await Ci(n, t, {
|
|
583
|
+
name: d,
|
|
584
|
+
params: n.rules[d]
|
|
585
|
+
});
|
|
586
|
+
if (m.error && (i.push(m.error), e.bails))
|
|
587
|
+
return {
|
|
588
|
+
errors: i
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
return {
|
|
592
|
+
errors: i
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
async function bi(e, t, n) {
|
|
596
|
+
var i;
|
|
597
|
+
return {
|
|
598
|
+
errors: await t.validate(e, {
|
|
599
|
+
abortEarly: (i = n.bails) !== null && i !== void 0 ? i : !0
|
|
600
|
+
}).then(() => []).catch((o) => {
|
|
601
|
+
if (o.name === "ValidationError")
|
|
602
|
+
return o.errors;
|
|
603
|
+
throw o;
|
|
604
|
+
})
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
async function Ci(e, t, n) {
|
|
608
|
+
const i = ni(n.name);
|
|
609
|
+
if (!i)
|
|
610
|
+
throw new Error(`No such validator '${n.name}' exists.`);
|
|
611
|
+
const r = wi(n.params, e.formData), o = {
|
|
612
|
+
field: e.label || e.name,
|
|
613
|
+
name: e.name,
|
|
614
|
+
label: e.label,
|
|
615
|
+
value: t,
|
|
616
|
+
form: e.formData,
|
|
617
|
+
rule: Object.assign(Object.assign({}, n), { params: r })
|
|
618
|
+
}, u = await i(t, r, o);
|
|
619
|
+
return typeof u == "string" ? {
|
|
620
|
+
error: u
|
|
621
|
+
} : {
|
|
622
|
+
error: u ? void 0 : qt(o)
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function qt(e) {
|
|
626
|
+
const t = mt().generateMessage;
|
|
627
|
+
return t ? t(e) : "Field is invalid";
|
|
628
|
+
}
|
|
629
|
+
function wi(e, t) {
|
|
630
|
+
const n = (i) => et(i) ? i(t) : i;
|
|
631
|
+
return Array.isArray(e) ? e.map(n) : Object.keys(e).reduce((i, r) => (i[r] = n(e[r]), i), {});
|
|
632
|
+
}
|
|
633
|
+
async function ki(e, t) {
|
|
634
|
+
const n = await e.validate(t, { abortEarly: !1 }).then(() => []).catch((o) => {
|
|
635
|
+
if (o.name !== "ValidationError")
|
|
636
|
+
throw o;
|
|
637
|
+
return o.inner || [];
|
|
638
|
+
}), i = {}, r = {};
|
|
639
|
+
for (const o of n) {
|
|
640
|
+
const u = o.errors;
|
|
641
|
+
i[o.path] = { valid: !u.length, errors: u }, u.length && (r[o.path] = u[0]);
|
|
642
|
+
}
|
|
643
|
+
return {
|
|
644
|
+
valid: !n.length,
|
|
645
|
+
results: i,
|
|
646
|
+
errors: r
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
async function Ii(e, t, n) {
|
|
650
|
+
const r = z(e).map(async (p) => {
|
|
651
|
+
var b, k, S;
|
|
652
|
+
const E = (b = n == null ? void 0 : n.names) === null || b === void 0 ? void 0 : b[p], P = await Kt(x(t, p), e[p], {
|
|
653
|
+
name: (E == null ? void 0 : E.name) || p,
|
|
654
|
+
label: E == null ? void 0 : E.label,
|
|
655
|
+
values: t,
|
|
656
|
+
bails: (S = (k = n == null ? void 0 : n.bailsMap) === null || k === void 0 ? void 0 : k[p]) !== null && S !== void 0 ? S : !0
|
|
657
|
+
});
|
|
658
|
+
return Object.assign(Object.assign({}, P), { path: p });
|
|
659
|
+
});
|
|
660
|
+
let o = !0;
|
|
661
|
+
const u = await Promise.all(r), d = {}, m = {};
|
|
662
|
+
for (const p of u)
|
|
663
|
+
d[p.path] = {
|
|
664
|
+
valid: p.valid,
|
|
665
|
+
errors: p.errors
|
|
666
|
+
}, p.valid || (o = !1, m[p.path] = p.errors[0]);
|
|
667
|
+
return {
|
|
668
|
+
valid: o,
|
|
669
|
+
results: d,
|
|
670
|
+
errors: m
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
let Ot = 0;
|
|
674
|
+
function Si(e, t) {
|
|
675
|
+
const { value: n, initialValue: i, setInitialValue: r } = Wt(e, t.modelValue, t.form), { errorMessage: o, errors: u, setErrors: d } = Ai(e, t.form), m = Oi(n, i, u), p = Ot >= Number.MAX_SAFE_INTEGER ? 0 : ++Ot;
|
|
676
|
+
function b(k) {
|
|
677
|
+
var S;
|
|
678
|
+
"value" in k && (n.value = k.value), "errors" in k && d(k.errors), "touched" in k && (m.touched = (S = k.touched) !== null && S !== void 0 ? S : m.touched), "initialValue" in k && r(k.initialValue);
|
|
679
|
+
}
|
|
680
|
+
return {
|
|
681
|
+
id: p,
|
|
682
|
+
path: e,
|
|
683
|
+
value: n,
|
|
684
|
+
initialValue: i,
|
|
685
|
+
meta: m,
|
|
686
|
+
errors: u,
|
|
687
|
+
errorMessage: o,
|
|
688
|
+
setState: b
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function Wt(e, t, n) {
|
|
692
|
+
const i = Y(_(t));
|
|
693
|
+
function r() {
|
|
694
|
+
return n ? x(n.meta.value.initialValues, _(e), _(i)) : _(i);
|
|
695
|
+
}
|
|
696
|
+
function o(p) {
|
|
697
|
+
if (!n) {
|
|
698
|
+
i.value = p;
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
n.stageInitialValue(_(e), p, !0);
|
|
702
|
+
}
|
|
703
|
+
const u = $(r);
|
|
704
|
+
if (!n)
|
|
705
|
+
return {
|
|
706
|
+
value: Y(r()),
|
|
707
|
+
initialValue: u,
|
|
708
|
+
setInitialValue: o
|
|
709
|
+
};
|
|
710
|
+
const d = t ? _(t) : x(n.values, _(e), _(u));
|
|
711
|
+
return n.stageInitialValue(_(e), d, !0), {
|
|
712
|
+
value: $({
|
|
713
|
+
get() {
|
|
714
|
+
return x(n.values, _(e));
|
|
715
|
+
},
|
|
716
|
+
set(p) {
|
|
717
|
+
n.setFieldValue(_(e), p);
|
|
718
|
+
}
|
|
719
|
+
}),
|
|
720
|
+
initialValue: u,
|
|
721
|
+
setInitialValue: o
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function Oi(e, t, n) {
|
|
725
|
+
const i = ct({
|
|
726
|
+
touched: !1,
|
|
727
|
+
pending: !1,
|
|
728
|
+
valid: !0,
|
|
729
|
+
validated: !!_(n).length,
|
|
730
|
+
initialValue: $(() => _(t)),
|
|
731
|
+
dirty: $(() => !G(_(e), _(t)))
|
|
732
|
+
});
|
|
733
|
+
return J(n, (r) => {
|
|
734
|
+
i.valid = !r.length;
|
|
735
|
+
}, {
|
|
736
|
+
immediate: !0,
|
|
737
|
+
flush: "sync"
|
|
738
|
+
}), i;
|
|
739
|
+
}
|
|
740
|
+
function Ai(e, t) {
|
|
741
|
+
function n(r) {
|
|
742
|
+
return r ? Array.isArray(r) ? r : [r] : [];
|
|
743
|
+
}
|
|
744
|
+
if (!t) {
|
|
745
|
+
const r = Y([]);
|
|
746
|
+
return {
|
|
747
|
+
errors: r,
|
|
748
|
+
errorMessage: $(() => r.value[0]),
|
|
749
|
+
setErrors: (o) => {
|
|
750
|
+
r.value = n(o);
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
const i = $(() => t.errorBag.value[_(e)] || []);
|
|
755
|
+
return {
|
|
756
|
+
errors: i,
|
|
757
|
+
errorMessage: $(() => i.value[0]),
|
|
758
|
+
setErrors: (r) => {
|
|
759
|
+
t.setFieldErrorBag(_(e), n(r));
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function Jt(e) {
|
|
764
|
+
process.env.NODE_ENV !== "production" && Xn({
|
|
765
|
+
id: "vee-validate-devtools-plugin",
|
|
766
|
+
label: "VeeValidate Plugin",
|
|
767
|
+
packageName: "vee-validate",
|
|
768
|
+
homepage: "https://vee-validate.logaretm.com/v4",
|
|
769
|
+
app: e,
|
|
770
|
+
logo: "https://vee-validate.logaretm.com/v4/logo.png"
|
|
771
|
+
}, Li);
|
|
772
|
+
}
|
|
773
|
+
const Ne = {}, De = {};
|
|
774
|
+
let de;
|
|
775
|
+
const Se = di(() => {
|
|
776
|
+
setTimeout(async () => {
|
|
777
|
+
await Ce(), de == null || de.sendInspectorState(we), de == null || de.sendInspectorTree(we);
|
|
778
|
+
}, 100);
|
|
779
|
+
}, 100);
|
|
780
|
+
function Ei(e) {
|
|
781
|
+
const t = Te();
|
|
782
|
+
if (!de) {
|
|
783
|
+
const n = t == null ? void 0 : t.appContext.app;
|
|
784
|
+
if (!n)
|
|
785
|
+
return;
|
|
786
|
+
Jt(n);
|
|
787
|
+
}
|
|
788
|
+
Ne[e.formId] = Object.assign({}, e), Ne[e.formId]._vm = t, jt(() => {
|
|
789
|
+
delete Ne[e.formId], Se();
|
|
790
|
+
}), Se();
|
|
791
|
+
}
|
|
792
|
+
function Vi(e) {
|
|
793
|
+
const t = Te();
|
|
794
|
+
if (!de) {
|
|
795
|
+
const n = t == null ? void 0 : t.appContext.app;
|
|
796
|
+
if (!n)
|
|
797
|
+
return;
|
|
798
|
+
Jt(n);
|
|
799
|
+
}
|
|
800
|
+
De[e.id] = Object.assign({}, e), De[e.id]._vm = t, jt(() => {
|
|
801
|
+
delete De[e.id], Se();
|
|
802
|
+
}), Se();
|
|
803
|
+
}
|
|
804
|
+
const we = "vee-validate-inspector", X = {
|
|
805
|
+
error: 12405579,
|
|
806
|
+
success: 448379,
|
|
807
|
+
unknown: 5522283,
|
|
808
|
+
white: 16777215,
|
|
809
|
+
black: 0,
|
|
810
|
+
blue: 218007,
|
|
811
|
+
purple: 12157168,
|
|
812
|
+
orange: 16099682,
|
|
813
|
+
gray: 12304330
|
|
814
|
+
};
|
|
815
|
+
let se = null;
|
|
816
|
+
function Li(e) {
|
|
817
|
+
de = e, e.addInspector({
|
|
818
|
+
id: we,
|
|
819
|
+
icon: "rule",
|
|
820
|
+
label: "vee-validate",
|
|
821
|
+
noSelectionText: "Select a vee-validate node to inspect",
|
|
822
|
+
actions: [
|
|
823
|
+
{
|
|
824
|
+
icon: "done_outline",
|
|
825
|
+
tooltip: "Validate selected item",
|
|
826
|
+
action: async () => {
|
|
827
|
+
if (!se) {
|
|
828
|
+
console.error("There is not a valid selected vee-validate node or component");
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const t = await se.validate();
|
|
832
|
+
console.log(t);
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
icon: "delete_sweep",
|
|
837
|
+
tooltip: "Clear validation state of the selected item",
|
|
838
|
+
action: () => {
|
|
839
|
+
if (!se) {
|
|
840
|
+
console.error("There is not a valid selected vee-validate node or component");
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
if ("id" in se) {
|
|
844
|
+
se.resetField();
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
se.resetForm();
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
]
|
|
851
|
+
}), e.on.getInspectorTree((t) => {
|
|
852
|
+
if (t.inspectorId !== we)
|
|
853
|
+
return;
|
|
854
|
+
const n = Object.values(Ne), i = Object.values(De);
|
|
855
|
+
t.rootNodes = [
|
|
856
|
+
...n.map(Fi),
|
|
857
|
+
...i.map((r) => gt(r))
|
|
858
|
+
];
|
|
859
|
+
}), e.on.getInspectorState((t, n) => {
|
|
860
|
+
if (t.inspectorId !== we || n.currentTab !== `custom-inspector:${we}`)
|
|
861
|
+
return;
|
|
862
|
+
const { form: i, field: r, type: o } = Ni(t.nodeId);
|
|
863
|
+
if (i && o === "form") {
|
|
864
|
+
t.state = Ti(i), se = i;
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
if (r && o === "field") {
|
|
868
|
+
t.state = Di(r), se = r;
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
se = null;
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
function Fi(e) {
|
|
875
|
+
const { textColor: t, bgColor: n } = Zt(e), i = {};
|
|
876
|
+
Object.values(e.fieldsByPath.value).forEach((u) => {
|
|
877
|
+
const d = Array.isArray(u) ? u[0] : u;
|
|
878
|
+
!d || ue(i, _(d.name), gt(d, e));
|
|
879
|
+
});
|
|
880
|
+
function r(u, d = []) {
|
|
881
|
+
const m = [...d].pop();
|
|
882
|
+
return "id" in u ? Object.assign(Object.assign({}, u), { label: m || u.label }) : ve(u) ? {
|
|
883
|
+
id: `${d.join(".")}`,
|
|
884
|
+
label: m || "",
|
|
885
|
+
children: Object.keys(u).map((p) => r(u[p], [...d, p]))
|
|
886
|
+
} : Array.isArray(u) ? {
|
|
887
|
+
id: `${d.join(".")}`,
|
|
888
|
+
label: `${m}[]`,
|
|
889
|
+
children: u.map((p, b) => r(p, [...d, String(b)]))
|
|
890
|
+
} : { id: "", label: "", children: [] };
|
|
891
|
+
}
|
|
892
|
+
const { children: o } = r(i);
|
|
893
|
+
return {
|
|
894
|
+
id: Qt(e),
|
|
895
|
+
label: "Form",
|
|
896
|
+
children: o,
|
|
897
|
+
tags: [
|
|
898
|
+
{
|
|
899
|
+
label: "Form",
|
|
900
|
+
textColor: t,
|
|
901
|
+
backgroundColor: n
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
label: `${Object.keys(e.fieldsByPath.value).length} fields`,
|
|
905
|
+
textColor: X.white,
|
|
906
|
+
backgroundColor: X.unknown
|
|
907
|
+
}
|
|
908
|
+
]
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
function gt(e, t) {
|
|
912
|
+
const n = ui(e), { textColor: i, bgColor: r } = Zt(n), o = Array.isArray(e) && e.length > 1;
|
|
913
|
+
return {
|
|
914
|
+
id: Qt(t, n, !o),
|
|
915
|
+
label: _(n.name),
|
|
916
|
+
children: Array.isArray(e) ? e.map((u) => gt(u, t)) : void 0,
|
|
917
|
+
tags: [
|
|
918
|
+
o ? void 0 : {
|
|
919
|
+
label: "Field",
|
|
920
|
+
textColor: i,
|
|
921
|
+
backgroundColor: r
|
|
922
|
+
},
|
|
923
|
+
t ? void 0 : {
|
|
924
|
+
label: "Standalone",
|
|
925
|
+
textColor: X.black,
|
|
926
|
+
backgroundColor: X.gray
|
|
927
|
+
},
|
|
928
|
+
!o && n.type === "checkbox" ? {
|
|
929
|
+
label: "Checkbox",
|
|
930
|
+
textColor: X.white,
|
|
931
|
+
backgroundColor: X.blue
|
|
932
|
+
} : void 0,
|
|
933
|
+
!o && n.type === "radio" ? {
|
|
934
|
+
label: "Radio",
|
|
935
|
+
textColor: X.white,
|
|
936
|
+
backgroundColor: X.purple
|
|
937
|
+
} : void 0,
|
|
938
|
+
o ? {
|
|
939
|
+
label: "Group",
|
|
940
|
+
textColor: X.black,
|
|
941
|
+
backgroundColor: X.orange
|
|
942
|
+
} : void 0
|
|
943
|
+
].filter(Boolean)
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
function Qt(e, t, n = !0) {
|
|
947
|
+
const i = e ? _(t == null ? void 0 : t.name) : t == null ? void 0 : t.id, r = i ? e == null ? void 0 : e.fieldsByPath.value[i] : void 0;
|
|
948
|
+
let o;
|
|
949
|
+
n && t && Array.isArray(r) && (o = r.indexOf(t));
|
|
950
|
+
const u = { f: e == null ? void 0 : e.formId, ff: i, idx: o, type: t ? "field" : "form" };
|
|
951
|
+
return btoa(JSON.stringify(u));
|
|
952
|
+
}
|
|
953
|
+
function Ni(e) {
|
|
954
|
+
try {
|
|
955
|
+
const t = JSON.parse(atob(e)), n = Ne[t.f];
|
|
956
|
+
if (!n && t.ff) {
|
|
957
|
+
const r = De[t.ff];
|
|
958
|
+
return r ? {
|
|
959
|
+
type: t.type,
|
|
960
|
+
field: r
|
|
961
|
+
} : {};
|
|
962
|
+
}
|
|
963
|
+
if (!n)
|
|
964
|
+
return {};
|
|
965
|
+
const i = n.fieldsByPath.value[t.ff];
|
|
966
|
+
return {
|
|
967
|
+
type: t.type,
|
|
968
|
+
form: n,
|
|
969
|
+
field: Array.isArray(i) ? i[t.idx || 0] : i
|
|
970
|
+
};
|
|
971
|
+
} catch {
|
|
972
|
+
}
|
|
973
|
+
return {};
|
|
974
|
+
}
|
|
975
|
+
function Di(e) {
|
|
976
|
+
const { errors: t, meta: n, value: i } = e;
|
|
977
|
+
return {
|
|
978
|
+
"Field state": [
|
|
979
|
+
{ key: "errors", value: t.value },
|
|
980
|
+
{
|
|
981
|
+
key: "initialValue",
|
|
982
|
+
value: n.initialValue
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
key: "currentValue",
|
|
986
|
+
value: i.value
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
key: "touched",
|
|
990
|
+
value: n.touched
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
key: "dirty",
|
|
994
|
+
value: n.dirty
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
key: "valid",
|
|
998
|
+
value: n.valid
|
|
999
|
+
}
|
|
1000
|
+
]
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
function Ti(e) {
|
|
1004
|
+
const { errorBag: t, meta: n, values: i, isSubmitting: r, submitCount: o } = e;
|
|
1005
|
+
return {
|
|
1006
|
+
"Form state": [
|
|
1007
|
+
{
|
|
1008
|
+
key: "submitCount",
|
|
1009
|
+
value: o.value
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
key: "isSubmitting",
|
|
1013
|
+
value: r.value
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
key: "touched",
|
|
1017
|
+
value: n.value.touched
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
key: "dirty",
|
|
1021
|
+
value: n.value.dirty
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
key: "valid",
|
|
1025
|
+
value: n.value.valid
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
key: "initialValues",
|
|
1029
|
+
value: n.value.initialValues
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
key: "currentValues",
|
|
1033
|
+
value: i
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
key: "errors",
|
|
1037
|
+
value: z(t.value).reduce((u, d) => {
|
|
1038
|
+
var m;
|
|
1039
|
+
const p = (m = t.value[d]) === null || m === void 0 ? void 0 : m[0];
|
|
1040
|
+
return p && (u[d] = p), u;
|
|
1041
|
+
}, {})
|
|
1042
|
+
}
|
|
1043
|
+
]
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function Zt(e) {
|
|
1047
|
+
const t = "id" in e ? e.meta.valid : e.meta.value.valid;
|
|
1048
|
+
return {
|
|
1049
|
+
bgColor: t ? X.success : X.error,
|
|
1050
|
+
textColor: t ? X.black : X.white
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
function yt(e, t, n) {
|
|
1054
|
+
return Ie(n == null ? void 0 : n.type) ? Pi(e, t, n) : Yt(e, t, n);
|
|
1055
|
+
}
|
|
1056
|
+
function Yt(e, t, n) {
|
|
1057
|
+
const { initialValue: i, validateOnMount: r, bails: o, type: u, checkedValue: d, label: m, validateOnValueUpdate: p, uncheckedValue: b, controlled: k, keepValueOnUnmount: S, modelPropName: E, syncVModel: P, form: H } = Mi(_(e), n), L = k ? vt(Me) : void 0, v = H || L;
|
|
1058
|
+
let l = !1;
|
|
1059
|
+
const { id: a, value: s, initialValue: c, meta: f, setState: y, errors: C, errorMessage: O } = Si(e, {
|
|
1060
|
+
modelValue: i,
|
|
1061
|
+
form: v
|
|
1062
|
+
});
|
|
1063
|
+
P && Bi({ value: s, prop: E, handleChange: M });
|
|
1064
|
+
const j = () => {
|
|
1065
|
+
f.touched = !0;
|
|
1066
|
+
}, Q = $(() => {
|
|
1067
|
+
let w = _(t);
|
|
1068
|
+
const N = _(v == null ? void 0 : v.schema);
|
|
1069
|
+
return N && !Fe(N) && (w = ji(N, _(e)) || w), Fe(w) || ke(w) || Array.isArray(w) ? w : Ht(w);
|
|
1070
|
+
});
|
|
1071
|
+
async function B(w) {
|
|
1072
|
+
var N, Z;
|
|
1073
|
+
return v != null && v.validateSchema ? (N = (await v.validateSchema(w)).results[_(e)]) !== null && N !== void 0 ? N : { valid: !0, errors: [] } : Kt(s.value, Q.value, {
|
|
1074
|
+
name: _(e),
|
|
1075
|
+
label: _(m),
|
|
1076
|
+
values: (Z = v == null ? void 0 : v.values) !== null && Z !== void 0 ? Z : {},
|
|
1077
|
+
bails: o
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
const K = nt(async () => (f.pending = !0, f.validated = !0, B("validated-only")), (w) => (l && (w.valid = !0, w.errors = []), y({ errors: w.errors }), f.pending = !1, w)), te = nt(async () => B("silent"), (w) => (l && (w.valid = !0), f.valid = w.valid, w));
|
|
1081
|
+
function R(w) {
|
|
1082
|
+
return (w == null ? void 0 : w.mode) === "silent" ? te() : K();
|
|
1083
|
+
}
|
|
1084
|
+
function M(w, N = !0) {
|
|
1085
|
+
const Z = pt(w);
|
|
1086
|
+
s.value = Z, !p && N && K();
|
|
1087
|
+
}
|
|
1088
|
+
ut(() => {
|
|
1089
|
+
if (r)
|
|
1090
|
+
return K();
|
|
1091
|
+
(!v || !v.validateSchema) && te();
|
|
1092
|
+
});
|
|
1093
|
+
function q(w) {
|
|
1094
|
+
f.touched = w;
|
|
1095
|
+
}
|
|
1096
|
+
let ie, Oe = T(s.value);
|
|
1097
|
+
function fe() {
|
|
1098
|
+
ie = J(s, (w, N) => {
|
|
1099
|
+
if (G(w, N) && G(w, Oe))
|
|
1100
|
+
return;
|
|
1101
|
+
(p ? K : te)(), Oe = T(w);
|
|
1102
|
+
}, {
|
|
1103
|
+
deep: !0
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
fe();
|
|
1107
|
+
function pe(w) {
|
|
1108
|
+
var N;
|
|
1109
|
+
ie == null || ie();
|
|
1110
|
+
const Z = w && "value" in w ? w.value : c.value;
|
|
1111
|
+
y({
|
|
1112
|
+
value: T(Z),
|
|
1113
|
+
initialValue: T(Z),
|
|
1114
|
+
touched: (N = w == null ? void 0 : w.touched) !== null && N !== void 0 ? N : !1,
|
|
1115
|
+
errors: (w == null ? void 0 : w.errors) || []
|
|
1116
|
+
}), f.pending = !1, f.validated = !1, te(), Ce(() => {
|
|
1117
|
+
fe();
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
function ye(w) {
|
|
1121
|
+
s.value = w;
|
|
1122
|
+
}
|
|
1123
|
+
function Ae(w) {
|
|
1124
|
+
y({ errors: Array.isArray(w) ? w : [w] });
|
|
1125
|
+
}
|
|
1126
|
+
const re = {
|
|
1127
|
+
id: a,
|
|
1128
|
+
name: e,
|
|
1129
|
+
label: m,
|
|
1130
|
+
value: s,
|
|
1131
|
+
meta: f,
|
|
1132
|
+
errors: C,
|
|
1133
|
+
errorMessage: O,
|
|
1134
|
+
type: u,
|
|
1135
|
+
checkedValue: d,
|
|
1136
|
+
uncheckedValue: b,
|
|
1137
|
+
bails: o,
|
|
1138
|
+
keepValueOnUnmount: S,
|
|
1139
|
+
resetField: pe,
|
|
1140
|
+
handleReset: () => pe(),
|
|
1141
|
+
validate: R,
|
|
1142
|
+
handleChange: M,
|
|
1143
|
+
handleBlur: j,
|
|
1144
|
+
setState: y,
|
|
1145
|
+
setTouched: q,
|
|
1146
|
+
setErrors: Ae,
|
|
1147
|
+
setValue: ye
|
|
1148
|
+
};
|
|
1149
|
+
if (Dt(ii, re), Ue(t) && typeof _(t) != "function" && J(t, (w, N) => {
|
|
1150
|
+
G(w, N) || (f.validated ? K() : te());
|
|
1151
|
+
}, {
|
|
1152
|
+
deep: !0
|
|
1153
|
+
}), process.env.NODE_ENV !== "production" && (re._vm = Te(), J(() => Object.assign(Object.assign({ errors: C.value }, f), { value: s.value }), Se, {
|
|
1154
|
+
deep: !0
|
|
1155
|
+
}), v || Vi(re)), !v)
|
|
1156
|
+
return re;
|
|
1157
|
+
v.register(re), Tt(() => {
|
|
1158
|
+
l = !0, v.unregister(re);
|
|
1159
|
+
});
|
|
1160
|
+
const Ke = $(() => {
|
|
1161
|
+
const w = Q.value;
|
|
1162
|
+
return !w || ke(w) || Fe(w) || Array.isArray(w) ? {} : Object.keys(w).reduce((N, Z) => {
|
|
1163
|
+
const Ee = mi(w[Z]).map((me) => me.__locatorRef).reduce((me, _e) => {
|
|
1164
|
+
const je = x(v.values, _e) || v.values[_e];
|
|
1165
|
+
return je !== void 0 && (me[_e] = je), me;
|
|
1166
|
+
}, {});
|
|
1167
|
+
return Object.assign(N, Ee), N;
|
|
1168
|
+
}, {});
|
|
1169
|
+
});
|
|
1170
|
+
return J(Ke, (w, N) => {
|
|
1171
|
+
if (!Object.keys(w).length)
|
|
1172
|
+
return;
|
|
1173
|
+
!G(w, N) && (f.validated ? K() : te());
|
|
1174
|
+
}), re;
|
|
1175
|
+
}
|
|
1176
|
+
function Mi(e, t) {
|
|
1177
|
+
const n = () => ({
|
|
1178
|
+
initialValue: void 0,
|
|
1179
|
+
validateOnMount: !1,
|
|
1180
|
+
bails: !0,
|
|
1181
|
+
label: e,
|
|
1182
|
+
validateOnValueUpdate: !0,
|
|
1183
|
+
keepValueOnUnmount: void 0,
|
|
1184
|
+
modelPropName: "modelValue",
|
|
1185
|
+
syncVModel: !0,
|
|
1186
|
+
controlled: !0
|
|
1187
|
+
});
|
|
1188
|
+
if (!t)
|
|
1189
|
+
return n();
|
|
1190
|
+
const i = "valueProp" in t ? t.valueProp : t.checkedValue, r = "standalone" in t ? !t.standalone : t.controlled;
|
|
1191
|
+
return Object.assign(Object.assign(Object.assign({}, n()), t || {}), { controlled: r != null ? r : !0, checkedValue: i });
|
|
1192
|
+
}
|
|
1193
|
+
function ji(e, t) {
|
|
1194
|
+
if (!!e)
|
|
1195
|
+
return e[t];
|
|
1196
|
+
}
|
|
1197
|
+
function Pi(e, t, n) {
|
|
1198
|
+
const i = n != null && n.standalone ? void 0 : vt(Me), r = n == null ? void 0 : n.checkedValue, o = n == null ? void 0 : n.uncheckedValue;
|
|
1199
|
+
function u(d) {
|
|
1200
|
+
const m = d.handleChange, p = $(() => {
|
|
1201
|
+
const k = _(d.value), S = _(r);
|
|
1202
|
+
return Array.isArray(k) ? k.findIndex((E) => G(E, S)) >= 0 : G(S, k);
|
|
1203
|
+
});
|
|
1204
|
+
function b(k, S = !0) {
|
|
1205
|
+
var E;
|
|
1206
|
+
if (p.value === ((E = k == null ? void 0 : k.target) === null || E === void 0 ? void 0 : E.checked)) {
|
|
1207
|
+
S && d.validate();
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
let P = pt(k);
|
|
1211
|
+
i || (P = tt(_(d.value), _(r), _(o))), m(P, S);
|
|
1212
|
+
}
|
|
1213
|
+
return Object.assign(Object.assign({}, d), {
|
|
1214
|
+
checked: p,
|
|
1215
|
+
checkedValue: r,
|
|
1216
|
+
uncheckedValue: o,
|
|
1217
|
+
handleChange: b
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
return u(Yt(e, t, n));
|
|
1221
|
+
}
|
|
1222
|
+
function Bi({ prop: e, value: t, handleChange: n }) {
|
|
1223
|
+
const i = Te();
|
|
1224
|
+
if (!i) {
|
|
1225
|
+
process.env.NODE_ENV !== "production" && console.warn("Failed to setup model events because `useField` was not called in setup.");
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
const r = e || "modelValue", o = `update:${r}`;
|
|
1229
|
+
r in i.props && (J(t, (u) => {
|
|
1230
|
+
G(u, At(i, r)) || i.emit(o, u);
|
|
1231
|
+
}), J(() => At(i, r), (u) => {
|
|
1232
|
+
if (u === ze && t.value === void 0)
|
|
1233
|
+
return;
|
|
1234
|
+
const d = u === ze ? void 0 : u;
|
|
1235
|
+
G(d, ci(t.value, i.props.modelModifiers)) || n(d);
|
|
1236
|
+
}));
|
|
1237
|
+
}
|
|
1238
|
+
function At(e, t) {
|
|
1239
|
+
return e.props[t];
|
|
1240
|
+
}
|
|
1241
|
+
oe({
|
|
1242
|
+
name: "Field",
|
|
1243
|
+
inheritAttrs: !1,
|
|
1244
|
+
props: {
|
|
1245
|
+
as: {
|
|
1246
|
+
type: [String, Object],
|
|
1247
|
+
default: void 0
|
|
1248
|
+
},
|
|
1249
|
+
name: {
|
|
1250
|
+
type: String,
|
|
1251
|
+
required: !0
|
|
1252
|
+
},
|
|
1253
|
+
rules: {
|
|
1254
|
+
type: [Object, String, Function],
|
|
1255
|
+
default: void 0
|
|
1256
|
+
},
|
|
1257
|
+
validateOnMount: {
|
|
1258
|
+
type: Boolean,
|
|
1259
|
+
default: !1
|
|
1260
|
+
},
|
|
1261
|
+
validateOnBlur: {
|
|
1262
|
+
type: Boolean,
|
|
1263
|
+
default: void 0
|
|
1264
|
+
},
|
|
1265
|
+
validateOnChange: {
|
|
1266
|
+
type: Boolean,
|
|
1267
|
+
default: void 0
|
|
1268
|
+
},
|
|
1269
|
+
validateOnInput: {
|
|
1270
|
+
type: Boolean,
|
|
1271
|
+
default: void 0
|
|
1272
|
+
},
|
|
1273
|
+
validateOnModelUpdate: {
|
|
1274
|
+
type: Boolean,
|
|
1275
|
+
default: void 0
|
|
1276
|
+
},
|
|
1277
|
+
bails: {
|
|
1278
|
+
type: Boolean,
|
|
1279
|
+
default: () => mt().bails
|
|
1280
|
+
},
|
|
1281
|
+
label: {
|
|
1282
|
+
type: String,
|
|
1283
|
+
default: void 0
|
|
1284
|
+
},
|
|
1285
|
+
uncheckedValue: {
|
|
1286
|
+
type: null,
|
|
1287
|
+
default: void 0
|
|
1288
|
+
},
|
|
1289
|
+
modelValue: {
|
|
1290
|
+
type: null,
|
|
1291
|
+
default: ze
|
|
1292
|
+
},
|
|
1293
|
+
modelModifiers: {
|
|
1294
|
+
type: null,
|
|
1295
|
+
default: () => ({})
|
|
1296
|
+
},
|
|
1297
|
+
"onUpdate:modelValue": {
|
|
1298
|
+
type: null,
|
|
1299
|
+
default: void 0
|
|
1300
|
+
},
|
|
1301
|
+
standalone: {
|
|
1302
|
+
type: Boolean,
|
|
1303
|
+
default: !1
|
|
1304
|
+
},
|
|
1305
|
+
keepValue: {
|
|
1306
|
+
type: Boolean,
|
|
1307
|
+
default: void 0
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
setup(e, t) {
|
|
1311
|
+
const n = ce(e, "rules"), i = ce(e, "name"), r = ce(e, "label"), o = ce(e, "uncheckedValue"), u = ce(e, "keepValue"), { errors: d, value: m, errorMessage: p, validate: b, handleChange: k, handleBlur: S, setTouched: E, resetField: P, handleReset: H, meta: L, checked: v, setErrors: l } = yt(i, n, {
|
|
1312
|
+
validateOnMount: e.validateOnMount,
|
|
1313
|
+
bails: e.bails,
|
|
1314
|
+
standalone: e.standalone,
|
|
1315
|
+
type: t.attrs.type,
|
|
1316
|
+
initialValue: Ui(e, t),
|
|
1317
|
+
checkedValue: t.attrs.value,
|
|
1318
|
+
uncheckedValue: o,
|
|
1319
|
+
label: r,
|
|
1320
|
+
validateOnValueUpdate: !1,
|
|
1321
|
+
keepValueOnUnmount: u
|
|
1322
|
+
}), a = function(O, j = !0) {
|
|
1323
|
+
k(O, j), t.emit("update:modelValue", m.value);
|
|
1324
|
+
}, s = (C) => {
|
|
1325
|
+
Ie(t.attrs.type) || (m.value = pt(C));
|
|
1326
|
+
}, c = function(O) {
|
|
1327
|
+
s(O), t.emit("update:modelValue", m.value);
|
|
1328
|
+
}, f = $(() => {
|
|
1329
|
+
const { validateOnInput: C, validateOnChange: O, validateOnBlur: j, validateOnModelUpdate: Q } = xi(e), B = [S, t.attrs.onBlur, j ? b : void 0].filter(Boolean), K = [(q) => a(q, C), t.attrs.onInput].filter(Boolean), te = [(q) => a(q, O), t.attrs.onChange].filter(Boolean), R = {
|
|
1330
|
+
name: e.name,
|
|
1331
|
+
onBlur: B,
|
|
1332
|
+
onInput: K,
|
|
1333
|
+
onChange: te
|
|
1334
|
+
};
|
|
1335
|
+
R["onUpdate:modelValue"] = (q) => a(q, Q), Ie(t.attrs.type) && v && (R.checked = v.value);
|
|
1336
|
+
const M = Et(e, t);
|
|
1337
|
+
return si(M, t.attrs) && (R.value = m.value), R;
|
|
1338
|
+
});
|
|
1339
|
+
function y() {
|
|
1340
|
+
return {
|
|
1341
|
+
field: f.value,
|
|
1342
|
+
value: m.value,
|
|
1343
|
+
meta: L,
|
|
1344
|
+
errors: d.value,
|
|
1345
|
+
errorMessage: p.value,
|
|
1346
|
+
validate: b,
|
|
1347
|
+
resetField: P,
|
|
1348
|
+
handleChange: a,
|
|
1349
|
+
handleInput: c,
|
|
1350
|
+
handleReset: H,
|
|
1351
|
+
handleBlur: S,
|
|
1352
|
+
setTouched: E,
|
|
1353
|
+
setErrors: l
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
return t.expose({
|
|
1357
|
+
setErrors: l,
|
|
1358
|
+
setTouched: E,
|
|
1359
|
+
reset: P,
|
|
1360
|
+
validate: b,
|
|
1361
|
+
handleChange: k
|
|
1362
|
+
}), () => {
|
|
1363
|
+
const C = dt(Et(e, t)), O = He(C, t, y);
|
|
1364
|
+
return C ? Re(C, Object.assign(Object.assign({}, t.attrs), f.value), O) : O;
|
|
23
1365
|
};
|
|
24
1366
|
}
|
|
25
1367
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1368
|
+
function Et(e, t) {
|
|
1369
|
+
let n = e.as || "";
|
|
1370
|
+
return !e.as && !t.slots.default && (n = "input"), n;
|
|
1371
|
+
}
|
|
1372
|
+
function xi(e) {
|
|
1373
|
+
var t, n, i, r;
|
|
1374
|
+
const { validateOnInput: o, validateOnChange: u, validateOnBlur: d, validateOnModelUpdate: m } = mt();
|
|
1375
|
+
return {
|
|
1376
|
+
validateOnInput: (t = e.validateOnInput) !== null && t !== void 0 ? t : o,
|
|
1377
|
+
validateOnChange: (n = e.validateOnChange) !== null && n !== void 0 ? n : u,
|
|
1378
|
+
validateOnBlur: (i = e.validateOnBlur) !== null && i !== void 0 ? i : d,
|
|
1379
|
+
validateOnModelUpdate: (r = e.validateOnModelUpdate) !== null && r !== void 0 ? r : m
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
function Ui(e, t) {
|
|
1383
|
+
return Ie(t.attrs.type) ? Ct(e, "modelValue") ? e.modelValue : void 0 : Ct(e, "modelValue") ? e.modelValue : t.attrs.value;
|
|
1384
|
+
}
|
|
1385
|
+
let Ri = 0;
|
|
1386
|
+
function zi(e) {
|
|
1387
|
+
var t;
|
|
1388
|
+
const n = Ri++, i = /* @__PURE__ */ new Set();
|
|
1389
|
+
let r = !1;
|
|
1390
|
+
const o = Y({}), u = Y(!1), d = Y(0), m = [], p = ct(T(_(e == null ? void 0 : e.initialValues) || {})), { errorBag: b, setErrorBag: k, setFieldErrorBag: S } = Hi(e == null ? void 0 : e.initialErrors), E = $(() => z(b.value).reduce((h, g) => {
|
|
1391
|
+
const I = b.value[g];
|
|
1392
|
+
return I && I.length && (h[g] = I[0]), h;
|
|
1393
|
+
}, {}));
|
|
1394
|
+
function P(h) {
|
|
1395
|
+
const g = o.value[h];
|
|
1396
|
+
return Array.isArray(g) ? g[0] : g;
|
|
1397
|
+
}
|
|
1398
|
+
function H(h) {
|
|
1399
|
+
return !!o.value[h];
|
|
1400
|
+
}
|
|
1401
|
+
const L = $(() => z(o.value).reduce((h, g) => {
|
|
1402
|
+
const I = P(g);
|
|
1403
|
+
return I && (h[g] = { name: _(I.name) || "", label: _(I.label) || "" }), h;
|
|
1404
|
+
}, {})), v = $(() => z(o.value).reduce((h, g) => {
|
|
1405
|
+
var I;
|
|
1406
|
+
const A = P(g);
|
|
1407
|
+
return A && (h[g] = (I = A.bails) !== null && I !== void 0 ? I : !0), h;
|
|
1408
|
+
}, {})), l = Object.assign({}, (e == null ? void 0 : e.initialErrors) || {}), a = (t = e == null ? void 0 : e.keepValuesOnUnmount) !== null && t !== void 0 ? t : !1, { initialValues: s, originalInitialValues: c, setInitialValues: f } = Gi(o, p, e == null ? void 0 : e.initialValues), y = $i(o, p, c, E), C = $(() => [...i, ...z(o.value)].reduce((h, g) => {
|
|
1409
|
+
const I = x(p, g);
|
|
1410
|
+
return ue(h, g, I), h;
|
|
1411
|
+
}, {})), O = e == null ? void 0 : e.validationSchema, j = It(bt, 5), Q = It(bt, 5), B = nt(async (h) => await h === "silent" ? j() : Q(), (h, [g]) => {
|
|
1412
|
+
const I = M.fieldsByPath.value || {}, A = z(M.errorBag.value);
|
|
1413
|
+
return [
|
|
1414
|
+
.../* @__PURE__ */ new Set([...z(h.results), ...z(I), ...A])
|
|
1415
|
+
].reduce((V, F) => {
|
|
1416
|
+
const W = I[F], le = (h.results[F] || { errors: [] }).errors, ae = {
|
|
1417
|
+
errors: le,
|
|
1418
|
+
valid: !le.length
|
|
1419
|
+
};
|
|
1420
|
+
if (V.results[F] = ae, ae.valid || (V.errors[F] = ae.errors[0]), !W)
|
|
1421
|
+
return fe(F, le), V;
|
|
1422
|
+
if (ie(W, (Ve) => Ve.meta.valid = ae.valid), g === "silent")
|
|
1423
|
+
return V;
|
|
1424
|
+
const dn = Array.isArray(W) ? W.some((Ve) => Ve.meta.validated) : W.meta.validated;
|
|
1425
|
+
return g === "validated-only" && !dn || ie(W, (Ve) => Ve.setState({ errors: ae.errors })), V;
|
|
1426
|
+
}, { valid: h.valid, results: {}, errors: {} });
|
|
1427
|
+
});
|
|
1428
|
+
function K(h) {
|
|
1429
|
+
return function(I, A) {
|
|
1430
|
+
return function(V) {
|
|
1431
|
+
return V instanceof Event && (V.preventDefault(), V.stopPropagation()), N(z(o.value).reduce((F, W) => (F[W] = !0, F), {})), u.value = !0, d.value++, Pe().then((F) => {
|
|
1432
|
+
const W = T(p);
|
|
1433
|
+
if (F.valid && typeof I == "function") {
|
|
1434
|
+
const le = T(C.value);
|
|
1435
|
+
return I(h ? le : W, {
|
|
1436
|
+
evt: V,
|
|
1437
|
+
controlledValues: le,
|
|
1438
|
+
setErrors: pe,
|
|
1439
|
+
setFieldError: fe,
|
|
1440
|
+
setTouched: N,
|
|
1441
|
+
setFieldTouched: w,
|
|
1442
|
+
setValues: Ae,
|
|
1443
|
+
setFieldValue: ye,
|
|
1444
|
+
resetForm: Ee,
|
|
1445
|
+
resetField: Z
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
!F.valid && typeof A == "function" && A({
|
|
1449
|
+
values: W,
|
|
1450
|
+
evt: V,
|
|
1451
|
+
errors: F.errors,
|
|
1452
|
+
results: F.results
|
|
1453
|
+
});
|
|
1454
|
+
}).then((F) => (u.value = !1, F), (F) => {
|
|
1455
|
+
throw u.value = !1, F;
|
|
1456
|
+
});
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
const R = K(!1);
|
|
1461
|
+
R.withControlled = K(!0);
|
|
1462
|
+
const M = {
|
|
1463
|
+
formId: n,
|
|
1464
|
+
fieldsByPath: o,
|
|
1465
|
+
values: p,
|
|
1466
|
+
controlledValues: C,
|
|
1467
|
+
errorBag: b,
|
|
1468
|
+
errors: E,
|
|
1469
|
+
schema: O,
|
|
1470
|
+
submitCount: d,
|
|
1471
|
+
meta: y,
|
|
1472
|
+
isSubmitting: u,
|
|
1473
|
+
fieldArrays: m,
|
|
1474
|
+
keepValuesOnUnmount: a,
|
|
1475
|
+
validateSchema: _(O) ? B : void 0,
|
|
1476
|
+
validate: Pe,
|
|
1477
|
+
register: je,
|
|
1478
|
+
unregister: on,
|
|
1479
|
+
setFieldErrorBag: S,
|
|
1480
|
+
validateField: qe,
|
|
1481
|
+
setFieldValue: ye,
|
|
1482
|
+
setValues: Ae,
|
|
1483
|
+
setErrors: pe,
|
|
1484
|
+
setFieldError: fe,
|
|
1485
|
+
setFieldTouched: w,
|
|
1486
|
+
setTouched: N,
|
|
1487
|
+
resetForm: Ee,
|
|
1488
|
+
resetField: Z,
|
|
1489
|
+
handleSubmit: R,
|
|
1490
|
+
stageInitialValue: sn,
|
|
1491
|
+
unsetInitialValue: ln,
|
|
1492
|
+
setFieldInitialValue: _t,
|
|
1493
|
+
useFieldModel: Ke
|
|
1494
|
+
};
|
|
1495
|
+
function q(h) {
|
|
1496
|
+
return Array.isArray(h);
|
|
1497
|
+
}
|
|
1498
|
+
function ie(h, g) {
|
|
1499
|
+
return Array.isArray(h) ? h.forEach(g) : g(h);
|
|
1500
|
+
}
|
|
1501
|
+
function Oe(h) {
|
|
1502
|
+
Object.values(o.value).forEach((g) => {
|
|
1503
|
+
!g || ie(g, h);
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
function fe(h, g) {
|
|
1507
|
+
S(h, g);
|
|
1508
|
+
}
|
|
1509
|
+
function pe(h) {
|
|
1510
|
+
k(h);
|
|
1511
|
+
}
|
|
1512
|
+
function ye(h, g, { force: I } = { force: !1 }) {
|
|
1513
|
+
var A;
|
|
1514
|
+
const D = o.value[h], V = T(g);
|
|
1515
|
+
if (!D) {
|
|
1516
|
+
ue(p, h, V);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
if (q(D) && ((A = D[0]) === null || A === void 0 ? void 0 : A.type) === "checkbox" && !Array.isArray(g)) {
|
|
1520
|
+
const W = T(tt(x(p, h) || [], g, void 0));
|
|
1521
|
+
ue(p, h, W);
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
let F = V;
|
|
1525
|
+
!q(D) && D.type === "checkbox" && !I && !r && (F = T(tt(x(p, h), g, _(D.uncheckedValue)))), ue(p, h, F);
|
|
1526
|
+
}
|
|
1527
|
+
function Ae(h) {
|
|
1528
|
+
z(p).forEach((g) => {
|
|
1529
|
+
delete p[g];
|
|
1530
|
+
}), z(h).forEach((g) => {
|
|
1531
|
+
ye(g, h[g]);
|
|
1532
|
+
}), m.forEach((g) => g && g.reset());
|
|
1533
|
+
}
|
|
1534
|
+
function re(h) {
|
|
1535
|
+
const { value: g } = Wt(h, void 0, M);
|
|
1536
|
+
return J(g, () => {
|
|
1537
|
+
H(_(h)) || Pe({ mode: "validated-only" });
|
|
1538
|
+
}, {
|
|
1539
|
+
deep: !0
|
|
1540
|
+
}), i.add(_(h)), g;
|
|
1541
|
+
}
|
|
1542
|
+
function Ke(h) {
|
|
1543
|
+
return Array.isArray(h) ? h.map(re) : re(h);
|
|
1544
|
+
}
|
|
1545
|
+
function w(h, g) {
|
|
1546
|
+
const I = o.value[h];
|
|
1547
|
+
I && ie(I, (A) => A.setTouched(g));
|
|
1548
|
+
}
|
|
1549
|
+
function N(h) {
|
|
1550
|
+
z(h).forEach((g) => {
|
|
1551
|
+
w(g, !!h[g]);
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
function Z(h, g) {
|
|
1555
|
+
const I = o.value[h];
|
|
1556
|
+
I && ie(I, (A) => A.resetField(g));
|
|
1557
|
+
}
|
|
1558
|
+
function Ee(h) {
|
|
1559
|
+
r = !0, Oe((I) => I.resetField());
|
|
1560
|
+
const g = h != null && h.values ? h.values : c.value;
|
|
1561
|
+
f(g), Ae(g), h != null && h.touched && N(h.touched), pe((h == null ? void 0 : h.errors) || {}), d.value = (h == null ? void 0 : h.submitCount) || 0, Ce(() => {
|
|
1562
|
+
r = !1;
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
function me(h, g) {
|
|
1566
|
+
const I = bn(h), A = g;
|
|
1567
|
+
if (!o.value[A]) {
|
|
1568
|
+
o.value[A] = I;
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1571
|
+
const D = o.value[A];
|
|
1572
|
+
D && !Array.isArray(D) && (o.value[A] = [D]), o.value[A] = [...o.value[A], I];
|
|
1573
|
+
}
|
|
1574
|
+
function _e(h, g) {
|
|
1575
|
+
const I = g, A = o.value[I];
|
|
1576
|
+
if (!!A) {
|
|
1577
|
+
if (!q(A) && h.id === A.id) {
|
|
1578
|
+
delete o.value[I];
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
if (q(A)) {
|
|
1582
|
+
const D = A.findIndex((V) => V.id === h.id);
|
|
1583
|
+
if (D === -1)
|
|
1584
|
+
return;
|
|
1585
|
+
A.splice(D, 1), A.length || delete o.value[I];
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
function je(h) {
|
|
1590
|
+
const g = _(h.name);
|
|
1591
|
+
me(h, g), Ue(h.name) && J(h.name, async (A, D) => {
|
|
1592
|
+
await Ce(), _e(h, D), me(h, A), (E.value[D] || E.value[A]) && (fe(D, void 0), qe(A)), await Ce(), H(D) || Be(p, D);
|
|
1593
|
+
});
|
|
1594
|
+
const I = _(h.errorMessage);
|
|
1595
|
+
I && (l == null ? void 0 : l[g]) !== I && qe(g), delete l[g];
|
|
1596
|
+
}
|
|
1597
|
+
function on(h) {
|
|
1598
|
+
const g = _(h.name), I = o.value[g], A = !!I && q(I);
|
|
1599
|
+
_e(h, g), Ce(() => {
|
|
1600
|
+
var D;
|
|
1601
|
+
const V = (D = _(h.keepValueOnUnmount)) !== null && D !== void 0 ? D : _(a), F = x(p, g);
|
|
1602
|
+
if (A && (I === o.value[g] || !o.value[g]) && !V)
|
|
1603
|
+
if (Array.isArray(F)) {
|
|
1604
|
+
const le = F.findIndex((ae) => G(ae, _(h.checkedValue)));
|
|
1605
|
+
if (le > -1) {
|
|
1606
|
+
const ae = [...F];
|
|
1607
|
+
ae.splice(le, 1), ye(g, ae, { force: !0 });
|
|
1608
|
+
}
|
|
1609
|
+
} else
|
|
1610
|
+
F === _(h.checkedValue) && Be(p, g);
|
|
1611
|
+
if (!H(g)) {
|
|
1612
|
+
if (fe(g, void 0), V || A && Array.isArray(F) && !Rt(F))
|
|
1613
|
+
return;
|
|
1614
|
+
Be(p, g);
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
async function Pe(h) {
|
|
1619
|
+
const g = (h == null ? void 0 : h.mode) || "force";
|
|
1620
|
+
if (g === "force" && Oe((V) => V.meta.validated = !0), M.validateSchema)
|
|
1621
|
+
return M.validateSchema(g);
|
|
1622
|
+
const I = await Promise.all(Object.values(o.value).map((V) => {
|
|
1623
|
+
const F = Array.isArray(V) ? V[0] : V;
|
|
1624
|
+
return F ? F.validate(h).then((W) => ({
|
|
1625
|
+
key: _(F.name),
|
|
1626
|
+
valid: W.valid,
|
|
1627
|
+
errors: W.errors
|
|
1628
|
+
})) : Promise.resolve({ key: "", valid: !0, errors: [] });
|
|
1629
|
+
})), A = {}, D = {};
|
|
1630
|
+
for (const V of I)
|
|
1631
|
+
A[V.key] = {
|
|
1632
|
+
valid: V.valid,
|
|
1633
|
+
errors: V.errors
|
|
1634
|
+
}, V.errors.length && (D[V.key] = V.errors[0]);
|
|
1635
|
+
return {
|
|
1636
|
+
valid: I.every((V) => V.valid),
|
|
1637
|
+
results: A,
|
|
1638
|
+
errors: D
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
async function qe(h) {
|
|
1642
|
+
const g = o.value[h];
|
|
1643
|
+
return g ? Array.isArray(g) ? g.map((I) => I.validate())[0] : g.validate() : (Pt(`field with name ${h} was not found`), Promise.resolve({ errors: [], valid: !0 }));
|
|
1644
|
+
}
|
|
1645
|
+
function ln(h) {
|
|
1646
|
+
Be(s.value, h);
|
|
1647
|
+
}
|
|
1648
|
+
function sn(h, g, I = !1) {
|
|
1649
|
+
ue(p, h, g), _t(h, g), I && !(e != null && e.initialValues) && ue(c.value, h, T(g));
|
|
1650
|
+
}
|
|
1651
|
+
function _t(h, g) {
|
|
1652
|
+
ue(s.value, h, T(g));
|
|
1653
|
+
}
|
|
1654
|
+
async function bt() {
|
|
1655
|
+
const h = _(O);
|
|
1656
|
+
return h ? Fe(h) ? await ki(h, p) : await Ii(h, p, {
|
|
1657
|
+
names: L.value,
|
|
1658
|
+
bailsMap: v.value
|
|
1659
|
+
}) : { valid: !0, results: {}, errors: {} };
|
|
1660
|
+
}
|
|
1661
|
+
const un = R((h, { evt: g }) => {
|
|
1662
|
+
$t(g) && g.target.submit();
|
|
1663
|
+
});
|
|
1664
|
+
return ut(() => {
|
|
1665
|
+
if (e != null && e.initialErrors && pe(e.initialErrors), e != null && e.initialTouched && N(e.initialTouched), e != null && e.validateOnMount) {
|
|
1666
|
+
Pe();
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
M.validateSchema && M.validateSchema("silent");
|
|
1670
|
+
}), Ue(O) && J(O, () => {
|
|
1671
|
+
var h;
|
|
1672
|
+
(h = M.validateSchema) === null || h === void 0 || h.call(M, "validated-only");
|
|
1673
|
+
}), Dt(Me, M), process.env.NODE_ENV !== "production" && (Ei(M), J(() => Object.assign(Object.assign({ errors: b.value }, y.value), { values: p, isSubmitting: u.value, submitCount: d.value }), Se, {
|
|
1674
|
+
deep: !0
|
|
1675
|
+
})), Object.assign(Object.assign({}, M), { handleReset: () => Ee(), submitForm: un });
|
|
1676
|
+
}
|
|
1677
|
+
function $i(e, t, n, i) {
|
|
1678
|
+
const r = {
|
|
1679
|
+
touched: "some",
|
|
1680
|
+
pending: "some",
|
|
1681
|
+
valid: "every"
|
|
1682
|
+
}, o = $(() => !G(t, _(n)));
|
|
1683
|
+
function u() {
|
|
1684
|
+
const m = Object.values(e.value).flat(1).filter(Boolean);
|
|
1685
|
+
return z(r).reduce((p, b) => {
|
|
1686
|
+
const k = r[b];
|
|
1687
|
+
return p[b] = m[k]((S) => S.meta[b]), p;
|
|
1688
|
+
}, {});
|
|
1689
|
+
}
|
|
1690
|
+
const d = ct(u());
|
|
1691
|
+
return _n(() => {
|
|
1692
|
+
const m = u();
|
|
1693
|
+
d.touched = m.touched, d.valid = m.valid, d.pending = m.pending;
|
|
1694
|
+
}), $(() => Object.assign(Object.assign({ initialValues: _(n) }, d), { valid: d.valid && !z(i.value).length, dirty: o.value }));
|
|
1695
|
+
}
|
|
1696
|
+
function Gi(e, t, n) {
|
|
1697
|
+
const i = Y(T(_(n)) || {}), r = Y(T(_(n)) || {});
|
|
1698
|
+
function o(u, d = !1) {
|
|
1699
|
+
i.value = T(u), r.value = T(u), d && z(e.value).forEach((m) => {
|
|
1700
|
+
const p = e.value[m], b = Array.isArray(p) ? p.some((S) => S.meta.touched) : p == null ? void 0 : p.meta.touched;
|
|
1701
|
+
if (!p || b)
|
|
1702
|
+
return;
|
|
1703
|
+
const k = x(i.value, m);
|
|
1704
|
+
ue(t, m, T(k));
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
return Ue(n) && J(n, (u) => {
|
|
1708
|
+
o(u, !0);
|
|
1709
|
+
}, {
|
|
1710
|
+
deep: !0
|
|
1711
|
+
}), {
|
|
1712
|
+
initialValues: i,
|
|
1713
|
+
originalInitialValues: r,
|
|
1714
|
+
setInitialValues: o
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
function Hi(e) {
|
|
1718
|
+
const t = Y({});
|
|
1719
|
+
function n(o) {
|
|
1720
|
+
return Array.isArray(o) ? o : o ? [o] : [];
|
|
1721
|
+
}
|
|
1722
|
+
function i(o, u) {
|
|
1723
|
+
if (!u) {
|
|
1724
|
+
delete t.value[o];
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
t.value[o] = n(u);
|
|
1728
|
+
}
|
|
1729
|
+
function r(o) {
|
|
1730
|
+
t.value = z(o).reduce((u, d) => {
|
|
1731
|
+
const m = o[d];
|
|
1732
|
+
return m && (u[d] = n(m)), u;
|
|
1733
|
+
}, {});
|
|
1734
|
+
}
|
|
1735
|
+
return e && r(e), {
|
|
1736
|
+
errorBag: t,
|
|
1737
|
+
setErrorBag: r,
|
|
1738
|
+
setFieldErrorBag: i
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
oe({
|
|
1742
|
+
name: "Form",
|
|
1743
|
+
inheritAttrs: !1,
|
|
1744
|
+
props: {
|
|
1745
|
+
as: {
|
|
1746
|
+
type: String,
|
|
1747
|
+
default: "form"
|
|
1748
|
+
},
|
|
1749
|
+
validationSchema: {
|
|
1750
|
+
type: Object,
|
|
1751
|
+
default: void 0
|
|
1752
|
+
},
|
|
1753
|
+
initialValues: {
|
|
1754
|
+
type: Object,
|
|
1755
|
+
default: void 0
|
|
1756
|
+
},
|
|
1757
|
+
initialErrors: {
|
|
1758
|
+
type: Object,
|
|
1759
|
+
default: void 0
|
|
1760
|
+
},
|
|
1761
|
+
initialTouched: {
|
|
1762
|
+
type: Object,
|
|
1763
|
+
default: void 0
|
|
1764
|
+
},
|
|
1765
|
+
validateOnMount: {
|
|
1766
|
+
type: Boolean,
|
|
1767
|
+
default: !1
|
|
1768
|
+
},
|
|
1769
|
+
onSubmit: {
|
|
1770
|
+
type: Function,
|
|
1771
|
+
default: void 0
|
|
1772
|
+
},
|
|
1773
|
+
onInvalidSubmit: {
|
|
1774
|
+
type: Function,
|
|
1775
|
+
default: void 0
|
|
1776
|
+
},
|
|
1777
|
+
keepValues: {
|
|
1778
|
+
type: Boolean,
|
|
1779
|
+
default: !1
|
|
1780
|
+
}
|
|
1781
|
+
},
|
|
1782
|
+
setup(e, t) {
|
|
1783
|
+
const n = ce(e, "initialValues"), i = ce(e, "validationSchema"), r = ce(e, "keepValues"), { errors: o, values: u, meta: d, isSubmitting: m, submitCount: p, controlledValues: b, validate: k, validateField: S, handleReset: E, resetForm: P, handleSubmit: H, setErrors: L, setFieldError: v, setFieldValue: l, setValues: a, setFieldTouched: s, setTouched: c, resetField: f } = zi({
|
|
1784
|
+
validationSchema: i.value ? i : void 0,
|
|
1785
|
+
initialValues: n,
|
|
1786
|
+
initialErrors: e.initialErrors,
|
|
1787
|
+
initialTouched: e.initialTouched,
|
|
1788
|
+
validateOnMount: e.validateOnMount,
|
|
1789
|
+
keepValuesOnUnmount: r
|
|
1790
|
+
}), y = H((R, { evt: M }) => {
|
|
1791
|
+
$t(M) && M.target.submit();
|
|
1792
|
+
}, e.onInvalidSubmit), C = e.onSubmit ? H(e.onSubmit, e.onInvalidSubmit) : y;
|
|
1793
|
+
function O(R) {
|
|
1794
|
+
ft(R) && R.preventDefault(), E(), typeof t.attrs.onReset == "function" && t.attrs.onReset();
|
|
1795
|
+
}
|
|
1796
|
+
function j(R, M) {
|
|
1797
|
+
return H(typeof R == "function" && !M ? R : M, e.onInvalidSubmit)(R);
|
|
1798
|
+
}
|
|
1799
|
+
function Q() {
|
|
1800
|
+
return T(u);
|
|
1801
|
+
}
|
|
1802
|
+
function B() {
|
|
1803
|
+
return T(d.value);
|
|
1804
|
+
}
|
|
1805
|
+
function K() {
|
|
1806
|
+
return T(o.value);
|
|
1807
|
+
}
|
|
1808
|
+
function te() {
|
|
1809
|
+
return {
|
|
1810
|
+
meta: d.value,
|
|
1811
|
+
errors: o.value,
|
|
1812
|
+
values: u,
|
|
1813
|
+
isSubmitting: m.value,
|
|
1814
|
+
submitCount: p.value,
|
|
1815
|
+
controlledValues: b.value,
|
|
1816
|
+
validate: k,
|
|
1817
|
+
validateField: S,
|
|
1818
|
+
handleSubmit: j,
|
|
1819
|
+
handleReset: E,
|
|
1820
|
+
submitForm: y,
|
|
1821
|
+
setErrors: L,
|
|
1822
|
+
setFieldError: v,
|
|
1823
|
+
setFieldValue: l,
|
|
1824
|
+
setValues: a,
|
|
1825
|
+
setFieldTouched: s,
|
|
1826
|
+
setTouched: c,
|
|
1827
|
+
resetForm: P,
|
|
1828
|
+
resetField: f,
|
|
1829
|
+
getValues: Q,
|
|
1830
|
+
getMeta: B,
|
|
1831
|
+
getErrors: K
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
return t.expose({
|
|
1835
|
+
setFieldError: v,
|
|
1836
|
+
setErrors: L,
|
|
1837
|
+
setFieldValue: l,
|
|
1838
|
+
setValues: a,
|
|
1839
|
+
setFieldTouched: s,
|
|
1840
|
+
setTouched: c,
|
|
1841
|
+
resetForm: P,
|
|
1842
|
+
validate: k,
|
|
1843
|
+
validateField: S,
|
|
1844
|
+
resetField: f,
|
|
1845
|
+
getValues: Q,
|
|
1846
|
+
getMeta: B,
|
|
1847
|
+
getErrors: K
|
|
1848
|
+
}), function() {
|
|
1849
|
+
const M = e.as === "form" ? e.as : dt(e.as), q = He(M, t, te);
|
|
1850
|
+
if (!e.as)
|
|
1851
|
+
return q;
|
|
1852
|
+
const ie = e.as === "form" ? {
|
|
1853
|
+
novalidate: !0
|
|
1854
|
+
} : {};
|
|
1855
|
+
return Re(M, Object.assign(Object.assign(Object.assign({}, ie), t.attrs), { onSubmit: C, onReset: O }), q);
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
});
|
|
1859
|
+
function Ki(e) {
|
|
1860
|
+
const t = vt(Me, void 0), n = Y([]), i = () => {
|
|
1861
|
+
}, r = {
|
|
1862
|
+
fields: n,
|
|
1863
|
+
remove: i,
|
|
1864
|
+
push: i,
|
|
1865
|
+
swap: i,
|
|
1866
|
+
insert: i,
|
|
1867
|
+
update: i,
|
|
1868
|
+
replace: i,
|
|
1869
|
+
prepend: i,
|
|
1870
|
+
move: i
|
|
1871
|
+
};
|
|
1872
|
+
if (!t)
|
|
1873
|
+
return Je("FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly"), r;
|
|
1874
|
+
if (!_(e))
|
|
1875
|
+
return Je("FieldArray requires a field path to be provided, did you forget to pass the `name` prop?"), r;
|
|
1876
|
+
const o = t.fieldArrays.find((a) => _(a.path) === _(e));
|
|
1877
|
+
if (o)
|
|
1878
|
+
return o;
|
|
1879
|
+
let u = 0;
|
|
1880
|
+
function d() {
|
|
1881
|
+
const a = x(t == null ? void 0 : t.values, _(e), []) || [];
|
|
1882
|
+
n.value = a.map(p), m();
|
|
1883
|
+
}
|
|
1884
|
+
d();
|
|
1885
|
+
function m() {
|
|
1886
|
+
const a = n.value.length;
|
|
1887
|
+
for (let s = 0; s < a; s++) {
|
|
1888
|
+
const c = n.value[s];
|
|
1889
|
+
c.isFirst = s === 0, c.isLast = s === a - 1;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
function p(a) {
|
|
1893
|
+
const s = u++;
|
|
1894
|
+
return {
|
|
1895
|
+
key: s,
|
|
1896
|
+
value: fi({
|
|
1897
|
+
get() {
|
|
1898
|
+
const f = x(t == null ? void 0 : t.values, _(e), []) || [], y = n.value.findIndex((C) => C.key === s);
|
|
1899
|
+
return y === -1 ? a : f[y];
|
|
1900
|
+
},
|
|
1901
|
+
set(f) {
|
|
1902
|
+
const y = n.value.findIndex((C) => C.key === s);
|
|
1903
|
+
if (y === -1) {
|
|
1904
|
+
Je("Attempting to update a non-existent array item");
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
H(y, f);
|
|
1908
|
+
}
|
|
1909
|
+
}),
|
|
1910
|
+
isFirst: !1,
|
|
1911
|
+
isLast: !1
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
function b(a) {
|
|
1915
|
+
const s = _(e), c = x(t == null ? void 0 : t.values, s);
|
|
1916
|
+
if (!c || !Array.isArray(c))
|
|
1917
|
+
return;
|
|
1918
|
+
const f = [...c];
|
|
1919
|
+
f.splice(a, 1), t == null || t.unsetInitialValue(s + `[${a}]`), t == null || t.setFieldValue(s, f), n.value.splice(a, 1), m();
|
|
1920
|
+
}
|
|
1921
|
+
function k(a) {
|
|
1922
|
+
const s = _(e), c = x(t == null ? void 0 : t.values, s), f = Le(c) ? [] : c;
|
|
1923
|
+
if (!Array.isArray(f))
|
|
1924
|
+
return;
|
|
1925
|
+
const y = [...f];
|
|
1926
|
+
y.push(a), t == null || t.stageInitialValue(s + `[${y.length - 1}]`, a), t == null || t.setFieldValue(s, y), n.value.push(p(a)), m();
|
|
1927
|
+
}
|
|
1928
|
+
function S(a, s) {
|
|
1929
|
+
const c = _(e), f = x(t == null ? void 0 : t.values, c);
|
|
1930
|
+
if (!Array.isArray(f) || !(a in f) || !(s in f))
|
|
1931
|
+
return;
|
|
1932
|
+
const y = [...f], C = [...n.value], O = y[a];
|
|
1933
|
+
y[a] = y[s], y[s] = O;
|
|
1934
|
+
const j = C[a];
|
|
1935
|
+
C[a] = C[s], C[s] = j, t == null || t.setFieldValue(c, y), n.value = C, m();
|
|
1936
|
+
}
|
|
1937
|
+
function E(a, s) {
|
|
1938
|
+
const c = _(e), f = x(t == null ? void 0 : t.values, c);
|
|
1939
|
+
if (!Array.isArray(f) || f.length < a)
|
|
1940
|
+
return;
|
|
1941
|
+
const y = [...f], C = [...n.value];
|
|
1942
|
+
y.splice(a, 0, s), C.splice(a, 0, p(s)), t == null || t.setFieldValue(c, y), n.value = C, m();
|
|
1943
|
+
}
|
|
1944
|
+
function P(a) {
|
|
1945
|
+
const s = _(e);
|
|
1946
|
+
t == null || t.setFieldValue(s, a), d();
|
|
1947
|
+
}
|
|
1948
|
+
function H(a, s) {
|
|
1949
|
+
const c = _(e), f = x(t == null ? void 0 : t.values, c);
|
|
1950
|
+
!Array.isArray(f) || f.length - 1 < a || (t == null || t.setFieldValue(`${c}[${a}]`, s), t == null || t.validate({ mode: "validated-only" }));
|
|
1951
|
+
}
|
|
1952
|
+
function L(a) {
|
|
1953
|
+
const s = _(e), c = x(t == null ? void 0 : t.values, s), f = Le(c) ? [] : c;
|
|
1954
|
+
if (!Array.isArray(f))
|
|
1955
|
+
return;
|
|
1956
|
+
const y = [a, ...f];
|
|
1957
|
+
t == null || t.stageInitialValue(s + `[${y.length - 1}]`, a), t == null || t.setFieldValue(s, y), n.value.unshift(p(a)), m();
|
|
1958
|
+
}
|
|
1959
|
+
function v(a, s) {
|
|
1960
|
+
const c = _(e), f = x(t == null ? void 0 : t.values, c), y = Le(f) ? [] : [...f];
|
|
1961
|
+
if (!Array.isArray(f) || !(a in f) || !(s in f))
|
|
1962
|
+
return;
|
|
1963
|
+
const C = [...n.value], O = C[a];
|
|
1964
|
+
C.splice(a, 1), C.splice(s, 0, O);
|
|
1965
|
+
const j = y[a];
|
|
1966
|
+
y.splice(a, 1), y.splice(s, 0, j), t == null || t.setFieldValue(c, y), n.value = C, m();
|
|
1967
|
+
}
|
|
1968
|
+
const l = {
|
|
1969
|
+
fields: n,
|
|
1970
|
+
remove: b,
|
|
1971
|
+
push: k,
|
|
1972
|
+
swap: S,
|
|
1973
|
+
insert: E,
|
|
1974
|
+
update: H,
|
|
1975
|
+
replace: P,
|
|
1976
|
+
prepend: L,
|
|
1977
|
+
move: v
|
|
1978
|
+
};
|
|
1979
|
+
return t.fieldArrays.push(Object.assign({ path: e, reset: d }, l)), Tt(() => {
|
|
1980
|
+
const a = t.fieldArrays.findIndex((s) => _(s.path) === _(e));
|
|
1981
|
+
a >= 0 && t.fieldArrays.splice(a, 1);
|
|
1982
|
+
}), l;
|
|
1983
|
+
}
|
|
1984
|
+
oe({
|
|
1985
|
+
name: "FieldArray",
|
|
1986
|
+
inheritAttrs: !1,
|
|
1987
|
+
props: {
|
|
1988
|
+
name: {
|
|
1989
|
+
type: String,
|
|
1990
|
+
required: !0
|
|
1991
|
+
}
|
|
1992
|
+
},
|
|
1993
|
+
setup(e, t) {
|
|
1994
|
+
const { push: n, remove: i, swap: r, insert: o, replace: u, update: d, prepend: m, move: p, fields: b } = Ki(ce(e, "name"));
|
|
1995
|
+
function k() {
|
|
1996
|
+
return {
|
|
1997
|
+
fields: b.value,
|
|
1998
|
+
push: n,
|
|
1999
|
+
remove: i,
|
|
2000
|
+
swap: r,
|
|
2001
|
+
insert: o,
|
|
2002
|
+
update: d,
|
|
2003
|
+
replace: u,
|
|
2004
|
+
prepend: m,
|
|
2005
|
+
move: p
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
return t.expose({
|
|
2009
|
+
push: n,
|
|
2010
|
+
remove: i,
|
|
2011
|
+
swap: r,
|
|
2012
|
+
insert: o,
|
|
2013
|
+
update: d,
|
|
2014
|
+
replace: u,
|
|
2015
|
+
prepend: m,
|
|
2016
|
+
move: p
|
|
2017
|
+
}), () => He(void 0, t, k);
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
oe({
|
|
2021
|
+
name: "ErrorMessage",
|
|
2022
|
+
props: {
|
|
2023
|
+
as: {
|
|
2024
|
+
type: String,
|
|
2025
|
+
default: void 0
|
|
2026
|
+
},
|
|
2027
|
+
name: {
|
|
2028
|
+
type: String,
|
|
2029
|
+
required: !0
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
setup(e, t) {
|
|
2033
|
+
const n = Mt(Me, void 0), i = $(() => n == null ? void 0 : n.errors.value[e.name]);
|
|
2034
|
+
function r() {
|
|
2035
|
+
return {
|
|
2036
|
+
message: i.value
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
return () => {
|
|
2040
|
+
if (!i.value)
|
|
2041
|
+
return;
|
|
2042
|
+
const o = e.as ? dt(e.as) : e.as, u = He(o, t, r), d = Object.assign({ role: "alert" }, t.attrs);
|
|
2043
|
+
return !o && (Array.isArray(u) || !u) && (u == null ? void 0 : u.length) ? u : (Array.isArray(u) || !u) && !(u != null && u.length) ? Re(o || "span", d, i.value) : Re(o, d, u);
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
const qi = { class: "form-group" }, Wi = {
|
|
2048
|
+
key: 0,
|
|
2049
|
+
class: "input-title"
|
|
2050
|
+
}, Ji = ["id", "inputmode", "placeholder", "type", "value", "autocomplete"], Qi = {
|
|
2051
|
+
key: 1,
|
|
2052
|
+
class: "input-error"
|
|
2053
|
+
}, Zi = /* @__PURE__ */ oe({
|
|
2054
|
+
__name: "TextInput",
|
|
2055
|
+
props: {
|
|
2056
|
+
mask: null,
|
|
2057
|
+
placeholder: null,
|
|
2058
|
+
icon: null,
|
|
2059
|
+
title: null,
|
|
2060
|
+
inputmode: null,
|
|
2061
|
+
type: { default: "text" },
|
|
2062
|
+
error: null,
|
|
2063
|
+
modelValue: null,
|
|
2064
|
+
autocomplete: null,
|
|
2065
|
+
id: null,
|
|
2066
|
+
validation: null,
|
|
2067
|
+
errorDisplay: { type: Boolean, default: !0 }
|
|
2068
|
+
},
|
|
2069
|
+
emits: ["update:modelValue"],
|
|
2070
|
+
setup(e, { expose: t, emit: n }) {
|
|
2071
|
+
const i = e, { value: r, errorMessage: o, meta: u, validate: d, setValue: m } = yt(
|
|
2072
|
+
"input",
|
|
2073
|
+
i.validation,
|
|
2074
|
+
{ initialValue: i.modelValue }
|
|
2075
|
+
);
|
|
2076
|
+
return J(
|
|
2077
|
+
() => i.modelValue,
|
|
2078
|
+
(p) => {
|
|
2079
|
+
m(p);
|
|
2080
|
+
}
|
|
2081
|
+
), t({ errorMessage: o, meta: u, validate: d }), (p, b) => {
|
|
2082
|
+
const k = Bt("maska");
|
|
2083
|
+
return ee(), ne("div", qi, [
|
|
2084
|
+
e.title ? (ee(), ne("div", Wi, he(e.title), 1)) : ge("", !0),
|
|
2085
|
+
U("div", {
|
|
2086
|
+
class: st(["input-container", {
|
|
2087
|
+
error: _(o)
|
|
2088
|
+
}])
|
|
2089
|
+
}, [
|
|
2090
|
+
lt(U("input", {
|
|
2091
|
+
id: e.id,
|
|
2092
|
+
inputmode: e.inputmode,
|
|
2093
|
+
placeholder: e.placeholder && e.placeholder,
|
|
2094
|
+
type: e.type,
|
|
2095
|
+
value: _(r),
|
|
2096
|
+
onInput: b[0] || (b[0] = (S) => n("update:modelValue", S.target.value)),
|
|
2097
|
+
autocomplete: e.autocomplete
|
|
2098
|
+
}, null, 40, Ji), [
|
|
2099
|
+
[k, e.mask]
|
|
2100
|
+
])
|
|
2101
|
+
], 2),
|
|
2102
|
+
_(o) && e.errorDisplay ? (ee(), ne("div", Qi, he(_(o)), 1)) : ge("", !0)
|
|
49
2103
|
]);
|
|
50
2104
|
};
|
|
51
2105
|
}
|
|
52
2106
|
});
|
|
53
|
-
|
|
54
|
-
|
|
2107
|
+
function Yi(e) {
|
|
2108
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2109
|
+
}
|
|
2110
|
+
var Xt = { exports: {} }, en = { exports: {} };
|
|
2111
|
+
(function(e) {
|
|
2112
|
+
(function(t) {
|
|
2113
|
+
e.exports ? e.exports = t() : window.intlTelInput = t();
|
|
2114
|
+
})(function(t) {
|
|
2115
|
+
return function() {
|
|
2116
|
+
for (var n = [["Afghanistan (\u202B\u0627\u0641\u063A\u0627\u0646\u0633\u062A\u0627\u0646\u202C\u200E)", "af", "93"], ["Albania (Shqip\xEBri)", "al", "355"], ["Algeria (\u202B\u0627\u0644\u062C\u0632\u0627\u0626\u0631\u202C\u200E)", "dz", "213"], ["American Samoa", "as", "1", 5, ["684"]], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Anguilla", "ai", "1", 6, ["264"]], ["Antigua and Barbuda", "ag", "1", 7, ["268"]], ["Argentina", "ar", "54"], ["Armenia (\u0540\u0561\u0575\u0561\u057D\u057F\u0561\u0576)", "am", "374"], ["Aruba", "aw", "297"], ["Ascension Island", "ac", "247"], ["Australia", "au", "61", 0], ["Austria (\xD6sterreich)", "at", "43"], ["Azerbaijan (Az\u0259rbaycan)", "az", "994"], ["Bahamas", "bs", "1", 8, ["242"]], ["Bahrain (\u202B\u0627\u0644\u0628\u062D\u0631\u064A\u0646\u202C\u200E)", "bh", "973"], ["Bangladesh (\u09AC\u09BE\u0982\u09B2\u09BE\u09A6\u09C7\u09B6)", "bd", "880"], ["Barbados", "bb", "1", 9, ["246"]], ["Belarus (\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u044C)", "by", "375"], ["Belgium (Belgi\xEB)", "be", "32"], ["Belize", "bz", "501"], ["Benin (B\xE9nin)", "bj", "229"], ["Bermuda", "bm", "1", 10, ["441"]], ["Bhutan (\u0F60\u0F56\u0FB2\u0F74\u0F42)", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia and Herzegovina (\u0411\u043E\u0441\u043D\u0430 \u0438 \u0425\u0435\u0440\u0446\u0435\u0433\u043E\u0432\u0438\u043D\u0430)", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil (Brasil)", "br", "55"], ["British Indian Ocean Territory", "io", "246"], ["British Virgin Islands", "vg", "1", 11, ["284"]], ["Brunei", "bn", "673"], ["Bulgaria (\u0411\u044A\u043B\u0433\u0430\u0440\u0438\u044F)", "bg", "359"], ["Burkina Faso", "bf", "226"], ["Burundi (Uburundi)", "bi", "257"], ["Cambodia (\u1780\u1798\u17D2\u1796\u17BB\u1787\u17B6)", "kh", "855"], ["Cameroon (Cameroun)", "cm", "237"], ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde (Kabu Verdi)", "cv", "238"], ["Caribbean Netherlands", "bq", "599", 1, ["3", "4", "7"]], ["Cayman Islands", "ky", "1", 12, ["345"]], ["Central African Republic (R\xE9publique centrafricaine)", "cf", "236"], ["Chad (Tchad)", "td", "235"], ["Chile", "cl", "56"], ["China (\u4E2D\u56FD)", "cn", "86"], ["Christmas Island", "cx", "61", 2, ["89164"]], ["Cocos (Keeling) Islands", "cc", "61", 1, ["89162"]], ["Colombia", "co", "57"], ["Comoros (\u202B\u062C\u0632\u0631 \u0627\u0644\u0642\u0645\u0631\u202C\u200E)", "km", "269"], ["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243"], ["Congo (Republic) (Congo-Brazzaville)", "cg", "242"], ["Cook Islands", "ck", "682"], ["Costa Rica", "cr", "506"], ["C\xF4te d\u2019Ivoire", "ci", "225"], ["Croatia (Hrvatska)", "hr", "385"], ["Cuba", "cu", "53"], ["Cura\xE7ao", "cw", "599", 0], ["Cyprus (\u039A\u03CD\u03C0\u03C1\u03BF\u03C2)", "cy", "357"], ["Czech Republic (\u010Cesk\xE1 republika)", "cz", "420"], ["Denmark (Danmark)", "dk", "45"], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1", 13, ["767"]], ["Dominican Republic (Rep\xFAblica Dominicana)", "do", "1", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt (\u202B\u0645\u0635\u0631\u202C\u200E)", "eg", "20"], ["El Salvador", "sv", "503"], ["Equatorial Guinea (Guinea Ecuatorial)", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia (Eesti)", "ee", "372"], ["Eswatini", "sz", "268"], ["Ethiopia", "et", "251"], ["Falkland Islands (Islas Malvinas)", "fk", "500"], ["Faroe Islands (F\xF8royar)", "fo", "298"], ["Fiji", "fj", "679"], ["Finland (Suomi)", "fi", "358", 0], ["France", "fr", "33"], ["French Guiana (Guyane fran\xE7aise)", "gf", "594"], ["French Polynesia (Polyn\xE9sie fran\xE7aise)", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia (\u10E1\u10D0\u10E5\u10D0\u10E0\u10D7\u10D5\u10D4\u10DA\u10DD)", "ge", "995"], ["Germany (Deutschland)", "de", "49"], ["Ghana (Gaana)", "gh", "233"], ["Gibraltar", "gi", "350"], ["Greece (\u0395\u03BB\u03BB\u03AC\u03B4\u03B1)", "gr", "30"], ["Greenland (Kalaallit Nunaat)", "gl", "299"], ["Grenada", "gd", "1", 14, ["473"]], ["Guadeloupe", "gp", "590", 0], ["Guam", "gu", "1", 15, ["671"]], ["Guatemala", "gt", "502"], ["Guernsey", "gg", "44", 1, ["1481", "7781", "7839", "7911"]], ["Guinea (Guin\xE9e)", "gn", "224"], ["Guinea-Bissau (Guin\xE9 Bissau)", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509"], ["Honduras", "hn", "504"], ["Hong Kong (\u9999\u6E2F)", "hk", "852"], ["Hungary (Magyarorsz\xE1g)", "hu", "36"], ["Iceland (\xCDsland)", "is", "354"], ["India (\u092D\u093E\u0930\u0924)", "in", "91"], ["Indonesia", "id", "62"], ["Iran (\u202B\u0627\u06CC\u0631\u0627\u0646\u202C\u200E)", "ir", "98"], ["Iraq (\u202B\u0627\u0644\u0639\u0631\u0627\u0642\u202C\u200E)", "iq", "964"], ["Ireland", "ie", "353"], ["Isle of Man", "im", "44", 2, ["1624", "74576", "7524", "7924", "7624"]], ["Israel (\u202B\u05D9\u05E9\u05E8\u05D0\u05DC\u202C\u200E)", "il", "972"], ["Italy (Italia)", "it", "39", 0], ["Jamaica", "jm", "1", 4, ["876", "658"]], ["Japan (\u65E5\u672C)", "jp", "81"], ["Jersey", "je", "44", 3, ["1534", "7509", "7700", "7797", "7829", "7937"]], ["Jordan (\u202B\u0627\u0644\u0623\u0631\u062F\u0646\u202C\u200E)", "jo", "962"], ["Kazakhstan (\u041A\u0430\u0437\u0430\u0445\u0441\u0442\u0430\u043D)", "kz", "7", 1, ["33", "7"]], ["Kenya", "ke", "254"], ["Kiribati", "ki", "686"], ["Kosovo", "xk", "383"], ["Kuwait (\u202B\u0627\u0644\u0643\u0648\u064A\u062A\u202C\u200E)", "kw", "965"], ["Kyrgyzstan (\u041A\u044B\u0440\u0433\u044B\u0437\u0441\u0442\u0430\u043D)", "kg", "996"], ["Laos (\u0EA5\u0EB2\u0EA7)", "la", "856"], ["Latvia (Latvija)", "lv", "371"], ["Lebanon (\u202B\u0644\u0628\u0646\u0627\u0646\u202C\u200E)", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya (\u202B\u0644\u064A\u0628\u064A\u0627\u202C\u200E)", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania (Lietuva)", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau (\u6FB3\u9580)", "mo", "853"], ["North Macedonia (\u041C\u0430\u043A\u0435\u0434\u043E\u043D\u0438\u0458\u0430)", "mk", "389"], ["Madagascar (Madagasikara)", "mg", "261"], ["Malawi", "mw", "265"], ["Malaysia", "my", "60"], ["Maldives", "mv", "960"], ["Mali", "ml", "223"], ["Malta", "mt", "356"], ["Marshall Islands", "mh", "692"], ["Martinique", "mq", "596"], ["Mauritania (\u202B\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627\u202C\u200E)", "mr", "222"], ["Mauritius (Moris)", "mu", "230"], ["Mayotte", "yt", "262", 1, ["269", "639"]], ["Mexico (M\xE9xico)", "mx", "52"], ["Micronesia", "fm", "691"], ["Moldova (Republica Moldova)", "md", "373"], ["Monaco", "mc", "377"], ["Mongolia (\u041C\u043E\u043D\u0433\u043E\u043B)", "mn", "976"], ["Montenegro (Crna Gora)", "me", "382"], ["Montserrat", "ms", "1", 16, ["664"]], ["Morocco (\u202B\u0627\u0644\u0645\u063A\u0631\u0628\u202C\u200E)", "ma", "212", 0], ["Mozambique (Mo\xE7ambique)", "mz", "258"], ["Myanmar (Burma) (\u1019\u103C\u1014\u103A\u1019\u102C)", "mm", "95"], ["Namibia (Namibi\xEB)", "na", "264"], ["Nauru", "nr", "674"], ["Nepal (\u0928\u0947\u092A\u093E\u0932)", "np", "977"], ["Netherlands (Nederland)", "nl", "31"], ["New Caledonia (Nouvelle-Cal\xE9donie)", "nc", "687"], ["New Zealand", "nz", "64"], ["Nicaragua", "ni", "505"], ["Niger (Nijar)", "ne", "227"], ["Nigeria", "ng", "234"], ["Niue", "nu", "683"], ["Norfolk Island", "nf", "672"], ["North Korea (\uC870\uC120 \uBBFC\uC8FC\uC8FC\uC758 \uC778\uBBFC \uACF5\uD654\uAD6D)", "kp", "850"], ["Northern Mariana Islands", "mp", "1", 17, ["670"]], ["Norway (Norge)", "no", "47", 0], ["Oman (\u202B\u0639\u064F\u0645\u0627\u0646\u202C\u200E)", "om", "968"], ["Pakistan (\u202B\u067E\u0627\u06A9\u0633\u062A\u0627\u0646\u202C\u200E)", "pk", "92"], ["Palau", "pw", "680"], ["Palestine (\u202B\u0641\u0644\u0633\u0637\u064A\u0646\u202C\u200E)", "ps", "970"], ["Panama (Panam\xE1)", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru (Per\xFA)", "pe", "51"], ["Philippines", "ph", "63"], ["Poland (Polska)", "pl", "48"], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", 3, ["787", "939"]], ["Qatar (\u202B\u0642\u0637\u0631\u202C\u200E)", "qa", "974"], ["R\xE9union (La R\xE9union)", "re", "262", 0], ["Romania (Rom\xE2nia)", "ro", "40"], ["Russia (\u0420\u043E\u0441\u0441\u0438\u044F)", "ru", "7", 0], ["Rwanda", "rw", "250"], ["Saint Barth\xE9lemy", "bl", "590", 1], ["Saint Helena", "sh", "290"], ["Saint Kitts and Nevis", "kn", "1", 18, ["869"]], ["Saint Lucia", "lc", "1", 19, ["758"]], ["Saint Martin (Saint-Martin (partie fran\xE7aise))", "mf", "590", 2], ["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508"], ["Saint Vincent and the Grenadines", "vc", "1", 20, ["784"]], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["S\xE3o Tom\xE9 and Pr\xEDncipe (S\xE3o Tom\xE9 e Pr\xEDncipe)", "st", "239"], ["Saudi Arabia (\u202B\u0627\u0644\u0645\u0645\u0644\u0643\u0629 \u0627\u0644\u0639\u0631\u0628\u064A\u0629 \u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629\u202C\u200E)", "sa", "966"], ["Senegal (S\xE9n\xE9gal)", "sn", "221"], ["Serbia (\u0421\u0440\u0431\u0438\u0458\u0430)", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65"], ["Sint Maarten", "sx", "1", 21, ["721"]], ["Slovakia (Slovensko)", "sk", "421"], ["Slovenia (Slovenija)", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia (Soomaaliya)", "so", "252"], ["South Africa", "za", "27"], ["South Korea (\uB300\uD55C\uBBFC\uAD6D)", "kr", "82"], ["South Sudan (\u202B\u062C\u0646\u0648\u0628 \u0627\u0644\u0633\u0648\u062F\u0627\u0646\u202C\u200E)", "ss", "211"], ["Spain (Espa\xF1a)", "es", "34"], ["Sri Lanka (\u0DC1\u0DCA\u200D\u0DBB\u0DD3 \u0DBD\u0D82\u0D9A\u0DCF\u0DC0)", "lk", "94"], ["Sudan (\u202B\u0627\u0644\u0633\u0648\u062F\u0627\u0646\u202C\u200E)", "sd", "249"], ["Suriname", "sr", "597"], ["Svalbard and Jan Mayen", "sj", "47", 1, ["79"]], ["Sweden (Sverige)", "se", "46"], ["Switzerland (Schweiz)", "ch", "41"], ["Syria (\u202B\u0633\u0648\u0631\u064A\u0627\u202C\u200E)", "sy", "963"], ["Taiwan (\u53F0\u7063)", "tw", "886"], ["Tajikistan", "tj", "992"], ["Tanzania", "tz", "255"], ["Thailand (\u0E44\u0E17\u0E22)", "th", "66"], ["Timor-Leste", "tl", "670"], ["Togo", "tg", "228"], ["Tokelau", "tk", "690"], ["Tonga", "to", "676"], ["Trinidad and Tobago", "tt", "1", 22, ["868"]], ["Tunisia (\u202B\u062A\u0648\u0646\u0633\u202C\u200E)", "tn", "216"], ["Turkey (T\xFCrkiye)", "tr", "90"], ["Turkmenistan", "tm", "993"], ["Turks and Caicos Islands", "tc", "1", 23, ["649"]], ["Tuvalu", "tv", "688"], ["U.S. Virgin Islands", "vi", "1", 24, ["340"]], ["Uganda", "ug", "256"], ["Ukraine (\u0423\u043A\u0440\u0430\u0457\u043D\u0430)", "ua", "380"], ["United Arab Emirates (\u202B\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062A \u0627\u0644\u0639\u0631\u0628\u064A\u0629 \u0627\u0644\u0645\u062A\u062D\u062F\u0629\u202C\u200E)", "ae", "971"], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", "598"], ["Uzbekistan (O\u02BBzbekiston)", "uz", "998"], ["Vanuatu", "vu", "678"], ["Vatican City (Citt\xE0 del Vaticano)", "va", "39", 1, ["06698"]], ["Venezuela", "ve", "58"], ["Vietnam (Vi\u1EC7t Nam)", "vn", "84"], ["Wallis and Futuna (Wallis-et-Futuna)", "wf", "681"], ["Western Sahara (\u202B\u0627\u0644\u0635\u062D\u0631\u0627\u0621 \u0627\u0644\u063A\u0631\u0628\u064A\u0629\u202C\u200E)", "eh", "212", 1, ["5288", "5289"]], ["Yemen (\u202B\u0627\u0644\u064A\u0645\u0646\u202C\u200E)", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"], ["\xC5land Islands", "ax", "358", 1, ["18"]]], i = 0; i < n.length; i++) {
|
|
2117
|
+
var r = n[i];
|
|
2118
|
+
n[i] = {
|
|
2119
|
+
name: r[0],
|
|
2120
|
+
iso2: r[1],
|
|
2121
|
+
dialCode: r[2],
|
|
2122
|
+
priority: r[3] || 0,
|
|
2123
|
+
areaCodes: r[4] || null
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
function o(L, v) {
|
|
2127
|
+
if (!(L instanceof v))
|
|
2128
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2129
|
+
}
|
|
2130
|
+
function u(L, v) {
|
|
2131
|
+
for (var l = 0; l < v.length; l++) {
|
|
2132
|
+
var a = v[l];
|
|
2133
|
+
a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(L, a.key, a);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function d(L, v, l) {
|
|
2137
|
+
return v && u(L.prototype, v), l && u(L, l), L;
|
|
2138
|
+
}
|
|
2139
|
+
var m = {
|
|
2140
|
+
getInstance: function(v) {
|
|
2141
|
+
var l = v.getAttribute("data-intl-tel-input-id");
|
|
2142
|
+
return window.intlTelInputGlobals.instances[l];
|
|
2143
|
+
},
|
|
2144
|
+
instances: {},
|
|
2145
|
+
documentReady: function() {
|
|
2146
|
+
return document.readyState === "complete";
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
typeof window == "object" && (window.intlTelInputGlobals = m);
|
|
2150
|
+
var p = 0, b = {
|
|
2151
|
+
allowDropdown: !0,
|
|
2152
|
+
autoHideDialCode: !0,
|
|
2153
|
+
autoPlaceholder: "polite",
|
|
2154
|
+
customContainer: "",
|
|
2155
|
+
customPlaceholder: null,
|
|
2156
|
+
dropdownContainer: null,
|
|
2157
|
+
excludeCountries: [],
|
|
2158
|
+
formatOnDisplay: !0,
|
|
2159
|
+
geoIpLookup: null,
|
|
2160
|
+
hiddenInput: "",
|
|
2161
|
+
initialCountry: "",
|
|
2162
|
+
localizedCountries: null,
|
|
2163
|
+
nationalMode: !0,
|
|
2164
|
+
onlyCountries: [],
|
|
2165
|
+
placeholderNumberType: "MOBILE",
|
|
2166
|
+
preferredCountries: ["us", "gb"],
|
|
2167
|
+
separateDialCode: !1,
|
|
2168
|
+
utilsScript: ""
|
|
2169
|
+
}, k = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], S = function(v, l) {
|
|
2170
|
+
for (var a = Object.keys(v), s = 0; s < a.length; s++)
|
|
2171
|
+
l(a[s], v[a[s]]);
|
|
2172
|
+
}, E = function(v) {
|
|
2173
|
+
S(window.intlTelInputGlobals.instances, function(l) {
|
|
2174
|
+
window.intlTelInputGlobals.instances[l][v]();
|
|
2175
|
+
});
|
|
2176
|
+
}, P = /* @__PURE__ */ function() {
|
|
2177
|
+
function L(v, l) {
|
|
2178
|
+
var a = this;
|
|
2179
|
+
o(this, L), this.id = p++, this.telInput = v, this.activeItem = null, this.highlightedItem = null;
|
|
2180
|
+
var s = l || {};
|
|
2181
|
+
this.options = {}, S(b, function(c, f) {
|
|
2182
|
+
a.options[c] = s.hasOwnProperty(c) ? s[c] : f;
|
|
2183
|
+
}), this.hadInitialPlaceholder = Boolean(v.getAttribute("placeholder"));
|
|
2184
|
+
}
|
|
2185
|
+
return d(L, [{
|
|
2186
|
+
key: "_init",
|
|
2187
|
+
value: function() {
|
|
2188
|
+
var l = this;
|
|
2189
|
+
if (this.options.nationalMode && (this.options.autoHideDialCode = !1), this.options.separateDialCode && (this.options.autoHideDialCode = this.options.nationalMode = !1), this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), this.isMobile && (document.body.classList.add("iti-mobile"), this.options.dropdownContainer || (this.options.dropdownContainer = document.body)), typeof Promise < "u") {
|
|
2190
|
+
var a = new Promise(function(c, f) {
|
|
2191
|
+
l.resolveAutoCountryPromise = c, l.rejectAutoCountryPromise = f;
|
|
2192
|
+
}), s = new Promise(function(c, f) {
|
|
2193
|
+
l.resolveUtilsScriptPromise = c, l.rejectUtilsScriptPromise = f;
|
|
2194
|
+
});
|
|
2195
|
+
this.promise = Promise.all([a, s]);
|
|
2196
|
+
} else
|
|
2197
|
+
this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {
|
|
2198
|
+
}, this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {
|
|
2199
|
+
};
|
|
2200
|
+
this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
2201
|
+
}
|
|
2202
|
+
}, {
|
|
2203
|
+
key: "_processCountryData",
|
|
2204
|
+
value: function() {
|
|
2205
|
+
this._processAllCountries(), this._processCountryCodes(), this._processPreferredCountries(), this.options.localizedCountries && this._translateCountriesByLocale(), (this.options.onlyCountries.length || this.options.localizedCountries) && this.countries.sort(this._countryNameSort);
|
|
2206
|
+
}
|
|
2207
|
+
}, {
|
|
2208
|
+
key: "_addCountryCode",
|
|
2209
|
+
value: function(l, a, s) {
|
|
2210
|
+
a.length > this.countryCodeMaxLen && (this.countryCodeMaxLen = a.length), this.countryCodes.hasOwnProperty(a) || (this.countryCodes[a] = []);
|
|
2211
|
+
for (var c = 0; c < this.countryCodes[a].length; c++)
|
|
2212
|
+
if (this.countryCodes[a][c] === l)
|
|
2213
|
+
return;
|
|
2214
|
+
var f = s !== t ? s : this.countryCodes[a].length;
|
|
2215
|
+
this.countryCodes[a][f] = l;
|
|
2216
|
+
}
|
|
2217
|
+
}, {
|
|
2218
|
+
key: "_processAllCountries",
|
|
2219
|
+
value: function() {
|
|
2220
|
+
if (this.options.onlyCountries.length) {
|
|
2221
|
+
var l = this.options.onlyCountries.map(function(s) {
|
|
2222
|
+
return s.toLowerCase();
|
|
2223
|
+
});
|
|
2224
|
+
this.countries = n.filter(function(s) {
|
|
2225
|
+
return l.indexOf(s.iso2) > -1;
|
|
2226
|
+
});
|
|
2227
|
+
} else if (this.options.excludeCountries.length) {
|
|
2228
|
+
var a = this.options.excludeCountries.map(function(s) {
|
|
2229
|
+
return s.toLowerCase();
|
|
2230
|
+
});
|
|
2231
|
+
this.countries = n.filter(function(s) {
|
|
2232
|
+
return a.indexOf(s.iso2) === -1;
|
|
2233
|
+
});
|
|
2234
|
+
} else
|
|
2235
|
+
this.countries = n;
|
|
2236
|
+
}
|
|
2237
|
+
}, {
|
|
2238
|
+
key: "_translateCountriesByLocale",
|
|
2239
|
+
value: function() {
|
|
2240
|
+
for (var l = 0; l < this.countries.length; l++) {
|
|
2241
|
+
var a = this.countries[l].iso2.toLowerCase();
|
|
2242
|
+
this.options.localizedCountries.hasOwnProperty(a) && (this.countries[l].name = this.options.localizedCountries[a]);
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
}, {
|
|
2246
|
+
key: "_countryNameSort",
|
|
2247
|
+
value: function(l, a) {
|
|
2248
|
+
return l.name.localeCompare(a.name);
|
|
2249
|
+
}
|
|
2250
|
+
}, {
|
|
2251
|
+
key: "_processCountryCodes",
|
|
2252
|
+
value: function() {
|
|
2253
|
+
this.countryCodeMaxLen = 0, this.dialCodes = {}, this.countryCodes = {};
|
|
2254
|
+
for (var l = 0; l < this.countries.length; l++) {
|
|
2255
|
+
var a = this.countries[l];
|
|
2256
|
+
this.dialCodes[a.dialCode] || (this.dialCodes[a.dialCode] = !0), this._addCountryCode(a.iso2, a.dialCode, a.priority);
|
|
2257
|
+
}
|
|
2258
|
+
for (var s = 0; s < this.countries.length; s++) {
|
|
2259
|
+
var c = this.countries[s];
|
|
2260
|
+
if (c.areaCodes)
|
|
2261
|
+
for (var f = this.countryCodes[c.dialCode][0], y = 0; y < c.areaCodes.length; y++) {
|
|
2262
|
+
for (var C = c.areaCodes[y], O = 1; O < C.length; O++) {
|
|
2263
|
+
var j = c.dialCode + C.substr(0, O);
|
|
2264
|
+
this._addCountryCode(f, j), this._addCountryCode(c.iso2, j);
|
|
2265
|
+
}
|
|
2266
|
+
this._addCountryCode(c.iso2, c.dialCode + C);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}, {
|
|
2271
|
+
key: "_processPreferredCountries",
|
|
2272
|
+
value: function() {
|
|
2273
|
+
this.preferredCountries = [];
|
|
2274
|
+
for (var l = 0; l < this.options.preferredCountries.length; l++) {
|
|
2275
|
+
var a = this.options.preferredCountries[l].toLowerCase(), s = this._getCountryData(a, !1, !0);
|
|
2276
|
+
s && this.preferredCountries.push(s);
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
}, {
|
|
2280
|
+
key: "_createEl",
|
|
2281
|
+
value: function(l, a, s) {
|
|
2282
|
+
var c = document.createElement(l);
|
|
2283
|
+
return a && S(a, function(f, y) {
|
|
2284
|
+
return c.setAttribute(f, y);
|
|
2285
|
+
}), s && s.appendChild(c), c;
|
|
2286
|
+
}
|
|
2287
|
+
}, {
|
|
2288
|
+
key: "_generateMarkup",
|
|
2289
|
+
value: function() {
|
|
2290
|
+
!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
2291
|
+
var l = "iti";
|
|
2292
|
+
this.options.allowDropdown && (l += " iti--allow-dropdown"), this.options.separateDialCode && (l += " iti--separate-dial-code"), this.options.customContainer && (l += " ", l += this.options.customContainer);
|
|
2293
|
+
var a = this._createEl("div", {
|
|
2294
|
+
class: l
|
|
2295
|
+
});
|
|
2296
|
+
if (this.telInput.parentNode.insertBefore(a, this.telInput), this.flagsContainer = this._createEl("div", {
|
|
2297
|
+
class: "iti__flag-container"
|
|
2298
|
+
}, a), a.appendChild(this.telInput), this.selectedFlag = this._createEl("div", {
|
|
2299
|
+
class: "iti__selected-flag",
|
|
2300
|
+
role: "combobox",
|
|
2301
|
+
"aria-controls": "iti-".concat(this.id, "__country-listbox"),
|
|
2302
|
+
"aria-owns": "iti-".concat(this.id, "__country-listbox"),
|
|
2303
|
+
"aria-expanded": "false"
|
|
2304
|
+
}, this.flagsContainer), this.selectedFlagInner = this._createEl("div", {
|
|
2305
|
+
class: "iti__flag"
|
|
2306
|
+
}, this.selectedFlag), this.options.separateDialCode && (this.selectedDialCode = this._createEl("div", {
|
|
2307
|
+
class: "iti__selected-dial-code"
|
|
2308
|
+
}, this.selectedFlag)), this.options.allowDropdown && (this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", {
|
|
2309
|
+
class: "iti__arrow"
|
|
2310
|
+
}, this.selectedFlag), this.countryList = this._createEl("ul", {
|
|
2311
|
+
class: "iti__country-list iti__hide",
|
|
2312
|
+
id: "iti-".concat(this.id, "__country-listbox"),
|
|
2313
|
+
role: "listbox",
|
|
2314
|
+
"aria-label": "List of countries"
|
|
2315
|
+
}), this.preferredCountries.length && (this._appendListItems(this.preferredCountries, "iti__preferred", !0), this._createEl("li", {
|
|
2316
|
+
class: "iti__divider",
|
|
2317
|
+
role: "separator",
|
|
2318
|
+
"aria-disabled": "true"
|
|
2319
|
+
}, this.countryList)), this._appendListItems(this.countries, "iti__standard"), this.options.dropdownContainer ? (this.dropdown = this._createEl("div", {
|
|
2320
|
+
class: "iti iti--container"
|
|
2321
|
+
}), this.dropdown.appendChild(this.countryList)) : this.flagsContainer.appendChild(this.countryList)), this.options.hiddenInput) {
|
|
2322
|
+
var s = this.options.hiddenInput, c = this.telInput.getAttribute("name");
|
|
2323
|
+
if (c) {
|
|
2324
|
+
var f = c.lastIndexOf("[");
|
|
2325
|
+
f !== -1 && (s = "".concat(c.substr(0, f), "[").concat(s, "]"));
|
|
2326
|
+
}
|
|
2327
|
+
this.hiddenInput = this._createEl("input", {
|
|
2328
|
+
type: "hidden",
|
|
2329
|
+
name: s
|
|
2330
|
+
}), a.appendChild(this.hiddenInput);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
}, {
|
|
2334
|
+
key: "_appendListItems",
|
|
2335
|
+
value: function(l, a, s) {
|
|
2336
|
+
for (var c = "", f = 0; f < l.length; f++) {
|
|
2337
|
+
var y = l[f], C = s ? "-preferred" : "";
|
|
2338
|
+
c += "<li class='iti__country ".concat(a, "' tabIndex='-1' id='iti-").concat(this.id, "__item-").concat(y.iso2).concat(C, "' role='option' data-dial-code='").concat(y.dialCode, "' data-country-code='").concat(y.iso2, "' aria-selected='false'>"), c += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(y.iso2, "'></div></div>"), c += "<span class='iti__country-name'>".concat(y.name, "</span>"), c += "<span class='iti__dial-code'>+".concat(y.dialCode, "</span>"), c += "</li>";
|
|
2339
|
+
}
|
|
2340
|
+
this.countryList.insertAdjacentHTML("beforeend", c);
|
|
2341
|
+
}
|
|
2342
|
+
}, {
|
|
2343
|
+
key: "_setInitialState",
|
|
2344
|
+
value: function() {
|
|
2345
|
+
var l = this.telInput.getAttribute("value"), a = this.telInput.value, s = l && l.charAt(0) === "+" && (!a || a.charAt(0) !== "+"), c = s ? l : a, f = this._getDialCode(c), y = this._isRegionlessNanp(c), C = this.options, O = C.initialCountry, j = C.nationalMode, Q = C.autoHideDialCode, B = C.separateDialCode;
|
|
2346
|
+
f && !y ? this._updateFlagFromNumber(c) : O !== "auto" && (O ? this._setFlag(O.toLowerCase()) : f && y ? this._setFlag("us") : (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, c || this._setFlag(this.defaultCountry)), !c && !j && !Q && !B && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode))), c && this._updateValFromNumber(c);
|
|
2347
|
+
}
|
|
2348
|
+
}, {
|
|
2349
|
+
key: "_initListeners",
|
|
2350
|
+
value: function() {
|
|
2351
|
+
this._initKeyListeners(), this.options.autoHideDialCode && this._initBlurListeners(), this.options.allowDropdown && this._initDropdownListeners(), this.hiddenInput && this._initHiddenInputListener();
|
|
2352
|
+
}
|
|
2353
|
+
}, {
|
|
2354
|
+
key: "_initHiddenInputListener",
|
|
2355
|
+
value: function() {
|
|
2356
|
+
var l = this;
|
|
2357
|
+
this._handleHiddenInputSubmit = function() {
|
|
2358
|
+
l.hiddenInput.value = l.getNumber();
|
|
2359
|
+
}, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
2360
|
+
}
|
|
2361
|
+
}, {
|
|
2362
|
+
key: "_getClosestLabel",
|
|
2363
|
+
value: function() {
|
|
2364
|
+
for (var l = this.telInput; l && l.tagName !== "LABEL"; )
|
|
2365
|
+
l = l.parentNode;
|
|
2366
|
+
return l;
|
|
2367
|
+
}
|
|
2368
|
+
}, {
|
|
2369
|
+
key: "_initDropdownListeners",
|
|
2370
|
+
value: function() {
|
|
2371
|
+
var l = this;
|
|
2372
|
+
this._handleLabelClick = function(s) {
|
|
2373
|
+
l.countryList.classList.contains("iti__hide") ? l.telInput.focus() : s.preventDefault();
|
|
2374
|
+
};
|
|
2375
|
+
var a = this._getClosestLabel();
|
|
2376
|
+
a && a.addEventListener("click", this._handleLabelClick), this._handleClickSelectedFlag = function() {
|
|
2377
|
+
l.countryList.classList.contains("iti__hide") && !l.telInput.disabled && !l.telInput.readOnly && l._showDropdown();
|
|
2378
|
+
}, this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag), this._handleFlagsContainerKeydown = function(s) {
|
|
2379
|
+
var c = l.countryList.classList.contains("iti__hide");
|
|
2380
|
+
c && ["ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter"].indexOf(s.key) !== -1 && (s.preventDefault(), s.stopPropagation(), l._showDropdown()), s.key === "Tab" && l._closeDropdown();
|
|
2381
|
+
}, this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
2382
|
+
}
|
|
2383
|
+
}, {
|
|
2384
|
+
key: "_initRequests",
|
|
2385
|
+
value: function() {
|
|
2386
|
+
var l = this;
|
|
2387
|
+
this.options.utilsScript && !window.intlTelInputUtils ? window.intlTelInputGlobals.documentReady() ? window.intlTelInputGlobals.loadUtils(this.options.utilsScript) : window.addEventListener("load", function() {
|
|
2388
|
+
window.intlTelInputGlobals.loadUtils(l.options.utilsScript);
|
|
2389
|
+
}) : this.resolveUtilsScriptPromise(), this.options.initialCountry === "auto" ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
2390
|
+
}
|
|
2391
|
+
}, {
|
|
2392
|
+
key: "_loadAutoCountry",
|
|
2393
|
+
value: function() {
|
|
2394
|
+
window.intlTelInputGlobals.autoCountry ? this.handleAutoCountry() : window.intlTelInputGlobals.startedLoadingAutoCountry || (window.intlTelInputGlobals.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(function(l) {
|
|
2395
|
+
window.intlTelInputGlobals.autoCountry = l.toLowerCase(), setTimeout(function() {
|
|
2396
|
+
return E("handleAutoCountry");
|
|
2397
|
+
});
|
|
2398
|
+
}, function() {
|
|
2399
|
+
return E("rejectAutoCountryPromise");
|
|
2400
|
+
}));
|
|
2401
|
+
}
|
|
2402
|
+
}, {
|
|
2403
|
+
key: "_initKeyListeners",
|
|
2404
|
+
value: function() {
|
|
2405
|
+
var l = this;
|
|
2406
|
+
this._handleKeyupEvent = function() {
|
|
2407
|
+
l._updateFlagFromNumber(l.telInput.value) && l._triggerCountryChange();
|
|
2408
|
+
}, this.telInput.addEventListener("keyup", this._handleKeyupEvent), this._handleClipboardEvent = function() {
|
|
2409
|
+
setTimeout(l._handleKeyupEvent);
|
|
2410
|
+
}, this.telInput.addEventListener("cut", this._handleClipboardEvent), this.telInput.addEventListener("paste", this._handleClipboardEvent);
|
|
2411
|
+
}
|
|
2412
|
+
}, {
|
|
2413
|
+
key: "_cap",
|
|
2414
|
+
value: function(l) {
|
|
2415
|
+
var a = this.telInput.getAttribute("maxlength");
|
|
2416
|
+
return a && l.length > a ? l.substr(0, a) : l;
|
|
2417
|
+
}
|
|
2418
|
+
}, {
|
|
2419
|
+
key: "_initBlurListeners",
|
|
2420
|
+
value: function() {
|
|
2421
|
+
var l = this;
|
|
2422
|
+
this._handleSubmitOrBlurEvent = function() {
|
|
2423
|
+
l._removeEmptyDialCode();
|
|
2424
|
+
}, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
|
|
2425
|
+
}
|
|
2426
|
+
}, {
|
|
2427
|
+
key: "_removeEmptyDialCode",
|
|
2428
|
+
value: function() {
|
|
2429
|
+
if (this.telInput.value.charAt(0) === "+") {
|
|
2430
|
+
var l = this._getNumeric(this.telInput.value);
|
|
2431
|
+
(!l || this.selectedCountryData.dialCode === l) && (this.telInput.value = "");
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
}, {
|
|
2435
|
+
key: "_getNumeric",
|
|
2436
|
+
value: function(l) {
|
|
2437
|
+
return l.replace(/\D/g, "");
|
|
2438
|
+
}
|
|
2439
|
+
}, {
|
|
2440
|
+
key: "_trigger",
|
|
2441
|
+
value: function(l) {
|
|
2442
|
+
var a = document.createEvent("Event");
|
|
2443
|
+
a.initEvent(l, !0, !0), this.telInput.dispatchEvent(a);
|
|
2444
|
+
}
|
|
2445
|
+
}, {
|
|
2446
|
+
key: "_showDropdown",
|
|
2447
|
+
value: function() {
|
|
2448
|
+
this.countryList.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.activeItem && (this._highlightListItem(this.activeItem, !1), this._scrollTo(this.activeItem, !0)), this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2449
|
+
}
|
|
2450
|
+
}, {
|
|
2451
|
+
key: "_toggleClass",
|
|
2452
|
+
value: function(l, a, s) {
|
|
2453
|
+
s && !l.classList.contains(a) ? l.classList.add(a) : !s && l.classList.contains(a) && l.classList.remove(a);
|
|
2454
|
+
}
|
|
2455
|
+
}, {
|
|
2456
|
+
key: "_setDropdownPosition",
|
|
2457
|
+
value: function() {
|
|
2458
|
+
var l = this;
|
|
2459
|
+
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.isMobile) {
|
|
2460
|
+
var a = this.telInput.getBoundingClientRect(), s = window.pageYOffset || document.documentElement.scrollTop, c = a.top + s, f = this.countryList.offsetHeight, y = c + this.telInput.offsetHeight + f < s + window.innerHeight, C = c - f > s;
|
|
2461
|
+
if (this._toggleClass(this.countryList, "iti__country-list--dropup", !y && C), this.options.dropdownContainer) {
|
|
2462
|
+
var O = !y && C ? 0 : this.telInput.offsetHeight;
|
|
2463
|
+
this.dropdown.style.top = "".concat(c + O, "px"), this.dropdown.style.left = "".concat(a.left + document.body.scrollLeft, "px"), this._handleWindowScroll = function() {
|
|
2464
|
+
return l._closeDropdown();
|
|
2465
|
+
}, window.addEventListener("scroll", this._handleWindowScroll);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}, {
|
|
2470
|
+
key: "_getClosestListItem",
|
|
2471
|
+
value: function(l) {
|
|
2472
|
+
for (var a = l; a && a !== this.countryList && !a.classList.contains("iti__country"); )
|
|
2473
|
+
a = a.parentNode;
|
|
2474
|
+
return a === this.countryList ? null : a;
|
|
2475
|
+
}
|
|
2476
|
+
}, {
|
|
2477
|
+
key: "_bindDropdownListeners",
|
|
2478
|
+
value: function() {
|
|
2479
|
+
var l = this;
|
|
2480
|
+
this._handleMouseoverCountryList = function(f) {
|
|
2481
|
+
var y = l._getClosestListItem(f.target);
|
|
2482
|
+
y && l._highlightListItem(y, !1);
|
|
2483
|
+
}, this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList), this._handleClickCountryList = function(f) {
|
|
2484
|
+
var y = l._getClosestListItem(f.target);
|
|
2485
|
+
y && l._selectListItem(y);
|
|
2486
|
+
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2487
|
+
var a = !0;
|
|
2488
|
+
this._handleClickOffToClose = function() {
|
|
2489
|
+
a || l._closeDropdown(), a = !1;
|
|
2490
|
+
}, document.documentElement.addEventListener("click", this._handleClickOffToClose);
|
|
2491
|
+
var s = "", c = null;
|
|
2492
|
+
this._handleKeydownOnDropdown = function(f) {
|
|
2493
|
+
f.preventDefault(), f.key === "ArrowUp" || f.key === "Up" || f.key === "ArrowDown" || f.key === "Down" ? l._handleUpDownKey(f.key) : f.key === "Enter" ? l._handleEnterKey() : f.key === "Escape" ? l._closeDropdown() : /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(f.key) && (c && clearTimeout(c), s += f.key.toLowerCase(), l._searchForCountry(s), c = setTimeout(function() {
|
|
2494
|
+
s = "";
|
|
2495
|
+
}, 1e3));
|
|
2496
|
+
}, document.addEventListener("keydown", this._handleKeydownOnDropdown);
|
|
2497
|
+
}
|
|
2498
|
+
}, {
|
|
2499
|
+
key: "_handleUpDownKey",
|
|
2500
|
+
value: function(l) {
|
|
2501
|
+
var a = l === "ArrowUp" || l === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
|
|
2502
|
+
a && (a.classList.contains("iti__divider") && (a = l === "ArrowUp" || l === "Up" ? a.previousElementSibling : a.nextElementSibling), this._highlightListItem(a, !0));
|
|
2503
|
+
}
|
|
2504
|
+
}, {
|
|
2505
|
+
key: "_handleEnterKey",
|
|
2506
|
+
value: function() {
|
|
2507
|
+
this.highlightedItem && this._selectListItem(this.highlightedItem);
|
|
2508
|
+
}
|
|
2509
|
+
}, {
|
|
2510
|
+
key: "_searchForCountry",
|
|
2511
|
+
value: function(l) {
|
|
2512
|
+
for (var a = 0; a < this.countries.length; a++)
|
|
2513
|
+
if (this._startsWith(this.countries[a].name, l)) {
|
|
2514
|
+
var s = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[a].iso2));
|
|
2515
|
+
this._highlightListItem(s, !1), this._scrollTo(s, !0);
|
|
2516
|
+
break;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
}, {
|
|
2520
|
+
key: "_startsWith",
|
|
2521
|
+
value: function(l, a) {
|
|
2522
|
+
return l.substr(0, a.length).toLowerCase() === a;
|
|
2523
|
+
}
|
|
2524
|
+
}, {
|
|
2525
|
+
key: "_updateValFromNumber",
|
|
2526
|
+
value: function(l) {
|
|
2527
|
+
var a = l;
|
|
2528
|
+
if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
|
|
2529
|
+
var s = !this.options.separateDialCode && (this.options.nationalMode || a.charAt(0) !== "+"), c = intlTelInputUtils.numberFormat, f = c.NATIONAL, y = c.INTERNATIONAL, C = s ? f : y;
|
|
2530
|
+
a = intlTelInputUtils.formatNumber(a, this.selectedCountryData.iso2, C);
|
|
2531
|
+
}
|
|
2532
|
+
a = this._beforeSetNumber(a), this.telInput.value = a;
|
|
2533
|
+
}
|
|
2534
|
+
}, {
|
|
2535
|
+
key: "_updateFlagFromNumber",
|
|
2536
|
+
value: function(l) {
|
|
2537
|
+
var a = l, s = this.selectedCountryData.dialCode, c = s === "1";
|
|
2538
|
+
a && this.options.nationalMode && c && a.charAt(0) !== "+" && (a.charAt(0) !== "1" && (a = "1".concat(a)), a = "+".concat(a)), this.options.separateDialCode && s && a.charAt(0) !== "+" && (a = "+".concat(s).concat(a));
|
|
2539
|
+
var f = this._getDialCode(a, !0), y = this._getNumeric(a), C = null;
|
|
2540
|
+
if (f) {
|
|
2541
|
+
var O = this.countryCodes[this._getNumeric(f)], j = O.indexOf(this.selectedCountryData.iso2) !== -1 && y.length <= f.length - 1, Q = s === "1" && this._isRegionlessNanp(y);
|
|
2542
|
+
if (!Q && !j) {
|
|
2543
|
+
for (var B = 0; B < O.length; B++)
|
|
2544
|
+
if (O[B]) {
|
|
2545
|
+
C = O[B];
|
|
2546
|
+
break;
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
} else
|
|
2550
|
+
a.charAt(0) === "+" && y.length ? C = "" : (!a || a === "+") && (C = this.defaultCountry);
|
|
2551
|
+
return C !== null ? this._setFlag(C) : !1;
|
|
2552
|
+
}
|
|
2553
|
+
}, {
|
|
2554
|
+
key: "_isRegionlessNanp",
|
|
2555
|
+
value: function(l) {
|
|
2556
|
+
var a = this._getNumeric(l);
|
|
2557
|
+
if (a.charAt(0) === "1") {
|
|
2558
|
+
var s = a.substr(1, 3);
|
|
2559
|
+
return k.indexOf(s) !== -1;
|
|
2560
|
+
}
|
|
2561
|
+
return !1;
|
|
2562
|
+
}
|
|
2563
|
+
}, {
|
|
2564
|
+
key: "_highlightListItem",
|
|
2565
|
+
value: function(l, a) {
|
|
2566
|
+
var s = this.highlightedItem;
|
|
2567
|
+
s && s.classList.remove("iti__highlight"), this.highlightedItem = l, this.highlightedItem.classList.add("iti__highlight"), a && this.highlightedItem.focus();
|
|
2568
|
+
}
|
|
2569
|
+
}, {
|
|
2570
|
+
key: "_getCountryData",
|
|
2571
|
+
value: function(l, a, s) {
|
|
2572
|
+
for (var c = a ? n : this.countries, f = 0; f < c.length; f++)
|
|
2573
|
+
if (c[f].iso2 === l)
|
|
2574
|
+
return c[f];
|
|
2575
|
+
if (s)
|
|
2576
|
+
return null;
|
|
2577
|
+
throw new Error("No country data for '".concat(l, "'"));
|
|
2578
|
+
}
|
|
2579
|
+
}, {
|
|
2580
|
+
key: "_setFlag",
|
|
2581
|
+
value: function(l) {
|
|
2582
|
+
var a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2583
|
+
this.selectedCountryData = l ? this._getCountryData(l, !1, !1) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(l));
|
|
2584
|
+
var s = l ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown";
|
|
2585
|
+
if (this.selectedFlag.setAttribute("title", s), this.options.separateDialCode) {
|
|
2586
|
+
var c = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
|
|
2587
|
+
this.selectedDialCode.innerHTML = c;
|
|
2588
|
+
var f = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
|
|
2589
|
+
this.telInput.style.paddingLeft = "".concat(f + 6, "px");
|
|
2590
|
+
}
|
|
2591
|
+
if (this._updatePlaceholder(), this.options.allowDropdown) {
|
|
2592
|
+
var y = this.activeItem;
|
|
2593
|
+
if (y && (y.classList.remove("iti__active"), y.setAttribute("aria-selected", "false")), l) {
|
|
2594
|
+
var C = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(l, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(l));
|
|
2595
|
+
C.setAttribute("aria-selected", "true"), C.classList.add("iti__active"), this.activeItem = C, this.selectedFlag.setAttribute("aria-activedescendant", C.getAttribute("id"));
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
return a.iso2 !== l;
|
|
2599
|
+
}
|
|
2600
|
+
}, {
|
|
2601
|
+
key: "_getHiddenSelectedFlagWidth",
|
|
2602
|
+
value: function() {
|
|
2603
|
+
var l = this.telInput.parentNode.cloneNode();
|
|
2604
|
+
l.style.visibility = "hidden", document.body.appendChild(l);
|
|
2605
|
+
var a = this.flagsContainer.cloneNode();
|
|
2606
|
+
l.appendChild(a);
|
|
2607
|
+
var s = this.selectedFlag.cloneNode(!0);
|
|
2608
|
+
a.appendChild(s);
|
|
2609
|
+
var c = s.offsetWidth;
|
|
2610
|
+
return l.parentNode.removeChild(l), c;
|
|
2611
|
+
}
|
|
2612
|
+
}, {
|
|
2613
|
+
key: "_updatePlaceholder",
|
|
2614
|
+
value: function() {
|
|
2615
|
+
var l = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
|
|
2616
|
+
if (window.intlTelInputUtils && l) {
|
|
2617
|
+
var a = intlTelInputUtils.numberType[this.options.placeholderNumberType], s = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, a) : "";
|
|
2618
|
+
s = this._beforeSetNumber(s), typeof this.options.customPlaceholder == "function" && (s = this.options.customPlaceholder(s, this.selectedCountryData)), this.telInput.setAttribute("placeholder", s);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
}, {
|
|
2622
|
+
key: "_selectListItem",
|
|
2623
|
+
value: function(l) {
|
|
2624
|
+
var a = this._setFlag(l.getAttribute("data-country-code"));
|
|
2625
|
+
this._closeDropdown(), this._updateDialCode(l.getAttribute("data-dial-code"), !0), this.telInput.focus();
|
|
2626
|
+
var s = this.telInput.value.length;
|
|
2627
|
+
this.telInput.setSelectionRange(s, s), a && this._triggerCountryChange();
|
|
2628
|
+
}
|
|
2629
|
+
}, {
|
|
2630
|
+
key: "_closeDropdown",
|
|
2631
|
+
value: function() {
|
|
2632
|
+
this.countryList.classList.add("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "false"), this.dropdownArrow.classList.remove("iti__arrow--up"), document.removeEventListener("keydown", this._handleKeydownOnDropdown), document.documentElement.removeEventListener("click", this._handleClickOffToClose), this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.isMobile || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
|
|
2633
|
+
}
|
|
2634
|
+
}, {
|
|
2635
|
+
key: "_scrollTo",
|
|
2636
|
+
value: function(l, a) {
|
|
2637
|
+
var s = this.countryList, c = window.pageYOffset || document.documentElement.scrollTop, f = s.offsetHeight, y = s.getBoundingClientRect().top + c, C = y + f, O = l.offsetHeight, j = l.getBoundingClientRect().top + c, Q = j + O, B = j - y + s.scrollTop, K = f / 2 - O / 2;
|
|
2638
|
+
if (j < y)
|
|
2639
|
+
a && (B -= K), s.scrollTop = B;
|
|
2640
|
+
else if (Q > C) {
|
|
2641
|
+
a && (B += K);
|
|
2642
|
+
var te = f - O;
|
|
2643
|
+
s.scrollTop = B - te;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
}, {
|
|
2647
|
+
key: "_updateDialCode",
|
|
2648
|
+
value: function(l, a) {
|
|
2649
|
+
var s = this.telInput.value, c = "+".concat(l), f;
|
|
2650
|
+
if (s.charAt(0) === "+") {
|
|
2651
|
+
var y = this._getDialCode(s);
|
|
2652
|
+
y ? f = s.replace(y, c) : f = c;
|
|
2653
|
+
} else {
|
|
2654
|
+
if (this.options.nationalMode || this.options.separateDialCode)
|
|
2655
|
+
return;
|
|
2656
|
+
if (s)
|
|
2657
|
+
f = c + s;
|
|
2658
|
+
else if (a || !this.options.autoHideDialCode)
|
|
2659
|
+
f = c;
|
|
2660
|
+
else
|
|
2661
|
+
return;
|
|
2662
|
+
}
|
|
2663
|
+
this.telInput.value = f;
|
|
2664
|
+
}
|
|
2665
|
+
}, {
|
|
2666
|
+
key: "_getDialCode",
|
|
2667
|
+
value: function(l, a) {
|
|
2668
|
+
var s = "";
|
|
2669
|
+
if (l.charAt(0) === "+")
|
|
2670
|
+
for (var c = "", f = 0; f < l.length; f++) {
|
|
2671
|
+
var y = l.charAt(f);
|
|
2672
|
+
if (!isNaN(parseInt(y, 10))) {
|
|
2673
|
+
if (c += y, a)
|
|
2674
|
+
this.countryCodes[c] && (s = l.substr(0, f + 1));
|
|
2675
|
+
else if (this.dialCodes[c]) {
|
|
2676
|
+
s = l.substr(0, f + 1);
|
|
2677
|
+
break;
|
|
2678
|
+
}
|
|
2679
|
+
if (c.length === this.countryCodeMaxLen)
|
|
2680
|
+
break;
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
return s;
|
|
2684
|
+
}
|
|
2685
|
+
}, {
|
|
2686
|
+
key: "_getFullNumber",
|
|
2687
|
+
value: function() {
|
|
2688
|
+
var l = this.telInput.value.trim(), a = this.selectedCountryData.dialCode, s, c = this._getNumeric(l);
|
|
2689
|
+
return this.options.separateDialCode && l.charAt(0) !== "+" && a && c ? s = "+".concat(a) : s = "", s + l;
|
|
2690
|
+
}
|
|
2691
|
+
}, {
|
|
2692
|
+
key: "_beforeSetNumber",
|
|
2693
|
+
value: function(l) {
|
|
2694
|
+
var a = l;
|
|
2695
|
+
if (this.options.separateDialCode) {
|
|
2696
|
+
var s = this._getDialCode(a);
|
|
2697
|
+
if (s) {
|
|
2698
|
+
s = "+".concat(this.selectedCountryData.dialCode);
|
|
2699
|
+
var c = a[s.length] === " " || a[s.length] === "-" ? s.length + 1 : s.length;
|
|
2700
|
+
a = a.substr(c);
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
return this._cap(a);
|
|
2704
|
+
}
|
|
2705
|
+
}, {
|
|
2706
|
+
key: "_triggerCountryChange",
|
|
2707
|
+
value: function() {
|
|
2708
|
+
this._trigger("countrychange");
|
|
2709
|
+
}
|
|
2710
|
+
}, {
|
|
2711
|
+
key: "handleAutoCountry",
|
|
2712
|
+
value: function() {
|
|
2713
|
+
this.options.initialCountry === "auto" && (this.defaultCountry = window.intlTelInputGlobals.autoCountry, this.telInput.value || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2714
|
+
}
|
|
2715
|
+
}, {
|
|
2716
|
+
key: "handleUtils",
|
|
2717
|
+
value: function() {
|
|
2718
|
+
window.intlTelInputUtils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this._updatePlaceholder()), this.resolveUtilsScriptPromise();
|
|
2719
|
+
}
|
|
2720
|
+
}, {
|
|
2721
|
+
key: "destroy",
|
|
2722
|
+
value: function() {
|
|
2723
|
+
var l = this.telInput.form;
|
|
2724
|
+
if (this.options.allowDropdown) {
|
|
2725
|
+
this._closeDropdown(), this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag), this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
2726
|
+
var a = this._getClosestLabel();
|
|
2727
|
+
a && a.removeEventListener("click", this._handleLabelClick);
|
|
2728
|
+
}
|
|
2729
|
+
this.hiddenInput && l && l.removeEventListener("submit", this._handleHiddenInputSubmit), this.options.autoHideDialCode && (l && l.removeEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent)), this.telInput.removeEventListener("keyup", this._handleKeyupEvent), this.telInput.removeEventListener("cut", this._handleClipboardEvent), this.telInput.removeEventListener("paste", this._handleClipboardEvent), this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
2730
|
+
var s = this.telInput.parentNode;
|
|
2731
|
+
s.parentNode.insertBefore(this.telInput, s), s.parentNode.removeChild(s), delete window.intlTelInputGlobals.instances[this.id];
|
|
2732
|
+
}
|
|
2733
|
+
}, {
|
|
2734
|
+
key: "getExtension",
|
|
2735
|
+
value: function() {
|
|
2736
|
+
return window.intlTelInputUtils ? intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2) : "";
|
|
2737
|
+
}
|
|
2738
|
+
}, {
|
|
2739
|
+
key: "getNumber",
|
|
2740
|
+
value: function(l) {
|
|
2741
|
+
if (window.intlTelInputUtils) {
|
|
2742
|
+
var a = this.selectedCountryData.iso2;
|
|
2743
|
+
return intlTelInputUtils.formatNumber(this._getFullNumber(), a, l);
|
|
2744
|
+
}
|
|
2745
|
+
return "";
|
|
2746
|
+
}
|
|
2747
|
+
}, {
|
|
2748
|
+
key: "getNumberType",
|
|
2749
|
+
value: function() {
|
|
2750
|
+
return window.intlTelInputUtils ? intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2) : -99;
|
|
2751
|
+
}
|
|
2752
|
+
}, {
|
|
2753
|
+
key: "getSelectedCountryData",
|
|
2754
|
+
value: function() {
|
|
2755
|
+
return this.selectedCountryData;
|
|
2756
|
+
}
|
|
2757
|
+
}, {
|
|
2758
|
+
key: "getValidationError",
|
|
2759
|
+
value: function() {
|
|
2760
|
+
if (window.intlTelInputUtils) {
|
|
2761
|
+
var l = this.selectedCountryData.iso2;
|
|
2762
|
+
return intlTelInputUtils.getValidationError(this._getFullNumber(), l);
|
|
2763
|
+
}
|
|
2764
|
+
return -99;
|
|
2765
|
+
}
|
|
2766
|
+
}, {
|
|
2767
|
+
key: "isValidNumber",
|
|
2768
|
+
value: function() {
|
|
2769
|
+
var l = this._getFullNumber().trim(), a = this.options.nationalMode ? this.selectedCountryData.iso2 : "";
|
|
2770
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(l, a) : null;
|
|
2771
|
+
}
|
|
2772
|
+
}, {
|
|
2773
|
+
key: "setCountry",
|
|
2774
|
+
value: function(l) {
|
|
2775
|
+
var a = l.toLowerCase();
|
|
2776
|
+
this.selectedFlagInner.classList.contains("iti__".concat(a)) || (this._setFlag(a), this._updateDialCode(this.selectedCountryData.dialCode, !1), this._triggerCountryChange());
|
|
2777
|
+
}
|
|
2778
|
+
}, {
|
|
2779
|
+
key: "setNumber",
|
|
2780
|
+
value: function(l) {
|
|
2781
|
+
var a = this._updateFlagFromNumber(l);
|
|
2782
|
+
this._updateValFromNumber(l), a && this._triggerCountryChange();
|
|
2783
|
+
}
|
|
2784
|
+
}, {
|
|
2785
|
+
key: "setPlaceholderNumberType",
|
|
2786
|
+
value: function(l) {
|
|
2787
|
+
this.options.placeholderNumberType = l, this._updatePlaceholder();
|
|
2788
|
+
}
|
|
2789
|
+
}]), L;
|
|
2790
|
+
}();
|
|
2791
|
+
m.getCountryData = function() {
|
|
2792
|
+
return n;
|
|
2793
|
+
};
|
|
2794
|
+
var H = function(v, l, a) {
|
|
2795
|
+
var s = document.createElement("script");
|
|
2796
|
+
s.onload = function() {
|
|
2797
|
+
E("handleUtils"), l && l();
|
|
2798
|
+
}, s.onerror = function() {
|
|
2799
|
+
E("rejectUtilsScriptPromise"), a && a();
|
|
2800
|
+
}, s.className = "iti-load-utils", s.async = !0, s.src = v, document.body.appendChild(s);
|
|
2801
|
+
};
|
|
2802
|
+
return m.loadUtils = function(L) {
|
|
2803
|
+
if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
|
|
2804
|
+
if (window.intlTelInputGlobals.startedLoadingUtilsScript = !0, typeof Promise < "u")
|
|
2805
|
+
return new Promise(function(v, l) {
|
|
2806
|
+
return H(L, v, l);
|
|
2807
|
+
});
|
|
2808
|
+
H(L);
|
|
2809
|
+
}
|
|
2810
|
+
return null;
|
|
2811
|
+
}, m.defaults = b, m.version = "17.0.19", function(L, v) {
|
|
2812
|
+
var l = new P(L, v);
|
|
2813
|
+
return l._init(), L.setAttribute("data-intl-tel-input-id", l.id), window.intlTelInputGlobals.instances[l.id] = l, l;
|
|
2814
|
+
};
|
|
2815
|
+
}();
|
|
2816
|
+
});
|
|
2817
|
+
})(en);
|
|
2818
|
+
(function(e) {
|
|
2819
|
+
e.exports = en.exports;
|
|
2820
|
+
})(Xt);
|
|
2821
|
+
const Xi = /* @__PURE__ */ Yi(Xt.exports), er = { class: "form-group" }, tr = {
|
|
2822
|
+
key: 0,
|
|
2823
|
+
class: "input-title"
|
|
2824
|
+
}, nr = ["id", "placeholder", "value", "autocomplete"], ir = {
|
|
2825
|
+
key: 1,
|
|
2826
|
+
class: "input-error"
|
|
2827
|
+
}, rr = /* @__PURE__ */ oe({
|
|
2828
|
+
__name: "PhoneInput",
|
|
2829
|
+
props: {
|
|
2830
|
+
placeholder: {
|
|
2831
|
+
type: String,
|
|
2832
|
+
default: ""
|
|
2833
|
+
},
|
|
2834
|
+
title: {
|
|
2835
|
+
type: String,
|
|
2836
|
+
required: !0
|
|
2837
|
+
},
|
|
2838
|
+
modelValue: {
|
|
2839
|
+
type: String,
|
|
2840
|
+
default: ""
|
|
2841
|
+
},
|
|
2842
|
+
phoneCountryCode: {
|
|
2843
|
+
type: String,
|
|
2844
|
+
default: ""
|
|
2845
|
+
},
|
|
2846
|
+
errorDisplay: {
|
|
2847
|
+
type: Boolean,
|
|
2848
|
+
default: !0
|
|
2849
|
+
},
|
|
2850
|
+
validation: Object,
|
|
2851
|
+
autocomplete: String,
|
|
2852
|
+
id: String
|
|
2853
|
+
},
|
|
2854
|
+
emits: ["update:modelValue", "update:phoneCountryCode"],
|
|
2855
|
+
setup(e, { expose: t, emit: n }) {
|
|
2856
|
+
const i = e, r = Y(), { value: o, errorMessage: u, meta: d, validate: m, setValue: p } = yt(
|
|
2857
|
+
"input",
|
|
2858
|
+
i.validation,
|
|
2859
|
+
{ initialValue: i.modelValue }
|
|
2860
|
+
);
|
|
2861
|
+
return J(
|
|
2862
|
+
() => i.modelValue,
|
|
2863
|
+
(b) => {
|
|
2864
|
+
p(b);
|
|
2865
|
+
}
|
|
2866
|
+
), t({ errorMessage: u, meta: d, validate: m }), ut(() => {
|
|
2867
|
+
r.value.addEventListener(
|
|
2868
|
+
"countrychange",
|
|
2869
|
+
() => n(
|
|
2870
|
+
"update:phoneCountryCode",
|
|
2871
|
+
window.intlTelInputGlobals.getInstance(r.value).getSelectedCountryData().dialCode
|
|
2872
|
+
)
|
|
2873
|
+
), Xi(r.value, {
|
|
2874
|
+
initialCountry: "pt",
|
|
2875
|
+
preferredCountries: ["pt"],
|
|
2876
|
+
separateDialCode: !0
|
|
2877
|
+
});
|
|
2878
|
+
}), (b, k) => {
|
|
2879
|
+
const S = Bt("maska");
|
|
2880
|
+
return ee(), ne("div", er, [
|
|
2881
|
+
e.title ? (ee(), ne("div", tr, he(e.title), 1)) : ge("", !0),
|
|
2882
|
+
U("div", {
|
|
2883
|
+
class: st(["input-container", { error: _(u) }])
|
|
2884
|
+
}, [
|
|
2885
|
+
lt(U("input", {
|
|
2886
|
+
ref_key: "inputEl",
|
|
2887
|
+
ref: r,
|
|
2888
|
+
id: e.id,
|
|
2889
|
+
placeholder: e.placeholder && e.placeholder,
|
|
2890
|
+
type: "tel",
|
|
2891
|
+
value: _(o),
|
|
2892
|
+
autocomplete: e.autocomplete,
|
|
2893
|
+
onInput: k[0] || (k[0] = (E) => n("update:modelValue", E.target.value))
|
|
2894
|
+
}, null, 40, nr), [
|
|
2895
|
+
[S, "#########"]
|
|
2896
|
+
])
|
|
2897
|
+
], 2),
|
|
2898
|
+
_(u) && e.errorDisplay ? (ee(), ne("div", ir, he(_(u)), 1)) : ge("", !0)
|
|
2899
|
+
]);
|
|
2900
|
+
};
|
|
2901
|
+
}
|
|
2902
|
+
}), ar = { class: "form-group" }, or = { class: "input-container-checkbox" }, lr = ["checked"], sr = /* @__PURE__ */ U("div", { class: "checkbox-icon m-cgg-icon--check2" }, null, -1), ur = ["innerHTML"], dr = {
|
|
2903
|
+
key: 0,
|
|
2904
|
+
class: "input-error"
|
|
2905
|
+
}, cr = /* @__PURE__ */ oe({
|
|
2906
|
+
__name: "CheckboxInput",
|
|
2907
|
+
props: {
|
|
2908
|
+
label: String,
|
|
2909
|
+
error: String,
|
|
2910
|
+
modelValue: Boolean
|
|
2911
|
+
},
|
|
2912
|
+
emits: ["update:modelValue"],
|
|
2913
|
+
setup(e, { emit: t }) {
|
|
2914
|
+
return (n, i) => (ee(), ne("div", ar, [
|
|
2915
|
+
U("div", or, [
|
|
2916
|
+
U("label", null, [
|
|
2917
|
+
U("input", {
|
|
2918
|
+
type: "checkbox",
|
|
2919
|
+
checked: e.modelValue,
|
|
2920
|
+
onChange: i[0] || (i[0] = (r) => n.$emit("update:modelValue", r.target.checked))
|
|
2921
|
+
}, null, 40, lr),
|
|
2922
|
+
sr,
|
|
2923
|
+
U("div", {
|
|
2924
|
+
class: "text-container",
|
|
2925
|
+
innerHTML: e.label
|
|
2926
|
+
}, null, 8, ur)
|
|
2927
|
+
])
|
|
2928
|
+
]),
|
|
2929
|
+
e.error ? (ee(), ne("div", dr, he(e.error), 1)) : ge("", !0)
|
|
2930
|
+
]));
|
|
2931
|
+
}
|
|
2932
|
+
}), Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
55
2933
|
__proto__: null,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
2934
|
+
ComponentA: Sn,
|
|
2935
|
+
ComponentB: Fn,
|
|
2936
|
+
Modal: Rn,
|
|
2937
|
+
CjaButton: Hn,
|
|
2938
|
+
TextInput: Zi,
|
|
2939
|
+
PhoneInput: rr,
|
|
2940
|
+
CheckboxInput: cr
|
|
2941
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2942
|
+
/*!
|
|
2943
|
+
* maska v1.5.2
|
|
2944
|
+
* (c) 2019-2022 Alexander Shabunevich
|
|
2945
|
+
* Released under the MIT License.
|
|
2946
|
+
*/
|
|
2947
|
+
function Lt(e, t) {
|
|
2948
|
+
var n = Object.keys(e);
|
|
2949
|
+
if (Object.getOwnPropertySymbols) {
|
|
2950
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
2951
|
+
t && (i = i.filter(function(r) {
|
|
2952
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2953
|
+
})), n.push.apply(n, i);
|
|
2954
|
+
}
|
|
2955
|
+
return n;
|
|
2956
|
+
}
|
|
2957
|
+
function xe(e) {
|
|
2958
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2959
|
+
var n = arguments[t] != null ? arguments[t] : {};
|
|
2960
|
+
t % 2 ? Lt(Object(n), !0).forEach(function(i) {
|
|
2961
|
+
vr(e, i, n[i]);
|
|
2962
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Lt(Object(n)).forEach(function(i) {
|
|
2963
|
+
Object.defineProperty(e, i, Object.getOwnPropertyDescriptor(n, i));
|
|
2964
|
+
});
|
|
2965
|
+
}
|
|
2966
|
+
return e;
|
|
2967
|
+
}
|
|
2968
|
+
function fr(e, t) {
|
|
2969
|
+
if (!(e instanceof t))
|
|
2970
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2971
|
+
}
|
|
2972
|
+
function hr(e, t) {
|
|
2973
|
+
for (var n = 0; n < t.length; n++) {
|
|
2974
|
+
var i = t[n];
|
|
2975
|
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, tn(i.key), i);
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
function vr(e, t, n) {
|
|
2979
|
+
return (t = tn(t)) in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
|
|
2980
|
+
}
|
|
2981
|
+
function tn(e) {
|
|
2982
|
+
var t = function(n, i) {
|
|
2983
|
+
if (typeof n != "object" || n === null)
|
|
2984
|
+
return n;
|
|
2985
|
+
var r = n[Symbol.toPrimitive];
|
|
2986
|
+
if (r !== void 0) {
|
|
2987
|
+
var o = r.call(n, i || "default");
|
|
2988
|
+
if (typeof o != "object")
|
|
2989
|
+
return o;
|
|
2990
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2991
|
+
}
|
|
2992
|
+
return (i === "string" ? String : Number)(n);
|
|
2993
|
+
}(e, "string");
|
|
2994
|
+
return typeof t == "symbol" ? t : String(t);
|
|
2995
|
+
}
|
|
2996
|
+
var nn = { "#": { pattern: /[0-9]/ }, X: { pattern: /[0-9a-zA-Z]/ }, S: { pattern: /[a-zA-Z]/ }, A: { pattern: /[a-zA-Z]/, uppercase: !0 }, a: { pattern: /[a-zA-Z]/, lowercase: !0 }, "!": { escape: !0 }, "*": { repeat: !0 } };
|
|
2997
|
+
function Ft(e, t) {
|
|
2998
|
+
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : nn, i = !(arguments.length > 3 && arguments[3] !== void 0) || arguments[3];
|
|
2999
|
+
return rn(t).length > 1 ? pr(t)(e, t, n, i) : it(e, t, n, i);
|
|
3000
|
+
}
|
|
3001
|
+
function rn(e) {
|
|
3002
|
+
try {
|
|
3003
|
+
return JSON.parse(e);
|
|
3004
|
+
} catch {
|
|
3005
|
+
return [e];
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
function pr(e) {
|
|
3009
|
+
var t = rn(e).sort(function(i, r) {
|
|
3010
|
+
return i.length - r.length;
|
|
3011
|
+
});
|
|
3012
|
+
return function(i, r, o) {
|
|
3013
|
+
var u = !(arguments.length > 3 && arguments[3] !== void 0) || arguments[3], d = t.map(function(b) {
|
|
3014
|
+
return it(i, b, o, !1);
|
|
3015
|
+
}), m = d.pop();
|
|
3016
|
+
for (var p in t)
|
|
3017
|
+
if (n(m, t[p], o))
|
|
3018
|
+
return it(i, t[p], o, u);
|
|
3019
|
+
return "";
|
|
3020
|
+
};
|
|
3021
|
+
function n(i, r, o) {
|
|
3022
|
+
for (var u in o)
|
|
3023
|
+
o[u].escape && (r = r.replace(new RegExp(u + ".{1}", "g"), ""));
|
|
3024
|
+
return r.split("").filter(function(d) {
|
|
3025
|
+
return o[d] && o[d].pattern;
|
|
3026
|
+
}).length >= i.length;
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
function it(e, t, n) {
|
|
3030
|
+
for (var i = !(arguments.length > 3 && arguments[3] !== void 0) || arguments[3], r = 0, o = 0, u = "", d = ""; r < t.length && o < e.length; ) {
|
|
3031
|
+
var m = t[r], p = e[o], b = n[m];
|
|
3032
|
+
if (b && b.pattern)
|
|
3033
|
+
b.pattern.test(p) && (u += mr(p, b), r++, i && t[r] && (n[t[r]] ? n[t[r]] && n[t[r]].escape && (u += t[r + 1], r += 2) : (u += t[r], r++))), o++;
|
|
3034
|
+
else if (b && b.repeat) {
|
|
3035
|
+
var k = n[t[r - 1]];
|
|
3036
|
+
k && !k.pattern.test(p) ? r++ : r--;
|
|
3037
|
+
} else
|
|
3038
|
+
b && b.escape && (m = t[++r]), i && (u += m), p === m && o++, r++;
|
|
3039
|
+
}
|
|
3040
|
+
for (; i && r < t.length; ) {
|
|
3041
|
+
var S = t[r];
|
|
3042
|
+
if (n[S]) {
|
|
3043
|
+
d = "";
|
|
3044
|
+
break;
|
|
3045
|
+
}
|
|
3046
|
+
d += S, r++;
|
|
3047
|
+
}
|
|
3048
|
+
return u + d;
|
|
3049
|
+
}
|
|
3050
|
+
function mr(e, t) {
|
|
3051
|
+
return t.transform && (e = t.transform(e)), t.uppercase ? e.toLocaleUpperCase() : t.lowercase ? e.toLocaleLowerCase() : e;
|
|
3052
|
+
}
|
|
3053
|
+
function Nt(e) {
|
|
3054
|
+
return e instanceof HTMLInputElement ? e : e.querySelector("input") || e;
|
|
3055
|
+
}
|
|
3056
|
+
function rt(e) {
|
|
3057
|
+
return Object.prototype.toString.call(e) === "[object String]";
|
|
3058
|
+
}
|
|
3059
|
+
var gr = function() {
|
|
3060
|
+
function e(i) {
|
|
3061
|
+
var r = this, o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3062
|
+
if (fr(this, e), !i)
|
|
3063
|
+
throw new Error("Maska: no element for mask");
|
|
3064
|
+
if (o.preprocessor != null && typeof o.preprocessor != "function")
|
|
3065
|
+
throw new Error("Maska: preprocessor must be a function");
|
|
3066
|
+
if (o.tokens)
|
|
3067
|
+
for (var u in o.tokens)
|
|
3068
|
+
o.tokens[u] = xe({}, o.tokens[u]), o.tokens[u].pattern && rt(o.tokens[u].pattern) && (o.tokens[u].pattern = new RegExp(o.tokens[u].pattern));
|
|
3069
|
+
this._opts = { mask: o.mask, tokens: xe(xe({}, nn), o.tokens), preprocessor: o.preprocessor }, this._el = rt(i) ? document.querySelectorAll(i) : i.length ? i : [i], this.inputEvent = function(d) {
|
|
3070
|
+
return r.updateValue(d.target, d);
|
|
3071
|
+
}, this.init();
|
|
3072
|
+
}
|
|
3073
|
+
var t, n;
|
|
3074
|
+
return t = e, n = [{ key: "init", value: function() {
|
|
3075
|
+
for (var i = this, r = function(u) {
|
|
3076
|
+
var d = Nt(i._el[u]);
|
|
3077
|
+
!i._opts.mask || d.dataset.mask && d.dataset.mask === i._opts.mask || (d.dataset.mask = i._opts.mask), setTimeout(function() {
|
|
3078
|
+
return i.updateValue(d);
|
|
3079
|
+
}, 0), d.dataset.maskInited || (d.dataset.maskInited = !0, d.addEventListener("input", i.inputEvent), d.addEventListener("beforeinput", i.beforeInput));
|
|
3080
|
+
}, o = 0; o < this._el.length; o++)
|
|
3081
|
+
r(o);
|
|
3082
|
+
} }, { key: "destroy", value: function() {
|
|
3083
|
+
for (var i = 0; i < this._el.length; i++) {
|
|
3084
|
+
var r = Nt(this._el[i]);
|
|
3085
|
+
r.removeEventListener("input", this.inputEvent), r.removeEventListener("beforeinput", this.beforeInput), delete r.dataset.mask, delete r.dataset.maskInited;
|
|
3086
|
+
}
|
|
3087
|
+
} }, { key: "updateValue", value: function(i, r) {
|
|
3088
|
+
if (i && i.type) {
|
|
3089
|
+
var o = i.type.match(/^number$/i) && i.validity.badInput;
|
|
3090
|
+
if (!i.value && !o || !i.dataset.mask)
|
|
3091
|
+
return i.dataset.maskRawValue = "", void this.dispatch("maska", i, r);
|
|
3092
|
+
var u = i.selectionEnd, d = i.value, m = d[u - 1];
|
|
3093
|
+
i.dataset.maskRawValue = Ft(i.value, i.dataset.mask, this._opts.tokens, !1);
|
|
3094
|
+
var p = i.value;
|
|
3095
|
+
this._opts.preprocessor && (p = this._opts.preprocessor(p)), i.value = Ft(p, i.dataset.mask, this._opts.tokens), r && r.inputType === "insertText" && u === d.length && (u = i.value.length), function(b, k, S) {
|
|
3096
|
+
for (; k && k < b.value.length && b.value.charAt(k - 1) !== S; )
|
|
3097
|
+
k++;
|
|
3098
|
+
(b.type ? b.type.match(/^(text|search|password|tel|url)$/i) : !b.type) && b === document.activeElement && (b.setSelectionRange(k, k), setTimeout(function() {
|
|
3099
|
+
b.setSelectionRange(k, k);
|
|
3100
|
+
}, 0));
|
|
3101
|
+
}(i, u, m), this.dispatch("maska", i, r), i.value !== d && this.dispatch("input", i, r);
|
|
3102
|
+
}
|
|
3103
|
+
} }, { key: "beforeInput", value: function(i) {
|
|
3104
|
+
i && i.target && i.target.type && i.target.type.match(/^number$/i) && i.data && isNaN(i.target.value + i.data) && i.preventDefault();
|
|
3105
|
+
} }, { key: "dispatch", value: function(i, r, o) {
|
|
3106
|
+
r.dispatchEvent(function(u) {
|
|
3107
|
+
var d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, m = document.createEvent("Event");
|
|
3108
|
+
return m.initEvent(u, !0, !0), d && (m.inputType = d), m;
|
|
3109
|
+
}(i, o && o.inputType || null));
|
|
3110
|
+
} }], n && hr(t.prototype, n), Object.defineProperty(t, "prototype", { writable: !1 }), e;
|
|
3111
|
+
}(), Ze, yr = (Ze = /* @__PURE__ */ new WeakMap(), function(e, t) {
|
|
3112
|
+
t.value && (Ze.has(e) && !function(n) {
|
|
3113
|
+
return !(rt(n.value) && n.value === n.oldValue || Array.isArray(n.value) && JSON.stringify(n.value) === JSON.stringify(n.oldValue) || n.value && n.value.mask && n.oldValue && n.oldValue.mask && n.value.mask === n.oldValue.mask);
|
|
3114
|
+
}(t) || Ze.set(e, new gr(e, function(n) {
|
|
3115
|
+
var i = {};
|
|
3116
|
+
return n.mask ? (i.mask = Array.isArray(n.mask) ? JSON.stringify(n.mask) : n.mask, i.tokens = n.tokens ? xe({}, n.tokens) : {}, i.preprocessor = n.preprocessor) : i.mask = Array.isArray(n) ? JSON.stringify(n) : n, i;
|
|
3117
|
+
}(t.value))));
|
|
59
3118
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
3119
|
+
function an(e) {
|
|
3120
|
+
e.directive("maska", yr);
|
|
3121
|
+
}
|
|
3122
|
+
typeof window < "u" && window.Vue && window.Vue.use && window.Vue.use(an);
|
|
3123
|
+
const _r = 100, kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
63
3124
|
__proto__: null,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return a + b;
|
|
3125
|
+
MAGIC_NUM: _r
|
|
3126
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3127
|
+
function br(e, t) {
|
|
3128
|
+
return e + t;
|
|
69
3129
|
}
|
|
70
|
-
|
|
71
|
-
add
|
|
3130
|
+
const Ir = {
|
|
3131
|
+
add: br
|
|
72
3132
|
};
|
|
73
|
-
function
|
|
74
|
-
for (const
|
|
75
|
-
|
|
76
|
-
|
|
3133
|
+
function Cr(e) {
|
|
3134
|
+
for (const t in Vt)
|
|
3135
|
+
e.component(t, Vt[t]);
|
|
3136
|
+
e.use(an);
|
|
77
3137
|
}
|
|
78
|
-
|
|
79
|
-
export {
|
|
3138
|
+
const Sr = { install: Cr };
|
|
3139
|
+
export {
|
|
3140
|
+
cr as CheckboxInput,
|
|
3141
|
+
Hn as CjaButton,
|
|
3142
|
+
Sn as ComponentA,
|
|
3143
|
+
Fn as ComponentB,
|
|
3144
|
+
Rn as Modal,
|
|
3145
|
+
kr as MyConstants,
|
|
3146
|
+
Ir as MyUtil,
|
|
3147
|
+
rr as PhoneInput,
|
|
3148
|
+
Zi as TextInput,
|
|
3149
|
+
Sr as default
|
|
3150
|
+
};
|