maz-ui 3.46.1-beta.3 → 3.46.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/components/MazAvatar.mjs +1 -1
  2. package/components/MazDropdown.d.ts +9 -0
  3. package/components/MazDropdown.mjs +58 -55
  4. package/components/MazLazyImg.d.ts +2 -0
  5. package/components/MazLazyImg.mjs +1 -1
  6. package/components/MazPhoneNumberInput.d.ts +2 -2
  7. package/components/MazPhoneNumberInput.mjs +1 -1
  8. package/components/MazSelect.d.ts +4 -0
  9. package/components/MazSelect.mjs +1 -1
  10. package/components/MazTable.mjs +1 -1
  11. package/components/assets/MazLazyImg.css +1 -1
  12. package/components/assets/MazPhoneNumberInput.css +1 -1
  13. package/components/assets/MazSelect.css +1 -1
  14. package/components/assets/MazTable.css +1 -1
  15. package/components/chunks/{MazAvatar-BXZpFUaZ.mjs → MazAvatar-BmaVqPui.mjs} +1 -1
  16. package/components/chunks/{MazBtn-6D9MhUfI.mjs → MazBtn-CAioWjHE.mjs} +2 -2
  17. package/components/chunks/{MazBtn-B9mpn5c4.mjs → MazBtn-DHFCbHI5.mjs} +2 -2
  18. package/components/chunks/{MazCheckbox-SCDhMssn.mjs → MazCheckbox-DOYkVPMK.mjs} +1 -1
  19. package/components/chunks/{MazCheckbox-q5o-NFLo.mjs → MazCheckbox-m1322Y67.mjs} +1 -1
  20. package/components/chunks/{MazIcon-BW5X0uLg.mjs → MazIcon-YNJa-F5Z.mjs} +1 -1
  21. package/components/chunks/{MazIcon-DiRrHbn4.mjs → MazIcon-wDqK0Xre.mjs} +1 -1
  22. package/components/chunks/{MazLazyImg-D2seDVoC.mjs → MazLazyImg-RHZ9wOy2.mjs} +7 -5
  23. package/components/chunks/{MazLazyImg-Db6BYACF.mjs → MazLazyImg-i-z6hcwF.mjs} +10 -8
  24. package/components/chunks/MazPhoneNumberInput-BbeofPj5.mjs +1821 -0
  25. package/components/chunks/{MazSelect-BTrnZLF5.mjs → MazSelect-CUo_OXDp.mjs} +133 -129
  26. package/components/chunks/{MazSpinner-CLQy7iCO.mjs → MazSpinner-5w4SkOOl.mjs} +1 -1
  27. package/components/chunks/{MazSpinner-D_Xqx8Vb.mjs → MazSpinner-ByWRmwig.mjs} +1 -1
  28. package/components/chunks/{MazSpinner-gYRmfrSM.mjs → MazSpinner-Ch7Qhq1M.mjs} +1 -1
  29. package/components/chunks/{MazSpinner-38KAnd2e.mjs → MazSpinner-Cl4Yy1dv.mjs} +1 -1
  30. package/components/chunks/MazSpinner-mCkWhiVE.mjs +37 -0
  31. package/components/chunks/{MazTable-DsZV0t--.mjs → MazTable-CPfwUOOM.mjs} +226 -222
  32. package/css/main.css +1 -1
  33. package/nuxt/index.json +1 -1
  34. package/package.json +1 -1
  35. package/types/components/MazDropdown.vue.d.ts +9 -0
  36. package/types/components/MazLazyImg.vue.d.ts +2 -0
  37. package/types/components/MazPhoneNumberInput.vue.d.ts +2 -2
  38. package/types/components/MazSelect.vue.d.ts +4 -0
  39. package/types/modules/helpers/country-flag-from-flagcn.d.ts +7 -0
  40. package/components/chunks/MazPhoneNumberInput-DjWHMKpM.mjs +0 -1579
  41. package/components/chunks/MazSpinner-hPbKGN5o.mjs +0 -37
@@ -0,0 +1,1821 @@
1
+ import '../assets/MazPhoneNumberInput.css';var Ge = Object.defineProperty;
2
+ var Je = (n, o, e) => o in n ? Ge(n, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[o] = e;
3
+ var _ = (n, o, e) => Je(n, typeof o != "symbol" ? o + "" : o, e);
4
+ import { useId as Ze, computed as h, inject as Xe, defineComponent as se, defineAsyncComponent as q, withDirectives as ze, openBlock as b, createElementBlock as L, normalizeClass as F, normalizeStyle as ee, Fragment as be, renderList as Be, createElementVNode as j, mergeProps as oe, createVNode as H, unref as E, createCommentVNode as z, renderSlot as N, ref as k, onMounted as Ie, useSlots as xe, createBlock as U, resolveDynamicComponent as Pe, toHandlers as _e, vModelDynamic as eo, createTextVNode as oo, toDisplayString as ue, withModifiers as ae, withCtx as G, useCssVars as to, onBeforeMount as lo, nextTick as ie, Transition as no, mergeModels as Ee, useModel as ao, provide as so, watch as he } from "vue";
5
+ import { getCountries as Oe, getCountryCallingCode as ce, isSupportedCountry as ro, parsePhoneNumberFromString as io, AsYouType as uo, getExampleNumber as co } from "libphonenumber-js";
6
+ function Ae({
7
+ componentName: n,
8
+ providedId: o
9
+ }) {
10
+ const e = Ze();
11
+ return h(() => o ?? `${n}-${e}`);
12
+ }
13
+ function ke(n, o = "20x15") {
14
+ return `https://flagcdn.com/${o}/${n.toLowerCase()}.png`;
15
+ }
16
+ function Me(n, o) {
17
+ const e = Xe(n, o);
18
+ if (!e)
19
+ throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${n}`);
20
+ return e;
21
+ }
22
+ function mo(n) {
23
+ return !!n;
24
+ }
25
+ const po = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", fo = {
26
+ baseClass: "m-lazy-img",
27
+ loadedClass: "m-lazy-loaded",
28
+ loadingClass: "m-lazy-loading",
29
+ errorClass: "m-lazy-error",
30
+ noPhotoClass: "m-lazy-no-photo",
31
+ noPhoto: !1,
32
+ observerOnce: !0,
33
+ loadOnce: !1,
34
+ noUseErrorPhoto: !1,
35
+ observerOptions: {
36
+ threshold: 0.1
37
+ }
38
+ };
39
+ class ho {
40
+ constructor(o = {}) {
41
+ _(this, "observers", []);
42
+ _(this, "defaultOptions", fo);
43
+ _(this, "options");
44
+ _(this, "onImgLoadedCallback");
45
+ _(this, "onImgErrorCallback");
46
+ _(this, "hasImgLoaded", !1);
47
+ this.options = this.buildOptions(o), this.onImgLoadedCallback = this.imageIsLoaded.bind(this), this.onImgErrorCallback = this.imageHasError.bind(this);
48
+ }
49
+ async loadErrorPhoto() {
50
+ const { default: o } = await import("./no-photography-BJX8HSus.mjs");
51
+ return o;
52
+ }
53
+ buildOptions(o) {
54
+ return {
55
+ ...this.defaultOptions,
56
+ ...o,
57
+ observerOptions: {
58
+ ...this.defaultOptions.observerOptions,
59
+ ...o.observerOptions
60
+ }
61
+ };
62
+ }
63
+ removeClass(o, e) {
64
+ o.classList.remove(e);
65
+ }
66
+ addClass(o, e) {
67
+ o.classList.add(e);
68
+ }
69
+ removeAllStateClasses(o) {
70
+ this.removeClass(o, this.options.loadedClass), this.removeClass(o, this.options.loadingClass), this.removeClass(o, this.options.errorClass), this.removeClass(o, this.options.noPhotoClass);
71
+ }
72
+ setBaseClass(o) {
73
+ this.addClass(o, this.options.baseClass);
74
+ }
75
+ imageIsLoading(o) {
76
+ var e, t;
77
+ this.addClass(o, this.options.loadingClass), (t = (e = this.options).onLoading) == null || t.call(e, o);
78
+ }
79
+ imageHasNoPhoto(o) {
80
+ this.removeClass(o, this.options.loadingClass), this.addClass(o, this.options.noPhotoClass), this.setDefaultPhoto(o);
81
+ }
82
+ imageIsLoaded(o) {
83
+ var e, t;
84
+ this.hasImgLoaded = !0, this.removeClass(o, this.options.loadingClass), this.addClass(o, this.options.loadedClass), (t = (e = this.options).onLoaded) == null || t.call(e, o);
85
+ }
86
+ imageHasError(o) {
87
+ var e, t;
88
+ this.removeClass(o, this.options.loadingClass), this.addClass(o, this.options.errorClass), (t = (e = this.options).onError) == null || t.call(e, o), this.setDefaultPhoto(o);
89
+ }
90
+ getSrc(o) {
91
+ return typeof o.value == "object" ? o.value.src : o.value;
92
+ }
93
+ getImageUrl(o, e) {
94
+ const t = this.getImgElement(o).getAttribute("data-lazy-src");
95
+ return t || this.getSrc(e);
96
+ }
97
+ async setPictureSourceUrls(o) {
98
+ const e = o.querySelectorAll("source");
99
+ if (e.length > 0)
100
+ for await (const t of e) {
101
+ const r = t.getAttribute("data-lazy-srcset");
102
+ if (r)
103
+ t.srcset = r;
104
+ else
105
+ return this.imageHasError(o);
106
+ }
107
+ else
108
+ this.imageHasError(o);
109
+ }
110
+ hasBgImgMode(o) {
111
+ return o.arg === "bg-image";
112
+ }
113
+ isPictureElement(o) {
114
+ return o instanceof HTMLPictureElement;
115
+ }
116
+ getImgElement(o) {
117
+ return this.isPictureElement(o) ? o.querySelector("img") : o;
118
+ }
119
+ async setDefaultPhoto(o) {
120
+ if (this.options.noUseErrorPhoto)
121
+ return;
122
+ const e = this.options.fallbackSrc ?? this.options.errorPhoto;
123
+ typeof e == "string" && this.addClass(o, this.options.noPhotoClass);
124
+ const t = e ?? await this.loadErrorPhoto(), r = o.querySelectorAll("source");
125
+ if (r.length > 0)
126
+ for await (const u of r)
127
+ u.srcset = t;
128
+ else
129
+ this.setImgSrc(o, t);
130
+ }
131
+ addEventListenerToImg(o) {
132
+ const e = this.getImgElement(o);
133
+ e.addEventListener("load", () => this.onImgLoadedCallback(o), {
134
+ once: !0
135
+ }), e.addEventListener("error", (t) => this.onImgErrorCallback(o, t), { once: !0 });
136
+ }
137
+ async loadImage(o, e) {
138
+ if (this.imageIsLoading(o), this.isPictureElement(o))
139
+ this.addEventListenerToImg(o), await this.setPictureSourceUrls(o);
140
+ else {
141
+ const t = this.getImageUrl(o, e);
142
+ if (!t)
143
+ return this.imageHasError(o);
144
+ this.hasBgImgMode(e) ? (o.style.backgroundImage = `url('${t}')`, this.imageIsLoaded(o)) : (this.addEventListenerToImg(o), this.setImgSrc(o, t));
145
+ }
146
+ }
147
+ setImgSrc(o, e) {
148
+ const t = this.getImgElement(o);
149
+ t.src = e;
150
+ }
151
+ handleIntersectionObserver(o, e, t, r) {
152
+ var u, y;
153
+ this.observers.push(r);
154
+ for (const p of t)
155
+ if (p.isIntersecting) {
156
+ if ((y = (u = this.options).onIntersecting) == null || y.call(u, p.target), this.options.observerOnce && r.unobserve(o), this.options.loadOnce && this.hasImgLoaded)
157
+ return;
158
+ this.loadImage(o, e);
159
+ }
160
+ }
161
+ createObserver(o, e) {
162
+ const t = (y, p) => {
163
+ this.handleIntersectionObserver(o, e, y, p);
164
+ }, r = this.options.observerOptions;
165
+ new IntersectionObserver(t, r).observe(o);
166
+ }
167
+ async imageHandler(o, e, t) {
168
+ if (t === "update")
169
+ for await (const r of this.observers) r.unobserve(o);
170
+ window.IntersectionObserver ? this.createObserver(o, e) : this.loadImage(o, e);
171
+ }
172
+ async bindUpdateHandler(o, e, t) {
173
+ if (this.options.noPhoto)
174
+ return this.imageHasNoPhoto(o);
175
+ await this.imageHandler(o, e, t);
176
+ }
177
+ async add(o, e) {
178
+ if (this.hasBgImgMode(e) && this.isPictureElement(o))
179
+ throw new Error(`[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`);
180
+ setTimeout(() => this.setBaseClass(o), 0), o.getAttribute("src") || this.setImgSrc(o, po), await this.bindUpdateHandler(o, e, "bind");
181
+ }
182
+ async update(o, e) {
183
+ e.value !== e.oldValue && (this.hasImgLoaded = !1, this.removeAllStateClasses(o), await this.bindUpdateHandler(o, e, "update"));
184
+ }
185
+ remove(o, e) {
186
+ this.hasImgLoaded = !1, this.hasBgImgMode(e) && (o.style.backgroundImage = ""), this.removeAllStateClasses(o);
187
+ for (const t of this.observers)
188
+ t.unobserve(o);
189
+ this.observers = [];
190
+ }
191
+ }
192
+ let de;
193
+ const yo = {
194
+ created(n, o) {
195
+ const e = typeof o.value == "object" ? o.value : {};
196
+ de = new ho(e), de.add(n, o);
197
+ },
198
+ updated(n, o) {
199
+ de.update(n, o);
200
+ },
201
+ unmounted(n, o) {
202
+ de.remove(n, o);
203
+ }
204
+ }, vo = ["data-lazy-srcset", "media"], go = ["alt"], bo = {
205
+ key: 0,
206
+ class: "m-lazy-img-component-loader"
207
+ }, Co = /* @__PURE__ */ se({
208
+ inheritAttrs: !1,
209
+ __name: "MazLazyImg",
210
+ props: {
211
+ style: { default: void 0 },
212
+ class: { default: void 0 },
213
+ image: { default: void 0 },
214
+ src: { default: void 0 },
215
+ alt: { default: void 0 },
216
+ noPhoto: { type: Boolean },
217
+ noLoader: { type: Boolean },
218
+ noObserverOnce: { type: Boolean },
219
+ loadOnce: { type: Boolean },
220
+ imageHeightFull: { type: Boolean },
221
+ observerOptions: { default: void 0 },
222
+ fallbackSrc: { default: void 0 },
223
+ imgClass: {}
224
+ },
225
+ emits: ["intersecting", "loading", "loaded", "error"],
226
+ setup(n) {
227
+ const o = n, e = q(() => import("./MazSpinner-mCkWhiVE.mjs")), t = h(() => o.image || o.src), r = h(() => {
228
+ var u;
229
+ return typeof t.value == "string" ? [{ srcset: t.value }] : (u = t.value) == null ? void 0 : u.sources;
230
+ });
231
+ return (u, y) => ze((b(), L(
232
+ "picture",
233
+ {
234
+ class: F(["m-lazy-img-component", [{ "--use-loader": !u.noLoader, "--height-full": u.imageHeightFull }, o.class]]),
235
+ style: ee(u.style)
236
+ },
237
+ [
238
+ (b(!0), L(
239
+ be,
240
+ null,
241
+ Be(r.value, ({ srcset: p, media: O }, $) => (b(), L("source", {
242
+ key: $,
243
+ "data-lazy-srcset": p,
244
+ media: O
245
+ }, null, 8, vo))),
246
+ 128
247
+ /* KEYED_FRAGMENT */
248
+ )),
249
+ j("img", oe(u.$attrs, {
250
+ src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
251
+ loading: "lazy",
252
+ alt: u.alt,
253
+ class: u.imgClass
254
+ }), null, 16, go),
255
+ u.noLoader ? z("v-if", !0) : (b(), L("div", bo, [
256
+ H(E(e), { size: "2em" })
257
+ ])),
258
+ N(u.$slots, "default", {}, void 0, !0)
259
+ ],
260
+ 6
261
+ /* CLASS, STYLE */
262
+ )), [
263
+ [E(yo), {
264
+ noPhoto: u.noPhoto,
265
+ loadOnce: u.loadOnce,
266
+ observerOptions: u.observerOptions,
267
+ fallbackSrc: u.fallbackSrc,
268
+ observerOnce: !u.noObserverOnce,
269
+ onIntersecting: (p) => u.$emit("intersecting", p),
270
+ onLoading: (p) => u.$emit("loading", p),
271
+ onLoaded: (p) => u.$emit("loaded", p),
272
+ onError: (p) => u.$emit("error", p)
273
+ }]
274
+ ]);
275
+ }
276
+ }), re = (n, o) => {
277
+ const e = n.__vccOpts || n;
278
+ for (const [t, r] of o)
279
+ e[t] = r;
280
+ return e;
281
+ }, Le = /* @__PURE__ */ re(Co, [["__scopeId", "data-v-f94782ce"]]), zo = {
282
+ removeAccents: !0,
283
+ caseSensitive: !1,
284
+ replaceSpaces: !0,
285
+ removeSpecialCharacters: !1,
286
+ trim: !0,
287
+ normalizeSpaces: !0,
288
+ removeNumbers: !1,
289
+ customNormalizationForms: ["NFC", "NFKD"]
290
+ };
291
+ function me(n, o) {
292
+ const e = { ...zo, ...o }, t = {
293
+ À: "A",
294
+ Á: "A",
295
+ Â: "A",
296
+ Ã: "A",
297
+ Ä: "A",
298
+ Å: "A",
299
+ à: "a",
300
+ á: "a",
301
+ â: "a",
302
+ ã: "a",
303
+ ä: "a",
304
+ å: "a",
305
+ È: "E",
306
+ É: "E",
307
+ Ê: "E",
308
+ Ë: "E",
309
+ è: "e",
310
+ é: "e",
311
+ ê: "e",
312
+ ë: "e",
313
+ Î: "I",
314
+ Ï: "I",
315
+ í: "I",
316
+ î: "i",
317
+ ï: "i",
318
+ Ô: "O",
319
+ Õ: "O",
320
+ Ö: "O",
321
+ Ø: "O",
322
+ ô: "o",
323
+ õ: "o",
324
+ ö: "o",
325
+ ø: "o",
326
+ Ù: "U",
327
+ Ú: "U",
328
+ Û: "U",
329
+ Ü: "U",
330
+ ù: "u",
331
+ ú: "u",
332
+ û: "u",
333
+ ü: "u",
334
+ Ç: "C",
335
+ ç: "c",
336
+ ÿ: "y",
337
+ Ñ: "N",
338
+ ñ: "n",
339
+ ó: "o"
340
+ };
341
+ let r = n.toString();
342
+ if (e.trim && (r = r.trim()), e.normalizeSpaces && (r = r.replaceAll(/\s+/g, " ")), e.replaceSpaces && (r = r.replaceAll(" ", "-")), e.removeNumbers && (r = r.replaceAll(/\d/g, "")), e.removeAccents && (r = r.replaceAll(/[ÀÁÂÃÄÅÇÈÉÊËÎÏÑÔÕÖØÙÚÛÜàáâãäåçèéêëíîïñóôõöøùúûüÿ]/g, (u) => t[u] || u), r = r.replaceAll(/[\u0300-\u036F]/g, "")), e.caseSensitive === !1 && (r = r.toLowerCase()), e.removeSpecialCharacters && (r = r.replaceAll(/[^\dA-Z-]/gi, "")), e.trim && (r = r.trim()), e.customNormalizationForms)
343
+ for (const u of e.customNormalizationForms)
344
+ r = r.normalize(u);
345
+ return r;
346
+ }
347
+ function Io(n, o) {
348
+ const e = n.length, t = o.length, r = [];
349
+ for (let u = 0; u <= e; u++)
350
+ r[u] = [u];
351
+ for (let u = 0; u <= t; u++)
352
+ r[0][u] = u;
353
+ for (let u = 1; u <= e; u++)
354
+ for (let y = 1; y <= t; y++) {
355
+ const p = n[u - 1] === o[y - 1] ? 0 : 1;
356
+ r[u][y] = Math.min(
357
+ r[u - 1][y] + 1,
358
+ r[u][y - 1] + 1,
359
+ r[u - 1][y - 1] + p
360
+ );
361
+ }
362
+ return r[e][t];
363
+ }
364
+ function Te(n, o) {
365
+ const e = Io(n, o), t = Math.max(n.length, o.length);
366
+ return 1 - e / t;
367
+ }
368
+ function Ao(n, o, e = 0.75) {
369
+ return Te(n, o) >= e;
370
+ }
371
+ function ye(n, o, e = 0.75) {
372
+ const t = h(
373
+ () => me(typeof n == "string" ? n : n.value)
374
+ ), r = h(
375
+ () => me(typeof o == "string" ? o : o.value)
376
+ ), u = h(() => typeof e == "number" ? e : e.value), y = h(() => Te(t.value, r.value));
377
+ return {
378
+ isMatching: h(
379
+ () => Ao(t.value, r.value, u.value)
380
+ ),
381
+ score: y
382
+ };
383
+ }
384
+ function Fe(n, o, e) {
385
+ var y;
386
+ n.stopPropagation();
387
+ const t = typeof e.value == "function" ? e.value : e.value.handler, r = typeof e.value == "object" ? e.value.exclude : void 0;
388
+ let u = !1;
389
+ if (r && r.length > 0) {
390
+ for (const p of r)
391
+ if (!u && n.target instanceof HTMLElement) {
392
+ const O = (y = document.querySelector(p)) == null ? void 0 : y.getAttribute("id");
393
+ u = n.target.getAttribute("id") === O;
394
+ }
395
+ }
396
+ !o.contains(n.target) && !u && (t == null || t());
397
+ }
398
+ function Ne() {
399
+ return document.ontouchstart === null ? "touchstart" : "click";
400
+ }
401
+ function wo(n, o) {
402
+ const e = Ne();
403
+ document.removeEventListener(e, (t) => Fe(t, n, o));
404
+ }
405
+ function So(n, o) {
406
+ if (typeof o.value != "function" && typeof o.value == "object" && typeof o.value.handler != "function") {
407
+ console.error("[maz-ui](vClosable) v-closable directive requires a handler function");
408
+ return;
409
+ }
410
+ const e = Ne();
411
+ document.addEventListener(e, (t) => Fe(t, n, o));
412
+ }
413
+ const Vo = {
414
+ mounted: So,
415
+ unmounted: wo
416
+ };
417
+ let ve = null;
418
+ function Po(n, o) {
419
+ ve && clearTimeout(ve), ve = setTimeout(n, o);
420
+ }
421
+ function Eo(n, o) {
422
+ let e;
423
+ return function(...t) {
424
+ clearTimeout(e), e = setTimeout(() => {
425
+ n.apply(this, t);
426
+ }, o);
427
+ };
428
+ }
429
+ const ko = {
430
+ key: 0,
431
+ class: "m-input-wrapper-left"
432
+ }, Lo = { class: "m-input-wrapper-input" }, $o = ["id", "type", "name", "inputmode", "placeholder", "aria-label", "disabled", "readonly", "required"], Bo = { key: 0 }, Oo = {
433
+ key: 1,
434
+ class: "m-input-wrapper-right"
435
+ }, Mo = /* @__PURE__ */ se({
436
+ inheritAttrs: !1,
437
+ __name: "MazInput",
438
+ props: {
439
+ style: { default: void 0 },
440
+ class: { default: void 0 },
441
+ modelValue: { default: void 0 },
442
+ placeholder: { default: void 0 },
443
+ label: { default: void 0 },
444
+ name: { default: void 0 },
445
+ color: { default: "primary" },
446
+ type: { default: "text" },
447
+ required: { type: Boolean, default: !1 },
448
+ disabled: { type: Boolean, default: !1 },
449
+ readonly: { type: Boolean, default: !1 },
450
+ id: { default: void 0 },
451
+ error: { type: Boolean, default: !1 },
452
+ success: { type: Boolean, default: !1 },
453
+ warning: { type: Boolean, default: !1 },
454
+ hint: { default: void 0 },
455
+ inputClasses: { default: void 0 },
456
+ noBorder: { type: Boolean, default: !1 },
457
+ noRadius: { type: Boolean, default: !1 },
458
+ inputmode: { default: "text" },
459
+ size: { default: "md" },
460
+ debounce: { type: [Boolean, Number], default: !1 },
461
+ debounceDelay: { default: 500 },
462
+ validButton: { type: Boolean, default: !1 },
463
+ validButtonLoading: { type: Boolean, default: !1 },
464
+ autoFocus: { type: Boolean, default: !1 },
465
+ borderActive: { type: Boolean, default: !1 },
466
+ leftIcon: { type: [String, Function, Object], default: void 0 },
467
+ rightIcon: { type: [String, Function, Object], default: void 0 },
468
+ roundedSize: { default: void 0 },
469
+ block: { type: Boolean }
470
+ },
471
+ emits: ["update:model-value", "focus", "blur", "click", "change", "input"],
472
+ setup(n, { emit: o }) {
473
+ const e = n, t = o, r = q(() => import("./MazBtn-DHFCbHI5.mjs")), u = q(() => import("./MazIcon-wDqK0Xre.mjs")), y = q(() => import("./eye-slash-BoO00xzs.mjs")), p = q(() => import("./eye-f8zAUc30.mjs")), O = q(() => import("./check-C9Q_W85g.mjs")), $ = k(!1), v = k(!1), P = k(), i = Ae({
474
+ componentName: "MazInput",
475
+ providedId: e.id
476
+ });
477
+ Ie(() => {
478
+ var s;
479
+ e.autoFocus && ((s = P.value) == null || s.focus());
480
+ });
481
+ const f = h(() => e.type === "password"), I = h(() => $.value ? "text" : e.type), S = h(() => {
482
+ if (!e.noBorder) {
483
+ if (e.error)
484
+ return "maz-border-danger";
485
+ if (e.success)
486
+ return "maz-border-success";
487
+ if (e.warning)
488
+ return "maz-border-warning";
489
+ if (v.value || e.borderActive) {
490
+ if (e.color === "black")
491
+ return "maz-border-black";
492
+ if (e.color === "danger")
493
+ return "maz-border-danger";
494
+ if (e.color === "info")
495
+ return "maz-border-info";
496
+ if (e.color === "primary")
497
+ return "maz-border-primary";
498
+ if (e.color === "secondary")
499
+ return "maz-border-secondary";
500
+ if (e.color === "success")
501
+ return "maz-border-success";
502
+ if (e.color === "warning")
503
+ return "maz-border-warning";
504
+ if (e.color === "white")
505
+ return "maz-border-white";
506
+ }
507
+ return "--default-border";
508
+ }
509
+ }), R = xe(), Y = h(() => {
510
+ const { required: s, placeholder: M } = e;
511
+ if (M)
512
+ return s ? `${M} *` : M;
513
+ }), J = h(() => C.value !== void 0 && C.value !== ""), g = Eo(
514
+ (s) => {
515
+ t("update:model-value", s);
516
+ },
517
+ typeof e.debounce == "number" ? e.debounce : e.debounceDelay ?? 500
518
+ );
519
+ function V(s) {
520
+ if (e.debounce)
521
+ return g(s);
522
+ t("update:model-value", s);
523
+ }
524
+ const C = h({
525
+ get: () => e.modelValue,
526
+ set: (s) => V(s)
527
+ }), W = h(() => (!!e.label || !!e.hint) && (v.value || !!J.value || !!e.placeholder || ["date", "month", "week"].includes(e.type))), Z = h(() => !!e.label || !!e.hint);
528
+ function a() {
529
+ return !!R["right-icon"] || f.value || !!R["valid-button"] || e.validButton || !!e.rightIcon;
530
+ }
531
+ function w() {
532
+ return !!R["left-icon"] || !!e.leftIcon;
533
+ }
534
+ function K(s) {
535
+ t("focus", s), v.value = !0;
536
+ }
537
+ function T(s) {
538
+ t("blur", s), v.value = !1;
539
+ }
540
+ function te(s) {
541
+ return t("change", s);
542
+ }
543
+ function X(s) {
544
+ return t("input", s);
545
+ }
546
+ return (s, M) => (b(), L(
547
+ "div",
548
+ {
549
+ class: F(["m-input", [
550
+ {
551
+ "--is-focused": v.value || s.borderActive,
552
+ "--should-up": W.value,
553
+ "--has-label": Z.value,
554
+ "--is-disabled": s.disabled,
555
+ "--is-readonly": s.readonly,
556
+ "--has-z-2": s.error || s.warning || s.success,
557
+ "--has-state": s.error || s.warning || s.success,
558
+ "--block": s.block
559
+ },
560
+ e.class,
561
+ `--${s.color}`,
562
+ `--${s.size}`
563
+ ]]),
564
+ style: ee(s.style)
565
+ },
566
+ [
567
+ j(
568
+ "div",
569
+ {
570
+ class: F(["m-input-wrapper", [
571
+ s.inputClasses,
572
+ S.value,
573
+ s.roundedSize ? `--rounded-${s.roundedSize}` : { "maz-rounded": !s.noRadius }
574
+ ]])
575
+ },
576
+ [
577
+ w() ? (b(), L("div", ko, [
578
+ z(`
579
+ @slot left-icon - The icon to display on the left of the input
580
+ `),
581
+ s.$slots["left-icon"] || s.leftIcon ? N(s.$slots, "left-icon", { key: 0 }, () => [
582
+ typeof s.leftIcon == "string" ? (b(), U(E(u), {
583
+ key: 0,
584
+ name: s.leftIcon,
585
+ class: "maz-text-xl maz-text-muted"
586
+ }, null, 8, ["name"])) : s.leftIcon ? (b(), U(Pe(s.leftIcon), {
587
+ key: 1,
588
+ class: "maz-text-xl maz-text-muted"
589
+ })) : z("v-if", !0)
590
+ ], !0) : z("v-if", !0)
591
+ ])) : z("v-if", !0),
592
+ j("div", Lo, [
593
+ ze(j("input", oe({
594
+ id: E(i),
595
+ ref_key: "input",
596
+ ref: P,
597
+ "onUpdate:modelValue": M[0] || (M[0] = (x) => C.value = x),
598
+ type: I.value,
599
+ name: s.name
600
+ }, s.$attrs, {
601
+ inputmode: s.inputmode,
602
+ placeholder: Y.value,
603
+ "aria-label": s.label || s.placeholder,
604
+ disabled: s.disabled,
605
+ readonly: s.readonly,
606
+ required: s.required,
607
+ class: "m-input-input"
608
+ }, _e({
609
+ blur: T,
610
+ focus: K,
611
+ change: te,
612
+ input: X
613
+ }, !0), {
614
+ onClick: M[1] || (M[1] = (x) => s.$emit("click", x))
615
+ }), null, 16, $o), [
616
+ [eo, C.value]
617
+ ]),
618
+ s.label || s.hint ? (b(), L(
619
+ "span",
620
+ {
621
+ key: 0,
622
+ class: F(["m-input-label", [
623
+ {
624
+ "maz-text-danger-600": s.error,
625
+ "maz-text-success-600": s.success,
626
+ "maz-text-warning-600": s.warning
627
+ }
628
+ ]])
629
+ },
630
+ [
631
+ oo(
632
+ ue(s.hint || s.label) + " ",
633
+ 1
634
+ /* TEXT */
635
+ ),
636
+ s.required ? (b(), L("sup", Bo, "*")) : z("v-if", !0)
637
+ ],
638
+ 2
639
+ /* CLASS */
640
+ )) : z("v-if", !0)
641
+ ]),
642
+ a() ? (b(), L("div", Oo, [
643
+ z(`
644
+ @slot right-icon - The icon to display on the right of the input
645
+ `),
646
+ s.$slots["right-icon"] || s.rightIcon ? N(s.$slots, "right-icon", { key: 0 }, () => [
647
+ typeof s.rightIcon == "string" ? (b(), U(E(u), {
648
+ key: 0,
649
+ name: s.rightIcon,
650
+ class: "maz-text-xl maz-text-muted"
651
+ }, null, 8, ["name"])) : s.rightIcon ? (b(), U(Pe(s.rightIcon), {
652
+ key: 1,
653
+ class: "maz-text-xl maz-text-muted"
654
+ })) : z("v-if", !0)
655
+ ], !0) : z("v-if", !0),
656
+ f.value ? (b(), U(E(r), {
657
+ key: 1,
658
+ color: "transparent",
659
+ tabindex: "-1",
660
+ size: "mini",
661
+ onClick: M[2] || (M[2] = ae((x) => $.value = !$.value, ["stop"]))
662
+ }, {
663
+ default: G(() => [
664
+ $.value ? (b(), U(E(y), {
665
+ key: 0,
666
+ class: "maz-text-xl maz-text-muted"
667
+ })) : (b(), U(E(p), {
668
+ key: 1,
669
+ class: "maz-text-xl maz-text-muted"
670
+ }))
671
+ ]),
672
+ _: 1
673
+ /* STABLE */
674
+ })) : z("v-if", !0),
675
+ z(`
676
+ @slot valid-button - Replace the valid button by your own
677
+ `),
678
+ s.$slots["valid-button"] || s.validButton ? N(s.$slots, "valid-button", { key: 2 }, () => [
679
+ H(E(r), {
680
+ color: "transparent",
681
+ disabled: s.disabled,
682
+ tabindex: "-1",
683
+ loading: s.validButtonLoading,
684
+ class: "m-input-valid-button",
685
+ size: "mini",
686
+ type: "submit"
687
+ }, {
688
+ default: G(() => [
689
+ H(E(O), { class: "maz-text-2xl maz-text-normal" })
690
+ ]),
691
+ _: 1
692
+ /* STABLE */
693
+ }, 8, ["disabled", "loading"])
694
+ ], !0) : z("v-if", !0)
695
+ ])) : z("v-if", !0)
696
+ ],
697
+ 2
698
+ /* CLASS */
699
+ )
700
+ ],
701
+ 6
702
+ /* CLASS, STYLE */
703
+ ));
704
+ }
705
+ }), Ce = /* @__PURE__ */ re(Mo, [["__scopeId", "data-v-b3e1e126"]]), To = ["aria-label"], Fo = { class: "m-select-list__no-results" }, No = {
706
+ key: 2,
707
+ class: "m-select-list__scroll-wrapper",
708
+ tabindex: "-1"
709
+ }, Ko = { class: "m-select-list-optgroup" }, Uo = ["onClick"], Ho = /* @__PURE__ */ se({
710
+ inheritAttrs: !1,
711
+ __name: "MazSelect",
712
+ props: {
713
+ style: { default: void 0 },
714
+ class: { default: void 0 },
715
+ id: { default: void 0 },
716
+ modelValue: { default: void 0 },
717
+ options: { default: void 0 },
718
+ optionValueKey: { default: "value" },
719
+ optionLabelKey: { default: "label" },
720
+ optionInputValueKey: { default: "label" },
721
+ listPosition: { default: "bottom left" },
722
+ itemHeight: { default: void 0 },
723
+ maxListHeight: { default: 240 },
724
+ maxListWidth: { default: void 0 },
725
+ minListHeight: { default: void 0 },
726
+ minListWidth: { default: void 0 },
727
+ size: { default: "md" },
728
+ color: { default: "primary" },
729
+ search: { type: Boolean },
730
+ searchPlaceholder: { default: "Search in options" },
731
+ searchThreshold: { default: 0.75 },
732
+ open: { type: Boolean },
733
+ multiple: { type: Boolean, default: void 0 },
734
+ required: { type: Boolean },
735
+ disabled: { type: Boolean },
736
+ block: { type: Boolean },
737
+ excludeSelectors: { default: void 0 },
738
+ autocomplete: { default: "off" }
739
+ },
740
+ emits: ["close", "open", "blur", "focus", "change", "input", "update:model-value", "selected-option"],
741
+ setup(n, { expose: o, emit: e }) {
742
+ to((l) => ({
743
+ cb149e58: I.value,
744
+ "215ff493": i.value,
745
+ "64d6cfbb": f.value
746
+ }));
747
+ const t = n, r = e, u = q(() => import("./MazCheckbox-DOYkVPMK.mjs")), y = q(() => import("./magnifying-glass--nBiyXot.mjs")), p = q(() => import("./chevron-down-BkvtON3b.mjs")), O = q(() => import("./no-symbol-CIgKzsrB.mjs"));
748
+ o({
749
+ /** Method to open the option list */
750
+ openList: ne,
751
+ /** Method to close the option list */
752
+ closeList: le
753
+ });
754
+ const $ = k(!1), v = k(), P = h(
755
+ () => ["black", "transparent", "white"].includes(t.color)
756
+ ), i = h(
757
+ () => P.value ? "var(--maz-color-black)" : `var(--maz-color-${t.color}-800)`
758
+ ), f = h(
759
+ () => P.value ? "var(--maz-color-muted)" : `var(--maz-color-${t.color}-100)`
760
+ ), I = h(
761
+ () => P.value ? "var(--maz-color-muted)" : `var(--maz-color-${t.color}-200)`
762
+ ), S = h(() => $.value || t.open), R = Ae({
763
+ componentName: "MazSelect",
764
+ providedId: t.id
765
+ });
766
+ function Y(l) {
767
+ return {
768
+ [t.optionValueKey]: l,
769
+ [t.optionLabelKey]: l,
770
+ [t.optionInputValueKey]: l
771
+ };
772
+ }
773
+ function J(l) {
774
+ return {
775
+ ...l,
776
+ [t.optionValueKey]: l[t.optionValueKey],
777
+ [t.optionLabelKey]: l[t.optionLabelKey],
778
+ [t.optionInputValueKey]: l[t.optionInputValueKey]
779
+ };
780
+ }
781
+ const g = h(() => {
782
+ var d;
783
+ const l = [];
784
+ if (!((d = t.options) != null && d.length))
785
+ return [];
786
+ for (const m of t.options)
787
+ typeof m == "string" || typeof m == "number" || typeof m == "boolean" ? l.push(Y(m)) : typeof m == "object" && "options" in m && Array.isArray(m.options) ? l.push(
788
+ { label: m.label, isOptGroup: !0 },
789
+ ...m.options.map(
790
+ (c) => typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? Y(c) : J(c)
791
+ )
792
+ ) : l.push(J(m));
793
+ return l;
794
+ }), V = h(
795
+ () => {
796
+ var l;
797
+ return ((l = g.value) == null ? void 0 : l.filter((d) => t.multiple ? Array.isArray(t.modelValue) ? t.modelValue.includes(d[t.optionValueKey]) && !w(d[t.optionValueKey]) : !1 : t.modelValue === d[t.optionValueKey] && !w(d[t.optionValueKey]))) ?? [];
798
+ }
799
+ );
800
+ lo(() => {
801
+ var l;
802
+ (l = t.options) != null && l.length || console.warn("[maz-ui](MazSelect) you must provide options"), fe();
803
+ });
804
+ const C = k(), W = k(), Z = k(), a = k();
805
+ function w(l) {
806
+ return l == null;
807
+ }
808
+ function K(l) {
809
+ var m;
810
+ return (((m = V.value) == null ? void 0 : m.some(
811
+ (c) => c[t.optionValueKey] === l[t.optionValueKey]
812
+ )) ?? !1) && !w(l[t.optionValueKey]);
813
+ }
814
+ const T = h(() => {
815
+ var d;
816
+ if (t.multiple && t.modelValue && Array.isArray(t.modelValue))
817
+ return t.modelValue.map(
818
+ (m) => {
819
+ var c, A;
820
+ return (A = (c = g.value) == null ? void 0 : c.find((B) => B[t.optionValueKey] === m)) == null ? void 0 : A[t.optionInputValueKey];
821
+ }
822
+ ).join(", ");
823
+ const l = (d = g.value) == null ? void 0 : d.find(
824
+ (m) => m[t.optionValueKey] === t.modelValue
825
+ );
826
+ return w(t.modelValue) || l == null ? void 0 : l[t.optionInputValueKey];
827
+ }), te = h(
828
+ () => t.listPosition.includes("bottom") ? "maz-slide" : "maz-slideinvert"
829
+ ), X = k(""), s = k("");
830
+ function M(l, d) {
831
+ return d && l && me(l).includes(me(d));
832
+ }
833
+ function x(l) {
834
+ var d;
835
+ return l ? (d = g.value) == null ? void 0 : d.filter((m) => {
836
+ const c = m[t.optionLabelKey], A = m[t.optionValueKey], B = m[t.optionInputValueKey], D = t.searchThreshold;
837
+ return M(c, l) || M(B, l) || M(A, l) || typeof c == "string" && ye(c, l, D).isMatching.value || typeof B == "string" && ye(B, l, D).isMatching.value || typeof A == "string" && ye(A, l, D).isMatching.value;
838
+ }) : g.value;
839
+ }
840
+ const Q = h(() => x(X.value));
841
+ async function le(l) {
842
+ var m, c;
843
+ if (!S.value)
844
+ return;
845
+ if (l && ("relatedTarget" in l && ((m = C.value) != null && m.contains(l.relatedTarget)) || l.type === "keydown"))
846
+ return l.preventDefault();
847
+ const d = l && "relatedTarget" in l && l.relatedTarget instanceof HTMLElement && l.relatedTarget.getAttribute("id");
848
+ if ((c = t.excludeSelectors) != null && c.includes(`#${d}`))
849
+ return l == null ? void 0 : l.preventDefault();
850
+ await ie(), $.value = !1, v.value = 0, r("close", l);
851
+ }
852
+ async function ne(l) {
853
+ t.disabled || S.value || (l == null || l.preventDefault(), $.value = !0, await pe(), r("focus", l), r("open", $.value));
854
+ }
855
+ function we() {
856
+ var l, d;
857
+ (d = ((l = W.value) == null ? void 0 : l.$el).querySelector("input")) == null || d.focus();
858
+ }
859
+ function Re() {
860
+ var l, d;
861
+ (d = ((l = W.value) == null ? void 0 : l.$el).querySelector("input")) == null || d.dispatchEvent(new Event("input"));
862
+ }
863
+ function De(l) {
864
+ $.value ? le(l) : we();
865
+ }
866
+ function qe(l) {
867
+ var d, m;
868
+ X.value = l, (m = ((d = Z.value) == null ? void 0 : d.$el).querySelector("input")) == null || m.focus();
869
+ }
870
+ function je(l) {
871
+ var m;
872
+ l === "Backspace" && s.value.length > 0 ? s.value = s.value.slice(0, -1) : s.value += l;
873
+ const d = x(s.value);
874
+ d != null && d.length && (v.value = (m = Q.value) == null ? void 0 : m.findIndex(
875
+ (c) => c[t.optionValueKey] === d[0][t.optionValueKey]
876
+ ), typeof v.value == "number" && v.value >= 0 && pe(v.value)), Po(() => {
877
+ s.value = "";
878
+ }, 1e3);
879
+ }
880
+ function Ye(l) {
881
+ const d = l.key;
882
+ /^[\dA-Za-z\u0400-\u04FF]$/.test(d) ? (l.preventDefault(), ne(l), t.search ? qe(d) : je(d)) : Se(l);
883
+ }
884
+ function Se(l, d = !0) {
885
+ const m = l.code, c = ["ArrowUp", "ArrowDown"].includes(m), A = (d ? ["Enter", "Space"] : ["Enter"]).includes(m), B = m === "Escape" && S.value;
886
+ c ? We(l, v.value) : A ? Qe(l, v.value) : B && le(l);
887
+ }
888
+ function We(l, d) {
889
+ var A;
890
+ l.preventDefault();
891
+ const m = l.code;
892
+ S.value || ne(l);
893
+ const c = (A = Q.value) == null ? void 0 : A.length;
894
+ c && (typeof d == "number" ? d === c - 1 && m === "ArrowDown" ? v.value = 0 : d === 0 && m === "ArrowUp" ? v.value = c - 1 : v.value = m === "ArrowDown" ? d + 1 : d - 1 : v.value = m === "ArrowDown" ? 0 : c - 1, pe(v.value));
895
+ }
896
+ function Qe(l, d) {
897
+ var c, A, B;
898
+ if (l.preventDefault(), !S.value)
899
+ return ne(l);
900
+ const m = d ? ((c = Q.value) == null ? void 0 : c[d]) ?? ((A = Q.value) == null ? void 0 : A[0]) : (B = Q.value) == null ? void 0 : B[0];
901
+ w(m) || Ve(m);
902
+ }
903
+ async function pe(l) {
904
+ var m, c;
905
+ await ie(), typeof l != "number" && fe();
906
+ const d = l ?? v.value;
907
+ if (typeof d == "number" && d >= 0) {
908
+ const A = (m = a.value) == null ? void 0 : m.querySelectorAll(".m-select-list-item");
909
+ (c = A == null ? void 0 : A[d]) == null || c.scrollIntoView({
910
+ behavior: "auto",
911
+ block: "nearest",
912
+ inline: "start"
913
+ });
914
+ }
915
+ }
916
+ function fe(l) {
917
+ var m;
918
+ const d = (m = Q.value) == null ? void 0 : m.findIndex((c) => {
919
+ var A, B;
920
+ return t.multiple && Array.isArray(t.modelValue) ? l ? l[t.optionValueKey] === c[t.optionValueKey] : [...t.modelValue].reverse()[0] === c[t.optionValueKey] : ((B = (A = V.value) == null ? void 0 : A[0]) == null ? void 0 : B[t.optionValueKey]) === c[t.optionValueKey];
921
+ });
922
+ v.value = d && d >= 0 ? d : 0;
923
+ }
924
+ function Ve(l, d = !0) {
925
+ var B;
926
+ d && !t.multiple && ie(() => le()), X.value = "";
927
+ const m = (B = V.value) == null ? void 0 : B.some(
928
+ (D) => D[t.optionValueKey] === l[t.optionValueKey]
929
+ );
930
+ let c = V.value;
931
+ m && t.multiple ? c = c == null ? void 0 : c.filter(
932
+ (D) => D[t.optionValueKey] !== l[t.optionValueKey]
933
+ ) : t.multiple ? c.push(l) : c = [l];
934
+ const A = c.map((D) => D[t.optionValueKey]);
935
+ r("update:model-value", t.multiple ? A : A[0]), r("selected-option", l), Re(), fe(l), we();
936
+ }
937
+ return (l, d) => {
938
+ var m;
939
+ return ze((b(), L(
940
+ "div",
941
+ {
942
+ ref_key: "mazSelectElement",
943
+ ref: C,
944
+ class: F(["m-select", [
945
+ { "--is-open": S.value, "--disabled": l.disabled, "--block": l.block },
946
+ t.class,
947
+ `--${l.size}`
948
+ ]]),
949
+ style: ee(l.style)
950
+ },
951
+ [
952
+ H(Ce, oe({
953
+ id: E(R),
954
+ ref_key: "mazInputComponent",
955
+ ref: W,
956
+ class: "m-select-input"
957
+ }, l.$attrs, {
958
+ required: l.required,
959
+ "border-active": $.value,
960
+ color: l.color,
961
+ "model-value": T.value,
962
+ size: l.size,
963
+ block: "",
964
+ autocomplete: l.autocomplete,
965
+ disabled: l.disabled,
966
+ onFocus: ae(ne, ["prevent", "stop"]),
967
+ onBlur: ae(le, ["prevent", "stop"]),
968
+ onClick: ae(ne, ["prevent", "stop"]),
969
+ onChange: d[0] || (d[0] = (c) => r("change", c)),
970
+ onInput: d[1] || (d[1] = (c) => r("input", c)),
971
+ onKeydown: Ye
972
+ }), {
973
+ "right-icon": G(() => [
974
+ j("button", {
975
+ tabindex: "-1",
976
+ type: "button",
977
+ class: "m-select-input__toggle-button maz-custom",
978
+ "aria-label": `${S.value ? "collapse" : "expand"} list of options`,
979
+ onClick: ae(De, ["stop"])
980
+ }, [
981
+ H(E(p), { class: "m-select-chevron maz-text-xl" })
982
+ ], 8, To)
983
+ ]),
984
+ _: 1
985
+ /* STABLE */
986
+ }, 16, ["id", "required", "border-active", "color", "model-value", "size", "autocomplete", "disabled"]),
987
+ H(no, { name: te.value }, {
988
+ default: G(() => [
989
+ S.value ? (b(), L(
990
+ "div",
991
+ {
992
+ key: 0,
993
+ ref_key: "optionsListElement",
994
+ ref: a,
995
+ class: F(["m-select-list", {
996
+ "--top": l.listPosition.includes("top"),
997
+ "--left": l.listPosition.includes("left"),
998
+ "--right": l.listPosition.includes("right"),
999
+ "--bottom": l.listPosition.includes("bottom")
1000
+ }]),
1001
+ style: ee({
1002
+ maxHeight: `${l.maxListHeight}px`,
1003
+ maxWidth: `${l.maxListWidth}px`,
1004
+ minHeight: `${l.minListHeight}px`,
1005
+ minWidth: `${l.minListWidth}px`
1006
+ })
1007
+ },
1008
+ [
1009
+ l.search ? (b(), U(Ce, {
1010
+ key: 0,
1011
+ ref_key: "searchInputComponent",
1012
+ ref: Z,
1013
+ modelValue: X.value,
1014
+ "onUpdate:modelValue": [
1015
+ d[2] || (d[2] = (c) => X.value = c),
1016
+ d[4] || (d[4] = (c) => v.value = 0)
1017
+ ],
1018
+ size: "sm",
1019
+ color: l.color,
1020
+ placeholder: l.searchPlaceholder,
1021
+ name: "search",
1022
+ inputmode: "search",
1023
+ autocomplete: "off",
1024
+ tabindex: "-1",
1025
+ class: "m-select-list__search-input maz-flex-none",
1026
+ "left-icon": E(y),
1027
+ onKeydown: d[3] || (d[3] = (c) => Se(c, !1))
1028
+ }, null, 8, ["modelValue", "color", "placeholder", "left-icon"])) : z("v-if", !0),
1029
+ z(`
1030
+ @slot No results slot - Displayed when no results corresponding with search query
1031
+ `),
1032
+ !Q.value || Q.value.length <= 0 ? N(l.$slots, "no-results", { key: 1 }, () => [
1033
+ j("span", Fo, [
1034
+ H(E(O), { class: "maz-h-6 maz-w-6 maz-text-normal" })
1035
+ ])
1036
+ ], !0) : (b(), L("div", No, [
1037
+ (b(!0), L(
1038
+ be,
1039
+ null,
1040
+ Be(Q.value, (c, A) => (b(), L(
1041
+ be,
1042
+ { key: A },
1043
+ [
1044
+ z(`
1045
+ @slot Custom optgroup label
1046
+ @binding {String} label - the label of the optgroup
1047
+ `),
1048
+ c.label && c.isOptGroup ? N(l.$slots, "optgroup", {
1049
+ key: 0,
1050
+ label: c.label
1051
+ }, () => [
1052
+ j(
1053
+ "span",
1054
+ Ko,
1055
+ ue(c.label),
1056
+ 1
1057
+ /* TEXT */
1058
+ )
1059
+ ], !0) : (b(), L("button", {
1060
+ key: 1,
1061
+ tabindex: "-1",
1062
+ type: "button",
1063
+ class: F(["m-select-list-item maz-custom maz-flex-none", [
1064
+ {
1065
+ "--is-keyboard-selected": v.value === A,
1066
+ "--is-selected": K(c),
1067
+ "--is-none-value": w(c[l.optionValueKey])
1068
+ }
1069
+ ]]),
1070
+ style: ee(l.itemHeight ? { height: `${l.itemHeight}px` } : void 0),
1071
+ onClick: ae((B) => Ve(c), ["prevent", "stop"])
1072
+ }, [
1073
+ l.multiple ? (b(), U(E(u), {
1074
+ key: 0,
1075
+ tabindex: "-1",
1076
+ "model-value": K(c),
1077
+ size: "sm",
1078
+ color: l.color
1079
+ }, null, 8, ["model-value", "color"])) : z("v-if", !0),
1080
+ z(`
1081
+ @slot Custom option
1082
+ @binding {Object} option - the option object
1083
+ @binding {Boolean} is-selected - if the option is selected
1084
+ `),
1085
+ N(l.$slots, "default", {
1086
+ option: c,
1087
+ isSelected: K(c)
1088
+ }, () => [
1089
+ j(
1090
+ "span",
1091
+ null,
1092
+ ue(c[l.optionLabelKey]),
1093
+ 1
1094
+ /* TEXT */
1095
+ )
1096
+ ], !0)
1097
+ ], 14, Uo))
1098
+ ],
1099
+ 64
1100
+ /* STABLE_FRAGMENT */
1101
+ ))),
1102
+ 128
1103
+ /* KEYED_FRAGMENT */
1104
+ ))
1105
+ ]))
1106
+ ],
1107
+ 6
1108
+ /* CLASS, STYLE */
1109
+ )) : z("v-if", !0)
1110
+ ]),
1111
+ _: 3
1112
+ /* FORWARDED */
1113
+ }, 8, ["name"])
1114
+ ],
1115
+ 6
1116
+ /* CLASS, STYLE */
1117
+ )), [
1118
+ [E(Vo), {
1119
+ exclude: (m = l.excludeSelectors) != null && m.length ? l.excludeSelectors : [],
1120
+ handler: le
1121
+ }]
1122
+ ]);
1123
+ };
1124
+ }
1125
+ }), Ro = /* @__PURE__ */ re(Ho, [["__scopeId", "data-v-e35a36a6"]]);
1126
+ function Ke() {
1127
+ if (typeof window > "u")
1128
+ return;
1129
+ const n = window.navigator.language;
1130
+ if (!n)
1131
+ return;
1132
+ let o = n.slice(3, 7).toUpperCase();
1133
+ return o === "" && (o = n.slice(0, 2).toUpperCase()), o === "EN" && (o = "US"), o === "JA" && (o = "JP"), {
1134
+ locale: o,
1135
+ browserLocale: n
1136
+ };
1137
+ }
1138
+ let ge, $e;
1139
+ function Do(n, o, e) {
1140
+ return e != null && e[o] ? e[o] : (($e !== n || !ge) && ($e = n, ge = new Intl.DisplayNames([n], { type: "region" })), ge.of(o));
1141
+ }
1142
+ function qo(n, o) {
1143
+ var r;
1144
+ const e = [], t = Oe();
1145
+ n = n ?? ((r = Ke()) == null ? void 0 : r.browserLocale) ?? "en-US";
1146
+ for (const u of t) {
1147
+ const y = Do(n, u, o);
1148
+ if (y)
1149
+ try {
1150
+ const p = ce(u);
1151
+ e.push({
1152
+ iso2: u,
1153
+ dialCode: p,
1154
+ name: y
1155
+ });
1156
+ } catch (p) {
1157
+ console.error(`[MazPhoneNumberInput](getCountryCallingCode) ${p}`);
1158
+ }
1159
+ }
1160
+ return e;
1161
+ }
1162
+ async function jo() {
1163
+ try {
1164
+ const n = await fetch("https://ipwho.is"), { country_code: o } = await n.json();
1165
+ return o;
1166
+ } catch (n) {
1167
+ throw new Error(`[MazPhoneNumberInput](fetchCountryCode) ${n}`);
1168
+ }
1169
+ }
1170
+ function Yo(n) {
1171
+ if (!n)
1172
+ return "";
1173
+ const o = new RegExp(/[^\d ()+-]/g);
1174
+ return n.replaceAll(o, "").trim();
1175
+ }
1176
+ function Ue() {
1177
+ return {
1178
+ sanitizePhoneNumber: Yo,
1179
+ fetchCountryCode: jo,
1180
+ getBrowserLocale: Ke,
1181
+ getCountriesList: qo
1182
+ };
1183
+ }
1184
+ const Wo = ["id"], Qo = {
1185
+ key: 0,
1186
+ class: "m-country-selector__select__item__flag-container"
1187
+ }, Go = /* @__PURE__ */ se({
1188
+ __name: "CountrySelector",
1189
+ props: {
1190
+ style: { default: void 0 },
1191
+ class: { default: void 0 },
1192
+ modelValue: { default: void 0 },
1193
+ id: {},
1194
+ color: {},
1195
+ size: {},
1196
+ preferredCountries: { default: void 0 },
1197
+ ignoredCountries: { default: void 0 },
1198
+ onlyCountries: { default: void 0 },
1199
+ customCountriesList: { default: void 0 },
1200
+ locales: {},
1201
+ listPosition: { default: "bottom left" },
1202
+ noFlags: { type: Boolean },
1203
+ noSearch: { type: Boolean },
1204
+ disabled: { type: Boolean },
1205
+ showCodeOnList: { type: Boolean },
1206
+ countryLocale: { default: void 0 },
1207
+ success: { type: Boolean },
1208
+ error: { type: Boolean },
1209
+ countrySelectorDisplayName: { type: Boolean },
1210
+ searchThreshold: {},
1211
+ width: { default: "9rem" },
1212
+ excludeSelectors: { default: void 0 }
1213
+ },
1214
+ emits: ["update:model-value"],
1215
+ setup(n) {
1216
+ const o = n, { phoneNumber: e } = Me("data"), t = k(), { getCountriesList: r } = Ue(), u = h(() => r(o.countryLocale, o.customCountriesList)), y = h(
1217
+ () => {
1218
+ var i;
1219
+ return (i = u.value) == null ? void 0 : i.filter((f) => {
1220
+ var I;
1221
+ return !((I = o.ignoredCountries) != null && I.includes(f.iso2));
1222
+ });
1223
+ }
1224
+ ), p = h(() => {
1225
+ const i = o.onlyCountries || o.preferredCountries;
1226
+ return i == null ? void 0 : i.map(
1227
+ (f) => {
1228
+ var I;
1229
+ return (I = y.value) == null ? void 0 : I.find((S) => S.iso2.includes(f));
1230
+ }
1231
+ );
1232
+ }), O = h(
1233
+ () => {
1234
+ var i;
1235
+ return (i = y.value) == null ? void 0 : i.filter((f) => {
1236
+ var I;
1237
+ return !((I = o.preferredCountries) != null && I.includes(f.iso2));
1238
+ });
1239
+ }
1240
+ ), $ = h(
1241
+ () => o.preferredCountries ? [...p.value ?? [], ...O.value ?? []] : o.onlyCountries ? p.value : y.value
1242
+ ), v = h(
1243
+ () => {
1244
+ var i;
1245
+ return (i = $.value) == null ? void 0 : i.map(
1246
+ (f) => f ? {
1247
+ ...f,
1248
+ dialCode: `+${f.dialCode}`
1249
+ } : void 0
1250
+ ).filter(mo);
1251
+ }
1252
+ );
1253
+ async function P() {
1254
+ var i, f;
1255
+ (f = (i = t.value) == null ? void 0 : i.$el.querySelector("input")) == null || f.focus();
1256
+ }
1257
+ return (i, f) => (b(), L(
1258
+ "div",
1259
+ {
1260
+ class: F(["m-country-selector", [o.class, { "--no-flags": i.noFlags }]]),
1261
+ style: ee(i.style)
1262
+ },
1263
+ [
1264
+ i.modelValue && !i.noFlags ? (b(), L("button", {
1265
+ key: 0,
1266
+ id: `country-selector-flag-button-${i.id}`,
1267
+ class: F(["m-country-selector__country-flag", {
1268
+ "--should-have-bottom-flag": i.locales.countrySelector.placeholder.length > 0
1269
+ }]),
1270
+ tabindex: "-1",
1271
+ type: "button",
1272
+ onClick: P
1273
+ }, [
1274
+ z(`
1275
+ @slot Country selector flag
1276
+ @binding {String} country-code - current selected country code - Ex: \`"FR"\`
1277
+ `),
1278
+ N(i.$slots, "selector-flag", { countryCode: i.modelValue }, () => [
1279
+ H(Le, {
1280
+ src: E(ke)(i.modelValue, "h20"),
1281
+ alt: i.modelValue,
1282
+ width: "20",
1283
+ height: "20",
1284
+ "img-class": "maz-w-5 maz-h-4 maz-rounded-sm"
1285
+ }, null, 8, ["src", "alt"])
1286
+ ], !0)
1287
+ ], 10, Wo)) : z("v-if", !0),
1288
+ H(Ro, oe({
1289
+ id: `country-selector-${i.id}`,
1290
+ ref_key: "CountrySelectorRef",
1291
+ ref: t,
1292
+ "model-value": i.modelValue
1293
+ }, { ...i.$attrs }, {
1294
+ class: "m-country-selector__select",
1295
+ "option-value-key": "iso2",
1296
+ "option-label-key": "name",
1297
+ "option-input-value-key": i.countrySelectorDisplayName ? "name" : "dialCode",
1298
+ "max-list-width": 250,
1299
+ "min-list-width": 200,
1300
+ disabled: i.disabled,
1301
+ color: i.color,
1302
+ size: i.size,
1303
+ error: i.error,
1304
+ "list-position": i.listPosition,
1305
+ "item-height": 38,
1306
+ success: i.success,
1307
+ search: !i.noSearch,
1308
+ "search-placeholder": i.locales.countrySelector.searchPlaceholder,
1309
+ "search-threshold": i.searchThreshold,
1310
+ options: v.value,
1311
+ hint: E(e) && !i.modelValue ? i.locales.countrySelector.error : void 0,
1312
+ label: i.locales.countrySelector.placeholder,
1313
+ style: {
1314
+ width: i.width
1315
+ },
1316
+ "exclude-selectors": [`#country-selector-flag-button-${i.id}`, ...i.excludeSelectors ?? []],
1317
+ "onUpdate:modelValue": f[0] || (f[0] = (I) => i.$emit("update:model-value", I))
1318
+ }), {
1319
+ "no-results": G(() => [
1320
+ N(i.$slots, "no-results", {}, void 0, !0)
1321
+ ]),
1322
+ default: G(({ option: I, isSelected: S }) => [
1323
+ j(
1324
+ "div",
1325
+ {
1326
+ class: F(["m-country-selector__select__item", {
1327
+ "m-country-selector__select__item--selected": S
1328
+ }])
1329
+ },
1330
+ [
1331
+ !i.noFlags && typeof I.iso2 == "string" ? (b(), L("span", Qo, [
1332
+ z(`
1333
+ @slot Country list flag
1334
+ @binding {String} country-code - country code of option - Ex: \`"FR"\`
1335
+ @binding {{ iso2: string; dialCode: string; name: string; }} option - country data
1336
+ @binding {Boolean} is-selected - \`true\` if option is selected
1337
+ `),
1338
+ N(i.$slots, "country-list-flag", {
1339
+ countryCode: I.iso2,
1340
+ option: I,
1341
+ isSelected: S
1342
+ }, () => [
1343
+ H(Le, {
1344
+ src: E(ke)(I.iso2, "h20"),
1345
+ alt: `${I.name} flag`,
1346
+ width: "20",
1347
+ height: "20",
1348
+ "img-class": "maz-rounded-full maz-w-5 maz-h-5"
1349
+ }, null, 8, ["src", "alt"])
1350
+ ], !0)
1351
+ ])) : z("v-if", !0),
1352
+ i.showCodeOnList ? (b(), L(
1353
+ "span",
1354
+ {
1355
+ key: 1,
1356
+ class: F(["maz-w-9 maz-flex-none", { "maz-text-muted": !S }])
1357
+ },
1358
+ ue(I.dialCode),
1359
+ 3
1360
+ /* TEXT, CLASS */
1361
+ )) : z("v-if", !0),
1362
+ j(
1363
+ "span",
1364
+ {
1365
+ class: F(["maz-flex-1 maz-truncate", { "maz-font-semibold": S }])
1366
+ },
1367
+ ue(I.name),
1368
+ 3
1369
+ /* TEXT, CLASS */
1370
+ )
1371
+ ],
1372
+ 2
1373
+ /* CLASS */
1374
+ )
1375
+ ]),
1376
+ _: 3
1377
+ /* FORWARDED */
1378
+ }, 16, ["id", "model-value", "option-input-value-key", "disabled", "color", "size", "error", "list-position", "success", "search", "search-placeholder", "search-threshold", "options", "hint", "label", "style", "exclude-selectors"])
1379
+ ],
1380
+ 6
1381
+ /* CLASS, STYLE */
1382
+ ));
1383
+ }
1384
+ }), Jo = /* @__PURE__ */ re(Go, [["__scopeId", "data-v-382b69af"]]), Zo = {
1385
+ countrySelector: {
1386
+ placeholder: "Country code",
1387
+ error: "Choose country",
1388
+ searchPlaceholder: "Search the country"
1389
+ },
1390
+ phoneInput: {
1391
+ placeholder: "Phone number",
1392
+ example: "Example:"
1393
+ }
1394
+ };
1395
+ function Xo(n) {
1396
+ try {
1397
+ const o = ro(n);
1398
+ return o || (console.error(`[maz-ui](MazPhoneNumberInput) The code country "${n}" is not available`), !1);
1399
+ } catch (o) {
1400
+ return console.error(`[maz-ui](MazPhoneNumberInput) ${o}`), !1;
1401
+ }
1402
+ }
1403
+ function xo({
1404
+ phoneNumber: n,
1405
+ countryCode: o
1406
+ }) {
1407
+ try {
1408
+ if (!n)
1409
+ return {
1410
+ isValid: !1,
1411
+ countryCode: o
1412
+ };
1413
+ const e = io(n, o);
1414
+ return {
1415
+ countryCode: (e == null ? void 0 : e.country) ?? o,
1416
+ isValid: (e == null ? void 0 : e.isValid()) ?? !1,
1417
+ isPossible: e == null ? void 0 : e.isPossible(),
1418
+ countryCallingCode: e == null ? void 0 : e.countryCallingCode,
1419
+ nationalNumber: e == null ? void 0 : e.nationalNumber,
1420
+ type: e == null ? void 0 : e.getType(),
1421
+ formatInternational: e == null ? void 0 : e.formatInternational(),
1422
+ formatNational: e == null ? void 0 : e.formatNational(),
1423
+ uri: e == null ? void 0 : e.getURI(),
1424
+ e164: e == null ? void 0 : e.format("E.164"),
1425
+ rfc3966: e == null ? void 0 : e.format("RFC3966"),
1426
+ phoneNumber: n
1427
+ };
1428
+ } catch (e) {
1429
+ throw new Error(`[MazPhoneNumberInput](getResultsFromPhoneNumber) ${e}`);
1430
+ }
1431
+ }
1432
+ function _o(n, o) {
1433
+ try {
1434
+ return o ? new uo(n).input(o) : "";
1435
+ } catch (e) {
1436
+ throw new Error(`[MazPhoneNumberInput](getAsYouTypeFormat) ${e}`);
1437
+ }
1438
+ }
1439
+ async function et() {
1440
+ const { default: n } = await import("./examples.mobile.json-JpNGylGv.mjs");
1441
+ return n;
1442
+ }
1443
+ function ot(n, o) {
1444
+ var e;
1445
+ try {
1446
+ return n && o ? (e = co(o, n)) == null ? void 0 : e.formatNational() : void 0;
1447
+ } catch (t) {
1448
+ console.error(`[maz-ui](MazPhoneNumberInput) ${t}`);
1449
+ }
1450
+ }
1451
+ function He() {
1452
+ function n(o, e) {
1453
+ return ce(o) === ce(e);
1454
+ }
1455
+ return {
1456
+ getAsYouTypeFormat: _o,
1457
+ getPhoneNumberResults: xo,
1458
+ getPhoneNumberExamplesFile: et,
1459
+ getPhoneNumberExample: ot,
1460
+ isSameCountryCallingCode: n,
1461
+ isCountryAvailable: Xo,
1462
+ getCountries: Oe,
1463
+ getCountryCallingCode: ce
1464
+ };
1465
+ }
1466
+ const tt = /* @__PURE__ */ se({
1467
+ __name: "PhoneInput",
1468
+ props: /* @__PURE__ */ Ee({
1469
+ id: {},
1470
+ color: {},
1471
+ size: {},
1472
+ locales: {},
1473
+ label: { default: void 0 },
1474
+ placeholder: { default: void 0 },
1475
+ noExample: { type: Boolean },
1476
+ disabled: { type: Boolean },
1477
+ hasRadius: { type: Boolean },
1478
+ success: { type: Boolean },
1479
+ error: { type: Boolean },
1480
+ autoFormat: { type: Boolean },
1481
+ noFormattingAsYouType: { type: Boolean }
1482
+ }, {
1483
+ modelValue: {},
1484
+ modelModifiers: {}
1485
+ }),
1486
+ emits: /* @__PURE__ */ Ee(["update:model-value"], ["update:modelValue"]),
1487
+ setup(n, { emit: o }) {
1488
+ const e = n, t = o, r = ao(n, "modelValue"), { getPhoneNumberExamplesFile: u, getPhoneNumberExample: y } = He(), { selectionRange: p, results: O, selectedCountry: $ } = Me("data"), v = k(), P = k(!1);
1489
+ function i(g, V) {
1490
+ const C = y(g, V);
1491
+ return C ? `${e.locales.phoneInput.example} ${C}` : void 0;
1492
+ }
1493
+ const f = h(() => {
1494
+ var V;
1495
+ if (e.label || e.placeholder)
1496
+ return e.label || e.placeholder;
1497
+ const g = e.locales.phoneInput.placeholder;
1498
+ if (e.noExample || !v.value)
1499
+ return g;
1500
+ {
1501
+ const C = i(v.value, $.value);
1502
+ return (V = O.value) != null && V.isValid || !C ? g : C;
1503
+ }
1504
+ }), I = h(() => e.placeholder ? {
1505
+ placeholder: f.value
1506
+ } : {
1507
+ label: f.value
1508
+ }), S = k();
1509
+ async function R() {
1510
+ try {
1511
+ if (v.value)
1512
+ return;
1513
+ v.value = await u();
1514
+ } catch (g) {
1515
+ console.error("[maz-ui](MazPhoneNumberInput) while loading phone number examples file", g);
1516
+ }
1517
+ }
1518
+ async function Y(g) {
1519
+ S.value && g && J(S.value, g), await ie(), t("update:model-value", g);
1520
+ }
1521
+ function J(g, V) {
1522
+ const C = g.$el.querySelector("input");
1523
+ p.value.start = C == null ? void 0 : C.selectionStart, p.value.end = C == null ? void 0 : C.selectionEnd, p.value.cursorAtEnd = V && typeof p.value.start == "number" && V.length > 0 ? p.value.start >= V.length : !0;
1524
+ }
1525
+ return Ie(() => {
1526
+ e.noExample || R();
1527
+ }), (g, V) => (b(), U(Ce, oe({
1528
+ id: g.id,
1529
+ ref_key: "PhoneInputRef",
1530
+ ref: S,
1531
+ "model-value": r.value
1532
+ }, { ...g.$attrs, ...I.value }, {
1533
+ disabled: g.disabled,
1534
+ color: g.color,
1535
+ error: g.error,
1536
+ size: g.size,
1537
+ success: g.success,
1538
+ class: ["m-phone-input", [
1539
+ {
1540
+ "--border-radius": g.hasRadius,
1541
+ "--error": g.error || !E(O).isValid,
1542
+ "--focused": P.value
1543
+ }
1544
+ ]],
1545
+ onFocus: V[0] || (V[0] = (C) => P.value = !0),
1546
+ onBlur: V[1] || (V[1] = (C) => P.value = !1),
1547
+ "onUpdate:modelValue": V[2] || (V[2] = (C) => Y(C))
1548
+ }), null, 16, ["id", "model-value", "disabled", "color", "error", "size", "success", "class"]));
1549
+ }
1550
+ }), lt = /* @__PURE__ */ re(tt, [["__scopeId", "data-v-ebe8f08f"]]), nt = /* @__PURE__ */ se({
1551
+ name: "MazPhoneNumberInput",
1552
+ inheritAttrs: !1,
1553
+ __name: "MazPhoneNumberInput",
1554
+ props: {
1555
+ style: { default: void 0 },
1556
+ class: { default: void 0 },
1557
+ modelValue: { default: void 0 },
1558
+ defaultPhoneNumber: { default: void 0 },
1559
+ countryCode: { default: void 0 },
1560
+ defaultCountryCode: { default: void 0 },
1561
+ id: { default: void 0 },
1562
+ placeholder: { default: void 0 },
1563
+ label: { default: void 0 },
1564
+ preferredCountries: { default: void 0 },
1565
+ ignoredCountries: { default: void 0 },
1566
+ onlyCountries: { default: void 0 },
1567
+ translations: { default: void 0 },
1568
+ listPosition: { default: "bottom left" },
1569
+ color: { default: "primary" },
1570
+ size: { default: "md" },
1571
+ noFlags: { type: Boolean },
1572
+ disabled: { type: Boolean },
1573
+ noExample: { type: Boolean },
1574
+ noSearch: { type: Boolean },
1575
+ searchThreshold: { default: 0.75 },
1576
+ noUseBrowserLocale: { type: Boolean },
1577
+ fetchCountry: { type: Boolean },
1578
+ noCountrySelector: { type: Boolean },
1579
+ showCodeOnList: { type: Boolean },
1580
+ customCountriesList: { default: void 0 },
1581
+ autoFormat: { type: Boolean, default: !0 },
1582
+ noFormattingAsYouType: { type: Boolean, default: !1 },
1583
+ countryLocale: { default: void 0 },
1584
+ noValidationError: { type: Boolean },
1585
+ noValidationSuccess: { type: Boolean },
1586
+ success: { type: Boolean },
1587
+ error: { type: Boolean },
1588
+ countrySelectorDisplayName: { type: Boolean },
1589
+ countrySelectorWidth: { default: "9rem" },
1590
+ block: { type: Boolean },
1591
+ excludeSelectors: { default: void 0 },
1592
+ orientation: { default: "responsive" },
1593
+ countrySelectAttributes: { default: () => ({
1594
+ name: "country",
1595
+ autocomplete: "off"
1596
+ }) },
1597
+ phoneInputAttributes: { default: () => ({
1598
+ name: "phone",
1599
+ autocomplete: "tel",
1600
+ inputmode: "tel"
1601
+ }) }
1602
+ },
1603
+ emits: ["update:model-value", "country-code", "update:country-code", "update", "data"],
1604
+ setup(n, { emit: o }) {
1605
+ const e = n, t = o, { fetchCountryCode: r, sanitizePhoneNumber: u, getBrowserLocale: y } = Ue(), { isCountryAvailable: p, getPhoneNumberResults: O, getAsYouTypeFormat: $ } = He(), v = Ae({
1606
+ componentName: "MazPhoneNumberInput",
1607
+ providedId: e.id
1608
+ }), P = k(""), i = k(), f = k({
1609
+ isValid: !1,
1610
+ countryCode: void 0
1611
+ }), I = k(), S = k({
1612
+ start: 0,
1613
+ end: 0,
1614
+ cursorAtEnd: !0
1615
+ });
1616
+ so("data", {
1617
+ selectedCountry: i,
1618
+ phoneNumber: P,
1619
+ results: f,
1620
+ selectionRange: S
1621
+ });
1622
+ const R = h(() => ({
1623
+ ...Zo,
1624
+ ...e.translations
1625
+ }));
1626
+ Ie(async () => {
1627
+ var a;
1628
+ if (C(e.countryCode ?? e.defaultCountryCode), e.fetchCountry && !i.value) {
1629
+ const w = await r();
1630
+ C(w);
1631
+ }
1632
+ if (!e.defaultCountryCode && !e.noUseBrowserLocale && !i.value) {
1633
+ const w = (a = y()) == null ? void 0 : a.locale;
1634
+ C(w);
1635
+ }
1636
+ });
1637
+ const Y = k();
1638
+ function J() {
1639
+ var a;
1640
+ return (a = Y.value) == null ? void 0 : a.$el.querySelector("input");
1641
+ }
1642
+ async function g() {
1643
+ var a;
1644
+ await ie(), (a = J()) == null || a.select();
1645
+ }
1646
+ function V(a) {
1647
+ Z({
1648
+ countryCode: a
1649
+ }), g();
1650
+ }
1651
+ function C(a) {
1652
+ if (a) {
1653
+ if (!p(a)) {
1654
+ i.value = void 0;
1655
+ return;
1656
+ }
1657
+ i.value = a;
1658
+ }
1659
+ }
1660
+ function W({
1661
+ newPhoneNumber: a,
1662
+ updateResults: w = !0
1663
+ }) {
1664
+ const K = u(a);
1665
+ if (w && (f.value = O({
1666
+ phoneNumber: K,
1667
+ countryCode: i.value
1668
+ })), S.value.cursorAtEnd && !e.noFormattingAsYouType && e.autoFormat) {
1669
+ const T = f.value.isValid ? f.value.formatNational : K;
1670
+ I.value = $(i.value, T), P.value = I.value;
1671
+ }
1672
+ f.value.countryCode && f.value.countryCode !== i.value && Z({
1673
+ countryCode: f.value.countryCode,
1674
+ updateResults: !1
1675
+ });
1676
+ }
1677
+ function Z({
1678
+ countryCode: a,
1679
+ updateResults: w = !0
1680
+ }) {
1681
+ if (!a) {
1682
+ i.value = void 0;
1683
+ return;
1684
+ }
1685
+ a !== i.value && C(a), w && (f.value = O({
1686
+ phoneNumber: P.value,
1687
+ countryCode: a
1688
+ })), W({
1689
+ newPhoneNumber: P.value,
1690
+ updateResults: !1
1691
+ });
1692
+ }
1693
+ return he(
1694
+ () => e.modelValue ?? e.defaultPhoneNumber,
1695
+ (a, w) => {
1696
+ a !== w && a !== P.value && W({
1697
+ newPhoneNumber: a
1698
+ });
1699
+ },
1700
+ {
1701
+ immediate: !0
1702
+ }
1703
+ ), he(
1704
+ () => e.countryCode ?? e.defaultCountryCode,
1705
+ (a, w) => {
1706
+ a && a !== w && a !== i.value && Z({
1707
+ countryCode: a
1708
+ });
1709
+ },
1710
+ {
1711
+ immediate: !0
1712
+ }
1713
+ ), he(
1714
+ f,
1715
+ (a) => {
1716
+ t("update", a), t("data", a), a.e164 && a.isValid ? t("update:model-value", a.e164) : t("update:model-value", P.value), t("country-code", i.value), t("update:country-code", i.value);
1717
+ },
1718
+ {
1719
+ immediate: !0
1720
+ }
1721
+ ), (a, w) => {
1722
+ var K;
1723
+ return b(), L(
1724
+ "div",
1725
+ {
1726
+ class: F(["m-phone-number-input", [e.class, { "--block": a.block }, a.orientation ? `--${a.orientation}` : void 0]]),
1727
+ style: ee(a.style)
1728
+ },
1729
+ [
1730
+ a.noCountrySelector ? z("v-if", !0) : (b(), U(Jo, oe({
1731
+ key: 0,
1732
+ id: E(v)
1733
+ }, a.countrySelectAttributes, {
1734
+ "model-value": i.value,
1735
+ color: a.color,
1736
+ size: a.size,
1737
+ "country-locale": a.countryLocale,
1738
+ "country-selector-display-name": a.countrySelectorDisplayName,
1739
+ "custom-countries-list": a.customCountriesList,
1740
+ "ignored-countries": a.ignoredCountries,
1741
+ "list-position": a.listPosition,
1742
+ "no-flags": a.noFlags,
1743
+ "no-search": a.noSearch,
1744
+ "exclude-selectors": a.excludeSelectors,
1745
+ error: a.error || (a.noValidationError ? !1 : !!P.value && !i.value),
1746
+ success: a.success || (a.noValidationSuccess ? !1 : (K = f.value) == null ? void 0 : K.isValid),
1747
+ locales: R.value,
1748
+ disabled: a.disabled,
1749
+ "search-threshold": a.searchThreshold,
1750
+ "show-code-on-list": a.showCodeOnList,
1751
+ "only-countries": a.onlyCountries,
1752
+ "preferred-countries": a.preferredCountries,
1753
+ width: a.countrySelectorWidth,
1754
+ "onUpdate:modelValue": V
1755
+ }), {
1756
+ "no-results": G(() => [
1757
+ z(`
1758
+ @slot Replace the "no results" icon in the country selector list
1759
+ `),
1760
+ N(a.$slots, "no-results", {}, void 0, !0)
1761
+ ]),
1762
+ "selector-flag": G(({ countryCode: T }) => [
1763
+ z(`
1764
+ @slot Country selector flag
1765
+ @binding {String} country-code - current selected country code - Ex: \`"FR"\`
1766
+ `),
1767
+ N(a.$slots, "selector-flag", { countryCode: T }, void 0, !0)
1768
+ ]),
1769
+ "country-list-flag": G(({ isSelected: T, option: te }) => [
1770
+ z(`
1771
+ @slot Country list flag
1772
+ @binding {String} country-code - country code of option - Ex: \`"FR"\`
1773
+ @binding {{ iso2: string; dialCode: string; name: string; }} option - country data
1774
+ @binding {Boolean} is-selected - \`true\` if option is selected
1775
+ `),
1776
+ N(a.$slots, "country-list-flag", {
1777
+ countryCode: te.iso2,
1778
+ option: te,
1779
+ isSelected: T
1780
+ }, void 0, !0)
1781
+ ]),
1782
+ _: 3
1783
+ /* FORWARDED */
1784
+ }, 16, ["id", "model-value", "color", "size", "country-locale", "country-selector-display-name", "custom-countries-list", "ignored-countries", "list-position", "no-flags", "no-search", "exclude-selectors", "error", "success", "locales", "disabled", "search-threshold", "show-code-on-list", "only-countries", "preferred-countries", "width"])),
1785
+ H(lt, oe({
1786
+ id: E(v),
1787
+ ref_key: "PhoneInputRef",
1788
+ ref: Y,
1789
+ modelValue: P.value,
1790
+ "onUpdate:modelValue": w[0] || (w[0] = (T) => P.value = T)
1791
+ }, { ...a.$attrs, ...a.phoneInputAttributes }, {
1792
+ color: a.color,
1793
+ size: a.size,
1794
+ "no-example": a.noExample,
1795
+ block: "",
1796
+ disabled: a.disabled,
1797
+ "has-radius": !a.noCountrySelector,
1798
+ success: a.success || (a.noValidationSuccess ? !1 : f.value.isValid),
1799
+ error: a.error || (a.noValidationError ? !1 : !!P.value && !f.value.isValid),
1800
+ locales: R.value,
1801
+ "no-formatting-as-you-type": a.noFormattingAsYouType,
1802
+ "auto-format": a.autoFormat,
1803
+ label: a.label,
1804
+ placeholder: a.placeholder,
1805
+ "onUpdate:modelValue": w[1] || (w[1] = (T) => W({
1806
+ newPhoneNumber: T
1807
+ }))
1808
+ }), null, 16, ["id", "modelValue", "color", "size", "no-example", "disabled", "has-radius", "success", "error", "locales", "no-formatting-as-you-type", "auto-format", "label", "placeholder"])
1809
+ ],
1810
+ 6
1811
+ /* CLASS, STYLE */
1812
+ );
1813
+ };
1814
+ }
1815
+ }), it = /* @__PURE__ */ re(nt, [["__scopeId", "data-v-420d6d4a"]]);
1816
+ export {
1817
+ it as M,
1818
+ re as _,
1819
+ Me as i,
1820
+ Ae as u
1821
+ };