@ikas/popup-renderer 1.0.227 → 1.0.228
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/PhoneNumberSearch.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/libphonenumber-js/min/exports/PhoneNumber.js +1 -0
- 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/index.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/close-settings/index.d.ts +7 -0
- package/build/popup-renderer/models/modal/close-settings/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/findPhoneNumbersInitialImplementation.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,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
|
|
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){return l="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},l(t)}function f(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){var n,r,i,o,u=[],s=!0,l=!1;try{if(i=(a=a.call(t)).next,0===e){if(Object(a)!==a)return;s=!1}else for(;!(s=(n=i.call(a)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){l=!0,r=t}finally{try{if(!s&&null!=a.return&&(o=a.return(),Object(o)!==o))return}finally{if(l)throw r}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?m(t,e):void 0}}(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 m(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,n=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,d(n.key),n)}}function d(t){var e=function(t,e){if("object"!=l(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var n=a.call(t,e||"default");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==l(e)?e:e+""}var c=function(){return l=function e(a,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new t(n);var r=f(this.getCountryAndCallingCode(a),2),i=r[0],o=r[1];this.defaultCountry=i,this.defaultCallingCode=o,this.reset()},(m=[{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.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,n=t.nationalPrefix,r=e,i=a||n;return i&&(r=i+r),r}},{key:"getNonFormattedNumber",value:function(){var t=this.state.nationalSignificantNumberIsModified;return this.getFullNumber(t?this.state.getNationalDigits():this.getNonFormattedNationalNumberWithPrefix())}},{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,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 m=o(n,{countries:f,metadata:this.metadata.metadata});m&&(u=m)}}var h=new e(u||i,n,this.metadata.metadata);return r&&(h.carrierCode=r),h}}},{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(l.prototype,m),d&&h(l,d),Object.defineProperty(l,"prototype",{writable:!1}),l;var l,m,d}();export{c 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 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){if("string"==typeof r)return e(r,t);var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);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 e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function n(r){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},n(r)}function a(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,o(n.key),n)}}function o(r){var t=function(r,t){if("object"!=n(r)||!r)return r;var e=r[Symbol.toPrimitive];if(void 0!==e){var a=e.call(r,t||"default");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==n(t)?t:t+""}var i=function(){return t=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)},e=[{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=l(r.split(""),this.matchTree,!0);if(e&&e.match&&delete e.matchedChars,!e||!e.overflow||t)return e}}],e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function l(r,e,n){if("string"==typeof e){var a=r.join("");return 0===e.indexOf(a)?r.length===e.length?{match:!0,matchedChars:r}:{partialMatch:!0}:0===a.indexOf(e)?n&&r.length>e.length?{overflow:!0}:{match:!0,matchedChars:r.slice(0,e.length)}:void 0}if(Array.isArray(e)){for(var o=r.slice(),i=0;i<e.length;){var c=l(o,e[i],n&&i===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===(o=o.slice(c.matchedChars.length)).length)return i===e.length-1?{match:!0,matchedChars:r}:{partialMatch:!0};i++}return n?{overflow:!0}:{match:!0,matchedChars:r.slice(0,r.length-o.length)}}switch(e.op){case"|":for(var u,f,h=t(e.args);!(f=h()).done;){var s=l(r,f.value,n);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)));u=!0}}return u?{partialMatch:!0}:void 0;case"[]":for(var m,v=t(e.args);!(m=v()).done;){var p=m.value;if(r[0]===p)return 1===r.length?{match:!0,matchedChars:r}:n?{overflow:!0}:{match:!0,matchedChars:[p]}}return;default:throw new Error("Unsupported instruction tree: ".concat(e))}}export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){for(var
|
|
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 n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,r(o.key),o)}}function r(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var n=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(r=[{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([a(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(s);if(e){var r=e[1],n=t.slice(0,e.index),c=t.slice(e.index+r.length);switch(r){case"(?:":n&&this.parsePattern(n),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(n&&this.parsePattern(n),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var u=this.getContext().branches;u.push(a(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:u});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(n&&this.parsePattern(n),!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(a(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":n&&this.parsePattern(n),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:o(n)});break;default:throw new Error("Unknown operator: ".concat(r))}c&&this.parsePattern(c)}else{if(i.test(t))throw new Error("Illegal characters found in a pattern: ".concat(t));this.getContext().instructions=this.getContext().instructions.concat(t.split(""))}}}])&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}();function o(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,i=n;i<=o;)e.push(String.fromCharCode(i)),i++}else e.push(t[r]);r++}return e}var i=/[\(\)\[\]\?\:\|]/,s=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function a(t){return 1===t.length?t[0]:t}export{n 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 r from"./helpers/formatNationalNumberUsingFormat.js";function e(a,t,r){var e=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,o=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(a.nationalSignificantNumber))return function(a,t,r){var e=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,o=r.getSeparatorAfterNationalPrefix;if(a.nationalSignificantNumber,a.international,a.nationalPrefix,a.carrierCode,i(t)){var f=n(a,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:e});if(f)return f}return n(a,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:e})}(a,t,{metadata:e,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:o})}function i(t,r,e){return"IS_POSSIBLE"===a(t,r,e)}function n(a,e,i){var n=i.metadata,o=i.useNationalPrefixFormattingRule,f=i.getSeparatorAfterNationalPrefix,l=r(a.nationalSignificantNumber,e,{carrierCode:a.carrierCode,useInternationalFormat:a.international,withNationalPrefix:o,metadata:n});if(o||(a.nationalPrefix?l=a.nationalPrefix+f(e)+l:a.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix&&(l=a.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix+" "+l)),function(a,r){return t(a)===r.getNationalDigits()}(l,a))return l}export{i as canFormatCompleteNumber,e 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 m}from"./helpers/formatNationalNumberUsingFormat.js";import{VALID_PUNCTUATION as s}from"./constants.js";import u from"./helpers/applyInternationalSeparatorStyle.js";function f(t){return f="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},f(t)}function h(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){if("string"==typeof t)return p(t,e);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?p(t,e):void 0}}(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 p(t,e){(null==e||e>t.length)&&(e=t.length);for(var a=0,r=Array(e);a<e;a++)r[a]=t[a];return r}function c(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,g(r.key),r)}}function g(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var r=a.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}var N=a("9",15),v=/[- ]/,y=new RegExp("["+s+"]*\\$1["+s+"]*(\\$\\d["+s+"]*)*$"),d=function(){return s=function t(e){e.state;var a=e.metadata;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.metadata=a,this.resetFormat()},(f=[{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,a.country,this.metadata))for(var o,l=h(this.matchingFormats);!(o=l()).done;){var m=o.value,s=i(a,m,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(t){return r.shouldTryNationalPrefixFormattingRule(t,{international:a.international,nationalPrefix:a.nationalPrefix})},getSeparatorAfterNationalPrefix:function(t){return r.getSeparatorAfterNationalPrefix(t)}});if(s)return this.resetFormat(),this.chosenFormat=m,this.setNationalNumberTemplate(s.replace(/\d/g,t),a),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(t),s}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?0:y.test(a.getFormatFormat(r,t.international))?a.createTemplateForFormat(r,t)?(a.chosenFormat=r,0):(a.matchingFormats=a.matchingFormats.filter(function(t){return t!==r}),1):1},i=h(this.matchingFormats.slice());!(e=i()).done&&0!==r(););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()&&v.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,s=r.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,f=e.pattern();f=f.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var h=N.match(f)[0];if(!(i.length>h.length)){var p=new RegExp("^"+f+"$"),c=i.replace(/\d/g,"9");p.test(c)&&(h=c);var g,v=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:o})){var y=v.replace(m,e.nationalPrefixFormattingRule());if(l(e.nationalPrefixFormattingRule())===(o||"")+l("$1")&&(v=y,g=!0,o))for(var d=o.length;d>0;)v=v.replace(/\d/,t),d--}var F=h.replace(new RegExp(f),v).replace(new RegExp("9","g"),t);return g||(s?F=a(t,s.length)+" "+F:o&&(F=a(t,o.length)+this.getSeparatorAfterNationalPrefix(e)+F)),n&&(F=u(F)),F}}},{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}}}])&&c(s.prototype,f),p&&c(s,p),Object.defineProperty(s,"prototype",{writable:!1}),s;var s,f,p}();export{d 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(
|
|
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){if("string"==typeof r)return e(r,t);var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(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=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 e from"./helpers/stripIddPrefix.js";import a from"./helpers/parseDigits.js";import{VALID_PUNCTUATION as r,VALID_DIGITS as o,PLUS_CHARS as l}from"./constants.js";function u(t){return u="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},u(t)}function c(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){var e,a,r,o,l=[],u=!0,c=!1;try{if(r=(n=n.call(t)).next,0===i){if(Object(n)!==n)return;u=!1}else for(;!(u=(e=r.call(n)).done)&&(l.push(e.value),l.length!==i);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return s(t,i);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,i):void 0}}(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,e=Array(i);n<i;n++)e[n]=t[n];return e}function f(t,i){for(var n=0;n<i.length;n++){var e=i[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,d(e.key),e)}}function d(t){var i=function(t,i){if("object"!=u(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,i||"default");if("object"!=u(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==u(i)?i:i+""}var g=new RegExp("^"+("["+r+o+"]+")+"$","i"),m="(?:["+l+"]["+r+o+"]*|["+r+o+"]+)",h=new RegExp("[^"+r+o+"]+.*$"),b=/[^\d\[\]]/,N=function(){return r=function t(i){var n=i.defaultCountry,e=i.defaultCallingCode,a=i.metadata,r=i.onNationalSignificantNumberChange;!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,t),this.defaultCountry=n,this.defaultCallingCode=e,this.metadata=a,this.onNationalSignificantNumberChange=r},(o=[{key:"input",value:function(t,i){var n,e=c(v(t),2),r=e[0],o=e[1],l=a(r);return o&&(i.digits||(i.startInternationalNumber(void 0,void 0),l||(n=!0))),l&&this.inputDigits(l,i),{digits:l,justLeadingPlus:n}}},{key:"inputDigits",value:function(t,i){var n=i.digits,e=n.length<3&&n.length+t.length>=3;if(i.appendDigits(t),e&&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(),i.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),e=n.countryCallingCode,a=n.number;if(e)return i.setCallingCode(e),i.update({nationalSignificantNumber:a}),!0}},{key:"reset",value:function(t){if(t){this.hasSelectedNumberingPlan=!0;var i=t._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=i&&b.test(i)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(t,i){if(this.hasSelectedNumberingPlan){var e=n(t,this.metadata),a=e.nationalPrefix,r=e.nationalNumber,o=e.carrierCode;if(r!==t)return this.onExtractedNationalNumber(a,o,r,t,i),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(t,i,e){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(t,e);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var a=n(t,this.metadata),r=a.nationalPrefix,o=a.nationalNumber,l=a.carrierCode;if(o!==i)return this.onExtractedNationalNumber(r,l,o,t,e),!0}}},{key:"onExtractedNationalNumber",value:function(t,i,n,e,a){var r,o=!1,l=e.lastIndexOf(n);if(l<0||l!==e.length-n.length)o=!0;else{var u=e.slice(0,l);u&&u!==t&&(r=u)}a({nationalPrefix:t,carrierCode:i,nationalSignificantNumber:n,nationalSignificantNumberIsModified:o,prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix: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,a=t.digits;if(t.nationalSignificantNumber,!i&&!n){var r=e(a,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==a?(t.update({IDDPrefix:a.slice(0,a.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,t.country,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata).countryCallingCode;if(n)return t.update({missingPlus:!0}),this.startInternationalNumber(t,{country:t.country,callingCode:n}),!0}}},{key:"startInternationalNumber",value:function(t,i){var n=i.country,e=i.callingCode;t.startInternationalNumber(n,e),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)})}}])&&f(r.prototype,o),l&&f(r,l),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,l}();function y(t){var i=function(t){var i,n=t.search(m);if(!(n<0))return"+"===(t=t.slice(n))[0]&&(i=!0,t=t.slice(1)),t=t.replace(h,""),i&&(t="+"+t),t}(t)||"";return"+"===i[0]?[i.slice(1),!0]:[i]}function v(t){var i=c(y(t),2),n=i[0],e=i[1];return g.test(n)||(n=""),[n,e]}export{N as default,v as extractFormattedDigitsAndPlus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function i(i,t){for(var
|
|
1
|
+
function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},i(t)}function t(i,t){for(var e=0;e<t.length;e++){var o=t[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(i,n(o.key),o)}}function n(t){var n=function(t,n){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var o=e.call(t,n||"default");if("object"!=i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==i(n)?n:n+""}var e=function(){return i=function i(t){var n=t.onCountryChange,e=t.onCallingCodeChange;!function(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),this.onCountryChange=n,this.onCallingCodeChange=e},(n=[{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.nationalSignificantNumberIsModified=!1,this.nationalPrefix=void 0,this.carrierCode=void 0,this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix=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}}])&&t(i.prototype,n),e&&t(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,e}();export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(
|
|
1
|
+
function t(r){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(r)}function r(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,e(o.key),o)}}function e(r){var e=function(r,e){if("object"!=t(r)||!r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var o=n.call(r,e||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==t(e)?e:e+""}function n(r,e,n){return e=c(e),function(r,e){if(e&&("object"==t(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r)}(r,u()?Reflect.construct(e,n||[],c(r).constructor):e.apply(r,n))}function o(t){var r="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(r){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return function(t,r,e){if(u())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,r);var o=new(t.bind.apply(t,n));return e&&i(o,e.prototype),o}(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),i(e,t)},o(t)}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(u=function(){return!!t})()}function i(t,r){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},i(t,r)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}var f=function(){function t(r){var e;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),e=n(this,t,[r]),Object.setPrototypeOf(e,t.prototype),e.name=e.constructor.name,e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&i(t,r)}(t,o(Error)),e=t,u&&r(e.prototype,u),c&&r(e,c),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,u,c}();export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./metadata.js";import
|
|
1
|
+
import t,{validateMetadata as e}from"./metadata.js";import r from"./isPossible.js";import n from"./isValid.js";import o from"./helpers/getNumberType.js";import i from"./helpers/getPossibleCountriesForNumber.js";import a from"./helpers/extractCountryCallingCode.js";import u from"./helpers/isObject.js";import s from"./format.js";function l(t){return l="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},l(t)}function f(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 c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){m(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function m(t,e,r){return(e=b(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(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,b(n.key),n)}}function b(t){var e=function(t,e){if("object"!=l(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==l(e)?e:e+""}var p=function(){return l=function r(n,o,i){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),!n)throw new TypeError("First argument is required");if("string"!=typeof n)throw new TypeError("First argument must be a string");if("+"===n[0]&&!o)throw new TypeError("`metadata` argument not passed");if(u(o)&&u(o.countries)){i=o;var s=n;if(!h.test(s))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var l=a(s,void 0,void 0,void 0,i);if(n=l.countryCallingCode,!(o=l.number))throw new Error("Invalid `number` argument passed: too short")}if(!o)throw new TypeError("`nationalNumber` argument is required");if("string"!=typeof o)throw new TypeError("`nationalNumber` argument must be a string");e(i);var f=function(e,r){var n,o,i=new t(r);return g(e)?(n=e,i.selectNumberingPlan(n),o=i.countryCallingCode()):o=e,{country:n,countryCallingCode:o}}(n,i),c=f.country,m=f.countryCallingCode;this.country=c,this.countryCallingCode=m,this.nationalNumber=o,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return i}},(f=[{key:"setExt",value:function(t){this.ext=t}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:i(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return r(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return n(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 o(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(t,e){return s(this,t,e?c(c({},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)}}])&&y(l.prototype,f),m&&y(l,m),Object.defineProperty(l,"prototype",{writable:!1}),l;var l,f,m}(),g=function(t){return/^[A-Z]{2}$/.test(t)};var h=/^\+\d+$/;export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{MAX_LENGTH_FOR_NSN as t,MAX_LENGTH_COUNTRY_CODE as e,VALID_PUNCTUATION as n}from"./constants.js";import r from"./helpers/extension/createExtensionPattern.js";import i from"./findNumbers/RegExpCache.js";import{limit as a,trimAfterFirstMatch as o}from"./findNumbers/util.js";import{pNd as s,_pN as u,_pL as l,pZ as c,PZ as f}from"./findNumbers/utf-8.js";import h from"./findNumbers/Leniency.js";import d from"./findNumbers/parsePreCandidate.js";import m from"./findNumbers/isValidPreCandidate.js";import y,{LEAD_CLASS as p}from"./findNumbers/isValidCandidate.js";import{isSupportedCountry as v}from"./metadata.js";import x from"./parsePhoneNumber.js";function b(t){return b="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},b(t)}function A(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){if("string"==typeof t)return E(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(t,e):void 0}}(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 E(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function g(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,C(r.key),r)}}function C(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}var N=r(),T=["/+(.*)","(\\([^(]*)","(?:".concat(c,"-|-").concat(c,")").concat(c,"*(.+)"),"[‒-―-]".concat(c,"*(.+)"),"\\.+".concat(c,"*([^.]+)"),"".concat(c,"+(").concat(f,"+)")],w=a(0,2),S=a(0,4),I=t+e,j=a(0,I),P="[".concat(n,"]")+S,R=s+a(1,I),M="(?:"+p+P+")"+w+R+"(?:"+P+R+")"+j+"(?:"+N+")?",O=new RegExp("[^".concat(u).concat(l,"#]+$")),D=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=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,t),n={v2:n.v2,defaultCallingCode:n.defaultCallingCode,defaultCountry:n.defaultCountry&&v(n.defaultCountry,r)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||D},!h[n.leniency])throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));if("POSSIBLE"!==n.leniency&&"VALID"!==n.leniency)throw new TypeError('Invalid `leniency`: "'.concat(n.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(n.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");this.text=e,this.options=n,this.metadata=r,this.leniency=h[n.leniency],this.maxTries=n.maxTries,this.PATTERN=new RegExp(M,"ig"),this.INNER_MATCHES=T.map(function(t){return new RegExp(t,"g")}),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new i(32)},(e=[{key:"find",value:function(t){var e;for(this.PATTERN.lastIndex=t;this.maxTries>0&&null!==(e=this.PATTERN.exec(this.text));){var n=e[0],r=e.index;if(n=d(n),m(n,r,this.text)){var i=this.parseAndVerify(n,r,this.text)||this.extractInnerMatch(n,r,this.text);if(i){if(this.options.v2)return{startsAt:i.startsAt,endsAt:i.endsAt,number:i.phoneNumber};var a=i.phoneNumber,o={startsAt:i.startsAt,endsAt:i.endsAt,phone:a.nationalNumber};return a.country?o.country=a.country:o.countryCallingCode=a.countryCallingCode,a.ext&&(o.ext=a.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(t,e,n){for(var r,i=A(this.INNER_MATCHES);!(r=i()).done;){var a=r.value;a.lastIndex=0;for(var s=!0,u=void 0;this.maxTries>0&&null!==(u=a.exec(t));){if(s){var l=o(O,t.slice(0,u.index)),c=this.parseAndVerify(l,e,n);if(c)return c;this.maxTries--,s=!1}var f=o(O,u[1]),h=t.indexOf(f,u.index),d=this.parseAndVerify(f,e+h,n);if(d)return d;this.maxTries--}}}},{key:"parseAndVerify",value:function(t,e,n){if(y(t,e,n,this.options.leniency)){var r=x(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.searchIndex),this.lastMatch?(this.searchIndex=this.lastMatch.endsAt,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}}])&&g(t.prototype,e),n&&g(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(
|
|
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 i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,n(r.key),r)}}function i(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(e){var i=function(e,i){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,i||"default");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(e,"string");return"symbol"==t(i)?i:i+""}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=i(function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r(this,t),this.key=e,this.value=i,this.next=n,this.prev=o}),a=function(){return i(function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;r(this,t),this.size=0,this.limit=e,this.head=null,this.tail=null,this.cache={}},[{key:"put",value:function(t,e){if(this.ensureLimit(),this.head){var i=new o(t,e,this.head);this.head.prev=i,this.head=i}else this.head=this.tail=new o(t,e);this.cache[t]=this.head,this.size++}},{key:"get",value:function(t){if(this.cache[t]){var e=this.cache[t].value;return this.remove(t),this.put(t,e),e}console.log("Item not available in cache for key ".concat(t))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(t){var e=this.cache[t];null!==e.prev?e.prev.next=e.next:this.head=e.next,null!==e.next?e.next.prev=e.prev:this.tail=e.prev,delete this.cache[t],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}])}();export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"../
|
|
1
|
+
import t from"../helpers/parseDigits.js";import a from"./matchPhoneNumberStringAgainstPhoneNumber.js";import r from"../metadata.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(r,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"!==a(n.substring(i),r,e))return!1}else{var l=t(n.substring(i));if(l){if(r.ext!==l)return!1}else if(r.ext)return!1}}}return!0}function u(t,a){a.defaultCountry;var i=a.metadata;if("FROM_DEFAULT_COUNTRY"!==t.__countryCallingCodeSource)return!0;var o=new r(i);o.selectNumberingPlan(t.countryCallingCode),t.country||n(t.countryCallingCode,{nationalNumber:t.nationalNumber,metadata:o});var u=t.nationalNumber,l=e(o.numberingPlan.formats(),u);return!l.nationalPrefixFormattingRule()||(!!o.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!l.usesNationalPrefix()||Boolean(t.nationalPrefix)))}function l(a,r){var n=r.indexOf("/");if(n<0)return!1;var e=r.indexOf("/",n+1);return!(e<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===a.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===a.__countryCallingCodeSource)||t(r.substring(0,n))!==a.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 t from"./LRUCache.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 r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}var o=function(){return e=function e(r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new t(r)},(n=[{key:"getPatternForRegExp",value:function(t){var e=this.cache.get(t);return e||(e=new RegExp("^"+t),this.cache.put(t,e)),e}}])&&r(e.prototype,n),o&&r(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}();export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"./helpers/matchesEntirely.js";import t from"./helpers/formatNationalNumberUsingFormat.js";import n,{getCountryCallingCode as e}from"./metadata.js";import a from"./helpers/getIddPrefix.js";import{formatRFC3966 as o}from"./helpers/RFC3966.js";var i={formatExtension:function(r,t,n){return"".concat(r).concat(n.ext()).concat(t)}};function c(r,t,c,f){if(c=c?function(){for(var r=1,t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];for(;r<n.length;){if(n[r])for(var a in n[r])n[0][a]=n[r][a];r++}return n[0]}({},i,c):i,f=new n(f),r.country&&"001"!==r.country){if(!f.hasCountry(r.country))throw new Error("Unknown country: ".concat(r.country));f.selectNumberingPlan(r.country)}else{if(!r.countryCallingCode)return r.phone||"";f.selectNumberingPlan(r.countryCallingCode)}var s,m=f.countryCallingCode(),N=c.v2?r.nationalNumber:r.phone;switch(t){case"NATIONAL":return N?l(s=u(N,r.carrierCode,"NATIONAL",f,c),r.ext,f,c.formatExtension):"";case"INTERNATIONAL":return N?(s=u(N,null,"INTERNATIONAL",f,c),l(s="+".concat(m," ").concat(s),r.ext,f,c.formatExtension)):"+".concat(m);case"E.164":return"+".concat(m).concat(N);case"RFC3966":return o({number:"+".concat(m).concat(N),ext:r.ext});case"IDD":if(!c.fromCountry)return;var g=function(r,t,n,o,i){var c=e(o,i.metadata);if(c===n){var f=u(r,t,"NATIONAL",i);return"1"===n?n+" "+f:f}var l=a(o,void 0,i.metadata);if(l)return"".concat(l," ").concat(n," ").concat(u(r,null,"INTERNATIONAL",i))}(N,r.carrierCode,m,c.fromCountry,f);if(!g)return;return l(g,r.ext,f,c.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function u(r,n,e,a,o){var i=f(a.formats(),r);return i?t(r,i,{useInternationalFormat:"INTERNATIONAL"===e,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!o||!1!==o.nationalPrefix,carrierCode:n,metadata:a}):r}function f(t,n){return function(r,t){var n=0;for(;n<r.length;){if(t(r[n]))return r[n];n++}}(t,function(t){if(t.leadingDigitsPatterns().length>0){var e=t.leadingDigitsPatterns()[t.leadingDigitsPatterns().length-1];if(0!==n.search(e))return!1}return r(n,t.pattern())})}function l(r,t,n,e){return t?e(r,t,n):r}export{f as chooseFormatForNumber,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./mergeArrays.js";function r(e,r){return
|
|
1
|
+
import e from"../metadata.js";import t from"./mergeArrays.js";function r(e,t,r){return n(e,t,void 0,r)}function n(r,I,L,s){I&&(s=new e(s.metadata)).selectNumberingPlan(I);var i=s.type(L),O=i&&i.possibleLengths()||s.possibleLengths();if(!O)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===L){if(!s.type("FIXED_LINE"))return n(r,I,"MOBILE",s);var a=s.type("MOBILE");a&&(O=t(O,a.possibleLengths()))}else if(L&&!i)return"INVALID_LENGTH";var E=r.length,o=O[0];return o===E?"IS_POSSIBLE":o>E?"TOO_SHORT":O[O.length-1]<E?"TOO_LONG":O.indexOf(E,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}export{n 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){if(!o)return{};var
|
|
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,l){if(!o)return{};var m;if("+"!==o[0]){var f=r(o,i||u,a,l);if(!f||f===o){if(i||u||a){var C=n(o,i,u,a,l),c=C.countryCallingCode,s=C.number;if(c)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:c,number:s}}return{number:o}}m=!0,o="+"+f}if("0"===o[1])return{};l=new e(l);for(var d=2;d-1<=t&&d<=o.length;){var _=o.slice(1,d);if(l.hasCallingCode(_))return l.selectNumberingPlan(_),{countryCallingCodeSource:m?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:_,number:o.slice(d)};d++}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){var
|
|
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,l){var b=i||o?e(i||o,l):u;if(0===m.indexOf(b)){(l=new r(l)).selectNumberingPlan(i||o,b);var f=m.slice(b.length),N=n(f,i,l).nationalNumber,c=n(m,i,l).nationalNumber;if(!t(c,l.nationalNumberPattern())&&t(N,l.nationalNumberPattern())||"TOO_LONG"===a(c,i,l))return{countryCallingCode:b,number:f}}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 n from"./checkNumberLength.js";import t from"./getCountryByCallingCode.js";function a(a,i,o){var u=r(a,o),m=u.carrierCode,l=u.nationalNumber;if(l!==a){if(!function(r,n,t){if(e(r,t.nationalNumberPattern())&&!e(n,t.nationalNumberPattern()))return!1;return!0}(a,l,o))return{nationalNumber:a};if(o.numberingPlan.possibleLengths()&&(i||(i=t(o.numberingPlan.callingCode(),{nationalNumber:l,metadata:o})),!function(r,e,t){switch(n(r,e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(l,i,o)))return{nationalNumber:a}}return{nationalNumber:l,carrierCode:m}}export{a 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.metadata,n=r.getCountryCodesForCallingCode(a);if(n)return 1===n.length?n[0]:t(o,{countries:n,metadata:r.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(
|
|
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){if("string"==typeof r)return n(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(r,t):void 0}}(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=Array(t);e<t;e++)n[e]=r[e];return n}function a(n,a){var o=a.countries,i=a.metadata;i=new r(i);for(var u,l=e(o);!(u=l()).done;){var f=u.value;if(i.selectNumberingPlan(f),i.leadingDigits()){if(n&&0===n.search(i.leadingDigits()))return f}else if(t({phone:n,country:f},void 0,i.metadata))return f}}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(
|
|
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){if("string"==typeof t)return n(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,r):void 0}}(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=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,l){if(a=a||{},n.country||n.countryCallingCode){(l=new t(l)).selectNumberingPlan(n.country,n.countryCallingCode);var u=a.v2?n.nationalNumber:n.phone;if(r(u,l.nationalNumberPattern())){if(i(u,"FIXED_LINE",l))return l.type("MOBILE")&&""===l.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":l.type("MOBILE")?i(u,"MOBILE",l)?"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(u,I,l))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(
|
|
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,VALID_DIGITS as e,PLUS_CHARS as n,VALID_PUNCTUATION as r}from"../constants.js";import o from"./extension/createExtensionPattern.js";var s="["+e+"]{"+t+"}",i="["+n+"]{0,1}(?:["+r+"]*["+e+"]){3,}["+r+e+"]*",a=new RegExp("^["+n+"]{0,1}(?:["+r+"]*["+e+"]){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(
|
|
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){if("string"==typeof r)return t(r,e);var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(r,e):void 0}}(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=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(
|
|
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){if("string"==typeof r)return t(r,e);var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(r,e):void 0}}(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=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.selectNumberingPlan(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,n.country,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,o){return"IS_POSSIBLE"===n(e,r,o)}export{r as default,o as isPossibleNumber};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"./normalizeArguments.js";import r from"./parsePhoneNumber_.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 o(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,o)}return e}function n(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?o(Object(e),!0).forEach(function(r){i(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):o(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function i(t,r,o){return(r=function(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,r||"default");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[r]=o,t}function u(){var e=t(arguments),o=e.text,i=e.options,u=e.metadata;i=n(n({},i),{},{extract:!1});var c=r(o,i,u);return c&&c.isValid()||!1}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"../parse.js";import{VALID_PHONE_NUMBER_WITH_EXTENSION as e}from"../helpers/isViablePhoneNumber.js";import r from"../findNumbers/parsePreCandidate.js";import i from"../findNumbers/isValidPreCandidate.js";import n from"../findNumbers/isValidCandidate.js";import{WHITESPACE as a,VALID_PUNCTUATION as o}from"../constants.js";function s(t){return s="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},s(t)}function f(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,u(i.key),i)}}function u(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=s(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}var l=new RegExp("^["+a+"]+"),h=new RegExp("["+o+"]+$"),m=function(){return a=function t(r,i,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=r,this.options=i||{},this.metadata=n,this.state="NOT_READY",this.regexp=new RegExp(e,"ig")},(o=[{key:"find",value:function(){var t=this.regexp.exec(this.text);if(t){var e=t[0],i=t.index;e=e.replace(l,""),i+=t[0].length-e.length,e=e.replace(h,""),e=r(e);var n=this.parseCandidate(e,i);return n||this.find()}}},{key:"parseCandidate",value:function(e,r){if(i(e,r,this.text)&&n(e,r,this.text,this.options.extended?"POSSIBLE":"VALID")){var a=t(e,this.options,this.metadata);if(a.phone)return a.startsAt=r,a.endsAt=r+e.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}}])&&f(a.prototype,o),s&&f(a,s),Object.defineProperty(a,"prototype",{writable:!1}),a;var a,o,s}();export{m as default};
|
|
@@ -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 i(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function a(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,o(i.key),i)}}function r(t,n,e){return n&&a(t.prototype,n),e&&a(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var a=i.call(t,n||"default");if("object"!=e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}var u=" ext. ",s=/^\d+$/,l=function(){return r(function t(n){i(this,t),m(n),this.metadata=n,p.call(this,n)},[{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&&s.test(t)&&(n=t,t=null),t&&"001"!==t){if(!this.hasCountry(t))throw new Error("Unknown country: ".concat(t));this.numberingPlan=new h(this.getCountryMetadata(t),this)}else if(n){if(!this.hasCallingCode(n))throw new Error("Unknown calling code: ".concat(n));this.numberingPlan=new h(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 i=this.countryCallingCodes()[t];if(i&&1===i.length&&"001"===i[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}}])}(),h=function(){return r(function t(n,e){i(this,t),this.globalMetadataObject=e,this.metadata=n,p.call(this,e.metadata)},[{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 f(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()&&y(this.types(),t))return new g(y(this.types(),t),this)}},{key:"ext",value:function(){return this.v1||this.v2?u:this.metadata[13]||u}}])}(),f=function(){return r(function t(n,e){i(this,t),this._format=n,this.metadata=e},[{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()||c.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}])}(),c=/^\(?\$1\)?$/,g=function(){return r(function t(n,e){i(this,t),this.type=n,this.metadata=e},[{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()}}])}();function y(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 m(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 "+v(t)+": "+t,"."))}var v=function(t){return e(t)};function d(t,n){if((n=new l(n)).hasCountry(t))return n.selectNumberingPlan(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function P(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{l as default,d as getCountryCallingCode,P as isSupportedCountry,m as validateMetadata};
|