@phillips/seldon 1.154.0 → 1.155.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index5.js +2 -2
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/_virtual/index8.js +2 -2
- package/dist/components/ComboBox/ComboBox.d.ts +30 -13
- package/dist/components/ComboBox/ComboBox.js +253 -148
- package/dist/components/ComboBox/ComboBox.stories.d.ts +46 -4
- package/dist/components/ComboBox/types.d.ts +18 -0
- package/dist/components/PhoneNumberPicker/PhoneNumberPicker.d.ts +8 -28
- package/dist/components/PhoneNumberPicker/PhoneNumberPicker.js +39 -0
- package/dist/components/PhoneNumberPicker/PhoneNumberPicker.stories.d.ts +1 -2
- package/dist/components/PhoneNumberPicker/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +59 -57
- package/dist/node_modules/exenv/index.js +1 -1
- package/dist/node_modules/ics/dist/index.js +2 -2
- package/dist/node_modules/ics/dist/pipeline/index.js +1 -1
- package/dist/node_modules/libphonenumber-js/es6/getCountries.js +7 -0
- package/dist/node_modules/libphonenumber-js/es6/helpers/isObject.js +7 -0
- package/dist/node_modules/libphonenumber-js/es6/metadata.js +456 -0
- package/dist/node_modules/libphonenumber-js/es6/tools/semver-compare.js +14 -0
- package/dist/node_modules/libphonenumber-js/metadata.min.json.js +4 -0
- package/dist/node_modules/libphonenumber-js/min/exports/getCountries.js +8 -0
- package/dist/node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js +8 -0
- package/dist/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +8 -0
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/pages/page.test.d.ts +1 -0
- package/dist/scss/components/ComboBox/_combobox.scss +93 -57
- package/dist/utils/usePrevious.d.ts +1 -0
- package/dist/utils/usePrevious.js +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import f from "./tools/semver-compare.js";
|
|
2
|
+
import s from "./helpers/isObject.js";
|
|
3
|
+
function l(n) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
return l = 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
|
+
}, l(n);
|
|
10
|
+
}
|
|
11
|
+
function r(n, t) {
|
|
12
|
+
if (!(n instanceof t))
|
|
13
|
+
throw new TypeError("Cannot call a class as a function");
|
|
14
|
+
}
|
|
15
|
+
function y(n, t) {
|
|
16
|
+
for (var e = 0; e < t.length; e++) {
|
|
17
|
+
var a = t[e];
|
|
18
|
+
a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(n, a.key, a);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function o(n, t, e) {
|
|
22
|
+
return t && y(n.prototype, t), Object.defineProperty(n, "prototype", { writable: !1 }), n;
|
|
23
|
+
}
|
|
24
|
+
var v = "1.2.0", P = "1.7.35", h = " ext. ", d = /^\d+$/, C = /* @__PURE__ */ function() {
|
|
25
|
+
function n(t) {
|
|
26
|
+
r(this, n), k(t), this.metadata = t, m.call(this, t);
|
|
27
|
+
}
|
|
28
|
+
return o(n, [{
|
|
29
|
+
key: "getCountries",
|
|
30
|
+
value: function() {
|
|
31
|
+
return Object.keys(this.metadata.countries).filter(function(e) {
|
|
32
|
+
return e !== "001";
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "getCountryMetadata",
|
|
37
|
+
value: function(e) {
|
|
38
|
+
return this.metadata.countries[e];
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "nonGeographic",
|
|
42
|
+
value: function() {
|
|
43
|
+
if (!(this.v1 || this.v2 || this.v3))
|
|
44
|
+
return this.metadata.nonGeographic || this.metadata.nonGeographical;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "hasCountry",
|
|
48
|
+
value: function(e) {
|
|
49
|
+
return this.getCountryMetadata(e) !== void 0;
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "hasCallingCode",
|
|
53
|
+
value: function(e) {
|
|
54
|
+
if (this.getCountryCodesForCallingCode(e))
|
|
55
|
+
return !0;
|
|
56
|
+
if (this.nonGeographic()) {
|
|
57
|
+
if (this.nonGeographic()[e])
|
|
58
|
+
return !0;
|
|
59
|
+
} else {
|
|
60
|
+
var a = this.countryCallingCodes()[e];
|
|
61
|
+
if (a && a.length === 1 && a[0] === "001")
|
|
62
|
+
return !0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "isNonGeographicCallingCode",
|
|
67
|
+
value: function(e) {
|
|
68
|
+
return this.nonGeographic() ? !!this.nonGeographic()[e] : !this.getCountryCodesForCallingCode(e);
|
|
69
|
+
}
|
|
70
|
+
// Deprecated.
|
|
71
|
+
}, {
|
|
72
|
+
key: "country",
|
|
73
|
+
value: function(e) {
|
|
74
|
+
return this.selectNumberingPlan(e);
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "selectNumberingPlan",
|
|
78
|
+
value: function(e, a) {
|
|
79
|
+
if (e && d.test(e) && (a = e, e = null), e && e !== "001") {
|
|
80
|
+
if (!this.hasCountry(e))
|
|
81
|
+
throw new Error("Unknown country: ".concat(e));
|
|
82
|
+
this.numberingPlan = new g(this.getCountryMetadata(e), this);
|
|
83
|
+
} else if (a) {
|
|
84
|
+
if (!this.hasCallingCode(a))
|
|
85
|
+
throw new Error("Unknown calling code: ".concat(a));
|
|
86
|
+
this.numberingPlan = new g(this.getNumberingPlanMetadata(a), this);
|
|
87
|
+
} else
|
|
88
|
+
this.numberingPlan = void 0;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "getCountryCodesForCallingCode",
|
|
93
|
+
value: function(e) {
|
|
94
|
+
var a = this.countryCallingCodes()[e];
|
|
95
|
+
if (a)
|
|
96
|
+
return a.length === 1 && a[0].length === 3 ? void 0 : a;
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "getCountryCodeForCallingCode",
|
|
100
|
+
value: function(e) {
|
|
101
|
+
var a = this.getCountryCodesForCallingCode(e);
|
|
102
|
+
if (a)
|
|
103
|
+
return a[0];
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "getNumberingPlanMetadata",
|
|
107
|
+
value: function(e) {
|
|
108
|
+
var a = this.getCountryCodeForCallingCode(e);
|
|
109
|
+
if (a)
|
|
110
|
+
return this.getCountryMetadata(a);
|
|
111
|
+
if (this.nonGeographic()) {
|
|
112
|
+
var i = this.nonGeographic()[e];
|
|
113
|
+
if (i)
|
|
114
|
+
return i;
|
|
115
|
+
} else {
|
|
116
|
+
var u = this.countryCallingCodes()[e];
|
|
117
|
+
if (u && u.length === 1 && u[0] === "001")
|
|
118
|
+
return this.metadata.countries["001"];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Deprecated.
|
|
122
|
+
}, {
|
|
123
|
+
key: "countryCallingCode",
|
|
124
|
+
value: function() {
|
|
125
|
+
return this.numberingPlan.callingCode();
|
|
126
|
+
}
|
|
127
|
+
// Deprecated.
|
|
128
|
+
}, {
|
|
129
|
+
key: "IDDPrefix",
|
|
130
|
+
value: function() {
|
|
131
|
+
return this.numberingPlan.IDDPrefix();
|
|
132
|
+
}
|
|
133
|
+
// Deprecated.
|
|
134
|
+
}, {
|
|
135
|
+
key: "defaultIDDPrefix",
|
|
136
|
+
value: function() {
|
|
137
|
+
return this.numberingPlan.defaultIDDPrefix();
|
|
138
|
+
}
|
|
139
|
+
// Deprecated.
|
|
140
|
+
}, {
|
|
141
|
+
key: "nationalNumberPattern",
|
|
142
|
+
value: function() {
|
|
143
|
+
return this.numberingPlan.nationalNumberPattern();
|
|
144
|
+
}
|
|
145
|
+
// Deprecated.
|
|
146
|
+
}, {
|
|
147
|
+
key: "possibleLengths",
|
|
148
|
+
value: function() {
|
|
149
|
+
return this.numberingPlan.possibleLengths();
|
|
150
|
+
}
|
|
151
|
+
// Deprecated.
|
|
152
|
+
}, {
|
|
153
|
+
key: "formats",
|
|
154
|
+
value: function() {
|
|
155
|
+
return this.numberingPlan.formats();
|
|
156
|
+
}
|
|
157
|
+
// Deprecated.
|
|
158
|
+
}, {
|
|
159
|
+
key: "nationalPrefixForParsing",
|
|
160
|
+
value: function() {
|
|
161
|
+
return this.numberingPlan.nationalPrefixForParsing();
|
|
162
|
+
}
|
|
163
|
+
// Deprecated.
|
|
164
|
+
}, {
|
|
165
|
+
key: "nationalPrefixTransformRule",
|
|
166
|
+
value: function() {
|
|
167
|
+
return this.numberingPlan.nationalPrefixTransformRule();
|
|
168
|
+
}
|
|
169
|
+
// Deprecated.
|
|
170
|
+
}, {
|
|
171
|
+
key: "leadingDigits",
|
|
172
|
+
value: function() {
|
|
173
|
+
return this.numberingPlan.leadingDigits();
|
|
174
|
+
}
|
|
175
|
+
// Deprecated.
|
|
176
|
+
}, {
|
|
177
|
+
key: "hasTypes",
|
|
178
|
+
value: function() {
|
|
179
|
+
return this.numberingPlan.hasTypes();
|
|
180
|
+
}
|
|
181
|
+
// Deprecated.
|
|
182
|
+
}, {
|
|
183
|
+
key: "type",
|
|
184
|
+
value: function(e) {
|
|
185
|
+
return this.numberingPlan.type(e);
|
|
186
|
+
}
|
|
187
|
+
// Deprecated.
|
|
188
|
+
}, {
|
|
189
|
+
key: "ext",
|
|
190
|
+
value: function() {
|
|
191
|
+
return this.numberingPlan.ext();
|
|
192
|
+
}
|
|
193
|
+
}, {
|
|
194
|
+
key: "countryCallingCodes",
|
|
195
|
+
value: function() {
|
|
196
|
+
return this.v1 ? this.metadata.country_phone_code_to_countries : this.metadata.country_calling_codes;
|
|
197
|
+
}
|
|
198
|
+
// Deprecated.
|
|
199
|
+
}, {
|
|
200
|
+
key: "chooseCountryByCountryCallingCode",
|
|
201
|
+
value: function(e) {
|
|
202
|
+
return this.selectNumberingPlan(e);
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
key: "hasSelectedNumberingPlan",
|
|
206
|
+
value: function() {
|
|
207
|
+
return this.numberingPlan !== void 0;
|
|
208
|
+
}
|
|
209
|
+
}]), n;
|
|
210
|
+
}(), g = /* @__PURE__ */ function() {
|
|
211
|
+
function n(t, e) {
|
|
212
|
+
r(this, n), this.globalMetadataObject = e, this.metadata = t, m.call(this, e.metadata);
|
|
213
|
+
}
|
|
214
|
+
return o(n, [{
|
|
215
|
+
key: "callingCode",
|
|
216
|
+
value: function() {
|
|
217
|
+
return this.metadata[0];
|
|
218
|
+
}
|
|
219
|
+
// Formatting information for regions which share
|
|
220
|
+
// a country calling code is contained by only one region
|
|
221
|
+
// for performance reasons. For example, for NANPA region
|
|
222
|
+
// ("North American Numbering Plan Administration",
|
|
223
|
+
// which includes USA, Canada, Cayman Islands, Bahamas, etc)
|
|
224
|
+
// it will be contained in the metadata for `US`.
|
|
225
|
+
}, {
|
|
226
|
+
key: "getDefaultCountryMetadataForRegion",
|
|
227
|
+
value: function() {
|
|
228
|
+
return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
|
|
229
|
+
}
|
|
230
|
+
// Is always present.
|
|
231
|
+
}, {
|
|
232
|
+
key: "IDDPrefix",
|
|
233
|
+
value: function() {
|
|
234
|
+
if (!(this.v1 || this.v2))
|
|
235
|
+
return this.metadata[1];
|
|
236
|
+
}
|
|
237
|
+
// Is only present when a country supports multiple IDD prefixes.
|
|
238
|
+
}, {
|
|
239
|
+
key: "defaultIDDPrefix",
|
|
240
|
+
value: function() {
|
|
241
|
+
if (!(this.v1 || this.v2))
|
|
242
|
+
return this.metadata[12];
|
|
243
|
+
}
|
|
244
|
+
}, {
|
|
245
|
+
key: "nationalNumberPattern",
|
|
246
|
+
value: function() {
|
|
247
|
+
return this.v1 || this.v2 ? this.metadata[1] : this.metadata[2];
|
|
248
|
+
}
|
|
249
|
+
// "possible length" data is always present in Google's metadata.
|
|
250
|
+
}, {
|
|
251
|
+
key: "possibleLengths",
|
|
252
|
+
value: function() {
|
|
253
|
+
if (!this.v1)
|
|
254
|
+
return this.metadata[this.v2 ? 2 : 3];
|
|
255
|
+
}
|
|
256
|
+
}, {
|
|
257
|
+
key: "_getFormats",
|
|
258
|
+
value: function(e) {
|
|
259
|
+
return e[this.v1 ? 2 : this.v2 ? 3 : 4];
|
|
260
|
+
}
|
|
261
|
+
// For countries of the same region (e.g. NANPA)
|
|
262
|
+
// formats are all stored in the "main" country for that region.
|
|
263
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
264
|
+
}, {
|
|
265
|
+
key: "formats",
|
|
266
|
+
value: function() {
|
|
267
|
+
var e = this, a = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
|
|
268
|
+
return a.map(function(i) {
|
|
269
|
+
return new p(i, e);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
273
|
+
key: "nationalPrefix",
|
|
274
|
+
value: function() {
|
|
275
|
+
return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
key: "_getNationalPrefixFormattingRule",
|
|
279
|
+
value: function(e) {
|
|
280
|
+
return e[this.v1 ? 4 : this.v2 ? 5 : 6];
|
|
281
|
+
}
|
|
282
|
+
// For countries of the same region (e.g. NANPA)
|
|
283
|
+
// national prefix formatting rule is stored in the "main" country for that region.
|
|
284
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
285
|
+
}, {
|
|
286
|
+
key: "nationalPrefixFormattingRule",
|
|
287
|
+
value: function() {
|
|
288
|
+
return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
|
|
289
|
+
}
|
|
290
|
+
}, {
|
|
291
|
+
key: "_nationalPrefixForParsing",
|
|
292
|
+
value: function() {
|
|
293
|
+
return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: "nationalPrefixForParsing",
|
|
297
|
+
value: function() {
|
|
298
|
+
return this._nationalPrefixForParsing() || this.nationalPrefix();
|
|
299
|
+
}
|
|
300
|
+
}, {
|
|
301
|
+
key: "nationalPrefixTransformRule",
|
|
302
|
+
value: function() {
|
|
303
|
+
return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
key: "_getNationalPrefixIsOptionalWhenFormatting",
|
|
307
|
+
value: function() {
|
|
308
|
+
return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
|
|
309
|
+
}
|
|
310
|
+
// For countries of the same region (e.g. NANPA)
|
|
311
|
+
// "national prefix is optional when formatting" flag is
|
|
312
|
+
// stored in the "main" country for that region.
|
|
313
|
+
// E.g. "RU" and "KZ", "US" and "CA".
|
|
314
|
+
}, {
|
|
315
|
+
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
|
|
316
|
+
value: function() {
|
|
317
|
+
return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
key: "leadingDigits",
|
|
321
|
+
value: function() {
|
|
322
|
+
return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "types",
|
|
326
|
+
value: function() {
|
|
327
|
+
return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
key: "hasTypes",
|
|
331
|
+
value: function() {
|
|
332
|
+
return this.types() && this.types().length === 0 ? !1 : !!this.types();
|
|
333
|
+
}
|
|
334
|
+
}, {
|
|
335
|
+
key: "type",
|
|
336
|
+
value: function(e) {
|
|
337
|
+
if (this.hasTypes() && c(this.types(), e))
|
|
338
|
+
return new F(c(this.types(), e), this);
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
key: "ext",
|
|
342
|
+
value: function() {
|
|
343
|
+
return this.v1 || this.v2 ? h : this.metadata[13] || h;
|
|
344
|
+
}
|
|
345
|
+
}]), n;
|
|
346
|
+
}(), p = /* @__PURE__ */ function() {
|
|
347
|
+
function n(t, e) {
|
|
348
|
+
r(this, n), this._format = t, this.metadata = e;
|
|
349
|
+
}
|
|
350
|
+
return o(n, [{
|
|
351
|
+
key: "pattern",
|
|
352
|
+
value: function() {
|
|
353
|
+
return this._format[0];
|
|
354
|
+
}
|
|
355
|
+
}, {
|
|
356
|
+
key: "format",
|
|
357
|
+
value: function() {
|
|
358
|
+
return this._format[1];
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "leadingDigitsPatterns",
|
|
362
|
+
value: function() {
|
|
363
|
+
return this._format[2] || [];
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
key: "nationalPrefixFormattingRule",
|
|
367
|
+
value: function() {
|
|
368
|
+
return this._format[3] || this.metadata.nationalPrefixFormattingRule();
|
|
369
|
+
}
|
|
370
|
+
}, {
|
|
371
|
+
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
|
|
372
|
+
value: function() {
|
|
373
|
+
return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
374
|
+
}
|
|
375
|
+
}, {
|
|
376
|
+
key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
|
|
377
|
+
value: function() {
|
|
378
|
+
return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
|
|
379
|
+
}
|
|
380
|
+
// Checks whether national prefix formatting rule contains national prefix.
|
|
381
|
+
}, {
|
|
382
|
+
key: "usesNationalPrefix",
|
|
383
|
+
value: function() {
|
|
384
|
+
return !!(this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
|
|
385
|
+
!b.test(this.nationalPrefixFormattingRule()));
|
|
386
|
+
}
|
|
387
|
+
}, {
|
|
388
|
+
key: "internationalFormat",
|
|
389
|
+
value: function() {
|
|
390
|
+
return this._format[5] || this.format();
|
|
391
|
+
}
|
|
392
|
+
}]), n;
|
|
393
|
+
}(), b = /^\(?\$1\)?$/, F = /* @__PURE__ */ function() {
|
|
394
|
+
function n(t, e) {
|
|
395
|
+
r(this, n), this.type = t, this.metadata = e;
|
|
396
|
+
}
|
|
397
|
+
return o(n, [{
|
|
398
|
+
key: "pattern",
|
|
399
|
+
value: function() {
|
|
400
|
+
return this.metadata.v1 ? this.type : this.type[0];
|
|
401
|
+
}
|
|
402
|
+
}, {
|
|
403
|
+
key: "possibleLengths",
|
|
404
|
+
value: function() {
|
|
405
|
+
if (!this.metadata.v1)
|
|
406
|
+
return this.type[1] || this.metadata.possibleLengths();
|
|
407
|
+
}
|
|
408
|
+
}]), n;
|
|
409
|
+
}();
|
|
410
|
+
function c(n, t) {
|
|
411
|
+
switch (t) {
|
|
412
|
+
case "FIXED_LINE":
|
|
413
|
+
return n[0];
|
|
414
|
+
case "MOBILE":
|
|
415
|
+
return n[1];
|
|
416
|
+
case "TOLL_FREE":
|
|
417
|
+
return n[2];
|
|
418
|
+
case "PREMIUM_RATE":
|
|
419
|
+
return n[3];
|
|
420
|
+
case "PERSONAL_NUMBER":
|
|
421
|
+
return n[4];
|
|
422
|
+
case "VOICEMAIL":
|
|
423
|
+
return n[5];
|
|
424
|
+
case "UAN":
|
|
425
|
+
return n[6];
|
|
426
|
+
case "PAGER":
|
|
427
|
+
return n[7];
|
|
428
|
+
case "VOIP":
|
|
429
|
+
return n[8];
|
|
430
|
+
case "SHARED_COST":
|
|
431
|
+
return n[9];
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function k(n) {
|
|
435
|
+
if (!n)
|
|
436
|
+
throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");
|
|
437
|
+
if (!s(n) || !s(n.countries))
|
|
438
|
+
throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(s(n) ? "an object of shape: { " + Object.keys(n).join(", ") + " }" : "a " + x(n) + ": " + n, "."));
|
|
439
|
+
}
|
|
440
|
+
var x = function(t) {
|
|
441
|
+
return l(t);
|
|
442
|
+
};
|
|
443
|
+
function I(n, t) {
|
|
444
|
+
if (t = new C(t), t.hasCountry(n))
|
|
445
|
+
return t.country(n).countryCallingCode();
|
|
446
|
+
throw new Error("Unknown country: ".concat(n));
|
|
447
|
+
}
|
|
448
|
+
function m(n) {
|
|
449
|
+
var t = n.version;
|
|
450
|
+
typeof t == "number" ? (this.v1 = t === 1, this.v2 = t === 2, this.v3 = t === 3, this.v4 = t === 4) : t ? f(t, v) === -1 ? this.v2 = !0 : f(t, P) === -1 ? this.v3 = !0 : this.v4 = !0 : this.v1 = !0;
|
|
451
|
+
}
|
|
452
|
+
export {
|
|
453
|
+
C as default,
|
|
454
|
+
I as getCountryCallingCode,
|
|
455
|
+
k as validateMetadata
|
|
456
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function f(r, t) {
|
|
2
|
+
r = r.split("-"), t = t.split("-");
|
|
3
|
+
for (var N = r[0].split("."), s = t[0].split("."), e = 0; e < 3; e++) {
|
|
4
|
+
var i = Number(N[e]), u = Number(s[e]);
|
|
5
|
+
if (i > u) return 1;
|
|
6
|
+
if (u > i) return -1;
|
|
7
|
+
if (!isNaN(i) && isNaN(u)) return 1;
|
|
8
|
+
if (isNaN(i) && !isNaN(u)) return -1;
|
|
9
|
+
}
|
|
10
|
+
return r[1] && t[1] ? r[1] > t[1] ? 1 : r[1] < t[1] ? -1 : 0 : !r[1] && t[1] ? 1 : r[1] && !t[1] ? -1 : 0;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
f as default
|
|
14
|
+
};
|