@calcom/atoms 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +5 -0
  2. package/dist/AddressInput-Ci02wr5C.js +33 -0
  3. package/dist/AlbyPriceComponent-NqN1MEov.js +967 -0
  4. package/dist/Card-6fRR5Hwj.js +185 -0
  5. package/dist/DatePicker-9pbCidOU.js +27 -0
  6. package/dist/PhoneInput-ysQbrvjy.js +1405 -0
  7. package/dist/PoweredBy-AY0Afi6V.js +31 -0
  8. package/dist/UnpublishedEntity-epeaNFkK.js +23 -0
  9. package/dist/availability/AvailabilitySettings.d.ts +58 -0
  10. package/dist/availability/AvailabilitySettings.d.ts.map +1 -0
  11. package/dist/availability/index.d.ts +4 -0
  12. package/dist/availability/index.d.ts.map +1 -0
  13. package/dist/availability/types.d.ts +22 -0
  14. package/dist/availability/types.d.ts.map +1 -0
  15. package/dist/availability/wrappers/PlatformAvailabilitySettingsWrapper.d.ts +18 -0
  16. package/dist/availability/wrappers/PlatformAvailabilitySettingsWrapper.d.ts.map +1 -0
  17. package/dist/availability/wrappers/WebAvailabilitySettingsWrapper.d.ts +2 -0
  18. package/dist/availability/wrappers/WebAvailabilitySettingsWrapper.d.ts.map +1 -0
  19. package/dist/booker/Booker.stories.d.ts +7 -0
  20. package/dist/booker/Booker.stories.d.ts.map +1 -0
  21. package/dist/booker/BookerPlatformWrapper.d.ts +24 -0
  22. package/dist/booker/BookerPlatformWrapper.d.ts.map +1 -0
  23. package/dist/booker/BookerWebWrapper.d.ts +5 -0
  24. package/dist/booker/BookerWebWrapper.d.ts.map +1 -0
  25. package/dist/booker/export.d.ts +4 -0
  26. package/dist/booker/export.d.ts.map +1 -0
  27. package/dist/booker/index.d.ts +3 -0
  28. package/dist/booker/index.d.ts.map +1 -0
  29. package/dist/cal-atoms.js +9 -0
  30. package/dist/cal-atoms.umd.cjs +577 -0
  31. package/dist/cal-provider/BaseCalProvider.d.ts +4 -0
  32. package/dist/cal-provider/BaseCalProvider.d.ts.map +1 -0
  33. package/dist/cal-provider/CalProvider.d.ts +14 -0
  34. package/dist/cal-provider/CalProvider.d.ts.map +1 -0
  35. package/dist/cal-provider/index.d.ts +2 -0
  36. package/dist/cal-provider/index.d.ts.map +1 -0
  37. package/dist/framer-features-Zr_i_7k0.js +443 -0
  38. package/dist/gcal-connect/GcalConnect.d.ts +9 -0
  39. package/dist/gcal-connect/GcalConnect.d.ts.map +1 -0
  40. package/dist/gcal-connect/index.d.ts +2 -0
  41. package/dist/gcal-connect/index.d.ts.map +1 -0
  42. package/dist/globals.min.css +1 -0
  43. package/dist/hooks/useApiKeys.d.ts +10 -0
  44. package/dist/hooks/useApiKeys.d.ts.map +1 -0
  45. package/dist/hooks/useAtomsContext.d.ts +31 -0
  46. package/dist/hooks/useAtomsContext.d.ts.map +1 -0
  47. package/dist/hooks/useAvailableSlots.d.ts +6 -0
  48. package/dist/hooks/useAvailableSlots.d.ts.map +1 -0
  49. package/dist/hooks/useBookings.d.ts +3 -0
  50. package/dist/hooks/useBookings.d.ts.map +1 -0
  51. package/dist/hooks/useCalendarsBusyTimes.d.ts +10 -0
  52. package/dist/hooks/useCalendarsBusyTimes.d.ts.map +1 -0
  53. package/dist/hooks/useClientSchedule.d.ts +8 -0
  54. package/dist/hooks/useClientSchedule.d.ts.map +1 -0
  55. package/dist/hooks/useConnectedCalendars.d.ts +3 -0
  56. package/dist/hooks/useConnectedCalendars.d.ts.map +1 -0
  57. package/dist/hooks/useCreateBooking.d.ts +169 -0
  58. package/dist/hooks/useCreateBooking.d.ts.map +1 -0
  59. package/dist/hooks/useCreateInstantBooking.d.ts +169 -0
  60. package/dist/hooks/useCreateInstantBooking.d.ts.map +1 -0
  61. package/dist/hooks/useCreateRecurringBooking.d.ts +154 -0
  62. package/dist/hooks/useCreateRecurringBooking.d.ts.map +1 -0
  63. package/dist/hooks/useDeleteSchedule.d.ts +11 -0
  64. package/dist/hooks/useDeleteSchedule.d.ts.map +1 -0
  65. package/dist/hooks/useDeleteSelectedSlot.d.ts +8 -0
  66. package/dist/hooks/useDeleteSelectedSlot.d.ts.map +1 -0
  67. package/dist/hooks/useGcal.d.ts +9 -0
  68. package/dist/hooks/useGcal.d.ts.map +1 -0
  69. package/dist/hooks/useGetCityTimezones.d.ts +6 -0
  70. package/dist/hooks/useGetCityTimezones.d.ts.map +1 -0
  71. package/dist/hooks/useHandleBookEvent.d.ts +15 -0
  72. package/dist/hooks/useHandleBookEvent.d.ts.map +1 -0
  73. package/dist/hooks/useIsPlatform.d.ts +2 -0
  74. package/dist/hooks/useIsPlatform.d.ts.map +1 -0
  75. package/dist/hooks/useMe.d.ts +12 -0
  76. package/dist/hooks/useMe.d.ts.map +1 -0
  77. package/dist/hooks/useOAuthClient.d.ts +11 -0
  78. package/dist/hooks/useOAuthClient.d.ts.map +1 -0
  79. package/dist/hooks/useOAuthFlow.d.ts +12 -0
  80. package/dist/hooks/useOAuthFlow.d.ts.map +1 -0
  81. package/dist/hooks/usePublicEvent.d.ts +958 -0
  82. package/dist/hooks/usePublicEvent.d.ts.map +1 -0
  83. package/dist/hooks/useReserveSlot.d.ts +8 -0
  84. package/dist/hooks/useReserveSlot.d.ts.map +1 -0
  85. package/dist/hooks/useSlots.d.ts +11 -0
  86. package/dist/hooks/useSlots.d.ts.map +1 -0
  87. package/dist/hooks/useTimezone.d.ts +2 -0
  88. package/dist/hooks/useTimezone.d.ts.map +1 -0
  89. package/dist/hooks/useUpdateSchedule.d.ts +9 -0
  90. package/dist/hooks/useUpdateSchedule.d.ts.map +1 -0
  91. package/dist/hooks/useUpdateUserTimezone.d.ts +15 -0
  92. package/dist/hooks/useUpdateUserTimezone.d.ts.map +1 -0
  93. package/dist/index--Pb54wx_.js +4 -0
  94. package/dist/index-3sgDY24S.js +5 -0
  95. package/dist/index-GttMIx74.js +65366 -0
  96. package/dist/index-RcPlEXh-.js +220 -0
  97. package/dist/index-rUbdQ7Zu.js +1256 -0
  98. package/dist/index-uuiJumv6.js +76 -0
  99. package/dist/index.d.ts +7 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/isSupportedCountry-WVb-DZDd.js +487 -0
  102. package/dist/lib/getQueryParam.d.ts +3 -0
  103. package/dist/lib/getQueryParam.d.ts.map +1 -0
  104. package/dist/lib/http.d.ts +18 -0
  105. package/dist/lib/http.d.ts.map +1 -0
  106. package/dist/lib/setQueryParam.d.ts +3 -0
  107. package/dist/lib/setQueryParam.d.ts.map +1 -0
  108. package/dist/monorepo.d.ts +9 -0
  109. package/dist/monorepo.d.ts.map +1 -0
  110. package/dist/server.browser-yA5s9iMO.js +9859 -0
  111. package/dist/src/components/ui/button.d.ts +12 -0
  112. package/dist/src/components/ui/button.d.ts.map +1 -0
  113. package/dist/src/components/ui/confirmation-dialog-content.d.ts +4 -0
  114. package/dist/src/components/ui/confirmation-dialog-content.d.ts.map +1 -0
  115. package/dist/src/components/ui/dialog.d.ts +20 -0
  116. package/dist/src/components/ui/dialog.d.ts.map +1 -0
  117. package/dist/src/components/ui/shell.d.ts +3 -0
  118. package/dist/src/components/ui/shell.d.ts.map +1 -0
  119. package/dist/src/components/ui/toast.d.ts +16 -0
  120. package/dist/src/components/ui/toast.d.ts.map +1 -0
  121. package/dist/src/components/ui/toaster.d.ts +3 -0
  122. package/dist/src/components/ui/toaster.d.ts.map +1 -0
  123. package/dist/src/components/ui/use-toast.d.ts +45 -0
  124. package/dist/src/components/ui/use-toast.d.ts.map +1 -0
  125. package/dist/src/lib/utils.d.ts +3 -0
  126. package/dist/src/lib/utils.d.ts.map +1 -0
  127. package/dist/style.css +1 -0
  128. package/dist/timezone/index.d.ts +4 -0
  129. package/dist/timezone/index.d.ts.map +1 -0
  130. package/dist/types.d.ts +8 -0
  131. package/dist/types.d.ts.map +1 -0
  132. package/dist/vite.config.d.ts +3 -0
  133. package/dist/vite.config.d.ts.map +1 -0
  134. package/package.json +56 -0
@@ -0,0 +1,1256 @@
1
+ import { M as c, g as T, a as he, b as Oe, w as Ne } from "./isSupportedCountry-WVb-DZDd.js";
2
+ import { i as Ot } from "./isSupportedCountry-WVb-DZDd.js";
3
+ function I(e) {
4
+ "@babel/helpers - typeof";
5
+ return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
6
+ return typeof t;
7
+ } : function(t) {
8
+ return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
9
+ }, I(e);
10
+ }
11
+ function M(e, t) {
12
+ for (var r = 0; r < t.length; r++) {
13
+ var n = t[r];
14
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
15
+ }
16
+ }
17
+ function _e(e, t, r) {
18
+ return t && M(e.prototype, t), r && M(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
19
+ }
20
+ function de(e, t) {
21
+ if (!(e instanceof t))
22
+ throw new TypeError("Cannot call a class as a function");
23
+ }
24
+ function Ee(e, t) {
25
+ if (typeof t != "function" && t !== null)
26
+ throw new TypeError("Super expression must either be null or a function");
27
+ e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && _(e, t);
28
+ }
29
+ function Pe(e) {
30
+ var t = fe();
31
+ return function() {
32
+ var n = d(e), i;
33
+ if (t) {
34
+ var u = d(this).constructor;
35
+ i = Reflect.construct(n, arguments, u);
36
+ } else
37
+ i = n.apply(this, arguments);
38
+ return me(this, i);
39
+ };
40
+ }
41
+ function me(e, t) {
42
+ if (t && (I(t) === "object" || typeof t == "function"))
43
+ return t;
44
+ if (t !== void 0)
45
+ throw new TypeError("Derived constructors may only return object or undefined");
46
+ return ae(e);
47
+ }
48
+ function ae(e) {
49
+ if (e === void 0)
50
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
51
+ return e;
52
+ }
53
+ function A(e) {
54
+ var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
55
+ return A = function(n) {
56
+ if (n === null || !we(n))
57
+ return n;
58
+ if (typeof n != "function")
59
+ throw new TypeError("Super expression must either be null or a function");
60
+ if (typeof t < "u") {
61
+ if (t.has(n))
62
+ return t.get(n);
63
+ t.set(n, i);
64
+ }
65
+ function i() {
66
+ return E(n, arguments, d(this).constructor);
67
+ }
68
+ return i.prototype = Object.create(n.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), _(i, n);
69
+ }, A(e);
70
+ }
71
+ function E(e, t, r) {
72
+ return fe() ? E = Reflect.construct : E = function(i, u, o) {
73
+ var a = [null];
74
+ a.push.apply(a, u);
75
+ var f = Function.bind.apply(i, a), l = new f();
76
+ return o && _(l, o.prototype), l;
77
+ }, E.apply(null, arguments);
78
+ }
79
+ function fe() {
80
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
81
+ return !1;
82
+ if (typeof Proxy == "function")
83
+ return !0;
84
+ try {
85
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
86
+ })), !0;
87
+ } catch {
88
+ return !1;
89
+ }
90
+ }
91
+ function we(e) {
92
+ return Function.toString.call(e).indexOf("[native code]") !== -1;
93
+ }
94
+ function _(e, t) {
95
+ return _ = Object.setPrototypeOf || function(n, i) {
96
+ return n.__proto__ = i, n;
97
+ }, _(e, t);
98
+ }
99
+ function d(e) {
100
+ return d = Object.setPrototypeOf ? Object.getPrototypeOf : function(r) {
101
+ return r.__proto__ || Object.getPrototypeOf(r);
102
+ }, d(e);
103
+ }
104
+ var v = /* @__PURE__ */ function(e) {
105
+ Ee(r, e);
106
+ var t = Pe(r);
107
+ function r(n) {
108
+ var i;
109
+ return de(this, r), i = t.call(this, n), Object.setPrototypeOf(ae(i), r.prototype), i.name = i.constructor.name, i;
110
+ }
111
+ return _e(r);
112
+ }(/* @__PURE__ */ A(Error)), R = 2, Ce = 17, Ie = 3, y = "0-90-9٠-٩۰-۹", Ae = "-‐-―−ー-", Fe = "//", Se = "..", xe = "  ­​⁠ ", Te = "()()[]\\[\\]", Re = "~⁓∼~", P = "".concat(Ae).concat(Fe).concat(Se).concat(xe).concat(Te).concat(Re), L = "++", Le = ";ext=", O = function(t) {
113
+ return "([".concat(y, "]{1,").concat(t, "})");
114
+ };
115
+ function le(e) {
116
+ var t = "20", r = "15", n = "9", i = "6", u = "[  \\t,]*", o = "[:\\..]?[  \\t,-]*", a = "#?", f = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", l = "(?:[xx##~~]|int|int)", s = "[- ]+", p = "[  \\t]*", g = "(?:,{2}|;)", h = Le + O(t), N = u + f + o + O(t) + a, ge = u + l + o + O(n) + a, ve = s + O(i) + "#", be = p + g + o + O(r) + a, pe = p + "(?:,)+" + o + O(n) + a;
117
+ return h + "|" + N + "|" + ge + "|" + ve + "|" + be + "|" + pe;
118
+ }
119
+ var De = "[" + y + "]{" + R + "}", je = "[" + L + "]{0,1}(?:[" + P + "]*[" + y + "]){3,}[" + P + y + "]*", Me = new RegExp("^[" + L + "]{0,1}(?:[" + P + "]*[" + y + "]){1,2}$", "i"), $e = je + // Phone number extensions
120
+ "(?:" + le() + ")?", Ue = new RegExp(
121
+ // Either a short two-digit-only phone number
122
+ "^" + De + "$|^" + $e + "$",
123
+ "i"
124
+ );
125
+ function Be(e) {
126
+ return e.length >= R && Ue.test(e);
127
+ }
128
+ function He(e) {
129
+ return Me.test(e);
130
+ }
131
+ var $ = new RegExp("(?:" + le() + ")$", "i");
132
+ function Ge(e) {
133
+ var t = e.search($);
134
+ if (t < 0)
135
+ return {};
136
+ for (var r = e.slice(0, t), n = e.match($), i = 1; i < n.length; ) {
137
+ if (n[i])
138
+ return {
139
+ number: r,
140
+ ext: n[i]
141
+ };
142
+ i++;
143
+ }
144
+ }
145
+ var Ve = {
146
+ 0: "0",
147
+ 1: "1",
148
+ 2: "2",
149
+ 3: "3",
150
+ 4: "4",
151
+ 5: "5",
152
+ 6: "6",
153
+ 7: "7",
154
+ 8: "8",
155
+ 9: "9",
156
+ "0": "0",
157
+ // Fullwidth digit 0
158
+ "1": "1",
159
+ // Fullwidth digit 1
160
+ "2": "2",
161
+ // Fullwidth digit 2
162
+ "3": "3",
163
+ // Fullwidth digit 3
164
+ "4": "4",
165
+ // Fullwidth digit 4
166
+ "5": "5",
167
+ // Fullwidth digit 5
168
+ "6": "6",
169
+ // Fullwidth digit 6
170
+ "7": "7",
171
+ // Fullwidth digit 7
172
+ "8": "8",
173
+ // Fullwidth digit 8
174
+ "9": "9",
175
+ // Fullwidth digit 9
176
+ "٠": "0",
177
+ // Arabic-indic digit 0
178
+ "١": "1",
179
+ // Arabic-indic digit 1
180
+ "٢": "2",
181
+ // Arabic-indic digit 2
182
+ "٣": "3",
183
+ // Arabic-indic digit 3
184
+ "٤": "4",
185
+ // Arabic-indic digit 4
186
+ "٥": "5",
187
+ // Arabic-indic digit 5
188
+ "٦": "6",
189
+ // Arabic-indic digit 6
190
+ "٧": "7",
191
+ // Arabic-indic digit 7
192
+ "٨": "8",
193
+ // Arabic-indic digit 8
194
+ "٩": "9",
195
+ // Arabic-indic digit 9
196
+ "۰": "0",
197
+ // Eastern-Arabic digit 0
198
+ "۱": "1",
199
+ // Eastern-Arabic digit 1
200
+ "۲": "2",
201
+ // Eastern-Arabic digit 2
202
+ "۳": "3",
203
+ // Eastern-Arabic digit 3
204
+ "۴": "4",
205
+ // Eastern-Arabic digit 4
206
+ "۵": "5",
207
+ // Eastern-Arabic digit 5
208
+ "۶": "6",
209
+ // Eastern-Arabic digit 6
210
+ "۷": "7",
211
+ // Eastern-Arabic digit 7
212
+ "۸": "8",
213
+ // Eastern-Arabic digit 8
214
+ "۹": "9"
215
+ // Eastern-Arabic digit 9
216
+ };
217
+ function Xe(e) {
218
+ return Ve[e];
219
+ }
220
+ function ke(e, t) {
221
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
222
+ if (r)
223
+ return (r = r.call(e)).next.bind(r);
224
+ if (Array.isArray(e) || (r = We(e)) || t && e && typeof e.length == "number") {
225
+ r && (e = r);
226
+ var n = 0;
227
+ return function() {
228
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
229
+ };
230
+ }
231
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
232
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
233
+ }
234
+ function We(e, t) {
235
+ if (e) {
236
+ if (typeof e == "string")
237
+ return U(e, t);
238
+ var r = Object.prototype.toString.call(e).slice(8, -1);
239
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
240
+ return Array.from(e);
241
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
242
+ return U(e, t);
243
+ }
244
+ }
245
+ function U(e, t) {
246
+ (t == null || t > e.length) && (t = e.length);
247
+ for (var r = 0, n = new Array(t); r < t; r++)
248
+ n[r] = e[r];
249
+ return n;
250
+ }
251
+ function B(e) {
252
+ for (var t = "", r = ke(e.split("")), n; !(n = r()).done; ) {
253
+ var i = n.value;
254
+ t += Ke(i, t) || "";
255
+ }
256
+ return t;
257
+ }
258
+ function Ke(e, t) {
259
+ return e === "+" ? t ? void 0 : "+" : Xe(e);
260
+ }
261
+ function Ye(e, t) {
262
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
263
+ if (r)
264
+ return (r = r.call(e)).next.bind(r);
265
+ if (Array.isArray(e) || (r = ze(e)) || t && e && typeof e.length == "number") {
266
+ r && (e = r);
267
+ var n = 0;
268
+ return function() {
269
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
270
+ };
271
+ }
272
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
273
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
274
+ }
275
+ function ze(e, t) {
276
+ if (e) {
277
+ if (typeof e == "string")
278
+ return H(e, t);
279
+ var r = Object.prototype.toString.call(e).slice(8, -1);
280
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
281
+ return Array.from(e);
282
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
283
+ return H(e, t);
284
+ }
285
+ }
286
+ function H(e, t) {
287
+ (t == null || t > e.length) && (t = e.length);
288
+ for (var r = 0, n = new Array(t); r < t; r++)
289
+ n[r] = e[r];
290
+ return n;
291
+ }
292
+ function qe(e, t) {
293
+ for (var r = e.slice(), n = Ye(t), i; !(i = n()).done; ) {
294
+ var u = i.value;
295
+ e.indexOf(u) < 0 && r.push(u);
296
+ }
297
+ return r.sort(function(o, a) {
298
+ return o - a;
299
+ });
300
+ }
301
+ function D(e, t) {
302
+ return ce(e, void 0, t);
303
+ }
304
+ function ce(e, t, r) {
305
+ var n = r.type(t), i = n && n.possibleLengths() || r.possibleLengths();
306
+ if (!i)
307
+ return "IS_POSSIBLE";
308
+ if (t === "FIXED_LINE_OR_MOBILE") {
309
+ if (!r.type("FIXED_LINE"))
310
+ return ce(e, "MOBILE", r);
311
+ var u = r.type("MOBILE");
312
+ u && (i = qe(i, u.possibleLengths()));
313
+ } else if (t && !n)
314
+ return "INVALID_LENGTH";
315
+ var o = e.length, a = i[0];
316
+ return a === o ? "IS_POSSIBLE" : a > o ? "TOO_SHORT" : i[i.length - 1] < o ? "TOO_LONG" : i.indexOf(o, 1) >= 0 ? "IS_POSSIBLE" : "INVALID_LENGTH";
317
+ }
318
+ function Ze(e, t, r) {
319
+ if (t === void 0 && (t = {}), r = new c(r), t.v2) {
320
+ if (!e.countryCallingCode)
321
+ throw new Error("Invalid phone number object passed");
322
+ r.selectNumberingPlan(e.countryCallingCode);
323
+ } else {
324
+ if (!e.phone)
325
+ return !1;
326
+ if (e.country) {
327
+ if (!r.hasCountry(e.country))
328
+ throw new Error("Unknown country: ".concat(e.country));
329
+ r.country(e.country);
330
+ } else {
331
+ if (!e.countryCallingCode)
332
+ throw new Error("Invalid phone number object passed");
333
+ r.selectNumberingPlan(e.countryCallingCode);
334
+ }
335
+ }
336
+ if (r.possibleLengths())
337
+ return se(e.phone || e.nationalNumber, r);
338
+ if (e.countryCallingCode && r.isNonGeographicCallingCode(e.countryCallingCode))
339
+ return !0;
340
+ throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
341
+ }
342
+ function se(e, t) {
343
+ switch (D(e, t)) {
344
+ case "IS_POSSIBLE":
345
+ return !0;
346
+ default:
347
+ return !1;
348
+ }
349
+ }
350
+ function b(e, t) {
351
+ return e = e || "", new RegExp("^(?:" + t + ")$").test(e);
352
+ }
353
+ function Je(e, t) {
354
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
355
+ if (r)
356
+ return (r = r.call(e)).next.bind(r);
357
+ if (Array.isArray(e) || (r = Qe(e)) || t && e && typeof e.length == "number") {
358
+ r && (e = r);
359
+ var n = 0;
360
+ return function() {
361
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
362
+ };
363
+ }
364
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
365
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
366
+ }
367
+ function Qe(e, t) {
368
+ if (e) {
369
+ if (typeof e == "string")
370
+ return G(e, t);
371
+ var r = Object.prototype.toString.call(e).slice(8, -1);
372
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
373
+ return Array.from(e);
374
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
375
+ return G(e, t);
376
+ }
377
+ }
378
+ function G(e, t) {
379
+ (t == null || t > e.length) && (t = e.length);
380
+ for (var r = 0, n = new Array(t); r < t; r++)
381
+ n[r] = e[r];
382
+ return n;
383
+ }
384
+ var er = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
385
+ function j(e, t, r) {
386
+ if (t = t || {}, !(!e.country && !e.countryCallingCode)) {
387
+ r = new c(r), r.selectNumberingPlan(e.country, e.countryCallingCode);
388
+ var n = t.v2 ? e.nationalNumber : e.phone;
389
+ if (b(n, r.nationalNumberPattern())) {
390
+ if (w(n, "FIXED_LINE", r))
391
+ return r.type("MOBILE") && r.type("MOBILE").pattern() === "" || !r.type("MOBILE") || w(n, "MOBILE", r) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
392
+ for (var i = Je(er), u; !(u = i()).done; ) {
393
+ var o = u.value;
394
+ if (w(n, o, r))
395
+ return o;
396
+ }
397
+ }
398
+ }
399
+ }
400
+ function w(e, t, r) {
401
+ return t = r.type(t), !t || !t.pattern() || t.possibleLengths() && t.possibleLengths().indexOf(e.length) < 0 ? !1 : b(e, t.pattern());
402
+ }
403
+ function rr(e, t, r) {
404
+ if (t = t || {}, r = new c(r), r.selectNumberingPlan(e.country, e.countryCallingCode), r.hasTypes())
405
+ return j(e, t, r.metadata) !== void 0;
406
+ var n = t.v2 ? e.nationalNumber : e.phone;
407
+ return b(n, r.nationalNumberPattern());
408
+ }
409
+ function tr(e, t, r) {
410
+ var n = new c(r), i = n.getCountryCodesForCallingCode(e);
411
+ return i ? i.filter(function(u) {
412
+ return nr(t, u, r);
413
+ }) : [];
414
+ }
415
+ function nr(e, t, r) {
416
+ var n = new c(r);
417
+ return n.selectNumberingPlan(t), n.numberingPlan.possibleLengths().indexOf(e.length) >= 0;
418
+ }
419
+ function ir(e) {
420
+ return e.replace(new RegExp("[".concat(P, "]+"), "g"), " ").trim();
421
+ }
422
+ var ur = /(\$\d)/;
423
+ function or(e, t, r) {
424
+ var n = r.useInternationalFormat, i = r.withNationalPrefix;
425
+ r.carrierCode, r.metadata;
426
+ var u = e.replace(new RegExp(t.pattern()), n ? t.internationalFormat() : (
427
+ // This library doesn't use `domestic_carrier_code_formatting_rule`,
428
+ // because that one is only used when formatting phone numbers
429
+ // for dialing from a mobile phone, and this is not a dialing library.
430
+ // carrierCode && format.domesticCarrierCodeFormattingRule()
431
+ // // First, replace the $CC in the formatting rule with the desired carrier code.
432
+ // // Then, replace the $FG in the formatting rule with the first group
433
+ // // and the carrier code combined in the appropriate way.
434
+ // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
435
+ // : (
436
+ // withNationalPrefix && format.nationalPrefixFormattingRule()
437
+ // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
438
+ // : format.format()
439
+ // )
440
+ i && t.nationalPrefixFormattingRule() ? t.format().replace(ur, t.nationalPrefixFormattingRule()) : t.format()
441
+ ));
442
+ return n ? ir(u) : u;
443
+ }
444
+ var ar = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
445
+ function fr(e, t, r) {
446
+ var n = new c(r);
447
+ if (n.selectNumberingPlan(e, t), n.defaultIDDPrefix())
448
+ return n.defaultIDDPrefix();
449
+ if (ar.test(n.IDDPrefix()))
450
+ return n.IDDPrefix();
451
+ }
452
+ function lr(e) {
453
+ var t = e.number, r = e.ext;
454
+ if (!t)
455
+ return "";
456
+ if (t[0] !== "+")
457
+ throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');
458
+ return "tel:".concat(t).concat(r ? ";ext=" + r : "");
459
+ }
460
+ function cr(e, t) {
461
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
462
+ if (r)
463
+ return (r = r.call(e)).next.bind(r);
464
+ if (Array.isArray(e) || (r = sr(e)) || t && e && typeof e.length == "number") {
465
+ r && (e = r);
466
+ var n = 0;
467
+ return function() {
468
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
469
+ };
470
+ }
471
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
472
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
473
+ }
474
+ function sr(e, t) {
475
+ if (e) {
476
+ if (typeof e == "string")
477
+ return V(e, t);
478
+ var r = Object.prototype.toString.call(e).slice(8, -1);
479
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
480
+ return Array.from(e);
481
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
482
+ return V(e, t);
483
+ }
484
+ }
485
+ function V(e, t) {
486
+ (t == null || t > e.length) && (t = e.length);
487
+ for (var r = 0, n = new Array(t); r < t; r++)
488
+ n[r] = e[r];
489
+ return n;
490
+ }
491
+ function X(e, t) {
492
+ var r = Object.keys(e);
493
+ if (Object.getOwnPropertySymbols) {
494
+ var n = Object.getOwnPropertySymbols(e);
495
+ t && (n = n.filter(function(i) {
496
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
497
+ })), r.push.apply(r, n);
498
+ }
499
+ return r;
500
+ }
501
+ function k(e) {
502
+ for (var t = 1; t < arguments.length; t++) {
503
+ var r = arguments[t] != null ? arguments[t] : {};
504
+ t % 2 ? X(Object(r), !0).forEach(function(n) {
505
+ yr(e, n, r[n]);
506
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : X(Object(r)).forEach(function(n) {
507
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
508
+ });
509
+ }
510
+ return e;
511
+ }
512
+ function yr(e, t, r) {
513
+ return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
514
+ }
515
+ var W = {
516
+ formatExtension: function(t, r, n) {
517
+ return "".concat(t).concat(n.ext()).concat(r);
518
+ }
519
+ };
520
+ function gr(e, t, r, n) {
521
+ if (r ? r = k(k({}, W), r) : r = W, n = new c(n), e.country && e.country !== "001") {
522
+ if (!n.hasCountry(e.country))
523
+ throw new Error("Unknown country: ".concat(e.country));
524
+ n.country(e.country);
525
+ } else if (e.countryCallingCode)
526
+ n.selectNumberingPlan(e.countryCallingCode);
527
+ else
528
+ return e.phone || "";
529
+ var i = n.countryCallingCode(), u = r.v2 ? e.nationalNumber : e.phone, o;
530
+ switch (t) {
531
+ case "NATIONAL":
532
+ return u ? (o = m(u, e.carrierCode, "NATIONAL", n, r), C(o, e.ext, n, r.formatExtension)) : "";
533
+ case "INTERNATIONAL":
534
+ return u ? (o = m(u, null, "INTERNATIONAL", n, r), o = "+".concat(i, " ").concat(o), C(o, e.ext, n, r.formatExtension)) : "+".concat(i);
535
+ case "E.164":
536
+ return "+".concat(i).concat(u);
537
+ case "RFC3966":
538
+ return lr({
539
+ number: "+".concat(i).concat(u),
540
+ ext: e.ext
541
+ });
542
+ case "IDD":
543
+ if (!r.fromCountry)
544
+ return;
545
+ var a = br(u, e.carrierCode, i, r.fromCountry, n);
546
+ return C(a, e.ext, n, r.formatExtension);
547
+ default:
548
+ throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t, '"'));
549
+ }
550
+ }
551
+ function m(e, t, r, n, i) {
552
+ var u = vr(n.formats(), e);
553
+ return u ? or(e, u, {
554
+ useInternationalFormat: r === "INTERNATIONAL",
555
+ withNationalPrefix: !(u.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && i && i.nationalPrefix === !1),
556
+ carrierCode: t,
557
+ metadata: n
558
+ }) : e;
559
+ }
560
+ function vr(e, t) {
561
+ for (var r = cr(e), n; !(n = r()).done; ) {
562
+ var i = n.value;
563
+ if (i.leadingDigitsPatterns().length > 0) {
564
+ var u = i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length - 1];
565
+ if (t.search(u) !== 0)
566
+ continue;
567
+ }
568
+ if (b(t, i.pattern()))
569
+ return i;
570
+ }
571
+ }
572
+ function C(e, t, r, n) {
573
+ return t ? n(e, t, r) : e;
574
+ }
575
+ function br(e, t, r, n, i) {
576
+ var u = T(n, i.metadata);
577
+ if (u === r) {
578
+ var o = m(e, t, "NATIONAL", i);
579
+ return r === "1" ? r + " " + o : o;
580
+ }
581
+ var a = fr(n, void 0, i.metadata);
582
+ if (a)
583
+ return "".concat(a, " ").concat(r, " ").concat(m(e, null, "INTERNATIONAL", i));
584
+ }
585
+ function K(e, t) {
586
+ var r = Object.keys(e);
587
+ if (Object.getOwnPropertySymbols) {
588
+ var n = Object.getOwnPropertySymbols(e);
589
+ t && (n = n.filter(function(i) {
590
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
591
+ })), r.push.apply(r, n);
592
+ }
593
+ return r;
594
+ }
595
+ function Y(e) {
596
+ for (var t = 1; t < arguments.length; t++) {
597
+ var r = arguments[t] != null ? arguments[t] : {};
598
+ t % 2 ? K(Object(r), !0).forEach(function(n) {
599
+ pr(e, n, r[n]);
600
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : K(Object(r)).forEach(function(n) {
601
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
602
+ });
603
+ }
604
+ return e;
605
+ }
606
+ function pr(e, t, r) {
607
+ return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
608
+ }
609
+ function hr(e, t) {
610
+ if (!(e instanceof t))
611
+ throw new TypeError("Cannot call a class as a function");
612
+ }
613
+ function z(e, t) {
614
+ for (var r = 0; r < t.length; r++) {
615
+ var n = t[r];
616
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
617
+ }
618
+ }
619
+ function Or(e, t, r) {
620
+ return t && z(e.prototype, t), r && z(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
621
+ }
622
+ var Nr = /* @__PURE__ */ function() {
623
+ function e(t, r, n) {
624
+ if (hr(this, e), !t)
625
+ throw new TypeError("`country` or `countryCallingCode` not passed");
626
+ if (!r)
627
+ throw new TypeError("`nationalNumber` not passed");
628
+ if (!n)
629
+ throw new TypeError("`metadata` not passed");
630
+ var i = dr(t, n), u = i.country, o = i.countryCallingCode;
631
+ this.country = u, this.countryCallingCode = o, this.nationalNumber = r, this.number = "+" + this.countryCallingCode + this.nationalNumber, this.getMetadata = function() {
632
+ return n;
633
+ };
634
+ }
635
+ return Or(e, [{
636
+ key: "setExt",
637
+ value: function(r) {
638
+ this.ext = r;
639
+ }
640
+ }, {
641
+ key: "getPossibleCountries",
642
+ value: function() {
643
+ return this.country ? [this.country] : tr(this.countryCallingCode, this.nationalNumber, this.getMetadata());
644
+ }
645
+ }, {
646
+ key: "isPossible",
647
+ value: function() {
648
+ return Ze(this, {
649
+ v2: !0
650
+ }, this.getMetadata());
651
+ }
652
+ }, {
653
+ key: "isValid",
654
+ value: function() {
655
+ return rr(this, {
656
+ v2: !0
657
+ }, this.getMetadata());
658
+ }
659
+ }, {
660
+ key: "isNonGeographic",
661
+ value: function() {
662
+ var r = new c(this.getMetadata());
663
+ return r.isNonGeographicCallingCode(this.countryCallingCode);
664
+ }
665
+ }, {
666
+ key: "isEqual",
667
+ value: function(r) {
668
+ return this.number === r.number && this.ext === r.ext;
669
+ }
670
+ // This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,
671
+ // but later it was found out that it doesn't include the possible `TOO_SHORT` result
672
+ // returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,
673
+ // so eventually I simply commented out this method from the `PhoneNumber` class
674
+ // and just left the `validatePhoneNumberLength()` function, even though that one would require
675
+ // and additional step to also validate the actual country / calling code of the phone number.
676
+ // validateLength() {
677
+ // const metadata = new Metadata(this.getMetadata())
678
+ // metadata.selectNumberingPlan(this.countryCallingCode)
679
+ // const result = checkNumberLength(this.nationalNumber, metadata)
680
+ // if (result !== 'IS_POSSIBLE') {
681
+ // return result
682
+ // }
683
+ // }
684
+ }, {
685
+ key: "getType",
686
+ value: function() {
687
+ return j(this, {
688
+ v2: !0
689
+ }, this.getMetadata());
690
+ }
691
+ }, {
692
+ key: "format",
693
+ value: function(r, n) {
694
+ return gr(this, r, n ? Y(Y({}, n), {}, {
695
+ v2: !0
696
+ }) : {
697
+ v2: !0
698
+ }, this.getMetadata());
699
+ }
700
+ }, {
701
+ key: "formatNational",
702
+ value: function(r) {
703
+ return this.format("NATIONAL", r);
704
+ }
705
+ }, {
706
+ key: "formatInternational",
707
+ value: function(r) {
708
+ return this.format("INTERNATIONAL", r);
709
+ }
710
+ }, {
711
+ key: "getURI",
712
+ value: function(r) {
713
+ return this.format("RFC3966", r);
714
+ }
715
+ }]), e;
716
+ }(), _r = function(t) {
717
+ return /^[A-Z]{2}$/.test(t);
718
+ };
719
+ function dr(e, t) {
720
+ var r, n, i = new c(t);
721
+ return _r(e) ? (r = e, i.selectNumberingPlan(r), n = i.countryCallingCode()) : n = e, {
722
+ country: r,
723
+ countryCallingCode: n
724
+ };
725
+ }
726
+ var Er = new RegExp("([" + y + "])");
727
+ function Pr(e, t, r, n) {
728
+ if (t) {
729
+ var i = new c(n);
730
+ i.selectNumberingPlan(t, r);
731
+ var u = new RegExp(i.IDDPrefix());
732
+ if (e.search(u) === 0) {
733
+ e = e.slice(e.match(u)[0].length);
734
+ var o = e.match(Er);
735
+ if (!(o && o[1] != null && o[1].length > 0 && o[1] === "0"))
736
+ return e;
737
+ }
738
+ }
739
+ }
740
+ function mr(e, t) {
741
+ if (e && t.numberingPlan.nationalPrefixForParsing()) {
742
+ var r = new RegExp("^(?:" + t.numberingPlan.nationalPrefixForParsing() + ")"), n = r.exec(e);
743
+ if (n) {
744
+ var i, u, o = n.length - 1, a = o > 0 && n[o];
745
+ if (t.nationalPrefixTransformRule() && a)
746
+ i = e.replace(r, t.nationalPrefixTransformRule()), o > 1 && (u = n[1]);
747
+ else {
748
+ var f = n[0];
749
+ i = e.slice(f.length), a && (u = n[1]);
750
+ }
751
+ var l;
752
+ if (a) {
753
+ var s = e.indexOf(n[1]), p = e.slice(0, s);
754
+ p === t.numberingPlan.nationalPrefix() && (l = t.numberingPlan.nationalPrefix());
755
+ } else
756
+ l = n[0];
757
+ return {
758
+ nationalNumber: i,
759
+ nationalPrefix: l,
760
+ carrierCode: u
761
+ };
762
+ }
763
+ }
764
+ return {
765
+ nationalNumber: e
766
+ };
767
+ }
768
+ function F(e, t) {
769
+ var r = mr(e, t), n = r.carrierCode, i = r.nationalNumber;
770
+ if (i !== e) {
771
+ if (!wr(e, i, t))
772
+ return {
773
+ nationalNumber: e
774
+ };
775
+ if (t.possibleLengths() && !Cr(i, t))
776
+ return {
777
+ nationalNumber: e
778
+ };
779
+ }
780
+ return {
781
+ nationalNumber: i,
782
+ carrierCode: n
783
+ };
784
+ }
785
+ function wr(e, t, r) {
786
+ return !(b(e, r.nationalNumberPattern()) && !b(t, r.nationalNumberPattern()));
787
+ }
788
+ function Cr(e, t) {
789
+ switch (D(e, t)) {
790
+ case "TOO_SHORT":
791
+ case "INVALID_LENGTH":
792
+ return !1;
793
+ default:
794
+ return !0;
795
+ }
796
+ }
797
+ function Ir(e, t, r, n) {
798
+ var i = t ? T(t, n) : r;
799
+ if (e.indexOf(i) === 0) {
800
+ n = new c(n), n.selectNumberingPlan(t, r);
801
+ var u = e.slice(i.length), o = F(u, n), a = o.nationalNumber, f = F(e, n), l = f.nationalNumber;
802
+ if (!b(l, n.nationalNumberPattern()) && b(a, n.nationalNumberPattern()) || D(l, n) === "TOO_LONG")
803
+ return {
804
+ countryCallingCode: i,
805
+ number: u
806
+ };
807
+ }
808
+ return {
809
+ number: e
810
+ };
811
+ }
812
+ function Ar(e, t, r, n) {
813
+ if (!e)
814
+ return {};
815
+ var i;
816
+ if (e[0] !== "+") {
817
+ var u = Pr(e, t, r, n);
818
+ if (u && u !== e)
819
+ i = !0, e = "+" + u;
820
+ else {
821
+ if (t || r) {
822
+ var o = Ir(e, t, r, n), a = o.countryCallingCode, f = o.number;
823
+ if (a)
824
+ return {
825
+ countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
826
+ countryCallingCode: a,
827
+ number: f
828
+ };
829
+ }
830
+ return {
831
+ // No need to set it to `UNSPECIFIED`. It can be just `undefined`.
832
+ // countryCallingCodeSource: 'UNSPECIFIED',
833
+ number: e
834
+ };
835
+ }
836
+ }
837
+ if (e[1] === "0")
838
+ return {};
839
+ n = new c(n);
840
+ for (var l = 2; l - 1 <= Ie && l <= e.length; ) {
841
+ var s = e.slice(1, l);
842
+ if (n.hasCallingCode(s))
843
+ return n.selectNumberingPlan(s), {
844
+ countryCallingCodeSource: i ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
845
+ countryCallingCode: s,
846
+ number: e.slice(l)
847
+ };
848
+ l++;
849
+ }
850
+ return {};
851
+ }
852
+ function Fr(e, t) {
853
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
854
+ if (r)
855
+ return (r = r.call(e)).next.bind(r);
856
+ if (Array.isArray(e) || (r = Sr(e)) || t && e && typeof e.length == "number") {
857
+ r && (e = r);
858
+ var n = 0;
859
+ return function() {
860
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
861
+ };
862
+ }
863
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
864
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
865
+ }
866
+ function Sr(e, t) {
867
+ if (e) {
868
+ if (typeof e == "string")
869
+ return q(e, t);
870
+ var r = Object.prototype.toString.call(e).slice(8, -1);
871
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
872
+ return Array.from(e);
873
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
874
+ return q(e, t);
875
+ }
876
+ }
877
+ function q(e, t) {
878
+ (t == null || t > e.length) && (t = e.length);
879
+ for (var r = 0, n = new Array(t); r < t; r++)
880
+ n[r] = e[r];
881
+ return n;
882
+ }
883
+ function xr(e, t) {
884
+ var r = t.countries, n = t.defaultCountry, i = t.metadata;
885
+ i = new c(i);
886
+ for (var u = [], o = Fr(r), a; !(a = o()).done; ) {
887
+ var f = a.value;
888
+ if (i.country(f), i.leadingDigits()) {
889
+ if (e && e.search(i.leadingDigits()) === 0)
890
+ return f;
891
+ } else if (j({
892
+ phone: e,
893
+ country: f
894
+ }, void 0, i.metadata))
895
+ if (n) {
896
+ if (f === n)
897
+ return f;
898
+ u.push(f);
899
+ } else
900
+ return f;
901
+ }
902
+ if (u.length > 0)
903
+ return u[0];
904
+ }
905
+ var Tr = !1;
906
+ function Rr(e, t) {
907
+ var r = t.nationalNumber, n = t.defaultCountry, i = t.metadata;
908
+ if (Tr && i.isNonGeographicCallingCode(e))
909
+ return "001";
910
+ var u = i.getCountryCodesForCallingCode(e);
911
+ if (u)
912
+ return u.length === 1 ? u[0] : xr(r, {
913
+ countries: u,
914
+ defaultCountry: n,
915
+ metadata: i.metadata
916
+ });
917
+ }
918
+ var ye = "+", Lr = "[\\-\\.\\(\\)]?", Z = "([" + y + "]|" + Lr + ")", Dr = "^\\" + ye + Z + "*[" + y + "]" + Z + "*$", jr = new RegExp(Dr, "g"), S = y, Mr = "[" + S + "]+((\\-)*[" + S + "])*", $r = "a-zA-Z", Ur = "[" + $r + "]+((\\-)*[" + S + "])*", Br = "^(" + Mr + "\\.)*" + Ur + "\\.?$", Hr = new RegExp(Br, "g"), J = "tel:", x = ";phone-context=", Gr = ";isub=";
919
+ function Vr(e) {
920
+ var t = e.indexOf(x);
921
+ if (t < 0)
922
+ return null;
923
+ var r = t + x.length;
924
+ if (r >= e.length)
925
+ return "";
926
+ var n = e.indexOf(";", r);
927
+ return n >= 0 ? e.substring(r, n) : e.substring(r);
928
+ }
929
+ function Xr(e) {
930
+ return e === null ? !0 : e.length === 0 ? !1 : jr.test(e) || Hr.test(e);
931
+ }
932
+ function kr(e, t) {
933
+ var r = t.extractFormattedPhoneNumber, n = Vr(e);
934
+ if (!Xr(n))
935
+ throw new v("NOT_A_NUMBER");
936
+ var i;
937
+ if (n === null)
938
+ i = r(e) || "";
939
+ else {
940
+ i = "", n.charAt(0) === ye && (i += n);
941
+ var u = e.indexOf(J), o;
942
+ u >= 0 ? o = u + J.length : o = 0;
943
+ var a = e.indexOf(x);
944
+ i += e.substring(o, a);
945
+ }
946
+ var f = i.indexOf(Gr);
947
+ if (f > 0 && (i = i.substring(0, f)), i !== "")
948
+ return i;
949
+ }
950
+ var Wr = 250, Kr = new RegExp("[" + L + y + "]"), Yr = new RegExp("[^" + y + "#]+$");
951
+ function zr(e, t, r) {
952
+ if (t = t || {}, r = new c(r), t.defaultCountry && !r.hasCountry(t.defaultCountry))
953
+ throw t.v2 ? new v("INVALID_COUNTRY") : new Error("Unknown country: ".concat(t.defaultCountry));
954
+ var n = Zr(e, t.v2, t.extract), i = n.number, u = n.ext, o = n.error;
955
+ if (!i) {
956
+ if (t.v2)
957
+ throw o === "TOO_SHORT" ? new v("TOO_SHORT") : new v("NOT_A_NUMBER");
958
+ return {};
959
+ }
960
+ var a = Qr(i, t.defaultCountry, t.defaultCallingCode, r), f = a.country, l = a.nationalNumber, s = a.countryCallingCode, p = a.countryCallingCodeSource, g = a.carrierCode;
961
+ if (!r.hasSelectedNumberingPlan()) {
962
+ if (t.v2)
963
+ throw new v("INVALID_COUNTRY");
964
+ return {};
965
+ }
966
+ if (!l || l.length < R) {
967
+ if (t.v2)
968
+ throw new v("TOO_SHORT");
969
+ return {};
970
+ }
971
+ if (l.length > Ce) {
972
+ if (t.v2)
973
+ throw new v("TOO_LONG");
974
+ return {};
975
+ }
976
+ if (t.v2) {
977
+ var h = new Nr(s, l, r.metadata);
978
+ return f && (h.country = f), g && (h.carrierCode = g), u && (h.ext = u), h.__countryCallingCodeSource = p, h;
979
+ }
980
+ var N = (t.extended ? r.hasSelectedNumberingPlan() : f) ? b(l, r.nationalNumberPattern()) : !1;
981
+ return t.extended ? {
982
+ country: f,
983
+ countryCallingCode: s,
984
+ carrierCode: g,
985
+ valid: N,
986
+ possible: N ? !0 : !!(t.extended === !0 && r.possibleLengths() && se(l, r)),
987
+ phone: l,
988
+ ext: u
989
+ } : N ? Jr(f, l, u) : {};
990
+ }
991
+ function qr(e, t, r) {
992
+ if (e) {
993
+ if (e.length > Wr) {
994
+ if (r)
995
+ throw new v("TOO_LONG");
996
+ return;
997
+ }
998
+ if (t === !1)
999
+ return e;
1000
+ var n = e.search(Kr);
1001
+ if (!(n < 0))
1002
+ return e.slice(n).replace(Yr, "");
1003
+ }
1004
+ }
1005
+ function Zr(e, t, r) {
1006
+ var n = kr(e, {
1007
+ extractFormattedPhoneNumber: function(o) {
1008
+ return qr(o, r, t);
1009
+ }
1010
+ });
1011
+ if (!n)
1012
+ return {};
1013
+ if (!Be(n))
1014
+ return He(n) ? {
1015
+ error: "TOO_SHORT"
1016
+ } : {};
1017
+ var i = Ge(n);
1018
+ return i.ext ? i : {
1019
+ number: n
1020
+ };
1021
+ }
1022
+ function Jr(e, t, r) {
1023
+ var n = {
1024
+ country: e,
1025
+ phone: t
1026
+ };
1027
+ return r && (n.ext = r), n;
1028
+ }
1029
+ function Qr(e, t, r, n) {
1030
+ var i = Ar(B(e), t, r, n.metadata), u = i.countryCallingCodeSource, o = i.countryCallingCode, a = i.number, f;
1031
+ if (o)
1032
+ n.selectNumberingPlan(o);
1033
+ else if (a && (t || r))
1034
+ n.selectNumberingPlan(t, r), t && (f = t), o = r || T(t, n.metadata);
1035
+ else
1036
+ return {};
1037
+ if (!a)
1038
+ return {
1039
+ countryCallingCodeSource: u,
1040
+ countryCallingCode: o
1041
+ };
1042
+ var l = F(B(a), n), s = l.nationalNumber, p = l.carrierCode, g = Rr(o, {
1043
+ nationalNumber: s,
1044
+ defaultCountry: t,
1045
+ metadata: n
1046
+ });
1047
+ return g && (f = g, g === "001" || n.country(f)), {
1048
+ country: f,
1049
+ countryCallingCode: o,
1050
+ countryCallingCodeSource: u,
1051
+ nationalNumber: s,
1052
+ carrierCode: p
1053
+ };
1054
+ }
1055
+ function Q(e, t) {
1056
+ var r = Object.keys(e);
1057
+ if (Object.getOwnPropertySymbols) {
1058
+ var n = Object.getOwnPropertySymbols(e);
1059
+ t && (n = n.filter(function(i) {
1060
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
1061
+ })), r.push.apply(r, n);
1062
+ }
1063
+ return r;
1064
+ }
1065
+ function ee(e) {
1066
+ for (var t = 1; t < arguments.length; t++) {
1067
+ var r = arguments[t] != null ? arguments[t] : {};
1068
+ t % 2 ? Q(Object(r), !0).forEach(function(n) {
1069
+ et(e, n, r[n]);
1070
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Q(Object(r)).forEach(function(n) {
1071
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1072
+ });
1073
+ }
1074
+ return e;
1075
+ }
1076
+ function et(e, t, r) {
1077
+ return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1078
+ }
1079
+ function rt(e, t, r) {
1080
+ return zr(e, ee(ee({}, t), {}, {
1081
+ v2: !0
1082
+ }), r);
1083
+ }
1084
+ function re(e, t) {
1085
+ var r = Object.keys(e);
1086
+ if (Object.getOwnPropertySymbols) {
1087
+ var n = Object.getOwnPropertySymbols(e);
1088
+ t && (n = n.filter(function(i) {
1089
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
1090
+ })), r.push.apply(r, n);
1091
+ }
1092
+ return r;
1093
+ }
1094
+ function tt(e) {
1095
+ for (var t = 1; t < arguments.length; t++) {
1096
+ var r = arguments[t] != null ? arguments[t] : {};
1097
+ t % 2 ? re(Object(r), !0).forEach(function(n) {
1098
+ nt(e, n, r[n]);
1099
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : re(Object(r)).forEach(function(n) {
1100
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1101
+ });
1102
+ }
1103
+ return e;
1104
+ }
1105
+ function nt(e, t, r) {
1106
+ return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1107
+ }
1108
+ function it(e, t) {
1109
+ return ft(e) || at(e, t) || ot(e, t) || ut();
1110
+ }
1111
+ function ut() {
1112
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1113
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1114
+ }
1115
+ function ot(e, t) {
1116
+ if (e) {
1117
+ if (typeof e == "string")
1118
+ return te(e, t);
1119
+ var r = Object.prototype.toString.call(e).slice(8, -1);
1120
+ if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
1121
+ return Array.from(e);
1122
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
1123
+ return te(e, t);
1124
+ }
1125
+ }
1126
+ function te(e, t) {
1127
+ (t == null || t > e.length) && (t = e.length);
1128
+ for (var r = 0, n = new Array(t); r < t; r++)
1129
+ n[r] = e[r];
1130
+ return n;
1131
+ }
1132
+ function at(e, t) {
1133
+ var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
1134
+ if (r != null) {
1135
+ var n = [], i = !0, u = !1, o, a;
1136
+ try {
1137
+ for (r = r.call(e); !(i = (o = r.next()).done) && (n.push(o.value), !(t && n.length === t)); i = !0)
1138
+ ;
1139
+ } catch (f) {
1140
+ u = !0, a = f;
1141
+ } finally {
1142
+ try {
1143
+ !i && r.return != null && r.return();
1144
+ } finally {
1145
+ if (u)
1146
+ throw a;
1147
+ }
1148
+ }
1149
+ return n;
1150
+ }
1151
+ }
1152
+ function ft(e) {
1153
+ if (Array.isArray(e))
1154
+ return e;
1155
+ }
1156
+ function lt(e) {
1157
+ var t = Array.prototype.slice.call(e), r = it(t, 4), n = r[0], i = r[1], u = r[2], o = r[3], a, f, l;
1158
+ if (typeof n == "string")
1159
+ a = n;
1160
+ else
1161
+ throw new TypeError("A text for parsing must be a string.");
1162
+ if (!i || typeof i == "string")
1163
+ o ? (f = u, l = o) : (f = void 0, l = u), i && (f = tt({
1164
+ defaultCountry: i
1165
+ }, f));
1166
+ else if (he(i))
1167
+ u ? (f = i, l = u) : l = i;
1168
+ else
1169
+ throw new Error("Invalid second argument: ".concat(i));
1170
+ return {
1171
+ text: a,
1172
+ options: f,
1173
+ metadata: l
1174
+ };
1175
+ }
1176
+ function ne(e, t) {
1177
+ var r = Object.keys(e);
1178
+ if (Object.getOwnPropertySymbols) {
1179
+ var n = Object.getOwnPropertySymbols(e);
1180
+ t && (n = n.filter(function(i) {
1181
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
1182
+ })), r.push.apply(r, n);
1183
+ }
1184
+ return r;
1185
+ }
1186
+ function ie(e) {
1187
+ for (var t = 1; t < arguments.length; t++) {
1188
+ var r = arguments[t] != null ? arguments[t] : {};
1189
+ t % 2 ? ne(Object(r), !0).forEach(function(n) {
1190
+ ct(e, n, r[n]);
1191
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ne(Object(r)).forEach(function(n) {
1192
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1193
+ });
1194
+ }
1195
+ return e;
1196
+ }
1197
+ function ct(e, t, r) {
1198
+ return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1199
+ }
1200
+ function st(e, t, r) {
1201
+ t && t.defaultCountry && !Oe(t.defaultCountry, r) && (t = ie(ie({}, t), {}, {
1202
+ defaultCountry: void 0
1203
+ }));
1204
+ try {
1205
+ return rt(e, t, r);
1206
+ } catch (n) {
1207
+ if (!(n instanceof v))
1208
+ throw n;
1209
+ }
1210
+ }
1211
+ function ue(e, t) {
1212
+ var r = Object.keys(e);
1213
+ if (Object.getOwnPropertySymbols) {
1214
+ var n = Object.getOwnPropertySymbols(e);
1215
+ t && (n = n.filter(function(i) {
1216
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
1217
+ })), r.push.apply(r, n);
1218
+ }
1219
+ return r;
1220
+ }
1221
+ function oe(e) {
1222
+ for (var t = 1; t < arguments.length; t++) {
1223
+ var r = arguments[t] != null ? arguments[t] : {};
1224
+ t % 2 ? ue(Object(r), !0).forEach(function(n) {
1225
+ yt(e, n, r[n]);
1226
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ue(Object(r)).forEach(function(n) {
1227
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1228
+ });
1229
+ }
1230
+ return e;
1231
+ }
1232
+ function yt(e, t, r) {
1233
+ return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1234
+ }
1235
+ function gt() {
1236
+ var e = lt(arguments), t = e.text, r = e.options, n = e.metadata;
1237
+ r = oe(oe({}, r), {}, {
1238
+ extract: !1
1239
+ });
1240
+ var i = st(t, r, n);
1241
+ return i && i.isValid() || !1;
1242
+ }
1243
+ function bt() {
1244
+ return Ne(gt, arguments);
1245
+ }
1246
+ export {
1247
+ Ve as DIGITS,
1248
+ v as ParseError,
1249
+ lr as formatRFC3966,
1250
+ T as getCountryCallingCodeCustom,
1251
+ T as getPhoneCodeCustom,
1252
+ Ot as isSupportedCountry,
1253
+ bt as isValidPhoneNumber,
1254
+ B as parseIncompletePhoneNumber,
1255
+ Ke as parsePhoneNumberCharacter
1256
+ };