intl-tel-input-rails 3.4.0.1 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/intl-tel-input/version.rb +1 -1
- data/vendor/assets/javascripts/intlTelInput.js +134 -122
- data/vendor/assets/javascripts/libphonenumber/utils.js +17 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 131669fc42c788d09bbc4501338f2d78145fc44d
|
4
|
+
data.tar.gz: c6055fae9eae6283189bfe7b18b6f34d8c077bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 449c3480db474b64927a1962957d6e0f821693a8e0715fb0c1ae95d37a79337fb86f0e91578c8c2136609ab016e08841c6fc120a8ea69be09417f06a8b1df9ed
|
7
|
+
data.tar.gz: 8229627a203a6a3ce61960ccbb7839c66dabe90fa5b74e9aa18982a99f34ea7957fe5b864714a9ee13ebff3da95b72e007e0c93d116dbad30f3fbf5e74c95f41
|
data/README.md
CHANGED
@@ -26,7 +26,11 @@ Add the following directive to your Javascript manifest file:
|
|
26
26
|
Coffeescript flavor:
|
27
27
|
|
28
28
|
#= require intlTelInput
|
29
|
+
|
30
|
+
Add the following directive to your Stylesheet manifest file:
|
31
|
+
|
32
|
+
@import "intlTelInput";
|
29
33
|
|
30
34
|
## Versioning
|
31
35
|
|
32
|
-
intl-tel-input-rails 3.
|
36
|
+
intl-tel-input-rails 3.6.0 == intl-tel-input 3.6.0
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
International Telephone Input v3.
|
2
|
+
International Telephone Input v3.6.0
|
3
3
|
https://github.com/Bluefieldscom/intl-tel-input.git
|
4
4
|
*/
|
5
5
|
// wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
|
@@ -23,6 +23,8 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
23
23
|
defaultCountry: "",
|
24
24
|
// don't insert international dial codes
|
25
25
|
nationalMode: false,
|
26
|
+
// number type to use for placeholders
|
27
|
+
numberType: "",
|
26
28
|
// display only these countries
|
27
29
|
onlyCountries: [],
|
28
30
|
// the countries at the top of the list. defaults to united states and united kingdom
|
@@ -239,21 +241,22 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
239
241
|
this._selectFlag(defaultCountry.iso2);
|
240
242
|
// if empty, insert the default dial code (this function will check !nationalMode and !autoHideDialCode)
|
241
243
|
if (!val) {
|
242
|
-
this.
|
244
|
+
this._updateDialCode(defaultCountry.dialCode, false);
|
243
245
|
}
|
244
246
|
}
|
245
247
|
// format
|
246
248
|
if (val) {
|
247
|
-
// this wont be run after
|
249
|
+
// this wont be run after _updateDialCode as that's only called if no val
|
248
250
|
this._updateVal(val, false);
|
249
251
|
}
|
250
252
|
},
|
251
253
|
// initialise the main event listeners: input keyup, and click selected flag
|
252
254
|
_initListeners: function() {
|
253
255
|
var that = this;
|
254
|
-
|
255
|
-
|
256
|
-
|
256
|
+
this._initKeyListeners();
|
257
|
+
// autoFormat prevents the change event from firing, so we need to check for changes between focus and blur in order to manually trigger it
|
258
|
+
if (this.options.autoHideDialCode || this.options.autoFormat) {
|
259
|
+
this._initFocusListeners();
|
257
260
|
}
|
258
261
|
// hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again
|
259
262
|
var label = this.telInput.closest("label");
|
@@ -267,6 +270,31 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
267
270
|
}
|
268
271
|
});
|
269
272
|
}
|
273
|
+
// toggle country dropdown on click
|
274
|
+
var selectedFlag = this.selectedFlagInner.parent();
|
275
|
+
selectedFlag.on("click" + this.ns, function(e) {
|
276
|
+
// only intercept this event if we're opening the dropdown
|
277
|
+
// else let it bubble up to the top ("click-off-to-close" listener)
|
278
|
+
// we cannot just stopPropagation as it may be needed to close another instance
|
279
|
+
if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled")) {
|
280
|
+
that._showDropdown();
|
281
|
+
}
|
282
|
+
});
|
283
|
+
// if the user has specified the path to the utils script, fetch it on window.load
|
284
|
+
if (this.options.utilsScript) {
|
285
|
+
// if the plugin is being initialised after the window.load event has already been fired
|
286
|
+
if (windowLoaded) {
|
287
|
+
this.loadUtils();
|
288
|
+
} else {
|
289
|
+
// wait until the load event so we don't block any other requests e.g. the flags image
|
290
|
+
$(window).load(function() {
|
291
|
+
that.loadUtils();
|
292
|
+
});
|
293
|
+
}
|
294
|
+
}
|
295
|
+
},
|
296
|
+
_initKeyListeners: function() {
|
297
|
+
var that = this;
|
270
298
|
if (this.options.autoFormat) {
|
271
299
|
// format number and update flag on keypress
|
272
300
|
// use keypress event as we want to ignore all input except for a select few keys,
|
@@ -288,6 +316,9 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
288
316
|
var newChar = isAllowedKey ? String.fromCharCode(e.which) : null;
|
289
317
|
that._handleInputKey(newChar, true);
|
290
318
|
}
|
319
|
+
if (!isAllowedKey) {
|
320
|
+
that.telInput.trigger("invalidkey");
|
321
|
+
}
|
291
322
|
}
|
292
323
|
});
|
293
324
|
}
|
@@ -296,13 +327,15 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
296
327
|
this.telInput.on("keyup" + this.ns, function(e) {
|
297
328
|
// the "enter" key event from selecting a dropdown item is triggered here on the input, because the document.keydown handler that initially handles that event triggers a focus on the input, and so the keyup for that same key event gets triggered here. weird, but just make sure we dont bother doing any re-formatting in this case (we've already done preventDefault in the keydown handler, so it wont actually submit the form or anything).
|
298
329
|
if (e.which == keys.ENTER) {} else if (that.options.autoFormat) {
|
299
|
-
var isCtrl = e.which == keys.CTRL || e.which == keys.CMD1 || e.which == keys.CMD2, input = that.telInput[0], noSelection
|
300
|
-
//
|
301
|
-
|
302
|
-
// if
|
303
|
-
if (
|
304
|
-
|
305
|
-
|
330
|
+
var isCtrl = e.which == keys.CTRL || e.which == keys.CMD1 || e.which == keys.CMD2, input = that.telInput[0], // noSelection defaults to false for bad browsers, else would be reformatting on all ctrl keys e.g. select-all/copy
|
331
|
+
noSelection = that.isGoodBrowser && input.selectionStart == input.selectionEnd, // cursorAtEnd defaults to false for bad browsers else they would never get a reformat on delete
|
332
|
+
cursorAtEnd = that.isGoodBrowser && input.selectionStart == that.telInput.val().length;
|
333
|
+
// if delete in the middle: reformat with no suffix (no need to reformat if delete at end)
|
334
|
+
// if backspace: reformat with no suffix (need to reformat if at end to remove any lingering suffix - this is a feature)
|
335
|
+
// if ctrl and no selection (i.e. could have just been a paste): reformat (if cursorAtEnd: add suffix)
|
336
|
+
if (e.which == keys.DEL && !cursorAtEnd || e.which == keys.BSPACE || isCtrl && noSelection) {
|
337
|
+
// important to remember never to add suffix on any delete key as can fuck up in ie8 so you can never delete a formatting char at the end
|
338
|
+
that._handleInputKey(null, isCtrl && cursorAtEnd);
|
306
339
|
}
|
307
340
|
// prevent deleting the plus (if not in nationalMode)
|
308
341
|
if (!that.options.nationalMode) {
|
@@ -321,28 +354,6 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
321
354
|
that._updateFlagFromNumber(that.telInput.val());
|
322
355
|
}
|
323
356
|
});
|
324
|
-
// toggle country dropdown on click
|
325
|
-
var selectedFlag = this.selectedFlagInner.parent();
|
326
|
-
selectedFlag.on("click" + this.ns, function(e) {
|
327
|
-
// only intercept this event if we're opening the dropdown
|
328
|
-
// else let it bubble up to the top ("click-off-to-close" listener)
|
329
|
-
// we cannot just stopPropagation as it may be needed to close another instance
|
330
|
-
if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled")) {
|
331
|
-
that._showDropdown();
|
332
|
-
}
|
333
|
-
});
|
334
|
-
// if the user has specified the path to the utils script, fetch it on window.load
|
335
|
-
if (this.options.utilsScript) {
|
336
|
-
// if the plugin is being initialised after the window.load event has already been fired
|
337
|
-
if (windowLoaded) {
|
338
|
-
this.loadUtils();
|
339
|
-
} else {
|
340
|
-
// wait until the load event so we don't block any other requests e.g. the flags image
|
341
|
-
$(window).load(function() {
|
342
|
-
that.loadUtils();
|
343
|
-
});
|
344
|
-
}
|
345
|
-
}
|
346
357
|
},
|
347
358
|
// when autoFormat is enabled: handle various key events on the input: the 2 main situations are 1) adding a new number character, which will replace any selection, reformat, and try to preserve the cursor position. and 2) reformatting on backspace, or paste event
|
348
359
|
_handleInputKey: function(newNumericChar, addSuffix) {
|
@@ -354,7 +365,7 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
354
365
|
// if handling a new number character: insert it in the right place and calculate the new cursor position
|
355
366
|
if (newNumericChar) {
|
356
367
|
// replace any selection they may have made with the new char
|
357
|
-
val = val.
|
368
|
+
val = val.substr(0, input.selectionStart) + newNumericChar + val.substring(selectionEnd, originalLen);
|
358
369
|
// if the cursor was not at the end then calculate it's new pos
|
359
370
|
if (!cursorAtEnd) {
|
360
371
|
newCursor = selectionEnd + (val.length - originalLen);
|
@@ -377,59 +388,64 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
377
388
|
input.setSelectionRange(newCursor, newCursor);
|
378
389
|
}
|
379
390
|
},
|
380
|
-
//
|
381
|
-
|
391
|
+
// listen for focus and blur
|
392
|
+
_initFocusListeners: function() {
|
382
393
|
var that = this;
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
}
|
392
|
-
}
|
393
|
-
// on focus: if empty, insert the dial code for the currently selected flag
|
394
|
+
if (this.options.autoHideDialCode) {
|
395
|
+
// mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click
|
396
|
+
this.telInput.on("mousedown" + this.ns, function(e) {
|
397
|
+
if (!that.telInput.is(":focus") && !that.telInput.val()) {
|
398
|
+
e.preventDefault();
|
399
|
+
// but this also cancels the focus, so we must trigger that manually
|
400
|
+
that.telInput.focus();
|
401
|
+
}
|
402
|
+
});
|
403
|
+
}
|
394
404
|
this.telInput.on("focus" + this.ns, function() {
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
//
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
}
|
418
|
-
}
|
405
|
+
var value = that.telInput.val();
|
406
|
+
// save this to compare on blur
|
407
|
+
that.telInput.data("focusVal", value);
|
408
|
+
if (that.options.autoHideDialCode) {
|
409
|
+
// on focus: if empty, insert the dial code for the currently selected flag
|
410
|
+
if (!value) {
|
411
|
+
that._updateVal("+" + that.selectedCountryData.dialCode, true);
|
412
|
+
// after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one
|
413
|
+
that.telInput.one("keypress.plus" + that.ns, function(e) {
|
414
|
+
if (e.which == keys.PLUS) {
|
415
|
+
// if autoFormat is enabled, this key event will have already have been handled by another keypress listener (hence we need to add the "+"). if disabled, it will be handled after this by a keyup listener (hence no need to add the "+").
|
416
|
+
var newVal = that.options.autoFormat ? "+" : "";
|
417
|
+
that.telInput.val(newVal);
|
418
|
+
}
|
419
|
+
});
|
420
|
+
// after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that
|
421
|
+
setTimeout(function() {
|
422
|
+
var input = that.telInput[0];
|
423
|
+
if (that.isGoodBrowser) {
|
424
|
+
var len = that.telInput.val().length;
|
425
|
+
input.setSelectionRange(len, len);
|
426
|
+
}
|
427
|
+
});
|
428
|
+
}
|
419
429
|
}
|
420
430
|
});
|
421
|
-
// on blur: if just a dial code then remove it
|
422
431
|
this.telInput.on("blur" + this.ns, function() {
|
423
|
-
|
424
|
-
|
425
|
-
var
|
426
|
-
|
427
|
-
|
428
|
-
|
432
|
+
if (that.options.autoHideDialCode) {
|
433
|
+
// on blur: if just a dial code then remove it
|
434
|
+
var value = that.telInput.val(), startsPlus = value.substr(0, 1) == "+";
|
435
|
+
if (startsPlus) {
|
436
|
+
var numeric = that._getNumeric(value);
|
437
|
+
// if just a plus, or if just a dial code
|
438
|
+
if (!numeric || that.selectedCountryData.dialCode == numeric) {
|
439
|
+
that.telInput.val("");
|
440
|
+
}
|
429
441
|
}
|
442
|
+
// remove the keypress listener we added on focus
|
443
|
+
that.telInput.off("keypress.plus" + that.ns);
|
444
|
+
}
|
445
|
+
// manually trigger change event if value has changed
|
446
|
+
if (that.options.autoFormat && that.telInput.val() != that.telInput.data("focusVal")) {
|
447
|
+
that.telInput.trigger("change");
|
430
448
|
}
|
431
|
-
// remove the keypress listener we added on focus
|
432
|
-
that.telInput.off("keypress.plus" + that.ns);
|
433
449
|
});
|
434
450
|
},
|
435
451
|
// extract the numeric digits from the given string
|
@@ -568,6 +584,11 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
568
584
|
},
|
569
585
|
// check if need to select a new flag based on the given number
|
570
586
|
_updateFlagFromNumber: function(number) {
|
587
|
+
// if we're in nationalMode and we're on US/Canada, make sure the number starts with a +1 so _getDialCode will be able to extract the area code
|
588
|
+
// update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit
|
589
|
+
if (this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.substr(0, 1) != "+") {
|
590
|
+
number = "+1" + number;
|
591
|
+
}
|
571
592
|
// try and extract valid dial code from input
|
572
593
|
var dialCode = this._getDialCode(number);
|
573
594
|
if (dialCode) {
|
@@ -596,12 +617,6 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
596
617
|
_isUnknownNanp: function(number, dialCode) {
|
597
618
|
return dialCode == "+1" && this._getNumeric(number).length >= 4;
|
598
619
|
},
|
599
|
-
// reset the input value to just a dial code
|
600
|
-
_resetToDialCode: function(dialCode) {
|
601
|
-
if (!this.options.nationalMode && !this.options.autoHideDialCode) {
|
602
|
-
this.telInput.val("+" + dialCode);
|
603
|
-
}
|
604
|
-
},
|
605
620
|
// remove highlighting from other list items and highlight the given item
|
606
621
|
_highlightListItem: function(listItem) {
|
607
622
|
this.countryListItems.removeClass("highlight");
|
@@ -640,7 +655,7 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
640
655
|
// update the input placeholder to an example number from the currently selected country
|
641
656
|
_updatePlaceholder: function() {
|
642
657
|
if (window.intlTelInputUtils && !this.hadInitialPlaceholder) {
|
643
|
-
var iso2 = this.selectedCountryData.iso2, placeholder = intlTelInputUtils.getExampleNumber(iso2, this.options.nationalMode);
|
658
|
+
var iso2 = this.selectedCountryData.iso2, numberType = this.options.numberType ? intlTelInputUtils.numberType[this.options.numberType] : intlTelInputUtils.numberType.FIXED_LINE, placeholder = intlTelInputUtils.getExampleNumber(iso2, this.options.nationalMode, numberType);
|
644
659
|
this.telInput.attr("placeholder", placeholder);
|
645
660
|
}
|
646
661
|
},
|
@@ -650,12 +665,8 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
650
665
|
var countryCode = listItem.attr("data-country-code");
|
651
666
|
this._selectFlag(countryCode);
|
652
667
|
this._closeDropdown();
|
653
|
-
|
654
|
-
if (
|
655
|
-
this._updateDialCode("+" + listItem.attr("data-dial-code"));
|
656
|
-
}
|
657
|
-
// always fire the change event as even if nationalMode=true (and we haven't updated
|
658
|
-
// the input val), the system as a whole has still changed - see country-sync example
|
668
|
+
this._updateDialCode(listItem.attr("data-dial-code"), true);
|
669
|
+
// always fire the change event as even if nationalMode=true (and we haven't updated the input val), the system as a whole has still changed - see country-sync example. think of it as making a selection from a select element.
|
659
670
|
this.telInput.trigger("change");
|
660
671
|
// focus the input
|
661
672
|
this.telInput.focus();
|
@@ -690,20 +701,30 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
690
701
|
container.scrollTop(newScrollTop - heightDifference);
|
691
702
|
}
|
692
703
|
},
|
693
|
-
// replace any existing dial code with the new one
|
694
|
-
//
|
695
|
-
_updateDialCode: function(newDialCode) {
|
696
|
-
var inputVal = this.telInput.val(),
|
697
|
-
//
|
698
|
-
|
699
|
-
if (
|
700
|
-
|
704
|
+
// replace any existing dial code with the new one (if not in nationalMode)
|
705
|
+
// also we need to know if we're focusing for a couple of reasons e.g. if so, we want to add any formatting suffix, also if the input is empty and we're not in nationalMode, then we want to insert the dial code
|
706
|
+
_updateDialCode: function(newDialCode, focusing) {
|
707
|
+
var inputVal = this.telInput.val(), newNumber;
|
708
|
+
// save having to pass this every time
|
709
|
+
newDialCode = "+" + newDialCode;
|
710
|
+
if (this.options.nationalMode && inputVal.substr(0, 1) != "+") {
|
711
|
+
// if nationalMode, we just want to re-format
|
712
|
+
newNumber = inputVal;
|
713
|
+
} else if (inputVal) {
|
714
|
+
// if the previous number contained a valid dial code, replace it
|
715
|
+
// (if more than just a plus character)
|
716
|
+
var prevDialCode = this._getDialCode(inputVal);
|
717
|
+
if (prevDialCode.length > 1) {
|
718
|
+
newNumber = inputVal.replace(prevDialCode, newDialCode);
|
719
|
+
} else {
|
720
|
+
// if the previous number didn't contain a dial code, we should persist it
|
721
|
+
var existingNumber = inputVal.substr(0, 1) != "+" ? $.trim(inputVal) : "";
|
722
|
+
newNumber = newDialCode + existingNumber;
|
723
|
+
}
|
701
724
|
} else {
|
702
|
-
|
703
|
-
var existingNumber = inputVal && inputVal.substr(0, 1) != "+" ? $.trim(inputVal) : "";
|
704
|
-
newNumber = newDialCode + existingNumber;
|
725
|
+
newNumber = !this.options.autoHideDialCode || focusing ? newDialCode : "";
|
705
726
|
}
|
706
|
-
this._updateVal(newNumber,
|
727
|
+
this._updateVal(newNumber, focusing);
|
707
728
|
},
|
708
729
|
// try and extract a valid international dial code from a full telephone number
|
709
730
|
// Note: returns the raw string inc plus character and any whitespace/dots etc
|
@@ -721,7 +742,7 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
721
742
|
// if current numericChars make a valid dial code
|
722
743
|
if (this.countryCodes[numericChars]) {
|
723
744
|
// store the actual raw string (useful for matching later)
|
724
|
-
dialCode = number.
|
745
|
+
dialCode = number.substr(0, i + 1);
|
725
746
|
}
|
726
747
|
// longest dial code is 4 chars
|
727
748
|
if (numericChars.length == 4) {
|
@@ -779,7 +800,10 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
779
800
|
isValidNumber: function() {
|
780
801
|
var val = $.trim(this.telInput.val()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "", // libphonenumber allows alpha chars, but in order to allow that, we'd need a method to retrieve the processed number, with letters replaced with numbers
|
781
802
|
containsAlpha = /[a-zA-Z]/.test(val);
|
782
|
-
|
803
|
+
if (!containsAlpha && window.intlTelInputUtils) {
|
804
|
+
return intlTelInputUtils.isValidNumber(val, countryCode);
|
805
|
+
}
|
806
|
+
return false;
|
783
807
|
},
|
784
808
|
// load the utils script
|
785
809
|
loadUtils: function(path) {
|
@@ -804,19 +828,7 @@ https://github.com/Bluefieldscom/intl-tel-input.git
|
|
804
828
|
// check if already selected
|
805
829
|
if (!this.selectedFlagInner.hasClass(countryCode)) {
|
806
830
|
this._selectFlag(countryCode);
|
807
|
-
|
808
|
-
if (val) {
|
809
|
-
if (this.options.nationalMode) {
|
810
|
-
// reformat
|
811
|
-
this._updateVal(val);
|
812
|
-
} else if (val) {
|
813
|
-
// update DC and reformat
|
814
|
-
this._updateDialCode("+" + this.selectedCountryData.dialCode);
|
815
|
-
}
|
816
|
-
} else {
|
817
|
-
// insert DC (this will check !nationalMode and !autoHideDialCode)
|
818
|
-
this._resetToDialCode(this.selectedCountryData.dialCode);
|
819
|
-
}
|
831
|
+
this._updateDialCode(this.selectedCountryData.dialCode, false);
|
820
832
|
}
|
821
833
|
},
|
822
834
|
// set the input value and update the flag
|
@@ -1,8 +1,8 @@
|
|
1
|
-
(function(){var k,aa=this;function m(a,b){var c=a.split("."),d=aa;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d=d[e]?d[e]:d[e]={}:d[e]=b}function
|
1
|
+
(function(){var k,aa=this;function m(a,b){var c=a.split("."),d=aa;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d=d[e]?d[e]:d[e]={}:d[e]=b}function p(a,b){function c(){}c.prototype=b.prototype;a.ya=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Ea=function(a,c,f){return b.prototype[c].apply(a,Array.prototype.slice.call(arguments,2))}};function q(a,b){null!=a&&this.append.apply(this,arguments)}k=q.prototype;k.e="";k.set=function(a){this.e=""+a};k.append=function(a,b,c){this.e+=a;if(null!=b)for(var d=1;d<arguments.length;d++)this.e+=arguments[d];return this};k.clear=function(){this.e=""};k.toString=function(){return this.e};function ba(a,b){a.sort(b||ca)}function ca(a,b){return a>b?1:a<b?-1:0};function da(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b};function r(a,b,c){this.ua=a;this.na=b.name||null;this.m={};for(a=0;a<c.length;a++)b=c[a],this.m[b.i]=b}r.prototype.getName=function(){return this.na};function ea(a){a=da(a.m);ba(a,function(a,c){return a.i-c.i});return a};function s(a,b,c){this.i=b;this.na=c.name;this.ea=!!c.fa;this.o=c.a;this.oa=c.type;this.ka=!1;switch(this.o){case fa:case ga:case ha:case ia:case ja:this.ka=!0}this.u=c.defaultValue}var fa=3,ga=4,ha=6,ia=16,ja=18;s.prototype.getName=function(){return this.na};function t(){this.c={};this.m=this.q().m;this.f=this.ma=null}k=t.prototype;k.q=function(){var a=this.constructor,b;if(!(b=a.ra)){var c;b=a.xa;var d=[],e=b[0];for(c in b)0!=c&&d.push(new s(0,c,b[c]));c=new r(a,e,d);b=a.ra=c}return b};k.has=function(a){return null!=this.c[a.i]};k.get=function(a,b){return u(this,a.i,b)};k.set=function(a,b){v(this,a.i,b)};k.add=function(a,b){ka(this,a.i,b)};k.clear=function(a){la(this,a.i)};
|
2
2
|
function ma(a,b){for(var c=ea(a.q()),d=0;d<c.length;d++){var e=c[d],f=e.i;if(null!=b.c[f]){a.f&&delete a.f[e.i];var g=11==e.o||10==e.o;if(e.ea)for(var e=w(b,f)||[],h=0;h<e.length;h++)ka(a,f,g?e[h].clone():e[h]);else e=w(b,f),g?(g=w(a,f))?ma(g,e):v(a,f,e.clone()):v(a,f,e)}}}k.clone=function(){var a=new this.constructor;a!=this&&(a.c={},a.f&&(a.f={}),ma(a,this));return a};
|
3
3
|
function w(a,b){var c=a.c[b];if(null==c)return null;if(a.ma){if(!(b in a.f)){var d=a.ma,e=a.m[b];if(null!=c)if(e.ea){for(var f=[],g=0;g<c.length;g++)f[g]=d.da(e,c[g]);c=f}else c=d.da(e,c);return a.f[b]=c}return a.f[b]}return c}function u(a,b,c){var d=w(a,b);return a.m[b].ea?d[c||0]:d}
|
4
4
|
function x(a,b){var c;if(null!=a.c[b])c=u(a,b,void 0);else a:{c=a.m[b];if(void 0===c.u){var d=c.oa;if(d===Boolean)c.u=!1;else if(d===Number)c.u=0;else if(d===String)c.u=c.ka?"0":"";else{c=new d;break a}}c=c.u}return c}function y(a,b){return a.m[b].ea?null!=a.c[b]?a.c[b].length:0:null!=a.c[b]?1:0}function v(a,b,c){a.c[b]=c;a.f&&(a.f[b]=c)}function ka(a,b,c){a.c[b]||(a.c[b]=[]);a.c[b].push(c);a.f&&delete a.f[b]}function la(a,b){delete a.c[b];a.f&&delete a.f[b]}
|
5
|
-
function A(a,b){a.
|
5
|
+
function A(a,b){a.xa=b;a.q=function(){return a.ra||(new a).q()}};/*
|
6
6
|
|
7
7
|
Protocol Buffer 2 Copyright 2008 Google Inc.
|
8
8
|
All other code copyright its respective owners.
|
@@ -20,7 +20,7 @@ function A(a,b){a.ya=b;a.q=function(){return a.ra||(new a).q()}};/*
|
|
20
20
|
See the License for the specific language governing permissions and
|
21
21
|
limitations under the License.
|
22
22
|
*/
|
23
|
-
function B(){t.apply(this)}
|
23
|
+
function B(){t.apply(this)}p(B,t);function C(){t.apply(this)}p(C,t);function D(){t.apply(this)}p(D,t);D.prototype.sa=function(){return u(this,10)};D.prototype.k=function(){return x(this,10)};D.prototype.aa=function(a){v(this,10,a)};function E(){t.apply(this)}p(E,t);E.prototype.getMetadata=function(a){return u(this,1,a)};
|
24
24
|
A(B,{0:{name:"NumberFormat",ca:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,a:9,type:String},2:{name:"format",required:!0,a:9,type:String},3:{name:"leading_digits_pattern",fa:!0,a:9,type:String},4:{name:"national_prefix_formatting_rule",a:9,type:String},6:{name:"national_prefix_optional_when_formatting",a:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",a:9,type:String}});
|
25
25
|
A(C,{0:{name:"PhoneNumberDesc",ca:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",a:9,type:String},3:{name:"possible_number_pattern",a:9,type:String},6:{name:"example_number",a:9,type:String}});
|
26
26
|
A(D,{0:{name:"PhoneMetadata",ca:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",required:!0,a:11,type:C},2:{name:"fixed_line",required:!0,a:11,type:C},3:{name:"mobile",required:!0,a:11,type:C},4:{name:"toll_free",required:!0,a:11,type:C},5:{name:"premium_rate",required:!0,a:11,type:C},6:{name:"shared_cost",required:!0,a:11,type:C},7:{name:"personal_number",required:!0,a:11,type:C},8:{name:"voip",required:!0,a:11,type:C},21:{name:"pager",required:!0,a:11,type:C},25:{name:"uan",required:!0,
|
@@ -44,8 +44,8 @@ A(E,{0:{name:"PhoneMetadataCollection",ca:"i18n.phonenumbers.PhoneMetadataCollec
|
|
44
44
|
See the License for the specific language governing permissions and
|
45
45
|
limitations under the License.
|
46
46
|
*/
|
47
|
-
function F(){t.apply(this)}
|
48
|
-
A(F,{0:{name:"PhoneNumber",ca:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:!0,a:5,type:Number},2:{name:"national_number",required:!0,a:4,type:Number},3:{name:"extension",a:9,type:String},4:{name:"italian_leading_zero",a:8,type:Boolean},8:{name:"number_of_leading_zeros",a:5,defaultValue:1,type:Number},5:{name:"raw_input",a:9,type:String},6:{name:"country_code_source",a:14,defaultValue:1,type:{
|
47
|
+
function F(){t.apply(this)}p(F,t);F.prototype.sa=function(){return u(this,1)};F.prototype.k=function(){return x(this,1)};F.prototype.aa=function(a){v(this,1,a)};F.prototype.getExtension=function(){return u(this,3)};
|
48
|
+
A(F,{0:{name:"PhoneNumber",ca:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:!0,a:5,type:Number},2:{name:"national_number",required:!0,a:4,type:Number},3:{name:"extension",a:9,type:String},4:{name:"italian_leading_zero",a:8,type:Boolean},8:{name:"number_of_leading_zeros",a:5,defaultValue:1,type:Number},5:{name:"raw_input",a:9,type:String},6:{name:"country_code_source",a:14,defaultValue:1,type:{Da:1,Ca:5,Ba:10,Aa:20}},7:{name:"preferred_domestic_carrier_code",a:9,type:String}});function G(){}G.prototype.v=function(a){new a.ua;throw Error("Unimplemented");};G.prototype.da=function(a,b){if(11==a.o||10==a.o)return b instanceof t?b:this.v(a.oa.q(),b);if(14==a.o||!a.ka)return b;var c=a.oa;if(c===String){if("number"==typeof b)return String(b)}else if(c===Number&&"string"==typeof b&&/^-?[0-9]+$/.test(b))return Number(b);return b};function H(){}p(H,G);H.prototype.v=function(a,b){var c=new a.ua;c.ma=this;c.c=b;c.f={};return c};function I(){}p(I,H);I.prototype.za=!1;I.prototype.da=function(a,b){return 8==a.o?!!b:G.prototype.da.apply(this,arguments)};I.prototype.v=function(a,b){var c=b;if(this.za){var c=[],d;for(d in b)c[parseInt(d,10)+1]=b[d]}return I.ya.v.call(this,a,c)};/*
|
49
49
|
|
50
50
|
Copyright (C) 2010 The Libphonenumber Authors
|
51
51
|
|
@@ -427,25 +427,25 @@ SK:[,[,,"[2-689]\\d{8}","\\d{9}"],[,,"[2-5]\\d{8}","\\d{9}",,,"212345678"],[,,"9
|
|
427
427
|
See the License for the specific language governing permissions and
|
428
428
|
limitations under the License.
|
429
429
|
*/
|
430
|
-
function K(){this.
|
430
|
+
function K(){this.va={}}K.r=function(){return K.ta?K.ta:K.ta=new K};
|
431
431
|
var L={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},oa={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",
|
432
432
|
7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2",B:"2",C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",
|
433
433
|
Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},pa=RegExp("[+\uff0b]+"),M=RegExp("^[+\uff0b]+"),qa=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),ra=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),sa=/[\\\/] *x/,ta=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),ua=/(?:.*?[A-Za-z]){3}.*/,va=RegExp("(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)$",
|
434
434
|
"i"),wa=RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)?$",
|
435
435
|
"i"),xa=/(\$\d)/,ya=/^\(?\$1\)?$/;function za(a){var b=a.search(ra);0<=b?(a=a.substring(b),a=a.replace(ta,""),b=a.search(sa),0<=b&&(a=a.substring(0,b))):a="";return a}function Aa(a){return 2>a.length?!1:N(wa,a)}function Ba(a){return N(ua,a)?O(a,oa):O(a,L)}function Ca(a){var b=Ba(a.toString());a.clear();a.append(b)}function O(a,b){for(var c=new q,d,e=a.length,f=0;f<e;++f)d=a.charAt(f),d=b[d.toUpperCase()],null!=d&&c.append(d);return c.toString()}
|
436
436
|
function P(a){return null!=a&&isNaN(a)&&a.toUpperCase()in na}
|
437
|
-
K.prototype.format=function(a,b){if(0==u(a,2)&&null!=a.c[5]){var c=x(a,5);if(0<c.length)return c}var c=a.k(),d=Q(a);if(0==b)return Da(c,0,d,"");if(!(c in J))return d;var e=R(this,c,S(c)),f;f=null!=a.c[3]&&0!=a.getExtension().length?3==b?";ext="+a.getExtension():null!=e.c[13]?u(e,13)+x(a,3):" ext. "+x(a,3):"";a:{for(var e=0==(w(e,20)||[]).length||2==b?w(e,19)||[]:w(e,20)||[],g,h=e.length,l=0;l<h;++l){g=e[l];var
|
437
|
+
K.prototype.format=function(a,b){if(0==u(a,2)&&null!=a.c[5]){var c=x(a,5);if(0<c.length)return c}var c=a.k(),d=Q(a);if(0==b)return Da(c,0,d,"");if(!(c in J))return d;var e=R(this,c,S(c)),f;f=null!=a.c[3]&&0!=a.getExtension().length?3==b?";ext="+a.getExtension():null!=e.c[13]?u(e,13)+x(a,3):" ext. "+x(a,3):"";a:{for(var e=0==(w(e,20)||[]).length||2==b?w(e,19)||[]:w(e,20)||[],g,h=e.length,l=0;l<h;++l){g=e[l];var n=y(g,3);if(0==n||0==d.search(u(g,3,n-1)))if(n=new RegExp(u(g,1)),N(n,d)){e=g;break a}}e=
|
438
438
|
null}null!=e&&(h=e,e=x(h,2),g=new RegExp(u(h,1)),x(h,5),l="",h=x(h,4),l=2==b&&null!=h&&0<h.length?d.replace(g,e.replace(xa,h)):d.replace(g,e),3==b&&(l=l.replace(RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+"),""),l=l.replace(RegExp("[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+","g"),"-")),d=l);return Da(c,b,d,f)};
|
439
|
-
function R(a,b,c){return"001"==c?T(a,""+b):T(a,c)}function Q(a){var b=""+u(a,2);return null!=a.c[4]&&u(a,4)?Array(x(a,8)+1).join("0")+b:b}function Da(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}
|
440
|
-
function Ea(a){switch(
|
441
|
-
function T(a,b){if(null==b)return null;b=b.toUpperCase();var c=a.
|
439
|
+
function R(a,b,c){return"001"==c?T(a,""+b):T(a,c)}function Q(a){var b=""+u(a,2);return null!=a.c[4]&&u(a,4)?Array(x(a,8)+1).join("0")+b:b}function Da(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}
|
440
|
+
function Ea(a,b){switch(b){case 4:return u(a,5);case 3:return u(a,4);case 1:return u(a,3);case 0:case 2:return u(a,2);case 5:return u(a,6);case 6:return u(a,8);case 7:return u(a,7);case 8:return u(a,21);case 9:return u(a,25);case 10:return u(a,28);default:return u(a,1)}}function U(a,b){return V(a,u(b,1))?V(a,u(b,5))?4:V(a,u(b,4))?3:V(a,u(b,6))?5:V(a,u(b,8))?6:V(a,u(b,7))?7:V(a,u(b,21))?8:V(a,u(b,25))?9:V(a,u(b,28))?10:V(a,u(b,2))?u(b,18)||V(a,u(b,3))?2:0:!u(b,18)&&V(a,u(b,3))?1:-1:-1}
|
441
|
+
function T(a,b){if(null==b)return null;b=b.toUpperCase();var c=a.va[b];if(null==c){c=na[b];if(null==c)return null;c=(new I).v(D.q(),c);a.va[b]=c}return c}function V(a,b){return N(x(b,3),a)&&N(x(b,2),a)}function Fa(a,b){if(null==b)return null;var c=b.k(),c=J[c];if(null==c)c=null;else if(1==c.length)c=c[0];else a:{for(var d=Q(b),e,f=c.length,g=0;g<f;g++){e=c[g];var h=T(a,e);if(null!=h.c[23]){if(0==d.search(u(h,23))){c=e;break a}}else if(-1!=U(d,h)){c=e;break a}}c=null}return c}
|
442
442
|
function S(a){a=J[a];return null==a?"ZZ":a[0]}function Ga(a,b){var c=T(a,b);if(null==c)throw"Invalid region code: "+b;return c.k()}function W(a,b){return N(a,b)?0:0==b.search(a)?3:2}function Ha(a,b){var c=a.toString();if(0==c.length||"0"==c.charAt(0))return 0;for(var d,e=c.length,f=1;3>=f&&f<=e;++f)if(d=parseInt(c.substring(0,f),10),d in J)return b.append(c.substring(f)),d;return 0}
|
443
443
|
function Ia(a,b,c,d,e){if(0==a.length)return 0;a=new q(a);var f;null!=b&&(f=u(b,11));null==f&&(f="NonMatch");var g=a.toString();if(0==g.length)f=20;else if(M.test(g))g=g.replace(M,""),a.clear(),a.append(Ba(g)),f=1;else{g=new RegExp(f);Ca(a);f=a.toString();if(0==f.search(g)){var g=f.match(g)[0].length,h=f.substring(g).match(qa);h&&null!=h[1]&&0<h[1].length&&"0"==O(h[1],L)?f=!1:(a.clear(),a.append(f.substring(g)),f=!0)}else f=!1;f=f?5:20}d&&v(e,6,f);if(20!=f){if(2>=a.e.length)throw"Phone number too short after IDD";
|
444
444
|
c=Ha(a,c);if(0!=c)return e.aa(c),c;throw"Invalid country calling code";}if(null!=b&&(f=b.k(),g=""+f,h=a.toString(),0==h.lastIndexOf(g,0))){var l=new q(h.substring(g.length)),h=u(b,1),g=new RegExp(x(h,2));Ja(l,b,null);b=l.toString();h=x(h,3);if(!N(g,a.toString())&&N(g,b)||3==W(h,a.toString()))return c.append(b),d&&v(e,6,10),e.aa(f),f}e.aa(0);return 0}
|
445
445
|
function Ja(a,b,c){var d=a.toString(),e=d.length,f=u(b,15);if(0!=e&&null!=f&&0!=f.length&&(f=new RegExp("^(?:"+f+")"),e=f.exec(d))){var g=RegExp,h;h=u(b,1);h=x(h,2);g=new g(h);h=N(g,d);var l=e.length-1;b=u(b,16);if(null==b||0==b.length||null==e[l]||0==e[l].length){if(!h||N(g,d.substring(e[0].length)))null!=c&&0<l&&null!=e[l]&&c.append(e[1]),a.set(d.substring(e[0].length))}else if(d=d.replace(f,b),!h||N(g,d))null!=c&&0<l&&c.append(e[1]),a.set(d)}}
|
446
446
|
K.prototype.parse=function(a,b){return Ka(this,a,b,!1)};function X(a,b,c){if(!P(c)&&0<b.length&&"+"!=b.charAt(0))throw"Invalid country calling code";return Ka(a,b,c,!0)}
|
447
447
|
function Ka(a,b,c,d){if(null==b)throw"The string supplied did not seem to be a phone number";if(250<b.length)throw"The string supplied is too long to be a phone number";var e=new q,f=b.indexOf(";phone-context=");if(0<f){var g=f+15;if("+"==b.charAt(g)){var h=b.indexOf(";",g);0<h?e.append(b.substring(g,h)):e.append(b.substring(g))}g=b.indexOf("tel:");e.append(b.substring(0<=g?g+4:0,f))}else e.append(za(b));f=e.toString();g=f.indexOf(";isub=");0<g&&(e.clear(),e.append(f.substring(0,g)));if(!Aa(e.toString()))throw"The string supplied did not seem to be a phone number";
|
448
|
-
f=e.toString();if(!(P(c)||null!=f&&0<f.length&&M.test(f)))throw"Invalid country calling code";f=new F;d&&v(f,5,b);a:{b=e.toString();g=b.search(va);if(0<=g&&Aa(b.substring(0,g)))for(var h=b.match(va),l=h.length,
|
448
|
+
f=e.toString();if(!(P(c)||null!=f&&0<f.length&&M.test(f)))throw"Invalid country calling code";f=new F;d&&v(f,5,b);a:{b=e.toString();g=b.search(va);if(0<=g&&Aa(b.substring(0,g)))for(var h=b.match(va),l=h.length,n=1;n<l;++n)if(null!=h[n]&&0<h[n].length){e.clear();e.append(b.substring(0,g));b=h[n];break a}b=""}0<b.length&&v(f,3,b);g=T(a,c);b=new q;h=0;l=e.toString();try{h=Ia(l,g,b,d,f)}catch(z){if("Invalid country calling code"==z&&M.test(l)){if(l=l.replace(M,""),h=Ia(l,g,b,d,f),0==h)throw z;}else throw z;
|
449
449
|
}0!=h?(e=S(h),e!=c&&(g=R(a,h,e))):(Ca(e),b.append(e.toString()),null!=c?(h=g.k(),f.aa(h)):d&&la(f,6));if(2>b.e.length)throw"The string supplied is too short to be a phone number";null!=g&&(a=new q,c=new q(b.toString()),Ja(c,g,a),e=c.toString(),g=u(g,1),g=x(g,3),2!=W(g,e)&&(b=c,d&&v(f,7,a.toString())));d=b.toString();a=d.length;if(2>a)throw"The string supplied is too short to be a phone number";if(17<a)throw"The string supplied is too long to be a phone number";if(1<d.length&&"0"==d.charAt(0)){v(f,
|
450
450
|
4,!0);for(a=1;a<d.length-1&&"0"==d.charAt(a);)a++;1!=a&&v(f,8,a)}v(f,2,parseInt(d,10));return f}function N(a,b){var c="string"==typeof a?b.match("^(?:"+a+")$"):b.match(a);return c&&c[0].length==b.length?!0:!1};/*
|
451
451
|
|
@@ -463,10 +463,10 @@ f=e.toString();if(!(P(c)||null!=f&&0<f.length&&M.test(f)))throw"Invalid country
|
|
463
463
|
See the License for the specific language governing permissions and
|
464
464
|
limitations under the License.
|
465
465
|
*/
|
466
|
-
function La(a){this.qa="\u2008";this.ha=new RegExp(this.qa);this.ia="";this.p=new q;this.ba="";this.j=new q;this.t=new q;this.l=!0;this.w=this.s=this.la=!1;this.pa=K.r();this.$=0;this.d=new q;this.ga=!1;this.n="";this.b=new q;this.g=[];this.ja=a;this.
|
466
|
+
function La(a){this.qa="\u2008";this.ha=new RegExp(this.qa);this.ia="";this.p=new q;this.ba="";this.j=new q;this.t=new q;this.l=!0;this.w=this.s=this.la=!1;this.pa=K.r();this.$=0;this.d=new q;this.ga=!1;this.n="";this.b=new q;this.g=[];this.ja=a;this.wa=this.h=Y(this,this.ja)}var Ma=new D;v(Ma,11,"NA");
|
467
467
|
var Na=/\[([^\[\]])*\]/g,Oa=/\d(?=[^,}][^,}])/g,Pa=RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*(\\$\\d[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*)+$"),Qa=/[- ]/;function Y(a,b){var c=P(b)?Ga(a.pa,b):0,c=T(a.pa,S(c));return null!=c?c:Ma}
|
468
|
-
function Ra(a){for(var b=a.g.length,c=0;c<b;++c){var d=a.g[c],e=x(d,1);if(a.ba==e)return!1;var f;f=a;var g=d,h=x(g,1);if(-1!=h.indexOf("|"))f=!1;else{h=h.replace(Na,"\\d");h=h.replace(Oa,"\\d");f.p.clear();var l;l=f;var g=x(g,2),
|
469
|
-
function Sa(a,b){for(var c=[],d=b.length-3,e=a.g.length,f=0;f<e;++f){var g=a.g[f];if(0==y(g,3))c.push(a.g[f]);else{var h=Math.min(d,y(g,3)-1),g=u(g,3,h);0==b.search(g)&&c.push(a.g[f])}}a.g=c}La.prototype.clear=function(){this.ia="";this.j.clear();this.t.clear();this.p.clear();this.$=0;this.ba="";this.d.clear();this.n="";this.b.clear();this.l=!0;this.w=this.s=this.la=!1;this.g=[];this.ga=!1;this.h!=this.
|
468
|
+
function Ra(a){for(var b=a.g.length,c=0;c<b;++c){var d=a.g[c],e=x(d,1);if(a.ba==e)return!1;var f;f=a;var g=d,h=x(g,1);if(-1!=h.indexOf("|"))f=!1;else{h=h.replace(Na,"\\d");h=h.replace(Oa,"\\d");f.p.clear();var l;l=f;var g=x(g,2),n="999999999999999".match(h)[0];n.length<l.b.e.length?l="":(h=n.replace(new RegExp(h,"g"),g),l=h=h.replace(RegExp("9","g"),l.qa));0<l.length?(f.p.append(l),f=!0):f=!1}if(f)return a.ba=e,a.ga=Qa.test(u(d,4)),a.$=0,!0}return a.l=!1}
|
469
|
+
function Sa(a,b){for(var c=[],d=b.length-3,e=a.g.length,f=0;f<e;++f){var g=a.g[f];if(0==y(g,3))c.push(a.g[f]);else{var h=Math.min(d,y(g,3)-1),g=u(g,3,h);0==b.search(g)&&c.push(a.g[f])}}a.g=c}La.prototype.clear=function(){this.ia="";this.j.clear();this.t.clear();this.p.clear();this.$=0;this.ba="";this.d.clear();this.n="";this.b.clear();this.l=!0;this.w=this.s=this.la=!1;this.g=[];this.ga=!1;this.h!=this.wa&&(this.h=Y(this,this.ja))};function Ta(a,b){a.ia=Ua(a,b);return a.ia}
|
470
470
|
function Ua(a,b){a.j.append(b);var c=b;if(qa.test(c)||1==a.j.e.length&&pa.test(c)){var c=b,d;"+"==c?(d=c,a.t.append(c)):(d=L[c],a.t.append(d),a.b.append(d));b=d}else a.l=!1,a.la=!0;if(!a.l){if(!a.la)if(Va(a)){if(Wa(a))return Xa(a)}else if(0<a.n.length&&(c=a.b.toString(),a.b.clear(),a.b.append(a.n),a.b.append(c),c=a.d.toString(),d=c.lastIndexOf(a.n),a.d.clear(),a.d.append(c.substring(0,d))),a.n!=Ya(a))return a.d.append(" "),Xa(a);return a.j.toString()}switch(a.t.e.length){case 0:case 1:case 2:return a.j.toString();
|
471
471
|
case 3:if(Va(a))a.w=!0;else return a.n=Ya(a),Z(a);default:if(a.w)return Wa(a)&&(a.w=!1),a.d.toString()+a.b.toString();if(0<a.g.length){c=Za(a,b);d=$a(a);if(0<d.length)return d;Sa(a,a.b.toString());return Ra(a)?ab(a):a.l?$(a,c):a.j.toString()}return Z(a)}}function Xa(a){a.l=!0;a.w=!1;a.g=[];return Z(a)}
|
472
472
|
function $a(a){for(var b=a.b.toString(),c=a.g.length,d=0;d<c;++d){var e=a.g[d],f=x(e,1);if((new RegExp("^(?:"+f+")$")).test(b))return a.ga=Qa.test(u(e,4)),b=b.replace(new RegExp(f,"g"),u(e,2)),$(a,b)}return""}function $(a,b){var c=a.d.e.length;return a.ga&&0<c&&" "!=a.d.toString().charAt(c-1)?a.d+" "+b:a.d+b}
|
@@ -474,6 +474,6 @@ function Z(a){var b=a.b.toString();if(3<=b.length){for(var c=a.s&&0<y(a.h,20)?w(
|
|
474
474
|
function Ya(a){var b=a.b.toString(),c=0,d;1!=a.h.sa()?d=!1:(d=a.b.toString(),d="1"==d.charAt(0)&&"0"!=d.charAt(1)&&"1"!=d.charAt(1));d?(c=1,a.d.append("1").append(" "),a.s=!0):null!=a.h.c[15]&&(d=new RegExp("^(?:"+u(a.h,15)+")"),d=b.match(d),null!=d&&null!=d[0]&&0<d[0].length&&(a.s=!0,c=d[0].length,a.d.append(b.substring(0,c))));a.b.clear();a.b.append(b.substring(c));return b.substring(0,c)}
|
475
475
|
function Va(a){var b=a.t.toString(),c=new RegExp("^(?:\\+|"+u(a.h,11)+")"),c=b.match(c);return null!=c&&null!=c[0]&&0<c[0].length?(a.s=!0,c=c[0].length,a.b.clear(),a.b.append(b.substring(c)),a.d.clear(),a.d.append(b.substring(0,c)),"+"!=b.charAt(0)&&a.d.append(" "),!0):!1}function Wa(a){if(0==a.b.e.length)return!1;var b=new q,c=Ha(a.b,b);if(0==c)return!1;a.b.clear();a.b.append(b.toString());b=S(c);"001"==b?a.h=T(a.pa,""+c):b!=a.ja&&(a.h=Y(a,b));a.d.append(""+c).append(" ");a.n="";return!0}
|
476
476
|
function Za(a,b){var c=a.p.toString();if(0<=c.substring(a.$).search(a.ha)){var d=c.search(a.ha),c=c.replace(a.ha,b);a.p.clear();a.p.append(c);a.$=d;return c.substring(0,a.$+1)}1==a.g.length&&(a.l=!1);a.ba="";return a.j.toString()};m("intlTelInputUtils",{});m("intlTelInputUtils.formatNumber",function(a,b,c){try{var d=a.replace(/\D/g,"");"+"==a.substr(0,1)&&(d="+"+d);var e=new La(b);b="";for(var f,g=0;g<d.length;g++){f=Ta(e,d.charAt(g));if(b&&f.length<=b.length)break;b=f}" "==b.charAt(b.length-1)&&(b=b.substr(0,b.length-1));if(c){var h=Ta(e,"5");" "==h.charAt(h.length-1)&&(h=h.substr(0,h.length-1));1<h.length-b.length&&(b=h.substr(0,h.length-1))}return b}catch(l){return a}});
|
477
|
-
m("intlTelInputUtils.formatNumberE164",function(a,b){try{var c=K.r(),d=X(c,a,b);return c.format(d,0)}catch(e){return""}});m("intlTelInputUtils.getExampleNumber",function(a,b){try{var
|
478
|
-
m("intlTelInputUtils.getValidationError",function(a,b){try{var c=K.r(),d;var e=X(c,a,b),f=Q(e),g=e.k();if(g in J){var h,l=R(c,g,S(g));h=u(l,1);var
|
479
|
-
m("intlTelInputUtils.isValidNumber",function(a,b){try{var c=K.r(),d=X(c,a,b),e;var f=Fa(c,d),g=d.k(),h=R(c,g,f);if(null==h||"001"!=f&&g!=Ga(c,f))e=!1;else{var l=Q(d);e=-1!=U(l,h)}return e}catch(
|
477
|
+
m("intlTelInputUtils.formatNumberE164",function(a,b){try{var c=K.r(),d=X(c,a,b);return c.format(d,0)}catch(e){return""}});m("intlTelInputUtils.getExampleNumber",function(a,b,c){try{var d=K.r(),e;a:{if(P(a)){var f=Ea(T(d,a),c);try{if(null!=f.c[6]){e=d.parse(x(f,6),a);break a}}catch(g){}}e=null}return d.format(e,b?2:1)}catch(h){return""}});m("intlTelInputUtils.getNumberType",function(a,b){try{var c=K.r(),d;var e=X(c,a,b),f=Fa(c,e),g=R(c,e.k(),f);if(null==g)d=-1;else{var h=Q(e);d=U(h,g)}return d}catch(l){return-99}});
|
478
|
+
m("intlTelInputUtils.getValidationError",function(a,b){try{var c=K.r(),d;var e=X(c,a,b),f=Q(e),g=e.k();if(g in J){var h,l=R(c,g,S(g));h=u(l,1);var n=x(h,3);d=W(n,f)}else d=1;return d}catch(z){return"Invalid country calling code"==z?1:"The string supplied did not seem to be a phone number"==z?4:"Phone number too short after IDD"==z||"The string supplied is too short to be a phone number"==z?2:"The string supplied is too long to be a phone number"==z?3:-99}});
|
479
|
+
m("intlTelInputUtils.isValidNumber",function(a,b){try{var c=K.r(),d=X(c,a,b),e;var f=Fa(c,d),g=d.k(),h=R(c,g,f);if(null==h||"001"!=f&&g!=Ga(c,f))e=!1;else{var l=Q(d);e=-1!=U(l,h)}return e}catch(n){return!1}});m("intlTelInputUtils.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1});m("intlTelInputUtils.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,NOT_A_NUMBER:4});})();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intl-tel-input-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilias Spyropoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|