@ikas/popup-renderer 1.0.244 → 1.0.246
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.
- package/build/ext/libphonenumber-js/es6/AsYouType.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.util.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeParser.js +1 -1
- package/build/ext/libphonenumber-js/es6/AsYouTypeState.js +1 -1
- package/build/ext/libphonenumber-js/es6/ParseError.js +1 -1
- package/build/ext/libphonenumber-js/es6/PhoneNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js +1 -1
- package/build/ext/libphonenumber-js/es6/findNumbers/LRUCache.js +1 -1
- package/build/ext/libphonenumber-js/es6/findNumbers/Leniency.js +1 -1
- package/build/ext/libphonenumber-js/es6/findNumbers/RegExpCache.js +1 -1
- package/build/ext/libphonenumber-js/es6/format.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/checkNumberLength.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/extractNationalNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/getNumberType.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/mergeArrays.js +1 -1
- package/build/ext/libphonenumber-js/es6/helpers/parseDigits.js +1 -1
- package/build/ext/libphonenumber-js/es6/isPossible.js +1 -1
- package/build/ext/libphonenumber-js/es6/isValidPhoneNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/legacy/findPhoneNumbersInitialImplementation.js +1 -0
- package/build/ext/libphonenumber-js/es6/metadata.js +1 -1
- package/build/ext/libphonenumber-js/es6/normalizeArguments.js +1 -1
- package/build/ext/libphonenumber-js/es6/parse.js +1 -1
- package/build/ext/libphonenumber-js/es6/parseIncompletePhoneNumber.js +1 -1
- package/build/ext/libphonenumber-js/es6/parsePhoneNumberWithError_.js +1 -1
- package/build/ext/libphonenumber-js/es6/parsePhoneNumber_.js +1 -1
- package/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js +1 -1
- package/build/ext/libphonenumber-js/metadata.min.json.js +1 -1
- package/build/ext/mobx-react-lite/es/observer.js +1 -1
- package/build/ext/mobx-react-lite/es/useObserver.js +1 -1
- package/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -1
- package/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -1
- package/build/ext/tslib/tslib.es6.mjs.js +1 -1
- package/build/popup-renderer/components/button-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/divider-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -1
- package/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -1
- package/build/popup-renderer/components/image-column-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/image-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/index.js +1 -1
- package/build/popup-renderer/components/product-list-renderer/index.js +1 -1
- package/build/popup-renderer/components/social-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/space-element-renderer/index.js +1 -1
- package/build/popup-renderer/components/text-element-renderer/index.js +1 -1
- package/build/popup-renderer/helpers/index.js +1 -1
- package/build/popup-renderer/models/modal/index.js +1 -1
- package/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js +1 -1
- package/build/popup-renderer/models/modal/step/elements/form/index.js +1 -1
- package/build/popup-renderer/models/modal/step/elements/social/index.js +1 -1
- package/build/popup-renderer/models/modal/step/index.js +1 -1
- package/package.json +1 -1
- package/build/ext/libphonenumber-js/es6/legacy/PhoneNumberSearch.js +0 -1
- package/build/ext/libphonenumber-js/min/exports/PhoneNumber.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./metadata.js";import e from"./PhoneNumber.js";import a from"./AsYouTypeState.js";import n from"./AsYouTypeFormatter.js";import r from"./AsYouTypeParser.js";import i from"./helpers/getCountryByCallingCode.js";import o from"./helpers/getCountryByNationalNumber.js";import u from"./helpers/isObject.js";import{DIGIT_PLACEHOLDER as s}from"./AsYouTypeFormatter.util.js";function l(t
|
|
1
|
+
import t from"./metadata.js";import e from"./PhoneNumber.js";import a from"./AsYouTypeState.js";import n from"./AsYouTypeFormatter.js";import r from"./AsYouTypeParser.js";import i from"./helpers/getCountryByCallingCode.js";import o from"./helpers/getCountryByNationalNumber.js";import u from"./helpers/isObject.js";import{DIGIT_PLACEHOLDER as s}from"./AsYouTypeFormatter.util.js";function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var n,r,i=[],o=!0,u=!1;try{for(a=a.call(t);!(o=(n=a.next()).done)&&(i.push(n.value),!e||i.length!==e);o=!0);}catch(t){u=!0,r=t}finally{try{o||null==a.return||a.return()}finally{if(u)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=new Array(e);a<e;a++)n[a]=t[a];return n}function h(t,e){for(var a=0;a<e.length;a++){var n=e[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var m=function(){function f(e,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),this.metadata=new t(a);var n=l(this.getCountryAndCallingCode(e),2),r=n[0],i=n[1];this.defaultCountry=r,this.defaultCallingCode=i,this.reset()}var m,d,g;return m=f,(d=[{key:"getCountryAndCallingCode",value:function(t){var e,a;return t&&(u(t)?(e=t.defaultCountry,a=t.defaultCallingCode):e=t),e&&!this.metadata.hasCountry(e)&&(e=void 0),[e,a]}},{key:"input",value:function(t){var e=this.parser.input(t,this.state),a=e.digits;if(e.justLeadingPlus)this.formattedOutput="+";else if(a){var n;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(n=this.formatter.format(a,this.state)),void 0===n&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(n=this.formatter.format(r,this.state))}this.formattedOutput=n?this.getFullNumber(n):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var t=this;return this.state=new a({onCountryChange:function(e){t.country=e},onCallingCodeChange:function(e,a){t.metadata.selectNumberingPlan(a,e),t.formatter.reset(t.metadata.numberingPlan,t.state),t.parser.reset(t.metadata.numberingPlan)}}),this.formatter=new n({state:this.state,metadata:this.metadata}),this.parser=new r({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){t.determineTheCountryIfNeeded(),t.formatter.reset(t.metadata.numberingPlan,t.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(t){var e=this;if(this.isInternational()){var a=function(t){return e.formatter.getInternationalPrefixBeforeCountryCallingCode(e.state,{spacing:!!t})+t},n=this.state.callingCode;return a(n?t?"".concat(n," ").concat(t):n:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return t}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var t=this.state,e=t.nationalSignificantNumber,a=t.complexPrefixBeforeNationalSignificantNumber,n=t.nationalPrefix,r=e,i=a||n;return i&&(r=i+r),r}},{key:"getNonFormattedNumber",value:function(){var t=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(t?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var t=this.getNonFormattedNumber();if(t)return t.replace(/[\+\d]/g,s)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var t=this.state.callingCode,e=this.metadata.getCountryCodesForCallingCode(t);return e&&e.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(i(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var t=this.state,e=t.digits,a=t.callingCode,n=t.country,r=t.nationalSignificantNumber;if(e)return this.isInternational()?a?"+"+a+r:"+"+e:n||a?"+"+(n?this.metadata.countryCallingCode():a)+r:void 0}},{key:"getNumber",value:function(){var a=this.state,n=a.nationalSignificantNumber,r=a.carrierCode,i=a.callingCode,u=this._getCountry();if(n&&(u||i)){if(u&&u===this.defaultCountry){var s=new t(this.metadata.metadata);s.selectNumberingPlan(u);var l=s.numberingPlan.callingCode(),f=this.metadata.getCountryCodesForCallingCode(l);if(f.length>1){var h=o(n,{countries:f,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});h&&(u=h)}}var m=new e(u||i,n,this.metadata.metadata);return r&&(m.carrierCode=r),m}}},{key:"isPossible",value:function(){var t=this.getNumber();return!!t&&t.isPossible()}},{key:"isValid",value:function(){var t=this.getNumber();return!!t&&t.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}])&&h(m.prototype,d),g&&h(m,g),Object.defineProperty(m,"prototype",{writable:!1}),f}();export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./AsYouTypeFormatter.PatternParser.js";function t(r,t){var
|
|
1
|
+
import r from"./AsYouTypeFormatter.PatternParser.js";function t(r,t){var a="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(a)return(a=a.call(r)).next.bind(a);if(Array.isArray(r)||(a=function(r,t){if(!r)return;if("string"==typeof r)return e(r,t);var a=Object.prototype.toString.call(r).slice(8,-1);"Object"===a&&r.constructor&&(a=r.constructor.name);if("Map"===a||"Set"===a)return Array.from(r);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return e(r,t)}(r))||t&&r&&"number"==typeof r.length){a&&(r=a);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,a=new Array(t);e<t;e++)a[e]=r[e];return a}function a(r,t){for(var e=0;e<t.length;e++){var a=t[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}var n=function(){function t(e){!function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.matchTree=(new r).parse(e)}var e,n,i;return e=t,n=[{key:"match",value:function(r){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!r)throw new Error("String is required");var e=o(r.split(""),this.matchTree,!0);if(e&&e.match&&delete e.matchedChars,!e||!e.overflow||t)return e}}],n&&a(e.prototype,n),i&&a(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function o(r,e,a){if("string"==typeof e){var n=r.join("");return 0===e.indexOf(n)?r.length===e.length?{match:!0,matchedChars:r}:{partialMatch:!0}:0===n.indexOf(e)?a&&r.length>e.length?{overflow:!0}:{match:!0,matchedChars:r.slice(0,e.length)}:void 0}if(Array.isArray(e)){for(var i=r.slice(),l=0;l<e.length;){var c=o(i,e[l],a&&l===e.length-1);if(!c)return;if(c.overflow)return c;if(!c.match){if(c.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)))}if(0===(i=i.slice(c.matchedChars.length)).length)return l===e.length-1?{match:!0,matchedChars:r}:{partialMatch:!0};l++}return a?{overflow:!0}:{match:!0,matchedChars:r.slice(0,r.length-i.length)}}switch(e.op){case"|":for(var h,f,u=t(e.args);!(f=u()).done;){var s=o(r,f.value,a);if(s){if(s.overflow)return s;if(s.match)return{match:!0,matchedChars:s.matchedChars};if(!s.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)));h=!0}}return h?{partialMatch:!0}:void 0;case"[]":for(var m,d=t(e.args);!(m=d()).done;){var p=m.value;if(r[0]===p)return 1===r.length?{match:!0,matchedChars:r}:a?{overflow:!0}:{match:!0,matchedChars:[p]}}return;default:throw new Error("Unsupported instruction tree: ".concat(e))}}export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(
|
|
1
|
+
function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var e=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e)}var i,a,h;return i=e,(a=[{key:"parse",value:function(t){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(t),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var e=this.context[0],r=e.branches,n=e.instructions;if(r)return{op:"|",args:r.concat([s(n)])};if(0===n.length)throw new Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(t){this.context.push(t)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(t){if(!t)throw new Error("Pattern is required");var e=t.match(o);if(e){var i=e[1],a=t.slice(0,e.index),h=t.slice(e.index+i.length);switch(i){case"(?:":a&&this.parsePattern(a),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(a&&this.parsePattern(a),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var c=this.getContext().branches;c.push(s(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:c});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(a&&this.parsePattern(a),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(s(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":a&&this.parsePattern(a),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:r(a)});break;default:throw new Error("Unknown operator: ".concat(i))}h&&this.parsePattern(h)}else{if(n.test(t))throw new Error("Illegal characters found in a pattern: ".concat(t));this.getContext().instructions=this.getContext().instructions.concat(t.split(""))}}}])&&t(i.prototype,a),h&&t(i,h),Object.defineProperty(i,"prototype",{writable:!1}),e}();function r(t){for(var e=[],r=0;r<t.length;){if("-"===t[r]){if(0===r||r===t.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(t));for(var n=t[r-1].charCodeAt(0)+1,o=t[r+1].charCodeAt(0)-1,s=n;s<=o;)e.push(String.fromCharCode(s)),s++}else e.push(t[r]);r++}return e}var n=/[\(\)\[\]\?\:\|]/,o=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function s(t){return 1===t.length?t[0]:t}export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import a from"./helpers/checkNumberLength.js";import t from"./helpers/parseDigits.js";import
|
|
1
|
+
import a from"./helpers/checkNumberLength.js";import t from"./helpers/parseDigits.js";import e from"./helpers/formatNationalNumberUsingFormat.js";function r(a,t,e){var r=e.metadata,i=e.shouldTryNationalPrefixFormattingRule,o=e.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(a.nationalSignificantNumber))return function(a,t,e){var r=e.metadata,i=e.shouldTryNationalPrefixFormattingRule,o=e.getSeparatorAfterNationalPrefix;if(a.nationalSignificantNumber,a.international,a.nationalPrefix,a.carrierCode,i(t)){var f=n(a,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:r});if(f)return f}return n(a,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:r})}(a,t,{metadata:r,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:o})}function i(t,e){return"IS_POSSIBLE"===a(t,e)}function n(a,r,i){var n=i.metadata,o=i.useNationalPrefixFormattingRule,f=i.getSeparatorAfterNationalPrefix,l=e(a.nationalSignificantNumber,r,{carrierCode:a.carrierCode,useInternationalFormat:a.international,withNationalPrefix:o,metadata:n});if(o||(a.nationalPrefix?l=a.nationalPrefix+f(r)+l:a.complexPrefixBeforeNationalSignificantNumber&&(l=a.complexPrefixBeforeNationalSignificantNumber+" "+l)),function(a,e){return t(a)===e.getNationalDigits()}(l,a))return l}export{i as canFormatCompleteNumber,r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DIGIT_PLACEHOLDER as t,cutAndStripNonPairedParens as e,repeat as a,populateTemplateWithDigits as r}from"./AsYouTypeFormatter.util.js";export{DIGIT_PLACEHOLDER}from"./AsYouTypeFormatter.util.js";import i,{canFormatCompleteNumber as n}from"./AsYouTypeFormatter.complete.js";import o from"./AsYouTypeFormatter.PatternMatcher.js";import l from"./helpers/parseDigits.js";import{FIRST_GROUP_PATTERN as
|
|
1
|
+
import{DIGIT_PLACEHOLDER as t,cutAndStripNonPairedParens as e,repeat as a,populateTemplateWithDigits as r}from"./AsYouTypeFormatter.util.js";export{DIGIT_PLACEHOLDER}from"./AsYouTypeFormatter.util.js";import i,{canFormatCompleteNumber as n}from"./AsYouTypeFormatter.complete.js";import o from"./AsYouTypeFormatter.PatternMatcher.js";import l from"./helpers/parseDigits.js";import{FIRST_GROUP_PATTERN as s}from"./helpers/formatNationalNumberUsingFormat.js";import{VALID_PUNCTUATION as m}from"./constants.js";import u from"./helpers/applyInternationalSeparatorStyle.js";function f(t,e){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(a)return(a=a.call(t)).next.bind(a);if(Array.isArray(t)||(a=function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return h(t,e)}(t))||e&&t&&"number"==typeof t.length){a&&(t=a);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function p(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=a("9",15),g=/[- ]/,N=new RegExp("["+m+"]*\\$1["+m+"]*(\\$\\d["+m+"]*)*$"),v=function(){function m(t){t.state;var e=t.metadata;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,m),this.metadata=e,this.resetFormat()}var h,v,d;return h=m,(v=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(t,e){this.resetFormat(),t?(this.isNANP="1"===t.callingCode(),this.matchingFormats=t.formats(),e.nationalSignificantNumber&&this.narrowDownMatchingFormats(e)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,a){var r=this;if(n(a.nationalSignificantNumber,this.metadata))for(var o,l=f(this.matchingFormats);!(o=l()).done;){var s=o.value,m=i(a,s,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(t){return r.shouldTryNationalPrefixFormattingRule(t,{international:a.international,nationalPrefix:a.nationalPrefix})},getSeparatorAfterNationalPrefix:function(t){return r.getSeparatorAfterNationalPrefix(t)}});if(m)return this.resetFormat(),this.chosenFormat=s,this.setNationalNumberTemplate(m.replace(/\d/g,t),a),this.populatedNationalNumberTemplate=m,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(t),m}return this.formatNationalNumberWithNextDigits(e,a)}},{key:"formatNationalNumberWithNextDigits",value:function(t,e){var a=this.chosenFormat,r=this.chooseFormat(e);if(r)return r===a?this.formatNextNationalNumberDigits(t):this.formatNextNationalNumberDigits(e.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(t){var e=this,a=t.nationalSignificantNumber,r=t.nationalPrefix,i=t.international,n=a,o=n.length-3;o<0&&(o=0),this.matchingFormats=this.matchingFormats.filter((function(t){return e.formatSuits(t,i,r)&&e.formatMatches(t,n,o)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(t,e,a){return!(a&&!t.usesNationalPrefix()&&!t.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!e&&!a&&t.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(t,e,a){var r=t.leadingDigitsPatterns().length;if(0===r)return!0;a=Math.min(a,r-1);var i=t.leadingDigitsPatterns()[a];if(e.length<3)try{return void 0!==new o(i).match(e,{allowOverflow:!0})}catch(t){return console.error(t),!0}return new RegExp("^(".concat(i,")")).test(e)}},{key:"getFormatFormat",value:function(t,e){return e?t.internationalFormat():t.format()}},{key:"chooseFormat",value:function(t){for(var e,a=this,r=function(){var r=e.value;return a.chosenFormat===r?"break":N.test(a.getFormatFormat(r,t.international))?a.createTemplateForFormat(r,t)?(a.chosenFormat=r,"break"):(a.matchingFormats=a.matchingFormats.filter((function(t){return t!==r})),"continue"):"continue"},i=f(this.matchingFormats.slice());!(e=i()).done;){var n=r();if("break"===n)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(t,e){if(!(t.pattern().indexOf("|")>=0)){var a=this.getTemplateForFormat(t,e);return a?(this.setNationalNumberTemplate(a,e),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(t){return this.isNANP||t&&t.nationalPrefixFormattingRule()&&g.test(t.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(t,e){var a=t.IDDPrefix,r=t.missingPlus;return a?e&&!1===e.spacing?a:a+" ":r?"":"+"}},{key:"getTemplate",value:function(a){if(this.template){for(var r=-1,i=0,n=a.international?this.getInternationalPrefixBeforeCountryCallingCode(a,{spacing:!1}):"";i<n.length+a.getDigitsWithoutInternationalPrefix().length;)r=this.template.indexOf(t,r+1),i++;return e(this.template,r+1)}}},{key:"setNationalNumberTemplate",value:function(e,r){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,r.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(r).replace(/[\d\+]/g,t)+a(t,r.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,r){var i=r.nationalSignificantNumber,n=r.international,o=r.nationalPrefix,m=r.complexPrefixBeforeNationalSignificantNumber,f=e.pattern();f=f.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var h=c.match(f)[0];if(!(i.length>h.length)){var p=new RegExp("^"+f+"$"),g=i.replace(/\d/g,"9");p.test(g)&&(h=g);var N,v=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:o})){var d=v.replace(s,e.nationalPrefixFormattingRule());if(l(e.nationalPrefixFormattingRule())===(o||"")+l("$1")&&(v=d,N=!0,o))for(var F=o.length;F>0;)v=v.replace(/\d/,t),F--}var y=h.replace(new RegExp(f),v).replace(new RegExp("9","g"),t);return N||(m?y=a(t,m.length)+" "+y:o&&(y=a(t,o.length)+this.getSeparatorAfterNationalPrefix(e)+y)),n&&(y=u(y)),y}}},{key:"formatNextNationalNumberDigits",value:function(t){var a=r(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,t);if(a)return this.populatedNationalNumberTemplate=a[0],this.populatedNationalNumberTemplatePosition=a[1],e(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(t,e){var a=e.international,r=e.nationalPrefix;if(t.nationalPrefixFormattingRule()){var i=t.usesNationalPrefix();if(i&&r||!i&&!a)return!0}}}])&&p(h.prototype,v),d&&p(h,d),Object.defineProperty(h,"prototype",{writable:!1}),m}();export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,t){if(r)
|
|
1
|
+
function r(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,t){if(!r)return;if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var t="x",n=new RegExp("x");function o(r,e){if(e<1)return"";for(var t="";e>1;)1&e&&(t+=r),e>>=1,r+=r;return t+r}function a(r,e){return")"===r[e]&&e++,i(r.slice(0,e))}function i(r){for(var e=[],t=0;t<r.length;)"("===r[t]?e.push(t):")"===r[t]&&e.pop(),t++;var n=0,o="";e.push(r.length);for(var a=0,i=e;a<i.length;a++){var u=i[a];o+=r.slice(n,u),n=u+1}return o}function u(e,t,o){for(var a,i=r(o.split(""));!(a=i()).done;){var u=a.value;if(e.slice(t+1).search(n)<0)return;t=e.search(n),e=e.replace(n,u)}return[e,t]}export{t as DIGIT_PLACEHOLDER,a as cutAndStripNonPairedParens,u as populateTemplateWithDigits,o as repeat,i as stripNonPairedParens};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./helpers/extractCountryCallingCode.js";import i from"./helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";import n from"./helpers/extractNationalNumberFromPossiblyIncompleteNumber.js";import
|
|
1
|
+
import t from"./helpers/extractCountryCallingCode.js";import i from"./helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";import n from"./helpers/extractNationalNumberFromPossiblyIncompleteNumber.js";import a from"./helpers/stripIddPrefix.js";import e from"./helpers/parseDigits.js";import{VALID_PUNCTUATION as r,VALID_DIGITS as o,PLUS_CHARS as l}from"./constants.js";function u(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var a,e,r=[],o=!0,l=!1;try{for(n=n.call(t);!(o=(a=n.next()).done)&&(r.push(a.value),!i||r.length!==i);o=!0);}catch(t){l=!0,e=t}finally{try{o||null==n.return||n.return()}finally{if(l)throw e}}return r}(t,i)||function(t,i){if(!t)return;if("string"==typeof t)return s(t,i);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(t,i)}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,i){(null==i||i>t.length)&&(i=t.length);for(var n=0,a=new Array(i);n<i;n++)a[n]=t[n];return a}function c(t,i){for(var n=0;n<i.length;n++){var a=i[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var f=new RegExp("^"+("["+r+o+"]+")+"$","i"),d="(?:["+l+"]["+r+o+"]*|["+r+o+"]+)",g=new RegExp("[^"+r+o+"]+.*$"),h=/[^\d\[\]]/,m=function(){function r(t){var i=t.defaultCountry,n=t.defaultCallingCode,a=t.metadata,e=t.onNationalSignificantNumberChange;!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,r),this.defaultCountry=i,this.defaultCallingCode=n,this.metadata=a,this.onNationalSignificantNumberChange=e}var o,l,s;return o=r,(l=[{key:"input",value:function(t,i){var n,a=u(b(t),2),r=a[0],o=a[1],l=e(r);return o&&(i.digits||(i.startInternationalNumber(),l||(n=!0))),l&&this.inputDigits(l,i),{digits:l,justLeadingPlus:n}}},{key:"inputDigits",value:function(t,i){var n=i.digits,a=n.length<3&&n.length+t.length>=3;if(i.appendDigits(t),a&&this.extractIddPrefix(i),this.isWaitingForCountryCallingCode(i)){if(!this.extractCountryCallingCode(i))return}else i.appendNationalSignificantNumberDigits(t);i.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(i.getNationalDigits(),(function(t){return i.update(t)}))}},{key:"isWaitingForCountryCallingCode",value:function(t){var i=t.international,n=t.callingCode;return i&&!n}},{key:"extractCountryCallingCode",value:function(i){var n=t("+"+i.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),a=n.countryCallingCode,e=n.number;if(a)return i.setCallingCode(a),i.update({nationalSignificantNumber:e}),!0}},{key:"reset",value:function(t){if(t){this.hasSelectedNumberingPlan=!0;var i=t._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=i&&h.test(i)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(t,i){if(this.hasSelectedNumberingPlan){var a=n(t,this.metadata),e=a.nationalPrefix,r=a.nationalNumber,o=a.carrierCode;if(r!==t)return this.onExtractedNationalNumber(e,o,r,t,i),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(t,i,a){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(t,a);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var e=n(t,this.metadata),r=e.nationalPrefix,o=e.nationalNumber,l=e.carrierCode;if(o!==i)return this.onExtractedNationalNumber(r,l,o,t,a),!0}}},{key:"onExtractedNationalNumber",value:function(t,i,n,a,e){var r,o,l=a.lastIndexOf(n);if(l>=0&&l===a.length-n.length){o=!0;var u=a.slice(0,l);u!==t&&(r=u)}e({nationalPrefix:t,carrierCode:i,nationalSignificantNumber:n,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:r}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(t){return!!this.extractAnotherNationalSignificantNumber(t.getNationalDigits(),t.nationalSignificantNumber,(function(i){return t.update(i)}))||(this.extractIddPrefix(t)||this.fixMissingPlus(t)?(this.extractCallingCodeAndNationalSignificantNumber(t),!0):void 0)}},{key:"extractIddPrefix",value:function(t){var i=t.international,n=t.IDDPrefix,e=t.digits;if(t.nationalSignificantNumber,!i&&!n){var r=a(e,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==e?(t.update({IDDPrefix:e.slice(0,e.length-r.length)}),this.startInternationalNumber(t,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(t){if(!t.international){var n=i(t.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),a=n.countryCallingCode;if(n.number,a)return t.update({missingPlus:!0}),this.startInternationalNumber(t,{country:t.country,callingCode:a}),!0}}},{key:"startInternationalNumber",value:function(t,i){var n=i.country,a=i.callingCode;t.startInternationalNumber(n,a),t.nationalSignificantNumber&&(t.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(t){this.extractCountryCallingCode(t)&&this.extractNationalSignificantNumber(t.getNationalDigits(),(function(i){return t.update(i)}))}}])&&c(o.prototype,l),s&&c(o,s),Object.defineProperty(o,"prototype",{writable:!1}),r}();function N(t){var i=function(t){var i,n=t.search(d);if(!(n<0))return"+"===(t=t.slice(n))[0]&&(i=!0,t=t.slice(1)),t=t.replace(g,""),i&&(t="+"+t),t}(t)||"";return"+"===i[0]?[i.slice(1),!0]:[i]}function b(t){var i=u(N(t),2),n=i[0],a=i[1];return f.test(n)||(n=""),[n,a]}export{m as default,b as extractFormattedDigitsAndPlus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function i(
|
|
1
|
+
function i(i,t){for(var n=0;n<t.length;n++){var e=t[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(i,e.key,e)}}var t=function(){function t(i){var n=i.onCountryChange,e=i.onCallingCodeChange;!function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.onCountryChange=n,this.onCallingCodeChange=e}var n,e,a;return n=t,(e=[{key:"reset",value:function(i){var t=i.country,n=i.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(i){for(var t=0,n=Object.keys(i);t<n.length;t++){var e=n[t];this[e]=i[e]}}},{key:"initCountryAndCallingCode",value:function(i,t){this.setCountry(i),this.setCallingCode(t)}},{key:"setCountry",value:function(i){this.country=i,this.onCountryChange(i)}},{key:"setCallingCode",value:function(i){this.callingCode=i,this.onCallingCodeChange(i,this.country)}},{key:"startInternationalNumber",value:function(i,t){this.international=!0,this.initCountryAndCallingCode(i,t)}},{key:"appendDigits",value:function(i){this.digits+=i}},{key:"appendNationalSignificantNumberDigits",value:function(i){this.nationalSignificantNumber+=i}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}])&&i(n.prototype,e),a&&i(n,a),Object.defineProperty(n,"prototype",{writable:!1}),t}();export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(
|
|
1
|
+
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(e){var r=c();return function(){var o,u=f(e);if(r){var c=f(this).constructor;o=Reflect.construct(u,arguments,c)}else o=u.apply(this,arguments);return function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)}(this,o)}}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,t)},o(t)}function u(t,e,r){return u=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o},u.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}var p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(a,o(Error));var u,c,f,p=r(a);function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),e=p.call(this,t),Object.setPrototypeOf(n(e),a.prototype),e.name=e.constructor.name,e}return u=a,c&&e(u.prototype,c),f&&e(u,f),Object.defineProperty(u,"prototype",{writable:!1}),u}();export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t
|
|
1
|
+
import t from"./metadata.js";import e from"./isPossible.js";import r from"./isValid.js";import n from"./helpers/getNumberType.js";import o from"./helpers/getPossibleCountriesForNumber.js";import i from"./format.js";function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var c=function(){function a(e,r,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),!e)throw new TypeError("`country` or `countryCallingCode` not passed");if(!r)throw new TypeError("`nationalNumber` not passed");if(!n)throw new TypeError("`metadata` not passed");var o=function(e,r){var n,o,i=new t(r);f(e)?(n=e,i.selectNumberingPlan(n),o=i.countryCallingCode()):o=e;return{country:n,countryCallingCode:o}}(e,n),i=o.country,u=o.countryCallingCode;this.country=i,this.countryCallingCode=u,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}var s,c,y;return s=a,(c=[{key:"setExt",value:function(t){this.ext=t}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:o(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return e(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return r(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new t(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(t){return this.number===t.number&&this.ext===t.ext}},{key:"getType",value:function(){return n(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(t,e){return i(this,t,e?u(u({},e),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function(t){return this.format("RFC3966",t)}}])&&l(s.prototype,c),y&&l(s,y),Object.defineProperty(s,"prototype",{writable:!1}),a}(),f=function(t){return/^[A-Z]{2}$/.test(t)};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_LENGTH_FOR_NSN as
|
|
1
|
+
import{isSupportedCountry as t}from"./metadata.js";import{MAX_LENGTH_FOR_NSN as e,MAX_LENGTH_COUNTRY_CODE as n,VALID_PUNCTUATION as r}from"./constants.js";import i from"./helpers/extension/createExtensionPattern.js";import a from"./findNumbers/RegExpCache.js";import{limit as o,trimAfterFirstMatch as s}from"./findNumbers/util.js";import{pNd as l,_pN as u,_pL as c,pZ as f,PZ as h}from"./findNumbers/utf-8.js";import d from"./findNumbers/Leniency.js";import m from"./findNumbers/parsePreCandidate.js";import y from"./findNumbers/isValidPreCandidate.js";import p,{LEAD_CLASS as x}from"./findNumbers/isValidCandidate.js";import v from"./parsePhoneNumber.js";function b(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return A(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var E=i(),g=["\\/+(.*)/","(\\([^(]*)","(?:".concat(f,"-|-").concat(f,")").concat(f,"*(.+)"),"[‒-―-]".concat(f,"*(.+)"),"\\.+".concat(f,"*([^.]+)"),"".concat(f,"+(").concat(h,"+)")],T=o(0,2),w=o(0,4),N=e+n,j=o(0,N),I="[".concat(r,"]")+w,S=l+o(1,N),O="(?:"+x+I+")"+T+S+"(?:"+I+S+")"+j+"(?:"+E+")?",P=new RegExp("[^".concat(u).concat(c,"#]+$")),R=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,D=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),!(r={v2:r.v2,defaultCallingCode:r.defaultCallingCode,defaultCountry:r.defaultCountry&&t(r.defaultCountry,i)?r.defaultCountry:void 0,leniency:r.leniency||(r.extended?"POSSIBLE":"VALID"),maxTries:r.maxTries||R}).leniency)throw new TypeError("`leniency` is required");if("POSSIBLE"!==r.leniency&&"VALID"!==r.leniency)throw new TypeError('Invalid `leniency`: "'.concat(r.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(r.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");if(this.text=n,this.options=r,this.metadata=i,this.leniency=d[r.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(r.leniency,'"'));this.maxTries=r.maxTries,this.PATTERN=new RegExp(O,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new a(32)}var n,r,i;return n=e,(r=[{key:"find",value:function(){for(var t;this.maxTries>0&&null!==(t=this.PATTERN.exec(this.text));){var e=t[0],n=t.index;if(e=m(e),y(e,n,this.text)){var r=this.parseAndVerify(e,n,this.text)||this.extractInnerMatch(e,n,this.text);if(r){if(this.options.v2)return{startsAt:r.startsAt,endsAt:r.endsAt,number:r.phoneNumber};var i=r.phoneNumber,a={startsAt:r.startsAt,endsAt:r.endsAt,phone:i.nationalNumber};return i.country?a.country=i.country:a.countryCallingCode=i.countryCallingCode,i.ext&&(a.ext=i.ext),a}}this.maxTries--}}},{key:"extractInnerMatch",value:function(t,e,n){for(var r,i=b(g);!(r=i()).done;)for(var a=r.value,o=!0,l=void 0,u=new RegExp(a,"g");this.maxTries>0&&null!==(l=u.exec(t));){if(o){var c=s(P,t.slice(0,l.index)),f=this.parseAndVerify(c,e,n);if(f)return f;this.maxTries--,o=!1}var h=s(P,l[1]),d=t.indexOf(h,l.index),m=this.parseAndVerify(h,e+d,n);if(m)return m;this.maxTries--}}},{key:"parseAndVerify",value:function(t,e,n){if(p(t,e,n,this.options.leniency)){var r=v(t,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(r&&r.isPossible())return this.leniency(r,{candidate:t,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:e,endsAt:e+t.length,phoneNumber:r}:void 0}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var t=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",t}}])&&C(n.prototype,r),i&&C(n,i),Object.defineProperty(n,"prototype",{writable:!1}),e}();export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var n=t((function e(t,n){var h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;i(this,e),this.key=t,this.value=n,this.next=h,this.prev=a})),h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;i(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return t(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var i=new n(e,t,this.head);this.head.prev=i,this.head=i}else this.head=this.tail=new n(e,t);this.cache[e]=this.head,this.size++}},{key:"get",value:function(e){if(this.cache[e]){var t=this.cache[e].value;return this.remove(e),this.put(e,t),t}console.log("Item not available in cache for key ".concat(e))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(e){var t=this.cache[e];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[e],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),e}();export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"../
|
|
1
|
+
import t from"../metadata.js";import a from"../helpers/parseDigits.js";import r from"./matchPhoneNumberStringAgainstPhoneNumber.js";import n from"../helpers/getCountryByCallingCode.js";import{chooseFormatForNumber as e}from"../format.js";var i={POSSIBLE:function(t,a){return a.candidate,a.metadata,!0},VALID:function(t,a){var r=a.candidate;a.defaultCountry;var n=a.metadata;return!(!t.isValid()||!o(t,r,n))},STRICT_GROUPING:function(t,a){var r=a.candidate,n=a.defaultCountry,e=a.metadata;return a.regExpCache,!(!t.isValid()||!o(t,r,e)||l(t,r)||!u(t,{defaultCountry:n,metadata:e}))&&d()},EXACT_GROUPING:function(t,a){var r=a.candidate,n=a.defaultCountry,e=a.metadata;return a.regExpCache,!(!t.isValid()||!o(t,r,e)||l(t,r)||!u(t,{defaultCountry:n,metadata:e}))&&d()}};function o(t,n,e){for(var i=0;i<n.length-1;i++){var o=n.charAt(i);if("x"===o||"X"===o){var u=n.charAt(i+1);if("x"===u||"X"===u){if(i++,"NSN_MATCH"!==r(n.substring(i),t,e))return!1}else{var l=a(n.substring(i));if(l){if(t.ext!==l)return!1}else if(t.ext)return!1}}}return!0}function u(a,r){var i=r.defaultCountry,o=r.metadata;if("FROM_DEFAULT_COUNTRY"!==a.__countryCallingCodeSource)return!0;var u=new t(o);u.selectNumberingPlan(a.countryCallingCode),a.country||n(a.countryCallingCode,{nationalNumber:a.nationalNumber,defaultCountry:i,metadata:u});var l=a.nationalNumber,d=e(u.numberingPlan.formats(),l);return!d.nationalPrefixFormattingRule()||(!!u.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!d.usesNationalPrefix()||Boolean(a.nationalPrefix)))}function l(t,r){var n=r.indexOf("/");if(n<0)return!1;var e=r.indexOf("/",n+1);return!(e<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===t.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===t.__countryCallingCodeSource)||a(r.substring(0,n))!==t.countryCallingCode||r.slice(e+1).indexOf("/")>=0)}function d(t,a,r,n,e){throw new Error("This part of code hasn't been ported")}export{l as containsMoreThanOneSlashInNationalNumber,i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./LRUCache.js";function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function r(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),this.cache=new e(t)}var n,a,o;return n=r,(a=[{key:"getPatternForRegExp",value:function(e){var t=this.cache.get(e);return t||(t=new RegExp("^"+e),this.cache.put(e,t)),t}}])&&t(n.prototype,a),o&&t(n,o),Object.defineProperty(n,"prototype",{writable:!1}),r}();export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"./helpers/matchesEntirely.js";import r from"./helpers/formatNationalNumberUsingFormat.js";import e,{getCountryCallingCode as n}from"./metadata.js";import o from"./helpers/getIddPrefix.js";import{formatRFC3966 as a}from"./helpers/RFC3966.js";function i(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(!t)return;if("string"==typeof t)return c(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return c(t,r)}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function f(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?u(Object(e),!0).forEach((function(r){l(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function l(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var s={formatExtension:function(t,r,e){return"".concat(t).concat(e.ext()).concat(r)}};function m(t,r,i,c){if(i=i?f(f({},s),i):s,c=new e(c),t.country&&"001"!==t.country){if(!c.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));c.country(t.country)}else{if(!t.countryCallingCode)return t.phone||"";c.selectNumberingPlan(t.countryCallingCode)}var u,l=c.countryCallingCode(),m=i.v2?t.nationalNumber:t.phone;switch(r){case"NATIONAL":return m?b(u=p(m,t.carrierCode,"NATIONAL",c,i),t.ext,c,i.formatExtension):"";case"INTERNATIONAL":return m?(u=p(m,null,"INTERNATIONAL",c,i),b(u="+".concat(l," ").concat(u),t.ext,c,i.formatExtension)):"+".concat(l);case"E.164":return"+".concat(l).concat(m);case"RFC3966":return a({number:"+".concat(l).concat(m),ext:t.ext});case"IDD":if(!i.fromCountry)return;var y=function(t,r,e,a,i){var c=n(a,i.metadata);if(c===e){var u=p(t,r,"NATIONAL",i);return"1"===e?e+" "+u:u}var f=o(a,void 0,i.metadata);if(f)return"".concat(f," ").concat(e," ").concat(p(t,null,"INTERNATIONAL",i))}(m,t.carrierCode,l,i.fromCountry,c);return b(y,t.ext,c,i.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(r,'"'))}}function p(t,e,n,o,a){var i=y(o.formats(),t);return i?r(t,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!a||!1!==a.nationalPrefix,carrierCode:e,metadata:o}):t}function y(r,e){for(var n,o=i(r);!(n=o()).done;){var a=n.value;if(a.leadingDigitsPatterns().length>0){var c=a.leadingDigitsPatterns()[a.leadingDigitsPatterns().length-1];if(0!==e.search(c))continue}if(t(e,a.pattern()))return a}}function b(t,r,e,n){return r?n(t,r,e):t}export{y as chooseFormatForNumber,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"./mergeArrays.js";function r(e,r){return t(e,void 0,r)}function t(r,I,L){var n=L.type(I),O=n&&n.possibleLengths()||L.possibleLengths();if(!O)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===I){if(!L.type("FIXED_LINE"))return t(r,"MOBILE",L);var s=L.type("MOBILE");s&&(O=e(O,s.possibleLengths()))}else if(I&&!n)return"INVALID_LENGTH";var i=r.length,E=O[0];return E===i?"IS_POSSIBLE":E>i?"TOO_SHORT":O[O.length-1]<i?"TOO_LONG":O.indexOf(i,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}export{t as checkNumberLengthForType,r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./stripIddPrefix.js";import n from"./extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";import e from"../metadata.js";import{MAX_LENGTH_COUNTRY_CODE as t}from"../constants.js";function o(o,i,u,a
|
|
1
|
+
import r from"./stripIddPrefix.js";import n from"./extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";import e from"../metadata.js";import{MAX_LENGTH_COUNTRY_CODE as t}from"../constants.js";function o(o,i,u,a){if(!o)return{};var l;if("+"!==o[0]){var m=r(o,i,u,a);if(!m||m===o){if(i||u){var f=n(o,i,u,a),C=f.countryCallingCode,c=f.number;if(C)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:C,number:c}}return{number:o}}l=!0,o="+"+m}if("0"===o[1])return{};a=new e(a);for(var s=2;s-1<=t&&s<=o.length;){var d=o.slice(1,s);if(a.hasCallingCode(d))return a.selectNumberingPlan(d),{countryCallingCodeSource:l?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:d,number:o.slice(s)};s++}return{}}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r,{getCountryCallingCode as e}from"../metadata.js";import t from"./matchesEntirely.js";import n from"./extractNationalNumber.js";import a from"./checkNumberLength.js";function m(m,i,o,u
|
|
1
|
+
import r,{getCountryCallingCode as e}from"../metadata.js";import t from"./matchesEntirely.js";import n from"./extractNationalNumber.js";import a from"./checkNumberLength.js";function m(m,i,o,u){var l=i?e(i,u):o;if(0===m.indexOf(l)){(u=new r(u)).selectNumberingPlan(i,o);var b=m.slice(l.length),f=n(b,u).nationalNumber,N=n(m,u).nationalNumber;if(!t(N,u.nationalNumberPattern())&&t(f,u.nationalNumberPattern())||"TOO_LONG"===a(N,u))return{countryCallingCode:l,number:b}}return{number:m}}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./extractNationalNumberFromPossiblyIncompleteNumber.js";import e from"./matchesEntirely.js";import
|
|
1
|
+
import r from"./extractNationalNumberFromPossiblyIncompleteNumber.js";import e from"./matchesEntirely.js";import t from"./checkNumberLength.js";function n(n,a){var i=r(n,a),o=i.carrierCode,u=i.nationalNumber;if(u!==n){if(!function(r,t,n){if(e(r,n.nationalNumberPattern())&&!e(t,n.nationalNumberPattern()))return!1;return!0}(n,u,a))return{nationalNumber:n};if(a.possibleLengths()&&!function(r,e){switch(t(r,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(u,a))return{nationalNumber:n}}return{nationalNumber:u,carrierCode:o}}export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./getCountryByNationalNumber.js";function a(a,e){var o=e.nationalNumber,r=e.
|
|
1
|
+
import t from"./getCountryByNationalNumber.js";function a(a,e){var o=e.nationalNumber,r=e.defaultCountry,n=e.metadata,u=n.getCountryCodesForCallingCode(a);if(u)return 1===u.length?u[0]:t(o,{countries:u,defaultCountry:r,metadata:n.metadata})}export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"../metadata.js";import t from"./getNumberType.js";function e(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=function(r,t){if(r)
|
|
1
|
+
import r from"../metadata.js";import t from"./getNumberType.js";function e(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=function(r,t){if(!r)return;if("string"==typeof r)return n(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(r,t)}(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var a=0;return function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function a(n,a){var o=a.countries,i=a.defaultCountry,u=a.metadata;u=new r(u);for(var f,l=[],c=e(o);!(f=c()).done;){var m=f.value;if(u.country(m),u.leadingDigits()){if(n&&0===n.search(u.leadingDigits()))return m}else if(t({phone:n,country:m},void 0,u.metadata)){if(!i)return m;if(m===i)return m;l.push(m)}}if(l.length>0)return l[0]}export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"../metadata.js";import r from"./matchesEntirely.js";function e(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t)
|
|
1
|
+
import t from"../metadata.js";import r from"./matchesEntirely.js";function e(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(!t)return;if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(t,r)}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}var o=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function a(n,a,u){if(a=a||{},n.country||n.countryCallingCode){(u=new t(u)).selectNumberingPlan(n.country,n.countryCallingCode);var l=a.v2?n.nationalNumber:n.phone;if(r(l,u.nationalNumberPattern())){if(i(l,"FIXED_LINE",u))return u.type("MOBILE")&&""===u.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":u.type("MOBILE")?i(l,"MOBILE",u)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var E,f=e(o);!(E=f()).done;){var I=E.value;if(i(l,I,u))return I}}}}function i(t,e,n){return!(!(e=n.type(e))||!e.pattern())&&(!(e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0)&&r(t,e.pattern()))}export{a as default,i as isNumberTypeEqualTo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"../metadata.js";function e(e,r,t){var i=new n(t).getCountryCodesForCallingCode(e);return i?i.filter(function(e){return function(e,r,t){var i=new n(t);if(i.selectNumberingPlan(r),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(r,e,t)}):[]}export{e as default};
|
|
1
|
+
import n from"../metadata.js";function e(e,r,t){var i=new n(t).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,r,t){var i=new n(t);if(i.selectNumberingPlan(r),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(r,e,t)})):[]}export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MIN_LENGTH_FOR_NSN as t,
|
|
1
|
+
import{MIN_LENGTH_FOR_NSN as t,PLUS_CHARS as e,VALID_PUNCTUATION as n,VALID_DIGITS as r}from"../constants.js";import o from"./extension/createExtensionPattern.js";var s="["+r+"]{"+t+"}",i="["+e+"]{0,1}(?:["+n+"]*["+r+"]){3,}["+n+r+"]*",a=new RegExp("^["+e+"]{0,1}(?:["+n+"]*["+r+"]){1,2}$","i"),f=i+"(?:"+o()+")?",p=new RegExp("^"+s+"$|^"+f+"$","i");function u(e){return e.length>=t&&p.test(e)}function x(t){return a.test(t)}export{i as VALID_PHONE_NUMBER,f as VALID_PHONE_NUMBER_WITH_EXTENSION,u as default,x as isViablePhoneNumberStart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(r,e){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,e){if(r)
|
|
1
|
+
function r(r,e){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,e){if(!r)return;if("string"==typeof r)return t(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(r,e)}(r))||e&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function e(t,e){for(var n,o=t.slice(),a=r(e);!(n=a()).done;){var i=n.value;t.indexOf(i)<0&&o.push(i)}return o.sort((function(r,t){return r-t}))}export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(r,e){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,e){if(r)
|
|
1
|
+
function r(r,e){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,e){if(!r)return;if("string"==typeof r)return t(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(r,e)}(r))||e&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var e={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function n(r){return e[r]}function o(t){for(var e,o="",a=r(t.split(""));!(e=a()).done;){var i=n(e.value);i&&(o+=i)}return o}export{e as DIGITS,o as default,n as parseDigit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./metadata.js";import n from"./helpers/checkNumberLength.js";function r(n,r,t){if(void 0===r&&(r={}),t=new e(t),r.v2){if(!n.countryCallingCode)throw new Error("Invalid phone number object passed");t.selectNumberingPlan(n.countryCallingCode)}else{if(!n.phone)return!1;if(n.country){if(!t.hasCountry(n.country))throw new Error("Unknown country: ".concat(n.country));t.
|
|
1
|
+
import e from"./metadata.js";import n from"./helpers/checkNumberLength.js";function r(n,r,t){if(void 0===r&&(r={}),t=new e(t),r.v2){if(!n.countryCallingCode)throw new Error("Invalid phone number object passed");t.selectNumberingPlan(n.countryCallingCode)}else{if(!n.phone)return!1;if(n.country){if(!t.hasCountry(n.country))throw new Error("Unknown country: ".concat(n.country));t.country(n.country)}else{if(!n.countryCallingCode)throw new Error("Invalid phone number object passed");t.selectNumberingPlan(n.countryCallingCode)}}if(t.possibleLengths())return o(n.phone||n.nationalNumber,t);if(n.countryCallingCode&&t.isNonGeographicCallingCode(n.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function o(e,r){return"IS_POSSIBLE"===n(e,r)}export{r as default,o as isPossibleNumber};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./normalizeArguments.js";import r from"./parsePhoneNumber_.js";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function n(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(r){o(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(){var t=e(arguments),o=t.text,c=t.options,i=t.metadata;c=n(n({},c),{},{extract:!1});var a=r(o,c,i);return a&&a.isValid()||!1}export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WHITESPACE as t,VALID_PUNCTUATION as e}from"../constants.js";import i from"../parse.js";import{VALID_PHONE_NUMBER_WITH_EXTENSION as a}from"../helpers/isViablePhoneNumber.js";import r from"../findNumbers/parsePreCandidate.js";import n from"../findNumbers/isValidPreCandidate.js";import s from"../findNumbers/isValidCandidate.js";function o(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var h=new RegExp("^["+t+"]+"),f=new RegExp("["+e+"]+$"),l=function(){function t(e,i,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.options=i||{},this.metadata=r,this.state="NOT_READY",this.regexp=new RegExp(a,"ig")}var e,l,p;return e=t,(l=[{key:"find",value:function(){var t=this.regexp.exec(this.text);if(t){var e=t[0],i=t.index;e=e.replace(h,""),i+=t[0].length-e.length,e=e.replace(f,""),e=r(e);var a=this.parseCandidate(e,i);return a||this.find()}}},{key:"parseCandidate",value:function(t,e){if(n(t,e,this.text)&&s(t,e,this.text,this.options.extended?"POSSIBLE":"VALID")){var a=i(t,this.options,this.metadata);if(a.phone)return a.startsAt=e,a.endsAt=e+t.length,a}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.last_match=this.find(),this.last_match?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var t=this.last_match;return this.last_match=null,this.state="NOT_READY",t}}])&&o(e.prototype,l),p&&o(e,p),Object.defineProperty(e,"prototype",{writable:!1}),t}();export{l as PhoneNumberSearch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./tools/semver-compare.js";import n from"./helpers/isObject.js";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function
|
|
1
|
+
import t from"./tools/semver-compare.js";import n from"./helpers/isObject.js";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function a(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function i(t,n){for(var e=0;e<n.length;e++){var a=n[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function r(t,n,e){return n&&i(t.prototype,n),e&&i(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=" ext. ",u=/^\d+$/,s=function(){function t(n){a(this,t),y(n),this.metadata=n,P.call(this,n)}return r(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(t){return"001"!==t}))}},{key:"getCountryMetadata",value:function(t){return this.metadata.countries[t]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(t){return void 0!==this.getCountryMetadata(t)}},{key:"hasCallingCode",value:function(t){if(this.getCountryCodesForCallingCode(t))return!0;if(this.nonGeographic()){if(this.nonGeographic()[t])return!0}else{var n=this.countryCallingCodes()[t];if(n&&1===n.length&&"001"===n[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(t){return this.nonGeographic()?!!this.nonGeographic()[t]:!this.getCountryCodesForCallingCode(t)}},{key:"country",value:function(t){return this.selectNumberingPlan(t)}},{key:"selectNumberingPlan",value:function(t,n){if(t&&u.test(t)&&(n=t,t=null),t&&"001"!==t){if(!this.hasCountry(t))throw new Error("Unknown country: ".concat(t));this.numberingPlan=new l(this.getCountryMetadata(t),this)}else if(n){if(!this.hasCallingCode(n))throw new Error("Unknown calling code: ".concat(n));this.numberingPlan=new l(this.getNumberingPlanMetadata(n),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(t){var n=this.countryCallingCodes()[t];if(n){if(1===n.length&&3===n[0].length)return;return n}}},{key:"getCountryCodeForCallingCode",value:function(t){var n=this.getCountryCodesForCallingCode(t);if(n)return n[0]}},{key:"getNumberingPlanMetadata",value:function(t){var n=this.getCountryCodeForCallingCode(t);if(n)return this.getCountryMetadata(n);if(this.nonGeographic()){var e=this.nonGeographic()[t];if(e)return e}else{var a=this.countryCallingCodes()[t];if(a&&1===a.length&&"001"===a[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(t){return this.numberingPlan.type(t)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(t){return this.selectNumberingPlan(t)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),t}(),l=function(){function t(n,e){a(this,t),this.globalMetadataObject=e,this.metadata=n,P.call(this,e.metadata)}return r(t,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(t){return t[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var t=this,n=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return n.map((function(n){return new h(n,t)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(t){return t[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(t){if(this.hasTypes()&&g(this.types(),t))return new c(g(this.types(),t),this)}},{key:"ext",value:function(){return this.v1||this.v2?o:this.metadata[13]||o}}]),t}(),h=function(){function t(n,e){a(this,t),this._format=n,this.metadata=e}return r(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||f.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),f=/^\(?\$1\)?$/,c=function(){function t(n,e){a(this,t),this.type=n,this.metadata=e}return r(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),t}();function g(t,n){switch(n){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function y(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!n(t)||!n(t.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(n(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+m(t)+": "+t,"."))}var m=function(t){return e(t)};function v(t,n){if((n=new s(n)).hasCountry(t))return n.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function d(t,n){return n.countries.hasOwnProperty(t)}function P(n){var e=n.version;"number"==typeof e?(this.v1=1===e,this.v2=2===e,this.v3=3===e,this.v4=4===e):e?-1===t(e,"1.2.0")?this.v2=!0:-1===t(e,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}export{s as default,v as getCountryCallingCode,d as isSupportedCountry,y as validateMetadata};
|