lite-phone-input 0.1.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.
@@ -0,0 +1,3400 @@
1
+ // data/phone-countries.json
2
+ var phone_countries_default = [
3
+ {
4
+ c: "AF",
5
+ n: "Afghanistan",
6
+ d: "93",
7
+ f: "XX XXX XXXX",
8
+ p: "0",
9
+ min: 9,
10
+ max: 9,
11
+ pri: 0
12
+ },
13
+ {
14
+ c: "AX",
15
+ n: "\xC5land Islands",
16
+ d: "358",
17
+ f: "XX XXXXXXX",
18
+ p: "0",
19
+ min: 6,
20
+ max: 10,
21
+ pri: 1
22
+ },
23
+ {
24
+ c: "AL",
25
+ n: "Albania",
26
+ d: "355",
27
+ f: "XX XXX XXXX",
28
+ p: "0",
29
+ min: 8,
30
+ max: 9,
31
+ pri: 0
32
+ },
33
+ {
34
+ c: "DZ",
35
+ n: "Algeria",
36
+ d: "213",
37
+ f: "XXX XX XX XX",
38
+ p: "0",
39
+ min: 8,
40
+ max: 9,
41
+ pri: 0
42
+ },
43
+ {
44
+ c: "AS",
45
+ n: "American Samoa",
46
+ d: "1",
47
+ f: "XXX XXX XXXX",
48
+ p: "1",
49
+ min: 10,
50
+ max: 10,
51
+ pri: 3
52
+ },
53
+ {
54
+ c: "AD",
55
+ n: "Andorra",
56
+ d: "376",
57
+ f: "XXX XXX",
58
+ p: null,
59
+ min: 6,
60
+ max: 9,
61
+ pri: 0
62
+ },
63
+ {
64
+ c: "AO",
65
+ n: "Angola",
66
+ d: "244",
67
+ f: "XXX XXX XXX",
68
+ p: null,
69
+ min: 9,
70
+ max: 9,
71
+ pri: 0
72
+ },
73
+ {
74
+ c: "AI",
75
+ n: "Anguilla",
76
+ d: "1",
77
+ f: "XXX XXX XXXX",
78
+ p: "1",
79
+ min: 10,
80
+ max: 10,
81
+ pri: 2
82
+ },
83
+ {
84
+ c: "AG",
85
+ n: "Antigua & Barbuda",
86
+ d: "1",
87
+ f: "XXX XXX XXXX",
88
+ p: "1",
89
+ min: 10,
90
+ max: 10,
91
+ pri: 1
92
+ },
93
+ {
94
+ c: "AR",
95
+ n: "Argentina",
96
+ d: "54",
97
+ f: "XX XX XXXX XXXX",
98
+ p: "0",
99
+ min: 10,
100
+ max: 11,
101
+ pri: 0
102
+ },
103
+ {
104
+ c: "AM",
105
+ n: "Armenia",
106
+ d: "374",
107
+ f: "XX XXXXXX",
108
+ p: "0",
109
+ min: 8,
110
+ max: 8,
111
+ pri: 0
112
+ },
113
+ {
114
+ c: "AW",
115
+ n: "Aruba",
116
+ d: "297",
117
+ f: "XXX XXXX",
118
+ p: null,
119
+ min: 7,
120
+ max: 7,
121
+ pri: 0
122
+ },
123
+ {
124
+ c: "AC",
125
+ n: "Ascension Island",
126
+ d: "247",
127
+ f: null,
128
+ p: null,
129
+ min: 5,
130
+ max: 5,
131
+ pri: 0
132
+ },
133
+ {
134
+ c: "AU",
135
+ n: "Australia",
136
+ d: "61",
137
+ f: "XXX XXX XXX",
138
+ p: "0",
139
+ min: 9,
140
+ max: 9,
141
+ pri: 0
142
+ },
143
+ {
144
+ c: "AT",
145
+ n: "Austria",
146
+ d: "43",
147
+ f: "XXX XXXXXX",
148
+ p: "0",
149
+ min: 4,
150
+ max: 13,
151
+ pri: 0
152
+ },
153
+ {
154
+ c: "AZ",
155
+ n: "Azerbaijan",
156
+ d: "994",
157
+ f: "XX XXX XX XX",
158
+ p: "0",
159
+ min: 9,
160
+ max: 9,
161
+ pri: 0
162
+ },
163
+ {
164
+ c: "BS",
165
+ n: "Bahamas",
166
+ d: "1",
167
+ f: "XXX XXX XXXX",
168
+ p: "1",
169
+ min: 10,
170
+ max: 10,
171
+ pri: 6
172
+ },
173
+ {
174
+ c: "BH",
175
+ n: "Bahrain",
176
+ d: "973",
177
+ f: "XXXX XXXX",
178
+ p: null,
179
+ min: 8,
180
+ max: 8,
181
+ pri: 0
182
+ },
183
+ {
184
+ c: "BD",
185
+ n: "Bangladesh",
186
+ d: "880",
187
+ f: "XXXX XXXXXX",
188
+ p: "0",
189
+ min: 6,
190
+ max: 10,
191
+ pri: 0
192
+ },
193
+ {
194
+ c: "BB",
195
+ n: "Barbados",
196
+ d: "1",
197
+ f: "XXX XXX XXXX",
198
+ p: "1",
199
+ min: 10,
200
+ max: 10,
201
+ pri: 4
202
+ },
203
+ {
204
+ c: "BY",
205
+ n: "Belarus",
206
+ d: "375",
207
+ f: "XX XXX XX XX",
208
+ p: "8",
209
+ min: 9,
210
+ max: 9,
211
+ pri: 0
212
+ },
213
+ {
214
+ c: "BE",
215
+ n: "Belgium",
216
+ d: "32",
217
+ f: "XXX XX XX XX",
218
+ p: "0",
219
+ min: 8,
220
+ max: 9,
221
+ pri: 0
222
+ },
223
+ {
224
+ c: "BZ",
225
+ n: "Belize",
226
+ d: "501",
227
+ f: "XXX XXXX",
228
+ p: null,
229
+ min: 7,
230
+ max: 7,
231
+ pri: 0
232
+ },
233
+ {
234
+ c: "BJ",
235
+ n: "Benin",
236
+ d: "229",
237
+ f: "XX XX XX XX XX",
238
+ p: null,
239
+ min: 10,
240
+ max: 10,
241
+ pri: 0
242
+ },
243
+ {
244
+ c: "BM",
245
+ n: "Bermuda",
246
+ d: "1",
247
+ f: "XXX XXX XXXX",
248
+ p: "1",
249
+ min: 10,
250
+ max: 10,
251
+ pri: 5
252
+ },
253
+ {
254
+ c: "BT",
255
+ n: "Bhutan",
256
+ d: "975",
257
+ f: "XX XX XX XX",
258
+ p: null,
259
+ min: 7,
260
+ max: 8,
261
+ pri: 0
262
+ },
263
+ {
264
+ c: "BO",
265
+ n: "Bolivia",
266
+ d: "591",
267
+ f: "XXXXXXXX",
268
+ p: "0",
269
+ min: 8,
270
+ max: 8,
271
+ pri: 0
272
+ },
273
+ {
274
+ c: "BA",
275
+ n: "Bosnia & Herzegovina",
276
+ d: "387",
277
+ f: "XX XXX XXX",
278
+ p: "0",
279
+ min: 8,
280
+ max: 9,
281
+ pri: 0
282
+ },
283
+ {
284
+ c: "BW",
285
+ n: "Botswana",
286
+ d: "267",
287
+ f: "XX XXX XXX",
288
+ p: null,
289
+ min: 7,
290
+ max: 8,
291
+ pri: 0
292
+ },
293
+ {
294
+ c: "BR",
295
+ n: "Brazil",
296
+ d: "55",
297
+ f: "XX XXXXX XXXX",
298
+ p: "0",
299
+ min: 10,
300
+ max: 11,
301
+ pri: 0
302
+ },
303
+ {
304
+ c: "IO",
305
+ n: "British Indian Ocean Territory",
306
+ d: "246",
307
+ f: "XXX XXXX",
308
+ p: null,
309
+ min: 7,
310
+ max: 7,
311
+ pri: 0
312
+ },
313
+ {
314
+ c: "VG",
315
+ n: "British Virgin Islands",
316
+ d: "1",
317
+ f: "XXX XXX XXXX",
318
+ p: "1",
319
+ min: 10,
320
+ max: 10,
321
+ pri: 23
322
+ },
323
+ {
324
+ c: "BN",
325
+ n: "Brunei",
326
+ d: "673",
327
+ f: "XXX XXXX",
328
+ p: null,
329
+ min: 7,
330
+ max: 7,
331
+ pri: 0
332
+ },
333
+ {
334
+ c: "BG",
335
+ n: "Bulgaria",
336
+ d: "359",
337
+ f: "XX XXX XXX",
338
+ p: "0",
339
+ min: 6,
340
+ max: 9,
341
+ pri: 0
342
+ },
343
+ {
344
+ c: "BF",
345
+ n: "Burkina Faso",
346
+ d: "226",
347
+ f: "XX XX XX XX",
348
+ p: null,
349
+ min: 8,
350
+ max: 8,
351
+ pri: 0
352
+ },
353
+ {
354
+ c: "BI",
355
+ n: "Burundi",
356
+ d: "257",
357
+ f: "XX XX XX XX",
358
+ p: null,
359
+ min: 8,
360
+ max: 8,
361
+ pri: 0
362
+ },
363
+ {
364
+ c: "KH",
365
+ n: "Cambodia",
366
+ d: "855",
367
+ f: "XX XXX XXX",
368
+ p: "0",
369
+ min: 8,
370
+ max: 9,
371
+ pri: 0
372
+ },
373
+ {
374
+ c: "CM",
375
+ n: "Cameroon",
376
+ d: "237",
377
+ f: "X XX XX XX XX",
378
+ p: null,
379
+ min: 9,
380
+ max: 9,
381
+ pri: 0
382
+ },
383
+ {
384
+ c: "CA",
385
+ n: "Canada",
386
+ d: "1",
387
+ f: "XXX XXX XXXX",
388
+ p: "1",
389
+ min: 10,
390
+ max: 10,
391
+ pri: 7
392
+ },
393
+ {
394
+ c: "CV",
395
+ n: "Cape Verde",
396
+ d: "238",
397
+ f: "XXX XX XX",
398
+ p: null,
399
+ min: 7,
400
+ max: 7,
401
+ pri: 0
402
+ },
403
+ {
404
+ c: "BQ",
405
+ n: "Caribbean Netherlands",
406
+ d: "599",
407
+ f: "XXX XXXX",
408
+ p: null,
409
+ min: 7,
410
+ max: 7,
411
+ pri: 1
412
+ },
413
+ {
414
+ c: "KY",
415
+ n: "Cayman Islands",
416
+ d: "1",
417
+ f: "XXX XXX XXXX",
418
+ p: "1",
419
+ min: 10,
420
+ max: 10,
421
+ pri: 14
422
+ },
423
+ {
424
+ c: "CF",
425
+ n: "Central African Republic",
426
+ d: "236",
427
+ f: "XX XX XX XX",
428
+ p: null,
429
+ min: 8,
430
+ max: 8,
431
+ pri: 0
432
+ },
433
+ {
434
+ c: "TD",
435
+ n: "Chad",
436
+ d: "235",
437
+ f: "XX XX XX XX",
438
+ p: null,
439
+ min: 8,
440
+ max: 8,
441
+ pri: 0
442
+ },
443
+ {
444
+ c: "CL",
445
+ n: "Chile",
446
+ d: "56",
447
+ f: "X XXXX XXXX",
448
+ p: null,
449
+ min: 9,
450
+ max: 9,
451
+ pri: 0
452
+ },
453
+ {
454
+ c: "CN",
455
+ n: "China",
456
+ d: "86",
457
+ f: "XXX XXXX XXXX",
458
+ p: "0",
459
+ min: 7,
460
+ max: 11,
461
+ pri: 0
462
+ },
463
+ {
464
+ c: "CX",
465
+ n: "Christmas Island",
466
+ d: "61",
467
+ f: "XXX XXX XXX",
468
+ p: "0",
469
+ min: 9,
470
+ max: 9,
471
+ pri: 2
472
+ },
473
+ {
474
+ c: "CC",
475
+ n: "Cocos (Keeling) Islands",
476
+ d: "61",
477
+ f: "XXX XXX XXX",
478
+ p: "0",
479
+ min: 9,
480
+ max: 9,
481
+ pri: 1
482
+ },
483
+ {
484
+ c: "CO",
485
+ n: "Colombia",
486
+ d: "57",
487
+ f: "XXX XXXXXXX",
488
+ p: "0",
489
+ min: 8,
490
+ max: 10,
491
+ pri: 0
492
+ },
493
+ {
494
+ c: "KM",
495
+ n: "Comoros",
496
+ d: "269",
497
+ f: "XXX XX XX",
498
+ p: null,
499
+ min: 7,
500
+ max: 7,
501
+ pri: 0
502
+ },
503
+ {
504
+ c: "CG",
505
+ n: "Congo - Brazzaville",
506
+ d: "242",
507
+ f: "XX XXX XXXX",
508
+ p: null,
509
+ min: 9,
510
+ max: 9,
511
+ pri: 0
512
+ },
513
+ {
514
+ c: "CD",
515
+ n: "Congo - Kinshasa",
516
+ d: "243",
517
+ f: "XXX XXX XXX",
518
+ p: "0",
519
+ min: 7,
520
+ max: 10,
521
+ pri: 0
522
+ },
523
+ {
524
+ c: "CK",
525
+ n: "Cook Islands",
526
+ d: "682",
527
+ f: "XX XXX",
528
+ p: null,
529
+ min: 5,
530
+ max: 5,
531
+ pri: 0
532
+ },
533
+ {
534
+ c: "CR",
535
+ n: "Costa Rica",
536
+ d: "506",
537
+ f: "XXXX XXXX",
538
+ p: null,
539
+ min: 8,
540
+ max: 8,
541
+ pri: 0
542
+ },
543
+ {
544
+ c: "CI",
545
+ n: "C\xF4te d\u2019Ivoire",
546
+ d: "225",
547
+ f: "XX XX XX XXXX",
548
+ p: null,
549
+ min: 10,
550
+ max: 10,
551
+ pri: 0
552
+ },
553
+ {
554
+ c: "HR",
555
+ n: "Croatia",
556
+ d: "385",
557
+ f: "XX XXX XXXX",
558
+ p: "0",
559
+ min: 8,
560
+ max: 9,
561
+ pri: 0
562
+ },
563
+ {
564
+ c: "CU",
565
+ n: "Cuba",
566
+ d: "53",
567
+ f: "X XXXXXXX",
568
+ p: "0",
569
+ min: 6,
570
+ max: 10,
571
+ pri: 0
572
+ },
573
+ {
574
+ c: "CW",
575
+ n: "Cura\xE7ao",
576
+ d: "599",
577
+ f: "X XXX XXXX",
578
+ p: null,
579
+ min: 7,
580
+ max: 8,
581
+ pri: 0
582
+ },
583
+ {
584
+ c: "CY",
585
+ n: "Cyprus",
586
+ d: "357",
587
+ f: "XX XXXXXX",
588
+ p: null,
589
+ min: 8,
590
+ max: 8,
591
+ pri: 0
592
+ },
593
+ {
594
+ c: "CZ",
595
+ n: "Czechia",
596
+ d: "420",
597
+ f: "XXX XXX XXX",
598
+ p: null,
599
+ min: 9,
600
+ max: 9,
601
+ pri: 0
602
+ },
603
+ {
604
+ c: "DK",
605
+ n: "Denmark",
606
+ d: "45",
607
+ f: "XX XX XX XX",
608
+ p: null,
609
+ min: 8,
610
+ max: 8,
611
+ pri: 0
612
+ },
613
+ {
614
+ c: "DJ",
615
+ n: "Djibouti",
616
+ d: "253",
617
+ f: "XX XX XX XX",
618
+ p: null,
619
+ min: 8,
620
+ max: 8,
621
+ pri: 0
622
+ },
623
+ {
624
+ c: "DM",
625
+ n: "Dominica",
626
+ d: "1",
627
+ f: "XXX XXX XXXX",
628
+ p: "1",
629
+ min: 10,
630
+ max: 10,
631
+ pri: 8
632
+ },
633
+ {
634
+ c: "DO",
635
+ n: "Dominican Republic",
636
+ d: "1",
637
+ f: "XXX XXX XXXX",
638
+ p: "1",
639
+ min: 10,
640
+ max: 10,
641
+ pri: 9
642
+ },
643
+ {
644
+ c: "EC",
645
+ n: "Ecuador",
646
+ d: "593",
647
+ f: "XX XXX XXXX",
648
+ p: "0",
649
+ min: 8,
650
+ max: 9,
651
+ pri: 0
652
+ },
653
+ {
654
+ c: "EG",
655
+ n: "Egypt",
656
+ d: "20",
657
+ f: "XX XXXXXXXX",
658
+ p: "0",
659
+ min: 8,
660
+ max: 10,
661
+ pri: 0
662
+ },
663
+ {
664
+ c: "SV",
665
+ n: "El Salvador",
666
+ d: "503",
667
+ f: "XXXX XXXX",
668
+ p: null,
669
+ min: 8,
670
+ max: 8,
671
+ pri: 0
672
+ },
673
+ {
674
+ c: "GQ",
675
+ n: "Equatorial Guinea",
676
+ d: "240",
677
+ f: "XXX XXX XXX",
678
+ p: null,
679
+ min: 9,
680
+ max: 9,
681
+ pri: 0
682
+ },
683
+ {
684
+ c: "ER",
685
+ n: "Eritrea",
686
+ d: "291",
687
+ f: "X XXX XXX",
688
+ p: "0",
689
+ min: 7,
690
+ max: 7,
691
+ pri: 0
692
+ },
693
+ {
694
+ c: "EE",
695
+ n: "Estonia",
696
+ d: "372",
697
+ f: "XXX XXXX",
698
+ p: null,
699
+ min: 7,
700
+ max: 8,
701
+ pri: 0
702
+ },
703
+ {
704
+ c: "SZ",
705
+ n: "Eswatini",
706
+ d: "268",
707
+ f: "XXXX XXXX",
708
+ p: null,
709
+ min: 8,
710
+ max: 8,
711
+ pri: 0
712
+ },
713
+ {
714
+ c: "ET",
715
+ n: "Ethiopia",
716
+ d: "251",
717
+ f: "XX XXX XXXX",
718
+ p: "0",
719
+ min: 9,
720
+ max: 9,
721
+ pri: 0
722
+ },
723
+ {
724
+ c: "FK",
725
+ n: "Falkland Islands",
726
+ d: "500",
727
+ f: null,
728
+ p: null,
729
+ min: 5,
730
+ max: 5,
731
+ pri: 0
732
+ },
733
+ {
734
+ c: "FO",
735
+ n: "Faroe Islands",
736
+ d: "298",
737
+ f: "XXXXXX",
738
+ p: null,
739
+ min: 6,
740
+ max: 6,
741
+ pri: 0
742
+ },
743
+ {
744
+ c: "FJ",
745
+ n: "Fiji",
746
+ d: "679",
747
+ f: "XXX XXXX",
748
+ p: null,
749
+ min: 7,
750
+ max: 7,
751
+ pri: 0
752
+ },
753
+ {
754
+ c: "FI",
755
+ n: "Finland",
756
+ d: "358",
757
+ f: "XX XXXXXXX",
758
+ p: "0",
759
+ min: 5,
760
+ max: 10,
761
+ pri: 0
762
+ },
763
+ {
764
+ c: "FR",
765
+ n: "France",
766
+ d: "33",
767
+ f: "X XX XX XX XX",
768
+ p: "0",
769
+ min: 9,
770
+ max: 9,
771
+ pri: 0
772
+ },
773
+ {
774
+ c: "GF",
775
+ n: "French Guiana",
776
+ d: "594",
777
+ f: "XXX XX XX XX",
778
+ p: "0",
779
+ min: 9,
780
+ max: 9,
781
+ pri: 0
782
+ },
783
+ {
784
+ c: "PF",
785
+ n: "French Polynesia",
786
+ d: "689",
787
+ f: "XX XX XX XX",
788
+ p: null,
789
+ min: 8,
790
+ max: 8,
791
+ pri: 0
792
+ },
793
+ {
794
+ c: "GA",
795
+ n: "Gabon",
796
+ d: "241",
797
+ f: "XX XX XX XX",
798
+ p: null,
799
+ min: 7,
800
+ max: 8,
801
+ pri: 0
802
+ },
803
+ {
804
+ c: "GM",
805
+ n: "Gambia",
806
+ d: "220",
807
+ f: "XXX XXXX",
808
+ p: null,
809
+ min: 7,
810
+ max: 7,
811
+ pri: 0
812
+ },
813
+ {
814
+ c: "GE",
815
+ n: "Georgia",
816
+ d: "995",
817
+ f: "XXX XX XX XX",
818
+ p: "0",
819
+ min: 9,
820
+ max: 9,
821
+ pri: 0
822
+ },
823
+ {
824
+ c: "DE",
825
+ n: "Germany",
826
+ d: "49",
827
+ f: "XXXX XXXXXXX",
828
+ p: "0",
829
+ min: 5,
830
+ max: 15,
831
+ pri: 0
832
+ },
833
+ {
834
+ c: "GH",
835
+ n: "Ghana",
836
+ d: "233",
837
+ f: "XX XXX XXXX",
838
+ p: "0",
839
+ min: 9,
840
+ max: 9,
841
+ pri: 0
842
+ },
843
+ {
844
+ c: "GI",
845
+ n: "Gibraltar",
846
+ d: "350",
847
+ f: "XXX XXXXX",
848
+ p: null,
849
+ min: 8,
850
+ max: 8,
851
+ pri: 0
852
+ },
853
+ {
854
+ c: "GR",
855
+ n: "Greece",
856
+ d: "30",
857
+ f: "XXX XXX XXXX",
858
+ p: null,
859
+ min: 10,
860
+ max: 10,
861
+ pri: 0
862
+ },
863
+ {
864
+ c: "GL",
865
+ n: "Greenland",
866
+ d: "299",
867
+ f: "XX XX XX",
868
+ p: null,
869
+ min: 6,
870
+ max: 6,
871
+ pri: 0
872
+ },
873
+ {
874
+ c: "GD",
875
+ n: "Grenada",
876
+ d: "1",
877
+ f: "XXX XXX XXXX",
878
+ p: "1",
879
+ min: 10,
880
+ max: 10,
881
+ pri: 10
882
+ },
883
+ {
884
+ c: "GP",
885
+ n: "Guadeloupe",
886
+ d: "590",
887
+ f: "XXX XX XX XX",
888
+ p: "0",
889
+ min: 9,
890
+ max: 9,
891
+ pri: 0
892
+ },
893
+ {
894
+ c: "GU",
895
+ n: "Guam",
896
+ d: "1",
897
+ f: "XXX XXX XXXX",
898
+ p: "1",
899
+ min: 10,
900
+ max: 10,
901
+ pri: 11
902
+ },
903
+ {
904
+ c: "GT",
905
+ n: "Guatemala",
906
+ d: "502",
907
+ f: "XXXX XXXX",
908
+ p: null,
909
+ min: 8,
910
+ max: 8,
911
+ pri: 0
912
+ },
913
+ {
914
+ c: "GG",
915
+ n: "Guernsey",
916
+ d: "44",
917
+ f: "XXXX XXXXXX",
918
+ p: "0",
919
+ min: 10,
920
+ max: 10,
921
+ pri: 1
922
+ },
923
+ {
924
+ c: "GN",
925
+ n: "Guinea",
926
+ d: "224",
927
+ f: "XXX XX XX XX",
928
+ p: null,
929
+ min: 8,
930
+ max: 9,
931
+ pri: 0
932
+ },
933
+ {
934
+ c: "GW",
935
+ n: "Guinea-Bissau",
936
+ d: "245",
937
+ f: "XXX XXX XXX",
938
+ p: null,
939
+ min: 9,
940
+ max: 9,
941
+ pri: 0
942
+ },
943
+ {
944
+ c: "GY",
945
+ n: "Guyana",
946
+ d: "592",
947
+ f: "XXX XXXX",
948
+ p: null,
949
+ min: 7,
950
+ max: 7,
951
+ pri: 0
952
+ },
953
+ {
954
+ c: "HT",
955
+ n: "Haiti",
956
+ d: "509",
957
+ f: "XX XX XXXX",
958
+ p: null,
959
+ min: 8,
960
+ max: 8,
961
+ pri: 0
962
+ },
963
+ {
964
+ c: "HN",
965
+ n: "Honduras",
966
+ d: "504",
967
+ f: "XXXX XXXX",
968
+ p: null,
969
+ min: 8,
970
+ max: 8,
971
+ pri: 0
972
+ },
973
+ {
974
+ c: "HK",
975
+ n: "Hong Kong SAR China",
976
+ d: "852",
977
+ f: "XXXX XXXX",
978
+ p: null,
979
+ min: 8,
980
+ max: 8,
981
+ pri: 0
982
+ },
983
+ {
984
+ c: "HU",
985
+ n: "Hungary",
986
+ d: "36",
987
+ f: "XX XXX XXXX",
988
+ p: "06",
989
+ min: 8,
990
+ max: 9,
991
+ pri: 0
992
+ },
993
+ {
994
+ c: "IS",
995
+ n: "Iceland",
996
+ d: "354",
997
+ f: "XXX XXXX",
998
+ p: null,
999
+ min: 7,
1000
+ max: 9,
1001
+ pri: 0
1002
+ },
1003
+ {
1004
+ c: "IN",
1005
+ n: "India",
1006
+ d: "91",
1007
+ f: "XXXXX XXXXX",
1008
+ p: "0",
1009
+ min: 10,
1010
+ max: 10,
1011
+ pri: 0
1012
+ },
1013
+ {
1014
+ c: "ID",
1015
+ n: "Indonesia",
1016
+ d: "62",
1017
+ f: "XXX XXX XXX",
1018
+ p: "0",
1019
+ min: 7,
1020
+ max: 12,
1021
+ pri: 0
1022
+ },
1023
+ {
1024
+ c: "IR",
1025
+ n: "Iran",
1026
+ d: "98",
1027
+ f: "XXX XXX XXXX",
1028
+ p: "0",
1029
+ min: 6,
1030
+ max: 10,
1031
+ pri: 0
1032
+ },
1033
+ {
1034
+ c: "IQ",
1035
+ n: "Iraq",
1036
+ d: "964",
1037
+ f: "XXX XXX XXXX",
1038
+ p: "0",
1039
+ min: 8,
1040
+ max: 10,
1041
+ pri: 0
1042
+ },
1043
+ {
1044
+ c: "IE",
1045
+ n: "Ireland",
1046
+ d: "353",
1047
+ f: "XX XXX XXXX",
1048
+ p: "0",
1049
+ min: 7,
1050
+ max: 10,
1051
+ pri: 0
1052
+ },
1053
+ {
1054
+ c: "IM",
1055
+ n: "Isle of Man",
1056
+ d: "44",
1057
+ f: "XXXX XXXXXX",
1058
+ p: "0",
1059
+ min: 10,
1060
+ max: 10,
1061
+ pri: 2
1062
+ },
1063
+ {
1064
+ c: "IL",
1065
+ n: "Israel",
1066
+ d: "972",
1067
+ f: "XX XXX XXXX",
1068
+ p: "0",
1069
+ min: 8,
1070
+ max: 12,
1071
+ pri: 0
1072
+ },
1073
+ {
1074
+ c: "IT",
1075
+ n: "Italy",
1076
+ d: "39",
1077
+ f: "XXX XXX XXXX",
1078
+ p: null,
1079
+ min: 6,
1080
+ max: 12,
1081
+ pri: 0
1082
+ },
1083
+ {
1084
+ c: "JM",
1085
+ n: "Jamaica",
1086
+ d: "1",
1087
+ f: "XXX XXX XXXX",
1088
+ p: "1",
1089
+ min: 10,
1090
+ max: 10,
1091
+ pri: 12
1092
+ },
1093
+ {
1094
+ c: "JP",
1095
+ n: "Japan",
1096
+ d: "81",
1097
+ f: "XX XXXX XXXX",
1098
+ p: "0",
1099
+ min: 9,
1100
+ max: 10,
1101
+ pri: 0
1102
+ },
1103
+ {
1104
+ c: "JE",
1105
+ n: "Jersey",
1106
+ d: "44",
1107
+ f: "XXXX XXXXXX",
1108
+ p: "0",
1109
+ min: 10,
1110
+ max: 10,
1111
+ pri: 3
1112
+ },
1113
+ {
1114
+ c: "JO",
1115
+ n: "Jordan",
1116
+ d: "962",
1117
+ f: "X XXXX XXXX",
1118
+ p: "0",
1119
+ min: 8,
1120
+ max: 9,
1121
+ pri: 0
1122
+ },
1123
+ {
1124
+ c: "KZ",
1125
+ n: "Kazakhstan",
1126
+ d: "7",
1127
+ f: "XXX XXX XXXX",
1128
+ p: "8",
1129
+ min: 10,
1130
+ max: 10,
1131
+ pri: 1
1132
+ },
1133
+ {
1134
+ c: "KE",
1135
+ n: "Kenya",
1136
+ d: "254",
1137
+ f: "XXX XXXXXX",
1138
+ p: "0",
1139
+ min: 7,
1140
+ max: 9,
1141
+ pri: 0
1142
+ },
1143
+ {
1144
+ c: "KI",
1145
+ n: "Kiribati",
1146
+ d: "686",
1147
+ f: null,
1148
+ p: "0",
1149
+ min: 5,
1150
+ max: 8,
1151
+ pri: 0
1152
+ },
1153
+ {
1154
+ c: "XK",
1155
+ n: "Kosovo",
1156
+ d: "383",
1157
+ f: "XX XXX XXX",
1158
+ p: "0",
1159
+ min: 8,
1160
+ max: 12,
1161
+ pri: 0
1162
+ },
1163
+ {
1164
+ c: "KW",
1165
+ n: "Kuwait",
1166
+ d: "965",
1167
+ f: "XXX XXXXX",
1168
+ p: null,
1169
+ min: 8,
1170
+ max: 8,
1171
+ pri: 0
1172
+ },
1173
+ {
1174
+ c: "KG",
1175
+ n: "Kyrgyzstan",
1176
+ d: "996",
1177
+ f: "XXX XXX XXX",
1178
+ p: "0",
1179
+ min: 9,
1180
+ max: 9,
1181
+ pri: 0
1182
+ },
1183
+ {
1184
+ c: "LA",
1185
+ n: "Laos",
1186
+ d: "856",
1187
+ f: "XX XX XXX XXX",
1188
+ p: "0",
1189
+ min: 8,
1190
+ max: 10,
1191
+ pri: 0
1192
+ },
1193
+ {
1194
+ c: "LV",
1195
+ n: "Latvia",
1196
+ d: "371",
1197
+ f: "XX XXX XXX",
1198
+ p: null,
1199
+ min: 8,
1200
+ max: 8,
1201
+ pri: 0
1202
+ },
1203
+ {
1204
+ c: "LB",
1205
+ n: "Lebanon",
1206
+ d: "961",
1207
+ f: "XX XXX XXX",
1208
+ p: "0",
1209
+ min: 7,
1210
+ max: 8,
1211
+ pri: 0
1212
+ },
1213
+ {
1214
+ c: "LS",
1215
+ n: "Lesotho",
1216
+ d: "266",
1217
+ f: "XXXX XXXX",
1218
+ p: null,
1219
+ min: 8,
1220
+ max: 8,
1221
+ pri: 0
1222
+ },
1223
+ {
1224
+ c: "LR",
1225
+ n: "Liberia",
1226
+ d: "231",
1227
+ f: "XX XXX XXXX",
1228
+ p: "0",
1229
+ min: 7,
1230
+ max: 9,
1231
+ pri: 0
1232
+ },
1233
+ {
1234
+ c: "LY",
1235
+ n: "Libya",
1236
+ d: "218",
1237
+ f: "XX XXXXXXX",
1238
+ p: "0",
1239
+ min: 9,
1240
+ max: 9,
1241
+ pri: 0
1242
+ },
1243
+ {
1244
+ c: "LI",
1245
+ n: "Liechtenstein",
1246
+ d: "423",
1247
+ f: "XXX XXX XXX",
1248
+ p: "0",
1249
+ min: 7,
1250
+ max: 9,
1251
+ pri: 0
1252
+ },
1253
+ {
1254
+ c: "LT",
1255
+ n: "Lithuania",
1256
+ d: "370",
1257
+ f: "XXX XXXXX",
1258
+ p: "0",
1259
+ min: 8,
1260
+ max: 8,
1261
+ pri: 0
1262
+ },
1263
+ {
1264
+ c: "LU",
1265
+ n: "Luxembourg",
1266
+ d: "352",
1267
+ f: "XXX XXX XXX",
1268
+ p: null,
1269
+ min: 4,
1270
+ max: 11,
1271
+ pri: 0
1272
+ },
1273
+ {
1274
+ c: "MO",
1275
+ n: "Macao SAR China",
1276
+ d: "853",
1277
+ f: "XXXX XXXX",
1278
+ p: null,
1279
+ min: 8,
1280
+ max: 8,
1281
+ pri: 0
1282
+ },
1283
+ {
1284
+ c: "MG",
1285
+ n: "Madagascar",
1286
+ d: "261",
1287
+ f: "XX XX XXX XX",
1288
+ p: "0",
1289
+ min: 9,
1290
+ max: 9,
1291
+ pri: 0
1292
+ },
1293
+ {
1294
+ c: "MW",
1295
+ n: "Malawi",
1296
+ d: "265",
1297
+ f: "XXX XX XX XX",
1298
+ p: "0",
1299
+ min: 7,
1300
+ max: 9,
1301
+ pri: 0
1302
+ },
1303
+ {
1304
+ c: "MY",
1305
+ n: "Malaysia",
1306
+ d: "60",
1307
+ f: "XX XXX XXXX",
1308
+ p: "0",
1309
+ min: 8,
1310
+ max: 10,
1311
+ pri: 0
1312
+ },
1313
+ {
1314
+ c: "MV",
1315
+ n: "Maldives",
1316
+ d: "960",
1317
+ f: "XXX XXXX",
1318
+ p: null,
1319
+ min: 7,
1320
+ max: 7,
1321
+ pri: 0
1322
+ },
1323
+ {
1324
+ c: "ML",
1325
+ n: "Mali",
1326
+ d: "223",
1327
+ f: "XX XX XX XX",
1328
+ p: null,
1329
+ min: 8,
1330
+ max: 8,
1331
+ pri: 0
1332
+ },
1333
+ {
1334
+ c: "MT",
1335
+ n: "Malta",
1336
+ d: "356",
1337
+ f: "XXXX XXXX",
1338
+ p: null,
1339
+ min: 8,
1340
+ max: 8,
1341
+ pri: 0
1342
+ },
1343
+ {
1344
+ c: "MH",
1345
+ n: "Marshall Islands",
1346
+ d: "692",
1347
+ f: "XXX XXXX",
1348
+ p: "1",
1349
+ min: 7,
1350
+ max: 7,
1351
+ pri: 0
1352
+ },
1353
+ {
1354
+ c: "MQ",
1355
+ n: "Martinique",
1356
+ d: "596",
1357
+ f: "XXX XX XX XX",
1358
+ p: "0",
1359
+ min: 9,
1360
+ max: 9,
1361
+ pri: 0
1362
+ },
1363
+ {
1364
+ c: "MR",
1365
+ n: "Mauritania",
1366
+ d: "222",
1367
+ f: "XX XX XX XX",
1368
+ p: null,
1369
+ min: 8,
1370
+ max: 8,
1371
+ pri: 0
1372
+ },
1373
+ {
1374
+ c: "MU",
1375
+ n: "Mauritius",
1376
+ d: "230",
1377
+ f: "XXXX XXXX",
1378
+ p: null,
1379
+ min: 7,
1380
+ max: 8,
1381
+ pri: 0
1382
+ },
1383
+ {
1384
+ c: "YT",
1385
+ n: "Mayotte",
1386
+ d: "262",
1387
+ f: "XXX XX XX XX",
1388
+ p: "0",
1389
+ min: 9,
1390
+ max: 9,
1391
+ pri: 1
1392
+ },
1393
+ {
1394
+ c: "MX",
1395
+ n: "Mexico",
1396
+ d: "52",
1397
+ f: "XXX XXX XXXX",
1398
+ p: null,
1399
+ min: 10,
1400
+ max: 10,
1401
+ pri: 0
1402
+ },
1403
+ {
1404
+ c: "FM",
1405
+ n: "Micronesia",
1406
+ d: "691",
1407
+ f: "XXX XXXX",
1408
+ p: null,
1409
+ min: 7,
1410
+ max: 7,
1411
+ pri: 0
1412
+ },
1413
+ {
1414
+ c: "MD",
1415
+ n: "Moldova",
1416
+ d: "373",
1417
+ f: "XXX XX XXX",
1418
+ p: "0",
1419
+ min: 8,
1420
+ max: 8,
1421
+ pri: 0
1422
+ },
1423
+ {
1424
+ c: "MC",
1425
+ n: "Monaco",
1426
+ d: "377",
1427
+ f: "X XX XX XX XX",
1428
+ p: "0",
1429
+ min: 8,
1430
+ max: 9,
1431
+ pri: 0
1432
+ },
1433
+ {
1434
+ c: "MN",
1435
+ n: "Mongolia",
1436
+ d: "976",
1437
+ f: "XXXX XXXX",
1438
+ p: "0",
1439
+ min: 8,
1440
+ max: 10,
1441
+ pri: 0
1442
+ },
1443
+ {
1444
+ c: "ME",
1445
+ n: "Montenegro",
1446
+ d: "382",
1447
+ f: "XX XXX XXX",
1448
+ p: "0",
1449
+ min: 8,
1450
+ max: 8,
1451
+ pri: 0
1452
+ },
1453
+ {
1454
+ c: "MS",
1455
+ n: "Montserrat",
1456
+ d: "1",
1457
+ f: "XXX XXX XXXX",
1458
+ p: "1",
1459
+ min: 10,
1460
+ max: 10,
1461
+ pri: 17
1462
+ },
1463
+ {
1464
+ c: "MA",
1465
+ n: "Morocco",
1466
+ d: "212",
1467
+ f: "X XX XX XX XX",
1468
+ p: "0",
1469
+ min: 9,
1470
+ max: 9,
1471
+ pri: 0
1472
+ },
1473
+ {
1474
+ c: "MZ",
1475
+ n: "Mozambique",
1476
+ d: "258",
1477
+ f: "XX XXX XXXX",
1478
+ p: null,
1479
+ min: 8,
1480
+ max: 9,
1481
+ pri: 0
1482
+ },
1483
+ {
1484
+ c: "MM",
1485
+ n: "Myanmar (Burma)",
1486
+ d: "95",
1487
+ f: "X XXX XXXX",
1488
+ p: "0",
1489
+ min: 6,
1490
+ max: 10,
1491
+ pri: 0
1492
+ },
1493
+ {
1494
+ c: "NA",
1495
+ n: "Namibia",
1496
+ d: "264",
1497
+ f: "XX XXX XXXX",
1498
+ p: "0",
1499
+ min: 8,
1500
+ max: 9,
1501
+ pri: 0
1502
+ },
1503
+ {
1504
+ c: "NR",
1505
+ n: "Nauru",
1506
+ d: "674",
1507
+ f: "XXX XXXX",
1508
+ p: null,
1509
+ min: 7,
1510
+ max: 7,
1511
+ pri: 0
1512
+ },
1513
+ {
1514
+ c: "NP",
1515
+ n: "Nepal",
1516
+ d: "977",
1517
+ f: "XXX XXXXXXX",
1518
+ p: "0",
1519
+ min: 8,
1520
+ max: 10,
1521
+ pri: 0
1522
+ },
1523
+ {
1524
+ c: "NL",
1525
+ n: "Netherlands",
1526
+ d: "31",
1527
+ f: "X XXXXXXXX",
1528
+ p: "0",
1529
+ min: 9,
1530
+ max: 11,
1531
+ pri: 0
1532
+ },
1533
+ {
1534
+ c: "NC",
1535
+ n: "New Caledonia",
1536
+ d: "687",
1537
+ f: "XX XX XX",
1538
+ p: null,
1539
+ min: 6,
1540
+ max: 6,
1541
+ pri: 0
1542
+ },
1543
+ {
1544
+ c: "NZ",
1545
+ n: "New Zealand",
1546
+ d: "64",
1547
+ f: "XX XXX XXXX",
1548
+ p: "0",
1549
+ min: 8,
1550
+ max: 10,
1551
+ pri: 0
1552
+ },
1553
+ {
1554
+ c: "NI",
1555
+ n: "Nicaragua",
1556
+ d: "505",
1557
+ f: "XXXX XXXX",
1558
+ p: null,
1559
+ min: 8,
1560
+ max: 8,
1561
+ pri: 0
1562
+ },
1563
+ {
1564
+ c: "NE",
1565
+ n: "Niger",
1566
+ d: "227",
1567
+ f: "XX XX XX XX",
1568
+ p: null,
1569
+ min: 8,
1570
+ max: 8,
1571
+ pri: 0
1572
+ },
1573
+ {
1574
+ c: "NG",
1575
+ n: "Nigeria",
1576
+ d: "234",
1577
+ f: "XXX XXX XXXX",
1578
+ p: "0",
1579
+ min: 10,
1580
+ max: 10,
1581
+ pri: 0
1582
+ },
1583
+ {
1584
+ c: "NU",
1585
+ n: "Niue",
1586
+ d: "683",
1587
+ f: "XXX XXXX",
1588
+ p: null,
1589
+ min: 4,
1590
+ max: 7,
1591
+ pri: 0
1592
+ },
1593
+ {
1594
+ c: "NF",
1595
+ n: "Norfolk Island",
1596
+ d: "672",
1597
+ f: "X XXXXX",
1598
+ p: null,
1599
+ min: 6,
1600
+ max: 6,
1601
+ pri: 0
1602
+ },
1603
+ {
1604
+ c: "KP",
1605
+ n: "North Korea",
1606
+ d: "850",
1607
+ f: "XXX XXX XXXX",
1608
+ p: "0",
1609
+ min: 8,
1610
+ max: 10,
1611
+ pri: 0
1612
+ },
1613
+ {
1614
+ c: "MK",
1615
+ n: "North Macedonia",
1616
+ d: "389",
1617
+ f: "XX XXX XXX",
1618
+ p: "0",
1619
+ min: 8,
1620
+ max: 8,
1621
+ pri: 0
1622
+ },
1623
+ {
1624
+ c: "MP",
1625
+ n: "Northern Mariana Islands",
1626
+ d: "1",
1627
+ f: "XXX XXX XXXX",
1628
+ p: "1",
1629
+ min: 10,
1630
+ max: 10,
1631
+ pri: 16
1632
+ },
1633
+ {
1634
+ c: "NO",
1635
+ n: "Norway",
1636
+ d: "47",
1637
+ f: "XX XX XX XX",
1638
+ p: null,
1639
+ min: 8,
1640
+ max: 8,
1641
+ pri: 0
1642
+ },
1643
+ {
1644
+ c: "OM",
1645
+ n: "Oman",
1646
+ d: "968",
1647
+ f: "XXXX XXXX",
1648
+ p: null,
1649
+ min: 8,
1650
+ max: 8,
1651
+ pri: 0
1652
+ },
1653
+ {
1654
+ c: "PK",
1655
+ n: "Pakistan",
1656
+ d: "92",
1657
+ f: "XXX XXXXXXX",
1658
+ p: "0",
1659
+ min: 9,
1660
+ max: 10,
1661
+ pri: 0
1662
+ },
1663
+ {
1664
+ c: "PW",
1665
+ n: "Palau",
1666
+ d: "680",
1667
+ f: "XXX XXXX",
1668
+ p: null,
1669
+ min: 7,
1670
+ max: 7,
1671
+ pri: 0
1672
+ },
1673
+ {
1674
+ c: "PS",
1675
+ n: "Palestinian Territories",
1676
+ d: "970",
1677
+ f: "XXX XXX XXX",
1678
+ p: "0",
1679
+ min: 8,
1680
+ max: 9,
1681
+ pri: 0
1682
+ },
1683
+ {
1684
+ c: "PA",
1685
+ n: "Panama",
1686
+ d: "507",
1687
+ f: "XXXX XXXX",
1688
+ p: null,
1689
+ min: 7,
1690
+ max: 8,
1691
+ pri: 0
1692
+ },
1693
+ {
1694
+ c: "PG",
1695
+ n: "Papua New Guinea",
1696
+ d: "675",
1697
+ f: "XXXX XXXX",
1698
+ p: null,
1699
+ min: 7,
1700
+ max: 8,
1701
+ pri: 0
1702
+ },
1703
+ {
1704
+ c: "PY",
1705
+ n: "Paraguay",
1706
+ d: "595",
1707
+ f: "XXX XXXXXX",
1708
+ p: "0",
1709
+ min: 7,
1710
+ max: 9,
1711
+ pri: 0
1712
+ },
1713
+ {
1714
+ c: "PE",
1715
+ n: "Peru",
1716
+ d: "51",
1717
+ f: "XXX XXX XXX",
1718
+ p: "0",
1719
+ min: 8,
1720
+ max: 9,
1721
+ pri: 0
1722
+ },
1723
+ {
1724
+ c: "PH",
1725
+ n: "Philippines",
1726
+ d: "63",
1727
+ f: "XXX XXX XXXX",
1728
+ p: "0",
1729
+ min: 6,
1730
+ max: 10,
1731
+ pri: 0
1732
+ },
1733
+ {
1734
+ c: "PL",
1735
+ n: "Poland",
1736
+ d: "48",
1737
+ f: "XXX XXX XXX",
1738
+ p: null,
1739
+ min: 7,
1740
+ max: 9,
1741
+ pri: 0
1742
+ },
1743
+ {
1744
+ c: "PT",
1745
+ n: "Portugal",
1746
+ d: "351",
1747
+ f: "XXX XXX XXX",
1748
+ p: null,
1749
+ min: 9,
1750
+ max: 9,
1751
+ pri: 0
1752
+ },
1753
+ {
1754
+ c: "PR",
1755
+ n: "Puerto Rico",
1756
+ d: "1",
1757
+ f: "XXX XXX XXXX",
1758
+ p: "1",
1759
+ min: 10,
1760
+ max: 10,
1761
+ pri: 18
1762
+ },
1763
+ {
1764
+ c: "QA",
1765
+ n: "Qatar",
1766
+ d: "974",
1767
+ f: "XXXX XXXX",
1768
+ p: null,
1769
+ min: 8,
1770
+ max: 8,
1771
+ pri: 0
1772
+ },
1773
+ {
1774
+ c: "RE",
1775
+ n: "R\xE9union",
1776
+ d: "262",
1777
+ f: "XXX XX XX XX",
1778
+ p: "0",
1779
+ min: 9,
1780
+ max: 9,
1781
+ pri: 0
1782
+ },
1783
+ {
1784
+ c: "RO",
1785
+ n: "Romania",
1786
+ d: "40",
1787
+ f: "XXX XXX XXX",
1788
+ p: "0",
1789
+ min: 6,
1790
+ max: 9,
1791
+ pri: 0
1792
+ },
1793
+ {
1794
+ c: "RU",
1795
+ n: "Russia",
1796
+ d: "7",
1797
+ f: "XXX XXX XX XX",
1798
+ p: "8",
1799
+ min: 10,
1800
+ max: 10,
1801
+ pri: 0
1802
+ },
1803
+ {
1804
+ c: "RW",
1805
+ n: "Rwanda",
1806
+ d: "250",
1807
+ f: "XXX XXX XXX",
1808
+ p: "0",
1809
+ min: 8,
1810
+ max: 9,
1811
+ pri: 0
1812
+ },
1813
+ {
1814
+ c: "WS",
1815
+ n: "Samoa",
1816
+ d: "685",
1817
+ f: "XX XXXXX",
1818
+ p: null,
1819
+ min: 5,
1820
+ max: 10,
1821
+ pri: 0
1822
+ },
1823
+ {
1824
+ c: "SM",
1825
+ n: "San Marino",
1826
+ d: "378",
1827
+ f: "XX XX XX XX",
1828
+ p: null,
1829
+ min: 8,
1830
+ max: 10,
1831
+ pri: 0
1832
+ },
1833
+ {
1834
+ c: "ST",
1835
+ n: "S\xE3o Tom\xE9 & Pr\xEDncipe",
1836
+ d: "239",
1837
+ f: "XXX XXXX",
1838
+ p: null,
1839
+ min: 7,
1840
+ max: 7,
1841
+ pri: 0
1842
+ },
1843
+ {
1844
+ c: "SA",
1845
+ n: "Saudi Arabia",
1846
+ d: "966",
1847
+ f: "XX XXX XXXX",
1848
+ p: "0",
1849
+ min: 9,
1850
+ max: 9,
1851
+ pri: 0
1852
+ },
1853
+ {
1854
+ c: "SN",
1855
+ n: "Senegal",
1856
+ d: "221",
1857
+ f: "XX XXX XX XX",
1858
+ p: null,
1859
+ min: 9,
1860
+ max: 9,
1861
+ pri: 0
1862
+ },
1863
+ {
1864
+ c: "RS",
1865
+ n: "Serbia",
1866
+ d: "381",
1867
+ f: "XX XXXXXXX",
1868
+ p: "0",
1869
+ min: 7,
1870
+ max: 12,
1871
+ pri: 0
1872
+ },
1873
+ {
1874
+ c: "SC",
1875
+ n: "Seychelles",
1876
+ d: "248",
1877
+ f: "X XXX XXX",
1878
+ p: null,
1879
+ min: 7,
1880
+ max: 7,
1881
+ pri: 0
1882
+ },
1883
+ {
1884
+ c: "SL",
1885
+ n: "Sierra Leone",
1886
+ d: "232",
1887
+ f: "XX XXXXXX",
1888
+ p: "0",
1889
+ min: 8,
1890
+ max: 8,
1891
+ pri: 0
1892
+ },
1893
+ {
1894
+ c: "SG",
1895
+ n: "Singapore",
1896
+ d: "65",
1897
+ f: "XXXX XXXX",
1898
+ p: null,
1899
+ min: 8,
1900
+ max: 8,
1901
+ pri: 0
1902
+ },
1903
+ {
1904
+ c: "SX",
1905
+ n: "Sint Maarten",
1906
+ d: "1",
1907
+ f: "XXX XXX XXXX",
1908
+ p: "1",
1909
+ min: 10,
1910
+ max: 10,
1911
+ pri: 19
1912
+ },
1913
+ {
1914
+ c: "SK",
1915
+ n: "Slovakia",
1916
+ d: "421",
1917
+ f: "XXX XXX XXX",
1918
+ p: "0",
1919
+ min: 6,
1920
+ max: 9,
1921
+ pri: 0
1922
+ },
1923
+ {
1924
+ c: "SI",
1925
+ n: "Slovenia",
1926
+ d: "386",
1927
+ f: "XX XXX XXX",
1928
+ p: "0",
1929
+ min: 8,
1930
+ max: 8,
1931
+ pri: 0
1932
+ },
1933
+ {
1934
+ c: "SB",
1935
+ n: "Solomon Islands",
1936
+ d: "677",
1937
+ f: "XX XXXXX",
1938
+ p: null,
1939
+ min: 5,
1940
+ max: 7,
1941
+ pri: 0
1942
+ },
1943
+ {
1944
+ c: "SO",
1945
+ n: "Somalia",
1946
+ d: "252",
1947
+ f: "X XXXXXXX",
1948
+ p: "0",
1949
+ min: 6,
1950
+ max: 9,
1951
+ pri: 0
1952
+ },
1953
+ {
1954
+ c: "ZA",
1955
+ n: "South Africa",
1956
+ d: "27",
1957
+ f: "XX XXX XXXX",
1958
+ p: "0",
1959
+ min: 5,
1960
+ max: 9,
1961
+ pri: 0
1962
+ },
1963
+ {
1964
+ c: "KR",
1965
+ n: "South Korea",
1966
+ d: "82",
1967
+ f: "XXXX XXXX",
1968
+ p: "0",
1969
+ min: 5,
1970
+ max: 10,
1971
+ pri: 0
1972
+ },
1973
+ {
1974
+ c: "SS",
1975
+ n: "South Sudan",
1976
+ d: "211",
1977
+ f: "XXX XXX XXX",
1978
+ p: "0",
1979
+ min: 9,
1980
+ max: 9,
1981
+ pri: 0
1982
+ },
1983
+ {
1984
+ c: "ES",
1985
+ n: "Spain",
1986
+ d: "34",
1987
+ f: "XXX XX XX XX",
1988
+ p: null,
1989
+ min: 9,
1990
+ max: 9,
1991
+ pri: 0
1992
+ },
1993
+ {
1994
+ c: "LK",
1995
+ n: "Sri Lanka",
1996
+ d: "94",
1997
+ f: "XX XXX XXXX",
1998
+ p: "0",
1999
+ min: 9,
2000
+ max: 9,
2001
+ pri: 0
2002
+ },
2003
+ {
2004
+ c: "BL",
2005
+ n: "St. Barth\xE9lemy",
2006
+ d: "590",
2007
+ f: "XXX XX XX XX",
2008
+ p: "0",
2009
+ min: 9,
2010
+ max: 9,
2011
+ pri: 1
2012
+ },
2013
+ {
2014
+ c: "SH",
2015
+ n: "St. Helena",
2016
+ d: "290",
2017
+ f: null,
2018
+ p: null,
2019
+ min: 4,
2020
+ max: 5,
2021
+ pri: 0
2022
+ },
2023
+ {
2024
+ c: "KN",
2025
+ n: "St. Kitts & Nevis",
2026
+ d: "1",
2027
+ f: "XXX XXX XXXX",
2028
+ p: "1",
2029
+ min: 10,
2030
+ max: 10,
2031
+ pri: 13
2032
+ },
2033
+ {
2034
+ c: "LC",
2035
+ n: "St. Lucia",
2036
+ d: "1",
2037
+ f: "XXX XXX XXXX",
2038
+ p: "1",
2039
+ min: 10,
2040
+ max: 10,
2041
+ pri: 15
2042
+ },
2043
+ {
2044
+ c: "MF",
2045
+ n: "St. Martin",
2046
+ d: "590",
2047
+ f: "XXX XX XX XX",
2048
+ p: "0",
2049
+ min: 9,
2050
+ max: 9,
2051
+ pri: 2
2052
+ },
2053
+ {
2054
+ c: "PM",
2055
+ n: "St. Pierre & Miquelon",
2056
+ d: "508",
2057
+ f: "XX XX XX",
2058
+ p: "0",
2059
+ min: 6,
2060
+ max: 9,
2061
+ pri: 0
2062
+ },
2063
+ {
2064
+ c: "VC",
2065
+ n: "St. Vincent & Grenadines",
2066
+ d: "1",
2067
+ f: "XXX XXX XXXX",
2068
+ p: "1",
2069
+ min: 10,
2070
+ max: 10,
2071
+ pri: 22
2072
+ },
2073
+ {
2074
+ c: "SD",
2075
+ n: "Sudan",
2076
+ d: "249",
2077
+ f: "XX XXX XXXX",
2078
+ p: "0",
2079
+ min: 9,
2080
+ max: 9,
2081
+ pri: 0
2082
+ },
2083
+ {
2084
+ c: "SR",
2085
+ n: "Suriname",
2086
+ d: "597",
2087
+ f: "XXX XXXX",
2088
+ p: null,
2089
+ min: 6,
2090
+ max: 7,
2091
+ pri: 0
2092
+ },
2093
+ {
2094
+ c: "SJ",
2095
+ n: "Svalbard & Jan Mayen",
2096
+ d: "47",
2097
+ f: "XX XX XX XX",
2098
+ p: null,
2099
+ min: 8,
2100
+ max: 8,
2101
+ pri: 1
2102
+ },
2103
+ {
2104
+ c: "SE",
2105
+ n: "Sweden",
2106
+ d: "46",
2107
+ f: "XX XXX XX XX",
2108
+ p: "0",
2109
+ min: 7,
2110
+ max: 9,
2111
+ pri: 0
2112
+ },
2113
+ {
2114
+ c: "CH",
2115
+ n: "Switzerland",
2116
+ d: "41",
2117
+ f: "XX XXX XX XX",
2118
+ p: "0",
2119
+ min: 9,
2120
+ max: 9,
2121
+ pri: 0
2122
+ },
2123
+ {
2124
+ c: "SY",
2125
+ n: "Syria",
2126
+ d: "963",
2127
+ f: "XXX XXX XXX",
2128
+ p: "0",
2129
+ min: 8,
2130
+ max: 9,
2131
+ pri: 0
2132
+ },
2133
+ {
2134
+ c: "TW",
2135
+ n: "Taiwan",
2136
+ d: "886",
2137
+ f: "XXX XXX XXX",
2138
+ p: "0",
2139
+ min: 8,
2140
+ max: 9,
2141
+ pri: 0
2142
+ },
2143
+ {
2144
+ c: "TJ",
2145
+ n: "Tajikistan",
2146
+ d: "992",
2147
+ f: "XX XXX XXXX",
2148
+ p: null,
2149
+ min: 9,
2150
+ max: 9,
2151
+ pri: 0
2152
+ },
2153
+ {
2154
+ c: "TZ",
2155
+ n: "Tanzania",
2156
+ d: "255",
2157
+ f: "XXX XXX XXX",
2158
+ p: "0",
2159
+ min: 9,
2160
+ max: 9,
2161
+ pri: 0
2162
+ },
2163
+ {
2164
+ c: "TH",
2165
+ n: "Thailand",
2166
+ d: "66",
2167
+ f: "XX XXX XXXX",
2168
+ p: "0",
2169
+ min: 8,
2170
+ max: 9,
2171
+ pri: 0
2172
+ },
2173
+ {
2174
+ c: "TL",
2175
+ n: "Timor-Leste",
2176
+ d: "670",
2177
+ f: "XXXX XXXX",
2178
+ p: null,
2179
+ min: 7,
2180
+ max: 8,
2181
+ pri: 0
2182
+ },
2183
+ {
2184
+ c: "TG",
2185
+ n: "Togo",
2186
+ d: "228",
2187
+ f: "XX XX XX XX",
2188
+ p: null,
2189
+ min: 8,
2190
+ max: 8,
2191
+ pri: 0
2192
+ },
2193
+ {
2194
+ c: "TK",
2195
+ n: "Tokelau",
2196
+ d: "690",
2197
+ f: null,
2198
+ p: null,
2199
+ min: 4,
2200
+ max: 7,
2201
+ pri: 0
2202
+ },
2203
+ {
2204
+ c: "TO",
2205
+ n: "Tonga",
2206
+ d: "676",
2207
+ f: "XXX XXXX",
2208
+ p: null,
2209
+ min: 5,
2210
+ max: 7,
2211
+ pri: 0
2212
+ },
2213
+ {
2214
+ c: "TT",
2215
+ n: "Trinidad & Tobago",
2216
+ d: "1",
2217
+ f: "XXX XXX XXXX",
2218
+ p: "1",
2219
+ min: 10,
2220
+ max: 10,
2221
+ pri: 21
2222
+ },
2223
+ {
2224
+ c: "TA",
2225
+ n: "Tristan da Cunha",
2226
+ d: "290",
2227
+ f: null,
2228
+ p: null,
2229
+ min: 4,
2230
+ max: 4,
2231
+ pri: 1
2232
+ },
2233
+ {
2234
+ c: "TN",
2235
+ n: "Tunisia",
2236
+ d: "216",
2237
+ f: "XX XXX XXX",
2238
+ p: null,
2239
+ min: 8,
2240
+ max: 8,
2241
+ pri: 0
2242
+ },
2243
+ {
2244
+ c: "TR",
2245
+ n: "T\xFCrkiye",
2246
+ d: "90",
2247
+ f: "XXX XXX XX XX",
2248
+ p: "0",
2249
+ min: 10,
2250
+ max: 10,
2251
+ pri: 0
2252
+ },
2253
+ {
2254
+ c: "TM",
2255
+ n: "Turkmenistan",
2256
+ d: "993",
2257
+ f: "XX XXXXXX",
2258
+ p: "8",
2259
+ min: 8,
2260
+ max: 8,
2261
+ pri: 0
2262
+ },
2263
+ {
2264
+ c: "TC",
2265
+ n: "Turks & Caicos Islands",
2266
+ d: "1",
2267
+ f: "XXX XXX XXXX",
2268
+ p: "1",
2269
+ min: 10,
2270
+ max: 10,
2271
+ pri: 20
2272
+ },
2273
+ {
2274
+ c: "TV",
2275
+ n: "Tuvalu",
2276
+ d: "688",
2277
+ f: "XX XXXX",
2278
+ p: null,
2279
+ min: 5,
2280
+ max: 7,
2281
+ pri: 0
2282
+ },
2283
+ {
2284
+ c: "VI",
2285
+ n: "U.S. Virgin Islands",
2286
+ d: "1",
2287
+ f: "XXX XXX XXXX",
2288
+ p: "1",
2289
+ min: 10,
2290
+ max: 10,
2291
+ pri: 24
2292
+ },
2293
+ {
2294
+ c: "UG",
2295
+ n: "Uganda",
2296
+ d: "256",
2297
+ f: "XXX XXXXXX",
2298
+ p: "0",
2299
+ min: 9,
2300
+ max: 9,
2301
+ pri: 0
2302
+ },
2303
+ {
2304
+ c: "UA",
2305
+ n: "Ukraine",
2306
+ d: "380",
2307
+ f: "XX XXX XXXX",
2308
+ p: "0",
2309
+ min: 9,
2310
+ max: 9,
2311
+ pri: 0
2312
+ },
2313
+ {
2314
+ c: "AE",
2315
+ n: "United Arab Emirates",
2316
+ d: "971",
2317
+ f: "XX XXX XXXX",
2318
+ p: "0",
2319
+ min: 8,
2320
+ max: 9,
2321
+ pri: 0
2322
+ },
2323
+ {
2324
+ c: "GB",
2325
+ n: "United Kingdom",
2326
+ d: "44",
2327
+ f: "XXXX XXXXXX",
2328
+ p: "0",
2329
+ min: 9,
2330
+ max: 10,
2331
+ pri: 0
2332
+ },
2333
+ {
2334
+ c: "US",
2335
+ n: "United States",
2336
+ d: "1",
2337
+ f: "XXX XXX XXXX",
2338
+ p: "1",
2339
+ min: 10,
2340
+ max: 10,
2341
+ pri: 0
2342
+ },
2343
+ {
2344
+ c: "UY",
2345
+ n: "Uruguay",
2346
+ d: "598",
2347
+ f: "XX XXX XXX",
2348
+ p: "0",
2349
+ min: 8,
2350
+ max: 8,
2351
+ pri: 0
2352
+ },
2353
+ {
2354
+ c: "UZ",
2355
+ n: "Uzbekistan",
2356
+ d: "998",
2357
+ f: "XX XXX XX XX",
2358
+ p: null,
2359
+ min: 9,
2360
+ max: 9,
2361
+ pri: 0
2362
+ },
2363
+ {
2364
+ c: "VU",
2365
+ n: "Vanuatu",
2366
+ d: "678",
2367
+ f: "XXX XXXX",
2368
+ p: null,
2369
+ min: 5,
2370
+ max: 7,
2371
+ pri: 0
2372
+ },
2373
+ {
2374
+ c: "VA",
2375
+ n: "Vatican City",
2376
+ d: "39",
2377
+ f: "XXX XXX XXXX",
2378
+ p: null,
2379
+ min: 6,
2380
+ max: 11,
2381
+ pri: 1
2382
+ },
2383
+ {
2384
+ c: "VE",
2385
+ n: "Venezuela",
2386
+ d: "58",
2387
+ f: "XXX XXXXXXX",
2388
+ p: "0",
2389
+ min: 10,
2390
+ max: 10,
2391
+ pri: 0
2392
+ },
2393
+ {
2394
+ c: "VN",
2395
+ n: "Vietnam",
2396
+ d: "84",
2397
+ f: "XXX XXX XXX",
2398
+ p: "0",
2399
+ min: 9,
2400
+ max: 10,
2401
+ pri: 0
2402
+ },
2403
+ {
2404
+ c: "WF",
2405
+ n: "Wallis & Futuna",
2406
+ d: "681",
2407
+ f: "XX XX XX",
2408
+ p: null,
2409
+ min: 6,
2410
+ max: 6,
2411
+ pri: 0
2412
+ },
2413
+ {
2414
+ c: "EH",
2415
+ n: "Western Sahara",
2416
+ d: "212",
2417
+ f: "X XX XX XX XX",
2418
+ p: "0",
2419
+ min: 9,
2420
+ max: 9,
2421
+ pri: 1
2422
+ },
2423
+ {
2424
+ c: "YE",
2425
+ n: "Yemen",
2426
+ d: "967",
2427
+ f: "XXX XXX XXX",
2428
+ p: "0",
2429
+ min: 7,
2430
+ max: 9,
2431
+ pri: 0
2432
+ },
2433
+ {
2434
+ c: "ZM",
2435
+ n: "Zambia",
2436
+ d: "260",
2437
+ f: "XX XXXXXXX",
2438
+ p: "0",
2439
+ min: 9,
2440
+ max: 9,
2441
+ pri: 0
2442
+ },
2443
+ {
2444
+ c: "ZW",
2445
+ n: "Zimbabwe",
2446
+ d: "263",
2447
+ f: "XX XXX XXXX",
2448
+ p: "0",
2449
+ min: 5,
2450
+ max: 10,
2451
+ pri: 0
2452
+ }
2453
+ ];
2454
+
2455
+ // src/core/format.ts
2456
+ var TRAILING_SEP = /[\s\-]+$/;
2457
+ var FALLBACK_GROUP = /(.{4})(?=.)/g;
2458
+ var NON_ASCII_DIGITS = /[\u0660-\u0669\u06F0-\u06F9]/g;
2459
+ function isDigit(ch) {
2460
+ const c = ch.charCodeAt(0);
2461
+ return c >= 48 && c <= 57;
2462
+ }
2463
+ function formatPhone(digits, pattern) {
2464
+ if (!digits) return "";
2465
+ if (!pattern) {
2466
+ return digits.replace(FALLBACK_GROUP, "$1 ");
2467
+ }
2468
+ let result = "";
2469
+ let digitIndex = 0;
2470
+ for (const char of pattern) {
2471
+ if (digitIndex >= digits.length) break;
2472
+ if (char === "X") {
2473
+ result += digits[digitIndex++];
2474
+ } else {
2475
+ result += char;
2476
+ }
2477
+ }
2478
+ if (digitIndex < digits.length) {
2479
+ result += digits.slice(digitIndex);
2480
+ }
2481
+ return result.replace(TRAILING_SEP, "");
2482
+ }
2483
+ function getCursorPosition(oldValue, oldCursor, newValue) {
2484
+ let digitsBeforeCursor = 0;
2485
+ for (let i = 0; i < oldCursor && i < oldValue.length; i++) {
2486
+ if (isDigit(oldValue[i])) {
2487
+ digitsBeforeCursor++;
2488
+ }
2489
+ }
2490
+ let digitCount = 0;
2491
+ for (let i = 0; i < newValue.length; i++) {
2492
+ if (isDigit(newValue[i])) {
2493
+ digitCount++;
2494
+ }
2495
+ if (digitCount === digitsBeforeCursor) {
2496
+ return i + 1;
2497
+ }
2498
+ }
2499
+ return newValue.length;
2500
+ }
2501
+ function extractDigits(value) {
2502
+ return value.replace(/\D/g, "");
2503
+ }
2504
+ function normalizeNumerals(value) {
2505
+ return value.replace(NON_ASCII_DIGITS, (c) => {
2506
+ const code = c.charCodeAt(0);
2507
+ return code <= 1641 ? String(code - 1632) : String(code - 1776);
2508
+ });
2509
+ }
2510
+
2511
+ // src/core/countries.ts
2512
+ function getFlag(code) {
2513
+ return String.fromCodePoint(
2514
+ ...[...code.toUpperCase()].map((c) => 127462 + c.charCodeAt(0) - 65)
2515
+ );
2516
+ }
2517
+ function processCountryData(raw) {
2518
+ return raw.map((d) => ({
2519
+ code: d.c,
2520
+ name: d.n,
2521
+ dialCode: d.d,
2522
+ format: d.f,
2523
+ nationalPrefix: d.p,
2524
+ minLength: d.min,
2525
+ maxLength: d.max,
2526
+ priority: d.pri
2527
+ }));
2528
+ }
2529
+ function getCountryByCode(countries, code) {
2530
+ const upper = code.toUpperCase();
2531
+ return countries.find((c) => c.code === upper);
2532
+ }
2533
+ var _allCountries = null;
2534
+ function getAllCountries() {
2535
+ if (!_allCountries) _allCountries = processCountryData(phone_countries_default);
2536
+ return _allCountries;
2537
+ }
2538
+ function getCountryByDialCode(countries, dialCode) {
2539
+ let best;
2540
+ for (const c of countries) {
2541
+ if (c.dialCode !== dialCode) continue;
2542
+ if (!best || c.priority < best.priority) best = c;
2543
+ }
2544
+ return best;
2545
+ }
2546
+
2547
+ // src/core/validate.ts
2548
+ function validatePhone(digits, country) {
2549
+ const currentDigits = digits.length;
2550
+ const { minLength, maxLength } = country;
2551
+ if (currentDigits < minLength) {
2552
+ return {
2553
+ valid: false,
2554
+ reason: "too_short",
2555
+ minDigits: minLength,
2556
+ maxDigits: maxLength,
2557
+ currentDigits
2558
+ };
2559
+ }
2560
+ if (currentDigits > maxLength) {
2561
+ return {
2562
+ valid: false,
2563
+ reason: "too_long",
2564
+ minDigits: minLength,
2565
+ maxDigits: maxLength,
2566
+ currentDigits
2567
+ };
2568
+ }
2569
+ return {
2570
+ valid: true,
2571
+ minDigits: minLength,
2572
+ maxDigits: maxLength,
2573
+ currentDigits
2574
+ };
2575
+ }
2576
+
2577
+ // src/vanilla/dropdown.ts
2578
+ var nextId = 0;
2579
+ var Dropdown = class {
2580
+ constructor(options) {
2581
+ this.el = null;
2582
+ this.searchInput = null;
2583
+ this.listEl = null;
2584
+ this.liveRegion = null;
2585
+ this.highlightIndex = -1;
2586
+ this.filteredItems = [];
2587
+ this.orderedCountries = null;
2588
+ this.searchTimeout = null;
2589
+ this.ac = null;
2590
+ this.displayNames = null;
2591
+ this.options = options;
2592
+ this.id = nextId++;
2593
+ if (options.locale && typeof Intl?.DisplayNames === "function") {
2594
+ try {
2595
+ this.displayNames = new Intl.DisplayNames([options.locale], { type: "region" });
2596
+ } catch {
2597
+ }
2598
+ }
2599
+ }
2600
+ open(anchorEl) {
2601
+ if (this.el) return;
2602
+ this.ac = new AbortController();
2603
+ const signal = this.ac.signal;
2604
+ this.el = document.createElement("div");
2605
+ this.el.className = "lpi__dropdown";
2606
+ this.el.setAttribute("role", "dialog");
2607
+ this.el.setAttribute("aria-label", "Select country");
2608
+ this.searchInput = document.createElement("input");
2609
+ this.searchInput.className = "lpi__search";
2610
+ this.searchInput.type = "text";
2611
+ this.searchInput.setAttribute("role", "combobox");
2612
+ this.searchInput.setAttribute("aria-expanded", "true");
2613
+ this.searchInput.setAttribute("aria-controls", `lpi-list-${this.id}`);
2614
+ this.searchInput.setAttribute("aria-autocomplete", "list");
2615
+ this.searchInput.placeholder = "Search...";
2616
+ this.el.appendChild(this.searchInput);
2617
+ this.liveRegion = document.createElement("div");
2618
+ this.liveRegion.className = "lpi__sr-only";
2619
+ this.liveRegion.setAttribute("aria-live", "polite");
2620
+ this.el.appendChild(this.liveRegion);
2621
+ this.listEl = document.createElement("ul");
2622
+ this.listEl.className = "lpi__list";
2623
+ this.listEl.setAttribute("role", "listbox");
2624
+ this.listEl.id = `lpi-list-${this.id}`;
2625
+ this.el.appendChild(this.listEl);
2626
+ this.filteredItems = this.getOrderedCountries();
2627
+ this.buildList();
2628
+ this.options.container.appendChild(this.el);
2629
+ this.position(anchorEl);
2630
+ if (typeof window.matchMedia === "function" && window.matchMedia("(max-width: 500px), (pointer: coarse) and (max-height: 600px)").matches) {
2631
+ this.el.classList.add("lpi__dropdown--fullscreen");
2632
+ }
2633
+ this.searchInput.focus();
2634
+ const selectedIdx = this.filteredItems.findIndex((c) => c.code === this.options.selectedCode);
2635
+ if (selectedIdx >= 0) {
2636
+ this.updateHighlight(selectedIdx);
2637
+ }
2638
+ this.searchInput.addEventListener("input", () => this.handleSearchInput(), { signal });
2639
+ this.el.addEventListener("keydown", (e) => this.handleKeyDown(e), { signal });
2640
+ this.listEl.addEventListener("click", (e) => this.handleListClick(e), { signal });
2641
+ document.addEventListener("mousedown", (e) => this.handleClickOutside(e), { signal });
2642
+ this.setupScrollListeners(anchorEl, signal);
2643
+ }
2644
+ close() {
2645
+ if (!this.el) return;
2646
+ this.ac?.abort();
2647
+ this.ac = null;
2648
+ if (this.searchTimeout) {
2649
+ clearTimeout(this.searchTimeout);
2650
+ this.searchTimeout = null;
2651
+ }
2652
+ this.el.remove();
2653
+ this.el = null;
2654
+ this.searchInput = null;
2655
+ this.listEl = null;
2656
+ this.liveRegion = null;
2657
+ this.highlightIndex = -1;
2658
+ this.filteredItems = [];
2659
+ this.orderedCountries = null;
2660
+ }
2661
+ isOpen() {
2662
+ return this.el !== null;
2663
+ }
2664
+ setSelected(code) {
2665
+ const prevCode = this.options.selectedCode;
2666
+ this.options.selectedCode = code;
2667
+ if (this.listEl) {
2668
+ if (prevCode) {
2669
+ const oldEl = this.listEl.querySelector(`[data-code="${prevCode}"]`);
2670
+ if (oldEl) {
2671
+ oldEl.setAttribute("aria-selected", "false");
2672
+ oldEl.classList.remove("lpi__option--selected");
2673
+ }
2674
+ }
2675
+ const newEl = this.listEl.querySelector(`[data-code="${code}"]`);
2676
+ if (newEl) {
2677
+ newEl.setAttribute("aria-selected", "true");
2678
+ newEl.classList.add("lpi__option--selected");
2679
+ }
2680
+ }
2681
+ }
2682
+ updateCountries(countries, preferredCountries) {
2683
+ this.options.countries = countries;
2684
+ this.options.preferredCountries = preferredCountries;
2685
+ this.orderedCountries = null;
2686
+ }
2687
+ destroy() {
2688
+ this.close();
2689
+ }
2690
+ // --- Internal ---
2691
+ getOrderedCountries() {
2692
+ if (this.orderedCountries) return this.orderedCountries;
2693
+ const { countries, preferredCountries } = this.options;
2694
+ if (!preferredCountries.length) {
2695
+ this.orderedCountries = countries;
2696
+ return countries;
2697
+ }
2698
+ const prefSet = new Set(preferredCountries.map((c) => c.toUpperCase()));
2699
+ const preferred = [];
2700
+ const rest = [];
2701
+ for (const c of countries) {
2702
+ if (prefSet.has(c.code)) {
2703
+ preferred.push(c);
2704
+ } else {
2705
+ rest.push(c);
2706
+ }
2707
+ }
2708
+ preferred.sort((a, b) => {
2709
+ return preferredCountries.indexOf(a.code) - preferredCountries.indexOf(b.code);
2710
+ });
2711
+ this.orderedCountries = [...preferred, ...rest];
2712
+ return this.orderedCountries;
2713
+ }
2714
+ buildList() {
2715
+ if (!this.listEl) return;
2716
+ this.listEl.replaceChildren();
2717
+ const { preferredCountries, selectedCode } = this.options;
2718
+ const prefSet = preferredCountries.length > 0 ? new Set(preferredCountries.map((c) => c.toUpperCase())) : null;
2719
+ let addedSeparator = false;
2720
+ for (let i = 0; i < this.filteredItems.length; i++) {
2721
+ const country = this.filteredItems[i];
2722
+ if (!addedSeparator && prefSet && !prefSet.has(country.code)) {
2723
+ if (i > 0) {
2724
+ const sep = document.createElement("li");
2725
+ sep.className = "lpi__separator";
2726
+ sep.setAttribute("role", "separator");
2727
+ sep.innerHTML = "<hr>";
2728
+ this.listEl.appendChild(sep);
2729
+ }
2730
+ addedSeparator = true;
2731
+ }
2732
+ const li = document.createElement("li");
2733
+ li.className = "lpi__option";
2734
+ if (country.code === selectedCode) li.classList.add("lpi__option--selected");
2735
+ li.setAttribute("role", "option");
2736
+ li.setAttribute("aria-selected", country.code === selectedCode ? "true" : "false");
2737
+ li.dataset.code = country.code;
2738
+ li.id = `lpi-opt-${this.id}-${country.code}`;
2739
+ const flag = document.createElement("span");
2740
+ flag.className = "lpi__flag";
2741
+ if (this.options.renderFlag) {
2742
+ flag.innerHTML = this.options.renderFlag(country.code);
2743
+ } else {
2744
+ flag.textContent = getFlag(country.code);
2745
+ }
2746
+ const name = document.createElement("span");
2747
+ name.className = "lpi__option-name";
2748
+ name.textContent = this.getCountryName(country);
2749
+ const dial = document.createElement("span");
2750
+ dial.className = "lpi__option-dial";
2751
+ dial.textContent = `+${country.dialCode}`;
2752
+ li.appendChild(flag);
2753
+ li.appendChild(name);
2754
+ li.appendChild(dial);
2755
+ this.listEl.appendChild(li);
2756
+ }
2757
+ this.updateLiveRegion();
2758
+ }
2759
+ getCountryName(country) {
2760
+ if (this.displayNames) {
2761
+ try {
2762
+ return this.displayNames.of(country.code) ?? country.name;
2763
+ } catch {
2764
+ return country.name;
2765
+ }
2766
+ }
2767
+ return country.name;
2768
+ }
2769
+ /** 3-bucket search: exact code/dial → starts-with → contains */
2770
+ search(query) {
2771
+ if (!query) return this.getOrderedCountries();
2772
+ const q = query.trim().toLowerCase();
2773
+ const qUpper = q.toUpperCase();
2774
+ const ordered = this.getOrderedCountries();
2775
+ const exact = [];
2776
+ const startsWith = [];
2777
+ const contains = [];
2778
+ for (const c of ordered) {
2779
+ const name = this.getCountryName(c).toLowerCase();
2780
+ if (c.code === qUpper || c.dialCode === q) {
2781
+ exact.push(c);
2782
+ } else if (name.startsWith(q)) {
2783
+ startsWith.push(c);
2784
+ } else if (name.includes(q)) {
2785
+ contains.push(c);
2786
+ }
2787
+ }
2788
+ return [...exact, ...startsWith, ...contains];
2789
+ }
2790
+ handleSearchInput() {
2791
+ if (this.searchTimeout) clearTimeout(this.searchTimeout);
2792
+ this.searchTimeout = setTimeout(() => {
2793
+ const query = this.searchInput?.value ?? "";
2794
+ this.filteredItems = this.search(query);
2795
+ this.highlightIndex = -1;
2796
+ this.buildList();
2797
+ if (this.filteredItems.length > 0) {
2798
+ this.updateHighlight(0);
2799
+ }
2800
+ }, 100);
2801
+ }
2802
+ handleKeyDown(e) {
2803
+ switch (e.key) {
2804
+ case "ArrowDown":
2805
+ e.preventDefault();
2806
+ if (this.filteredItems.length > 0) {
2807
+ const next = this.highlightIndex < this.filteredItems.length - 1 ? this.highlightIndex + 1 : 0;
2808
+ this.updateHighlight(next);
2809
+ }
2810
+ break;
2811
+ case "ArrowUp":
2812
+ e.preventDefault();
2813
+ if (this.filteredItems.length > 0) {
2814
+ const prev = this.highlightIndex > 0 ? this.highlightIndex - 1 : this.filteredItems.length - 1;
2815
+ this.updateHighlight(prev);
2816
+ }
2817
+ break;
2818
+ case "Enter":
2819
+ e.preventDefault();
2820
+ if (this.highlightIndex >= 0 && this.highlightIndex < this.filteredItems.length) {
2821
+ this.options.onSelect(this.filteredItems[this.highlightIndex]);
2822
+ }
2823
+ break;
2824
+ case "Escape":
2825
+ e.preventDefault();
2826
+ this.options.onClose();
2827
+ break;
2828
+ case "Tab":
2829
+ this.options.onClose();
2830
+ break;
2831
+ }
2832
+ }
2833
+ handleListClick(e) {
2834
+ const target = e.target.closest(".lpi__option");
2835
+ if (!target?.dataset.code) return;
2836
+ const country = this.filteredItems.find((c) => c.code === target.dataset.code);
2837
+ if (country) this.options.onSelect(country);
2838
+ }
2839
+ handleClickOutside(e) {
2840
+ if (this.el && !this.el.contains(e.target)) {
2841
+ this.options.onClose();
2842
+ }
2843
+ }
2844
+ setupScrollListeners(anchorEl, signal) {
2845
+ let node = anchorEl.parentElement;
2846
+ while (node && node !== document.documentElement) {
2847
+ const ancestor = node;
2848
+ ancestor.addEventListener("scroll", () => {
2849
+ if (this.el && this.el.contains(ancestor)) return;
2850
+ this.options.onClose();
2851
+ }, { signal, passive: true });
2852
+ node = node.parentElement;
2853
+ }
2854
+ }
2855
+ position(anchorEl) {
2856
+ if (!this.el) return;
2857
+ const rect = anchorEl.getBoundingClientRect();
2858
+ const spaceBelow = window.innerHeight - rect.bottom;
2859
+ const spaceAbove = rect.top;
2860
+ const container = this.options.container;
2861
+ const isPortal = container === document.body;
2862
+ if (isPortal) {
2863
+ this.el.style.position = "absolute";
2864
+ const scrollTop = window.scrollY;
2865
+ const scrollLeft = window.scrollX;
2866
+ const dropdownHeight = Math.min(300, spaceAbove);
2867
+ if (spaceBelow >= 300 || spaceBelow >= spaceAbove) {
2868
+ this.el.style.top = `${rect.bottom + scrollTop}px`;
2869
+ this.el.style.left = `${rect.left + scrollLeft}px`;
2870
+ this.el.classList.remove("lpi__dropdown--above");
2871
+ } else {
2872
+ this.el.style.top = `${rect.top + scrollTop - dropdownHeight}px`;
2873
+ this.el.style.left = `${rect.left + scrollLeft}px`;
2874
+ this.el.classList.add("lpi__dropdown--above");
2875
+ }
2876
+ this.el.style.width = `${Math.max(rect.width, 280)}px`;
2877
+ } else {
2878
+ if (spaceBelow >= 300 || spaceBelow >= spaceAbove) {
2879
+ this.el.classList.remove("lpi__dropdown--above");
2880
+ } else {
2881
+ this.el.classList.add("lpi__dropdown--above");
2882
+ }
2883
+ }
2884
+ }
2885
+ updateHighlight(index) {
2886
+ if (!this.listEl || !this.searchInput) return;
2887
+ if (this.highlightIndex >= 0) {
2888
+ const oldItem = this.getOptionElement(this.highlightIndex);
2889
+ oldItem?.classList.remove("lpi__option--highlighted");
2890
+ }
2891
+ this.highlightIndex = index;
2892
+ const item = this.getOptionElement(index);
2893
+ if (item) {
2894
+ item.classList.add("lpi__option--highlighted");
2895
+ item.scrollIntoView?.({ block: "nearest" });
2896
+ this.searchInput.setAttribute("aria-activedescendant", item.id);
2897
+ }
2898
+ }
2899
+ getOptionElement(index) {
2900
+ if (!this.listEl) return null;
2901
+ const options = this.listEl.querySelectorAll(".lpi__option");
2902
+ return options[index] ?? null;
2903
+ }
2904
+ updateLiveRegion() {
2905
+ if (this.liveRegion) {
2906
+ const count = this.filteredItems.length;
2907
+ this.liveRegion.textContent = `${count} ${count === 1 ? "result" : "results"}`;
2908
+ }
2909
+ }
2910
+ };
2911
+
2912
+ // src/vanilla/phone-input.ts
2913
+ var isClient = typeof window !== "undefined";
2914
+ var PhoneInput = class _PhoneInput {
2915
+ constructor(el, options) {
2916
+ this.nationalDigits = "";
2917
+ this.lastValidation = null;
2918
+ this.dropdown = null;
2919
+ this.dialCodeEl = null;
2920
+ this.arrowEl = null;
2921
+ this.hiddenPhoneEl = null;
2922
+ this.hiddenCountryEl = null;
2923
+ this.el = el;
2924
+ this.opts = { ...options };
2925
+ this.ac = new AbortController();
2926
+ this.countries = this.filterCountries(getAllCountries());
2927
+ this.selectedCountry = this.resolveCountry(this.opts.defaultCountry) ?? this.countries[0];
2928
+ if (isClient) {
2929
+ this.buildDOM();
2930
+ this.attachListeners();
2931
+ if (this.opts.value) {
2932
+ this.setValueInternal(this.opts.value, false);
2933
+ }
2934
+ }
2935
+ }
2936
+ static mount(el, options) {
2937
+ return new _PhoneInput(el, options);
2938
+ }
2939
+ // --- Public API ---
2940
+ getValue() {
2941
+ if (!this.nationalDigits) return "";
2942
+ return `+${this.selectedCountry.dialCode}${this.nationalDigits}`;
2943
+ }
2944
+ getNationalNumber() {
2945
+ return this.nationalDigits;
2946
+ }
2947
+ getCountry() {
2948
+ return {
2949
+ code: this.selectedCountry.code,
2950
+ dialCode: this.selectedCountry.dialCode,
2951
+ name: this.selectedCountry.name
2952
+ };
2953
+ }
2954
+ setValue(e164) {
2955
+ this.setValueInternal(e164, true);
2956
+ }
2957
+ setCountry(code) {
2958
+ const country = this.resolveCountry(code);
2959
+ if (country) this.selectCountry(country, true);
2960
+ }
2961
+ isValid() {
2962
+ return this.validate().valid;
2963
+ }
2964
+ validate() {
2965
+ return validatePhone(this.nationalDigits, this.selectedCountry);
2966
+ }
2967
+ setOptions(opts) {
2968
+ const prev = { ...this.opts };
2969
+ Object.assign(this.opts, opts);
2970
+ if (opts.allowedCountries !== void 0 || opts.excludedCountries !== void 0) {
2971
+ this.countries = this.filterCountries(getAllCountries());
2972
+ if (!this.countries.find((c) => c.code === this.selectedCountry.code)) {
2973
+ this.selectCountry(this.countries[0], true);
2974
+ }
2975
+ if (this.dropdown) {
2976
+ this.dropdown.updateCountries(this.countries, this.opts.preferredCountries ?? []);
2977
+ }
2978
+ }
2979
+ if (opts.disabled !== void 0) {
2980
+ this.inputEl.disabled = !!opts.disabled;
2981
+ this.containerEl.classList.toggle("lpi--disabled", !!opts.disabled);
2982
+ if (this.triggerEl instanceof HTMLButtonElement) {
2983
+ this.triggerEl.disabled = !!opts.disabled;
2984
+ }
2985
+ }
2986
+ if (opts.separateDialCode !== void 0 && opts.separateDialCode !== prev.separateDialCode) {
2987
+ this.updateDisplayMode();
2988
+ }
2989
+ if (opts.renderFlag !== void 0) {
2990
+ this.updateFlag();
2991
+ }
2992
+ if (opts.placeholder !== void 0) {
2993
+ this.updatePlaceholder();
2994
+ }
2995
+ if (opts.formatAsYouType !== void 0 || opts.strict !== void 0) {
2996
+ this.reformatInput();
2997
+ }
2998
+ if (opts.allowDropdown !== void 0) {
2999
+ this.rebuildTrigger();
3000
+ }
3001
+ }
3002
+ destroy() {
3003
+ this.ac.abort();
3004
+ if (this.dropdown) {
3005
+ this.dropdown.destroy();
3006
+ this.dropdown = null;
3007
+ }
3008
+ this.el.innerHTML = "";
3009
+ }
3010
+ // --- DOM Construction ---
3011
+ buildDOM() {
3012
+ this.containerEl = document.createElement("div");
3013
+ this.containerEl.className = "lpi";
3014
+ if (this.opts.containerClass) {
3015
+ this.containerEl.className += ` ${this.opts.containerClass}`;
3016
+ }
3017
+ if (this.opts.separateDialCode) {
3018
+ this.containerEl.classList.add("lpi--separate-dial-code");
3019
+ }
3020
+ if (this.opts.disabled) {
3021
+ this.containerEl.classList.add("lpi--disabled");
3022
+ }
3023
+ this.buildTrigger();
3024
+ this.inputEl = document.createElement("input");
3025
+ this.inputEl.className = "lpi__input";
3026
+ this.inputEl.type = "tel";
3027
+ this.inputEl.inputMode = "tel";
3028
+ this.inputEl.autocomplete = "tel";
3029
+ this.inputEl.dir = "ltr";
3030
+ if (this.opts.disabled) this.inputEl.disabled = true;
3031
+ if (this.opts.inputAttributes) {
3032
+ for (const [key, value] of Object.entries(this.opts.inputAttributes)) {
3033
+ this.inputEl.setAttribute(key, value);
3034
+ }
3035
+ }
3036
+ this.updatePlaceholder();
3037
+ this.containerEl.appendChild(this.inputEl);
3038
+ if (this.opts.hiddenInput) {
3039
+ if (this.opts.hiddenInput.phone) {
3040
+ this.hiddenPhoneEl = document.createElement("input");
3041
+ this.hiddenPhoneEl.type = "hidden";
3042
+ this.hiddenPhoneEl.name = this.opts.hiddenInput.phone;
3043
+ this.containerEl.appendChild(this.hiddenPhoneEl);
3044
+ }
3045
+ if (this.opts.hiddenInput.country) {
3046
+ this.hiddenCountryEl = document.createElement("input");
3047
+ this.hiddenCountryEl.type = "hidden";
3048
+ this.hiddenCountryEl.name = this.opts.hiddenInput.country;
3049
+ this.hiddenCountryEl.value = this.selectedCountry.code;
3050
+ this.containerEl.appendChild(this.hiddenCountryEl);
3051
+ }
3052
+ }
3053
+ this.el.appendChild(this.containerEl);
3054
+ }
3055
+ buildTrigger() {
3056
+ const allowDropdown = this.opts.allowDropdown !== false;
3057
+ if (allowDropdown) {
3058
+ const btn = document.createElement("button");
3059
+ btn.className = "lpi__trigger";
3060
+ btn.type = "button";
3061
+ btn.setAttribute("role", "combobox");
3062
+ btn.setAttribute("aria-expanded", "false");
3063
+ btn.setAttribute("aria-haspopup", "listbox");
3064
+ btn.setAttribute("aria-label", "Select country");
3065
+ if (this.opts.disabled) btn.disabled = true;
3066
+ this.triggerEl = btn;
3067
+ } else {
3068
+ const span = document.createElement("span");
3069
+ span.className = "lpi__trigger";
3070
+ this.triggerEl = span;
3071
+ }
3072
+ this.flagEl = document.createElement("span");
3073
+ this.flagEl.className = "lpi__flag";
3074
+ this.updateFlag();
3075
+ this.triggerEl.appendChild(this.flagEl);
3076
+ if (this.opts.separateDialCode) {
3077
+ this.dialCodeEl = document.createElement("span");
3078
+ this.dialCodeEl.className = "lpi__dial-code";
3079
+ this.dialCodeEl.textContent = `+${this.selectedCountry.dialCode}`;
3080
+ this.triggerEl.appendChild(this.dialCodeEl);
3081
+ }
3082
+ if (allowDropdown) {
3083
+ this.arrowEl = document.createElement("span");
3084
+ this.arrowEl.className = "lpi__arrow";
3085
+ this.arrowEl.textContent = "\u25BC";
3086
+ this.triggerEl.appendChild(this.arrowEl);
3087
+ this.triggerEl.addEventListener("click", () => this.handleTriggerClick(), { signal: this.ac.signal });
3088
+ }
3089
+ this.containerEl.appendChild(this.triggerEl);
3090
+ }
3091
+ rebuildTrigger() {
3092
+ this.triggerEl.remove();
3093
+ this.dialCodeEl = null;
3094
+ this.arrowEl = null;
3095
+ this.buildTrigger();
3096
+ this.containerEl.insertBefore(this.triggerEl, this.inputEl);
3097
+ }
3098
+ // --- Event Handling ---
3099
+ attachListeners() {
3100
+ const signal = this.ac.signal;
3101
+ this.inputEl.addEventListener("input", (e) => this.handleInput(e), { signal });
3102
+ this.inputEl.addEventListener("keydown", (e) => this.handleKeyDown(e), { signal });
3103
+ this.inputEl.addEventListener("paste", (e) => this.handlePaste(e), { signal });
3104
+ }
3105
+ handleInput(e) {
3106
+ if (this.opts.strict !== false && e.data === "+" && this.opts.separateDialCode) {
3107
+ this.inputEl.value = this.inputEl.value.replace("+", "");
3108
+ }
3109
+ const oldCursor = this.inputEl.selectionStart ?? 0;
3110
+ let raw = normalizeNumerals(this.inputEl.value);
3111
+ if (this.opts.separateDialCode) {
3112
+ let digits = extractDigits(raw);
3113
+ digits = this.stripNationalPrefix(digits);
3114
+ if (this.opts.strict !== false && digits.length > this.selectedCountry.maxLength) {
3115
+ digits = digits.slice(0, this.selectedCountry.maxLength);
3116
+ }
3117
+ this.nationalDigits = digits;
3118
+ const formatted = this.opts.formatAsYouType !== false ? formatPhone(digits, this.selectedCountry.format) : digits;
3119
+ const newCursor = getCursorPosition(this.inputEl.value, oldCursor, formatted);
3120
+ this.inputEl.value = formatted;
3121
+ this.inputEl.setSelectionRange(newCursor, newCursor);
3122
+ } else {
3123
+ const digits = extractDigits(raw);
3124
+ const hasPlus = raw.startsWith("+");
3125
+ if (hasPlus && digits.length > 0) {
3126
+ this.detectCountryFromDigits(digits);
3127
+ }
3128
+ let national = this.extractNationalFromFull(digits, hasPlus);
3129
+ national = this.stripNationalPrefix(national);
3130
+ if (this.opts.strict !== false && national.length > this.selectedCountry.maxLength) {
3131
+ national = national.slice(0, this.selectedCountry.maxLength);
3132
+ }
3133
+ this.nationalDigits = national;
3134
+ const formatted = this.formatFullValue();
3135
+ const newCursor = getCursorPosition(this.inputEl.value, oldCursor, formatted);
3136
+ this.inputEl.value = formatted;
3137
+ this.inputEl.setSelectionRange(newCursor, newCursor);
3138
+ }
3139
+ this.syncHiddenInputs();
3140
+ this.fireCallbacks();
3141
+ }
3142
+ handleKeyDown(e) {
3143
+ if (this.opts.strict === false) return;
3144
+ if (e.key === "Backspace" || e.key === "Delete" || e.key === "Tab" || e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "Home" || e.key === "End" || e.ctrlKey || e.metaKey) {
3145
+ return;
3146
+ }
3147
+ if (!this.opts.separateDialCode && e.key === "+" && this.inputEl.selectionStart === 0) {
3148
+ return;
3149
+ }
3150
+ if (e.key.length === 1 && !/\d/.test(e.key)) {
3151
+ const code = e.key.charCodeAt(0);
3152
+ if (!(code >= 1632 && code <= 1641 || code >= 1776 && code <= 1785)) {
3153
+ e.preventDefault();
3154
+ }
3155
+ }
3156
+ }
3157
+ handlePaste(e) {
3158
+ e.preventDefault();
3159
+ const text = e.clipboardData?.getData("text") ?? "";
3160
+ if (!text) return;
3161
+ const cleaned = normalizeNumerals(text);
3162
+ let digits = cleaned.replace(/[^\d]/g, "");
3163
+ const isInternational = cleaned.startsWith("+") || cleaned.startsWith("00");
3164
+ if (isInternational) {
3165
+ if (cleaned.startsWith("00")) {
3166
+ digits = digits.slice(2);
3167
+ }
3168
+ this.detectCountryFromDigits(digits);
3169
+ digits = this.extractNationalFromFull(digits, true);
3170
+ }
3171
+ digits = this.stripNationalPrefix(digits);
3172
+ if (this.opts.strict !== false && digits.length > this.selectedCountry.maxLength) {
3173
+ digits = digits.slice(0, this.selectedCountry.maxLength);
3174
+ }
3175
+ this.nationalDigits = digits;
3176
+ if (this.opts.separateDialCode) {
3177
+ this.inputEl.value = this.opts.formatAsYouType !== false ? formatPhone(this.nationalDigits, this.selectedCountry.format) : this.nationalDigits;
3178
+ } else {
3179
+ this.inputEl.value = this.formatFullValue();
3180
+ }
3181
+ this.syncHiddenInputs();
3182
+ this.fireCallbacks();
3183
+ }
3184
+ handleTriggerClick() {
3185
+ if (this.opts.allowDropdown === false) return;
3186
+ if (this.dropdown) {
3187
+ this.closeDropdown();
3188
+ } else {
3189
+ this.openDropdown();
3190
+ }
3191
+ }
3192
+ // --- Dropdown ---
3193
+ openDropdown() {
3194
+ if (this.dropdown) return;
3195
+ this.dropdown = new Dropdown({
3196
+ countries: this.countries,
3197
+ preferredCountries: this.opts.preferredCountries ?? [],
3198
+ selectedCode: this.selectedCountry.code,
3199
+ locale: this.opts.locale,
3200
+ renderFlag: this.opts.renderFlag,
3201
+ onSelect: (country) => {
3202
+ this.selectCountry(country, true);
3203
+ this.closeDropdown();
3204
+ this.inputEl.focus();
3205
+ },
3206
+ onClose: () => {
3207
+ this.closeDropdown();
3208
+ if (this.triggerEl instanceof HTMLButtonElement) {
3209
+ this.triggerEl.focus();
3210
+ }
3211
+ },
3212
+ container: this.opts.dropdownContainer ?? document.body
3213
+ });
3214
+ this.dropdown.open(this.triggerEl);
3215
+ this.containerEl.classList.add("lpi--open");
3216
+ if (this.triggerEl instanceof HTMLButtonElement) {
3217
+ this.triggerEl.setAttribute("aria-expanded", "true");
3218
+ }
3219
+ this.opts.onDropdownOpen?.();
3220
+ }
3221
+ closeDropdown() {
3222
+ if (!this.dropdown) return;
3223
+ this.dropdown.close();
3224
+ this.dropdown = null;
3225
+ this.containerEl.classList.remove("lpi--open");
3226
+ if (this.triggerEl instanceof HTMLButtonElement) {
3227
+ this.triggerEl.setAttribute("aria-expanded", "false");
3228
+ }
3229
+ this.opts.onDropdownClose?.();
3230
+ }
3231
+ // --- Country Logic ---
3232
+ selectCountry(country, fireEvent) {
3233
+ const prev = this.selectedCountry;
3234
+ this.selectedCountry = country;
3235
+ this.updateFlag();
3236
+ this.updateDialCodeDisplay();
3237
+ this.reformatInput();
3238
+ this.updatePlaceholder();
3239
+ this.syncHiddenInputs();
3240
+ if (this.dropdown) {
3241
+ this.dropdown.setSelected(country.code);
3242
+ }
3243
+ if (fireEvent && prev.code !== country.code) {
3244
+ this.opts.onCountryChange?.(country);
3245
+ this.fireCallbacks();
3246
+ }
3247
+ }
3248
+ detectCountryFromDigits(digits) {
3249
+ for (let len = Math.min(4, digits.length); len >= 1; len--) {
3250
+ const prefix = digits.slice(0, len);
3251
+ const match = getCountryByDialCode(this.countries, prefix);
3252
+ if (match) {
3253
+ if (this.selectedCountry.dialCode === prefix) return;
3254
+ this.selectCountry(match, true);
3255
+ return;
3256
+ }
3257
+ }
3258
+ }
3259
+ extractNationalFromFull(digits, hasInternationalPrefix) {
3260
+ if (!hasInternationalPrefix) return digits;
3261
+ const dc = this.selectedCountry.dialCode;
3262
+ if (digits.startsWith(dc)) {
3263
+ return digits.slice(dc.length);
3264
+ }
3265
+ return digits;
3266
+ }
3267
+ stripNationalPrefix(digits) {
3268
+ const prefix = this.selectedCountry.nationalPrefix;
3269
+ if (prefix && digits.startsWith(prefix)) {
3270
+ const remaining = digits.slice(prefix.length);
3271
+ if (remaining.length > 0) {
3272
+ return remaining;
3273
+ }
3274
+ }
3275
+ return digits;
3276
+ }
3277
+ // --- Display ---
3278
+ formatFullValue() {
3279
+ if (!this.nationalDigits) return "";
3280
+ const formatted = this.opts.formatAsYouType !== false ? formatPhone(this.nationalDigits, this.selectedCountry.format) : this.nationalDigits;
3281
+ return `+${this.selectedCountry.dialCode} ${formatted}`;
3282
+ }
3283
+ updateFlag() {
3284
+ if (!this.flagEl) return;
3285
+ if (this.opts.renderFlag) {
3286
+ this.flagEl.innerHTML = this.opts.renderFlag(this.selectedCountry.code);
3287
+ } else {
3288
+ this.flagEl.textContent = getFlag(this.selectedCountry.code);
3289
+ }
3290
+ }
3291
+ updateDialCodeDisplay() {
3292
+ if (this.dialCodeEl) {
3293
+ this.dialCodeEl.textContent = `+${this.selectedCountry.dialCode}`;
3294
+ }
3295
+ }
3296
+ updatePlaceholder() {
3297
+ if (!this.inputEl) return;
3298
+ const placeholder = this.opts.placeholder;
3299
+ if (placeholder === "auto" || placeholder === void 0) {
3300
+ const mask = this.selectedCountry.format;
3301
+ if (mask) {
3302
+ const example = mask.replace(/X/g, "0");
3303
+ if (this.opts.separateDialCode) {
3304
+ this.inputEl.placeholder = example;
3305
+ } else {
3306
+ this.inputEl.placeholder = `+${this.selectedCountry.dialCode} ${example}`;
3307
+ }
3308
+ } else {
3309
+ this.inputEl.placeholder = "";
3310
+ }
3311
+ } else if (placeholder) {
3312
+ this.inputEl.placeholder = placeholder;
3313
+ } else {
3314
+ this.inputEl.placeholder = "";
3315
+ }
3316
+ }
3317
+ updateDisplayMode() {
3318
+ this.containerEl.classList.toggle("lpi--separate-dial-code", !!this.opts.separateDialCode);
3319
+ if (this.opts.separateDialCode && !this.dialCodeEl) {
3320
+ this.dialCodeEl = document.createElement("span");
3321
+ this.dialCodeEl.className = "lpi__dial-code";
3322
+ this.dialCodeEl.textContent = `+${this.selectedCountry.dialCode}`;
3323
+ if (this.arrowEl) {
3324
+ this.triggerEl.insertBefore(this.dialCodeEl, this.arrowEl);
3325
+ } else {
3326
+ this.triggerEl.appendChild(this.dialCodeEl);
3327
+ }
3328
+ } else if (!this.opts.separateDialCode && this.dialCodeEl) {
3329
+ this.dialCodeEl.remove();
3330
+ this.dialCodeEl = null;
3331
+ }
3332
+ this.reformatInput();
3333
+ this.updatePlaceholder();
3334
+ }
3335
+ reformatInput() {
3336
+ if (!this.inputEl) return;
3337
+ if (this.opts.separateDialCode) {
3338
+ this.inputEl.value = this.opts.formatAsYouType !== false ? formatPhone(this.nationalDigits, this.selectedCountry.format) : this.nationalDigits;
3339
+ } else {
3340
+ this.inputEl.value = this.formatFullValue();
3341
+ }
3342
+ }
3343
+ // --- Helpers ---
3344
+ filterCountries(all) {
3345
+ let filtered = all;
3346
+ if (this.opts.allowedCountries?.length) {
3347
+ const allowed = new Set(this.opts.allowedCountries.map((c) => c.toUpperCase()));
3348
+ filtered = filtered.filter((c) => allowed.has(c.code));
3349
+ }
3350
+ if (this.opts.excludedCountries?.length) {
3351
+ const excluded = new Set(this.opts.excludedCountries.map((c) => c.toUpperCase()));
3352
+ filtered = filtered.filter((c) => !excluded.has(c.code));
3353
+ }
3354
+ return filtered;
3355
+ }
3356
+ resolveCountry(code) {
3357
+ return getCountryByCode(this.countries, code);
3358
+ }
3359
+ setValueInternal(e164, updateInput) {
3360
+ if (!e164) {
3361
+ this.nationalDigits = "";
3362
+ if (updateInput) this.reformatInput();
3363
+ this.syncHiddenInputs();
3364
+ this.fireCallbacks();
3365
+ return;
3366
+ }
3367
+ let digits = extractDigits(normalizeNumerals(e164));
3368
+ const hasPlus = e164.startsWith("+");
3369
+ if (hasPlus) {
3370
+ this.detectCountryFromDigits(digits);
3371
+ digits = this.extractNationalFromFull(digits, true);
3372
+ }
3373
+ digits = this.stripNationalPrefix(digits);
3374
+ this.nationalDigits = digits;
3375
+ if (updateInput) this.reformatInput();
3376
+ this.syncHiddenInputs();
3377
+ this.fireCallbacks();
3378
+ }
3379
+ syncHiddenInputs() {
3380
+ if (this.hiddenPhoneEl) {
3381
+ this.hiddenPhoneEl.value = this.getValue();
3382
+ }
3383
+ if (this.hiddenCountryEl) {
3384
+ this.hiddenCountryEl.value = this.selectedCountry.code;
3385
+ }
3386
+ }
3387
+ fireCallbacks() {
3388
+ const v = validatePhone(this.nationalDigits, this.selectedCountry);
3389
+ const e164 = this.getValue();
3390
+ this.opts.onChange?.(e164, this.selectedCountry, v);
3391
+ if (this.lastValidation === null || v.valid !== this.lastValidation.valid) {
3392
+ this.opts.onValidationChange?.(v);
3393
+ }
3394
+ this.lastValidation = v;
3395
+ }
3396
+ };
3397
+ export {
3398
+ PhoneInput
3399
+ };
3400
+ //# sourceMappingURL=index.js.map