intl-tel-input 25.14.1 → 25.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +5 -5
  2. package/angular/README.md +1 -1
  3. package/angular/build/IntlTelInput.js +1 -1
  4. package/angular/build/IntlTelInputWithUtils.js +1 -1
  5. package/build/css/intlTelInput-no-assets.css +1259 -0
  6. package/build/css/intlTelInput-no-assets.min.css +1 -0
  7. package/build/css/intlTelInput.css +6 -4
  8. package/build/css/intlTelInput.min.css +1 -1
  9. package/build/js/data.js +1 -1
  10. package/build/js/data.min.js +1 -1
  11. package/build/js/intlTelInput.js +2 -2
  12. package/build/js/intlTelInput.min.js +2 -2
  13. package/build/js/intlTelInputWithUtils.js +2 -2
  14. package/build/js/intlTelInputWithUtils.min.js +2 -2
  15. package/package.json +1 -1
  16. package/react/README.md +1 -1
  17. package/react/build/IntlTelInput.cjs +1 -1
  18. package/react/build/IntlTelInput.js +1 -1
  19. package/react/build/IntlTelInputWithUtils.cjs +1 -1
  20. package/react/build/IntlTelInputWithUtils.js +1 -1
  21. package/svelte/README.md +1 -1
  22. package/svelte/build/IntlTelInput.mjs +1 -1
  23. package/svelte/build/IntlTelInputWithUtils.mjs +1 -1
  24. package/vue/README.md +1 -1
  25. package/vue/build/IntlTelInput.mjs +1 -1
  26. package/vue/build/IntlTelInput.vue.d.ts +34 -0
  27. package/vue/build/IntlTelInputWithUtils.mjs +1 -1
  28. package/vue/build/IntlTelInputWithUtils.vue.d.ts +34 -0
  29. package/vue/build/exports/IntlTelInput.d.ts +3 -0
  30. package/vue/build/exports/IntlTelInput.mjs +66 -0
  31. package/vue/build/exports/IntlTelInputWithUtils.d.ts +3 -0
  32. package/vue/build/exports/IntlTelInputWithUtils.mjs +6207 -0
  33. package/vue/build/intl-tel-input-Db39yQmC.mjs +3083 -0
  34. package/vue/build/intl-tel-input.d.ts +97 -0
  35. package/vue/build/modules/constants.d.ts +85 -0
  36. package/vue/build/modules/core/countrySearch.d.ts +17 -0
  37. package/vue/build/modules/core/icons.d.ts +9 -0
  38. package/vue/build/modules/core/options.d.ts +3 -0
  39. package/vue/build/modules/core/ui.d.ts +46 -0
  40. package/vue/build/modules/data/country-data.d.ts +12 -0
  41. package/vue/build/modules/data/nanp-regionless.d.ts +2 -0
  42. package/vue/build/modules/format/caret.d.ts +1 -0
  43. package/vue/build/modules/format/formatting.d.ts +3 -0
  44. package/vue/build/modules/types/events.d.ts +9 -0
  45. package/vue/build/modules/types/public-api.d.ts +78 -0
  46. package/vue/build/modules/utils/dom.d.ts +6 -0
  47. package/vue/build/modules/utils/string.d.ts +2 -0
@@ -0,0 +1,3083 @@
1
+ const Y = [
2
+ [
3
+ "af",
4
+ // Afghanistan
5
+ "93",
6
+ 0,
7
+ null,
8
+ "0"
9
+ ],
10
+ [
11
+ "ax",
12
+ // Åland Islands
13
+ "358",
14
+ 1,
15
+ ["18", "4"],
16
+ // (4 is a mobile range shared with FI)
17
+ "0"
18
+ ],
19
+ [
20
+ "al",
21
+ // Albania
22
+ "355",
23
+ 0,
24
+ null,
25
+ "0"
26
+ ],
27
+ [
28
+ "dz",
29
+ // Algeria
30
+ "213",
31
+ 0,
32
+ null,
33
+ "0"
34
+ ],
35
+ [
36
+ "as",
37
+ // American Samoa
38
+ "1",
39
+ 5,
40
+ ["684"],
41
+ "1"
42
+ ],
43
+ [
44
+ "ad",
45
+ // Andorra
46
+ "376"
47
+ ],
48
+ [
49
+ "ao",
50
+ // Angola
51
+ "244"
52
+ ],
53
+ [
54
+ "ai",
55
+ // Anguilla
56
+ "1",
57
+ 6,
58
+ ["264"],
59
+ "1"
60
+ ],
61
+ [
62
+ "ag",
63
+ // Antigua and Barbuda
64
+ "1",
65
+ 7,
66
+ ["268"],
67
+ "1"
68
+ ],
69
+ [
70
+ "ar",
71
+ // Argentina
72
+ "54",
73
+ 0,
74
+ null,
75
+ "0"
76
+ ],
77
+ [
78
+ "am",
79
+ // Armenia
80
+ "374",
81
+ 0,
82
+ null,
83
+ "0"
84
+ ],
85
+ [
86
+ "aw",
87
+ // Aruba
88
+ "297"
89
+ ],
90
+ [
91
+ "ac",
92
+ // Ascension Island
93
+ "247"
94
+ ],
95
+ [
96
+ "au",
97
+ // Australia
98
+ "61",
99
+ 0,
100
+ ["4"],
101
+ // (mobile range shared with CX and CC)
102
+ "0"
103
+ ],
104
+ [
105
+ "at",
106
+ // Austria
107
+ "43",
108
+ 0,
109
+ null,
110
+ "0"
111
+ ],
112
+ [
113
+ "az",
114
+ // Azerbaijan
115
+ "994",
116
+ 0,
117
+ null,
118
+ "0"
119
+ ],
120
+ [
121
+ "bs",
122
+ // Bahamas
123
+ "1",
124
+ 8,
125
+ ["242"],
126
+ "1"
127
+ ],
128
+ [
129
+ "bh",
130
+ // Bahrain
131
+ "973"
132
+ ],
133
+ [
134
+ "bd",
135
+ // Bangladesh
136
+ "880",
137
+ 0,
138
+ null,
139
+ "0"
140
+ ],
141
+ [
142
+ "bb",
143
+ // Barbados
144
+ "1",
145
+ 9,
146
+ ["246"],
147
+ "1"
148
+ ],
149
+ [
150
+ "by",
151
+ // Belarus
152
+ "375",
153
+ 0,
154
+ null,
155
+ "8"
156
+ ],
157
+ [
158
+ "be",
159
+ // Belgium
160
+ "32",
161
+ 0,
162
+ null,
163
+ "0"
164
+ ],
165
+ [
166
+ "bz",
167
+ // Belize
168
+ "501"
169
+ ],
170
+ [
171
+ "bj",
172
+ // Benin
173
+ "229"
174
+ ],
175
+ [
176
+ "bm",
177
+ // Bermuda
178
+ "1",
179
+ 10,
180
+ ["441"],
181
+ "1"
182
+ ],
183
+ [
184
+ "bt",
185
+ // Bhutan
186
+ "975"
187
+ ],
188
+ [
189
+ "bo",
190
+ // Bolivia
191
+ "591",
192
+ 0,
193
+ null,
194
+ "0"
195
+ ],
196
+ [
197
+ "ba",
198
+ // Bosnia and Herzegovina
199
+ "387",
200
+ 0,
201
+ null,
202
+ "0"
203
+ ],
204
+ [
205
+ "bw",
206
+ // Botswana
207
+ "267"
208
+ ],
209
+ [
210
+ "br",
211
+ // Brazil
212
+ "55",
213
+ 0,
214
+ null,
215
+ "0"
216
+ ],
217
+ [
218
+ "io",
219
+ // British Indian Ocean Territory
220
+ "246"
221
+ ],
222
+ [
223
+ "vg",
224
+ // British Virgin Islands
225
+ "1",
226
+ 11,
227
+ ["284"],
228
+ "1"
229
+ ],
230
+ [
231
+ "bn",
232
+ // Brunei
233
+ "673"
234
+ ],
235
+ [
236
+ "bg",
237
+ // Bulgaria
238
+ "359",
239
+ 0,
240
+ null,
241
+ "0"
242
+ ],
243
+ [
244
+ "bf",
245
+ // Burkina Faso
246
+ "226"
247
+ ],
248
+ [
249
+ "bi",
250
+ // Burundi
251
+ "257"
252
+ ],
253
+ [
254
+ "kh",
255
+ // Cambodia
256
+ "855",
257
+ 0,
258
+ null,
259
+ "0"
260
+ ],
261
+ [
262
+ "cm",
263
+ // Cameroon
264
+ "237"
265
+ ],
266
+ [
267
+ "ca",
268
+ // Canada
269
+ "1",
270
+ 1,
271
+ ["204", "226", "236", "249", "250", "257", "263", "289", "306", "343", "354", "365", "367", "368", "382", "403", "416", "418", "428", "431", "437", "438", "450", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "879", "902", "905", "942"],
272
+ "1"
273
+ ],
274
+ [
275
+ "cv",
276
+ // Cape Verde
277
+ "238"
278
+ ],
279
+ [
280
+ "bq",
281
+ // Caribbean Netherlands
282
+ "599",
283
+ 1,
284
+ ["3", "4", "7"]
285
+ ],
286
+ [
287
+ "ky",
288
+ // Cayman Islands
289
+ "1",
290
+ 12,
291
+ ["345"],
292
+ "1"
293
+ ],
294
+ [
295
+ "cf",
296
+ // Central African Republic
297
+ "236"
298
+ ],
299
+ [
300
+ "td",
301
+ // Chad
302
+ "235"
303
+ ],
304
+ [
305
+ "cl",
306
+ // Chile
307
+ "56"
308
+ ],
309
+ [
310
+ "cn",
311
+ // China
312
+ "86",
313
+ 0,
314
+ null,
315
+ "0"
316
+ ],
317
+ [
318
+ "cx",
319
+ // Christmas Island
320
+ "61",
321
+ 2,
322
+ ["4", "89164"],
323
+ // (4 is a mobile range shared with AU and CC)
324
+ "0"
325
+ ],
326
+ [
327
+ "cc",
328
+ // Cocos (Keeling) Islands
329
+ "61",
330
+ 1,
331
+ ["4", "89162"],
332
+ // (4 is a mobile range shared with AU and CX)
333
+ "0"
334
+ ],
335
+ [
336
+ "co",
337
+ // Colombia
338
+ "57",
339
+ 0,
340
+ null,
341
+ "0"
342
+ ],
343
+ [
344
+ "km",
345
+ // Comoros
346
+ "269"
347
+ ],
348
+ [
349
+ "cg",
350
+ // Congo (Brazzaville)
351
+ "242"
352
+ ],
353
+ [
354
+ "cd",
355
+ // Congo (Kinshasa)
356
+ "243",
357
+ 0,
358
+ null,
359
+ "0"
360
+ ],
361
+ [
362
+ "ck",
363
+ // Cook Islands
364
+ "682"
365
+ ],
366
+ [
367
+ "cr",
368
+ // Costa Rica
369
+ "506"
370
+ ],
371
+ [
372
+ "ci",
373
+ // Côte d'Ivoire
374
+ "225"
375
+ ],
376
+ [
377
+ "hr",
378
+ // Croatia
379
+ "385",
380
+ 0,
381
+ null,
382
+ "0"
383
+ ],
384
+ [
385
+ "cu",
386
+ // Cuba
387
+ "53",
388
+ 0,
389
+ null,
390
+ "0"
391
+ ],
392
+ [
393
+ "cw",
394
+ // Curaçao
395
+ "599",
396
+ 0
397
+ ],
398
+ [
399
+ "cy",
400
+ // Cyprus
401
+ "357"
402
+ ],
403
+ [
404
+ "cz",
405
+ // Czech Republic
406
+ "420"
407
+ ],
408
+ [
409
+ "dk",
410
+ // Denmark
411
+ "45"
412
+ ],
413
+ [
414
+ "dj",
415
+ // Djibouti
416
+ "253"
417
+ ],
418
+ [
419
+ "dm",
420
+ // Dominica
421
+ "1",
422
+ 13,
423
+ ["767"],
424
+ "1"
425
+ ],
426
+ [
427
+ "do",
428
+ // Dominican Republic
429
+ "1",
430
+ 2,
431
+ ["809", "829", "849"],
432
+ "1"
433
+ ],
434
+ [
435
+ "ec",
436
+ // Ecuador
437
+ "593",
438
+ 0,
439
+ null,
440
+ "0"
441
+ ],
442
+ [
443
+ "eg",
444
+ // Egypt
445
+ "20",
446
+ 0,
447
+ null,
448
+ "0"
449
+ ],
450
+ [
451
+ "sv",
452
+ // El Salvador
453
+ "503"
454
+ ],
455
+ [
456
+ "gq",
457
+ // Equatorial Guinea
458
+ "240"
459
+ ],
460
+ [
461
+ "er",
462
+ // Eritrea
463
+ "291",
464
+ 0,
465
+ null,
466
+ "0"
467
+ ],
468
+ [
469
+ "ee",
470
+ // Estonia
471
+ "372"
472
+ ],
473
+ [
474
+ "sz",
475
+ // Eswatini
476
+ "268"
477
+ ],
478
+ [
479
+ "et",
480
+ // Ethiopia
481
+ "251",
482
+ 0,
483
+ null,
484
+ "0"
485
+ ],
486
+ [
487
+ "fk",
488
+ // Falkland Islands (Malvinas)
489
+ "500"
490
+ ],
491
+ [
492
+ "fo",
493
+ // Faroe Islands
494
+ "298"
495
+ ],
496
+ [
497
+ "fj",
498
+ // Fiji
499
+ "679"
500
+ ],
501
+ [
502
+ "fi",
503
+ // Finland
504
+ "358",
505
+ 0,
506
+ ["4"],
507
+ // (mobile range shared with AX)
508
+ "0"
509
+ ],
510
+ [
511
+ "fr",
512
+ // France
513
+ "33",
514
+ 0,
515
+ null,
516
+ "0"
517
+ ],
518
+ [
519
+ "gf",
520
+ // French Guiana
521
+ "594",
522
+ 0,
523
+ null,
524
+ "0"
525
+ ],
526
+ [
527
+ "pf",
528
+ // French Polynesia
529
+ "689"
530
+ ],
531
+ [
532
+ "ga",
533
+ // Gabon
534
+ "241"
535
+ ],
536
+ [
537
+ "gm",
538
+ // Gambia
539
+ "220"
540
+ ],
541
+ [
542
+ "ge",
543
+ // Georgia
544
+ "995",
545
+ 0,
546
+ null,
547
+ "0"
548
+ ],
549
+ [
550
+ "de",
551
+ // Germany
552
+ "49",
553
+ 0,
554
+ null,
555
+ "0"
556
+ ],
557
+ [
558
+ "gh",
559
+ // Ghana
560
+ "233",
561
+ 0,
562
+ null,
563
+ "0"
564
+ ],
565
+ [
566
+ "gi",
567
+ // Gibraltar
568
+ "350"
569
+ ],
570
+ [
571
+ "gr",
572
+ // Greece
573
+ "30"
574
+ ],
575
+ [
576
+ "gl",
577
+ // Greenland
578
+ "299"
579
+ ],
580
+ [
581
+ "gd",
582
+ // Grenada
583
+ "1",
584
+ 14,
585
+ ["473"],
586
+ "1"
587
+ ],
588
+ [
589
+ "gp",
590
+ // Guadeloupe
591
+ "590",
592
+ 0,
593
+ null,
594
+ "0"
595
+ ],
596
+ [
597
+ "gu",
598
+ // Guam
599
+ "1",
600
+ 15,
601
+ ["671"],
602
+ "1"
603
+ ],
604
+ [
605
+ "gt",
606
+ // Guatemala
607
+ "502"
608
+ ],
609
+ [
610
+ "gg",
611
+ // Guernsey
612
+ "44",
613
+ 1,
614
+ ["1481", "7781", "7839", "7911"],
615
+ "0"
616
+ ],
617
+ [
618
+ "gn",
619
+ // Guinea
620
+ "224"
621
+ ],
622
+ [
623
+ "gw",
624
+ // Guinea-Bissau
625
+ "245"
626
+ ],
627
+ [
628
+ "gy",
629
+ // Guyana
630
+ "592"
631
+ ],
632
+ [
633
+ "ht",
634
+ // Haiti
635
+ "509"
636
+ ],
637
+ [
638
+ "hn",
639
+ // Honduras
640
+ "504"
641
+ ],
642
+ [
643
+ "hk",
644
+ // Hong Kong SAR China
645
+ "852"
646
+ ],
647
+ [
648
+ "hu",
649
+ // Hungary
650
+ "36",
651
+ 0,
652
+ null,
653
+ "06"
654
+ ],
655
+ [
656
+ "is",
657
+ // Iceland
658
+ "354"
659
+ ],
660
+ [
661
+ "in",
662
+ // India
663
+ "91",
664
+ 0,
665
+ null,
666
+ "0"
667
+ ],
668
+ [
669
+ "id",
670
+ // Indonesia
671
+ "62",
672
+ 0,
673
+ null,
674
+ "0"
675
+ ],
676
+ [
677
+ "ir",
678
+ // Iran
679
+ "98",
680
+ 0,
681
+ null,
682
+ "0"
683
+ ],
684
+ [
685
+ "iq",
686
+ // Iraq
687
+ "964",
688
+ 0,
689
+ null,
690
+ "0"
691
+ ],
692
+ [
693
+ "ie",
694
+ // Ireland
695
+ "353",
696
+ 0,
697
+ null,
698
+ "0"
699
+ ],
700
+ [
701
+ "im",
702
+ // Isle of Man
703
+ "44",
704
+ 2,
705
+ ["1624", "74576", "7524", "7624", "7924"],
706
+ "0"
707
+ ],
708
+ [
709
+ "il",
710
+ // Israel
711
+ "972",
712
+ 0,
713
+ null,
714
+ "0"
715
+ ],
716
+ [
717
+ "it",
718
+ // Italy
719
+ "39",
720
+ 0,
721
+ ["3"]
722
+ // (mobile range shared with VA)
723
+ ],
724
+ [
725
+ "jm",
726
+ // Jamaica
727
+ "1",
728
+ 4,
729
+ ["658", "876"],
730
+ "1"
731
+ ],
732
+ [
733
+ "jp",
734
+ // Japan
735
+ "81",
736
+ 0,
737
+ null,
738
+ "0"
739
+ ],
740
+ [
741
+ "je",
742
+ // Jersey
743
+ "44",
744
+ 3,
745
+ ["1534", "7509", "7700", "7797", "7829", "7937"],
746
+ "0"
747
+ ],
748
+ [
749
+ "jo",
750
+ // Jordan
751
+ "962",
752
+ 0,
753
+ null,
754
+ "0"
755
+ ],
756
+ [
757
+ "kz",
758
+ // Kazakhstan
759
+ "7",
760
+ 1,
761
+ ["33", "7"],
762
+ // (33 is shared with RU)
763
+ "8"
764
+ ],
765
+ [
766
+ "ke",
767
+ // Kenya
768
+ "254",
769
+ 0,
770
+ null,
771
+ "0"
772
+ ],
773
+ [
774
+ "ki",
775
+ // Kiribati
776
+ "686",
777
+ 0,
778
+ null,
779
+ "0"
780
+ ],
781
+ [
782
+ "xk",
783
+ // Kosovo
784
+ "383",
785
+ 0,
786
+ null,
787
+ "0"
788
+ ],
789
+ [
790
+ "kw",
791
+ // Kuwait
792
+ "965"
793
+ ],
794
+ [
795
+ "kg",
796
+ // Kyrgyzstan
797
+ "996",
798
+ 0,
799
+ null,
800
+ "0"
801
+ ],
802
+ [
803
+ "la",
804
+ // Laos
805
+ "856",
806
+ 0,
807
+ null,
808
+ "0"
809
+ ],
810
+ [
811
+ "lv",
812
+ // Latvia
813
+ "371"
814
+ ],
815
+ [
816
+ "lb",
817
+ // Lebanon
818
+ "961",
819
+ 0,
820
+ null,
821
+ "0"
822
+ ],
823
+ [
824
+ "ls",
825
+ // Lesotho
826
+ "266"
827
+ ],
828
+ [
829
+ "lr",
830
+ // Liberia
831
+ "231",
832
+ 0,
833
+ null,
834
+ "0"
835
+ ],
836
+ [
837
+ "ly",
838
+ // Libya
839
+ "218",
840
+ 0,
841
+ null,
842
+ "0"
843
+ ],
844
+ [
845
+ "li",
846
+ // Liechtenstein
847
+ "423",
848
+ 0,
849
+ null,
850
+ "0"
851
+ ],
852
+ [
853
+ "lt",
854
+ // Lithuania
855
+ "370",
856
+ 0,
857
+ null,
858
+ "0"
859
+ ],
860
+ [
861
+ "lu",
862
+ // Luxembourg
863
+ "352"
864
+ ],
865
+ [
866
+ "mo",
867
+ // Macao SAR China
868
+ "853"
869
+ ],
870
+ [
871
+ "mg",
872
+ // Madagascar
873
+ "261",
874
+ 0,
875
+ null,
876
+ "0"
877
+ ],
878
+ [
879
+ "mw",
880
+ // Malawi
881
+ "265",
882
+ 0,
883
+ null,
884
+ "0"
885
+ ],
886
+ [
887
+ "my",
888
+ // Malaysia
889
+ "60",
890
+ 0,
891
+ null,
892
+ "0"
893
+ ],
894
+ [
895
+ "mv",
896
+ // Maldives
897
+ "960"
898
+ ],
899
+ [
900
+ "ml",
901
+ // Mali
902
+ "223"
903
+ ],
904
+ [
905
+ "mt",
906
+ // Malta
907
+ "356"
908
+ ],
909
+ [
910
+ "mh",
911
+ // Marshall Islands
912
+ "692",
913
+ 0,
914
+ null,
915
+ "1"
916
+ ],
917
+ [
918
+ "mq",
919
+ // Martinique
920
+ "596",
921
+ 0,
922
+ null,
923
+ "0"
924
+ ],
925
+ [
926
+ "mr",
927
+ // Mauritania
928
+ "222"
929
+ ],
930
+ [
931
+ "mu",
932
+ // Mauritius
933
+ "230"
934
+ ],
935
+ [
936
+ "yt",
937
+ // Mayotte
938
+ "262",
939
+ 1,
940
+ ["269", "639"],
941
+ "0"
942
+ ],
943
+ [
944
+ "mx",
945
+ // Mexico
946
+ "52"
947
+ ],
948
+ [
949
+ "fm",
950
+ // Micronesia
951
+ "691"
952
+ ],
953
+ [
954
+ "md",
955
+ // Moldova
956
+ "373",
957
+ 0,
958
+ null,
959
+ "0"
960
+ ],
961
+ [
962
+ "mc",
963
+ // Monaco
964
+ "377",
965
+ 0,
966
+ null,
967
+ "0"
968
+ ],
969
+ [
970
+ "mn",
971
+ // Mongolia
972
+ "976",
973
+ 0,
974
+ null,
975
+ "0"
976
+ ],
977
+ [
978
+ "me",
979
+ // Montenegro
980
+ "382",
981
+ 0,
982
+ null,
983
+ "0"
984
+ ],
985
+ [
986
+ "ms",
987
+ // Montserrat
988
+ "1",
989
+ 16,
990
+ ["664"],
991
+ "1"
992
+ ],
993
+ [
994
+ "ma",
995
+ // Morocco
996
+ "212",
997
+ 0,
998
+ ["6", "7"],
999
+ // (mobile ranges shared with EH)
1000
+ "0"
1001
+ ],
1002
+ [
1003
+ "mz",
1004
+ // Mozambique
1005
+ "258"
1006
+ ],
1007
+ [
1008
+ "mm",
1009
+ // Myanmar (Burma)
1010
+ "95",
1011
+ 0,
1012
+ null,
1013
+ "0"
1014
+ ],
1015
+ [
1016
+ "na",
1017
+ // Namibia
1018
+ "264",
1019
+ 0,
1020
+ null,
1021
+ "0"
1022
+ ],
1023
+ [
1024
+ "nr",
1025
+ // Nauru
1026
+ "674"
1027
+ ],
1028
+ [
1029
+ "np",
1030
+ // Nepal
1031
+ "977",
1032
+ 0,
1033
+ null,
1034
+ "0"
1035
+ ],
1036
+ [
1037
+ "nl",
1038
+ // Netherlands
1039
+ "31",
1040
+ 0,
1041
+ null,
1042
+ "0"
1043
+ ],
1044
+ [
1045
+ "nc",
1046
+ // New Caledonia
1047
+ "687"
1048
+ ],
1049
+ [
1050
+ "nz",
1051
+ // New Zealand
1052
+ "64",
1053
+ 0,
1054
+ null,
1055
+ "0"
1056
+ ],
1057
+ [
1058
+ "ni",
1059
+ // Nicaragua
1060
+ "505"
1061
+ ],
1062
+ [
1063
+ "ne",
1064
+ // Niger
1065
+ "227"
1066
+ ],
1067
+ [
1068
+ "ng",
1069
+ // Nigeria
1070
+ "234",
1071
+ 0,
1072
+ null,
1073
+ "0"
1074
+ ],
1075
+ [
1076
+ "nu",
1077
+ // Niue
1078
+ "683"
1079
+ ],
1080
+ [
1081
+ "nf",
1082
+ // Norfolk Island
1083
+ "672"
1084
+ ],
1085
+ [
1086
+ "kp",
1087
+ // North Korea
1088
+ "850",
1089
+ 0,
1090
+ null,
1091
+ "0"
1092
+ ],
1093
+ [
1094
+ "mk",
1095
+ // North Macedonia
1096
+ "389",
1097
+ 0,
1098
+ null,
1099
+ "0"
1100
+ ],
1101
+ [
1102
+ "mp",
1103
+ // Northern Mariana Islands
1104
+ "1",
1105
+ 17,
1106
+ ["670"],
1107
+ "1"
1108
+ ],
1109
+ [
1110
+ "no",
1111
+ // Norway
1112
+ "47",
1113
+ 0,
1114
+ ["4", "9"]
1115
+ // (mobile ranges shared with SJ)
1116
+ ],
1117
+ [
1118
+ "om",
1119
+ // Oman
1120
+ "968"
1121
+ ],
1122
+ [
1123
+ "pk",
1124
+ // Pakistan
1125
+ "92",
1126
+ 0,
1127
+ null,
1128
+ "0"
1129
+ ],
1130
+ [
1131
+ "pw",
1132
+ // Palau
1133
+ "680"
1134
+ ],
1135
+ [
1136
+ "ps",
1137
+ // Palestinian Territories
1138
+ "970",
1139
+ 0,
1140
+ null,
1141
+ "0"
1142
+ ],
1143
+ [
1144
+ "pa",
1145
+ // Panama
1146
+ "507"
1147
+ ],
1148
+ [
1149
+ "pg",
1150
+ // Papua New Guinea
1151
+ "675"
1152
+ ],
1153
+ [
1154
+ "py",
1155
+ // Paraguay
1156
+ "595",
1157
+ 0,
1158
+ null,
1159
+ "0"
1160
+ ],
1161
+ [
1162
+ "pe",
1163
+ // Peru
1164
+ "51",
1165
+ 0,
1166
+ null,
1167
+ "0"
1168
+ ],
1169
+ [
1170
+ "ph",
1171
+ // Philippines
1172
+ "63",
1173
+ 0,
1174
+ null,
1175
+ "0"
1176
+ ],
1177
+ [
1178
+ "pl",
1179
+ // Poland
1180
+ "48"
1181
+ ],
1182
+ [
1183
+ "pt",
1184
+ // Portugal
1185
+ "351"
1186
+ ],
1187
+ [
1188
+ "pr",
1189
+ // Puerto Rico
1190
+ "1",
1191
+ 3,
1192
+ ["787", "939"],
1193
+ "1"
1194
+ ],
1195
+ [
1196
+ "qa",
1197
+ // Qatar
1198
+ "974"
1199
+ ],
1200
+ [
1201
+ "re",
1202
+ // Réunion
1203
+ "262",
1204
+ 0,
1205
+ null,
1206
+ "0"
1207
+ ],
1208
+ [
1209
+ "ro",
1210
+ // Romania
1211
+ "40",
1212
+ 0,
1213
+ null,
1214
+ "0"
1215
+ ],
1216
+ [
1217
+ "ru",
1218
+ // Russia
1219
+ "7",
1220
+ 0,
1221
+ ["33"],
1222
+ // (shared with KZ)
1223
+ "8"
1224
+ ],
1225
+ [
1226
+ "rw",
1227
+ // Rwanda
1228
+ "250",
1229
+ 0,
1230
+ null,
1231
+ "0"
1232
+ ],
1233
+ [
1234
+ "ws",
1235
+ // Samoa
1236
+ "685"
1237
+ ],
1238
+ [
1239
+ "sm",
1240
+ // San Marino
1241
+ "378"
1242
+ ],
1243
+ [
1244
+ "st",
1245
+ // São Tomé & Príncipe
1246
+ "239"
1247
+ ],
1248
+ [
1249
+ "sa",
1250
+ // Saudi Arabia
1251
+ "966",
1252
+ 0,
1253
+ null,
1254
+ "0"
1255
+ ],
1256
+ [
1257
+ "sn",
1258
+ // Senegal
1259
+ "221"
1260
+ ],
1261
+ [
1262
+ "rs",
1263
+ // Serbia
1264
+ "381",
1265
+ 0,
1266
+ null,
1267
+ "0"
1268
+ ],
1269
+ [
1270
+ "sc",
1271
+ // Seychelles
1272
+ "248"
1273
+ ],
1274
+ [
1275
+ "sl",
1276
+ // Sierra Leone
1277
+ "232",
1278
+ 0,
1279
+ null,
1280
+ "0"
1281
+ ],
1282
+ [
1283
+ "sg",
1284
+ // Singapore
1285
+ "65"
1286
+ ],
1287
+ [
1288
+ "sx",
1289
+ // Sint Maarten
1290
+ "1",
1291
+ 21,
1292
+ ["721"],
1293
+ "1"
1294
+ ],
1295
+ [
1296
+ "sk",
1297
+ // Slovakia
1298
+ "421",
1299
+ 0,
1300
+ null,
1301
+ "0"
1302
+ ],
1303
+ [
1304
+ "si",
1305
+ // Slovenia
1306
+ "386",
1307
+ 0,
1308
+ null,
1309
+ "0"
1310
+ ],
1311
+ [
1312
+ "sb",
1313
+ // Solomon Islands
1314
+ "677"
1315
+ ],
1316
+ [
1317
+ "so",
1318
+ // Somalia
1319
+ "252",
1320
+ 0,
1321
+ null,
1322
+ "0"
1323
+ ],
1324
+ [
1325
+ "za",
1326
+ // South Africa
1327
+ "27",
1328
+ 0,
1329
+ null,
1330
+ "0"
1331
+ ],
1332
+ [
1333
+ "kr",
1334
+ // South Korea
1335
+ "82",
1336
+ 0,
1337
+ null,
1338
+ "0"
1339
+ ],
1340
+ [
1341
+ "ss",
1342
+ // South Sudan
1343
+ "211",
1344
+ 0,
1345
+ null,
1346
+ "0"
1347
+ ],
1348
+ [
1349
+ "es",
1350
+ // Spain
1351
+ "34"
1352
+ ],
1353
+ [
1354
+ "lk",
1355
+ // Sri Lanka
1356
+ "94",
1357
+ 0,
1358
+ null,
1359
+ "0"
1360
+ ],
1361
+ [
1362
+ "bl",
1363
+ // St. Barthélemy
1364
+ "590",
1365
+ 1,
1366
+ null,
1367
+ "0"
1368
+ ],
1369
+ [
1370
+ "sh",
1371
+ // St. Helena
1372
+ "290"
1373
+ ],
1374
+ [
1375
+ "kn",
1376
+ // St. Kitts & Nevis
1377
+ "1",
1378
+ 18,
1379
+ ["869"],
1380
+ "1"
1381
+ ],
1382
+ [
1383
+ "lc",
1384
+ // St. Lucia
1385
+ "1",
1386
+ 19,
1387
+ ["758"],
1388
+ "1"
1389
+ ],
1390
+ [
1391
+ "mf",
1392
+ // St. Martin
1393
+ "590",
1394
+ 2,
1395
+ null,
1396
+ "0"
1397
+ ],
1398
+ [
1399
+ "pm",
1400
+ // St. Pierre & Miquelon
1401
+ "508",
1402
+ 0,
1403
+ null,
1404
+ "0"
1405
+ ],
1406
+ [
1407
+ "vc",
1408
+ // St. Vincent & Grenadines
1409
+ "1",
1410
+ 20,
1411
+ ["784"],
1412
+ "1"
1413
+ ],
1414
+ [
1415
+ "sd",
1416
+ // Sudan
1417
+ "249",
1418
+ 0,
1419
+ null,
1420
+ "0"
1421
+ ],
1422
+ [
1423
+ "sr",
1424
+ // Suriname
1425
+ "597"
1426
+ ],
1427
+ [
1428
+ "sj",
1429
+ // Svalbard & Jan Mayen
1430
+ "47",
1431
+ 1,
1432
+ ["4", "79", "9"]
1433
+ // (4 and 9 are mobile ranges shared with NO)
1434
+ ],
1435
+ [
1436
+ "se",
1437
+ // Sweden
1438
+ "46",
1439
+ 0,
1440
+ null,
1441
+ "0"
1442
+ ],
1443
+ [
1444
+ "ch",
1445
+ // Switzerland
1446
+ "41",
1447
+ 0,
1448
+ null,
1449
+ "0"
1450
+ ],
1451
+ [
1452
+ "sy",
1453
+ // Syria
1454
+ "963",
1455
+ 0,
1456
+ null,
1457
+ "0"
1458
+ ],
1459
+ [
1460
+ "tw",
1461
+ // Taiwan
1462
+ "886",
1463
+ 0,
1464
+ null,
1465
+ "0"
1466
+ ],
1467
+ [
1468
+ "tj",
1469
+ // Tajikistan
1470
+ "992"
1471
+ ],
1472
+ [
1473
+ "tz",
1474
+ // Tanzania
1475
+ "255",
1476
+ 0,
1477
+ null,
1478
+ "0"
1479
+ ],
1480
+ [
1481
+ "th",
1482
+ // Thailand
1483
+ "66",
1484
+ 0,
1485
+ null,
1486
+ "0"
1487
+ ],
1488
+ [
1489
+ "tl",
1490
+ // Timor-Leste
1491
+ "670"
1492
+ ],
1493
+ [
1494
+ "tg",
1495
+ // Togo
1496
+ "228"
1497
+ ],
1498
+ [
1499
+ "tk",
1500
+ // Tokelau
1501
+ "690"
1502
+ ],
1503
+ [
1504
+ "to",
1505
+ // Tonga
1506
+ "676"
1507
+ ],
1508
+ [
1509
+ "tt",
1510
+ // Trinidad & Tobago
1511
+ "1",
1512
+ 22,
1513
+ ["868"],
1514
+ "1"
1515
+ ],
1516
+ [
1517
+ "tn",
1518
+ // Tunisia
1519
+ "216"
1520
+ ],
1521
+ [
1522
+ "tr",
1523
+ // Turkey
1524
+ "90",
1525
+ 0,
1526
+ null,
1527
+ "0"
1528
+ ],
1529
+ [
1530
+ "tm",
1531
+ // Turkmenistan
1532
+ "993",
1533
+ 0,
1534
+ null,
1535
+ "8"
1536
+ ],
1537
+ [
1538
+ "tc",
1539
+ // Turks & Caicos Islands
1540
+ "1",
1541
+ 23,
1542
+ ["649"],
1543
+ "1"
1544
+ ],
1545
+ [
1546
+ "tv",
1547
+ // Tuvalu
1548
+ "688"
1549
+ ],
1550
+ [
1551
+ "vi",
1552
+ // U.S. Virgin Islands
1553
+ "1",
1554
+ 24,
1555
+ ["340"],
1556
+ "1"
1557
+ ],
1558
+ [
1559
+ "ug",
1560
+ // Uganda
1561
+ "256",
1562
+ 0,
1563
+ null,
1564
+ "0"
1565
+ ],
1566
+ [
1567
+ "ua",
1568
+ // Ukraine
1569
+ "380",
1570
+ 0,
1571
+ null,
1572
+ "0"
1573
+ ],
1574
+ [
1575
+ "ae",
1576
+ // United Arab Emirates
1577
+ "971",
1578
+ 0,
1579
+ null,
1580
+ "0"
1581
+ ],
1582
+ [
1583
+ "gb",
1584
+ // United Kingdom
1585
+ "44",
1586
+ 0,
1587
+ null,
1588
+ "0"
1589
+ ],
1590
+ [
1591
+ "us",
1592
+ // United States
1593
+ "1",
1594
+ 0,
1595
+ null,
1596
+ "1"
1597
+ ],
1598
+ [
1599
+ "uy",
1600
+ // Uruguay
1601
+ "598",
1602
+ 0,
1603
+ null,
1604
+ "0"
1605
+ ],
1606
+ [
1607
+ "uz",
1608
+ // Uzbekistan
1609
+ "998"
1610
+ ],
1611
+ [
1612
+ "vu",
1613
+ // Vanuatu
1614
+ "678"
1615
+ ],
1616
+ [
1617
+ "va",
1618
+ // Vatican City
1619
+ "39",
1620
+ 1,
1621
+ ["06698", "3"]
1622
+ // (3 is a mobile range shared with IT)
1623
+ ],
1624
+ [
1625
+ "ve",
1626
+ // Venezuela
1627
+ "58",
1628
+ 0,
1629
+ null,
1630
+ "0"
1631
+ ],
1632
+ [
1633
+ "vn",
1634
+ // Vietnam
1635
+ "84",
1636
+ 0,
1637
+ null,
1638
+ "0"
1639
+ ],
1640
+ [
1641
+ "wf",
1642
+ // Wallis & Futuna
1643
+ "681"
1644
+ ],
1645
+ [
1646
+ "eh",
1647
+ // Western Sahara
1648
+ "212",
1649
+ 1,
1650
+ ["5288", "5289", "6", "7"],
1651
+ // (6 and 7 are mobile ranges shared with MA)
1652
+ "0"
1653
+ ],
1654
+ [
1655
+ "ye",
1656
+ // Yemen
1657
+ "967",
1658
+ 0,
1659
+ null,
1660
+ "0"
1661
+ ],
1662
+ [
1663
+ "zm",
1664
+ // Zambia
1665
+ "260",
1666
+ 0,
1667
+ null,
1668
+ "0"
1669
+ ],
1670
+ [
1671
+ "zw",
1672
+ // Zimbabwe
1673
+ "263",
1674
+ 0,
1675
+ null,
1676
+ "0"
1677
+ ]
1678
+ ], A = [];
1679
+ for (const l of Y)
1680
+ A.push({
1681
+ name: "",
1682
+ // populated in the plugin
1683
+ iso2: l[0],
1684
+ dialCode: l[1],
1685
+ priority: l[2] || 0,
1686
+ areaCodes: l[3] || null,
1687
+ nodeById: {},
1688
+ // populated by the plugin
1689
+ nationalPrefix: l[4] || null,
1690
+ normalisedName: "",
1691
+ // populated in the plugin
1692
+ initials: "",
1693
+ // populated in the plugin
1694
+ dialCodePlus: ""
1695
+ // populated in the plugin
1696
+ });
1697
+ const S = {
1698
+ OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1699
+ CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1700
+ COUNTRY_CHANGE: "countrychange",
1701
+ INPUT: "input"
1702
+ // used for synthetic input trigger
1703
+ }, h = {
1704
+ HIDE: "iti__hide",
1705
+ V_HIDE: "iti__v-hide",
1706
+ ARROW_UP: "iti__arrow--up",
1707
+ GLOBE: "iti__globe",
1708
+ FLAG: "iti__flag",
1709
+ COUNTRY_ITEM: "iti__country",
1710
+ HIGHLIGHT: "iti__highlight"
1711
+ }, y = {
1712
+ ARROW_UP: "ArrowUp",
1713
+ ARROW_DOWN: "ArrowDown",
1714
+ SPACE: " ",
1715
+ ENTER: "Enter",
1716
+ ESC: "Escape",
1717
+ TAB: "Tab"
1718
+ }, B = {
1719
+ PASTE: "insertFromPaste",
1720
+ DELETE_FWD: "deleteContentForward"
1721
+ }, E = {
1722
+ ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
1723
+ // any kind of letter from any language
1724
+ NON_PLUS_NUMERIC: /[^+0-9]/,
1725
+ // chars that are NOT + or digit
1726
+ NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
1727
+ // chars that are NOT + or digit (global)
1728
+ HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1729
+ // single acceptable hidden-search char
1730
+ }, q = {
1731
+ HIDDEN_SEARCH_RESET_MS: 1e3
1732
+ }, F = {
1733
+ UNKNOWN_NUMBER_TYPE: -99,
1734
+ UNKNOWN_VALIDATION_ERROR: -99
1735
+ }, O = {
1736
+ SANE_SELECTED_WITH_DIAL_WIDTH: 78,
1737
+ // px width fallback when separateDialCode enabled
1738
+ SANE_SELECTED_NO_DIAL_WIDTH: 42,
1739
+ // px width fallback when no separate dial code
1740
+ INPUT_PADDING_EXTRA_LEFT: 6
1741
+ // px gap between selected country container and input text
1742
+ }, G = {
1743
+ NANP: "1"
1744
+ // North American Numbering Plan
1745
+ }, R = {
1746
+ DIAL_CODE: "44",
1747
+ // +44 United Kingdom
1748
+ MOBILE_PREFIX: "7",
1749
+ // UK mobile numbers start with 7 after national trunk (0) or core section
1750
+ MOBILE_CORE_LENGTH: 10
1751
+ // core number length (excluding dial code / national prefix) for mobiles
1752
+ }, X = {
1753
+ ISO2: "us"
1754
+ }, k = {
1755
+ AGGRESSIVE: "aggressive",
1756
+ POLITE: "polite"
1757
+ }, x = {
1758
+ AUTO: "auto"
1759
+ }, V = {
1760
+ COUNTRY_CODE: "countryCode",
1761
+ DIAL_CODE: "dialCode"
1762
+ }, p = {
1763
+ EXPANDED: "aria-expanded",
1764
+ LABEL: "aria-label",
1765
+ SELECTED: "aria-selected",
1766
+ ACTIVE_DESCENDANT: "aria-activedescendant",
1767
+ HASPOPUP: "aria-haspopup",
1768
+ CONTROLS: "aria-controls",
1769
+ HIDDEN: "aria-hidden",
1770
+ AUTOCOMPLETE: "aria-autocomplete",
1771
+ MODAL: "aria-modal"
1772
+ }, Q = {
1773
+ selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1774
+ noCountrySelected: "Select country",
1775
+ countryListAriaLabel: "List of countries",
1776
+ searchPlaceholder: "Search",
1777
+ clearSearchAriaLabel: "Clear search",
1778
+ zeroSearchResults: "No results found",
1779
+ oneSearchResult: "1 result found",
1780
+ multipleSearchResults: "${count} results found"
1781
+ }, U = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, Z = () => {
1782
+ if (typeof navigator < "u" && typeof window < "u") {
1783
+ const l = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
1784
+ navigator.userAgent
1785
+ ), t = U("(max-width: 500px)"), e = U("(max-height: 600px)"), s = U("(pointer: coarse)");
1786
+ return l || t || s && e;
1787
+ }
1788
+ return !1;
1789
+ }, z = {
1790
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1791
+ allowPhonewords: !1,
1792
+ //* Whether or not to allow the dropdown.
1793
+ allowDropdown: !0,
1794
+ //* Add a placeholder in the input with an example number for the selected country.
1795
+ autoPlaceholder: k.POLITE,
1796
+ //* Modify the parentClass.
1797
+ containerClass: "",
1798
+ //* Locale for localising country names via Intl.DisplayNames.
1799
+ countryNameLocale: "en",
1800
+ //* The order of the countries in the dropdown. Defaults to alphabetical.
1801
+ countryOrder: null,
1802
+ //* Add a country search input at the top of the dropdown.
1803
+ countrySearch: !0,
1804
+ //* Modify the auto placeholder.
1805
+ customPlaceholder: null,
1806
+ //* Append menu to specified element.
1807
+ dropdownContainer: null,
1808
+ //* Don't display these countries.
1809
+ excludeCountries: [],
1810
+ //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
1811
+ fixDropdownWidth: !0,
1812
+ //* Format the number as the user types
1813
+ formatAsYouType: !0,
1814
+ //* Format the input value during initialisation and on setNumber.
1815
+ formatOnDisplay: !0,
1816
+ //* geoIp lookup function.
1817
+ geoIpLookup: null,
1818
+ //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
1819
+ hiddenInput: null,
1820
+ //* Internationalise the plugin text e.g. search input placeholder, country names.
1821
+ i18n: {},
1822
+ //* Initial country.
1823
+ initialCountry: "",
1824
+ //* A function to load the utils script.
1825
+ loadUtils: null,
1826
+ //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
1827
+ nationalMode: !0,
1828
+ //* Display only these countries.
1829
+ onlyCountries: [],
1830
+ //* Number type to use for placeholders.
1831
+ placeholderNumberType: "MOBILE",
1832
+ //* Show flags - for both the selected country, and in the country dropdown
1833
+ showFlags: !0,
1834
+ //* Display the international dial code next to the selected flag.
1835
+ separateDialCode: !1,
1836
+ //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
1837
+ strictMode: !1,
1838
+ //* Use full screen popup instead of dropdown for country list.
1839
+ useFullscreenPopup: Z(),
1840
+ //* The number type to enforce during validation.
1841
+ validationNumberTypes: ["MOBILE"]
1842
+ }, J = (l) => {
1843
+ l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...Q, ...l.i18n };
1844
+ }, P = (l) => l.replace(/\D/g, ""), j = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), tt = (l, t) => {
1845
+ const e = j(t), s = [], i = [], o = [], n = [], r = [], a = [];
1846
+ for (const d of l)
1847
+ d.iso2 === e ? s.push(d) : d.normalisedName.startsWith(e) ? i.push(d) : d.normalisedName.includes(e) ? o.push(d) : e === d.dialCode || e === d.dialCodePlus ? n.push(d) : d.dialCodePlus.includes(e) ? r.push(d) : d.initials.includes(e) && a.push(d);
1848
+ const c = (d, m) => d.priority - m.priority;
1849
+ return [
1850
+ ...s.sort(c),
1851
+ ...i.sort(c),
1852
+ ...o.sort(c),
1853
+ ...n.sort(c),
1854
+ ...r.sort(c),
1855
+ ...a.sort(c)
1856
+ ];
1857
+ }, et = (l, t) => {
1858
+ const e = t.toLowerCase();
1859
+ for (const s of l)
1860
+ if (s.name.toLowerCase().startsWith(e))
1861
+ return s;
1862
+ return null;
1863
+ }, H = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), C = (l, t, e) => {
1864
+ const s = document.createElement(l);
1865
+ return t && Object.entries(t).forEach(
1866
+ ([i, o]) => s.setAttribute(i, o)
1867
+ ), e && e.appendChild(s), s;
1868
+ }, st = () => `
1869
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
1870
+ <circle cx="11" cy="11" r="7" />
1871
+ <line x1="21" y1="21" x2="16.65" y2="16.65" />
1872
+ </svg>`, it = (l) => {
1873
+ const t = `iti-${l}-clear-mask`;
1874
+ return `
1875
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
1876
+ <mask id="${t}" maskUnits="userSpaceOnUse">
1877
+ <rect width="16" height="16" fill="white" />
1878
+ <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
1879
+ </mask>
1880
+ <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
1881
+ </svg>`;
1882
+ }, nt = () => `
1883
+ <svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
1884
+ <path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
1885
+ <path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
1886
+ </svg>`;
1887
+ class ot {
1888
+ constructor(t, e, s) {
1889
+ this.highlightedItem = null, this.selectedItem = null, t.dataset.intlTelInputId = s.toString(), this.telInput = t, this.options = e, this.id = s, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
1890
+ }
1891
+ //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
1892
+ generateMarkup(t) {
1893
+ this.countries = t, this._prepareTelInput();
1894
+ const e = this._createWrapperAndInsert();
1895
+ this._maybeBuildCountryContainer(e), e.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(e);
1896
+ }
1897
+ _prepareTelInput() {
1898
+ var t;
1899
+ this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((t = this.telInput.form) != null && t.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
1900
+ }
1901
+ _createWrapperAndInsert() {
1902
+ const { allowDropdown: t, showFlags: e, containerClass: s, useFullscreenPopup: i } = this.options, o = H({
1903
+ iti: !0,
1904
+ "iti--allow-dropdown": t,
1905
+ "iti--show-flags": e,
1906
+ "iti--inline-dropdown": !i,
1907
+ [s]: !!s
1908
+ }), n = C("div", { class: o });
1909
+ return this.isRTL && n.setAttribute("dir", "ltr"), this.telInput.before(n), n;
1910
+ }
1911
+ _maybeBuildCountryContainer(t) {
1912
+ const { allowDropdown: e, separateDialCode: s, showFlags: i } = this.options;
1913
+ if (e || i || s) {
1914
+ this.countryContainer = C(
1915
+ "div",
1916
+ // visibly hidden until we measure it's width to set the input padding correctly
1917
+ { class: `iti__country-container ${h.V_HIDE}` },
1918
+ t
1919
+ ), e ? (this.selectedCountry = C(
1920
+ "button",
1921
+ {
1922
+ type: "button",
1923
+ class: "iti__selected-country",
1924
+ [p.EXPANDED]: "false",
1925
+ [p.LABEL]: this.options.i18n.noCountrySelected,
1926
+ [p.HASPOPUP]: "dialog",
1927
+ [p.CONTROLS]: `iti-${this.id}__dropdown-content`
1928
+ },
1929
+ this.countryContainer
1930
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = C(
1931
+ "div",
1932
+ { class: "iti__selected-country" },
1933
+ this.countryContainer
1934
+ );
1935
+ const o = C(
1936
+ "div",
1937
+ { class: "iti__selected-country-primary" },
1938
+ this.selectedCountry
1939
+ );
1940
+ this.selectedCountryInner = C(
1941
+ "div",
1942
+ { class: h.FLAG },
1943
+ o
1944
+ ), e && (this.dropdownArrow = C(
1945
+ "div",
1946
+ { class: "iti__arrow", [p.HIDDEN]: "true" },
1947
+ o
1948
+ )), s && (this.selectedDialCode = C(
1949
+ "div",
1950
+ { class: "iti__selected-dial-code" },
1951
+ this.selectedCountry
1952
+ )), e && this._buildDropdownContent();
1953
+ }
1954
+ }
1955
+ _buildDropdownContent() {
1956
+ const {
1957
+ fixDropdownWidth: t,
1958
+ useFullscreenPopup: e,
1959
+ countrySearch: s,
1960
+ i18n: i,
1961
+ dropdownContainer: o,
1962
+ containerClass: n
1963
+ } = this.options, r = t ? "" : "iti--flexible-dropdown-width";
1964
+ if (this.dropdownContent = C("div", {
1965
+ id: `iti-${this.id}__dropdown-content`,
1966
+ class: `iti__dropdown-content ${h.HIDE} ${r}`,
1967
+ role: "dialog",
1968
+ [p.MODAL]: "true"
1969
+ }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), s && this._buildSearchUI(), this.countryList = C(
1970
+ "ul",
1971
+ {
1972
+ class: "iti__country-list",
1973
+ id: `iti-${this.id}__country-listbox`,
1974
+ role: "listbox",
1975
+ [p.LABEL]: i.countryListAriaLabel
1976
+ },
1977
+ this.dropdownContent
1978
+ ), this._appendListItems(), s && this.updateSearchResultsA11yText(), o) {
1979
+ const a = H({
1980
+ iti: !0,
1981
+ "iti--container": !0,
1982
+ "iti--fullscreen-popup": e,
1983
+ "iti--inline-dropdown": !e,
1984
+ [n]: !!n
1985
+ });
1986
+ this.dropdown = C("div", { class: a }), this.dropdown.appendChild(this.dropdownContent);
1987
+ } else
1988
+ this.countryContainer.appendChild(this.dropdownContent);
1989
+ }
1990
+ _buildSearchUI() {
1991
+ const { i18n: t } = this.options, e = C(
1992
+ "div",
1993
+ { class: "iti__search-input-wrapper" },
1994
+ this.dropdownContent
1995
+ );
1996
+ this.searchIcon = C(
1997
+ "span",
1998
+ {
1999
+ class: "iti__search-icon",
2000
+ [p.HIDDEN]: "true"
2001
+ },
2002
+ e
2003
+ ), this.searchIcon.innerHTML = st(), this.searchInput = C(
2004
+ "input",
2005
+ {
2006
+ id: `iti-${this.id}__search-input`,
2007
+ // Chrome says inputs need either a name or an id
2008
+ type: "search",
2009
+ class: "iti__search-input",
2010
+ placeholder: t.searchPlaceholder,
2011
+ // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2012
+ role: "combobox",
2013
+ [p.EXPANDED]: "true",
2014
+ [p.LABEL]: t.searchPlaceholder,
2015
+ [p.CONTROLS]: `iti-${this.id}__country-listbox`,
2016
+ [p.AUTOCOMPLETE]: "list",
2017
+ autocomplete: "off"
2018
+ },
2019
+ e
2020
+ ), this.searchClearButton = C(
2021
+ "button",
2022
+ {
2023
+ type: "button",
2024
+ class: `iti__search-clear ${h.HIDE}`,
2025
+ [p.LABEL]: t.clearSearchAriaLabel,
2026
+ tabindex: "-1"
2027
+ },
2028
+ e
2029
+ ), this.searchClearButton.innerHTML = it(this.id), this.searchResultsA11yText = C(
2030
+ "span",
2031
+ { class: "iti__a11y-text" },
2032
+ this.dropdownContent
2033
+ ), this.searchNoResults = C(
2034
+ "div",
2035
+ {
2036
+ class: `iti__no-results ${h.HIDE}`,
2037
+ [p.HIDDEN]: "true"
2038
+ // all a11y messaging happens in this.searchResultsA11yText
2039
+ },
2040
+ this.dropdownContent
2041
+ ), this.searchNoResults.textContent = t.zeroSearchResults;
2042
+ }
2043
+ _maybeUpdateInputPaddingAndReveal() {
2044
+ this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(h.V_HIDE));
2045
+ }
2046
+ _maybeBuildHiddenInputs(t) {
2047
+ var s, i;
2048
+ const { hiddenInput: e } = this.options;
2049
+ if (e) {
2050
+ const o = this.telInput.getAttribute("name") || "", n = e(o);
2051
+ if (n.phone) {
2052
+ const r = (s = this.telInput.form) == null ? void 0 : s.querySelector(
2053
+ `input[name="${n.phone}"]`
2054
+ );
2055
+ r ? this.hiddenInput = r : (this.hiddenInput = C("input", {
2056
+ type: "hidden",
2057
+ name: n.phone
2058
+ }), t.appendChild(this.hiddenInput));
2059
+ }
2060
+ if (n.country) {
2061
+ const r = (i = this.telInput.form) == null ? void 0 : i.querySelector(
2062
+ `input[name="${n.country}"]`
2063
+ );
2064
+ r ? this.hiddenInputCountry = r : (this.hiddenInputCountry = C("input", {
2065
+ type: "hidden",
2066
+ name: n.country
2067
+ }), t.appendChild(this.hiddenInputCountry));
2068
+ }
2069
+ }
2070
+ }
2071
+ //* For each country: add a country list item <li> to the countryList <ul> container.
2072
+ _appendListItems() {
2073
+ const t = document.createDocumentFragment();
2074
+ for (let e = 0; e < this.countries.length; e++) {
2075
+ const s = this.countries[e], i = H({
2076
+ [h.COUNTRY_ITEM]: !0
2077
+ }), o = C("li", {
2078
+ id: `iti-${this.id}__item-${s.iso2}`,
2079
+ class: i,
2080
+ tabindex: "-1",
2081
+ role: "option",
2082
+ [p.SELECTED]: "false"
2083
+ });
2084
+ o.dataset.dialCode = s.dialCode, o.dataset.countryCode = s.iso2, s.nodeById[this.id] = o, this.options.showFlags && C("div", { class: `${h.FLAG} iti__${s.iso2}` }, o);
2085
+ const n = C("span", { class: "iti__country-name" }, o);
2086
+ n.textContent = s.name;
2087
+ const r = C("span", { class: "iti__dial-code" }, o);
2088
+ this.isRTL && r.setAttribute("dir", "ltr"), r.textContent = `+${s.dialCode}`, t.appendChild(o);
2089
+ }
2090
+ this.countryList.appendChild(t);
2091
+ }
2092
+ //* Update the input padding to make space for the selected country/dial code.
2093
+ updateInputPadding() {
2094
+ if (this.selectedCountry) {
2095
+ const t = this.options.separateDialCode ? O.SANE_SELECTED_WITH_DIAL_WIDTH : O.SANE_SELECTED_NO_DIAL_WIDTH, s = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + O.INPUT_PADDING_EXTRA_LEFT;
2096
+ this.telInput.style.paddingLeft = `${s}px`;
2097
+ }
2098
+ }
2099
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2100
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2101
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2102
+ //* and then to inject a deep clone of the selectedCountry element.
2103
+ _getHiddenSelectedCountryWidth() {
2104
+ if (this.telInput.parentNode) {
2105
+ let t;
2106
+ try {
2107
+ t = window.top.document.body;
2108
+ } catch {
2109
+ t = document.body;
2110
+ }
2111
+ const e = this.telInput.parentNode.cloneNode(
2112
+ !1
2113
+ );
2114
+ e.style.visibility = "hidden", t.appendChild(e);
2115
+ const s = this.countryContainer.cloneNode();
2116
+ e.appendChild(s);
2117
+ const i = this.selectedCountry.cloneNode(
2118
+ !0
2119
+ );
2120
+ s.appendChild(i);
2121
+ const o = i.offsetWidth;
2122
+ return t.removeChild(e), o;
2123
+ }
2124
+ return 0;
2125
+ }
2126
+ //* Update search results text (for a11y).
2127
+ updateSearchResultsA11yText() {
2128
+ const { i18n: t } = this.options, e = this.countryList.childElementCount;
2129
+ let s;
2130
+ e === 0 ? s = t.zeroSearchResults : t.searchResultsText ? s = t.searchResultsText(e) : e === 1 ? s = t.oneSearchResult : s = t.multipleSearchResults.replace(
2131
+ "${count}",
2132
+ e.toString()
2133
+ ), this.searchResultsA11yText.textContent = s;
2134
+ }
2135
+ //* Check if an element is visible within it's container, else scroll until it is.
2136
+ scrollTo(t) {
2137
+ const e = this.countryList, s = document.documentElement.scrollTop, i = e.offsetHeight, o = e.getBoundingClientRect().top + s, n = o + i, r = t.offsetHeight, a = t.getBoundingClientRect().top + s, c = a + r, d = a - o + e.scrollTop;
2138
+ if (a < o)
2139
+ e.scrollTop = d;
2140
+ else if (c > n) {
2141
+ const m = i - r;
2142
+ e.scrollTop = d - m;
2143
+ }
2144
+ }
2145
+ //* Remove highlighting from the previous list item and highlight the new one.
2146
+ highlightListItem(t, e) {
2147
+ const s = this.highlightedItem;
2148
+ if (s && s.classList.remove(h.HIGHLIGHT), this.highlightedItem = t, this.highlightedItem && (this.highlightedItem.classList.add(h.HIGHLIGHT), this.options.countrySearch)) {
2149
+ const i = this.highlightedItem.getAttribute("id") || "";
2150
+ this.searchInput.setAttribute(p.ACTIVE_DESCENDANT, i);
2151
+ }
2152
+ e && this.highlightedItem.focus();
2153
+ }
2154
+ updateSelectedItem(t) {
2155
+ if (this.selectedItem && this.selectedItem.dataset.countryCode !== t && (this.selectedItem.setAttribute(p.SELECTED, "false"), this.selectedItem = null), t && !this.selectedItem) {
2156
+ const e = this.countryList.querySelector(
2157
+ `[data-country-code="${t}"]`
2158
+ );
2159
+ e && (e.setAttribute(p.SELECTED, "true"), this.selectedItem = e);
2160
+ }
2161
+ }
2162
+ //* Country search: Filter the country list to the given array of countries.
2163
+ filterCountries(t) {
2164
+ this.countryList.innerHTML = "";
2165
+ let e = !0;
2166
+ for (const s of t) {
2167
+ const i = s.nodeById[this.id];
2168
+ i && (this.countryList.appendChild(i), e && (this.highlightListItem(i, !1), e = !1));
2169
+ }
2170
+ e ? (this.highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove(h.HIDE)) : this.searchNoResults && this.searchNoResults.classList.add(h.HIDE), this.countryList.scrollTop = 0, this.updateSearchResultsA11yText();
2171
+ }
2172
+ destroy() {
2173
+ this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2174
+ const t = this.telInput.parentNode;
2175
+ t.before(this.telInput), t.remove(), this.telInput = null, this.countryContainer = null, this.selectedCountry = null, this.selectedCountryInner = null, this.selectedDialCode = null, this.dropdownArrow = null, this.dropdownContent = null, this.searchInput = null, this.searchIcon = null, this.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null, this.selectedItem = null;
2176
+ for (const e of this.countries)
2177
+ delete e.nodeById[this.id];
2178
+ this.countries = null;
2179
+ }
2180
+ }
2181
+ const lt = (l) => {
2182
+ const { onlyCountries: t, excludeCountries: e } = l;
2183
+ if (t.length) {
2184
+ const s = t.map(
2185
+ (i) => i.toLowerCase()
2186
+ );
2187
+ return A.filter(
2188
+ (i) => s.includes(i.iso2)
2189
+ );
2190
+ } else if (e.length) {
2191
+ const s = e.map(
2192
+ (i) => i.toLowerCase()
2193
+ );
2194
+ return A.filter(
2195
+ (i) => !s.includes(i.iso2)
2196
+ );
2197
+ }
2198
+ return A;
2199
+ }, rt = (l, t) => {
2200
+ const { countryNameLocale: e, i18n: s } = t, o = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(e, {
2201
+ type: "region"
2202
+ }) : null;
2203
+ for (const n of l)
2204
+ n.name = s[n.iso2] || (o == null ? void 0 : o.of(n.iso2.toUpperCase()));
2205
+ }, at = (l) => {
2206
+ const t = /* @__PURE__ */ new Set();
2207
+ let e = 0;
2208
+ const s = {}, i = (n, r) => {
2209
+ if (!n || !r)
2210
+ return;
2211
+ r.length > e && (e = r.length), s.hasOwnProperty(r) || (s[r] = []);
2212
+ const a = s[r];
2213
+ a.includes(n) || a.push(n);
2214
+ }, o = [...l].sort((n, r) => n.priority - r.priority);
2215
+ for (const n of o) {
2216
+ t.has(n.dialCode) || t.add(n.dialCode);
2217
+ for (let r = 1; r < n.dialCode.length; r++) {
2218
+ const a = n.dialCode.substring(0, r);
2219
+ i(n.iso2, a);
2220
+ }
2221
+ if (i(n.iso2, n.dialCode), n.areaCodes) {
2222
+ const r = s[n.dialCode][0];
2223
+ for (const a of n.areaCodes) {
2224
+ for (let c = 1; c < a.length; c++) {
2225
+ const d = a.substring(0, c), m = n.dialCode + d;
2226
+ i(r, m), i(n.iso2, m);
2227
+ }
2228
+ i(n.iso2, n.dialCode + a);
2229
+ }
2230
+ }
2231
+ }
2232
+ return { dialCodes: t, dialCodeMaxLen: e, dialCodeToIso2Map: s };
2233
+ }, ut = (l, t) => {
2234
+ t.countryOrder && (t.countryOrder = t.countryOrder.map(
2235
+ (e) => e.toLowerCase()
2236
+ )), l.sort((e, s) => {
2237
+ const { countryOrder: i } = t;
2238
+ if (i) {
2239
+ const o = i.indexOf(e.iso2), n = i.indexOf(s.iso2), r = o > -1, a = n > -1;
2240
+ if (r || a)
2241
+ return r && a ? o - n : r ? -1 : 1;
2242
+ }
2243
+ return e.name.localeCompare(s.name);
2244
+ });
2245
+ }, ct = (l) => {
2246
+ for (const t of l)
2247
+ t.normalisedName = j(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
2248
+ }, dt = (l, t, e, s) => {
2249
+ let i = l;
2250
+ if (e && t) {
2251
+ t = `+${s.dialCode}`;
2252
+ const o = i[t.length] === " " || i[t.length] === "-" ? t.length + 1 : t.length;
2253
+ i = i.substring(o);
2254
+ }
2255
+ return i;
2256
+ }, ht = (l, t, e, s, i) => {
2257
+ const o = e ? e.formatNumberAsYouType(l, s.iso2) : l, { dialCode: n } = s;
2258
+ return i && t.charAt(0) !== "+" && o.includes(`+${n}`) ? (o.split(`+${n}`)[1] || "").trim() : o;
2259
+ }, pt = (l, t, e, s) => {
2260
+ if (e === 0 && !s)
2261
+ return 0;
2262
+ let i = 0;
2263
+ for (let o = 0; o < t.length; o++) {
2264
+ if (/[+0-9]/.test(t[o]) && i++, i === l && !s)
2265
+ return o + 1;
2266
+ if (s && i === l + 1)
2267
+ return o;
2268
+ }
2269
+ return t.length;
2270
+ }, Ct = [
2271
+ "800",
2272
+ "822",
2273
+ "833",
2274
+ "844",
2275
+ "855",
2276
+ "866",
2277
+ "877",
2278
+ "880",
2279
+ "881",
2280
+ "882",
2281
+ "883",
2282
+ "884",
2283
+ "885",
2284
+ "886",
2285
+ "887",
2286
+ "888",
2287
+ "889"
2288
+ ], $ = (l) => {
2289
+ const t = P(l);
2290
+ if (t.startsWith(G.NANP) && t.length >= 4) {
2291
+ const e = t.substring(1, 4);
2292
+ return Ct.includes(e);
2293
+ }
2294
+ return !1;
2295
+ };
2296
+ let mt = 0;
2297
+ const ft = new Set(A.map((l) => l.iso2)), M = (l) => ft.has(l);
2298
+ class W {
2299
+ constructor(t, e = {}) {
2300
+ this.id = mt++, this.options = { ...z, ...e }, J(this.options), this.ui = new ot(t, this.options, this.id), this.isAndroid = W._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = lt(this.options);
2301
+ const { dialCodes: s, dialCodeMaxLen: i, dialCodeToIso2Map: o } = at(
2302
+ this.countries
2303
+ );
2304
+ this.dialCodes = s, this.dialCodeMaxLen = i, this.dialCodeToIso2Map = o, this.countryByIso2 = new Map(this.countries.map((n) => [n.iso2, n])), this._init();
2305
+ }
2306
+ static _getIsAndroid() {
2307
+ return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
2308
+ }
2309
+ _updateNumeralSet(t) {
2310
+ /[\u0660-\u0669]/.test(t) ? this.userNumeralSet = "arabic-indic" : /[\u06F0-\u06F9]/.test(t) ? this.userNumeralSet = "persian" : this.userNumeralSet = "ascii";
2311
+ }
2312
+ _mapAsciiToUserNumerals(t) {
2313
+ if (this.userNumeralSet || this._updateNumeralSet(this.ui.telInput.value), this.userNumeralSet === "ascii")
2314
+ return t;
2315
+ const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776;
2316
+ return t.replace(/[0-9]/g, (s) => String.fromCharCode(e + Number(s)));
2317
+ }
2318
+ // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
2319
+ _normaliseNumerals(t) {
2320
+ if (!t)
2321
+ return "";
2322
+ if (this._updateNumeralSet(t), this.userNumeralSet === "ascii")
2323
+ return t;
2324
+ const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776, s = this.userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
2325
+ return t.replace(s, (i) => String.fromCharCode(48 + (i.charCodeAt(0) - e)));
2326
+ }
2327
+ _getTelInputValue() {
2328
+ const t = this.ui.telInput.value.trim();
2329
+ return this._normaliseNumerals(t);
2330
+ }
2331
+ _setTelInputValue(t) {
2332
+ this.ui.telInput.value = this._mapAsciiToUserNumerals(t);
2333
+ }
2334
+ _createInitPromises() {
2335
+ const t = new Promise((s, i) => {
2336
+ this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = i;
2337
+ }), e = new Promise((s, i) => {
2338
+ this.resolveUtilsScriptPromise = s, this.rejectUtilsScriptPromise = i;
2339
+ });
2340
+ return Promise.all([t, e]);
2341
+ }
2342
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
2343
+ _init() {
2344
+ this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
2345
+ }
2346
+ //********************
2347
+ //* PRIVATE METHODS
2348
+ //********************
2349
+ //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2350
+ _processCountryData() {
2351
+ rt(this.countries, this.options), ut(this.countries, this.options), ct(this.countries);
2352
+ }
2353
+ //* Set the initial state of the input value and the selected country by:
2354
+ //* 1. Extracting a dial code from the given number
2355
+ //* 2. Using explicit initialCountry
2356
+ _setInitialState(t = !1) {
2357
+ const e = this.ui.telInput.getAttribute("value"), s = this._normaliseNumerals(e), i = this._getTelInputValue(), n = s && s.startsWith("+") && (!i || !i.startsWith("+")) ? s : i, r = this._getDialCode(n), a = $(n), { initialCountry: c, geoIpLookup: d } = this.options, m = c === x.AUTO && d;
2358
+ if (r && !a)
2359
+ this._updateCountryFromNumber(n);
2360
+ else if (!m || t) {
2361
+ const _ = c ? c.toLowerCase() : "";
2362
+ M(_) ? this._setCountry(_) : r && a ? this._setCountry(X.ISO2) : this._setCountry("");
2363
+ }
2364
+ n && this._updateValFromNumber(n);
2365
+ }
2366
+ //* Initialise the main event listeners: input keyup, and click selected country.
2367
+ _initListeners() {
2368
+ this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
2369
+ }
2370
+ //* Update hidden input on form submit.
2371
+ _initHiddenInputListener() {
2372
+ var e;
2373
+ const t = () => {
2374
+ this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
2375
+ };
2376
+ (e = this.ui.telInput.form) == null || e.addEventListener("submit", t, {
2377
+ signal: this.abortController.signal
2378
+ });
2379
+ }
2380
+ //* initialise the dropdown listeners.
2381
+ _initDropdownListeners() {
2382
+ const t = this.abortController.signal, e = (n) => {
2383
+ this.ui.dropdownContent.classList.contains(h.HIDE) ? this.ui.telInput.focus() : n.preventDefault();
2384
+ }, s = this.ui.telInput.closest("label");
2385
+ s && s.addEventListener("click", e, { signal: t });
2386
+ const i = () => {
2387
+ this.ui.dropdownContent.classList.contains(
2388
+ h.HIDE
2389
+ ) && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
2390
+ };
2391
+ this.ui.selectedCountry.addEventListener(
2392
+ "click",
2393
+ i,
2394
+ {
2395
+ signal: t
2396
+ }
2397
+ );
2398
+ const o = (n) => {
2399
+ this.ui.dropdownContent.classList.contains(
2400
+ h.HIDE
2401
+ ) && [y.ARROW_UP, y.ARROW_DOWN, y.SPACE, y.ENTER].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === y.TAB && this._closeDropdown();
2402
+ };
2403
+ this.ui.countryContainer.addEventListener(
2404
+ "keydown",
2405
+ o,
2406
+ { signal: t }
2407
+ );
2408
+ }
2409
+ //* Init many requests: utils script / geo ip lookup.
2410
+ _initRequests() {
2411
+ const { loadUtils: t, initialCountry: e, geoIpLookup: s } = this.options;
2412
+ if (t && !u.utils) {
2413
+ const o = () => {
2414
+ var n;
2415
+ (n = u.attachUtils(t)) == null || n.catch(() => {
2416
+ });
2417
+ };
2418
+ if (u.documentReady())
2419
+ o();
2420
+ else {
2421
+ const n = () => {
2422
+ o();
2423
+ };
2424
+ window.addEventListener("load", n, {
2425
+ signal: this.abortController.signal
2426
+ });
2427
+ }
2428
+ } else
2429
+ this.resolveUtilsScriptPromise();
2430
+ e === x.AUTO && s && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2431
+ }
2432
+ //* Perform the geo ip lookup.
2433
+ _loadAutoCountry() {
2434
+ u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2435
+ (t = "") => {
2436
+ const e = t.toLowerCase();
2437
+ M(e) ? (u.autoCountry = e, setTimeout(() => T("handleAutoCountry"))) : (this._setInitialState(!0), T("rejectAutoCountryPromise"));
2438
+ },
2439
+ () => {
2440
+ this._setInitialState(!0), T("rejectAutoCountryPromise");
2441
+ }
2442
+ ));
2443
+ }
2444
+ _openDropdownWithPlus() {
2445
+ this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
2446
+ }
2447
+ //* Initialize the tel input listeners.
2448
+ _initTelInputListeners() {
2449
+ this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
2450
+ }
2451
+ _bindInputListener() {
2452
+ const {
2453
+ strictMode: t,
2454
+ formatAsYouType: e,
2455
+ separateDialCode: s,
2456
+ allowDropdown: i,
2457
+ countrySearch: o
2458
+ } = this.options;
2459
+ let n = !1;
2460
+ E.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
2461
+ const r = (a) => {
2462
+ const c = this._getTelInputValue();
2463
+ if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && s && i && o) {
2464
+ const g = this.ui.telInput.selectionStart || 0, N = c.substring(0, g - 1), I = c.substring(g);
2465
+ this._setTelInputValue(N + I), this._openDropdownWithPlus();
2466
+ return;
2467
+ }
2468
+ this._updateCountryFromNumber(c) && this._triggerCountryChange();
2469
+ const d = (a == null ? void 0 : a.data) && E.NON_PLUS_NUMERIC.test(a.data), m = (a == null ? void 0 : a.inputType) === B.PASTE && c;
2470
+ d || m && !t ? n = !0 : E.NON_PLUS_NUMERIC.test(c) || (n = !1);
2471
+ const _ = (a == null ? void 0 : a.detail) && a.detail.isSetNumber, w = this.userNumeralSet === "ascii";
2472
+ if (e && !n && !_ && w) {
2473
+ const g = this.ui.telInput.selectionStart || 0, I = c.substring(
2474
+ 0,
2475
+ g
2476
+ ).replace(
2477
+ E.NON_PLUS_NUMERIC_GLOBAL,
2478
+ ""
2479
+ ).length, D = (a == null ? void 0 : a.inputType) === B.DELETE_FWD, f = this._getFullNumber(), L = ht(
2480
+ f,
2481
+ c,
2482
+ u.utils,
2483
+ this.selectedCountryData,
2484
+ this.options.separateDialCode
2485
+ ), b = pt(
2486
+ I,
2487
+ L,
2488
+ g,
2489
+ D
2490
+ );
2491
+ this._setTelInputValue(L), this.ui.telInput.setSelectionRange(b, b);
2492
+ }
2493
+ };
2494
+ this.ui.telInput.addEventListener(
2495
+ "input",
2496
+ r,
2497
+ {
2498
+ signal: this.abortController.signal
2499
+ }
2500
+ );
2501
+ }
2502
+ _maybeBindKeydownListener() {
2503
+ const { strictMode: t, separateDialCode: e, allowDropdown: s, countrySearch: i } = this.options;
2504
+ if (t || e) {
2505
+ const o = (n) => {
2506
+ if (n.key && n.key.length === 1 && !n.altKey && !n.ctrlKey && !n.metaKey) {
2507
+ if (e && s && i && n.key === "+") {
2508
+ n.preventDefault(), this._openDropdownWithPlus();
2509
+ return;
2510
+ }
2511
+ if (t) {
2512
+ const r = this._getTelInputValue(), c = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", d = this._normaliseNumerals(n.key), m = /^[0-9]$/.test(d), _ = e ? m : c || m, w = this.ui.telInput, g = w.selectionStart, N = w.selectionEnd, I = r.slice(0, g), D = r.slice(N), f = I + n.key + D, L = this._getFullNumber(f), b = u.utils.getCoreNumber(
2513
+ L,
2514
+ this.selectedCountryData.iso2
2515
+ ), v = this.maxCoreNumberLength && b.length > this.maxCoreNumberLength, K = this._getNewCountryFromNumber(L) !== null;
2516
+ (!_ || v && !K && !c) && n.preventDefault();
2517
+ }
2518
+ }
2519
+ };
2520
+ this.ui.telInput.addEventListener("keydown", o, {
2521
+ signal: this.abortController.signal
2522
+ });
2523
+ }
2524
+ }
2525
+ _maybeBindPasteListener() {
2526
+ if (this.options.strictMode) {
2527
+ const t = (e) => {
2528
+ e.preventDefault();
2529
+ const s = this.ui.telInput, i = s.selectionStart, o = s.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, i), a = n.slice(o), c = this.selectedCountryData.iso2, d = e.clipboardData.getData("text"), m = this._normaliseNumerals(d), _ = i === 0 && o > 0, w = !n.startsWith("+") || _, g = m.replace(E.NON_PLUS_NUMERIC_GLOBAL, ""), N = g.startsWith("+"), I = g.replace(/\+/g, ""), D = N && w ? `+${I}` : I;
2530
+ let f = r + D + a;
2531
+ if (f.length > 5) {
2532
+ let b = u.utils.getCoreNumber(f, c);
2533
+ for (; b.length === 0 && f.length > 0; )
2534
+ f = f.slice(0, -1), b = u.utils.getCoreNumber(f, c);
2535
+ if (!b)
2536
+ return;
2537
+ if (this.maxCoreNumberLength && b.length > this.maxCoreNumberLength)
2538
+ if (s.selectionEnd === n.length) {
2539
+ const v = b.length - this.maxCoreNumberLength;
2540
+ f = f.slice(0, f.length - v);
2541
+ } else
2542
+ return;
2543
+ }
2544
+ this._setTelInputValue(f);
2545
+ const L = i + D.length;
2546
+ s.setSelectionRange(L, L), s.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2547
+ };
2548
+ this.ui.telInput.addEventListener("paste", t, {
2549
+ signal: this.abortController.signal
2550
+ });
2551
+ }
2552
+ }
2553
+ //* Adhere to the input's maxlength attr.
2554
+ _cap(t) {
2555
+ const e = Number(this.ui.telInput.getAttribute("maxlength"));
2556
+ return e && t.length > e ? t.substring(0, e) : t;
2557
+ }
2558
+ //* Trigger a custom event on the input (typed via ItiEventMap).
2559
+ _trigger(t, e = {}) {
2560
+ const s = new CustomEvent(t, {
2561
+ bubbles: !0,
2562
+ cancelable: !0,
2563
+ detail: e
2564
+ });
2565
+ this.ui.telInput.dispatchEvent(s);
2566
+ }
2567
+ //* Open the dropdown.
2568
+ _openDropdown() {
2569
+ const { fixDropdownWidth: t, countrySearch: e } = this.options;
2570
+ if (this.dropdownAbortController = new AbortController(), t && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(h.HIDE), this.ui.selectedCountry.setAttribute(p.EXPANDED, "true"), this._setDropdownPosition(), e) {
2571
+ const s = this.ui.countryList.firstElementChild;
2572
+ s && (this.ui.highlightListItem(s, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
2573
+ }
2574
+ this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(S.OPEN_COUNTRY_DROPDOWN);
2575
+ }
2576
+ //* Set the dropdown position
2577
+ _setDropdownPosition() {
2578
+ if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
2579
+ const t = this.ui.telInput.getBoundingClientRect(), e = this.ui.telInput.offsetHeight;
2580
+ if (this.options.dropdownContainer) {
2581
+ this.ui.dropdown.style.top = `${t.top + e}px`, this.ui.dropdown.style.left = `${t.left}px`;
2582
+ const s = () => this._closeDropdown();
2583
+ window.addEventListener("scroll", s, {
2584
+ signal: this.dropdownAbortController.signal
2585
+ });
2586
+ }
2587
+ }
2588
+ }
2589
+ //* We only bind dropdown listeners when the dropdown is open.
2590
+ _bindDropdownListeners() {
2591
+ const t = this.dropdownAbortController.signal;
2592
+ this._bindDropdownMouseoverListener(t), this._bindDropdownCountryClickListener(t), this._bindDropdownClickOffListener(t), this._bindDropdownKeydownListener(t), this.options.countrySearch && this._bindDropdownSearchListeners(t);
2593
+ }
2594
+ //* When mouse over a list item, just highlight that one
2595
+ //* we add the class "highlight", so if they hit "enter" we know which one to select.
2596
+ _bindDropdownMouseoverListener(t) {
2597
+ const e = (s) => {
2598
+ var o;
2599
+ const i = (o = s.target) == null ? void 0 : o.closest(
2600
+ `.${h.COUNTRY_ITEM}`
2601
+ );
2602
+ i && this.ui.highlightListItem(i, !1);
2603
+ };
2604
+ this.ui.countryList.addEventListener(
2605
+ "mouseover",
2606
+ e,
2607
+ {
2608
+ signal: t
2609
+ }
2610
+ );
2611
+ }
2612
+ //* Listen for country selection.
2613
+ _bindDropdownCountryClickListener(t) {
2614
+ const e = (s) => {
2615
+ var o;
2616
+ const i = (o = s.target) == null ? void 0 : o.closest(
2617
+ `.${h.COUNTRY_ITEM}`
2618
+ );
2619
+ i && this._selectListItem(i);
2620
+ };
2621
+ this.ui.countryList.addEventListener("click", e, {
2622
+ signal: t
2623
+ });
2624
+ }
2625
+ //* Click off to close (except when this initial opening click is bubbling up).
2626
+ //* We cannot just stopPropagation as it may be needed to close another instance.
2627
+ _bindDropdownClickOffListener(t) {
2628
+ const e = (s) => {
2629
+ !!s.target.closest(
2630
+ `#iti-${this.id}__dropdown-content`
2631
+ ) || this._closeDropdown();
2632
+ };
2633
+ setTimeout(() => {
2634
+ document.documentElement.addEventListener(
2635
+ "click",
2636
+ e,
2637
+ { signal: t }
2638
+ );
2639
+ }, 0);
2640
+ }
2641
+ //* Listen for up/down scrolling, enter to select, or escape to close.
2642
+ //* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
2643
+ //* just hit down and hold it to scroll down (no keyup event).
2644
+ //* Listen on the document because that's where key events are triggered if no input has focus.
2645
+ _bindDropdownKeydownListener(t) {
2646
+ let e = "", s = null;
2647
+ const i = (o) => {
2648
+ [
2649
+ y.ARROW_UP,
2650
+ y.ARROW_DOWN,
2651
+ y.ENTER,
2652
+ y.ESC
2653
+ ].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === y.ARROW_UP || o.key === y.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === y.ENTER ? this._handleEnterKey() : o.key === y.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && E.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), s && clearTimeout(s), e += o.key.toLowerCase(), this._searchForCountry(e), s = setTimeout(() => {
2654
+ e = "";
2655
+ }, q.HIDDEN_SEARCH_RESET_MS));
2656
+ };
2657
+ document.addEventListener("keydown", i, { signal: t });
2658
+ }
2659
+ //* Search input listeners when countrySearch enabled.
2660
+ _bindDropdownSearchListeners(t) {
2661
+ const e = () => {
2662
+ const n = this.ui.searchInput.value.trim();
2663
+ this._filterCountriesByQuery(n), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove(h.HIDE) : this.ui.searchClearButton.classList.add(h.HIDE);
2664
+ };
2665
+ let s = null;
2666
+ const i = () => {
2667
+ s && clearTimeout(s), s = setTimeout(() => {
2668
+ e(), s = null;
2669
+ }, 100);
2670
+ };
2671
+ this.ui.searchInput.addEventListener("input", i, {
2672
+ signal: t
2673
+ });
2674
+ const o = () => {
2675
+ this.ui.searchInput.value = "", this.ui.searchInput.focus(), e();
2676
+ };
2677
+ this.ui.searchClearButton.addEventListener("click", o, {
2678
+ signal: t
2679
+ });
2680
+ }
2681
+ //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2682
+ _searchForCountry(t) {
2683
+ const e = et(this.countries, t);
2684
+ if (e) {
2685
+ const s = e.nodeById[this.id];
2686
+ this.ui.highlightListItem(s, !1), this.ui.scrollTo(s);
2687
+ }
2688
+ }
2689
+ //* Country search: Filter the countries according to the search query.
2690
+ _filterCountriesByQuery(t) {
2691
+ let e;
2692
+ t === "" ? e = this.countries : e = tt(this.countries, t), this.ui.filterCountries(e);
2693
+ }
2694
+ //* Highlight the next/prev item in the list (and ensure it is visible).
2695
+ _handleUpDownKey(t) {
2696
+ var s, i;
2697
+ let e = t === y.ARROW_UP ? (s = this.ui.highlightedItem) == null ? void 0 : s.previousElementSibling : (i = this.ui.highlightedItem) == null ? void 0 : i.nextElementSibling;
2698
+ !e && this.ui.countryList.childElementCount > 1 && (e = t === y.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), e && (this.ui.scrollTo(e), this.ui.highlightListItem(e, !1));
2699
+ }
2700
+ //* Select the currently highlighted item.
2701
+ _handleEnterKey() {
2702
+ this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
2703
+ }
2704
+ //* Update the input's value to the given val (format first if possible)
2705
+ //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2706
+ _updateValFromNumber(t) {
2707
+ let e = t;
2708
+ if (this.options.formatOnDisplay && u.utils && this.selectedCountryData) {
2709
+ const s = this.options.nationalMode || !e.startsWith("+") && !this.options.separateDialCode, { NATIONAL: i, INTERNATIONAL: o } = u.utils.numberFormat, n = s ? i : o;
2710
+ e = u.utils.formatNumber(
2711
+ e,
2712
+ this.selectedCountryData.iso2,
2713
+ n
2714
+ );
2715
+ }
2716
+ e = this._beforeSetNumber(e), this._setTelInputValue(e);
2717
+ }
2718
+ //* Check if need to select a new country based on the given number
2719
+ //* Note: called from _setInitialState, keyup handler, setNumber.
2720
+ _updateCountryFromNumber(t) {
2721
+ const e = this._getNewCountryFromNumber(t);
2722
+ return e !== null ? this._setCountry(e) : !1;
2723
+ }
2724
+ // if there is a selected country, and the number doesn't start with a dial code, then add it
2725
+ _ensureHasDialCode(t) {
2726
+ const { dialCode: e, nationalPrefix: s } = this.selectedCountryData;
2727
+ if (t.startsWith("+") || !e)
2728
+ return t;
2729
+ const n = s && t.startsWith(s) && !this.options.separateDialCode ? t.substring(1) : t;
2730
+ return `+${e}${n}`;
2731
+ }
2732
+ // Get the country ISO2 code from the given number
2733
+ // BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
2734
+ // NOTE: consider refactoring this to be more clear
2735
+ _getNewCountryFromNumber(t) {
2736
+ const e = t.indexOf("+");
2737
+ let s = e ? t.substring(e) : t;
2738
+ const i = this.selectedCountryData.iso2, o = this.selectedCountryData.dialCode;
2739
+ s = this._ensureHasDialCode(s);
2740
+ const n = this._getDialCode(s, !0), r = P(s);
2741
+ if (n) {
2742
+ const a = P(n), c = this.dialCodeToIso2Map[a];
2743
+ if (c.length === 1)
2744
+ return c[0] === i ? null : c[0];
2745
+ if (!i && this.defaultCountry && c.includes(this.defaultCountry))
2746
+ return this.defaultCountry;
2747
+ if (o === G.NANP && $(r))
2748
+ return null;
2749
+ const { areaCodes: m, priority: _ } = this.selectedCountryData;
2750
+ if (m) {
2751
+ const D = m.map(
2752
+ (f) => `${o}${f}`
2753
+ );
2754
+ for (const f of D)
2755
+ if (r.startsWith(f))
2756
+ return null;
2757
+ }
2758
+ const g = m && !(_ === 0) && r.length > a.length, N = i && c.includes(i) && !g, I = i === c[0];
2759
+ if (!N && !I)
2760
+ return c[0];
2761
+ } else if (s.startsWith("+") && r.length) {
2762
+ const a = this.selectedCountryData.dialCode || "";
2763
+ return a && a.startsWith(r) ? null : "";
2764
+ } else if ((!s || s === "+") && !i)
2765
+ return this.defaultCountry;
2766
+ return null;
2767
+ }
2768
+ //* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
2769
+ //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2770
+ _setCountry(t) {
2771
+ const { separateDialCode: e, showFlags: s, i18n: i, allowDropdown: o } = this.options, n = this.selectedCountryData.iso2 || "";
2772
+ if (o && this.ui.updateSelectedItem(t), this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
2773
+ const r = t && s ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
2774
+ let a, c, d;
2775
+ if (t) {
2776
+ const { name: m, dialCode: _ } = this.selectedCountryData;
2777
+ c = m, a = i.selectedCountryAriaLabel.replace("${countryName}", m).replace("${dialCode}", `+${_}`), d = "";
2778
+ } else
2779
+ c = i.noCountrySelected, a = i.noCountrySelected, d = nt();
2780
+ this.ui.selectedCountryInner.className = r, this.ui.selectedCountry.setAttribute("title", c), this.ui.selectedCountry.setAttribute(p.LABEL, a), this.ui.selectedCountryInner.innerHTML = d;
2781
+ }
2782
+ if (e) {
2783
+ const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2784
+ this.ui.selectedDialCode.textContent = r, this.ui.updateInputPadding();
2785
+ }
2786
+ return this._updatePlaceholder(), this._updateMaxLength(), n !== t;
2787
+ }
2788
+ //* Update the maximum valid number length for the currently selected country.
2789
+ _updateMaxLength() {
2790
+ const { strictMode: t, placeholderNumberType: e, validationNumberTypes: s } = this.options, { iso2: i } = this.selectedCountryData;
2791
+ if (t && u.utils)
2792
+ if (i) {
2793
+ const o = u.utils.numberType[e];
2794
+ let n = u.utils.getExampleNumber(
2795
+ i,
2796
+ !1,
2797
+ o,
2798
+ !0
2799
+ ), r = n;
2800
+ for (; u.utils.isPossibleNumber(
2801
+ n,
2802
+ i,
2803
+ s
2804
+ ); )
2805
+ r = n, n += "0";
2806
+ const a = u.utils.getCoreNumber(r, i);
2807
+ this.maxCoreNumberLength = a.length, i === "by" && (this.maxCoreNumberLength = a.length + 1);
2808
+ } else
2809
+ this.maxCoreNumberLength = null;
2810
+ }
2811
+ //* Update the input placeholder to an example number from the currently selected country.
2812
+ _updatePlaceholder() {
2813
+ const {
2814
+ autoPlaceholder: t,
2815
+ placeholderNumberType: e,
2816
+ nationalMode: s,
2817
+ customPlaceholder: i
2818
+ } = this.options, o = t === k.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === k.POLITE;
2819
+ if (u.utils && o) {
2820
+ const n = u.utils.numberType[e];
2821
+ let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
2822
+ this.selectedCountryData.iso2,
2823
+ s,
2824
+ n
2825
+ ) : "";
2826
+ r = this._beforeSetNumber(r), typeof i == "function" && (r = i(r, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", r);
2827
+ }
2828
+ }
2829
+ //* Called when the user selects a list item from the dropdown.
2830
+ _selectListItem(t) {
2831
+ const e = t.dataset[V.COUNTRY_CODE], s = this._setCountry(e);
2832
+ this._closeDropdown();
2833
+ const i = t.dataset[V.DIAL_CODE];
2834
+ if (this._updateDialCode(i), this.options.formatOnDisplay) {
2835
+ const o = this._getTelInputValue();
2836
+ this._updateValFromNumber(o);
2837
+ }
2838
+ this.ui.telInput.focus(), s && this._triggerCountryChange();
2839
+ }
2840
+ //* Close the dropdown and unbind any listeners.
2841
+ _closeDropdown() {
2842
+ this.ui.dropdownContent.classList.contains(h.HIDE) || (this.ui.dropdownContent.classList.add(h.HIDE), this.ui.selectedCountry.setAttribute(p.EXPANDED, "false"), this.options.countrySearch && (this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT), this.ui.highlightedItem && (this.ui.highlightedItem.classList.remove(h.HIGHLIGHT), this.ui.highlightedItem = null)), this.ui.dropdownArrow.classList.remove(h.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(S.CLOSE_COUNTRY_DROPDOWN));
2843
+ }
2844
+ //* Replace any existing dial code with the new one
2845
+ //* Note: called from _selectListItem and setCountry
2846
+ _updateDialCode(t) {
2847
+ const e = this._getTelInputValue(), s = `+${t}`;
2848
+ let i;
2849
+ if (e.startsWith("+")) {
2850
+ const o = this._getDialCode(e);
2851
+ o ? i = e.replace(o, s) : i = s, this._setTelInputValue(i);
2852
+ }
2853
+ }
2854
+ //* Try and extract a valid international dial code from a full telephone number.
2855
+ //* Note: returns the raw string inc plus character and any whitespace/dots etc.
2856
+ _getDialCode(t, e) {
2857
+ let s = "";
2858
+ if (t.startsWith("+")) {
2859
+ let i = "", o = !1;
2860
+ for (let n = 0; n < t.length; n++) {
2861
+ const r = t.charAt(n);
2862
+ if (/[0-9]/.test(r)) {
2863
+ if (i += r, !!!this.dialCodeToIso2Map[i])
2864
+ break;
2865
+ if (this.dialCodes.has(i)) {
2866
+ if (s = t.substring(0, n + 1), o = !0, !e)
2867
+ break;
2868
+ } else e && o && (s = t.substring(0, n + 1));
2869
+ if (i.length === this.dialCodeMaxLen)
2870
+ break;
2871
+ }
2872
+ }
2873
+ }
2874
+ return s;
2875
+ }
2876
+ //* Get the input val, adding the dial code if separateDialCode is enabled.
2877
+ _getFullNumber(t) {
2878
+ const e = t ? this._normaliseNumerals(t) : this._getTelInputValue(), { dialCode: s } = this.selectedCountryData;
2879
+ let i;
2880
+ const o = P(e);
2881
+ return this.options.separateDialCode && !e.startsWith("+") && s && o ? i = `+${s}` : i = "", i + e;
2882
+ }
2883
+ //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
2884
+ _beforeSetNumber(t) {
2885
+ const e = this._getDialCode(t), s = dt(
2886
+ t,
2887
+ e,
2888
+ this.options.separateDialCode,
2889
+ this.selectedCountryData
2890
+ );
2891
+ return this._cap(s);
2892
+ }
2893
+ //* Trigger the 'countrychange' event.
2894
+ _triggerCountryChange() {
2895
+ this._trigger(S.COUNTRY_CHANGE);
2896
+ }
2897
+ //**************************
2898
+ //* SECRET PUBLIC METHODS
2899
+ //**************************
2900
+ //* This is called when the geoip call returns.
2901
+ handleAutoCountry() {
2902
+ this.options.initialCountry === x.AUTO && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(h.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2903
+ }
2904
+ //* This is called when the utils request completes.
2905
+ handleUtils() {
2906
+ if (u.utils) {
2907
+ const t = this._getTelInputValue();
2908
+ t && this._updateValFromNumber(t), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength());
2909
+ }
2910
+ this.resolveUtilsScriptPromise();
2911
+ }
2912
+ //********************
2913
+ //* PUBLIC METHODS
2914
+ //********************
2915
+ //* Remove plugin.
2916
+ destroy() {
2917
+ this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), u.instances instanceof Map ? u.instances.delete(this.id) : delete u.instances[this.id]);
2918
+ }
2919
+ //* Get the extension from the current number.
2920
+ getExtension() {
2921
+ return u.utils ? u.utils.getExtension(
2922
+ this._getFullNumber(),
2923
+ this.selectedCountryData.iso2
2924
+ ) : "";
2925
+ }
2926
+ //* Format the number to the given format.
2927
+ getNumber(t) {
2928
+ if (u.utils) {
2929
+ const { iso2: e } = this.selectedCountryData, s = this._getFullNumber(), i = u.utils.formatNumber(
2930
+ s,
2931
+ e,
2932
+ t
2933
+ );
2934
+ return this._mapAsciiToUserNumerals(i);
2935
+ }
2936
+ return "";
2937
+ }
2938
+ //* Get the type of the entered number e.g. landline/mobile.
2939
+ getNumberType() {
2940
+ return u.utils ? u.utils.getNumberType(
2941
+ this._getFullNumber(),
2942
+ this.selectedCountryData.iso2
2943
+ ) : F.UNKNOWN_NUMBER_TYPE;
2944
+ }
2945
+ //* Get the country data for the currently selected country.
2946
+ getSelectedCountryData() {
2947
+ return this.selectedCountryData;
2948
+ }
2949
+ //* Get the validation error.
2950
+ getValidationError() {
2951
+ if (u.utils) {
2952
+ const { iso2: t } = this.selectedCountryData;
2953
+ return u.utils.getValidationError(this._getFullNumber(), t);
2954
+ }
2955
+ return F.UNKNOWN_VALIDATION_ERROR;
2956
+ }
2957
+ //* Validate the input val using number length only
2958
+ isValidNumber() {
2959
+ const { dialCode: t, iso2: e } = this.selectedCountryData;
2960
+ if (t === R.DIAL_CODE && u.utils) {
2961
+ const s = this._getFullNumber(), i = u.utils.getCoreNumber(s, e);
2962
+ if (i[0] === R.MOBILE_PREFIX && i.length !== R.MOBILE_CORE_LENGTH)
2963
+ return !1;
2964
+ }
2965
+ return this._validateNumber(!1);
2966
+ }
2967
+ //* Validate the input val with precise validation
2968
+ isValidNumberPrecise() {
2969
+ return this._validateNumber(!0);
2970
+ }
2971
+ _utilsIsPossibleNumber(t) {
2972
+ return u.utils ? u.utils.isPossibleNumber(
2973
+ t,
2974
+ this.selectedCountryData.iso2,
2975
+ this.options.validationNumberTypes
2976
+ ) : null;
2977
+ }
2978
+ //* Shared internal validation logic to handle alpha character extension rules.
2979
+ _validateNumber(t) {
2980
+ if (!u.utils)
2981
+ return null;
2982
+ if (!this.selectedCountryData.iso2)
2983
+ return !1;
2984
+ const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), s = this._getFullNumber(), i = s.search(E.ALPHA_UNICODE);
2985
+ if (i > -1 && !this.options.allowPhonewords) {
2986
+ const n = s.substring(0, i), r = e(n), a = e(s);
2987
+ return r && a;
2988
+ }
2989
+ return e(s);
2990
+ }
2991
+ _utilsIsValidNumber(t) {
2992
+ return u.utils ? u.utils.isValidNumber(
2993
+ t,
2994
+ this.selectedCountryData.iso2,
2995
+ this.options.validationNumberTypes
2996
+ ) : null;
2997
+ }
2998
+ //* Update the selected country, and update the input val accordingly.
2999
+ setCountry(t) {
3000
+ const e = t == null ? void 0 : t.toLowerCase();
3001
+ if (!M(e))
3002
+ throw new Error(`Invalid country code: '${e}'`);
3003
+ const s = this.selectedCountryData.iso2;
3004
+ if (t && e !== s || !t && s) {
3005
+ if (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay) {
3006
+ const o = this._getTelInputValue();
3007
+ this._updateValFromNumber(o);
3008
+ }
3009
+ this._triggerCountryChange();
3010
+ }
3011
+ }
3012
+ //* Set the input value and update the country.
3013
+ setNumber(t) {
3014
+ const e = this._normaliseNumerals(t), s = this._updateCountryFromNumber(e);
3015
+ this._updateValFromNumber(e), s && this._triggerCountryChange(), this._trigger(S.INPUT, { isSetNumber: !0 });
3016
+ }
3017
+ //* Set the placeholder number typ
3018
+ setPlaceholderNumberType(t) {
3019
+ this.options.placeholderNumberType = t, this._updatePlaceholder();
3020
+ }
3021
+ setDisabled(t) {
3022
+ this.ui.telInput.disabled = t, t ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
3023
+ }
3024
+ }
3025
+ const yt = (l) => {
3026
+ if (!u.utils && !u.startedLoadingUtilsScript) {
3027
+ let t;
3028
+ if (typeof l == "function")
3029
+ try {
3030
+ t = Promise.resolve(l());
3031
+ } catch (e) {
3032
+ return Promise.reject(e);
3033
+ }
3034
+ else
3035
+ return Promise.reject(
3036
+ new TypeError(
3037
+ `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof l}`
3038
+ )
3039
+ );
3040
+ return u.startedLoadingUtilsScript = !0, t.then((e) => {
3041
+ const s = e == null ? void 0 : e.default;
3042
+ if (!s || typeof s != "object")
3043
+ throw new TypeError(
3044
+ "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
3045
+ );
3046
+ return u.utils = s, T("handleUtils"), !0;
3047
+ }).catch((e) => {
3048
+ throw T("rejectUtilsScriptPromise", e), e;
3049
+ });
3050
+ }
3051
+ return null;
3052
+ }, T = (l, ...t) => {
3053
+ Object.values(u.instances).forEach((e) => {
3054
+ const s = e[l];
3055
+ typeof s == "function" && s.apply(e, t);
3056
+ });
3057
+ }, u = Object.assign(
3058
+ (l, t) => {
3059
+ const e = new W(l, t);
3060
+ return u.instances[e.id] = e, l.iti = e, e;
3061
+ },
3062
+ {
3063
+ defaults: z,
3064
+ //* Using a static var like this allows us to mock it in the tests.
3065
+ documentReady: () => document.readyState === "complete",
3066
+ //* Get the country data object.
3067
+ getCountryData: () => A,
3068
+ //* A getter for the plugin instance.
3069
+ getInstance: (l) => {
3070
+ const t = l.dataset.intlTelInputId;
3071
+ return t ? u.instances[t] : null;
3072
+ },
3073
+ //* A map from instance ID to instance object.
3074
+ instances: {},
3075
+ attachUtils: yt,
3076
+ startedLoadingUtilsScript: !1,
3077
+ startedLoadingAutoCountry: !1,
3078
+ version: "25.14.1"
3079
+ }
3080
+ );
3081
+ export {
3082
+ u as i
3083
+ };