diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index d5c4aac71..9bb79d6b0 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -10,7 +10,24 @@ I'm very open to contributions, big and small! For general instructions on submi
## Changes to the plugin
-In order to build the project, you will first need to install [npm](https://www.npmjs.org), and then run `npm install` to install the project's dependencies. At this point, the included `demo.html` should be working, if you open it in your browser. Then you should make your changes in the `src` directory, and be sure to run the relevant build script before committing your changes - if you've modified the JS, you'll need to run `npm run build:js`, or if you've modified the CSS, it's `npm run build:css`.
+In order to build the project, you will first need to install [npm](https://www.npmjs.org), and then run `npm install` to install the project's dependencies.
+
+If you want to try out a demo playground for the component:
+1. Start the server by running `npm run server`.
+2. Open the demo page in your browser at the address printed to your console.
+
+**Tests** are broken up into two parts. We are currently porting the existing test suite from Grunt & Jasmine to Jest.
+- To run all tests, run `npm test`.
+- To only run the new tests, run `npm run jest`.
+- To only run the old tests, run `npx grunt jasmine:test`.
+- To run & debug the old tests interactively in your browser, run: `npx grunt jasmine:interactive` and load the URL it prints out in your browser.
+
+**Any time you make changes, you’ll need to re-build the plugin.** Most tests run against the builds, so after making changes, you’ll need to do a build before running tests.
+- To do a complete build, run `npm run build`
+- To build just the JS:
+ - `npm run build:js` runs various checks (linting, etc.) and then builds.
+ - `npm run build:jsfast` *just* builds the JS. This is useful when iterating and testing small changes. Make sure you eventually do a full build with all the checks, though!
+- To build just the CSS, run `npm run build:css`.
## Updating to a new version of libphonenumber
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 000000000..05d694f2b
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1,3 @@
+# Jest uses the `vm` module, which does not have production ready module support
+# yet. This option lets us use dynamic imports.
+node-options='--experimental-vm-modules'
diff --git a/Gruntfile.js b/Gruntfile.js
index e11585b53..c667ffe44 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -28,8 +28,21 @@ module.exports = function(grunt) {
// just vue
grunt.registerTask('vue', ['replace:vueWithUtils', 'shell:buildVue', 'replace:removeImport']);
+ // Run tests with a server so that async imports/fetches work.
+ grunt.registerTask('jasmine:test', ['connect:test', 'jasmine']);
+ grunt.registerTask('jasmine:interactive', () => {
+ grunt.event.once('connect.test.listening', (host, port) => {
+ const origin = `http://${host === '::' ? 'localhost' : host}:${port}`;
+ console.log(`
+ To view and debug tests in your browser, go to ${origin}/spec.html
+ To play with a demo of the package, go to ${origin}/demo.html
+ `);
+ });
+ grunt.task.run('connect:test:keepalive');
+ });
+
// Travis CI
- grunt.registerTask('travis', ['jasmine']);
+ grunt.registerTask('travis', ['jasmine:test']);
// bump version number in 3 files, rebuild js to update headers, then commit, tag and push
grunt.registerTask('version', ['shell:test', 'bump-only', 'js', 'bump-commit']);
grunt.registerTask('version:minor', ['shell:test', 'bump-only:minor', 'js', 'bump-commit']);
diff --git a/README.md b/README.md
index 5df0c98be..f88eff583 100644
--- a/README.md
+++ b/README.md
@@ -83,7 +83,7 @@ _Note: We have now dropped support for all versions of Internet Explorer because
```
@@ -109,10 +109,21 @@ _Note: We have now dropped support for all versions of Internet Explorer because
const input = document.querySelector("#phone");
intlTelInput(input, {
- utilsScript: "path/to/utils.js"
+ loadUtilsOnInit: () => import("intl-tel-input/utils")
});
```
+Most bundlers (such as Webpack, Vite, or Parcel) will see this and place the [utilities script](#utilities-script) in a separate bundle and load it asynchronously, only when needed. If this doesn’t work with your bundler or you want to load the utils module from some other location (such as a CDN) you can set the `loadUtilsOnInit` option to the URL to load from as a string. For example:
+
+```js
+import intlTelInput from 'intl-tel-input';
+
+const input = document.querySelector("#phone");
+intlTelInput(input, {
+ loadUtilsOnInit: `https://cdn.jsdelivr.net/npm/intl-tel-input@${intlTelInput.version}/build/js/utils.js`;
+});
+```
+
## Getting Started (Not using a bundler)
1. Download the [latest release](https://github.com/jackocnr/intl-tel-input/releases/latest), or better yet install it with [npm](https://www.npmjs.com/package/intl-tel-input)
@@ -137,7 +148,7 @@ _Note: We have now dropped support for all versions of Internet Explorer because
```
@@ -304,6 +315,15 @@ intlTelInput(input, {
Type: `String` Default: `""`
Set the initial country selection by specifying its country code e.g. `"us"` for the United States. (Be careful not to do this unless you are sure of the user's country, as it can lead to tricky issues if set incorrectly and the user auto-fills their national number and submits the form without checking - in certain cases, this can pass validation and you can end up storing a number with the wrong dial code). You can also set `initialCountry` to `"auto"`, which will look up the user's country based on their IP address (requires the `geoIpLookup` option - [see example](https://intl-tel-input.com/examples/lookup-country.html)). Note that however you use `initialCountry`, it will not update the country selection if the input already contains a number with an international dial code.
+**loadUtilsOnInit**
+Type: `String` or `() => Promise` Default: `""` Example: `"/build/js/utils.js"`
+
+This is one way to (lazy) load the included utils.js (to enable formatting/validation etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtilsOnInit` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.2/build/js/utils.js"`. The script is loaded via a [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) statement, which means the URL cannot be relative - it must be absolute.
+
+Alternatively, this can be a function that returns a promise for the utils module. When using a bundler like Webpack, this can be used to tell the bundler that the utils script should be kept in a separate file from the rest of your code. For example: `{ loadUtilsOnInit: () => import("intl-tel-input/utils") }`.
+
+The script is only fetched when you initialise the plugin, and additionally, only when the page has finished loading (on the window load event) to prevent blocking (the script is ~260KB). When instantiating the plugin, a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned under the `promise` instance property, so you can do something like `iti.promise.then(callback)` to know when initialisation requests like this have finished. See [Utilities Script](#utilities-script) for more information.
+
**nationalMode**
Type: `Boolean` Default: `true`
Format numbers in the national format, rather than the international format. This applies to placeholder numbers, and when displaying users' existing numbers. Note that it's fine for users to type their numbers in national format - as long as they have selected the right country, you can use `getNumber` to extract a full international number - [see example](https://intl-tel-input.com/examples/national-mode.html). It is recommended to leave this option enabled, to encourage users to enter their numbers in national format as this is usually more familiar to them and so it creates a better user experience.
@@ -334,9 +354,10 @@ As the user types in the input, ignore any irrelevant characters. The user can o
Type: `Boolean` Default: `true on mobile devices, false otherwise`
Control when the country list appears as a fullscreen popup vs an inline dropdown. By default, it will appear as a fullscreen popup on mobile devices (based on user-agent and screen width), to make better use of the limited space (similar to how a native `` works), and as an inline dropdown on larger devices/screens. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--usefullscreenpopup) (using the React component).
-**utilsScript**
-Type: `String` Default: `""` Example: `"/build/js/utils.js"`
-This is one way to (lazy) load the included utils.js (to enable formatting/validation etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.2/build/js/utils.js"`. The script is loaded via a [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) statement, which means the URL cannot be relative - it must be absolute. The script is only fetched when you initialise the plugin, and additionally, only when the page has finished loading (on the window load event) to prevent blocking (the script is ~260KB). When instantiating the plugin, a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned under the `promise` instance property, so you can do something like `iti.promise.then(callback)` to know when initialisation requests like this have finished. See [Utilities Script](#utilities-script) for more information.
+**utilsScript** ⚠️ DEPRECATED
+Type: `String` or `() => Promise` Default: `""` Example: `"/build/js/utils.js"`
+
+This option is deprecated and has been renamed to `loadUtilsOnInit`. Please see the deatails for that option and use it instead.
**validationNumberType**
Type: `String` Default: `"MOBILE"`
@@ -472,9 +493,17 @@ iti.isValidNumber(); // etc
```
**loadUtils**
-An alternative to the `utilsScript` option, this method lets you manually load the utils.js script on demand, to enable formatting/validation etc. See [Loading The Utilities Script](#loading-the-utilities-script) for more information. This method should only be called once per page. A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned so you can use `loadUtils().then(callback)` to know when it's finished.
+An alternative to the `loadUtilsOnInit` option, this method lets you manually load the utils.js script on demand, to enable formatting/validation etc. See [Loading The Utilities Script](#loading-the-utilities-script) for more information. This method should only be called once per page. A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned so you can use `loadUtils().then(callback)` to know when it's finished.
```js
+// Load from a URL:
intlTelInput.loadUtils("/build/js/utils.js");
+
+// Or manage load via some other method with a function:
+intlTelInput.loadUtils(async () => {
+ // Your own loading logic here. Return a JavaScript "module" object with
+ // the utils as the default export.
+ return { default: { /* a copy of the utils module */ } }
+});
```
## Events
@@ -551,10 +580,20 @@ To recompile the utils script yourself (e.g. to update the version of libphonenu
The utils script provides lots of great functionality (see above section), but comes at the cost of increased filesize (~260KB). There are two main ways to load the utils script, depending on whether you're concerned about filesize or not.
**Option 1: intlTelInputWithUtils**
-If you're not concerned about filesize (e.g. you're lazy loading this script), the easiest thing to do is to just use the full bundle /build/js/intlTelInputWithUtils.js, which comes with the utils script included. This script can be used exactly like the main intlTelInput.js - so it can either be loaded directly onto the page (which defines `window.intlTelInput` like usual), or it can be imported like so: `import intlTelInput from "intl-tel-input/intlTelInputWithUtils"`.
+If you're not concerned about filesize (e.g. you're lazy loading this script), the easiest thing to do is to just use the full bundle (`/build/js/intlTelInputWithUtils.js`), which comes with the utils script included. This script can be used exactly like the main intlTelInput.js - so it can either be loaded directly onto the page (which defines `window.intlTelInput` like usual), or it can be imported like so: `import intlTelInput from "intl-tel-input/intlTelInputWithUtils"`.
+
+**Option 2: loadUtilsOnInit**
+If you *are* concerned about filesize, you can lazy load the utils script when the plugin initialises, using the `loadUtilsOnInit` initialisation option. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtilsOnInit` option to that URL, or just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.2/build/js/utils.js"`.
+
+Alternatively, you can set the `loadUtilsOnInit` option to a function that returns a promise for the utils script as a JS module object. If you use a bundler like Webpack, Vite, or Parcel to build your app, you can use it like this automatically separate the utils into a different bundle:
+
+```js
+intlTelInput(htmlInputElement, {
+ loadUtilsOnInit: () => import("intl-tel-input/utils)
+});
+```
-**Option 2: utilsScript**
-If you *are* concerned about filesize, you can lazy load the utils script when the plugin initialises, using the `utilsScript` initialisation option. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `utilsScript` option to that URL, or just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@24.5.2/build/js/utils.js"`. If you want more control over when this file is lazy loaded, you can manually invoke the `loadUtils` static method, instead of using `utilsScript`.
+If you want more control over when this file is lazy loaded, you can manually invoke the `loadUtils` static method, instead of using `loadUtilsOnInit`.
## Troubleshooting
diff --git a/build/js/intlTelInput.d.ts b/build/js/intlTelInput.d.ts
index 53ee0e97d..689bf1667 100644
--- a/build/js/intlTelInput.d.ts
+++ b/build/js/intlTelInput.d.ts
@@ -286,6 +286,9 @@ declare module "intl-tel-input/i18n/en" {
declare module "intl-tel-input" {
import { Country } from "intl-tel-input/data";
import { I18n } from "intl-tel-input/i18n/types";
+ type UtilsLoader = () => Promise<{
+ default: ItiUtils;
+ }>;
interface IntlTelInputInterface {
(input: HTMLInputElement, options?: SomeOptions): Iti;
autoCountry?: string;
@@ -296,9 +299,9 @@ declare module "intl-tel-input" {
instances: {
[key: string]: Iti;
};
- loadUtils: (path: string) => Promise | null;
- startedLoadingAutoCountry?: boolean;
- startedLoadingUtilsScript?: boolean;
+ loadUtils: (source: string | UtilsLoader) => Promise | null;
+ startedLoadingAutoCountry: boolean;
+ startedLoadingUtilsScript: boolean;
version: string | undefined;
utils?: ItiUtils;
}
@@ -345,6 +348,7 @@ declare module "intl-tel-input" {
}) | null;
i18n: I18n;
initialCountry: string;
+ loadUtilsOnInit: string | UtilsLoader;
nationalMode: boolean;
onlyCountries: string[];
placeholderNumberType: NumberType;
@@ -352,7 +356,8 @@ declare module "intl-tel-input" {
separateDialCode: boolean;
strictMode: boolean;
useFullscreenPopup: boolean;
- utilsScript: string;
+ /** @deprecated Please use the `loadUtilsOnInit` option. */
+ utilsScript: string | UtilsLoader;
validationNumberType: NumberType | null;
}
export type SomeOptions = Partial;
@@ -400,6 +405,7 @@ declare module "intl-tel-input" {
private _handleClickOffToClose;
private _handleKeydownOnDropdown;
private _handleSearchChange;
+ private _handlePageLoad;
private resolveAutoCountryPromise;
private rejectAutoCountryPromise;
private resolveUtilsScriptPromise;
diff --git a/build/js/intlTelInput.js b/build/js/intlTelInput.js
index 60d99c102..a68548f19 100644
--- a/build/js/intlTelInput.js
+++ b/build/js/intlTelInput.js
@@ -1664,6 +1664,8 @@ var factoryOutput = (() => {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -1684,7 +1686,7 @@ var factoryOutput = (() => {
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1746,9 +1748,9 @@ var factoryOutput = (() => {
}
return el;
};
- var forEachInstance = (method) => {
+ var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -2196,14 +2198,21 @@ var factoryOutput = (() => {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -2788,6 +2797,9 @@ var factoryOutput = (() => {
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -3076,22 +3088,43 @@ var factoryOutput = (() => {
}
}
};
- var loadUtils = (path) => {
+ var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils }) => {
- intlTelInput.utils = utils;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module) => {
+ const utils = module?.default;
+ if (!utils || typeof utils !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -3118,6 +3151,8 @@ var factoryOutput = (() => {
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/build/js/intlTelInput.min.js b/build/js/intlTelInput.min.js
index 06b321f9b..43aba052b 100644
--- a/build/js/intlTelInput.min.js
+++ b/build/js/intlTelInput.min.js
@@ -13,7 +13,7 @@
}
}(() => {
-var factoryOutput=(()=>{var L=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var F=(l,t)=>{for(var e in t)L(l,e,{get:t[e],enumerable:!0})},B=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!R.call(l,n)&&n!==e&&L(l,n,{get:()=>t[n],enumerable:!(i=O(t,n))||i.enumerable});return l};var z=l=>B(L({},"__esModule",{value:!0}),l);var Y={};F(Y,{Iti:()=>w,default:()=>q});var E=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],N=[];for(let l=0;ll.replace(/\D/g,""),k=(l="")=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),M=l=>{let t=I(l);if(t.charAt(0)==="1"){let e=t.substr(1,3);return $.indexOf(e)!==-1}return!1},W=(l,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(l);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=l=>{let{instances:t}=r;Object.values(t).forEach(e=>e[l]())},w=class{constructor(t,e={}){this.id=U++,this.a=t,this.c=null,this.d=Object.assign({},P,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.onlyCountries.length===1&&(this.d.initialCountry=this.d.onlyCountries[0]),this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.allowDropdown&&!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]");let t=this.d.allowDropdown||this.d.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!t:t,this.d.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.a.style.paddingRight:this.originalPaddingLeft=this.a.style.paddingLeft),this.d.i18n={...T,...this.d.i18n};let e=new Promise((n,s)=>{this.h=n,this.i=s}),i=new Promise((n,s)=>{this.i0=n,this.i1=s});this.promise=Promise.all([e,i]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this._sortCountries()}_sortCountries(){this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,u=s>-1;if(o||u)return o&&u?n-s:o?-1:1}return t.name.localeCompare(e.name)})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;sn.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=f}_d0(){for(let t=0;t`),s+=`${e.name} `,s+=`+${e.dialCode} `,n.insertAdjacentHTML("beforeend",s)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),u=M(s),{initialCountry:a,geoIpLookup:p}=this.d,h=a==="auto"&&p;if(o&&!u)this._v(s);else if(!h||t){let d=a?a.toLowerCase():"";d&&this._y(d,!0)?this._z(d):o&&u?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{utilsScript:t,initialCountry:e,geoIpLookup:i}=this.d;t&&!r.utils?r.documentReady()?r.loadUtils(t):window.addEventListener("load",()=>{r.loadUtils(t)}):this.i0(),e==="auto"&&i&&!this.s.iso2?this._i4():this.h()}_i4(){r.autoCountry?this.handleAutoCountry():r.startedLoadingAutoCountry||(r.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(r.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._h(!0),b("rejectAutoCountryPromise"))},()=>{this._h(!0),b("rejectAutoCountryPromise")}))}_nWithPlus(){this._n(),this.searchInput.value="+",this._p3("",!0)}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n,allowDropdown:s,countrySearch:o}=this.d,u=!1;/\p{L}/u.test(this.a.value)&&(u=!0),this._a12=a=>{if(this.isAndroid&&a?.data==="+"&&i&&s&&o){let m=this.a.selectionStart||0,g=this.a.value.substring(0,m-1),C=this.a.value.substring(m);this.a.value=g+C,this._nWithPlus();return}this._v(this.a.value)&&this._8();let p=a?.data&&/[^+0-9]/.test(a.data),h=a?.inputType==="insertFromPaste"&&this.a.value;p||h&&!t?u=!0:/[^+0-9]/.test(this.a.value)||(u=!1);let d=a?.detail&&a.detail.isSetNumber&&!n;if(e&&!u&&!d){let m=this.a.selectionStart||0,C=this.a.value.substring(0,m).replace(/[^+0-9]/g,"").length,y=a?.inputType==="deleteContentForward",v=this._9(),_=W(C,v,m,y);this.a.value=v,this.a.setSelectionRange(_,_)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=a=>{if(a.key&&a.key.length===1&&!a.altKey&&!a.ctrlKey&&!a.metaKey){if(i&&s&&o&&a.key==="+"){a.preventDefault(),this._nWithPlus();return}if(t){let p=this.a.value,h=p.charAt(0)==="+",d=!h&&this.a.selectionStart===0&&a.key==="+",m=/^[0-9]$/.test(a.key),g=i?m:d||m,C=p.slice(0,this.a.selectionStart)+a.key+p.slice(this.a.selectionEnd),y=this._6(C),v=r.utils.getCoreNumber(y,this.s.iso2),_=this.maxCoreNumberLength&&v.length>this.maxCoreNumberLength,D=!1;if(h){let x=this.s.iso2;D=this._getCountryFromNumber(y)!==x}(!g||_&&!D&&!d)&&a.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t,countrySearch:e}=this.d;if(t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),e){let i=this.countryList.firstElementChild;i&&(this._x(i,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2);let e="",i=null;if(this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let n=()=>{let o=this.searchInput.value.trim();o?this._p3(o):this._p3("",!0)},s=null;this._a7=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",o=>o.stopPropagation())}}_searchForCountry(t){for(let e=0;eh[0]).join("").toLowerCase(),p=`+${o.dialCode}`;if(e||u.includes(n)||p.includes(n)||o.iso2.includes(n)||a.includes(n)){let h=o.nodeById[this.id];h&&this.countryList.appendChild(h),i&&(this._x(h,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&r.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=r.utils.numberFormat,o=i?n:s;e=r.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=this._getCountryFromNumber(t);return e!==null?this._z(e):!1}_getCountryFromNumber(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),u=I(i);if(o){let a=this.q[I(o)],p=a.indexOf(this.s.iso2)!==-1&&u.length<=o.length-1;if(!(n==="1"&&M(u))&&!p){for(let d=0;do){let d=n-u;e.scrollTop=h-d}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s-1){let i=t.substring(0,e),n=this._utilsIsPossibleNumber(i),s=this._utilsIsPossibleNumber(t);return n&&s}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return r.utils?r.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){if(!this.s.iso2)return!1;let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsValidNumber(i),s=this._utilsIsValidNumber(t);return n&&s}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return r.utils?r.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}setDisabled(t){this.a.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},G=l=>!r.utils&&!r.startedLoadingUtilsScript?(r.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(/* webpackIgnore: true */ l).then(({default:i})=>{r.utils=i,b("handleUtils"),t(!0)}).catch(()=>{b("rejectUtilsScriptPromise"),e()})})):null,r=Object.assign((l,t)=>{let e=new w(l,t);return e._init(),l.setAttribute("data-intl-tel-input-id",e.id.toString()),r.instances[e.id]=e,e},{defaults:P,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:l=>{let t=l.getAttribute("data-intl-tel-input-id");return t?r.instances[t]:null},instances:{},loadUtils:G,version:"24.5.2"}),q=r;return z(Y);})();
+var factoryOutput=(()=>{var L=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var F=(a,t)=>{for(var e in t)L(a,e,{get:t[e],enumerable:!0})},U=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!R.call(a,n)&&n!==e&&L(a,n,{get:()=>t[n],enumerable:!(i=O(t,n))||i.enumerable});return a};var B=a=>U(L({},"__esModule",{value:!0}),a);var Y={};F(Y,{Iti:()=>w,default:()=>q});var D=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],N=[];for(let a=0;aa.replace(/\D/g,""),k=(a="")=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),M=a=>{let t=I(a);if(t.charAt(0)==="1"){let e=t.substr(1,3);return V.indexOf(e)!==-1}return!1},W=(a,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(a);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=(a,...t)=>{let{instances:e}=r;Object.values(e).forEach(i=>i[a](...t))},w=class{constructor(t,e={}){this.id=K++,this.a=t,this.c=null,this.d=Object.assign({},P,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.onlyCountries.length===1&&(this.d.initialCountry=this.d.onlyCountries[0]),this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.allowDropdown&&!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]");let t=this.d.allowDropdown||this.d.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!t:t,this.d.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.a.style.paddingRight:this.originalPaddingLeft=this.a.style.paddingLeft),this.d.i18n={...T,...this.d.i18n};let e=new Promise((n,s)=>{this.h=n,this.i=s}),i=new Promise((n,s)=>{this.i0=n,this.i1=s});this.promise=Promise.all([e,i]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this._sortCountries()}_sortCountries(){this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,u=s>-1;if(o||u)return o&&u?n-s:o?-1:1}return t.name.localeCompare(e.name)})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;sn.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=f}_d0(){for(let t=0;t`),s+=`${e.name} `,s+=`+${e.dialCode} `,n.insertAdjacentHTML("beforeend",s)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),u=M(s),{initialCountry:l,geoIpLookup:p}=this.d,h=l==="auto"&&p;if(o&&!u)this._v(s);else if(!h||t){let d=l?l.toLowerCase():"";d&&this._y(d,!0)?this._z(d):o&&u?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{loadUtilsOnInit:t,utilsScript:e,initialCountry:i,geoIpLookup:n}=this.d;!t&&e&&(console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."),t=e),t&&!r.utils?(this._handlePageLoad=()=>{window.removeEventListener("load",this._handlePageLoad),r.loadUtils(t)?.catch(()=>{})},r.documentReady()?this._handlePageLoad():window.addEventListener("load",this._handlePageLoad)):this.i0(),i==="auto"&&n&&!this.s.iso2?this._i4():this.h()}_i4(){r.autoCountry?this.handleAutoCountry():r.startedLoadingAutoCountry||(r.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(r.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._h(!0),b("rejectAutoCountryPromise"))},()=>{this._h(!0),b("rejectAutoCountryPromise")}))}_nWithPlus(){this._n(),this.searchInput.value="+",this._p3("",!0)}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n,allowDropdown:s,countrySearch:o}=this.d,u=!1;/\p{L}/u.test(this.a.value)&&(u=!0),this._a12=l=>{if(this.isAndroid&&l?.data==="+"&&i&&s&&o){let m=this.a.selectionStart||0,y=this.a.value.substring(0,m-1),g=this.a.value.substring(m);this.a.value=y+g,this._nWithPlus();return}this._v(this.a.value)&&this._8();let p=l?.data&&/[^+0-9]/.test(l.data),h=l?.inputType==="insertFromPaste"&&this.a.value;p||h&&!t?u=!0:/[^+0-9]/.test(this.a.value)||(u=!1);let d=l?.detail&&l.detail.isSetNumber&&!n;if(e&&!u&&!d){let m=this.a.selectionStart||0,g=this.a.value.substring(0,m).replace(/[^+0-9]/g,"").length,C=l?.inputType==="deleteContentForward",v=this._9(),_=W(g,v,m,C);this.a.value=v,this.a.setSelectionRange(_,_)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=l=>{if(l.key&&l.key.length===1&&!l.altKey&&!l.ctrlKey&&!l.metaKey){if(i&&s&&o&&l.key==="+"){l.preventDefault(),this._nWithPlus();return}if(t){let p=this.a.value,h=p.charAt(0)==="+",d=!h&&this.a.selectionStart===0&&l.key==="+",m=/^[0-9]$/.test(l.key),y=i?m:d||m,g=p.slice(0,this.a.selectionStart)+l.key+p.slice(this.a.selectionEnd),C=this._6(g),v=r.utils.getCoreNumber(C,this.s.iso2),_=this.maxCoreNumberLength&&v.length>this.maxCoreNumberLength,E=!1;if(h){let x=this.s.iso2;E=this._getCountryFromNumber(C)!==x}(!y||_&&!E&&!d)&&l.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t,countrySearch:e}=this.d;if(t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),e){let i=this.countryList.firstElementChild;i&&(this._x(i,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2);let e="",i=null;if(this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let n=()=>{let o=this.searchInput.value.trim();o?this._p3(o):this._p3("",!0)},s=null;this._a7=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",o=>o.stopPropagation())}}_searchForCountry(t){for(let e=0;eh[0]).join("").toLowerCase(),p=`+${o.dialCode}`;if(e||u.includes(n)||p.includes(n)||o.iso2.includes(n)||l.includes(n)){let h=o.nodeById[this.id];h&&this.countryList.appendChild(h),i&&(this._x(h,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&r.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=r.utils.numberFormat,o=i?n:s;e=r.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=this._getCountryFromNumber(t);return e!==null?this._z(e):!1}_getCountryFromNumber(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),u=I(i);if(o){let l=this.q[I(o)],p=l.indexOf(this.s.iso2)!==-1&&u.length<=o.length-1;if(!(n==="1"&&M(u))&&!p){for(let d=0;do){let d=n-u;e.scrollTop=h-d}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s-1){let i=t.substring(0,e),n=this._utilsIsPossibleNumber(i),s=this._utilsIsPossibleNumber(t);return n&&s}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return r.utils?r.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){if(!this.s.iso2)return!1;let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsValidNumber(i),s=this._utilsIsValidNumber(t);return n&&s}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return r.utils?r.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}setDisabled(t){this.a.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},G=a=>{if(!r.utils&&!r.startedLoadingUtilsScript){let t;if(typeof a=="string")t=import(/* webpackIgnore: true */ a);else if(typeof a=="function")try{if(t=a(),!(t instanceof Promise))throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof t}`)}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof a}`));return r.startedLoadingUtilsScript=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="object")throw typeof a=="string"?new TypeError(`The module loaded from ${a} did not set utils as its default export.`):new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");return r.utils=i,b("handleUtils"),!0}).catch(e=>{throw b("rejectUtilsScriptPromise",e),e})}return null},r=Object.assign((a,t)=>{let e=new w(a,t);return e._init(),a.setAttribute("data-intl-tel-input-id",e.id.toString()),r.instances[e.id]=e,e},{defaults:P,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:a=>{let t=a.getAttribute("data-intl-tel-input-id");return t?r.instances[t]:null},instances:{},loadUtils:G,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"24.5.2"}),q=r;return B(Y);})();
// UMD
return factoryOutput.default;
diff --git a/build/js/intlTelInputWithUtils.js b/build/js/intlTelInputWithUtils.js
index 954fae8d5..1d3a0c33b 100644
--- a/build/js/intlTelInputWithUtils.js
+++ b/build/js/intlTelInputWithUtils.js
@@ -1663,6 +1663,8 @@ var factoryOutput = (() => {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -1683,7 +1685,7 @@ var factoryOutput = (() => {
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1745,9 +1747,9 @@ var factoryOutput = (() => {
}
return el;
};
- var forEachInstance = (method) => {
+ var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -2195,14 +2197,21 @@ var factoryOutput = (() => {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -2787,6 +2796,9 @@ var factoryOutput = (() => {
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -3075,22 +3087,39 @@ var factoryOutput = (() => {
}
}
};
- var loadUtils = (path) => {
+ var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import_INTENTIONALLY_BROKEN(
- /* webpackIgnore: true */
- /* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ return loadCall.then((module) => {
+ const utils2 = module?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -3117,6 +3146,8 @@ var factoryOutput = (() => {
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/build/js/intlTelInputWithUtils.min.js b/build/js/intlTelInputWithUtils.min.js
index 8b3dc5b70..165b22cd6 100644
--- a/build/js/intlTelInputWithUtils.min.js
+++ b/build/js/intlTelInputWithUtils.min.js
@@ -13,7 +13,7 @@
}
}(() => {
-var factoryOutput=(()=>{var I1=Object.defineProperty;var D2=Object.getOwnPropertyDescriptor;var x2=Object.getOwnPropertyNames;var P2=Object.prototype.hasOwnProperty;var R2=(C,e)=>{for(var n in e)I1(C,n,{get:e[n],enumerable:!0})},O2=(C,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of x2(e))!P2.call(C,u)&&u!==n&&I1(C,u,{get:()=>e[u],enumerable:!(r=D2(e,u))||r.enumerable});return C};var k2=C=>O2(I1({},"__esModule",{value:!0}),C);var z2={};R2(z2,{default:()=>W2});var o2=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],s2=[];for(let C=0;CC.replace(/\D/g,""),l2=(C="")=>C.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),h2=C=>{let e=p1(C);if(e.charAt(0)==="1"){let n=e.substr(1,3);return U2.indexOf(n)!==-1}return!1},K2=(C,e,n,r)=>{if(n===0&&!r)return 0;let u=0;for(let l=0;l{let r=document.createElement(C);return e&&Object.entries(e).forEach(([u,l])=>r.setAttribute(u,l)),n&&n.appendChild(r),r},$1=C=>{let{instances:e}=g;Object.values(e).forEach(n=>n[C]())},b1=class{constructor(e,n={}){this.id=F2++,this.telInput=e,this.highlightedItem=null,this.options=Object.assign({},c2,n),this.hadInitialPlaceholder=!!e.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.onlyCountries.length===1&&(this.options.initialCountry=this.options.onlyCountries[0]),this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.allowDropdown&&!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.telInput.closest("[dir=rtl]");let e=this.options.allowDropdown||this.options.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!e:e,this.options.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.telInput.style.paddingRight:this.originalPaddingLeft=this.telInput.style.paddingLeft),this.options.i18n={..._1,...this.options.i18n};let n=new Promise((u,l)=>{this.resolveAutoCountryPromise=u,this.rejectAutoCountryPromise=l}),r=new Promise((u,l)=>{this.resolveUtilsScriptPromise=u,this.rejectUtilsScriptPromise=l});this.promise=Promise.all([n,r]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this._sortCountries()}_sortCountries(){this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(e=>e.toLowerCase())),this.countries.sort((e,n)=>{let{countryOrder:r}=this.options;if(r){let u=r.indexOf(e.iso2),l=r.indexOf(n.iso2),p=u>-1,y=l>-1;if(p||y)return p&&y?u-l:p?-1:1}return e.name.localeCompare(n.name)})}_addToDialCodeMap(e,n,r){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let l=0;lu.toLowerCase());this.countries=K.filter(u=>r.indexOf(u.iso2)>-1)}else if(n.length){let r=n.map(u=>u.toLowerCase());this.countries=K.filter(u=>r.indexOf(u.iso2)===-1)}else this.countries=K}_translateCountryNames(){for(let e=0;e`),l+=`${n.name} `,l+=`+${n.dialCode} `,u.insertAdjacentHTML("beforeend",l)}}_setInitialState(e=!1){let n=this.telInput.getAttribute("value"),r=this.telInput.value,l=n&&n.charAt(0)==="+"&&(!r||r.charAt(0)!=="+")?n:r,p=this._getDialCode(l),y=h2(l),{initialCountry:m,geoIpLookup:S}=this.options,I=m==="auto"&&S;if(p&&!y)this._updateCountryFromNumber(l);else if(!I||e){let _=m?m.toLowerCase():"";_&&this._getCountryData(_,!0)?this._setCountry(_):p&&y?this._setCountry("us"):this._setCountry()}l&&this._updateValFromNumber(l)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let e=this.telInput.closest("label");e&&e.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){let{utilsScript:e,initialCountry:n,geoIpLookup:r}=this.options;e&&!g.utils?g.documentReady()?g.loadUtils(e):window.addEventListener("load",()=>{g.loadUtils(e)}):this.resolveUtilsScriptPromise(),n==="auto"&&r&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){g.autoCountry?this.handleAutoCountry():g.startedLoadingAutoCountry||(g.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let n=e.toLowerCase();n&&this._getCountryData(n,!0)?(g.autoCountry=n,setTimeout(()=>$1("handleAutoCountry"))):(this._setInitialState(!0),$1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),$1("rejectAutoCountryPromise")}))}_openDropdownWithPlus(){this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0)}_initTelInputListeners(){let{strictMode:e,formatAsYouType:n,separateDialCode:r,formatOnDisplay:u,allowDropdown:l,countrySearch:p}=this.options,y=!1;/\p{L}/u.test(this.telInput.value)&&(y=!0),this._handleInputEvent=m=>{if(this.isAndroid&&m?.data==="+"&&r&&l&&p){let w=this.telInput.selectionStart||0,O=this.telInput.value.substring(0,w-1),M=this.telInput.value.substring(w);this.telInput.value=O+M,this._openDropdownWithPlus();return}this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let S=m?.data&&/[^+0-9]/.test(m.data),I=m?.inputType==="insertFromPaste"&&this.telInput.value;S||I&&!e?y=!0:/[^+0-9]/.test(this.telInput.value)||(y=!1);let _=m?.detail&&m.detail.isSetNumber&&!u;if(n&&!y&&!_){let w=this.telInput.selectionStart||0,M=this.telInput.value.substring(0,w).replace(/[^+0-9]/g,"").length,k=m?.inputType==="deleteContentForward",z=this._formatNumberAsYouType(),Z=K2(M,z,w,k);this.telInput.value=z,this.telInput.setSelectionRange(Z,Z)}},this.telInput.addEventListener("input",this._handleInputEvent),(e||r)&&(this._handleKeydownEvent=m=>{if(m.key&&m.key.length===1&&!m.altKey&&!m.ctrlKey&&!m.metaKey){if(r&&l&&p&&m.key==="+"){m.preventDefault(),this._openDropdownWithPlus();return}if(e){let S=this.telInput.value,I=S.charAt(0)==="+",_=!I&&this.telInput.selectionStart===0&&m.key==="+",w=/^[0-9]$/.test(m.key),O=r?w:_||w,M=S.slice(0,this.telInput.selectionStart)+m.key+S.slice(this.telInput.selectionEnd),k=this._getFullNumber(M),z=g.utils.getCoreNumber(k,this.selectedCountryData.iso2),Z=this.maxCoreNumberLength&&z.length>this.maxCoreNumberLength,n1=!1;if(I){let f1=this.selectedCountryData.iso2;n1=this._getCountryFromNumber(k)!==f1}(!O||Z&&!n1&&!_)&&m.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(e){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&e.length>n?e.substr(0,n):e}_trigger(e,n={}){let r=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});this.telInput.dispatchEvent(r)}_openDropdown(){let{fixDropdownWidth:e,countrySearch:n}=this.options;if(e&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),n){let r=this.countryList.firstElementChild;r&&(this._highlightListItem(r,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let e=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${e.top+n}px`,this.dropdown.style.left=`${e.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._highlightListItem(l,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._selectListItem(l)},this.countryList.addEventListener("click",this._handleClickCountryList);let e=!0;this._handleClickOffToClose=()=>{e||this._closeDropdown(),e=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let n="",r=null;if(this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(u.key)&&(u.stopPropagation(),r&&clearTimeout(r),n+=u.key.toLowerCase(),this._searchForCountry(n),r=setTimeout(()=>{n=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let u=()=>{let p=this.searchInput.value.trim();p?this._filterCountries(p):this._filterCountries("",!0)},l=null;this._handleSearchChange=()=>{l&&clearTimeout(l),l=setTimeout(()=>{u(),l=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",p=>p.stopPropagation())}}_searchForCountry(e){for(let n=0;nI[0]).join("").toLowerCase(),S=`+${p.dialCode}`;if(n||y.includes(u)||S.includes(u)||p.iso2.includes(u)||m.includes(u)){let I=p.nodeById[this.id];I&&this.countryList.appendChild(I),r&&(this._highlightListItem(I,!1),r=!1)}}r&&this._highlightListItem(null,!1),this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:e}=this.options,n=this.countryList.childElementCount,r;n===0?r=e.zeroSearchResults:n===1?r=e.oneSearchResult:r=e.multipleSearchResults.replace("${count}",n.toString()),this.searchResultsA11yText.textContent=r}_handleUpDownKey(e){let n=e==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!n&&this.countryList.childElementCount>1&&(n=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(e){let n=e;if(this.options.formatOnDisplay&&g.utils&&this.selectedCountryData){let r=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:l}=g.utils.numberFormat,p=r?u:l;n=g.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber(e){let n=this._getCountryFromNumber(e);return n!==null?this._setCountry(n):!1}_getCountryFromNumber(e){let n=e.indexOf("+"),r=n?e.substring(n):e,u=this.selectedCountryData.dialCode;r&&u==="1"&&r.charAt(0)!=="+"&&(r.charAt(0)!=="1"&&(r=`1${r}`),r=`+${r}`),this.options.separateDialCode&&u&&r.charAt(0)!=="+"&&(r=`+${u}${r}`);let p=this._getDialCode(r,!0),y=p1(r);if(p){let m=this.dialCodeToIso2Map[p1(p)],S=m.indexOf(this.selectedCountryData.iso2)!==-1&&y.length<=p.length-1;if(!(u==="1"&&h2(y))&&!S){for(let _=0;_p){let _=u-y;n.scrollTop=I-_}}_updateDialCode(e){let n=this.telInput.value,r=`+${e}`,u;if(n.charAt(0)==="+"){let l=this._getDialCode(n);l?u=n.replace(l,r):u=r,this.telInput.value=u}}_getDialCode(e,n){let r="";if(e.charAt(0)==="+"){let u="";for(let l=0;l-1){let r=e.substring(0,n),u=this._utilsIsPossibleNumber(r),l=this._utilsIsPossibleNumber(e);return u&&l}return this._utilsIsPossibleNumber(e)}_utilsIsPossibleNumber(e){return g.utils?g.utils.isPossibleNumber(e,this.selectedCountryData.iso2,this.options.validationNumberType):null}isValidNumberPrecise(){if(!this.selectedCountryData.iso2)return!1;let e=this._getFullNumber(),n=e.search(/\p{L}/u);if(n>-1){let r=e.substring(0,n),u=this._utilsIsValidNumber(r),l=this._utilsIsValidNumber(e);return u&&l}return this._utilsIsValidNumber(e)}_utilsIsValidNumber(e){return g.utils?g.utils.isValidNumber(e,this.selectedCountryData.iso2):null}setCountry(e){let n=e?.toLowerCase(),r=this.selectedCountryData.iso2;(e&&n!==r||!e&&r)&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(e){let n=this._updateCountryFromNumber(e);this._updateValFromNumber(e),n&&this._triggerCountryChange(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(e){this.options.placeholderNumberType=e,this._updatePlaceholder()}setDisabled(e){this.telInput.disabled=e,e?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},V2=C=>!g.utils&&!g.startedLoadingUtilsScript?(g.startedLoadingUtilsScript=!0,new Promise((e,n)=>{import_INTENTIONALLY_BROKEN(/* webpackIgnore: true */ C).then(({default:r})=>{g.utils=r,$1("handleUtils"),e(!0)}).catch(()=>{$1("rejectUtilsScriptPromise"),n()})})):null,g=Object.assign((C,e)=>{let n=new b1(C,e);return n._init(),C.setAttribute("data-intl-tel-input-id",n.id.toString()),g.instances[n.id]=n,n},{defaults:c2,documentReady:()=>document.readyState==="complete",getCountryData:()=>K,getInstance:C=>{let e=C.getAttribute("data-intl-tel-input-id");return e?g.instances[e]:null},instances:{},loadUtils:V2,version:"24.5.2"}),S1=g;(function(){var C=this||self;function e(d,t){d=d.split(".");var $=C;d[0]in $||typeof $.execScript>"u"||$.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?$[i]&&$[i]!==Object.prototype[i]?$=$[i]:$=$[i]={}:$[i]=t}function n(d,t){function $(){}$.prototype=t.prototype,d.ma=t.prototype,d.prototype=new $,d.prototype.constructor=d,d.sa=function(i,o,s){for(var a=Array(arguments.length-2),h=2;hd.length?!1:B(T2,d)}function B1(d){return B(b2,d)?s1(d,C2):s1(d,m1)}function G1(d){var t=B1(d.toString());P(d),d.g(t)}function H1(d){return d!=null&&(H(d,9)!=1||A(d,9)[0]!=-1)}function s1(d,t){for(var $=new T,i,o=d.length,s=0;st?2:s[s.length-1]=o&&o<=i;++o)if($=parseInt(d.substring(0,o),10),$ in X)return t.g(d.substring(o)),$;return 0}function W1(d,t,$,i,o,s){if(t.length==0)return 0;t=new T(t);var a;$!=null&&(a=c($,11)),a==null&&(a="NonMatch");var h=t.toString();if(h.length==0)a=20;else if(Q.test(h))h=h.replace(Q,""),P(t),t.g(B1(h)),a=1;else{if(h=new RegExp(a),G1(t),a=t.toString(),a.search(h)==0){h=a.match(h)[0].length;var f=a.substring(h).match(P1);f&&f[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=j1(t,i),d!=0)return E(s,1,d),d;throw Error("Invalid country calling code")}return $!=null&&(a=v($,10),h=""+a,f=t.toString(),f.lastIndexOf(h,0)==0&&(h=new T(f.substring(h.length)),f=c($,1),f=new RegExp(v(f,2)),z1(h,$,null),h=h.toString(),!B(f,t.toString())&&B(f,h)||l1(d,t.toString(),$,-1)==3))?(i.g(h),o&&E(s,6,10),E(s,1,a),a):(E(s,1,0),0)}function z1(d,t,$){var i=d.toString(),o=i.length,s=c(t,15);if(o!=0&&s!=null&&s.length!=0){var a=new RegExp("^(?:"+s+")");if(o=a.exec(i)){s=new RegExp(v(c(t,1),2));var h=B(s,i),f=o.length-1;t=c(t,16),t==null||t.length==0||o[f]==null||o[f].length==0?(!h||B(s,i.substring(o[0].length)))&&($!=null&&0=t.length)s="";else{var a=t.indexOf(";",s);s=a!==-1?t.substring(s,a):t.substring(s)}var h=s;if(h==null?a=!0:h.length===0?a=!1:(a=S2.exec(h),h=w2.exec(h),a=a!==null||h!==null),!a||(s!=null?(s.charAt(0)==="+"&&o.g(s),s=t.indexOf("tel:"),o.g(t.substring(0<=s?s+4:0,t.indexOf(";phone-context=")))):(s=o.g,a=t??"",h=a.search(v2),0<=h?(a=a.substring(h),a=a.replace(_2,""),h=a.search(I2),0<=h&&(a=a.substring(0,h))):a="",s.call(o,a)),s=o.toString(),a=s.indexOf(";isub="),0t.h.length||(a!=null&&($=new T,o=new T(t.toString()),z1(o,a,$),d=l1(d,o.toString(),a,-1),d!=2&&d!=4&&d!=5&&(t=o,i&&0<$.toString().length&&E(s,7,$.toString()))),i=t.toString(),d=i.length,2>d))throw Error("The string supplied is too short to be a phone number");if(17{try{let $=d.replace(/[^+0-9]/g,""),i=new N2(t);t="";for(let o=0;o<$.length;o++)i.ja=M2(i,$.charAt(o)),t=i.ja;return t}catch{return d}}),e("intlTelInputUtilsTemp.formatNumber",(d,t,$)=>{try{let o=N.g(),s=W(o,d,t);var i=J(o,s,-1);return i==0||i==4?o.format(s,typeof $>"u"?0:$):d}catch{return d}}),e("intlTelInputUtilsTemp.getExampleNumber",(d,t,$,i)=>{try{let f=N.g();d:{var o=f;if(u1(d)){var s=a1(U(o,d),$);try{if(x(s,6)){var a=c(s,6),h=Z1(o,a,d,!1);break d}}catch{}}h=null}return f.format(h,i?0:t?2:1)}catch{return""}}),e("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(W(N.g(),d,t),3)}catch{return""}}),e("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let a=N.g(),h=W(a,d,t);var $=K1(a,h),i=d1(a,v(h,1),$);if(i==null)var o=-1;else{var s=t1(h);o=C1(s,i)}return o}catch{return-99}}),e("intlTelInputUtilsTemp.getValidationError",(d,t)=>{if(!t)return 1;try{let $=N.g(),i=W($,d,t);return J($,i,-1)}catch($){return $.message==="Invalid country calling code"?1:3>=d.length||$.message==="Phone number too short after IDD"||$.message==="The string supplied is too short to be a phone number"?2:$.message==="The string supplied is too long to be a phone number"?3:-99}}),e("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let f=N.g();var $=W(f,d,t),i=K1(f,$);d=f;var o=v($,1),s=d1(d,o,i);if(s==null||i!="001"&&o!=V1(d,i))var a=!1;else{var h=t1($);a=C1(h,s)!=-1}return a}catch{return!1}}),e("intlTelInputUtilsTemp.isPossibleNumber",(d,t,$)=>{try{let i=N.g(),o=W(i,d,t);if($){let s=J(i,o,c1[$])===0;if($==="FIXED_LINE_OR_MOBILE"){let a=J(i,o,c1.MOBILE)===0,h=J(i,o,c1.FIXED_LINE)===0;return a||h||s}return s}return J(i,o,-1)===0}catch{return!1}}),e("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(W(N.g(),d,t),2).toString()}catch{return""}}),e("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),e("intlTelInputUtilsTemp.numberType",c1),e("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var j2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var p2=j2;S1.utils=p2;var W2=S1;return k2(z2);})();
+var factoryOutput=(()=>{var I1=Object.defineProperty;var D2=Object.getOwnPropertyDescriptor;var P2=Object.getOwnPropertyNames;var x2=Object.prototype.hasOwnProperty;var R2=(f,e)=>{for(var n in e)I1(f,n,{get:e[n],enumerable:!0})},O2=(f,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of P2(e))!x2.call(f,a)&&a!==n&&I1(f,a,{get:()=>e[a],enumerable:!(r=D2(e,a))||r.enumerable});return f};var k2=f=>O2(I1({},"__esModule",{value:!0}),f);var z2={};R2(z2,{default:()=>W2});var o2=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],s2=[];for(let f=0;ff.replace(/\D/g,""),l2=(f="")=>f.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),h2=f=>{let e=p1(f);if(e.charAt(0)==="1"){let n=e.substr(1,3);return F2.indexOf(n)!==-1}return!1},K2=(f,e,n,r)=>{if(n===0&&!r)return 0;let a=0;for(let l=0;l{let r=document.createElement(f);return e&&Object.entries(e).forEach(([a,l])=>r.setAttribute(a,l)),n&&n.appendChild(r),r},$1=(f,...e)=>{let{instances:n}=m;Object.values(n).forEach(r=>r[f](...e))},b1=class{constructor(e,n={}){this.id=H2++,this.telInput=e,this.highlightedItem=null,this.options=Object.assign({},c2,n),this.hadInitialPlaceholder=!!e.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.onlyCountries.length===1&&(this.options.initialCountry=this.options.onlyCountries[0]),this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.allowDropdown&&!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.telInput.closest("[dir=rtl]");let e=this.options.allowDropdown||this.options.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!e:e,this.options.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.telInput.style.paddingRight:this.originalPaddingLeft=this.telInput.style.paddingLeft),this.options.i18n={..._1,...this.options.i18n};let n=new Promise((a,l)=>{this.resolveAutoCountryPromise=a,this.rejectAutoCountryPromise=l}),r=new Promise((a,l)=>{this.resolveUtilsScriptPromise=a,this.rejectUtilsScriptPromise=l});this.promise=Promise.all([n,r]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this._sortCountries()}_sortCountries(){this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(e=>e.toLowerCase())),this.countries.sort((e,n)=>{let{countryOrder:r}=this.options;if(r){let a=r.indexOf(e.iso2),l=r.indexOf(n.iso2),p=a>-1,y=l>-1;if(p||y)return p&&y?a-l:p?-1:1}return e.name.localeCompare(n.name)})}_addToDialCodeMap(e,n,r){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let l=0;la.toLowerCase());this.countries=K.filter(a=>r.indexOf(a.iso2)>-1)}else if(n.length){let r=n.map(a=>a.toLowerCase());this.countries=K.filter(a=>r.indexOf(a.iso2)===-1)}else this.countries=K}_translateCountryNames(){for(let e=0;e`),l+=`${n.name} `,l+=`+${n.dialCode} `,a.insertAdjacentHTML("beforeend",l)}}_setInitialState(e=!1){let n=this.telInput.getAttribute("value"),r=this.telInput.value,l=n&&n.charAt(0)==="+"&&(!r||r.charAt(0)!=="+")?n:r,p=this._getDialCode(l),y=h2(l),{initialCountry:C,geoIpLookup:S}=this.options,I=C==="auto"&&S;if(p&&!y)this._updateCountryFromNumber(l);else if(!I||e){let _=C?C.toLowerCase():"";_&&this._getCountryData(_,!0)?this._setCountry(_):p&&y?this._setCountry("us"):this._setCountry()}l&&this._updateValFromNumber(l)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let e=this.telInput.closest("label");e&&e.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){let{loadUtilsOnInit:e,utilsScript:n,initialCountry:r,geoIpLookup:a}=this.options;!e&&n&&(console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."),e=n),e&&!m.utils?(this._handlePageLoad=()=>{window.removeEventListener("load",this._handlePageLoad),m.loadUtils(e)?.catch(()=>{})},m.documentReady()?this._handlePageLoad():window.addEventListener("load",this._handlePageLoad)):this.resolveUtilsScriptPromise(),r==="auto"&&a&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){m.autoCountry?this.handleAutoCountry():m.startedLoadingAutoCountry||(m.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let n=e.toLowerCase();n&&this._getCountryData(n,!0)?(m.autoCountry=n,setTimeout(()=>$1("handleAutoCountry"))):(this._setInitialState(!0),$1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),$1("rejectAutoCountryPromise")}))}_openDropdownWithPlus(){this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0)}_initTelInputListeners(){let{strictMode:e,formatAsYouType:n,separateDialCode:r,formatOnDisplay:a,allowDropdown:l,countrySearch:p}=this.options,y=!1;/\p{L}/u.test(this.telInput.value)&&(y=!0),this._handleInputEvent=C=>{if(this.isAndroid&&C?.data==="+"&&r&&l&&p){let w=this.telInput.selectionStart||0,O=this.telInput.value.substring(0,w-1),M=this.telInput.value.substring(w);this.telInput.value=O+M,this._openDropdownWithPlus();return}this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let S=C?.data&&/[^+0-9]/.test(C.data),I=C?.inputType==="insertFromPaste"&&this.telInput.value;S||I&&!e?y=!0:/[^+0-9]/.test(this.telInput.value)||(y=!1);let _=C?.detail&&C.detail.isSetNumber&&!a;if(n&&!y&&!_){let w=this.telInput.selectionStart||0,M=this.telInput.value.substring(0,w).replace(/[^+0-9]/g,"").length,k=C?.inputType==="deleteContentForward",z=this._formatNumberAsYouType(),Z=K2(M,z,w,k);this.telInput.value=z,this.telInput.setSelectionRange(Z,Z)}},this.telInput.addEventListener("input",this._handleInputEvent),(e||r)&&(this._handleKeydownEvent=C=>{if(C.key&&C.key.length===1&&!C.altKey&&!C.ctrlKey&&!C.metaKey){if(r&&l&&p&&C.key==="+"){C.preventDefault(),this._openDropdownWithPlus();return}if(e){let S=this.telInput.value,I=S.charAt(0)==="+",_=!I&&this.telInput.selectionStart===0&&C.key==="+",w=/^[0-9]$/.test(C.key),O=r?w:_||w,M=S.slice(0,this.telInput.selectionStart)+C.key+S.slice(this.telInput.selectionEnd),k=this._getFullNumber(M),z=m.utils.getCoreNumber(k,this.selectedCountryData.iso2),Z=this.maxCoreNumberLength&&z.length>this.maxCoreNumberLength,n1=!1;if(I){let f1=this.selectedCountryData.iso2;n1=this._getCountryFromNumber(k)!==f1}(!O||Z&&!n1&&!_)&&C.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(e){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&e.length>n?e.substr(0,n):e}_trigger(e,n={}){let r=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});this.telInput.dispatchEvent(r)}_openDropdown(){let{fixDropdownWidth:e,countrySearch:n}=this.options;if(e&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),n){let r=this.countryList.firstElementChild;r&&(this._highlightListItem(r,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let e=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${e.top+n}px`,this.dropdown.style.left=`${e.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=a=>{let l=a.target?.closest(".iti__country");l&&this._highlightListItem(l,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=a=>{let l=a.target?.closest(".iti__country");l&&this._selectListItem(l)},this.countryList.addEventListener("click",this._handleClickCountryList);let e=!0;this._handleClickOffToClose=()=>{e||this._closeDropdown(),e=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let n="",r=null;if(this._handleKeydownOnDropdown=a=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(a.key)&&(a.preventDefault(),a.stopPropagation(),a.key==="ArrowUp"||a.key==="ArrowDown"?this._handleUpDownKey(a.key):a.key==="Enter"?this._handleEnterKey():a.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(a.key)&&(a.stopPropagation(),r&&clearTimeout(r),n+=a.key.toLowerCase(),this._searchForCountry(n),r=setTimeout(()=>{n=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let a=()=>{let p=this.searchInput.value.trim();p?this._filterCountries(p):this._filterCountries("",!0)},l=null;this._handleSearchChange=()=>{l&&clearTimeout(l),l=setTimeout(()=>{a(),l=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",p=>p.stopPropagation())}}_searchForCountry(e){for(let n=0;nI[0]).join("").toLowerCase(),S=`+${p.dialCode}`;if(n||y.includes(a)||S.includes(a)||p.iso2.includes(a)||C.includes(a)){let I=p.nodeById[this.id];I&&this.countryList.appendChild(I),r&&(this._highlightListItem(I,!1),r=!1)}}r&&this._highlightListItem(null,!1),this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:e}=this.options,n=this.countryList.childElementCount,r;n===0?r=e.zeroSearchResults:n===1?r=e.oneSearchResult:r=e.multipleSearchResults.replace("${count}",n.toString()),this.searchResultsA11yText.textContent=r}_handleUpDownKey(e){let n=e==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!n&&this.countryList.childElementCount>1&&(n=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(e){let n=e;if(this.options.formatOnDisplay&&m.utils&&this.selectedCountryData){let r=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:a,INTERNATIONAL:l}=m.utils.numberFormat,p=r?a:l;n=m.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber(e){let n=this._getCountryFromNumber(e);return n!==null?this._setCountry(n):!1}_getCountryFromNumber(e){let n=e.indexOf("+"),r=n?e.substring(n):e,a=this.selectedCountryData.dialCode;r&&a==="1"&&r.charAt(0)!=="+"&&(r.charAt(0)!=="1"&&(r=`1${r}`),r=`+${r}`),this.options.separateDialCode&&a&&r.charAt(0)!=="+"&&(r=`+${a}${r}`);let p=this._getDialCode(r,!0),y=p1(r);if(p){let C=this.dialCodeToIso2Map[p1(p)],S=C.indexOf(this.selectedCountryData.iso2)!==-1&&y.length<=p.length-1;if(!(a==="1"&&h2(y))&&!S){for(let _=0;_p){let _=a-y;n.scrollTop=I-_}}_updateDialCode(e){let n=this.telInput.value,r=`+${e}`,a;if(n.charAt(0)==="+"){let l=this._getDialCode(n);l?a=n.replace(l,r):a=r,this.telInput.value=a}}_getDialCode(e,n){let r="";if(e.charAt(0)==="+"){let a="";for(let l=0;l-1){let r=e.substring(0,n),a=this._utilsIsPossibleNumber(r),l=this._utilsIsPossibleNumber(e);return a&&l}return this._utilsIsPossibleNumber(e)}_utilsIsPossibleNumber(e){return m.utils?m.utils.isPossibleNumber(e,this.selectedCountryData.iso2,this.options.validationNumberType):null}isValidNumberPrecise(){if(!this.selectedCountryData.iso2)return!1;let e=this._getFullNumber(),n=e.search(/\p{L}/u);if(n>-1){let r=e.substring(0,n),a=this._utilsIsValidNumber(r),l=this._utilsIsValidNumber(e);return a&&l}return this._utilsIsValidNumber(e)}_utilsIsValidNumber(e){return m.utils?m.utils.isValidNumber(e,this.selectedCountryData.iso2):null}setCountry(e){let n=e?.toLowerCase(),r=this.selectedCountryData.iso2;(e&&n!==r||!e&&r)&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(e){let n=this._updateCountryFromNumber(e);this._updateValFromNumber(e),n&&this._triggerCountryChange(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(e){this.options.placeholderNumberType=e,this._updatePlaceholder()}setDisabled(e){this.telInput.disabled=e,e?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},V2=f=>{if(!m.utils&&!m.startedLoadingUtilsScript){let e;if(typeof f=="string")e=Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));else if(typeof f=="function")try{if(e=f(),!(e instanceof Promise))throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof e}`)}catch(n){return Promise.reject(n)}else return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof f}`));return m.startedLoadingUtilsScript=!0,e.then(n=>{let r=n?.default;if(!r||typeof r!="object")throw typeof f=="string"?new TypeError(`The module loaded from ${f} did not set utils as its default export.`):new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");return m.utils=r,$1("handleUtils"),!0}).catch(n=>{throw $1("rejectUtilsScriptPromise",n),n})}return null},m=Object.assign((f,e)=>{let n=new b1(f,e);return n._init(),f.setAttribute("data-intl-tel-input-id",n.id.toString()),m.instances[n.id]=n,n},{defaults:c2,documentReady:()=>document.readyState==="complete",getCountryData:()=>K,getInstance:f=>{let e=f.getAttribute("data-intl-tel-input-id");return e?m.instances[e]:null},instances:{},loadUtils:V2,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"24.5.2"}),S1=m;(function(){var f=this||self;function e(d,t){d=d.split(".");var $=f;d[0]in $||typeof $.execScript>"u"||$.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?$[i]&&$[i]!==Object.prototype[i]?$=$[i]:$=$[i]={}:$[i]=t}function n(d,t){function $(){}$.prototype=t.prototype,d.ma=t.prototype,d.prototype=new $,d.prototype.constructor=d,d.sa=function(i,o,s){for(var u=Array(arguments.length-2),h=2;hd.length?!1:B(L2,d)}function B1(d){return B(b2,d)?s1(d,C2):s1(d,m1)}function G1(d){var t=B1(d.toString());x(d),d.g(t)}function U1(d){return d!=null&&(U(d,9)!=1||A(d,9)[0]!=-1)}function s1(d,t){for(var $=new L,i,o=d.length,s=0;st?2:s[s.length-1]=o&&o<=i;++o)if($=parseInt(d.substring(0,o),10),$ in X)return t.g(d.substring(o)),$;return 0}function W1(d,t,$,i,o,s){if(t.length==0)return 0;t=new L(t);var u;$!=null&&(u=c($,11)),u==null&&(u="NonMatch");var h=t.toString();if(h.length==0)u=20;else if(Q.test(h))h=h.replace(Q,""),x(t),t.g(B1(h)),u=1;else{if(h=new RegExp(u),G1(t),u=t.toString(),u.search(h)==0){h=u.match(h)[0].length;var g=u.substring(h).match(x1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=j1(t,i),d!=0)return E(s,1,d),d;throw Error("Invalid country calling code")}return $!=null&&(u=v($,10),h=""+u,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new L(g.substring(h.length)),g=c($,1),g=new RegExp(v(g,2)),z1(h,$,null),h=h.toString(),!B(g,t.toString())&&B(g,h)||l1(d,t.toString(),$,-1)==3))?(i.g(h),o&&E(s,6,10),E(s,1,u),u):(E(s,1,0),0)}function z1(d,t,$){var i=d.toString(),o=i.length,s=c(t,15);if(o!=0&&s!=null&&s.length!=0){var u=new RegExp("^(?:"+s+")");if(o=u.exec(i)){s=new RegExp(v(c(t,1),2));var h=B(s,i),g=o.length-1;t=c(t,16),t==null||t.length==0||o[g]==null||o[g].length==0?(!h||B(s,i.substring(o[0].length)))&&($!=null&&0=t.length)s="";else{var u=t.indexOf(";",s);s=u!==-1?t.substring(s,u):t.substring(s)}var h=s;if(h==null?u=!0:h.length===0?u=!1:(u=S2.exec(h),h=w2.exec(h),u=u!==null||h!==null),!u||(s!=null?(s.charAt(0)==="+"&&o.g(s),s=t.indexOf("tel:"),o.g(t.substring(0<=s?s+4:0,t.indexOf(";phone-context=")))):(s=o.g,u=t??"",h=u.search(v2),0<=h?(u=u.substring(h),u=u.replace(_2,""),h=u.search(I2),0<=h&&(u=u.substring(0,h))):u="",s.call(o,u)),s=o.toString(),u=s.indexOf(";isub="),0t.h.length||(u!=null&&($=new L,o=new L(t.toString()),z1(o,u,$),d=l1(d,o.toString(),u,-1),d!=2&&d!=4&&d!=5&&(t=o,i&&0<$.toString().length&&E(s,7,$.toString()))),i=t.toString(),d=i.length,2>d))throw Error("The string supplied is too short to be a phone number");if(17{try{let $=d.replace(/[^+0-9]/g,""),i=new N2(t);t="";for(let o=0;o<$.length;o++)i.ja=M2(i,$.charAt(o)),t=i.ja;return t}catch{return d}}),e("intlTelInputUtilsTemp.formatNumber",(d,t,$)=>{try{let o=N.g(),s=W(o,d,t);var i=J(o,s,-1);return i==0||i==4?o.format(s,typeof $>"u"?0:$):d}catch{return d}}),e("intlTelInputUtilsTemp.getExampleNumber",(d,t,$,i)=>{try{let g=N.g();d:{var o=g;if(a1(d)){var s=u1(F(o,d),$);try{if(P(s,6)){var u=c(s,6),h=Z1(o,u,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),e("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(W(N.g(),d,t),3)}catch{return""}}),e("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let u=N.g(),h=W(u,d,t);var $=K1(u,h),i=d1(u,v(h,1),$);if(i==null)var o=-1;else{var s=t1(h);o=C1(s,i)}return o}catch{return-99}}),e("intlTelInputUtilsTemp.getValidationError",(d,t)=>{if(!t)return 1;try{let $=N.g(),i=W($,d,t);return J($,i,-1)}catch($){return $.message==="Invalid country calling code"?1:3>=d.length||$.message==="Phone number too short after IDD"||$.message==="The string supplied is too short to be a phone number"?2:$.message==="The string supplied is too long to be a phone number"?3:-99}}),e("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=N.g();var $=W(g,d,t),i=K1(g,$);d=g;var o=v($,1),s=d1(d,o,i);if(s==null||i!="001"&&o!=V1(d,i))var u=!1;else{var h=t1($);u=C1(h,s)!=-1}return u}catch{return!1}}),e("intlTelInputUtilsTemp.isPossibleNumber",(d,t,$)=>{try{let i=N.g(),o=W(i,d,t);if($){let s=J(i,o,c1[$])===0;if($==="FIXED_LINE_OR_MOBILE"){let u=J(i,o,c1.MOBILE)===0,h=J(i,o,c1.FIXED_LINE)===0;return u||h||s}return s}return J(i,o,-1)===0}catch{return!1}}),e("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(W(N.g(),d,t),2).toString()}catch{return""}}),e("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),e("intlTelInputUtilsTemp.numberType",c1),e("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var j2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var p2=j2;S1.utils=p2;var W2=S1;return k2(z2);})();
// UMD
return factoryOutput.default;
diff --git a/demo.html b/demo.html
index 3554b5d76..2f454c371 100644
--- a/demo.html
+++ b/demo.html
@@ -50,7 +50,7 @@ International Telephone Input
// separateDialCode: true,
// strictMode: true,
// useFullscreenPopup: true,
- // utilsScript: "/build/js/utils.js", // leading slash (and http-server) required for this to work in chrome
+ // loadUtilsOnInit: "/build/js/utils.js", // leading slash (and http-server) required for this to work in chrome
// validationNumberType: null,
});
window.iti = iti; // useful for testing
diff --git a/grunt/connect.js b/grunt/connect.js
new file mode 100644
index 000000000..82940dac5
--- /dev/null
+++ b/grunt/connect.js
@@ -0,0 +1,7 @@
+module.exports = function(grunt) {
+ return {
+ test: {
+ port: 8000
+ }
+ };
+};
diff --git a/grunt/jasmine.js b/grunt/jasmine.js
index e83a3fd8a..a0a7a489c 100644
--- a/grunt/jasmine.js
+++ b/grunt/jasmine.js
@@ -12,7 +12,8 @@ module.exports = function(grunt) {
specs: 'src/spec/tests/**/*.js',
styles: "build/css/intlTelInput.css", //* Required so adding "hide" class actually works etc.
outfile: 'spec.html',
- keepRunner: true
+ keepRunner: true,
+ host: 'http://localhost:8000/'
}
};
};
diff --git a/grunt/replace.js b/grunt/replace.js
index 5bff990aa..85e43eacb 100644
--- a/grunt/replace.js
+++ b/grunt/replace.js
@@ -346,8 +346,8 @@ module.exports = function(grunt) {
options: {
patterns: [
{
- match: /import\(/,
- replacement: 'import_INTENTIONALLY_BROKEN('
+ match: /import\([^)]*\)/,
+ replacement: 'Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"))'
}
]
},
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 000000000..4bd58beb7
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,24 @@
+/** @type {import('jest').Config} */
+module.exports = {
+ moduleDirectories: [
+ "node_modules",
+ "build/js",
+ ],
+ transform: {
+ // Most of the build outputs in this project use UMD syntax, but the
+ // utilities script is a proper ES Module. Unfortunately, Jest cannot treat
+ // a file with a `.js` extension as ESM unless the whole project is ESM
+ // (Jest does not use Node.js built-in resolution and loading logic), so
+ // we have to set up special parsing for that file.
+ // See also: https://jestjs.io/docs/next/ecmascript-modules
+ "utils.js$": [
+ "babel-jest",
+ {
+ plugins: [
+ "@babel/plugin-transform-modules-commonjs",
+ "babel-plugin-add-module-exports",
+ ],
+ },
+ ],
+ },
+};
diff --git a/package-lock.json b/package-lock.json
index 6fd5077a8..b1be2d011 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,9 +6,10 @@
"packages": {
"": {
"name": "intl-tel-input",
- "version": "24.5.0",
+ "version": "24.5.2",
"license": "MIT",
"devDependencies": {
+ "@babel/plugin-transform-modules-commonjs": "^7.25.7",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.2.74",
@@ -16,6 +17,7 @@
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@vitejs/plugin-vue": "^5.1.2",
+ "babel-plugin-add-module-exports": "^1.0.4",
"cspell": "^8.6.1",
"esbuild": "^0.23.0",
"eslint": "^8.57.0",
@@ -31,6 +33,7 @@
"grunt": "^1.6.1",
"grunt-bump": "^0.8.0",
"grunt-cli": "^1.2.0",
+ "grunt-contrib-connect": "^5.0.0",
"grunt-contrib-cssmin": "^5.0.0",
"grunt-contrib-jasmine": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
@@ -82,12 +85,12 @@
}
},
"node_modules/@babel/code-frame": {
- "version": "7.24.2",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz",
- "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.7.tgz",
+ "integrity": "sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==",
"dev": true,
"dependencies": {
- "@babel/highlight": "^7.24.2",
+ "@babel/highlight": "^7.25.7",
"picocolors": "^1.0.0"
},
"engines": {
@@ -172,15 +175,15 @@
}
},
"node_modules/@babel/generator": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.5.tgz",
- "integrity": "sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.7.tgz",
+ "integrity": "sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==",
"dev": true,
"dependencies": {
- "@babel/types": "^7.24.5",
+ "@babel/types": "^7.25.7",
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25",
- "jsesc": "^2.5.1"
+ "jsesc": "^3.0.2"
},
"engines": {
"node": ">=6.9.0"
@@ -226,63 +229,29 @@
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"dev": true
},
- "node_modules/@babel/helper-environment-visitor": {
- "version": "7.22.20",
- "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
- "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
- "dev": true,
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-function-name": {
- "version": "7.23.0",
- "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz",
- "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==",
- "dev": true,
- "dependencies": {
- "@babel/template": "^7.22.15",
- "@babel/types": "^7.23.0"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-hoist-variables": {
- "version": "7.22.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz",
- "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==",
- "dev": true,
- "dependencies": {
- "@babel/types": "^7.22.5"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
"node_modules/@babel/helper-module-imports": {
- "version": "7.24.3",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz",
- "integrity": "sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.7.tgz",
+ "integrity": "sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==",
"dev": true,
"dependencies": {
- "@babel/types": "^7.24.0"
+ "@babel/traverse": "^7.25.7",
+ "@babel/types": "^7.25.7"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-module-transforms": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.5.tgz",
- "integrity": "sha512-9GxeY8c2d2mdQUP1Dye0ks3VDyIMS98kt/llQ2nUId8IsWqTF0l1LkSX0/uP7l7MCDrzXS009Hyhe2gzTiGW8A==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.7.tgz",
+ "integrity": "sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ==",
"dev": true,
"dependencies": {
- "@babel/helper-environment-visitor": "^7.22.20",
- "@babel/helper-module-imports": "^7.24.3",
- "@babel/helper-simple-access": "^7.24.5",
- "@babel/helper-split-export-declaration": "^7.24.5",
- "@babel/helper-validator-identifier": "^7.24.5"
+ "@babel/helper-module-imports": "^7.25.7",
+ "@babel/helper-simple-access": "^7.25.7",
+ "@babel/helper-validator-identifier": "^7.25.7",
+ "@babel/traverse": "^7.25.7"
},
"engines": {
"node": ">=6.9.0"
@@ -292,51 +261,40 @@
}
},
"node_modules/@babel/helper-plugin-utils": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.5.tgz",
- "integrity": "sha512-xjNLDopRzW2o6ba0gKbkZq5YWEBaK3PCyTOY1K2P/O07LGMhMqlMXPxwN4S5/RhWuCobT8z0jrlKGlYmeR1OhQ==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.7.tgz",
+ "integrity": "sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-simple-access": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.5.tgz",
- "integrity": "sha512-uH3Hmf5q5n7n8mz7arjUlDOCbttY/DW4DYhE6FUsjKJ/oYC1kQQUvwEQWxRwUpX9qQKRXeqLwWxrqilMrf32sQ==",
- "dev": true,
- "dependencies": {
- "@babel/types": "^7.24.5"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@babel/helper-split-export-declaration": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz",
- "integrity": "sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.25.7.tgz",
+ "integrity": "sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==",
"dev": true,
"dependencies": {
- "@babel/types": "^7.24.5"
+ "@babel/traverse": "^7.25.7",
+ "@babel/types": "^7.25.7"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-string-parser": {
- "version": "7.24.8",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz",
- "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz",
+ "integrity": "sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
- "version": "7.24.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz",
- "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz",
+ "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==",
"dev": true,
"engines": {
"node": ">=6.9.0"
@@ -366,12 +324,12 @@
}
},
"node_modules/@babel/highlight": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz",
- "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.7.tgz",
+ "integrity": "sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==",
"dev": true,
"dependencies": {
- "@babel/helper-validator-identifier": "^7.24.5",
+ "@babel/helper-validator-identifier": "^7.25.7",
"chalk": "^2.4.2",
"js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
@@ -419,12 +377,12 @@
}
},
"node_modules/@babel/parser": {
- "version": "7.25.3",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz",
- "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.7.tgz",
+ "integrity": "sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==",
"dev": true,
"dependencies": {
- "@babel/types": "^7.25.2"
+ "@babel/types": "^7.25.7"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -610,6 +568,23 @@
"@babel/core": "^7.0.0-0"
}
},
+ "node_modules/@babel/plugin-transform-modules-commonjs": {
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.25.7.tgz",
+ "integrity": "sha512-L9Gcahi0kKFYXvweO6n0wc3ZG1ChpSFdgG+eV1WYZ3/dGbJK7vvk91FgGgak8YwRgrCuihF8tE/Xg07EkL5COg==",
+ "dev": true,
+ "dependencies": {
+ "@babel/helper-module-transforms": "^7.25.7",
+ "@babel/helper-plugin-utils": "^7.25.7",
+ "@babel/helper-simple-access": "^7.25.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
"node_modules/@babel/runtime": {
"version": "7.24.5",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.5.tgz",
@@ -624,33 +599,30 @@
}
},
"node_modules/@babel/template": {
- "version": "7.24.0",
- "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz",
- "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.7.tgz",
+ "integrity": "sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==",
"dev": true,
"dependencies": {
- "@babel/code-frame": "^7.23.5",
- "@babel/parser": "^7.24.0",
- "@babel/types": "^7.24.0"
+ "@babel/code-frame": "^7.25.7",
+ "@babel/parser": "^7.25.7",
+ "@babel/types": "^7.25.7"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/traverse": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.5.tgz",
- "integrity": "sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.7.tgz",
+ "integrity": "sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==",
"dev": true,
"dependencies": {
- "@babel/code-frame": "^7.24.2",
- "@babel/generator": "^7.24.5",
- "@babel/helper-environment-visitor": "^7.22.20",
- "@babel/helper-function-name": "^7.23.0",
- "@babel/helper-hoist-variables": "^7.22.5",
- "@babel/helper-split-export-declaration": "^7.24.5",
- "@babel/parser": "^7.24.5",
- "@babel/types": "^7.24.5",
+ "@babel/code-frame": "^7.25.7",
+ "@babel/generator": "^7.25.7",
+ "@babel/parser": "^7.25.7",
+ "@babel/template": "^7.25.7",
+ "@babel/types": "^7.25.7",
"debug": "^4.3.1",
"globals": "^11.1.0"
},
@@ -685,13 +657,13 @@
}
},
"node_modules/@babel/types": {
- "version": "7.25.2",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz",
- "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.7.tgz",
+ "integrity": "sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==",
"dev": true,
"dependencies": {
- "@babel/helper-string-parser": "^7.24.8",
- "@babel/helper-validator-identifier": "^7.24.7",
+ "@babel/helper-string-parser": "^7.25.7",
+ "@babel/helper-validator-identifier": "^7.25.7",
"to-fast-properties": "^2.0.0"
},
"engines": {
@@ -4565,6 +4537,19 @@
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"dev": true
},
+ "node_modules/accepts": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+ "dev": true,
+ "dependencies": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/acorn": {
"version": "8.11.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
@@ -5057,6 +5042,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/async": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
+ "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+ "dev": true
+ },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@@ -5169,6 +5160,12 @@
"node": ">=8"
}
},
+ "node_modules/babel-plugin-add-module-exports": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.4.tgz",
+ "integrity": "sha512-g+8yxHUZ60RcyaUpfNzy56OtWW+x9cyEe9j+CranqLiqbju2yf/Cy6ZtYK40EZxtrdHllzlVZgLmcOUCTlJ7Jg==",
+ "dev": true
+ },
"node_modules/babel-plugin-istanbul": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz",
@@ -5290,6 +5287,24 @@
}
]
},
+ "node_modules/basic-auth": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
+ "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "5.1.2"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/batch": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
+ "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==",
+ "dev": true
+ },
"node_modules/body": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/body/-/body-5.1.0.tgz",
@@ -5961,6 +5976,45 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
+ "node_modules/connect": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz",
+ "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==",
+ "dev": true,
+ "dependencies": {
+ "debug": "2.6.9",
+ "finalhandler": "1.1.2",
+ "parseurl": "~1.3.3",
+ "utils-merge": "1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
+ "node_modules/connect-livereload": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/connect-livereload/-/connect-livereload-0.6.1.tgz",
+ "integrity": "sha512-3R0kMOdL7CjJpU66fzAkCe6HNtd3AavCS4m+uW4KtJjrdGPT0SQEZieAYd+cm+lJoBznNQ4lqipYWkhBMgk00g==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/connect/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/connect/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ },
"node_modules/console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
@@ -6637,6 +6691,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/define-lazy-prop": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
+ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/define-properties": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
@@ -6669,6 +6732,15 @@
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
"dev": true
},
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/dequal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
@@ -6678,6 +6750,16 @@
"node": ">=6"
}
},
+ "node_modules/destroy": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
"node_modules/detect-file": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
@@ -6788,6 +6870,12 @@
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"dev": true
},
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "dev": true
+ },
"node_modules/electron-to-chromium": {
"version": "1.4.774",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.774.tgz",
@@ -6806,6 +6894,15 @@
"url": "https://github.com/sindresorhus/emittery?sponsor=1"
}
},
+ "node_modules/encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
@@ -7090,6 +7187,12 @@
"node": ">=6"
}
},
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "dev": true
+ },
"node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -7830,6 +7933,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/eventemitter2": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
@@ -8069,6 +8181,39 @@
"node": ">=8"
}
},
+ "node_modules/finalhandler": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
+ "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
+ "dev": true,
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "statuses": "~1.5.0",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/finalhandler/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/finalhandler/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ },
"node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
@@ -8339,6 +8484,15 @@
"node": ">= 8"
}
},
+ "node_modules/fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
@@ -8947,6 +9101,26 @@
"node": ">=6"
}
},
+ "node_modules/grunt-contrib-connect": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/grunt-contrib-connect/-/grunt-contrib-connect-5.0.0.tgz",
+ "integrity": "sha512-5bnw/5h8p4P+9EYgFAPKExlNzY1U2/FQSsNlbZmXwbS5l2SyzLwyDqpXKma9RFi2y4s+3IC0ShjE1hJkzuhp4w==",
+ "dev": true,
+ "dependencies": {
+ "async": "^3.2.5",
+ "connect": "^3.7.0",
+ "connect-livereload": "^0.6.1",
+ "http2-wrapper": "^2.2.1",
+ "morgan": "^1.10.0",
+ "open": "^8.0.0",
+ "portscanner": "^2.2.0",
+ "serve-index": "^1.9.1",
+ "serve-static": "^1.15.0"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
"node_modules/grunt-contrib-cssmin": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/grunt-contrib-cssmin/-/grunt-contrib-cssmin-5.0.0.tgz",
@@ -9426,12 +9600,6 @@
"node": ">=10"
}
},
- "node_modules/grunt-legacy-util/node_modules/async": {
- "version": "3.2.5",
- "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz",
- "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==",
- "dev": true
- },
"node_modules/grunt-legacy-util/node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -9748,7 +9916,7 @@
"node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"engines": {
"node": ">=4"
@@ -9871,6 +10039,36 @@
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
+ "node_modules/http-errors": {
+ "version": "1.6.3",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
+ "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==",
+ "dev": true,
+ "dependencies": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.0",
+ "statuses": ">= 1.4.0 < 2"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/http-errors/node_modules/depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/http-errors/node_modules/inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==",
+ "dev": true
+ },
"node_modules/http-parser-js": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz",
@@ -9908,6 +10106,19 @@
}
}
},
+ "node_modules/http2-wrapper": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz",
+ "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==",
+ "dev": true,
+ "dependencies": {
+ "quick-lru": "^5.1.1",
+ "resolve-alpn": "^1.2.0"
+ },
+ "engines": {
+ "node": ">=10.19.0"
+ }
+ },
"node_modules/https-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
@@ -10325,6 +10536,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true,
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -10442,6 +10668,15 @@
"node": ">=0.12.0"
}
},
+ "node_modules/is-number-like": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/is-number-like/-/is-number-like-1.0.8.tgz",
+ "integrity": "sha512-6rZi3ezCyFcn5L71ywzz2bS5b2Igl1En3eTlZlvKjpz1n3IZLAYMbKYAIQgFmEu0GENg92ziU/faEOA/aixjbA==",
+ "dev": true,
+ "dependencies": {
+ "lodash.isfinite": "^3.3.2"
+ }
+ },
"node_modules/is-number-object": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz",
@@ -10645,6 +10880,18 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "dependencies": {
+ "is-docker": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -13050,15 +13297,15 @@
}
},
"node_modules/jsesc": {
- "version": "2.5.2",
- "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
- "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz",
+ "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==",
"dev": true,
"bin": {
"jsesc": "bin/jsesc"
},
"engines": {
- "node": ">=4"
+ "node": ">=6"
}
},
"node_modules/json-parse-even-better-errors": {
@@ -13280,6 +13527,12 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
+ "node_modules/lodash.isfinite": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz",
+ "integrity": "sha512-7FGG40uhC8Mm633uKW1r58aElFlBlxCrg9JfSi3P6aYiWmfiWF0PgMd86ZUsxE5GwWPdHoS2+48bwTh2VPkIQA==",
+ "dev": true
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -13779,6 +14032,18 @@
"node": ">=8.6"
}
},
+ "node_modules/mime": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "dev": true,
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -14074,6 +14339,37 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
"dev": true
},
+ "node_modules/morgan": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
+ "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
+ "dev": true,
+ "dependencies": {
+ "basic-auth": "~2.0.1",
+ "debug": "2.6.9",
+ "depd": "~2.0.0",
+ "on-finished": "~2.3.0",
+ "on-headers": "~1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/morgan/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/morgan/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -14764,6 +15060,27 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==",
+ "dev": true,
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/on-headers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
+ "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -14788,6 +15105,23 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/open": {
+ "version": "8.4.2",
+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
+ "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
+ "dev": true,
+ "dependencies": {
+ "define-lazy-prop": "^2.0.0",
+ "is-docker": "^2.1.1",
+ "is-wsl": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/optional-require": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.1.8.tgz",
@@ -14994,6 +15328,15 @@
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -15206,6 +15549,29 @@
"node": ">=0.10.0"
}
},
+ "node_modules/portscanner": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/portscanner/-/portscanner-2.2.0.tgz",
+ "integrity": "sha512-IFroCz/59Lqa2uBvzK3bKDbDDIEaAY8XJ1jFxcLWTqosrsc32//P4VuSB2vZXoHiHqOmx8B5L5hnKOxL/7FlPw==",
+ "dev": true,
+ "dependencies": {
+ "async": "^2.6.0",
+ "is-number-like": "^1.0.3"
+ },
+ "engines": {
+ "node": ">=0.4",
+ "npm": ">=1.0.0"
+ }
+ },
+ "node_modules/portscanner/node_modules/async": {
+ "version": "2.6.4",
+ "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
+ "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
+ "dev": true,
+ "dependencies": {
+ "lodash": "^4.17.14"
+ }
+ },
"node_modules/possible-typed-array-names": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
@@ -15550,6 +15916,27 @@
}
]
},
+ "node_modules/quick-lru": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
+ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/raw-body": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz",
@@ -15928,6 +16315,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/resolve-alpn": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz",
+ "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==",
+ "dev": true
+ },
"node_modules/resolve-cwd": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz",
@@ -16094,9 +16487,9 @@
"dev": true
},
"node_modules/safe-buffer": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
- "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"node_modules/safe-json-parse": {
@@ -16190,6 +16583,151 @@
"semver": "bin/semver"
}
},
+ "node_modules/send": {
+ "version": "0.19.0",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
+ "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
+ "dev": true,
+ "dependencies": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "0.5.2",
+ "http-errors": "2.0.0",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "2.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/send/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/send/node_modules/debug/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ },
+ "node_modules/send/node_modules/http-errors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+ "dev": true,
+ "dependencies": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/send/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "node_modules/send/node_modules/on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "dev": true,
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/send/node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "dev": true
+ },
+ "node_modules/send/node_modules/statuses": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/serve-index": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
+ "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==",
+ "dev": true,
+ "dependencies": {
+ "accepts": "~1.3.4",
+ "batch": "0.6.1",
+ "debug": "2.6.9",
+ "escape-html": "~1.0.3",
+ "http-errors": "~1.6.2",
+ "mime-types": "~2.1.17",
+ "parseurl": "~1.3.2"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/serve-index/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/serve-index/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ },
+ "node_modules/serve-static": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
+ "dev": true,
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "0.19.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/serve-static/node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
@@ -16228,6 +16766,12 @@
"node": ">= 0.4"
}
},
+ "node_modules/setprototypeof": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
+ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==",
+ "dev": true
+ },
"node_modules/sharp": {
"version": "0.33.5",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz",
@@ -16591,6 +17135,15 @@
"node": ">=8"
}
},
+ "node_modules/statuses": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
+ "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@@ -17153,6 +17706,15 @@
"node": ">=8.0"
}
},
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@@ -17514,6 +18076,15 @@
"node": ">= 4.0.0"
}
},
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/update-browserslist-db": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
@@ -17569,6 +18140,15 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true
},
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
"node_modules/v8-to-istanbul": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz",
@@ -18630,12 +19210,12 @@
}
},
"@babel/code-frame": {
- "version": "7.24.2",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz",
- "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.7.tgz",
+ "integrity": "sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==",
"dev": true,
"requires": {
- "@babel/highlight": "^7.24.2",
+ "@babel/highlight": "^7.25.7",
"picocolors": "^1.0.0"
}
},
@@ -18692,15 +19272,15 @@
}
},
"@babel/generator": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.5.tgz",
- "integrity": "sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.7.tgz",
+ "integrity": "sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==",
"dev": true,
"requires": {
- "@babel/types": "^7.24.5",
+ "@babel/types": "^7.25.7",
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25",
- "jsesc": "^2.5.1"
+ "jsesc": "^3.0.2"
}
},
"@babel/helper-compilation-targets": {
@@ -18739,87 +19319,54 @@
}
}
},
- "@babel/helper-environment-visitor": {
- "version": "7.22.20",
- "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
- "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
- "dev": true
- },
- "@babel/helper-function-name": {
- "version": "7.23.0",
- "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz",
- "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==",
- "dev": true,
- "requires": {
- "@babel/template": "^7.22.15",
- "@babel/types": "^7.23.0"
- }
- },
- "@babel/helper-hoist-variables": {
- "version": "7.22.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz",
- "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==",
- "dev": true,
- "requires": {
- "@babel/types": "^7.22.5"
- }
- },
"@babel/helper-module-imports": {
- "version": "7.24.3",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz",
- "integrity": "sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.7.tgz",
+ "integrity": "sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==",
"dev": true,
"requires": {
- "@babel/types": "^7.24.0"
+ "@babel/traverse": "^7.25.7",
+ "@babel/types": "^7.25.7"
}
},
"@babel/helper-module-transforms": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.5.tgz",
- "integrity": "sha512-9GxeY8c2d2mdQUP1Dye0ks3VDyIMS98kt/llQ2nUId8IsWqTF0l1LkSX0/uP7l7MCDrzXS009Hyhe2gzTiGW8A==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.7.tgz",
+ "integrity": "sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ==",
"dev": true,
"requires": {
- "@babel/helper-environment-visitor": "^7.22.20",
- "@babel/helper-module-imports": "^7.24.3",
- "@babel/helper-simple-access": "^7.24.5",
- "@babel/helper-split-export-declaration": "^7.24.5",
- "@babel/helper-validator-identifier": "^7.24.5"
+ "@babel/helper-module-imports": "^7.25.7",
+ "@babel/helper-simple-access": "^7.25.7",
+ "@babel/helper-validator-identifier": "^7.25.7",
+ "@babel/traverse": "^7.25.7"
}
},
"@babel/helper-plugin-utils": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.5.tgz",
- "integrity": "sha512-xjNLDopRzW2o6ba0gKbkZq5YWEBaK3PCyTOY1K2P/O07LGMhMqlMXPxwN4S5/RhWuCobT8z0jrlKGlYmeR1OhQ==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.7.tgz",
+ "integrity": "sha512-eaPZai0PiqCi09pPs3pAFfl/zYgGaE6IdXtYvmf0qlcDTd3WCtO7JWCcRd64e0EQrcYgiHibEZnOGsSY4QSgaw==",
"dev": true
},
"@babel/helper-simple-access": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.5.tgz",
- "integrity": "sha512-uH3Hmf5q5n7n8mz7arjUlDOCbttY/DW4DYhE6FUsjKJ/oYC1kQQUvwEQWxRwUpX9qQKRXeqLwWxrqilMrf32sQ==",
- "dev": true,
- "requires": {
- "@babel/types": "^7.24.5"
- }
- },
- "@babel/helper-split-export-declaration": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz",
- "integrity": "sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.25.7.tgz",
+ "integrity": "sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==",
"dev": true,
"requires": {
- "@babel/types": "^7.24.5"
+ "@babel/traverse": "^7.25.7",
+ "@babel/types": "^7.25.7"
}
},
"@babel/helper-string-parser": {
- "version": "7.24.8",
- "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz",
- "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz",
+ "integrity": "sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==",
"dev": true
},
"@babel/helper-validator-identifier": {
- "version": "7.24.7",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz",
- "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz",
+ "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==",
"dev": true
},
"@babel/helper-validator-option": {
@@ -18840,12 +19387,12 @@
}
},
"@babel/highlight": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz",
- "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.7.tgz",
+ "integrity": "sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==",
"dev": true,
"requires": {
- "@babel/helper-validator-identifier": "^7.24.5",
+ "@babel/helper-validator-identifier": "^7.25.7",
"chalk": "^2.4.2",
"js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
@@ -18883,12 +19430,12 @@
}
},
"@babel/parser": {
- "version": "7.25.3",
- "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz",
- "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.7.tgz",
+ "integrity": "sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==",
"dev": true,
"requires": {
- "@babel/types": "^7.25.2"
+ "@babel/types": "^7.25.7"
}
},
"@babel/plugin-syntax-async-generators": {
@@ -19017,6 +19564,17 @@
"@babel/helper-plugin-utils": "^7.24.0"
}
},
+ "@babel/plugin-transform-modules-commonjs": {
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.25.7.tgz",
+ "integrity": "sha512-L9Gcahi0kKFYXvweO6n0wc3ZG1ChpSFdgG+eV1WYZ3/dGbJK7vvk91FgGgak8YwRgrCuihF8tE/Xg07EkL5COg==",
+ "dev": true,
+ "requires": {
+ "@babel/helper-module-transforms": "^7.25.7",
+ "@babel/helper-plugin-utils": "^7.25.7",
+ "@babel/helper-simple-access": "^7.25.7"
+ }
+ },
"@babel/runtime": {
"version": "7.24.5",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.5.tgz",
@@ -19028,30 +19586,27 @@
}
},
"@babel/template": {
- "version": "7.24.0",
- "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz",
- "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.7.tgz",
+ "integrity": "sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==",
"dev": true,
"requires": {
- "@babel/code-frame": "^7.23.5",
- "@babel/parser": "^7.24.0",
- "@babel/types": "^7.24.0"
+ "@babel/code-frame": "^7.25.7",
+ "@babel/parser": "^7.25.7",
+ "@babel/types": "^7.25.7"
}
},
"@babel/traverse": {
- "version": "7.24.5",
- "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.5.tgz",
- "integrity": "sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.7.tgz",
+ "integrity": "sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==",
"dev": true,
"requires": {
- "@babel/code-frame": "^7.24.2",
- "@babel/generator": "^7.24.5",
- "@babel/helper-environment-visitor": "^7.22.20",
- "@babel/helper-function-name": "^7.23.0",
- "@babel/helper-hoist-variables": "^7.22.5",
- "@babel/helper-split-export-declaration": "^7.24.5",
- "@babel/parser": "^7.24.5",
- "@babel/types": "^7.24.5",
+ "@babel/code-frame": "^7.25.7",
+ "@babel/generator": "^7.25.7",
+ "@babel/parser": "^7.25.7",
+ "@babel/template": "^7.25.7",
+ "@babel/types": "^7.25.7",
"debug": "^4.3.1",
"globals": "^11.1.0"
},
@@ -19074,13 +19629,13 @@
}
},
"@babel/types": {
- "version": "7.25.2",
- "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz",
- "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==",
+ "version": "7.25.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.7.tgz",
+ "integrity": "sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==",
"dev": true,
"requires": {
- "@babel/helper-string-parser": "^7.24.8",
- "@babel/helper-validator-identifier": "^7.24.7",
+ "@babel/helper-string-parser": "^7.25.7",
+ "@babel/helper-validator-identifier": "^7.25.7",
"to-fast-properties": "^2.0.0"
}
},
@@ -21825,6 +22380,16 @@
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"dev": true
},
+ "accepts": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+ "dev": true,
+ "requires": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ }
+ },
"acorn": {
"version": "8.11.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
@@ -22188,6 +22753,12 @@
"is-shared-array-buffer": "^1.0.2"
}
},
+ "async": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
+ "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+ "dev": true
+ },
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@@ -22269,6 +22840,12 @@
}
}
},
+ "babel-plugin-add-module-exports": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.4.tgz",
+ "integrity": "sha512-g+8yxHUZ60RcyaUpfNzy56OtWW+x9cyEe9j+CranqLiqbju2yf/Cy6ZtYK40EZxtrdHllzlVZgLmcOUCTlJ7Jg==",
+ "dev": true
+ },
"babel-plugin-istanbul": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz",
@@ -22357,6 +22934,21 @@
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"dev": true
},
+ "basic-auth": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
+ "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "5.1.2"
+ }
+ },
+ "batch": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
+ "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==",
+ "dev": true
+ },
"body": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/body/-/body-5.1.0.tgz",
@@ -22842,6 +23434,41 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
+ "connect": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz",
+ "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "finalhandler": "1.1.2",
+ "parseurl": "~1.3.3",
+ "utils-merge": "1.0.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ }
+ }
+ },
+ "connect-livereload": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/connect-livereload/-/connect-livereload-0.6.1.tgz",
+ "integrity": "sha512-3R0kMOdL7CjJpU66fzAkCe6HNtd3AavCS4m+uW4KtJjrdGPT0SQEZieAYd+cm+lJoBznNQ4lqipYWkhBMgk00g==",
+ "dev": true
+ },
"console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
@@ -23349,6 +23976,12 @@
"gopd": "^1.0.1"
}
},
+ "define-lazy-prop": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
+ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
+ "dev": true
+ },
"define-properties": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
@@ -23372,12 +24005,24 @@
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
"dev": true
},
+ "depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "dev": true
+ },
"dequal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
"dev": true
},
+ "destroy": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+ "dev": true
+ },
"detect-file": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
@@ -23462,6 +24107,12 @@
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"dev": true
},
+ "ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "dev": true
+ },
"electron-to-chromium": {
"version": "1.4.774",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.774.tgz",
@@ -23474,6 +24125,12 @@
"integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==",
"dev": true
},
+ "encodeurl": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
+ "dev": true
+ },
"encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
@@ -23709,6 +24366,12 @@
"integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
"dev": true
},
+ "escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "dev": true
+ },
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -24225,6 +24888,12 @@
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
+ "etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "dev": true
+ },
"eventemitter2": {
"version": "0.4.14",
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
@@ -24411,6 +25080,38 @@
"to-regex-range": "^5.0.1"
}
},
+ "finalhandler": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
+ "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "statuses": "~1.5.0",
+ "unpipe": "~1.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ }
+ }
+ },
"find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
@@ -24609,6 +25310,12 @@
}
}
},
+ "fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+ "dev": true
+ },
"fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
@@ -25102,6 +25809,23 @@
}
}
},
+ "grunt-contrib-connect": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/grunt-contrib-connect/-/grunt-contrib-connect-5.0.0.tgz",
+ "integrity": "sha512-5bnw/5h8p4P+9EYgFAPKExlNzY1U2/FQSsNlbZmXwbS5l2SyzLwyDqpXKma9RFi2y4s+3IC0ShjE1hJkzuhp4w==",
+ "dev": true,
+ "requires": {
+ "async": "^3.2.5",
+ "connect": "^3.7.0",
+ "connect-livereload": "^0.6.1",
+ "http2-wrapper": "^2.2.1",
+ "morgan": "^1.10.0",
+ "open": "^8.0.0",
+ "portscanner": "^2.2.0",
+ "serve-index": "^1.9.1",
+ "serve-static": "^1.15.0"
+ }
+ },
"grunt-contrib-cssmin": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/grunt-contrib-cssmin/-/grunt-contrib-cssmin-5.0.0.tgz",
@@ -25453,12 +26177,6 @@
"which": "~2.0.2"
},
"dependencies": {
- "async": {
- "version": "3.2.5",
- "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz",
- "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==",
- "dev": true
- },
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -25645,7 +26363,7 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true
},
"has-own-prop": {
@@ -25729,6 +26447,32 @@
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
+ "http-errors": {
+ "version": "1.6.3",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
+ "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==",
+ "dev": true,
+ "requires": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.3",
+ "setprototypeof": "1.1.0",
+ "statuses": ">= 1.4.0 < 2"
+ },
+ "dependencies": {
+ "depd": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
+ "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
+ "dev": true
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==",
+ "dev": true
+ }
+ }
+ },
"http-parser-js": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz",
@@ -25757,6 +26501,16 @@
}
}
},
+ "http2-wrapper": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz",
+ "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==",
+ "dev": true,
+ "requires": {
+ "quick-lru": "^5.1.1",
+ "resolve-alpn": "^1.2.0"
+ }
+ },
"https-proxy-agent": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
@@ -26056,6 +26810,12 @@
"has-tostringtag": "^1.0.0"
}
},
+ "is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true
+ },
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -26134,6 +26894,15 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
+ "is-number-like": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/is-number-like/-/is-number-like-1.0.8.tgz",
+ "integrity": "sha512-6rZi3ezCyFcn5L71ywzz2bS5b2Igl1En3eTlZlvKjpz1n3IZLAYMbKYAIQgFmEu0GENg92ziU/faEOA/aixjbA==",
+ "dev": true,
+ "requires": {
+ "lodash.isfinite": "^3.3.2"
+ }
+ },
"is-number-object": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz",
@@ -26265,6 +27034,15 @@
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
"dev": true
},
+ "is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "requires": {
+ "is-docker": "^2.0.0"
+ }
+ },
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -28047,9 +28825,9 @@
}
},
"jsesc": {
- "version": "2.5.2",
- "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
- "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz",
+ "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==",
"dev": true
},
"json-parse-even-better-errors": {
@@ -28229,6 +29007,12 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
+ "lodash.isfinite": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz",
+ "integrity": "sha512-7FGG40uhC8Mm633uKW1r58aElFlBlxCrg9JfSi3P6aYiWmfiWF0PgMd86ZUsxE5GwWPdHoS2+48bwTh2VPkIQA==",
+ "dev": true
+ },
"lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -28613,6 +29397,12 @@
"picomatch": "^2.3.1"
}
},
+ "mime": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "dev": true
+ },
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -28860,6 +29650,36 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
"dev": true
},
+ "morgan": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
+ "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
+ "dev": true,
+ "requires": {
+ "basic-auth": "~2.0.1",
+ "debug": "2.6.9",
+ "depd": "~2.0.0",
+ "on-finished": "~2.3.0",
+ "on-headers": "~1.0.2"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ }
+ }
+ },
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -29376,6 +30196,21 @@
"es-object-atoms": "^1.0.0"
}
},
+ "on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==",
+ "dev": true,
+ "requires": {
+ "ee-first": "1.1.1"
+ }
+ },
+ "on-headers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
+ "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
+ "dev": true
+ },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -29394,6 +30229,17 @@
"mimic-fn": "^2.1.0"
}
},
+ "open": {
+ "version": "8.4.2",
+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
+ "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
+ "dev": true,
+ "requires": {
+ "define-lazy-prop": "^2.0.0",
+ "is-docker": "^2.1.1",
+ "is-wsl": "^2.2.0"
+ }
+ },
"optional-require": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.1.8.tgz",
@@ -29550,6 +30396,12 @@
"entities": "^4.4.0"
}
},
+ "parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "dev": true
+ },
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -29708,6 +30560,27 @@
"integrity": "sha1-24XGgU9eXlo7Se/CjWBP7GKXUVY=",
"dev": true
},
+ "portscanner": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/portscanner/-/portscanner-2.2.0.tgz",
+ "integrity": "sha512-IFroCz/59Lqa2uBvzK3bKDbDDIEaAY8XJ1jFxcLWTqosrsc32//P4VuSB2vZXoHiHqOmx8B5L5hnKOxL/7FlPw==",
+ "dev": true,
+ "requires": {
+ "async": "^2.6.0",
+ "is-number-like": "^1.0.3"
+ },
+ "dependencies": {
+ "async": {
+ "version": "2.6.4",
+ "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
+ "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.14"
+ }
+ }
+ }
+ },
"possible-typed-array-names": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz",
@@ -29940,6 +30813,18 @@
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
"dev": true
},
+ "quick-lru": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
+ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==",
+ "dev": true
+ },
+ "range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "dev": true
+ },
"raw-body": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz",
@@ -30226,6 +31111,12 @@
"supports-preserve-symlinks-flag": "^1.0.0"
}
},
+ "resolve-alpn": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz",
+ "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==",
+ "dev": true
+ },
"resolve-cwd": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz",
@@ -30340,9 +31231,9 @@
}
},
"safe-buffer": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
- "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"safe-json-parse": {
@@ -30412,6 +31303,138 @@
"integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
"dev": true
},
+ "send": {
+ "version": "0.19.0",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
+ "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "0.5.2",
+ "http-errors": "2.0.0",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "2.0.1"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ },
+ "dependencies": {
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ }
+ }
+ },
+ "http-errors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+ "dev": true,
+ "requires": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ }
+ },
+ "ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "dev": true,
+ "requires": {
+ "ee-first": "1.1.1"
+ }
+ },
+ "setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "dev": true
+ },
+ "statuses": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
+ "dev": true
+ }
+ }
+ },
+ "serve-index": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
+ "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.4",
+ "batch": "0.6.1",
+ "debug": "2.6.9",
+ "escape-html": "~1.0.3",
+ "http-errors": "~1.6.2",
+ "mime-types": "~2.1.17",
+ "parseurl": "~1.3.2"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "dev": true
+ }
+ }
+ },
+ "serve-static": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
+ "dev": true,
+ "requires": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "0.19.0"
+ },
+ "dependencies": {
+ "encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "dev": true
+ }
+ }
+ },
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
@@ -30444,6 +31467,12 @@
"has-property-descriptors": "^1.0.2"
}
},
+ "setprototypeof": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
+ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==",
+ "dev": true
+ },
"sharp": {
"version": "0.33.5",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz",
@@ -30739,6 +31768,12 @@
}
}
},
+ "statuses": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
+ "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==",
+ "dev": true
+ },
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@@ -31181,6 +32216,12 @@
"is-number": "^7.0.0"
}
},
+ "toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "dev": true
+ },
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@@ -31451,6 +32492,12 @@
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
"dev": true
},
+ "unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "dev": true
+ },
"update-browserslist-db": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
@@ -31486,6 +32533,12 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true
},
+ "utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+ "dev": true
+ },
"v8-to-istanbul": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz",
diff --git a/package.json b/package.json
index 3e9c6811b..d6810d921 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"license": "MIT",
"author": "Jack O'Connor (http://jackocnr.com)",
"devDependencies": {
+ "@babel/plugin-transform-modules-commonjs": "^7.25.7",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.2.74",
@@ -31,6 +32,7 @@
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"@vitejs/plugin-vue": "^5.1.2",
+ "babel-plugin-add-module-exports": "^1.0.4",
"cspell": "^8.6.1",
"esbuild": "^0.23.0",
"eslint": "^8.57.0",
@@ -46,6 +48,7 @@
"grunt": "^1.6.1",
"grunt-bump": "^0.8.0",
"grunt-cli": "^1.2.0",
+ "grunt-contrib-connect": "^5.0.0",
"grunt-contrib-cssmin": "^5.0.0",
"grunt-contrib-jasmine": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
@@ -98,7 +101,8 @@
"build:img": "grunt img",
"build:react": "grunt react",
"build:vue": "grunt vue",
- "vue:demo": "vite --config vue/demo/validation/vite.config.js"
+ "vue:demo": "vite --config vue/demo/validation/vite.config.js",
+ "server": "grunt test:interactive"
},
"style": "build/css/intlTelInput.css",
"main": "./build/js/intlTelInput.js",
@@ -150,11 +154,5 @@
"react/build/IntlTelInput.d.ts"
]
}
- },
- "jest": {
- "moduleDirectories": [
- "node_modules",
- "build/js"
- ]
}
}
diff --git a/react/build/IntlTelInput.cjs b/react/build/IntlTelInput.cjs
index e10847a03..85ac48076 100644
--- a/react/build/IntlTelInput.cjs
+++ b/react/build/IntlTelInput.cjs
@@ -1659,6 +1659,8 @@ var defaults = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -1679,7 +1681,7 @@ var defaults = {
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1741,9 +1743,9 @@ var createEl = (name, attrs, container) => {
}
return el;
};
-var forEachInstance = (method) => {
+var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -2191,14 +2193,21 @@ var Iti = class {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -2783,6 +2792,9 @@ var Iti = class {
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -3071,22 +3083,43 @@ var Iti = class {
}
}
};
-var loadUtils = (path) => {
+var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils }) => {
- intlTelInput.utils = utils;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module2) => {
+ const utils = module2?.default;
+ if (!utils || typeof utils !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -3113,6 +3146,8 @@ var intlTelInput = Object.assign(
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/build/IntlTelInput.d.ts b/react/build/IntlTelInput.d.ts
index f8bcb2b5a..64a57b5d4 100644
--- a/react/build/IntlTelInput.d.ts
+++ b/react/build/IntlTelInput.d.ts
@@ -286,6 +286,9 @@ declare module "intl-tel-input/i18n/en" {
declare module "intl-tel-input" {
import { Country } from "intl-tel-input/data";
import { I18n } from "intl-tel-input/i18n/types";
+ type UtilsLoader = () => Promise<{
+ default: ItiUtils;
+ }>;
interface IntlTelInputInterface {
(input: HTMLInputElement, options?: SomeOptions): Iti;
autoCountry?: string;
@@ -296,9 +299,9 @@ declare module "intl-tel-input" {
instances: {
[key: string]: Iti;
};
- loadUtils: (path: string) => Promise | null;
- startedLoadingAutoCountry?: boolean;
- startedLoadingUtilsScript?: boolean;
+ loadUtils: (source: string | UtilsLoader) => Promise | null;
+ startedLoadingAutoCountry: boolean;
+ startedLoadingUtilsScript: boolean;
version: string | undefined;
utils?: ItiUtils;
}
@@ -345,6 +348,7 @@ declare module "intl-tel-input" {
}) | null;
i18n: I18n;
initialCountry: string;
+ loadUtilsOnInit: string | UtilsLoader;
nationalMode: boolean;
onlyCountries: string[];
placeholderNumberType: NumberType;
@@ -352,7 +356,8 @@ declare module "intl-tel-input" {
separateDialCode: boolean;
strictMode: boolean;
useFullscreenPopup: boolean;
- utilsScript: string;
+ /** @deprecated Please use the `loadUtilsOnInit` option. */
+ utilsScript: string | UtilsLoader;
validationNumberType: NumberType | null;
}
export type SomeOptions = Partial;
@@ -400,6 +405,7 @@ declare module "intl-tel-input" {
private _handleClickOffToClose;
private _handleKeydownOnDropdown;
private _handleSearchChange;
+ private _handlePageLoad;
private resolveAutoCountryPromise;
private rejectAutoCountryPromise;
private resolveUtilsScriptPromise;
diff --git a/react/build/IntlTelInput.js b/react/build/IntlTelInput.js
index 5dd3fd00f..36bbe4f15 100644
--- a/react/build/IntlTelInput.js
+++ b/react/build/IntlTelInput.js
@@ -1623,6 +1623,8 @@ var defaults = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -1643,7 +1645,7 @@ var defaults = {
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1705,9 +1707,9 @@ var createEl = (name, attrs, container) => {
}
return el;
};
-var forEachInstance = (method) => {
+var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -2155,14 +2157,21 @@ var Iti = class {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -2747,6 +2756,9 @@ var Iti = class {
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -3035,22 +3047,43 @@ var Iti = class {
}
}
};
-var loadUtils = (path) => {
+var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils }) => {
- intlTelInput.utils = utils;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module) => {
+ const utils = module?.default;
+ if (!utils || typeof utils !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -3077,6 +3110,8 @@ var intlTelInput = Object.assign(
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/build/IntlTelInputWithUtils.cjs b/react/build/IntlTelInputWithUtils.cjs
index fb695cbcc..061b6b20d 100644
--- a/react/build/IntlTelInputWithUtils.cjs
+++ b/react/build/IntlTelInputWithUtils.cjs
@@ -1659,6 +1659,8 @@ var defaults = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -1679,7 +1681,7 @@ var defaults = {
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1741,9 +1743,9 @@ var createEl = (name, attrs, container) => {
}
return el;
};
-var forEachInstance = (method) => {
+var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -2191,14 +2193,21 @@ var Iti = class {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -2783,6 +2792,9 @@ var Iti = class {
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -3071,22 +3083,39 @@ var Iti = class {
}
}
};
-var loadUtils = (path) => {
+var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import_INTENTIONALLY_BROKEN(
- /* webpackIgnore: true */
- /* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ return loadCall.then((module2) => {
+ const utils2 = module2?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -3113,6 +3142,8 @@ var intlTelInput = Object.assign(
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/build/IntlTelInputWithUtils.js b/react/build/IntlTelInputWithUtils.js
index fa4c0e0f6..117047a2f 100644
--- a/react/build/IntlTelInputWithUtils.js
+++ b/react/build/IntlTelInputWithUtils.js
@@ -1623,6 +1623,8 @@ var defaults = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -1643,7 +1645,7 @@ var defaults = {
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1705,9 +1707,9 @@ var createEl = (name, attrs, container) => {
}
return el;
};
-var forEachInstance = (method) => {
+var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -2155,14 +2157,21 @@ var Iti = class {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -2747,6 +2756,9 @@ var Iti = class {
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -3035,22 +3047,39 @@ var Iti = class {
}
}
};
-var loadUtils = (path) => {
+var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import_INTENTIONALLY_BROKEN(
- /* webpackIgnore: true */
- /* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ return loadCall.then((module) => {
+ const utils2 = module?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -3077,6 +3106,8 @@ var intlTelInput = Object.assign(
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/demo/set-number/set-number-bundle.js b/react/demo/set-number/set-number-bundle.js
index c8f10ef47..972313f45 100644
--- a/react/demo/set-number/set-number-bundle.js
+++ b/react/demo/set-number/set-number-bundle.js
@@ -25210,6 +25210,8 @@
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -25230,7 +25232,7 @@
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -25292,9 +25294,9 @@
}
return el;
};
- var forEachInstance = (method) => {
+ var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -25742,14 +25744,21 @@
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -26334,6 +26343,9 @@
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -26622,22 +26634,43 @@
}
}
};
- var loadUtils = (path) => {
+ var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module) => {
+ const utils2 = module?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -26664,6 +26697,8 @@
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/demo/simple/simple-bundle.js b/react/demo/simple/simple-bundle.js
index 8e6f7f6e2..b200b92fd 100644
--- a/react/demo/simple/simple-bundle.js
+++ b/react/demo/simple/simple-bundle.js
@@ -25210,6 +25210,8 @@
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -25230,7 +25232,7 @@
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -25292,9 +25294,9 @@
}
return el;
};
- var forEachInstance = (method) => {
+ var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -25742,14 +25744,21 @@
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -26334,6 +26343,9 @@
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -26622,22 +26634,43 @@
}
}
};
- var loadUtils = (path) => {
+ var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module) => {
+ const utils2 = module?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -26664,6 +26697,8 @@
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/demo/toggle-disabled/toggle-disabled-bundle.js b/react/demo/toggle-disabled/toggle-disabled-bundle.js
index d073a5bf9..36665921a 100644
--- a/react/demo/toggle-disabled/toggle-disabled-bundle.js
+++ b/react/demo/toggle-disabled/toggle-disabled-bundle.js
@@ -25210,6 +25210,8 @@
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -25230,7 +25232,7 @@
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -25292,9 +25294,9 @@
}
return el;
};
- var forEachInstance = (method) => {
+ var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -25742,14 +25744,21 @@
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -26334,6 +26343,9 @@
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -26622,22 +26634,43 @@
}
}
};
- var loadUtils = (path) => {
+ var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module) => {
+ const utils2 = module?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -26664,6 +26697,8 @@
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/react/demo/validation/validation-bundle.js b/react/demo/validation/validation-bundle.js
index 03327af6a..5760d3150 100644
--- a/react/demo/validation/validation-bundle.js
+++ b/react/demo/validation/validation-bundle.js
@@ -25210,6 +25210,8 @@
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -25230,7 +25232,7 @@
navigator.userAgent
) || window.innerWidth <= 500
) : false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -25292,9 +25294,9 @@
}
return el;
};
- var forEachInstance = (method) => {
+ var forEachInstance = (method, ...args) => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
var Iti = class {
constructor(input, customOptions = {}) {
@@ -25742,14 +25744,21 @@
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
- if (utilsScript && !intlTelInput.utils) {
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {
+ });
+ };
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -26334,6 +26343,9 @@
this.dropdown.parentNode.removeChild(this.dropdown);
}
}
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
@@ -26622,22 +26634,43 @@
}
}
};
- var loadUtils = (path) => {
+ var loadUtils = (source) => {
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
- intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(
/* webpackIgnore: true */
/* @vite-ignore */
- path
- ).then(({ default: utils2 }) => {
- intlTelInput.utils = utils2;
- forEachInstance("handleUtils");
- resolve(true);
- }).catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
+ source
+ );
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+ intlTelInput.startedLoadingUtilsScript = true;
+ return loadCall.then((module) => {
+ const utils2 = module?.default;
+ if (!utils2 || typeof utils2 !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+ intlTelInput.utils = utils2;
+ forEachInstance("handleUtils");
+ return true;
+ }).catch((error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
});
}
return null;
@@ -26664,6 +26697,8 @@
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: "24.5.2"
}
);
diff --git a/spec.html b/spec.html
index a7ffc54ff..90995331a 100644
--- a/spec.html
+++ b/spec.html
@@ -82,14 +82,10 @@
-
-
-
-
diff --git a/src/js/intl-tel-input.ts b/src/js/intl-tel-input.ts
index 820ce6cb2..35dd0e96e 100644
--- a/src/js/intl-tel-input.ts
+++ b/src/js/intl-tel-input.ts
@@ -7,6 +7,8 @@ for (let i = 0; i < allCountries.length; i++) {
allCountries[i].name = defaultEnglishStrings[allCountries[i].iso2];
}
+type UtilsLoader = () => Promise<{default: ItiUtils}>;
+
interface IntlTelInputInterface {
(input: HTMLInputElement, options?: SomeOptions): Iti;
autoCountry?: string;
@@ -15,9 +17,9 @@ interface IntlTelInputInterface {
getCountryData: () => Country[];
getInstance: (input: HTMLInputElement) => Iti | null;
instances: { [key: string]: Iti };
- loadUtils: (path: string) => Promise | null;
- startedLoadingAutoCountry?: boolean;
- startedLoadingUtilsScript?: boolean;
+ loadUtils: (source: string|UtilsLoader) => Promise | null;
+ startedLoadingAutoCountry: boolean;
+ startedLoadingUtilsScript: boolean;
version: string | undefined;
utils?: ItiUtils;
}
@@ -64,6 +66,7 @@ interface AllOptions {
hiddenInput: ((telInputName: string) => {phone: string, country?: string}) | null;
i18n: I18n,
initialCountry: string;
+ loadUtilsOnInit: string|UtilsLoader;
nationalMode: boolean;
onlyCountries: string[];
placeholderNumberType: NumberType;
@@ -71,7 +74,8 @@ interface AllOptions {
separateDialCode: boolean;
strictMode: boolean;
useFullscreenPopup: boolean;
- utilsScript: string;
+ /** @deprecated Please use the `loadUtilsOnInit` option. */
+ utilsScript: string|UtilsLoader;
validationNumberType: NumberType | null;
}
@@ -111,6 +115,8 @@ const defaults: AllOptions = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: true,
//* Display only these countries.
@@ -132,7 +138,7 @@ const defaults: AllOptions = {
navigator.userAgent,
) || window.innerWidth <= 500
: false,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE",
@@ -221,9 +227,9 @@ const createEl = (name: string, attrs: object | null, container?: HTMLElement):
};
//* Run a method on each instance of the plugin.
-const forEachInstance = (method: string): void => {
+const forEachInstance = (method: string, ...args: any[]): void => {
const { instances } = intlTelInput;
- Object.values(instances).forEach((instance) => instance[method]());
+ Object.values(instances).forEach((instance) => instance[method](...args));
};
//* This is our plugin class that we will create an instance of
@@ -276,6 +282,7 @@ export class Iti {
private _handleClickOffToClose: () => void;
private _handleKeydownOnDropdown: (e: KeyboardEvent) => void;
private _handleSearchChange: () => void;
+ private _handlePageLoad: () => void;
private resolveAutoCountryPromise: (value?: unknown) => void;
private rejectAutoCountryPromise: (reason?: unknown) => void;
@@ -897,17 +904,30 @@ export class Iti {
//* Init many requests: utils script / geo ip lookup.
private _initRequests(): void {
- const { utilsScript, initialCountry, geoIpLookup } = this.options;
+ // eslint-disable-next-line prefer-const
+ let { loadUtilsOnInit, utilsScript, initialCountry, geoIpLookup } = this.options;
+
+ if (!loadUtilsOnInit && utilsScript) {
+ console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
+ loadUtilsOnInit = utilsScript;
+ }
+
//* If the user has specified the path to the utils script, fetch it on window.load, else resolve.
- if (utilsScript && !intlTelInput.utils) {
+ if (loadUtilsOnInit && !intlTelInput.utils) {
+ this._handlePageLoad = () => {
+ window.removeEventListener("load", this._handlePageLoad);
+ //* Catch and ignore any errors to prevent unhandled-promise failures.
+ //* The error from `loadUtils()` is also surfaced in each instance's
+ //* `promise` property, so it's not getting lost by being ignored here.
+ intlTelInput.loadUtils(loadUtilsOnInit)?.catch(() => {});
+ };
+
//* If the plugin is being initialised after the window.load event has already been fired.
if (intlTelInput.documentReady()) {
- intlTelInput.loadUtils(utilsScript);
+ this._handlePageLoad();
} else {
//* Wait until the load event so we don't block any other requests e.g. the flags image.
- window.addEventListener("load", () => {
- intlTelInput.loadUtils(utilsScript);
- });
+ window.addEventListener("load", this._handlePageLoad);
}
} else {
this.resolveUtilsScriptPromise();
@@ -1722,6 +1742,11 @@ export class Iti {
}
}
+ //* Unhook any deferred resource loads.
+ if (this._handlePageLoad) {
+ window.removeEventListener("load", this._handlePageLoad);
+ }
+
this._trigger("close:countrydropdown");
}
@@ -2112,7 +2137,7 @@ export class Iti {
********************/
//* Load the utils script.
-const loadUtils = (path: string): Promise | null => {
+const loadUtils = (source: string|UtilsLoader): Promise | null => {
//* 2 Options:
//* 1) Not already started loading (start)
//* 2) Already started loading (do nothing - just wait for the onload callback to fire, which will
@@ -2121,21 +2146,44 @@ const loadUtils = (path: string): Promise | null => {
!intlTelInput.utils &&
!intlTelInput.startedLoadingUtilsScript
) {
+ let loadCall;
+ if (typeof source === "string") {
+ loadCall = import(/* webpackIgnore: true */ /* @vite-ignore */ source);
+ } else if (typeof source === "function") {
+ try {
+ loadCall = source();
+ if (!(loadCall instanceof Promise)) {
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof loadCall}`);
+ }
+ } catch (error) {
+ return Promise.reject(error);
+ }
+ } else {
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof source}`));
+ }
+
//* Only do this once.
intlTelInput.startedLoadingUtilsScript = true;
- return new Promise((resolve, reject) => {
- import(/* webpackIgnore: true */ /* @vite-ignore */ path)
- .then(({ default: utils }) => {
- intlTelInput.utils = utils;
- forEachInstance("handleUtils");
- resolve(true);
- })
- .catch(() => {
- forEachInstance("rejectUtilsScriptPromise");
- reject();
- });
- });
+ return loadCall
+ .then((module) => {
+ const utils = module?.default;
+ if (!utils || typeof utils !== "object") {
+ if (typeof source === "string") {
+ throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
+ } else {
+ throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ }
+ }
+
+ intlTelInput.utils = utils;
+ forEachInstance("handleUtils");
+ return true;
+ })
+ .catch((error: Error) => {
+ forEachInstance("rejectUtilsScriptPromise", error);
+ throw error;
+ });
}
return null;
};
@@ -2163,6 +2211,8 @@ const intlTelInput: IntlTelInputInterface = Object.assign(
//* A map from instance ID to instance object.
instances: {},
loadUtils,
+ startedLoadingUtilsScript: false,
+ startedLoadingAutoCountry: false,
version: process.env.VERSION,
});
diff --git a/src/spec/.eslintrc.js b/src/spec/.eslintrc.js
index 8e77ea143..b4b3e6f19 100644
--- a/src/spec/.eslintrc.js
+++ b/src/spec/.eslintrc.js
@@ -42,6 +42,7 @@ module.exports = {
"triggerKeyOnBody": true,
"triggerKeyOnCountryContainerElement": true,
"intlTelInputUtils": true,
+ "useIntlTelInputBuild": true,
},
rules: {
"@typescript-eslint/no-unused-vars": "off",
diff --git a/src/spec/helpers/helpers.js b/src/spec/helpers/helpers.js
index fb6a593c7..48b1b6a1b 100644
--- a/src/spec/helpers/helpers.js
+++ b/src/spec/helpers/helpers.js
@@ -149,3 +149,77 @@ var triggerKeyOnCountryContainerElement = function(key) {
triggerKey(getCountryContainerElement()[0], "keydown", key);
};
/* eslint-enable @typescript-eslint/no-unused-vars */
+
+const moduleCache = new Map();
+
+/**
+ * A very simplistic module loader.
+ * @param {string} path
+ * @returns {Promise<{exports: any, hasUtils: boolean}>}
+ */
+async function loadCommonJsModule (path) {
+ const url = new URL(path, window.location.href);
+
+ let module = moduleCache.get(url);
+
+ if (!module) {
+ const response = await fetch(url);
+ if (response.status !== 200) {
+ throw new TypeError(`error loading dynamically imported module: ${url}`);
+ }
+
+ const source = await response.text();
+ module = eval?.(`
+ (function() {
+ const module = { exports: {} };
+ ${source}
+ return module;
+ })()
+ `);
+ module.hasUtils = !!module.exports.utils;
+
+ moduleCache.set(moduleCache, module);
+ }
+
+ return module;
+}
+
+/**
+ * Configure a test suite to use a specific build of intl-tel-input.
+ * @param {string} path
+ *
+ * @example
+ * describe("my suite", function () {
+ * useIntlTelInputBuild("build/intlTelInputWithUtils.js");
+ *
+ * it("should do something", () => {
+ * // In this test, window.intlTelInput will be the version from
+ * // "build/intlTelInputWithUtils.js"
+ * })
+ * })
+ */
+function useIntlTelInputBuild(path) {
+ let defaultBuild;
+
+ beforeEach(async function() {
+ defaultBuild = window.intlTelInput;
+
+ const usedBuild = await loadCommonJsModule(path);
+ if (!usedBuild.hasUtils) {
+ usedBuild.exports.utils = undefined;
+ usedBuild.exports.startedLoadingUtilsScript = false;
+ }
+
+ window.intlTelInput = usedBuild.exports;
+ });
+
+ afterEach(function() {
+ try {
+ for (const instance of Object.values(window.intlTelInput?.instances ?? {})) {
+ instance.destroy();
+ }
+ } finally {
+ window.intlTelInput = defaultBuild;
+ }
+ });
+}
diff --git a/src/spec/tests/options/utilsScript.js b/src/spec/tests/options/utilsScript.js
deleted file mode 100644
index 18adba908..000000000
--- a/src/spec/tests/options/utilsScript.js
+++ /dev/null
@@ -1,40 +0,0 @@
-"use strict";
-
-describe("utilsScript:", function() {
-
- var url = "build/js/utils.js";
-
- beforeEach(function() {
- intlSetup();
- input = $(" ").wrap("div");
- });
-
- afterEach(function() {
- intlTeardown();
- });
-
- it("init vanilla plugin does not start loading the utils script", function() {
- iti = window.intlTelInput(input[0]);
-
- expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(false);
- });
-
- it("init plugin with utilsScript before documentReady event does not inject the script", function() {
- window.intlTelInput.documentReady = () => false;
- iti = window.intlTelInput(input[0], {
- utilsScript: url,
- });
-
- expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(false);
- });
-
- it("faking documentReady then init plugin with utilsScript does inject the script", function() {
- window.intlTelInput.documentReady = () => true;
- iti = window.intlTelInput(input[0], {
- utilsScript: url,
- });
-
- expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(true);
- });
-
-});
diff --git a/src/spec/tests/static/loadUtils.js b/src/spec/tests/static/loadUtils.js
deleted file mode 100644
index fed0791ce..000000000
--- a/src/spec/tests/static/loadUtils.js
+++ /dev/null
@@ -1,217 +0,0 @@
-// TODO: figure out how to spy on dynamic import to test this, as currently the dyanmic import is failing in the test env.
-
-// "use strict";
-
-// describe("loadUtils:", function() {
-
-// beforeEach(function() {
-// intlSetup();
-// //* Must be in markup for utils loaded handler to work.
-// input = $(" ").appendTo("body");
-// });
-
-// afterEach(function() {
-// intlTeardown();
-// });
-
-
-
-// describe("calling loadUtils before init plugin", function() {
-
-// var url = "build/js/utils.js?v=1",
-// resolved = false;
-
-// beforeEach(function(done) {
-// var promise = window.intlTelInput.loadUtils(url);
-// promise.then(function() {
-// resolved = true;
-// done();
-// });
-// });
-
-// afterEach(function() {
-// resolved = false;
-// });
-
-// it("starts loading the utils", function() {
-// expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(true);
-// });
-
-// it("does resolve the promise", function() {
-// expect(resolved).toEqual(true);
-// });
-
-
-
-// describe("then init plugin with utilsScript option", function() {
-
-// var resolved2 = false;
-
-// beforeEach(function(done) {
-// iti = window.intlTelInput(input[0], {
-// utilsScript: "some/other/url/ok",
-// });
-// iti.promise.then(function() {
-// resolved2 = true;
-// done();
-// });
-// });
-
-// afterEach(function() {
-// resolved2 = false;
-// });
-
-// // TODO: spy on dynamic imports to check if this fired again
-// // it("does not start loading the utils", function() {
-// // expect($("script.iti-load-utils").length).toEqual(1);
-// // expect($("script.iti-load-utils").attr("src")).toEqual(url);
-// // });
-
-// it("does resolve the promise immediately", function() {
-// expect(resolved2).toEqual(true);
-// });
-
-// });
-
-// });
-
-
-
-// describe("init plugin with utilsScript option, but force documentReady=false so it wont fire", function() {
-
-// var url2 = "build/js/utils.js?v=2",
-// resolved = false;
-
-// beforeEach(function(done) {
-// window.intlTelInput.documentReady = () => false;
-// iti = window.intlTelInput(input[0], {
-// utilsScript: "some/other/url/ok",
-// });
-// iti.promise.then(function() {
-// resolved = true;
-// done();
-// });
-// });
-
-// afterEach(function() {
-// resolved = false;
-// });
-
-// it("does not start loading the utils", function() {
-// expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(false);
-// });
-
-// it("does not resolve the promise", function() {
-// expect(resolved).toEqual(false);
-// });
-
-
-
-// describe("calling loadUtils", function() {
-
-// var resolved2 = false;
-
-// beforeEach(function(done) {
-// var promise = window.intlTelInput.loadUtils(url2);
-// promise.then(function() {
-// resolved2 = true;
-// done();
-// });
-// });
-
-// afterEach(function() {
-// resolved2 = false;
-// });
-
-// it("does start loading the utils", function() {
-// expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(true);
-// });
-
-// it("does resolve the promise", function() {
-// expect(resolved2).toEqual(true);
-// });
-
-
-
-// describe("then init another plugin instance with utilsScript option", function() {
-
-// var iti2,
-// input2,
-// resolved3 = false;
-
-// beforeEach(function(done) {
-// input2 = $(" ").appendTo("body");
-// iti2 = window.intlTelInput(input2[0], {
-// utilsScript: "test/url/three/utils.js",
-// });
-// iti2.promise.then(function() {
-// resolved3 = true;
-// done();
-// });
-// });
-
-// afterEach(function() {
-// resolved3 = false;
-// iti2.destroy();
-// input2.remove();
-// iti2 = input2 = null;
-// });
-
-// // TODO: spy on dynamic imports to check if this fired again
-// // it("does not inject another script", function() {
-// // expect($("script.iti-load-utils").length).toEqual(1);
-// // expect($("script.iti-load-utils").attr("src")).toEqual(url2);
-// // });
-
-// it("does resolve the promise immediately", function() {
-// expect(resolved3).toEqual(true);
-// });
-
-// });
-
-// });
-
-// });
-
-
-
-// describe("force documentReady=true then init plugin with utilsScript", function() {
-
-// var url3 = "build/js/utils.js?v=3",
-// resolved = false;
-
-// beforeEach(function(done) {
-// window.intlTelInput.documentReady = () => true;
-// iti = window.intlTelInput(input[0], {
-// utilsScript: url3,
-// });
-// //* Wait for the request to finish so we don't interfere with other tests.
-// iti.promise.then(function() {
-// resolved = true;
-// done();
-// });
-// });
-
-// afterEach(function() {
-// resolved = false;
-// });
-
-// it("resolves the promise immediately", function() {
-// expect(resolved).toEqual(true);
-// });
-
-// it("starts loading the utils", function() {
-// expect(window.intlTelInput.startedLoadingUtilsScript).toEqual(true);
-// });
-
-// // TODO: spy on dynamic imports to check if this fired again
-// // it("then calling loadUtils does not inject another script", function() {
-// // window.intlTelInput.loadUtils("this/is/a/test");
-
-// // expect($("script.iti-load-utils").length).toEqual(1);
-// // expect($("script.iti-load-utils").attr("src")).toEqual(url3);
-// // });
-
-// });
-
-// });
diff --git a/tests/helpers/helpers.js b/tests/helpers/helpers.js
index a40036f97..98df81543 100644
--- a/tests/helpers/helpers.js
+++ b/tests/helpers/helpers.js
@@ -1,5 +1,9 @@
require("@testing-library/jest-dom");
-const intlTelInput = require("intlTelInputWithUtils.js");
+const intlTelInputWithUtils = require("intlTelInputWithUtils.js");
+
+/** @typedef {typeof import("intl-tel-input").default} IntlTelInputInterface */
+/** @typedef {import("intl-tel-input").Iti} Iti */
+/** @typedef {import("intl-tel-input").SomeOptions} SomeOptions */
exports.totalCountries = 244;
@@ -17,19 +21,61 @@ exports.injectInput = ({ inputValue = "", disabled = false } = injectInputDefaul
return input;
};
-const initPluginDefaults = { input: null, options: {}, inputValue: "" };
-
-exports.initPlugin = ({ input = null, options = {}, inputValue = "" } = initPluginDefaults) => {
+/**
+ * Create an intl-tel-input instance to test.
+ * @param {{intlTelInput?: IntlTelInputInterface, input?: any, inputValue?: string, options?: SomeOptions}} options
+ * @returns {{input: HTMLInputElement, iti: Iti, container: HTMLElement}}
+ */
+exports.initPlugin = ({ intlTelInput = intlTelInputWithUtils, input = null, inputValue = "", options = {} } = {}) => {
const inputToUse = input || exports.injectInput({ inputValue });
const iti = intlTelInput(inputToUse, options);
const container = inputToUse.parentElement;
return { input: inputToUse, iti, container };
};
+/**
+ * Tear down a standard test environment. Optionally takes an intl-tel-input
+ * instance to tear down, or a copy of the whole library in which to tear down
+ * all instances.
+ * @param {Iti|IntlTelInputInterface} iti
+ */
exports.teardown = (iti) => {
- iti.destroy();
+ let toDestroy = [];
+ if (iti?.instances) {
+ toDestroy = Object.values(iti.instances);
+ } else if (iti) {
+ toDestroy = [iti];
+ }
+
+ for (const instance of toDestroy) {
+ // Tests might intentionally set up an instance wrong, so ignore any
+ // rejections of the instance's promise (otherwise the unhandled
+ // rejection causes the test to fail). But don't *wait*, since the test
+ // may also create a state where the promise will never fulfill.
+ instance.promise.catch(() => {});
+
+ instance.destroy();
+ }
+
document.body.innerHTML = "";
- jest.clearAllMocks();
+ jest.restoreAllMocks();
+};
+
+/**
+ * @param {IntlTelInputInterface} intlTelInput
+ */
+exports.resetPackageAfterEach = (intlTelInput = intlTelInputWithUtils) => {
+ const originalUtils = intlTelInput.utils;
+
+ afterEach(function() {
+ try {
+ exports.teardown(intlTelInput);
+ } finally {
+ // Reset package-wide state.
+ intlTelInput.utils = originalUtils;
+ intlTelInput.startedLoadingUtilsScript = false;
+ }
+ });
};
exports.getCountryListLength = (container) => {
@@ -87,4 +133,4 @@ exports.selectCountryAndTypePlaceholderNumberAsync = async (container, iso2, use
};
// strip formatting chars like space, dash, brackets (leaving just numerics and optional plus)
-exports.stripFormattingChars = (str) => str.replace(/[^0-9+]/g, "");
\ No newline at end of file
+exports.stripFormattingChars = (str) => str.replace(/[^0-9+]/g, "");
diff --git a/tests/helpers/matchers.js b/tests/helpers/matchers.js
new file mode 100644
index 000000000..f0f280c0f
--- /dev/null
+++ b/tests/helpers/matchers.js
@@ -0,0 +1,24 @@
+/** Test whether something is a promise. Works across realms. */
+function toBeAPromise(actual) {
+ const pass = Object.prototype.toString.call(actual) === "[object Promise]";
+ return {
+ pass,
+ message: () => `expected ${this.utils.printReceived(actual)}${pass ? " not" : ""} to be a promise`,
+ };
+}
+
+async function toBePending(actual) {
+ const pending = Symbol();
+ const resolution = await Promise.race([actual, Promise.resolve(pending)]);
+ const pass = resolution === pending;
+
+ return {
+ pass,
+ message: () => `expected ${this.utils.printReceived(actual)}${pass ? " not" : ""} to be a pending`,
+ };
+}
+
+expect.extend({
+ toBeAPromise,
+ toBePending,
+});
diff --git a/tests/options/loadUtilsOnInit.test.js b/tests/options/loadUtilsOnInit.test.js
new file mode 100644
index 000000000..9cc449a81
--- /dev/null
+++ b/tests/options/loadUtilsOnInit.test.js
@@ -0,0 +1,127 @@
+/**
+ * @jest-environment jsdom
+ */
+
+const intlTelInput = require("intl-tel-input");
+const { initPlugin, resetPackageAfterEach } = require("../helpers/helpers");
+
+describe("loadUtilsOnInit", () => {
+ resetPackageAfterEach(intlTelInput);
+
+ const loadUtilsOnInit = "intl-tel-input/utils";
+
+ it("does not load the utils script if `loadUtilsOnInit` option is not set", async () => {
+ const { iti } = initPlugin({ intlTelInput });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", false);
+
+ await iti.promise;
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", false);
+ });
+
+ it("loads the utils script successfully", async () => {
+ expect(intlTelInput).not.toHaveProperty("utils.isValidNumber");
+
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit },
+ });
+
+ await iti.promise;
+ expect(intlTelInput).toHaveProperty("utils.isValidNumber");
+ });
+
+ it("waits until the page is loaded before loading utils", async () => {
+ jest.spyOn(intlTelInput, "documentReady").mockReturnValue(false);
+
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit },
+ });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", false);
+
+ const loadEvent = new Event("load");
+ window.dispatchEvent(loadEvent);
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+
+ await iti.promise;
+ });
+
+ it("loads utils immediately if page is already finished loading", async function() {
+ jest.spyOn(intlTelInput, "documentReady").mockReturnValue(true);
+
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit },
+ });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+
+ await iti.promise;
+ });
+
+ it("rejects with an error if the utils script cannot load", async function() {
+ jest.spyOn(intlTelInput, "documentReady").mockReturnValue(true);
+
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit: "/some/incorrect/url" },
+ });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+
+ await expect(iti.promise).rejects.toThrow();
+ });
+
+ it("works if loadUtilsOnInit is a function", async function() {
+ const mockUtils = { default: { mockUtils: true } };
+ jest.spyOn(intlTelInput, "documentReady").mockReturnValue(true);
+
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: {
+ async loadUtilsOnInit () {
+ return mockUtils;
+ },
+ },
+ });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+ await iti.promise;
+
+ expect(intlTelInput.utils).toBe(mockUtils.default);
+ });
+
+ describe("in 'withUtils' builds", () => {
+ const intlTelInput = require("intl-tel-input/intlTelInputWithUtils");
+ resetPackageAfterEach(intlTelInput);
+
+ it("ignores the `loadUtilsOnInit` option and does not load", async () => {
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit },
+ });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", false);
+
+ await iti.promise;
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", false);
+ });
+
+ it("Raises an informative error when `utils` is missing", async () => {
+ delete intlTelInput.utils;
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit },
+ });
+
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+ await expect(iti.promise).rejects.toThrow("INTENTIONALLY BROKEN");
+ });
+ });
+
+});
diff --git a/tests/static/loadUtils.test.js b/tests/static/loadUtils.test.js
new file mode 100644
index 000000000..4d8025d44
--- /dev/null
+++ b/tests/static/loadUtils.test.js
@@ -0,0 +1,198 @@
+/**
+ * @jest-environment jsdom
+ */
+
+const intlTelInput = require("intl-tel-input");
+const { initPlugin, resetPackageAfterEach } = require("../helpers/helpers");
+require("../helpers/matchers");
+
+describe("loadUtils", function() {
+ resetPackageAfterEach(intlTelInput);
+
+ describe("calling loadUtils before init plugin", () => {
+
+ let url = "./utils.js?v=1";
+ let loadResult;
+
+ beforeEach(() => {
+ loadResult = intlTelInput.loadUtils(url);
+ loadResult.catch(() => {});
+ });
+
+ it("starts loading the utils", () => {
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+ });
+
+ it("resolves the promise", async () => {
+ expect(loadResult).toBeAPromise();
+ await expect(loadResult).resolves.toBe(true);
+ });
+
+ it("installs the utils module at intlTelInput.utils", async () => {
+ await loadResult;
+
+ expect(intlTelInput).toHaveProperty("utils.isValidNumber");
+ });
+
+ describe("then init plugin with loadUtilsOnInit option", () => {
+
+ it("resolves the instance's promise", async () => {
+ const { iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit: "some/other/url/ok" }
+ });
+ await iti.promise;
+ });
+
+ });
+
+ });
+
+
+
+ describe("init plugin with loadUtilsOnInit option, but force documentReady=false so it wont fire", function() {
+ /** @type {jest.Mock<() => Promise>} */
+ let utilsLoader;
+ /** @type {intlTelInput.Iti} */
+ let iti;
+
+ beforeEach(function() {
+ jest.spyOn(intlTelInput, "documentReady").mockReturnValue(false);
+ utilsLoader = jest.fn(async () => import("intl-tel-input/utils"));
+
+ ({ iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit: utilsLoader },
+ }));
+ });
+
+ it("does not start loading the utils", function() {
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", false);
+ });
+
+ it("does not resolve the promise", async function() {
+ await expect(iti.promise).toBePending();
+ });
+
+
+
+ describe("calling loadUtils", function() {
+ /** @type {Promise} */
+ let loadUtilsPromise;
+
+ beforeEach(async function() {
+ loadUtilsPromise = intlTelInput.loadUtils(utilsLoader);
+ });
+
+ it("starts loading the utils", function() {
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+ });
+
+ it("resolves the promise", async function() {
+ await expect(loadUtilsPromise).resolves.toBe(true);
+ });
+
+
+
+ describe("then init another plugin instance with loadUtilsOnInit option", function() {
+
+ beforeEach(async function() {
+ // Wait for previous load to finish.
+ await loadUtilsPromise;
+
+ initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit: utilsLoader },
+ });
+ });
+
+ it("only loads once", function() {
+ expect(utilsLoader).toHaveBeenCalledTimes(1);
+ });
+
+ });
+
+ });
+
+ });
+
+
+
+ describe("force documentReady=true then init plugin with loadUtilsOnInit", function() {
+
+ const url3 = "./utils.js?v=3";
+ /** @type {intlTelInput.Iti} */
+ let iti;
+
+ beforeEach(function() {
+ jest.spyOn(intlTelInput, "documentReady").mockReturnValue(true);
+ ({ iti } = initPlugin({
+ intlTelInput,
+ options: { loadUtilsOnInit: url3 },
+ }));
+ });
+
+ it("resolves the promise immediately", async function() {
+ await expect(iti.promise).resolves.toBeInstanceOf(Array);
+ });
+
+ it("starts loading the utils", function() {
+ expect(intlTelInput).toHaveProperty("startedLoadingUtilsScript", true);
+ });
+
+ });
+
+
+
+ describe("calling with a function", function() {
+ const mockUtils = { default: { mymodule: "fakeutils" } };
+
+ it("uses the object the function resolves with", async () => {
+ const result = await intlTelInput.loadUtils(async () => mockUtils);
+
+ expect(result).toEqual(true);
+ expect(intlTelInput.utils).toBe(mockUtils.default);
+ });
+
+ it("rejects if the function rejects", async () => {
+ const loadPromise = intlTelInput.loadUtils(async () => {
+ throw new Error("Uhoh!");
+ });
+
+ await expect(loadPromise).rejects.toThrow("Uhoh!");
+ });
+
+ it("rejects if the function throws", async () => {
+ const loadPromise = intlTelInput.loadUtils(() => {
+ throw new Error("Uhoh!");
+ });
+
+ await expect(loadPromise).rejects.toThrow("Uhoh!");
+ });
+
+ it("rejects if the function returns a non-promise", async () => {
+ const loadPromise = intlTelInput.loadUtils(() => ({
+ anObject: "That is not a promise",
+ }));
+
+ await expect(loadPromise).rejects.toThrow();
+ });
+
+ it("rejects if the function resolves to a non-object", async () => {
+ const loadPromise = intlTelInput.loadUtils(async () => "Hello!");
+
+ await expect(loadPromise).rejects.toThrow();
+ });
+
+ it("does not call the function a second time", async () => {
+ const loader = jest.fn(async () => mockUtils);
+
+ await intlTelInput.loadUtils(loader);
+ await intlTelInput.loadUtils(loader);
+
+ expect(loader).toHaveBeenCalledTimes(1);
+ });
+
+ });
+
+});
diff --git a/vue/build/IntlTelInput.mjs b/vue/build/IntlTelInput.mjs
index 709b017ce..7199c038e 100644
--- a/vue/build/IntlTelInput.mjs
+++ b/vue/build/IntlTelInput.mjs
@@ -1,4 +1,4 @@
-import { mergeModels as D, useModel as x, ref as v, onMounted as E, watch as M, onUnmounted as F, withDirectives as B, openBlock as O, createElementBlock as V, mergeProps as z, vModelText as R } from "vue";
+import { mergeModels as D, useModel as x, ref as v, onMounted as E, watch as M, onUnmounted as O, withDirectives as F, openBlock as B, createElementBlock as V, mergeProps as z, vModelText as R } from "vue";
const N = [
[
"af",
@@ -1318,7 +1318,7 @@ for (let u = 0; u < N.length; u++) {
nodeById: {}
};
}
-const $ = {
+const j = {
ad: "Andorra",
ae: "United Arab Emirates",
af: "Afghanistan",
@@ -1561,7 +1561,7 @@ const $ = {
za: "South Africa",
zm: "Zambia",
zw: "Zimbabwe"
-}, j = {
+}, $ = {
selectedCountryAriaLabel: "Selected country",
noCountrySelected: "No country selected",
countryListAriaLabel: "List of countries",
@@ -1572,10 +1572,10 @@ const $ = {
// additional countries (not supported by country-list library)
ac: "Ascension Island",
xk: "Kosovo"
-}, k = { ...$, ...j };
+}, k = { ...j, ...$ };
for (let u = 0; u < b.length; u++)
b[u].name = k[b[u].iso2];
-let K = 0;
+let U = 0;
const T = {
//* Whether or not to allow the dropdown.
allowDropdown: !0,
@@ -1607,6 +1607,8 @@ const T = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: !0,
//* Display only these countries.
@@ -1627,11 +1629,11 @@ const T = {
navigator.userAgent
) || window.innerWidth <= 500
) : !1,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
-}, U = [
+}, K = [
"800",
"822",
"833",
@@ -1649,11 +1651,11 @@ const T = {
"887",
"888",
"889"
-], w = (u) => u.replace(/\D/g, ""), A = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
- const t = w(u);
+], I = (u) => u.replace(/\D/g, ""), A = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
+ const t = I(u);
if (t.charAt(0) === "1") {
const e = t.substr(1, 3);
- return U.indexOf(e) !== -1;
+ return K.indexOf(e) !== -1;
}
return !1;
}, H = (u, t, e, i) => {
@@ -1670,13 +1672,13 @@ const T = {
}, y = (u, t, e) => {
const i = document.createElement(u);
return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
-}, _ = (u) => {
- const { instances: t } = l;
- Object.values(t).forEach((e) => e[u]());
+}, _ = (u, ...t) => {
+ const { instances: e } = l;
+ Object.values(e).forEach((i) => i[u](...t));
};
class G {
constructor(t, e = {}) {
- this.id = K++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, T, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
+ this.id = U++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, T, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
}
//* Can't be private as it's called from intlTelInput convenience wrapper.
_init() {
@@ -1936,10 +1938,12 @@ class G {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript: t, initialCountry: e, geoIpLookup: i } = this.options;
- t && !l.utils ? l.documentReady() ? l.loadUtils(t) : window.addEventListener("load", () => {
- l.loadUtils(t);
- }) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
+ let { loadUtilsOnInit: t, utilsScript: e, initialCountry: i, geoIpLookup: s } = this.options;
+ !t && e && (console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."), t = e), t && !l.utils ? (this._handlePageLoad = () => {
+ var o;
+ window.removeEventListener("load", this._handlePageLoad), (o = l.loadUtils(t)) == null || o.catch(() => {
+ });
+ }, l.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), i === "auto" && s && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
}
//* Perform the geo ip lookup.
_loadAutoCountry() {
@@ -1971,8 +1975,8 @@ class G {
p || c && !t ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
const d = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
if (e && !a && !d) {
- const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, f = (r == null ? void 0 : r.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), I = H(m, g, C, f);
- this.telInput.value = g, this.telInput.setSelectionRange(I, I);
+ const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, f = (r == null ? void 0 : r.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), w = H(m, g, C, f);
+ this.telInput.value = g, this.telInput.setSelectionRange(w, w);
}
}, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (r) => {
if (r.key && r.key.length === 1 && !r.altKey && !r.ctrlKey && !r.metaKey) {
@@ -1981,13 +1985,13 @@ class G {
return;
}
if (t) {
- const p = this.telInput.value, c = p.charAt(0) === "+", d = !c && this.telInput.selectionStart === 0 && r.key === "+", C = /^[0-9]$/.test(r.key), h = i ? C : d || C, m = p.slice(0, this.telInput.selectionStart) + r.key + p.slice(this.telInput.selectionEnd), f = this._getFullNumber(m), g = l.utils.getCoreNumber(f, this.selectedCountryData.iso2), I = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength;
+ const p = this.telInput.value, c = p.charAt(0) === "+", d = !c && this.telInput.selectionStart === 0 && r.key === "+", C = /^[0-9]$/.test(r.key), h = i ? C : d || C, m = p.slice(0, this.telInput.selectionStart) + r.key + p.slice(this.telInput.selectionEnd), f = this._getFullNumber(m), g = l.utils.getCoreNumber(f, this.selectedCountryData.iso2), w = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength;
let L = !1;
if (c) {
const P = this.selectedCountryData.iso2;
L = this._getCountryFromNumber(f) !== P;
}
- (!h || I && !L && !d) && r.preventDefault();
+ (!h || w && !L && !d) && r.preventDefault();
}
}
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
@@ -2127,9 +2131,9 @@ class G {
let i = e ? t.substring(e) : t;
const s = this.selectedCountryData.dialCode;
i && s === "1" && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = `1${i}`), i = `+${i}`), this.options.separateDialCode && s && i.charAt(0) !== "+" && (i = `+${s}${i}`);
- const o = this._getDialCode(i, !0), a = w(i);
+ const o = this._getDialCode(i, !0), a = I(i);
if (o) {
- const r = this.dialCodeToIso2Map[w(o)], p = r.indexOf(this.selectedCountryData.iso2) !== -1 && a.length <= o.length - 1;
+ const r = this.dialCodeToIso2Map[I(o)], p = r.indexOf(this.selectedCountryData.iso2) !== -1 && a.length <= o.length - 1;
if (!(s === "1" && S(a)) && !p) {
for (let d = 0; d < r.length; d++)
if (r[d])
@@ -2259,7 +2263,7 @@ class G {
), this.countryList.removeEventListener(
"mouseover",
this._handleMouseoverCountryList
- ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
+ ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
_scrollTo(t) {
@@ -2307,7 +2311,7 @@ class G {
_getFullNumber(t) {
const e = t || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
let s;
- const n = w(e);
+ const n = I(e);
return this.options.separateDialCode && e.charAt(0) !== "+" && i && n ? s = `+${i}` : s = "", s + e;
}
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
@@ -2450,17 +2454,35 @@ class G {
this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
}
}
-const W = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUtilsScript = !0, new Promise((t, e) => {
- import(
- /* webpackIgnore: true */
- /* @vite-ignore */
- u
- ).then(({ default: i }) => {
- l.utils = i, _("handleUtils"), t(!0);
- }).catch(() => {
- _("rejectUtilsScriptPromise"), e();
- });
-})) : null, l = Object.assign(
+const W = (u) => {
+ if (!l.utils && !l.startedLoadingUtilsScript) {
+ let t;
+ if (typeof u == "string")
+ t = import(
+ /* webpackIgnore: true */
+ /* @vite-ignore */
+ u
+ );
+ else if (typeof u == "function")
+ try {
+ if (t = u(), !(t instanceof Promise))
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof t}`);
+ } catch (e) {
+ return Promise.reject(e);
+ }
+ else
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof u}`));
+ return l.startedLoadingUtilsScript = !0, t.then((e) => {
+ const i = e == null ? void 0 : e.default;
+ if (!i || typeof i != "object")
+ throw typeof u == "string" ? new TypeError(`The module loaded from ${u} did not set utils as its default export.`) : new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ return l.utils = i, _("handleUtils"), !0;
+ }).catch((e) => {
+ throw _("rejectUtilsScriptPromise", e), e;
+ });
+ }
+ return null;
+}, l = Object.assign(
(u, t) => {
const e = new G(u, t);
return e._init(), u.setAttribute("data-intl-tel-input-id", e.id.toString()), l.instances[e.id] = e, e;
@@ -2479,6 +2501,8 @@ const W = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
//* A map from instance ID to instance object.
instances: {},
loadUtils: W,
+ startedLoadingUtilsScript: !1,
+ startedLoadingAutoCountry: !1,
version: "24.5.2"
}
), J = {
@@ -2535,10 +2559,10 @@ const W = (u) => !l.utils && !l.startedLoadingUtilsScript ? (l.startedLoadingUti
var m;
return (m = a.value) == null ? void 0 : m.setDisabled(h);
}
- ), F(() => {
+ ), O(() => {
var h;
return (h = a.value) == null ? void 0 : h.destroy();
- }), t({ instance: a, input: o }), (h, m) => B((O(), V("input", z({
+ }), t({ instance: a, input: o }), (h, m) => F((B(), V("input", z({
ref_key: "input",
ref: o,
"onUpdate:modelValue": m[0] || (m[0] = (f) => i.value = f),
diff --git a/vue/build/IntlTelInputWithUtils.mjs b/vue/build/IntlTelInputWithUtils.mjs
index c9c4b5c1f..d4ca8900b 100644
--- a/vue/build/IntlTelInputWithUtils.mjs
+++ b/vue/build/IntlTelInputWithUtils.mjs
@@ -1,5 +1,5 @@
-import { mergeModels as n2, useModel as A2, ref as I1, onMounted as L2, watch as T2, onUnmounted as E2, withDirectives as D2, openBlock as M2, createElementBlock as x2, mergeProps as P2, vModelText as R2 } from "vue";
-const i2 = [
+import { mergeModels as i2, useModel as T2, ref as I1, onMounted as N2, watch as A2, onUnmounted as E2, withDirectives as D2, openBlock as M2, createElementBlock as P2, mergeProps as x2, vModelText as R2 } from "vue";
+const n2 = [
[
"af",
// Afghanistan
@@ -1306,8 +1306,8 @@ const i2 = [
"263"
]
], H = [];
-for (let y = 0; y < i2.length; y++) {
- const e = i2[y];
+for (let y = 0; y < n2.length; y++) {
+ const e = n2[y];
H[y] = {
name: "",
// this is now populated in the plugin
@@ -1607,6 +1607,8 @@ const u2 = {
i18n: {},
//* Initial country.
initialCountry: "",
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
+ loadUtilsOnInit: "",
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
nationalMode: !0,
//* Display only these countries.
@@ -1627,7 +1629,7 @@ const u2 = {
navigator.userAgent
) || window.innerWidth <= 500
) : !1,
- //* Specify the path to the libphonenumber script to enable validation/formatting.
+ //* Deprecated! Use `loadUtilsOnInit` instead.
utilsScript: "",
//* The number type to enforce during validation.
validationNumberType: "MOBILE"
@@ -1652,43 +1654,43 @@ const u2 = {
], f1 = (y) => y.replace(/\D/g, ""), r2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), s2 = (y) => {
const e = f1(y);
if (e.charAt(0) === "1") {
- const n = e.substr(1, 3);
- return G2.indexOf(n) !== -1;
+ const i = e.substr(1, 3);
+ return G2.indexOf(i) !== -1;
}
return !1;
-}, F2 = (y, e, n, r) => {
- if (n === 0 && !r)
+}, U2 = (y, e, i, n) => {
+ if (i === 0 && !n)
return 0;
let o = 0;
for (let a = 0; a < e.length; a++) {
- if (/[+0-9]/.test(e[a]) && o++, o === y && !r)
+ if (/[+0-9]/.test(e[a]) && o++, o === y && !n)
return a + 1;
- if (r && o === y + 1)
+ if (n && o === y + 1)
return a;
}
return e.length;
-}, T = (y, e, n) => {
- const r = document.createElement(y);
- return e && Object.entries(e).forEach(([o, a]) => r.setAttribute(o, a)), n && n.appendChild(r), r;
-}, $1 = (y) => {
- const { instances: e } = C;
- Object.values(e).forEach((n) => n[y]());
+}, A = (y, e, i) => {
+ const n = document.createElement(y);
+ return e && Object.entries(e).forEach(([o, a]) => n.setAttribute(o, a)), i && i.appendChild(n), n;
+}, $1 = (y, ...e) => {
+ const { instances: i } = m;
+ Object.values(i).forEach((n) => n[y](...e));
};
-class U2 {
- constructor(e, n = {}) {
- this.id = O2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u2, n), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
+class F2 {
+ constructor(e, i = {}) {
+ this.id = O2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u2, i), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
}
//* Can't be private as it's called from intlTelInput convenience wrapper.
_init() {
this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]");
const e = this.options.allowDropdown || this.options.separateDialCode;
this.showSelectedCountryOnLeft = this.isRTL ? !e : e, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...o2, ...this.options.i18n };
- const n = new Promise((o, a) => {
+ const i = new Promise((o, a) => {
this.resolveAutoCountryPromise = o, this.rejectAutoCountryPromise = a;
- }), r = new Promise((o, a) => {
+ }), n = new Promise((o, a) => {
this.resolveUtilsScriptPromise = o, this.rejectUtilsScriptPromise = a;
});
- this.promise = Promise.all([n, r]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
+ this.promise = Promise.all([i, n]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
}
//********************
//* PRIVATE METHODS
@@ -1699,41 +1701,41 @@ class U2 {
}
//* Sort countries by countryOrder option (if present), then name.
_sortCountries() {
- this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, n) => {
- const { countryOrder: r } = this.options;
- if (r) {
- const o = r.indexOf(e.iso2), a = r.indexOf(n.iso2), c = o > -1, g = a > -1;
+ this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, i) => {
+ const { countryOrder: n } = this.options;
+ if (n) {
+ const o = n.indexOf(e.iso2), a = n.indexOf(i.iso2), c = o > -1, g = a > -1;
if (c || g)
return c && g ? o - a : c ? -1 : 1;
}
- return e.name.localeCompare(n.name);
+ return e.name.localeCompare(i.name);
});
}
//* Add a dial code to this.dialCodeToIso2Map.
- _addToDialCodeMap(e, n, r) {
- n.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = n.length), this.dialCodeToIso2Map.hasOwnProperty(n) || (this.dialCodeToIso2Map[n] = []);
- for (let a = 0; a < this.dialCodeToIso2Map[n].length; a++)
- if (this.dialCodeToIso2Map[n][a] === e)
+ _addToDialCodeMap(e, i, n) {
+ i.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = i.length), this.dialCodeToIso2Map.hasOwnProperty(i) || (this.dialCodeToIso2Map[i] = []);
+ for (let a = 0; a < this.dialCodeToIso2Map[i].length; a++)
+ if (this.dialCodeToIso2Map[i][a] === e)
return;
- const o = r !== void 0 ? r : this.dialCodeToIso2Map[n].length;
- this.dialCodeToIso2Map[n][o] = e;
+ const o = n !== void 0 ? n : this.dialCodeToIso2Map[i].length;
+ this.dialCodeToIso2Map[i][o] = e;
}
//* Process onlyCountries or excludeCountries array if present.
_processAllCountries() {
- const { onlyCountries: e, excludeCountries: n } = this.options;
+ const { onlyCountries: e, excludeCountries: i } = this.options;
if (e.length) {
- const r = e.map(
+ const n = e.map(
(o) => o.toLowerCase()
);
this.countries = H.filter(
- (o) => r.indexOf(o.iso2) > -1
+ (o) => n.indexOf(o.iso2) > -1
);
- } else if (n.length) {
- const r = n.map(
+ } else if (i.length) {
+ const n = i.map(
(o) => o.toLowerCase()
);
this.countries = H.filter(
- (o) => r.indexOf(o.iso2) === -1
+ (o) => n.indexOf(o.iso2) === -1
);
} else
this.countries = H;
@@ -1741,28 +1743,28 @@ class U2 {
//* Translate Countries by object literal provided on config.
_translateCountryNames() {
for (let e = 0; e < this.countries.length; e++) {
- const n = this.countries[e].iso2.toLowerCase();
- this.options.i18n.hasOwnProperty(n) && (this.countries[e].name = this.options.i18n[n]);
+ const i = this.countries[e].iso2.toLowerCase();
+ this.options.i18n.hasOwnProperty(i) && (this.countries[e].name = this.options.i18n[i]);
}
}
//* Generate this.dialCodes and this.dialCodeToIso2Map.
_processDialCodes() {
this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
for (let e = 0; e < this.countries.length; e++) {
- const n = this.countries[e];
- this.dialCodes[n.dialCode] || (this.dialCodes[n.dialCode] = !0), this._addToDialCodeMap(n.iso2, n.dialCode, n.priority);
+ const i = this.countries[e];
+ this.dialCodes[i.dialCode] || (this.dialCodes[i.dialCode] = !0), this._addToDialCodeMap(i.iso2, i.dialCode, i.priority);
}
for (let e = 0; e < this.countries.length; e++) {
- const n = this.countries[e];
- if (n.areaCodes) {
- const r = this.dialCodeToIso2Map[n.dialCode][0];
- for (let o = 0; o < n.areaCodes.length; o++) {
- const a = n.areaCodes[o];
+ const i = this.countries[e];
+ if (i.areaCodes) {
+ const n = this.dialCodeToIso2Map[i.dialCode][0];
+ for (let o = 0; o < i.areaCodes.length; o++) {
+ const a = i.areaCodes[o];
for (let c = 1; c < a.length; c++) {
- const g = n.dialCode + a.substr(0, c);
- this._addToDialCodeMap(r, g), this._addToDialCodeMap(n.iso2, g);
+ const g = i.dialCode + a.substr(0, c);
+ this._addToDialCodeMap(n, g), this._addToDialCodeMap(i.iso2, g);
}
- this._addToDialCodeMap(n.iso2, n.dialCode + a);
+ this._addToDialCodeMap(i.iso2, i.dialCode + a);
}
}
}
@@ -1773,8 +1775,8 @@ class U2 {
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
const {
allowDropdown: e,
- separateDialCode: n,
- showFlags: r,
+ separateDialCode: i,
+ showFlags: n,
containerClass: o,
hiddenInput: a,
dropdownContainer: c,
@@ -1784,14 +1786,14 @@ class U2 {
i18n: _
} = this.options;
let I = "iti";
- e && (I += " iti--allow-dropdown"), r && (I += " iti--show-flags"), o && (I += ` ${o}`), f || (I += " iti--inline-dropdown");
- const N = T("div", { class: I });
- if ((v = this.telInput.parentNode) == null || v.insertBefore(N, this.telInput), e || r || n) {
- this.countryContainer = T(
+ e && (I += " iti--allow-dropdown"), n && (I += " iti--show-flags"), o && (I += ` ${o}`), f || (I += " iti--inline-dropdown");
+ const L = A("div", { class: I });
+ if ((v = this.telInput.parentNode) == null || v.insertBefore(L, this.telInput), e || n || i) {
+ this.countryContainer = A(
"div",
{ class: "iti__country-container" },
- N
- ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = T(
+ L
+ ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = A(
"button",
{
type: "button",
@@ -1803,30 +1805,30 @@ class U2 {
role: "combobox"
},
this.countryContainer
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = T(
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = A(
"div",
{ class: "iti__selected-country" },
this.countryContainer
);
- const A = T("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
- if (this.selectedCountryInner = T("div", { class: "iti__flag" }, A), this.selectedCountryA11yText = T(
+ const T = A("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
+ if (this.selectedCountryInner = A("div", { class: "iti__flag" }, T), this.selectedCountryA11yText = A(
"span",
{ class: "iti__a11y-text" },
this.selectedCountryInner
- ), e && (this.dropdownArrow = T(
+ ), e && (this.dropdownArrow = A(
"div",
{ class: "iti__arrow", "aria-hidden": "true" },
- A
- )), n && (this.selectedDialCode = T(
+ T
+ )), i && (this.selectedDialCode = A(
"div",
{ class: "iti__selected-dial-code" },
this.selectedCountry
)), e) {
const M = g ? "" : "iti--flexible-dropdown-width";
- if (this.dropdownContent = T("div", {
+ if (this.dropdownContent = A("div", {
id: `iti-${this.id}__dropdown-content`,
class: `iti__dropdown-content iti__hide ${M}`
- }), b && (this.searchInput = T(
+ }), b && (this.searchInput = A(
"input",
{
type: "text",
@@ -1840,11 +1842,11 @@ class U2 {
autocomplete: "off"
},
this.dropdownContent
- ), this.searchResultsA11yText = T(
+ ), this.searchResultsA11yText = A(
"span",
{ class: "iti__a11y-text" },
this.dropdownContent
- )), this.countryList = T(
+ )), this.countryList = A(
"ul",
{
class: "iti__country-list",
@@ -1855,48 +1857,48 @@ class U2 {
this.dropdownContent
), this._appendListItems(), b && this._updateSearchResultsText(), c) {
let O = "iti iti--container";
- f ? O += " iti--fullscreen-popup" : O += " iti--inline-dropdown", this.dropdown = T("div", { class: O }), this.dropdown.appendChild(this.dropdownContent);
+ f ? O += " iti--fullscreen-popup" : O += " iti--inline-dropdown", this.dropdown = A("div", { class: O }), this.dropdown.appendChild(this.dropdownContent);
} else
this.countryContainer.appendChild(this.dropdownContent);
}
}
- if (N.appendChild(this.telInput), this._updateInputPadding(), a) {
- const A = this.telInput.getAttribute("name") || "", M = a(A);
- M.phone && (this.hiddenInput = T("input", {
+ if (L.appendChild(this.telInput), this._updateInputPadding(), a) {
+ const T = this.telInput.getAttribute("name") || "", M = a(T);
+ M.phone && (this.hiddenInput = A("input", {
type: "hidden",
name: M.phone
- }), N.appendChild(this.hiddenInput)), M.country && (this.hiddenInputCountry = T("input", {
+ }), L.appendChild(this.hiddenInput)), M.country && (this.hiddenInputCountry = A("input", {
type: "hidden",
name: M.country
- }), N.appendChild(this.hiddenInputCountry));
+ }), L.appendChild(this.hiddenInputCountry));
}
}
//* For each country: add a country list item to the countryList container.
_appendListItems() {
for (let e = 0; e < this.countries.length; e++) {
- const n = this.countries[e], r = e === 0 ? "iti__highlight" : "", o = T(
+ const i = this.countries[e], n = e === 0 ? "iti__highlight" : "", o = A(
"li",
{
- id: `iti-${this.id}__item-${n.iso2}`,
- class: `iti__country ${r}`,
+ id: `iti-${this.id}__item-${i.iso2}`,
+ class: `iti__country ${n}`,
tabindex: "-1",
role: "option",
- "data-dial-code": n.dialCode,
- "data-country-code": n.iso2,
+ "data-dial-code": i.dialCode,
+ "data-country-code": i.iso2,
"aria-selected": "false"
},
this.countryList
);
- n.nodeById[this.id] = o;
+ i.nodeById[this.id] = o;
let a = "";
- this.options.showFlags && (a += `
`), a += `${n.name} `, a += `+${n.dialCode} `, o.insertAdjacentHTML("beforeend", a);
+ this.options.showFlags && (a += `
`), a += `${i.name} `, a += `+${i.dialCode} `, o.insertAdjacentHTML("beforeend", a);
}
}
//* Set the initial state of the input value and the selected country by:
//* 1. Extracting a dial code from the given number
//* 2. Using explicit initialCountry
_setInitialState(e = !1) {
- const n = this.telInput.getAttribute("value"), r = this.telInput.value, a = n && n.charAt(0) === "+" && (!r || r.charAt(0) !== "+") ? n : r, c = this._getDialCode(a), g = s2(a), { initialCountry: f, geoIpLookup: b } = this.options, _ = f === "auto" && b;
+ const i = this.telInput.getAttribute("value"), n = this.telInput.value, a = i && i.charAt(0) === "+" && (!n || n.charAt(0) !== "+") ? i : n, c = this._getDialCode(a), g = s2(a), { initialCountry: f, geoIpLookup: b } = this.options, _ = f === "auto" && b;
if (c && !g)
this._updateCountryFromNumber(a);
else if (!_ || e) {
@@ -1921,14 +1923,14 @@ class U2 {
}
//* initialise the dropdown listeners.
_initDropdownListeners() {
- this._handleLabelClick = (n) => {
- this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : n.preventDefault();
+ this._handleLabelClick = (i) => {
+ this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : i.preventDefault();
};
const e = this.telInput.closest("label");
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
- }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (n) => {
- this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === "Tab" && this._closeDropdown();
+ }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (i) => {
+ this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), this._openDropdown()), i.key === "Tab" && this._closeDropdown();
}, this.countryContainer.addEventListener(
"keydown",
this._handleCountryContainerKeydown
@@ -1936,17 +1938,19 @@ class U2 {
}
//* Init many requests: utils script / geo ip lookup.
_initRequests() {
- const { utilsScript: e, initialCountry: n, geoIpLookup: r } = this.options;
- e && !C.utils ? C.documentReady() ? C.loadUtils(e) : window.addEventListener("load", () => {
- C.loadUtils(e);
- }) : this.resolveUtilsScriptPromise(), n === "auto" && r && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
+ let { loadUtilsOnInit: e, utilsScript: i, initialCountry: n, geoIpLookup: o } = this.options;
+ !e && i && (console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."), e = i), e && !m.utils ? (this._handlePageLoad = () => {
+ var c;
+ window.removeEventListener("load", this._handlePageLoad), (c = m.loadUtils(e)) == null || c.catch(() => {
+ });
+ }, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), n === "auto" && o && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
}
//* Perform the geo ip lookup.
_loadAutoCountry() {
- C.autoCountry ? this.handleAutoCountry() : C.startedLoadingAutoCountry || (C.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
+ m.autoCountry ? this.handleAutoCountry() : m.startedLoadingAutoCountry || (m.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
(e = "") => {
- const n = e.toLowerCase();
- n && this._getCountryData(n, !0) ? (C.autoCountry = n, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
+ const i = e.toLowerCase();
+ i && this._getCountryData(i, !0) ? (m.autoCountry = i, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
},
() => {
this._setInitialState(!0), $1("rejectAutoCountryPromise");
@@ -1958,68 +1962,68 @@ class U2 {
}
//* Initialize the tel input listeners.
_initTelInputListeners() {
- const { strictMode: e, formatAsYouType: n, separateDialCode: r, formatOnDisplay: o, allowDropdown: a, countrySearch: c } = this.options;
+ const { strictMode: e, formatAsYouType: i, separateDialCode: n, formatOnDisplay: o, allowDropdown: a, countrySearch: c } = this.options;
let g = !1;
new RegExp("\\p{L}", "u").test(this.telInput.value) && (g = !0), this._handleInputEvent = (f) => {
- if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && r && a && c) {
- const N = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, N - 1), A = this.telInput.value.substring(N);
- this.telInput.value = v + A, this._openDropdownWithPlus();
+ if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && n && a && c) {
+ const L = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, L - 1), T = this.telInput.value.substring(L);
+ this.telInput.value = v + T, this._openDropdownWithPlus();
return;
}
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
const b = (f == null ? void 0 : f.data) && /[^+0-9]/.test(f.data), _ = (f == null ? void 0 : f.inputType) === "insertFromPaste" && this.telInput.value;
b || _ && !e ? g = !0 : /[^+0-9]/.test(this.telInput.value) || (g = !1);
const I = (f == null ? void 0 : f.detail) && f.detail.isSetNumber && !o;
- if (n && !g && !I) {
- const N = this.telInput.selectionStart || 0, A = this.telInput.value.substring(0, N).replace(/[^+0-9]/g, "").length, M = (f == null ? void 0 : f.inputType) === "deleteContentForward", O = this._formatNumberAsYouType(), Z = F2(A, O, N, M);
+ if (i && !g && !I) {
+ const L = this.telInput.selectionStart || 0, T = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, M = (f == null ? void 0 : f.inputType) === "deleteContentForward", O = this._formatNumberAsYouType(), Z = U2(T, O, L, M);
this.telInput.value = O, this.telInput.setSelectionRange(Z, Z);
}
- }, this.telInput.addEventListener("input", this._handleInputEvent), (e || r) && (this._handleKeydownEvent = (f) => {
+ }, this.telInput.addEventListener("input", this._handleInputEvent), (e || n) && (this._handleKeydownEvent = (f) => {
if (f.key && f.key.length === 1 && !f.altKey && !f.ctrlKey && !f.metaKey) {
- if (r && a && c && f.key === "+") {
+ if (n && a && c && f.key === "+") {
f.preventDefault(), this._openDropdownWithPlus();
return;
}
if (e) {
- const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+", N = /^[0-9]$/.test(f.key), v = r ? N : I || N, A = b.slice(0, this.telInput.selectionStart) + f.key + b.slice(this.telInput.selectionEnd), M = this._getFullNumber(A), O = C.utils.getCoreNumber(M, this.selectedCountryData.iso2), Z = this.maxCoreNumberLength && O.length > this.maxCoreNumberLength;
- let n1 = !1;
+ const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+", L = /^[0-9]$/.test(f.key), v = n ? L : I || L, T = b.slice(0, this.telInput.selectionStart) + f.key + b.slice(this.telInput.selectionEnd), M = this._getFullNumber(T), O = m.utils.getCoreNumber(M, this.selectedCountryData.iso2), Z = this.maxCoreNumberLength && O.length > this.maxCoreNumberLength;
+ let i1 = !1;
if (_) {
const p1 = this.selectedCountryData.iso2;
- n1 = this._getCountryFromNumber(M) !== p1;
+ i1 = this._getCountryFromNumber(M) !== p1;
}
- (!v || Z && !n1 && !I) && f.preventDefault();
+ (!v || Z && !i1 && !I) && f.preventDefault();
}
}
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
}
//* Adhere to the input's maxlength attr.
_cap(e) {
- const n = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
- return n && e.length > n ? e.substr(0, n) : e;
+ const i = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
+ return i && e.length > i ? e.substr(0, i) : e;
}
//* Trigger a custom event on the input.
- _trigger(e, n = {}) {
- const r = new CustomEvent(e, {
+ _trigger(e, i = {}) {
+ const n = new CustomEvent(e, {
bubbles: !0,
cancelable: !0,
- detail: n
+ detail: i
});
- this.telInput.dispatchEvent(r);
+ this.telInput.dispatchEvent(n);
}
//* Open the dropdown.
_openDropdown() {
- const { fixDropdownWidth: e, countrySearch: n } = this.options;
- if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), n) {
- const r = this.countryList.firstElementChild;
- r && (this._highlightListItem(r, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
+ const { fixDropdownWidth: e, countrySearch: i } = this.options;
+ if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), i) {
+ const n = this.countryList.firstElementChild;
+ n && (this._highlightListItem(n, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
}
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
}
//* Set the dropdown position
_setDropdownPosition() {
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
- const e = this.telInput.getBoundingClientRect(), n = this.telInput.offsetHeight;
- this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + n}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
+ const e = this.telInput.getBoundingClientRect(), i = this.telInput.offsetHeight;
+ this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + i}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
}
}
//* We only bind dropdown listeners when the dropdown is open.
@@ -2043,10 +2047,10 @@ class U2 {
"click",
this._handleClickOffToClose
);
- let n = "", r = null;
+ let i = "", n = null;
if (this._handleKeydownOnDropdown = (o) => {
- ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === "ArrowUp" || o.key === "ArrowDown" ? this._handleUpDownKey(o.key) : o.key === "Enter" ? this._handleEnterKey() : o.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(o.key) && (o.stopPropagation(), r && clearTimeout(r), n += o.key.toLowerCase(), this._searchForCountry(n), r = setTimeout(() => {
- n = "";
+ ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === "ArrowUp" || o.key === "ArrowDown" ? this._handleUpDownKey(o.key) : o.key === "Enter" ? this._handleEnterKey() : o.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(o.key) && (o.stopPropagation(), n && clearTimeout(n), i += o.key.toLowerCase(), this._searchForCountry(i), n = setTimeout(() => {
+ i = "";
}, 1e3));
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
const o = () => {
@@ -2063,40 +2067,40 @@ class U2 {
}
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
_searchForCountry(e) {
- for (let n = 0; n < this.countries.length; n++) {
- const r = this.countries[n];
- if (r.name.substr(0, e.length).toLowerCase() === e) {
- const a = r.nodeById[this.id];
+ for (let i = 0; i < this.countries.length; i++) {
+ const n = this.countries[i];
+ if (n.name.substr(0, e.length).toLowerCase() === e) {
+ const a = n.nodeById[this.id];
this._highlightListItem(a, !1), this._scrollTo(a);
break;
}
}
}
//* Country search enabled: Filter the countries according to the search query.
- _filterCountries(e, n = !1) {
- let r = !0;
+ _filterCountries(e, i = !1) {
+ let n = !0;
this.countryList.innerHTML = "";
const o = r2(e);
for (let a = 0; a < this.countries.length; a++) {
const c = this.countries[a], g = r2(c.name), f = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((_) => _[0]).join("").toLowerCase(), b = `+${c.dialCode}`;
- if (n || g.includes(o) || b.includes(o) || c.iso2.includes(o) || f.includes(o)) {
+ if (i || g.includes(o) || b.includes(o) || c.iso2.includes(o) || f.includes(o)) {
const _ = c.nodeById[this.id];
- _ && this.countryList.appendChild(_), r && (this._highlightListItem(_, !1), r = !1);
+ _ && this.countryList.appendChild(_), n && (this._highlightListItem(_, !1), n = !1);
}
}
- r && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
+ n && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
}
//* Update search results text (for a11y).
_updateSearchResultsText() {
- const { i18n: e } = this.options, n = this.countryList.childElementCount;
- let r;
- n === 0 ? r = e.zeroSearchResults : n === 1 ? r = e.oneSearchResult : r = e.multipleSearchResults.replace("${count}", n.toString()), this.searchResultsA11yText.textContent = r;
+ const { i18n: e } = this.options, i = this.countryList.childElementCount;
+ let n;
+ i === 0 ? n = e.zeroSearchResults : i === 1 ? n = e.oneSearchResult : n = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = n;
}
//* Highlight the next/prev item in the list (and ensure it is visible).
_handleUpDownKey(e) {
- var r, o;
- let n = e === "ArrowUp" ? (r = this.highlightedItem) == null ? void 0 : r.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
- !n && this.countryList.childElementCount > 1 && (n = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), n && (this._scrollTo(n), this._highlightListItem(n, !1));
+ var n, o;
+ let i = e === "ArrowUp" ? (n = this.highlightedItem) == null ? void 0 : n.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
+ !i && this.countryList.childElementCount > 1 && (i = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), i && (this._scrollTo(i), this._highlightListItem(i, !1));
}
//* Select the currently highlighted item.
_handleEnterKey() {
@@ -2105,29 +2109,29 @@ class U2 {
//* Update the input's value to the given val (format first if possible)
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
_updateValFromNumber(e) {
- let n = e;
- if (this.options.formatOnDisplay && C.utils && this.selectedCountryData) {
- const r = this.options.nationalMode || n.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: a } = C.utils.numberFormat, c = r ? o : a;
- n = C.utils.formatNumber(
- n,
+ let i = e;
+ if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
+ const n = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: a } = m.utils.numberFormat, c = n ? o : a;
+ i = m.utils.formatNumber(
+ i,
this.selectedCountryData.iso2,
c
);
}
- n = this._beforeSetNumber(n), this.telInput.value = n;
+ i = this._beforeSetNumber(i), this.telInput.value = i;
}
//* Check if need to select a new country based on the given number
//* Note: called from _setInitialState, keyup handler, setNumber.
_updateCountryFromNumber(e) {
- const n = this._getCountryFromNumber(e);
- return n !== null ? this._setCountry(n) : !1;
+ const i = this._getCountryFromNumber(e);
+ return i !== null ? this._setCountry(i) : !1;
}
_getCountryFromNumber(e) {
- const n = e.indexOf("+");
- let r = n ? e.substring(n) : e;
+ const i = e.indexOf("+");
+ let n = i ? e.substring(i) : e;
const o = this.selectedCountryData.dialCode;
- r && o === "1" && r.charAt(0) !== "+" && (r.charAt(0) !== "1" && (r = `1${r}`), r = `+${r}`), this.options.separateDialCode && o && r.charAt(0) !== "+" && (r = `+${o}${r}`);
- const c = this._getDialCode(r, !0), g = f1(r);
+ n && o === "1" && n.charAt(0) !== "+" && (n.charAt(0) !== "1" && (n = `1${n}`), n = `+${n}`), this.options.separateDialCode && o && n.charAt(0) !== "+" && (n = `+${o}${n}`);
+ const c = this._getDialCode(n, !0), g = f1(n);
if (c) {
const f = this.dialCodeToIso2Map[f1(c)], b = f.indexOf(this.selectedCountryData.iso2) !== -1 && g.length <= c.length - 1;
if (!(o === "1" && s2(g)) && !b) {
@@ -2136,42 +2140,42 @@ class U2 {
return f[I];
}
} else {
- if (r.charAt(0) === "+" && g.length)
+ if (n.charAt(0) === "+" && g.length)
return "";
- if ((!r || r === "+") && !this.selectedCountryData.iso2)
+ if ((!n || n === "+") && !this.selectedCountryData.iso2)
return this.defaultCountry;
}
return null;
}
//* Remove highlighting from other list items and highlight the given item.
- _highlightListItem(e, n) {
- const r = this.highlightedItem;
- if (r && (r.classList.remove("iti__highlight"), r.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
+ _highlightListItem(e, i) {
+ const n = this.highlightedItem;
+ if (n && (n.classList.remove("iti__highlight"), n.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
const o = this.highlightedItem.getAttribute("id") || "";
this.selectedCountry.setAttribute("aria-activedescendant", o), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", o);
}
- n && this.highlightedItem.focus();
+ i && this.highlightedItem.focus();
}
//* Find the country data for the given iso2 code
//* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
- _getCountryData(e, n) {
- for (let r = 0; r < this.countries.length; r++)
- if (this.countries[r].iso2 === e)
- return this.countries[r];
- if (n)
+ _getCountryData(e, i) {
+ for (let n = 0; n < this.countries.length; n++)
+ if (this.countries[n].iso2 === e)
+ return this.countries[n];
+ if (i)
return null;
throw new Error(`No country data for '${e}'`);
}
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
_setCountry(e) {
- const { separateDialCode: n, showFlags: r, i18n: o } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
+ const { separateDialCode: i, showFlags: n, i18n: o } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
let c = "", g = "";
- e && r ? (c = `iti__flag iti__${e}`, g = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (c = "iti__flag iti__globe", g = o.noCountrySelected), this.selectedCountryInner.className = c, this.selectedCountryA11yText.textContent = g;
+ e && n ? (c = `iti__flag iti__${e}`, g = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (c = "iti__flag iti__globe", g = o.noCountrySelected), this.selectedCountryInner.className = c, this.selectedCountryA11yText.textContent = g;
}
- if (this._setSelectedCountryTitleAttribute(e, n), n) {
+ if (this._setSelectedCountryTitleAttribute(e, i), i) {
const c = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
this.selectedDialCode.innerHTML = c, this._updateInputPadding();
}
@@ -2180,34 +2184,34 @@ class U2 {
//* Update the input padding to make space for the selected country/dial code.
_updateInputPadding() {
if (this.selectedCountry) {
- const n = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
- this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${n}px` : this.telInput.style.paddingRight = `${n}px`;
+ const i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
+ this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`;
}
}
//* Update the maximum valid number length for the currently selected country.
_updateMaxLength() {
- const { strictMode: e, placeholderNumberType: n, validationNumberType: r } = this.options, { iso2: o } = this.selectedCountryData;
- if (e && C.utils)
+ const { strictMode: e, placeholderNumberType: i, validationNumberType: n } = this.options, { iso2: o } = this.selectedCountryData;
+ if (e && m.utils)
if (o) {
- const a = C.utils.numberType[n];
- let c = C.utils.getExampleNumber(
+ const a = m.utils.numberType[i];
+ let c = m.utils.getExampleNumber(
o,
!1,
a,
!0
), g = c;
- for (; C.utils.isPossibleNumber(c, o, r); )
+ for (; m.utils.isPossibleNumber(c, o, n); )
g = c, c += "0";
- const f = C.utils.getCoreNumber(g, o);
+ const f = m.utils.getCoreNumber(g, o);
this.maxCoreNumberLength = f.length, o === "by" && (this.maxCoreNumberLength = f.length + 1);
} else
this.maxCoreNumberLength = null;
}
- _setSelectedCountryTitleAttribute(e = null, n) {
+ _setSelectedCountryTitleAttribute(e = null, i) {
if (!this.selectedCountry)
return;
- let r;
- e && !n ? r = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? r = this.selectedCountryData.name : r = "Unknown", this.selectedCountry.setAttribute("title", r);
+ let n;
+ e && !i ? n = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? n = this.selectedCountryData.name : n = "Unknown", this.selectedCountry.setAttribute("title", n);
}
//* When the input is in a hidden container during initialisation, we must inject some markup
//* into the end of the DOM to calculate the correct offsetWidth.
@@ -2217,11 +2221,11 @@ class U2 {
if (this.telInput.parentNode) {
const e = this.telInput.parentNode.cloneNode(!1);
e.style.visibility = "hidden", document.body.appendChild(e);
- const n = this.countryContainer.cloneNode();
- e.appendChild(n);
- const r = this.selectedCountry.cloneNode(!0);
- n.appendChild(r);
- const o = r.offsetWidth;
+ const i = this.countryContainer.cloneNode();
+ e.appendChild(i);
+ const n = this.selectedCountry.cloneNode(!0);
+ i.appendChild(n);
+ const o = n.offsetWidth;
return document.body.removeChild(e), o;
}
return 0;
@@ -2230,15 +2234,15 @@ class U2 {
_updatePlaceholder() {
const {
autoPlaceholder: e,
- placeholderNumberType: n,
- nationalMode: r,
+ placeholderNumberType: i,
+ nationalMode: n,
customPlaceholder: o
} = this.options, a = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
- if (C.utils && a) {
- const c = C.utils.numberType[n];
- let g = this.selectedCountryData.iso2 ? C.utils.getExampleNumber(
+ if (m.utils && a) {
+ const c = m.utils.numberType[i];
+ let g = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
this.selectedCountryData.iso2,
- r,
+ n,
c
) : "";
g = this._beforeSetNumber(g), typeof o == "function" && (g = o(g, this.selectedCountryData)), this.telInput.setAttribute("placeholder", g);
@@ -2246,10 +2250,10 @@ class U2 {
}
//* Called when the user selects a list item from the dropdown.
_selectListItem(e) {
- const n = this._setCountry(
+ const i = this._setCountry(
e.getAttribute("data-country-code")
);
- this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), n && this._triggerCountryChange();
+ this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), i && this._triggerCountryChange();
}
//* Close the dropdown and unbind any listeners.
_closeDropdown() {
@@ -2259,41 +2263,41 @@ class U2 {
), this.countryList.removeEventListener(
"mouseover",
this._handleMouseoverCountryList
- ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
+ ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this._trigger("close:countrydropdown");
}
//* Check if an element is visible within it's container, else scroll until it is.
_scrollTo(e) {
- const n = this.countryList, r = document.documentElement.scrollTop, o = n.offsetHeight, a = n.getBoundingClientRect().top + r, c = a + o, g = e.offsetHeight, f = e.getBoundingClientRect().top + r, b = f + g, _ = f - a + n.scrollTop;
+ const i = this.countryList, n = document.documentElement.scrollTop, o = i.offsetHeight, a = i.getBoundingClientRect().top + n, c = a + o, g = e.offsetHeight, f = e.getBoundingClientRect().top + n, b = f + g, _ = f - a + i.scrollTop;
if (f < a)
- n.scrollTop = _;
+ i.scrollTop = _;
else if (b > c) {
const I = o - g;
- n.scrollTop = _ - I;
+ i.scrollTop = _ - I;
}
}
//* Replace any existing dial code with the new one
//* Note: called from _selectListItem and setCountry
_updateDialCode(e) {
- const n = this.telInput.value, r = `+${e}`;
+ const i = this.telInput.value, n = `+${e}`;
let o;
- if (n.charAt(0) === "+") {
- const a = this._getDialCode(n);
- a ? o = n.replace(a, r) : o = r, this.telInput.value = o;
+ if (i.charAt(0) === "+") {
+ const a = this._getDialCode(i);
+ a ? o = i.replace(a, n) : o = n, this.telInput.value = o;
}
}
//* Try and extract a valid international dial code from a full telephone number.
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
- _getDialCode(e, n) {
- let r = "";
+ _getDialCode(e, i) {
+ let n = "";
if (e.charAt(0) === "+") {
let o = "";
for (let a = 0; a < e.length; a++) {
const c = e.charAt(a);
if (!isNaN(parseInt(c, 10))) {
- if (o += c, n)
- this.dialCodeToIso2Map[o] && (r = e.substr(0, a + 1));
+ if (o += c, i)
+ this.dialCodeToIso2Map[o] && (n = e.substr(0, a + 1));
else if (this.dialCodes[o]) {
- r = e.substr(0, a + 1);
+ n = e.substr(0, a + 1);
break;
}
if (o.length === this.dialCodeMaxLen)
@@ -2301,27 +2305,27 @@ class U2 {
}
}
}
- return r;
+ return n;
}
//* Get the input val, adding the dial code if separateDialCode is enabled.
_getFullNumber(e) {
- const n = e || this.telInput.value.trim(), { dialCode: r } = this.selectedCountryData;
+ const i = e || this.telInput.value.trim(), { dialCode: n } = this.selectedCountryData;
let o;
- const a = f1(n);
- return this.options.separateDialCode && n.charAt(0) !== "+" && r && a ? o = `+${r}` : o = "", o + n;
+ const a = f1(i);
+ return this.options.separateDialCode && i.charAt(0) !== "+" && n && a ? o = `+${n}` : o = "", o + i;
}
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
_beforeSetNumber(e) {
- let n = e;
+ let i = e;
if (this.options.separateDialCode) {
- let r = this._getDialCode(n);
- if (r) {
- r = `+${this.selectedCountryData.dialCode}`;
- const o = n[r.length] === " " || n[r.length] === "-" ? r.length + 1 : r.length;
- n = n.substr(o);
+ let n = this._getDialCode(i);
+ if (n) {
+ n = `+${this.selectedCountryData.dialCode}`;
+ const o = i[n.length] === " " || i[n.length] === "-" ? n.length + 1 : n.length;
+ i = i.substr(o);
}
}
- return this._cap(n);
+ return this._cap(i);
}
//* Trigger the 'countrychange' event.
_triggerCountryChange() {
@@ -2329,19 +2333,19 @@ class U2 {
}
//* Format the number as the user types.
_formatNumberAsYouType() {
- const e = this._getFullNumber(), n = C.utils ? C.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: r } = this.selectedCountryData;
- return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && n.includes(`+${r}`) ? (n.split(`+${r}`)[1] || "").trim() : n;
+ const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: n } = this.selectedCountryData;
+ return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${n}`) ? (i.split(`+${n}`)[1] || "").trim() : i;
}
//**************************
//* SECRET PUBLIC METHODS
//**************************
//* This is called when the geoip call returns.
handleAutoCountry() {
- this.options.initialCountry === "auto" && C.autoCountry && (this.defaultCountry = C.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
+ this.options.initialCountry === "auto" && m.autoCountry && (this.defaultCountry = m.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
}
//* This is called when the utils request completes.
handleUtils() {
- C.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
+ m.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
}
//********************
//* PUBLIC METHODS
@@ -2349,7 +2353,7 @@ class U2 {
//* Remove plugin.
destroy() {
var a, c;
- const { allowDropdown: e, separateDialCode: n } = this.options;
+ const { allowDropdown: e, separateDialCode: i } = this.options;
if (e) {
this._closeDropdown(), this.selectedCountry.removeEventListener(
"click",
@@ -2361,25 +2365,25 @@ class U2 {
const g = this.telInput.closest("label");
g && g.removeEventListener("click", this._handleLabelClick);
}
- const { form: r } = this.telInput;
- this._handleHiddenInputSubmit && r && r.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), n && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
+ const { form: n } = this.telInput;
+ this._handleHiddenInputSubmit && n && n.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), i && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
const o = this.telInput.parentNode;
- (a = o == null ? void 0 : o.parentNode) == null || a.insertBefore(this.telInput, o), (c = o == null ? void 0 : o.parentNode) == null || c.removeChild(o), delete C.instances[this.id];
+ (a = o == null ? void 0 : o.parentNode) == null || a.insertBefore(this.telInput, o), (c = o == null ? void 0 : o.parentNode) == null || c.removeChild(o), delete m.instances[this.id];
}
//* Get the extension from the current number.
getExtension() {
- return C.utils ? C.utils.getExtension(
+ return m.utils ? m.utils.getExtension(
this._getFullNumber(),
this.selectedCountryData.iso2
) : "";
}
//* Format the number to the given format.
getNumber(e) {
- if (C.utils) {
- const { iso2: n } = this.selectedCountryData;
- return C.utils.formatNumber(
+ if (m.utils) {
+ const { iso2: i } = this.selectedCountryData;
+ return m.utils.formatNumber(
this._getFullNumber(),
- n,
+ i,
e
);
}
@@ -2387,7 +2391,7 @@ class U2 {
}
//* Get the type of the entered number e.g. landline/mobile.
getNumberType() {
- return C.utils ? C.utils.getNumberType(
+ return m.utils ? m.utils.getNumberType(
this._getFullNumber(),
this.selectedCountryData.iso2
) : -99;
@@ -2398,9 +2402,9 @@ class U2 {
}
//* Get the validation error.
getValidationError() {
- if (C.utils) {
+ if (m.utils) {
const { iso2: e } = this.selectedCountryData;
- return C.utils.getValidationError(this._getFullNumber(), e);
+ return m.utils.getValidationError(this._getFullNumber(), e);
}
return -99;
}
@@ -2408,39 +2412,39 @@ class U2 {
isValidNumber() {
if (!this.selectedCountryData.iso2)
return !1;
- const e = this._getFullNumber(), n = e.search(new RegExp("\\p{L}", "u"));
- if (n > -1) {
- const r = e.substring(0, n), o = this._utilsIsPossibleNumber(r), a = this._utilsIsPossibleNumber(e);
+ const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u"));
+ if (i > -1) {
+ const n = e.substring(0, i), o = this._utilsIsPossibleNumber(n), a = this._utilsIsPossibleNumber(e);
return o && a;
}
return this._utilsIsPossibleNumber(e);
}
_utilsIsPossibleNumber(e) {
- return C.utils ? C.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberType) : null;
+ return m.utils ? m.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberType) : null;
}
//* Validate the input val (precise)
isValidNumberPrecise() {
if (!this.selectedCountryData.iso2)
return !1;
- const e = this._getFullNumber(), n = e.search(new RegExp("\\p{L}", "u"));
- if (n > -1) {
- const r = e.substring(0, n), o = this._utilsIsValidNumber(r), a = this._utilsIsValidNumber(e);
+ const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u"));
+ if (i > -1) {
+ const n = e.substring(0, i), o = this._utilsIsValidNumber(n), a = this._utilsIsValidNumber(e);
return o && a;
}
return this._utilsIsValidNumber(e);
}
_utilsIsValidNumber(e) {
- return C.utils ? C.utils.isValidNumber(e, this.selectedCountryData.iso2) : null;
+ return m.utils ? m.utils.isValidNumber(e, this.selectedCountryData.iso2) : null;
}
//* Update the selected country, and update the input val accordingly.
setCountry(e) {
- const n = e == null ? void 0 : e.toLowerCase(), r = this.selectedCountryData.iso2;
- (e && n !== r || !e && r) && (this._setCountry(n), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
+ const i = e == null ? void 0 : e.toLowerCase(), n = this.selectedCountryData.iso2;
+ (e && i !== n || !e && n) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
}
//* Set the input value and update the country.
setNumber(e) {
- const n = this._updateCountryFromNumber(e);
- this._updateValFromNumber(e), n && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
+ const i = this._updateCountryFromNumber(e);
+ this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
}
//* Set the placeholder number typ
setPlaceholderNumberType(e) {
@@ -2450,20 +2454,34 @@ class U2 {
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
}
}
-const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUtilsScript = !0, new Promise((e, n) => {
- import_INTENTIONALLY_BROKEN(
- /* webpackIgnore: true */
- /* @vite-ignore */
- y
- ).then(({ default: r }) => {
- C.utils = r, $1("handleUtils"), e(!0);
- }).catch(() => {
- $1("rejectUtilsScriptPromise"), n();
- });
-})) : null, C = Object.assign(
+const V2 = (y) => {
+ if (!m.utils && !m.startedLoadingUtilsScript) {
+ let e;
+ if (typeof y == "string")
+ e = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
+ else if (typeof y == "function")
+ try {
+ if (e = y(), !(e instanceof Promise))
+ throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof e}`);
+ } catch (i) {
+ return Promise.reject(i);
+ }
+ else
+ return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof y}`));
+ return m.startedLoadingUtilsScript = !0, e.then((i) => {
+ const n = i == null ? void 0 : i.default;
+ if (!n || typeof n != "object")
+ throw typeof y == "string" ? new TypeError(`The module loaded from ${y} did not set utils as its default export.`) : new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
+ return m.utils = n, $1("handleUtils"), !0;
+ }).catch((i) => {
+ throw $1("rejectUtilsScriptPromise", i), i;
+ });
+ }
+ return null;
+}, m = Object.assign(
(y, e) => {
- const n = new U2(y, e);
- return n._init(), y.setAttribute("data-intl-tel-input-id", n.id.toString()), C.instances[n.id] = n, n;
+ const i = new F2(y, e);
+ return i._init(), y.setAttribute("data-intl-tel-input-id", i.id.toString()), m.instances[i.id] = i, i;
},
{
defaults: u2,
@@ -2474,11 +2492,13 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
//* A getter for the plugin instance.
getInstance: (y) => {
const e = y.getAttribute("data-intl-tel-input-id");
- return e ? C.instances[e] : null;
+ return e ? m.instances[e] : null;
},
//* A map from instance ID to instance object.
instances: {},
loadUtils: V2,
+ startedLoadingUtilsScript: !1,
+ startedLoadingAutoCountry: !1,
version: "24.5.2"
}
);
@@ -2488,20 +2508,20 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
d = d.split(".");
var $ = y;
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
- for (var i; d.length && (i = d.shift()); ) d.length || t === void 0 ? $[i] && $[i] !== Object.prototype[i] ? $ = $[i] : $ = $[i] = {} : $[i] = t;
+ for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? $[r] && $[r] !== Object.prototype[r] ? $ = $[r] : $ = $[r] = {} : $[r] = t;
}
- function n(d, t) {
+ function i(d, t) {
function $() {
}
- $.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(i, s, u) {
+ $.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(r, s, u) {
for (var l = Array(arguments.length - 2), h = 2; h < arguments.length; h++) l[h - 2] = arguments[h];
- return t.prototype[s].apply(i, l);
+ return t.prototype[s].apply(r, l);
};
}
- function r(d) {
+ function n(d) {
const t = [];
let $ = 0;
- for (const i in d) t[$++] = d[i];
+ for (const r in d) t[$++] = d[r];
return t;
}
var o = class {
@@ -2546,20 +2566,20 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
}
new I();
- function N(d, t) {
+ function L(d, t) {
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
case M:
case O:
case Z:
- case n1:
+ case i1:
case p1:
- case A:
+ case T:
case v:
this.o = !0;
}
this.j = t.defaultValue;
}
- var v = 1, A = 2, M = 3, O = 4, Z = 6, n1 = 16, p1 = 18;
+ var v = 1, T = 2, M = 3, O = 4, Z = 6, i1 = 16, p1 = 18;
function v1(d, t) {
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
var $ = t[d];
@@ -2567,52 +2587,52 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
}
function l2(d) {
- return d = r(d.g), d.sort(function(t, $) {
+ return d = n(d.g), d.sort(function(t, $) {
return t.g - $.g;
}), d;
}
- function P() {
+ function x() {
this.h = {}, this.j = this.m().g, this.g = this.l = null;
}
- P.prototype.has = function(d) {
+ x.prototype.has = function(d) {
return R(this, d.g);
- }, P.prototype.get = function(d, t) {
+ }, x.prototype.get = function(d, t) {
return p(this, d.g, t);
- }, P.prototype.set = function(d, t) {
+ }, x.prototype.set = function(d, t) {
E(this, d.g, t);
- }, P.prototype.add = function(d, t) {
+ }, x.prototype.add = function(d, t) {
w1(this, d.g, t);
};
function S1(d, t) {
- for (var $ = l2(d.m()), i = 0; i < $.length; i++) {
- var s = $[i], u = s.g;
+ for (var $ = l2(d.m()), r = 0; r < $.length; r++) {
+ var s = $[r], u = s.g;
if (R(t, u)) {
d.g && delete d.g[s.g];
var l = s.h == 11 || s.h == 10;
if (s.l) {
- s = x(t, u);
+ s = P(t, u);
for (var h = 0; h < s.length; h++) w1(d, u, l ? s[h].clone() : s[h]);
- } else s = i1(t, u), l ? (l = i1(d, u)) ? S1(l, s) : E(d, u, s.clone()) : E(d, u, s);
+ } else s = n1(t, u), l ? (l = n1(d, u)) ? S1(l, s) : E(d, u, s.clone()) : E(d, u, s);
}
}
}
- P.prototype.clone = function() {
+ x.prototype.clone = function() {
var d = new this.constructor();
return d != this && (d.h = {}, d.g && (d.g = {}), S1(d, this)), d;
};
function R(d, t) {
return d.h[t] != null;
}
- function i1(d, t) {
+ function n1(d, t) {
var $ = d.h[t];
if ($ == null) return null;
if (d.l) {
if (!(t in d.g)) {
- var i = d.l, s = d.j[t];
+ var r = d.l, s = d.j[t];
if ($ != null) if (s.l) {
- for (var u = [], l = 0; l < $.length; l++) u[l] = i.h(s, $[l]);
+ for (var u = [], l = 0; l < $.length; l++) u[l] = r.h(s, $[l]);
$ = u;
- } else $ = i.h(s, $);
+ } else $ = r.h(s, $);
return d.g[t] = $;
}
return d.g[t];
@@ -2620,8 +2640,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
return $;
}
function p(d, t, $) {
- var i = i1(d, t);
- return d.j[t].l ? i[$ || 0] : i;
+ var r = n1(d, t);
+ return d.j[t].l ? r[$ || 0] : r;
}
function S(d, t) {
if (R(d, t)) d = p(d, t);
@@ -2637,10 +2657,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
return d;
}
- function x(d, t) {
- return i1(d, t) || [];
+ function P(d, t) {
+ return n1(d, t) || [];
}
- function U(d, t) {
+ function F(d, t) {
return d.j[t].l ? R(d, t) ? d.h[t].length : 0 : R(d, t) ? 1 : 0;
}
function E(d, t, $) {
@@ -2650,8 +2670,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
}
function r1(d, t) {
- var $ = [], i;
- for (i in t) i != 0 && $.push(new N(i, t[i]));
+ var $ = [], r;
+ for (r in t) r != 0 && $.push(new L(r, t[r]));
return new v1(d, $);
}
function s1() {
@@ -2659,7 +2679,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
s1.prototype.g = function(d) {
throw new d.h(), Error("Unimplemented");
}, s1.prototype.h = function(d, t) {
- if (d.h == 11 || d.h == 10) return t instanceof P ? t : this.g(d.s.prototype.m(), t);
+ if (d.h == 11 || d.h == 10) return t instanceof x ? t : this.g(d.s.prototype.m(), t);
if (d.h == 14) return typeof t == "string" && b1.test(t) && (d = Number(t), 0 < d) ? d : t;
if (!d.o) return t;
if (d = d.s, d === String) {
@@ -2670,55 +2690,55 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
var b1 = /^-?[0-9]+$/;
function g1() {
}
- n(g1, s1), g1.prototype.g = function(d, t) {
+ i(g1, s1), g1.prototype.g = function(d, t) {
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
};
function q() {
}
- n(q, g1), q.prototype.h = function(d, t) {
+ i(q, g1), q.prototype.h = function(d, t) {
return d.h == 8 ? !!t : s1.prototype.h.apply(this, arguments);
}, q.prototype.g = function(d, t) {
return q.ma.g.call(this, d, t);
};
- function L(d, t) {
+ function N(d, t) {
d != null && this.g.apply(this, arguments);
}
- L.prototype.h = "", L.prototype.set = function(d) {
+ N.prototype.h = "", N.prototype.set = function(d) {
this.h = "" + d;
- }, L.prototype.g = function(d, t, $) {
- if (this.h += String(d), t != null) for (let i = 1; i < arguments.length; i++) this.h += arguments[i];
+ }, N.prototype.g = function(d, t, $) {
+ if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
return this;
};
function B(d) {
d.h = "";
}
- L.prototype.toString = function() {
+ N.prototype.toString = function() {
return this.h;
};
function j() {
- P.call(this);
+ x.call(this);
}
- n(j, P);
- var N1 = null;
+ i(j, x);
+ var L1 = null;
function w() {
- P.call(this);
+ x.call(this);
}
- n(w, P);
- var A1 = null;
+ i(w, x);
+ var T1 = null;
function W() {
- P.call(this);
+ x.call(this);
}
- n(W, P);
- var L1 = null;
+ i(W, x);
+ var N1 = null;
j.prototype.m = function() {
- var d = N1;
- return d || (N1 = d = r1(j, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
+ var d = L1;
+ return d || (L1 = d = r1(j, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
}, j.m = j.prototype.m, w.prototype.m = function() {
- var d = A1;
- return d || (A1 = d = r1(w, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
+ var d = T1;
+ return d || (T1 = d = r1(w, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
}, w.m = w.prototype.m, W.prototype.m = function() {
- var d = L1;
- return d || (L1 = d = r1(W, {
+ var d = N1;
+ return d || (N1 = d = r1(W, {
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
1: { name: "general_desc", i: 11, type: w },
2: { name: "fixed_line", i: 11, type: w },
@@ -2757,13 +2777,13 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
})), d;
}, W.m = W.prototype.m;
function V() {
- P.call(this);
+ x.call(this);
}
- n(V, P);
- var T1 = null, a2 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
+ i(V, x);
+ var A1 = null, a2 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
V.prototype.m = function() {
- var d = T1;
- return d || (T1 = d = r1(V, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: a2 }, 7: {
+ var d = A1;
+ return d || (A1 = d = r1(V, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: a2 }, 7: {
name: "preferred_domestic_carrier_code",
i: 9,
type: String
@@ -8015,8 +8035,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
function M1() {
return ";ext=" + Y("20") + "|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[ \\t,-]*" + (Y("20") + "#?|[ \\t,]*(?:[xx##~~]|int|int)[:\\..]?[ \\t,-]*") + (Y("9") + "#?|[- ]+") + (Y("6") + "#|[ \\t]*(?:,{2}|;)[:\\..]?[ \\t,-]*") + (Y("15") + "#?|[ \\t]*(?:,)+[:\\..]?[ \\t,-]*") + (Y("9") + "#?");
}
- var x1 = new RegExp("(?:" + M1() + ")$", "i"), I2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + M1() + ")?$", "i"), v2 = /(\$\d)/, S2 = /^\(?\$1\)?$/;
- function P1(d) {
+ var P1 = new RegExp("(?:" + M1() + ")$", "i"), I2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + M1() + ")?$", "i"), v2 = /(\$\d)/, S2 = /^\(?\$1\)?$/;
+ function x1(d) {
return 2 > d.length ? !1 : G(I2, d);
}
function R1(d) {
@@ -8027,10 +8047,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
B(d), d.g(t);
}
function k1(d) {
- return d != null && (U(d, 9) != 1 || x(d, 9)[0] != -1);
+ return d != null && (F(d, 9) != 1 || P(d, 9)[0] != -1);
}
function o1(d, t) {
- for (var $ = new L(), i, s = d.length, u = 0; u < s; ++u) i = d.charAt(u), i = t[i.toUpperCase()], i != null && $.g(i);
+ for (var $ = new N(), r, s = d.length, u = 0; u < s; ++u) r = d.charAt(u), r = t[r.toUpperCase()], r != null && $.g(r);
return $.toString();
}
function O1(d) {
@@ -8045,17 +8065,17 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
if (0 < $.length) return $;
}
$ = S(d, 1);
- var i = t1(d);
- if (t == 0) return G1($, 0, i, "");
- if (!($ in X)) return i;
+ var r = t1(d);
+ if (t == 0) return G1($, 0, r, "");
+ if (!($ in X)) return r;
var s = d1(this, $, e1($));
d = R(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : R(s, 13) ? p(s, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
d: {
- s = x(s, 20).length == 0 || t == 2 ? x(s, 19) : x(s, 20);
+ s = P(s, 20).length == 0 || t == 2 ? P(s, 19) : P(s, 20);
for (var u, l = s.length, h = 0; h < l; ++h) {
u = s[h];
- var m = U(u, 3);
- if ((m == 0 || i.search(p(u, 3, m - 1)) == 0) && (m = new RegExp(p(u, 1)), G(m, i))) {
+ var C = F(u, 3);
+ if ((C == 0 || r.search(p(u, 3, C - 1)) == 0) && (C = new RegExp(p(u, 1)), G(C, r))) {
s = u;
break d;
}
@@ -8065,7 +8085,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
return s != null && (l = s, s = S(l, 2), u = new RegExp(p(l, 1)), S(
l,
5
- ), l = S(l, 4), i = t == 2 && l != null && 0 < l.length ? i.replace(u, s.replace(v2, l)) : i.replace(u, s), t == 3 && (i = i.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), i = i.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), G1($, t, i, d);
+ ), l = S(l, 4), r = t == 2 && l != null && 0 < l.length ? r.replace(u, s.replace(v2, l)) : r.replace(u, s), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), G1($, t, r, d);
};
function d1(d, t, $) {
return $ == "001" ? K(d, "" + t) : K(d, $);
@@ -8075,16 +8095,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
var t = "" + p(d, 2);
return R(d, 4) && p(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
}
- function G1(d, t, $, i) {
+ function G1(d, t, $, r) {
switch (t) {
case 0:
- return "+" + d + $ + i;
+ return "+" + d + $ + r;
case 1:
- return "+" + d + " " + $ + i;
+ return "+" + d + " " + $ + r;
case 3:
- return "tel:+" + d + "-" + $ + i;
+ return "tel:+" + d + "-" + $ + r;
default:
- return $ + i;
+ return $ + r;
}
}
function l1(d, t) {
@@ -8129,25 +8149,25 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
function k(d, t) {
var $ = d.length;
- return 0 < U(t, 9) && x(t, 9).indexOf($) == -1 ? !1 : G(S(t, 2), d);
+ return 0 < F(t, 9) && P(t, 9).indexOf($) == -1 ? !1 : G(S(t, 2), d);
}
- function F1(d, t) {
+ function U1(d, t) {
if (t == null) return null;
var $ = S(t, 1);
if ($ = X[$], $ == null) d = null;
else if ($.length == 1) d = $[0];
else d: {
t = t1(t);
- for (var i, s = $.length, u = 0; u < s; u++) {
- i = $[u];
- var l = K(d, i);
+ for (var r, s = $.length, u = 0; u < s; u++) {
+ r = $[u];
+ var l = K(d, r);
if (R(l, 23)) {
if (t.search(p(l, 23)) == 0) {
- d = i;
+ d = r;
break d;
}
} else if (m1(t, l) != -1) {
- d = i;
+ d = r;
break d;
}
}
@@ -8158,28 +8178,28 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
function e1(d) {
return d = X[d], d == null ? "ZZ" : d[0];
}
- function U1(d, t) {
+ function F1(d, t) {
if (d = K(d, t), d == null) throw Error("Invalid region code: " + t);
return S(d, 10);
}
- function a1(d, t, $, i) {
- var s = l1($, i), u = U(s, 9) == 0 ? x(p($, 1), 9) : x(s, 9);
- if (s = x(s, 10), i == 2) if (k1(l1($, 0))) d = l1($, 1), k1(d) && (u = u.concat(U(d, 9) == 0 ? x(p($, 1), 9) : x(d, 9)), u.sort(), s.length == 0 ? s = x(d, 10) : (s = s.concat(x(d, 10)), s.sort()));
+ function a1(d, t, $, r) {
+ var s = l1($, r), u = F(s, 9) == 0 ? P(p($, 1), 9) : P(s, 9);
+ if (s = P(s, 10), r == 2) if (k1(l1($, 0))) d = l1($, 1), k1(d) && (u = u.concat(F(d, 9) == 0 ? P(p($, 1), 9) : P(d, 9)), u.sort(), s.length == 0 ? s = P(d, 10) : (s = s.concat(P(d, 10)), s.sort()));
else return a1(d, t, $, 1);
return u[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : ($ = u[0], $ == t ? 0 : $ > t ? 2 : u[u.length - 1] < t ? 3 : -1 < u.indexOf(t, 1) ? 0 : 5));
}
function J(d, t, $) {
- var i = t1(t);
- return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), a1(d, i, t, $)) : 1;
+ var r = t1(t);
+ return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), a1(d, r, t, $)) : 1;
}
function V1(d, t) {
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
- for (var $, i = d.length, s = 1; 3 >= s && s <= i; ++s) if ($ = parseInt(d.substring(0, s), 10), $ in X) return t.g(d.substring(s)), $;
+ for (var $, r = d.length, s = 1; 3 >= s && s <= r; ++s) if ($ = parseInt(d.substring(0, s), 10), $ in X) return t.g(d.substring(s)), $;
return 0;
}
- function K1(d, t, $, i, s, u) {
+ function K1(d, t, $, r, s, u) {
if (t.length == 0) return 0;
- t = new L(t);
+ t = new N(t);
var l;
$ != null && (l = p($, 11)), l == null && (l = "NonMatch");
var h = t.toString();
@@ -8188,26 +8208,26 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
else {
if (h = new RegExp(l), B1(t), l = t.toString(), l.search(h) == 0) {
h = l.match(h)[0].length;
- var m = l.substring(h).match(D1);
- m && m[1] != null && 0 < m[1].length && o1(m[1], C1) == "0" ? l = !1 : (B(t), t.g(l.substring(h)), l = !0);
+ var C = l.substring(h).match(D1);
+ C && C[1] != null && 0 < C[1].length && o1(C[1], C1) == "0" ? l = !1 : (B(t), t.g(l.substring(h)), l = !0);
} else l = !1;
l = l ? 5 : 20;
}
if (s && E(u, 6, l), l != 20) {
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
- if (d = V1(t, i), d != 0) return E(u, 1, d), d;
+ if (d = V1(t, r), d != 0) return E(u, 1, d), d;
throw Error("Invalid country calling code");
}
- return $ != null && (l = S($, 10), h = "" + l, m = t.toString(), m.lastIndexOf(h, 0) == 0 && (h = new L(m.substring(h.length)), m = p($, 1), m = new RegExp(S(m, 2)), H1(h, $, null), h = h.toString(), !G(m, t.toString()) && G(m, h) || a1(d, t.toString(), $, -1) == 3)) ? (i.g(h), s && E(u, 6, 10), E(u, 1, l), l) : (E(u, 1, 0), 0);
+ return $ != null && (l = S($, 10), h = "" + l, C = t.toString(), C.lastIndexOf(h, 0) == 0 && (h = new N(C.substring(h.length)), C = p($, 1), C = new RegExp(S(C, 2)), H1(h, $, null), h = h.toString(), !G(C, t.toString()) && G(C, h) || a1(d, t.toString(), $, -1) == 3)) ? (r.g(h), s && E(u, 6, 10), E(u, 1, l), l) : (E(u, 1, 0), 0);
}
function H1(d, t, $) {
- var i = d.toString(), s = i.length, u = p(t, 15);
+ var r = d.toString(), s = r.length, u = p(t, 15);
if (s != 0 && u != null && u.length != 0) {
var l = new RegExp("^(?:" + u + ")");
- if (s = l.exec(i)) {
+ if (s = l.exec(r)) {
u = new RegExp(S(p(t, 1), 2));
- var h = G(u, i), m = s.length - 1;
- t = p(t, 16), t == null || t.length == 0 || s[m] == null || s[m].length == 0 ? (!h || G(u, i.substring(s[0].length))) && ($ != null && 0 < m && s[m] != null && $.g(s[1]), d.set(i.substring(s[0].length))) : (i = i.replace(l, t), (!h || G(u, i)) && ($ != null && 0 < m && $.g(s[1]), d.set(i)));
+ var h = G(u, r), C = s.length - 1;
+ t = p(t, 16), t == null || t.length == 0 || s[C] == null || s[C].length == 0 ? (!h || G(u, r.substring(s[0].length))) && ($ != null && 0 < C && s[C] != null && $.g(s[1]), d.set(r.substring(s[0].length))) : (r = r.replace(l, t), (!h || G(u, r)) && ($ != null && 0 < C && $.g(s[1]), d.set(r)));
}
}
}
@@ -8215,10 +8235,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
if (!u1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
return j1(d, t, $, !0);
}
- function j1(d, t, $, i) {
+ function j1(d, t, $, r) {
if (t == null) throw Error("The string supplied did not seem to be a phone number");
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
- var s = new L(), u = t.indexOf(";phone-context=");
+ var s = new N(), u = t.indexOf(";phone-context=");
if (u === -1) u = null;
else if (u += 15, u >= t.length) u = "";
else {
@@ -8226,73 +8246,73 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
u = l !== -1 ? t.substring(u, l) : t.substring(u);
}
var h = u;
- if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = y2.exec(h), h = _2.exec(h), l = l !== null || h !== null), !l || (u != null ? (u.charAt(0) === "+" && s.g(u), u = t.indexOf("tel:"), s.g(t.substring(0 <= u ? u + 4 : 0, t.indexOf(";phone-context=")))) : (u = s.g, l = t ?? "", h = l.search(p2), 0 <= h ? (l = l.substring(h), l = l.replace(C2, ""), h = l.search(g2), 0 <= h && (l = l.substring(0, h))) : l = "", u.call(s, l)), u = s.toString(), l = u.indexOf(";isub="), 0 < l && (B(s), s.g(u.substring(0, l))), !P1(s.toString()))) throw Error("The string supplied did not seem to be a phone number");
+ if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = y2.exec(h), h = _2.exec(h), l = l !== null || h !== null), !l || (u != null ? (u.charAt(0) === "+" && s.g(u), u = t.indexOf("tel:"), s.g(t.substring(0 <= u ? u + 4 : 0, t.indexOf(";phone-context=")))) : (u = s.g, l = t ?? "", h = l.search(p2), 0 <= h ? (l = l.substring(h), l = l.replace(C2, ""), h = l.search(g2), 0 <= h && (l = l.substring(0, h))) : l = "", u.call(s, l)), u = s.toString(), l = u.indexOf(";isub="), 0 < l && (B(s), s.g(u.substring(0, l))), !x1(s.toString()))) throw Error("The string supplied did not seem to be a phone number");
if (u = s.toString(), !(u1($) || u != null && 0 < u.length && Q.test(u))) throw Error("Invalid country calling code");
- u = new V(), i && E(u, 5, t);
+ u = new V(), r && E(u, 5, t);
d: {
- if (t = s.toString(), l = t.search(x1), 0 <= l && P1(t.substring(0, l))) {
- h = t.match(x1);
- for (var m = h.length, F = 1; F < m; ++F) if (h[F] != null && 0 < h[F].length) {
- B(s), s.g(t.substring(0, l)), t = h[F];
+ if (t = s.toString(), l = t.search(P1), 0 <= l && x1(t.substring(0, l))) {
+ h = t.match(P1);
+ for (var C = h.length, U = 1; U < C; ++U) if (h[U] != null && 0 < h[U].length) {
+ B(s), s.g(t.substring(0, l)), t = h[U];
break d;
}
}
t = "";
}
- 0 < t.length && E(u, 3, t), l = K(d, $), t = new L(), h = 0, m = s.toString();
+ 0 < t.length && E(u, 3, t), l = K(d, $), t = new N(), h = 0, C = s.toString();
try {
- h = K1(d, m, l, t, i, u);
+ h = K1(d, C, l, t, r, u);
} catch (_1) {
- if (_1.message == "Invalid country calling code" && Q.test(m)) {
- if (m = m.replace(Q, ""), h = K1(d, m, l, t, i, u), h == 0) throw _1;
+ if (_1.message == "Invalid country calling code" && Q.test(C)) {
+ if (C = C.replace(Q, ""), h = K1(d, C, l, t, r, u), h == 0) throw _1;
} else throw _1;
}
if (h != 0 ? (s = e1(h), s != $ && (l = d1(d, h, s))) : (B1(s), t.g(s.toString()), $ != null ? (h = S(l, 10), E(
u,
1,
h
- )) : i && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && ($ = new L(), s = new L(t.toString()), H1(s, l, $), d = a1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, i && 0 < $.toString().length && E(u, 7, $.toString()))), i = t.toString(), d = i.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
+ )) : r && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && ($ = new N(), s = new N(t.toString()), H1(s, l, $), d = a1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, r && 0 < $.toString().length && E(u, 7, $.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
if (17 < d) throw Error("The string supplied is too long to be a phone number");
- if (1 < i.length && i.charAt(0) == "0") {
- for (E(u, 4, !0), d = 1; d < i.length - 1 && i.charAt(d) == "0"; ) d++;
+ if (1 < r.length && r.charAt(0) == "0") {
+ for (E(u, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
d != 1 && E(u, 8, d);
}
- return E(u, 2, parseInt(i, 10)), u;
+ return E(u, 2, parseInt(r, 10)), u;
}
function G(d, t) {
return !!((d = typeof d == "string" ? t.match("^(?:" + d + ")$") : t.match(d)) && d[0].length == t.length);
}
function w2(d) {
- this.fa = RegExp(" "), this.ja = "", this.v = new L(), this.da = "", this.s = new L(), this.ba = new L(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new L(), this.ha = !1, this.o = "", this.g = new L(), this.j = [], this.ka = d, this.l = Z1(this, this.ka);
+ this.fa = RegExp(" "), this.ja = "", this.v = new N(), this.da = "", this.s = new N(), this.ba = new N(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new N(), this.ha = !1, this.o = "", this.g = new N(), this.j = [], this.ka = d, this.l = Z1(this, this.ka);
}
var W1 = new W();
E(W1, 11, "NA");
var b2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), z1 = /[- ]/;
function Z1(d, t) {
var $ = d.ga;
- return t = u1(t) ? U1($, t) : 0, d = K(d.ga, e1(t)), d ?? W1;
+ return t = u1(t) ? F1($, t) : 0, d = K(d.ga, e1(t)), d ?? W1;
}
function Y1(d) {
for (var t = d.j.length, $ = 0; $ < t; ++$) {
- var i = d.j[$], s = S(i, 1);
+ var r = d.j[$], s = S(r, 1);
if (d.da == s) return !1;
- var u = d, l = i, h = S(l, 1);
+ var u = d, l = r, h = S(l, 1);
B(u.v);
- var m = u;
+ var C = u;
l = S(l, 2);
- var F = "999999999999999".match(h)[0];
- if (F.length < m.g.h.length ? m = "" : (m = F.replace(new RegExp(h, "g"), l), m = m.replace(RegExp("9", "g"), " ")), 0 < m.length ? (u.v.g(m), u = !0) : u = !1, u) return d.da = s, d.ha = z1.test(p(i, 4)), d.$ = 0, !0;
+ var U = "999999999999999".match(h)[0];
+ if (U.length < C.g.h.length ? C = "" : (C = U.replace(new RegExp(h, "g"), l), C = C.replace(RegExp("9", "g"), " ")), 0 < C.length ? (u.v.g(C), u = !0) : u = !1, u) return d.da = s, d.ha = z1.test(p(r, 4)), d.$ = 0, !0;
}
return d.u = !1;
}
function J1(d, t) {
- for (var $ = [], i = t.length - 3, s = d.j.length, u = 0; u < s; ++u) {
+ for (var $ = [], r = t.length - 3, s = d.j.length, u = 0; u < s; ++u) {
var l = d.j[u];
- U(l, 3) == 0 ? $.push(d.j[u]) : (l = p(l, 3, Math.min(i, U(l, 3) - 1)), t.search(l) == 0 && $.push(d.j[u]));
+ F(l, 3) == 0 ? $.push(d.j[u]) : (l = p(l, 3, Math.min(r, F(l, 3) - 1)), t.search(l) == 0 && $.push(d.j[u]));
}
d.j = $;
}
- function N2(d, t) {
+ function L2(d, t) {
d.s.g(t);
var $ = t;
if (D1.test($) || d.s.h.length == 1 && f2.test($) ? (t == "+" ? ($ = t, d.ba.g(t)) : ($ = C1[t], d.ba.g($), d.g.g($)), t = $) : (d.u = !1, d.la = !0), !d.u) {
@@ -8319,8 +8339,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, B(d.v), d.da = "", y1(d);
}
function X1(d) {
- for (var t = d.g.toString(), $ = d.j.length, i = 0; i < $; ++i) {
- var s = d.j[i], u = S(s, 1);
+ for (var t = d.g.toString(), $ = d.j.length, r = 0; r < $; ++r) {
+ var s = d.j[r], u = S(s, 1);
if (new RegExp("^(?:" + u + ")$").test(t) && (d.ha = z1.test(p(s, 4)), s = t.replace(new RegExp(u, "g"), p(s, 2)), s = h1(d, s), o1(s, h2) == d.ba)) return s;
}
return "";
@@ -8332,7 +8352,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
function y1(d) {
var t = d.g.toString();
if (3 <= t.length) {
- for (var $ = d.ca && d.o.length == 0 && 0 < U(d.l, 20) ? x(d.l, 20) : x(d.l, 19), i = $.length, s = 0; s < i; ++s) {
+ for (var $ = d.ca && d.o.length == 0 && 0 < F(d.l, 20) ? P(d.l, 20) : P(d.l, 19), r = $.length, s = 0; s < r; ++s) {
var u = $[s];
0 < d.o.length && O1(S(u, 4)) && !p(u, 6) && !R(u, 5) || (d.o.length != 0 || d.ca || O1(S(u, 4)) || p(u, 6)) && b2.test(S(u, 2)) && d.j.push(u);
}
@@ -8343,16 +8363,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
function Q1(d) {
var t = d.g.toString(), $ = t.length;
if (0 < $) {
- for (var i = "", s = 0; s < $; s++) i = $2(d, t.charAt(s));
- return d.u ? h1(d, i) : d.s.toString();
+ for (var r = "", s = 0; s < $; s++) r = $2(d, t.charAt(s));
+ return d.u ? h1(d, r) : d.s.toString();
}
return d.h.toString();
}
function d2(d) {
var t = d.g.toString(), $ = 0;
- if (p(d.l, 10) != 1) var i = !1;
- else i = d.g.toString(), i = i.charAt(0) == "1" && i.charAt(1) != "0" && i.charAt(1) != "1";
- return i ? ($ = 1, d.h.g("1").g(" "), d.ca = !0) : R(d.l, 15) && (i = new RegExp("^(?:" + p(d.l, 15) + ")"), i = t.match(i), i != null && i[0] != null && 0 < i[0].length && (d.ca = !0, $ = i[0].length, d.h.g(t.substring(0, $)))), B(d.g), d.g.g(t.substring($)), t.substring(0, $);
+ if (p(d.l, 10) != 1) var r = !1;
+ else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
+ return r ? ($ = 1, d.h.g("1").g(" "), d.ca = !0) : R(d.l, 15) && (r = new RegExp("^(?:" + p(d.l, 15) + ")"), r = t.match(r), r != null && r[0] != null && 0 < r[0].length && (d.ca = !0, $ = r[0].length, d.h.g(t.substring(0, $)))), B(d.g), d.g.g(t.substring($)), t.substring(0, $);
}
function t2(d) {
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
@@ -8360,23 +8380,23 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
function e2(d) {
if (d.g.h.length == 0) return !1;
- var t = new L(), $ = V1(d.g, t);
+ var t = new N(), $ = V1(d.g, t);
return $ == 0 ? !1 : (B(d.g), d.g.g(t.toString()), t = e1($), t == "001" ? d.l = K(d.ga, "" + $) : t != d.ka && (d.l = Z1(d, t)), d.h.g("" + $).g(" "), d.o = "", !0);
}
function $2(d, t) {
var $ = d.v.toString();
if (0 <= $.substring(d.$).search(d.fa)) {
- var i = $.search(d.fa);
- return t = $.replace(d.fa, t), B(d.v), d.v.g(t), d.$ = i, t.substring(0, d.$ + 1);
+ var r = $.search(d.fa);
+ return t = $.replace(d.fa, t), B(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
}
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
}
const c1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
try {
- const $ = d.replace(/[^+0-9]/g, ""), i = new w2(t);
+ const $ = d.replace(/[^+0-9]/g, ""), r = new w2(t);
t = "";
- for (let s = 0; s < $.length; s++) i.ja = N2(i, $.charAt(s)), t = i.ja;
+ for (let s = 0; s < $.length; s++) r.ja = L2(r, $.charAt(s)), t = r.ja;
return t;
} catch {
return d;
@@ -8384,16 +8404,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
try {
const s = D.g(), u = z(s, d, t);
- var i = J(s, u, -1);
- return i == 0 || i == 4 ? s.format(u, typeof $ > "u" ? 0 : $) : d;
+ var r = J(s, u, -1);
+ return r == 0 || r == 4 ? s.format(u, typeof $ > "u" ? 0 : $) : d;
} catch {
return d;
}
- }), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, i) => {
+ }), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, r) => {
try {
- const m = D.g();
+ const C = D.g();
d: {
- var s = m;
+ var s = C;
if (u1(d)) {
var u = l1(K(s, d), $);
try {
@@ -8406,7 +8426,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
h = null;
}
- return m.format(h, i ? 0 : t ? 2 : 1);
+ return C.format(h, r ? 0 : t ? 2 : 1);
} catch {
return "";
}
@@ -8419,11 +8439,11 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
try {
const l = D.g(), h = z(l, d, t);
- var $ = F1(l, h), i = d1(l, S(h, 1), $);
- if (i == null) var s = -1;
+ var $ = U1(l, h), r = d1(l, S(h, 1), $);
+ if (r == null) var s = -1;
else {
var u = t1(h);
- s = m1(u, i);
+ s = m1(u, r);
}
return s;
} catch {
@@ -8432,18 +8452,18 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
if (!t) return 1;
try {
- const $ = D.g(), i = z($, d, t);
- return J($, i, -1);
+ const $ = D.g(), r = z($, d, t);
+ return J($, r, -1);
} catch ($) {
return $.message === "Invalid country calling code" ? 1 : 3 >= d.length || $.message === "Phone number too short after IDD" || $.message === "The string supplied is too short to be a phone number" ? 2 : $.message === "The string supplied is too long to be a phone number" ? 3 : -99;
}
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t) => {
try {
- const m = D.g();
- var $ = z(m, d, t), i = F1(m, $);
- d = m;
- var s = S($, 1), u = d1(d, s, i);
- if (u == null || i != "001" && s != U1(d, i)) var l = !1;
+ const C = D.g();
+ var $ = z(C, d, t), r = U1(C, $);
+ d = C;
+ var s = S($, 1), u = d1(d, s, r);
+ if (u == null || r != "001" && s != F1(d, r)) var l = !1;
else {
var h = t1($);
l = m1(h, u) != -1;
@@ -8454,16 +8474,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
}
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
try {
- const i = D.g(), s = z(i, d, t);
+ const r = D.g(), s = z(r, d, t);
if ($) {
- const u = J(i, s, c1[$]) === 0;
+ const u = J(r, s, c1[$]) === 0;
if ($ === "FIXED_LINE_OR_MOBILE") {
- const l = J(i, s, c1.MOBILE) === 0, h = J(i, s, c1.FIXED_LINE) === 0;
+ const l = J(r, s, c1.MOBILE) === 0, h = J(r, s, c1.FIXED_LINE) === 0;
return l || h || u;
}
return u;
}
- return J(i, s, -1) === 0;
+ return J(r, s, -1) === 0;
} catch {
return !1;
}
@@ -8477,10 +8497,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
})();
const K2 = window.intlTelInputUtilsTemp;
delete window.intlTelInputUtilsTemp;
-C.utils = K2;
+m.utils = K2;
const j2 = {
__name: "IntlTelInputWithUtils",
- props: /* @__PURE__ */ n2({
+ props: /* @__PURE__ */ i2({
disabled: {
type: Boolean,
default: !1
@@ -8504,14 +8524,14 @@ const j2 = {
},
modelModifiers: {}
}),
- emits: /* @__PURE__ */ n2([
+ emits: /* @__PURE__ */ i2([
"changeNumber",
"changeCountry",
"changeValidity",
"changeErrorCode"
], ["update:modelValue"]),
- setup(y, { expose: e, emit: n }) {
- const r = A2(y, "modelValue"), o = y, a = n, c = I1(), g = I1(), f = I1(!1), b = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, _ = () => {
+ setup(y, { expose: e, emit: i }) {
+ const n = T2(y, "modelValue"), o = y, a = i, c = I1(), g = I1(), f = I1(!1), b = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, _ = () => {
let v = b();
f.value !== v && (f.value = v, a("changeValidity", !!v), a(
"changeErrorCode",
@@ -8520,30 +8540,30 @@ const j2 = {
}, I = () => {
var v;
a("changeNumber", ((v = g.value) == null ? void 0 : v.getNumber()) ?? ""), _();
- }, N = () => {
+ }, L = () => {
var v;
a("changeCountry", ((v = g.value) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), I(), _();
};
- return L2(() => {
- c.value && (g.value = C(c.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled));
- }), T2(
+ return N2(() => {
+ c.value && (g.value = m(c.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled));
+ }), A2(
() => o.disabled,
(v) => {
- var A;
- return (A = g.value) == null ? void 0 : A.setDisabled(v);
+ var T;
+ return (T = g.value) == null ? void 0 : T.setDisabled(v);
}
), E2(() => {
var v;
return (v = g.value) == null ? void 0 : v.destroy();
- }), e({ instance: g, input: c }), (v, A) => D2((M2(), x2("input", P2({
+ }), e({ instance: g, input: c }), (v, T) => D2((M2(), P2("input", x2({
ref_key: "input",
ref: c,
- "onUpdate:modelValue": A[0] || (A[0] = (M) => r.value = M),
+ "onUpdate:modelValue": T[0] || (T[0] = (M) => n.value = M),
type: "tel",
- onCountrychange: N,
+ onCountrychange: L,
onInput: I
}, y.inputProps), null, 16)), [
- [R2, r.value]
+ [R2, n.value]
]);
}
};