UNPKG

490 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3 typeof define === 'function' && define.amd ? define(['exports'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ClassValidator = {}));
5})(this, (function (exports) { 'use strict';
6
7 /**
8 * This metadata contains validation rules.
9 */
10 var ValidationMetadata = /** @class */ (function () {
11 // -------------------------------------------------------------------------
12 // Constructor
13 // -------------------------------------------------------------------------
14 function ValidationMetadata(args) {
15 /**
16 * Validation groups used for this validation.
17 */
18 this.groups = [];
19 /**
20 * Specifies if validated value is an array and each of its item must be validated.
21 */
22 this.each = false;
23 /*
24 * A transient set of data passed through to the validation result for response mapping
25 */
26 this.context = undefined;
27 this.type = args.type;
28 this.target = args.target;
29 this.propertyName = args.propertyName;
30 this.constraints = args.constraints;
31 this.constraintCls = args.constraintCls;
32 this.validationTypeOptions = args.validationTypeOptions;
33 if (args.validationOptions) {
34 this.message = args.validationOptions.message;
35 this.groups = args.validationOptions.groups;
36 this.always = args.validationOptions.always;
37 this.each = args.validationOptions.each;
38 this.context = args.validationOptions.context;
39 }
40 }
41 return ValidationMetadata;
42 }());
43
44 /**
45 * Used to transform validation schemas to validation metadatas.
46 */
47 var ValidationSchemaToMetadataTransformer = /** @class */ (function () {
48 function ValidationSchemaToMetadataTransformer() {
49 }
50 ValidationSchemaToMetadataTransformer.prototype.transform = function (schema) {
51 var metadatas = [];
52 Object.keys(schema.properties).forEach(function (property) {
53 schema.properties[property].forEach(function (validation) {
54 var validationOptions = {
55 message: validation.message,
56 groups: validation.groups,
57 always: validation.always,
58 each: validation.each,
59 };
60 var args = {
61 type: validation.type,
62 target: schema.name,
63 propertyName: property,
64 constraints: validation.constraints,
65 validationTypeOptions: validation.options,
66 validationOptions: validationOptions,
67 };
68 metadatas.push(new ValidationMetadata(args));
69 });
70 });
71 return metadatas;
72 };
73 return ValidationSchemaToMetadataTransformer;
74 }());
75
76 /**
77 * Convert Map, Set to Array
78 */
79 function convertToArray(val) {
80 if (val instanceof Map) {
81 return Array.from(val.values());
82 }
83 return Array.isArray(val) ? val : Array.from(val);
84 }
85
86 /**
87 * This function returns the global object across Node and browsers.
88 *
89 * Note: `globalThis` is the standardized approach however it has been added to
90 * Node.js in version 12. We need to include this snippet until Node 12 EOL.
91 */
92 function getGlobal() {
93 if (typeof globalThis !== 'undefined') {
94 return globalThis;
95 }
96 if (typeof global !== 'undefined') {
97 return global;
98 }
99 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
100 // @ts-ignore: Cannot find name 'window'.
101 if (typeof window !== 'undefined') {
102 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
103 // @ts-ignore: Cannot find name 'window'.
104 return window;
105 }
106 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
107 // @ts-ignore: Cannot find name 'self'.
108 if (typeof self !== 'undefined') {
109 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
110 // @ts-ignore: Cannot find name 'self'.
111 return self;
112 }
113 }
114
115 // https://github.com/TylorS/typed-is-promise/blob/abf1514e1b6961adfc75765476b0debb96b2c3ae/src/index.ts
116 function isPromise(p) {
117 return p !== null && typeof p === 'object' && typeof p.then === 'function';
118 }
119
120 /**
121 * Storage all metadatas.
122 */
123 var MetadataStorage = /** @class */ (function () {
124 function MetadataStorage() {
125 // -------------------------------------------------------------------------
126 // Private properties
127 // -------------------------------------------------------------------------
128 this.validationMetadatas = [];
129 this.constraintMetadatas = [];
130 }
131 Object.defineProperty(MetadataStorage.prototype, "hasValidationMetaData", {
132 get: function () {
133 return !!this.validationMetadatas.length;
134 },
135 enumerable: false,
136 configurable: true
137 });
138 // -------------------------------------------------------------------------
139 // Public Methods
140 // -------------------------------------------------------------------------
141 /**
142 * Adds a new validation metadata.
143 */
144 MetadataStorage.prototype.addValidationSchema = function (schema) {
145 var _this = this;
146 var validationMetadatas = new ValidationSchemaToMetadataTransformer().transform(schema);
147 validationMetadatas.forEach(function (validationMetadata) { return _this.addValidationMetadata(validationMetadata); });
148 };
149 /**
150 * Adds a new validation metadata.
151 */
152 MetadataStorage.prototype.addValidationMetadata = function (metadata) {
153 this.validationMetadatas.push(metadata);
154 };
155 /**
156 * Adds a new constraint metadata.
157 */
158 MetadataStorage.prototype.addConstraintMetadata = function (metadata) {
159 this.constraintMetadatas.push(metadata);
160 };
161 /**
162 * Groups metadata by their property names.
163 */
164 MetadataStorage.prototype.groupByPropertyName = function (metadata) {
165 var grouped = {};
166 metadata.forEach(function (metadata) {
167 if (!grouped[metadata.propertyName])
168 grouped[metadata.propertyName] = [];
169 grouped[metadata.propertyName].push(metadata);
170 });
171 return grouped;
172 };
173 /**
174 * Gets all validation metadatas for the given object with the given groups.
175 */
176 MetadataStorage.prototype.getTargetValidationMetadatas = function (targetConstructor, targetSchema, always, strictGroups, groups) {
177 var includeMetadataBecauseOfAlwaysOption = function (metadata) {
178 // `metadata.always` overrides global default.
179 if (typeof metadata.always !== 'undefined')
180 return metadata.always;
181 // `metadata.groups` overrides global default.
182 if (metadata.groups && metadata.groups.length)
183 return false;
184 // Use global default.
185 return always;
186 };
187 var excludeMetadataBecauseOfStrictGroupsOption = function (metadata) {
188 if (strictGroups) {
189 // Validation is not using groups.
190 if (!groups || !groups.length) {
191 // `metadata.groups` has at least one group.
192 if (metadata.groups && metadata.groups.length)
193 return true;
194 }
195 }
196 return false;
197 };
198 // get directly related to a target metadatas
199 var originalMetadatas = this.validationMetadatas.filter(function (metadata) {
200 if (metadata.target !== targetConstructor && metadata.target !== targetSchema)
201 return false;
202 if (includeMetadataBecauseOfAlwaysOption(metadata))
203 return true;
204 if (excludeMetadataBecauseOfStrictGroupsOption(metadata))
205 return false;
206 if (groups && groups.length > 0)
207 return metadata.groups && !!metadata.groups.find(function (group) { return groups.indexOf(group) !== -1; });
208 return true;
209 });
210 // get metadatas for inherited classes
211 var inheritedMetadatas = this.validationMetadatas.filter(function (metadata) {
212 // if target is a string it's means we validate against a schema, and there is no inheritance support for schemas
213 if (typeof metadata.target === 'string')
214 return false;
215 if (metadata.target === targetConstructor)
216 return false;
217 if (metadata.target instanceof Function && !(targetConstructor.prototype instanceof metadata.target))
218 return false;
219 if (includeMetadataBecauseOfAlwaysOption(metadata))
220 return true;
221 if (excludeMetadataBecauseOfStrictGroupsOption(metadata))
222 return false;
223 if (groups && groups.length > 0)
224 return metadata.groups && !!metadata.groups.find(function (group) { return groups.indexOf(group) !== -1; });
225 return true;
226 });
227 // filter out duplicate metadatas, prefer original metadatas instead of inherited metadatas
228 var uniqueInheritedMetadatas = inheritedMetadatas.filter(function (inheritedMetadata) {
229 return !originalMetadatas.find(function (originalMetadata) {
230 return (originalMetadata.propertyName === inheritedMetadata.propertyName &&
231 originalMetadata.type === inheritedMetadata.type);
232 });
233 });
234 return originalMetadatas.concat(uniqueInheritedMetadatas);
235 };
236 /**
237 * Gets all validator constraints for the given object.
238 */
239 MetadataStorage.prototype.getTargetValidatorConstraints = function (target) {
240 return this.constraintMetadatas.filter(function (metadata) { return metadata.target === target; });
241 };
242 return MetadataStorage;
243 }());
244 /**
245 * Gets metadata storage.
246 * Metadata storage follows the best practices and stores metadata in a global variable.
247 */
248 function getMetadataStorage() {
249 var global = getGlobal();
250 if (!global.classValidatorMetadataStorage) {
251 global.classValidatorMetadataStorage = new MetadataStorage();
252 }
253 return global.classValidatorMetadataStorage;
254 }
255
256 /**
257 * Validation error description.
258 */
259 var ValidationError = /** @class */ (function () {
260 function ValidationError() {
261 }
262 /**
263 *
264 * @param shouldDecorate decorate the message with ANSI formatter escape codes for better readability
265 * @param hasParent true when the error is a child of an another one
266 * @param parentPath path as string to the parent of this property
267 */
268 ValidationError.prototype.toString = function (shouldDecorate, hasParent, parentPath) {
269 var _this = this;
270 if (shouldDecorate === void 0) { shouldDecorate = false; }
271 if (hasParent === void 0) { hasParent = false; }
272 if (parentPath === void 0) { parentPath = ""; }
273 var boldStart = shouldDecorate ? "\u001B[1m" : "";
274 var boldEnd = shouldDecorate ? "\u001B[22m" : "";
275 var propConstraintFailed = function (propertyName) {
276 return " - property ".concat(boldStart).concat(parentPath).concat(propertyName).concat(boldEnd, " has failed the following constraints: ").concat(boldStart).concat(Object.keys(_this.constraints).join(", ")).concat(boldEnd, " \n");
277 };
278 if (!hasParent) {
279 return ("An instance of ".concat(boldStart).concat(this.target ? this.target.constructor.name : 'an object').concat(boldEnd, " has failed the validation:\n") +
280 (this.constraints ? propConstraintFailed(this.property) : "") +
281 (this.children
282 ? this.children.map(function (childError) { return childError.toString(shouldDecorate, true, _this.property); }).join("")
283 : ""));
284 }
285 else {
286 // we format numbers as array indexes for better readability.
287 var formattedProperty_1 = Number.isInteger(+this.property)
288 ? "[".concat(this.property, "]")
289 : "".concat(parentPath ? "." : "").concat(this.property);
290 if (this.constraints) {
291 return propConstraintFailed(formattedProperty_1);
292 }
293 else {
294 return this.children
295 ? this.children
296 .map(function (childError) { return childError.toString(shouldDecorate, true, "".concat(parentPath).concat(formattedProperty_1)); })
297 .join("")
298 : "";
299 }
300 }
301 };
302 return ValidationError;
303 }());
304
305 /**
306 * Validation types.
307 */
308 var ValidationTypes = /** @class */ (function () {
309 function ValidationTypes() {
310 }
311 /**
312 * Checks if validation type is valid.
313 */
314 ValidationTypes.isValid = function (type) {
315 var _this = this;
316 return (type !== 'isValid' &&
317 type !== 'getMessage' &&
318 Object.keys(this)
319 .map(function (key) { return _this[key]; })
320 .indexOf(type) !== -1);
321 };
322 /* system */
323 ValidationTypes.CUSTOM_VALIDATION = 'customValidation'; // done
324 ValidationTypes.NESTED_VALIDATION = 'nestedValidation'; // done
325 ValidationTypes.PROMISE_VALIDATION = 'promiseValidation'; // done
326 ValidationTypes.CONDITIONAL_VALIDATION = 'conditionalValidation'; // done
327 ValidationTypes.WHITELIST = 'whitelistValidation'; // done
328 ValidationTypes.IS_DEFINED = 'isDefined'; // done
329 return ValidationTypes;
330 }());
331
332 /**
333 * Convert the constraint to a string to be shown in an error
334 */
335 function constraintToString(constraint) {
336 if (Array.isArray(constraint)) {
337 return constraint.join(', ');
338 }
339 return "".concat(constraint);
340 }
341 var ValidationUtils = /** @class */ (function () {
342 function ValidationUtils() {
343 }
344 ValidationUtils.replaceMessageSpecialTokens = function (message, validationArguments) {
345 var messageString;
346 if (message instanceof Function) {
347 messageString = message(validationArguments);
348 }
349 else if (typeof message === 'string') {
350 messageString = message;
351 }
352 if (messageString && Array.isArray(validationArguments.constraints)) {
353 validationArguments.constraints.forEach(function (constraint, index) {
354 messageString = messageString.replace(new RegExp("\\$constraint".concat(index + 1), 'g'), constraintToString(constraint));
355 });
356 }
357 if (messageString &&
358 validationArguments.value !== undefined &&
359 validationArguments.value !== null &&
360 typeof validationArguments.value === 'string')
361 messageString = messageString.replace(/\$value/g, validationArguments.value);
362 if (messageString)
363 messageString = messageString.replace(/\$property/g, validationArguments.property);
364 if (messageString)
365 messageString = messageString.replace(/\$target/g, validationArguments.targetName);
366 return messageString;
367 };
368 return ValidationUtils;
369 }());
370
371 /**
372 * Executes validation over given object.
373 */
374 var ValidationExecutor = /** @class */ (function () {
375 // -------------------------------------------------------------------------
376 // Constructor
377 // -------------------------------------------------------------------------
378 function ValidationExecutor(validator, validatorOptions) {
379 this.validator = validator;
380 this.validatorOptions = validatorOptions;
381 // -------------------------------------------------------------------------
382 // Properties
383 // -------------------------------------------------------------------------
384 this.awaitingPromises = [];
385 this.ignoreAsyncValidations = false;
386 // -------------------------------------------------------------------------
387 // Private Properties
388 // -------------------------------------------------------------------------
389 this.metadataStorage = getMetadataStorage();
390 }
391 // -------------------------------------------------------------------------
392 // Public Methods
393 // -------------------------------------------------------------------------
394 ValidationExecutor.prototype.execute = function (object, targetSchema, validationErrors) {
395 var _this = this;
396 var _a;
397 /**
398 * If there is no metadata registered it means possibly the dependencies are not flatterned and
399 * more than one instance is used.
400 *
401 * TODO: This needs proper handling, forcing to use the same container or some other proper solution.
402 */
403 if (!this.metadataStorage.hasValidationMetaData && ((_a = this.validatorOptions) === null || _a === void 0 ? void 0 : _a.enableDebugMessages) === true) {
404 console.warn("No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.");
405 }
406 var groups = this.validatorOptions ? this.validatorOptions.groups : undefined;
407 var strictGroups = (this.validatorOptions && this.validatorOptions.strictGroups) || false;
408 var always = (this.validatorOptions && this.validatorOptions.always) || false;
409 var targetMetadatas = this.metadataStorage.getTargetValidationMetadatas(object.constructor, targetSchema, always, strictGroups, groups);
410 var groupedMetadatas = this.metadataStorage.groupByPropertyName(targetMetadatas);
411 if (this.validatorOptions && this.validatorOptions.forbidUnknownValues && !targetMetadatas.length) {
412 var validationError = new ValidationError();
413 if (!this.validatorOptions ||
414 !this.validatorOptions.validationError ||
415 this.validatorOptions.validationError.target === undefined ||
416 this.validatorOptions.validationError.target === true)
417 validationError.target = object;
418 validationError.value = undefined;
419 validationError.property = undefined;
420 validationError.children = [];
421 validationError.constraints = { unknownValue: 'an unknown value was passed to the validate function' };
422 validationErrors.push(validationError);
423 return;
424 }
425 if (this.validatorOptions && this.validatorOptions.whitelist)
426 this.whitelist(object, groupedMetadatas, validationErrors);
427 // General validation
428 Object.keys(groupedMetadatas).forEach(function (propertyName) {
429 var value = object[propertyName];
430 var definedMetadatas = groupedMetadatas[propertyName].filter(function (metadata) { return metadata.type === ValidationTypes.IS_DEFINED; });
431 var metadatas = groupedMetadatas[propertyName].filter(function (metadata) { return metadata.type !== ValidationTypes.IS_DEFINED && metadata.type !== ValidationTypes.WHITELIST; });
432 if (value instanceof Promise &&
433 metadatas.find(function (metadata) { return metadata.type === ValidationTypes.PROMISE_VALIDATION; })) {
434 _this.awaitingPromises.push(value.then(function (resolvedValue) {
435 _this.performValidations(object, resolvedValue, propertyName, definedMetadatas, metadatas, validationErrors);
436 }));
437 }
438 else {
439 _this.performValidations(object, value, propertyName, definedMetadatas, metadatas, validationErrors);
440 }
441 });
442 };
443 ValidationExecutor.prototype.whitelist = function (object, groupedMetadatas, validationErrors) {
444 var _this = this;
445 var notAllowedProperties = [];
446 Object.keys(object).forEach(function (propertyName) {
447 // does this property have no metadata?
448 if (!groupedMetadatas[propertyName] || groupedMetadatas[propertyName].length === 0)
449 notAllowedProperties.push(propertyName);
450 });
451 if (notAllowedProperties.length > 0) {
452 if (this.validatorOptions && this.validatorOptions.forbidNonWhitelisted) {
453 // throw errors
454 notAllowedProperties.forEach(function (property) {
455 var _a;
456 var validationError = _this.generateValidationError(object, object[property], property);
457 validationError.constraints = (_a = {}, _a[ValidationTypes.WHITELIST] = "property ".concat(property, " should not exist"), _a);
458 validationError.children = undefined;
459 validationErrors.push(validationError);
460 });
461 }
462 else {
463 // strip non allowed properties
464 notAllowedProperties.forEach(function (property) { return delete object[property]; });
465 }
466 }
467 };
468 ValidationExecutor.prototype.stripEmptyErrors = function (errors) {
469 var _this = this;
470 return errors.filter(function (error) {
471 if (error.children) {
472 error.children = _this.stripEmptyErrors(error.children);
473 }
474 if (Object.keys(error.constraints).length === 0) {
475 if (error.children.length === 0) {
476 return false;
477 }
478 else {
479 delete error.constraints;
480 }
481 }
482 return true;
483 });
484 };
485 // -------------------------------------------------------------------------
486 // Private Methods
487 // -------------------------------------------------------------------------
488 ValidationExecutor.prototype.performValidations = function (object, value, propertyName, definedMetadatas, metadatas, validationErrors) {
489 var customValidationMetadatas = metadatas.filter(function (metadata) { return metadata.type === ValidationTypes.CUSTOM_VALIDATION; });
490 var nestedValidationMetadatas = metadatas.filter(function (metadata) { return metadata.type === ValidationTypes.NESTED_VALIDATION; });
491 var conditionalValidationMetadatas = metadatas.filter(function (metadata) { return metadata.type === ValidationTypes.CONDITIONAL_VALIDATION; });
492 var validationError = this.generateValidationError(object, value, propertyName);
493 validationErrors.push(validationError);
494 var canValidate = this.conditionalValidations(object, value, conditionalValidationMetadatas);
495 if (!canValidate) {
496 return;
497 }
498 // handle IS_DEFINED validation type the special way - it should work no matter skipUndefinedProperties/skipMissingProperties is set or not
499 this.customValidations(object, value, definedMetadatas, validationError);
500 this.mapContexts(object, value, definedMetadatas, validationError);
501 if (value === undefined && this.validatorOptions && this.validatorOptions.skipUndefinedProperties === true) {
502 return;
503 }
504 if (value === null && this.validatorOptions && this.validatorOptions.skipNullProperties === true) {
505 return;
506 }
507 if ((value === null || value === undefined) &&
508 this.validatorOptions &&
509 this.validatorOptions.skipMissingProperties === true) {
510 return;
511 }
512 this.customValidations(object, value, customValidationMetadatas, validationError);
513 this.nestedValidations(value, nestedValidationMetadatas, validationError.children);
514 this.mapContexts(object, value, metadatas, validationError);
515 this.mapContexts(object, value, customValidationMetadatas, validationError);
516 };
517 ValidationExecutor.prototype.generateValidationError = function (object, value, propertyName) {
518 var validationError = new ValidationError();
519 if (!this.validatorOptions ||
520 !this.validatorOptions.validationError ||
521 this.validatorOptions.validationError.target === undefined ||
522 this.validatorOptions.validationError.target === true)
523 validationError.target = object;
524 if (!this.validatorOptions ||
525 !this.validatorOptions.validationError ||
526 this.validatorOptions.validationError.value === undefined ||
527 this.validatorOptions.validationError.value === true)
528 validationError.value = value;
529 validationError.property = propertyName;
530 validationError.children = [];
531 validationError.constraints = {};
532 return validationError;
533 };
534 ValidationExecutor.prototype.conditionalValidations = function (object, value, metadatas) {
535 return metadatas
536 .map(function (metadata) { return metadata.constraints[0](object, value); })
537 .reduce(function (resultA, resultB) { return resultA && resultB; }, true);
538 };
539 ValidationExecutor.prototype.customValidations = function (object, value, metadatas, error) {
540 var _this = this;
541 metadatas.forEach(function (metadata) {
542 _this.metadataStorage.getTargetValidatorConstraints(metadata.constraintCls).forEach(function (customConstraintMetadata) {
543 if (customConstraintMetadata.async && _this.ignoreAsyncValidations)
544 return;
545 if (_this.validatorOptions &&
546 _this.validatorOptions.stopAtFirstError &&
547 Object.keys(error.constraints || {}).length > 0)
548 return;
549 var validationArguments = {
550 targetName: object.constructor ? object.constructor.name : undefined,
551 property: metadata.propertyName,
552 object: object,
553 value: value,
554 constraints: metadata.constraints,
555 };
556 if (!metadata.each || !(Array.isArray(value) || value instanceof Set || value instanceof Map)) {
557 var validatedValue = customConstraintMetadata.instance.validate(value, validationArguments);
558 if (isPromise(validatedValue)) {
559 var promise = validatedValue.then(function (isValid) {
560 if (!isValid) {
561 var _a = _this.createValidationError(object, value, metadata, customConstraintMetadata), type = _a[0], message = _a[1];
562 error.constraints[type] = message;
563 if (metadata.context) {
564 if (!error.contexts) {
565 error.contexts = {};
566 }
567 error.contexts[type] = Object.assign(error.contexts[type] || {}, metadata.context);
568 }
569 }
570 });
571 _this.awaitingPromises.push(promise);
572 }
573 else {
574 if (!validatedValue) {
575 var _a = _this.createValidationError(object, value, metadata, customConstraintMetadata), type = _a[0], message = _a[1];
576 error.constraints[type] = message;
577 }
578 }
579 return;
580 }
581 // convert set and map into array
582 var arrayValue = convertToArray(value);
583 // Validation needs to be applied to each array item
584 var validatedSubValues = arrayValue.map(function (subValue) {
585 return customConstraintMetadata.instance.validate(subValue, validationArguments);
586 });
587 var validationIsAsync = validatedSubValues.some(function (validatedSubValue) {
588 return isPromise(validatedSubValue);
589 });
590 if (validationIsAsync) {
591 // Wrap plain values (if any) in promises, so that all are async
592 var asyncValidatedSubValues = validatedSubValues.map(function (validatedSubValue) {
593 return isPromise(validatedSubValue) ? validatedSubValue : Promise.resolve(validatedSubValue);
594 });
595 var asyncValidationIsFinishedPromise = Promise.all(asyncValidatedSubValues).then(function (flatValidatedValues) {
596 var validationResult = flatValidatedValues.every(function (isValid) { return isValid; });
597 if (!validationResult) {
598 var _a = _this.createValidationError(object, value, metadata, customConstraintMetadata), type = _a[0], message = _a[1];
599 error.constraints[type] = message;
600 if (metadata.context) {
601 if (!error.contexts) {
602 error.contexts = {};
603 }
604 error.contexts[type] = Object.assign(error.contexts[type] || {}, metadata.context);
605 }
606 }
607 });
608 _this.awaitingPromises.push(asyncValidationIsFinishedPromise);
609 return;
610 }
611 var validationResult = validatedSubValues.every(function (isValid) { return isValid; });
612 if (!validationResult) {
613 var _b = _this.createValidationError(object, value, metadata, customConstraintMetadata), type = _b[0], message = _b[1];
614 error.constraints[type] = message;
615 }
616 });
617 });
618 };
619 ValidationExecutor.prototype.nestedValidations = function (value, metadatas, errors) {
620 var _this = this;
621 if (value === void 0) {
622 return;
623 }
624 metadatas.forEach(function (metadata) {
625 var _a;
626 if (metadata.type !== ValidationTypes.NESTED_VALIDATION && metadata.type !== ValidationTypes.PROMISE_VALIDATION) {
627 return;
628 }
629 if (Array.isArray(value) || value instanceof Set || value instanceof Map) {
630 // Treats Set as an array - as index of Set value is value itself and it is common case to have Object as value
631 var arrayLikeValue = value instanceof Set ? Array.from(value) : value;
632 arrayLikeValue.forEach(function (subValue, index) {
633 _this.performValidations(value, subValue, index.toString(), [], metadatas, errors);
634 });
635 }
636 else if (value instanceof Object) {
637 var targetSchema = typeof metadata.target === 'string' ? metadata.target : metadata.target.name;
638 _this.execute(value, targetSchema, errors);
639 }
640 else {
641 var error = new ValidationError();
642 error.value = value;
643 error.property = metadata.propertyName;
644 error.target = metadata.target;
645 var _b = _this.createValidationError(metadata.target, value, metadata), type = _b[0], message = _b[1];
646 error.constraints = (_a = {},
647 _a[type] = message,
648 _a);
649 errors.push(error);
650 }
651 });
652 };
653 ValidationExecutor.prototype.mapContexts = function (object, value, metadatas, error) {
654 var _this = this;
655 return metadatas.forEach(function (metadata) {
656 if (metadata.context) {
657 var customConstraint = void 0;
658 if (metadata.type === ValidationTypes.CUSTOM_VALIDATION) {
659 var customConstraints = _this.metadataStorage.getTargetValidatorConstraints(metadata.constraintCls);
660 customConstraint = customConstraints[0];
661 }
662 var type = _this.getConstraintType(metadata, customConstraint);
663 if (error.constraints[type]) {
664 if (!error.contexts) {
665 error.contexts = {};
666 }
667 error.contexts[type] = Object.assign(error.contexts[type] || {}, metadata.context);
668 }
669 }
670 });
671 };
672 ValidationExecutor.prototype.createValidationError = function (object, value, metadata, customValidatorMetadata) {
673 var targetName = object.constructor ? object.constructor.name : undefined;
674 var type = this.getConstraintType(metadata, customValidatorMetadata);
675 var validationArguments = {
676 targetName: targetName,
677 property: metadata.propertyName,
678 object: object,
679 value: value,
680 constraints: metadata.constraints,
681 };
682 var message = metadata.message || '';
683 if (!metadata.message &&
684 (!this.validatorOptions || (this.validatorOptions && !this.validatorOptions.dismissDefaultMessages))) {
685 if (customValidatorMetadata && customValidatorMetadata.instance.defaultMessage instanceof Function) {
686 message = customValidatorMetadata.instance.defaultMessage(validationArguments);
687 }
688 }
689 var messageString = ValidationUtils.replaceMessageSpecialTokens(message, validationArguments);
690 return [type, messageString];
691 };
692 ValidationExecutor.prototype.getConstraintType = function (metadata, customValidatorMetadata) {
693 var type = customValidatorMetadata && customValidatorMetadata.name ? customValidatorMetadata.name : metadata.type;
694 return type;
695 };
696 return ValidationExecutor;
697 }());
698
699 var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
700 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
701 return new (P || (P = Promise))(function (resolve, reject) {
702 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
703 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
704 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
705 step((generator = generator.apply(thisArg, _arguments || [])).next());
706 });
707 };
708 var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
709 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
710 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
711 function verb(n) { return function (v) { return step([n, v]); }; }
712 function step(op) {
713 if (f) throw new TypeError("Generator is already executing.");
714 while (_) try {
715 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
716 if (y = 0, t) op = [op[0] & 2, t.value];
717 switch (op[0]) {
718 case 0: case 1: t = op; break;
719 case 4: _.label++; return { value: op[1], done: false };
720 case 5: _.label++; y = op[1]; op = [0]; continue;
721 case 7: op = _.ops.pop(); _.trys.pop(); continue;
722 default:
723 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
724 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
725 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
726 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
727 if (t[2]) _.ops.pop();
728 _.trys.pop(); continue;
729 }
730 op = body.call(thisArg, _);
731 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
732 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
733 }
734 };
735 /**
736 * Validator performs validation of the given object based on its metadata.
737 */
738 var Validator = /** @class */ (function () {
739 function Validator() {
740 }
741 /**
742 * Performs validation of the given object based on decorators or validation schema.
743 */
744 Validator.prototype.validate = function (objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
745 return this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions);
746 };
747 /**
748 * Performs validation of the given object based on decorators or validation schema and reject on error.
749 */
750 Validator.prototype.validateOrReject = function (objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
751 return __awaiter(this, void 0, void 0, function () {
752 var errors;
753 return __generator(this, function (_a) {
754 switch (_a.label) {
755 case 0: return [4 /*yield*/, this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions)];
756 case 1:
757 errors = _a.sent();
758 if (errors.length)
759 return [2 /*return*/, Promise.reject(errors)];
760 return [2 /*return*/];
761 }
762 });
763 });
764 };
765 /**
766 * Performs validation of the given object based on decorators or validation schema.
767 */
768 Validator.prototype.validateSync = function (objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
769 var object = typeof objectOrSchemaName === 'string' ? objectOrValidationOptions : objectOrSchemaName;
770 var options = typeof objectOrSchemaName === 'string' ? maybeValidatorOptions : objectOrValidationOptions;
771 var schema = typeof objectOrSchemaName === 'string' ? objectOrSchemaName : undefined;
772 var executor = new ValidationExecutor(this, options);
773 executor.ignoreAsyncValidations = true;
774 var validationErrors = [];
775 executor.execute(object, schema, validationErrors);
776 return executor.stripEmptyErrors(validationErrors);
777 };
778 // -------------------------------------------------------------------------
779 // Private Properties
780 // -------------------------------------------------------------------------
781 /**
782 * Performs validation of the given object based on decorators or validation schema.
783 * Common method for `validateOrReject` and `validate` methods.
784 */
785 Validator.prototype.coreValidate = function (objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
786 var object = typeof objectOrSchemaName === 'string' ? objectOrValidationOptions : objectOrSchemaName;
787 var options = typeof objectOrSchemaName === 'string' ? maybeValidatorOptions : objectOrValidationOptions;
788 var schema = typeof objectOrSchemaName === 'string' ? objectOrSchemaName : undefined;
789 var executor = new ValidationExecutor(this, options);
790 var validationErrors = [];
791 executor.execute(object, schema, validationErrors);
792 return Promise.all(executor.awaitingPromises).then(function () {
793 return executor.stripEmptyErrors(validationErrors);
794 });
795 };
796 return Validator;
797 }());
798
799 /**
800 * Container to be used by this library for inversion control. If container was not implicitly set then by default
801 * container simply creates a new instance of the given class.
802 */
803 var defaultContainer = new (/** @class */ (function () {
804 function class_1() {
805 this.instances = [];
806 }
807 class_1.prototype.get = function (someClass) {
808 var instance = this.instances.find(function (instance) { return instance.type === someClass; });
809 if (!instance) {
810 instance = { type: someClass, object: new someClass() };
811 this.instances.push(instance);
812 }
813 return instance.object;
814 };
815 return class_1;
816 }()))();
817 var userContainer;
818 var userContainerOptions;
819 /**
820 * Sets container to be used by this library.
821 */
822 function useContainer(iocContainer, options) {
823 userContainer = iocContainer;
824 userContainerOptions = options;
825 }
826 /**
827 * Gets the IOC container used by this library.
828 */
829 function getFromContainer(someClass) {
830 if (userContainer) {
831 try {
832 var instance = userContainer.get(someClass);
833 if (instance)
834 return instance;
835 if (!userContainerOptions || !userContainerOptions.fallback)
836 return instance;
837 }
838 catch (error) {
839 if (!userContainerOptions || !userContainerOptions.fallbackOnErrors)
840 throw error;
841 }
842 }
843 return defaultContainer.get(someClass);
844 }
845
846 /**
847 * If object has both allowed and not allowed properties a validation error will be thrown.
848 */
849 function Allow(validationOptions) {
850 return function (object, propertyName) {
851 var args = {
852 type: ValidationTypes.WHITELIST,
853 target: object.constructor,
854 propertyName: propertyName,
855 validationOptions: validationOptions,
856 };
857 getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));
858 };
859 }
860
861 /**
862 * This metadata interface contains information for custom validators.
863 */
864 var ConstraintMetadata = /** @class */ (function () {
865 // -------------------------------------------------------------------------
866 // Constructor
867 // -------------------------------------------------------------------------
868 function ConstraintMetadata(target, name, async) {
869 if (async === void 0) { async = false; }
870 this.target = target;
871 this.name = name;
872 this.async = async;
873 }
874 Object.defineProperty(ConstraintMetadata.prototype, "instance", {
875 // -------------------------------------------------------------------------
876 // Accessors
877 // -------------------------------------------------------------------------
878 /**
879 * Instance of the target custom validation class which performs validation.
880 */
881 get: function () {
882 return getFromContainer(this.target);
883 },
884 enumerable: false,
885 configurable: true
886 });
887 return ConstraintMetadata;
888 }());
889
890 /**
891 * Registers a custom validation decorator.
892 */
893 function registerDecorator(options) {
894 var constraintCls;
895 if (options.validator instanceof Function) {
896 constraintCls = options.validator;
897 var constraintClasses = getFromContainer(MetadataStorage).getTargetValidatorConstraints(options.validator);
898 if (constraintClasses.length > 1) {
899 throw "More than one implementation of ValidatorConstraintInterface found for validator on: ".concat(options.target.name, ":").concat(options.propertyName);
900 }
901 }
902 else {
903 var validator_1 = options.validator;
904 constraintCls = /** @class */ (function () {
905 function CustomConstraint() {
906 }
907 CustomConstraint.prototype.validate = function (value, validationArguments) {
908 return validator_1.validate(value, validationArguments);
909 };
910 CustomConstraint.prototype.defaultMessage = function (validationArguments) {
911 if (validator_1.defaultMessage) {
912 return validator_1.defaultMessage(validationArguments);
913 }
914 return '';
915 };
916 return CustomConstraint;
917 }());
918 getMetadataStorage().addConstraintMetadata(new ConstraintMetadata(constraintCls, options.name, options.async));
919 }
920 var validationMetadataArgs = {
921 type: options.name && ValidationTypes.isValid(options.name) ? options.name : ValidationTypes.CUSTOM_VALIDATION,
922 target: options.target,
923 propertyName: options.propertyName,
924 validationOptions: options.options,
925 constraintCls: constraintCls,
926 constraints: options.constraints,
927 };
928 getMetadataStorage().addValidationMetadata(new ValidationMetadata(validationMetadataArgs));
929 }
930
931 function buildMessage(impl, validationOptions) {
932 return function (validationArguments) {
933 var eachPrefix = validationOptions && validationOptions.each ? 'each value in ' : '';
934 return impl(eachPrefix, validationArguments);
935 };
936 }
937 function ValidateBy(options, validationOptions) {
938 return function (object, propertyName) {
939 registerDecorator({
940 name: options.name,
941 target: object.constructor,
942 propertyName: propertyName,
943 options: validationOptions,
944 constraints: options.constraints,
945 validator: options.validator,
946 });
947 };
948 }
949
950 // isDefined is (yet) a special case
951 var IS_DEFINED = ValidationTypes.IS_DEFINED;
952 /**
953 * Checks if value is defined (!== undefined, !== null).
954 */
955 function isDefined(value) {
956 return value !== undefined && value !== null;
957 }
958 /**
959 * Checks if value is defined (!== undefined, !== null).
960 */
961 function IsDefined(validationOptions) {
962 return ValidateBy({
963 name: IS_DEFINED,
964 validator: {
965 validate: function (value) { return isDefined(value); },
966 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not be null or undefined'; }, validationOptions),
967 },
968 }, validationOptions);
969 }
970
971 /**
972 * Checks if value is missing and if so, ignores all validators.
973 */
974 function IsOptional(validationOptions) {
975 return function (object, propertyName) {
976 var args = {
977 type: ValidationTypes.CONDITIONAL_VALIDATION,
978 target: object.constructor,
979 propertyName: propertyName,
980 constraints: [
981 function (object, value) {
982 return object[propertyName] !== null && object[propertyName] !== undefined;
983 },
984 ],
985 validationOptions: validationOptions,
986 };
987 getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));
988 };
989 }
990
991 /**
992 * Registers custom validator class.
993 */
994 function ValidatorConstraint(options) {
995 return function (target) {
996 var isAsync = options && options.async;
997 var name = options && options.name ? options.name : '';
998 if (!name) {
999 name = target.name;
1000 if (!name)
1001 // generate name if it was not given
1002 name = name.replace(/\.?([A-Z]+)/g, function (x, y) { return '_' + y.toLowerCase(); }).replace(/^_/, '');
1003 }
1004 var metadata = new ConstraintMetadata(target, name, isAsync);
1005 getMetadataStorage().addConstraintMetadata(metadata);
1006 };
1007 }
1008 function Validate(constraintClass, constraintsOrValidationOptions, maybeValidationOptions) {
1009 return function (object, propertyName) {
1010 var args = {
1011 type: ValidationTypes.CUSTOM_VALIDATION,
1012 target: object.constructor,
1013 propertyName: propertyName,
1014 constraintCls: constraintClass,
1015 constraints: Array.isArray(constraintsOrValidationOptions) ? constraintsOrValidationOptions : undefined,
1016 validationOptions: !Array.isArray(constraintsOrValidationOptions)
1017 ? constraintsOrValidationOptions
1018 : maybeValidationOptions,
1019 };
1020 getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));
1021 };
1022 }
1023
1024 /**
1025 * Ignores the other validators on a property when the provided condition function returns false.
1026 */
1027 function ValidateIf(condition, validationOptions) {
1028 return function (object, propertyName) {
1029 var args = {
1030 type: ValidationTypes.CONDITIONAL_VALIDATION,
1031 target: object.constructor,
1032 propertyName: propertyName,
1033 constraints: [condition],
1034 validationOptions: validationOptions,
1035 };
1036 getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));
1037 };
1038 }
1039
1040 var __assign = (undefined && undefined.__assign) || function () {
1041 __assign = Object.assign || function(t) {
1042 for (var s, i = 1, n = arguments.length; i < n; i++) {
1043 s = arguments[i];
1044 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1045 t[p] = s[p];
1046 }
1047 return t;
1048 };
1049 return __assign.apply(this, arguments);
1050 };
1051 /**
1052 * Objects / object arrays marked with this decorator will also be validated.
1053 */
1054 function ValidateNested(validationOptions) {
1055 var opts = __assign({}, validationOptions);
1056 var eachPrefix = opts.each ? 'each value in ' : '';
1057 opts.message = opts.message || eachPrefix + 'nested property $property must be either object or array';
1058 return function (object, propertyName) {
1059 var args = {
1060 type: ValidationTypes.NESTED_VALIDATION,
1061 target: object.constructor,
1062 propertyName: propertyName,
1063 validationOptions: opts,
1064 };
1065 getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));
1066 };
1067 }
1068
1069 /**
1070 * Resolve promise before validation
1071 */
1072 function ValidatePromise(validationOptions) {
1073 return function (object, propertyName) {
1074 var args = {
1075 type: ValidationTypes.PROMISE_VALIDATION,
1076 target: object.constructor,
1077 propertyName: propertyName,
1078 validationOptions: validationOptions,
1079 };
1080 getMetadataStorage().addValidationMetadata(new ValidationMetadata(args));
1081 };
1082 }
1083
1084 function getDefaultExportFromCjs (x) {
1085 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1086 }
1087
1088 var isLatLong$1 = {exports: {}};
1089
1090 var assertString = {exports: {}};
1091
1092 (function (module, exports) {
1093
1094 Object.defineProperty(exports, "__esModule", {
1095 value: true
1096 });
1097 exports.default = assertString;
1098
1099 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1100
1101 function assertString(input) {
1102 var isString = typeof input === 'string' || input instanceof String;
1103
1104 if (!isString) {
1105 var invalidType = _typeof(input);
1106
1107 if (input === null) invalidType = 'null';else if (invalidType === 'object') invalidType = input.constructor.name;
1108 throw new TypeError("Expected a string but received a ".concat(invalidType));
1109 }
1110 }
1111
1112 module.exports = exports.default;
1113 module.exports.default = exports.default;
1114 }(assertString, assertString.exports));
1115
1116 var merge = {exports: {}};
1117
1118 (function (module, exports) {
1119
1120 Object.defineProperty(exports, "__esModule", {
1121 value: true
1122 });
1123 exports.default = merge;
1124
1125 function merge() {
1126 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1127 var defaults = arguments.length > 1 ? arguments[1] : undefined;
1128
1129 for (var key in defaults) {
1130 if (typeof obj[key] === 'undefined') {
1131 obj[key] = defaults[key];
1132 }
1133 }
1134
1135 return obj;
1136 }
1137
1138 module.exports = exports.default;
1139 module.exports.default = exports.default;
1140 }(merge, merge.exports));
1141
1142 (function (module, exports) {
1143
1144 Object.defineProperty(exports, "__esModule", {
1145 value: true
1146 });
1147 exports.default = isLatLong;
1148
1149 var _assertString = _interopRequireDefault(assertString.exports);
1150
1151 var _merge = _interopRequireDefault(merge.exports);
1152
1153 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1154
1155 var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/;
1156 var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;
1157 var latDMS = /^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i;
1158 var longDMS = /^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i;
1159 var defaultLatLongOptions = {
1160 checkDMS: false
1161 };
1162
1163 function isLatLong(str, options) {
1164 (0, _assertString.default)(str);
1165 options = (0, _merge.default)(options, defaultLatLongOptions);
1166 if (!str.includes(',')) return false;
1167 var pair = str.split(',');
1168 if (pair[0].startsWith('(') && !pair[1].endsWith(')') || pair[1].endsWith(')') && !pair[0].startsWith('(')) return false;
1169
1170 if (options.checkDMS) {
1171 return latDMS.test(pair[0]) && longDMS.test(pair[1]);
1172 }
1173
1174 return lat.test(pair[0]) && long.test(pair[1]);
1175 }
1176
1177 module.exports = exports.default;
1178 module.exports.default = exports.default;
1179 }(isLatLong$1, isLatLong$1.exports));
1180
1181 var isLatLongValidator = /*@__PURE__*/getDefaultExportFromCjs(isLatLong$1.exports);
1182
1183 var IS_LATLONG = 'isLatLong';
1184 /**
1185 * Checks if a value is string in format a "latitude,longitude".
1186 */
1187 function isLatLong(value) {
1188 return typeof value === 'string' && isLatLongValidator(value);
1189 }
1190 /**
1191 * Checks if a value is string in format a "latitude,longitude".
1192 */
1193 function IsLatLong(validationOptions) {
1194 return ValidateBy({
1195 name: IS_LATLONG,
1196 validator: {
1197 validate: function (value, args) { return isLatLong(value); },
1198 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a latitude,longitude string'; }, validationOptions),
1199 },
1200 }, validationOptions);
1201 }
1202
1203 var IS_LATITUDE = 'isLatitude';
1204 /**
1205 * Checks if a given value is a latitude.
1206 */
1207 function isLatitude(value) {
1208 return (typeof value === 'number' || typeof value === 'string') && isLatLong("".concat(value, ",0"));
1209 }
1210 /**
1211 * Checks if a given value is a latitude.
1212 */
1213 function IsLatitude(validationOptions) {
1214 return ValidateBy({
1215 name: IS_LATITUDE,
1216 validator: {
1217 validate: function (value, args) { return isLatitude(value); },
1218 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a latitude string or number'; }, validationOptions),
1219 },
1220 }, validationOptions);
1221 }
1222
1223 var IS_LONGITUDE = 'isLongitude';
1224 /**
1225 * Checks if a given value is a longitude.
1226 */
1227 function isLongitude(value) {
1228 return (typeof value === 'number' || typeof value === 'string') && isLatLong("0,".concat(value));
1229 }
1230 /**
1231 * Checks if a given value is a longitude.
1232 */
1233 function IsLongitude(validationOptions) {
1234 return ValidateBy({
1235 name: IS_LONGITUDE,
1236 validator: {
1237 validate: function (value, args) { return isLongitude(value); },
1238 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a longitude string or number'; }, validationOptions),
1239 },
1240 }, validationOptions);
1241 }
1242
1243 var EQUALS = 'equals';
1244 /**
1245 * Checks if value matches ("===") the comparison.
1246 */
1247 function equals(value, comparison) {
1248 return value === comparison;
1249 }
1250 /**
1251 * Checks if value matches ("===") the comparison.
1252 */
1253 function Equals(comparison, validationOptions) {
1254 return ValidateBy({
1255 name: EQUALS,
1256 constraints: [comparison],
1257 validator: {
1258 validate: function (value, args) { return equals(value, args.constraints[0]); },
1259 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be equal to $constraint1'; }, validationOptions),
1260 },
1261 }, validationOptions);
1262 }
1263
1264 var NOT_EQUALS = 'notEquals';
1265 /**
1266 * Checks if value does not match ("!==") the comparison.
1267 */
1268 function notEquals(value, comparison) {
1269 return value !== comparison;
1270 }
1271 /**
1272 * Checks if value does not match ("!==") the comparison.
1273 */
1274 function NotEquals(comparison, validationOptions) {
1275 return ValidateBy({
1276 name: NOT_EQUALS,
1277 constraints: [comparison],
1278 validator: {
1279 validate: function (value, args) { return notEquals(value, args.constraints[0]); },
1280 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not be equal to $constraint1'; }, validationOptions),
1281 },
1282 }, validationOptions);
1283 }
1284
1285 var IS_EMPTY = 'isEmpty';
1286 /**
1287 * Checks if given value is empty (=== '', === null, === undefined).
1288 */
1289 function isEmpty(value) {
1290 return value === '' || value === null || value === undefined;
1291 }
1292 /**
1293 * Checks if given value is empty (=== '', === null, === undefined).
1294 */
1295 function IsEmpty(validationOptions) {
1296 return ValidateBy({
1297 name: IS_EMPTY,
1298 validator: {
1299 validate: function (value, args) { return isEmpty(value); },
1300 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be empty'; }, validationOptions),
1301 },
1302 }, validationOptions);
1303 }
1304
1305 var IS_NOT_EMPTY = 'isNotEmpty';
1306 /**
1307 * Checks if given value is not empty (!== '', !== null, !== undefined).
1308 */
1309 function isNotEmpty(value) {
1310 return value !== '' && value !== null && value !== undefined;
1311 }
1312 /**
1313 * Checks if given value is not empty (!== '', !== null, !== undefined).
1314 */
1315 function IsNotEmpty(validationOptions) {
1316 return ValidateBy({
1317 name: IS_NOT_EMPTY,
1318 validator: {
1319 validate: function (value, args) { return isNotEmpty(value); },
1320 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not be empty'; }, validationOptions),
1321 },
1322 }, validationOptions);
1323 }
1324
1325 var IS_IN = 'isIn';
1326 /**
1327 * Checks if given value is in a array of allowed values.
1328 */
1329 function isIn(value, possibleValues) {
1330 return !Array.isArray(possibleValues) || possibleValues.some(function (possibleValue) { return possibleValue === value; });
1331 }
1332 /**
1333 * Checks if given value is in a array of allowed values.
1334 */
1335 function IsIn(values, validationOptions) {
1336 return ValidateBy({
1337 name: IS_IN,
1338 constraints: [values],
1339 validator: {
1340 validate: function (value, args) { return isIn(value, args.constraints[0]); },
1341 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be one of the following values: $constraint1'; }, validationOptions),
1342 },
1343 }, validationOptions);
1344 }
1345
1346 var IS_NOT_IN = 'isNotIn';
1347 /**
1348 * Checks if given value not in a array of allowed values.
1349 */
1350 function isNotIn(value, possibleValues) {
1351 return !Array.isArray(possibleValues) || !possibleValues.some(function (possibleValue) { return possibleValue === value; });
1352 }
1353 /**
1354 * Checks if given value not in a array of allowed values.
1355 */
1356 function IsNotIn(values, validationOptions) {
1357 return ValidateBy({
1358 name: IS_NOT_IN,
1359 constraints: [values],
1360 validator: {
1361 validate: function (value, args) { return isNotIn(value, args.constraints[0]); },
1362 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not be one of the following values: $constraint1'; }, validationOptions),
1363 },
1364 }, validationOptions);
1365 }
1366
1367 var isDivisibleBy$1 = {exports: {}};
1368
1369 var toFloat = {exports: {}};
1370
1371 var isFloat$1 = {};
1372
1373 var alpha$1 = {};
1374
1375 Object.defineProperty(alpha$1, "__esModule", {
1376 value: true
1377 });
1378 alpha$1.commaDecimal = alpha$1.dotDecimal = alpha$1.farsiLocales = alpha$1.arabicLocales = alpha$1.englishLocales = alpha$1.decimal = alpha$1.alphanumeric = alpha$1.alpha = void 0;
1379 var alpha = {
1380 'en-US': /^[A-Z]+$/i,
1381 'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
1382 'bg-BG': /^[А-Я]+$/i,
1383 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
1384 'da-DK': /^[A-ZÆØÅ]+$/i,
1385 'de-DE': /^[A-ZÄÖÜß]+$/i,
1386 'el-GR': /^[Α-ώ]+$/i,
1387 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,
1388 'fa-IR': /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
1389 'fi-FI': /^[A-ZÅÄÖ]+$/i,
1390 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
1391 'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
1392 'nb-NO': /^[A-ZÆØÅ]+$/i,
1393 'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
1394 'nn-NO': /^[A-ZÆØÅ]+$/i,
1395 'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
1396 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
1397 'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
1398 'ru-RU': /^[А-ЯЁ]+$/i,
1399 'sl-SI': /^[A-ZČĆĐŠŽ]+$/i,
1400 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
1401 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i,
1402 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i,
1403 'sv-SE': /^[A-ZÅÄÖ]+$/i,
1404 'th-TH': /^[ก-๐\s]+$/i,
1405 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
1406 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
1407 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
1408 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
1409 ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
1410 he: /^[א-ת]+$/,
1411 fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
1412 'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i
1413 };
1414 alpha$1.alpha = alpha;
1415 var alphanumeric = {
1416 'en-US': /^[0-9A-Z]+$/i,
1417 'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
1418 'bg-BG': /^[0-9А-Я]+$/i,
1419 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
1420 'da-DK': /^[0-9A-ZÆØÅ]+$/i,
1421 'de-DE': /^[0-9A-ZÄÖÜß]+$/i,
1422 'el-GR': /^[0-9Α-ω]+$/i,
1423 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
1424 'fi-FI': /^[0-9A-ZÅÄÖ]+$/i,
1425 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
1426 'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
1427 'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
1428 'nb-NO': /^[0-9A-ZÆØÅ]+$/i,
1429 'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
1430 'nn-NO': /^[0-9A-ZÆØÅ]+$/i,
1431 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
1432 'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
1433 'ru-RU': /^[0-9А-ЯЁ]+$/i,
1434 'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i,
1435 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
1436 'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i,
1437 'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
1438 'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
1439 'th-TH': /^[ก-๙\s]+$/i,
1440 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
1441 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
1442 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
1443 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
1444 ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
1445 he: /^[0-9א-ת]+$/,
1446 fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
1447 'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i
1448 };
1449 alpha$1.alphanumeric = alphanumeric;
1450 var decimal = {
1451 'en-US': '.',
1452 ar: '٫'
1453 };
1454 alpha$1.decimal = decimal;
1455 var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
1456 alpha$1.englishLocales = englishLocales;
1457
1458 for (var locale, i = 0; i < englishLocales.length; i++) {
1459 locale = "en-".concat(englishLocales[i]);
1460 alpha[locale] = alpha['en-US'];
1461 alphanumeric[locale] = alphanumeric['en-US'];
1462 decimal[locale] = decimal['en-US'];
1463 } // Source: http://www.localeplanet.com/java/
1464
1465
1466 var arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE'];
1467 alpha$1.arabicLocales = arabicLocales;
1468
1469 for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
1470 _locale = "ar-".concat(arabicLocales[_i]);
1471 alpha[_locale] = alpha.ar;
1472 alphanumeric[_locale] = alphanumeric.ar;
1473 decimal[_locale] = decimal.ar;
1474 }
1475
1476 var farsiLocales = ['IR', 'AF'];
1477 alpha$1.farsiLocales = farsiLocales;
1478
1479 for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
1480 _locale2 = "fa-".concat(farsiLocales[_i2]);
1481 alphanumeric[_locale2] = alphanumeric.fa;
1482 decimal[_locale2] = decimal.ar;
1483 } // Source: https://en.wikipedia.org/wiki/Decimal_mark
1484
1485
1486 var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
1487 alpha$1.dotDecimal = dotDecimal;
1488 var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hi-IN', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
1489 alpha$1.commaDecimal = commaDecimal;
1490
1491 for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
1492 decimal[dotDecimal[_i3]] = decimal['en-US'];
1493 }
1494
1495 for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
1496 decimal[commaDecimal[_i4]] = ',';
1497 }
1498
1499 alpha['fr-CA'] = alpha['fr-FR'];
1500 alphanumeric['fr-CA'] = alphanumeric['fr-FR'];
1501 alpha['pt-BR'] = alpha['pt-PT'];
1502 alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
1503 decimal['pt-BR'] = decimal['pt-PT']; // see #862
1504
1505 alpha['pl-Pl'] = alpha['pl-PL'];
1506 alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
1507 decimal['pl-Pl'] = decimal['pl-PL']; // see #1455
1508
1509 alpha['fa-AF'] = alpha.fa;
1510
1511 Object.defineProperty(isFloat$1, "__esModule", {
1512 value: true
1513 });
1514 isFloat$1.default = isFloat;
1515 isFloat$1.locales = void 0;
1516
1517 var _assertString$8 = _interopRequireDefault$8(assertString.exports);
1518
1519 var _alpha$2 = alpha$1;
1520
1521 function _interopRequireDefault$8(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1522
1523 function isFloat(str, options) {
1524 (0, _assertString$8.default)(str);
1525 options = options || {};
1526 var float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? _alpha$2.decimal[options.locale] : '.', "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"));
1527
1528 if (str === '' || str === '.' || str === '-' || str === '+') {
1529 return false;
1530 }
1531
1532 var value = parseFloat(str.replace(',', '.'));
1533 return float.test(str) && (!options.hasOwnProperty('min') || value >= options.min) && (!options.hasOwnProperty('max') || value <= options.max) && (!options.hasOwnProperty('lt') || value < options.lt) && (!options.hasOwnProperty('gt') || value > options.gt);
1534 }
1535
1536 var locales$5 = Object.keys(_alpha$2.decimal);
1537 isFloat$1.locales = locales$5;
1538
1539 (function (module, exports) {
1540
1541 Object.defineProperty(exports, "__esModule", {
1542 value: true
1543 });
1544 exports.default = toFloat;
1545
1546 var _isFloat = _interopRequireDefault(isFloat$1);
1547
1548 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1549
1550 function toFloat(str) {
1551 if (!(0, _isFloat.default)(str)) return NaN;
1552 return parseFloat(str);
1553 }
1554
1555 module.exports = exports.default;
1556 module.exports.default = exports.default;
1557 }(toFloat, toFloat.exports));
1558
1559 (function (module, exports) {
1560
1561 Object.defineProperty(exports, "__esModule", {
1562 value: true
1563 });
1564 exports.default = isDivisibleBy;
1565
1566 var _assertString = _interopRequireDefault(assertString.exports);
1567
1568 var _toFloat = _interopRequireDefault(toFloat.exports);
1569
1570 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1571
1572 function isDivisibleBy(str, num) {
1573 (0, _assertString.default)(str);
1574 return (0, _toFloat.default)(str) % parseInt(num, 10) === 0;
1575 }
1576
1577 module.exports = exports.default;
1578 module.exports.default = exports.default;
1579 }(isDivisibleBy$1, isDivisibleBy$1.exports));
1580
1581 var isDivisibleByValidator = /*@__PURE__*/getDefaultExportFromCjs(isDivisibleBy$1.exports);
1582
1583 var IS_DIVISIBLE_BY = 'isDivisibleBy';
1584 /**
1585 * Checks if value is a number that's divisible by another.
1586 */
1587 function isDivisibleBy(value, num) {
1588 return typeof value === 'number' && typeof num === 'number' && isDivisibleByValidator(String(value), num);
1589 }
1590 /**
1591 * Checks if value is a number that's divisible by another.
1592 */
1593 function IsDivisibleBy(num, validationOptions) {
1594 return ValidateBy({
1595 name: IS_DIVISIBLE_BY,
1596 constraints: [num],
1597 validator: {
1598 validate: function (value, args) { return isDivisibleBy(value, args.constraints[0]); },
1599 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be divisible by $constraint1'; }, validationOptions),
1600 },
1601 }, validationOptions);
1602 }
1603
1604 var IS_POSITIVE = 'isPositive';
1605 /**
1606 * Checks if the value is a positive number greater than zero.
1607 */
1608 function isPositive(value) {
1609 return typeof value === 'number' && value > 0;
1610 }
1611 /**
1612 * Checks if the value is a positive number greater than zero.
1613 */
1614 function IsPositive(validationOptions) {
1615 return ValidateBy({
1616 name: IS_POSITIVE,
1617 validator: {
1618 validate: function (value, args) { return isPositive(value); },
1619 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a positive number'; }, validationOptions),
1620 },
1621 }, validationOptions);
1622 }
1623
1624 var IS_NEGATIVE = 'isNegative';
1625 /**
1626 * Checks if the value is a negative number smaller than zero.
1627 */
1628 function isNegative(value) {
1629 return typeof value === 'number' && value < 0;
1630 }
1631 /**
1632 * Checks if the value is a negative number smaller than zero.
1633 */
1634 function IsNegative(validationOptions) {
1635 return ValidateBy({
1636 name: IS_NEGATIVE,
1637 validator: {
1638 validate: function (value, args) { return isNegative(value); },
1639 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a negative number'; }, validationOptions),
1640 },
1641 }, validationOptions);
1642 }
1643
1644 var MAX = 'max';
1645 /**
1646 * Checks if the first number is less than or equal to the second.
1647 */
1648 function max(num, max) {
1649 return typeof num === 'number' && typeof max === 'number' && num <= max;
1650 }
1651 /**
1652 * Checks if the first number is less than or equal to the second.
1653 */
1654 function Max(maxValue, validationOptions) {
1655 return ValidateBy({
1656 name: MAX,
1657 constraints: [maxValue],
1658 validator: {
1659 validate: function (value, args) { return max(value, args.constraints[0]); },
1660 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must not be greater than $constraint1'; }, validationOptions),
1661 },
1662 }, validationOptions);
1663 }
1664
1665 var MIN = 'min';
1666 /**
1667 * Checks if the first number is greater than or equal to the second.
1668 */
1669 function min(num, min) {
1670 return typeof num === 'number' && typeof min === 'number' && num >= min;
1671 }
1672 /**
1673 * Checks if the first number is greater than or equal to the second.
1674 */
1675 function Min(minValue, validationOptions) {
1676 return ValidateBy({
1677 name: MIN,
1678 constraints: [minValue],
1679 validator: {
1680 validate: function (value, args) { return min(value, args.constraints[0]); },
1681 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must not be less than $constraint1'; }, validationOptions),
1682 },
1683 }, validationOptions);
1684 }
1685
1686 var MIN_DATE = 'minDate';
1687 /**
1688 * Checks if the value is a date that's after the specified date.
1689 */
1690 function minDate(date, minDate) {
1691 return date instanceof Date && date.getTime() >= minDate.getTime();
1692 }
1693 /**
1694 * Checks if the value is a date that's after the specified date.
1695 */
1696 function MinDate(date, validationOptions) {
1697 return ValidateBy({
1698 name: MIN_DATE,
1699 constraints: [date],
1700 validator: {
1701 validate: function (value, args) { return minDate(value, args.constraints[0]); },
1702 defaultMessage: buildMessage(function (eachPrefix) { return 'minimal allowed date for ' + eachPrefix + '$property is $constraint1'; }, validationOptions),
1703 },
1704 }, validationOptions);
1705 }
1706
1707 var MAX_DATE = 'maxDate';
1708 /**
1709 * Checks if the value is a date that's before the specified date.
1710 */
1711 function maxDate(date, maxDate) {
1712 return date instanceof Date && date.getTime() <= maxDate.getTime();
1713 }
1714 /**
1715 * Checks if the value is a date that's after the specified date.
1716 */
1717 function MaxDate(date, validationOptions) {
1718 return ValidateBy({
1719 name: MAX_DATE,
1720 constraints: [date],
1721 validator: {
1722 validate: function (value, args) { return maxDate(value, args.constraints[0]); },
1723 defaultMessage: buildMessage(function (eachPrefix) { return 'maximal allowed date for ' + eachPrefix + '$property is $constraint1'; }, validationOptions),
1724 },
1725 }, validationOptions);
1726 }
1727
1728 var contains$1 = {exports: {}};
1729
1730 var toString = {exports: {}};
1731
1732 (function (module, exports) {
1733
1734 Object.defineProperty(exports, "__esModule", {
1735 value: true
1736 });
1737 exports.default = toString;
1738
1739 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1740
1741 function toString(input) {
1742 if (_typeof(input) === 'object' && input !== null) {
1743 if (typeof input.toString === 'function') {
1744 input = input.toString();
1745 } else {
1746 input = '[object Object]';
1747 }
1748 } else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) {
1749 input = '';
1750 }
1751
1752 return String(input);
1753 }
1754
1755 module.exports = exports.default;
1756 module.exports.default = exports.default;
1757 }(toString, toString.exports));
1758
1759 (function (module, exports) {
1760
1761 Object.defineProperty(exports, "__esModule", {
1762 value: true
1763 });
1764 exports.default = contains;
1765
1766 var _assertString = _interopRequireDefault(assertString.exports);
1767
1768 var _toString = _interopRequireDefault(toString.exports);
1769
1770 var _merge = _interopRequireDefault(merge.exports);
1771
1772 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1773
1774 var defaulContainsOptions = {
1775 ignoreCase: false,
1776 minOccurrences: 1
1777 };
1778
1779 function contains(str, elem, options) {
1780 (0, _assertString.default)(str);
1781 options = (0, _merge.default)(options, defaulContainsOptions);
1782
1783 if (options.ignoreCase) {
1784 return str.toLowerCase().split((0, _toString.default)(elem).toLowerCase()).length > options.minOccurrences;
1785 }
1786
1787 return str.split((0, _toString.default)(elem)).length > options.minOccurrences;
1788 }
1789
1790 module.exports = exports.default;
1791 module.exports.default = exports.default;
1792 }(contains$1, contains$1.exports));
1793
1794 var containsValidator = /*@__PURE__*/getDefaultExportFromCjs(contains$1.exports);
1795
1796 var CONTAINS = 'contains';
1797 /**
1798 * Checks if the string contains the seed.
1799 * If given value is not a string, then it returns false.
1800 */
1801 function contains(value, seed) {
1802 return typeof value === 'string' && containsValidator(value, seed);
1803 }
1804 /**
1805 * Checks if the string contains the seed.
1806 * If given value is not a string, then it returns false.
1807 */
1808 function Contains(seed, validationOptions) {
1809 return ValidateBy({
1810 name: CONTAINS,
1811 constraints: [seed],
1812 validator: {
1813 validate: function (value, args) { return contains(value, args.constraints[0]); },
1814 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain a $constraint1 string'; }, validationOptions),
1815 },
1816 }, validationOptions);
1817 }
1818
1819 var NOT_CONTAINS = 'notContains';
1820 /**
1821 * Checks if the string does not contain the seed.
1822 * If given value is not a string, then it returns false.
1823 */
1824 function notContains(value, seed) {
1825 return typeof value === 'string' && !containsValidator(value, seed);
1826 }
1827 /**
1828 * Checks if the string does not contain the seed.
1829 * If given value is not a string, then it returns false.
1830 */
1831 function NotContains(seed, validationOptions) {
1832 return ValidateBy({
1833 name: NOT_CONTAINS,
1834 constraints: [seed],
1835 validator: {
1836 validate: function (value, args) { return notContains(value, args.constraints[0]); },
1837 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not contain a $constraint1 string'; }, validationOptions),
1838 },
1839 }, validationOptions);
1840 }
1841
1842 var isAlpha$2 = {};
1843
1844 Object.defineProperty(isAlpha$2, "__esModule", {
1845 value: true
1846 });
1847 var _default$7 = isAlpha$2.default = isAlpha$1;
1848 isAlpha$2.locales = void 0;
1849
1850 var _assertString$7 = _interopRequireDefault$7(assertString.exports);
1851
1852 var _alpha$1 = alpha$1;
1853
1854 function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1855
1856 function isAlpha$1(_str) {
1857 var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
1858 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1859 (0, _assertString$7.default)(_str);
1860 var str = _str;
1861 var ignore = options.ignore;
1862
1863 if (ignore) {
1864 if (ignore instanceof RegExp) {
1865 str = str.replace(ignore, '');
1866 } else if (typeof ignore === 'string') {
1867 str = str.replace(new RegExp("[".concat(ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&'), "]"), 'g'), ''); // escape regex for ignore
1868 } else {
1869 throw new Error('ignore should be instance of a String or RegExp');
1870 }
1871 }
1872
1873 if (locale in _alpha$1.alpha) {
1874 return _alpha$1.alpha[locale].test(str);
1875 }
1876
1877 throw new Error("Invalid locale '".concat(locale, "'"));
1878 }
1879
1880 var locales$4 = Object.keys(_alpha$1.alpha);
1881 isAlpha$2.locales = locales$4;
1882
1883 var IS_ALPHA = 'isAlpha';
1884 /**
1885 * Checks if the string contains only letters (a-zA-Z).
1886 * If given value is not a string, then it returns false.
1887 */
1888 function isAlpha(value, locale) {
1889 return typeof value === 'string' && _default$7(value, locale);
1890 }
1891 /**
1892 * Checks if the string contains only letters (a-zA-Z).
1893 * If given value is not a string, then it returns false.
1894 */
1895 function IsAlpha(locale, validationOptions) {
1896 return ValidateBy({
1897 name: IS_ALPHA,
1898 constraints: [locale],
1899 validator: {
1900 validate: function (value, args) { return isAlpha(value, args.constraints[0]); },
1901 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain only letters (a-zA-Z)'; }, validationOptions),
1902 },
1903 }, validationOptions);
1904 }
1905
1906 var isAlphanumeric$2 = {};
1907
1908 Object.defineProperty(isAlphanumeric$2, "__esModule", {
1909 value: true
1910 });
1911 var _default$6 = isAlphanumeric$2.default = isAlphanumeric$1;
1912 isAlphanumeric$2.locales = void 0;
1913
1914 var _assertString$6 = _interopRequireDefault$6(assertString.exports);
1915
1916 var _alpha = alpha$1;
1917
1918 function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1919
1920 function isAlphanumeric$1(_str) {
1921 var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
1922 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1923 (0, _assertString$6.default)(_str);
1924 var str = _str;
1925 var ignore = options.ignore;
1926
1927 if (ignore) {
1928 if (ignore instanceof RegExp) {
1929 str = str.replace(ignore, '');
1930 } else if (typeof ignore === 'string') {
1931 str = str.replace(new RegExp("[".concat(ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&'), "]"), 'g'), ''); // escape regex for ignore
1932 } else {
1933 throw new Error('ignore should be instance of a String or RegExp');
1934 }
1935 }
1936
1937 if (locale in _alpha.alphanumeric) {
1938 return _alpha.alphanumeric[locale].test(str);
1939 }
1940
1941 throw new Error("Invalid locale '".concat(locale, "'"));
1942 }
1943
1944 var locales$3 = Object.keys(_alpha.alphanumeric);
1945 isAlphanumeric$2.locales = locales$3;
1946
1947 var IS_ALPHANUMERIC = 'isAlphanumeric';
1948 /**
1949 * Checks if the string contains only letters and numbers.
1950 * If given value is not a string, then it returns false.
1951 */
1952 function isAlphanumeric(value, locale) {
1953 return typeof value === 'string' && _default$6(value, locale);
1954 }
1955 /**
1956 * Checks if the string contains only letters and numbers.
1957 * If given value is not a string, then it returns false.
1958 */
1959 function IsAlphanumeric(locale, validationOptions) {
1960 return ValidateBy({
1961 name: IS_ALPHANUMERIC,
1962 constraints: [locale],
1963 validator: {
1964 validate: function (value, args) { return isAlphanumeric(value, args.constraints[0]); },
1965 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain only letters and numbers'; }, validationOptions),
1966 },
1967 }, validationOptions);
1968 }
1969
1970 var isDecimal$1 = {exports: {}};
1971
1972 var includes = {exports: {}};
1973
1974 (function (module, exports) {
1975
1976 Object.defineProperty(exports, "__esModule", {
1977 value: true
1978 });
1979 exports.default = void 0;
1980
1981 var includes = function includes(arr, val) {
1982 return arr.some(function (arrVal) {
1983 return val === arrVal;
1984 });
1985 };
1986
1987 var _default = includes;
1988 exports.default = _default;
1989 module.exports = exports.default;
1990 module.exports.default = exports.default;
1991 }(includes, includes.exports));
1992
1993 (function (module, exports) {
1994
1995 Object.defineProperty(exports, "__esModule", {
1996 value: true
1997 });
1998 exports.default = isDecimal;
1999
2000 var _merge = _interopRequireDefault(merge.exports);
2001
2002 var _assertString = _interopRequireDefault(assertString.exports);
2003
2004 var _includes = _interopRequireDefault(includes.exports);
2005
2006 var _alpha = alpha$1;
2007
2008 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2009
2010 function decimalRegExp(options) {
2011 var regExp = new RegExp("^[-+]?([0-9]+)?(\\".concat(_alpha.decimal[options.locale], "[0-9]{").concat(options.decimal_digits, "})").concat(options.force_decimal ? '' : '?', "$"));
2012 return regExp;
2013 }
2014
2015 var default_decimal_options = {
2016 force_decimal: false,
2017 decimal_digits: '1,',
2018 locale: 'en-US'
2019 };
2020 var blacklist = ['', '-', '+'];
2021
2022 function isDecimal(str, options) {
2023 (0, _assertString.default)(str);
2024 options = (0, _merge.default)(options, default_decimal_options);
2025
2026 if (options.locale in _alpha.decimal) {
2027 return !(0, _includes.default)(blacklist, str.replace(/ /g, '')) && decimalRegExp(options).test(str);
2028 }
2029
2030 throw new Error("Invalid locale '".concat(options.locale, "'"));
2031 }
2032
2033 module.exports = exports.default;
2034 module.exports.default = exports.default;
2035 }(isDecimal$1, isDecimal$1.exports));
2036
2037 var isDecimalValidator = /*@__PURE__*/getDefaultExportFromCjs(isDecimal$1.exports);
2038
2039 var IS_DECIMAL = 'isDecimal';
2040 /**
2041 * Checks if the string is a valid decimal.
2042 * If given value is not a string, then it returns false.
2043 */
2044 function isDecimal(value, options) {
2045 return typeof value === 'string' && isDecimalValidator(value, options);
2046 }
2047 /**
2048 * Checks if the string contains only letters and numbers.
2049 * If given value is not a string, then it returns false.
2050 */
2051 function IsDecimal(options, validationOptions) {
2052 return ValidateBy({
2053 name: IS_DECIMAL,
2054 constraints: [options],
2055 validator: {
2056 validate: function (value, args) { return isDecimal(value, args.constraints[0]); },
2057 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property is not a valid decimal number.'; }, validationOptions),
2058 },
2059 }, validationOptions);
2060 }
2061
2062 var isAscii$1 = {exports: {}};
2063
2064 (function (module, exports) {
2065
2066 Object.defineProperty(exports, "__esModule", {
2067 value: true
2068 });
2069 exports.default = isAscii;
2070
2071 var _assertString = _interopRequireDefault(assertString.exports);
2072
2073 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2074
2075 /* eslint-disable no-control-regex */
2076 var ascii = /^[\x00-\x7F]+$/;
2077 /* eslint-enable no-control-regex */
2078
2079 function isAscii(str) {
2080 (0, _assertString.default)(str);
2081 return ascii.test(str);
2082 }
2083
2084 module.exports = exports.default;
2085 module.exports.default = exports.default;
2086 }(isAscii$1, isAscii$1.exports));
2087
2088 var isAsciiValidator = /*@__PURE__*/getDefaultExportFromCjs(isAscii$1.exports);
2089
2090 var IS_ASCII = 'isAscii';
2091 /**
2092 * Checks if the string contains ASCII chars only.
2093 * If given value is not a string, then it returns false.
2094 */
2095 function isAscii(value) {
2096 return typeof value === 'string' && isAsciiValidator(value);
2097 }
2098 /**
2099 * Checks if the string contains ASCII chars only.
2100 * If given value is not a string, then it returns false.
2101 */
2102 function IsAscii(validationOptions) {
2103 return ValidateBy({
2104 name: IS_ASCII,
2105 validator: {
2106 validate: function (value, args) { return isAscii(value); },
2107 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain only ASCII characters'; }, validationOptions),
2108 },
2109 }, validationOptions);
2110 }
2111
2112 var isBase64$1 = {exports: {}};
2113
2114 (function (module, exports) {
2115
2116 Object.defineProperty(exports, "__esModule", {
2117 value: true
2118 });
2119 exports.default = isBase64;
2120
2121 var _assertString = _interopRequireDefault(assertString.exports);
2122
2123 var _merge = _interopRequireDefault(merge.exports);
2124
2125 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2126
2127 var notBase64 = /[^A-Z0-9+\/=]/i;
2128 var urlSafeBase64 = /^[A-Z0-9_\-]*$/i;
2129 var defaultBase64Options = {
2130 urlSafe: false
2131 };
2132
2133 function isBase64(str, options) {
2134 (0, _assertString.default)(str);
2135 options = (0, _merge.default)(options, defaultBase64Options);
2136 var len = str.length;
2137
2138 if (options.urlSafe) {
2139 return urlSafeBase64.test(str);
2140 }
2141
2142 if (len % 4 !== 0 || notBase64.test(str)) {
2143 return false;
2144 }
2145
2146 var firstPaddingChar = str.indexOf('=');
2147 return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '=';
2148 }
2149
2150 module.exports = exports.default;
2151 module.exports.default = exports.default;
2152 }(isBase64$1, isBase64$1.exports));
2153
2154 var isBase64Validator = /*@__PURE__*/getDefaultExportFromCjs(isBase64$1.exports);
2155
2156 var IS_BASE64 = 'isBase64';
2157 /**
2158 * Checks if a string is base64 encoded.
2159 * If given value is not a string, then it returns false.
2160 */
2161 function isBase64(value) {
2162 return typeof value === 'string' && isBase64Validator(value);
2163 }
2164 /**
2165 * Checks if a string is base64 encoded.
2166 * If given value is not a string, then it returns false.
2167 */
2168 function IsBase64(validationOptions) {
2169 return ValidateBy({
2170 name: IS_BASE64,
2171 validator: {
2172 validate: function (value, args) { return isBase64(value); },
2173 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be base64 encoded'; }, validationOptions),
2174 },
2175 }, validationOptions);
2176 }
2177
2178 var isByteLength$1 = {exports: {}};
2179
2180 (function (module, exports) {
2181
2182 Object.defineProperty(exports, "__esModule", {
2183 value: true
2184 });
2185 exports.default = isByteLength;
2186
2187 var _assertString = _interopRequireDefault(assertString.exports);
2188
2189 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2190
2191 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2192
2193 /* eslint-disable prefer-rest-params */
2194 function isByteLength(str, options) {
2195 (0, _assertString.default)(str);
2196 var min;
2197 var max;
2198
2199 if (_typeof(options) === 'object') {
2200 min = options.min || 0;
2201 max = options.max;
2202 } else {
2203 // backwards compatibility: isByteLength(str, min [, max])
2204 min = arguments[1];
2205 max = arguments[2];
2206 }
2207
2208 var len = encodeURI(str).split(/%..|./).length - 1;
2209 return len >= min && (typeof max === 'undefined' || len <= max);
2210 }
2211
2212 module.exports = exports.default;
2213 module.exports.default = exports.default;
2214 }(isByteLength$1, isByteLength$1.exports));
2215
2216 var isByteLengthValidator = /*@__PURE__*/getDefaultExportFromCjs(isByteLength$1.exports);
2217
2218 var IS_BYTE_LENGTH = 'isByteLength';
2219 /**
2220 * Checks if the string's length (in bytes) falls in a range.
2221 * If given value is not a string, then it returns false.
2222 */
2223 function isByteLength(value, min, max) {
2224 return typeof value === 'string' && isByteLengthValidator(value, { min: min, max: max });
2225 }
2226 /**
2227 * Checks if the string's length (in bytes) falls in a range.
2228 * If given value is not a string, then it returns false.
2229 */
2230 function IsByteLength(min, max, validationOptions) {
2231 return ValidateBy({
2232 name: IS_BYTE_LENGTH,
2233 constraints: [min, max],
2234 validator: {
2235 validate: function (value, args) { return isByteLength(value, args.constraints[0], args.constraints[1]); },
2236 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + "$property's byte length must fall into ($constraint1, $constraint2) range"; }, validationOptions),
2237 },
2238 }, validationOptions);
2239 }
2240
2241 var isCreditCard$1 = {exports: {}};
2242
2243 (function (module, exports) {
2244
2245 Object.defineProperty(exports, "__esModule", {
2246 value: true
2247 });
2248 exports.default = isCreditCard;
2249
2250 var _assertString = _interopRequireDefault(assertString.exports);
2251
2252 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2253
2254 /* eslint-disable max-len */
2255 var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
2256 /* eslint-enable max-len */
2257
2258 function isCreditCard(str) {
2259 (0, _assertString.default)(str);
2260 var sanitized = str.replace(/[- ]+/g, '');
2261
2262 if (!creditCard.test(sanitized)) {
2263 return false;
2264 }
2265
2266 var sum = 0;
2267 var digit;
2268 var tmpNum;
2269 var shouldDouble;
2270
2271 for (var i = sanitized.length - 1; i >= 0; i--) {
2272 digit = sanitized.substring(i, i + 1);
2273 tmpNum = parseInt(digit, 10);
2274
2275 if (shouldDouble) {
2276 tmpNum *= 2;
2277
2278 if (tmpNum >= 10) {
2279 sum += tmpNum % 10 + 1;
2280 } else {
2281 sum += tmpNum;
2282 }
2283 } else {
2284 sum += tmpNum;
2285 }
2286
2287 shouldDouble = !shouldDouble;
2288 }
2289
2290 return !!(sum % 10 === 0 ? sanitized : false);
2291 }
2292
2293 module.exports = exports.default;
2294 module.exports.default = exports.default;
2295 }(isCreditCard$1, isCreditCard$1.exports));
2296
2297 var isCreditCardValidator = /*@__PURE__*/getDefaultExportFromCjs(isCreditCard$1.exports);
2298
2299 var IS_CREDIT_CARD = 'isCreditCard';
2300 /**
2301 * Checks if the string is a credit card.
2302 * If given value is not a string, then it returns false.
2303 */
2304 function isCreditCard(value) {
2305 return typeof value === 'string' && isCreditCardValidator(value);
2306 }
2307 /**
2308 * Checks if the string is a credit card.
2309 * If given value is not a string, then it returns false.
2310 */
2311 function IsCreditCard(validationOptions) {
2312 return ValidateBy({
2313 name: IS_CREDIT_CARD,
2314 validator: {
2315 validate: function (value, args) { return isCreditCard(value); },
2316 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a credit card'; }, validationOptions),
2317 },
2318 }, validationOptions);
2319 }
2320
2321 var isCurrency$1 = {exports: {}};
2322
2323 (function (module, exports) {
2324
2325 Object.defineProperty(exports, "__esModule", {
2326 value: true
2327 });
2328 exports.default = isCurrency;
2329
2330 var _merge = _interopRequireDefault(merge.exports);
2331
2332 var _assertString = _interopRequireDefault(assertString.exports);
2333
2334 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2335
2336 function currencyRegex(options) {
2337 var decimal_digits = "\\d{".concat(options.digits_after_decimal[0], "}");
2338 options.digits_after_decimal.forEach(function (digit, index) {
2339 if (index !== 0) decimal_digits = "".concat(decimal_digits, "|\\d{").concat(digit, "}");
2340 });
2341 var symbol = "(".concat(options.symbol.replace(/\W/, function (m) {
2342 return "\\".concat(m);
2343 }), ")").concat(options.require_symbol ? '' : '?'),
2344 negative = '-?',
2345 whole_dollar_amount_without_sep = '[1-9]\\d*',
2346 whole_dollar_amount_with_sep = "[1-9]\\d{0,2}(\\".concat(options.thousands_separator, "\\d{3})*"),
2347 valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep],
2348 whole_dollar_amount = "(".concat(valid_whole_dollar_amounts.join('|'), ")?"),
2349 decimal_amount = "(\\".concat(options.decimal_separator, "(").concat(decimal_digits, "))").concat(options.require_decimal ? '' : '?');
2350 var pattern = whole_dollar_amount + (options.allow_decimal || options.require_decimal ? decimal_amount : ''); // default is negative sign before symbol, but there are two other options (besides parens)
2351
2352 if (options.allow_negatives && !options.parens_for_negatives) {
2353 if (options.negative_sign_after_digits) {
2354 pattern += negative;
2355 } else if (options.negative_sign_before_digits) {
2356 pattern = negative + pattern;
2357 }
2358 } // South African Rand, for example, uses R 123 (space) and R-123 (no space)
2359
2360
2361 if (options.allow_negative_sign_placeholder) {
2362 pattern = "( (?!\\-))?".concat(pattern);
2363 } else if (options.allow_space_after_symbol) {
2364 pattern = " ?".concat(pattern);
2365 } else if (options.allow_space_after_digits) {
2366 pattern += '( (?!$))?';
2367 }
2368
2369 if (options.symbol_after_digits) {
2370 pattern += symbol;
2371 } else {
2372 pattern = symbol + pattern;
2373 }
2374
2375 if (options.allow_negatives) {
2376 if (options.parens_for_negatives) {
2377 pattern = "(\\(".concat(pattern, "\\)|").concat(pattern, ")");
2378 } else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) {
2379 pattern = negative + pattern;
2380 }
2381 } // ensure there's a dollar and/or decimal amount, and that
2382 // it doesn't start with a space or a negative sign followed by a space
2383
2384
2385 return new RegExp("^(?!-? )(?=.*\\d)".concat(pattern, "$"));
2386 }
2387
2388 var default_currency_options = {
2389 symbol: '$',
2390 require_symbol: false,
2391 allow_space_after_symbol: false,
2392 symbol_after_digits: false,
2393 allow_negatives: true,
2394 parens_for_negatives: false,
2395 negative_sign_before_digits: false,
2396 negative_sign_after_digits: false,
2397 allow_negative_sign_placeholder: false,
2398 thousands_separator: ',',
2399 decimal_separator: '.',
2400 allow_decimal: true,
2401 require_decimal: false,
2402 digits_after_decimal: [2],
2403 allow_space_after_digits: false
2404 };
2405
2406 function isCurrency(str, options) {
2407 (0, _assertString.default)(str);
2408 options = (0, _merge.default)(options, default_currency_options);
2409 return currencyRegex(options).test(str);
2410 }
2411
2412 module.exports = exports.default;
2413 module.exports.default = exports.default;
2414 }(isCurrency$1, isCurrency$1.exports));
2415
2416 var isCurrencyValidator = /*@__PURE__*/getDefaultExportFromCjs(isCurrency$1.exports);
2417
2418 var IS_CURRENCY = 'isCurrency';
2419 /**
2420 * Checks if the string is a valid currency amount.
2421 * If given value is not a string, then it returns false.
2422 */
2423 function isCurrency(value, options) {
2424 return typeof value === 'string' && isCurrencyValidator(value, options);
2425 }
2426 /**
2427 * Checks if the string is a valid currency amount.
2428 * If given value is not a string, then it returns false.
2429 */
2430 function IsCurrency(options, validationOptions) {
2431 return ValidateBy({
2432 name: IS_CURRENCY,
2433 constraints: [options],
2434 validator: {
2435 validate: function (value, args) { return isCurrency(value, args.constraints[0]); },
2436 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a currency'; }, validationOptions),
2437 },
2438 }, validationOptions);
2439 }
2440
2441 var isEmail$1 = {exports: {}};
2442
2443 var isFQDN$1 = {exports: {}};
2444
2445 (function (module, exports) {
2446
2447 Object.defineProperty(exports, "__esModule", {
2448 value: true
2449 });
2450 exports.default = isFQDN;
2451
2452 var _assertString = _interopRequireDefault(assertString.exports);
2453
2454 var _merge = _interopRequireDefault(merge.exports);
2455
2456 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2457
2458 var default_fqdn_options = {
2459 require_tld: true,
2460 allow_underscores: false,
2461 allow_trailing_dot: false,
2462 allow_numeric_tld: false,
2463 allow_wildcard: false
2464 };
2465
2466 function isFQDN(str, options) {
2467 (0, _assertString.default)(str);
2468 options = (0, _merge.default)(options, default_fqdn_options);
2469 /* Remove the optional trailing dot before checking validity */
2470
2471 if (options.allow_trailing_dot && str[str.length - 1] === '.') {
2472 str = str.substring(0, str.length - 1);
2473 }
2474 /* Remove the optional wildcard before checking validity */
2475
2476
2477 if (options.allow_wildcard === true && str.indexOf('*.') === 0) {
2478 str = str.substring(2);
2479 }
2480
2481 var parts = str.split('.');
2482 var tld = parts[parts.length - 1];
2483
2484 if (options.require_tld) {
2485 // disallow fqdns without tld
2486 if (parts.length < 2) {
2487 return false;
2488 }
2489
2490 if (!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
2491 return false;
2492 } // disallow spaces
2493
2494
2495 if (/\s/.test(tld)) {
2496 return false;
2497 }
2498 } // reject numeric TLDs
2499
2500
2501 if (!options.allow_numeric_tld && /^\d+$/.test(tld)) {
2502 return false;
2503 }
2504
2505 return parts.every(function (part) {
2506 if (part.length > 63) {
2507 return false;
2508 }
2509
2510 if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) {
2511 return false;
2512 } // disallow full-width chars
2513
2514
2515 if (/[\uff01-\uff5e]/.test(part)) {
2516 return false;
2517 } // disallow parts starting or ending with hyphen
2518
2519
2520 if (/^-|-$/.test(part)) {
2521 return false;
2522 }
2523
2524 if (!options.allow_underscores && /_/.test(part)) {
2525 return false;
2526 }
2527
2528 return true;
2529 });
2530 }
2531
2532 module.exports = exports.default;
2533 module.exports.default = exports.default;
2534 }(isFQDN$1, isFQDN$1.exports));
2535
2536 var isFqdnValidator = /*@__PURE__*/getDefaultExportFromCjs(isFQDN$1.exports);
2537
2538 var isIP$1 = {exports: {}};
2539
2540 (function (module, exports) {
2541
2542 Object.defineProperty(exports, "__esModule", {
2543 value: true
2544 });
2545 exports.default = isIP;
2546
2547 var _assertString = _interopRequireDefault(assertString.exports);
2548
2549 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2550
2551 /**
2552 11.3. Examples
2553
2554 The following addresses
2555
2556 fe80::1234 (on the 1st link of the node)
2557 ff02::5678 (on the 5th link of the node)
2558 ff08::9abc (on the 10th organization of the node)
2559
2560 would be represented as follows:
2561
2562 fe80::1234%1
2563 ff02::5678%5
2564 ff08::9abc%10
2565
2566 (Here we assume a natural translation from a zone index to the
2567 <zone_id> part, where the Nth zone of any scope is translated into
2568 "N".)
2569
2570 If we use interface names as <zone_id>, those addresses could also be
2571 represented as follows:
2572
2573 fe80::1234%ne0
2574 ff02::5678%pvc1.3
2575 ff08::9abc%interface10
2576
2577 where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs
2578 to the 5th link, and "interface10" belongs to the 10th organization.
2579 * * */
2580 var IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
2581 var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
2582 var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$"));
2583 var IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})';
2584 var IPv6AddressRegExp = new RegExp('^(' + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ')(%[0-9a-zA-Z-.:]{1,})?$');
2585
2586 function isIP(str) {
2587 var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2588 (0, _assertString.default)(str);
2589 version = String(version);
2590
2591 if (!version) {
2592 return isIP(str, 4) || isIP(str, 6);
2593 }
2594
2595 if (version === '4') {
2596 if (!IPv4AddressRegExp.test(str)) {
2597 return false;
2598 }
2599
2600 var parts = str.split('.').sort(function (a, b) {
2601 return a - b;
2602 });
2603 return parts[3] <= 255;
2604 }
2605
2606 if (version === '6') {
2607 return !!IPv6AddressRegExp.test(str);
2608 }
2609
2610 return false;
2611 }
2612
2613 module.exports = exports.default;
2614 module.exports.default = exports.default;
2615 }(isIP$1, isIP$1.exports));
2616
2617 var isIPValidator = /*@__PURE__*/getDefaultExportFromCjs(isIP$1.exports);
2618
2619 (function (module, exports) {
2620
2621 Object.defineProperty(exports, "__esModule", {
2622 value: true
2623 });
2624 exports.default = isEmail;
2625
2626 var _assertString = _interopRequireDefault(assertString.exports);
2627
2628 var _merge = _interopRequireDefault(merge.exports);
2629
2630 var _isByteLength = _interopRequireDefault(isByteLength$1.exports);
2631
2632 var _isFQDN = _interopRequireDefault(isFQDN$1.exports);
2633
2634 var _isIP = _interopRequireDefault(isIP$1.exports);
2635
2636 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2637
2638 var default_email_options = {
2639 allow_display_name: false,
2640 require_display_name: false,
2641 allow_utf8_local_part: true,
2642 require_tld: true,
2643 blacklisted_chars: '',
2644 ignore_max_length: false,
2645 host_blacklist: []
2646 };
2647 /* eslint-disable max-len */
2648
2649 /* eslint-disable no-control-regex */
2650
2651 var splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i;
2652 var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
2653 var gmailUserPart = /^[a-z\d]+$/;
2654 var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
2655 var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
2656 var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;
2657 var defaultMaxEmailLength = 254;
2658 /* eslint-enable max-len */
2659
2660 /* eslint-enable no-control-regex */
2661
2662 /**
2663 * Validate display name according to the RFC2822: https://tools.ietf.org/html/rfc2822#appendix-A.1.2
2664 * @param {String} display_name
2665 */
2666
2667 function validateDisplayName(display_name) {
2668 var display_name_without_quotes = display_name.replace(/^"(.+)"$/, '$1'); // display name with only spaces is not valid
2669
2670 if (!display_name_without_quotes.trim()) {
2671 return false;
2672 } // check whether display name contains illegal character
2673
2674
2675 var contains_illegal = /[\.";<>]/.test(display_name_without_quotes);
2676
2677 if (contains_illegal) {
2678 // if contains illegal characters,
2679 // must to be enclosed in double-quotes, otherwise it's not a valid display name
2680 if (display_name_without_quotes === display_name) {
2681 return false;
2682 } // the quotes in display name must start with character symbol \
2683
2684
2685 var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length;
2686
2687 if (!all_start_with_back_slash) {
2688 return false;
2689 }
2690 }
2691
2692 return true;
2693 }
2694
2695 function isEmail(str, options) {
2696 (0, _assertString.default)(str);
2697 options = (0, _merge.default)(options, default_email_options);
2698
2699 if (options.require_display_name || options.allow_display_name) {
2700 var display_email = str.match(splitNameAddress);
2701
2702 if (display_email) {
2703 var display_name = display_email[1]; // Remove display name and angle brackets to get email address
2704 // Can be done in the regex but will introduce a ReDOS (See #1597 for more info)
2705
2706 str = str.replace(display_name, '').replace(/(^<|>$)/g, ''); // sometimes need to trim the last space to get the display name
2707 // because there may be a space between display name and email address
2708 // eg. myname <address@gmail.com>
2709 // the display name is `myname` instead of `myname `, so need to trim the last space
2710
2711 if (display_name.endsWith(' ')) {
2712 display_name = display_name.substr(0, display_name.length - 1);
2713 }
2714
2715 if (!validateDisplayName(display_name)) {
2716 return false;
2717 }
2718 } else if (options.require_display_name) {
2719 return false;
2720 }
2721 }
2722
2723 if (!options.ignore_max_length && str.length > defaultMaxEmailLength) {
2724 return false;
2725 }
2726
2727 var parts = str.split('@');
2728 var domain = parts.pop();
2729 var lower_domain = domain.toLowerCase();
2730
2731 if (options.host_blacklist.includes(lower_domain)) {
2732 return false;
2733 }
2734
2735 var user = parts.join('@');
2736
2737 if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) {
2738 /*
2739 Previously we removed dots for gmail addresses before validating.
2740 This was removed because it allows `multiple..dots@gmail.com`
2741 to be reported as valid, but it is not.
2742 Gmail only normalizes single dots, removing them from here is pointless,
2743 should be done in normalizeEmail
2744 */
2745 user = user.toLowerCase(); // Removing sub-address from username before gmail validation
2746
2747 var username = user.split('+')[0]; // Dots are not included in gmail length restriction
2748
2749 if (!(0, _isByteLength.default)(username.replace(/\./g, ''), {
2750 min: 6,
2751 max: 30
2752 })) {
2753 return false;
2754 }
2755
2756 var _user_parts = username.split('.');
2757
2758 for (var i = 0; i < _user_parts.length; i++) {
2759 if (!gmailUserPart.test(_user_parts[i])) {
2760 return false;
2761 }
2762 }
2763 }
2764
2765 if (options.ignore_max_length === false && (!(0, _isByteLength.default)(user, {
2766 max: 64
2767 }) || !(0, _isByteLength.default)(domain, {
2768 max: 254
2769 }))) {
2770 return false;
2771 }
2772
2773 if (!(0, _isFQDN.default)(domain, {
2774 require_tld: options.require_tld
2775 })) {
2776 if (!options.allow_ip_domain) {
2777 return false;
2778 }
2779
2780 if (!(0, _isIP.default)(domain)) {
2781 if (!domain.startsWith('[') || !domain.endsWith(']')) {
2782 return false;
2783 }
2784
2785 var noBracketdomain = domain.substr(1, domain.length - 2);
2786
2787 if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) {
2788 return false;
2789 }
2790 }
2791 }
2792
2793 if (user[0] === '"') {
2794 user = user.slice(1, user.length - 1);
2795 return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);
2796 }
2797
2798 var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;
2799 var user_parts = user.split('.');
2800
2801 for (var _i = 0; _i < user_parts.length; _i++) {
2802 if (!pattern.test(user_parts[_i])) {
2803 return false;
2804 }
2805 }
2806
2807 if (options.blacklisted_chars) {
2808 if (user.search(new RegExp("[".concat(options.blacklisted_chars, "]+"), 'g')) !== -1) return false;
2809 }
2810
2811 return true;
2812 }
2813
2814 module.exports = exports.default;
2815 module.exports.default = exports.default;
2816 }(isEmail$1, isEmail$1.exports));
2817
2818 var isEmailValidator = /*@__PURE__*/getDefaultExportFromCjs(isEmail$1.exports);
2819
2820 var IS_EMAIL = 'isEmail';
2821 /**
2822 * Checks if the string is an email.
2823 * If given value is not a string, then it returns false.
2824 */
2825 function isEmail(value, options) {
2826 return typeof value === 'string' && isEmailValidator(value, options);
2827 }
2828 /**
2829 * Checks if the string is an email.
2830 * If given value is not a string, then it returns false.
2831 */
2832 function IsEmail(options, validationOptions) {
2833 return ValidateBy({
2834 name: IS_EMAIL,
2835 constraints: [options],
2836 validator: {
2837 validate: function (value, args) { return isEmail(value, args.constraints[0]); },
2838 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an email'; }, validationOptions),
2839 },
2840 }, validationOptions);
2841 }
2842
2843 var IS_FQDN = 'isFqdn';
2844 /**
2845 * Checks if the string is a fully qualified domain name (e.g. domain.com).
2846 * If given value is not a string, then it returns false.
2847 */
2848 function isFQDN(value, options) {
2849 return typeof value === 'string' && isFqdnValidator(value, options);
2850 }
2851 /**
2852 * Checks if the string is a fully qualified domain name (e.g. domain.com).
2853 * If given value is not a string, then it returns false.
2854 */
2855 function IsFQDN(options, validationOptions) {
2856 return ValidateBy({
2857 name: IS_FQDN,
2858 constraints: [options],
2859 validator: {
2860 validate: function (value, args) { return isFQDN(value, args.constraints[0]); },
2861 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid domain name'; }, validationOptions),
2862 },
2863 }, validationOptions);
2864 }
2865
2866 var isFullWidth$2 = {};
2867
2868 Object.defineProperty(isFullWidth$2, "__esModule", {
2869 value: true
2870 });
2871 var _default$5 = isFullWidth$2.default = isFullWidth$1;
2872 isFullWidth$2.fullWidth = void 0;
2873
2874 var _assertString$5 = _interopRequireDefault$5(assertString.exports);
2875
2876 function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2877
2878 var fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;
2879 isFullWidth$2.fullWidth = fullWidth;
2880
2881 function isFullWidth$1(str) {
2882 (0, _assertString$5.default)(str);
2883 return fullWidth.test(str);
2884 }
2885
2886 var IS_FULL_WIDTH = 'isFullWidth';
2887 /**
2888 * Checks if the string contains any full-width chars.
2889 * If given value is not a string, then it returns false.
2890 */
2891 function isFullWidth(value) {
2892 return typeof value === 'string' && _default$5(value);
2893 }
2894 /**
2895 * Checks if the string contains any full-width chars.
2896 * If given value is not a string, then it returns false.
2897 */
2898 function IsFullWidth(validationOptions) {
2899 return ValidateBy({
2900 name: IS_FULL_WIDTH,
2901 validator: {
2902 validate: function (value, args) { return isFullWidth(value); },
2903 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain a full-width characters'; }, validationOptions),
2904 },
2905 }, validationOptions);
2906 }
2907
2908 var isHalfWidth$2 = {};
2909
2910 Object.defineProperty(isHalfWidth$2, "__esModule", {
2911 value: true
2912 });
2913 var _default$4 = isHalfWidth$2.default = isHalfWidth$1;
2914 isHalfWidth$2.halfWidth = void 0;
2915
2916 var _assertString$4 = _interopRequireDefault$4(assertString.exports);
2917
2918 function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2919
2920 var halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;
2921 isHalfWidth$2.halfWidth = halfWidth;
2922
2923 function isHalfWidth$1(str) {
2924 (0, _assertString$4.default)(str);
2925 return halfWidth.test(str);
2926 }
2927
2928 var IS_HALF_WIDTH = 'isHalfWidth';
2929 /**
2930 * Checks if the string contains any half-width chars.
2931 * If given value is not a string, then it returns false.
2932 */
2933 function isHalfWidth(value) {
2934 return typeof value === 'string' && _default$4(value);
2935 }
2936 /**
2937 * Checks if the string contains any full-width chars.
2938 * If given value is not a string, then it returns false.
2939 */
2940 function IsHalfWidth(validationOptions) {
2941 return ValidateBy({
2942 name: IS_HALF_WIDTH,
2943 validator: {
2944 validate: function (value, args) { return isHalfWidth(value); },
2945 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain a half-width characters'; }, validationOptions),
2946 },
2947 }, validationOptions);
2948 }
2949
2950 var isVariableWidth$1 = {exports: {}};
2951
2952 (function (module, exports) {
2953
2954 Object.defineProperty(exports, "__esModule", {
2955 value: true
2956 });
2957 exports.default = isVariableWidth;
2958
2959 var _assertString = _interopRequireDefault(assertString.exports);
2960
2961 var _isFullWidth = isFullWidth$2;
2962
2963 var _isHalfWidth = isHalfWidth$2;
2964
2965 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2966
2967 function isVariableWidth(str) {
2968 (0, _assertString.default)(str);
2969 return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str);
2970 }
2971
2972 module.exports = exports.default;
2973 module.exports.default = exports.default;
2974 }(isVariableWidth$1, isVariableWidth$1.exports));
2975
2976 var isVariableWidthValidator = /*@__PURE__*/getDefaultExportFromCjs(isVariableWidth$1.exports);
2977
2978 var IS_VARIABLE_WIDTH = 'isVariableWidth';
2979 /**
2980 * Checks if the string contains variable-width chars.
2981 * If given value is not a string, then it returns false.
2982 */
2983 function isVariableWidth(value) {
2984 return typeof value === 'string' && isVariableWidthValidator(value);
2985 }
2986 /**
2987 * Checks if the string contains variable-width chars.
2988 * If given value is not a string, then it returns false.
2989 */
2990 function IsVariableWidth(validationOptions) {
2991 return ValidateBy({
2992 name: IS_VARIABLE_WIDTH,
2993 validator: {
2994 validate: function (value, args) { return isVariableWidth(value); },
2995 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain a full-width and half-width characters'; }, validationOptions),
2996 },
2997 }, validationOptions);
2998 }
2999
3000 var isHexColor$1 = {exports: {}};
3001
3002 (function (module, exports) {
3003
3004 Object.defineProperty(exports, "__esModule", {
3005 value: true
3006 });
3007 exports.default = isHexColor;
3008
3009 var _assertString = _interopRequireDefault(assertString.exports);
3010
3011 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3012
3013 var hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i;
3014
3015 function isHexColor(str) {
3016 (0, _assertString.default)(str);
3017 return hexcolor.test(str);
3018 }
3019
3020 module.exports = exports.default;
3021 module.exports.default = exports.default;
3022 }(isHexColor$1, isHexColor$1.exports));
3023
3024 var isHexColorValidator = /*@__PURE__*/getDefaultExportFromCjs(isHexColor$1.exports);
3025
3026 var IS_HEX_COLOR = 'isHexColor';
3027 /**
3028 * Checks if the string is a hexadecimal color.
3029 * If given value is not a string, then it returns false.
3030 */
3031 function isHexColor(value) {
3032 return typeof value === 'string' && isHexColorValidator(value);
3033 }
3034 /**
3035 * Checks if the string is a hexadecimal color.
3036 * If given value is not a string, then it returns false.
3037 */
3038 function IsHexColor(validationOptions) {
3039 return ValidateBy({
3040 name: IS_HEX_COLOR,
3041 validator: {
3042 validate: function (value, args) { return isHexColor(value); },
3043 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a hexadecimal color'; }, validationOptions),
3044 },
3045 }, validationOptions);
3046 }
3047
3048 var isHexadecimal$1 = {exports: {}};
3049
3050 (function (module, exports) {
3051
3052 Object.defineProperty(exports, "__esModule", {
3053 value: true
3054 });
3055 exports.default = isHexadecimal;
3056
3057 var _assertString = _interopRequireDefault(assertString.exports);
3058
3059 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3060
3061 var hexadecimal = /^(0x|0h)?[0-9A-F]+$/i;
3062
3063 function isHexadecimal(str) {
3064 (0, _assertString.default)(str);
3065 return hexadecimal.test(str);
3066 }
3067
3068 module.exports = exports.default;
3069 module.exports.default = exports.default;
3070 }(isHexadecimal$1, isHexadecimal$1.exports));
3071
3072 var isHexadecimalValidator = /*@__PURE__*/getDefaultExportFromCjs(isHexadecimal$1.exports);
3073
3074 var IS_HEXADECIMAL = 'isHexadecimal';
3075 /**
3076 * Checks if the string is a hexadecimal number.
3077 * If given value is not a string, then it returns false.
3078 */
3079 function isHexadecimal(value) {
3080 return typeof value === 'string' && isHexadecimalValidator(value);
3081 }
3082 /**
3083 * Checks if the string is a hexadecimal number.
3084 * If given value is not a string, then it returns false.
3085 */
3086 function IsHexadecimal(validationOptions) {
3087 return ValidateBy({
3088 name: IS_HEXADECIMAL,
3089 validator: {
3090 validate: function (value, args) { return isHexadecimal(value); },
3091 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a hexadecimal number'; }, validationOptions),
3092 },
3093 }, validationOptions);
3094 }
3095
3096 function isValidationOptions(val) {
3097 if (!val) {
3098 return false;
3099 }
3100 return 'each' in val || 'message' in val || 'groups' in val || 'always' in val || 'context' in val;
3101 }
3102
3103 var isMACAddress$1 = {exports: {}};
3104
3105 (function (module, exports) {
3106
3107 Object.defineProperty(exports, "__esModule", {
3108 value: true
3109 });
3110 exports.default = isMACAddress;
3111
3112 var _assertString = _interopRequireDefault(assertString.exports);
3113
3114 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3115
3116 var macAddress = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/;
3117 var macAddressNoSeparators = /^([0-9a-fA-F]){12}$/;
3118 var macAddressWithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/;
3119
3120 function isMACAddress(str, options) {
3121 (0, _assertString.default)(str);
3122 /**
3123 * @deprecated `no_colons` TODO: remove it in the next major
3124 */
3125
3126 if (options && (options.no_colons || options.no_separators)) {
3127 return macAddressNoSeparators.test(str);
3128 }
3129
3130 return macAddress.test(str) || macAddressWithDots.test(str);
3131 }
3132
3133 module.exports = exports.default;
3134 module.exports.default = exports.default;
3135 }(isMACAddress$1, isMACAddress$1.exports));
3136
3137 var isMacAddressValidator = /*@__PURE__*/getDefaultExportFromCjs(isMACAddress$1.exports);
3138
3139 var IS_MAC_ADDRESS = 'isMacAddress';
3140 /**
3141 * Check if the string is a MAC address.
3142 * If given value is not a string, then it returns false.
3143 */
3144 function isMACAddress(value, options) {
3145 return typeof value === 'string' && isMacAddressValidator(value, options);
3146 }
3147 function IsMACAddress(optionsOrValidationOptionsArg, validationOptionsArg) {
3148 var options = !isValidationOptions(optionsOrValidationOptionsArg) ? optionsOrValidationOptionsArg : undefined;
3149 var validationOptions = isValidationOptions(optionsOrValidationOptionsArg)
3150 ? optionsOrValidationOptionsArg
3151 : validationOptionsArg;
3152 return ValidateBy({
3153 name: IS_MAC_ADDRESS,
3154 constraints: [options],
3155 validator: {
3156 validate: function (value, args) { return isMACAddress(value, options); },
3157 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a MAC Address'; }, validationOptions),
3158 },
3159 }, validationOptions);
3160 }
3161
3162 var IS_IP = 'isIp';
3163 /**
3164 * Checks if the string is an IP (version 4 or 6).
3165 * If given value is not a string, then it returns false.
3166 */
3167 function isIP(value, version) {
3168 /* eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion */
3169 var versionStr = version ? "".concat(version) : undefined;
3170 return typeof value === 'string' && isIPValidator(value, versionStr);
3171 }
3172 /**
3173 * Checks if the string is an IP (version 4 or 6).
3174 * If given value is not a string, then it returns false.
3175 */
3176 function IsIP(version, validationOptions) {
3177 return ValidateBy({
3178 name: IS_IP,
3179 constraints: [version],
3180 validator: {
3181 validate: function (value, args) { return isIP(value, args.constraints[0]); },
3182 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an ip address'; }, validationOptions),
3183 },
3184 }, validationOptions);
3185 }
3186
3187 var isPort$1 = {exports: {}};
3188
3189 var isInt$1 = {exports: {}};
3190
3191 (function (module, exports) {
3192
3193 Object.defineProperty(exports, "__esModule", {
3194 value: true
3195 });
3196 exports.default = isInt;
3197
3198 var _assertString = _interopRequireDefault(assertString.exports);
3199
3200 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3201
3202 var int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/;
3203 var intLeadingZeroes = /^[-+]?[0-9]+$/;
3204
3205 function isInt(str, options) {
3206 (0, _assertString.default)(str);
3207 options = options || {}; // Get the regex to use for testing, based on whether
3208 // leading zeroes are allowed or not.
3209
3210 var regex = options.hasOwnProperty('allow_leading_zeroes') && !options.allow_leading_zeroes ? int : intLeadingZeroes; // Check min/max/lt/gt
3211
3212 var minCheckPassed = !options.hasOwnProperty('min') || str >= options.min;
3213 var maxCheckPassed = !options.hasOwnProperty('max') || str <= options.max;
3214 var ltCheckPassed = !options.hasOwnProperty('lt') || str < options.lt;
3215 var gtCheckPassed = !options.hasOwnProperty('gt') || str > options.gt;
3216 return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed;
3217 }
3218
3219 module.exports = exports.default;
3220 module.exports.default = exports.default;
3221 }(isInt$1, isInt$1.exports));
3222
3223 (function (module, exports) {
3224
3225 Object.defineProperty(exports, "__esModule", {
3226 value: true
3227 });
3228 exports.default = isPort;
3229
3230 var _isInt = _interopRequireDefault(isInt$1.exports);
3231
3232 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3233
3234 function isPort(str) {
3235 return (0, _isInt.default)(str, {
3236 min: 0,
3237 max: 65535
3238 });
3239 }
3240
3241 module.exports = exports.default;
3242 module.exports.default = exports.default;
3243 }(isPort$1, isPort$1.exports));
3244
3245 var isPortValidator = /*@__PURE__*/getDefaultExportFromCjs(isPort$1.exports);
3246
3247 var IS_PORT = 'isPort';
3248 /**
3249 * Check if the string is a valid port number.
3250 */
3251 function isPort(value) {
3252 return typeof value === 'string' && isPortValidator(value);
3253 }
3254 /**
3255 * Check if the string is a valid port number.
3256 */
3257 function IsPort(validationOptions) {
3258 return ValidateBy({
3259 name: IS_PORT,
3260 validator: {
3261 validate: function (value, args) { return isPort(value); },
3262 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a port'; }, validationOptions),
3263 },
3264 }, validationOptions);
3265 }
3266
3267 var isISBN$1 = {exports: {}};
3268
3269 (function (module, exports) {
3270
3271 Object.defineProperty(exports, "__esModule", {
3272 value: true
3273 });
3274 exports.default = isISBN;
3275
3276 var _assertString = _interopRequireDefault(assertString.exports);
3277
3278 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3279
3280 var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/;
3281 var isbn13Maybe = /^(?:[0-9]{13})$/;
3282 var factor = [1, 3];
3283
3284 function isISBN(str) {
3285 var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3286 (0, _assertString.default)(str);
3287 version = String(version);
3288
3289 if (!version) {
3290 return isISBN(str, 10) || isISBN(str, 13);
3291 }
3292
3293 var sanitized = str.replace(/[\s-]+/g, '');
3294 var checksum = 0;
3295 var i;
3296
3297 if (version === '10') {
3298 if (!isbn10Maybe.test(sanitized)) {
3299 return false;
3300 }
3301
3302 for (i = 0; i < 9; i++) {
3303 checksum += (i + 1) * sanitized.charAt(i);
3304 }
3305
3306 if (sanitized.charAt(9) === 'X') {
3307 checksum += 10 * 10;
3308 } else {
3309 checksum += 10 * sanitized.charAt(9);
3310 }
3311
3312 if (checksum % 11 === 0) {
3313 return !!sanitized;
3314 }
3315 } else if (version === '13') {
3316 if (!isbn13Maybe.test(sanitized)) {
3317 return false;
3318 }
3319
3320 for (i = 0; i < 12; i++) {
3321 checksum += factor[i % 2] * sanitized.charAt(i);
3322 }
3323
3324 if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) {
3325 return !!sanitized;
3326 }
3327 }
3328
3329 return false;
3330 }
3331
3332 module.exports = exports.default;
3333 module.exports.default = exports.default;
3334 }(isISBN$1, isISBN$1.exports));
3335
3336 var isIsbnValidator = /*@__PURE__*/getDefaultExportFromCjs(isISBN$1.exports);
3337
3338 var IS_ISBN = 'isIsbn';
3339 /**
3340 * Checks if the string is an ISBN (version 10 or 13).
3341 * If given value is not a string, then it returns false.
3342 */
3343 function isISBN(value, version) {
3344 /* eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion */
3345 var versionStr = version ? "".concat(version) : undefined;
3346 return typeof value === 'string' && isIsbnValidator(value, versionStr);
3347 }
3348 /**
3349 * Checks if the string is an ISBN (version 10 or 13).
3350 * If given value is not a string, then it returns false.
3351 */
3352 function IsISBN(version, validationOptions) {
3353 return ValidateBy({
3354 name: IS_ISBN,
3355 constraints: [version],
3356 validator: {
3357 validate: function (value, args) { return isISBN(value, args.constraints[0]); },
3358 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an ISBN'; }, validationOptions),
3359 },
3360 }, validationOptions);
3361 }
3362
3363 var isISIN$1 = {exports: {}};
3364
3365 (function (module, exports) {
3366
3367 Object.defineProperty(exports, "__esModule", {
3368 value: true
3369 });
3370 exports.default = isISIN;
3371
3372 var _assertString = _interopRequireDefault(assertString.exports);
3373
3374 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3375
3376 var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; // this link details how the check digit is calculated:
3377 // https://www.isin.org/isin-format/. it is a little bit
3378 // odd in that it works with digits, not numbers. in order
3379 // to make only one pass through the ISIN characters, the
3380 // each alpha character is handled as 2 characters within
3381 // the loop.
3382
3383 function isISIN(str) {
3384 (0, _assertString.default)(str);
3385
3386 if (!isin.test(str)) {
3387 return false;
3388 }
3389
3390 var double = true;
3391 var sum = 0; // convert values
3392
3393 for (var i = str.length - 2; i >= 0; i--) {
3394 if (str[i] >= 'A' && str[i] <= 'Z') {
3395 var value = str[i].charCodeAt(0) - 55;
3396 var lo = value % 10;
3397 var hi = Math.trunc(value / 10); // letters have two digits, so handle the low order
3398 // and high order digits separately.
3399
3400 for (var _i = 0, _arr = [lo, hi]; _i < _arr.length; _i++) {
3401 var digit = _arr[_i];
3402
3403 if (double) {
3404 if (digit >= 5) {
3405 sum += 1 + (digit - 5) * 2;
3406 } else {
3407 sum += digit * 2;
3408 }
3409 } else {
3410 sum += digit;
3411 }
3412
3413 double = !double;
3414 }
3415 } else {
3416 var _digit = str[i].charCodeAt(0) - '0'.charCodeAt(0);
3417
3418 if (double) {
3419 if (_digit >= 5) {
3420 sum += 1 + (_digit - 5) * 2;
3421 } else {
3422 sum += _digit * 2;
3423 }
3424 } else {
3425 sum += _digit;
3426 }
3427
3428 double = !double;
3429 }
3430 }
3431
3432 var check = Math.trunc((sum + 9) / 10) * 10 - sum;
3433 return +str[str.length - 1] === check;
3434 }
3435
3436 module.exports = exports.default;
3437 module.exports.default = exports.default;
3438 }(isISIN$1, isISIN$1.exports));
3439
3440 var isIsinValidator = /*@__PURE__*/getDefaultExportFromCjs(isISIN$1.exports);
3441
3442 var IS_ISIN = 'isIsin';
3443 /**
3444 * Checks if the string is an ISIN (stock/security identifier).
3445 * If given value is not a string, then it returns false.
3446 */
3447 function isISIN(value) {
3448 return typeof value === 'string' && isIsinValidator(value);
3449 }
3450 /**
3451 * Checks if the string is an ISIN (stock/security identifier).
3452 * If given value is not a string, then it returns false.
3453 */
3454 function IsISIN(validationOptions) {
3455 return ValidateBy({
3456 name: IS_ISIN,
3457 validator: {
3458 validate: function (value, args) { return isISIN(value); },
3459 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an ISIN (stock/security identifier)'; }, validationOptions),
3460 },
3461 }, validationOptions);
3462 }
3463
3464 var isISO8601$1 = {exports: {}};
3465
3466 (function (module, exports) {
3467
3468 Object.defineProperty(exports, "__esModule", {
3469 value: true
3470 });
3471 exports.default = isISO8601;
3472
3473 var _assertString = _interopRequireDefault(assertString.exports);
3474
3475 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3476
3477 /* eslint-disable max-len */
3478 // from http://goo.gl/0ejHHW
3479 var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; // same as above, except with a strict 'T' separator between date and time
3480
3481 var iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
3482 /* eslint-enable max-len */
3483
3484 var isValidDate = function isValidDate(str) {
3485 // str must have passed the ISO8601 check
3486 // this check is meant to catch invalid dates
3487 // like 2009-02-31
3488 // first check for ordinal dates
3489 var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
3490
3491 if (ordinalMatch) {
3492 var oYear = Number(ordinalMatch[1]);
3493 var oDay = Number(ordinalMatch[2]); // if is leap year
3494
3495 if (oYear % 4 === 0 && oYear % 100 !== 0 || oYear % 400 === 0) return oDay <= 366;
3496 return oDay <= 365;
3497 }
3498
3499 var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number);
3500 var year = match[1];
3501 var month = match[2];
3502 var day = match[3];
3503 var monthString = month ? "0".concat(month).slice(-2) : month;
3504 var dayString = day ? "0".concat(day).slice(-2) : day; // create a date object and compare
3505
3506 var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01'));
3507
3508 if (month && day) {
3509 return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
3510 }
3511
3512 return true;
3513 };
3514
3515 function isISO8601(str) {
3516 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3517 (0, _assertString.default)(str);
3518 var check = options.strictSeparator ? iso8601StrictSeparator.test(str) : iso8601.test(str);
3519 if (check && options.strict) return isValidDate(str);
3520 return check;
3521 }
3522
3523 module.exports = exports.default;
3524 module.exports.default = exports.default;
3525 }(isISO8601$1, isISO8601$1.exports));
3526
3527 var isIso8601Validator = /*@__PURE__*/getDefaultExportFromCjs(isISO8601$1.exports);
3528
3529 var IS_ISO8601 = 'isIso8601';
3530 /**
3531 * Checks if the string is a valid ISO 8601 date.
3532 * If given value is not a string, then it returns false.
3533 * Use the option strict = true for additional checks for a valid date, e.g. invalidates dates like 2019-02-29.
3534 */
3535 function isISO8601(value, options) {
3536 return typeof value === 'string' && isIso8601Validator(value, options);
3537 }
3538 /**
3539 * Checks if the string is a valid ISO 8601 date.
3540 * If given value is not a string, then it returns false.
3541 * Use the option strict = true for additional checks for a valid date, e.g. invalidates dates like 2019-02-29.
3542 */
3543 function IsISO8601(options, validationOptions) {
3544 return ValidateBy({
3545 name: IS_ISO8601,
3546 constraints: [options],
3547 validator: {
3548 validate: function (value, args) { return isISO8601(value, args.constraints[0]); },
3549 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid ISO 8601 date string'; }, validationOptions),
3550 },
3551 }, validationOptions);
3552 }
3553
3554 var isJSON$1 = {exports: {}};
3555
3556 (function (module, exports) {
3557
3558 Object.defineProperty(exports, "__esModule", {
3559 value: true
3560 });
3561 exports.default = isJSON;
3562
3563 var _assertString = _interopRequireDefault(assertString.exports);
3564
3565 var _merge = _interopRequireDefault(merge.exports);
3566
3567 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3568
3569 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3570
3571 var default_json_options = {
3572 allow_primitives: false
3573 };
3574
3575 function isJSON(str, options) {
3576 (0, _assertString.default)(str);
3577
3578 try {
3579 options = (0, _merge.default)(options, default_json_options);
3580 var primitives = [];
3581
3582 if (options.allow_primitives) {
3583 primitives = [null, false, true];
3584 }
3585
3586 var obj = JSON.parse(str);
3587 return primitives.includes(obj) || !!obj && _typeof(obj) === 'object';
3588 } catch (e) {
3589 /* ignore */
3590 }
3591
3592 return false;
3593 }
3594
3595 module.exports = exports.default;
3596 module.exports.default = exports.default;
3597 }(isJSON$1, isJSON$1.exports));
3598
3599 var isJSONValidator = /*@__PURE__*/getDefaultExportFromCjs(isJSON$1.exports);
3600
3601 var IS_JSON = 'isJson';
3602 /**
3603 * Checks if the string is valid JSON (note: uses JSON.parse).
3604 * If given value is not a string, then it returns false.
3605 */
3606 function isJSON(value) {
3607 return typeof value === 'string' && isJSONValidator(value);
3608 }
3609 /**
3610 * Checks if the string is valid JSON (note: uses JSON.parse).
3611 * If given value is not a string, then it returns false.
3612 */
3613 function IsJSON(validationOptions) {
3614 return ValidateBy({
3615 name: IS_JSON,
3616 validator: {
3617 validate: function (value, args) { return isJSON(value); },
3618 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a json string'; }, validationOptions),
3619 },
3620 }, validationOptions);
3621 }
3622
3623 var isJWT$1 = {exports: {}};
3624
3625 (function (module, exports) {
3626
3627 Object.defineProperty(exports, "__esModule", {
3628 value: true
3629 });
3630 exports.default = isJWT;
3631
3632 var _assertString = _interopRequireDefault(assertString.exports);
3633
3634 var _isBase = _interopRequireDefault(isBase64$1.exports);
3635
3636 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3637
3638 function isJWT(str) {
3639 (0, _assertString.default)(str);
3640 var dotSplit = str.split('.');
3641 var len = dotSplit.length;
3642
3643 if (len > 3 || len < 2) {
3644 return false;
3645 }
3646
3647 return dotSplit.reduce(function (acc, currElem) {
3648 return acc && (0, _isBase.default)(currElem, {
3649 urlSafe: true
3650 });
3651 }, true);
3652 }
3653
3654 module.exports = exports.default;
3655 module.exports.default = exports.default;
3656 }(isJWT$1, isJWT$1.exports));
3657
3658 var isJwtValidator = /*@__PURE__*/getDefaultExportFromCjs(isJWT$1.exports);
3659
3660 var IS_JWT = 'isJwt';
3661 /**
3662 * Checks if the string is valid JWT token.
3663 * If given value is not a string, then it returns false.
3664 */
3665 function isJWT(value) {
3666 return typeof value === 'string' && isJwtValidator(value);
3667 }
3668 /**
3669 * Checks if the string is valid JWT token.
3670 * If given value is not a string, then it returns false.
3671 */
3672 function IsJWT(validationOptions) {
3673 return ValidateBy({
3674 name: IS_JWT,
3675 validator: {
3676 validate: function (value, args) { return isJWT(value); },
3677 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a jwt string'; }, validationOptions),
3678 },
3679 }, validationOptions);
3680 }
3681
3682 var isLowercase$1 = {exports: {}};
3683
3684 (function (module, exports) {
3685
3686 Object.defineProperty(exports, "__esModule", {
3687 value: true
3688 });
3689 exports.default = isLowercase;
3690
3691 var _assertString = _interopRequireDefault(assertString.exports);
3692
3693 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3694
3695 function isLowercase(str) {
3696 (0, _assertString.default)(str);
3697 return str === str.toLowerCase();
3698 }
3699
3700 module.exports = exports.default;
3701 module.exports.default = exports.default;
3702 }(isLowercase$1, isLowercase$1.exports));
3703
3704 var isLowercaseValidator = /*@__PURE__*/getDefaultExportFromCjs(isLowercase$1.exports);
3705
3706 var IS_LOWERCASE = 'isLowercase';
3707 /**
3708 * Checks if the string is lowercase.
3709 * If given value is not a string, then it returns false.
3710 */
3711 function isLowercase(value) {
3712 return typeof value === 'string' && isLowercaseValidator(value);
3713 }
3714 /**
3715 * Checks if the string is lowercase.
3716 * If given value is not a string, then it returns false.
3717 */
3718 function IsLowercase(validationOptions) {
3719 return ValidateBy({
3720 name: IS_LOWERCASE,
3721 validator: {
3722 validate: function (value, args) { return isLowercase(value); },
3723 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a lowercase string'; }, validationOptions),
3724 },
3725 }, validationOptions);
3726 }
3727
3728 var isMobilePhone$2 = {};
3729
3730 Object.defineProperty(isMobilePhone$2, "__esModule", {
3731 value: true
3732 });
3733 var _default$3 = isMobilePhone$2.default = isMobilePhone$1;
3734 isMobilePhone$2.locales = void 0;
3735
3736 var _assertString$3 = _interopRequireDefault$3(assertString.exports);
3737
3738 function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3739
3740 /* eslint-disable max-len */
3741 var phones = {
3742 'am-AM': /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,
3743 'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/,
3744 'ar-BH': /^(\+?973)?(3|6)\d{7}$/,
3745 'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/,
3746 'ar-LB': /^(\+?961)?((3|81)\d{6}|7\d{7})$/,
3747 'ar-EG': /^((\+?20)|0)?1[0125]\d{8}$/,
3748 'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/,
3749 'ar-JO': /^(\+?962|0)?7[789]\d{7}$/,
3750 'ar-KW': /^(\+?965)[569]\d{7}$/,
3751 'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,
3752 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/,
3753 'ar-OM': /^((\+|00)968)?(9[1-9])\d{6}$/,
3754 'ar-PS': /^(\+?970|0)5[6|9](\d{7})$/,
3755 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
3756 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
3757 'ar-TN': /^(\+?216)?[2459]\d{7}$/,
3758 'az-AZ': /^(\+994|0)(5[015]|7[07]|99)\d{7}$/,
3759 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,
3760 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,
3761 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/,
3762 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/,
3763 'ca-AD': /^(\+376)?[346]\d{5}$/,
3764 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
3765 'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
3766 'de-DE': /^((\+49|0)[1|3])([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
3767 'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
3768 'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
3769 'de-LU': /^(\+352)?((6\d1)\d{6})$/,
3770 'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
3771 'el-GR': /^(\+?30|0)?(69\d{8})$/,
3772 'en-AU': /^(\+?61|0)4\d{8}$/,
3773 'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}))/,
3774 'en-GB': /^(\+?44|0)7\d{9}$/,
3775 'en-GG': /^(\+?44|0)1481\d{6}$/,
3776 'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28|55|59)\d{7}$/,
3777 'en-GY': /^(\+592|0)6\d{6}$/,
3778 'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,
3779 'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,
3780 'en-IE': /^(\+?353|0)8[356789]\d{7}$/,
3781 'en-IN': /^(\+?91|0)?[6789]\d{9}$/,
3782 'en-KE': /^(\+?254|0)(7|1)\d{8}$/,
3783 'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/,
3784 'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,
3785 'en-MU': /^(\+?230|0)?\d{8}$/,
3786 'en-NA': /^(\+?264|0)(6|8)\d{7}$/,
3787 'en-NG': /^(\+?234|0)?[789]\d{9}$/,
3788 'en-NZ': /^(\+?64|0)[28]\d{7,9}$/,
3789 'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/,
3790 'en-PH': /^(09|\+639)\d{9}$/,
3791 'en-RW': /^(\+?250|0)?[7]\d{8}$/,
3792 'en-SG': /^(\+65)?[3689]\d{7}$/,
3793 'en-SL': /^(\+?232|0)\d{8}$/,
3794 'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
3795 'en-UG': /^(\+?256|0)?[7]\d{8}$/,
3796 'en-US': /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,
3797 'en-ZA': /^(\+?27|0)\d{9}$/,
3798 'en-ZM': /^(\+?26)?09[567]\d{7}$/,
3799 'en-ZW': /^(\+263)[0-9]{9}$/,
3800 'en-BW': /^(\+?267)?(7[1-8]{1})\d{6}$/,
3801 'es-AR': /^\+?549(11|[2368]\d)\d{8}$/,
3802 'es-BO': /^(\+?591)?(6|7)\d{7}$/,
3803 'es-CO': /^(\+?57)?3(0(0|1|2|4|5)|1\d|2[0-4]|5(0|1))\d{7}$/,
3804 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/,
3805 'es-CR': /^(\+506)?[2-8]\d{7}$/,
3806 'es-CU': /^(\+53|0053)?5\d{7}/,
3807 'es-DO': /^(\+?1)?8[024]9\d{7}$/,
3808 'es-HN': /^(\+?504)?[9|8]\d{7}$/,
3809 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/,
3810 'es-ES': /^(\+?34)?[6|7]\d{8}$/,
3811 'es-PE': /^(\+?51)?9\d{8}$/,
3812 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/,
3813 'es-PA': /^(\+?507)\d{7,8}$/,
3814 'es-PY': /^(\+?595|0)9[9876]\d{7}$/,
3815 'es-SV': /^(\+?503)?[67]\d{7}$/,
3816 'es-UY': /^(\+598|0)9[1-9][\d]{6}$/,
3817 'es-VE': /^(\+?58)?(2|4)\d{9}$/,
3818 'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,
3819 'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,
3820 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,
3821 'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/,
3822 'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
3823 'fr-BF': /^(\+226|0)[67]\d{7}$/,
3824 'fr-CM': /^(\+?237)6[0-9]{8}$/,
3825 'fr-FR': /^(\+?33|0)[67]\d{8}$/,
3826 'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/,
3827 'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/,
3828 'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/,
3829 'fr-PF': /^(\+?689)?8[789]\d{6}$/,
3830 'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
3831 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
3832 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
3833 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
3834 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
3835 'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,
3836 'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,
3837 'ka-GE': /^(\+?995)?(5|79)\d{7}$/,
3838 'kk-KZ': /^(\+?7|8)?7\d{9}$/,
3839 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,
3840 'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
3841 'lt-LT': /^(\+370|8)\d{8}$/,
3842 'lv-LV': /^(\+?371)2\d{7}$/,
3843 'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,
3844 'mz-MZ': /^(\+?258)?8[234567]\d{7}$/,
3845 'nb-NO': /^(\+?47)?[49]\d{7}$/,
3846 'ne-NP': /^(\+?977)?9[78]\d{8}$/,
3847 'nl-BE': /^(\+?32|0)4\d{8}$/,
3848 'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,
3849 'nn-NO': /^(\+?47)?[49]\d{7}$/,
3850 'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
3851 'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/,
3852 'pt-PT': /^(\+?351)?9[1236]\d{7}$/,
3853 'pt-AO': /^(\+244)\d{9}$/,
3854 'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,
3855 'ru-RU': /^(\+?7|8)?9\d{9}$/,
3856 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|4|5|6|7|8)( |-)?)\d{7}$/,
3857 'sl-SI': /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/,
3858 'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
3859 'sq-AL': /^(\+355|0)6[789]\d{6}$/,
3860 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/,
3861 'sv-SE': /^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/,
3862 'tg-TJ': /^(\+?992)?[5][5]\d{7}$/,
3863 'th-TH': /^(\+66|66|0)\d{9}$/,
3864 'tr-TR': /^(\+?90|0)?5\d{9}$/,
3865 'tk-TM': /^(\+993|993|8)\d{8}$/,
3866 'uk-UA': /^(\+?38|8)?0\d{9}$/,
3867 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
3868 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/,
3869 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/,
3870 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/,
3871 'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/
3872 };
3873 /* eslint-enable max-len */
3874 // aliases
3875
3876 phones['en-CA'] = phones['en-US'];
3877 phones['fr-CA'] = phones['en-CA'];
3878 phones['fr-BE'] = phones['nl-BE'];
3879 phones['zh-HK'] = phones['en-HK'];
3880 phones['zh-MO'] = phones['en-MO'];
3881 phones['ga-IE'] = phones['en-IE'];
3882 phones['fr-CH'] = phones['de-CH'];
3883 phones['it-CH'] = phones['fr-CH'];
3884
3885 function isMobilePhone$1(str, locale, options) {
3886 (0, _assertString$3.default)(str);
3887
3888 if (options && options.strictMode && !str.startsWith('+')) {
3889 return false;
3890 }
3891
3892 if (Array.isArray(locale)) {
3893 return locale.some(function (key) {
3894 // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
3895 // istanbul ignore else
3896 if (phones.hasOwnProperty(key)) {
3897 var phone = phones[key];
3898
3899 if (phone.test(str)) {
3900 return true;
3901 }
3902 }
3903
3904 return false;
3905 });
3906 } else if (locale in phones) {
3907 return phones[locale].test(str); // alias falsey locale as 'any'
3908 } else if (!locale || locale === 'any') {
3909 for (var key in phones) {
3910 // istanbul ignore else
3911 if (phones.hasOwnProperty(key)) {
3912 var phone = phones[key];
3913
3914 if (phone.test(str)) {
3915 return true;
3916 }
3917 }
3918 }
3919
3920 return false;
3921 }
3922
3923 throw new Error("Invalid locale '".concat(locale, "'"));
3924 }
3925
3926 var locales$2 = Object.keys(phones);
3927 isMobilePhone$2.locales = locales$2;
3928
3929 var IS_MOBILE_PHONE = 'isMobilePhone';
3930 /**
3931 * Checks if the string is a mobile phone number (locale is either an array of locales (e.g ['sk-SK', 'sr-RS'])
3932 * OR one of ['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY',
3933 * 'bg-BG', 'bn-BD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-HK',
3934 * 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-UG',
3935 * 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'es-CL', 'es-CR', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-UY', 'et-EE',
3936 * 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-RE', 'he-IL', 'hu-HU', 'id-ID',
3937 * 'it-IT', 'ja-JP', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL',
3938 * 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sl-SI', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN',
3939 * 'zh-HK', 'zh-MO', 'zh-TW']
3940 * If given value is not a string, then it returns false.
3941 */
3942 function isMobilePhone(value, locale, options) {
3943 return typeof value === 'string' && _default$3(value, locale, options);
3944 }
3945 /**
3946 * Checks if the string is a mobile phone number (locale is either an array of locales (e.g ['sk-SK', 'sr-RS'])
3947 * OR one of ['am-Am', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY',
3948 * 'bg-BG', 'bn-BD', 'cs-CZ', 'da-DK', 'de-DE', 'de-AT', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-GG', 'en-GH', 'en-HK',
3949 * 'en-MO', 'en-IE', 'en-IN', 'en-KE', 'en-MT', 'en-MU', 'en-NG', 'en-NZ', 'en-PK', 'en-RW', 'en-SG', 'en-SL', 'en-UG',
3950 * 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'es-CL', 'es-CR', 'es-EC', 'es-ES', 'es-MX', 'es-PA', 'es-PY', 'es-UY', 'et-EE',
3951 * 'fa-IR', 'fi-FI', 'fj-FJ', 'fo-FO', 'fr-BE', 'fr-FR', 'fr-GF', 'fr-GP', 'fr-MQ', 'fr-RE', 'he-IL', 'hu-HU', 'id-ID',
3952 * 'it-IT', 'ja-JP', 'kk-KZ', 'kl-GL', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'ne-NP', 'nl-BE', 'nl-NL', 'nn-NO', 'pl-PL',
3953 * 'pt-BR', 'pt-PT', 'ro-RO', 'ru-RU', 'sl-SI', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN',
3954 * 'zh-HK', 'zh-MO', 'zh-TW']
3955 * If given value is not a string, then it returns false.
3956 */
3957 function IsMobilePhone(locale, options, validationOptions) {
3958 return ValidateBy({
3959 name: IS_MOBILE_PHONE,
3960 constraints: [locale, options],
3961 validator: {
3962 validate: function (value, args) { return isMobilePhone(value, args.constraints[0], args.constraints[1]); },
3963 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a phone number'; }, validationOptions),
3964 },
3965 }, validationOptions);
3966 }
3967
3968 var isISO31661Alpha2$2 = {};
3969
3970 Object.defineProperty(isISO31661Alpha2$2, "__esModule", {
3971 value: true
3972 });
3973 var _default$2 = isISO31661Alpha2$2.default = isISO31661Alpha2$1;
3974 isISO31661Alpha2$2.CountryCodes = void 0;
3975
3976 var _assertString$2 = _interopRequireDefault$2(assertString.exports);
3977
3978 function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3979
3980 // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
3981 var validISO31661Alpha2CountriesCodes = new Set(['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', 'BR', 'BS', 'BT', 'BV', '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', 'HM', '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', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', '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', 'YE', 'YT', 'ZA', 'ZM', 'ZW']);
3982
3983 function isISO31661Alpha2$1(str) {
3984 (0, _assertString$2.default)(str);
3985 return validISO31661Alpha2CountriesCodes.has(str.toUpperCase());
3986 }
3987
3988 var CountryCodes = validISO31661Alpha2CountriesCodes;
3989 isISO31661Alpha2$2.CountryCodes = CountryCodes;
3990
3991 var IS_ISO31661_ALPHA_2 = 'isISO31661Alpha2';
3992 /**
3993 * Check if the string is a valid [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned country code.
3994 */
3995 function isISO31661Alpha2(value) {
3996 return typeof value === 'string' && _default$2(value);
3997 }
3998 /**
3999 * Check if the string is a valid [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) officially assigned country code.
4000 */
4001 function IsISO31661Alpha2(validationOptions) {
4002 return ValidateBy({
4003 name: IS_ISO31661_ALPHA_2,
4004 validator: {
4005 validate: function (value, args) { return isISO31661Alpha2(value); },
4006 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid ISO31661 Alpha2 code'; }, validationOptions),
4007 },
4008 }, validationOptions);
4009 }
4010
4011 var isISO31661Alpha3$1 = {exports: {}};
4012
4013 (function (module, exports) {
4014
4015 Object.defineProperty(exports, "__esModule", {
4016 value: true
4017 });
4018 exports.default = isISO31661Alpha3;
4019
4020 var _assertString = _interopRequireDefault(assertString.exports);
4021
4022 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4023
4024 // from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
4025 var validISO31661Alpha3CountriesCodes = new Set(['AFG', 'ALA', 'ALB', 'DZA', 'ASM', 'AND', 'AGO', 'AIA', 'ATA', 'ATG', 'ARG', 'ARM', 'ABW', 'AUS', 'AUT', 'AZE', 'BHS', 'BHR', 'BGD', 'BRB', 'BLR', 'BEL', 'BLZ', 'BEN', 'BMU', 'BTN', 'BOL', 'BES', 'BIH', 'BWA', 'BVT', 'BRA', 'IOT', 'BRN', 'BGR', 'BFA', 'BDI', 'KHM', 'CMR', 'CAN', 'CPV', 'CYM', 'CAF', 'TCD', 'CHL', 'CHN', 'CXR', 'CCK', 'COL', 'COM', 'COG', 'COD', 'COK', 'CRI', 'CIV', 'HRV', 'CUB', 'CUW', 'CYP', 'CZE', 'DNK', 'DJI', 'DMA', 'DOM', 'ECU', 'EGY', 'SLV', 'GNQ', 'ERI', 'EST', 'ETH', 'FLK', 'FRO', 'FJI', 'FIN', 'FRA', 'GUF', 'PYF', 'ATF', 'GAB', 'GMB', 'GEO', 'DEU', 'GHA', 'GIB', 'GRC', 'GRL', 'GRD', 'GLP', 'GUM', 'GTM', 'GGY', 'GIN', 'GNB', 'GUY', 'HTI', 'HMD', 'VAT', 'HND', 'HKG', 'HUN', 'ISL', 'IND', 'IDN', 'IRN', 'IRQ', 'IRL', 'IMN', 'ISR', 'ITA', 'JAM', 'JPN', 'JEY', 'JOR', 'KAZ', 'KEN', 'KIR', 'PRK', 'KOR', 'KWT', 'KGZ', 'LAO', 'LVA', 'LBN', 'LSO', 'LBR', 'LBY', 'LIE', 'LTU', 'LUX', 'MAC', 'MKD', 'MDG', 'MWI', 'MYS', 'MDV', 'MLI', 'MLT', 'MHL', 'MTQ', 'MRT', 'MUS', 'MYT', 'MEX', 'FSM', 'MDA', 'MCO', 'MNG', 'MNE', 'MSR', 'MAR', 'MOZ', 'MMR', 'NAM', 'NRU', 'NPL', 'NLD', 'NCL', 'NZL', 'NIC', 'NER', 'NGA', 'NIU', 'NFK', 'MNP', 'NOR', 'OMN', 'PAK', 'PLW', 'PSE', 'PAN', 'PNG', 'PRY', 'PER', 'PHL', 'PCN', 'POL', 'PRT', 'PRI', 'QAT', 'REU', 'ROU', 'RUS', 'RWA', 'BLM', 'SHN', 'KNA', 'LCA', 'MAF', 'SPM', 'VCT', 'WSM', 'SMR', 'STP', 'SAU', 'SEN', 'SRB', 'SYC', 'SLE', 'SGP', 'SXM', 'SVK', 'SVN', 'SLB', 'SOM', 'ZAF', 'SGS', 'SSD', 'ESP', 'LKA', 'SDN', 'SUR', 'SJM', 'SWZ', 'SWE', 'CHE', 'SYR', 'TWN', 'TJK', 'TZA', 'THA', 'TLS', 'TGO', 'TKL', 'TON', 'TTO', 'TUN', 'TUR', 'TKM', 'TCA', 'TUV', 'UGA', 'UKR', 'ARE', 'GBR', 'USA', 'UMI', 'URY', 'UZB', 'VUT', 'VEN', 'VNM', 'VGB', 'VIR', 'WLF', 'ESH', 'YEM', 'ZMB', 'ZWE']);
4026
4027 function isISO31661Alpha3(str) {
4028 (0, _assertString.default)(str);
4029 return validISO31661Alpha3CountriesCodes.has(str.toUpperCase());
4030 }
4031
4032 module.exports = exports.default;
4033 module.exports.default = exports.default;
4034 }(isISO31661Alpha3$1, isISO31661Alpha3$1.exports));
4035
4036 var isISO31661Alpha3Validator = /*@__PURE__*/getDefaultExportFromCjs(isISO31661Alpha3$1.exports);
4037
4038 var IS_ISO31661_ALPHA_3 = 'isISO31661Alpha3';
4039 /**
4040 * Check if the string is a valid [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned country code.
4041 */
4042 function isISO31661Alpha3(value) {
4043 return typeof value === 'string' && isISO31661Alpha3Validator(value);
4044 }
4045 /**
4046 * Check if the string is a valid [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) officially assigned country code.
4047 */
4048 function IsISO31661Alpha3(validationOptions) {
4049 return ValidateBy({
4050 name: IS_ISO31661_ALPHA_3,
4051 validator: {
4052 validate: function (value, args) { return isISO31661Alpha3(value); },
4053 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid ISO31661 Alpha3 code'; }, validationOptions),
4054 },
4055 }, validationOptions);
4056 }
4057
4058 var isMongoId$1 = {exports: {}};
4059
4060 (function (module, exports) {
4061
4062 Object.defineProperty(exports, "__esModule", {
4063 value: true
4064 });
4065 exports.default = isMongoId;
4066
4067 var _assertString = _interopRequireDefault(assertString.exports);
4068
4069 var _isHexadecimal = _interopRequireDefault(isHexadecimal$1.exports);
4070
4071 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4072
4073 function isMongoId(str) {
4074 (0, _assertString.default)(str);
4075 return (0, _isHexadecimal.default)(str) && str.length === 24;
4076 }
4077
4078 module.exports = exports.default;
4079 module.exports.default = exports.default;
4080 }(isMongoId$1, isMongoId$1.exports));
4081
4082 var isMongoIdValidator = /*@__PURE__*/getDefaultExportFromCjs(isMongoId$1.exports);
4083
4084 var IS_MONGO_ID = 'isMongoId';
4085 /**
4086 * Checks if the string is a valid hex-encoded representation of a MongoDB ObjectId.
4087 * If given value is not a string, then it returns false.
4088 */
4089 function isMongoId(value) {
4090 return typeof value === 'string' && isMongoIdValidator(value);
4091 }
4092 /**
4093 * Checks if the string is a valid hex-encoded representation of a MongoDB ObjectId.
4094 * If given value is not a string, then it returns false.
4095 */
4096 function IsMongoId(validationOptions) {
4097 return ValidateBy({
4098 name: IS_MONGO_ID,
4099 validator: {
4100 validate: function (value, args) { return isMongoId(value); },
4101 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a mongodb id'; }, validationOptions),
4102 },
4103 }, validationOptions);
4104 }
4105
4106 var isMultibyte$1 = {exports: {}};
4107
4108 (function (module, exports) {
4109
4110 Object.defineProperty(exports, "__esModule", {
4111 value: true
4112 });
4113 exports.default = isMultibyte;
4114
4115 var _assertString = _interopRequireDefault(assertString.exports);
4116
4117 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4118
4119 /* eslint-disable no-control-regex */
4120 var multibyte = /[^\x00-\x7F]/;
4121 /* eslint-enable no-control-regex */
4122
4123 function isMultibyte(str) {
4124 (0, _assertString.default)(str);
4125 return multibyte.test(str);
4126 }
4127
4128 module.exports = exports.default;
4129 module.exports.default = exports.default;
4130 }(isMultibyte$1, isMultibyte$1.exports));
4131
4132 var isMultibyteValidator = /*@__PURE__*/getDefaultExportFromCjs(isMultibyte$1.exports);
4133
4134 var IS_MULTIBYTE = 'isMultibyte';
4135 /**
4136 * Checks if the string contains one or more multibyte chars.
4137 * If given value is not a string, then it returns false.
4138 */
4139 function isMultibyte(value) {
4140 return typeof value === 'string' && isMultibyteValidator(value);
4141 }
4142 /**
4143 * Checks if the string contains one or more multibyte chars.
4144 * If given value is not a string, then it returns false.
4145 */
4146 function IsMultibyte(validationOptions) {
4147 return ValidateBy({
4148 name: IS_MULTIBYTE,
4149 validator: {
4150 validate: function (value, args) { return isMultibyte(value); },
4151 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain one or more multibyte chars'; }, validationOptions),
4152 },
4153 }, validationOptions);
4154 }
4155
4156 var isSurrogatePair$1 = {exports: {}};
4157
4158 (function (module, exports) {
4159
4160 Object.defineProperty(exports, "__esModule", {
4161 value: true
4162 });
4163 exports.default = isSurrogatePair;
4164
4165 var _assertString = _interopRequireDefault(assertString.exports);
4166
4167 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4168
4169 var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
4170
4171 function isSurrogatePair(str) {
4172 (0, _assertString.default)(str);
4173 return surrogatePair.test(str);
4174 }
4175
4176 module.exports = exports.default;
4177 module.exports.default = exports.default;
4178 }(isSurrogatePair$1, isSurrogatePair$1.exports));
4179
4180 var isSurrogatePairValidator = /*@__PURE__*/getDefaultExportFromCjs(isSurrogatePair$1.exports);
4181
4182 var IS_SURROGATE_PAIR = 'isSurrogatePair';
4183 /**
4184 * Checks if the string contains any surrogate pairs chars.
4185 * If given value is not a string, then it returns false.
4186 */
4187 function isSurrogatePair(value) {
4188 return typeof value === 'string' && isSurrogatePairValidator(value);
4189 }
4190 /**
4191 * Checks if the string contains any surrogate pairs chars.
4192 * If given value is not a string, then it returns false.
4193 */
4194 function IsSurrogatePair(validationOptions) {
4195 return ValidateBy({
4196 name: IS_SURROGATE_PAIR,
4197 validator: {
4198 validate: function (value, args) { return isSurrogatePair(value); },
4199 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain any surrogate pairs chars'; }, validationOptions),
4200 },
4201 }, validationOptions);
4202 }
4203
4204 var isURL$1 = {exports: {}};
4205
4206 (function (module, exports) {
4207
4208 Object.defineProperty(exports, "__esModule", {
4209 value: true
4210 });
4211 exports.default = isURL;
4212
4213 var _assertString = _interopRequireDefault(assertString.exports);
4214
4215 var _isFQDN = _interopRequireDefault(isFQDN$1.exports);
4216
4217 var _isIP = _interopRequireDefault(isIP$1.exports);
4218
4219 var _merge = _interopRequireDefault(merge.exports);
4220
4221 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4222
4223 function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4224
4225 function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4226
4227 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4228
4229 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4230
4231 function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
4232
4233 function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4234
4235 /*
4236 options for isURL method
4237
4238 require_protocol - if set as true isURL will return false if protocol is not present in the URL
4239 require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option
4240 protocols - valid protocols can be modified with this option
4241 require_host - if set as false isURL will not check if host is present in the URL
4242 require_port - if set as true isURL will check if port is present in the URL
4243 allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed
4244 validate_length - if set as false isURL will skip string length validation (IE maximum is 2083)
4245
4246 */
4247 var default_url_options = {
4248 protocols: ['http', 'https', 'ftp'],
4249 require_tld: true,
4250 require_protocol: false,
4251 require_host: true,
4252 require_port: false,
4253 require_valid_protocol: true,
4254 allow_underscores: false,
4255 allow_trailing_dot: false,
4256 allow_protocol_relative_urls: false,
4257 allow_fragments: true,
4258 allow_query_components: true,
4259 validate_length: true
4260 };
4261 var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
4262
4263 function isRegExp(obj) {
4264 return Object.prototype.toString.call(obj) === '[object RegExp]';
4265 }
4266
4267 function checkHost(host, matches) {
4268 for (var i = 0; i < matches.length; i++) {
4269 var match = matches[i];
4270
4271 if (host === match || isRegExp(match) && match.test(host)) {
4272 return true;
4273 }
4274 }
4275
4276 return false;
4277 }
4278
4279 function isURL(url, options) {
4280 (0, _assertString.default)(url);
4281
4282 if (!url || /[\s<>]/.test(url)) {
4283 return false;
4284 }
4285
4286 if (url.indexOf('mailto:') === 0) {
4287 return false;
4288 }
4289
4290 options = (0, _merge.default)(options, default_url_options);
4291
4292 if (options.validate_length && url.length >= 2083) {
4293 return false;
4294 }
4295
4296 if (!options.allow_fragments && url.includes('#')) {
4297 return false;
4298 }
4299
4300 if (!options.allow_query_components && (url.includes('?') || url.includes('&'))) {
4301 return false;
4302 }
4303
4304 var protocol, auth, host, hostname, port, port_str, split, ipv6;
4305 split = url.split('#');
4306 url = split.shift();
4307 split = url.split('?');
4308 url = split.shift();
4309 split = url.split('://');
4310
4311 if (split.length > 1) {
4312 protocol = split.shift().toLowerCase();
4313
4314 if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
4315 return false;
4316 }
4317 } else if (options.require_protocol) {
4318 return false;
4319 } else if (url.substr(0, 2) === '//') {
4320 if (!options.allow_protocol_relative_urls) {
4321 return false;
4322 }
4323
4324 split[0] = url.substr(2);
4325 }
4326
4327 url = split.join('://');
4328
4329 if (url === '') {
4330 return false;
4331 }
4332
4333 split = url.split('/');
4334 url = split.shift();
4335
4336 if (url === '' && !options.require_host) {
4337 return true;
4338 }
4339
4340 split = url.split('@');
4341
4342 if (split.length > 1) {
4343 if (options.disallow_auth) {
4344 return false;
4345 }
4346
4347 if (split[0] === '') {
4348 return false;
4349 }
4350
4351 auth = split.shift();
4352
4353 if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
4354 return false;
4355 }
4356
4357 var _auth$split = auth.split(':'),
4358 _auth$split2 = _slicedToArray(_auth$split, 2),
4359 user = _auth$split2[0],
4360 password = _auth$split2[1];
4361
4362 if (user === '' && password === '') {
4363 return false;
4364 }
4365 }
4366
4367 hostname = split.join('@');
4368 port_str = null;
4369 ipv6 = null;
4370 var ipv6_match = hostname.match(wrapped_ipv6);
4371
4372 if (ipv6_match) {
4373 host = '';
4374 ipv6 = ipv6_match[1];
4375 port_str = ipv6_match[2] || null;
4376 } else {
4377 split = hostname.split(':');
4378 host = split.shift();
4379
4380 if (split.length) {
4381 port_str = split.join(':');
4382 }
4383 }
4384
4385 if (port_str !== null && port_str.length > 0) {
4386 port = parseInt(port_str, 10);
4387
4388 if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
4389 return false;
4390 }
4391 } else if (options.require_port) {
4392 return false;
4393 }
4394
4395 if (options.host_whitelist) {
4396 return checkHost(host, options.host_whitelist);
4397 }
4398
4399 if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) {
4400 return false;
4401 }
4402
4403 host = host || ipv6;
4404
4405 if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
4406 return false;
4407 }
4408
4409 return true;
4410 }
4411
4412 module.exports = exports.default;
4413 module.exports.default = exports.default;
4414 }(isURL$1, isURL$1.exports));
4415
4416 var isUrlValidator = /*@__PURE__*/getDefaultExportFromCjs(isURL$1.exports);
4417
4418 var IS_URL = 'isUrl';
4419 /**
4420 * Checks if the string is an url.
4421 * If given value is not a string, then it returns false.
4422 */
4423 function isURL(value, options) {
4424 return typeof value === 'string' && isUrlValidator(value, options);
4425 }
4426 /**
4427 * Checks if the string is an url.
4428 * If given value is not a string, then it returns false.
4429 */
4430 function IsUrl(options, validationOptions) {
4431 return ValidateBy({
4432 name: IS_URL,
4433 constraints: [options],
4434 validator: {
4435 validate: function (value, args) { return isURL(value, args.constraints[0]); },
4436 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an URL address'; }, validationOptions),
4437 },
4438 }, validationOptions);
4439 }
4440
4441 var isUUID$1 = {exports: {}};
4442
4443 (function (module, exports) {
4444
4445 Object.defineProperty(exports, "__esModule", {
4446 value: true
4447 });
4448 exports.default = isUUID;
4449
4450 var _assertString = _interopRequireDefault(assertString.exports);
4451
4452 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4453
4454 var uuid = {
4455 1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
4456 2: /^[0-9A-F]{8}-[0-9A-F]{4}-2[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
4457 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
4458 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
4459 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
4460 all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
4461 };
4462
4463 function isUUID(str, version) {
4464 (0, _assertString.default)(str);
4465 var pattern = uuid[![undefined, null].includes(version) ? version : 'all'];
4466 return !!pattern && pattern.test(str);
4467 }
4468
4469 module.exports = exports.default;
4470 module.exports.default = exports.default;
4471 }(isUUID$1, isUUID$1.exports));
4472
4473 var isUuidValidator = /*@__PURE__*/getDefaultExportFromCjs(isUUID$1.exports);
4474
4475 var IS_UUID = 'isUuid';
4476 /**
4477 * Checks if the string is a UUID (version 3, 4 or 5).
4478 * If given value is not a string, then it returns false.
4479 */
4480 function isUUID(value, version) {
4481 return typeof value === 'string' && isUuidValidator(value, version);
4482 }
4483 /**
4484 * Checks if the string is a UUID (version 3, 4 or 5).
4485 * If given value is not a string, then it returns false.
4486 */
4487 function IsUUID(version, validationOptions) {
4488 return ValidateBy({
4489 name: IS_UUID,
4490 constraints: [version],
4491 validator: {
4492 validate: function (value, args) { return isUUID(value, args.constraints[0]); },
4493 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a UUID'; }, validationOptions),
4494 },
4495 }, validationOptions);
4496 }
4497
4498 var IS_FIREBASE_PUSH_ID = 'IsFirebasePushId';
4499 /**
4500 * Checks if the string is a Firebase Push Id
4501 * If given value is not a Firebase Push Id, it returns false
4502 */
4503 function isFirebasePushId(value) {
4504 var webSafeRegex = /^[a-zA-Z0-9_-]*$/;
4505 return typeof value === 'string' && value.length === 20 && webSafeRegex.test(value);
4506 }
4507 /**
4508 * Checks if the string is a Firebase Push Id
4509 * If given value is not a Firebase Push Id, it returns false
4510 */
4511 function IsFirebasePushId(validationOptions) {
4512 return ValidateBy({
4513 name: IS_FIREBASE_PUSH_ID,
4514 validator: {
4515 validate: function (value, args) { return isFirebasePushId(value); },
4516 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a Firebase Push Id'; }, validationOptions),
4517 },
4518 }, validationOptions);
4519 }
4520
4521 var isUppercase$1 = {exports: {}};
4522
4523 (function (module, exports) {
4524
4525 Object.defineProperty(exports, "__esModule", {
4526 value: true
4527 });
4528 exports.default = isUppercase;
4529
4530 var _assertString = _interopRequireDefault(assertString.exports);
4531
4532 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4533
4534 function isUppercase(str) {
4535 (0, _assertString.default)(str);
4536 return str === str.toUpperCase();
4537 }
4538
4539 module.exports = exports.default;
4540 module.exports.default = exports.default;
4541 }(isUppercase$1, isUppercase$1.exports));
4542
4543 var isUppercaseValidator = /*@__PURE__*/getDefaultExportFromCjs(isUppercase$1.exports);
4544
4545 var IS_UPPERCASE = 'isUppercase';
4546 /**
4547 * Checks if the string is uppercase.
4548 * If given value is not a string, then it returns false.
4549 */
4550 function isUppercase(value) {
4551 return typeof value === 'string' && isUppercaseValidator(value);
4552 }
4553 /**
4554 * Checks if the string is uppercase.
4555 * If given value is not a string, then it returns false.
4556 */
4557 function IsUppercase(validationOptions) {
4558 return ValidateBy({
4559 name: IS_UPPERCASE,
4560 validator: {
4561 validate: function (value, args) { return isUppercase(value); },
4562 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be uppercase'; }, validationOptions),
4563 },
4564 }, validationOptions);
4565 }
4566
4567 var isLength = {exports: {}};
4568
4569 (function (module, exports) {
4570
4571 Object.defineProperty(exports, "__esModule", {
4572 value: true
4573 });
4574 exports.default = isLength;
4575
4576 var _assertString = _interopRequireDefault(assertString.exports);
4577
4578 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4579
4580 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4581
4582 /* eslint-disable prefer-rest-params */
4583 function isLength(str, options) {
4584 (0, _assertString.default)(str);
4585 var min;
4586 var max;
4587
4588 if (_typeof(options) === 'object') {
4589 min = options.min || 0;
4590 max = options.max;
4591 } else {
4592 // backwards compatibility: isLength(str, min [, max])
4593 min = arguments[1] || 0;
4594 max = arguments[2];
4595 }
4596
4597 var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || [];
4598 var len = str.length - surrogatePairs.length;
4599 return len >= min && (typeof max === 'undefined' || len <= max);
4600 }
4601
4602 module.exports = exports.default;
4603 module.exports.default = exports.default;
4604 }(isLength, isLength.exports));
4605
4606 var isLengthValidator = /*@__PURE__*/getDefaultExportFromCjs(isLength.exports);
4607
4608 var IS_LENGTH = 'isLength';
4609 /**
4610 * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
4611 * If given value is not a string, then it returns false.
4612 */
4613 function length(value, min, max) {
4614 return typeof value === 'string' && isLengthValidator(value, { min: min, max: max });
4615 }
4616 /**
4617 * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
4618 * If given value is not a string, then it returns false.
4619 */
4620 function Length(min, max, validationOptions) {
4621 return ValidateBy({
4622 name: IS_LENGTH,
4623 constraints: [min, max],
4624 validator: {
4625 validate: function (value, args) { return length(value, args.constraints[0], args.constraints[1]); },
4626 defaultMessage: buildMessage(function (eachPrefix, args) {
4627 var isMinLength = args.constraints[0] !== null && args.constraints[0] !== undefined;
4628 var isMaxLength = args.constraints[1] !== null && args.constraints[1] !== undefined;
4629 if (isMinLength && (!args.value || args.value.length < args.constraints[0])) {
4630 return eachPrefix + '$property must be longer than or equal to $constraint1 characters';
4631 }
4632 else if (isMaxLength && args.value.length > args.constraints[1]) {
4633 return eachPrefix + '$property must be shorter than or equal to $constraint2 characters';
4634 }
4635 return (eachPrefix +
4636 '$property must be longer than or equal to $constraint1 and shorter than or equal to $constraint2 characters');
4637 }, validationOptions),
4638 },
4639 }, validationOptions);
4640 }
4641
4642 var MAX_LENGTH = 'maxLength';
4643 /**
4644 * Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs.
4645 * If given value is not a string, then it returns false.
4646 */
4647 function maxLength(value, max) {
4648 return typeof value === 'string' && isLengthValidator(value, { min: 0, max: max });
4649 }
4650 /**
4651 * Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs.
4652 * If given value is not a string, then it returns false.
4653 */
4654 function MaxLength(max, validationOptions) {
4655 return ValidateBy({
4656 name: MAX_LENGTH,
4657 constraints: [max],
4658 validator: {
4659 validate: function (value, args) { return maxLength(value, args.constraints[0]); },
4660 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be shorter than or equal to $constraint1 characters'; }, validationOptions),
4661 },
4662 }, validationOptions);
4663 }
4664
4665 var MIN_LENGTH = 'minLength';
4666 /**
4667 * Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs.
4668 * If given value is not a string, then it returns false.
4669 */
4670 function minLength(value, min) {
4671 return typeof value === 'string' && isLengthValidator(value, { min: min });
4672 }
4673 /**
4674 * Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs.
4675 * If given value is not a string, then it returns false.
4676 */
4677 function MinLength(min, validationOptions) {
4678 return ValidateBy({
4679 name: MIN_LENGTH,
4680 constraints: [min],
4681 validator: {
4682 validate: function (value, args) { return minLength(value, args.constraints[0]); },
4683 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be longer than or equal to $constraint1 characters'; }, validationOptions),
4684 },
4685 }, validationOptions);
4686 }
4687
4688 var matches$1 = {exports: {}};
4689
4690 (function (module, exports) {
4691
4692 Object.defineProperty(exports, "__esModule", {
4693 value: true
4694 });
4695 exports.default = matches;
4696
4697 var _assertString = _interopRequireDefault(assertString.exports);
4698
4699 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4700
4701 function matches(str, pattern, modifiers) {
4702 (0, _assertString.default)(str);
4703
4704 if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {
4705 pattern = new RegExp(pattern, modifiers);
4706 }
4707
4708 return pattern.test(str);
4709 }
4710
4711 module.exports = exports.default;
4712 module.exports.default = exports.default;
4713 }(matches$1, matches$1.exports));
4714
4715 var matchesValidator = /*@__PURE__*/getDefaultExportFromCjs(matches$1.exports);
4716
4717 var MATCHES = 'matches';
4718 function matches(value, pattern, modifiers) {
4719 return typeof value === 'string' && matchesValidator(value, pattern, modifiers);
4720 }
4721 function Matches(pattern, modifiersOrAnnotationOptions, validationOptions) {
4722 var modifiers;
4723 if (modifiersOrAnnotationOptions && modifiersOrAnnotationOptions instanceof Object && !validationOptions) {
4724 validationOptions = modifiersOrAnnotationOptions;
4725 }
4726 else {
4727 modifiers = modifiersOrAnnotationOptions;
4728 }
4729 return ValidateBy({
4730 name: MATCHES,
4731 constraints: [pattern, modifiers],
4732 validator: {
4733 validate: function (value, args) { return matches(value, args.constraints[0], args.constraints[1]); },
4734 defaultMessage: buildMessage(function (eachPrefix, args) { return eachPrefix + '$property must match $constraint1 regular expression'; }, validationOptions),
4735 },
4736 }, validationOptions);
4737 }
4738
4739 // This file is a workaround for a bug in web browsers' "native"
4740 // ES6 importing system which is uncapable of importing "*.json" files.
4741 // https://github.com/catamphetamine/libphonenumber-js/issues/239
4742 var metadata = {"version":4,"country_calling_codes":{"1":["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],"7":["RU","KZ"],"20":["EG"],"27":["ZA"],"30":["GR"],"31":["NL"],"32":["BE"],"33":["FR"],"34":["ES"],"36":["HU"],"39":["IT","VA"],"40":["RO"],"41":["CH"],"43":["AT"],"44":["GB","GG","IM","JE"],"45":["DK"],"46":["SE"],"47":["NO","SJ"],"48":["PL"],"49":["DE"],"51":["PE"],"52":["MX"],"53":["CU"],"54":["AR"],"55":["BR"],"56":["CL"],"57":["CO"],"58":["VE"],"60":["MY"],"61":["AU","CC","CX"],"62":["ID"],"63":["PH"],"64":["NZ"],"65":["SG"],"66":["TH"],"81":["JP"],"82":["KR"],"84":["VN"],"86":["CN"],"90":["TR"],"91":["IN"],"92":["PK"],"93":["AF"],"94":["LK"],"95":["MM"],"98":["IR"],"211":["SS"],"212":["MA","EH"],"213":["DZ"],"216":["TN"],"218":["LY"],"220":["GM"],"221":["SN"],"222":["MR"],"223":["ML"],"224":["GN"],"225":["CI"],"226":["BF"],"227":["NE"],"228":["TG"],"229":["BJ"],"230":["MU"],"231":["LR"],"232":["SL"],"233":["GH"],"234":["NG"],"235":["TD"],"236":["CF"],"237":["CM"],"238":["CV"],"239":["ST"],"240":["GQ"],"241":["GA"],"242":["CG"],"243":["CD"],"244":["AO"],"245":["GW"],"246":["IO"],"247":["AC"],"248":["SC"],"249":["SD"],"250":["RW"],"251":["ET"],"252":["SO"],"253":["DJ"],"254":["KE"],"255":["TZ"],"256":["UG"],"257":["BI"],"258":["MZ"],"260":["ZM"],"261":["MG"],"262":["RE","YT"],"263":["ZW"],"264":["NA"],"265":["MW"],"266":["LS"],"267":["BW"],"268":["SZ"],"269":["KM"],"290":["SH","TA"],"291":["ER"],"297":["AW"],"298":["FO"],"299":["GL"],"350":["GI"],"351":["PT"],"352":["LU"],"353":["IE"],"354":["IS"],"355":["AL"],"356":["MT"],"357":["CY"],"358":["FI","AX"],"359":["BG"],"370":["LT"],"371":["LV"],"372":["EE"],"373":["MD"],"374":["AM"],"375":["BY"],"376":["AD"],"377":["MC"],"378":["SM"],"380":["UA"],"381":["RS"],"382":["ME"],"383":["XK"],"385":["HR"],"386":["SI"],"387":["BA"],"389":["MK"],"420":["CZ"],"421":["SK"],"423":["LI"],"500":["FK"],"501":["BZ"],"502":["GT"],"503":["SV"],"504":["HN"],"505":["NI"],"506":["CR"],"507":["PA"],"508":["PM"],"509":["HT"],"590":["GP","BL","MF"],"591":["BO"],"592":["GY"],"593":["EC"],"594":["GF"],"595":["PY"],"596":["MQ"],"597":["SR"],"598":["UY"],"599":["CW","BQ"],"670":["TL"],"672":["NF"],"673":["BN"],"674":["NR"],"675":["PG"],"676":["TO"],"677":["SB"],"678":["VU"],"679":["FJ"],"680":["PW"],"681":["WF"],"682":["CK"],"683":["NU"],"685":["WS"],"686":["KI"],"687":["NC"],"688":["TV"],"689":["PF"],"690":["TK"],"691":["FM"],"692":["MH"],"850":["KP"],"852":["HK"],"853":["MO"],"855":["KH"],"856":["LA"],"880":["BD"],"886":["TW"],"960":["MV"],"961":["LB"],"962":["JO"],"963":["SY"],"964":["IQ"],"965":["KW"],"966":["SA"],"967":["YE"],"968":["OM"],"970":["PS"],"971":["AE"],"972":["IL"],"973":["BH"],"974":["QA"],"975":["BT"],"976":["MN"],"977":["NP"],"992":["TJ"],"993":["TM"],"994":["AZ"],"995":["GE"],"996":["KG"],"998":["UZ"]},"countries":{"AC":["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],"AD":["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],"AE":["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],"AF":["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],"AG":["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([457]\\d{6})$","268$1",0,"268"],"AI":["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2457]\\d{6})$","264$1",0,"264"],"AL":["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],"AM":["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],"AO":["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],"AR":["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],"AS":["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"1|([267]\\d{6})$","684$1",0,"684"],"AT":["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],"AU":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"0|(183[12])",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],"AW":["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],"AX":["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],"AZ":["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],"BA":["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],"BB":["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","246$1",0,"246"],"BD":["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:28|4[14]|5)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],"BE":["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],"BF":["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],"BG":["359","00","[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],"BH":["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[047]"]]]],"BI":["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],"BJ":["229","00","[25689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[25689]"]]]],"BL":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"BM":["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","441$1",0,"441"],"BN":["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],"BO":["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],"BQ":["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],"BR":["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-24679]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],"BS":["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([3-8]\\d{6})$","242$1",0,"242"],"BT":["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],"BW":["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-79]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],"BY":["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],"BZ":["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],"CA":["1","011","(?:[2-8]\\d|90)\\d{8}",[10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50)|3(?:06|43|6[578])|4(?:03|1[68]|3[178]|50|74)|5(?:06|1[49]|48|79|8[17])|6(?:04|13|39|47|72)|7(?:0[59]|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[12]|33|44|66|77|88)|622)[2-9]\\d{6}"],0,0,0,["600[2-9]\\d{6}"]]],"CC":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"0|([59]\\d{7})$","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],"CD":["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],"CF":["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],"CG":["242","00","(?:0\\d\\d|222|800)\\d{6}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],"CH":["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],"CI":["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],"CK":["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],"CL":["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-3]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],"CM":["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],"CN":["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","(?:10|2[0-57-9])(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"0|(1(?:[12]\\d|79)\\d\\d)",0,0,0,0,"00"],"CO":["57","00(?:4(?:[14]4|56)|[579])","(?:(?:1\\d|[36])\\d{3}|9101)\\d{6}|[124-8]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1 $2",["[146][2-9]|[2578]"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["[39]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],"CR":["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],"CU":["53","119","[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["5"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],"CV":["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],"CW":["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],"CX":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"0|([59]\\d{7})$","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],"CY":["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],"CZ":["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],"DE":["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:1\\d|2[02-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[05]\\d|[23]1|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],"DJ":["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],"DK":["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],"DM":["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","767$1",0,"767"],"DO":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],"DZ":["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],"EC":["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],"EE":["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],"EG":["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[189]"],"0$1"]],"0"],"EH":["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],"ER":["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],"ES":["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],"ET":["251","00","(?:11|[2-59]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-59]"],"0$1"]],"0"],"FI":["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],"FJ":["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],"FK":["500","00","[2-7]\\d{4}",[5]],"FM":["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],"FO":["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],"FR":["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],"GA":["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[47]\\d{6}|76\\d{6})","$1"],"GB":["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0359])|(?:5[0-26-9]|[78][0-49])\\d\\d|6(?:[0-4]\\d\\d|50[0-24-69]))|2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d\\d|1(?:[0-7]\\d\\d|8(?:[02]\\d|1[0-278])))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],"GD":["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","473$1",0,"473"],"GE":["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],"GF":["594","00","(?:[56]94|80\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"GG":["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"0|([25-9]\\d{5})$","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],"GH":["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],"GI":["350","00","(?:[25]\\d\\d|606)\\d{5}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],"GL":["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],"GM":["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],"GN":["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],"GP":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|1[0-2]|2[0-68]|3[1289]|4[0-24-9]|5[3-579]|6[0189]|7[08]|8[0-689]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"GQ":["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],"GR":["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],"GT":["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"GU":["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"1|([3-9]\\d{6})$","671$1",0,"671"],"GW":["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],"GY":["592","001","(?:862\\d|9008)\\d{3}|(?:[2-46]\\d|77)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-46-9]"]]]],"HK":["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4}(?:\\d(?:\\d(?:\\d{4})?)?)?|(?:[235-79]\\d|46)\\d{6}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],"HN":["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],"HR":["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],"HT":["509","00","[2-489]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-489]"]]]],"HU":["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],"ID":["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],"IE":["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"IL":["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],"IM":["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"0|([25-8]\\d{5})$","1624$1",0,"74576|(?:16|7[56])24"],"IN":["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],"IO":["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],"IQ":["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],"IR":["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],"IS":["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],"IT":["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|55\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[38]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],"JE":["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"0|([0-24-8]\\d{5})$","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|81|9[139])\\d{6}"],["56\\d{8}"]]],"JM":["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],"JO":["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],"JP":["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:49|80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:496|802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:496|802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0"],"KE":["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],"KG":["996","00","8\\d{9}|(?:[235-8]\\d|99)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"KH":["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"KI":["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],"KM":["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],"KN":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","869$1",0,"869"],"KP":["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],"KR":["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],"KW":["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],"KY":["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","345$1",0,"345"],"KZ":["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],"LA":["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],"LB":["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],"LC":["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"1|([2-8]\\d{6})$","758$1",0,"758"],"LI":["423","00","90\\d{5}|(?:[2378]|6\\d\\d)\\d{6}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[237-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"0|(1001)"],"LK":["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],"LR":["231","00","(?:2|33|5\\d|77|88)\\d{7}|[4-6]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3578]"],"0$1"]],"0"],"LS":["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],"LT":["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],"LU":["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],"LV":["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],"LY":["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],"MA":["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29|38)[89]","5(?:29|38)[89]0"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:29(?:[189][05]|2[29]|3[01])|38[89][05])\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|90)|3(?:[0-47]\\d|5[02-9]|6[02-8]|80|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:0\\d|1[0-5]|6[1267]|7[0-57]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],"MC":["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],"MD":["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],"ME":["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],"MF":["590","00","(?:590|(?:69|80)\\d|976)\\d{6}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["976[01]\\d{5}"]]],"MG":["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"0|([24-9]\\d{6})$","20$1"],"MH":["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],"MK":["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],"ML":["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],"MM":["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],"MN":["976","001","[12]\\d{7,9}|[57-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[57-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],"MO":["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],"MP":["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","670$1",0,"670"],"MQ":["596","00","(?:69|80)\\d{7}|(?:59|97)6\\d{6}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"MR":["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],"MS":["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"1|([34]\\d{6})$","664$1",0,"664"],"MT":["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],"MU":["230","0(?:0|[24-7]0|3[03])","(?:5|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["5"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],"MV":["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[3467]|9[13-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],"MW":["265","00","(?:[19]\\d|[23]1|77|88)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],"MX":["52","0[09]","1(?:(?:44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[017]\\d|[235][1-9]|4[0-35-9]|6[0-46-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],"MY":["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9])|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1[36-8]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],"MZ":["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],"NA":["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],"NC":["687","00","[2-57-9]\\d{5}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[2-57-9]"]]]],"NE":["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[04]"]]]],"NF":["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],"NG":["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],"NI":["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],"NL":["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|[89]\\d{6,9}|1\\d{4,5}",[5,6,7,8,9,10],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-57-9]"],"0$1"]],"0"],"NO":["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[489]|59"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-7]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],"NP":["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-579]|6[2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],"NR":["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],"NU":["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],"NZ":["64","0(?:0|161)","[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-579]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|[89]0","50(?:[0367]|88)|[89]0"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[59]|80"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7|86"],"0$1"]],"0",0,0,0,0,0,0,"00"],"OM":["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],"PA":["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],"PE":["51","19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,0," Anexo "],"PF":["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],"PG":["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],"PH":["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],"PK":["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],"PL":["48","00","6\\d{5}(?:\\d{2})?|8\\d{9}|[1-9]\\d{6}(?:\\d{2})?",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],"PM":["508","00","(?:[45]|80\\d\\d)\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"PR":["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],"PS":["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"PT":["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],"PW":["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],"PY":["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],"QA":["974","00","[2-7]\\d{7}|800\\d{4}(?:\\d{2})?|2\\d{6}",[7,8,9],[["(\\d{3})(\\d{4})","$1 $2",["2[126]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]]]],"RE":["262","00","9769\\d{5}|(?:26|[68]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,"26[23]|69|[89]"],"RO":["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],"RS":["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],"RU":["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-6]2|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-6]2|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],"RW":["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]]],"0"],"SA":["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],"SB":["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],"SC":["248","010|0[0-2]","8000\\d{3}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],"SD":["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],"SE":["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],"SG":["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-4]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"SH":["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],"SI":["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],"SJ":["47","00","0\\d{4}|(?:[489]\\d|[57]9)\\d{6}",[5,8],0,0,0,0,0,0,"79"],"SK":["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],"SL":["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],"SM":["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],"SN":["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],"SO":["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["24|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3478]|64|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6(?:0[5-7]|[1-35-9])|9[2-9]"]]],"0"],"SR":["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],"SS":["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],"ST":["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],"SV":["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],"SX":["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|(5\\d{6})$","721$1",0,"721"],"SY":["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],"SZ":["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],"TA":["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],"TC":["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"1|([2-479]\\d{6})$","649$1",0,"649"],"TD":["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],"TG":["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],"TH":["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"TJ":["992","810","(?:00|[1-57-9]\\d)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[34]7|91[78]"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],"TK":["690","00","[2-47]\\d{3,6}",[4,5,6,7]],"TL":["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],"TM":["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"TN":["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],"TO":["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],"TR":["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],"TT":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-46-8]\\d{6})$","868$1",0,"868"],"TV":["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],"TW":["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],"TZ":["255","00[056]","(?:[26-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],"UA":["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["4[45][0-5]|5(?:0|6[37])|6(?:[12][018]|[36-8])|7|89|9[1-9]|(?:48|57)[0137-9]","4[45][0-5]|5(?:0|6(?:3[14-7]|7))|6(?:[12][018]|[36-8])|7|89|9[1-9]|(?:48|57)[0137-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["[3-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],"UG":["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],"US":["1","011","[2-9]\\d{9}",[10],[["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5(?:05(?:[2-57-9]\\d\\d|6(?:[0-35-9]\\d|44))|82(?:2(?:0[0-3]|[268]2)|3(?:0[02]|33)|4(?:00|4[24]|65|82)|5(?:00|29|83)|6(?:00|66|82)|777|8(?:00|88)|9(?:00|9[89])))\\d{4}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[12]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[39]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[0-5]|8[056])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[0179]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[08]|3[0-289]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01579]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[12]|33|44|66|77|88)[2-9]\\d{6}"]]],"UY":["598","0(?:0|1[3-9]\\d)","4\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"]],"0",0,0,0,0,0,0,"00"," int. "],"UZ":["998","810","(?:33|55|[679]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[35-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"VA":["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],"VC":["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"1|([2-7]\\d{6})$","784$1",0,"784"],"VE":["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],"VG":["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"1|([2-578]\\d{6})$","284$1",0,"284"],"VI":["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"1|([2-9]\\d{6})$","340$1",0,"340"],"VN":["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[69]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3578]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],"VU":["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],"WF":["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],"WS":["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],"XK":["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],"YE":["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7[24-68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],"YT":["262","00","80\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,"269|63"],"ZA":["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],"ZM":["260","00","(?:63|80)0\\d{6}|(?:21|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],"ZW":["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},"nonGeographic":{"800":["800",0,"(?:005|[1-9]\\d\\d)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:005|[1-9]\\d\\d)\\d{5}"]]],"808":["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],"870":["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],"878":["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],"881":["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],"882":["882",0,"[13]\\d{6}(?:\\d{2,5})?|285\\d{9}|(?:[19]\\d|49)\\d{6}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["4"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[19]"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["34[57]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-3]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|3(?:2|47|7\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:(?:285\\d\\d|3(?:45|[69]\\d{3}))\\d|9[89])\\d{6}"]]],"883":["883",0,"210\\d{7}|51\\d{7}(?:\\d{3})?",[9,10,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["510"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["5"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:210|51[013]0\\d)\\d{7}|5100\\d{5}"]]],"888":["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],"979":["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};
4743
4744 // Importing from `.json.js` a workaround for a bug in web browsers' "native"
4745
4746 function withMetadata(func, _arguments) {
4747 var args = Array.prototype.slice.call(_arguments);
4748 args.push(metadata);
4749 return func.apply(this, args)
4750 }
4751
4752 function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4753
4754 // https://stackoverflow.com/a/46971044/970769
4755 var ParseError = function ParseError(code) {
4756 _classCallCheck$2(this, ParseError);
4757
4758 this.name = this.constructor.name;
4759 this.message = code;
4760 this.stack = new Error(code).stack;
4761 };
4762 ParseError.prototype = Object.create(Error.prototype);
4763 ParseError.prototype.constructor = ParseError;
4764
4765 // The minimum length of the national significant number.
4766 var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15,
4767 // but one can find longer numbers in Germany.
4768
4769 var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code.
4770
4771 var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers
4772 // (ascii, fullwidth, arabic-indic, and eastern arabic digits).
4773
4774 var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; // `DASHES` will be right after the opening square bracket of the "character class"
4775
4776 var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D";
4777 var SLASHES = "\uFF0F/";
4778 var DOTS = "\uFF0E.";
4779 var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000";
4780 var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]"; // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\['
4781
4782 var TILDES = "~\u2053\u223C\uFF5E"; // Regular expression of acceptable punctuation found in phone numbers. This
4783 // excludes punctuation found as a leading character only. This consists of dash
4784 // characters, white space characters, full stops, slashes, square brackets,
4785 // parentheses and tildes. Full-width variants are also present.
4786
4787 var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
4788 var PLUS_CHARS = "+\uFF0B"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')
4789
4790 // Copy-pasted from:
4791 // https://github.com/substack/semver-compare/blob/master/index.js
4792 //
4793 // Inlining this function because some users reported issues with
4794 // importing from `semver-compare` in a browser with ES6 "native" modules.
4795 //
4796 // Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags".
4797 // https://github.com/catamphetamine/libphonenumber-js/issues/381
4798 function compare (a, b) {
4799 a = a.split('-');
4800 b = b.split('-');
4801 var pa = a[0].split('.');
4802 var pb = b[0].split('.');
4803
4804 for (var i = 0; i < 3; i++) {
4805 var na = Number(pa[i]);
4806 var nb = Number(pb[i]);
4807 if (na > nb) return 1;
4808 if (nb > na) return -1;
4809 if (!isNaN(na) && isNaN(nb)) return 1;
4810 if (isNaN(na) && !isNaN(nb)) return -1;
4811 }
4812
4813 if (a[1] && b[1]) {
4814 return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
4815 }
4816
4817 return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
4818 }
4819
4820 function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
4821
4822 function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4823
4824 function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4825
4826 function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
4827
4828 var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata.
4829
4830 var V4 = '1.7.35';
4831 var DEFAULT_EXT_PREFIX = ' ext. ';
4832 var CALLING_CODE_REG_EXP = /^\d+$/;
4833 /**
4834 * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md
4835 */
4836
4837 var Metadata =
4838 /*#__PURE__*/
4839 function () {
4840 function Metadata(metadata) {
4841 _classCallCheck$1(this, Metadata);
4842
4843 validateMetadata(metadata);
4844 this.metadata = metadata;
4845 setVersion.call(this, metadata);
4846 }
4847
4848 _createClass$1(Metadata, [{
4849 key: "getCountries",
4850 value: function getCountries() {
4851 return Object.keys(this.metadata.countries).filter(function (_) {
4852 return _ !== '001';
4853 });
4854 }
4855 }, {
4856 key: "getCountryMetadata",
4857 value: function getCountryMetadata(countryCode) {
4858 return this.metadata.countries[countryCode];
4859 }
4860 }, {
4861 key: "nonGeographic",
4862 value: function nonGeographic() {
4863 if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.
4864 // It's present in metadata generated from `1.7.35` to `1.7.37`.
4865
4866 return this.metadata.nonGeographic || this.metadata.nonGeographical;
4867 }
4868 }, {
4869 key: "hasCountry",
4870 value: function hasCountry(country) {
4871 return this.getCountryMetadata(country) !== undefined;
4872 }
4873 }, {
4874 key: "hasCallingCode",
4875 value: function hasCallingCode(callingCode) {
4876 if (this.getCountryCodesForCallingCode(callingCode)) {
4877 return true;
4878 }
4879
4880 if (this.nonGeographic()) {
4881 if (this.nonGeographic()[callingCode]) {
4882 return true;
4883 }
4884 } else {
4885 // A hacky workaround for old custom metadata (generated before V4).
4886 var countryCodes = this.countryCallingCodes()[callingCode];
4887
4888 if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
4889 return true;
4890 }
4891 }
4892 }
4893 }, {
4894 key: "isNonGeographicCallingCode",
4895 value: function isNonGeographicCallingCode(callingCode) {
4896 if (this.nonGeographic()) {
4897 return this.nonGeographic()[callingCode] ? true : false;
4898 } else {
4899 return this.getCountryCodesForCallingCode(callingCode) ? false : true;
4900 }
4901 } // Deprecated.
4902
4903 }, {
4904 key: "country",
4905 value: function country(countryCode) {
4906 return this.selectNumberingPlan(countryCode);
4907 }
4908 }, {
4909 key: "selectNumberingPlan",
4910 value: function selectNumberingPlan(countryCode, callingCode) {
4911 // Supports just passing `callingCode` as the first argument.
4912 if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
4913 callingCode = countryCode;
4914 countryCode = null;
4915 }
4916
4917 if (countryCode && countryCode !== '001') {
4918 if (!this.hasCountry(countryCode)) {
4919 throw new Error("Unknown country: ".concat(countryCode));
4920 }
4921
4922 this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
4923 } else if (callingCode) {
4924 if (!this.hasCallingCode(callingCode)) {
4925 throw new Error("Unknown calling code: ".concat(callingCode));
4926 }
4927
4928 this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
4929 } else {
4930 this.numberingPlan = undefined;
4931 }
4932
4933 return this;
4934 }
4935 }, {
4936 key: "getCountryCodesForCallingCode",
4937 value: function getCountryCodesForCallingCode(callingCode) {
4938 var countryCodes = this.countryCallingCodes()[callingCode];
4939
4940 if (countryCodes) {
4941 // Metadata before V4 included "non-geographic entity" calling codes
4942 // inside `country_calling_codes` (for example, `"881":["001"]`).
4943 // Now the semantics of `country_calling_codes` has changed:
4944 // it's specifically for "countries" now.
4945 // Older versions of custom metadata will simply skip parsing
4946 // "non-geographic entity" phone numbers with new versions
4947 // of this library: it's not considered a bug,
4948 // because such numbers are extremely rare,
4949 // and developers extremely rarely use custom metadata.
4950 if (countryCodes.length === 1 && countryCodes[0].length === 3) {
4951 return;
4952 }
4953
4954 return countryCodes;
4955 }
4956 }
4957 }, {
4958 key: "getCountryCodeForCallingCode",
4959 value: function getCountryCodeForCallingCode(callingCode) {
4960 var countryCodes = this.getCountryCodesForCallingCode(callingCode);
4961
4962 if (countryCodes) {
4963 return countryCodes[0];
4964 }
4965 }
4966 }, {
4967 key: "getNumberingPlanMetadata",
4968 value: function getNumberingPlanMetadata(callingCode) {
4969 var countryCode = this.getCountryCodeForCallingCode(callingCode);
4970
4971 if (countryCode) {
4972 return this.getCountryMetadata(countryCode);
4973 }
4974
4975 if (this.nonGeographic()) {
4976 var metadata = this.nonGeographic()[callingCode];
4977
4978 if (metadata) {
4979 return metadata;
4980 }
4981 } else {
4982 // A hacky workaround for old custom metadata (generated before V4).
4983 var countryCodes = this.countryCallingCodes()[callingCode];
4984
4985 if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
4986 return this.metadata.countries['001'];
4987 }
4988 }
4989 } // Deprecated.
4990
4991 }, {
4992 key: "countryCallingCode",
4993 value: function countryCallingCode() {
4994 return this.numberingPlan.callingCode();
4995 } // Deprecated.
4996
4997 }, {
4998 key: "IDDPrefix",
4999 value: function IDDPrefix() {
5000 return this.numberingPlan.IDDPrefix();
5001 } // Deprecated.
5002
5003 }, {
5004 key: "defaultIDDPrefix",
5005 value: function defaultIDDPrefix() {
5006 return this.numberingPlan.defaultIDDPrefix();
5007 } // Deprecated.
5008
5009 }, {
5010 key: "nationalNumberPattern",
5011 value: function nationalNumberPattern() {
5012 return this.numberingPlan.nationalNumberPattern();
5013 } // Deprecated.
5014
5015 }, {
5016 key: "possibleLengths",
5017 value: function possibleLengths() {
5018 return this.numberingPlan.possibleLengths();
5019 } // Deprecated.
5020
5021 }, {
5022 key: "formats",
5023 value: function formats() {
5024 return this.numberingPlan.formats();
5025 } // Deprecated.
5026
5027 }, {
5028 key: "nationalPrefixForParsing",
5029 value: function nationalPrefixForParsing() {
5030 return this.numberingPlan.nationalPrefixForParsing();
5031 } // Deprecated.
5032
5033 }, {
5034 key: "nationalPrefixTransformRule",
5035 value: function nationalPrefixTransformRule() {
5036 return this.numberingPlan.nationalPrefixTransformRule();
5037 } // Deprecated.
5038
5039 }, {
5040 key: "leadingDigits",
5041 value: function leadingDigits() {
5042 return this.numberingPlan.leadingDigits();
5043 } // Deprecated.
5044
5045 }, {
5046 key: "hasTypes",
5047 value: function hasTypes() {
5048 return this.numberingPlan.hasTypes();
5049 } // Deprecated.
5050
5051 }, {
5052 key: "type",
5053 value: function type(_type) {
5054 return this.numberingPlan.type(_type);
5055 } // Deprecated.
5056
5057 }, {
5058 key: "ext",
5059 value: function ext() {
5060 return this.numberingPlan.ext();
5061 }
5062 }, {
5063 key: "countryCallingCodes",
5064 value: function countryCallingCodes() {
5065 if (this.v1) return this.metadata.country_phone_code_to_countries;
5066 return this.metadata.country_calling_codes;
5067 } // Deprecated.
5068
5069 }, {
5070 key: "chooseCountryByCountryCallingCode",
5071 value: function chooseCountryByCountryCallingCode(callingCode) {
5072 return this.selectNumberingPlan(callingCode);
5073 }
5074 }, {
5075 key: "hasSelectedNumberingPlan",
5076 value: function hasSelectedNumberingPlan() {
5077 return this.numberingPlan !== undefined;
5078 }
5079 }]);
5080
5081 return Metadata;
5082 }();
5083
5084 var NumberingPlan =
5085 /*#__PURE__*/
5086 function () {
5087 function NumberingPlan(metadata, globalMetadataObject) {
5088 _classCallCheck$1(this, NumberingPlan);
5089
5090 this.globalMetadataObject = globalMetadataObject;
5091 this.metadata = metadata;
5092 setVersion.call(this, globalMetadataObject.metadata);
5093 }
5094
5095 _createClass$1(NumberingPlan, [{
5096 key: "callingCode",
5097 value: function callingCode() {
5098 return this.metadata[0];
5099 } // Formatting information for regions which share
5100 // a country calling code is contained by only one region
5101 // for performance reasons. For example, for NANPA region
5102 // ("North American Numbering Plan Administration",
5103 // which includes USA, Canada, Cayman Islands, Bahamas, etc)
5104 // it will be contained in the metadata for `US`.
5105
5106 }, {
5107 key: "getDefaultCountryMetadataForRegion",
5108 value: function getDefaultCountryMetadataForRegion() {
5109 return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
5110 } // Is always present.
5111
5112 }, {
5113 key: "IDDPrefix",
5114 value: function IDDPrefix() {
5115 if (this.v1 || this.v2) return;
5116 return this.metadata[1];
5117 } // Is only present when a country supports multiple IDD prefixes.
5118
5119 }, {
5120 key: "defaultIDDPrefix",
5121 value: function defaultIDDPrefix() {
5122 if (this.v1 || this.v2) return;
5123 return this.metadata[12];
5124 }
5125 }, {
5126 key: "nationalNumberPattern",
5127 value: function nationalNumberPattern() {
5128 if (this.v1 || this.v2) return this.metadata[1];
5129 return this.metadata[2];
5130 } // Is always present.
5131
5132 }, {
5133 key: "possibleLengths",
5134 value: function possibleLengths() {
5135 if (this.v1) return;
5136 return this.metadata[this.v2 ? 2 : 3];
5137 }
5138 }, {
5139 key: "_getFormats",
5140 value: function _getFormats(metadata) {
5141 return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];
5142 } // For countries of the same region (e.g. NANPA)
5143 // formats are all stored in the "main" country for that region.
5144 // E.g. "RU" and "KZ", "US" and "CA".
5145
5146 }, {
5147 key: "formats",
5148 value: function formats() {
5149 var _this = this;
5150
5151 var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
5152 return formats.map(function (_) {
5153 return new Format(_, _this);
5154 });
5155 }
5156 }, {
5157 key: "nationalPrefix",
5158 value: function nationalPrefix() {
5159 return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
5160 }
5161 }, {
5162 key: "_getNationalPrefixFormattingRule",
5163 value: function _getNationalPrefixFormattingRule(metadata) {
5164 return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];
5165 } // For countries of the same region (e.g. NANPA)
5166 // national prefix formatting rule is stored in the "main" country for that region.
5167 // E.g. "RU" and "KZ", "US" and "CA".
5168
5169 }, {
5170 key: "nationalPrefixFormattingRule",
5171 value: function nationalPrefixFormattingRule() {
5172 return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
5173 }
5174 }, {
5175 key: "_nationalPrefixForParsing",
5176 value: function _nationalPrefixForParsing() {
5177 return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
5178 }
5179 }, {
5180 key: "nationalPrefixForParsing",
5181 value: function nationalPrefixForParsing() {
5182 // If `national_prefix_for_parsing` is not set explicitly,
5183 // then infer it from `national_prefix` (if any)
5184 return this._nationalPrefixForParsing() || this.nationalPrefix();
5185 }
5186 }, {
5187 key: "nationalPrefixTransformRule",
5188 value: function nationalPrefixTransformRule() {
5189 return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
5190 }
5191 }, {
5192 key: "_getNationalPrefixIsOptionalWhenFormatting",
5193 value: function _getNationalPrefixIsOptionalWhenFormatting() {
5194 return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
5195 } // For countries of the same region (e.g. NANPA)
5196 // "national prefix is optional when formatting" flag is
5197 // stored in the "main" country for that region.
5198 // E.g. "RU" and "KZ", "US" and "CA".
5199
5200 }, {
5201 key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
5202 value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
5203 return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
5204 }
5205 }, {
5206 key: "leadingDigits",
5207 value: function leadingDigits() {
5208 return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
5209 }
5210 }, {
5211 key: "types",
5212 value: function types() {
5213 return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
5214 }
5215 }, {
5216 key: "hasTypes",
5217 value: function hasTypes() {
5218 // Versions 1.2.0 - 1.2.4: can be `[]`.
5219
5220 /* istanbul ignore next */
5221 if (this.types() && this.types().length === 0) {
5222 return false;
5223 } // Versions <= 1.2.4: can be `undefined`.
5224 // Version >= 1.2.5: can be `0`.
5225
5226
5227 return !!this.types();
5228 }
5229 }, {
5230 key: "type",
5231 value: function type(_type2) {
5232 if (this.hasTypes() && getType(this.types(), _type2)) {
5233 return new Type(getType(this.types(), _type2), this);
5234 }
5235 }
5236 }, {
5237 key: "ext",
5238 value: function ext() {
5239 if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;
5240 return this.metadata[13] || DEFAULT_EXT_PREFIX;
5241 }
5242 }]);
5243
5244 return NumberingPlan;
5245 }();
5246
5247 var Format =
5248 /*#__PURE__*/
5249 function () {
5250 function Format(format, metadata) {
5251 _classCallCheck$1(this, Format);
5252
5253 this._format = format;
5254 this.metadata = metadata;
5255 }
5256
5257 _createClass$1(Format, [{
5258 key: "pattern",
5259 value: function pattern() {
5260 return this._format[0];
5261 }
5262 }, {
5263 key: "format",
5264 value: function format() {
5265 return this._format[1];
5266 }
5267 }, {
5268 key: "leadingDigitsPatterns",
5269 value: function leadingDigitsPatterns() {
5270 return this._format[2] || [];
5271 }
5272 }, {
5273 key: "nationalPrefixFormattingRule",
5274 value: function nationalPrefixFormattingRule() {
5275 return this._format[3] || this.metadata.nationalPrefixFormattingRule();
5276 }
5277 }, {
5278 key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
5279 value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
5280 return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
5281 }
5282 }, {
5283 key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
5284 value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
5285 // National prefix is omitted if there's no national prefix formatting rule
5286 // set for this country, or when the national prefix formatting rule
5287 // contains no national prefix itself, or when this rule is set but
5288 // national prefix is optional for this phone number format
5289 // (and it is not enforced explicitly)
5290 return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
5291 } // Checks whether national prefix formatting rule contains national prefix.
5292
5293 }, {
5294 key: "usesNationalPrefix",
5295 value: function usesNationalPrefix() {
5296 return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
5297 !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`
5298 // when `national_prefix_formatting_rule` is not present.
5299 // So, `true` or `false` are returned explicitly here, so that
5300 // `0` number isn't returned.
5301 ? true : false;
5302 }
5303 }, {
5304 key: "internationalFormat",
5305 value: function internationalFormat() {
5306 return this._format[5] || this.format();
5307 }
5308 }]);
5309
5310 return Format;
5311 }();
5312 /**
5313 * A pattern that is used to determine if the national prefix formatting rule
5314 * has the first group only, i.e., does not start with the national prefix.
5315 * Note that the pattern explicitly allows for unbalanced parentheses.
5316 */
5317
5318
5319 var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
5320
5321 var Type =
5322 /*#__PURE__*/
5323 function () {
5324 function Type(type, metadata) {
5325 _classCallCheck$1(this, Type);
5326
5327 this.type = type;
5328 this.metadata = metadata;
5329 }
5330
5331 _createClass$1(Type, [{
5332 key: "pattern",
5333 value: function pattern() {
5334 if (this.metadata.v1) return this.type;
5335 return this.type[0];
5336 }
5337 }, {
5338 key: "possibleLengths",
5339 value: function possibleLengths() {
5340 if (this.metadata.v1) return;
5341 return this.type[1] || this.metadata.possibleLengths();
5342 }
5343 }]);
5344
5345 return Type;
5346 }();
5347
5348 function getType(types, type) {
5349 switch (type) {
5350 case 'FIXED_LINE':
5351 return types[0];
5352
5353 case 'MOBILE':
5354 return types[1];
5355
5356 case 'TOLL_FREE':
5357 return types[2];
5358
5359 case 'PREMIUM_RATE':
5360 return types[3];
5361
5362 case 'PERSONAL_NUMBER':
5363 return types[4];
5364
5365 case 'VOICEMAIL':
5366 return types[5];
5367
5368 case 'UAN':
5369 return types[6];
5370
5371 case 'PAGER':
5372 return types[7];
5373
5374 case 'VOIP':
5375 return types[8];
5376
5377 case 'SHARED_COST':
5378 return types[9];
5379 }
5380 }
5381
5382 function validateMetadata(metadata) {
5383 if (!metadata) {
5384 throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');
5385 } // `country_phone_code_to_countries` was renamed to
5386 // `country_calling_codes` in `1.0.18`.
5387
5388
5389 if (!is_object(metadata) || !is_object(metadata.countries)) {
5390 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(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, "."));
5391 }
5392 } // Babel transforms `typeof` into some "branches"
5393 // so istanbul will show this as "branch not covered".
5394
5395 /* istanbul ignore next */
5396
5397 var is_object = function is_object(_) {
5398 return _typeof$1(_) === 'object';
5399 }; // Babel transforms `typeof` into some "branches"
5400 // so istanbul will show this as "branch not covered".
5401
5402 /* istanbul ignore next */
5403
5404
5405 var type_of = function type_of(_) {
5406 return _typeof$1(_);
5407 };
5408 /**
5409 * Returns "country calling code" for a country.
5410 * Throws an error if the country doesn't exist or isn't supported by this library.
5411 * @param {string} country
5412 * @param {object} metadata
5413 * @return {string}
5414 * @example
5415 * // Returns "44"
5416 * getCountryCallingCode("GB")
5417 */
5418
5419 function getCountryCallingCode(country, metadata) {
5420 metadata = new Metadata(metadata);
5421
5422 if (metadata.hasCountry(country)) {
5423 return metadata.country(country).countryCallingCode();
5424 }
5425
5426 throw new Error("Unknown country: ".concat(country));
5427 }
5428 function isSupportedCountry(country, metadata) {
5429 // metadata = new Metadata(metadata)
5430 // return metadata.hasCountry(country)
5431 return metadata.countries[country] !== undefined;
5432 }
5433
5434 function setVersion(metadata) {
5435 var version = metadata.version;
5436
5437 if (typeof version === 'number') {
5438 this.v1 = version === 1;
5439 this.v2 = version === 2;
5440 this.v3 = version === 3;
5441 this.v4 = version === 4;
5442 } else {
5443 if (!version) {
5444 this.v1 = true;
5445 } else if (compare(version, V3) === -1) {
5446 this.v2 = true;
5447 } else if (compare(version, V4) === -1) {
5448 this.v3 = true;
5449 } else {
5450 this.v4 = true;
5451 }
5452 }
5453 } // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/
5454 // function isCountryCode(countryCode) {
5455 // return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)
5456 // }
5457
5458 var RFC3966_EXTN_PREFIX = ';ext=';
5459 /**
5460 * Helper method for constructing regular expressions for parsing. Creates
5461 * an expression that captures up to max_length digits.
5462 * @return {string} RegEx pattern to capture extension digits.
5463 */
5464
5465 var getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {
5466 return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
5467 };
5468 /**
5469 * Helper initialiser method to create the regular-expression pattern to match
5470 * extensions.
5471 * Copy-pasted from Google's `libphonenumber`:
5472 * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766
5473 * @return {string} RegEx pattern to capture extensions.
5474 */
5475
5476
5477 function createExtensionPattern(purpose) {
5478 // We cap the maximum length of an extension based on the ambiguity of the way
5479 // the extension is prefixed. As per ITU, the officially allowed length for
5480 // extensions is actually 40, but we don't support this since we haven't seen real
5481 // examples and this introduces many false interpretations as the extension labels
5482 // are not standardized.
5483
5484 /** @type {string} */
5485 var extLimitAfterExplicitLabel = '20';
5486 /** @type {string} */
5487
5488 var extLimitAfterLikelyLabel = '15';
5489 /** @type {string} */
5490
5491 var extLimitAfterAmbiguousChar = '9';
5492 /** @type {string} */
5493
5494 var extLimitWhenNotSure = '6';
5495 /** @type {string} */
5496
5497 var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*"; // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.
5498
5499 /** @type {string} */
5500
5501 var possibleCharsAfterExtLabel = "[:\\.\uFF0E]?[ \xA0\\t,-]*";
5502 /** @type {string} */
5503
5504 var optionalExtnSuffix = "#?"; // Here the extension is called out in more explicit way, i.e mentioning it obvious
5505 // patterns like "ext.".
5506
5507 /** @type {string} */
5508
5509 var explicitExtLabels = "(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)"; // One-character symbols that can be used to indicate an extension, and less
5510 // commonly used or more ambiguous extension labels.
5511
5512 /** @type {string} */
5513
5514 var ambiguousExtLabels = "(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)"; // When extension is not separated clearly.
5515
5516 /** @type {string} */
5517
5518 var ambiguousSeparator = "[- ]+"; // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching
5519 // comma as extension label may have it.
5520
5521 /** @type {string} */
5522
5523 var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*"; // ",," is commonly used for auto dialling the extension when connected. First
5524 // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do
5525 // not repeat it here. Semi-colon works in Iphone and Android also to pop up a
5526 // button with the extension number following.
5527
5528 /** @type {string} */
5529
5530 var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
5531 /** @type {string} */
5532
5533 var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
5534 /** @type {string} */
5535
5536 var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
5537 /** @type {string} */
5538
5539 var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
5540 /** @type {string} */
5541
5542 var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
5543 /** @type {string} */
5544
5545 var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
5546 /** @type {string} */
5547
5548 var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; // The first regular expression covers RFC 3966 format, where the extension is added
5549 // using ";ext=". The second more generic where extension is mentioned with explicit
5550 // labels like "ext:". In both the above cases we allow more numbers in extension than
5551 // any other extension labels. The third one captures when single character extension
5552 // labels or less commonly used labels are used. In such cases we capture fewer
5553 // extension digits in order to reduce the chance of falsely interpreting two
5554 // numbers beside each other as a number + extension. The fourth one covers the
5555 // special case of American numbers where the extension is written with a hash
5556 // at the end, such as "- 503#". The fifth one is exclusively for extension
5557 // autodialling formats which are used when dialling and in this case we accept longer
5558 // extensions. The last one is more liberal on the number of commas that acts as
5559 // extension labels, so we have a strict cap on the number of digits in such extensions.
5560
5561 return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
5562 }
5563
5564 // Checks we have at least three leading digits, and only valid punctuation,
5565 // alpha characters and digits in the phone number. Does not include extension
5566 // data. The symbol 'x' is allowed here as valid punctuation since it is often
5567 // used as a placeholder for carrier codes, for example in Brazilian phone
5568 // numbers. We also allow multiple '+' characters at the start.
5569 //
5570 // Corresponds to the following:
5571 // [digits]{minLengthNsn}|
5572 // plus_sign*
5573 // (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*
5574 //
5575 // The first reg-ex is to allow short numbers (two digits long) to be parsed if
5576 // they are entered as "15" etc, but only if there is no punctuation in them.
5577 // The second expression restricts the number of digits to three or more, but
5578 // then allows them to be in international form, and to have alpha-characters
5579 // and punctuation. We split up the two reg-exes here and combine them when
5580 // creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it
5581 // with ^ and append $ to each branch.
5582 //
5583 // "Note VALID_PUNCTUATION starts with a -,
5584 // so must be the first in the range" (c) Google devs.
5585 // (wtf did they mean by saying that; probably nothing)
5586 //
5587
5588 var MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; //
5589 // And this is the second reg-exp:
5590 // (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)
5591 //
5592
5593 var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // This regular expression isn't present in Google's `libphonenumber`
5594 // and is only used to determine whether the phone number being input
5595 // is too short for it to even consider it a "valid" number.
5596 // This is just a way to differentiate between a really invalid phone
5597 // number like "abcde" and a valid phone number that a user has just
5598 // started inputting, like "+1" or "1": both these cases would be
5599 // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this
5600 // library can provide a more detailed error message — whether it's
5601 // really "not a number", or is it just a start of a valid phone number.
5602
5603 var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp('^' + '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){1,2}' + '$', 'i');
5604 var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions
5605 '(?:' + createExtensionPattern() + ')?'; // The combined regular expression for valid phone numbers:
5606 //
5607
5608 var VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number
5609 '^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters)
5610 '^' + VALID_PHONE_NUMBER_WITH_EXTENSION + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at
5611 // all. At the moment, checks to see that the string begins with at least 2
5612 // digits, ignoring any punctuation commonly found in phone numbers. This method
5613 // does not require the number to be normalized in advance - but does assume
5614 // that leading non-number symbols have been removed, such as by the method
5615 // `extract_possible_number`.
5616 //
5617
5618 function isViablePhoneNumber(number) {
5619 return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);
5620 } // This is just a way to differentiate between a really invalid phone
5621 // number like "abcde" and a valid phone number that a user has just
5622 // started inputting, like "+1" or "1": both these cases would be
5623 // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this
5624 // library can provide a more detailed error message — whether it's
5625 // really "not a number", or is it just a start of a valid phone number.
5626
5627 function isViablePhoneNumberStart(number) {
5628 return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
5629 }
5630
5631 // 1 or more valid digits, for use when parsing.
5632
5633 var EXTN_PATTERN = new RegExp('(?:' + createExtensionPattern() + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is
5634 // connected, usually indicated with extn, ext, x or similar) from the end of
5635 // the number, and returns it.
5636
5637 function extractExtension(number) {
5638 var start = number.search(EXTN_PATTERN);
5639
5640 if (start < 0) {
5641 return {};
5642 } // If we find a potential extension, and the number preceding this is a viable
5643 // number, we assume it is an extension.
5644
5645
5646 var numberWithoutExtension = number.slice(0, start);
5647 var matches = number.match(EXTN_PATTERN);
5648 var i = 1;
5649
5650 while (i < matches.length) {
5651 if (matches[i]) {
5652 return {
5653 number: numberWithoutExtension,
5654 ext: matches[i]
5655 };
5656 }
5657
5658 i++;
5659 }
5660 }
5661
5662 // These mappings map a character (key) to a specific digit that should
5663 // replace it for normalization purposes. Non-European digits that
5664 // may be used in phone numbers are mapped to a European equivalent.
5665 //
5666 // E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
5667 //
5668 var DIGITS = {
5669 '0': '0',
5670 '1': '1',
5671 '2': '2',
5672 '3': '3',
5673 '4': '4',
5674 '5': '5',
5675 '6': '6',
5676 '7': '7',
5677 '8': '8',
5678 '9': '9',
5679 "\uFF10": '0',
5680 // Fullwidth digit 0
5681 "\uFF11": '1',
5682 // Fullwidth digit 1
5683 "\uFF12": '2',
5684 // Fullwidth digit 2
5685 "\uFF13": '3',
5686 // Fullwidth digit 3
5687 "\uFF14": '4',
5688 // Fullwidth digit 4
5689 "\uFF15": '5',
5690 // Fullwidth digit 5
5691 "\uFF16": '6',
5692 // Fullwidth digit 6
5693 "\uFF17": '7',
5694 // Fullwidth digit 7
5695 "\uFF18": '8',
5696 // Fullwidth digit 8
5697 "\uFF19": '9',
5698 // Fullwidth digit 9
5699 "\u0660": '0',
5700 // Arabic-indic digit 0
5701 "\u0661": '1',
5702 // Arabic-indic digit 1
5703 "\u0662": '2',
5704 // Arabic-indic digit 2
5705 "\u0663": '3',
5706 // Arabic-indic digit 3
5707 "\u0664": '4',
5708 // Arabic-indic digit 4
5709 "\u0665": '5',
5710 // Arabic-indic digit 5
5711 "\u0666": '6',
5712 // Arabic-indic digit 6
5713 "\u0667": '7',
5714 // Arabic-indic digit 7
5715 "\u0668": '8',
5716 // Arabic-indic digit 8
5717 "\u0669": '9',
5718 // Arabic-indic digit 9
5719 "\u06F0": '0',
5720 // Eastern-Arabic digit 0
5721 "\u06F1": '1',
5722 // Eastern-Arabic digit 1
5723 "\u06F2": '2',
5724 // Eastern-Arabic digit 2
5725 "\u06F3": '3',
5726 // Eastern-Arabic digit 3
5727 "\u06F4": '4',
5728 // Eastern-Arabic digit 4
5729 "\u06F5": '5',
5730 // Eastern-Arabic digit 5
5731 "\u06F6": '6',
5732 // Eastern-Arabic digit 6
5733 "\u06F7": '7',
5734 // Eastern-Arabic digit 7
5735 "\u06F8": '8',
5736 // Eastern-Arabic digit 8
5737 "\u06F9": '9' // Eastern-Arabic digit 9
5738
5739 };
5740 function parseDigit(character) {
5741 return DIGITS[character];
5742 }
5743
5744 /**
5745 * Parses phone number characters from a string.
5746 * Drops all punctuation leaving only digits and the leading `+` sign (if any).
5747 * Also converts wide-ascii and arabic-indic numerals to conventional numerals.
5748 * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
5749 * @param {string} string
5750 * @return {string}
5751 * @example
5752 * ```js
5753 * // Outputs '8800555'.
5754 * parseIncompletePhoneNumber('8 (800) 555')
5755 * // Outputs '+7800555'.
5756 * parseIncompletePhoneNumber('+7 800 555')
5757 * ```
5758 */
5759
5760 function parseIncompletePhoneNumber(string) {
5761 var result = ''; // Using `.split('')` here instead of normal `for ... of`
5762 // because the importing application doesn't neccessarily include an ES6 polyfill.
5763 // The `.split('')` approach discards "exotic" UTF-8 characters
5764 // (the ones consisting of four bytes) but digits
5765 // (including non-European ones) don't fall into that range
5766 // so such "exotic" characters would be discarded anyway.
5767
5768 for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
5769 var _ref;
5770
5771 if (_isArray) {
5772 if (_i >= _iterator.length) break;
5773 _ref = _iterator[_i++];
5774 } else {
5775 _i = _iterator.next();
5776 if (_i.done) break;
5777 _ref = _i.value;
5778 }
5779
5780 var character = _ref;
5781 result += parsePhoneNumberCharacter(character, result) || '';
5782 }
5783
5784 return result;
5785 }
5786 /**
5787 * Parses next character while parsing phone number digits (including a `+`)
5788 * from text: discards everything except `+` and digits, and `+` is only allowed
5789 * at the start of a phone number.
5790 * For example, is used in `react-phone-number-input` where it uses
5791 * [`input-format`](https://gitlab.com/catamphetamine/input-format).
5792 * @param {string} character - Yet another character from raw input string.
5793 * @param {string?} prevParsedCharacters - Previous parsed characters.
5794 * @param {object} meta - Optional custom use-case-specific metadata.
5795 * @return {string?} The parsed character.
5796 */
5797
5798 function parsePhoneNumberCharacter(character, prevParsedCharacters) {
5799 // Only allow a leading `+`.
5800 if (character === '+') {
5801 // If this `+` is not the first parsed character
5802 // then discard it.
5803 if (prevParsedCharacters) {
5804 return;
5805 }
5806
5807 return '+';
5808 } // Allow digits.
5809
5810
5811 return parseDigit(character);
5812 }
5813
5814 /**
5815 * Merges two arrays.
5816 * @param {*} a
5817 * @param {*} b
5818 * @return {*}
5819 */
5820 function mergeArrays(a, b) {
5821 var merged = a.slice();
5822
5823 for (var _iterator = b, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
5824 var _ref;
5825
5826 if (_isArray) {
5827 if (_i >= _iterator.length) break;
5828 _ref = _iterator[_i++];
5829 } else {
5830 _i = _iterator.next();
5831 if (_i.done) break;
5832 _ref = _i.value;
5833 }
5834
5835 var element = _ref;
5836
5837 if (a.indexOf(element) < 0) {
5838 merged.push(element);
5839 }
5840 }
5841
5842 return merged.sort(function (a, b) {
5843 return a - b;
5844 }); // ES6 version, requires Set polyfill.
5845 // let merged = new Set(a)
5846 // for (const element of b) {
5847 // merged.add(i)
5848 // }
5849 // return Array.from(merged).sort((a, b) => a - b)
5850 }
5851
5852 function checkNumberLength(nationalNumber, metadata) {
5853 return checkNumberLengthForType(nationalNumber, undefined, metadata);
5854 } // Checks whether a number is possible for the country based on its length.
5855 // Should only be called for the "new" metadata which has "possible lengths".
5856
5857 function checkNumberLengthForType(nationalNumber, type, metadata) {
5858 var type_info = metadata.type(type); // There should always be "<possiblePengths/>" set for every type element.
5859 // This is declared in the XML schema.
5860 // For size efficiency, where a sub-description (e.g. fixed-line)
5861 // has the same "<possiblePengths/>" as the "general description", this is missing,
5862 // so we fall back to the "general description". Where no numbers of the type
5863 // exist at all, there is one possible length (-1) which is guaranteed
5864 // not to match the length of any real phone number.
5865
5866 var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()
5867 // Metadata before version `1.0.18` didn't contain `possible_lengths`.
5868
5869 if (!possible_lengths) {
5870 return 'IS_POSSIBLE';
5871 }
5872
5873 if (type === 'FIXED_LINE_OR_MOBILE') {
5874 // No such country in metadata.
5875
5876 /* istanbul ignore next */
5877 if (!metadata.type('FIXED_LINE')) {
5878 // The rare case has been encountered where no fixedLine data is available
5879 // (true for some non-geographic entities), so we just check mobile.
5880 return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);
5881 }
5882
5883 var mobile_type = metadata.type('MOBILE');
5884
5885 if (mobile_type) {
5886 // Merge the mobile data in if there was any. "Concat" creates a new
5887 // array, it doesn't edit possible_lengths in place, so we don't need a copy.
5888 // Note that when adding the possible lengths from mobile, we have
5889 // to again check they aren't empty since if they are this indicates
5890 // they are the same as the general desc and should be obtained from there.
5891 possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and
5892 // re-sort (duplicates are okay). Sorting isn't so expensive because
5893 // the lists are very small.
5894 // if (local_lengths) {
5895 // local_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())
5896 // } else {
5897 // local_lengths = mobile_type.possibleLengthsLocal()
5898 // }
5899 }
5900 } // If the type doesn't exist then return 'INVALID_LENGTH'.
5901 else if (type && !type_info) {
5902 return 'INVALID_LENGTH';
5903 }
5904
5905 var actual_length = nationalNumber.length; // In `libphonenumber-js` all "local-only" formats are dropped for simplicity.
5906 // // This is safe because there is never an overlap beween the possible lengths
5907 // // and the local-only lengths; this is checked at build time.
5908 // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)
5909 // {
5910 // return 'IS_POSSIBLE_LOCAL_ONLY'
5911 // }
5912
5913 var minimum_length = possible_lengths[0];
5914
5915 if (minimum_length === actual_length) {
5916 return 'IS_POSSIBLE';
5917 }
5918
5919 if (minimum_length > actual_length) {
5920 return 'TOO_SHORT';
5921 }
5922
5923 if (possible_lengths[possible_lengths.length - 1] < actual_length) {
5924 return 'TOO_LONG';
5925 } // We skip the first element since we've already checked it.
5926
5927
5928 return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';
5929 }
5930
5931 function isPossiblePhoneNumber(input, options, metadata) {
5932 /* istanbul ignore if */
5933 if (options === undefined) {
5934 options = {};
5935 }
5936
5937 metadata = new Metadata(metadata);
5938
5939 if (options.v2) {
5940 if (!input.countryCallingCode) {
5941 throw new Error('Invalid phone number object passed');
5942 }
5943
5944 metadata.selectNumberingPlan(input.countryCallingCode);
5945 } else {
5946 if (!input.phone) {
5947 return false;
5948 }
5949
5950 if (input.country) {
5951 if (!metadata.hasCountry(input.country)) {
5952 throw new Error("Unknown country: ".concat(input.country));
5953 }
5954
5955 metadata.country(input.country);
5956 } else {
5957 if (!input.countryCallingCode) {
5958 throw new Error('Invalid phone number object passed');
5959 }
5960
5961 metadata.selectNumberingPlan(input.countryCallingCode);
5962 }
5963 }
5964
5965 if (metadata.possibleLengths()) {
5966 return isPossibleNumber(input.phone || input.nationalNumber, metadata);
5967 } else {
5968 // There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
5969 // were missing for "non-geographical" numbering plans.
5970 // Just assume the number is possible in such cases:
5971 // it's unlikely that anyone generated their custom metadata
5972 // in that short period of time (one day).
5973 // This code can be removed in some future major version update.
5974 if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
5975 // "Non-geographic entities" did't have `possibleLengths`
5976 // due to a bug in metadata generation process.
5977 return true;
5978 } else {
5979 throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
5980 }
5981 }
5982 }
5983 function isPossibleNumber(nationalNumber, metadata) {
5984 //, isInternational) {
5985 switch (checkNumberLength(nationalNumber, metadata)) {
5986 case 'IS_POSSIBLE':
5987 return true;
5988 // This library ignores "local-only" phone numbers (for simplicity).
5989 // See the readme for more info on what are "local-only" phone numbers.
5990 // case 'IS_POSSIBLE_LOCAL_ONLY':
5991 // return !isInternational
5992
5993 default:
5994 return false;
5995 }
5996 }
5997
5998 function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1(); }
5999
6000 function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
6001
6002 function _iterableToArrayLimit$1(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
6003
6004 function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
6005
6006 /**
6007 * @param {string} text - Phone URI (RFC 3966).
6008 * @return {object} `{ ?number, ?ext }`.
6009 */
6010
6011 function parseRFC3966(text) {
6012 var number;
6013 var ext; // Replace "tel:" with "tel=" for parsing convenience.
6014
6015 text = text.replace(/^tel:/, 'tel=');
6016
6017 for (var _iterator = text.split(';'), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
6018 var _ref;
6019
6020 if (_isArray) {
6021 if (_i >= _iterator.length) break;
6022 _ref = _iterator[_i++];
6023 } else {
6024 _i = _iterator.next();
6025 if (_i.done) break;
6026 _ref = _i.value;
6027 }
6028
6029 var part = _ref;
6030
6031 var _part$split = part.split('='),
6032 _part$split2 = _slicedToArray$1(_part$split, 2),
6033 name = _part$split2[0],
6034 value = _part$split2[1];
6035
6036 switch (name) {
6037 case 'tel':
6038 number = value;
6039 break;
6040
6041 case 'ext':
6042 ext = value;
6043 break;
6044
6045 case 'phone-context':
6046 // Only "country contexts" are supported.
6047 // "Domain contexts" are ignored.
6048 if (value[0] === '+') {
6049 number = value + number;
6050 }
6051
6052 break;
6053 }
6054 } // If the phone number is not viable, then abort.
6055
6056
6057 if (!isViablePhoneNumber(number)) {
6058 return {};
6059 }
6060
6061 var result = {
6062 number: number
6063 };
6064
6065 if (ext) {
6066 result.ext = ext;
6067 }
6068
6069 return result;
6070 }
6071 /**
6072 * @param {object} - `{ ?number, ?extension }`.
6073 * @return {string} Phone URI (RFC 3966).
6074 */
6075
6076 function formatRFC3966(_ref2) {
6077 var number = _ref2.number,
6078 ext = _ref2.ext;
6079
6080 if (!number) {
6081 return '';
6082 }
6083
6084 if (number[0] !== '+') {
6085 throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format.");
6086 }
6087
6088 return "tel:".concat(number).concat(ext ? ';ext=' + ext : '');
6089 }
6090
6091 /**
6092 * Checks whether the entire input sequence can be matched
6093 * against the regular expression.
6094 * @return {boolean}
6095 */
6096 function matchesEntirely(text, regular_expression) {
6097 // If assigning the `''` default value is moved to the arguments above,
6098 // code coverage would decrease for some weird reason.
6099 text = text || '';
6100 return new RegExp('^(?:' + regular_expression + ')$').test(text);
6101 }
6102
6103 var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)
6104
6105 function getNumberType(input, options, metadata) {
6106 // If assigning the `{}` default value is moved to the arguments above,
6107 // code coverage would decrease for some weird reason.
6108 options = options || {}; // When `parse()` returned `{}`
6109 // meaning that the phone number is not a valid one.
6110
6111 if (!input.country) {
6112 return;
6113 }
6114
6115 metadata = new Metadata(metadata);
6116 metadata.selectNumberingPlan(input.country, input.countryCallingCode);
6117 var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:
6118 // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835
6119 // Is this national number even valid for this country
6120
6121 if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {
6122 return;
6123 } // Is it fixed line number
6124
6125
6126 if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {
6127 // Because duplicate regular expressions are removed
6128 // to reduce metadata size, if "mobile" pattern is ""
6129 // then it means it was removed due to being a duplicate of the fixed-line pattern.
6130 //
6131 if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {
6132 return 'FIXED_LINE_OR_MOBILE';
6133 } // v1 metadata.
6134 // Legacy.
6135 // Deprecated.
6136
6137
6138 if (!metadata.type('MOBILE')) {
6139 return 'FIXED_LINE_OR_MOBILE';
6140 } // Check if the number happens to qualify as both fixed line and mobile.
6141 // (no such country in the minimal metadata set)
6142
6143 /* istanbul ignore if */
6144
6145
6146 if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {
6147 return 'FIXED_LINE_OR_MOBILE';
6148 }
6149
6150 return 'FIXED_LINE';
6151 }
6152
6153 for (var _i = 0, _NON_FIXED_LINE_PHONE = NON_FIXED_LINE_PHONE_TYPES; _i < _NON_FIXED_LINE_PHONE.length; _i++) {
6154 var type = _NON_FIXED_LINE_PHONE[_i];
6155
6156 if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
6157 return type;
6158 }
6159 }
6160 }
6161 function isNumberTypeEqualTo(nationalNumber, type, metadata) {
6162 type = metadata.type(type);
6163
6164 if (!type || !type.pattern()) {
6165 return false;
6166 } // Check if any possible number lengths are present;
6167 // if so, we use them to avoid checking
6168 // the validation pattern if they don't match.
6169 // If they are absent, this means they match
6170 // the general description, which we have
6171 // already checked before a specific number type.
6172
6173
6174 if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {
6175 return false;
6176 }
6177
6178 return matchesEntirely(nationalNumber, type.pattern());
6179 }
6180
6181 /**
6182 * Checks if a given phone number is valid.
6183 *
6184 * If the `number` is a string, it will be parsed to an object,
6185 * but only if it contains only valid phone number characters (including punctuation).
6186 * If the `number` is an object, it is used as is.
6187 *
6188 * The optional `defaultCountry` argument is the default country.
6189 * I.e. it does not restrict to just that country,
6190 * e.g. in those cases where several countries share
6191 * the same phone numbering rules (NANPA, Britain, etc).
6192 * For example, even though the number `07624 369230`
6193 * belongs to the Isle of Man ("IM" country code)
6194 * calling `isValidNumber('07624369230', 'GB', metadata)`
6195 * still returns `true` because the country is not restricted to `GB`,
6196 * it's just that `GB` is the default one for the phone numbering rules.
6197 * For restricting the country see `isValidNumberForRegion()`
6198 * though restricting a country might not be a good idea.
6199 * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
6200 *
6201 * Examples:
6202 *
6203 * ```js
6204 * isValidNumber('+78005553535', metadata)
6205 * isValidNumber('8005553535', 'RU', metadata)
6206 * isValidNumber('88005553535', 'RU', metadata)
6207 * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)
6208 * ```
6209 */
6210
6211 function isValidNumber(input, options, metadata) {
6212 // If assigning the `{}` default value is moved to the arguments above,
6213 // code coverage would decrease for some weird reason.
6214 options = options || {};
6215 metadata = new Metadata(metadata); // This is just to support `isValidNumber({})`
6216 // for cases when `parseNumber()` returns `{}`.
6217
6218 if (!input.country) {
6219 return false;
6220 }
6221
6222 metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for
6223 // distinguishing different countries having the same `countryCallingCode`.
6224
6225 if (metadata.hasTypes()) {
6226 return getNumberType(input, options, metadata.metadata) !== undefined;
6227 } // If there are no type regexps for this country in metadata then use
6228 // `nationalNumberPattern` as a "better than nothing" replacement.
6229
6230
6231 var national_number = options.v2 ? input.nationalNumber : input.phone;
6232 return matchesEntirely(national_number, metadata.nationalNumberPattern());
6233 }
6234
6235 //
6236 // E.g. "(999) 111-22-33" -> "999 111 22 33"
6237 //
6238 // For some reason Google's metadata contains `<intlFormat/>`s with brackets and dashes.
6239 // Meanwhile, there's no single opinion about using punctuation in international phone numbers.
6240 //
6241 // For example, Google's `<intlFormat/>` for USA is `+1 213-373-4253`.
6242 // And here's a quote from WikiPedia's "North American Numbering Plan" page:
6243 // https://en.wikipedia.org/wiki/North_American_Numbering_Plan
6244 //
6245 // "The country calling code for all countries participating in the NANP is 1.
6246 // In international format, an NANP number should be listed as +1 301 555 01 00,
6247 // where 301 is an area code (Maryland)."
6248 //
6249 // I personally prefer the international format without any punctuation.
6250 // For example, brackets are remnants of the old age, meaning that the
6251 // phone number part in brackets (so called "area code") can be omitted
6252 // if dialing within the same "area".
6253 // And hyphens were clearly introduced for splitting local numbers into memorizable groups.
6254 // For example, remembering "5553535" is difficult but "555-35-35" is much simpler.
6255 // Imagine a man taking a bus from home to work and seeing an ad with a phone number.
6256 // He has a couple of seconds to memorize that number until it passes by.
6257 // If it were spaces instead of hyphens the man wouldn't necessarily get it,
6258 // but with hyphens instead of spaces the grouping is more explicit.
6259 // I personally think that hyphens introduce visual clutter,
6260 // so I prefer replacing them with spaces in international numbers.
6261 // In the modern age all output is done on displays where spaces are clearly distinguishable
6262 // so hyphens can be safely replaced with spaces without losing any legibility.
6263 //
6264
6265 function applyInternationalSeparatorStyle(formattedNumber) {
6266 return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), 'g'), ' ').trim();
6267 }
6268
6269 // first group is not used in the national pattern (e.g. Argentina) so the $1
6270 // group does not match correctly. Therefore, we use `\d`, so that the first
6271 // group actually used in the pattern will be matched.
6272
6273 var FIRST_GROUP_PATTERN = /(\$\d)/;
6274 function formatNationalNumberUsingFormat(number, format, _ref) {
6275 var useInternationalFormat = _ref.useInternationalFormat,
6276 withNationalPrefix = _ref.withNationalPrefix;
6277 _ref.carrierCode;
6278 _ref.metadata;
6279 var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,
6280 // because that one is only used when formatting phone numbers
6281 // for dialing from a mobile phone, and this is not a dialing library.
6282 // carrierCode && format.domesticCarrierCodeFormattingRule()
6283 // // First, replace the $CC in the formatting rule with the desired carrier code.
6284 // // Then, replace the $FG in the formatting rule with the first group
6285 // // and the carrier code combined in the appropriate way.
6286 // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
6287 // : (
6288 // withNationalPrefix && format.nationalPrefixFormattingRule()
6289 // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
6290 // : format.format()
6291 // )
6292 withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());
6293
6294 if (useInternationalFormat) {
6295 return applyInternationalSeparatorStyle(formattedNumber);
6296 }
6297
6298 return formattedNumber;
6299 }
6300
6301 /**
6302 * Pattern that makes it easy to distinguish whether a region has a single
6303 * international dialing prefix or not. If a region has a single international
6304 * prefix (e.g. 011 in USA), it will be represented as a string that contains
6305 * a sequence of ASCII digits, and possibly a tilde, which signals waiting for
6306 * the tone. If there are multiple available international prefixes in a
6307 * region, they will be represented as a regex string that always contains one
6308 * or more characters that are not ASCII digits or a tilde.
6309 */
6310
6311 var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/; // For regions that have multiple IDD prefixes
6312 // a preferred IDD prefix is returned.
6313
6314 function getIddPrefix(country, callingCode, metadata) {
6315 var countryMetadata = new Metadata(metadata);
6316 countryMetadata.selectNumberingPlan(country, callingCode);
6317
6318 if (countryMetadata.defaultIDDPrefix()) {
6319 return countryMetadata.defaultIDDPrefix();
6320 }
6321
6322 if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
6323 return countryMetadata.IDDPrefix();
6324 }
6325 }
6326
6327 function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$4(target, key, source[key]); }); } return target; }
6328
6329 function _defineProperty$4(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6330 var DEFAULT_OPTIONS = {
6331 formatExtension: function formatExtension(formattedNumber, extension, metadata) {
6332 return "".concat(formattedNumber).concat(metadata.ext()).concat(extension);
6333 } // Formats a phone number
6334 //
6335 // Example use cases:
6336 //
6337 // ```js
6338 // formatNumber('8005553535', 'RU', 'INTERNATIONAL')
6339 // formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)
6340 // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')
6341 // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)
6342 // formatNumber('+78005553535', 'NATIONAL')
6343 // formatNumber('+78005553535', 'NATIONAL', metadata)
6344 // ```
6345 //
6346
6347 };
6348 function formatNumber(input, format, options, metadata) {
6349 // Apply default options.
6350 if (options) {
6351 options = _objectSpread$4({}, DEFAULT_OPTIONS, options);
6352 } else {
6353 options = DEFAULT_OPTIONS;
6354 }
6355
6356 metadata = new Metadata(metadata);
6357
6358 if (input.country && input.country !== '001') {
6359 // Validate `input.country`.
6360 if (!metadata.hasCountry(input.country)) {
6361 throw new Error("Unknown country: ".concat(input.country));
6362 }
6363
6364 metadata.country(input.country);
6365 } else if (input.countryCallingCode) {
6366 metadata.selectNumberingPlan(input.countryCallingCode);
6367 } else return input.phone || '';
6368
6369 var countryCallingCode = metadata.countryCallingCode();
6370 var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s
6371 // but Babel has a bug and it says "duplicate variable declaration".
6372
6373 var number;
6374
6375 switch (format) {
6376 case 'NATIONAL':
6377 // Legacy argument support.
6378 // (`{ country: ..., phone: '' }`)
6379 if (!nationalNumber) {
6380 return '';
6381 }
6382
6383 number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);
6384 return addExtension(number, input.ext, metadata, options.formatExtension);
6385
6386 case 'INTERNATIONAL':
6387 // Legacy argument support.
6388 // (`{ country: ..., phone: '' }`)
6389 if (!nationalNumber) {
6390 return "+".concat(countryCallingCode);
6391 }
6392
6393 number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);
6394 number = "+".concat(countryCallingCode, " ").concat(number);
6395 return addExtension(number, input.ext, metadata, options.formatExtension);
6396
6397 case 'E.164':
6398 // `E.164` doesn't define "phone number extensions".
6399 return "+".concat(countryCallingCode).concat(nationalNumber);
6400
6401 case 'RFC3966':
6402 return formatRFC3966({
6403 number: "+".concat(countryCallingCode).concat(nationalNumber),
6404 ext: input.ext
6405 });
6406 // For reference, here's Google's IDD formatter:
6407 // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
6408 // Not saying that this IDD formatter replicates it 1:1, but it seems to work.
6409 // Who would even need to format phone numbers in IDD format anyway?
6410
6411 case 'IDD':
6412 if (!options.fromCountry) {
6413 return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')
6414 }
6415
6416 var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);
6417 return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);
6418
6419 default:
6420 throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\""));
6421 }
6422 }
6423
6424 function formatNationalNumber(number, carrierCode, formatAs, metadata, options) {
6425 var format = chooseFormatForNumber(metadata.formats(), number);
6426
6427 if (!format) {
6428 return number;
6429 }
6430
6431 return formatNationalNumberUsingFormat(number, format, {
6432 useInternationalFormat: formatAs === 'INTERNATIONAL',
6433 withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
6434 carrierCode: carrierCode,
6435 metadata: metadata
6436 });
6437 }
6438
6439 function chooseFormatForNumber(availableFormats, nationalNnumber) {
6440 for (var _iterator = availableFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
6441 var _ref;
6442
6443 if (_isArray) {
6444 if (_i >= _iterator.length) break;
6445 _ref = _iterator[_i++];
6446 } else {
6447 _i = _iterator.next();
6448 if (_i.done) break;
6449 _ref = _i.value;
6450 }
6451
6452 var format = _ref;
6453
6454 // Validate leading digits
6455 if (format.leadingDigitsPatterns().length > 0) {
6456 // The last leading_digits_pattern is used here, as it is the most detailed
6457 var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format
6458
6459 if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {
6460 continue;
6461 }
6462 } // Check that the national number matches the phone number format regular expression
6463
6464
6465 if (matchesEntirely(nationalNnumber, format.pattern())) {
6466 return format;
6467 }
6468 }
6469 }
6470
6471 function addExtension(formattedNumber, ext, metadata, formatExtension) {
6472 return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;
6473 }
6474
6475 function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {
6476 var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code.
6477
6478 if (fromCountryCallingCode === countryCallingCode) {
6479 var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions
6480 // but prefix it with the country calling code.
6481
6482 if (countryCallingCode === '1') {
6483 return countryCallingCode + ' ' + formattedNumber;
6484 } // If regions share a country calling code, the country calling code need
6485 // not be dialled. This also applies when dialling within a region, so this
6486 // if clause covers both these cases. Technically this is the case for
6487 // dialling from La Reunion to other overseas departments of France (French
6488 // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover
6489 // this edge case for now and for those cases return the version including
6490 // country calling code. Details here:
6491 // http://www.petitfute.com/voyage/225-info-pratiques-reunion
6492 //
6493
6494
6495 return formattedNumber;
6496 }
6497
6498 var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);
6499
6500 if (iddPrefix) {
6501 return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));
6502 }
6503 }
6504
6505 function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } return target; }
6506
6507 function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6508
6509 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6510
6511 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6512
6513 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6514
6515 var PhoneNumber =
6516 /*#__PURE__*/
6517 function () {
6518 function PhoneNumber(countryCallingCode, nationalNumber, metadata) {
6519 _classCallCheck(this, PhoneNumber);
6520
6521 if (!countryCallingCode) {
6522 throw new TypeError('`country` or `countryCallingCode` not passed');
6523 }
6524
6525 if (!nationalNumber) {
6526 throw new TypeError('`nationalNumber` not passed');
6527 }
6528
6529 if (!metadata) {
6530 throw new TypeError('`metadata` not passed');
6531 }
6532
6533 var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it.
6534 // Also store the country code as `.country`.
6535
6536
6537 if (isCountryCode(countryCallingCode)) {
6538 this.country = countryCallingCode;
6539
6540 _metadata.country(countryCallingCode);
6541
6542 countryCallingCode = _metadata.countryCallingCode();
6543 }
6544
6545 this.countryCallingCode = countryCallingCode;
6546 this.nationalNumber = nationalNumber;
6547 this.number = '+' + this.countryCallingCode + this.nationalNumber;
6548 this.metadata = metadata;
6549 }
6550
6551 _createClass(PhoneNumber, [{
6552 key: "setExt",
6553 value: function setExt(ext) {
6554 this.ext = ext;
6555 }
6556 }, {
6557 key: "isPossible",
6558 value: function isPossible() {
6559 return isPossiblePhoneNumber(this, {
6560 v2: true
6561 }, this.metadata);
6562 }
6563 }, {
6564 key: "isValid",
6565 value: function isValid() {
6566 return isValidNumber(this, {
6567 v2: true
6568 }, this.metadata);
6569 }
6570 }, {
6571 key: "isNonGeographic",
6572 value: function isNonGeographic() {
6573 var metadata = new Metadata(this.metadata);
6574 return metadata.isNonGeographicCallingCode(this.countryCallingCode);
6575 }
6576 }, {
6577 key: "isEqual",
6578 value: function isEqual(phoneNumber) {
6579 return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
6580 } // // Is just an alias for `this.isValid() && this.country === country`.
6581 // // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
6582 // isValidForRegion(country) {
6583 // return isValidNumberForRegion(this, country, { v2: true }, this.metadata)
6584 // }
6585
6586 }, {
6587 key: "getType",
6588 value: function getType() {
6589 return getNumberType(this, {
6590 v2: true
6591 }, this.metadata);
6592 }
6593 }, {
6594 key: "format",
6595 value: function format(_format, options) {
6596 return formatNumber(this, _format, options ? _objectSpread$3({}, options, {
6597 v2: true
6598 }) : {
6599 v2: true
6600 }, this.metadata);
6601 }
6602 }, {
6603 key: "formatNational",
6604 value: function formatNational(options) {
6605 return this.format('NATIONAL', options);
6606 }
6607 }, {
6608 key: "formatInternational",
6609 value: function formatInternational(options) {
6610 return this.format('INTERNATIONAL', options);
6611 }
6612 }, {
6613 key: "getURI",
6614 value: function getURI(options) {
6615 return this.format('RFC3966', options);
6616 }
6617 }]);
6618
6619 return PhoneNumber;
6620 }();
6621
6622 var isCountryCode = function isCountryCode(value) {
6623 return /^[A-Z]{2}$/.test(value);
6624 };
6625
6626 var CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');
6627 function stripIddPrefix(number, country, callingCode, metadata) {
6628 if (!country) {
6629 return;
6630 } // Check if the number is IDD-prefixed.
6631
6632
6633 var countryMetadata = new Metadata(metadata);
6634 countryMetadata.selectNumberingPlan(country, callingCode);
6635 var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
6636
6637 if (number.search(IDDPrefixPattern) !== 0) {
6638 return;
6639 } // Strip IDD prefix.
6640
6641
6642 number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix,
6643 // then those digits are a country calling code.
6644 // Since no country code starts with a `0`,
6645 // the code below validates that the next digit (if present) is not `0`.
6646
6647 var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
6648
6649 if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
6650 if (matchedGroups[1] === '0') {
6651 return;
6652 }
6653 }
6654
6655 return number;
6656 }
6657
6658 /**
6659 * Strips any national prefix (such as 0, 1) present in a
6660 * (possibly incomplete) number provided.
6661 * "Carrier codes" are only used in Colombia and Brazil,
6662 * and only when dialing within those countries from a mobile phone to a fixed line number.
6663 * Sometimes it won't actually strip national prefix
6664 * and will instead prepend some digits to the `number`:
6665 * for example, when number `2345678` is passed with `VI` country selected,
6666 * it will return `{ number: "3402345678" }`, because `340` area code is prepended.
6667 * @param {string} number — National number digits.
6668 * @param {object} metadata — Metadata with country selected.
6669 * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`.
6670 */
6671 function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
6672 if (number && metadata.numberingPlan.nationalPrefixForParsing()) {
6673 // See METADATA.md for the description of
6674 // `national_prefix_for_parsing` and `national_prefix_transform_rule`.
6675 // Attempt to parse the first digits as a national prefix.
6676 var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');
6677 var prefixMatch = prefixPattern.exec(number);
6678
6679 if (prefixMatch) {
6680 var nationalNumber;
6681 var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
6682 // If a `national_prefix_for_parsing` has any "capturing groups"
6683 // then it means that the national (significant) number is equal to
6684 // those "capturing groups" transformed via `national_prefix_transform_rule`,
6685 // and nothing could be said about the actual national prefix:
6686 // what is it and was it even there.
6687 // If a `national_prefix_for_parsing` doesn't have any "capturing groups",
6688 // then everything it matches is a national prefix.
6689 // To determine whether `national_prefix_for_parsing` matched any
6690 // "capturing groups", the value of the result of calling `.exec()`
6691 // is looked at, and if it has non-undefined values where there're
6692 // "capturing groups" in the regular expression, then it means
6693 // that "capturing groups" have been matched.
6694 // It's not possible to tell whether there'll be any "capturing gropus"
6695 // before the matching process, because a `national_prefix_for_parsing`
6696 // could exhibit both behaviors.
6697
6698 var capturedGroupsCount = prefixMatch.length - 1;
6699 var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
6700
6701 if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
6702 nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,
6703 // then carrier code is the second one.
6704
6705 if (capturedGroupsCount > 1) {
6706 carrierCode = prefixMatch[1];
6707 }
6708 } // If there're no "capturing groups",
6709 // or if there're "capturing groups" but no
6710 // `national_prefix_transform_rule`,
6711 // then just strip the national prefix from the number,
6712 // and possibly a carrier code.
6713 // Seems like there could be more.
6714 else {
6715 // `prefixBeforeNationalNumber` is the whole substring matched by
6716 // the `national_prefix_for_parsing` regular expression.
6717 // There seem to be no guarantees that it's just a national prefix.
6718 // For example, if there's a carrier code, it's gonna be a
6719 // part of `prefixBeforeNationalNumber` too.
6720 var prefixBeforeNationalNumber = prefixMatch[0];
6721 nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,
6722 // then carrier code is the first one.
6723
6724 if (hasCapturedGroups) {
6725 carrierCode = prefixMatch[1];
6726 }
6727 } // Tries to guess whether a national prefix was present in the input.
6728 // This is not something copy-pasted from Google's library:
6729 // they don't seem to have an equivalent for that.
6730 // So this isn't an "officially approved" way of doing something like that.
6731 // But since there seems no other existing method, this library uses it.
6732
6733
6734 var nationalPrefix;
6735
6736 if (hasCapturedGroups) {
6737 var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
6738 var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.
6739 // `prefixMatch[0]` is `01115`, and `$1` is `11`,
6740 // and the rest of the phone number is `23456789`.
6741 // The national number is transformed via `9$1` to `91123456789`.
6742 // National prefix `0` is detected being present at the start.
6743 // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {
6744
6745 if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {
6746 nationalPrefix = metadata.numberingPlan.nationalPrefix();
6747 }
6748 } else {
6749 nationalPrefix = prefixMatch[0];
6750 }
6751
6752 return {
6753 nationalNumber: nationalNumber,
6754 nationalPrefix: nationalPrefix,
6755 carrierCode: carrierCode
6756 };
6757 }
6758 }
6759
6760 return {
6761 nationalNumber: number
6762 };
6763 }
6764
6765 /**
6766 * Strips national prefix and carrier code from a complete phone number.
6767 * The difference from the non-"FromCompleteNumber" function is that
6768 * it won't extract national prefix if the resultant number is too short
6769 * to be a complete number for the selected phone numbering plan.
6770 * @param {string} number — Complete phone number digits.
6771 * @param {Metadata} metadata — Metadata with a phone numbering plan selected.
6772 * @return {object} `{ nationalNumber: string, carrierCode: string? }`.
6773 */
6774
6775 function extractNationalNumber(number, metadata) {
6776 // Parsing national prefixes and carrier codes
6777 // is only required for local phone numbers
6778 // but some people don't understand that
6779 // and sometimes write international phone numbers
6780 // with national prefixes (or maybe even carrier codes).
6781 // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html
6782 // Google's original library forgives such mistakes
6783 // and so does this library, because it has been requested:
6784 // https://github.com/catamphetamine/libphonenumber-js/issues/127
6785 var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),
6786 nationalNumber = _extractNationalNumbe.nationalNumber,
6787 carrierCode = _extractNationalNumbe.carrierCode;
6788
6789 if (!shouldExtractNationalPrefix(number, nationalNumber, metadata)) {
6790 // Don't strip the national prefix.
6791 return {
6792 nationalNumber: number
6793 };
6794 } // If a national prefix has been extracted, check to see
6795 // if the resultant number isn't too short.
6796 // Same code in Google's `libphonenumber`:
6797 // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3291-L3302
6798 // For some reason, they do this check right after the `national_number_pattern` check
6799 // this library does in `shouldExtractNationalPrefix()` function.
6800 // Why is there a second "resultant" number validity check?
6801 // They don't provide an explanation.
6802 // This library just copies the behavior.
6803
6804
6805 if (number.length !== nationalNumber.length + (carrierCode ? carrierCode.length : 0)) {
6806 // If not using legacy generated metadata (before version `1.0.18`)
6807 // then it has "possible lengths", so use those to validate the number length.
6808 if (metadata.possibleLengths()) {
6809 // "We require that the NSN remaining after stripping the national prefix and
6810 // carrier code be long enough to be a possible length for the region.
6811 // Otherwise, we don't do the stripping, since the original number could be
6812 // a valid short number."
6813 // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
6814 switch (checkNumberLength(nationalNumber, metadata)) {
6815 case 'TOO_SHORT':
6816 case 'INVALID_LENGTH':
6817 // case 'IS_POSSIBLE_LOCAL_ONLY':
6818 // Don't strip the national prefix.
6819 return {
6820 nationalNumber: number
6821 };
6822 }
6823 }
6824 }
6825
6826 return {
6827 nationalNumber: nationalNumber,
6828 carrierCode: carrierCode
6829 };
6830 } // In some countries, the same digit could be a national prefix
6831 // or a leading digit of a valid phone number.
6832 // For example, in Russia, national prefix is `8`,
6833 // and also `800 555 35 35` is a valid number
6834 // in which `8` is not a national prefix, but the first digit
6835 // of a national (significant) number.
6836 // Same's with Belarus:
6837 // `82004910060` is a valid national (significant) number,
6838 // but `2004910060` is not.
6839 // To support such cases (to prevent the code from always stripping
6840 // national prefix), a condition is imposed: a national prefix
6841 // is not extracted when the original number is "viable" and the
6842 // resultant number is not, a "viable" national number being the one
6843 // that matches `national_number_pattern`.
6844
6845 function shouldExtractNationalPrefix(number, nationalSignificantNumber, metadata) {
6846 // The equivalent in Google's code is:
6847 // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004
6848 if (matchesEntirely(number, metadata.nationalNumberPattern()) && !matchesEntirely(nationalSignificantNumber, metadata.nationalNumberPattern())) {
6849 return false;
6850 } // Just "possible" number check would be more relaxed, so it's not used.
6851 // if (isPossibleNumber(number, metadata) &&
6852 // !isPossibleNumber(numberWithNationalPrefixExtracted, metadata)) {
6853 // return false
6854 // }
6855
6856
6857 return true;
6858 }
6859
6860 /**
6861 * Sometimes some people incorrectly input international phone numbers
6862 * without the leading `+`. This function corrects such input.
6863 * @param {string} number — Phone number digits.
6864 * @param {string?} country
6865 * @param {string?} callingCode
6866 * @param {object} metadata
6867 * @return {object} `{ countryCallingCode: string?, number: string }`.
6868 */
6869
6870 function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {
6871 var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;
6872
6873 if (number.indexOf(countryCallingCode) === 0) {
6874 metadata = new Metadata(metadata);
6875 metadata.selectNumberingPlan(country, callingCode);
6876 var possibleShorterNumber = number.slice(countryCallingCode.length);
6877
6878 var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),
6879 possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
6880
6881 var _extractNationalNumbe2 = extractNationalNumber(number, metadata),
6882 nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now,
6883 // or if it was too long before, we consider the number
6884 // with the country calling code stripped to be a better result
6885 // and keep that instead.
6886 // For example, in Germany (+49), `49` is a valid area code,
6887 // so if a number starts with `49`, it could be both a valid
6888 // national German number or an international number without
6889 // a leading `+`.
6890
6891
6892 if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {
6893 return {
6894 countryCallingCode: countryCallingCode,
6895 number: possibleShorterNumber
6896 };
6897 }
6898 }
6899
6900 return {
6901 number: number
6902 };
6903 }
6904
6905 /**
6906 * Converts a phone number digits (possibly with a `+`)
6907 * into a calling code and the rest phone number digits.
6908 * The "rest phone number digits" could include
6909 * a national prefix, carrier code, and national
6910 * (significant) number.
6911 * @param {string} number — Phone number digits (possibly with a `+`).
6912 * @param {string} [country] — Default country.
6913 * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).
6914 * @param {object} metadata
6915 * @return {object} `{ countryCallingCode: string?, number: string }`
6916 * @example
6917 * // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
6918 * extractCountryCallingCode('2133734253', 'US', null, metadata)
6919 * extractCountryCallingCode('2133734253', null, '1', metadata)
6920 * extractCountryCallingCode('+12133734253', null, null, metadata)
6921 * extractCountryCallingCode('+12133734253', 'RU', null, metadata)
6922 */
6923
6924 function extractCountryCallingCode(number, country, callingCode, metadata) {
6925 if (!number) {
6926 return {};
6927 } // If this is not an international phone number,
6928 // then either extract an "IDD" prefix, or extract a
6929 // country calling code from a number by autocorrecting it
6930 // by prepending a leading `+` in cases when it starts
6931 // with the country calling code.
6932 // https://wikitravel.org/en/International_dialling_prefix
6933 // https://github.com/catamphetamine/libphonenumber-js/issues/376
6934
6935
6936 if (number[0] !== '+') {
6937 // Convert an "out-of-country" dialing phone number
6938 // to a proper international phone number.
6939 var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then
6940 // convert the number to international one
6941 // for subsequent parsing.
6942
6943 if (numberWithoutIDD && numberWithoutIDD !== number) {
6944 number = '+' + numberWithoutIDD;
6945 } else {
6946 // Check to see if the number starts with the country calling code
6947 // for the default country. If so, we remove the country calling code,
6948 // and do some checks on the validity of the number before and after.
6949 // https://github.com/catamphetamine/libphonenumber-js/issues/376
6950 if (country || callingCode) {
6951 var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),
6952 countryCallingCode = _extractCountryCallin.countryCallingCode,
6953 shorterNumber = _extractCountryCallin.number;
6954
6955 if (countryCallingCode) {
6956 return {
6957 countryCallingCode: countryCallingCode,
6958 number: shorterNumber
6959 };
6960 }
6961 }
6962
6963 return {
6964 number: number
6965 };
6966 }
6967 } // Fast abortion: country codes do not begin with a '0'
6968
6969
6970 if (number[1] === '0') {
6971 return {};
6972 }
6973
6974 metadata = new Metadata(metadata); // The thing with country phone codes
6975 // is that they are orthogonal to each other
6976 // i.e. there's no such country phone code A
6977 // for which country phone code B exists
6978 // where B starts with A.
6979 // Therefore, while scanning digits,
6980 // if a valid country code is found,
6981 // that means that it is the country code.
6982 //
6983
6984 var i = 2;
6985
6986 while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {
6987 var _countryCallingCode = number.slice(1, i);
6988
6989 if (metadata.hasCallingCode(_countryCallingCode)) {
6990 metadata.selectNumberingPlan(_countryCallingCode);
6991 return {
6992 countryCallingCode: _countryCallingCode,
6993 number: number.slice(i)
6994 };
6995 }
6996
6997 i++;
6998 }
6999
7000 return {};
7001 }
7002
7003 var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
7004 function getCountryByCallingCode(callingCode, nationalPhoneNumber, metadata) {
7005 /* istanbul ignore if */
7006 if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
7007 if (metadata.isNonGeographicCallingCode(callingCode)) {
7008 return '001';
7009 }
7010 } // Is always non-empty, because `callingCode` is always valid
7011
7012
7013 var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
7014
7015 if (!possibleCountries) {
7016 return;
7017 } // If there's just one country corresponding to the country code,
7018 // then just return it, without further phone number digits validation.
7019
7020
7021 if (possibleCountries.length === 1) {
7022 return possibleCountries[0];
7023 }
7024
7025 return selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata.metadata);
7026 }
7027
7028 function selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata) {
7029 // Re-create `metadata` because it will be selecting a `country`.
7030 metadata = new Metadata(metadata);
7031
7032 for (var _iterator = possibleCountries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
7033 var _ref;
7034
7035 if (_isArray) {
7036 if (_i >= _iterator.length) break;
7037 _ref = _iterator[_i++];
7038 } else {
7039 _i = _iterator.next();
7040 if (_i.done) break;
7041 _ref = _i.value;
7042 }
7043
7044 var country = _ref;
7045 metadata.country(country); // Leading digits check would be the simplest and fastest one.
7046 // Leading digits patterns are only defined for about 20% of all countries.
7047 // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits
7048 // Matching "leading digits" is a sufficient but not necessary condition.
7049
7050 if (metadata.leadingDigits()) {
7051 if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {
7052 return country;
7053 }
7054 } // Else perform full validation with all of those
7055 // fixed-line/mobile/etc regular expressions.
7056 else if (getNumberType({
7057 phone: nationalPhoneNumber,
7058 country: country
7059 }, undefined, metadata.metadata)) {
7060 return country;
7061 }
7062 }
7063 }
7064
7065 // This is a port of Google Android `libphonenumber`'s
7066 // This prevents malicious input from consuming CPU.
7067
7068 var MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits.
7069
7070 var PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove.
7071 // A trailing `#` is sometimes used when writing phone numbers with extensions in US.
7072 // Example: "+1 (645) 123 1234-910#" number has extension "910".
7073
7074 var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$');
7075 //
7076 // ```js
7077 // parse('8 (800) 555-35-35', 'RU')
7078 // parse('8 (800) 555-35-35', 'RU', metadata)
7079 // parse('8 (800) 555-35-35', { country: { default: 'RU' } })
7080 // parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)
7081 // parse('+7 800 555 35 35')
7082 // parse('+7 800 555 35 35', metadata)
7083 // ```
7084 //
7085
7086 function parse(text, options, metadata) {
7087 // If assigning the `{}` default value is moved to the arguments above,
7088 // code coverage would decrease for some weird reason.
7089 options = options || {};
7090 metadata = new Metadata(metadata); // Validate `defaultCountry`.
7091
7092 if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {
7093 if (options.v2) {
7094 throw new ParseError('INVALID_COUNTRY');
7095 }
7096
7097 throw new Error("Unknown country: ".concat(options.defaultCountry));
7098 } // Parse the phone number.
7099
7100
7101 var _parseInput = parseInput(text, options.v2, options.extract),
7102 formattedPhoneNumber = _parseInput.number,
7103 ext = _parseInput.ext,
7104 error = _parseInput.error; // If the phone number is not viable then return nothing.
7105
7106
7107 if (!formattedPhoneNumber) {
7108 if (options.v2) {
7109 if (error === 'TOO_SHORT') {
7110 throw new ParseError('TOO_SHORT');
7111 }
7112
7113 throw new ParseError('NOT_A_NUMBER');
7114 }
7115
7116 return {};
7117 }
7118
7119 var _parsePhoneNumber = parsePhoneNumber$1(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata),
7120 country = _parsePhoneNumber.country,
7121 nationalNumber = _parsePhoneNumber.nationalNumber,
7122 countryCallingCode = _parsePhoneNumber.countryCallingCode,
7123 carrierCode = _parsePhoneNumber.carrierCode;
7124
7125 if (!metadata.hasSelectedNumberingPlan()) {
7126 if (options.v2) {
7127 throw new ParseError('INVALID_COUNTRY');
7128 }
7129
7130 return {};
7131 } // Validate national (significant) number length.
7132
7133
7134 if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {
7135 // Won't throw here because the regexp already demands length > 1.
7136
7137 /* istanbul ignore if */
7138 if (options.v2) {
7139 throw new ParseError('TOO_SHORT');
7140 } // Google's demo just throws an error in this case.
7141
7142
7143 return {};
7144 } // Validate national (significant) number length.
7145 //
7146 // A sidenote:
7147 //
7148 // They say that sometimes national (significant) numbers
7149 // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).
7150 // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36
7151 // Such numbers will just be discarded.
7152 //
7153
7154
7155 if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {
7156 if (options.v2) {
7157 throw new ParseError('TOO_LONG');
7158 } // Google's demo just throws an error in this case.
7159
7160
7161 return {};
7162 }
7163
7164 if (options.v2) {
7165 var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);
7166
7167 if (country) {
7168 phoneNumber.country = country;
7169 }
7170
7171 if (carrierCode) {
7172 phoneNumber.carrierCode = carrierCode;
7173 }
7174
7175 if (ext) {
7176 phoneNumber.ext = ext;
7177 }
7178
7179 return phoneNumber;
7180 } // Check if national phone number pattern matches the number.
7181 // National number pattern is different for each country,
7182 // even for those ones which are part of the "NANPA" group.
7183
7184
7185 var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;
7186
7187 if (!options.extended) {
7188 return valid ? result(country, nationalNumber, ext) : {};
7189 } // isInternational: countryCallingCode !== undefined
7190
7191
7192 return {
7193 country: country,
7194 countryCallingCode: countryCallingCode,
7195 carrierCode: carrierCode,
7196 valid: valid,
7197 possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,
7198 phone: nationalNumber,
7199 ext: ext
7200 };
7201 }
7202 /**
7203 * Extracts a formatted phone number from text.
7204 * Doesn't guarantee that the extracted phone number
7205 * is a valid phone number (for example, doesn't validate its length).
7206 * @param {string} text
7207 * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.
7208 * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.
7209 * @return {string}
7210 * @example
7211 * // Returns "(213) 373-4253".
7212 * extractFormattedPhoneNumber("Call (213) 373-4253 for assistance.")
7213 */
7214
7215 function extractFormattedPhoneNumber(text, extract, throwOnError) {
7216 if (!text) {
7217 return;
7218 }
7219
7220 if (text.length > MAX_INPUT_STRING_LENGTH) {
7221 if (throwOnError) {
7222 throw new ParseError('TOO_LONG');
7223 }
7224
7225 return;
7226 }
7227
7228 if (extract === false) {
7229 return text;
7230 } // Attempt to extract a possible number from the string passed in
7231
7232
7233 var startsAt = text.search(PHONE_NUMBER_START_PATTERN);
7234
7235 if (startsAt < 0) {
7236 return;
7237 }
7238
7239 return text // Trim everything to the left of the phone number
7240 .slice(startsAt) // Remove trailing non-numerical characters
7241 .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');
7242 }
7243 /**
7244 * @param {string} text - Input.
7245 * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.
7246 * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.
7247 * @return {object} `{ ?number, ?ext }`.
7248 */
7249
7250
7251 function parseInput(text, v2, extract) {
7252 // Parse RFC 3966 phone number URI.
7253 if (text && text.indexOf('tel:') === 0) {
7254 return parseRFC3966(text);
7255 }
7256
7257 var number = extractFormattedPhoneNumber(text, extract, v2); // If the phone number is not viable, then abort.
7258
7259 if (!number) {
7260 return {};
7261 }
7262
7263 if (!isViablePhoneNumber(number)) {
7264 if (isViablePhoneNumberStart(number)) {
7265 return {
7266 error: 'TOO_SHORT'
7267 };
7268 }
7269
7270 return {};
7271 } // Attempt to parse extension first, since it doesn't require region-specific
7272 // data and we want to have the non-normalised number here.
7273
7274
7275 var withExtensionStripped = extractExtension(number);
7276
7277 if (withExtensionStripped.ext) {
7278 return withExtensionStripped;
7279 }
7280
7281 return {
7282 number: number
7283 };
7284 }
7285 /**
7286 * Creates `parse()` result object.
7287 */
7288
7289
7290 function result(country, nationalNumber, ext) {
7291 var result = {
7292 country: country,
7293 phone: nationalNumber
7294 };
7295
7296 if (ext) {
7297 result.ext = ext;
7298 }
7299
7300 return result;
7301 }
7302 /**
7303 * Parses a viable phone number.
7304 * @param {string} formattedPhoneNumber — Example: "(213) 373-4253".
7305 * @param {string} [defaultCountry]
7306 * @param {string} [defaultCallingCode]
7307 * @param {Metadata} metadata
7308 * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.
7309 */
7310
7311
7312 function parsePhoneNumber$1(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {
7313 // Extract calling code from phone number.
7314 var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata),
7315 countryCallingCode = _extractCountryCallin.countryCallingCode,
7316 number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`.
7317
7318
7319 var country;
7320
7321 if (countryCallingCode) {
7322 metadata.selectNumberingPlan(countryCallingCode);
7323 } // If `formattedPhoneNumber` is in "national" format
7324 // then `number` is defined and `countryCallingCode` isn't.
7325 else if (number && (defaultCountry || defaultCallingCode)) {
7326 metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);
7327
7328 if (defaultCountry) {
7329 country = defaultCountry;
7330 }
7331
7332 countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);
7333 } else return {};
7334
7335 if (!number) {
7336 return {
7337 countryCallingCode: countryCallingCode
7338 };
7339 }
7340
7341 var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata),
7342 nationalNumber = _extractNationalNumbe.nationalNumber,
7343 carrierCode = _extractNationalNumbe.carrierCode; // Sometimes there are several countries
7344 // corresponding to the same country phone code
7345 // (e.g. NANPA countries all having `1` country phone code).
7346 // Therefore, to reliably determine the exact country,
7347 // national (significant) number should have been parsed first.
7348 //
7349 // When `metadata.json` is generated, all "ambiguous" country phone codes
7350 // get their countries populated with the full set of
7351 // "phone number type" regular expressions.
7352 //
7353
7354
7355 var exactCountry = getCountryByCallingCode(countryCallingCode, nationalNumber, metadata);
7356
7357 if (exactCountry) {
7358 country = exactCountry;
7359 /* istanbul ignore if */
7360
7361 if (exactCountry === '001') ; else {
7362 metadata.country(country);
7363 }
7364 }
7365
7366 return {
7367 country: country,
7368 countryCallingCode: countryCallingCode,
7369 nationalNumber: nationalNumber,
7370 carrierCode: carrierCode
7371 };
7372 }
7373
7374 function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } return target; }
7375
7376 function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7377 function parsePhoneNumber(text, options, metadata) {
7378 return parse(text, _objectSpread$2({}, options, {
7379 v2: true
7380 }), metadata);
7381 }
7382
7383 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
7384
7385 function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } return target; }
7386
7387 function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7388
7389 function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
7390
7391 function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
7392
7393 function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
7394
7395 function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7396 function normalizeArguments(args) {
7397 var _Array$prototype$slic = Array.prototype.slice.call(args),
7398 _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4),
7399 arg_1 = _Array$prototype$slic2[0],
7400 arg_2 = _Array$prototype$slic2[1],
7401 arg_3 = _Array$prototype$slic2[2],
7402 arg_4 = _Array$prototype$slic2[3];
7403
7404 var text;
7405 var options;
7406 var metadata; // If the phone number is passed as a string.
7407 // `parsePhoneNumber('88005553535', ...)`.
7408
7409 if (typeof arg_1 === 'string') {
7410 text = arg_1;
7411 } else throw new TypeError('A text for parsing must be a string.'); // If "default country" argument is being passed then move it to `options`.
7412 // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.
7413
7414
7415 if (!arg_2 || typeof arg_2 === 'string') {
7416 if (arg_4) {
7417 options = arg_3;
7418 metadata = arg_4;
7419 } else {
7420 options = undefined;
7421 metadata = arg_3;
7422 }
7423
7424 if (arg_2) {
7425 options = _objectSpread$1({
7426 defaultCountry: arg_2
7427 }, options);
7428 }
7429 } // `defaultCountry` is not passed.
7430 // Example: `parsePhoneNumber('+78005553535', [options], metadata)`.
7431 else if (isObject$1(arg_2)) {
7432 if (arg_3) {
7433 options = arg_2;
7434 metadata = arg_3;
7435 } else {
7436 metadata = arg_2;
7437 }
7438 } else throw new Error("Invalid second argument: ".concat(arg_2));
7439
7440 return {
7441 text: text,
7442 options: options,
7443 metadata: metadata
7444 };
7445 } // Otherwise istanbul would show this as "branch not covered".
7446
7447 /* istanbul ignore next */
7448
7449 var isObject$1 = function isObject(_) {
7450 return _typeof(_) === 'object';
7451 };
7452
7453 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
7454
7455 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7456 function parsePhoneNumberFromString$2(text, options, metadata) {
7457 // Validate `defaultCountry`.
7458 if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {
7459 options = _objectSpread({}, options, {
7460 defaultCountry: undefined
7461 });
7462 } // Parse phone number.
7463
7464
7465 try {
7466 return parsePhoneNumber(text, options, metadata);
7467 } catch (error) {
7468 /* istanbul ignore else */
7469 if (error instanceof ParseError) ; else {
7470 throw error;
7471 }
7472 }
7473 }
7474
7475 function parsePhoneNumberFromString$1() {
7476 var _normalizeArguments = normalizeArguments(arguments),
7477 text = _normalizeArguments.text,
7478 options = _normalizeArguments.options,
7479 metadata = _normalizeArguments.metadata;
7480
7481 return parsePhoneNumberFromString$2(text, options, metadata);
7482 }
7483
7484 function parsePhoneNumberFromString() {
7485 return withMetadata(parsePhoneNumberFromString$1, arguments)
7486 }
7487
7488 var IS_PHONE_NUMBER = 'isPhoneNumber';
7489 /**
7490 * Checks if the string is a valid phone number. To successfully validate any phone number the text must include
7491 * the intl. calling code, if the calling code wont be provided then the region must be set.
7492 *
7493 * @param value the potential phone number string to test
7494 * @param region 2 characters uppercase country code (e.g. DE, US, CH) for country specific validation.
7495 * If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.
7496 */
7497 function isPhoneNumber(value, region) {
7498 try {
7499 var phoneNum = parsePhoneNumberFromString(value, region);
7500 var result = phoneNum === null || phoneNum === void 0 ? void 0 : phoneNum.isValid();
7501 return !!result;
7502 }
7503 catch (error) {
7504 // logging?
7505 return false;
7506 }
7507 }
7508 /**
7509 * Checks if the string is a valid phone number. To successfully validate any phone number the text must include
7510 * the intl. calling code, if the calling code wont be provided then the region must be set.
7511 *
7512 * @param region 2 characters uppercase country code (e.g. DE, US, CH) for country specific validation.
7513 * If text doesn't start with the international calling code (e.g. +41), then you must set this parameter.
7514 */
7515 function IsPhoneNumber(region, validationOptions) {
7516 return ValidateBy({
7517 name: IS_PHONE_NUMBER,
7518 constraints: [region],
7519 validator: {
7520 validate: function (value, args) { return isPhoneNumber(value, args.constraints[0]); },
7521 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid phone number'; }, validationOptions),
7522 },
7523 }, validationOptions);
7524 }
7525
7526 var IS_MILITARY_TIME = 'isMilitaryTime';
7527 /**
7528 * Checks if the string represents a time without a given timezone in the format HH:MM (military)
7529 * If the given value does not match the pattern HH:MM, then it returns false.
7530 */
7531 function isMilitaryTime(value) {
7532 var militaryTimeRegex = /^([01]\d|2[0-3]):?([0-5]\d)$/;
7533 return typeof value === 'string' && matchesValidator(value, militaryTimeRegex);
7534 }
7535 /**
7536 * Checks if the string represents a time without a given timezone in the format HH:MM (military)
7537 * If the given value does not match the pattern HH:MM, then it returns false.
7538 */
7539 function IsMilitaryTime(validationOptions) {
7540 return ValidateBy({
7541 name: IS_MILITARY_TIME,
7542 validator: {
7543 validate: function (value, args) { return isMilitaryTime(value); },
7544 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid representation of military time in the format HH:MM'; }, validationOptions),
7545 },
7546 }, validationOptions);
7547 }
7548
7549 var isHash$1 = {exports: {}};
7550
7551 (function (module, exports) {
7552
7553 Object.defineProperty(exports, "__esModule", {
7554 value: true
7555 });
7556 exports.default = isHash;
7557
7558 var _assertString = _interopRequireDefault(assertString.exports);
7559
7560 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7561
7562 var lengths = {
7563 md5: 32,
7564 md4: 32,
7565 sha1: 40,
7566 sha256: 64,
7567 sha384: 96,
7568 sha512: 128,
7569 ripemd128: 32,
7570 ripemd160: 40,
7571 tiger128: 32,
7572 tiger160: 40,
7573 tiger192: 48,
7574 crc32: 8,
7575 crc32b: 8
7576 };
7577
7578 function isHash(str, algorithm) {
7579 (0, _assertString.default)(str);
7580 var hash = new RegExp("^[a-fA-F0-9]{".concat(lengths[algorithm], "}$"));
7581 return hash.test(str);
7582 }
7583
7584 module.exports = exports.default;
7585 module.exports.default = exports.default;
7586 }(isHash$1, isHash$1.exports));
7587
7588 var isHashValidator = /*@__PURE__*/getDefaultExportFromCjs(isHash$1.exports);
7589
7590 var IS_HASH = 'isHash';
7591 /**
7592 * Check if the string is a hash of type algorithm.
7593 * Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128',
7594 * 'tiger160', 'tiger192', 'crc32', 'crc32b']
7595 */
7596 function isHash(value, algorithm) {
7597 return typeof value === 'string' && isHashValidator(value, algorithm);
7598 }
7599 /**
7600 * Check if the string is a hash of type algorithm.
7601 * Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128',
7602 * 'tiger160', 'tiger192', 'crc32', 'crc32b']
7603 */
7604 function IsHash(algorithm, validationOptions) {
7605 return ValidateBy({
7606 name: IS_HASH,
7607 constraints: [algorithm],
7608 validator: {
7609 validate: function (value, args) { return isHash(value, args.constraints[0]); },
7610 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a hash of type $constraint1'; }, validationOptions),
7611 },
7612 }, validationOptions);
7613 }
7614
7615 var isISSN$1 = {exports: {}};
7616
7617 (function (module, exports) {
7618
7619 Object.defineProperty(exports, "__esModule", {
7620 value: true
7621 });
7622 exports.default = isISSN;
7623
7624 var _assertString = _interopRequireDefault(assertString.exports);
7625
7626 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7627
7628 var issn = '^\\d{4}-?\\d{3}[\\dX]$';
7629
7630 function isISSN(str) {
7631 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7632 (0, _assertString.default)(str);
7633 var testIssn = issn;
7634 testIssn = options.require_hyphen ? testIssn.replace('?', '') : testIssn;
7635 testIssn = options.case_sensitive ? new RegExp(testIssn) : new RegExp(testIssn, 'i');
7636
7637 if (!testIssn.test(str)) {
7638 return false;
7639 }
7640
7641 var digits = str.replace('-', '').toUpperCase();
7642 var checksum = 0;
7643
7644 for (var i = 0; i < digits.length; i++) {
7645 var digit = digits[i];
7646 checksum += (digit === 'X' ? 10 : +digit) * (8 - i);
7647 }
7648
7649 return checksum % 11 === 0;
7650 }
7651
7652 module.exports = exports.default;
7653 module.exports.default = exports.default;
7654 }(isISSN$1, isISSN$1.exports));
7655
7656 var isISSNValidator = /*@__PURE__*/getDefaultExportFromCjs(isISSN$1.exports);
7657
7658 var IS_ISSN = 'isISSN';
7659 /**
7660 * Checks if the string is a ISSN.
7661 * If given value is not a string, then it returns false.
7662 */
7663 function isISSN(value, options) {
7664 return typeof value === 'string' && isISSNValidator(value, options);
7665 }
7666 /**
7667 * Checks if the string is a ISSN.
7668 * If given value is not a string, then it returns false.
7669 */
7670 function IsISSN(options, validationOptions) {
7671 return ValidateBy({
7672 name: IS_ISSN,
7673 constraints: [options],
7674 validator: {
7675 validate: function (value, args) { return isISSN(value, args.constraints[0]); },
7676 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a ISSN'; }, validationOptions),
7677 },
7678 }, validationOptions);
7679 }
7680
7681 var IS_DATE_STRING = 'isDateString';
7682 /**
7683 * Alias for IsISO8601 validator
7684 */
7685 function isDateString(value, options) {
7686 return isISO8601(value, options);
7687 }
7688 /**
7689 * Alias for IsISO8601 validator
7690 */
7691 function IsDateString(options, validationOptions) {
7692 return ValidateBy({
7693 name: IS_DATE_STRING,
7694 constraints: [options],
7695 validator: {
7696 validate: function (value, args) { return isDateString(value); },
7697 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid ISO 8601 date string'; }, validationOptions),
7698 },
7699 }, validationOptions);
7700 }
7701
7702 var isBoolean$1 = {exports: {}};
7703
7704 (function (module, exports) {
7705
7706 Object.defineProperty(exports, "__esModule", {
7707 value: true
7708 });
7709 exports.default = isBoolean;
7710
7711 var _assertString = _interopRequireDefault(assertString.exports);
7712
7713 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7714
7715 var defaultOptions = {
7716 loose: false
7717 };
7718 var strictBooleans = ['true', 'false', '1', '0'];
7719 var looseBooleans = [].concat(strictBooleans, ['yes', 'no']);
7720
7721 function isBoolean(str) {
7722 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
7723 (0, _assertString.default)(str);
7724
7725 if (options.loose) {
7726 return looseBooleans.includes(str.toLowerCase());
7727 }
7728
7729 return strictBooleans.includes(str);
7730 }
7731
7732 module.exports = exports.default;
7733 module.exports.default = exports.default;
7734 }(isBoolean$1, isBoolean$1.exports));
7735
7736 var isBooleanValidator = /*@__PURE__*/getDefaultExportFromCjs(isBoolean$1.exports);
7737
7738 var IS_BOOLEAN_STRING = 'isBooleanString';
7739 /**
7740 * Checks if a string is a boolean.
7741 * If given value is not a string, then it returns false.
7742 */
7743 function isBooleanString(value) {
7744 return typeof value === 'string' && isBooleanValidator(value);
7745 }
7746 /**
7747 * Checks if a string is a boolean.
7748 * If given value is not a string, then it returns false.
7749 */
7750 function IsBooleanString(validationOptions) {
7751 return ValidateBy({
7752 name: IS_BOOLEAN_STRING,
7753 validator: {
7754 validate: function (value, args) { return isBooleanString(value); },
7755 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a boolean string'; }, validationOptions),
7756 },
7757 }, validationOptions);
7758 }
7759
7760 var isNumeric = {exports: {}};
7761
7762 (function (module, exports) {
7763
7764 Object.defineProperty(exports, "__esModule", {
7765 value: true
7766 });
7767 exports.default = isNumeric;
7768
7769 var _assertString = _interopRequireDefault(assertString.exports);
7770
7771 var _alpha = alpha$1;
7772
7773 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7774
7775 var numericNoSymbols = /^[0-9]+$/;
7776
7777 function isNumeric(str, options) {
7778 (0, _assertString.default)(str);
7779
7780 if (options && options.no_symbols) {
7781 return numericNoSymbols.test(str);
7782 }
7783
7784 return new RegExp("^[+-]?([0-9]*[".concat((options || {}).locale ? _alpha.decimal[options.locale] : '.', "])?[0-9]+$")).test(str);
7785 }
7786
7787 module.exports = exports.default;
7788 module.exports.default = exports.default;
7789 }(isNumeric, isNumeric.exports));
7790
7791 var isNumericValidator = /*@__PURE__*/getDefaultExportFromCjs(isNumeric.exports);
7792
7793 var IS_NUMBER_STRING = 'isNumberString';
7794 /**
7795 * Checks if the string is numeric.
7796 * If given value is not a string, then it returns false.
7797 */
7798 function isNumberString(value, options) {
7799 return typeof value === 'string' && isNumericValidator(value, options);
7800 }
7801 /**
7802 * Checks if the string is numeric.
7803 * If given value is not a string, then it returns false.
7804 */
7805 function IsNumberString(options, validationOptions) {
7806 return ValidateBy({
7807 name: IS_NUMBER_STRING,
7808 constraints: [options],
7809 validator: {
7810 validate: function (value, args) { return isNumberString(value, args.constraints[0]); },
7811 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a number string'; }, validationOptions),
7812 },
7813 }, validationOptions);
7814 }
7815
7816 var isBase32$1 = {exports: {}};
7817
7818 (function (module, exports) {
7819
7820 Object.defineProperty(exports, "__esModule", {
7821 value: true
7822 });
7823 exports.default = isBase32;
7824
7825 var _assertString = _interopRequireDefault(assertString.exports);
7826
7827 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7828
7829 var base32 = /^[A-Z2-7]+=*$/;
7830
7831 function isBase32(str) {
7832 (0, _assertString.default)(str);
7833 var len = str.length;
7834
7835 if (len % 8 === 0 && base32.test(str)) {
7836 return true;
7837 }
7838
7839 return false;
7840 }
7841
7842 module.exports = exports.default;
7843 module.exports.default = exports.default;
7844 }(isBase32$1, isBase32$1.exports));
7845
7846 var isBase32Validator = /*@__PURE__*/getDefaultExportFromCjs(isBase32$1.exports);
7847
7848 var IS_BASE32 = 'isBase32';
7849 /**
7850 * Checks if a string is base32 encoded.
7851 * If given value is not a string, then it returns false.
7852 */
7853 function isBase32(value) {
7854 return typeof value === 'string' && isBase32Validator(value);
7855 }
7856 /**
7857 * Check if a string is base32 encoded.
7858 * If given value is not a string, then it returns false.
7859 */
7860 function IsBase32(validationOptions) {
7861 return ValidateBy({
7862 name: IS_BASE32,
7863 validator: {
7864 validate: function (value, args) { return isBase32(value); },
7865 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be base32 encoded'; }, validationOptions),
7866 },
7867 }, validationOptions);
7868 }
7869
7870 var isBIC$1 = {exports: {}};
7871
7872 (function (module, exports) {
7873
7874 Object.defineProperty(exports, "__esModule", {
7875 value: true
7876 });
7877 exports.default = isBIC;
7878
7879 var _assertString = _interopRequireDefault(assertString.exports);
7880
7881 var _isISO31661Alpha = isISO31661Alpha2$2;
7882
7883 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7884
7885 // https://en.wikipedia.org/wiki/ISO_9362
7886 var isBICReg = /^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$/;
7887
7888 function isBIC(str) {
7889 (0, _assertString.default)(str); // toUpperCase() should be removed when a new major version goes out that changes
7890 // the regex to [A-Z] (per the spec).
7891
7892 if (!_isISO31661Alpha.CountryCodes.has(str.slice(4, 6).toUpperCase())) {
7893 return false;
7894 }
7895
7896 return isBICReg.test(str);
7897 }
7898
7899 module.exports = exports.default;
7900 module.exports.default = exports.default;
7901 }(isBIC$1, isBIC$1.exports));
7902
7903 var isBICValidator = /*@__PURE__*/getDefaultExportFromCjs(isBIC$1.exports);
7904
7905 var IS_BIC = 'isBIC';
7906 /**
7907 * Check if a string is a BIC (Bank Identification Code) or SWIFT code.
7908 * If given value is not a string, then it returns false.
7909 */
7910 function isBIC(value) {
7911 return typeof value === 'string' && isBICValidator(value);
7912 }
7913 /**
7914 * Check if a string is a BIC (Bank Identification Code) or SWIFT code.
7915 * If given value is not a string, then it returns false.
7916 */
7917 function IsBIC(validationOptions) {
7918 return ValidateBy({
7919 name: IS_BIC,
7920 validator: {
7921 validate: function (value, args) { return isBIC(value); },
7922 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a BIC or SWIFT code'; }, validationOptions),
7923 },
7924 }, validationOptions);
7925 }
7926
7927 var isBtcAddress$1 = {exports: {}};
7928
7929 (function (module, exports) {
7930
7931 Object.defineProperty(exports, "__esModule", {
7932 value: true
7933 });
7934 exports.default = isBtcAddress;
7935
7936 var _assertString = _interopRequireDefault(assertString.exports);
7937
7938 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7939
7940 // supports Bech32 addresses
7941 var bech32 = /^(bc1)[a-z0-9]{25,39}$/;
7942 var base58 = /^(1|3)[A-HJ-NP-Za-km-z1-9]{25,39}$/;
7943
7944 function isBtcAddress(str) {
7945 (0, _assertString.default)(str); // check for bech32
7946
7947 if (str.startsWith('bc1')) {
7948 return bech32.test(str);
7949 }
7950
7951 return base58.test(str);
7952 }
7953
7954 module.exports = exports.default;
7955 module.exports.default = exports.default;
7956 }(isBtcAddress$1, isBtcAddress$1.exports));
7957
7958 var isBtcAddressValidator = /*@__PURE__*/getDefaultExportFromCjs(isBtcAddress$1.exports);
7959
7960 var IS_BTC_ADDRESS = 'isBtcAddress';
7961 /**
7962 * Check if the string is a valid BTC address.
7963 * If given value is not a string, then it returns false.
7964 */
7965 function isBtcAddress(value) {
7966 return typeof value === 'string' && isBtcAddressValidator(value);
7967 }
7968 /**
7969 * Check if the string is a valid BTC address.
7970 * If given value is not a string, then it returns false.
7971 */
7972 function IsBtcAddress(validationOptions) {
7973 return ValidateBy({
7974 name: IS_BTC_ADDRESS,
7975 validator: {
7976 validate: function (value, args) { return isBtcAddress(value); },
7977 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a BTC address'; }, validationOptions),
7978 },
7979 }, validationOptions);
7980 }
7981
7982 var isDataURI$1 = {exports: {}};
7983
7984 (function (module, exports) {
7985
7986 Object.defineProperty(exports, "__esModule", {
7987 value: true
7988 });
7989 exports.default = isDataURI;
7990
7991 var _assertString = _interopRequireDefault(assertString.exports);
7992
7993 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7994
7995 var validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i;
7996 var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i;
7997 var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;
7998
7999 function isDataURI(str) {
8000 (0, _assertString.default)(str);
8001 var data = str.split(',');
8002
8003 if (data.length < 2) {
8004 return false;
8005 }
8006
8007 var attributes = data.shift().trim().split(';');
8008 var schemeAndMediaType = attributes.shift();
8009
8010 if (schemeAndMediaType.substr(0, 5) !== 'data:') {
8011 return false;
8012 }
8013
8014 var mediaType = schemeAndMediaType.substr(5);
8015
8016 if (mediaType !== '' && !validMediaType.test(mediaType)) {
8017 return false;
8018 }
8019
8020 for (var i = 0; i < attributes.length; i++) {
8021 if (!(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') && !validAttribute.test(attributes[i])) {
8022 return false;
8023 }
8024 }
8025
8026 for (var _i = 0; _i < data.length; _i++) {
8027 if (!validData.test(data[_i])) {
8028 return false;
8029 }
8030 }
8031
8032 return true;
8033 }
8034
8035 module.exports = exports.default;
8036 module.exports.default = exports.default;
8037 }(isDataURI$1, isDataURI$1.exports));
8038
8039 var isDataURIValidator = /*@__PURE__*/getDefaultExportFromCjs(isDataURI$1.exports);
8040
8041 var IS_DATA_URI = 'isDataURI';
8042 /**
8043 * Check if the string is a data uri format.
8044 * If given value is not a string, then it returns false.
8045 */
8046 function isDataURI(value) {
8047 return typeof value === 'string' && isDataURIValidator(value);
8048 }
8049 /**
8050 * Check if the string is a data uri format.
8051 * If given value is not a string, then it returns false.
8052 */
8053 function IsDataURI(validationOptions) {
8054 return ValidateBy({
8055 name: IS_DATA_URI,
8056 validator: {
8057 validate: function (value, args) { return isDataURI(value); },
8058 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a data uri format'; }, validationOptions),
8059 },
8060 }, validationOptions);
8061 }
8062
8063 var isEAN$1 = {exports: {}};
8064
8065 (function (module, exports) {
8066
8067 Object.defineProperty(exports, "__esModule", {
8068 value: true
8069 });
8070 exports.default = isEAN;
8071
8072 var _assertString = _interopRequireDefault(assertString.exports);
8073
8074 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8075
8076 /**
8077 * The most commonly used EAN standard is
8078 * the thirteen-digit EAN-13, while the
8079 * less commonly used 8-digit EAN-8 barcode was
8080 * introduced for use on small packages.
8081 * Also EAN/UCC-14 is used for Grouping of individual
8082 * trade items above unit level(Intermediate, Carton or Pallet).
8083 * For more info about EAN-14 checkout: https://www.gtin.info/itf-14-barcodes/
8084 * EAN consists of:
8085 * GS1 prefix, manufacturer code, product code and check digit
8086 * Reference: https://en.wikipedia.org/wiki/International_Article_Number
8087 * Reference: https://www.gtin.info/
8088 */
8089
8090 /**
8091 * Define EAN Lenghts; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14
8092 * and Regular Expression for valid EANs (EAN-8, EAN-13, EAN-14),
8093 * with exact numberic matching of 8 or 13 or 14 digits [0-9]
8094 */
8095 var LENGTH_EAN_8 = 8;
8096 var LENGTH_EAN_14 = 14;
8097 var validEanRegex = /^(\d{8}|\d{13}|\d{14})$/;
8098 /**
8099 * Get position weight given:
8100 * EAN length and digit index/position
8101 *
8102 * @param {number} length
8103 * @param {number} index
8104 * @return {number}
8105 */
8106
8107 function getPositionWeightThroughLengthAndIndex(length, index) {
8108 if (length === LENGTH_EAN_8 || length === LENGTH_EAN_14) {
8109 return index % 2 === 0 ? 3 : 1;
8110 }
8111
8112 return index % 2 === 0 ? 1 : 3;
8113 }
8114 /**
8115 * Calculate EAN Check Digit
8116 * Reference: https://en.wikipedia.org/wiki/International_Article_Number#Calculation_of_checksum_digit
8117 *
8118 * @param {string} ean
8119 * @return {number}
8120 */
8121
8122
8123 function calculateCheckDigit(ean) {
8124 var checksum = ean.slice(0, -1).split('').map(function (char, index) {
8125 return Number(char) * getPositionWeightThroughLengthAndIndex(ean.length, index);
8126 }).reduce(function (acc, partialSum) {
8127 return acc + partialSum;
8128 }, 0);
8129 var remainder = 10 - checksum % 10;
8130 return remainder < 10 ? remainder : 0;
8131 }
8132 /**
8133 * Check if string is valid EAN:
8134 * Matches EAN-8/EAN-13/EAN-14 regex
8135 * Has valid check digit.
8136 *
8137 * @param {string} str
8138 * @return {boolean}
8139 */
8140
8141
8142 function isEAN(str) {
8143 (0, _assertString.default)(str);
8144 var actualCheckDigit = Number(str.slice(-1));
8145 return validEanRegex.test(str) && actualCheckDigit === calculateCheckDigit(str);
8146 }
8147
8148 module.exports = exports.default;
8149 module.exports.default = exports.default;
8150 }(isEAN$1, isEAN$1.exports));
8151
8152 var isEANValidator = /*@__PURE__*/getDefaultExportFromCjs(isEAN$1.exports);
8153
8154 var IS_EAN = 'isEAN';
8155 /**
8156 * Check if the string is an EAN (European Article Number).
8157 * If given value is not a string, then it returns false.
8158 */
8159 function isEAN(value) {
8160 return typeof value === 'string' && isEANValidator(value);
8161 }
8162 /**
8163 * Check if the string is an EAN (European Article Number).
8164 * If given value is not a string, then it returns false.
8165 */
8166 function IsEAN(validationOptions) {
8167 return ValidateBy({
8168 name: IS_EAN,
8169 validator: {
8170 validate: function (value, args) { return isEAN(value); },
8171 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an EAN (European Article Number)'; }, validationOptions),
8172 },
8173 }, validationOptions);
8174 }
8175
8176 var isEthereumAddress$1 = {exports: {}};
8177
8178 (function (module, exports) {
8179
8180 Object.defineProperty(exports, "__esModule", {
8181 value: true
8182 });
8183 exports.default = isEthereumAddress;
8184
8185 var _assertString = _interopRequireDefault(assertString.exports);
8186
8187 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8188
8189 var eth = /^(0x)[0-9a-f]{40}$/i;
8190
8191 function isEthereumAddress(str) {
8192 (0, _assertString.default)(str);
8193 return eth.test(str);
8194 }
8195
8196 module.exports = exports.default;
8197 module.exports.default = exports.default;
8198 }(isEthereumAddress$1, isEthereumAddress$1.exports));
8199
8200 var isEthereumAddressValidator = /*@__PURE__*/getDefaultExportFromCjs(isEthereumAddress$1.exports);
8201
8202 var IS_ETHEREUM_ADDRESS = 'isEthereumAddress';
8203 /**
8204 * Check if the string is an Ethereum address using basic regex. Does not validate address checksums.
8205 * If given value is not a string, then it returns false.
8206 */
8207 function isEthereumAddress(value) {
8208 return typeof value === 'string' && isEthereumAddressValidator(value);
8209 }
8210 /**
8211 * Check if the string is an Ethereum address using basic regex. Does not validate address checksums.
8212 * If given value is not a string, then it returns false.
8213 */
8214 function IsEthereumAddress(validationOptions) {
8215 return ValidateBy({
8216 name: IS_ETHEREUM_ADDRESS,
8217 validator: {
8218 validate: function (value, args) { return isEthereumAddress(value); },
8219 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an Ethereum address'; }, validationOptions),
8220 },
8221 }, validationOptions);
8222 }
8223
8224 var isHSL$1 = {exports: {}};
8225
8226 (function (module, exports) {
8227
8228 Object.defineProperty(exports, "__esModule", {
8229 value: true
8230 });
8231 exports.default = isHSL;
8232
8233 var _assertString = _interopRequireDefault(assertString.exports);
8234
8235 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8236
8237 var hslComma = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}(,((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?))?\)$/i;
8238 var hslSpace = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s?(\/\s((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s?)?\)$/i;
8239
8240 function isHSL(str) {
8241 (0, _assertString.default)(str); // Strip duplicate spaces before calling the validation regex (See #1598 for more info)
8242
8243 var strippedStr = str.replace(/\s+/g, ' ').replace(/\s?(hsla?\(|\)|,)\s?/ig, '$1');
8244
8245 if (strippedStr.indexOf(',') !== -1) {
8246 return hslComma.test(strippedStr);
8247 }
8248
8249 return hslSpace.test(strippedStr);
8250 }
8251
8252 module.exports = exports.default;
8253 module.exports.default = exports.default;
8254 }(isHSL$1, isHSL$1.exports));
8255
8256 var isHSLValidator = /*@__PURE__*/getDefaultExportFromCjs(isHSL$1.exports);
8257
8258 var IS_HSL = 'isHSL';
8259 /**
8260 * Check if the string is an HSL (hue, saturation, lightness, optional alpha) color based on CSS Colors Level 4 specification.
8261 * Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: hsl(200grad+.1%62%/1)).
8262 * If given value is not a string, then it returns false.
8263 */
8264 function isHSL(value) {
8265 return typeof value === 'string' && isHSLValidator(value);
8266 }
8267 /**
8268 * Check if the string is an HSL (hue, saturation, lightness, optional alpha) color based on CSS Colors Level 4 specification.
8269 * Comma-separated format supported. Space-separated format supported with the exception of a few edge cases (ex: hsl(200grad+.1%62%/1)).
8270 * If given value is not a string, then it returns false.
8271 */
8272 function IsHSL(validationOptions) {
8273 return ValidateBy({
8274 name: IS_HSL,
8275 validator: {
8276 validate: function (value, args) { return isHSL(value); },
8277 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a HSL color'; }, validationOptions),
8278 },
8279 }, validationOptions);
8280 }
8281
8282 var isIBAN$2 = {};
8283
8284 Object.defineProperty(isIBAN$2, "__esModule", {
8285 value: true
8286 });
8287 var _default$1 = isIBAN$2.default = isIBAN$1;
8288 isIBAN$2.locales = void 0;
8289
8290 var _assertString$1 = _interopRequireDefault$1(assertString.exports);
8291
8292 function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8293
8294 /**
8295 * List of country codes with
8296 * corresponding IBAN regular expression
8297 * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number
8298 */
8299 var ibanRegexThroughCountryCode = {
8300 AD: /^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/,
8301 AE: /^(AE[0-9]{2})\d{3}\d{16}$/,
8302 AL: /^(AL[0-9]{2})\d{8}[A-Z0-9]{16}$/,
8303 AT: /^(AT[0-9]{2})\d{16}$/,
8304 AZ: /^(AZ[0-9]{2})[A-Z0-9]{4}\d{20}$/,
8305 BA: /^(BA[0-9]{2})\d{16}$/,
8306 BE: /^(BE[0-9]{2})\d{12}$/,
8307 BG: /^(BG[0-9]{2})[A-Z]{4}\d{6}[A-Z0-9]{8}$/,
8308 BH: /^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/,
8309 BR: /^(BR[0-9]{2})\d{23}[A-Z]{1}[A-Z0-9]{1}$/,
8310 BY: /^(BY[0-9]{2})[A-Z0-9]{4}\d{20}$/,
8311 CH: /^(CH[0-9]{2})\d{5}[A-Z0-9]{12}$/,
8312 CR: /^(CR[0-9]{2})\d{18}$/,
8313 CY: /^(CY[0-9]{2})\d{8}[A-Z0-9]{16}$/,
8314 CZ: /^(CZ[0-9]{2})\d{20}$/,
8315 DE: /^(DE[0-9]{2})\d{18}$/,
8316 DK: /^(DK[0-9]{2})\d{14}$/,
8317 DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/,
8318 EE: /^(EE[0-9]{2})\d{16}$/,
8319 EG: /^(EG[0-9]{2})\d{25}$/,
8320 ES: /^(ES[0-9]{2})\d{20}$/,
8321 FI: /^(FI[0-9]{2})\d{14}$/,
8322 FO: /^(FO[0-9]{2})\d{14}$/,
8323 FR: /^(FR[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,
8324 GB: /^(GB[0-9]{2})[A-Z]{4}\d{14}$/,
8325 GE: /^(GE[0-9]{2})[A-Z0-9]{2}\d{16}$/,
8326 GI: /^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/,
8327 GL: /^(GL[0-9]{2})\d{14}$/,
8328 GR: /^(GR[0-9]{2})\d{7}[A-Z0-9]{16}$/,
8329 GT: /^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/,
8330 HR: /^(HR[0-9]{2})\d{17}$/,
8331 HU: /^(HU[0-9]{2})\d{24}$/,
8332 IE: /^(IE[0-9]{2})[A-Z0-9]{4}\d{14}$/,
8333 IL: /^(IL[0-9]{2})\d{19}$/,
8334 IQ: /^(IQ[0-9]{2})[A-Z]{4}\d{15}$/,
8335 IR: /^(IR[0-9]{2})0\d{2}0\d{18}$/,
8336 IS: /^(IS[0-9]{2})\d{22}$/,
8337 IT: /^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,
8338 JO: /^(JO[0-9]{2})[A-Z]{4}\d{22}$/,
8339 KW: /^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/,
8340 KZ: /^(KZ[0-9]{2})\d{3}[A-Z0-9]{13}$/,
8341 LB: /^(LB[0-9]{2})\d{4}[A-Z0-9]{20}$/,
8342 LC: /^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/,
8343 LI: /^(LI[0-9]{2})\d{5}[A-Z0-9]{12}$/,
8344 LT: /^(LT[0-9]{2})\d{16}$/,
8345 LU: /^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/,
8346 LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,
8347 MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,
8348 MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/,
8349 ME: /^(ME[0-9]{2})\d{18}$/,
8350 MK: /^(MK[0-9]{2})\d{3}[A-Z0-9]{10}\d{2}$/,
8351 MR: /^(MR[0-9]{2})\d{23}$/,
8352 MT: /^(MT[0-9]{2})[A-Z]{4}\d{5}[A-Z0-9]{18}$/,
8353 MU: /^(MU[0-9]{2})[A-Z]{4}\d{19}[A-Z]{3}$/,
8354 MZ: /^(MZ[0-9]{2})\d{21}$/,
8355 NL: /^(NL[0-9]{2})[A-Z]{4}\d{10}$/,
8356 NO: /^(NO[0-9]{2})\d{11}$/,
8357 PK: /^(PK[0-9]{2})[A-Z0-9]{4}\d{16}$/,
8358 PL: /^(PL[0-9]{2})\d{24}$/,
8359 PS: /^(PS[0-9]{2})[A-Z0-9]{4}\d{21}$/,
8360 PT: /^(PT[0-9]{2})\d{21}$/,
8361 QA: /^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/,
8362 RO: /^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/,
8363 RS: /^(RS[0-9]{2})\d{18}$/,
8364 SA: /^(SA[0-9]{2})\d{2}[A-Z0-9]{18}$/,
8365 SC: /^(SC[0-9]{2})[A-Z]{4}\d{20}[A-Z]{3}$/,
8366 SE: /^(SE[0-9]{2})\d{20}$/,
8367 SI: /^(SI[0-9]{2})\d{15}$/,
8368 SK: /^(SK[0-9]{2})\d{20}$/,
8369 SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,
8370 SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/,
8371 TL: /^(TL[0-9]{2})\d{19}$/,
8372 TN: /^(TN[0-9]{2})\d{20}$/,
8373 TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/,
8374 UA: /^(UA[0-9]{2})\d{6}[A-Z0-9]{19}$/,
8375 VA: /^(VA[0-9]{2})\d{18}$/,
8376 VG: /^(VG[0-9]{2})[A-Z0-9]{4}\d{16}$/,
8377 XK: /^(XK[0-9]{2})\d{16}$/
8378 };
8379 /**
8380 * Check whether string has correct universal IBAN format
8381 * The IBAN consists of up to 34 alphanumeric characters, as follows:
8382 * Country Code using ISO 3166-1 alpha-2, two letters
8383 * check digits, two digits and
8384 * Basic Bank Account Number (BBAN), up to 30 alphanumeric characters.
8385 * NOTE: Permitted IBAN characters are: digits [0-9] and the 26 latin alphabetic [A-Z]
8386 *
8387 * @param {string} str - string under validation
8388 * @return {boolean}
8389 */
8390
8391 function hasValidIbanFormat(str) {
8392 // Strip white spaces and hyphens
8393 var strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase();
8394 var isoCountryCode = strippedStr.slice(0, 2).toUpperCase();
8395 return isoCountryCode in ibanRegexThroughCountryCode && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr);
8396 }
8397 /**
8398 * Check whether string has valid IBAN Checksum
8399 * by performing basic mod-97 operation and
8400 * the remainder should equal 1
8401 * -- Start by rearranging the IBAN by moving the four initial characters to the end of the string
8402 * -- Replace each letter in the string with two digits, A -> 10, B = 11, Z = 35
8403 * -- Interpret the string as a decimal integer and
8404 * -- compute the remainder on division by 97 (mod 97)
8405 * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number
8406 *
8407 * @param {string} str
8408 * @return {boolean}
8409 */
8410
8411
8412 function hasValidIbanChecksum(str) {
8413 var strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic
8414
8415 var rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4);
8416 var alphaCapsReplacedWithDigits = rearranged.replace(/[A-Z]/g, function (char) {
8417 return char.charCodeAt(0) - 55;
8418 });
8419 var remainder = alphaCapsReplacedWithDigits.match(/\d{1,7}/g).reduce(function (acc, value) {
8420 return Number(acc + value) % 97;
8421 }, '');
8422 return remainder === 1;
8423 }
8424
8425 function isIBAN$1(str) {
8426 (0, _assertString$1.default)(str);
8427 return hasValidIbanFormat(str) && hasValidIbanChecksum(str);
8428 }
8429
8430 var locales$1 = Object.keys(ibanRegexThroughCountryCode);
8431 isIBAN$2.locales = locales$1;
8432
8433 var IS_IBAN = 'isIBAN';
8434 /**
8435 * Check if a string is a IBAN (International Bank Account Number).
8436 * If given value is not a string, then it returns false.
8437 */
8438 function isIBAN(value) {
8439 return typeof value === 'string' && _default$1(value);
8440 }
8441 /**
8442 * Check if a string is a IBAN (International Bank Account Number).
8443 * If given value is not a string, then it returns false.
8444 */
8445 function IsIBAN(validationOptions) {
8446 return ValidateBy({
8447 name: IS_IBAN,
8448 validator: {
8449 validate: function (value, args) { return isIBAN(value); },
8450 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an IBAN'; }, validationOptions),
8451 },
8452 }, validationOptions);
8453 }
8454
8455 var isIdentityCard$1 = {exports: {}};
8456
8457 (function (module, exports) {
8458
8459 Object.defineProperty(exports, "__esModule", {
8460 value: true
8461 });
8462 exports.default = isIdentityCard;
8463
8464 var _assertString = _interopRequireDefault(assertString.exports);
8465
8466 var _isInt = _interopRequireDefault(isInt$1.exports);
8467
8468 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8469
8470 var validators = {
8471 PL: function PL(str) {
8472 (0, _assertString.default)(str);
8473 var weightOfDigits = {
8474 1: 1,
8475 2: 3,
8476 3: 7,
8477 4: 9,
8478 5: 1,
8479 6: 3,
8480 7: 7,
8481 8: 9,
8482 9: 1,
8483 10: 3,
8484 11: 0
8485 };
8486
8487 if (str != null && str.length === 11 && (0, _isInt.default)(str, {
8488 allow_leading_zeroes: true
8489 })) {
8490 var digits = str.split('').slice(0, -1);
8491 var sum = digits.reduce(function (acc, digit, index) {
8492 return acc + Number(digit) * weightOfDigits[index + 1];
8493 }, 0);
8494 var modulo = sum % 10;
8495 var lastDigit = Number(str.charAt(str.length - 1));
8496
8497 if (modulo === 0 && lastDigit === 0 || lastDigit === 10 - modulo) {
8498 return true;
8499 }
8500 }
8501
8502 return false;
8503 },
8504 ES: function ES(str) {
8505 (0, _assertString.default)(str);
8506 var DNI = /^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/;
8507 var charsValue = {
8508 X: 0,
8509 Y: 1,
8510 Z: 2
8511 };
8512 var controlDigits = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E']; // sanitize user input
8513
8514 var sanitized = str.trim().toUpperCase(); // validate the data structure
8515
8516 if (!DNI.test(sanitized)) {
8517 return false;
8518 } // validate the control digit
8519
8520
8521 var number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, function (char) {
8522 return charsValue[char];
8523 });
8524 return sanitized.endsWith(controlDigits[number % 23]);
8525 },
8526 FI: function FI(str) {
8527 // https://dvv.fi/en/personal-identity-code#:~:text=control%20character%20for%20a-,personal,-identity%20code%20calculated
8528 (0, _assertString.default)(str);
8529
8530 if (str.length !== 11) {
8531 return false;
8532 }
8533
8534 if (!str.match(/^\d{6}[\-A\+]\d{3}[0-9ABCDEFHJKLMNPRSTUVWXY]{1}$/)) {
8535 return false;
8536 }
8537
8538 var checkDigits = '0123456789ABCDEFHJKLMNPRSTUVWXY';
8539 var idAsNumber = parseInt(str.slice(0, 6), 10) * 1000 + parseInt(str.slice(7, 10), 10);
8540 var remainder = idAsNumber % 31;
8541 var checkDigit = checkDigits[remainder];
8542 return checkDigit === str.slice(10, 11);
8543 },
8544 IN: function IN(str) {
8545 var DNI = /^[1-9]\d{3}\s?\d{4}\s?\d{4}$/; // multiplication table
8546
8547 var d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]; // permutation table
8548
8549 var p = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]]; // sanitize user input
8550
8551 var sanitized = str.trim(); // validate the data structure
8552
8553 if (!DNI.test(sanitized)) {
8554 return false;
8555 }
8556
8557 var c = 0;
8558 var invertedArray = sanitized.replace(/\s/g, '').split('').map(Number).reverse();
8559 invertedArray.forEach(function (val, i) {
8560 c = d[c][p[i % 8][val]];
8561 });
8562 return c === 0;
8563 },
8564 IR: function IR(str) {
8565 if (!str.match(/^\d{10}$/)) return false;
8566 str = "0000".concat(str).substr(str.length - 6);
8567 if (parseInt(str.substr(3, 6), 10) === 0) return false;
8568 var lastNumber = parseInt(str.substr(9, 1), 10);
8569 var sum = 0;
8570
8571 for (var i = 0; i < 9; i++) {
8572 sum += parseInt(str.substr(i, 1), 10) * (10 - i);
8573 }
8574
8575 sum %= 11;
8576 return sum < 2 && lastNumber === sum || sum >= 2 && lastNumber === 11 - sum;
8577 },
8578 IT: function IT(str) {
8579 if (str.length !== 9) return false;
8580 if (str === 'CA00000AA') return false; // https://it.wikipedia.org/wiki/Carta_d%27identit%C3%A0_elettronica_italiana
8581
8582 return str.search(/C[A-Z][0-9]{5}[A-Z]{2}/i) > -1;
8583 },
8584 NO: function NO(str) {
8585 var sanitized = str.trim();
8586 if (isNaN(Number(sanitized))) return false;
8587 if (sanitized.length !== 11) return false;
8588 if (sanitized === '00000000000') return false; // https://no.wikipedia.org/wiki/F%C3%B8dselsnummer
8589
8590 var f = sanitized.split('').map(Number);
8591 var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11;
8592 var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11;
8593 if (k1 !== f[9] || k2 !== f[10]) return false;
8594 return true;
8595 },
8596 TH: function TH(str) {
8597 if (!str.match(/^[1-8]\d{12}$/)) return false; // validate check digit
8598
8599 var sum = 0;
8600
8601 for (var i = 0; i < 12; i++) {
8602 sum += parseInt(str[i], 10) * (13 - i);
8603 }
8604
8605 return str[12] === ((11 - sum % 11) % 10).toString();
8606 },
8607 LK: function LK(str) {
8608 var old_nic = /^[1-9]\d{8}[vx]$/i;
8609 var new_nic = /^[1-9]\d{11}$/i;
8610 if (str.length === 10 && old_nic.test(str)) return true;else if (str.length === 12 && new_nic.test(str)) return true;
8611 return false;
8612 },
8613 'he-IL': function heIL(str) {
8614 var DNI = /^\d{9}$/; // sanitize user input
8615
8616 var sanitized = str.trim(); // validate the data structure
8617
8618 if (!DNI.test(sanitized)) {
8619 return false;
8620 }
8621
8622 var id = sanitized;
8623 var sum = 0,
8624 incNum;
8625
8626 for (var i = 0; i < id.length; i++) {
8627 incNum = Number(id[i]) * (i % 2 + 1); // Multiply number by 1 or 2
8628
8629 sum += incNum > 9 ? incNum - 9 : incNum; // Sum the digits up and add to total
8630 }
8631
8632 return sum % 10 === 0;
8633 },
8634 'ar-LY': function arLY(str) {
8635 // Libya National Identity Number NIN is 12 digits, the first digit is either 1 or 2
8636 var NIN = /^(1|2)\d{11}$/; // sanitize user input
8637
8638 var sanitized = str.trim(); // validate the data structure
8639
8640 if (!NIN.test(sanitized)) {
8641 return false;
8642 }
8643
8644 return true;
8645 },
8646 'ar-TN': function arTN(str) {
8647 var DNI = /^\d{8}$/; // sanitize user input
8648
8649 var sanitized = str.trim(); // validate the data structure
8650
8651 if (!DNI.test(sanitized)) {
8652 return false;
8653 }
8654
8655 return true;
8656 },
8657 'zh-CN': function zhCN(str) {
8658 var provincesAndCities = ['11', // 北京
8659 '12', // 天津
8660 '13', // 河北
8661 '14', // 山西
8662 '15', // 内蒙古
8663 '21', // 辽宁
8664 '22', // 吉林
8665 '23', // 黑龙江
8666 '31', // 上海
8667 '32', // 江苏
8668 '33', // 浙江
8669 '34', // 安徽
8670 '35', // 福建
8671 '36', // 江西
8672 '37', // 山东
8673 '41', // 河南
8674 '42', // 湖北
8675 '43', // 湖南
8676 '44', // 广东
8677 '45', // 广西
8678 '46', // 海南
8679 '50', // 重庆
8680 '51', // 四川
8681 '52', // 贵州
8682 '53', // 云南
8683 '54', // 西藏
8684 '61', // 陕西
8685 '62', // 甘肃
8686 '63', // 青海
8687 '64', // 宁夏
8688 '65', // 新疆
8689 '71', // 台湾
8690 '81', // 香港
8691 '82', // 澳门
8692 '91' // 国外
8693 ];
8694 var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2'];
8695 var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
8696
8697 var checkAddressCode = function checkAddressCode(addressCode) {
8698 return provincesAndCities.includes(addressCode);
8699 };
8700
8701 var checkBirthDayCode = function checkBirthDayCode(birDayCode) {
8702 var yyyy = parseInt(birDayCode.substring(0, 4), 10);
8703 var mm = parseInt(birDayCode.substring(4, 6), 10);
8704 var dd = parseInt(birDayCode.substring(6), 10);
8705 var xdata = new Date(yyyy, mm - 1, dd);
8706
8707 if (xdata > new Date()) {
8708 return false; // eslint-disable-next-line max-len
8709 } else if (xdata.getFullYear() === yyyy && xdata.getMonth() === mm - 1 && xdata.getDate() === dd) {
8710 return true;
8711 }
8712
8713 return false;
8714 };
8715
8716 var getParityBit = function getParityBit(idCardNo) {
8717 var id17 = idCardNo.substring(0, 17);
8718 var power = 0;
8719
8720 for (var i = 0; i < 17; i++) {
8721 power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10);
8722 }
8723
8724 var mod = power % 11;
8725 return parityBit[mod];
8726 };
8727
8728 var checkParityBit = function checkParityBit(idCardNo) {
8729 return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase();
8730 };
8731
8732 var check15IdCardNo = function check15IdCardNo(idCardNo) {
8733 var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo);
8734 if (!check) return false;
8735 var addressCode = idCardNo.substring(0, 2);
8736 check = checkAddressCode(addressCode);
8737 if (!check) return false;
8738 var birDayCode = "19".concat(idCardNo.substring(6, 12));
8739 check = checkBirthDayCode(birDayCode);
8740 if (!check) return false;
8741 return true;
8742 };
8743
8744 var check18IdCardNo = function check18IdCardNo(idCardNo) {
8745 var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo);
8746 if (!check) return false;
8747 var addressCode = idCardNo.substring(0, 2);
8748 check = checkAddressCode(addressCode);
8749 if (!check) return false;
8750 var birDayCode = idCardNo.substring(6, 14);
8751 check = checkBirthDayCode(birDayCode);
8752 if (!check) return false;
8753 return checkParityBit(idCardNo);
8754 };
8755
8756 var checkIdCardNo = function checkIdCardNo(idCardNo) {
8757 var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo);
8758 if (!check) return false;
8759
8760 if (idCardNo.length === 15) {
8761 return check15IdCardNo(idCardNo);
8762 }
8763
8764 return check18IdCardNo(idCardNo);
8765 };
8766
8767 return checkIdCardNo(str);
8768 },
8769 'zh-TW': function zhTW(str) {
8770 var ALPHABET_CODES = {
8771 A: 10,
8772 B: 11,
8773 C: 12,
8774 D: 13,
8775 E: 14,
8776 F: 15,
8777 G: 16,
8778 H: 17,
8779 I: 34,
8780 J: 18,
8781 K: 19,
8782 L: 20,
8783 M: 21,
8784 N: 22,
8785 O: 35,
8786 P: 23,
8787 Q: 24,
8788 R: 25,
8789 S: 26,
8790 T: 27,
8791 U: 28,
8792 V: 29,
8793 W: 32,
8794 X: 30,
8795 Y: 31,
8796 Z: 33
8797 };
8798 var sanitized = str.trim().toUpperCase();
8799 if (!/^[A-Z][0-9]{9}$/.test(sanitized)) return false;
8800 return Array.from(sanitized).reduce(function (sum, number, index) {
8801 if (index === 0) {
8802 var code = ALPHABET_CODES[number];
8803 return code % 10 * 9 + Math.floor(code / 10);
8804 }
8805
8806 if (index === 9) {
8807 return (10 - sum % 10 - Number(number)) % 10 === 0;
8808 }
8809
8810 return sum + Number(number) * (9 - index);
8811 }, 0);
8812 }
8813 };
8814
8815 function isIdentityCard(str, locale) {
8816 (0, _assertString.default)(str);
8817
8818 if (locale in validators) {
8819 return validators[locale](str);
8820 } else if (locale === 'any') {
8821 for (var key in validators) {
8822 // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
8823 // istanbul ignore else
8824 if (validators.hasOwnProperty(key)) {
8825 var validator = validators[key];
8826
8827 if (validator(str)) {
8828 return true;
8829 }
8830 }
8831 }
8832
8833 return false;
8834 }
8835
8836 throw new Error("Invalid locale '".concat(locale, "'"));
8837 }
8838
8839 module.exports = exports.default;
8840 module.exports.default = exports.default;
8841 }(isIdentityCard$1, isIdentityCard$1.exports));
8842
8843 var isIdentityCardValidator = /*@__PURE__*/getDefaultExportFromCjs(isIdentityCard$1.exports);
8844
8845 var IS_IDENTITY_CARD = 'isIdentityCard';
8846 /**
8847 * Check if the string is a valid identity card code.
8848 * locale is one of ['ES', 'zh-TW', 'he-IL', 'ar-TN'] OR 'any'. If 'any' is used, function will check if any of the locals match.
8849 * Defaults to 'any'.
8850 * If given value is not a string, then it returns false.
8851 */
8852 function isIdentityCard(value, locale) {
8853 return typeof value === 'string' && isIdentityCardValidator(value, locale);
8854 }
8855 /**
8856 * Check if the string is a valid identity card code.
8857 * locale is one of ['ES', 'zh-TW', 'he-IL', 'ar-TN'] OR 'any'. If 'any' is used, function will check if any of the locals match.
8858 * Defaults to 'any'.
8859 * If given value is not a string, then it returns false.
8860 */
8861 function IsIdentityCard(locale, validationOptions) {
8862 return ValidateBy({
8863 name: IS_IDENTITY_CARD,
8864 constraints: [locale],
8865 validator: {
8866 validate: function (value, args) { return isIdentityCard(value, args.constraints[0]); },
8867 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a identity card number'; }, validationOptions),
8868 },
8869 }, validationOptions);
8870 }
8871
8872 var isISRC$1 = {exports: {}};
8873
8874 (function (module, exports) {
8875
8876 Object.defineProperty(exports, "__esModule", {
8877 value: true
8878 });
8879 exports.default = isISRC;
8880
8881 var _assertString = _interopRequireDefault(assertString.exports);
8882
8883 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8884
8885 // see http://isrc.ifpi.org/en/isrc-standard/code-syntax
8886 var isrc = /^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;
8887
8888 function isISRC(str) {
8889 (0, _assertString.default)(str);
8890 return isrc.test(str);
8891 }
8892
8893 module.exports = exports.default;
8894 module.exports.default = exports.default;
8895 }(isISRC$1, isISRC$1.exports));
8896
8897 var isISRCValidator = /*@__PURE__*/getDefaultExportFromCjs(isISRC$1.exports);
8898
8899 var IS_ISRC = 'isISRC';
8900 /**
8901 * Check if the string is a ISRC.
8902 * If given value is not a string, then it returns false.
8903 */
8904 function isISRC(value) {
8905 return typeof value === 'string' && isISRCValidator(value);
8906 }
8907 /**
8908 * Check if the string is a ISRC.
8909 * If given value is not a string, then it returns false.
8910 */
8911 function IsISRC(validationOptions) {
8912 return ValidateBy({
8913 name: IS_ISRC,
8914 validator: {
8915 validate: function (value, args) { return isISRC(value); },
8916 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an ISRC'; }, validationOptions),
8917 },
8918 }, validationOptions);
8919 }
8920
8921 var isLocale$1 = {exports: {}};
8922
8923 (function (module, exports) {
8924
8925 Object.defineProperty(exports, "__esModule", {
8926 value: true
8927 });
8928 exports.default = isLocale;
8929
8930 var _assertString = _interopRequireDefault(assertString.exports);
8931
8932 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8933
8934 var localeReg = /^[A-Za-z]{2,4}([_-]([A-Za-z]{4}|[\d]{3}))?([_-]([A-Za-z]{2}|[\d]{3}))?$/;
8935
8936 function isLocale(str) {
8937 (0, _assertString.default)(str);
8938
8939 if (str === 'en_US_POSIX' || str === 'ca_ES_VALENCIA') {
8940 return true;
8941 }
8942
8943 return localeReg.test(str);
8944 }
8945
8946 module.exports = exports.default;
8947 module.exports.default = exports.default;
8948 }(isLocale$1, isLocale$1.exports));
8949
8950 var isLocaleValidator = /*@__PURE__*/getDefaultExportFromCjs(isLocale$1.exports);
8951
8952 var IS_LOCALE = 'isLocale';
8953 /**
8954 * Check if the string is a locale.
8955 * If given value is not a string, then it returns false.
8956 */
8957 function isLocale(value) {
8958 return typeof value === 'string' && isLocaleValidator(value);
8959 }
8960 /**
8961 * Check if the string is a locale.
8962 * If given value is not a string, then it returns false.
8963 */
8964 function IsLocale(validationOptions) {
8965 return ValidateBy({
8966 name: IS_LOCALE,
8967 validator: {
8968 validate: function (value, args) { return isLocale(value); },
8969 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be locale'; }, validationOptions),
8970 },
8971 }, validationOptions);
8972 }
8973
8974 var isMagnetURI$1 = {exports: {}};
8975
8976 (function (module, exports) {
8977
8978 Object.defineProperty(exports, "__esModule", {
8979 value: true
8980 });
8981 exports.default = isMagnetURI;
8982
8983 var _assertString = _interopRequireDefault(assertString.exports);
8984
8985 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8986
8987 var magnetURI = /^magnet:\?xt(?:\.1)?=urn:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?($|&)/i;
8988
8989 function isMagnetURI(url) {
8990 (0, _assertString.default)(url);
8991 return magnetURI.test(url.trim());
8992 }
8993
8994 module.exports = exports.default;
8995 module.exports.default = exports.default;
8996 }(isMagnetURI$1, isMagnetURI$1.exports));
8997
8998 var isMagnetURIValidator = /*@__PURE__*/getDefaultExportFromCjs(isMagnetURI$1.exports);
8999
9000 var IS_MAGNET_URI = 'isMagnetURI';
9001 /**
9002 * Check if the string is a magnet uri format.
9003 * If given value is not a string, then it returns false.
9004 */
9005 function isMagnetURI(value) {
9006 return typeof value === 'string' && isMagnetURIValidator(value);
9007 }
9008 /**
9009 * Check if the string is a magnet uri format.
9010 * If given value is not a string, then it returns false.
9011 */
9012 function IsMagnetURI(validationOptions) {
9013 return ValidateBy({
9014 name: IS_MAGNET_URI,
9015 validator: {
9016 validate: function (value, args) { return isMagnetURI(value); },
9017 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be magnet uri format'; }, validationOptions),
9018 },
9019 }, validationOptions);
9020 }
9021
9022 var isMimeType$1 = {exports: {}};
9023
9024 (function (module, exports) {
9025
9026 Object.defineProperty(exports, "__esModule", {
9027 value: true
9028 });
9029 exports.default = isMimeType;
9030
9031 var _assertString = _interopRequireDefault(assertString.exports);
9032
9033 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9034
9035 /*
9036 Checks if the provided string matches to a correct Media type format (MIME type)
9037
9038 This function only checks is the string format follows the
9039 etablished rules by the according RFC specifications.
9040 This function supports 'charset' in textual media types
9041 (https://tools.ietf.org/html/rfc6657).
9042
9043 This function does not check against all the media types listed
9044 by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml)
9045 because of lightness purposes : it would require to include
9046 all these MIME types in this librairy, which would weigh it
9047 significantly. This kind of effort maybe is not worth for the use that
9048 this function has in this entire librairy.
9049
9050 More informations in the RFC specifications :
9051 - https://tools.ietf.org/html/rfc2045
9052 - https://tools.ietf.org/html/rfc2046
9053 - https://tools.ietf.org/html/rfc7231#section-3.1.1.1
9054 - https://tools.ietf.org/html/rfc7231#section-3.1.1.5
9055 */
9056 // Match simple MIME types
9057 // NB :
9058 // Subtype length must not exceed 100 characters.
9059 // This rule does not comply to the RFC specs (what is the max length ?).
9060 var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len
9061 // Handle "charset" in "text/*"
9062
9063 var mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len
9064 // Handle "boundary" in "multipart/*"
9065
9066 var mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len
9067
9068 function isMimeType(str) {
9069 (0, _assertString.default)(str);
9070 return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str);
9071 }
9072
9073 module.exports = exports.default;
9074 module.exports.default = exports.default;
9075 }(isMimeType$1, isMimeType$1.exports));
9076
9077 var isMimeTypeValidator = /*@__PURE__*/getDefaultExportFromCjs(isMimeType$1.exports);
9078
9079 var IS_MIME_TYPE = 'isMimeType';
9080 /**
9081 * Check if the string matches to a valid MIME type format
9082 * If given value is not a string, then it returns false.
9083 */
9084 function isMimeType(value) {
9085 return typeof value === 'string' && isMimeTypeValidator(value);
9086 }
9087 /**
9088 * Check if the string matches to a valid MIME type format
9089 * If given value is not a string, then it returns false.
9090 */
9091 function IsMimeType(validationOptions) {
9092 return ValidateBy({
9093 name: IS_MIME_TYPE,
9094 validator: {
9095 validate: function (value, args) { return isMimeType(value); },
9096 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be MIME type format'; }, validationOptions),
9097 },
9098 }, validationOptions);
9099 }
9100
9101 var isOctal$1 = {exports: {}};
9102
9103 (function (module, exports) {
9104
9105 Object.defineProperty(exports, "__esModule", {
9106 value: true
9107 });
9108 exports.default = isOctal;
9109
9110 var _assertString = _interopRequireDefault(assertString.exports);
9111
9112 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9113
9114 var octal = /^(0o)?[0-7]+$/i;
9115
9116 function isOctal(str) {
9117 (0, _assertString.default)(str);
9118 return octal.test(str);
9119 }
9120
9121 module.exports = exports.default;
9122 module.exports.default = exports.default;
9123 }(isOctal$1, isOctal$1.exports));
9124
9125 var isOctalValidator = /*@__PURE__*/getDefaultExportFromCjs(isOctal$1.exports);
9126
9127 var IS_OCTAL = 'isOctal';
9128 /**
9129 * Check if the string is a valid octal number.
9130 * If given value is not a string, then it returns false.
9131 */
9132 function isOctal(value) {
9133 return typeof value === 'string' && isOctalValidator(value);
9134 }
9135 /**
9136 * Check if the string is a valid octal number.
9137 * If given value is not a string, then it returns false.
9138 */
9139 function IsOctal(validationOptions) {
9140 return ValidateBy({
9141 name: IS_OCTAL,
9142 validator: {
9143 validate: function (value, args) { return isOctal(value); },
9144 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be valid octal number'; }, validationOptions),
9145 },
9146 }, validationOptions);
9147 }
9148
9149 var isPassportNumber$1 = {exports: {}};
9150
9151 (function (module, exports) {
9152
9153 Object.defineProperty(exports, "__esModule", {
9154 value: true
9155 });
9156 exports.default = isPassportNumber;
9157
9158 var _assertString = _interopRequireDefault(assertString.exports);
9159
9160 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9161
9162 /**
9163 * Reference:
9164 * https://en.wikipedia.org/ -- Wikipedia
9165 * https://docs.microsoft.com/en-us/microsoft-365/compliance/eu-passport-number -- EU Passport Number
9166 * https://countrycode.org/ -- Country Codes
9167 */
9168 var passportRegexByCountryCode = {
9169 AM: /^[A-Z]{2}\d{7}$/,
9170 // ARMENIA
9171 AR: /^[A-Z]{3}\d{6}$/,
9172 // ARGENTINA
9173 AT: /^[A-Z]\d{7}$/,
9174 // AUSTRIA
9175 AU: /^[A-Z]\d{7}$/,
9176 // AUSTRALIA
9177 BE: /^[A-Z]{2}\d{6}$/,
9178 // BELGIUM
9179 BG: /^\d{9}$/,
9180 // BULGARIA
9181 BR: /^[A-Z]{2}\d{6}$/,
9182 // BRAZIL
9183 BY: /^[A-Z]{2}\d{7}$/,
9184 // BELARUS
9185 CA: /^[A-Z]{2}\d{6}$/,
9186 // CANADA
9187 CH: /^[A-Z]\d{7}$/,
9188 // SWITZERLAND
9189 CN: /^G\d{8}$|^E(?![IO])[A-Z0-9]\d{7}$/,
9190 // CHINA [G=Ordinary, E=Electronic] followed by 8-digits, or E followed by any UPPERCASE letter (except I and O) followed by 7 digits
9191 CY: /^[A-Z](\d{6}|\d{8})$/,
9192 // CYPRUS
9193 CZ: /^\d{8}$/,
9194 // CZECH REPUBLIC
9195 DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/,
9196 // GERMANY
9197 DK: /^\d{9}$/,
9198 // DENMARK
9199 DZ: /^\d{9}$/,
9200 // ALGERIA
9201 EE: /^([A-Z]\d{7}|[A-Z]{2}\d{7})$/,
9202 // ESTONIA (K followed by 7-digits), e-passports have 2 UPPERCASE followed by 7 digits
9203 ES: /^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/,
9204 // SPAIN
9205 FI: /^[A-Z]{2}\d{7}$/,
9206 // FINLAND
9207 FR: /^\d{2}[A-Z]{2}\d{5}$/,
9208 // FRANCE
9209 GB: /^\d{9}$/,
9210 // UNITED KINGDOM
9211 GR: /^[A-Z]{2}\d{7}$/,
9212 // GREECE
9213 HR: /^\d{9}$/,
9214 // CROATIA
9215 HU: /^[A-Z]{2}(\d{6}|\d{7})$/,
9216 // HUNGARY
9217 IE: /^[A-Z0-9]{2}\d{7}$/,
9218 // IRELAND
9219 IN: /^[A-Z]{1}-?\d{7}$/,
9220 // INDIA
9221 ID: /^[A-C]\d{7}$/,
9222 // INDONESIA
9223 IR: /^[A-Z]\d{8}$/,
9224 // IRAN
9225 IS: /^(A)\d{7}$/,
9226 // ICELAND
9227 IT: /^[A-Z0-9]{2}\d{7}$/,
9228 // ITALY
9229 JP: /^[A-Z]{2}\d{7}$/,
9230 // JAPAN
9231 KR: /^[MS]\d{8}$/,
9232 // SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports]
9233 LT: /^[A-Z0-9]{8}$/,
9234 // LITHUANIA
9235 LU: /^[A-Z0-9]{8}$/,
9236 // LUXEMBURG
9237 LV: /^[A-Z0-9]{2}\d{7}$/,
9238 // LATVIA
9239 LY: /^[A-Z0-9]{8}$/,
9240 // LIBYA
9241 MT: /^\d{7}$/,
9242 // MALTA
9243 MZ: /^([A-Z]{2}\d{7})|(\d{2}[A-Z]{2}\d{5})$/,
9244 // MOZAMBIQUE
9245 MY: /^[AHK]\d{8}$/,
9246 // MALAYSIA
9247 NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/,
9248 // NETHERLANDS
9249 PL: /^[A-Z]{2}\d{7}$/,
9250 // POLAND
9251 PT: /^[A-Z]\d{6}$/,
9252 // PORTUGAL
9253 RO: /^\d{8,9}$/,
9254 // ROMANIA
9255 RU: /^\d{9}$/,
9256 // RUSSIAN FEDERATION
9257 SE: /^\d{8}$/,
9258 // SWEDEN
9259 SL: /^(P)[A-Z]\d{7}$/,
9260 // SLOVANIA
9261 SK: /^[0-9A-Z]\d{7}$/,
9262 // SLOVAKIA
9263 TR: /^[A-Z]\d{8}$/,
9264 // TURKEY
9265 UA: /^[A-Z]{2}\d{6}$/,
9266 // UKRAINE
9267 US: /^\d{9}$/ // UNITED STATES
9268
9269 };
9270 /**
9271 * Check if str is a valid passport number
9272 * relative to provided ISO Country Code.
9273 *
9274 * @param {string} str
9275 * @param {string} countryCode
9276 * @return {boolean}
9277 */
9278
9279 function isPassportNumber(str, countryCode) {
9280 (0, _assertString.default)(str);
9281 /** Remove All Whitespaces, Convert to UPPERCASE */
9282
9283 var normalizedStr = str.replace(/\s/g, '').toUpperCase();
9284 return countryCode.toUpperCase() in passportRegexByCountryCode && passportRegexByCountryCode[countryCode].test(normalizedStr);
9285 }
9286
9287 module.exports = exports.default;
9288 module.exports.default = exports.default;
9289 }(isPassportNumber$1, isPassportNumber$1.exports));
9290
9291 var isPassportNumberValidator = /*@__PURE__*/getDefaultExportFromCjs(isPassportNumber$1.exports);
9292
9293 var IS_PASSPORT_NUMBER = 'isPassportNumber';
9294 /**
9295 * Check if the string is a valid passport number relative to a specific country code.
9296 * If given value is not a string, then it returns false.
9297 */
9298 function isPassportNumber(value, countryCode) {
9299 return typeof value === 'string' && isPassportNumberValidator(value, countryCode);
9300 }
9301 /**
9302 * Check if the string is a valid passport number relative to a specific country code.
9303 * If given value is not a string, then it returns false.
9304 */
9305 function IsPassportNumber(countryCode, validationOptions) {
9306 return ValidateBy({
9307 name: IS_PASSPORT_NUMBER,
9308 constraints: [countryCode],
9309 validator: {
9310 validate: function (value, args) { return isPassportNumber(value, args.constraints[0]); },
9311 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be valid passport number'; }, validationOptions),
9312 },
9313 }, validationOptions);
9314 }
9315
9316 var isPostalCode$2 = {};
9317
9318 Object.defineProperty(isPostalCode$2, "__esModule", {
9319 value: true
9320 });
9321 var _default = isPostalCode$2.default = isPostalCode$1;
9322 isPostalCode$2.locales = void 0;
9323
9324 var _assertString = _interopRequireDefault(assertString.exports);
9325
9326 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9327
9328 // common patterns
9329 var threeDigit = /^\d{3}$/;
9330 var fourDigit = /^\d{4}$/;
9331 var fiveDigit = /^\d{5}$/;
9332 var sixDigit = /^\d{6}$/;
9333 var patterns = {
9334 AD: /^AD\d{3}$/,
9335 AT: fourDigit,
9336 AU: fourDigit,
9337 AZ: /^AZ\d{4}$/,
9338 BE: fourDigit,
9339 BG: fourDigit,
9340 BR: /^\d{5}-\d{3}$/,
9341 BY: /2[1-4]{1}\d{4}$/,
9342 CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
9343 CH: fourDigit,
9344 CN: /^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/,
9345 CZ: /^\d{3}\s?\d{2}$/,
9346 DE: fiveDigit,
9347 DK: fourDigit,
9348 DO: fiveDigit,
9349 DZ: fiveDigit,
9350 EE: fiveDigit,
9351 ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/,
9352 FI: fiveDigit,
9353 FR: /^\d{2}\s?\d{3}$/,
9354 GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,
9355 GR: /^\d{3}\s?\d{2}$/,
9356 HR: /^([1-5]\d{4}$)/,
9357 HT: /^HT\d{4}$/,
9358 HU: fourDigit,
9359 ID: fiveDigit,
9360 IE: /^(?!.*(?:o))[A-Za-z]\d[\dw]\s\w{4}$/i,
9361 IL: /^(\d{5}|\d{7})$/,
9362 IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,
9363 IR: /\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/,
9364 IS: threeDigit,
9365 IT: fiveDigit,
9366 JP: /^\d{3}\-\d{4}$/,
9367 KE: fiveDigit,
9368 KR: /^(\d{5}|\d{6})$/,
9369 LI: /^(948[5-9]|949[0-7])$/,
9370 LT: /^LT\-\d{5}$/,
9371 LU: fourDigit,
9372 LV: /^LV\-\d{4}$/,
9373 LK: fiveDigit,
9374 MX: fiveDigit,
9375 MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
9376 MY: fiveDigit,
9377 NL: /^\d{4}\s?[a-z]{2}$/i,
9378 NO: fourDigit,
9379 NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,
9380 NZ: fourDigit,
9381 PL: /^\d{2}\-\d{3}$/,
9382 PR: /^00[679]\d{2}([ -]\d{4})?$/,
9383 PT: /^\d{4}\-\d{3}?$/,
9384 RO: sixDigit,
9385 RU: sixDigit,
9386 SA: fiveDigit,
9387 SE: /^[1-9]\d{2}\s?\d{2}$/,
9388 SG: sixDigit,
9389 SI: fourDigit,
9390 SK: /^\d{3}\s?\d{2}$/,
9391 TH: fiveDigit,
9392 TN: fourDigit,
9393 TW: /^\d{3}(\d{2})?$/,
9394 UA: fiveDigit,
9395 US: /^\d{5}(-\d{4})?$/,
9396 ZA: fourDigit,
9397 ZM: fiveDigit
9398 };
9399 var locales = Object.keys(patterns);
9400 isPostalCode$2.locales = locales;
9401
9402 function isPostalCode$1(str, locale) {
9403 (0, _assertString.default)(str);
9404
9405 if (locale in patterns) {
9406 return patterns[locale].test(str);
9407 } else if (locale === 'any') {
9408 for (var key in patterns) {
9409 // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
9410 // istanbul ignore else
9411 if (patterns.hasOwnProperty(key)) {
9412 var pattern = patterns[key];
9413
9414 if (pattern.test(str)) {
9415 return true;
9416 }
9417 }
9418 }
9419
9420 return false;
9421 }
9422
9423 throw new Error("Invalid locale '".concat(locale, "'"));
9424 }
9425
9426 var IS_POSTAL_CODE = 'isPostalCode';
9427 /**
9428 * Check if the string is a postal code,
9429 * (locale is one of [ 'AD', 'AT', 'AU', 'BE', 'BG', 'BR', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'ID', 'IE' 'IL', 'IN', 'IR', 'IS', 'IT', 'JP', 'KE', 'LI', 'LT', 'LU', 'LV', 'MT', 'MX', 'NL', 'NO', 'NZ', 'PL', 'PR', 'PT', 'RO', 'RU', 'SA', 'SE', 'SI', 'TN', 'TW', 'UA', 'US', 'ZA', 'ZM' ] OR 'any'. If 'any' is used, function will check if any of the locals match. Locale list is validator.isPostalCodeLocales.).
9430 * If given value is not a string, then it returns false.
9431 */
9432 function isPostalCode(value, locale) {
9433 return typeof value === 'string' && _default(value, locale);
9434 }
9435 /**
9436 * Check if the string is a postal code,
9437 * (locale is one of [ 'AD', 'AT', 'AU', 'BE', 'BG', 'BR', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'ID', 'IE' 'IL', 'IN', 'IR', 'IS', 'IT', 'JP', 'KE', 'LI', 'LT', 'LU', 'LV', 'MT', 'MX', 'NL', 'NO', 'NZ', 'PL', 'PR', 'PT', 'RO', 'RU', 'SA', 'SE', 'SI', 'TN', 'TW', 'UA', 'US', 'ZA', 'ZM' ] OR 'any'. If 'any' is used, function will check if any of the locals match. Locale list is validator.isPostalCodeLocales.).
9438 * If given value is not a string, then it returns false.
9439 */
9440 function IsPostalCode(locale, validationOptions) {
9441 return ValidateBy({
9442 name: IS_POSTAL_CODE,
9443 constraints: [locale],
9444 validator: {
9445 validate: function (value, args) { return isPostalCode(value, args.constraints[0]); },
9446 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a postal code'; }, validationOptions),
9447 },
9448 }, validationOptions);
9449 }
9450
9451 var isRFC3339$1 = {exports: {}};
9452
9453 (function (module, exports) {
9454
9455 Object.defineProperty(exports, "__esModule", {
9456 value: true
9457 });
9458 exports.default = isRFC3339;
9459
9460 var _assertString = _interopRequireDefault(assertString.exports);
9461
9462 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9463
9464 /* Based on https://tools.ietf.org/html/rfc3339#section-5.6 */
9465 var dateFullYear = /[0-9]{4}/;
9466 var dateMonth = /(0[1-9]|1[0-2])/;
9467 var dateMDay = /([12]\d|0[1-9]|3[01])/;
9468 var timeHour = /([01][0-9]|2[0-3])/;
9469 var timeMinute = /[0-5][0-9]/;
9470 var timeSecond = /([0-5][0-9]|60)/;
9471 var timeSecFrac = /(\.[0-9]+)?/;
9472 var timeNumOffset = new RegExp("[-+]".concat(timeHour.source, ":").concat(timeMinute.source));
9473 var timeOffset = new RegExp("([zZ]|".concat(timeNumOffset.source, ")"));
9474 var partialTime = new RegExp("".concat(timeHour.source, ":").concat(timeMinute.source, ":").concat(timeSecond.source).concat(timeSecFrac.source));
9475 var fullDate = new RegExp("".concat(dateFullYear.source, "-").concat(dateMonth.source, "-").concat(dateMDay.source));
9476 var fullTime = new RegExp("".concat(partialTime.source).concat(timeOffset.source));
9477 var rfc3339 = new RegExp("^".concat(fullDate.source, "[ tT]").concat(fullTime.source, "$"));
9478
9479 function isRFC3339(str) {
9480 (0, _assertString.default)(str);
9481 return rfc3339.test(str);
9482 }
9483
9484 module.exports = exports.default;
9485 module.exports.default = exports.default;
9486 }(isRFC3339$1, isRFC3339$1.exports));
9487
9488 var isRFC3339Validator = /*@__PURE__*/getDefaultExportFromCjs(isRFC3339$1.exports);
9489
9490 var IS_RFC_3339 = 'isRFC3339';
9491 /**
9492 * Check if the string is a valid RFC 3339 date.
9493 * If given value is not a string, then it returns false.
9494 */
9495 function isRFC3339(value) {
9496 return typeof value === 'string' && isRFC3339Validator(value);
9497 }
9498 /**
9499 * Check if the string is a valid RFC 3339 date.
9500 * If given value is not a string, then it returns false.
9501 */
9502 function IsRFC3339(validationOptions) {
9503 return ValidateBy({
9504 name: IS_RFC_3339,
9505 validator: {
9506 validate: function (value, args) { return isRFC3339(value); },
9507 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be RFC 3339 date'; }, validationOptions),
9508 },
9509 }, validationOptions);
9510 }
9511
9512 var isRgbColor$1 = {exports: {}};
9513
9514 (function (module, exports) {
9515
9516 Object.defineProperty(exports, "__esModule", {
9517 value: true
9518 });
9519 exports.default = isRgbColor;
9520
9521 var _assertString = _interopRequireDefault(assertString.exports);
9522
9523 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9524
9525 var rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/;
9526 var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
9527 var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/;
9528 var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/;
9529
9530 function isRgbColor(str) {
9531 var includePercentValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9532 (0, _assertString.default)(str);
9533
9534 if (!includePercentValues) {
9535 return rgbColor.test(str) || rgbaColor.test(str);
9536 }
9537
9538 return rgbColor.test(str) || rgbaColor.test(str) || rgbColorPercent.test(str) || rgbaColorPercent.test(str);
9539 }
9540
9541 module.exports = exports.default;
9542 module.exports.default = exports.default;
9543 }(isRgbColor$1, isRgbColor$1.exports));
9544
9545 var isRgbColorValidator = /*@__PURE__*/getDefaultExportFromCjs(isRgbColor$1.exports);
9546
9547 var IS_RGB_COLOR = 'isRgbColor';
9548 /**
9549 * Check if the string is a rgb or rgba color.
9550 * `includePercentValues` defaults to true. If you don't want to allow to set rgb or rgba values with percents, like rgb(5%,5%,5%), or rgba(90%,90%,90%,.3), then set it to false.
9551 * If given value is not a string, then it returns false.
9552 */
9553 function isRgbColor(value, includePercentValues) {
9554 return typeof value === 'string' && isRgbColorValidator(value, includePercentValues);
9555 }
9556 /**
9557 * Check if the string is a rgb or rgba color.
9558 * `includePercentValues` defaults to true. If you don't want to allow to set rgb or rgba values with percents, like rgb(5%,5%,5%), or rgba(90%,90%,90%,.3), then set it to false.
9559 * If given value is not a string, then it returns false.
9560 */
9561 function IsRgbColor(includePercentValues, validationOptions) {
9562 return ValidateBy({
9563 name: IS_RGB_COLOR,
9564 constraints: [includePercentValues],
9565 validator: {
9566 validate: function (value, args) { return isRgbColor(value, args.constraints[0]); },
9567 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be RGB color'; }, validationOptions),
9568 },
9569 }, validationOptions);
9570 }
9571
9572 var isSemVer$1 = {exports: {}};
9573
9574 var multilineRegex = {exports: {}};
9575
9576 (function (module, exports) {
9577
9578 Object.defineProperty(exports, "__esModule", {
9579 value: true
9580 });
9581 exports.default = multilineRegexp;
9582
9583 /**
9584 * Build RegExp object from an array
9585 * of multiple/multi-line regexp parts
9586 *
9587 * @param {string[]} parts
9588 * @param {string} flags
9589 * @return {object} - RegExp object
9590 */
9591 function multilineRegexp(parts, flags) {
9592 var regexpAsStringLiteral = parts.join('');
9593 return new RegExp(regexpAsStringLiteral, flags);
9594 }
9595
9596 module.exports = exports.default;
9597 module.exports.default = exports.default;
9598 }(multilineRegex, multilineRegex.exports));
9599
9600 (function (module, exports) {
9601
9602 Object.defineProperty(exports, "__esModule", {
9603 value: true
9604 });
9605 exports.default = isSemVer;
9606
9607 var _assertString = _interopRequireDefault(assertString.exports);
9608
9609 var _multilineRegex = _interopRequireDefault(multilineRegex.exports);
9610
9611 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9612
9613 /**
9614 * Regular Expression to match
9615 * semantic versioning (SemVer)
9616 * built from multi-line, multi-parts regexp
9617 * Reference: https://semver.org/
9618 */
9619 var semanticVersioningRegex = (0, _multilineRegex.default)(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i');
9620
9621 function isSemVer(str) {
9622 (0, _assertString.default)(str);
9623 return semanticVersioningRegex.test(str);
9624 }
9625
9626 module.exports = exports.default;
9627 module.exports.default = exports.default;
9628 }(isSemVer$1, isSemVer$1.exports));
9629
9630 var isSemVerValidator = /*@__PURE__*/getDefaultExportFromCjs(isSemVer$1.exports);
9631
9632 var IS_SEM_VER = 'isSemVer';
9633 /**
9634 * Check if the string is a Semantic Versioning Specification (SemVer).
9635 * If given value is not a string, then it returns false.
9636 */
9637 function isSemVer(value) {
9638 return typeof value === 'string' && isSemVerValidator(value);
9639 }
9640 /**
9641 * Check if the string is a Semantic Versioning Specification (SemVer).
9642 * If given value is not a string, then it returns false.
9643 */
9644 function IsSemVer(validationOptions) {
9645 return ValidateBy({
9646 name: IS_SEM_VER,
9647 validator: {
9648 validate: function (value, args) { return isSemVer(value); },
9649 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a Semantic Versioning Specification'; }, validationOptions),
9650 },
9651 }, validationOptions);
9652 }
9653
9654 var IS_BOOLEAN = 'isBoolean';
9655 /**
9656 * Checks if a given value is a boolean.
9657 */
9658 function isBoolean(value) {
9659 return value instanceof Boolean || typeof value === 'boolean';
9660 }
9661 /**
9662 * Checks if a value is a boolean.
9663 */
9664 function IsBoolean(validationOptions) {
9665 return ValidateBy({
9666 name: IS_BOOLEAN,
9667 validator: {
9668 validate: function (value, args) { return isBoolean(value); },
9669 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a boolean value'; }, validationOptions),
9670 },
9671 }, validationOptions);
9672 }
9673
9674 var IS_DATE = 'isDate';
9675 /**
9676 * Checks if a given value is a date.
9677 */
9678 function isDate(value) {
9679 return value instanceof Date && !isNaN(value.getTime());
9680 }
9681 /**
9682 * Checks if a value is a date.
9683 */
9684 function IsDate(validationOptions) {
9685 return ValidateBy({
9686 name: IS_DATE,
9687 validator: {
9688 validate: function (value, args) { return isDate(value); },
9689 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a Date instance'; }, validationOptions),
9690 },
9691 }, validationOptions);
9692 }
9693
9694 var IS_NUMBER = 'isNumber';
9695 /**
9696 * Checks if a given value is a number.
9697 */
9698 function isNumber(value, options) {
9699 if (options === void 0) { options = {}; }
9700 if (typeof value !== 'number') {
9701 return false;
9702 }
9703 if (value === Infinity || value === -Infinity) {
9704 return options.allowInfinity;
9705 }
9706 if (Number.isNaN(value)) {
9707 return options.allowNaN;
9708 }
9709 if (options.maxDecimalPlaces !== undefined) {
9710 var decimalPlaces = 0;
9711 if (value % 1 !== 0) {
9712 decimalPlaces = value.toString().split('.')[1].length;
9713 }
9714 if (decimalPlaces > options.maxDecimalPlaces) {
9715 return false;
9716 }
9717 }
9718 return Number.isFinite(value);
9719 }
9720 /**
9721 * Checks if a value is a number.
9722 */
9723 function IsNumber(options, validationOptions) {
9724 if (options === void 0) { options = {}; }
9725 return ValidateBy({
9726 name: IS_NUMBER,
9727 constraints: [options],
9728 validator: {
9729 validate: function (value, args) { return isNumber(value, args.constraints[0]); },
9730 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a number conforming to the specified constraints'; }, validationOptions),
9731 },
9732 }, validationOptions);
9733 }
9734
9735 var IS_ENUM = 'isEnum';
9736 /**
9737 * Checks if a given value is an enum
9738 */
9739 function isEnum(value, entity) {
9740 var enumValues = Object.keys(entity).map(function (k) { return entity[k]; });
9741 return enumValues.indexOf(value) >= 0;
9742 }
9743 /**
9744 * Checks if a given value is an enum
9745 */
9746 function IsEnum(entity, validationOptions) {
9747 return ValidateBy({
9748 name: IS_ENUM,
9749 constraints: [entity],
9750 validator: {
9751 validate: function (value, args) { return isEnum(value, args.constraints[0]); },
9752 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a valid enum value'; }, validationOptions),
9753 },
9754 }, validationOptions);
9755 }
9756
9757 var IS_INT = 'isInt';
9758 /**
9759 * Checks if value is an integer.
9760 */
9761 function isInt(val) {
9762 return typeof val === 'number' && Number.isInteger(val);
9763 }
9764 /**
9765 * Checks if value is an integer.
9766 */
9767 function IsInt(validationOptions) {
9768 return ValidateBy({
9769 name: IS_INT,
9770 validator: {
9771 validate: function (value, args) { return isInt(value); },
9772 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an integer number'; }, validationOptions),
9773 },
9774 }, validationOptions);
9775 }
9776
9777 var IS_STRING = 'isString';
9778 /**
9779 * Checks if a given value is a real string.
9780 */
9781 function isString(value) {
9782 return value instanceof String || typeof value === 'string';
9783 }
9784 /**
9785 * Checks if a given value is a real string.
9786 */
9787 function IsString(validationOptions) {
9788 return ValidateBy({
9789 name: IS_STRING,
9790 validator: {
9791 validate: function (value, args) { return isString(value); },
9792 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a string'; }, validationOptions),
9793 },
9794 }, validationOptions);
9795 }
9796
9797 var IS_ARRAY = 'isArray';
9798 /**
9799 * Checks if a given value is an array
9800 */
9801 function isArray(value) {
9802 return Array.isArray(value);
9803 }
9804 /**
9805 * Checks if a given value is an array
9806 */
9807 function IsArray(validationOptions) {
9808 return ValidateBy({
9809 name: IS_ARRAY,
9810 validator: {
9811 validate: function (value, args) { return isArray(value); },
9812 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an array'; }, validationOptions),
9813 },
9814 }, validationOptions);
9815 }
9816
9817 var IS_OBJECT = 'isObject';
9818 /**
9819 * Checks if the value is valid Object.
9820 * Returns false if the value is not an object.
9821 */
9822 function isObject(value) {
9823 return value != null && (typeof value === 'object' || typeof value === 'function') && !Array.isArray(value);
9824 }
9825 /**
9826 * Checks if the value is valid Object.
9827 * Returns false if the value is not an object.
9828 */
9829 function IsObject(validationOptions) {
9830 return ValidateBy({
9831 name: IS_OBJECT,
9832 validator: {
9833 validate: function (value, args) { return isObject(value); },
9834 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be an object'; }, validationOptions),
9835 },
9836 }, validationOptions);
9837 }
9838
9839 var ARRAY_CONTAINS = 'arrayContains';
9840 /**
9841 * Checks if array contains all values from the given array of values.
9842 * If null or undefined is given then this function returns false.
9843 */
9844 function arrayContains(array, values) {
9845 if (!Array.isArray(array))
9846 return false;
9847 return values.every(function (value) { return array.indexOf(value) !== -1; });
9848 }
9849 /**
9850 * Checks if array contains all values from the given array of values.
9851 * If null or undefined is given then this function returns false.
9852 */
9853 function ArrayContains(values, validationOptions) {
9854 return ValidateBy({
9855 name: ARRAY_CONTAINS,
9856 constraints: [values],
9857 validator: {
9858 validate: function (value, args) { return arrayContains(value, args.constraints[0]); },
9859 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain $constraint1 values'; }, validationOptions),
9860 },
9861 }, validationOptions);
9862 }
9863
9864 var ARRAY_NOT_CONTAINS = 'arrayNotContains';
9865 /**
9866 * Checks if array does not contain any of the given values.
9867 * If null or undefined is given then this function returns false.
9868 */
9869 function arrayNotContains(array, values) {
9870 if (!Array.isArray(array))
9871 return false;
9872 return values.every(function (value) { return array.indexOf(value) === -1; });
9873 }
9874 /**
9875 * Checks if array does not contain any of the given values.
9876 * If null or undefined is given then this function returns false.
9877 */
9878 function ArrayNotContains(values, validationOptions) {
9879 return ValidateBy({
9880 name: ARRAY_NOT_CONTAINS,
9881 constraints: [values],
9882 validator: {
9883 validate: function (value, args) { return arrayNotContains(value, args.constraints[0]); },
9884 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not contain $constraint1 values'; }, validationOptions),
9885 },
9886 }, validationOptions);
9887 }
9888
9889 var ARRAY_NOT_EMPTY = 'arrayNotEmpty';
9890 /**
9891 * Checks if given array is not empty.
9892 * If null or undefined is given then this function returns false.
9893 */
9894 function arrayNotEmpty(array) {
9895 return Array.isArray(array) && array.length > 0;
9896 }
9897 /**
9898 * Checks if given array is not empty.
9899 * If null or undefined is given then this function returns false.
9900 */
9901 function ArrayNotEmpty(validationOptions) {
9902 return ValidateBy({
9903 name: ARRAY_NOT_EMPTY,
9904 validator: {
9905 validate: function (value, args) { return arrayNotEmpty(value); },
9906 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property should not be empty'; }, validationOptions),
9907 },
9908 }, validationOptions);
9909 }
9910
9911 var ARRAY_MIN_SIZE = 'arrayMinSize';
9912 /**
9913 * Checks if the array's length is greater than or equal to the specified number.
9914 * If null or undefined is given then this function returns false.
9915 */
9916 function arrayMinSize(array, min) {
9917 return Array.isArray(array) && array.length >= min;
9918 }
9919 /**
9920 * Checks if the array's length is greater than or equal to the specified number.
9921 * If null or undefined is given then this function returns false.
9922 */
9923 function ArrayMinSize(min, validationOptions) {
9924 return ValidateBy({
9925 name: ARRAY_MIN_SIZE,
9926 constraints: [min],
9927 validator: {
9928 validate: function (value, args) { return arrayMinSize(value, args.constraints[0]); },
9929 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain at least $constraint1 elements'; }, validationOptions),
9930 },
9931 }, validationOptions);
9932 }
9933
9934 var ARRAY_MAX_SIZE = 'arrayMaxSize';
9935 /**
9936 * Checks if the array's length is less or equal to the specified number.
9937 * If null or undefined is given then this function returns false.
9938 */
9939 function arrayMaxSize(array, max) {
9940 return Array.isArray(array) && array.length <= max;
9941 }
9942 /**
9943 * Checks if the array's length is less or equal to the specified number.
9944 * If null or undefined is given then this function returns false.
9945 */
9946 function ArrayMaxSize(max, validationOptions) {
9947 return ValidateBy({
9948 name: ARRAY_MAX_SIZE,
9949 constraints: [max],
9950 validator: {
9951 validate: function (value, args) { return arrayMaxSize(value, args.constraints[0]); },
9952 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must contain not more than $constraint1 elements'; }, validationOptions),
9953 },
9954 }, validationOptions);
9955 }
9956
9957 var ARRAY_UNIQUE = 'arrayUnique';
9958 /**
9959 * Checks if all array's values are unique. Comparison for objects is reference-based.
9960 * If null or undefined is given then this function returns false.
9961 */
9962 function arrayUnique(array, identifier) {
9963 if (!Array.isArray(array))
9964 return false;
9965 if (identifier) {
9966 array = array.map(function (o) { return (o != null ? identifier(o) : o); });
9967 }
9968 var uniqueItems = array.filter(function (a, b, c) { return c.indexOf(a) === b; });
9969 return array.length === uniqueItems.length;
9970 }
9971 /**
9972 * Checks if all array's values are unique. Comparison for objects is reference-based.
9973 * If null or undefined is given then this function returns false.
9974 */
9975 function ArrayUnique(identifierOrOptions, validationOptions) {
9976 var identifier = typeof identifierOrOptions === 'function' ? identifierOrOptions : undefined;
9977 var options = typeof identifierOrOptions !== 'function' ? identifierOrOptions : validationOptions;
9978 return ValidateBy({
9979 name: ARRAY_UNIQUE,
9980 validator: {
9981 validate: function (value, args) { return arrayUnique(value, identifier); },
9982 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + "All $property's elements must be unique"; }, options),
9983 },
9984 }, options);
9985 }
9986
9987 var IS_NOT_EMPTY_OBJECT = 'isNotEmptyObject';
9988 /**
9989 * Checks if the value is valid Object & not empty.
9990 * Returns false if the value is not an object or an empty valid object.
9991 */
9992 function isNotEmptyObject(value, options) {
9993 if (!isObject(value)) {
9994 return false;
9995 }
9996 if ((options === null || options === void 0 ? void 0 : options.nullable) === true) {
9997 return !Object.values(value).every(function (propertyValue) { return propertyValue === null || propertyValue === undefined; });
9998 }
9999 for (var key in value) {
10000 if (value.hasOwnProperty(key)) {
10001 return true;
10002 }
10003 }
10004 return false;
10005 }
10006 /**
10007 * Checks if the value is valid Object & not empty.
10008 * Returns false if the value is not an object or an empty valid object.
10009 */
10010 function IsNotEmptyObject(options, validationOptions) {
10011 return ValidateBy({
10012 name: IS_NOT_EMPTY_OBJECT,
10013 constraints: [options],
10014 validator: {
10015 validate: function (value, args) { return isNotEmptyObject(value, args.constraints[0]); },
10016 defaultMessage: buildMessage(function (eachPrefix) { return eachPrefix + '$property must be a non-empty object'; }, validationOptions),
10017 },
10018 }, validationOptions);
10019 }
10020
10021 var IS_INSTANCE = 'isInstance';
10022 /**
10023 * Checks if the value is an instance of the specified object.
10024 */
10025 function isInstance(object, targetTypeConstructor) {
10026 return (targetTypeConstructor && typeof targetTypeConstructor === 'function' && object instanceof targetTypeConstructor);
10027 }
10028 /**
10029 * Checks if the value is an instance of the specified object.
10030 */
10031 function IsInstance(targetType, validationOptions) {
10032 return ValidateBy({
10033 name: IS_INSTANCE,
10034 constraints: [targetType],
10035 validator: {
10036 validate: function (value, args) { return isInstance(value, args.constraints[0]); },
10037 defaultMessage: buildMessage(function (eachPrefix, args) {
10038 if (args.constraints[0]) {
10039 return eachPrefix + "$property must be an instance of ".concat(args.constraints[0].name);
10040 }
10041 else {
10042 return eachPrefix + "".concat(IS_INSTANCE, " decorator expects and object as value, but got falsy value.");
10043 }
10044 }, validationOptions),
10045 },
10046 }, validationOptions);
10047 }
10048
10049 /**
10050 * Validates given object by object's decorators or given validation schema.
10051 */
10052 function validate(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions) {
10053 if (typeof schemaNameOrObject === 'string') {
10054 return getFromContainer(Validator).validate(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions);
10055 }
10056 else {
10057 return getFromContainer(Validator).validate(schemaNameOrObject, objectOrValidationOptions);
10058 }
10059 }
10060 /**
10061 * Validates given object by object's decorators or given validation schema and reject on error.
10062 */
10063 function validateOrReject(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions) {
10064 if (typeof schemaNameOrObject === 'string') {
10065 return getFromContainer(Validator).validateOrReject(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions);
10066 }
10067 else {
10068 return getFromContainer(Validator).validateOrReject(schemaNameOrObject, objectOrValidationOptions);
10069 }
10070 }
10071 /**
10072 * Validates given object by object's decorators or given validation schema.
10073 * Note that this method completely ignores async validations.
10074 * If you want to properly perform validation you need to call validate method instead.
10075 */
10076 function validateSync(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions) {
10077 if (typeof schemaNameOrObject === 'string') {
10078 return getFromContainer(Validator).validateSync(schemaNameOrObject, objectOrValidationOptions, maybeValidatorOptions);
10079 }
10080 else {
10081 return getFromContainer(Validator).validateSync(schemaNameOrObject, objectOrValidationOptions);
10082 }
10083 }
10084 /**
10085 * Registers a new validation schema.
10086 */
10087 function registerSchema(schema) {
10088 getMetadataStorage().addValidationSchema(schema);
10089 }
10090
10091 exports.ARRAY_CONTAINS = ARRAY_CONTAINS;
10092 exports.ARRAY_MAX_SIZE = ARRAY_MAX_SIZE;
10093 exports.ARRAY_MIN_SIZE = ARRAY_MIN_SIZE;
10094 exports.ARRAY_NOT_CONTAINS = ARRAY_NOT_CONTAINS;
10095 exports.ARRAY_NOT_EMPTY = ARRAY_NOT_EMPTY;
10096 exports.ARRAY_UNIQUE = ARRAY_UNIQUE;
10097 exports.Allow = Allow;
10098 exports.ArrayContains = ArrayContains;
10099 exports.ArrayMaxSize = ArrayMaxSize;
10100 exports.ArrayMinSize = ArrayMinSize;
10101 exports.ArrayNotContains = ArrayNotContains;
10102 exports.ArrayNotEmpty = ArrayNotEmpty;
10103 exports.ArrayUnique = ArrayUnique;
10104 exports.CONTAINS = CONTAINS;
10105 exports.Contains = Contains;
10106 exports.EQUALS = EQUALS;
10107 exports.Equals = Equals;
10108 exports.IS_ALPHA = IS_ALPHA;
10109 exports.IS_ALPHANUMERIC = IS_ALPHANUMERIC;
10110 exports.IS_ARRAY = IS_ARRAY;
10111 exports.IS_ASCII = IS_ASCII;
10112 exports.IS_BASE32 = IS_BASE32;
10113 exports.IS_BASE64 = IS_BASE64;
10114 exports.IS_BIC = IS_BIC;
10115 exports.IS_BOOLEAN = IS_BOOLEAN;
10116 exports.IS_BOOLEAN_STRING = IS_BOOLEAN_STRING;
10117 exports.IS_BTC_ADDRESS = IS_BTC_ADDRESS;
10118 exports.IS_BYTE_LENGTH = IS_BYTE_LENGTH;
10119 exports.IS_CREDIT_CARD = IS_CREDIT_CARD;
10120 exports.IS_CURRENCY = IS_CURRENCY;
10121 exports.IS_DATA_URI = IS_DATA_URI;
10122 exports.IS_DATE = IS_DATE;
10123 exports.IS_DATE_STRING = IS_DATE_STRING;
10124 exports.IS_DECIMAL = IS_DECIMAL;
10125 exports.IS_DEFINED = IS_DEFINED;
10126 exports.IS_DIVISIBLE_BY = IS_DIVISIBLE_BY;
10127 exports.IS_EAN = IS_EAN;
10128 exports.IS_EMAIL = IS_EMAIL;
10129 exports.IS_EMPTY = IS_EMPTY;
10130 exports.IS_ENUM = IS_ENUM;
10131 exports.IS_ETHEREUM_ADDRESS = IS_ETHEREUM_ADDRESS;
10132 exports.IS_FIREBASE_PUSH_ID = IS_FIREBASE_PUSH_ID;
10133 exports.IS_FQDN = IS_FQDN;
10134 exports.IS_FULL_WIDTH = IS_FULL_WIDTH;
10135 exports.IS_HALF_WIDTH = IS_HALF_WIDTH;
10136 exports.IS_HASH = IS_HASH;
10137 exports.IS_HEXADECIMAL = IS_HEXADECIMAL;
10138 exports.IS_HEX_COLOR = IS_HEX_COLOR;
10139 exports.IS_HSL = IS_HSL;
10140 exports.IS_IBAN = IS_IBAN;
10141 exports.IS_IDENTITY_CARD = IS_IDENTITY_CARD;
10142 exports.IS_IN = IS_IN;
10143 exports.IS_INSTANCE = IS_INSTANCE;
10144 exports.IS_INT = IS_INT;
10145 exports.IS_IP = IS_IP;
10146 exports.IS_ISBN = IS_ISBN;
10147 exports.IS_ISIN = IS_ISIN;
10148 exports.IS_ISO31661_ALPHA_2 = IS_ISO31661_ALPHA_2;
10149 exports.IS_ISO31661_ALPHA_3 = IS_ISO31661_ALPHA_3;
10150 exports.IS_ISO8601 = IS_ISO8601;
10151 exports.IS_ISRC = IS_ISRC;
10152 exports.IS_ISSN = IS_ISSN;
10153 exports.IS_JSON = IS_JSON;
10154 exports.IS_JWT = IS_JWT;
10155 exports.IS_LATITUDE = IS_LATITUDE;
10156 exports.IS_LATLONG = IS_LATLONG;
10157 exports.IS_LENGTH = IS_LENGTH;
10158 exports.IS_LOCALE = IS_LOCALE;
10159 exports.IS_LONGITUDE = IS_LONGITUDE;
10160 exports.IS_LOWERCASE = IS_LOWERCASE;
10161 exports.IS_MAC_ADDRESS = IS_MAC_ADDRESS;
10162 exports.IS_MAGNET_URI = IS_MAGNET_URI;
10163 exports.IS_MILITARY_TIME = IS_MILITARY_TIME;
10164 exports.IS_MIME_TYPE = IS_MIME_TYPE;
10165 exports.IS_MOBILE_PHONE = IS_MOBILE_PHONE;
10166 exports.IS_MONGO_ID = IS_MONGO_ID;
10167 exports.IS_MULTIBYTE = IS_MULTIBYTE;
10168 exports.IS_NEGATIVE = IS_NEGATIVE;
10169 exports.IS_NOT_EMPTY = IS_NOT_EMPTY;
10170 exports.IS_NOT_EMPTY_OBJECT = IS_NOT_EMPTY_OBJECT;
10171 exports.IS_NOT_IN = IS_NOT_IN;
10172 exports.IS_NUMBER = IS_NUMBER;
10173 exports.IS_NUMBER_STRING = IS_NUMBER_STRING;
10174 exports.IS_OBJECT = IS_OBJECT;
10175 exports.IS_OCTAL = IS_OCTAL;
10176 exports.IS_PASSPORT_NUMBER = IS_PASSPORT_NUMBER;
10177 exports.IS_PHONE_NUMBER = IS_PHONE_NUMBER;
10178 exports.IS_PORT = IS_PORT;
10179 exports.IS_POSITIVE = IS_POSITIVE;
10180 exports.IS_POSTAL_CODE = IS_POSTAL_CODE;
10181 exports.IS_RFC_3339 = IS_RFC_3339;
10182 exports.IS_RGB_COLOR = IS_RGB_COLOR;
10183 exports.IS_SEM_VER = IS_SEM_VER;
10184 exports.IS_STRING = IS_STRING;
10185 exports.IS_SURROGATE_PAIR = IS_SURROGATE_PAIR;
10186 exports.IS_UPPERCASE = IS_UPPERCASE;
10187 exports.IS_URL = IS_URL;
10188 exports.IS_UUID = IS_UUID;
10189 exports.IS_VARIABLE_WIDTH = IS_VARIABLE_WIDTH;
10190 exports.IsAlpha = IsAlpha;
10191 exports.IsAlphanumeric = IsAlphanumeric;
10192 exports.IsArray = IsArray;
10193 exports.IsAscii = IsAscii;
10194 exports.IsBIC = IsBIC;
10195 exports.IsBase32 = IsBase32;
10196 exports.IsBase64 = IsBase64;
10197 exports.IsBoolean = IsBoolean;
10198 exports.IsBooleanString = IsBooleanString;
10199 exports.IsBtcAddress = IsBtcAddress;
10200 exports.IsByteLength = IsByteLength;
10201 exports.IsCreditCard = IsCreditCard;
10202 exports.IsCurrency = IsCurrency;
10203 exports.IsDataURI = IsDataURI;
10204 exports.IsDate = IsDate;
10205 exports.IsDateString = IsDateString;
10206 exports.IsDecimal = IsDecimal;
10207 exports.IsDefined = IsDefined;
10208 exports.IsDivisibleBy = IsDivisibleBy;
10209 exports.IsEAN = IsEAN;
10210 exports.IsEmail = IsEmail;
10211 exports.IsEmpty = IsEmpty;
10212 exports.IsEnum = IsEnum;
10213 exports.IsEthereumAddress = IsEthereumAddress;
10214 exports.IsFQDN = IsFQDN;
10215 exports.IsFirebasePushId = IsFirebasePushId;
10216 exports.IsFullWidth = IsFullWidth;
10217 exports.IsHSL = IsHSL;
10218 exports.IsHalfWidth = IsHalfWidth;
10219 exports.IsHash = IsHash;
10220 exports.IsHexColor = IsHexColor;
10221 exports.IsHexadecimal = IsHexadecimal;
10222 exports.IsIBAN = IsIBAN;
10223 exports.IsIP = IsIP;
10224 exports.IsISBN = IsISBN;
10225 exports.IsISIN = IsISIN;
10226 exports.IsISO31661Alpha2 = IsISO31661Alpha2;
10227 exports.IsISO31661Alpha3 = IsISO31661Alpha3;
10228 exports.IsISO8601 = IsISO8601;
10229 exports.IsISRC = IsISRC;
10230 exports.IsISSN = IsISSN;
10231 exports.IsIdentityCard = IsIdentityCard;
10232 exports.IsIn = IsIn;
10233 exports.IsInstance = IsInstance;
10234 exports.IsInt = IsInt;
10235 exports.IsJSON = IsJSON;
10236 exports.IsJWT = IsJWT;
10237 exports.IsLatLong = IsLatLong;
10238 exports.IsLatitude = IsLatitude;
10239 exports.IsLocale = IsLocale;
10240 exports.IsLongitude = IsLongitude;
10241 exports.IsLowercase = IsLowercase;
10242 exports.IsMACAddress = IsMACAddress;
10243 exports.IsMagnetURI = IsMagnetURI;
10244 exports.IsMilitaryTime = IsMilitaryTime;
10245 exports.IsMimeType = IsMimeType;
10246 exports.IsMobilePhone = IsMobilePhone;
10247 exports.IsMongoId = IsMongoId;
10248 exports.IsMultibyte = IsMultibyte;
10249 exports.IsNegative = IsNegative;
10250 exports.IsNotEmpty = IsNotEmpty;
10251 exports.IsNotEmptyObject = IsNotEmptyObject;
10252 exports.IsNotIn = IsNotIn;
10253 exports.IsNumber = IsNumber;
10254 exports.IsNumberString = IsNumberString;
10255 exports.IsObject = IsObject;
10256 exports.IsOctal = IsOctal;
10257 exports.IsOptional = IsOptional;
10258 exports.IsPassportNumber = IsPassportNumber;
10259 exports.IsPhoneNumber = IsPhoneNumber;
10260 exports.IsPort = IsPort;
10261 exports.IsPositive = IsPositive;
10262 exports.IsPostalCode = IsPostalCode;
10263 exports.IsRFC3339 = IsRFC3339;
10264 exports.IsRgbColor = IsRgbColor;
10265 exports.IsSemVer = IsSemVer;
10266 exports.IsString = IsString;
10267 exports.IsSurrogatePair = IsSurrogatePair;
10268 exports.IsUUID = IsUUID;
10269 exports.IsUppercase = IsUppercase;
10270 exports.IsUrl = IsUrl;
10271 exports.IsVariableWidth = IsVariableWidth;
10272 exports.Length = Length;
10273 exports.MATCHES = MATCHES;
10274 exports.MAX = MAX;
10275 exports.MAX_DATE = MAX_DATE;
10276 exports.MAX_LENGTH = MAX_LENGTH;
10277 exports.MIN = MIN;
10278 exports.MIN_DATE = MIN_DATE;
10279 exports.MIN_LENGTH = MIN_LENGTH;
10280 exports.Matches = Matches;
10281 exports.Max = Max;
10282 exports.MaxDate = MaxDate;
10283 exports.MaxLength = MaxLength;
10284 exports.MetadataStorage = MetadataStorage;
10285 exports.Min = Min;
10286 exports.MinDate = MinDate;
10287 exports.MinLength = MinLength;
10288 exports.NOT_CONTAINS = NOT_CONTAINS;
10289 exports.NOT_EQUALS = NOT_EQUALS;
10290 exports.NotContains = NotContains;
10291 exports.NotEquals = NotEquals;
10292 exports.Validate = Validate;
10293 exports.ValidateBy = ValidateBy;
10294 exports.ValidateIf = ValidateIf;
10295 exports.ValidateNested = ValidateNested;
10296 exports.ValidatePromise = ValidatePromise;
10297 exports.ValidationError = ValidationError;
10298 exports.ValidationTypes = ValidationTypes;
10299 exports.Validator = Validator;
10300 exports.ValidatorConstraint = ValidatorConstraint;
10301 exports.arrayContains = arrayContains;
10302 exports.arrayMaxSize = arrayMaxSize;
10303 exports.arrayMinSize = arrayMinSize;
10304 exports.arrayNotContains = arrayNotContains;
10305 exports.arrayNotEmpty = arrayNotEmpty;
10306 exports.arrayUnique = arrayUnique;
10307 exports.buildMessage = buildMessage;
10308 exports.contains = contains;
10309 exports.equals = equals;
10310 exports.getFromContainer = getFromContainer;
10311 exports.getMetadataStorage = getMetadataStorage;
10312 exports.isAlpha = isAlpha;
10313 exports.isAlphanumeric = isAlphanumeric;
10314 exports.isArray = isArray;
10315 exports.isAscii = isAscii;
10316 exports.isBIC = isBIC;
10317 exports.isBase32 = isBase32;
10318 exports.isBase64 = isBase64;
10319 exports.isBoolean = isBoolean;
10320 exports.isBooleanString = isBooleanString;
10321 exports.isBtcAddress = isBtcAddress;
10322 exports.isByteLength = isByteLength;
10323 exports.isCreditCard = isCreditCard;
10324 exports.isCurrency = isCurrency;
10325 exports.isDataURI = isDataURI;
10326 exports.isDate = isDate;
10327 exports.isDateString = isDateString;
10328 exports.isDecimal = isDecimal;
10329 exports.isDefined = isDefined;
10330 exports.isDivisibleBy = isDivisibleBy;
10331 exports.isEAN = isEAN;
10332 exports.isEmail = isEmail;
10333 exports.isEmpty = isEmpty;
10334 exports.isEnum = isEnum;
10335 exports.isEthereumAddress = isEthereumAddress;
10336 exports.isFQDN = isFQDN;
10337 exports.isFirebasePushId = isFirebasePushId;
10338 exports.isFullWidth = isFullWidth;
10339 exports.isHSL = isHSL;
10340 exports.isHalfWidth = isHalfWidth;
10341 exports.isHash = isHash;
10342 exports.isHexColor = isHexColor;
10343 exports.isHexadecimal = isHexadecimal;
10344 exports.isIBAN = isIBAN;
10345 exports.isIP = isIP;
10346 exports.isISBN = isISBN;
10347 exports.isISIN = isISIN;
10348 exports.isISO31661Alpha2 = isISO31661Alpha2;
10349 exports.isISO31661Alpha3 = isISO31661Alpha3;
10350 exports.isISO8601 = isISO8601;
10351 exports.isISRC = isISRC;
10352 exports.isISSN = isISSN;
10353 exports.isIdentityCard = isIdentityCard;
10354 exports.isIn = isIn;
10355 exports.isInstance = isInstance;
10356 exports.isInt = isInt;
10357 exports.isJSON = isJSON;
10358 exports.isJWT = isJWT;
10359 exports.isLatLong = isLatLong;
10360 exports.isLatitude = isLatitude;
10361 exports.isLocale = isLocale;
10362 exports.isLongitude = isLongitude;
10363 exports.isLowercase = isLowercase;
10364 exports.isMACAddress = isMACAddress;
10365 exports.isMagnetURI = isMagnetURI;
10366 exports.isMilitaryTime = isMilitaryTime;
10367 exports.isMimeType = isMimeType;
10368 exports.isMobilePhone = isMobilePhone;
10369 exports.isMongoId = isMongoId;
10370 exports.isMultibyte = isMultibyte;
10371 exports.isNegative = isNegative;
10372 exports.isNotEmpty = isNotEmpty;
10373 exports.isNotEmptyObject = isNotEmptyObject;
10374 exports.isNotIn = isNotIn;
10375 exports.isNumber = isNumber;
10376 exports.isNumberString = isNumberString;
10377 exports.isObject = isObject;
10378 exports.isOctal = isOctal;
10379 exports.isPassportNumber = isPassportNumber;
10380 exports.isPhoneNumber = isPhoneNumber;
10381 exports.isPort = isPort;
10382 exports.isPositive = isPositive;
10383 exports.isPostalCode = isPostalCode;
10384 exports.isRFC3339 = isRFC3339;
10385 exports.isRgbColor = isRgbColor;
10386 exports.isSemVer = isSemVer;
10387 exports.isString = isString;
10388 exports.isSurrogatePair = isSurrogatePair;
10389 exports.isURL = isURL;
10390 exports.isUUID = isUUID;
10391 exports.isUppercase = isUppercase;
10392 exports.isValidationOptions = isValidationOptions;
10393 exports.isVariableWidth = isVariableWidth;
10394 exports.length = length;
10395 exports.matches = matches;
10396 exports.max = max;
10397 exports.maxDate = maxDate;
10398 exports.maxLength = maxLength;
10399 exports.min = min;
10400 exports.minDate = minDate;
10401 exports.minLength = minLength;
10402 exports.notContains = notContains;
10403 exports.notEquals = notEquals;
10404 exports.registerDecorator = registerDecorator;
10405 exports.registerSchema = registerSchema;
10406 exports.useContainer = useContainer;
10407 exports.validate = validate;
10408 exports.validateOrReject = validateOrReject;
10409 exports.validateSync = validateSync;
10410
10411 Object.defineProperty(exports, '__esModule', { value: true });
10412
10413}));
10414//# sourceMappingURL=class-validator.umd.js.map