UNPKG

mui-country-code-selector

Version:
1,929 lines 172 kB
import { jsx as K, jsxs as er, Fragment as tr } from "react/jsx-runtime"; import * as Ee from "react"; import Ne, { createContext as So, useContext as fn, useRef as de, useState as Ie, useEffect as Se, useCallback as me, useReducer as vo } from "react"; import { TextField as rr, Box as Eo, createFilterOptions as Co, Autocomplete as dn, GridLegacy as dt, FormGroup as br, Stack as To, Grid as Oo, FormHelperText as pn } from "@mui/material"; import { ThemeContext as wo } from "@emotion/react"; import _o from "@emotion/styled"; function mn(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var it = { exports: {} }, Dt = {}, st = { exports: {} }, Lt = {}; /** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Sr; function Ao() { if (Sr) return Lt; Sr = 1; var e = Ne; function t(p, m) { return p === m && (p !== 0 || 1 / p === 1 / m) || p !== p && m !== m; } var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, i = e.useLayoutEffect, s = e.useDebugValue; function u(p, m) { var y = m(), g = n({ inst: { value: y, getSnapshot: m } }), c = g[0].inst, v = g[1]; return i( function() { c.value = y, c.getSnapshot = m, f(c) && v({ inst: c }); }, [p, y, m] ), o( function() { return f(c) && v({ inst: c }), p(function() { f(c) && v({ inst: c }); }); }, [p] ), s(y), y; } function f(p) { var m = p.getSnapshot; p = p.value; try { var y = m(); return !r(p, y); } catch { return !0; } } function l(p, m) { return m(); } var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l : u; return Lt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : d, Lt; } var Bt = {}; /** * @license React * use-sync-external-store-shim.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var vr; function Ro() { return vr || (vr = 1, process.env.NODE_ENV !== "production" && function() { function e(y, g) { return y === g && (y !== 0 || 1 / y === 1 / g) || y !== y && g !== g; } function t(y, g) { d || o.startTransition === void 0 || (d = !0, console.error( "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." )); var c = g(); if (!p) { var v = g(); i(c, v) || (console.error( "The result of getSnapshot should be cached to avoid an infinite loop" ), p = !0); } v = s({ inst: { value: c, getSnapshot: g } }); var T = v[0].inst, I = v[1]; return f( function() { T.value = c, T.getSnapshot = g, r(T) && I({ inst: T }); }, [y, c, g] ), u( function() { return r(T) && I({ inst: T }), y(function() { r(T) && I({ inst: T }); }); }, [y] ), l(c), c; } function r(y) { var g = y.getSnapshot; y = y.value; try { var c = g(); return !i(y, c); } catch { return !0; } } function n(y, g) { return g(); } typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); var o = Ne, i = typeof Object.is == "function" ? Object.is : e, s = o.useState, u = o.useEffect, f = o.useLayoutEffect, l = o.useDebugValue, d = !1, p = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t; Bt.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); }()), Bt; } var Er; function gn() { return Er || (Er = 1, process.env.NODE_ENV === "production" ? st.exports = Ao() : st.exports = Ro()), st.exports; } /** * @license React * use-sync-external-store-shim/with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Cr; function xo() { if (Cr) return Dt; Cr = 1; var e = Ne, t = gn(); function r(l, d) { return l === d && (l !== 0 || 1 / l === 1 / d) || l !== l && d !== d; } var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, i = e.useRef, s = e.useEffect, u = e.useMemo, f = e.useDebugValue; return Dt.useSyncExternalStoreWithSelector = function(l, d, p, m, y) { var g = i(null); if (g.current === null) { var c = { hasValue: !1, value: null }; g.current = c; } else c = g.current; g = u( function() { function T(A) { if (!I) { if (I = !0, _ = A, A = m(A), y !== void 0 && c.hasValue) { var $ = c.value; if (y($, A)) return O = $; } return O = A; } if ($ = O, n(_, A)) return $; var k = m(A); return y !== void 0 && y($, k) ? (_ = A, $) : (_ = A, O = k); } var I = !1, _, O, b = p === void 0 ? null : p; return [ function() { return T(d()); }, b === null ? void 0 : function() { return T(b()); } ]; }, [d, p, m, y] ); var v = o(l, g[0], g[1]); return s( function() { c.hasValue = !0, c.value = v; }, [v] ), f(v), v; }, Dt; } var Gt = {}; /** * @license React * use-sync-external-store-shim/with-selector.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Tr; function $o() { return Tr || (Tr = 1, process.env.NODE_ENV !== "production" && function() { function e(l, d) { return l === d && (l !== 0 || 1 / l === 1 / d) || l !== l && d !== d; } typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); var t = Ne, r = gn(), n = typeof Object.is == "function" ? Object.is : e, o = r.useSyncExternalStore, i = t.useRef, s = t.useEffect, u = t.useMemo, f = t.useDebugValue; Gt.useSyncExternalStoreWithSelector = function(l, d, p, m, y) { var g = i(null); if (g.current === null) { var c = { hasValue: !1, value: null }; g.current = c; } else c = g.current; g = u( function() { function T(A) { if (!I) { if (I = !0, _ = A, A = m(A), y !== void 0 && c.hasValue) { var $ = c.value; if (y($, A)) return O = $; } return O = A; } if ($ = O, n(_, A)) return $; var k = m(A); return y !== void 0 && y($, k) ? (_ = A, $) : (_ = A, O = k); } var I = !1, _, O, b = p === void 0 ? null : p; return [ function() { return T(d()); }, b === null ? void 0 : function() { return T(b()); } ]; }, [d, p, m, y] ); var v = o(l, g[0], g[1]); return s( function() { c.hasValue = !0, c.value = v; }, [v] ), f(v), v; }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); }()), Gt; } var Or; function Po() { return Or || (Or = 1, process.env.NODE_ENV === "production" ? it.exports = xo() : it.exports = $o()), it.exports; } var Mo = Po(); const Io = /* @__PURE__ */ mn(Mo), No = {}, wr = (e) => { let t; const r = /* @__PURE__ */ new Set(), n = (d, p) => { const m = typeof d == "function" ? d(t) : d; if (!Object.is(m, t)) { const y = t; t = p ?? (typeof m != "object" || m === null) ? m : Object.assign({}, t, m), r.forEach((g) => g(t, y)); } }, o = () => t, f = { setState: n, getState: o, getInitialState: () => l, subscribe: (d) => (r.add(d), () => r.delete(d)), destroy: () => { (No ? "production" : void 0) !== "production" && console.warn( "[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected." ), r.clear(); } }, l = t = e(n, o, f); return f; }, ko = (e) => e ? wr(e) : wr, { useDebugValue: Do } = Ne, { useSyncExternalStoreWithSelector: Lo } = Io, Bo = (e) => e; function le(e, t = Bo, r) { const n = Lo( e.subscribe, e.getState, e.getServerState || e.getInitialState, t, r ); return Do(n), n; } function fe(e, t) { if (Object.is(e, t)) return !0; if (typeof e != "object" || e === null || typeof t != "object" || t === null) return !1; if (e instanceof Map && t instanceof Map) { if (e.size !== t.size) return !1; for (const [n, o] of e) if (!Object.is(o, t.get(n))) return !1; return !0; } if (e instanceof Set && t instanceof Set) { if (e.size !== t.size) return !1; for (const n of e) if (!t.has(n)) return !1; return !0; } const r = Object.keys(e); if (r.length !== Object.keys(t).length) return !1; for (const n of r) if (!Object.prototype.hasOwnProperty.call(t, n) || !Object.is(e[n], t[n])) return !1; return !0; } const nr = So(null), yn = () => { const e = fn(nr); if (e === null) throw new Error( "no provider - please, surround the component with CountryCodeStoreProvider tags" ); return { phoneNumStr: le( e, (t) => t.phoneNumStr, fe ), countryCodeValue: le( e, (t) => t.countryCodeValue, fe ), countries: le( e, (t) => t.countries, fe ), errorMsg: le(e, (t) => t.errorMsg, fe), errorMsgDelay: le( e, (t) => t.errorMsgDelay, fe ), errorMsgTimeoutObj: le( e, (t) => t.errorMsgTimeoutObj, fe ), phoneNumberInput: le( e, (t) => t.phoneNumberInput, fe ), clearedRerender: le( e, (t) => t.clearedRerender, fe ), setPhoneNumberInput: le( e, (t) => t.setPhoneNumberInput, fe ), setRefs: le(e, (t) => t.setRefs, fe), initialize: le( e, (t) => t.initialize, fe ), cleanUp: le(e, (t) => t.cleanUp, fe), handlePhoneNumberChange: le( e, (t) => t.handlePhoneNumberChange, fe ), handleCountryCodeChange: le( e, (t) => t.handleCountryCodeChange, fe ), handleValueChange: le( e, (t) => t.handleValueChange, fe ), placeInputSelection: le( e, (t) => t.placeInputSelection, fe ) }; }, hn = "Country code", Go = "Country", jo = "20rem", Vo = "90vw", bn = { paper: { sx: { width: jo, maxWidth: Vo } } }, Sn = 145; function vn() { return Co({ matchFrom: "any", stringify: (e) => { const t = Array.isArray(e.country) ? e.country.join(" ") : e.country, r = e.displayIso ? e.displayIso : e.iso; return `${t} ${e.iso} ${r} +${e.code}`; } }); } function En(e, t) { const r = t.displayIso ? t.displayIso : t.iso, { key: n, ...o } = e; let i = "", s = ""; return Array.isArray(t.country) ? ([i, s] = t.country, s && (s = ` (${s})`)) : i = t.country, /* @__PURE__ */ er(Eo, { component: "li", ...o, children: [ i, s, " ", r, " +", t.code ] }, n); } function Cn(e, t, r, n) { return function(i) { let s = e; return t < Sn && (s = Go), /* @__PURE__ */ K( rr, { ...i, label: s, inputProps: { ...i.inputProps, autoComplete: "new-password" // disable autocomplete and autofill }, variant: n, InputLabelProps: { shrink: r } } ); }; } function Tn(e) { return `${Array.isArray(e.country) ? e.country[0] : e.country}${e.code}${e.iso}`; } function On(e) { return function(r) { const n = r.displayIso ? ` ${r.displayIso}` : ` ${r.iso}`; let o = "", i = ""; return Array.isArray(r.country) ? ([o, i] = r.country, i && (i = ` (${i})`)) : o = r.country, e < Sn ? n.trim() : `${o}${i}${n}`; }; } function Fo({ autoHighlight: e = !0, autoSelect: t = !0, filterOptions: r = vn(), getOptionKey: n = void 0, getOptionLabel: o = void 0, handleHomeEndKeys: i = !1, label: s = hn, renderOption: u = En, renderInput: f, shrink: l, slotProps: d, variant: p, renderCountRef: m, ...y }) { const { handleCountryCodeChange: g, countryCodeValue: c, countries: v } = yn(), T = de(null), [I, _] = Ie(160); Se(() => { if (!T.current) return; const F = new ResizeObserver((a) => { a[0].contentBoxSize && _(a[0].contentBoxSize[0].inlineSize); }); return F.observe(T.current), () => F.disconnect(); }, []); const O = me((F) => { T.current = F; }, []), b = f ?? Cn(s, I, l, p), A = n ?? Tn, $ = o ?? On(I), k = { ...bn, ...d }; return Se(() => { m && (m.current += 1); }), /* @__PURE__ */ K( dn, { autoHighlight: e, autoSelect: t, filterOptions: r, getOptionKey: A, getOptionLabel: $, handleHomeEndKeys: i, onChange: g, options: v, renderOption: u, renderInput: b, slotProps: k, value: c, ref: O, ...y } ); } function Wo({ autoHighlight: e = !0, autoSelect: t = !0, filterOptions: r = vn(), getOptionKey: n = void 0, getOptionLabel: o = void 0, handleHomeEndKeys: i = !1, label: s = hn, onChange: u, renderOption: f = En, renderInput: l, shrink: d, slotProps: p, value: m, variant: y, renderCountRef: g, countries: c, ...v }) { const T = de(null), [I, _] = Ie(160); Se(() => { if (!T.current) return; const F = new ResizeObserver((a) => { a[0].contentBoxSize && _(a[0].contentBoxSize[0].inlineSize); }); return F.observe(T.current), () => F.disconnect(); }, []); const O = me((F) => { T.current = F; }, []), b = l ?? Cn(s, I, d, y), A = n ?? Tn, $ = o ?? On(I), k = { ...bn, ...p }; return Se(() => { g && (g.current += 1); }), /* @__PURE__ */ K( dn, { autoHighlight: e, autoSelect: t, filterOptions: r, getOptionKey: A, getOptionLabel: $, handleHomeEndKeys: i, onChange: u, options: c, renderOption: f, renderInput: b, slotProps: k, value: m, ref: O, ...v } ); } const Uo = (e, t, r) => { const n = e[t]; return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((o, i) => { (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)( i.bind( null, new Error( "Unknown variable dynamic import: " + t + (t.split("/").length !== r ? ". Note that variables only represent file names one level deep." : "") ) ) ); }); }, wn = [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BQBO", "BQSA", "BQSE", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SHAC", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW" ]; function zo(e) { return typeof e == "object" && e !== null; } function Ko(e) { return zo(e) ? !wn.some((t) => { if (!(t in e)) return !0; const r = e; return typeof r[t] != "string" ? Array.isArray(r[t]) ? r[t].some((o) => typeof o != "string") : !0 : !1; }) : !1; } const Ho = { AD: "376", AE: "971", AF: "93", AG: "1-268", AI: "1-264", AL: "355", AM: "374", AO: "244", AQ: ["672", "64"], AR: "54", AS: "1-684", AT: "43", AU: "61", AW: "297", AX: "358-18", AZ: "994", BA: "387", BB: "1-246", BD: "880", BE: "32", BF: "226", BG: "359", BH: "973", BI: "257", BJ: "229", BL: "590", BM: "1-441", BN: "673", BO: "591", BQ: "599", BQBO: "599-7", BQSA: "599-4", BQSE: "599-3", BR: "55", BS: "1-242", BT: "975", BW: "267", BY: "375", BZ: "501", CA: "1", CC: "61", CD: "243", CF: "236", CG: "242", CH: "41", CI: "225", CK: "682", CL: "56", CM: "237", CN: "86", CO: "57", CR: "506", CU: "53", CV: "238", CW: "599-9", CX: "61", CY: "357", CZ: "420", DE: "49", DJ: "253", DK: "45", DM: "1-767", DO: ["1-809", "1-829", "1-849"], DZ: "213", EC: "593", EE: "372", EG: "20", EH: "212", ER: "291", ES: "34", ET: "251", FI: "358", FJ: "679", FK: "500", FM: "691", FO: "298", FR: "33", GA: "241", GB: "44", GD: "1-473", GE: "995", GF: "594", GG: "44-1481", GH: "233", GI: "350", GL: "299", GM: "220", GN: "224", GP: "590", GQ: "240", GR: "30", GS: "500", GT: "502", GU: "1-671", GW: "245", GY: "592", HK: "852", HN: "504", HR: "385", HT: "509", HU: "36", ID: "62", IE: "353", IL: "972", IM: "44-1624", IN: "91", IO: "246", IQ: "964", IR: "98", IS: "354", IT: "39", JE: "44-1534", JM: ["1-658", "1-876"], JO: "962", JP: "81", KE: "254", KG: "996", KH: "855", KI: "686", KM: "269", KN: "1-869", KP: "850", KR: "82", KW: "965", KY: "1-345", KZ: "7", LA: "856", LB: "961", LC: "1-758", LI: "423", LK: "94", LR: "231", LS: "266", LT: "370", LU: "352", LV: "371", LY: "218", MA: "212", MC: "377", MD: "373", ME: "382", MF: "590", MG: "261", MH: "692", MK: "389", ML: "223", MM: "95", MN: "976", MO: "853", MP: "1-670", MQ: "596", MR: "222", MS: "1-664", MT: "356", MU: "230", MV: "960", MW: "265", MX: "52", MY: "60", MZ: "258", NA: "264", NC: "687", NE: "227", NF: "672-3", NG: "234", NI: "505", NL: "31", NO: "47", NP: "977", NR: "674", NU: "683", NZ: "64", OM: "968", PA: "507", PE: "51", PF: "689", PG: "675", PH: "63", PK: "92", PL: "48", PM: "508", PN: "64", PR: ["1-787", "1-939"], PS: "970", PT: "351", PW: "680", PY: "595", QA: "974", RE: "262", RO: "40", RS: "381", RU: "7", RW: "250", SA: "966", SB: "677", SC: "248", SD: "249", SE: "46", SG: "65", SH: "290", SHAC: "247", SI: "386", SJ: "47-79", SK: "421", SL: "232", SM: "378", SN: "221", SO: "252", SR: "597", SS: "211", ST: "239", SV: "503", SX: "1-721", SY: "963", SZ: "268", TC: "1-649", TD: "235", TG: "228", TH: "66", TJ: "992", TK: "690", TL: "670", TM: "993", TN: "216", TO: "676", TR: "90", TT: "1-868", TV: "688", TW: "886", TZ: "255", UA: "380", UG: "256", UM: "1-808", US: "1", UY: "598", UZ: "998", VA: "379", VC: "1-784", VE: "58", VG: "1-284", VI: "1-340", VN: "84", VU: "678", WF: "681", WS: "685", XK: "383", YE: "967", YT: "262", ZA: "27", ZM: "260", ZW: "263" }; function Yo(e) { if (Ko(e)) return e; throw new Error("invalid CountryNameRecord"); } function _r(e, t, r, n, o) { const i = { country: t[n], code: r, iso: n }; o && (i.displayIso = o), e.push(i); } async function _n(e = "en") { let t; try { t = await Uo(/* @__PURE__ */ Object.assign({ "./countryNames/en.json": () => import("./en-VTdMomEX.js") }), `./countryNames/${e}.json`, 3); } catch (o) { if (o instanceof Error) throw new Error( `importing of locale '${e}' failed: ${o.message}` ); } const r = Yo(t), n = []; return wn.forEach((o) => { const i = Ho[o], s = o.length > 2 ? `${o.slice(0, 2)}-${o.slice(2)}` : ""; Array.isArray(i) ? i.forEach((u) => { _r(n, r, u, o, s); }) : _r(n, r, i, o, s); }), n; } function pt(e) { return e.replace(/\+|\s|-/g, ""); } function mt(e = "", t = null) { return { significantDigits: e, countryCodeDigits: "", countryCodeValue: null, possibleCountries: t }; } function An(e) { let t = e == null ? void 0 : e.parentElement; for (; t && t.tagName !== "FORM"; ) t = t == null ? void 0 : t.parentElement; return t; } function Rn(e, t, r, n, o, i) { function s() { return { selectionStart: t != null && t.selectionStart ? t.selectionStart : 0, selectionEnd: t != null && t.selectionEnd ? t.selectionEnd : 0 }; } function u(b, A, $) { return b.length > 0 && A === "+" && $.length === 0; } function f(b, A) { return b.length > 0 && b !== A; } function l(b, A, $) { return !!(b.length > 0 && b === A && $ && $.maxCodeDigits > b.length); } function d(b) { function A(a, C) { const x = C ? C.possibleCountries : i; let P = Number.MAX_SAFE_INTEGER, D = 0, H = []; return H = x.filter((Q) => { const Z = pt(Q.code), ne = Z.startsWith(a); return ne && Z.length < P && (P = Z.length), ne && Z.length > D && (D = Z.length), ne; }), { newPossible: H, minCodeDigits: P, maxCodeDigits: D }; } let $ = null, k = [], F = ""; for (let a = 0; a < b.length; a += 1) { F += b[a]; let C = Number.MAX_SAFE_INTEGER, x = 0; if ({ newPossible: k, minCodeDigits: C, maxCodeDigits: x } = A(F, $), k.length > 0) $ = { digitsConsidered: b.slice(0, a + 1), minCodeDigits: C, maxCodeDigits: x, possibleCountries: k }; else break; } return $; } const p = (b, A, $, k) => { function F() { const P = A.length > 0 ? b.slice(0, A.length) : null; return !!// it is correct to use eslint-disable-next-line // @typescript-eslint/prefer-nullish-coalescing (P && P !== A || P && (k != null && k.maxCodeDigits) && b.length > P.length && P.length < k.maxCodeDigits); } function a(P, D) { let H = D ? D.digitsConsidered.length : P.length; const Q = (D && D.digitsConsidered.length < D.minCodeDigits) ?? !D ? i : D.possibleCountries; let Z = []; for (H; H >= 0; H -= 1) { const ne = H; if (Z = Q.filter( (he) => he.code.replace(/\s|-/g, "") === P.slice(0, ne) ), Z.length > 0) return Z; } return Z; } let C = k, x = A; if ((!k || F()) && (C = d(b), x = C ? b.slice(0, C.maxCodeDigits) : ""), C && C.possibleCountries.length > 0) { const P = a(b, C); if (P.length > 0) { const D = pt(P[0].code); if (D !== $) return { significantDigits: x, countryCodeDigits: D, countryCodeValue: P[0], possibleCountries: C }; } return b.startsWith($) ? { significantDigits: x, possibleCountries: C } : { ...mt(x, C) }; } return { ...mt() }; }, m = s(), y = m.selectionStart - 1, g = m.selectionEnd - 1, c = { selectionStart: y > 0 ? y : 0, selectionEnd: g > 0 ? g : 0 }; if (e.match(/[^+\d\s-]/)) return { errorMsg: 'Only digits and visual separator characters (" ", "-") are allowed', inputSelection: c }; if (e.match(/^[^+\d]/)) return { errorMsg: "Phone number must start with a number or a plus character", inputSelection: c }; if (e.match(/\s{2,}|-{2,}|\s-|-\s/)) return { errorMsg: "Only one separator character between digits allowed", inputSelection: c }; if (e.match(/\+.*\+/)) return { errorMsg: "Only one plus character is allowed at the beginning of the phone number", inputSelection: c }; if (e.match(/\+/) && !e.startsWith("+")) return { errorMsg: "Plus can only be the first character of the phone number", inputSelection: c }; const v = pt(e); let T = { ...n }, I = o; const _ = e.slice(0, 1); if (v.length > 0 && _ === "+" && !n && (T = d(v), I = T ? v.slice(0, T == null ? void 0 : T.maxCodeDigits) : ""), r.length > 0 && _ !== "+") return { ...mt(), phoneNumStr: e, inputSelection: s() }; const O = v.slice(0, r.length); return u(v, _, r) || f(O, r) || l(O, r, T) ? { ...p( v, I, r, T ), phoneNumStr: e, inputSelection: s() } : { phoneNumStr: e, inputSelection: s() }; } function xn(e, t, r, n, o) { function i(f) { const l = "(\\s*|-*)"; return new RegExp( `${["\\+", ...f].join(l) + l}0*` ); } function s(f, l, d) { const p = `+${f.code} `, m = d.startsWith("0") ? d.replace(/^0*/, "") : d.replace(i(l), ""), y = p + m; return { countryCodeDigits: pt(f.code), countryCodeValue: f, phoneNumStr: y, inputSelection: { selectionStart: y.length, selectionEnd: y.length } }; } function u(f, l) { const d = l.replace(i(f), ""); return { ...mt(), phoneNumStr: d }; } return o === "clear" ? { ...u(r, n) } : e != null && e.code ? (t && t.focus(), { ...s(e, r, n) }) : {}; } function $n(e, t) { e({ target: { value: t } }); } function Pn(e, t, r) { e && e.addEventListener( "reset", () => $n(t, r) ); } function Mn(e, t, r) { e == null || e.removeEventListener( "reset", () => $n(t, r) ); } function In(e, t) { if (!e.shiftKey) { const r = e.target; t({ selectionStart: r.selectionStart ?? r.value.length, selectionEnd: r.selectionEnd ?? r.value.length }); } } function Nn(e, t) { e == null || e.addEventListener( "keyup", (r) => In(r, t) ); } function kn(e, t) { e == null || e.removeEventListener( "keyup", (r) => In(r, t) ); } function Dn(e, t) { const r = e.target; t({ selectionStart: r.selectionStart ?? r.value.length, selectionEnd: r.selectionEnd ?? r.value.length }); } function Ln(e, t) { e == null || e.addEventListener( "mouseup", (r) => Dn(r, t) ); } function Bn(e, t) { e == null || e.removeEventListener( "mouseUp", (r) => Dn(r, t) ); } function Gn(e, t) { e.target.value === "" && t(); } function jn(e, t) { e == null || e.addEventListener( "blur", (r) => Gn(r, t) ); } function Vn(e, t) { e == null || e.removeEventListener( "blur", (r) => Gn(r, t) ); } function Fn(e, t) { e && e === document.activeElement && (e.focus(), e.setSelectionRange( t.selectionStart, t.selectionEnd )); } function Ar({ gridItemProps: e, gridSelectorProps: t, gridInputProps: r, gridErrorProps: n, selectorSize: o, inputSize: i, errorSize: s, children: u }) { const f = { ...e, ...t, ...o }, l = { ...e, ...r, ...i }, d = { ...e, ...n, ...s }; return /* @__PURE__ */ K(tr, { children: Ne.Children.map(u, (p, m) => { switch (m) { case 0: return /* @__PURE__ */ K(dt, { item: !0, ...f, children: p }, "selector"); case 1: return /* @__PURE__ */ K(dt, { item: !0, ...l, children: p }, "input"); case 2: return p !== null ? /* @__PURE__ */ K(dt, { item: !0, ...d, children: p }, "error") : null; default: return null; } }) }); } var at = { exports: {} }, ct = { exports: {} }, Y = {}; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Rr; function qo() { if (Rr) return Y; Rr = 1; var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, n = e ? Symbol.for("react.fragment") : 60107, o = e ? Symbol.for("react.strict_mode") : 60108, i = e ? Symbol.for("react.profiler") : 60114, s = e ? Symbol.for("react.provider") : 60109, u = e ? Symbol.for("react.context") : 60110, f = e ? Symbol.for("react.async_mode") : 60111, l = e ? Symbol.for("react.concurrent_mode") : 60111, d = e ? Symbol.for("react.forward_ref") : 60112, p = e ? Symbol.for("react.suspense") : 60113, m = e ? Symbol.for("react.suspense_list") : 60120, y = e ? Symbol.for("react.memo") : 60115, g = e ? Symbol.for("react.lazy") : 60116, c = e ? Symbol.for("react.block") : 60121, v = e ? Symbol.for("react.fundamental") : 60117, T = e ? Symbol.for("react.responder") : 60118, I = e ? Symbol.for("react.scope") : 60119; function _(b) { if (typeof b == "object" && b !== null) { var A = b.$$typeof; switch (A) { case t: switch (b = b.type, b) { case f: case l: case n: case i: case o: case p: return b; default: switch (b = b && b.$$typeof, b) { case u: case d: case g: case y: case s: return b; default: return A; } } case r: return A; } } } function O(b) { return _(b) === l; } return Y.AsyncMode = f, Y.ConcurrentMode = l, Y.ContextConsumer = u, Y.ContextProvider = s, Y.Element = t, Y.ForwardRef = d, Y.Fragment = n, Y.Lazy = g, Y.Memo = y, Y.Portal = r, Y.Profiler = i, Y.StrictMode = o, Y.Suspense = p, Y.isAsyncMode = function(b) { return O(b) || _(b) === f; }, Y.isConcurrentMode = O, Y.isContextConsumer = function(b) { return _(b) === u; }, Y.isContextProvider = function(b) { return _(b) === s; }, Y.isElement = function(b) { return typeof b == "object" && b !== null && b.$$typeof === t; }, Y.isForwardRef = function(b) { return _(b) === d; }, Y.isFragment = function(b) { return _(b) === n; }, Y.isLazy = function(b) { return _(b) === g; }, Y.isMemo = function(b) { return _(b) === y; }, Y.isPortal = function(b) { return _(b) === r; }, Y.isProfiler = function(b) { return _(b) === i; }, Y.isStrictMode = function(b) { return _(b) === o; }, Y.isSuspense = function(b) { return _(b) === p; }, Y.isValidElementType = function(b) { return typeof b == "string" || typeof b == "function" || b === n || b === l || b === i || b === o || b === p || b === m || typeof b == "object" && b !== null && (b.$$typeof === g || b.$$typeof === y || b.$$typeof === s || b.$$typeof === u || b.$$typeof === d || b.$$typeof === v || b.$$typeof === T || b.$$typeof === I || b.$$typeof === c); }, Y.typeOf = _, Y; } var q = {}; /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var xr; function Zo() { return xr || (xr = 1, process.env.NODE_ENV !== "production" && function() { var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, n = e ? Symbol.for("react.fragment") : 60107, o = e ? Symbol.for("react.strict_mode") : 60108, i = e ? Symbol.for("react.profiler") : 60114, s = e ? Symbol.for("react.provider") : 60109, u = e ? Symbol.for("react.context") : 60110, f = e ? Symbol.for("react.async_mode") : 60111, l = e ? Symbol.for("react.concurrent_mode") : 60111, d = e ? Symbol.for("react.forward_ref") : 60112, p = e ? Symbol.for("react.suspense") : 60113, m = e ? Symbol.for("react.suspense_list") : 60120, y = e ? Symbol.for("react.memo") : 60115, g = e ? Symbol.for("react.lazy") : 60116, c = e ? Symbol.for("react.block") : 60121, v = e ? Symbol.for("react.fundamental") : 60117, T = e ? Symbol.for("react.responder") : 60118, I = e ? Symbol.for("react.scope") : 60119; function _(R) { return typeof R == "string" || typeof R == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. R === n || R === l || R === i || R === o || R === p || R === m || typeof R == "object" && R !== null && (R.$$typeof === g || R.$$typeof === y || R.$$typeof === s || R.$$typeof === u || R.$$typeof === d || R.$$typeof === v || R.$$typeof === T || R.$$typeof === I || R.$$typeof === c); } function O(R) { if (typeof R == "object" && R !== null) { var se = R.$$typeof; switch (se) { case t: var Me = R.type; switch (Me) { case f: case l: case n: case i: case o: case p: return Me; default: var Oe = Me && Me.$$typeof; switch (Oe) { case u: case d: case g: case y: case s: return Oe; default: return se; } } case r: return se; } } } var b = f, A = l, $ = u, k = s, F = t, a = d, C = n, x = g, P = y, D = r, H = i, Q = o, Z = p, ne = !1; function he(R) { return ne || (ne = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), E(R) || O(R) === f; } function E(R) { return O(R) === l; } function w(R) { return O(R) === u; } function B(R) { return O(R) === s; } function M(R) { return typeof R == "object" && R !== null && R.$$typeof === t; } function N(R) { return O(R) === d; } function W(R) { return O(R) === n; } function j(R) { return O(R) === g; } function G(R) { return O(R) === y; } function V(R) { return O(R) === r; } function z(R) { return O(R) === i; } function U(R) { return O(R) === o; } function ce(R) { return O(R) === p; } q.AsyncMode = b, q.ConcurrentMode = A, q.ContextConsumer = $, q.ContextProvider = k, q.Element = F, q.ForwardRef = a, q.Fragment = C, q.Lazy = x, q.Memo = P, q.Portal = D, q.Profiler = H, q.StrictMode = Q, q.Suspense = Z, q.isAsyncMode = he, q.isConcurrentMode = E, q.isContextConsumer = w, q.isContextProvider = B, q.isElement = M, q.isForwardRef = N, q.isFragment = W, q.isLazy = j, q.isMemo = G, q.isPortal = V, q.isProfiler = z, q.isStrictMode = U, q.isSuspense = ce, q.isValidElementType = _, q.typeOf = O; }()), q; } var $r; function Wn() { return $r || ($r = 1, process.env.NODE_ENV === "production" ? ct.exports = qo() : ct.exports = Zo()), ct.exports; } /* object-assign (c) Sindre Sorhus @license MIT */ var jt, Pr; function Qo() { if (Pr) return jt; Pr = 1; var e = Object.getOwnPropertySymbols, t = Object.prototype.hasOwnProperty, r = Object.prototype.propertyIsEnumerable; function n(i) { if (i == null) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(i); } function o() { try { if (!Object.assign) return !1; var i = new String("abc"); if (i[5] = "de", Object.getOwnPropertyNames(i)[0] === "5") return !1; for (var s = {}, u = 0; u < 10; u++) s["_" + String.fromCharCode(u)] = u; var f = Object.getOwnPropertyNames(s).map(function(d) { return s[d]; }); if (f.join("") !== "0123456789") return !1; var l = {}; return "abcdefghijklmnopqrst".split("").forEach(function(d) { l[d] = d; }), Object.keys(Object.assign({}, l)).join("") === "abcdefghijklmnopqrst"; } catch { return !1; } } return jt = o() ? Object.assign : function(i, s) { for (var u, f = n(i), l, d = 1; d < arguments.length; d++) { u = Object(arguments[d]); for (var p in u) t.call(u, p) && (f[p] = u[p]); if (e) { l = e(u); for (var m = 0; m < l.length; m++) r.call(u, l[m]) && (f[l[m]] = u[l[m]]); } } return f; }, jt; } var Vt, Mr; function or() { if (Mr) return Vt; Mr = 1; var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; return Vt = e, Vt; } var Ft, Ir; function Un() { return Ir || (Ir = 1, Ft = Function.call.bind(Object.prototype.hasOwnProperty)), Ft; } var Wt, Nr; function Jo() { if (Nr) return Wt; Nr = 1; var e = function() { }; if (process.env.NODE_ENV !== "production") { var t = /* @__PURE__ */ or(), r = {}, n = /* @__PURE__ */ Un(); e = function(i) { var s = "Warning: " + i; typeof console < "u" && console.error(s); try { throw new Error(s); } catch { } }; } function o(i, s, u, f, l) { if (process.env.NODE_ENV !== "production") { for (var d in i) if (n(i, d)) { var p; try { if (typeof i[d] != "function") { var m = Error( (f || "React class") + ": " + u + " type `" + d + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[d] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`." ); throw m.name = "Invariant Violation", m; } p = i[d](s, d, f, u, null, t); } catch (g) { p = g; } if (p && !(p instanceof Error) && e( (f || "React class") + ": type specification of " + u + " `" + d + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof p + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)." ), p instanceof Error && !(p.message in r)) { r[p.message] = !0; var y = l ? l() : ""; e( "Failed " + u + " type: " + p.message + (y ?? "") ); } } } } return o.resetWarningCache = function() { process.env.NODE_ENV !== "production" && (r = {}); }, Wt = o, Wt; } var Ut, kr; function Xo() { if (kr) return Ut; kr = 1; var e = Wn(), t = Qo(), r = /* @__PURE__ */ or(), n = /* @__PURE__ */ Un(), o = /* @__PURE__ */ Jo(), i = function() { }; process.env.NODE_ENV !== "production" && (i = function(u) { var f = "Warning: " + u; typeof console < "u" && console.error(f); try { throw new Error(f); } catch { } }); function s() { return null; } return Ut = function(u, f) { var l = typeof Symbol == "function" && Symbol.iterator, d = "@@iterator"; function p(E) { var w = E && (l && E[l] || E[d]); if (typeof w == "function") return w; } var m = "<<anonymous>>", y = { array: T("array"), bigint: T("bigint"), bool: T("boolean"), func: T("function"), number: T("number"), object: T("object"), string: T("string"), symbol: T("symbol"), any: I(), arrayOf: _, element: O(), elementType: b(), instanceOf: A, node: a(), objectOf: k, oneOf: $, oneOfType: F, shape: x, exact: P }; function g(E, w) { return E === w ? E !== 0 || 1 / E === 1 / w : E !== E && w !== w; } function c(E, w) { this.message = E, this.data = w && typeof w == "object" ? w : {}, this.stack = ""; } c.prototype = Error.prototype; function v(E) { if (process.env.NODE_ENV !== "production") var w = {}, B = 0; function M(W, j, G, V, z, U, ce) { if (V = V || m, U = U || G, ce !== r) { if (f) { var R = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types" ); throw R.name = "Invariant Violation", R; } else if (process.env.NODE_ENV !== "production" && typeof console < "u") { var se = V + ":" + G; !w[se] && // Avoid spamming the console because they are often not actionable except for lib authors B < 3 && (i( "You are manually calling a React.PropTypes validation function for the `" + U + "` prop on `" + V + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details." ), w[se] = !0, B++); } } return j[G] == null ? W ? j[G] === null ? new c("The " + z + " `" + U + "` is marked as required " + ("in `" + V + "`, but its value is `null`.")) : new c("The " + z + " `" + U + "` is marked as required in " + ("`" + V + "`, but its value is `undefined`.")) : null : E(j, G, V, z, U); } var N = M.bind(null, !1); return N.isRequired = M.bind(null, !0), N; } function T(E) { function w(B, M, N, W, j, G) { var V = B[M], z = Q(V); if (z !== E) { var U = Z(V); return new c( "Invalid " + W + " `" + j + "` of type " + ("`" + U + "` supplied to `" + N + "`, expected ") + ("`" + E + "`."), { expectedType: E } ); } return null; } return v(w); } function I() { return v(s); } function _(E) { function w(B, M, N, W, j) { if (typeof E != "function") return new c("Property `" + j + "` of component `" + N + "` has invalid PropType notation inside arrayOf."); var G = B[M]; if (!Array.isArray(G)) { var V = Q(G); return new c("Invalid " + W + " `" + j + "` of type " + ("`" + V + "` supplied to `" + N + "`, expected an array.")); } for (var z = 0; z < G.length; z++) { var U = E(G, z, N, W, j + "[" + z + "]", r); if (U instanceof Error) return U; } return null; } return v(w); } function O() { function E(w, B, M, N, W) { var j = w[B]; if (!u(j)) { var G = Q(j); return new c("Invalid " + N + " `" + W + "` of type " + ("`" + G + "` supplied to `" + M + "`, expected a single ReactElement.")); } return null; } return v(E); } function b() { function E(w, B, M, N, W) { var j = w[B]; if (!e.isValidElementType(j)) { var G = Q(j); return new c("Invalid " + N + " `" + W + "` of type " + ("`" + G + "` supplied to `" + M + "`, expected a single ReactElement type.")); } return null; } return v(E); } function A(E) { function w(B, M, N, W, j) { if (!(B[M] instanceof E)) { var G = E.name || m, V = he(B[M]); return new c("Invalid " + W + " `" + j + "` of type " + ("`" + V + "` supplied to `" + N + "`, expected ") + ("instance of `" + G + "`.")); } return null; } return v(w); } function $(E) { if (!Array.isArray(E)) return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? i( "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])." ) : i("Invalid argument supplied to oneOf, expected an array.")), s; function w(B, M, N, W, j) { for (var G = B[M], V = 0; V < E.length; V++) if (g(G, E[V])) return null; var z = JSON.stringify(E, function(ce, R) { var se = Z(R); return se === "symbol" ? String(R) : R; }); return new c("Invalid " + W + " `" + j + "` of value `" + String(G) + "` " + ("supplied to `" + N + "`, expected one of " + z + ".")); } return v(w); } function k(E) { function w(B, M, N, W, j) { if (typeof E != "function") return new c("Property `" + j + "` of component `" + N + "` has invalid PropType notation inside objectOf."); var G = B[M], V = Q(G); if (V !== "object") return new c("Invalid " + W + " `" + j + "` of type " + ("`" + V + "` supplied to `" + N + "`, expected an object.")); for (var z in G) if (n(G, z)) { var U = E(G, z, N, W, j + "." + z, r); if (U instanceof Error) return U; } return null; } return v(w); } function F(E) { if (!Array.isArray(E)) return process.env.NODE_ENV !== "production" && i("Invalid argument supplied to oneOfType, expected an instance of array."), s; for (var w = 0; w < E.length; w++) { var B = E[w]; if (typeof B != "function") return i( "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + ne(B) + " at index " + w + "." ), s; } function M(N, W, j, G, V) { for (var z = [], U = 0; U < E.length; U++) { var ce = E[U], R = ce(N, W, j, G, V, r); if (R == null) return null; R.data && n(R.data, "expectedType") && z.push(R.data.expectedType); } var se = z.length > 0 ? ", expected one of type [" + z.join(", ") + "]" : ""; return new c("Invalid " + G + " `" + V + "` supplied to " + ("`" + j + "`" + se + ".")); } return v(M); } function a() { function E(w, B, M, N, W) { return D(w[B]) ? null : new c("Invalid " + N + " `" + W + "` supplied to " + ("`" + M + "`, expected a ReactNode.")); } return v(E); } function C(E, w, B, M, N) { return new c( (E || "React class") + ": " + w + " type `" + B + "." + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + N + "`." ); } function x(E) { function w(B, M, N, W, j) { var G = B[M], V = Q(G); if (V !== "object") return new c("Invalid " + W + " `" + j + "` of type `" + V + "` " + ("supplied to `" + N + "`, expected `object`.")); for (var z in E) { var U = E[z]; if (typeof U != "function") return C(N, W, j, z, Z(U)); var ce = U(G, z, N, W, j + "." + z, r); if (ce) return ce; } return null; } return v(w); } function P(E) { function w(B, M, N, W, j) { var G = B[M], V = Q(G); if (V !== "object") return new c("Invalid " + W + " `" + j + "` of type `" + V + "` " + ("supplied to `" + N + "`, expected `object`.")); var z = t({}, B[M], E); for (var U in z) { var ce = E[U]; if (n(E, U) && typeof ce != "function") return C(N, W, j, U, Z(ce)); if (!ce) return new c( "Invalid " + W + " `" + j + "` key `" + U + "` supplied to `" + N + "`.\nBad object: " + JSON.stringify(B[M], null, " ") + ` Valid ke