-
Notifications
You must be signed in to change notification settings - Fork 0
/
validatorUtility.js
5930 lines (5825 loc) · 217 KB
/
validatorUtility.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
// src/utils/value.js
var require_value = __commonJS({
"src/utils/value.js"(exports2, module2) {
var Value = class {
isNumber(o) {
return typeof o === "number" || o instanceof Number;
}
isString(o) {
return typeof o === "string" || o instanceof String;
}
isArray(o) {
return Array.isArray(o) || o instanceof Array;
}
isBoolean(o) {
return typeof o === "boolean" || o instanceof Boolean;
}
isObject(o) {
return typeof o === "object" || o instanceof Object;
}
isValidArrayOrString(o) {
const valid = !!o;
const isString = this.isString(o);
const isArray = this.isArray(o);
if (isString && !valid && o === "") {
return true;
}
return valid && (isArray || isString);
}
isValidObject(o) {
return !!o && this.isObject(o);
}
};
module2.exports = new Value();
}
});
// src/utils/utils.js
var require_utils = __commonJS({
"src/utils/utils.js"(exports2, module2) {
var check2 = require_value();
var Utils = class {
escape(str, ignore = []) {
if (!check2.isString(str)) {
throw new TypeError("validator-utility - escape/escapeString expected a string but got", typeof str);
}
if (!check2.isValidArrayOrString(ignore)) {
ignore = [];
}
let result = str;
if (!ignore.includes("&")) {
result = result.replace(/&/g, "&");
}
if (!ignore.includes('"')) {
result = result.replace(/"/g, """);
}
if (!ignore.includes("'")) {
result = result.replace(/'/g, "'");
}
if (!ignore.includes("<")) {
result = result.replace(/</g, "<");
}
if (!ignore.includes(">")) {
result = result.replace(/>/g, ">");
}
if (!ignore.includes("/")) {
result = result.replace(/\//g, "/");
}
if (!ignore.includes("\\")) {
result = result.replace(/\\/g, "\");
}
if (!ignore.includes("`")) {
result = result.replace(/`/g, "`");
}
return result;
}
safeEscape(str, escapeFunction, unescapeFunction, ignore) {
return escapeFunction(unescapeFunction(str), ignore);
}
};
module2.exports = new Utils();
}
});
// src/utils/modifyValidatorEscape.js
var require_modifyValidatorEscape = __commonJS({
"src/utils/modifyValidatorEscape.js"(exports2, module2) {
var check2 = require_value();
function modifyValidatorEscape2(_validator, _oldValidatorEscapeRef, _safeEscapeFunction) {
_validator.escape = (obj, maxDeepDepth, maxArrayDepth, supressWarnings, ignore, truncateArray) => {
if (!check2.isNumber(maxDeepDepth) || maxDeepDepth <= 0) {
maxDeepDepth = Infinity;
}
if (!check2.isNumber(maxArrayDepth) || maxArrayDepth <= 0) {
maxArrayDepth = Infinity;
}
let wasJsonString = false;
if (check2.isString(obj)) {
try {
const json = JSON.parse(obj);
if (check2.isValidObject(json)) {
obj = json;
wasJsonString = true;
}
} catch (ignored) {
}
}
function _sanitizeObject(_obj, escapeFunction, unescapeFunction, currentDeepDepth = 0, nestedArrayDepth = 0) {
if (_obj instanceof Date) {
return _obj.toISOString();
}
if (_obj === null || _obj === void 0 || typeof _obj !== "object") {
if (check2.isString(_obj)) {
return _safeEscapeFunction(_obj, escapeFunction, unescapeFunction, ignore);
}
return _obj;
}
if (check2.isArray(_obj)) {
const arr = [];
if (truncateArray) {
if (nestedArrayDepth < maxDeepDepth) {
for (let i = 0; i < _obj.length && i < maxArrayDepth; i += 1) {
const element = _obj[i];
arr[i] = _sanitizeObject(element, escapeFunction, unescapeFunction, currentDeepDepth, nestedArrayDepth + (check2.isArray(element) ? 1 : 0));
}
} else if (!supressWarnings) {
console.warn(`WARNING (validator-utility): exceeded max deep depth, i.e., nested arrays (${nestedArrayDepth < maxDeepDepth}).`);
}
} else if (_obj.length < maxArrayDepth && nestedArrayDepth < maxDeepDepth) {
_obj.forEach((element, i) => {
arr[i] = _sanitizeObject(element, escapeFunction, unescapeFunction, currentDeepDepth, nestedArrayDepth + (check2.isArray(element) ? 1 : 0));
});
} else if (!supressWarnings) {
console.warn(`WARNING (validator-utility): Exceeded max array depth (${_obj.length < maxArrayDepth}), or exceeded max deep depth, i.e., nested arrays (${nestedArrayDepth < maxDeepDepth}).`);
}
return arr;
}
const sanitized = {};
if (currentDeepDepth < maxDeepDepth) {
for (const i in _obj) {
if (i === "_id" && typeof _obj[i] === "object") {
const serialId = _obj[i].toString();
sanitized[i] = _sanitizeObject(serialId, escapeFunction, unescapeFunction, currentDeepDepth + 1, nestedArrayDepth);
} else {
sanitized[i] = _sanitizeObject(_obj[i], escapeFunction, unescapeFunction, currentDeepDepth + 1, nestedArrayDepth);
}
}
} else if (!supressWarnings) {
console.warn("WARNING (validator-utility): Exceeded max deep depth (object).");
}
return sanitized;
}
const result = _sanitizeObject(obj, _oldValidatorEscapeRef, _validator.unescape, 0, 1);
return wasJsonString ? JSON.stringify(result) : result;
};
}
module2.exports = modifyValidatorEscape2;
}
});
// node_modules/validator/lib/util/assertString.js
var require_assertString = __commonJS({
"node_modules/validator/lib/util/assertString.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = assertString;
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof2(obj2) {
return typeof obj2;
};
} else {
_typeof = function _typeof2(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof(obj);
}
function assertString(input) {
var isString = typeof input === "string" || input instanceof String;
if (!isString) {
var invalidType = _typeof(input);
if (input === null)
invalidType = "null";
else if (invalidType === "object")
invalidType = input.constructor.name;
throw new TypeError("Expected a string but received a ".concat(invalidType));
}
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/toDate.js
var require_toDate = __commonJS({
"node_modules/validator/lib/toDate.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toDate;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toDate(date) {
(0, _assertString.default)(date);
date = Date.parse(date);
return !isNaN(date) ? new Date(date) : null;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/alpha.js
var require_alpha = __commonJS({
"node_modules/validator/lib/alpha.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.commaDecimal = exports2.dotDecimal = exports2.farsiLocales = exports2.arabicLocales = exports2.englishLocales = exports2.decimal = exports2.alphanumeric = exports2.alpha = void 0;
var alpha = {
"en-US": /^[A-Z]+$/i,
"az-AZ": /^[A-VXYZÇƏĞİıÖŞÜ]+$/i,
"bg-BG": /^[А-Я]+$/i,
"cs-CZ": /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
"da-DK": /^[A-ZÆØÅ]+$/i,
"de-DE": /^[A-ZÄÖÜß]+$/i,
"el-GR": /^[Α-ώ]+$/i,
"es-ES": /^[A-ZÁÉÍÑÓÚÜ]+$/i,
"fa-IR": /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,
"fi-FI": /^[A-ZÅÄÖ]+$/i,
"fr-FR": /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
"it-IT": /^[A-ZÀÉÈÌÎÓÒÙ]+$/i,
"nb-NO": /^[A-ZÆØÅ]+$/i,
"nl-NL": /^[A-ZÁÉËÏÓÖÜÚ]+$/i,
"nn-NO": /^[A-ZÆØÅ]+$/i,
"hu-HU": /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
"pl-PL": /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
"pt-PT": /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
"ru-RU": /^[А-ЯЁ]+$/i,
"sl-SI": /^[A-ZČĆĐŠŽ]+$/i,
"sk-SK": /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
"sr-RS@latin": /^[A-ZČĆŽŠĐ]+$/i,
"sr-RS": /^[А-ЯЂЈЉЊЋЏ]+$/i,
"sv-SE": /^[A-ZÅÄÖ]+$/i,
"th-TH": /^[ก-๐\s]+$/i,
"tr-TR": /^[A-ZÇĞİıÖŞÜ]+$/i,
"uk-UA": /^[А-ЩЬЮЯЄIЇҐі]+$/i,
"vi-VN": /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
"ku-IQ": /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[א-ת]+$/,
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i,
"hi-IN": /^[\u0900-\u0961]+[\u0972-\u097F]*$/i
};
exports2.alpha = alpha;
var alphanumeric = {
"en-US": /^[0-9A-Z]+$/i,
"az-AZ": /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,
"bg-BG": /^[0-9А-Я]+$/i,
"cs-CZ": /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
"da-DK": /^[0-9A-ZÆØÅ]+$/i,
"de-DE": /^[0-9A-ZÄÖÜß]+$/i,
"el-GR": /^[0-9Α-ω]+$/i,
"es-ES": /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,
"fi-FI": /^[0-9A-ZÅÄÖ]+$/i,
"fr-FR": /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,
"it-IT": /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,
"hu-HU": /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,
"nb-NO": /^[0-9A-ZÆØÅ]+$/i,
"nl-NL": /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,
"nn-NO": /^[0-9A-ZÆØÅ]+$/i,
"pl-PL": /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,
"pt-PT": /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,
"ru-RU": /^[0-9А-ЯЁ]+$/i,
"sl-SI": /^[0-9A-ZČĆĐŠŽ]+$/i,
"sk-SK": /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,
"sr-RS@latin": /^[0-9A-ZČĆŽŠĐ]+$/i,
"sr-RS": /^[0-9А-ЯЂЈЉЊЋЏ]+$/i,
"sv-SE": /^[0-9A-ZÅÄÖ]+$/i,
"th-TH": /^[ก-๙\s]+$/i,
"tr-TR": /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
"uk-UA": /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
"ku-IQ": /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
"vi-VN": /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[0-9א-ת]+$/,
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i,
"hi-IN": /^[\u0900-\u0963]+[\u0966-\u097F]*$/i
};
exports2.alphanumeric = alphanumeric;
var decimal = {
"en-US": ".",
ar: "\u066B"
};
exports2.decimal = decimal;
var englishLocales = ["AU", "GB", "HK", "IN", "NZ", "ZA", "ZM"];
exports2.englishLocales = englishLocales;
for (i = 0; i < englishLocales.length; i++) {
locale = "en-".concat(englishLocales[i]);
alpha[locale] = alpha["en-US"];
alphanumeric[locale] = alphanumeric["en-US"];
decimal[locale] = decimal["en-US"];
}
var locale;
var i;
var arabicLocales = ["AE", "BH", "DZ", "EG", "IQ", "JO", "KW", "LB", "LY", "MA", "QM", "QA", "SA", "SD", "SY", "TN", "YE"];
exports2.arabicLocales = arabicLocales;
for (_i = 0; _i < arabicLocales.length; _i++) {
_locale = "ar-".concat(arabicLocales[_i]);
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
decimal[_locale] = decimal.ar;
}
var _locale;
var _i;
var farsiLocales = ["IR", "AF"];
exports2.farsiLocales = farsiLocales;
for (_i2 = 0; _i2 < farsiLocales.length; _i2++) {
_locale2 = "fa-".concat(farsiLocales[_i2]);
alphanumeric[_locale2] = alphanumeric.fa;
decimal[_locale2] = decimal.ar;
}
var _locale2;
var _i2;
var dotDecimal = ["ar-EG", "ar-LB", "ar-LY"];
exports2.dotDecimal = dotDecimal;
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"];
exports2.commaDecimal = commaDecimal;
for (_i3 = 0; _i3 < dotDecimal.length; _i3++) {
decimal[dotDecimal[_i3]] = decimal["en-US"];
}
var _i3;
for (_i4 = 0; _i4 < commaDecimal.length; _i4++) {
decimal[commaDecimal[_i4]] = ",";
}
var _i4;
alpha["fr-CA"] = alpha["fr-FR"];
alphanumeric["fr-CA"] = alphanumeric["fr-FR"];
alpha["pt-BR"] = alpha["pt-PT"];
alphanumeric["pt-BR"] = alphanumeric["pt-PT"];
decimal["pt-BR"] = decimal["pt-PT"];
alpha["pl-Pl"] = alpha["pl-PL"];
alphanumeric["pl-Pl"] = alphanumeric["pl-PL"];
decimal["pl-Pl"] = decimal["pl-PL"];
alpha["fa-AF"] = alpha.fa;
}
});
// node_modules/validator/lib/isFloat.js
var require_isFloat = __commonJS({
"node_modules/validator/lib/isFloat.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isFloat;
exports2.locales = void 0;
var _assertString = _interopRequireDefault(require_assertString());
var _alpha = require_alpha();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function isFloat(str, options) {
(0, _assertString.default)(str);
options = options || {};
var float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? _alpha.decimal[options.locale] : ".", "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"));
if (str === "" || str === "." || str === "-" || str === "+") {
return false;
}
var value = parseFloat(str.replace(",", "."));
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);
}
var locales = Object.keys(_alpha.decimal);
exports2.locales = locales;
}
});
// node_modules/validator/lib/toFloat.js
var require_toFloat = __commonJS({
"node_modules/validator/lib/toFloat.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toFloat;
var _isFloat = _interopRequireDefault(require_isFloat());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toFloat(str) {
if (!(0, _isFloat.default)(str))
return NaN;
return parseFloat(str);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/toInt.js
var require_toInt = __commonJS({
"node_modules/validator/lib/toInt.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toInt;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toInt(str, radix) {
(0, _assertString.default)(str);
return parseInt(str, radix || 10);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/toBoolean.js
var require_toBoolean = __commonJS({
"node_modules/validator/lib/toBoolean.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toBoolean;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function toBoolean(str, strict) {
(0, _assertString.default)(str);
if (strict) {
return str === "1" || /^true$/i.test(str);
}
return str !== "0" && !/^false$/i.test(str) && str !== "";
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/equals.js
var require_equals = __commonJS({
"node_modules/validator/lib/equals.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = equals;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function equals(str, comparison) {
(0, _assertString.default)(str);
return str === comparison;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/util/toString.js
var require_toString = __commonJS({
"node_modules/validator/lib/util/toString.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = toString2;
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof2(obj2) {
return typeof obj2;
};
} else {
_typeof = function _typeof2(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof(obj);
}
function toString2(input) {
if (_typeof(input) === "object" && input !== null) {
if (typeof input.toString === "function") {
input = input.toString();
} else {
input = "[object Object]";
}
} else if (input === null || typeof input === "undefined" || isNaN(input) && !input.length) {
input = "";
}
return String(input);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/util/merge.js
var require_merge = __commonJS({
"node_modules/validator/lib/util/merge.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = merge;
function merge() {
var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var defaults = arguments.length > 1 ? arguments[1] : void 0;
for (var key in defaults) {
if (typeof obj[key] === "undefined") {
obj[key] = defaults[key];
}
}
return obj;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/contains.js
var require_contains = __commonJS({
"node_modules/validator/lib/contains.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = contains;
var _assertString = _interopRequireDefault(require_assertString());
var _toString = _interopRequireDefault(require_toString());
var _merge = _interopRequireDefault(require_merge());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var defaulContainsOptions = {
ignoreCase: false,
minOccurrences: 1
};
function contains(str, elem, options) {
(0, _assertString.default)(str);
options = (0, _merge.default)(options, defaulContainsOptions);
if (options.ignoreCase) {
return str.toLowerCase().split((0, _toString.default)(elem).toLowerCase()).length > options.minOccurrences;
}
return str.split((0, _toString.default)(elem)).length > options.minOccurrences;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/matches.js
var require_matches = __commonJS({
"node_modules/validator/lib/matches.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = matches;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function matches(str, pattern, modifiers) {
(0, _assertString.default)(str);
if (Object.prototype.toString.call(pattern) !== "[object RegExp]") {
pattern = new RegExp(pattern, modifiers);
}
return pattern.test(str);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isByteLength.js
var require_isByteLength = __commonJS({
"node_modules/validator/lib/isByteLength.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isByteLength;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof2(obj2) {
return typeof obj2;
};
} else {
_typeof = function _typeof2(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof(obj);
}
function isByteLength(str, options) {
(0, _assertString.default)(str);
var min;
var max;
if (_typeof(options) === "object") {
min = options.min || 0;
max = options.max;
} else {
min = arguments[1];
max = arguments[2];
}
var len = encodeURI(str).split(/%..|./).length - 1;
return len >= min && (typeof max === "undefined" || len <= max);
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isFQDN.js
var require_isFQDN = __commonJS({
"node_modules/validator/lib/isFQDN.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isFQDN;
var _assertString = _interopRequireDefault(require_assertString());
var _merge = _interopRequireDefault(require_merge());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var default_fqdn_options = {
require_tld: true,
allow_underscores: false,
allow_trailing_dot: false,
allow_numeric_tld: false,
allow_wildcard: false
};
function isFQDN(str, options) {
(0, _assertString.default)(str);
options = (0, _merge.default)(options, default_fqdn_options);
if (options.allow_trailing_dot && str[str.length - 1] === ".") {
str = str.substring(0, str.length - 1);
}
if (options.allow_wildcard === true && str.indexOf("*.") === 0) {
str = str.substring(2);
}
var parts = str.split(".");
var tld = parts[parts.length - 1];
if (options.require_tld) {
if (parts.length < 2) {
return false;
}
if (!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
return false;
}
if (/\s/.test(tld)) {
return false;
}
}
if (!options.allow_numeric_tld && /^\d+$/.test(tld)) {
return false;
}
return parts.every(function(part) {
if (part.length > 63) {
return false;
}
if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) {
return false;
}
if (/[\uff01-\uff5e]/.test(part)) {
return false;
}
if (/^-|-$/.test(part)) {
return false;
}
if (!options.allow_underscores && /_/.test(part)) {
return false;
}
return true;
});
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isIP.js
var require_isIP = __commonJS({
"node_modules/validator/lib/isIP.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isIP;
var _assertString = _interopRequireDefault(require_assertString());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var IPv4SegmentFormat = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";
var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$"));
var IPv6SegmentFormat = "(?:[0-9a-fA-F]{1,4})";
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,})?$");
function isIP(str) {
var version = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
(0, _assertString.default)(str);
version = String(version);
if (!version) {
return isIP(str, 4) || isIP(str, 6);
}
if (version === "4") {
if (!IPv4AddressRegExp.test(str)) {
return false;
}
var parts = str.split(".").sort(function(a, b) {
return a - b;
});
return parts[3] <= 255;
}
if (version === "6") {
return !!IPv6AddressRegExp.test(str);
}
return false;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isEmail.js
var require_isEmail = __commonJS({
"node_modules/validator/lib/isEmail.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isEmail;
var _assertString = _interopRequireDefault(require_assertString());
var _merge = _interopRequireDefault(require_merge());
var _isByteLength = _interopRequireDefault(require_isByteLength());
var _isFQDN = _interopRequireDefault(require_isFQDN());
var _isIP = _interopRequireDefault(require_isIP());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var default_email_options = {
allow_display_name: false,
require_display_name: false,
allow_utf8_local_part: true,
require_tld: true,
blacklisted_chars: "",
ignore_max_length: false,
host_blacklist: []
};
var splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i;
var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
var gmailUserPart = /^[a-z\d]+$/;
var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
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;
var defaultMaxEmailLength = 254;
function validateDisplayName(display_name) {
var display_name_without_quotes = display_name.replace(/^"(.+)"$/, "$1");
if (!display_name_without_quotes.trim()) {
return false;
}
var contains_illegal = /[\.";<>]/.test(display_name_without_quotes);
if (contains_illegal) {
if (display_name_without_quotes === display_name) {
return false;
}
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length;
if (!all_start_with_back_slash) {
return false;
}
}
return true;
}
function isEmail(str, options) {
(0, _assertString.default)(str);
options = (0, _merge.default)(options, default_email_options);
if (options.require_display_name || options.allow_display_name) {
var display_email = str.match(splitNameAddress);
if (display_email) {
var display_name = display_email[1];
str = str.replace(display_name, "").replace(/(^<|>$)/g, "");
if (display_name.endsWith(" ")) {
display_name = display_name.substr(0, display_name.length - 1);
}
if (!validateDisplayName(display_name)) {
return false;
}
} else if (options.require_display_name) {
return false;
}
}
if (!options.ignore_max_length && str.length > defaultMaxEmailLength) {
return false;
}
var parts = str.split("@");
var domain = parts.pop();
var lower_domain = domain.toLowerCase();
if (options.host_blacklist.includes(lower_domain)) {
return false;
}
var user = parts.join("@");
if (options.domain_specific_validation && (lower_domain === "gmail.com" || lower_domain === "googlemail.com")) {
user = user.toLowerCase();
var username = user.split("+")[0];
if (!(0, _isByteLength.default)(username.replace(/\./g, ""), {
min: 6,
max: 30
})) {
return false;
}
var _user_parts = username.split(".");
for (var i = 0; i < _user_parts.length; i++) {
if (!gmailUserPart.test(_user_parts[i])) {
return false;
}
}
}
if (options.ignore_max_length === false && (!(0, _isByteLength.default)(user, {
max: 64
}) || !(0, _isByteLength.default)(domain, {
max: 254
}))) {
return false;
}
if (!(0, _isFQDN.default)(domain, {
require_tld: options.require_tld
})) {
if (!options.allow_ip_domain) {
return false;
}
if (!(0, _isIP.default)(domain)) {
if (!domain.startsWith("[") || !domain.endsWith("]")) {
return false;
}
var noBracketdomain = domain.substr(1, domain.length - 2);
if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) {
return false;
}
}
}
if (user[0] === '"') {
user = user.slice(1, user.length - 1);
return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);
}
var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;
var user_parts = user.split(".");
for (var _i = 0; _i < user_parts.length; _i++) {
if (!pattern.test(user_parts[_i])) {
return false;
}
}
if (options.blacklisted_chars) {
if (user.search(new RegExp("[".concat(options.blacklisted_chars, "]+"), "g")) !== -1)
return false;
}
return true;
}
module2.exports = exports2.default;
module2.exports.default = exports2.default;
}
});
// node_modules/validator/lib/isURL.js
var require_isURL = __commonJS({
"node_modules/validator/lib/isURL.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = isURL;
var _assertString = _interopRequireDefault(require_assertString());
var _isFQDN = _interopRequireDefault(require_isFQDN());
var _isIP = _interopRequireDefault(require_isIP());
var _merge = _interopRequireDefault(require_merge());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
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.");
}
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);
}
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;
}
function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr)))
return;
var _arr = [];
var _n = true;
var _d = false;
var _e = void 0;
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;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr))
return arr;
}
var default_url_options = {
protocols: ["http", "https", "ftp"],
require_tld: true,
require_protocol: false,
require_host: true,
require_port: false,
require_valid_protocol: true,
allow_underscores: false,
allow_trailing_dot: false,
allow_protocol_relative_urls: false,
allow_fragments: true,
allow_query_components: true,
validate_length: true
};
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
function isRegExp(obj) {
return Object.prototype.toString.call(obj) === "[object RegExp]";
}
function checkHost(host, matches) {
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
if (host === match || isRegExp(match) && match.test(host)) {
return true;
}
}
return false;
}
function isURL(url, options) {
(0, _assertString.default)(url);
if (!url || /[\s<>]/.test(url)) {
return false;
}
if (url.indexOf("mailto:") === 0) {
return false;
}
options = (0, _merge.default)(options, default_url_options);
if (options.validate_length && url.length >= 2083) {
return false;
}
if (!options.allow_fragments && url.includes("#")) {
return false;