@descope/user-management-widget 0.16.4 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * @descope/user-management-widget v0.16.4
3
+ * @descope/user-management-widget v0.17.0
4
4
  */
5
- this["descope-user-management-widget"]=function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function n(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))}function r(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function i(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function o(...e){return t=>e.reduce(((e,t)=>t(e)),t)}"function"==typeof SuppressedError&&SuppressedError;const s=e=>{const t=document.createElement("template");return t.innerHTML=e,t},a=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),d=e=>{let t,n;return(...r)=>(t&&a(t,r)||(t=r,n=e(...r)),n)},l=e=>(t,...n)=>t.reduce(((t,r,i)=>{var o;return`${t}${r}${(null===(o=null==n?void 0:n[i])||void 0===o?void 0:o[e>1?1:0])||""}`}),""),c=(e,t=500)=>{let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}},u=(e={})=>{const t=s("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),(e=>"string"==typeof e?e:(e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype)(e)?JSON.stringify(e):"")(n))})),t},h=e=>{const t=Symbol((e=>{const t=e.toString();let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return n.toString(16)})(e));return n=>{if(n[t])return n;const r=e(n);return r[t]=!0,r}};var f,p,g,v;function m(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const i=n[r],o=e[i],s=t[i];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!m(o,s))return!1}else if(o!==s)return!1}return!0}let $=class{constructor(e={},{forceUpdate:t=!1}={}){f.set(this,void 0),p.set(this,{}),g.set(this,0),v.set(this,!0),this.update=e=>{const t="function"==typeof e?e(r(this,f,"f")):e,n=Object.assign(Object.assign({},r(this,f,"f")),t);if(r(this,v,"f")||!m(r(this,f,"f"),n)){const e=r(this,f,"f");i(this,f,n,"f"),Object.freeze(r(this,f,"f")),setTimeout((()=>{Object.values(r(this,p,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},i(this,f,e,"f"),i(this,v,t,"f")}get current(){return Object.assign({},r(this,f,"f"))}subscribe(e){return i(this,g,r(this,g,"f")+1,"f"),r(this,p,"f")[r(this,g,"f")]=e,r(this,g,"f").toString()}unsubscribe(e){const t=!!r(this,p,"f")[e];return t&&delete r(this,p,"f")[e],t}unsubscribeAll(){return i(this,p,{},"f"),!0}};function y(e){if(e)return{locale:e.toLowerCase(),fallback:e.toLowerCase()};const t=navigator.language;return t?t.includes("-")?{locale:t.toLowerCase(),fallback:t.split("-")[0].toLowerCase()}:{locale:t.toLowerCase(),fallback:t.toLowerCase()}:{locale:"",fallback:""}}f=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakMap;const b=["error","warn","info","debug"],w={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},C=h((e=>{var t,n,o,s;return s=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,r(this,t,"m",o).call(this,w))}set logger(e){i(this,n,r(this,t,"m",o).call(this,e||w),"f")}get logger(){return r(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return b.reduce(((t,n)=>(t[n]=(...t)=>{var r;this.onLogEvent(n,t),null===(r=e[n])||void 0===r||r.call(e,...t)},t)),{})},s})),k="undefined"!=typeof localStorage,S="https://static.descope.com/pages",x="https://static2.descope.com/pages",I=k&&localStorage.getItem("base.content.url")||"",O=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,E=h((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&r(this,t,"f")&&(i(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),A=h((e=>{var t,n;const i=o(C,E)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,i;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,i=e=>{var n;null===(n=r(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>i(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&i(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){r(this,t,"f")[e]||(r(this,t,"f")[e]=[]);const i=r(this,t,"f")[e].push(n);return()=>r(this,t,"f")[e].splice(i,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),P=e=>t=>{var n,i,s;const a=o(C,E,A)(t),d=Object.keys(e);return s=class extends a{constructor(...e){super(...e),n.add(this),this.observeAttributes(d,r(this,n,"m",i).bind(this))}async init(){var e;d.forEach((e=>r(this,n,"m",i).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,i=function(t,n){const r=e[t],i="function"==typeof r?r(t,n):r;i&&this.logger.error(i)},s};P.missingAttrValidator=O;const N=h((e=>{const t=o(P({"project-id":O}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),j=h((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),R="Trying the next fallback URL...",T=async(e,t,{logger:n}={})=>{try{return await fetch(e,t)}catch(r){return null==n||n.debug(`Network error fetching URL ${e} [${r.message}], retrying...`),fetch(e,t)}};const M=h((e=>{var t,n,s,a,d,l,c;const u=o(C,N,j)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,new Set)}async fetchStaticResource(e,n){const o=r(this,t,"m",d).call(this,e),l=Array.isArray(o)?e=>{const{baseUrl:t}=o[e];i(this,s,t,"f");for(let t=0;t<e;t++){const e=o[t].baseUrl;r(this,a,"f").add(e)}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:r}={})=>{const i=Array.isArray(e)?e:[e];for(let e=0;e<i.length;e++){const o=i[e],s=e===i.length-1;try{const i=await T(o.toString(),t,{logger:n});if(i.ok)return null==r||r(e),null==n||n.debug(`Successfully fetched URL ${o}`),i;const a=`Error fetching URL ${o} [${i.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${R}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${R}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:l});return{body:await e[n](),headers:Object.fromEntries(e.headers.entries())}}catch(e){this.logger.error(e.message)}}get baseStaticUrl(){return this.getAttribute("base-static-url")||""}},n=new WeakMap,s=new WeakMap,a=new WeakMap,t=new WeakSet,d=function(e){const o=I||this.baseStaticUrl;if(o)return r(this,t,"m",l).call(this,e,o);r(this,n,"f")!==this.baseUrl&&(i(this,n,this.baseUrl,"f"),i(this,s,void 0,"f"),r(this,a,"f").clear());const d=[];if(r(this,s,"f"))d.push(r(this,t,"m",l).call(this,e,r(this,s,"f"))),r(this,s,"f")===S&&d.push(r(this,t,"m",l).call(this,e,x));else{const n=this.baseUrl+"/pages";this.baseUrl&&!r(this,a,"f").has(n)&&d.push(r(this,t,"m",l).call(this,e,n)),r(this,a,"f").has(S)||d.push(r(this,t,"m",l).call(this,e,S)),d.push(r(this,t,"m",l).call(this,e,x))}return 1===d.length?d[0]:d},l=function(e,t){return function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:r=S}){const i=new URL(r);return i.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(i.pathname,e,n,t),i.baseUrl=r,i}({projectId:this.projectId,filename:e,baseUrl:t})},c})),U=h((e=>{var t,n;const i=o(P({"project-id":O}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return r(this,t,"f").set(e,n),()=>{r(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(r(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=r(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),L=h((e=>{var t,n,s,a,d;const l=o(M,U,E)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}async init(){await super.init(),this.onReset("config",r(this,t,"m",n).bind(this))}get config(){return r(this,s,"f")||i(this,s,r(this,a,"f").call(this),"f"),r(this,s,"f")}},s=new WeakMap,a=new WeakMap,t=new WeakSet,n=function(){i(this,s,void 0,"f")},d})),_=h((e=>{var t,n,s,a,d,l,c;return c=class extends(o(E,C)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,i),"debug"===e&&r(this,t,"m",d).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var i;null===(i=super.onLogEvent)||void 0===i||i.call(this,e,n),"error"===e&&r(this,t,"m",l).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),r(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){var e;null===(e=r(this,n,"f"))||void 0===e||e.remove(),i(this,n,null,"f")},a=async function(){i(this,n,document.createElement("descope-debugger"),"f"),Object.assign(r(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return lf})),document.body.appendChild(r(this,n,"f"))},d=function(){this.debug?r(this,t,"m",a).call(this):r(this,t,"m",s).call(this)},l=function(e,t){var i;e&&(null===(i=r(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},c})),W=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],D=e=>{let t=0;const n=e.toString();for(let e=0;e<n.length;e++){t=(t<<5)-t+n.charCodeAt(e),t|=0}return`${Math.abs(t).toString()}`},F=(e,t,n)=>new Promise(((r,i)=>{const o=((e,t)=>{const n=document.createElement("script");return n.id=e,t&&(n.integrity=t,n.crossOrigin="anonymous"),window.DESCOPE_NONCE&&n.setAttribute("nonce",window.DESCOPE_NONCE),n})(e,n);o.onerror=e=>{o.setAttribute("status","error"),i(e)},o.onload=()=>{o.setAttribute("status","loaded"),r(o)},o.src=t.toString(),document.body.appendChild(o)})),q=(e,t)=>{if(t){const n=e.integrity;if(n!==t)return Promise.reject(new Error(`Integrity mismatch: expected ${t}, found ${n}`))}return"loaded"===e.getAttribute("status")?Promise.resolve(e):(e=>"error"===e.getAttribute("status"))(e)?Promise.reject():new Promise(((t,n)=>{e.addEventListener("load",(()=>{t(e)})),e.addEventListener("error",(e=>{n(e)}))}))},B=h((e=>{const t=o(C)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(e,t,n="",r=[],i){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"${i?" with SRI integrity check":""}`),(async(e,t)=>{for(const r of e){const{id:e,url:i,integrity:o}=r,s=(n=e,document.querySelector(`script#${n}`));if(s)try{return await q(s,o),r}catch(e){t(r,!0)}else try{return await F(e,i,o),r}catch(e){t(r,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,r="",i)=>e.reduce(((e,o)=>{const s=o;if(!s)return e;let a;try{a=new URL(s)}catch(e){throw new Error(`Invalid URL: ${s}`)}"/"!==a.pathname||(a.pathname=`/npm/${t}@${n}/${r}`);const d={url:a,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${D(a)}`};return i&&(d.integrity=i),[...e,d]}),[]))([...r,this.baseCdnUrl,...W],e,t,n,i),((e,t)=>{t?this.logger.error(`Existing script cannot be loaded: "${e.url}"`):this.logger.error(`Cannot load script from URL, Make sure this URL is valid and return the correct script: "${e.url}"`)}))}}})),H="base.ui.components.url",V=k&&localStorage.getItem(H),G=h((e=>{var t,n,s,a,d,l,c;const u=o(C,L,B)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),a.set(this,void 0)}get descopeUi(){return r(this,a,"f")||i(this,a,r(this,t,"m",l).call(this),"f"),r(this,a,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>r(this,t,"m",d).call(this,e))))}},a=new WeakMap,t=new WeakSet,n=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},s=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersionSri;return n&&this.logger.debug("SRI hash available for components"),n},d=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},l=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const e=await r(this,t,"m",n).call(this),i=V?void 0:await r(this,t,"m",s).call(this);return await this.injectNpmLib("@descope/web-components-ui",e,"dist/umd/index.js",[V],i),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},c})),K=h((e=>{var t,n,i;const s=o(E,A)(e);return i=class extends s{constructor(){super(...arguments),t.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.observeAttribute("nonce",r(this,t,"m",n).bind(this)),r(this,t,"m",n).call(this)}},t=new WeakSet,n=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},i}));class z{constructor(e,t,{prepend:n=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(n?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return null===(e=this.styleEle.sheet)||void 0===e?void 0:e.cssRules}}const J=h((e=>{const t=o(K)(e);return class extends t{injectStyle(e,{prepend:t=!1}={}){let n;try{n=new CSSStyleSheet}catch(e){n=new z(this.shadowRoot,this.nonce,{prepend:t})}if(e&&n.replaceSync(e),n instanceof CSSStyleSheet){const e=this.shadowRoot;if(e&&"adoptedStyleSheets"in e){const r=[...e.adoptedStyleSheets||[]];r[t?"unshift":"push"](n),e.adoptedStyleSheets=r}}return n}}})),Z="content-root",Y="root",X=h((e=>{const t=o(J)(e);return class extends t{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${Y}">\n <div id="${Z}"></div>\n </div>\n `,this.injectStyle(`\n #${Y}, #${Z} {\n height: 100%;\n }\n #${Y} {\n position: relative;\n height: fit-content;\n }\n `),this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Z),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Y)}}})),Q="descope-modal";var ee,te;let ne=class{constructor(e,t){ee.set(this,void 0),this.nodeName="",i(this,ee,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>new Promise((t=>{const n=setInterval((()=>{const r="function"==typeof e?e():e;r&&(clearInterval(n),t(r))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(r(this,ee,"f"))}get ele(){var e,t;const n="function"==typeof r(this,ee,"f")?r(this,ee,"f").call(this):r(this,ee,"f");return n?(null==n?void 0:n.localName)!==this.nodeName?(null===(t=this.logger)||void 0===t||t.debug(`node name do not match, expected "${this.nodeName}", received "${n.localName}" `,Error()),null):n:(null===(e=this.logger)||void 0===e||e.debug(`Driver element is not available for ${this.nodeName}`,new Error),null)}get isExists(){return!!this.ele}};ee=new WeakMap;let re=class extends ne{constructor(){super(...arguments),this.nodeName="descope-button"}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}},ie=class extends ne{constructor(){super(...arguments),this.nodeName="descope-wc"}set projectId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("project-id",e)}set baseUrl(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("base-url",e)}set flowId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("flow-id",e)}set theme(e){var t,n;e?null===(n=this.ele)||void 0===n||n.setAttribute("theme",e):null===(t=this.ele)||void 0===t||t.removeAttribute("theme")}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}onPageUpdated(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("page-updated",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("page-updated",e)}}},oe=class extends re{get flowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id"))||""}get enableMode(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("enable-mode")}};const se=/^descope-grid-([^-]+)-column$/,ae={text:class extends ne{constructor(){super(...arguments),this.nodeName="descope-grid-text-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}},custom:class extends ne{constructor(){super(...arguments),this.nodeName="descope-grid-custom-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}}};let de=class extends ne{constructor(){super(...arguments),this.nodeName="descope-grid",te.set(this,void 0)}onSelectedItemsChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("selected-items-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}get ele(){return super.ele}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}set data(e){this.ele&&(this.ele.data=e)}get columns(){return this.ele?Array.from(this.ele.children).reduce(((e,t)=>{var n;const r=null===(n=se.exec(t.localName))||void 0===n?void 0:n[1],i=ae[r];return i?(e.push(new i(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const i=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);i&&this.ele.columns&&(a(i,this.ele.columns)||(this.ele.columns=i,null===(n=r(this,te,"f"))||void 0===n||n.call(this,i)))}onColumnsChange(e){i(this,te,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};var le,ce,ue,he;te=new WeakMap;let fe=class extends ne{constructor(...e){super(...e),le.add(this),ce.set(this,void 0),ue.set(this,void 0),this.nodeName="descope-modal",r(this,le,"m",he).call(this)}get isOpen(){var e;return"true"===(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("opened"))}get isClosed(){return!this.isOpen}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),r(this,le,"m",he).call(this),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),r(this,ce,"f")&&(null===(e=this.ele)||void 0===e||e.append(r(this,ce,"f").content.cloneNode(!0)))}setContent(e){i(this,ce,e,"f"),this.reset()}remove(){var e,t;null===(e=r(this,ue,"f"))||void 0===e||e.disconnect(),null===(t=this.ele)||void 0===t||t.remove()}};ce=new WeakMap,ue=new WeakMap,le=new WeakSet,he=function(){if(r(this,ue,"f"))return;const e=this.ele;e&&(i(this,ue,new MutationObserver((t=>{t.forEach(((n,r)=>{var i;const o="true"===n.oldValue,s=t[r+1]?t[r+1].oldValue:e.getAttribute("opened");o&&"true"!==s&&(null===(i=this.afterClose)||void 0===i||i.call(this))}))})),"f"),r(this,ue,"f").observe(e,{attributes:!0,attributeFilter:["opened"],attributeOldValue:!0}))};let pe=class extends ne{constructor(){super(...arguments),this.nodeName="descope-multi-line-mappings"}setData(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("data",JSON.stringify(e))}get value(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.value)||[]}set value(e){this.ele&&(this.ele.value=e)}get mergedValue(){return Object.entries(this.value.filter((({tenantId:e})=>!!e)).reduce(((e,{tenantId:t,roleNames:n})=>(e[t]=[...new Set([...e[t]||[],...n])],e)),{})).map((([e,t])=>({tenantId:e,roleNames:t})))}},ge=class extends ne{constructor(){super(...arguments),this.nodeName="descope-multi-select-combo-box"}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}},ve=class extends ne{constructor(){super(...arguments),this.nodeName="descope-notification"}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}show(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("opened","true")}setContent(e){this.ele.innerHTML="",this.ele.appendChild(e.content.cloneNode(!0))}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}},me=class extends ne{constructor(){super(...arguments),this.nodeName="descope-text"}get ele(){return super.ele}get text(){var e;return null===(e=this.ele)||void 0===e?void 0:e.innerText}set text(e){this.ele&&(this.ele.innerText=e)}},$e=class extends ne{constructor(){super(...arguments),this.nodeName="descope-text-field"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}};const ye=h((e=>{var t,n;const i=o(E,X,G)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends fe{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Q);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Q]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),be="descope-notification",we=h((e=>{var t,n;const i=o(E,X,G)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ve{setContent(t){const n="string"==typeof t?s(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(be);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([be])}},t=new WeakMap,n})),Ce="theme",ke=(e,t,n="")=>Object.entries(e).reduce(((e,[r,i])=>{if(!/^[a-zA-Z0-9-]+$/.test(r))return t("Ignoring invalid override-css token path segment"),e;const o=n?`${n}-${r}`:r;if("object"==typeof i&&null!==i)return e+ke(i,t,o);const s=(e=>"number"==typeof e?Number.isFinite(e)?String(e):null:"string"!=typeof e||/[;{}]/.test(e)?null:e.trim())(i);return null===s?(t("Ignoring invalid override-css token value"),e):`${e}--descope-${o}:${s};`}),"");function Se(e,t){const n=Object.assign({},e);for(const[e,r]of Object.entries(t||{}))if(null!=r)if("object"==typeof r){if(0===Object.keys(r).length)continue;n[e]=Se(n[e]||{},r)}else n[e]="string"==typeof r?(n[e]||"")+r:r;return n}const xe=(e,t)=>null!==t&&!/^[a-zA-Z0-9_-]*$/.test(t)&&"tenant must contain only alphanumeric characters, hyphens, or underscores",Ie=h((e=>{const t=o(P({tenant:xe}))(e);return class extends t{get tenantId(){return this.getAttribute("tenant")||void 0}}})),Oe=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Ee=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g,v,m,$,y,b,w,C,k,S,x;const I=o(P({theme:Oe}),Ie,M,E,G,L,X,A,J)(e);return x=class extends I{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,void 0),l.set(this,void 0),c.set(this,void 0),C.set(this,(()=>{r(this,t,"m",k).call(this),r(this,S,"f").call(this,"os"===this.getAttribute("theme"))})),S.set(this,(e=>{var n,i,o;const s=e?"addEventListener":"removeEventListener";null===(o=null===(i=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===i?void 0:i[s])||void 0===o||o.call(i,"change",(()=>r(this,t,"m",k).call(this)))}))}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}get styleId(){return this.getAttribute("style-id")||Ce}get themeOverride(){const e=this.getAttribute("theme-override");if(!e)return null;try{return JSON.parse(e)}catch(e){return this.logger.error("Failed to parse theme-override attribute. error: ",e),null}}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),r(this,C,"f").call(this),await Promise.all([r(this,t,"m",f).call(this),r(this,t,"m",v).call(this),r(this,t,"m",$).call(this)]),r(this,t,"m",m).call(this),this.observeAttributes(["theme"],r(this,C,"f")),this.observeAttributes(["theme-override"],(()=>r(this,t,"m",m).call(this))),this.observeAttributes(["tenant"],(()=>{i(this,c,null,"f"),r(this,t,"m",v).call(this),r(this,t,"m",$).call(this)})),this.observeAttributes(["style-id"],(()=>{i(this,l,null,"f"),r(this,t,"m",b).call(this),r(this,t,"m",f).call(this),r(this,t,"m",$).call(this)}))}},n=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,C=new WeakMap,S=new WeakMap,t=new WeakSet,d=function(){const e=this.themeOverride;return e?["light","dark"].map((t=>{var n,r,i,o,s,a;const d=null===(i=null===(r=null===(n=e[t])||void 0===n?void 0:n.globals)||void 0===r?void 0:r.colors)||void 0===i?void 0:i.primary,l=null===(a=null===(s=null===(o=e[t])||void 0===o?void 0:o.globals)||void 0===s?void 0:s.colors)||void 0===a?void 0:a.secondary;return d||l?`[data-theme="${t}"]{${ke({colors:{primary:d,secondary:l}},(e=>this.logger.error(e)))}}`:""})).join(""):""},u=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(H))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(H),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},e.light.components),t.light.components),e.dark.components=Object.assign(Object.assign({},e.dark.components),t.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},h=function(){return r(this,l,"f")||(i(this,l,r(this,t,"m",u).call(this),"f"),r(this,l,"f").then((e=>this.logger.debug("Fetched theme",e)))),r(this,l,"f")},f=async function(){var e,o;const s=await r(this,t,"a",h);if(!s)return;const a=((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.globals)||"")+((null===(o=null==s?void 0:s.dark)||void 0===o?void 0:o.globals)||"");r(this,n,"f")?r(this,n,"f").replaceSync(a):i(this,n,this.injectStyle(a,{prepend:!0}),"f")},p=async function(){const e=this.tenantId;if(e)try{const{body:t}=await this.fetchStaticResource(`${e}/theme.json`,"json");return t}catch(e){this.logger.warn("No tenant style exists, using project default theme.")}},g=function(){return r(this,c,"f")||i(this,c,r(this,t,"m",p).call(this),"f"),r(this,c,"f")},v=async function(){var e,n,o,a;if(!this.tenantId)return void(null===(e=r(this,s,"f"))||void 0===e||e.replaceSync(""));const d=await r(this,t,"a",g);if(!d)return void(null===(n=r(this,s,"f"))||void 0===n||n.replaceSync(""));const l=((null===(o=d.light)||void 0===o?void 0:o.globals)||"")+((null===(a=d.dark)||void 0===a?void 0:a.globals)||"");r(this,s,"f")?r(this,s,"f").replaceSync(l):i(this,s,this.injectStyle(l),"f")},m=async function(){var e;if(!this.themeOverride)return void(null===(e=r(this,a,"f"))||void 0===e||e.replaceSync(""));const n=r(this,t,"m",d).call(this);r(this,a,"f")?r(this,a,"f").replaceSync(n):i(this,a,this.injectStyle(n),"f")},$=async function(){var e,n,i,o;const s=await r(this,t,"a",h);if(!s)return;const a=await this.descopeUi;if(!(null==a?void 0:a.componentsThemeManager))return;const d=await r(this,t,"a",g);a.componentsThemeManager.themes={light:Se((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.components)||{},(null===(n=null==d?void 0:d.light)||void 0===n?void 0:n.components)||{}),dark:Se((null===(i=null==s?void 0:s.dark)||void 0===i?void 0:i.components)||{},(null===(o=null==d?void 0:d.dark)||void 0===o?void 0:o.components)||{})}},y=async function(){var e,t;const{projectConfig:n}=await this.config||{},r=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],i=null==n?void 0:n.cssTemplate,o=r||i;return null===(t=null==o?void 0:o[this.theme])||void 0===t?void 0:t.fonts},b=async function(){const e=await r(this,t,"m",y).call(this);e?Object.values(e).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))})):this.logger.debug("No fonts to load")},w=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},k=function(){r(this,t,"m",b).call(this),r(this,t,"m",w).call(this)},x}));var Ae=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Pe=()=>Math.random().toString(36).substring(7).split("").join("."),Ne={INIT:`@@redux/INIT${Pe()}`,REPLACE:`@@redux/REPLACE${Pe()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Pe()}`};function je(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Re(e){if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";const n=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function Te(e){let t=typeof e;return t=Re(e),t}function Me(e,t,n){if("function"!=typeof e)throw new Error(`Expected the root reducer to be a function. Instead, received: '${Te(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(`Expected the enhancer to be a function. Instead, received: '${Te(n)}'`);return n(Me)(e,t)}let r=e,i=t,o=new Map,s=o,a=0,d=!1;function l(){s===o&&(s=new Map,o.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function u(e){if("function"!=typeof e)throw new Error(`Expected the listener to be a function. Instead, received: '${Te(e)}'`);if(d)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(d)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,l(),s.delete(n),o=null}}}function h(e){if(!je(e))throw new Error(`Actions must be plain objects. Instead, the actual type was: '${Te(e)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if("string"!=typeof e.type)throw new Error(`Action "type" property must be a string. Instead, the actual type was: '${Te(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,i=r(i,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Ne.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(`Expected the nextReducer to be a function. Instead, received: '${Te(e)}`);r=e,h({type:Ne.REPLACE})},[Ae]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(`Expected the observer to be an object. Instead, received: '${Te(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Ae](){return this}}}}}function Ue(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function Le(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];void 0===e[i]&&Ue(`No reducer provided for key "${i}"`),"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i,o;i={};try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Ne.INIT}))throw new Error(`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(void 0===n(void 0,{type:Ne.PROBE_UNKNOWN_ACTION()}))throw new Error(`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Ne.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;{const r=function(e,t,n,r){const i=Object.keys(t),o=n&&n.type===Ne.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===i.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!je(e))return`The ${o} has unexpected type of "${Te(e)}". Expected argument to be an object with the following keys: "${i.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!r[e]));return s.forEach((e=>{r[e]=!0})),n&&n.type===Ne.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${o}. Expected to find one of the known reducer keys instead: "${i.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,i);r&&Ue(r)}let s=!1;const a={};for(let i=0;i<r.length;i++){const o=r[i],d=n[o],l=e[o],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error(`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${o}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[o]=c,s=s||c!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function _e(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function We(e){return je(e)&&"type"in e&&"string"==typeof e.type}var De=Symbol.for("immer-nothing"),Fe=Symbol.for("immer-draftable"),qe=Symbol.for("immer-state"),Be=[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}];function He(e,...t){{const n=Be[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}}var Ve=Object.getPrototypeOf;function Ge(e){return!!e&&!!e[qe]}function Ke(e){return!!e&&(Je(e)||Array.isArray(e)||!!e[Fe]||!!e.constructor?.[Fe]||et(e)||tt(e))}var ze=Object.prototype.constructor.toString();function Je(e){if(!e||"object"!=typeof e)return!1;const t=Ve(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===ze}function Ze(e,t){0===Ye(e)?Object.entries(e).forEach((([n,r])=>{t(n,r,e)})):e.forEach(((n,r)=>t(r,n,e)))}function Ye(e){const t=e[qe];return t?t.type_:Array.isArray(e)?1:et(e)?2:tt(e)?3:0}function Xe(e,t){return 2===Ye(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Qe(e,t,n){const r=Ye(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function et(e){return e instanceof Map}function tt(e){return e instanceof Set}function nt(e){return e.copy_||e.base_}function rt(e,t){if(et(e))return new Map(e);if(tt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Je(e)){if(!Ve(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[qe];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const i=r[t],o=n[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(n[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Ve(e),n)}function it(e,t=!1){return st(e)||Ge(e)||!Ke(e)||(Ye(e)>1&&(e.set=e.add=e.clear=e.delete=ot),Object.freeze(e),t&&Ze(e,((e,t)=>it(t,!0)))),e}function ot(){He(2)}function st(e){return Object.isFrozen(e)}var at,dt={};function lt(e){const t=dt[e];return t||He(0,e),t}function ct(){return at}function ut(e,t){t&&(lt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ht(e){ft(e),e.drafts_.forEach(gt),e.drafts_=null}function ft(e){e===at&&(at=e.parent_)}function pt(e){return at={drafts_:[],parent_:at,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function gt(e){const t=e[qe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function vt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[qe].modified_&&(ht(t),He(4)),Ke(e)&&(e=mt(t,e),t.parent_||yt(t,e)),t.patches_&&lt("Patches").generateReplacementPatches_(n[qe].base_,e,t.patches_,t.inversePatches_)):e=mt(t,n,[]),ht(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==De?e:void 0}function mt(e,t,n){if(st(t))return t;const r=t[qe];if(!r)return Ze(t,((i,o)=>$t(e,r,t,i,o,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return yt(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let i=t,o=!1;3===r.type_&&(i=new Set(t),t.clear(),o=!0),Ze(i,((i,s)=>$t(e,r,t,i,s,n,o))),yt(e,t,!1),n&&e.patches_&&lt("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function $t(e,t,n,r,i,o,s){if(i===n&&He(5),Ge(i)){const s=mt(e,i,o&&t&&3!==t.type_&&!Xe(t.assigned_,r)?o.concat(r):void 0);if(Qe(n,r,s),!Ge(s))return;e.canAutoFreeze_=!1}else s&&n.add(i);if(Ke(i)&&!st(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;mt(e,i),t&&t.scope_.parent_||yt(e,i)}}function yt(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&it(t,n)}var bt={get(e,t){if(t===qe)return e;const n=nt(e);if(!Xe(n,t))return function(e,t,n){const r=kt(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Ke(r)?r:r===Ct(e.base_,t)?(xt(e),e.copy_[t]=It(r,e)):r},has:(e,t)=>t in nt(e),ownKeys:e=>Reflect.ownKeys(nt(e)),set(e,t,n){const r=kt(nt(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Ct(nt(e),t),i=r?.[qe];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,r)&&(void 0!==n||Xe(e.base_,t)))return!0;xt(e),St(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Ct(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,xt(e),St(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=nt(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){He(11)},getPrototypeOf:e=>Ve(e.base_),setPrototypeOf(){He(12)}},wt={};function Ct(e,t){const n=e[qe];return(n?nt(n):e)[t]}function kt(e,t){if(!(t in e))return;let n=Ve(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ve(n)}}function St(e){e.modified_||(e.modified_=!0,e.parent_&&St(e.parent_))}function xt(e){e.copy_||(e.copy_=rt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ze(bt,((e,t)=>{wt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),wt.deleteProperty=function(e,t){return isNaN(parseInt(t))&&He(13),wt.set.call(this,e,t,void 0)},wt.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&He(14),bt.set.call(this,e[0],t,n,e[0])};function It(e,t){const n=et(e)?lt("MapSet").proxyMap_(e,t):tt(e)?lt("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ct(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=bt;n&&(i=[r],o=wt);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:ct()).drafts_.push(n),n}function Ot(e){return Ge(e)||He(10,e),Et(e)}function Et(e){if(!Ke(e)||st(e))return e;const t=e[qe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=rt(e,t.scope_.immer_.useStrictShallowCopy_)}else n=rt(e,!0);return Ze(n,((e,t)=>{Qe(n,e,Et(t))})),t&&(t.finalized_=!1),n}var At=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,(e=>t.call(this,e,...i)))}}let r;if("function"!=typeof t&&He(6),void 0!==n&&"function"!=typeof n&&He(7),Ke(e)){const i=pt(this),o=It(e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?ht(i):ft(i)}return ut(i,n),vt(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===De&&(r=void 0),this.autoFreeze_&&it(r,!0),n){const t=[],i=[];lt("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}He(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;const i=this.produce(e,t,((e,t)=>{n=e,r=t}));return[i,n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Ke(e)||He(8),Ge(e)&&(e=Ot(e));const t=pt(this),n=It(e,void 0);return n[qe].isManual_=!0,ft(t),n}finishDraft(e,t){const n=e&&e[qe];n&&n.isManual_||He(9);const{scope_:r}=n;return ut(r,t),vt(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=lt("Patches").applyPatches_;return Ge(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Pt=At.produce;At.produceWithPatches.bind(At),At.setAutoFreeze.bind(At),At.setUseStrictShallowCopy.bind(At),At.applyPatches.bind(At),At.createDraft.bind(At),At.finishDraft.bind(At);var Nt=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},jt=(e,t,n)=>{const{memoize:r,memoizeOptions:i}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=r((()=>({})),...i);if(!(a.apply(null,o)===a.apply(null,s))){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:o,secondInputs:s,stack:e})}},Rt={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Tt=e=>Array.isArray(e)?e:[e];function Mt(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Ut(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Lt="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},_t=0,Wt=1;function Dt(){return{s:_t,v:void 0,o:null,p:null}}function Ft(e,t={}){let n=Dt();const{resultEqualityCheck:r}=t;let i,o=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=Dt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=Dt(),e.set(n,t)):t=r}}const a=t;let d;if(t.s===Wt)d=t.v;else if(d=e.apply(null,arguments),o++,r){const e=i?.deref?.()??i;null!=e&&r(e,d)&&(d=e,0!==o&&o--);i="object"==typeof d&&null!==d||"function"==typeof d?new Lt(d):d}return a.s=Wt,a.v=d,d}return s.clearCache=()=>{n=Dt(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function qt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...o},{memoize:d,memoizeOptions:l=[],argsMemoize:c=Ft,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=Tt(l),p=Tt(u),g=Mt(e),v=d((function(){return r++,s.apply(null,arguments)}),...f);let m=!0;const $=c((function(){i++;const e=Ut(g,arguments);t=v.apply(null,e);{const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Rt,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Nt},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:jt}}})(m,h);if(n.shouldRun&&n.run(s,e,t),r.shouldRun){const t=Ut(g,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign($,{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:d,argsMemoize:c})};return Object.assign(r,{withTypes:()=>r}),r}var Bt=qt(Ft),Ht=Object.assign(((e,t=Bt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e),r=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})));return r}),{withTypes:()=>Ht});function Vt(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var Gt=Vt(),Kt=Vt;((...e)=>{const t=qt(...e)})(Ft);var zt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?_e:_e.apply(null,arguments)},Jt=e=>e&&"function"==typeof e.match;function Zt(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>We(t)&&t.type===e,n}function Yt(e){return"function"==typeof e&&"type"in e&&Jt(e)}function Xt(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var Qt=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function en(e){return Ke(e)?Pt(e,(()=>{})):e}function tn(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error("No insert provided for key not already in map");const r=n.insert(t,e);return e.set(t,r),r}function nn(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function rn(e,t,n){const r=on(e,t,n);return{detectMutations:()=>sn(e,t,r,n)}}function on(e,t=[],n,r="",i=new Set){const o={value:n};if(!e(n)&&!i.has(n)){i.add(n),o.children={};for(const i in n){const s=r?r+"."+i:i;t.length&&-1!==t.indexOf(s)||(o.children[i]=on(e,t,n[i],s))}}return o}function sn(e,t=[],n,r,i=!1,o=""){const s=n?n.value:void 0,a=s===r;if(i&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:o};if(e(s)||e(r))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in r)d[e]=!0;const l=t.length>0;for(let i in d){const s=o?o+"."+i:i;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=sn(e,t,n.children[i],r[i],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function an(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||je(e)}function dn(e,t="",n=an,r,i=[],o){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(o?.has(e))return!1;const a=null!=r?r(e):Object.entries(e),d=i.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(i.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=dn(l,a,n,r,i,o),s))return s}return o&&ln(e)&&o.add(e),!1}function ln(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!ln(t))return!1;return!0}function cn(e){return"boolean"==typeof e}var un=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let o=new Qt;if(t&&(cn(t)?o.push(Gt):o.push(Kt(t.extraArgument))),n){let e={};cn(n)||(e=n),o.unshift(function(e={}){{let t=function(e,t,r,i){return JSON.stringify(e,n(t,i),r)},n=function(e,t){let n=[],r=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=t.call(this,i,o))}else n.push(o);return null==e?o:e.call(this,i,o)}},{isImmutable:r=nn,ignoredPaths:i,warnAfter:o=32}=e;const s=rn.bind(null,r,i);return({getState:e})=>{let n,r=e(),i=s(r);return a=>d=>{const l=Xt(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(r=e(),n=i.detectMutations(),i=s(r),n.wasMutated)throw new Error(`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(r=e(),n=i.detectMutations(),i=s(r),n.wasMutated)throw new Error(`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(r){let e={};cn(r)||(e=r),o.push(function(e={}){{const{isSerializable:t=an,getEntries:n,ignoredActions:r=[],ignoredActionPaths:i=["meta.arg","meta.baseQueryMeta"],ignoredPaths:o=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!We(u))return l(u);const h=l(u),f=Xt(s,"SerializableStateInvariantMiddleware");return d||r.length&&-1!==r.indexOf(u.type)||f.measureTime((()=>{const e=dn(u,"",t,n,i,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(f.measureTime((()=>{const r=dn(e.getState(),"",t,n,o,c);if(r){const{keyPath:e,value:t}=r;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),f.warnIfExceeded()),h}}}(e))}if(i){let e={};cn(i)||(e=i),o.unshift(function(e={}){const{isActionCreator:t=Yt}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}return o},hn=e=>t=>{setTimeout(t,e)},fn="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:hn(10),pn=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Qt(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,o=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?fn:"callback"===e.type?e.queueNotification:hn(e.timeout),l=()=>{s=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>i&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,o=!i,o&&(s||(s=!0,d(l))),r.dispatch(e)}finally{i=!0}}})})("object"==typeof n?n:void 0)),r};function gn(e){const t=un(),{reducer:n,middleware:r,devTools:i=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!je(n))throw new Error("`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=Le(n)}if(r&&"function"!=typeof r)throw new Error("`middleware` field must be a callback");if("function"==typeof r){if(d=r(t),!Array.isArray(d))throw new Error("when using a middleware builder function, an array of middleware must be returned")}else d=t();if(d.some((e=>"function"!=typeof e)))throw new Error("each middleware provided to configureStore must be a function");let l=_e;i&&(l=zt({trace:!0,..."object"==typeof i&&i}));const c=function(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:i.getState,dispatch:(e,...t)=>o(e,...t)},a=e.map((e=>e(s)));return o=_e(...a)(i.dispatch),{...i,dispatch:o}}}(...d),u=pn(c);if(s&&"function"!=typeof s)throw new Error("`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Array.isArray(h))throw new Error("`enhancers` callback must return an array");if(h.some((e=>"function"!=typeof e)))throw new Error("each enhancer provided to configureStore must be a function");d.length&&!h.includes(c)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return Me(a,o,l(...h))}function vn(e){const t={},n=[];let r;const i={addCase(e,o){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");const s="string"==typeof e?e:e.type;if(!s)throw new Error("`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error(`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,i},addMatcher(e,t){if(r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){if(r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,i}};return e(i),[t,n,r]}function mn(...e){return t=>e.some((e=>((e,t)=>Jt(e)?e.match(t):e(t))(e,t)))}var $n=["name","message","stack","code"],yn=class{constructor(e,t){this.payload=e,this.meta=t}_type},bn=class{constructor(e,t){this.payload=e,this.meta=t}_type},wn=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of $n)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Cn=(()=>{function e(e,t,n){const r=Zt(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),i=Zt(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=Zt(e+"/rejected",((e,t,r,i,o)=>({payload:i,error:(n&&n.serializeError||wn)(e||"Rejected"),meta:{...o||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),c=new AbortController;let u;function h(e){u=e,c.abort()}const f=async function(){let f;try{let o=n?.condition?.(e,{getState:a,extra:d});if(null!==(p=o)&&"object"==typeof p&&"function"==typeof p.then&&(o=await o),!1===o||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const g=new Promise(((e,t)=>c.signal.addEventListener("abort",(()=>t({name:"AbortError",message:u||"Aborted"})))));s(i(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([g,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:h,rejectWithValue:(e,t)=>new yn(e,t),fulfillWithValue:(e,t)=>new bn(e,t)})).then((t=>{if(t instanceof yn)throw t;return t instanceof bn?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof yn?o(null,l,e,t.payload,t.meta):o(t,l,e)}var p;return n&&!n.dispatchConditionRejection&&o.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(kn)})}}),{pending:i,rejected:o,fulfilled:r,settled:mn(o,r),typePrefix:e})}return e.withTypes=()=>e,e})();function kn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Sn=Symbol.for("rtk-slice-createasyncthunk");function xn(e,t){return`${e}/${t}`}function In(e,t,n,r){function i(i,...o){let s=n.call(e,i);if(void 0===s){if(!r)throw new Error("selectState returned undefined for an uninjected slice reducer");s=e.getInitialState()}return t(s,...o)}return i.unwrapped=t,i}var On=function({creators:e}={}){const t=e?.asyncThunk?.[Sn];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error("`name` is a required option for createSlice");"undefined"!=typeof process&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(i),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("object"==typeof e.extraReducers)throw new Error("The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],r]="function"==typeof e.extraReducers?vn(e.extraReducers):[e.extraReducers],i={...t,...s.sliceCaseReducersByType};return function(e,t){if("object"==typeof t)throw new Error("The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[r,i,o]=vn(t);if(function(e){return"function"==typeof e}(e))n=()=>en(e());else{const t=en(e);n=()=>t}function s(e=n(),t){let s=[r[t.type],...i.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[o]),s.reduce(((e,n)=>{if(n){if(Ge(e)){const r=n(e,t);return void 0===r?e:r}if(Ke(e))return Pt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in i)e.addCase(t,i[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}))}o.forEach((r=>{const o=i[r],s={reducerName:r,type:xn(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},r,i){let o,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error("Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=r.reducer,s=r.prepare}else o=r;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?Zt(e,s):Zt(e))}(s,o,a):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error("Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:o,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=i(e,o,c);r.exposeAction(t,u),s&&r.addCase(u.fulfilled,s);a&&r.addCase(u.pending,a);d&&r.addCase(u.rejected,d);l&&r.addMatcher(u.settled,l);r.exposeCaseReducer(t,{fulfilled:s||En,pending:a||En,rejected:d||En,settled:l||En})}(s,o,a,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:r,reducer:(e,t)=>(u||(u=d()),u(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(u||(u=d()),u.getInitialState()),getSelectors(t=l){const n=tn(c,this,{insert:()=>new WeakMap});return tn(n,t,{insert:()=>{const n={};for(const[r,i]of Object.entries(e.selectors??{}))n[r]=In(this,i,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t){if(this===h)throw new Error("selectSlice returned undefined for an uninjected slice reducer");t=this.getInitialState()}return t},get selectors(){return this.getSelectors(this.selectSlice)},injectInto(e,{reducerPath:t,...n}={}){const r=t??this.reducerPath;return e.inject({reducerPath:r,reducer:this.reducer},n),{...this,reducerPath:r}}};return h}}();function En(){}var An="listenerMiddleware";Zt(`${An}/add`),Zt(`${An}/removeAll`),Zt(`${An}/remove`);const Pn=e=>h((t=>{const n=On(e),r=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(o(C)(t)){constructor(...e){super(...e);const t=gn({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),i=e=>async(...n)=>{const r=await t.dispatch(e(...n));try{kn(r)}catch(e){this.logger.error(e.message,r.type,e.stack)}return r},o=Object.keys(r).reduce(((e,t)=>(e[t]=i(r[t]),e)),{});this.actions=o,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}})),Nn=h((e=>class extends(C(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}})),jn=h((e=>{const t=o(P({"widget-id":O}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}}})),Rn=h((e=>{const t=o(L,jn)(e);return class extends t{async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async getWidgetConfig(){var e,t;const n=await this.config;return null===(t=null===(e=null==n?void 0:n.projectConfig)||void 0===e?void 0:e.widgets)||void 0===t?void 0:t[this.widgetId]}}})),Tn=h((e=>class extends e{get locale(){return this.getAttribute("locale")||""}get localeCandidates(){const{locale:e,fallback:t}=y(this.locale);return[...new Set([e,t].filter(Boolean))]}firstAvailableLocale(e){var t;const n=(null!=e?e:[]).map((e=>e.toLowerCase()));return null!==(t=this.localeCandidates.find((e=>n.includes(e))))&&void 0!==t?t:""}})),Mn=e=>h((t=>{var n,i,s;const a=o(M,jn,Rn,Tn)(t);return s=class extends a{constructor(){super(...arguments),n.add(this)}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async fetchWidgetPage(t){const o=await r(this,n,"m",i).call(this,t);if(void 0!==o)return o;const s=await this.fetchStaticResource(`${e}/${this.widgetId}/${t}`,"text");return null==s?void 0:s.body}},n=new WeakSet,i=async function(t){var n;const r=await this.getWidgetConfig(),i=this.firstAvailableLocale(null!==(n=null==r?void 0:r.targetLocales)&&void 0!==n?n:[]);if(!i)return;const o=".html",s=t.endsWith(o)?t.slice(0,-5):t;try{const t=await this.fetchStaticResource(`${e}/${this.widgetId}/${s}-${i}${o}`,"text");return null==t?void 0:t.body}catch(e){return}},s})),Un=h((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),Ln=h((e=>{var n,i,o;return o=class extends(Ee(e)){constructor(){super(...arguments),n.add(this)}get clientInput(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get formInput(){return this.getAttribute("form")||void 0}createFlowTemplate(e){var{flowId:o,client:s,form:a}=e,d=t(e,["flowId","client","form"]);return u(Object.assign({projectId:this.getAttribute("project-id"),flowId:o,baseUrl:this.getAttribute("base-url")||"",baseStaticUrl:this.getAttribute("base-static-url")||"",baseCdnUrl:this.getAttribute("base-cdn-url")||"",refreshCookieName:this.getAttribute("refresh-cookie-name")||"",theme:this.theme,"style-id":this.styleId,locale:this.getAttribute("locale")||"",form:r(this,n,"m",i).call(this,a),client:Object.assign(Object.assign({},this.clientInput),s)},d))}},n=new WeakSet,i=function(e){const t=this.formInput;if(!e)return t;if(!t)return e;try{return Object.assign(Object.assign({},JSON.parse(t)),e)}catch(t){return e}},o}));var _n;!function(e){e[e.text=1]="text",e[e.numeric=2]="numeric",e[e.bool=3]="bool",e[e.singleSelect=4]="singleSelect",e[e.array=5]="array",e[e.date=6]="date"}(_n||(_n={}));const Wn=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>{const[i,...o]=n.split(".");return t!==i?Object.assign(e,{[n]:r}):(e[i]||(e[i]={}),e[i][o.join(".")]=r,e)}),{}),Dn=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Fn=(e,t)=>e===_n.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t;function qn(e){return new URLSearchParams(window.location.search).get(e)}const Bn={enabled:"active",disabled:"disabled",invited:"invited"},Hn=e=>e.tenantRoles.data,Vn=e=>e.selectedUsersLoginIds,Gn=e=>e.notifications,Kn=e=>e.customAttributes.data,zn=Bt((e=>e.subTenantRoles.data),(e=>Object.fromEntries(e.map((({tenantId:e,tenantName:t,roleNames:n})=>[e,t?{label:t,options:n}:n]))))),Jn=Bt(zn,(e=>Object.keys(e).length>0)),Zn=Bt(Kn,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),Yn=Bt((e=>e.usersList.data),Zn,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes||{}).map((([e,n])=>[e,Fn(t[e],n)])))}))))),Xn=e=>{const t=[e.roleNames||[],...(e.userTenants||[]).map((e=>e.roleNames||[]))].filter((e=>e.length>0));if(0===t.length)return e.roleNames||[];const n=t.map((e=>[...e].sort().join("\0"))),r=n.every((e=>e===n[0]));return r?t[0]:"Multiple roles"},Qn=Bt(Yn,(e=>e.map((e=>{var t;return Object.assign(Object.assign(Object.assign({},e),Dn(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:Bn[e.status]||e.status,roles:Xn(e),tenants:null===(t=e.userTenants)||void 0===t?void 0:t.map((e=>e.tenantName||e.tenantId))})})))),er=Bt(Vn,Qn,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),tr=Bt(er,(e=>e.map((e=>e.userId)))),nr=Bt(er,(e=>e.map((({userId:e,loginIds:t})=>({userId:e,loginIds:t}))))),rr=Bt(er,(e=>e.map((e=>({userId:e.userId,roles:e.roleNames}))))),ir=Bt(er,(e=>e.map((e=>e.status)))),or=Bt(er,(e=>e.every((e=>e.editable)))),sr=Bt(Vn,(e=>!!e.length)),ar=Bt(Vn,(e=>1===e.length)),dr=Bt(Vn,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),lr=Bt(ar,ir,((e,t)=>e&&t.every((e=>e===Bn.enabled)))),cr=Bt(ir,(e=>e.every((e=>e===Bn.disabled)))),ur=Bt(er,(e=>{var t;return 1===e.length?e[0].name||e[0].email||(null===(t=e[0].loginIds)||void 0===t?void 0:t[0]):`${e.length} users`})),hr=Bt(ar,cr,or,((e,t,n)=>e&&t&&n)),fr=Bt(ar,lr,or,((e,t,n)=>e&&t&&n)),pr=Bt(ar,or,((e,t)=>e&&t)),gr=Bt(ar,or,((e,t)=>e&&t)),vr=Bt(ar,or,((e,t)=>e&&t)),mr=sr,$r=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},yr=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),br=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),wr=Cn("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Cr=$r(wr)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},yr((e=>e.createUser)),br({getSuccessMsg:()=>"User created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),kr={action:wr,reducer:Cr},Sr=Cn("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),xr=$r(Sr)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},yr((e=>e.deleteUser)),br({getSuccessMsg:e=>l(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>l(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Ir={action:Sr,reducer:xr},Or=Cn("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Er=$r(Or)(yr((e=>e.setTempUserPassword)),br({getSuccessMsg:()=>"Successfully reset user password",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to reset user's password</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Ar={action:Or,reducer:Er},Pr=Cn("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Nr=$r(Pr)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},yr((e=>e.customAttributes))),jr={action:Pr,reducer:Nr},Rr=Cn("users/search",((e,{extra:{api:t},getState:n})=>{const r=n().searchParams;return t.user.search(Object.assign(Object.assign({},r),e))})),Tr=$r(Rr)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},yr((e=>e.usersList))),Mr={action:Rr,reducer:Tr},Ur=Cn("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Lr=$r(Ur)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},yr((e=>e.tenantRoles))),_r={action:Ur,reducer:Lr},Wr=Cn("tenant/getSubTenantRoles",((e,{extra:{api:t}})=>t.tenant.getSubTenantRoles())),Dr=$r(Wr)({onFulfilled:(e,t)=>{e.subTenantRoles.data=t.payload.roles},onRejected:e=>{e.subTenantRoles.data=[]}},yr((e=>e.subTenantRoles))),Fr={action:Wr,reducer:Dr},qr=Cn("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Br=$r(qr)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>a(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},yr((e=>e.updateUser)),br({getSuccessMsg:()=>"User updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Hr={action:qr,reducer:Br},Vr=Cn("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Gr=$r(Vr)({onFulfilled:(e,t)=>{var n;const r=e.usersList.data.findIndex((e=>{var n;return a(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==r&&(e.usersList.data[r].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},yr((e=>e.enableUser)),br({getSuccessMsg:()=>"User enabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to enable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Kr={action:Vr,reducer:Gr},zr=Cn("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Jr=$r(zr)({onFulfilled:(e,t)=>{var n;const r=e.usersList.data.findIndex((e=>{var n;return a(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==r&&(e.usersList.data[r].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},yr((e=>e.disableUser)),br({getSuccessMsg:()=>"User disabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to disable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Zr={action:zr,reducer:Jr},Yr=Cn("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Xr={action:Yr,reducer:$r(Yr)(yr((e=>e.removePasskey)),br({getSuccessMsg:()=>"Successfully removed user's passkey",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to remove user's passkey</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}}))},Qr={usersList:{data:[],loading:!1,error:null},createUser:{loading:!1,error:null},updateUser:{loading:!1,error:null},deleteUser:{loading:!1,error:null},enableUser:{loading:!1,error:null},disableUser:{loading:!1,error:null},removePasskey:{loading:!1,error:null},setTempUserPassword:{loading:!1,error:null},customAttributes:{loading:!1,error:null,data:[]},tenantRoles:{loading:!1,error:null,data:[]},subTenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]};class ei extends Error{}function ti(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return atob(t)}}function ni(e,t){if("string"!=typeof e)throw new ei("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new ei(`Invalid token specified: missing part #${n+1}`);let i;try{i=ti(r)}catch(e){throw new ei(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new ei(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}ei.prototype.name="InvalidTokenError";var ri={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},sso:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const ii="<region>",oi=`https://api.${ii}descope.com`,si=6e5,ai="dct",di=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},li=[503,520,521,522,524,530],ci=[100,5e3,5e3],ui=e=>new Promise((t=>setTimeout(t,e))),hi=e=>async function(...t){let n=await e(...t),r=0;for(;li.includes(n.status)&&r<ci.length;)await ui(ci[r]),n=await e(...t),r++;r>0&&(n.retries=r);const i=await n.text();return n.text=()=>Promise.resolve(i),n.json=()=>Promise.resolve(JSON.parse(i)),n.clone=()=>n,n};let fi;const pi=()=>{if(fi)return fi;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return fi=`${t}-${n}`,fi};var gi;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(gi||(gi={}));const vi=({path:e,baseUrl:t,queryParams:n,projectId:r})=>{const i=r.slice(1,-27);t=t.replace(ii,i?i+".":"");let o=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,r)=>{o=`${o}${0===r?"?":""}${t}=${encodeURIComponent(n[t])}${r===e.length-1?"":"&"}`}))}return o},mi=(...e)=>new Headers(e.reduce(((e,t)=>((e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t).forEach((([t,n])=>{e[t]="function"==typeof n?n():n})),e)),{})),$i={"Content-Type":"application/json"},yi=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},bi=(e,t)=>{const n={"x-descope-sdk-session-id":pi(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.67.1","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},wi=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e};var Ci=e=>{var t;return(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:r,logger:i,hooks:o,cookiePolicy:s,fetch:a})=>{const d=e||oi,l=((e,t)=>{const n=t||fetch;return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async function(...t){if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>di().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const r=await hi(n)(...t);return e[r.ok?"log":"error"](await(async e=>{const t=await e.text();return di().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).retries(e.retries).build()})(r)),r}:hi(n)})(i,a),c=async e=>{var i;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(e):e,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=a,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:mi(yi(t,g),bi(t,r),(null==n?void 0:n.baseHeaders)||{},wi(v)?$i:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const $=await l(vi({path:c,baseUrl:d,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(e,null==$?void 0:$.clone()),null==o?void 0:o.transformResponse){const e=await $.json(),t=(y=(null===(i=$.headers)||void 0===i?void 0:i.get("set-cookie"))||"",Object.fromEntries(function(e){if(!e)return[];const t=[];let n=0;function r(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function i(){const t=e.charAt(n);return"="!==t&&";"!==t&&","!==t}for(;n<e.length;){const o=n;let s,a,d=!1;for(;r();)if(","===e.charAt(n)){for(s=n,n+=1,r(),a=n;n<e.length&&i();)n+=1;if(n<e.length&&"="===e.charAt(n)){d=!0,n=a,t.push(e.substring(o,s));break}n=s+1}else n+=1;(!d||n>=e.length)&&t.push(e.substring(o,e.length))}return t}(y).map((e=>{const t=e.split(";")[0],n=t.indexOf("=");return n<1?null:[t.substring(0,n).trim(),t.substring(n+1).trim()]})).filter(Boolean))),n=Object.assign(Object.assign({},$),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}var y;return $};return{get:(e,{headers:t,queryParams:n,token:r}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:gi.get,token:r}),post:(e,t,{headers:n,queryParams:r,token:i}={})=>c({path:e,headers:n,queryParams:r,body:t,method:gi.post,token:i}),patch:(e,t,{headers:n,queryParams:r,token:i}={})=>c({path:e,headers:n,queryParams:r,body:t,method:gi.patch,token:i}),put:(e,t,{headers:n,queryParams:r,token:i}={})=>c({path:e,headers:n,queryParams:r,body:t,method:gi.put,token:i}),delete:(e,{headers:t,queryParams:n,token:r}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:gi.delete,token:r}),hooks:o,buildUrl:(e,n)=>vi({projectId:t,baseUrl:d,path:e,queryParams:n})}})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const r=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==r?void 0:r.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var r;const i=[].concat((null===(r=e.hooks)||void 0===r?void 0:r.afterRequest)||[]);0!=i.length&&(await Promise.allSettled(null==i?void 0:i.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))},ki=429;function Si(e,t,n){var r;let i=xi(e);if(t){if(!(null==i?void 0:i.tenants)&&(null==i?void 0:i[ai])===t)return(null==i?void 0:i[n])||[];i=null===(r=null==i?void 0:i.tenants)||void 0===r?void 0:r[t]}const o=null==i?void 0:i[n];return Array.isArray(o)?o:[]}function xi(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return ni(e)}function Ii(e){const{exp:t}=xi(e);return(new Date).getTime()/1e3>t}function Oi(e){let t=xi(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Ei(e,t){return Si(e,t,"permissions")}function Ai(e,t){return Si(e,t,"roles")}const Pi=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Ni(e,t){var n;const r=await e,i={code:r.status,ok:r.ok,response:r},o=await r.clone().json();return r.ok?i.data=o:(i.error=o,r.status===ki&&Object.assign(i.error,{retryAfter:Number.parseInt(null===(n=r.headers)||void 0===n?void 0:n.get("retry-after"))||0})),i}function ji(e){var t;return(null===(t=xi(e))||void 0===t?void 0:t[ai])||""}const Ri=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Ti=(e,t)=>(n=t)=>t=>{const r=e.filter((e=>e(t)));return!(r.length<e.length)&&(n?n.replace("{val}",t):r.join(" OR "))},Mi=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ui=e=>t=>e.test(t),Li=Ui(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),_i=Ui(/^\+[1-9]{1}[0-9]{3,14}$/),Wi=Ri(Li,'"{val}" is not a valid email'),Di=Ri(_i,'"{val}" is not a valid phone number'),Fi=Ri((e=>e.length>=1),"Minimum length is 1");const qi=Ri((e=>"string"==typeof e),"Input is not a string"),Bi=Ri((e=>Array.isArray(e)),"Input is not an array"),Hi=Ri((e=>"boolean"==typeof e),"Input is not a boolean"),Vi=Ri((e=>void 0===e),"Input is defined"),Gi=Ti([qi(),Vi()],"Input is not a string or undefined"),Ki=Ti([Bi(),Hi()],"Input is not an array or boolean"),zi=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Mi(...e).validate(n[t]))),t(...n)),Ji=e=>[qi(`"${e}" must be a string`)],Zi=e=>[Gi(`"${e}" must be string or undefined`)],Yi=e=>[qi(`"${e}" must be a string`),Fi(`"${e}" must not be empty`)],Xi=e=>[qi(`"${e}" must be a string`),Wi()],Qi=e=>[qi(`"${e}" must be a string`),Di()],eo=zi(Yi("accessKey")),to=e=>({exchange:eo(((t,n)=>Ni(e.post(ri.accessKey.exchange,{loginOptions:n},{token:t}))))}),no=(e,t,n)=>(t.forEach((t=>{const r=t.split(".");let i=r.shift(),o=e;for(;r.length>0;){if(o=o[i],!i||!o)throw Error(`Invalid path "${t}", "${i}" is missing or has no value`);i=r.shift()}if("function"!=typeof o[i])throw Error(`"${t}" is not a function`);const s=o[i];o[i]=n(s)})),e),ro=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||si,si)});var io,oo;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"}(io||(io={})),function(e){e.email="email"}(oo||(oo={}));const so=Object.assign(Object.assign({},io),oo);var ao;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(ao||(ao={}));const lo=Yi("loginId"),co=zi(Yi("token")),uo=zi(lo),ho=zi(Yi("pendingRef")),fo=zi(lo,Xi("email")),po=e=>({verify:co((t=>Ni(e.post(ri.enchantedLink.verify,{token:t})))),signIn:uo(((n,r,i={},o)=>{var{providerId:s}=i,a=t(i,["providerId"]);return Ni(e.post(Pi(ri.enchantedLink.signIn,so.email),{loginId:n,URI:r,loginOptions:a,providerId:s},{token:o}))})),signUpOrIn:uo(((n,r,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ni(e.post(Pi(ri.enchantedLink.signUpOrIn,so.email),{loginId:n,URI:r,loginOptions:s,providerId:o}))})),signUp:uo(((n,r,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ni(e.post(Pi(ri.enchantedLink.signUp,so.email),{loginId:n,URI:r,user:i,loginOptions:a,providerId:s}))})),waitForSession:ho(((t,n)=>new Promise((r=>{const{pollingIntervalMs:i,timeoutMs:o}=ro(n);let s;const a=setInterval((async()=>{const n=await e.post(ri.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Ni(Promise.resolve(n))))}),i);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:fo(((t,n,r,i,o)=>Ni(e.post(ri.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:r},o),{token:i}))))}}),go=zi(Yi("flowId")),vo=zi(Yi("executionId"),Yi("stepId"),Yi("interactionId")),mo=e=>({start:go(((t,n,r,i,o,s,a,d=!1)=>Ni(e.post(ri.flow.start,{flowId:t,options:n,conditionInteractionId:r,interactionId:i,componentsVersion:o,flowVersions:s,input:a,isCustomScreen:d})))),next:vo(((t,n,r,i,o,s,a=!1)=>Ni(e.post(ri.flow.next,{executionId:t,stepId:n,interactionId:r,version:i,componentsVersion:o,input:s,isCustomScreen:a}))))}),$o=Yi("loginId"),yo=zi(Yi("token")),bo=zi($o),wo=zi($o,Qi("phone")),Co=zi($o,Xi("email")),ko=Object.keys(so).filter((e=>e!==io.voice&&e!==io.im)),So=e=>({verify:yo((t=>Ni(e.post(ri.magicLink.verify,{token:t})))),signIn:ko.reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:bo(((n,i,o={},s)=>{var{providerId:a}=o,d=t(o,["providerId"]);return Ni(e.post(Pi(ri.magicLink.signIn,r),{loginId:n,URI:i,loginOptions:d,providerId:a},{token:s}))}))})),{}),signUp:ko.reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:bo(((n,i,o,s={})=>{var{providerId:a}=s,d=t(s,["providerId"]);return Ni(e.post(Pi(ri.magicLink.signUp,r),{loginId:n,URI:i,user:o,loginOptions:d,providerId:a}))}))})),{}),signUpOrIn:ko.reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:bo(((n,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ni(e.post(Pi(ri.magicLink.signUpOrIn,r),{loginId:n,URI:i,loginOptions:a,providerId:s}))}))})),{}),update:{email:Co(((t,n,r,i,o)=>Ni(e.post(ri.magicLink.update.email,Object.assign({loginId:t,email:n,URI:r},o),{token:i})))),phone:Object.keys(io).filter((e=>e!==io.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:wo(((t,r,i,o,s)=>Ni(e.post(Pi(ri.magicLink.update.phone,n),Object.assign({loginId:t,phone:r,URI:i},s),{token:o}))))})),{})}});var xo;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple",e.discord="discord",e.linkedin="linkedin",e.slack="slack"}(xo||(xo={}));const Io=zi(Yi("code")),Oo=e=>({start:Object.assign(((t,n,r,i,o)=>Ni(e.post(ri.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),o&&{loginHint:o}),token:i}))),Object.keys(xo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,r,i,o)=>Ni(e.post(ri.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},t&&{redirectURL:t}),o&&{loginHint:o}),token:i}))})),{})),exchange:Io((t=>Ni(e.post(ri.oauth.exchange,{code:t})))),startNative:(t,n,r)=>Ni(e.post(ri.oauth.startNative,{provider:t,loginOptions:n,implicit:r})),finishNative:(t,n,r,i,o)=>Ni(e.post(ri.oauth.finishNative,{provider:t,stateId:n,user:r,code:i,idToken:o})),getOneTapClientId:t=>Ni(e.get(ri.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,r,i)=>Ni(e.post(ri.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:r,loginOptions:i})),exchangeOneTapIDToken:(t,n,r,i)=>Ni(e.post(ri.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:r,loginOptions:i}))}),Eo=Yi("appId"),Ao=zi(Eo),Po=e=>({connect:Ao(((t,n,r)=>{const i=null==n?void 0:n.tenantId,o=null==n?void 0:n.tenantLevel;return null==n||delete n.tenantId,null==n||delete n.tenantLevel,Ni(e.post(ri.outbound.connect,{appId:t,tenantId:i,tenantLevel:o,options:n},{token:r}))}))}),No=Yi("loginId"),jo=zi(No,Yi("code")),Ro=zi(No),To=zi(No,Qi("phone")),Mo=zi(No,Xi("email")),Uo=e=>({verify:Object.keys(so).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:jo(((t,r)=>Ni(e.post(Pi(ri.otp.verify,n),{code:r,loginId:t}))))})),{}),signIn:Object.keys(so).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Ro(((n,i={},o)=>{var{providerId:s}=i,a=t(i,["providerId"]);return Ni(e.post(Pi(ri.otp.signIn,r),{loginId:n,loginOptions:a,providerId:s},{token:o}))}))})),{}),signUp:Object.keys(so).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Ro(((n,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ni(e.post(Pi(ri.otp.signUp,r),{loginId:n,user:i,loginOptions:a,providerId:s}))}))})),{}),signUpOrIn:Object.keys(so).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Ro(((n,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ni(e.post(Pi(ri.otp.signUpOrIn,r),{loginId:n,loginOptions:s,providerId:o}))}))})),{}),update:{email:Mo(((t,n,r,i)=>Ni(e.post(ri.otp.update.email,Object.assign({loginId:t,email:n},i),{token:r})))),phone:Object.keys(io).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:To(((t,r,i,o)=>Ni(e.post(Pi(ri.otp.update.phone,n),Object.assign({loginId:t,phone:r},o),{token:i}))))})),{})}}),Lo=zi(Yi("tenant")),_o=zi(Yi("code")),Wo=e=>({start:Lo(((t,n,r,i,o,s,a,d)=>Ni(e.post(ri.sso.start,r||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o}),s&&{forceAuthn:"true"}),a&&{loginHint:a}),d&&{initiatedEmail:t})},i&&{token:i}))))),exchange:_o((t=>Ni(e.post(ri.sso.exchange,{code:t}))))}),Do=Yi("loginId"),Fo=zi(Do,Yi("code")),qo=zi(Do),Bo=zi(Do),Ho=e=>({signUp:qo(((t,n)=>Ni(e.post(ri.totp.signUp,{loginId:t,user:n})))),verify:Fo(((t,n,r,i)=>Ni(e.post(ri.totp.verify,{loginId:t,code:n,loginOptions:r},{token:i})))),update:Bo(((t,n)=>Ni(e.post(ri.totp.update,{loginId:t},{token:n}))))}),Vo=Yi("loginId"),Go=Yi("newPassword"),Ko=zi(Vo,Yi("password")),zo=zi(Vo),Jo=zi(Vo,Go),Zo=zi(Vo,Yi("oldPassword"),Go),Yo=e=>({signUp:Ko(((n,r,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ni(e.post(ri.password.signUp,{loginId:n,password:r,user:i,loginOptions:a,providerId:s}))})),signIn:Ko(((n,r,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ni(e.post(ri.password.signIn,{loginId:n,password:r,loginOptions:s,providerId:o}))})),sendReset:zo(((t,n,r)=>Ni(e.post(ri.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:r})))),update:Jo(((t,n,r)=>Ni(e.post(ri.password.update,{loginId:t,newPassword:n},{token:r})))),replace:Zo(((t,n,r)=>Ni(e.post(ri.password.replace,{loginId:t,oldPassword:n,newPassword:r})))),policy:()=>Ni(e.get(ri.password.policy))}),Xo=Ji("loginId"),Qo=Yi("loginId"),es=Ji("origin"),ts=zi(Qo,es,Yi("name")),ns=zi(Qo,es),rs=zi(Xo,es),is=zi(Qo,es,Zi("token")),os=zi(Yi("transactionId"),Yi("response")),ss=e=>({signUp:{start:ts(((t,n,r,i,o)=>Ni(e.post(ri.webauthn.signUp.start,{user:{loginId:t,name:r},origin:n,loginOptions:o,passkeyOptions:i})))),finish:os(((t,n)=>Ni(e.post(ri.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:rs(((t,n,r,i,o)=>Ni(e.post(ri.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:o},{token:i})))),finish:os(((t,n)=>Ni(e.post(ri.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:ns(((t,n,r,i)=>Ni(e.post(ri.webauthn.signUpOrIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:r}))))},update:{start:is(((t,n,r,i,o)=>Ni(e.post(ri.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:i,mfa:o},{token:r})))),finish:os(((t,n)=>Ni(e.post(ri.webauthn.update.finish,{transactionId:t,response:n}))))}}),as=Ji("loginId"),ds=zi(as),ls=zi(Yi("pendingRef")),cs=e=>({signUpOrIn:ds(((n,r={})=>{var{providerId:i}=r,o=t(r,["providerId"]);return Ni(e.post(ri.notp.signUpOrIn,{loginId:n,loginOptions:o,providerId:i}))})),signUp:ds(((n,r,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ni(e.post(ri.notp.signUp,{loginId:n,user:r,providerId:o,loginOptions:s}))})),signIn:ds(((n,r={},i)=>{var{providerId:o}=r,s=t(r,["providerId"]);return Ni(e.post(ri.notp.signIn,{loginId:n,loginOptions:s,providerId:o},{token:i}))})),waitForSession:ls(((t,n)=>new Promise((r=>{const{pollingIntervalMs:i,timeoutMs:o}=ro(n);let s;const a=setInterval((async()=>{const n=await e.post(ri.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Ni(Promise.resolve(n))))}),i);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),us=zi(Yi("token")),hs=zi(Zi("token"));var fs,ps=zi([(fs=Yi("projectId"),Ri(((e,t)=>n=>Mi(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=n.length;let i=0,o=e===Object(e)?e:void 0;for(;null!=o&&i<r;)o=o[n[i++]];return i&&i===r&&void 0!==o?o:void 0})(n,e)))("projectId",fs))())])((e=>{const{projectId:t,logger:n,baseUrl:r,cookiePolicy:i,baseHeaders:o={},refreshCookieName:s,fetch:a}=e;return d=Ci({baseUrl:r,projectId:t,logger:n,hooks:{get beforeRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest},get afterRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.afterRequest},get transformResponse(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}},cookiePolicy:i,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:to(d),otp:Uo(d),magicLink:So(d),enchantedLink:po(d),oauth:Oo(d),outbound:Po(d),sso:Wo(d),saml:Wo(d),totp:Ho(d),notp:cs(d),webauthn:ss(d),password:Yo(d),flow:mo(d),refresh:hs(((e,t,n,r)=>{const i={};n&&(i.externalToken=n);const o=r?ri.tryRefresh:ri.refresh;return Ni(d.post(o,i,{token:e,queryParams:t}))})),selectTenant:zi([qi("tenantId")],[Gi('"token" must be string or undefined')])(((e,t)=>Ni(d.post(ri.selectTenant,{tenant:e},{token:t})))),logout:hs((e=>Ni(d.post(ri.logout,{},{token:e})))),logoutAll:hs((e=>Ni(d.post(ri.logoutAll,{},{token:e})))),me:hs((e=>Ni(d.get(ri.me,{token:e})))),myTenants:zi([Ki('"tenants" must a string array or a boolean')],[Gi('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,Ni(d.post(ri.myTenants,n,{token:t}))})),history:hs((e=>Ni(d.get(ri.history,{token:e})))),isJwtExpired:us(Ii),getTenants:us(Oi),getJwtPermissions:us(Ei),getJwtRoles:us(Ai),getCurrentTenant:us(ji),httpClient:d};var d})),gs=Object.assign(ps,{DeliveryMethods:so});
6
- /*! js-cookie v3.0.8 | MIT */function vs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)"__proto__"!==r&&(e[r]=n[r])}return e}var ms=function e(t,n){function r(e,r,i){if("undefined"!=typeof document){"number"==typeof(i=vs({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in i)i[s]&&(o+="; "+s,!0!==i[s]&&(o+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(a in r||(r[a]=t.read(s,a)),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",vs({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,vs({},this.attributes,t))},withConverter:function(t){return e(vs({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});var $s={default:"endpoint"},ys="Blocked by CSP",bs="The endpoint parameter is not a valid URL",ws="Failed to load the JS script of the agent",Cs="9319";function ks(e,t){var n,r,i,o,s,a=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),o=0,r=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,o++))},i=new Set,[n.current(),function(e,t){var o,s=t instanceof Error?t.message:"";if(s===ys||s===bs)n.exclude(),o=0;else if(s===Cs)n.exclude();else if(s===ws){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!i.has(d)&&(i.add(d),o=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=o?o:e.getTime()+r()-Date.now()]}]),l=d[0],c=d[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var u=function(e){var n=new Date,r=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r()}),r),i.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=c(n,e);if(!t)throw s;var r,i=t[0],o=t[1];return(r=o,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return u(i)}))}))};return u(l).then((function(e){return[e,a]}))}var Ss="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",xs=Ss;function Is(n){var r;n.scriptUrlPattern;var i=n.token,o=n.apiKey,s=void 0===o?i:o,a=t(n,["scriptUrlPattern","token","apiKey"]),d=null!==(r=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(n,"scriptUrlPattern"))&&void 0!==r?r:Ss,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(document,"visibilitychange",t);return t(),[e,n]}(),c=l[0],u=l[1];return Promise.resolve().then((function(){if(!s||"string"!=typeof s)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.6"):e}))}(String(e),t)}))}(d,s);return ks(e,Os)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Cs?new Error(ws):e}(e)})).then((function(t){var n=t[0],r=t[1];return u(),n.load(e(e({},a),{ldi:{attempts:r,visibilityStates:c}}))}))}function Os(e){return function(e,t,n){var r,i=document,o="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(r=t,a())};i.addEventListener(o,s);var a=function(){return i.removeEventListener(o,s)};return Promise.resolve().then(t).then((function(e){return a(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(a(),r)return n(r);throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(bs);var r=document.createElement("script"),i=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},o=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),t()},r.onerror=function(){i(),n(new Error(ws))},r.async=!0,r.src=e,o.appendChild(r)}))}(e)}),(function(){throw new Error(ys)})).then(Es)}function Es(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,r=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==r?void 0:r.configurable)?delete e[t]:r&&!r.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(Cs);return n}const As="3.2.0",Ps="undefined"!=typeof window,Ns=Math.pow(2,31)-1,js=`https://descopecdn.com/npm/oidc-client-ts@${As}/dist/browser/oidc-client-ts.min.js`,Rs=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${As}/dist/browser/oidc-client-ts.min.js`,Ts=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let Ms;const Us=e=>{try{return ni(e).exp}catch(e){return null}},Ls=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Us(n)},_s=e=>{const{expires_in:t,expires_at:n,access_token:r}=e;return n||(t?Math.floor(Date.now()/1e3)+t:r?Us(r):void 0)},Ws=e=>{const{access_token:n,id_token:r,refresh_token:i,refresh_expire_in:o}=e,s=t(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||n,idToken:r,refreshJwt:e.refreshJwt||i,sessionExpiration:e.sessionExpiration||_s(e),cookieExpiration:e.cookieExpiration||Ls(e)},s)},Ds=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,r)=>{var i;return n[r]=[].concat((null===(i=e.hooks)||void 0===i?void 0:i[r])||[]).concat((null==t?void 0:t[r])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Fs=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json()),n=(null==t?void 0:t.authInfo)||t||{};return Ws(n)},qs=()=>Ps&&!!window.descopeBridge,Bs=(e,t)=>{if(!((null==t?void 0:t.status)>=400&&(null==t?void 0:t.status)<500))return!1;const n=(null==e?void 0:e.path)||"";return Ts.includes(n)},Hs=void 0!==Ms||Ps&&void 0!==window.localStorage,Vs=(e,t)=>{var n,r;return null===(r=null===(n=Ms||Ps&&window.localStorage)||void 0===n?void 0:n.setItem)||void 0===r?void 0:r.call(n,e,t)},Gs=e=>{var t,n;return null===(n=null===(t=Ms||Ps&&window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e)},Ks=e=>{var t,n;return null===(n=null===(t=Ms||Ps&&window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n?void 0:n.call(t,e)},zs=e=>{var t,n,r,i,o;return null!==(o=null!==(n=null===(t=null==Ms?void 0:Ms.key)||void 0===t?void 0:t.call(Ms,e))&&void 0!==n?n:Ps&&(null===(i=null===(r=window.localStorage)||void 0===r?void 0:r.key)||void 0===i?void 0:i.call(r,e)))&&void 0!==o?o:null},Js=e=>{var t,n;return Ps&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e))||null},Zs=e=>{var t,n;try{Ps&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n||n.call(t,e))}catch(e){}},Ys=(...e)=>{console.debug(...e)},Xs=(...e)=>{console.warn(...e)},Qs="DS",ea="DSR",ta="DSI",na="DSRCN";function ra(e,t,n){if(t){const{cookieDomain:r,cookiePath:i,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=ia(r);ms.set(e,t,{path:i,domain:l?r:void 0,expires:d,sameSite:o,secure:a})}}function ia(e){const t=window.location.hostname.split("."),n=null==e?void 0:e.split(".");return t.slice(-(null==n?void 0:n.length)).join(".")===e}const oa=e=>(null==e?void 0:e.cookieName)||Qs,sa=e=>(null==e?void 0:e.cookieName)||ea;function aa(e="",t){return ms.get(sa(t))||Gs(`${e}${ea}`)||""}function da(e="",t){return ms.get(oa(t))||Gs(`${e}${Qs}`)||""}function la(e=""){return Gs(`${e}${ta}`)||""}function ca(e="",t,n,r){Ks(`${e}${ea}`),Ks(`${e}${Qs}`),Ks(`${e}${ta}`),Ks(`${e}${na}`);const i=oa(t);ms.remove(i,null==r?void 0:r.session);const o=sa(n);ms.remove(o,null==r?void 0:r.refresh)}const ua=(e,t,n)=>r=>{const i=Object.assign(r,{token:r.token||aa(e,t)});if(!n){const t=function(e=""){return Gs(`${e}${na}`)}(e);t&&(i.headers=Object.assign(Object.assign({},i.headers||{}),{"x-descope-refresh-cookie-name":t}))}const o=function(e=""){return Gs(`${e}DTD`)||""}(e);return o&&(i.headers=Object.assign(Object.assign({},i.headers||{}),{"x-descope-trusted-device-token":o})),i},ha=Ps&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",fa="vsid",pa="vrid",ga="fp",va=(e=!1)=>{const t=Gs(ga);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},ma=async(e,t=ha)=>{try{if(va())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const i=new URL(t);i.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const o=i.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Is({apiKey:e,endpoint:[r.toString(),$s],scriptUrlPattern:[o,xs]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[fa]:e,[pa]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};Vs(ga,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},$a=e=>{const t=va(!0);return t&&e.body&&(e.body.fpData=t),e},ya="descopeFlowNonce",ba="X-Descope-Flow-Nonce",wa="/v1/flow/start",Ca="/v1/flow/next",ka=(e,t=ya)=>`${t}${e}`,Sa=(e,t=ya)=>{try{const n=ka(e,t),r=Gs(n);if(!r)return null;const i=JSON.parse(r);return i.expiry<Date.now()?(xa(e,t),null):{value:i.value,seq:i.seq}}catch(e){return console.error("Error getting flow nonce:",e),null}},xa=(e,t=ya)=>{try{const n=ka(e,t);Ks(n)}catch(e){console.error("Error removing flow nonce:",e)}},Ia=e=>{var t;return(null===(t=/.*\|#\|(.*)/.exec(e))||void 0===t?void 0:t[1])||null},Oa=e=>{var t;return e.path===Ca&&(null===(t=e.body)||void 0===t?void 0:t.executionId)?Ia(e.body.executionId):null},Ea="dls_last_user_login_id",Aa="dls_last_user_display_name",Pa=e=>Vs(Ea,e),Na=()=>Gs(Ea),ja=()=>Gs(Aa),Ra=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,r={}]=t,i=Na(),o=ja();return i&&(null!==(n=r.lastAuth)&&void 0!==n||(r.lastAuth={}),r.lastAuth.loginId=i,r.lastAuth.name=o),await e(...t)},Ta="DSLI",Ma=e=>async(...t)=>{const n=await e(...t);return Zs(Ta),n};function Ua(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}async function La(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Ha(n.publicKey.challenge),n.publicKey.user.id=Ha(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Ha(e.id)})),n}(e);try{return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Va(n.rawId),type:n.type,response:{attestationObject:Va(n.response.attestationObject),clientDataJSON:Va(n.response.clientDataJSON)}})}catch(e){throw await Da(e,t,!0)}var n}async function _a(e){const t=qa(e);try{return Ba(await navigator.credentials.get(t))}catch(e){throw await Da(e,t,!1)}}async function Wa(e,t){const n=qa(e);n.signal=t.signal,n.mediation="conditional";try{return Ba(await navigator.credentials.get(n))}catch(e){throw await Da(e,n,!1)}}async function Da(e,t,n){if(e&&"object"==typeof e)try{e.reason=await async function(e,t,n){var r,i;const o=null==e?void 0:e.name;if("AbortError"===o&&(null==t?void 0:t.signal)instanceof AbortSignal)return"aborted";if("InvalidStateError"===o&&n)return"authenticator_already_registered";if("NotSupportedError"===o)return"no_supported_algorithm";if("ConstraintError"===o)return"authenticator_constraints_unsupported";if("SecurityError"===o){const e=window.location.hostname;return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)?"invalid_rpid":"invalid_domain"}if(!await Fa())return"webauthn_unsupported";const s="platform"===(null===(i=null===(r=null==t?void 0:t.publicKey)||void 0===r?void 0:r.authenticatorSelection)||void 0===i?void 0:i.authenticatorAttachment);return n&&s&&!await Fa(!0)?"platform_authenticator_unsupported":"NotAllowedError"===o?"not_allowed":"unknown"}(e,t,n)}catch(e){}return e}async function Fa(e=!1){var t,n;if(!Ps)return Promise.resolve(!1);if(qs()){const e=null===(n=null===(t=window.descopeBridge)||void 0===t?void 0:t.hostInfo)||void 0===n?void 0:n.webauthn;if("boolean"==typeof e)return e}const r=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return r&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():r}function qa(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Ha(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Ha(e.id)})),n}function Ba(e){return JSON.stringify({id:e.id,rawId:Va(e.rawId),type:e.type,response:{authenticatorData:Va(e.response.authenticatorData),clientDataJSON:Va(e.response.clientDataJSON),signature:Va(e.response.signature),userHandle:e.response.userHandle?Va(e.response.userHandle):void 0}})}function Ha(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Va(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Ga,Ka=(Ga=e=>({async signUp(t,n,r){const i=await e.webauthn.signUp.start(t,window.location.origin,n,r);if(!i.ok)return i;const o=await La(i.data.options);return await e.webauthn.signUp.finish(i.data.transactionId,o)},async signIn(t,n){const r=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!r.ok)return r;const i=await _a(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)},async signUpOrIn(t,n){var r;const i=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!i.ok)return i;if(null===(r=i.data)||void 0===r?void 0:r.create){const t=await La(i.data.options);return await e.webauthn.signUp.finish(i.data.transactionId,t)}{const t=await _a(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,t)}},async update(t,n,r){const i=await e.webauthn.update.start(t,window.location.origin,n,r);if(!i.ok)return i;const o=await La(i.data.options);return await e.webauthn.update.finish(i.data.transactionId,o)},helpers:{create:La,get:_a,isSupported:Fa,conditional:Wa}}),(...e)=>{const t=Ga(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const za="/fedcm/config",Ja=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("")}return Math.random().toString(36).substring(2)};async function Za(e,t){var n;try{await Ya(e,t)}catch(e){null===(n=null==t?void 0:t.onFailed)||void 0===n||n.call(t,e)}}async function Ya(e,t){var n,r;const i=await async function(e,t="google",n,r,i){const o=Ja(),s=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}(),a=await e.oauth.getOneTapClientId(t);if(!a.ok)throw new Error("Failed to get OneTap client ID for provider "+t);const d=a.data.clientId;return new Promise((e=>{var a,l;const c=n=>{e({provider:t,nonce:o,credential:null==n?void 0:n.credential})};s.initialize(Object.assign(Object.assign({},n),{itp_support:null===(a=null==n?void 0:n.itp_support)||void 0===a||a,use_fedcm_for_prompt:null===(l=null==n?void 0:n.use_fedcm_for_prompt)||void 0===l||l,client_id:d,callback:c,nonce:o})),s.prompt((e=>{var t,n;if(i&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);return null==i||i(n),void c()}if(r&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);return null==r||r(t),void c()}}))}))}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!i.credential)return null;if(null==t?void 0:t.onCodeReceived){const r=await e.oauth.verifyOneTapIDToken(i.provider,i.credential,i.nonce,null==t?void 0:t.loginOptions);if(!r.ok||!r.data)throw new Error("Failed to verify OneTap client ID for provider "+i.provider);null===(n=null==t?void 0:t.onCodeReceived)||void 0===n||n.call(t,r.data.code)}else{const n=await e.oauth.exchangeOneTapIDToken(i.provider,i.credential,i.nonce,null==t?void 0:t.loginOptions);if(!n.ok||!n.data)throw new Error("Failed to exchange OneTap client ID for provider "+i.provider);null===(r=null==t?void 0:t.onAuthenticated)||void 0===r||r.call(t,n.data)}}var Xa=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Fa(),r=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=r,e.flow.start(...t)}});let Qa;const ed=(e,t)=>new Promise(((n,r)=>{if(!e.length)return r(new Error("No URLs provided to loadScriptWithFallback"));const i=t();if(i)return n(i);const o=e.shift(),s=document.createElement("script");s.src=o,s.id=(e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t).toString(16)})(o),s.onload=()=>{const e=t();if(e)return n(e);throw new Error("Could not get entry after loading script from URL")},s.addEventListener("error",(()=>{ed(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),td=(e,t,n)=>{const r=async()=>{let r,i;return r&&i||({client:r,stateUserKey:i}=await(async(e,t,n)=>{Qa||(Qa=(async()=>{try{return require("oidc-client-ts")}catch(e){return ed([js,Rs],(()=>window.oidc))}})());const{OidcClient:r,WebStorageStateStore:i}=await Qa;if(!r)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=(null==n?void 0:n.redirectUri)||window.location.href;let s,a,d,l;if(null==n?void 0:n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,a=n.clientId,d=`${a}_user`,l="openid"}else(null==n?void 0:n.applicationId)?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access");const c={authority:s,client_id:a,redirect_uri:o,response_type:"code",scope:(null==n?void 0:n.scope)||l,stateStore:new i({store:window.localStorage,prefix:a}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),{client:new r(c),stateUserKey:d}})(e,t,n)),{client:r,stateUserKey:i}},i=async(t="")=>{var n;const{client:i,stateUserKey:o}=await r(),s=await i.processSigninResponse(t||window.location.href);var a;return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(s)))),Vs(o,JSON.stringify({id_token:(a=s).id_token,session_state:a.session_state,profile:a.profile})),(()=>{const e=new URL(window.location.href);e.searchParams.delete("code"),e.searchParams.delete("state"),window.history.replaceState({},document.title,e.toString())})(),s};return{loginWithRedirect:async(t={},n=!1)=>{var i;const{client:o}=await r(),s=await o.createSigninRequest(t),{url:a}=s;return n||(await(null===(i=e.httpClient.hooks)||void 0===i?void 0:i.afterRequest({},new Response(JSON.stringify(s)))),window.location.href=a),{ok:!0,data:s}},finishLogin:i,finishLoginIfNeed:async(e="")=>{if(window.location.search.includes("code")&&window.location.search.includes("state"))return await i(e)},refreshToken:async t=>{var n;const{client:i,stateUserKey:o}=await r(),s=(e=>{const t=Gs(e);return t?JSON.parse(t):null})(o);if(!s)throw new Error("User not found in storage to refresh token");let a=t;if(!a){const t={};e.httpClient.hooks.beforeRequest(t),a=t.token}const d=await i.useRefreshToken({state:{refresh_token:a,session_state:s.session_state,profile:s.profile}});return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(d)))),d},logout:async(e,t=!1)=>{const{client:n,stateUserKey:i}=await r();e||(e={}),e.id_token_hint=e.id_token_hint||la(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return Ks(i),t||window.location.replace(s),o}}},nd=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var n;return n=t.customStorage,Ms=n,e(t)}),(e=>n=>{var{fpKey:r,fpLoad:i}=n,o=t(n,["fpKey","fpLoad"]);return Ps?(r&&i&&ma(r).catch((()=>null)),e(Ds(o,{beforeRequest:$a}))):e(o)}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.51.4"},t.baseHeaders)}))),(e=>t=>{const n=Ua(),r=Ua(),i=Ua(),o=Ua(),s=e(Ds(t,{afterRequest:async(e,t)=>{if(Bs(e,t))Ys("Session invalidated, notifying subscribers with empty values"),r.pub(null),i.pub(null),n.pub(null),o.pub(null);else{const e=await(async e=>{const t=await Fs(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)})(t);e&&i.pub(e);const{sessionJwt:s,sessionExpiration:a,claims:d}=await Fs(t);s&&r.pub(s),d&&o.pub(d),(a||s)&&n.pub(a||42)}}})),a=no(s,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const s=await e(...t);return r.pub(null),i.pub(null),n.pub(null),o.pub(null),s}));return Object.assign(a,{onSessionTokenChange:r.sub,onUserChange:i.sub,onClaimsChange:o.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>n=>{var r;const{enableFlowNonce:i=!0,nonceStoragePrefix:o=ya}=n,s=t(n,["enableFlowNonce","nonceStoragePrefix"]);if(!i)return e(s);((e=ya)=>{try{if(!Hs)return;for(let i=0;i<(void 0,n=void 0,void 0,null!==(r=null!==(t=null==Ms?void 0:Ms.length)&&void 0!==t?t:Ps&&(null===(n=window.localStorage)||void 0===n?void 0:n.length))&&void 0!==r?r:0);i++){const t=zs(i);if(t&&t.startsWith(e)){const n=Gs(t);if(n)try{JSON.parse(n).expiry<Date.now()&&Ks(t)}catch(e){Ks(t)}}}}catch(e){console.error("Error cleaning up expired nonces:",e)}var t,n,r})(o);const a=e(Ds(s,{afterRequest:async(e,t)=>{var n;if(e.path!==wa&&e.path!==Ca)return;const{nonce:r,seq:i,executionId:s}=await(async(e,t)=>{try{const n=t.headers.get(ba),r=null===n?void 0:(e=>{const t=e.indexOf(".");if(t<=0)return;const n=e.slice(0,t);if(!/^\d+$/.test(n))return;const r=Number(n);return Number.isSafeInteger(r)?r:void 0})(n);let i=await t.clone().json().then((e=>(null==e?void 0:e.executionId)||null)).catch((()=>null));return i||(i=Oa(e)),{nonce:n,seq:r,executionId:Ia(i)}}catch(e){return{nonce:null,seq:void 0,executionId:null}}})(e,t);if(!r||!s)return;const a=e.path===wa,d=null===(n=Sa(s,o))||void 0===n?void 0:n.seq;!a&&void 0!==i&&void 0!==d&&i<=d||((e,t,n,r=ya,i)=>{try{const o=ka(e,r),s=n?172800:10800,a={value:t,expiry:Date.now()+1e3*s,isStart:n,seq:i};Vs(o,JSON.stringify(a))}catch(e){console.error("Error setting flow nonce:",e)}})(s,r,a,o,null!=i?i:a?void 0:d)},beforeRequest:e=>{if(e.path===Ca){const t=Oa(e);if(t){const n=((e,t=ya)=>{var n,r;return null!==(r=null===(n=Sa(e,t))||void 0===n?void 0:n.value)&&void 0!==r?r:null})(t,o);n&&(e.headers=e.headers||{},e.headers[ba]=n)}}return e}}));if(null===(r=a.flow)||void 0===r?void 0:r.next){let e=Promise.resolve();const t=a.flow.next.bind(a.flow);a.flow.next=async(...n)=>{const r=e;let i;e=new Promise((e=>{i=e})),await r;try{return await t(...n)}finally{i()}}}return a}),(e=>t=>{const n=e(Ds(t,{afterRequest:async(e,t)=>{if(Bs(e,t))return void Zs(Ta);const n=await Fs(t);(null==n?void 0:n.sessionExpiration)&&((e,t)=>{var n,r;try{Ps&&(null===(r=null===(n=window.localStorage)||void 0===n?void 0:n.setItem)||void 0===r||r.call(n,e,t))}catch(e){}})(Ta,String(n.sessionExpiration))}}));return no(n,["logout","logoutAll","oidc.logout"],Ma)}),(e=>n=>{var{autoRefresh:r}=n,i=t(n,["autoRefresh"]);const o=!!r,s="object"==typeof r&&(null==r?void 0:r.customActivityTracking);if(!o||qs())return Object.assign(e(i),{markUserActive:()=>{Xs("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:d}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let l,c,u=null,h=!1,f=!1;s&&(Ys("Activity-based refresh enabled"),u=(()=>{let e=!0;return{hadActivity:()=>e,reset:()=>{e=!1},markActive:()=>{e=!0}}})()),Ps&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&l&&new Date>l&&(Ys("Expiration time passed, refreshing session"),p.refresh(aa()||c))}));const p=e(Ds(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:r,sessionExpiration:i,nextRefreshSeconds:o}=await Fs(t);if(Bs(e,t))Ys("Session invalidated, canceling all timers"),a();else if(n||i){if(l=((e,t)=>{if(t)return new Date(1e3*t);Ys("Could not extract expiration time from session token, trying to decode the token");try{const t=ni(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,i),!l)return void Ys("Could not extract expiration time from session token");c=r,h=o>0;const e=((e,t)=>{let n;var r;return t>0?(n=1e3*t,Ys(`Using provided nextRefreshSeconds: ${t}s`)):n=((r=e)?r.getTime()-(new Date).getTime():0)-2e4,n>Ns&&(Ys(`Timeout is too large (${n}ms), setting it to ${Ns}ms`),n=Ns),n})(l,o);if(a(),e<=2e4)return void Ys("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Ys(`Setting refresh timer for ${t}. (${e}ms)`),u&&(u.reset(),f=!1),d((()=>{if(Ps&&"hidden"===document.visibilityState)Ys("Skipping refresh due to timer - document is hidden");else{if(u&&h&&!u.hadActivity())return Ys("Skipping refresh due to timer - user is idle"),void(f=!0);Ys("Refreshing session due to timer"),p.refresh(aa()||r)}}),e)}}}));return Object.assign(no(p,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return Ys("Clearing all timers"),a(),n})),{markUserActive:u?()=>{Ys("markUserActive() called"),h||Ys("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),f&&(Ys("User became active after skipped refresh, triggering refresh"),f=!1,a(),p.refresh(aa()||c))}:()=>{Xs("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})}),(e=>n=>{var{storeLastAuthenticatedUser:r=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=n,o=t(n,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!r)return Object.assign(e(o),{getLastUserLoginId:Na,getLastUserDisplayName:ja});const s=e(Ds(o,{afterRequest:async(e,t)=>{var n;const{userInfo:r,lastAuth:i}=await(async e=>{if(!(null==e?void 0:e.ok))return{userInfo:void 0,lastAuth:void 0};const t=await(null==e?void 0:e.clone().json()),n=Ws((null==t?void 0:t.authInfo)||t||{});return{userInfo:(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0),lastAuth:t.lastAuth}})(t),o=null===(n=null==r?void 0:r.loginIds)||void 0===n?void 0:n[0],s=null==r?void 0:r.name;o?(Pa(o),(e=>{Vs(Aa,e)})(s)):(null==i?void 0:i.loginId)&&Pa(i.loginId)}}));let a=no(s,["flow.start"],Ra);return a=no(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const r=await t(...n);return e||(Ks(Ea),Ks(Aa)),r})(i)),Object.assign(a,{getLastUserLoginId:Na,getLastUserDisplayName:ja})}),(e=>n=>{var{persistTokens:r,sessionTokenViaCookie:i,refreshTokenViaCookie:o,storagePrefix:s,refreshCookieName:a}=n,d=t(n,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!r||!Ps)return e(Object.assign({refreshCookieName:a},d));let l;const c=e(Ds(Object.assign({refreshCookieName:a},d),{beforeRequest:ua(s,o,a),afterRequest:async(e,t)=>{if(Bs(e,t))Ys("Session invalidated, clearing persisted tokens"),ca(s,i,o,l);else{const e=await Fs(t);e.cookieName?Vs(`${s||""}${na}`,e.cookieName):e.refreshJwt&&Ks(`${s||""}${na}`);const n=((e={},t=!1,n="",r=!1)=>{var i,o,s,a;const{sessionJwt:d,refreshJwt:l,trustedDeviceJwt:c}=e;let u;if(l)if(r){Ks(`${n}${ea}`);const t=r.sameSite||"Strict",s=null===(i=r.secure)||void 0===i||i,a=null!==(o=r.domain)&&void 0!==o?o:e.cookieDomain,d=sa(r);s&&"https:"!==window.location.protocol&&Xs("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const c=Object.assign(Object.assign({},e),{cookieSameSite:t,cookieSecure:s,cookieDomain:a});ra(d,l,c);const h=ia(a);u=Object.assign(Object.assign({},u),{refresh:{path:c.cookiePath,domain:h?a:void 0}})}else{const e=sa(r);ms.remove(e),Vs(`${n}${ea}`,l)}if(d)if(t){const n=t.sameSite||"Strict",r=null===(s=t.secure)||void 0===s||s,i=null!==(a=t.domain)&&void 0!==a?a:e.cookieDomain,o=oa(t);r&&"https:"!==window.location.protocol&&Xs("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const l=Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:r,cookieDomain:i});ra(o,d,l);const c=ia(i);u=Object.assign(Object.assign({},u),{session:{path:l.cookiePath,domain:c?i:void 0}})}else Vs(`${n}${Qs}`,d);return e.idToken&&Vs(`${n}${ta}`,e.idToken),c&&Vs(`${n}DTD`,c),u})(e,i,s,o);n&&(l=n)}}})),u=no(c,["logout","logoutAll","oidc.logout"],((e,t,n,r)=>i=>async(...o)=>{const s=await i(...o);return ca(e,t,n,null==r?void 0:r()),s})(s,i,o,(()=>l)));return Object.assign(u,{getRefreshToken:()=>aa(s,o),getSessionToken:()=>da(s,i),getIdToken:()=>la(s)})}))((e=>{const t=gs(e),n=td(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(r,i)=>{var o;if(qs())return Ys(`Refresh called in native flow: ${(new Error).stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(r),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}if(i&&Ps&&void 0!==window.localStorage&&!Js(Ta)&&!Gs(Ea)&&!Js("DSLI_DISABLED"))return Promise.resolve({ok:!0});const s=da(),a=aa();let d="";if(e.getExternalToken)try{d=await(null===(o=e.getExternalToken)||void 0===o?void 0:o.call(e))}catch(e){Ys("Error getting external token while refreshing",e)}return t.refresh(r,{dcs:s?"t":"f",dcr:a?"t":"f"},d,i)},logout:async r=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:r}),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:e.toString()}})}return t.logout(r)},flow:Xa(t),webauthn:Ka(t),fedcm:(r=t,i=e.projectId,{onetap:{requestExchangeCode(e){Za(r,e)},requestAuthentication(e){Za(r,e)}},async oneTap(e,t,n,i,o){await Ya(r,{provider:e,oneTapConfig:t,loginOptions:n,onSkipped:i,onDismissed:o})},async launch(e){var t;const n={identity:{context:e||"signin",providers:[{configURL:r.httpClient.buildUrl(i+za),clientId:i}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return r.refresh(o.token)},isSupported:()=>Ps&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=r.httpClient.buildUrl(i+za);try{const r={identity:{context:e||"signin",providers:[{configURL:n,clientId:i}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(r));return!!o&&!!o.token}catch(e){return!1}}}),oidc:n});var r,i})),rd={search:"/v1/mgmt/user/search",deleteBatch:"/v1/mgmt/user/delete/batch",create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/patch",status:"/v1/mgmt/user/update/status",setTempPassword:"/v1/mgmt/user/password/set/temporary",removePasskey:"/v1/mgmt/user/passkeys/delete",customAttributes:"/v1/mgmt/user/customattributes"},id={roles:"/v1/mgmt/role/all",subTenantRoles:"/v1/mgmt/role/subtenant/all"},od=e=>n(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),sd=e=>n(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const r=[],i=(new Date).getTime();for(let e=1;e<10;e+=1)r.push({loginIds:[`user${e}@company.com`],externalIds:[`user${e}@company.com`],userId:`user-${e}`,name:`User ${e}`,email:`user${e}@company.com`,roleNames:[`Role ${e}`],phone:`+1-202-555-010${e}`,recoveryEmail:`recovery${e}@company.com`,recoveryPhone:`+1-202-555-020${e}`,verifiedEmail:!0,verifiedPhone:!0,verifiedRecoveryEmail:!0,verifiedRecoveryPhone:!0,userTenants:[{tenantId:"sub-tenant-1",tenantName:"Hurray",roleNames:["Role 1","Role 2"]}],status:"enabled",editable:!0,createdTime:i,createdTimeFormatted:new Date(1e3*(i||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:e%3==0,OIDC:e%3==1,SCIM:e%3==2,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{r.sort(((t,n)=>((e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof t){const r=e?1:0,i=t?1:0;return n?r-i:i-r}const r=(null==e?void 0:e.toString())||"",i=(null==t?void 0:t.toString())||"";return n?i.localeCompare(r):r.localeCompare(i)})(t[e.field],n[e.field],e.desc)))})),n(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.phone.toLowerCase().includes(e.toLowerCase())||t.status.toLowerCase().includes(e.toLowerCase())||"active"===e.toLowerCase()||t.familyName.toLowerCase().includes(e.toLowerCase())||t.givenName.toLowerCase().includes(e.toLowerCase())||t.middleName.toLowerCase().includes(e.toLowerCase())||t.email.toLowerCase().includes(e.toLowerCase()))))}))})),ad=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:r,roles:i,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,userTenants:h}){return new Promise((f=>{const p=Math.random().toString(10).substring(15);f({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:r,roleNames:i,customAttributes:o,picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),dd=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:r,roles:i,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,userTenants:h}){return new Promise((f=>{f({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:r,roleNames:i,customAttributes:o||{},picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),ld=()=>n(void 0,void 0,void 0,(function*(){})),cd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),ud=()=>n(void 0,void 0,void 0,(function*(){})),hd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),fd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),pd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),gd=e=>new Promise((t=>{const n=[];for(let t=1;t<5;t+=1)n.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:n})})),vd=()=>new Promise((e=>{e({roles:[{tenantId:"sub-tenant-1",tenantName:"Sub Tenant 1",roleNames:["Role 1","Role 2"]},{tenantId:"sub-tenant-2",tenantName:"Sub Tenant 2",roleNames:["Role 1","Role 3"]},{tenantId:"sub-tenant-3",tenantName:"Sub Tenant 3",roleNames:["Role 2"]}]})})),md=({httpClient:e,tenant:t,mock:r})=>({search:(...i)=>n(void 0,[...i],void 0,(function*({page:n,limit:i=1e4,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:c}={}){if(r)return sd({page:n,limit:i,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:c});const u=yield e.post(rd.search,{limit:i,page:n,withTestUser:!1,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:c},{queryParams:{tenant:t}});yield od(u);return(yield u.json()).users})),deleteBatch:i=>n(void 0,void 0,void 0,(function*(){if(r)return ld();const n=yield e.post(rd.deleteBatch,{userIds:i},{queryParams:{tenant:t}});return yield od(n),n.json()})),create:i=>n(void 0,[i],void 0,(function*({loginId:n,email:i,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C}){if(r)return ad({loginId:n,email:i,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C});const k=yield e.post(rd.create,{loginId:n,email:i,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:C,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w},{queryParams:{tenant:t}});yield od(k);return(yield k.json()).user})),update:i=>n(void 0,[i],void 0,(function*({loginId:n,email:i,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$}){if(r)return dd({loginId:n,email:i,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$});const y=yield e.patch(rd.update,{loginId:n,email:i,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:$,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m},{queryParams:{tenant:t}});yield od(y);return(yield y.json()).user})),enable:i=>n(void 0,void 0,void 0,(function*(){if(r)return hd(i);const n=yield e.post(rd.status,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield od(n),n.json()})),disable:i=>n(void 0,void 0,void 0,(function*(){if(r)return fd(i);const n=yield e.post(rd.status,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield od(n),n.json()})),removePasskey:i=>n(void 0,void 0,void 0,(function*(){if(r)return ud();const n=yield e.post(rd.removePasskey,{loginId:i},{queryParams:{tenant:t}});return yield od(n),n.json()})),setTempPassword:i=>n(void 0,void 0,void 0,(function*(){if(r)return cd();const n=yield e.post(rd.setTempPassword,{loginId:i},{queryParams:{tenant:t}});return yield od(n),n.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(r)return pd();const n=yield e.get(rd.customAttributes,{queryParams:{tenant:t}});yield od(n);return(yield n.json()).data}))}),$d=({httpClient:e,tenant:t,mock:r})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(r)return gd(t);const n=yield e.get(id.roles,{queryParams:{tenant:t}});return yield od(n),n.json()})),getSubTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(r)return vd();const n=yield e.get(id.subTenantRoles,{queryParams:{tenant:t}});return yield od(n),n.json()}))}),yd=h((e=>{var t,s,a,d;const l=o(N,jn,A,C,j,Un,P({tenant:P.missingAttrValidator}))(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||Ce}get api(){return r(this,s,"f")||r(this,t,"m",a).call(this),r(this,s,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{r(this,s,"f")&&r(this,t,"m",a).call(this)}))}))}},s=new WeakMap,t=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,s,((e,t,n,r)=>{const i=nd(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":r,"x-descope-widget-version":"0.16.4"}}));return{user:md({httpClient:i.httpClient,tenant:t,mock:n}),tenant:$d({httpClient:i.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},d})),bd=h((e=>{const t=o(Pn({name:"widget",initialState:Qr,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{kr.reducer(e),Hr.reducer(e),Kr.reducer(e),Zr.reducer(e),Ir.reducer(e),Mr.reducer(e),Ar.reducer(e),Xr.reducer(e),jr.reducer(e),_r.reducer(e),Fr.reducer(e)},asyncActions:{searchUsers:Mr.action,createUser:kr.action,updateUser:Hr.action,enableUser:Kr.action,disableUser:Zr.action,deleteUsers:Ir.action,removePasskey:Xr.action,getCustomAttributes:jr.action,getTenantRoles:_r.action,getSubTenantRoles:Fr.action,setTempUserPassword:Ar.action}}),E,C,yd)(e);return class extends t{constructor(...e){super(...e),this.state=Qr,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),wd=h((e=>{var t,i,a;return a=class extends(o(C,E,G,X,Mn("user-management-widget"),bd,Rn)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return n(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.injectStyle(".hidden { display: none; }");const o=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([r(this,t,"m",i).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes(),o]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,i=function(){return n(this,void 0,void 0,(function*(){const e=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},a})),Cd=h((e=>{var t,a,d,l,c,u,h,f,p;return p=class extends(o(bd,ye,Nn,C,Rn,wd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,(()=>n(this,void 0,void 0,(function*(){yield r(this,a,"f").setData(Hn(this.state).map((({name:e})=>({value:e,label:e}))))})))),f.set(this,(()=>{var e;const t=Jn(this.state);null===(e=r(this,d,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&r(this,l,"f").setData(zn(this.state))}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",c).call(this)}))}},a=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,t=new WeakSet,c=function(){return n(this,void 0,void 0,(function*(){var e;this.createUserModal=this.createModal(),this.createUserModal.setContent(s(yield this.fetchWidgetPage("create-user-modal.html")));const o=new re((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}),c=()=>{this.resetFormData(this.createUserModal.ele),r(this,l,"f").value=[]};o.onClick((()=>{this.createUserModal.close(),c()}));const p=new re((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});p.onClick((()=>n(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele),t=r(this,l,"f").mergedValue;this.actions.createUser(Object.assign(Object.assign({},Wn(e,"customAttributes")),{userTenants:t,invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),c()}})))),i(this,a,new ge((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),i(this,d,null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-section"]'),"f"),i(this,l,new pe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),r(this,h,"f").call(this),this.createUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield r(this,h,"f").call(this),r(this,f,"f").call(this),r(this,t,"m",u).call(this)}))}))},u=function(){const e=Kn(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,r]=t.split(".");if("customAttributes"!==n)return;const i=e.find((e=>e.name===r));i?i.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},p})),kd=h((e=>{var t,i,s;return s=class extends(o(C,Cd,wd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",i).call(this)}))}},t=new WeakSet,i=function(){var e;this.createButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},s})),Sd=h((e=>{var t,i,a;return a=class extends(o(bd,ye,C,wd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",i).call(this)}))}},t=new WeakSet,i=function(){return n(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(s(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new re((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteUsersModal.close()));const n=new re((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=tr(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const r=new me(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=ur(this.state);r.text=`Delete ${e}?`}}))},a})),xd=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd,Sd)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),mr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.deleteButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-users"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteUsersModal.open()}))},a})),Id=h((e=>{var t,i,a,d,l;return l=class extends(o(bd,ye,C,Nn,wd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new re((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.disableUserModal.close()))},a=function(){new re((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=dr(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(s(yield this.fetchWidgetPage("disable-user-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new me(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ur(this.state);o.text=`Disable ${e}?`}))}))},l})),Od=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd,Id,Nn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),fr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.disableButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="disable-user"]'),{logger:this.logger}),this.disableButton.disable(),this.disableButton.onClick((()=>{this.disableUserModal.open()}))},a}));var Ed={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-35])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:[56]94\\d|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",[6,7,8,9,10,11]],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[25-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[0135-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","(?:596\\d|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","38\\d{6}|[78]\\d{9,13}|(?:20|9\\d)\\d{8}",[8,10,11,12,13,14],[["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["3"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|8\\d\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[468]))\\d{4}|(?:305[3-9]|472[24]|505[2-57-9]|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["305209\\d{4}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","7093\\d{5}|(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function Ad(e){return Ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ad(e)}function Pd(e){var t=Td();return function(){var n,r=Ud(e);if(t){var i=Ud(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Ad(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Nd(e)}(this,n)}}function Nd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jd(e){var t="function"==typeof Map?new Map:void 0;return jd=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Rd(e,arguments,Ud(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Md(r,e)},jd(e)}function Rd(e,t,n){return Rd=Td()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&Md(i,n.prototype),i},Rd.apply(null,arguments)}function Td(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Md(e,t){return Md=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Md(e,t)}function Ud(e){return Ud=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Ud(e)}var Ld=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Md(e,t)}(r,e);var t,n=Pd(r);function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),t=n.call(this,e),Object.setPrototypeOf(Nd(t),r.prototype),t.name=t.constructor.name,t}return t=r,Object.defineProperty(t,"prototype",{writable:!1}),t}(jd(Error)),_d=2,Wd=17,Dd=3,Fd="0-90-9٠-٩۰-۹",qd="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~"),Bd="++";function Hd(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),r=t[0].split("."),i=0;i<3;i++){var o=Number(n[i]),s=Number(r[i]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}var Vd={}.constructor;function Gd(e){return null!=e&&e.constructor===Vd}function Kd(e){return Kd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kd(e)}function zd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Zd=" ext. ",Yd=/^\d+$/,Xd=function(){function e(t){zd(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Gd(e)||!Gd(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Gd(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+il(e)+": "+e,"."))}(t),this.metadata=t,al.call(this,t)}return Jd(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&Yd.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Qd(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Qd(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var n=this.nonGeographic()[e];if(n)return n}else{var r=this.countryCallingCodes()[e];if(r&&1===r.length&&"001"===r[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),Qd=function(){function e(t,n){zd(this,e),this.globalMetadataObject=n,this.metadata=t,al.call(this,n.metadata)}return Jd(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this,t=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return t.map((function(t){return new el(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(e){if(this.hasTypes()&&rl(this.types(),e))return new nl(rl(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?Zd:this.metadata[13]||Zd}}]),e}(),el=function(){function e(t,n){zd(this,e),this._format=t,this.metadata=n}return Jd(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||tl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),tl=/^\(?\$1\)?$/,nl=function(){function e(t,n){zd(this,e),this.type=t,this.metadata=n}return Jd(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function rl(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var il=function(e){return Kd(e)};function ol(e,t){if((t=new Xd(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function sl(e,t){return t.countries.hasOwnProperty(e)}function al(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===Hd(t,"1.2.0")?this.v2=!0:-1===Hd(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var dl=function(e){return"([".concat(Fd,"]{1,").concat(e,"})")};function ll(e){var t="[  \\t,]*",n="[:\\..]?[  \\t,-]*",r="#?",i="[  \\t]*";return";ext="+dl("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+dl("20")+r)+"|"+(t+"(?:[xx##~~]|int|int)"+n+dl("9")+r)+"|"+("[- ]+"+dl("6")+"#")+"|"+(i+"(?:,{2}|;)"+n+dl("15")+r)+"|"+(i+"(?:,)+"+n+dl("9")+r)}var cl="["+Fd+"]{"+_d+"}",ul="[++]{0,1}(?:["+qd+"]*["+Fd+"]){3,}["+qd+Fd+"]*",hl=new RegExp("^[++]{0,1}(?:["+qd+"]*["+Fd+"]){1,2}$","i"),fl=ul+"(?:"+ll()+")?",pl=new RegExp("^"+cl+"$|^"+fl+"$","i");var gl=new RegExp("(?:"+ll()+")$","i");function vl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ml(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $l={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function yl(e){return $l[e]}function bl(e){for(var t,n="",r=vl(e.split(""));!(t=r()).done;){var i=yl(t.value);i&&(n+=i)}return n}function wl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Cl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cl(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Cl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kl(e){for(var t,n="",r=wl(e.split(""));!(t=r()).done;){n+=Sl(t.value,n)||""}return n}function Sl(e,t,n){if("+"===e){if(t)return;return"+"}return yl(e)}function xl(e,t){return function(e,t,n){var r=n.type(t),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=e.length,s=i[0];if(s===o)return"IS_POSSIBLE";if(s>o)return"TOO_SHORT";if(i[i.length-1]<o)return"TOO_LONG";return i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Il(e,t){return"IS_POSSIBLE"===xl(e,t)}function Ol(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function El(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Al(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Al(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Pl=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Nl(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Xd(n)).selectNumberingPlan(e.country,e.countryCallingCode);var r=t.v2?e.nationalNumber:e.phone;if(Ol(r,n.nationalNumberPattern())){if(jl(r,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?jl(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,o=El(Pl);!(i=o()).done;){var s=i.value;if(jl(r,s,n))return s}}}}function jl(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Ol(e,t.pattern()))}function Rl(e,t,n){var r=new Xd(n).getCountryCodesForCallingCode(e);return r?r.filter((function(e){return function(e,t,n){var r=new Xd(n);if(r.selectNumberingPlan(t),r.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function Tl(e){return e.replace(new RegExp("[".concat(qd,"]+"),"g")," ").trim()}var Ml=/(\$\d)/;function Ul(e,t,n){var r=n.useInternationalFormat,i=n.withNationalPrefix;n.carrierCode,n.metadata;var o=e.replace(new RegExp(t.pattern()),r?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(Ml,t.nationalPrefixFormattingRule()):t.format());return r?Tl(o):o}var Ll=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function _l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Wl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wl(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Wl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dl(Object(n),!0).forEach((function(t){ql(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bl={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function Hl(e,t,n,r){if(n=n?Fl(Fl({},Bl),n):Bl,r=new Xd(r),e.country&&"001"!==e.country){if(!r.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));r.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";r.selectNumberingPlan(e.countryCallingCode)}var i,o=r.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?Kl(i=Vl(s,e.carrierCode,"NATIONAL",r,n),e.ext,r,n.formatExtension):"";case"INTERNATIONAL":return s?(i=Vl(s,null,"INTERNATIONAL",r,n),Kl(i="+".concat(o," ").concat(i),e.ext,r,n.formatExtension)):"+".concat(o);case"E.164":return"+".concat(o).concat(s);case"RFC3966":return function(e){var t=e.number,n=e.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(n?";ext="+n:"")}({number:"+".concat(o).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,r,i){var o=ol(r,i.metadata);if(o===n){var s=Vl(e,t,"NATIONAL",i);return"1"===n?n+" "+s:s}var a=function(e,t,n){var r=new Xd(n);return r.selectNumberingPlan(e,t),r.defaultIDDPrefix()?r.defaultIDDPrefix():Ll.test(r.IDDPrefix())?r.IDDPrefix():void 0}(r,void 0,i.metadata);if(a)return"".concat(a," ").concat(n," ").concat(Vl(e,null,"INTERNATIONAL",i))}(s,e.carrierCode,o,n.fromCountry,r);return Kl(a,e.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function Vl(e,t,n,r,i){var o=Gl(r.formats(),e);return o?Ul(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:r}):e}function Gl(e,t){for(var n,r=_l(e);!(n=r()).done;){var i=n.value;if(i.leadingDigitsPatterns().length>0){var o=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(Ol(t,i.pattern()))return i}}function Kl(e,t,n,r){return t?r(e,t,n):e}function zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zl(Object(n),!0).forEach((function(t){Zl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Zl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yl(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Xl=function(){function e(t,n,r){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!n)throw new TypeError("`nationalNumber` not passed");if(!r)throw new TypeError("`metadata` not passed");var i=function(e,t){var n,r,i=new Xd(t);Ql(e)?(n=e,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=e;return{country:n,countryCallingCode:r}}(t,r),o=i.country,s=i.countryCallingCode;this.country=o,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return Yl(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Rl(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Xd(n),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!n.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}}if(n.possibleLengths())return Il(e.phone||e.nationalNumber,n);if(e.countryCallingCode&&n.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return function(e,t,n){return t=t||{},(n=new Xd(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Nl(e,t,n.metadata):Ol(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Xd(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Nl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Hl(this,e,t?Jl(Jl({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}]),e}(),Ql=function(e){return/^[A-Z]{2}$/.test(e)};var ec=new RegExp("(["+Fd+"])");function tc(e,t,n,r){if(t){var i=new Xd(r);i.selectNumberingPlan(t,n);var o=new RegExp(i.IDDPrefix());if(0===e.search(o)){var s=(e=e.slice(e.match(o)[0].length)).match(ec);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function nc(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(e);if(r){var i,o,s,a=r.length-1,d=a>0&&r[a];if(t.nationalPrefixTransformRule()&&d)i=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(o=r[1]);else{var l=r[0];i=e.slice(l.length),d&&(o=r[1])}if(d){var c=e.indexOf(r[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=r[0];return{nationalNumber:i,nationalPrefix:s,carrierCode:o}}}return{nationalNumber:e}}function rc(e,t){var n=nc(e,t),r=n.carrierCode,i=n.nationalNumber;if(i!==e){if(!function(e,t,n){if(Ol(e,n.nationalNumberPattern())&&!Ol(t,n.nationalNumberPattern()))return!1;return!0}(e,i,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(xl(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(i,t))return{nationalNumber:e}}return{nationalNumber:i,carrierCode:r}}function ic(e,t,n,r){var i=t?ol(t,r):n;if(0===e.indexOf(i)){(r=new Xd(r)).selectNumberingPlan(t,n);var o=e.slice(i.length),s=rc(o,r).nationalNumber,a=rc(e,r).nationalNumber;if(!Ol(a,r.nationalNumberPattern())&&Ol(s,r.nationalNumberPattern())||"TOO_LONG"===xl(a,r))return{countryCallingCode:i,number:o}}return{number:e}}function oc(e,t,n,r){if(!e)return{};var i;if("+"!==e[0]){var o=tc(e,t,n,r);if(!o||o===e){if(t||n){var s=ic(e,t,n,r),a=s.countryCallingCode,d=s.number;if(a)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:d}}return{number:e}}i=!0,e="+"+o}if("0"===e[1])return{};r=new Xd(r);for(var l=2;l-1<=Dd&&l<=e.length;){var c=e.slice(1,l);if(r.hasCallingCode(c))return r.selectNumberingPlan(c),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function sc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ac(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ac(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ac(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dc(e,t){var n=t.countries;t.defaultCountry;var r=t.metadata;r=new Xd(r);for(var i,o=sc(n);!(i=o()).done;){var s=i.value;if(r.country(s),r.leadingDigits()){if(e&&0===e.search(r.leadingDigits()))return s}else if(Nl({phone:e,country:s},void 0,r.metadata))return s}}function lc(e,t){var n=t.nationalNumber,r=t.defaultCountry,i=t.metadata,o=i.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:dc(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var cc="+",uc="(["+Fd+"]|[\\-\\.\\(\\)]?)",hc=new RegExp("^\\"+cc+uc+"*["+Fd+"]"+uc+"*$","g"),fc=new RegExp("^("+("["+Fd+"]+((\\-)*["+Fd+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Fd+"])*")+"\\.?$","g"),pc="tel:",gc=";phone-context=",vc=";isub=";function mc(e,t){var n,r=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf(gc);if(t<0)return null;var n=t+gc.length;if(n>=e.length)return"";var r=e.indexOf(";",n);return r>=0?e.substring(n,r):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(hc.test(e)||fc.test(e))}(i))throw new Ld("NOT_A_NUMBER");if(null===i)n=r(e)||"";else{n="",i.charAt(0)===cc&&(n+=i);var o,s=e.indexOf(pc);o=s>=0?s+pc.length:0;var a=e.indexOf(gc);n+=e.substring(o,a)}var d=n.indexOf(vc);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var $c=250,yc=new RegExp("[++"+Fd+"]"),bc=new RegExp("[^"+Fd+"#]+$");function wc(e,t,n){if(t=t||{},n=new Xd(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Ld("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var r=function(e,t,n){var r=mc(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>$c){if(n)throw new Ld("TOO_LONG");return}if(!1===t)return e;var r=e.search(yc);if(r<0)return;return e.slice(r).replace(bc,"")}(e,n,t)}});if(!r)return{};if(!function(e){return e.length>=_d&&pl.test(e)}(r))return function(e){return hl.test(e)}(r)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(gl);if(t<0)return{};for(var n=e.slice(0,t),r=e.match(gl),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}(r);if(i.ext)return i;return{number:r}}(e,t.v2,t.extract),i=r.number,o=r.ext,s=r.error;if(!i){if(t.v2){if("TOO_SHORT"===s)throw new Ld("TOO_SHORT");throw new Ld("NOT_A_NUMBER")}return{}}var a=function(e,t,n,r){var i,o=oc(kl(e),t,n,r.metadata),s=o.countryCallingCodeSource,a=o.countryCallingCode,d=o.number;if(a)r.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};r.selectNumberingPlan(t,n),t&&(i=t),a=n||ol(t,r.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=rc(kl(d),r),c=l.nationalNumber,u=l.carrierCode,h=lc(a,{nationalNumber:c,defaultCountry:t,metadata:r});h&&(i=h,"001"===h||r.country(i));return{country:i,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(i,t.defaultCountry,t.defaultCallingCode,n),d=a.country,l=a.nationalNumber,c=a.countryCallingCode,u=a.countryCallingCodeSource,h=a.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2)throw new Ld("INVALID_COUNTRY");return{}}if(!l||l.length<_d){if(t.v2)throw new Ld("TOO_SHORT");return{}}if(l.length>Wd){if(t.v2)throw new Ld("TOO_LONG");return{}}if(t.v2){var f=new Xl(c,l,n.metadata);return d&&(f.country=d),h&&(f.carrierCode=h),o&&(f.ext=o),f.__countryCallingCodeSource=u,f}var p=!!(t.extended?n.hasSelectedNumberingPlan():d)&&Ol(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!Il(l,n)),phone:l,ext:o}:p?function(e,t,n){var r={country:e,phone:t};n&&(r.ext=n);return r}(d,l,o):{}}function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cc(Object(n),!0).forEach((function(t){Sc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ic(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ec(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ec(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ac(e){var t,n,r,i=Oc(Array.prototype.slice.call(e),4),o=i[0],s=i[1],a=i[2],d=i[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,s&&"string"!=typeof s){if(!Gd(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,r=a):r=s}else d?(n=a,r=d):(n=void 0,r=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xc(Object(n),!0).forEach((function(t){Ic(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:r}}function Pc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pc(Object(n),!0).forEach((function(t){jc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rc(e,t,n){t&&t.defaultCountry&&!sl(t.defaultCountry,n)&&(t=Nc(Nc({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return wc(e,kc(kc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Ld))throw e}}function Tc(){var e=Ac(arguments);return Rc(e.text,e.options,e.metadata)}function Mc(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Lc=Mc((function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;Uc(this,e),this.key=t,this.value=n,this.next=r,this.prev=i})),_c=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Uc(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return Mc(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Lc(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Lc(e,t);this.cache[e]=this.head,this.size++}},{key:"get",value:function(e){if(this.cache[e]){var t=this.cache[e].value;return this.remove(e),this.put(e,t),t}console.log("Item not available in cache for key ".concat(e))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(e){var t=this.cache[e];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[e],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),e}();function Wc(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Dc=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new _c(t)}return Wc(e,[{key:"getPatternForRegExp",value:function(e){var t=this.cache.get(e);return t||(t=new RegExp("^"+e),this.cache.put(e,t)),t}}]),e}();function Fc(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function qc(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var Bc="   ᠎ - \u2028\u2029   ",Hc="[".concat(Bc,"]"),Vc="[^".concat(Bc,"]"),Gc="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),Kc="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",zc="[".concat(Kc,"]"),Jc=new RegExp(zc),Zc="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),Yc=new RegExp(Zc),Xc="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),Qc=new RegExp(Xc),eu=new RegExp("[\0-€-ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function tu(e){return!(!Jc.test(e)&&!Qc.test(e))&&eu.test(e)}function nu(e){return"%"===e||Yc.test(e)}function ru(e,t,n){var r=!0,i=Tc(e,n);if(i||(r=!1,i=Tc(e,{defaultCallingCode:t.countryCallingCode},n)),!i)return"INVALID_NUMBER";if(t.ext){if(i.ext!==t.ext)return"NO_MATCH"}else if(i.ext)return"NO_MATCH";return r&&t.countryCallingCode!==i.countryCallingCode?"NO_MATCH":t.number===i.number?r?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(i.nationalNumber)||0===i.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var iu={POSSIBLE:function(e,t){return t.candidate,t.metadata,!0},VALID:function(e,t){var n=t.candidate;t.defaultCountry;var r=t.metadata;return!(!e.isValid()||!ou(e,n,r))},STRICT_GROUPING:function(e,t){var n=t.candidate,r=t.defaultCountry,i=t.metadata;return t.regExpCache,!(!e.isValid()||!ou(e,n,i)||au(e,n)||!su(e,{defaultCountry:r,metadata:i}))&&du()},EXACT_GROUPING:function(e,t){var n=t.candidate,r=t.defaultCountry,i=t.metadata;return t.regExpCache,!(!e.isValid()||!ou(e,n,i)||au(e,n)||!su(e,{defaultCountry:r,metadata:i}))&&du()}};function ou(e,t,n){for(var r=0;r<t.length-1;r++){var i=t.charAt(r);if("x"===i||"X"===i){var o=t.charAt(r+1);if("x"===o||"X"===o){if(r++,"NSN_MATCH"!==ru(t.substring(r),e,n))return!1}else{var s=bl(t.substring(r));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function su(e,t){var n=t.defaultCountry,r=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var i=new Xd(r);i.selectNumberingPlan(e.countryCallingCode),e.country||lc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:i});var o=e.nationalNumber,s=Gl(i.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!i.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function au(e,t){var n=t.indexOf("/");if(n<0)return!1;var r=t.indexOf("/",n+1);return!(r<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===e.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===e.__countryCallingCodeSource)||bl(t.substring(0,n))!==e.countryCallingCode||t.slice(r+1).indexOf("/")>=0)}function du(e,t,n,r,i){throw new Error("This part of code hasn't been ported")}var lu=/[\\/] *x/;function cu(e){return qc(lu,e)}var uu=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,hu=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,fu=/^:[0-5]\d/;function pu(e,t,n){if(uu.test(e))return!1;if(hu.test(e)){var r=n.slice(t+e.length);if(fu.test(r))return!1}return!0}var gu="(\\[([",vu=")\\])]",mu="[^".concat(gu).concat(vu,"]"),$u="[".concat(gu).concat(Bd,"]"),yu=new RegExp("^"+$u),bu=Fc(0,3),wu=new RegExp("^(?:[(\\[([])?(?:"+mu+"+["+vu+"])?"+mu+"+(?:["+gu+"]"+mu+"+["+vu+"])"+bu+mu+"*$"),Cu=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function ku(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Su(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Su(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Su(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Iu=ll(),Ou=["\\/+(.*)/","(\\([^(]*)","(?:".concat(Hc,"-|-").concat(Hc,")").concat(Hc,"*(.+)"),"[‒-―-]".concat(Hc,"*(.+)"),"\\.+".concat(Hc,"*([^.]+)"),"".concat(Hc,"+(").concat(Vc,"+)")],Eu=Fc(0,2),Au=Fc(0,4),Pu=Wd+Dd,Nu=Fc(0,Pu),ju="[".concat(qd,"]")+Au,Ru=Gc+Fc(1,Pu),Tu="(?:"+$u+ju+")"+Eu+Ru+"(?:"+ju+Ru+")"+Nu+"(?:"+Iu+")?",Mu=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(Kc,"#]+$")),Uu=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Lu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(n={v2:n.v2,defaultCallingCode:n.defaultCallingCode,defaultCountry:n.defaultCountry&&sl(n.defaultCountry,r)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Uu}).leniency)throw new TypeError("`leniency` is required");if("POSSIBLE"!==n.leniency&&"VALID"!==n.leniency)throw new TypeError('Invalid `leniency`: "'.concat(n.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(n.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");if(this.text=t,this.options=n,this.metadata=r,this.leniency=iu[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(Tu,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new Dc(32)}return xu(e,[{key:"find",value:function(){for(var e;this.maxTries>0&&null!==(e=this.PATTERN.exec(this.text));){var t=e[0],n=e.index;if(pu(t=cu(t),n,this.text)){var r=this.parseAndVerify(t,n,this.text)||this.extractInnerMatch(t,n,this.text);if(r){if(this.options.v2)return{startsAt:r.startsAt,endsAt:r.endsAt,number:r.phoneNumber};var i=r.phoneNumber,o={startsAt:r.startsAt,endsAt:r.endsAt,phone:i.nationalNumber};return i.country?o.country=i.country:o.countryCallingCode=i.countryCallingCode,i.ext&&(o.ext=i.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,n){for(var r,i=ku(Ou);!(r=i()).done;)for(var o=r.value,s=!0,a=void 0,d=new RegExp(o,"g");this.maxTries>0&&null!==(a=d.exec(e));){if(s){var l=qc(Mu,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=qc(Mu,a[1]),h=e.indexOf(u,a.index),f=this.parseAndVerify(u,t+h,n);if(f)return f;this.maxTries--}}},{key:"parseAndVerify",value:function(e,t,n){if(function(e,t,n,r){if(wu.test(e)&&!Cu.test(e)){if("POSSIBLE"!==r){if(t>0&&!yu.test(e)){var i=n[t-1];if(nu(i)||tu(i))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(nu(s)||tu(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var r=Tc(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(r&&r.isPossible())return this.leniency(r,{candidate:e,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+e.length,phoneNumber:r}:void 0}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var e=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",e}}]),e}();function _u(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Wu=function(){function e(t){var n=t.onCountryChange,r=t.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.onCountryChange=n,this.onCallingCodeChange=r}return _u(e,[{key:"reset",value:function(e){var t=e.country,n=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];this[r]=e[r]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}]),e}();function Du(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Fu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fu(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Fu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qu="x",Bu=new RegExp(qu);function Hu(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function Vu(e,t){return")"===e[t]&&t++,function(e){var t=[],n=0;for(;n<e.length;)"("===e[n]?t.push(n):")"===e[n]&&t.pop(),n++;var r=0,i="";t.push(e.length);for(var o=0,s=t;o<s.length;o++){var a=s[o];i+=e.slice(r,a),r=a+1}return i}(e.slice(0,t))}function Gu(e,t,n){var r=n.metadata,i=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,n){var r=n.metadata,i=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var s=Ku(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:r});if(s)return s}return Ku(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:r})}(e,t,{metadata:r,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:o})}function Ku(e,t,n){var r=n.metadata,i=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Ul(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:r});if(i||(e.nationalPrefix?s=e.nationalPrefix+o(t)+s:e.complexPrefixBeforeNationalSignificantNumber&&(s=e.complexPrefixBeforeNationalSignificantNumber+" "+s)),function(e,t){return bl(e)===t.getNationalDigits()}(s,e))return s}function zu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ju=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return zu(e,[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],n=t.branches,r=t.instructions;if(n)return{op:"|",args:n.concat([Qu(r)])};if(0===r.length)throw new Error("Pattern is required");return 1===r.length?r[0]:r}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw new Error("Pattern is required");var t=e.match(Xu);if(t){var n=t[1],r=e.slice(0,t.index),i=e.slice(t.index+n.length);switch(n){case"(?:":r&&this.parsePattern(r),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(r&&this.parsePattern(r),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(Qu(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:o});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(r&&this.parsePattern(r),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(Qu(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":r&&this.parsePattern(r),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:Zu(r)});break;default:throw new Error("Unknown operator: ".concat(n))}i&&this.parsePattern(i)}else{if(Yu.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function Zu(e){for(var t=[],n=0;n<e.length;){if("-"===e[n]){if(0===n||n===e.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(e));for(var r=e[n-1].charCodeAt(0)+1,i=e[n+1].charCodeAt(0)-1,o=r;o<=i;)t.push(String.fromCharCode(o)),o++}else t.push(e[n]);n++}return t}var Yu=/[\(\)\[\]\?\:\|]/,Xu=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Qu(e){return 1===e.length?e[0]:e}function eh(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return th(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return th(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function th(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function nh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var rh=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matchTree=(new Ju).parse(t)}return nh(e,[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw new Error("String is required");var n=ih(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function ih(e,t,n){if("string"==typeof t){var r=e.join("");return 0===t.indexOf(r)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===r.indexOf(t)?n&&e.length>t.length?{overflow:!0}:{match:!0,matchedChars:e.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var i=e.slice(),o=0;o<t.length;){var s=ih(i,t[o],n&&o===t.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(i=i.slice(s.matchedChars.length)).length)return o===t.length-1?{match:!0,matchedChars:e}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:e.slice(0,e.length-i.length)}}switch(t.op){case"|":for(var a,d,l=eh(t.args);!(d=l()).done;){var c=ih(e,d.value,n);if(c){if(c.overflow)return c;if(c.match)return{match:!0,matchedChars:c.matchedChars};if(!c.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)));a=!0}}return a?{partialMatch:!0}:void 0;case"[]":for(var u,h=eh(t.args);!(u=h()).done;){var f=u.value;if(e[0]===f)return 1===e.length?{match:!0,matchedChars:e}:n?{overflow:!0}:{match:!0,matchedChars:[f]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function oh(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return sh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sh(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function sh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ah(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var dh=Hu("9",15),lh=/[- ]/,ch=new RegExp("["+qd+"]*\\$1["+qd+"]*(\\$\\d["+qd+"]*)*$"),uh=function(){function e(t){t.state;var n=t.metadata;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=n,this.resetFormat()}return ah(e,[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var n=this;if(function(e,t){return"IS_POSSIBLE"===xl(e,t)}(t.nationalSignificantNumber,this.metadata))for(var r,i=oh(this.matchingFormats);!(r=i()).done;){var o=r.value,s=Gu(t,o,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return n.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return n.getSeparatorAfterNationalPrefix(e)}});if(s)return this.resetFormat(),this.chosenFormat=o,this.setNationalNumberTemplate(s.replace(/\d/g,qu),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(qu),s}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var n=this.chosenFormat,r=this.chooseFormat(t);if(r)return r===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,n=e.nationalSignificantNumber,r=e.nationalPrefix,i=e.international,o=n,s=o.length-3;s<0&&(s=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,i,r)&&t.formatMatches(e,o,s)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,n){return!(n&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat())&&!(!t&&!n&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,n){var r=e.leadingDigitsPatterns().length;if(0===r)return!0;n=Math.min(n,r-1);var i=e.leadingDigitsPatterns()[n];if(t.length<3)try{return void 0!==new rh(i).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(i,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,n=this,r=function(){var r=t.value;return n.chosenFormat===r?"break":ch.test(n.getFormatFormat(r,e.international))?n.createTemplateForFormat(r,e)?(n.chosenFormat=r,"break"):(n.matchingFormats=n.matchingFormats.filter((function(e){return e!==r})),"continue"):"continue"},i=oh(this.matchingFormats.slice());!(t=i()).done;){var o=r();if("break"===o)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var n=this.getTemplateForFormat(e,t);return n?(this.setNationalNumberTemplate(n,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&lh.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var n=e.IDDPrefix,r=e.missingPlus;return n?t&&!1===t.spacing?n:n+" ":r?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,n=0,r=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";n<r.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(qu,t+1),n++;return Vu(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,qu)+Hu(qu,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var n=t.nationalSignificantNumber,r=t.international,i=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,s=e.pattern();s=s.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var a=dh.match(s)[0];if(!(n.length>a.length)){var d=new RegExp("^"+s+"$"),l=n.replace(/\d/g,"9");d.test(l)&&(a=l);var c,u=this.getFormatFormat(e,r);if(this.shouldTryNationalPrefixFormattingRule(e,{international:r,nationalPrefix:i})){var h=u.replace(Ml,e.nationalPrefixFormattingRule());if(bl(e.nationalPrefixFormattingRule())===(i||"")+bl("$1")&&(u=h,c=!0,i))for(var f=i.length;f>0;)u=u.replace(/\d/,qu),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),qu);return c||(o?p=Hu(qu,o.length)+" "+p:i&&(p=Hu(qu,i.length)+this.getSeparatorAfterNationalPrefix(e)+p)),r&&(p=Tl(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var r,i=Du(n.split(""));!(r=i()).done;){var o=r.value;if(e.slice(t+1).search(Bu)<0)return;t=e.search(Bu),e=e.replace(Bu,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Vu(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var n=t.international,r=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&r||!i&&!n)return!0}}}]),e}();function hh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ph(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var gh=new RegExp("^"+("["+qd+Fd+"]+")+"$","i"),vh="(?:[++]["+qd+Fd+"]*|["+qd+Fd+"]+)",mh=new RegExp("[^"+qd+Fd+"]+.*$"),$h=/[^\d\[\]]/,yh=function(){function e(t){var n=t.defaultCountry,r=t.defaultCallingCode,i=t.metadata,o=t.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaultCountry=n,this.defaultCallingCode=r,this.metadata=i,this.onNationalSignificantNumberChange=o}return ph(e,[{key:"input",value:function(e,t){var n,r=function(e){var t=function(e){var t=function(e){var t,n=e.search(vh);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(mh,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=hh(t,2),r=n[0],i=n[1];gh.test(r)||(r="");return[r,i]}(e),i=hh(r,2),o=i[0],s=i[1],a=bl(o);return s&&(t.digits||(t.startInternationalNumber(),a||(n=!0))),a&&this.inputDigits(a,t),{digits:a,justLeadingPlus:n}}},{key:"inputDigits",value:function(e,t){var n=t.digits,r=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),r&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,n=e.callingCode;return t&&!n}},{key:"extractCountryCallingCode",value:function(e){var t=oc("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode,r=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:r}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&$h.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=nc(e,this.metadata),r=n.nationalPrefix,i=n.nationalNumber,o=n.carrierCode;if(i!==e)return this.onExtractedNationalNumber(r,o,i,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var r=nc(e,this.metadata),i=r.nationalPrefix,o=r.nationalNumber,s=r.carrierCode;if(o!==t)return this.onExtractedNationalNumber(i,s,o,e,n),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,n,r,i){var o,s,a=r.lastIndexOf(n);if(a>=0&&a===r.length-n.length){s=!0;var d=r.slice(0,a);d!==e&&(o=d)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:n,nationalSignificantNumberMatchesInput:s,complexPrefixBeforeNationalSignificantNumber:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,n=e.IDDPrefix,r=e.digits;if(e.nationalSignificantNumber,!t&&!n){var i=tc(r,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==i&&i!==r?(e.update({IDDPrefix:r.slice(0,r.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=ic(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode;if(t.number,n)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:n}),!0}}},{key:"startInternationalNumber",value:function(e,t){var n=t.country,r=t.callingCode;e.startInternationalNumber(n,r),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}]),e}();function bh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return wh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ch(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var kh=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new Xd(n);var r=bh(this.getCountryAndCallingCode(t),2),i=r[0],o=r[1];this.defaultCountry=i,this.defaultCallingCode=o,this.reset()}return Ch(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(Gd(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,n]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput="+";else if(n){var r;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(r=this.formatter.format(n,this.state)),void 0===r&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(r=this.formatter.format(i,this.state))}this.formattedOutput=r?this.getFullNumber(r):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Wu({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new uh({state:this.state,metadata:this.metadata}),this.parser=new yh({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},r=this.state.callingCode;return n(r?e?"".concat(r," ").concat(e):r:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.complexPrefixBeforeNationalSignificantNumber,r=e.nationalPrefix,i=t,o=n||r;return o&&(i=o+i),i}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,qu)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(lc(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,n=e.callingCode,r=e.country,i=e.nationalSignificantNumber;if(t)return this.isInternational()?n?"+"+n+i:"+"+t:r||n?"+"+(r?this.metadata.countryCallingCode():n)+i:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,r=e.callingCode,i=this._getCountry();if(t&&(i||r)){if(i&&i===this.defaultCountry){var o=new Xd(this.metadata.metadata);o.selectNumberingPlan(i);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=dc(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(i=d)}}var l=new Xl(i||r,t,this.metadata.metadata);return n&&(l.carrierCode=n),l}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function Sh(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Ed),e.apply(this,n)}(Tc,arguments)}function xh(e,t){return Lu.call(this,e,t,Ed)}function Ih(e){return kh.call(this,e,Ed)}function Oh(){return Xd.call(this,Ed)}xh.prototype=Object.create(Lu.prototype,{}),xh.prototype.constructor=xh,Ih.prototype=Object.create(kh.prototype,{}),Ih.prototype.constructor=Ih,Oh.prototype=Object.create(Xd.prototype,{}),Oh.prototype.constructor=Oh;const Eh=e=>{if(!e)return e;const t=Sh(e.startsWith("+")?e:`+${e}`);if(!t)return e;const n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return(null==t?void 0:t.number.replace(n,"$1-$2"))||e},Ah=h((e=>{var a,d,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(bd,ye,C,Nn,Rn,wd)(e)){constructor(){super(...arguments),a.add(this),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),u.set(this,void 0),p.set(this,(()=>n(this,void 0,void 0,(function*(){yield r(this,l,"f").setData(Hn(this.state).map((({name:e})=>({value:e,label:e}))))})))),g.set(this,(()=>{var e;const t=Jn(this.state);null===(e=r(this,c,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&r(this,u,"f").setData(zn(this.state))})),m.set(this,(()=>{var e,t;const n=null===(e=er(this.state))||void 0===e?void 0:e[0],i=Object.assign({loginId:null===(t=null==n?void 0:n.loginIds)||void 0===t?void 0:t.join(", "),displayName:null==n?void 0:n.name,email:null==n?void 0:n.email,phone:Eh(null==n?void 0:n.phone),recoveryEmail:null==n?void 0:n.recoveryEmail,recoveryPhone:Eh(null==n?void 0:n.recoveryPhone),roles:null==n?void 0:n.roleNames,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},Dn(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i),r(this,u,"f").value=(null==n?void 0:n.userTenants)||[]}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),yield r(this,a,"m",$).call(this)}))}},d=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,a=new WeakSet,h=function(){new re((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editUserModal.close()))},f=function(){new re((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{if(this.validateForm(this.editUserModal.ele)){const e=this.getFormData(this.editUserModal.ele),{loginId:n}=e,i=t(e,["loginId"]),o=r(this,c,"f")&&!r(this,c,"f").classList.contains("hidden")?r(this,u,"f").mergedValue:void 0;this.actions.updateUser(Object.assign(Object.assign({loginId:n.split(", ")[0]},Wn(i,"customAttributes")),void 0!==o&&{userTenants:o})),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},v=function(){const e=Kn(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,r]=t.split(".");if("customAttributes"!==n)return;const i=e.find((e=>e.name===r));i?i.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},$=function(){return n(this,void 0,void 0,(function*(){var e,t;this.editUserModal=this.createModal(),this.editUserModal.setContent(s(yield this.fetchWidgetPage("edit-user-modal.html"))),r(this,a,"m",h).call(this),r(this,a,"m",f).call(this),i(this,d,new $e(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),i(this,l,new ge((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),i(this,c,null===(t=this.editUserModal.ele)||void 0===t?void 0:t.querySelector('[data-id="sub-tenant-section"]'),"f"),i(this,u,new pe((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield r(this,p,"f").call(this),r(this,d,"f").disable(),r(this,g,"f").call(this),r(this,m,"f").call(this),r(this,a,"m",v).call(this)}))}))},y})),Ph=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd,Ah,Nn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),pr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.editButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-user"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editUserModal.open()}))},a})),Nh=h((e=>{var t,i,a,d,l;return l=class extends(o(bd,ye,C,Nn,wd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new re((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.enableUserModal.close()))},a=function(){new re((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=dr(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(s(yield this.fetchWidgetPage("enable-user-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new me(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ur(this.state);o.text=`Activate ${e}?`}))}))},l})),jh=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd,Nh,Nn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),hr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.enableButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="enable-user"]'),{logger:this.logger}),this.enableButton.disable(),this.enableButton.onClick((()=>{this.enableUserModal.open()}))},a})),Rh=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,c((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",s).call(this)}))}},i=new WeakMap,t=new WeakSet,s=function(){var e;this.searchInput=new $e(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(r(this,i,"f"))},a}));const Th={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},Mh=h((e=>{var t,i,s,a,l;return l=class extends(o(C,bd,we,E)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{e.length&&(e.forEach((({type:e,msg:n})=>{const o=r(this,t,"m",s).call(this,e);o.setContent(r(this,t,"m",i).call(this,{type:e,msg:n})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(r(this,a,"f").bind(this),Gn)}))}},a=new WeakMap,t=new WeakSet,i=function({type:e,msg:t}){const n=Th[e],r=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${r.outerHTML}`},s=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},l})),Uh=h((e=>{var t,i,a,d,l;return l=class extends(o(bd,ye,C,Nn,wd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new re((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.removePasskeyModal.close()))},a=function(){new re((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=dr(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(s(yield this.fetchWidgetPage("remove-passkey-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new me(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ur(this.state);o.text=`Remove passkey for ${e}?`}))}))},l})),Lh=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd,Uh,Nn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),gr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.removePasskeyButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="remove-passkey"]'),{logger:this.logger}),this.removePasskeyButton.disable(),this.removePasskeyButton.onClick((()=>{this.removePasskeyModal.open()}))},a})),_h=h((e=>{var t,i,s,a,l,u,h,f;return f=class extends(o(bd,C,wd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{this.usersTable.data=e}))),l.set(this,c(((e,t)=>{const n=[],{value:r}=t;if(r){const t=e.path;n.push({field:t,desc:"desc"===r})}this.actions.searchUsers({sort:n})}))),u.set(this,d((e=>{this.usersTable.filterColumns((t=>{var n;const[r,i]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==r||!!(null==e?void 0:e.find((e=>e.name===i)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",s).call(this),r(this,a,"f").call(this,Qn(this.state)),r(this,u,"f").call(this,Kn(this.state)),this.subscribe(r(this,u,"f").bind(this),Kn),this.subscribe(r(this,a,"f").bind(this),Qn)}))}},a=new WeakMap,l=new WeakMap,u=new WeakMap,t=new WeakSet,i=function(){const e=e=>{var t;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(`[path="${e}"]`)},t=e=>{var t;const n=`descope-grid-${e}-column`;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(n)},n=this.usersTable.renderColumn;this.usersTable.renderColumn=({path:r,header:i,type:o,attrs:s})=>{const a=e(r)||t(o);if(!a)return n({path:r,header:i,type:o,attrs:s});const d=a.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:i});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},s=function(){var e;this.usersTable=new de(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="users-table"]'),{logger:this.logger}),this.usersTable.onSelectedItemsChange((e=>{this.actions.setSelectedUsersIds(e.detail.value.map((({loginIds:e})=>e)))})),this.usersTable.onColumnsChange(r(this,t,"m",h).bind(this)),r(this,t,"m",i).call(this),r(this,t,"m",h).call(this)},h=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{r(this,l,"f").call(this,e.target,e.detail)}))}))},f})),Wh=h((e=>{var t,i,a;return a=class extends(o(bd,ye,C,Nn,wd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",i).call(this)}))}},t=new WeakSet,i=function(){return n(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(s(yield this.fetchWidgetPage("generated-password-modal.html")));new re((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.generatedPasswordModal.ele)["generated-password"]),this.resetFormData(this.generatedPasswordModal.ele),this.generatedPasswordModal.close()}))}))},a})),Dh=h((e=>{var t,i,a,d,l;return l=class extends(o(bd,ye,C,Nn,wd,Wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new re((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.resetPasswordModal.close()))},a=function(){new re((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){var e;const t=dr(this.state),n=yield this.actions.setTempUserPassword(t);this.resetPasswordModal.close(),this.setFormData(this.generatedPasswordModal.ele,{"generated-password":null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext}),this.generatedPasswordModal.open()}))))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(s(yield this.fetchWidgetPage("reset-password-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new me(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=ur(this.state);o.text=`This will generate a new temporary password for ${e}?`}))}))},l})),Fh=h((e=>{var t,i,s,a;return a=class extends(o(C,wd,bd,Dh,Nn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),vr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.resetPasswordButton=new re(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="reset-password"]'),{logger:this.logger}),this.resetPasswordButton.disable(),this.resetPasswordButton.onClick((()=>{this.resetPasswordModal.open()}))},a})),qh=h((e=>class extends(o(Ee,A)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),Bh=h((e=>{var t,s,a,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(Tn,qh,bd,ye,C,Nn,wd,Ln)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.set(this,void 0),l.set(this,[]),c.set(this,null),u.set(this,null),$.set(this,d((e=>{r(this,l,"f").forEach((t=>{"onlyOne"===t.enableMode&&1===e.length||"oneOrMore"===t.enableMode&&e.length>0||"always"===t.enableMode?t.enable():t.disable()}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",p).call(this),r(this,t,"m",f).call(this),r(this,$,"f").call(this,Vn(this.state))}))}},s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,$=new WeakMap,t=new WeakSet,h=function(e){const n=new oe(e,{logger:this.logger});n.onClick((()=>{r(this,t,"m",m).call(this,n.flowId)})),this.subscribe(r(this,$,"f").bind(this),Vn),r(this,l,"f").push(n)},f=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{r(this,t,"m",h).call(this,e)}))},p=function(){i(this,s,this.createModal({"data-id":"generic-flow-modal"}),"f"),r(this,s,"f").afterClose=()=>{var e;r(this,c,"f")&&(null===(e=r(this,u,"f"))||void 0===e||e.call(this),i(this,c,null,"f"))},i(this,a,new ie((()=>{var e;return null===(e=r(this,s,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(r(this,a,"f"))},g=function(){var e;r(this,s,"f").open(),null===(e=r(this,u,"f"))||void 0===e||e.call(this)},v=function(e,n){n=()=>r(this,t,"m",g).call(this),i(this,u,r(this,a,"f").onPageUpdated(n),"f")},m=function(e){r(this,s,"f").setContent(this.createFlowTemplate({flowId:e,client:{userIds:tr(this.state),loginIds:nr(this.state),usersAndRoles:rr(this.state)},tenant:this.tenantId})),r(this,t,"m",v).call(this,r(this,s,"f"),r(this,c,"f")),r(this,a,"f").onSuccess((()=>{r(this,s,"f").close(),this.actions.searchUsers()}))},y})),Hh="widget-flow",Vh=h((e=>{var t,i,s;return s=class extends(o(Tn,E,ye,bd,Un,C,Ee,Ln)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this);const o=qn(Hh);o&&(!function(e){if(window.history.replaceState&&qn(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}(Hh),r(this,t,"m",i).call(this,o))}))}},t=new WeakSet,i=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(this.createFlowTemplate({flowId:e}));new ie((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close()})),t.afterClose=()=>{t.remove()},t.open()},s})),Gh=h((e=>class extends(o(_,Ee,Vh,_h,kd,xd,Ph,jh,Od,Fh,Lh,Rh,Mh,Bh)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Kh=o((e=>class extends(Gh(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield Promise.resolve().then((function(){return Nv})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.16.4"}}}))}}))(HTMLElement);customElements.define("descope-user-management-widget",Kh);const zh=(e,t,n,r={})=>{var i,o,s,a;return[Math.min(Math.max(t,("all"===r.left?e.offsetWidth:null!==(i=r.left)&&void 0!==i?i:0)-e.offsetWidth),window.innerWidth-("all"===r.right?e.offsetWidth:null!==(o=r.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===r.top?e.offsetHeight:null!==(s=r.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===r.bottom?e.offsetHeight:null!==(a=r.bottom)&&void 0!==a?a:0))]};var Jh,Zh,Yh,Xh,Qh,ef,tf,nf,rf,of;const sf=document.createElement("template");sf.innerHTML='\n<div class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n';const af=o(J)(HTMLElement);class df extends af{constructor(){var e;super(),Jh.add(this),Zh.set(this,new $({messages:[]})),Yh.set(this,void 0),Xh.set(this,void 0),Qh.set(this,void 0),ef.set(this,{resize:r(this,Jh,"m",of).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sf.content.cloneNode(!0)),this.injectStyle('\n.debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),i(this,Yh,this.shadowRoot.querySelector(".debugger"),"f"),r(this,Yh,"f").style.top="32px",r(this,Yh,"f").style.left=window.innerWidth-300-32+"px",i(this,Xh,r(this,Yh,"f").querySelector(".content"),"f"),i(this,Qh,r(this,Yh,"f").querySelector(".header"),"f")}updateData(e){r(this,Zh,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let r=0,i=0,o=0,s=0;function a(t){t.preventDefault(),r=o-t.clientX,i=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=zh(e,e.offsetLeft-r,e.offsetTop-i,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(r(this,Yh,"f"),r(this,Qh,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",r(this,ef,"f").resize),(e=r(this,Yh,"f")).onmousemove=t=>{var n;const r=t.target;(r.w&&r.w!==r.offsetWidth||r.h&&r.h!==r.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),r.w=r.offsetWidth,r.h=r.offsetHeight},r(this,Yh,"f").onresize=r(this,Jh,"m",rf).bind(this),r(this,Zh,"f").subscribe(r(this,Jh,"m",tf).bind(this))}disconnectedCallback(){r(this,Zh,"f").unsubscribeAll(),window.removeEventListener("resize",r(this,ef,"f").resize)}}Zh=new WeakMap,Yh=new WeakMap,Xh=new WeakMap,Qh=new WeakMap,ef=new WeakMap,Jh=new WeakSet,tf=function(e){r(this,Jh,"m",nf).call(this,e),r(this,Jh,"m",rf).call(this)},nf=function(e){r(this,Xh,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},rf=function(){r(this,Xh,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),r=n.scrollWidth>n.clientWidth,i=n.clientHeight>20;r||i?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},of=function(){const[e,t]=zh(r(this,Yh,"f"),Number.parseInt(r(this,Yh,"f").style.left,10),Number.parseInt(r(this,Yh,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});r(this,Yh,"f").style.top=`${t}px`,r(this,Yh,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",df);var lf=Object.freeze({__proto__:null,default:df});const cf="undefined"!=typeof localStorage,uf="J151000",hf="E103205",ff="E108201",pf=cf&&localStorage.getItem("base.content.url")||"",gf="base.ui.components.url";cf&&localStorage.getItem(gf),cf&&localStorage.getItem(gf);const vf="descope-login-flow",mf="code",$f="redirect_mode",yf="err",bf="data-exclude-field",wf="data-exclude-next",Cf="dls_last_auth",kf="dls_last_submitted_login_id",Sf="state_id",xf="saml_idp_state_id",If="wsfed_idp_state_id",Of="saml_idp_username",Ef="descope_idp_initiated",Af="sso_app_id",Pf="custom_app_id",Nf="third_party_app_id",jf="third_party_app_state_id",Rf="oidc_login_hint",Tf="oidc_prompt",Mf="oidc_resource",Uf="oidc_error_redirect_uri",Lf="application_scopes",_f="data-type",Wf="redirect",Df="poll",Ff="webauthnCreate",qf="webauthnGet",Bf="nativeBridge",Hf="loadForm",Vf="submit",Gf="polling",Kf=["descope-multi-select-combo-box","descope-text-area"],zf="dls_last_auth_in_flight",Jf=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts","data","totp","notp","sentTo","sso","selfProvisionDomains"];var Zf;!function(e){e.backward="backward",e.forward="forward"}(Zf||(Zf={}));const Yf=["descope-enriched-text"];function Xf(e){return new URLSearchParams(window.location.search).get(e)}function Qf(e){if(window.history.replaceState&&Xf(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}function ep(e,t){if(!t)return;const n=+e,r=+t;return Number.isNaN(n)||Number.isNaN(r)?void 0:n>r?Zf.forward:n<r?Zf.backward:void 0}const tp=e=>{let[t="",n=""]=(Xf(vf)||"").split("_");const r=(e=>{var t;return(null===(t=/(.*)\|#\|.*/.exec(e))||void 0===t?void 0:t[1])||""})(t);return(!e||r&&r!==e)&&(t="",n=""),{executionId:t,stepId:n,executionFlowId:r}};function np(){Qf(vf)}const rp=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),ip=(e,t)=>{const{executionId:n,stepId:r,executionFlowId:i}=tp(e);if(i&&e!==i)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||r)&&np();const o=Xf("t")||void 0;o&&Qf("t");const s=Xf(mf)||void 0;s&&Qf(mf);const a="popup"===Xf($f);a&&Qf($f);const d=Xf(yf)||void 0;d&&Qf(yf);const{redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h}={redirectAuthCodeChallenge:Xf("ra-challenge"),redirectAuthCallbackUrl:Xf("ra-callback"),redirectAuthBackupCallbackUri:Xf("ra-backup-callback"),redirectAuthInitiator:Xf("ra-initiator")},f=Xf(Sf);f&&Qf(Sf);const p=Xf(xf);p&&Qf(xf);const g=Xf(If);g&&Qf(If);const v=Xf(Of);p&&Qf(Of);const m=Xf(Ef);m&&Qf(Ef);const $=Xf(Af);$&&Qf(Af);const y=Xf(Pf);y&&Qf(Pf);const b=Xf(Nf);b&&Qf(Nf);const w=Xf(jf);w&&Qf(jf);const C=Xf(Lf);C&&Qf(Lf);const k=Xf(Rf);k&&Qf(Rf);const S=Xf(Tf);S&&Qf(Tf);const x=Xf(Uf);x&&Qf(Uf);const I=Xf(Mf);return I&&Qf(Mf),{executionId:n,stepId:r,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h,ssoQueryParams:{oidcIdpStateId:f,samlIdpStateId:p,wsfedIdpStateId:g,samlIdpUsername:v,descopeIdpInitiated:"true"===m,ssoAppId:$,customAppId:y,oidcLoginHint:k,oidcPrompt:S,oidcErrorRedirectUri:x,oidcResource:I,thirdPartyAppId:b,thirdPartyAppStateId:w,applicationScopes:C}}},op=e=>{let t,n;return Object.assign(((...r)=>{return t&&(o=r,(i=t).length===o.length&&i.every(((e,t)=>e===o[t])))||(t=r,n=e(...r)),n;var i,o}),{reset:()=>{t=void 0,n=void 0}})},sp=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector('*[name]:not([auto-focus="false"]):not([aria-hidden="true"])');setTimeout((()=>{null==t||t.focus()}))}};function ap(e,t,n){return new Promise(((r,i)=>{let o=!1;const s=setTimeout((()=>{o=!0,void 0!==n?r(n):i(new Error(`Promise timed out after ${e} ms`))}),e);t.then((e=>{o||(clearTimeout(s),r(e))})).catch((e=>{o||(clearTimeout(s),i(e))}))}))}const dp=(e,{oidcIdpStateId:t,samlIdpStateId:n,wsfedIdpStateId:r,samlIdpUsername:i,ssoAppId:o,customAppId:s,oidcLoginHint:a,oidcPrompt:d,oidcErrorRedirectUri:l,oidcResource:c,thirdPartyAppId:u,thirdPartyAppStateId:h,applicationScopes:f})=>!(!e||t||n||r||i||o||s||a||d||l||c||u||h||f),lp=e=>null==e?void 0:e.submit(),cp=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},up=(e,t=100)=>{let n;return function(...r){n||e.apply(this,r),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}},hp={minLength:"data-password-policy-value-minlength",strength:"data-password-policy-value-passwordstrength",disallowedChars:"data-password-policy-value-disallowedchars",email:"data-password-policy-value-email",activePolicies:"active-policies",availablePolicies:"available-policies"},fp=(e,t)=>{var n;const r=null==e?void 0:e.componentsDynamicAttrs;if(!r)return;const i=Object.entries(r).find((([e])=>(e=>{var t;return null===(t=e.match(/\[data-name=["']([^"']+)["']\]/))||void 0===t?void 0:t[1]})(e)===t));return null===(n=null==i?void 0:i[1])||void 0===n?void 0:n.attributes},pp=[{key:"totp",from:e=>e.totp},{key:"notp",from:e=>e.notp},{key:"sentTo",from:e=>e.sentTo},{key:"sso",from:e=>e.sso},{key:"selfProvisionDomains",from:e=>e.selfProvisionDomains},{key:"inboundAppApproveScopes",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.thirdPartyAppApproveScopes)||void 0===n?void 0:n.data}},{key:"securityQuestionsSetup",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqSetup}},{key:"securityQuestionsVerify",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqVerify}},{key:"userTenants",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userSelectedTenant)||void 0===n?void 0:n.data}},{key:"userRoles",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userRoles)||void 0===n?void 0:n.data}},{key:"ssoApplications",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoApplications)||void 0===n?void 0:n.data}},{key:"ssoConfigurations",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoConfigurations)||void 0===n?void 0:n.data}},{key:"samlAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlMappings)||void 0===n?void 0:n.options}},{key:"oidcAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.oidcMappings)||void 0===n?void 0:n.options}},{key:"samlGroupMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlGroupMappings)||void 0===n?void 0:n.options}},{key:"passwordPolicy",from:e=>{var t;return(e=>{if(!e)return;const t=Object.fromEntries(Object.entries(hp).map((([t,n])=>[t,e[n]])).filter((([,e])=>void 0!==e)));return Object.keys(t).length?t:void 0})(null===(t=e.componentsConfig)||void 0===t?void 0:t.newPassword)}},{key:"recoveryCodes",from:e=>(e=>{const t=fp(e,"recoveryCodes");if(t)return Array.isArray(t.data)?t.data.map((e=>e.value)):[]})(e.componentsConfig)},{key:"outboundApp",from:e=>(e=>{const t=fp(e,"outboundApp");if(t)return{label:t.label,iconSrc:t["icon-src"],appId:t["data-descope-outbound-oauth-app-id"]}})(e.componentsConfig)}],gp=e=>{const t=Object.assign({},e);return e.inboundAppApproveScopes&&(t.thirdPartyAppApproveScopes=e.inboundAppApproveScopes),t};function vp(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var mp,$p,yp,bp;function wp(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const i=n[r],o=e[i],s=t[i];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!wp(o,s))return!1}else if(o!==s)return!1}return!0}let Cp=class{constructor(e={},{forceUpdate:t=!1}={}){mp.set(this,void 0),$p.set(this,{}),yp.set(this,0),bp.set(this,!0),this.update=e=>{const t="function"==typeof e?e(r(this,mp,"f")):e,n=Object.assign(Object.assign({},r(this,mp,"f")),t),o=r(this,mp,"f");i(this,mp,n,"f"),Object.freeze(r(this,mp,"f")),setTimeout((()=>{Object.values(r(this,$p,"f")).forEach((({cb:e,selector:t,forceUpdate:i})=>{const s=t(o),a=t(n);(r(this,bp,"f")||i||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(a)?!wp(s,a):s!==a))&&e(a,s,((e,t)=>n=>e[n]!==t[n])(a,s))}))}),0)},i(this,mp,e,"f"),i(this,bp,t,"f")}get current(){return Object.assign({},r(this,mp,"f"))}set forceUpdate(e){i(this,bp,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return i(this,yp,r(this,yp,"f")+1,"f"),r(this,$p,"f")[r(this,yp,"f")]={cb:e,selector:t,forceUpdate:n},r(this,yp,"f").toString()}unsubscribe(e){const t=!!r(this,$p,"f")[e];return t&&delete r(this,$p,"f")[e],t}unsubscribeAll(){return i(this,$p,{},"f"),!0}};mp=new WeakMap,$p=new WeakMap,yp=new WeakMap,bp=new WeakMap;const kp=["*","#","/","(",")","[","]","_","<",">","`"],Sp=e=>"string"!=typeof e?e:e.replace((e=>{const t=kp.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),xp=["disabled"],Ip=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${bf}])`)).forEach((e=>{e.value=n}))}))},Op=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),Ep=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,r)=>n?Sp(Op(t,r)):Op(t,r))),Ap=(e,t,n)=>{e.querySelectorAll(`[${_f}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Pp=(e,t,n)=>{var r,i;const o=null===(r=customElements.get(t))||void 0===r?void 0:r.cssVarList.url;n&&o&&(null===(i=null==e?void 0:e.style)||void 0===i||i.setProperty(o,`url(data:image/jpg;base64,${n})`))},Np=(e,n,r,i)=>{var o,s;Ap(e,"totp-link",null===(o=null==n?void 0:n.totp)||void 0===o?void 0:o.provisionUrl),Ap(e,"notp-link",null===(s=null==n?void 0:n.notp)||void 0===s?void 0:s.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{const n=(e=>Yf.includes(e))(e.localName);e.textContent=Ep(e.textContent,t,n);const r=e.getAttribute("href");r&&e.setAttribute("href",Ep(r,t))}))})(e,n),((e,n,r)=>{if(!n)return;const{componentsDynamicAttrs:i}=n,o=t(n,["componentsDynamicAttrs"]),s=Object.keys(o).reduce(((e,t)=>(e[`[name=${t}]`]=o[t],e)),{});i&&Object.keys(i).forEach((e=>{const t=i[e];if(t){const{attributes:n}=t;n&&Object.keys(n).length&&(s[e]=n)}})),Object.keys(s).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const n=s[t];Object.keys(n).forEach((t=>{let i=n[t];if("string"!=typeof i)try{i=JSON.stringify(i)}catch(e){r.error(`Could not stringify value "${i}" for "${t}"`,e.message),i=""}e.setAttribute(t,i)}))}))}))})(e,null==n?void 0:n.componentsConfig,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Ep(e.value,t)}))}))})(e,n),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{xp.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,r)},jp=op((()=>n(void 0,void 0,void 0,(function*(){var e,t;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const n=Promise.all([null===(e=window.PublicKeyCredential)||void 0===e?void 0:e.isConditionalMediationAvailable(),null===(t=window.PublicKeyCredential)||void 0===t?void 0:t.isUserVerifyingPlatformAuthenticatorAvailable()]).then((e=>e.every((e=>!!e)))),r=(()=>{var e;const t=null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===e?void 0:e.brands,n=null==t?void 0:t.find((({brand:e,version:t})=>"Chromium"===e&&parseFloat(t)));return n?n.version:0})()>=108;return yield ap(100,n,r)}catch(e){return console.error("Conditional login check failed",e),!1}}))));let Rp;const Tp=(e,t)=>{Rp?Rp.setItem(e,t):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.setItem(e,t)},Mp=e=>Rp?Rp.getItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)?window.localStorage.getItem(e):null,Up="dls_ab_testing_id",Lp={"lastAuth.loginId":{"not-empty":e=>{var t;return!!e.loginId||!!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)},empty:e=>{var t;return!e.loginId&&!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)}},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t,"greater-than-or-equal":(e,t)=>(e.abTestingKey||0)>=t,"less-than-or-equal":(e,t)=>(e.abTestingKey||0)<=t,"in-range":(e,t)=>{const[n,r]=t?t.split(",").map(Number):[void 0,void 0];return(e.abTestingKey||0)>=(null!=n?n:0)&&(e.abTestingKey||0)<=(null!=r?r:0)},"not-in-range":(e,t)=>{const[n,r]=t?t.split(",").map(Number):[void 0,void 0];return!(void 0!==n&&void 0!==r&&!Number.isNaN(n)&&!Number.isNaN(r))||(e.abTestingKey||0)<n||(e.abTestingKey||0)>r},"devised-by":(e,t)=>{const n=Number(t);return!Number.isNaN(n)&&(e.abTestingKey||0)%n==0}}};function _p(e,t){const n={};try{Object.assign(n,JSON.parse(Mp(Cf)))}catch(e){null==t||t.warn("[Descope] Failed to read last auth from storage",String(e))}return n.loginId||e?n:{}}function Wp(e,t){(null==e?void 0:e.authMethod)&&(t&&!e.loginId||Tp(Cf,JSON.stringify(e)))}function Dp(){try{return JSON.parse(Mp(zf)||"{}")}catch(e){return{}}}function Fp(e){try{(e=>{Rp?Rp.removeItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.removeItem(e)})(zf)}catch(t){null==e||e.warn("[Descope] Failed to clear in-flight last auth storage",String(t))}}const qp=(e,t="")=>Object.keys(e).reduce(((n,r)=>{var i;if(Array.isArray(e[r]))return Object.assign(Object.assign({},n),{[r]:{value:e[r].map((e=>"object"==typeof e&&null!==e?qp(e):e))}});if("object"==typeof e[r]&&null!==e[r]&&!(null===(i=e[r])||void 0===i?void 0:i.value))return Object.assign(Object.assign({},n),qp(e[r],`${t+r}.`));const o="object"==typeof e[r]?e[r]:{value:e[r]},s=Object.assign(Object.assign({},n),{[t+r]:o,[`form.${t}${r}`]:o});return"displayName"===r?Object.assign(Object.assign({},s),{[`${t}fullName`]:o,[`form.${t}fullName`]:o}):s}),[]),Bp=h((e=>{var t,n,i,o;return o=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;r(this,t,"m",n).call(this)&&r(this,t,"m",i).call(this),null===(e=super.connectedCallback)||void 0===e||e.call(this)}},t=new WeakSet,n=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},i=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",t.style.height="100%",e.parentElement.appendChild(t),t.appendChild(e)},o})),Hp=["input","change"];function Vp(e){if("number"==typeof e&&Number.isFinite(e))return{value:e,ok:!0};if("boolean"==typeof e)return{value:e?1:0,ok:!0};if("string"==typeof e){if(""===e.trim())return{value:0,ok:!1};const t=Number(e);if(Number.isFinite(t))return{value:t,ok:!0}}return{value:0,ok:!1}}function Gp(e){return null==e?"":"string"==typeof e?e:"boolean"==typeof e?e?"true":"false":"number"==typeof e?Number.isFinite(e)?String(e):"":String(e)}function Kp(e){if("boolean"==typeof e)return{value:e,ok:!0};if("string"==typeof e){if("true"===e)return{value:!0,ok:!0};if("false"===e)return{value:!1,ok:!0}}return"number"==typeof e?{value:0!==e,ok:!0}:{value:!1,ok:!1}}function zp(e){return Array.isArray(e)?e:"string"==typeof e?e.split(","):null}function Jp(e){return null==e||("string"==typeof e?""===e:Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)}const Zp=new Map,Yp={equal:(e,t)=>e===t||Gp(e)===Gp(t),"not-equal":(e,t)=>e!==t&&Gp(e)!==Gp(t),contains:(e,t)=>Array.isArray(e)?e.includes(t):"string"==typeof e&&e.includes(Gp(t)),"doesnt-contains":(e,t)=>Array.isArray(e)?!e.includes(t):"string"==typeof e&&!e.includes(Gp(t)),"greater-than":(e,t)=>{const n=Vp(e),r=Vp(t);return n.ok&&r.ok&&n.value>r.value},"greater-than-or-equal":(e,t)=>{const n=Vp(e),r=Vp(t);return n.ok&&r.ok&&n.value>=r.value},"less-than":(e,t)=>{const n=Vp(e),r=Vp(t);return n.ok&&r.ok&&n.value<r.value},"less-than-or-equal":(e,t)=>{const n=Vp(e),r=Vp(t);return n.ok&&r.ok&&n.value<=r.value},empty:e=>Jp(e),"not-empty":e=>!Jp(e),"is-true":e=>{const t=Kp(e);return t.ok&&t.value},"is-false":e=>{const t=Kp(e);return t.ok&&!t.value},in:(e,t)=>{const n=zp(t);return null!==n&&n.includes(e)},"not-in":(e,t)=>{const n=zp(t);return null!==n&&!n.includes(e)},matches:(e,t)=>{if("string"!=typeof e)return!1;const n=function(e){var t;if(Zp.has(e))return null!==(t=Zp.get(e))&&void 0!==t?t:null;let n;try{n=new RegExp(e)}catch(e){n=null}return Zp.set(e,n),n}(Gp(t));return null!==n&&n.test(e)}};function Xp(e,t){var n;if(e)return"form"===e.kind&&e.form?t[e.form]:"list"===e.kind?(null!==(n=e.items)&&void 0!==n?n:[]).map((e=>Xp(e,t))):e.value}function Qp(e,t){const n=Yp[e.operator];return!!n&&n(Xp(e.target,t),Xp(e.predicate,t))}function eg(e,t){const n={};return(null!=e?e:[]).forEach((e=>{var r;(function(e,t){var n;return(null!==(n=e.rules)&&void 0!==n?n:[]).some((e=>function(e,t){var n;const r=null!==(n=e.atomicConditions)&&void 0!==n?n:[];return!!r.length&&(e.logicalOr?r.some((e=>Qp(e,t))):r.every((e=>Qp(e,t))))}(e,t)))})(e,t)&&(null!==(r=e.componentIds)&&void 0!==r?r:[]).forEach((t=>{n[t]=e.action}))})),n}const tg=["hide","disable","read-only"];const ng=/(["\\])/g;function rg(e){return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(e):e.replace(ng,"\\$1")}function ig(e,t){return Array.from(e.querySelectorAll(`[id="${rg(t)}"]`))}function og(e,t,n){return Object.keys(t).forEach((r=>{const i=t[r];n[r]!==i&&ig(e,r).forEach((e=>function(e,t){switch(t){case"hide":e.classList.remove("hidden");break;case"disable":e.removeAttribute("disabled");break;case"read-only":e.removeAttribute("readonly")}}(e,i)))})),Object.keys(n).forEach((r=>{const i=n[r],o=t[r];i!==o&&ig(e,r).forEach((e=>function(e,t){switch(t){case"hide":e.classList.add("hidden");break;case"disable":e.setAttribute("disabled","true");break;case"read-only":e.setAttribute("readonly","true")}}(e,i)))})),Object.assign({},n)}const sg="component-conditions:";function ag(e){return e instanceof HTMLInputElement?"checkbox"===e.type?e.checked:e.value:"checked"in e?e.checked:"value"in e?e.value:void 0}function dg(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>e[n]===t[n]))}function lg(){return{conditions:[],touchedIds:new Set,snapshot:{},applied:{},serverBaseline:{},debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:null}}function cg(e,t,n){const r={};return n.forEach((n=>{e[n]?r[n]=e[n]:t[n]&&(r[n]=t[n])})),r}const ug=h((e=>{var t,n,s,a,d,l;const c=o(C)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,lg())}applyComponentsState(e,t){t&&(Object.entries(t).forEach((([e,t])=>{tg.includes(t)||this.logger.error(`Unknown component action "${t}" for component with id "${e}"`,`Valid actions are ${tg.map((e=>`"${e}"`)).join(", ")}`)})),og(e,{},t))}initRealtimeConditions(e,o){var a,l,c,u;r(this,t,"m",d).call(this);const h=null!==(a=null==o?void 0:o.realtimeComponentsConditions)&&void 0!==a?a:[];if(!h.length)return void this.logger.debug(`${sg} no real-time rules to apply on this screen`);this.logger.info(`${sg} found ${h.length} real-time rule(s) for this screen`);const f={};Object.entries(null!==(l=null==o?void 0:o.form)&&void 0!==l?l:{}).forEach((([e,t])=>{f[`form.${e}`]=t})),function(e){const t=new Set,n=e=>{var r;e&&("form"===e.kind&&e.form?t.add(e.form):"list"===e.kind&&(null!==(r=e.items)&&void 0!==r?r:[]).forEach(n))};return(null!=e?e:[]).forEach((e=>{var t;return(null!==(t=e.rules)&&void 0!==t?t:[]).forEach((e=>{var t;return(null!==(t=e.atomicConditions)&&void 0!==t?t:[]).forEach((e=>{n(e.target),n(e.predicate)}))}))})),t}(h).forEach((t=>{const n=function(e,t){const n=t.startsWith("form.")?t.slice(5):t;return e.querySelector(`[name="${rg(t)}"]`)||e.querySelector(`[name="${rg(n)}"]`)}(e,t);if(!n)return;const r=ag(n);void 0!==r&&(f[t]=r)}));const p=function(e){const t=new Set;return(null!=e?e:[]).forEach((e=>{var n;(null!==(n=e.componentIds)&&void 0!==n?n:[]).forEach((e=>t.add(e)))})),t}(h),g={},v={};Object.entries(null!==(c=null==o?void 0:o.componentsState)&&void 0!==c?c:{}).forEach((([e,t])=>{p.has(e)&&(v[e]=t)})),Object.entries(null!==(u=null==o?void 0:o.serverOnlyComponentsState)&&void 0!==u?u:{}).forEach((([e,t])=>{p.has(e)&&(g[e]=t)}));const m={conditions:h,touchedIds:p,snapshot:f,applied:v,serverBaseline:g,debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:e},$=cg(eg(h,f),g,p);dg(v,$)||(m.applied=og(e,v,$)),m.inputHandler=e=>r(this,t,"m",s).call(this,e),Hp.forEach((t=>{e.addEventListener(t,m.inputHandler,!0)})),this.logger.debug(`${sg} listening for "${Hp.join('" and "')}" events on form fields; ${Object.keys(v).length} component(s) start hidden / disabled / read-only by these rules`);const y=this.nextRequestStatus;if(null==y?void 0:y.subscribe){const e=({isLoading:e})=>{m.paused=e,e&&m.debounceTimer&&(clearTimeout(m.debounceTimer),m.debounceTimer=null)},t=y.subscribe(e);m.unsubscribePauseListener=()=>{var e;null!=t&&(null===(e=y.unsubscribe)||void 0===e||e.call(y,t))}}i(this,n,m,"f")}disconnectedCallback(){var e;null===(e=super.disconnectedCallback)||void 0===e||e.call(this),r(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(e){var i,o;const s=r(this,n,"f");if(!s.root||s.paused)return;const d=e.target;if(!d)return;if(null===(i=d.hasAttribute)||void 0===i?void 0:i.call(d,bf))return;const l=null===(o=d.getAttribute)||void 0===o?void 0:o.call(d,"name");if(!l)return;const c=function(e){return e.startsWith("form.")?e:`form.${e}`}(l);s.snapshot[c]=ag(d),s.debounceTimer&&clearTimeout(s.debounceTimer),s.debounceTimer=setTimeout((()=>{s.debounceTimer=null,r(this,t,"m",a).call(this)}),50)},a=function(){const e=r(this,n,"f");if(!e.root)return;let t;try{t=cg(eg(e.conditions,e.snapshot),e.serverBaseline,e.touchedIds)}catch(e){return void this.logger.error(`${sg} failed to evaluate real-time rules — keeping the previous state`,null==e?void 0:e.message)}const i=e.applied;dg(i,t)||(this.logger.debug(`${sg} form changed — updating components: was ${JSON.stringify(i)}, now ${JSON.stringify(t)}`),e.applied=og(e.root,i,t))},d=function(){const e=r(this,n,"f");e.debounceTimer&&clearTimeout(e.debounceTimer),e.unsubscribePauseListener&&e.unsubscribePauseListener(),e.root&&(Object.keys(e.applied).length>0&&e.root.isConnected&&og(e.root,e.applied,{}),Hp.forEach((t=>{e.root.removeEventListener(t,e.inputHandler,!0)}))),i(this,n,lg(),"f")},l})),hg="project-id",fg="flow-id",pg=e=>{const t=(e=>{const t=e.getAttribute(hg),n=e.getAttribute(fg);return t&&n?Array.from(e.ownerDocument.querySelectorAll("descope-wc")).filter((e=>e.getAttribute(hg)===t&&e.getAttribute(fg)===n)):[]})(e);return t.length>1&&t[0]!==e},gg=h((e=>{var t,n,s,a;const d=o(C)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}connectedCallback(){var e;null===(e=super.connectedCallback)||void 0===e||e.call(this),r(this,t,"m",s).call(this)}attributeChangedCallback(e,n,i){var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,i),n===i||e!==hg&&e!==fg||r(this,t,"m",s).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){queueMicrotask((()=>{if(!this.isConnected)return;const e=this.getAttribute(hg),t=this.getAttribute(fg),o=`${e}|${t}`;r(this,n,"f")!==o&&pg(this)&&(i(this,n,o,"f"),this.logger.warn("Multiple Descope flow components detected on the same page",`The same flow ("${t}") and project ("${e}") are running more than once on this page. This is not supported and may cause the flow to behave unexpectedly.`))}))},a})),vg=["externalId","email","phone"],mg=["newPassword","password"],$g="data-username-anchor",yg=e=>{var t;if(!e)return"";try{const n=null===(t=window.sessionStorage)||void 0===t?void 0:t.getItem(kf);if(!n)return"";const r=JSON.parse(n);return r.executionId===e&&r.loginId||""}catch(e){return""}},bg=h((e=>{var t,n,s,a,d;const l=o(C)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}updateScreenUser(e){var o,d,l;i(this,n,{email:null==e?void 0:e.email,loginIds:(null===(o=null==e?void 0:e.loginIds)||void 0===o?void 0:o.length)?e.loginIds:[yg(r(this,t,"a",a))||(null===(l=null===(d=r(this,t,"a",s).sdk)||void 0===d?void 0:d.getLastUserLoginId)||void 0===l?void 0:l.call(d))].filter(Boolean)},"f")}updateUsernameAnchor(){document.querySelectorAll(`[${$g}="true"]`).forEach((e=>e.remove())),((e,t,n,r)=>{var i;const o=(null==n?void 0:n.email)||(null===(i=null==n?void 0:n.loginIds)||void 0===i?void 0:i[0]);(e=>e.querySelector("descope-new-password")||e.querySelector("descope-password"))(t)?o?(e=>{const t=['input[autocomplete="username"]',...vg.map((e=>`[name="${e}"]`))].join(", ");return e.some((e=>e.querySelector(t)))})([e,t])?r.debug("Username anchor: screen already has an identifier field"):(r.debug("Username anchor: injecting hidden username input"),e.appendChild((e=>{const t=document.createElement("input");return t.setAttribute("autocomplete","username"),t.setAttribute("name","username"),t.setAttribute("type","email"),t.setAttribute("readonly","true"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.setAttribute(bf,"true"),t.setAttribute($g,"true"),t.setAttribute("value",e),t.value=e,Object.assign(t.style,{position:"absolute",opacity:"0",pointerEvents:"none",height:"0",border:"0"}),t})(o))):r.debug("Username anchor: no user identifier available"):r.debug("Username anchor: no password component on screen")})(this,r(this,t,"a",s).contentRootElement,r(this,n,"f"),this.logger)}captureLastSubmittedLoginId(e={},n){const i=cp(e,vg);i&&((e,t)=>{var n;if(e&&t)try{null===(n=window.sessionStorage)||void 0===n||n.setItem(kf,JSON.stringify({executionId:t,loginId:e}))}catch(e){}})(i,n||r(this,t,"a",a))}storeCredentials(e={}){var t,i,o,s,a,d;const l=cp(e,vg)||(null===(t=r(this,n,"f"))||void 0===t?void 0:t.email)||(null===(o=null===(i=r(this,n,"f"))||void 0===i?void 0:i.loginIds)||void 0===o?void 0:o[0]),c=cp(e,mg);if(l&&c)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:l,password:c});null===(d=null===(a=null===(s=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,e))||void 0===d||d.catch((e=>{this.logger.error("Could not store credentials",null==e?void 0:e.message)}))}catch(e){this.logger.error("Could not store credentials",e.message)}}},n=new WeakMap,t=new WeakSet,s=function(){return this},a=function(){var e,n;return(null===(n=null===(e=r(this,t,"a",s).flowState)||void 0===e?void 0:e.current)||void 0===n?void 0:n.executionId)||""},d}));var wg,Cg,kg,Sg,xg,Ig,Og,Eg,Ag,Pg,Ng,jg,Rg,Tg,Mg,Ug,Lg,_g,Wg,Dg,Fg,qg;const Bg=o(Ee,M,Bp,ug,gg,bg,J)(HTMLElement);class Hg extends Bg{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id"]}constructor(e){super(),wg.add(this),kg.set(this,!1),Sg.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),r(this,wg,"m",qg).call(this,e,t)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",n={})=>{this.logger.info(e,t,n)},debug:(e,t="")=>{this.logger.debug(e,t)}},xg.set(this,new Cp),Ig.set(this,new Cp),Og.set(this,{}),this.getComponentsContext=()=>r(this,Og,"f"),this.nextRequestStatus=new Cp({isLoading:!1}),Eg.set(this,void 0),Ag.set(this,{popstate:r(this,wg,"m",Tg).bind(this),componentsContext:r(this,wg,"m",Wg).bind(this)}),Pg.set(this,void 0),this.getConfig=()=>n(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),i(this,Pg,e,"f"),r(this,wg,"m",jg).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{return qp(JSON.parse(e))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return((e,t)=>Object.fromEntries(Object.entries(e).map((([e,n])=>[e,n[t]]))))(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{return JSON.parse(this.getAttribute("outbound-app-scopes"))||null}catch(e){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return r(this,Sg,"f")}set customStorage(e){if(e&&"function"!=typeof e.getItem)throw new Error("Custom storage must have a getItem method");if(e&&"function"!=typeof e.setItem)throw new Error("Custom storage must have a setItem method");if(e&&"function"!=typeof e.removeItem)throw new Error("Custom storage must have a removeItem method");i(this,Sg,e,"f"),(e=>{Rp=e})(e)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return n(this,void 0,void 0,(function*(){var e,t;const n=yield this.getProjectConfig(),r=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=r.version)&&void 0!==t||(r.version=0),r}))}getTargetLocales(){return n(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,n,r;const i=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Kf.includes(null!==(r=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==r?r:"");if("Enter"!==e.key||i||o)return;e.preventDefault();const s=this.rootElement.querySelectorAll("descope-button");if(1===s.length&&"false"!==s[0].getAttribute("auto-submit"))return void s[0].click();const a=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const d=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===d.length)"false"!==d[0].getAttribute("auto-submit")&&d[0].click();else if(0===d.length){const e=Array.from(s).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return n(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig();return("projectConfig"in t?null===(e=t.projectConfig)||void 0===e?void 0:e.componentsVersion:{})||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;if(this.flowStatus="loading",["ready","error","success"].forEach((e=>this.addEventListener(e,(()=>{this.flowStatus=e})))),yield null===(t=e.init)||void 0===t?void 0:t.call(this),r(this,Ig,"f").subscribe(r(this,wg,"m",Fg).bind(this)),r(this,Ig,"f").update({isDebug:this.debug}),r(this,wg,"m",Rg).call(this),yield r(this,wg,"m",Lg).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const n=yield this.getConfig();if("isMissingConfig"in n&&n.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:o,stepId:s,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:g}=ip(this.flowId,this.loggerWrapper);window.addEventListener("popstate",r(this,Ag,"f").popstate),window.addEventListener("components-context",r(this,Ag,"f").componentsContext),r(this,xg,"f").subscribe(r(this,wg,"m",Ug).bind(this)),r(this,xg,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:s,executionId:o,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},g)),i(this,kg,!0,"f")}))}disconnectedCallback(){var e;r(this,xg,"f").unsubscribeAll(),r(this,Ig,"f").unsubscribeAll(),r(this,wg,"m",Dg).call(this),window.removeEventListener("popstate",r(this,Ag,"f").popstate),window.removeEventListener("components-context",r(this,Ag,"f").componentsContext),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}attributeChangedCallback(e,t,n){var i;if(null===(i=super.attributeChangedCallback)||void 0===i||i.call(this,e,t,n),this.shadowRoot.isConnected&&r(this,kg,"f")&&t!==n&&Cg.observedAttributes.includes(e)){r(this,wg,"m",Rg).call(this);const i=null===t;r(this,xg,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,np()),{[rp(e)]:n,stepId:o,executionId:s}})),r(this,Ig,"f").update({isDebug:this.debug})}}}var Vg,Gg,Kg,zg,Jg,Zg,Yg,Xg,Qg,ev,tv,nv,rv,iv,ov,sv,av,dv,lv,cv,uv,hv,fv,pv,gv,vv,mv,$v,yv,bv,wv,Cv,kv,Sv,xv,Iv,Ov,Ev,Av;Cg=Hg,kg=new WeakMap,Sg=new WeakMap,xg=new WeakMap,Ig=new WeakMap,Og=new WeakMap,Eg=new WeakMap,Ag=new WeakMap,Pg=new WeakMap,wg=new WeakSet,Ng=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},jg=function(){r(this,wg,"m",Ng).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},Rg=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","outbound-app-id","outbound-app-scopes","theme-override"];Cg.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[rp(t)])throw Error(`${t} cannot be empty`)}))},Tg=function(){const{stepId:e,executionId:t}=tp(this.flowId);r(this,xg,"f").update({stepId:e,executionId:t})},Mg=function(e,t){nd&&"function"==typeof nd||this.logger.error("SDK was not loaded properly",nd,JSON.stringify(nd));const i=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},Cg.sdkConfigOverrides),{projectId:e,baseUrl:t});r(this,Sg,"f")&&(i.customStorage=r(this,Sg,"f")),this.sdk=nd(i),["start","next"].forEach((e=>{const t=function(e,t,r){return(...i)=>n(this,void 0,void 0,(function*(){let n;const o=r+1;for(let s=0;s<o;s++)try{return yield e(...i)}catch(e){n=e,s<r&&(yield new Promise((e=>{setTimeout(e,t*Math.pow(2,s+1))})))}throw n}))}(this.sdk.flow[e],1e3,3);this.sdk.flow[e]=(...r)=>n(this,void 0,void 0,(function*(){try{return yield t(...r)}catch(t){return this.logger.error(`Error in sdk flow ${e} function`,t),{error:{errorCode:uf,errorDescription:t.toString()}}}}))}))},Ug=function(e,t,i){return n(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:n}=e;if(i("projectId")||i("baseUrl")){if(!t)return;r(this,wg,"m",Mg).call(this,t,n)}r(this,Pg,"f").call(this,e)}))},Lg=function(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield r(this,wg,"m",_g).call(this))}))},_g=function(){return n(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:r}){const i=new URL(pf||r||"https://static.descope.com/pages");return i.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(i.pathname,e,n,t),i.toString()}({projectId:this.projectId,filename:"config.json",assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield function(e,t){return n(this,void 0,void 0,(function*(){const n=yield fetch(e,{cache:"default"});if(!n.ok)throw Error(`Error fetching URL ${e} [${n.status}]`);return{body:yield n[t](),headers:Object.fromEntries(n.headers.entries())}}))}(e,"json"),!0}catch(e){return!1}}))},Wg=function(e){i(this,Og,Object.assign(Object.assign({},r(this,Og,"f")),e.detail),"f")},Dg=function(){var e;null===(e=r(this,Eg,"f"))||void 0===e||e.remove(),i(this,Eg,null,"f")},Fg=function(e){return n(this,arguments,void 0,(function*({isDebug:e}){e?(i(this,Eg,document.createElement("descope-debugger"),"f"),Object.assign(r(this,Eg,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return zv})),document.body.appendChild(r(this,Eg,"f"))):r(this,wg,"m",Dg).call(this)}))},qg=function(e,t){var n;e&&this.debug&&(null===(n=r(this,Eg,"f"))||void 0===n||n.updateData({title:e,description:t}))},Hg.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.0.2"}};class Pv extends Hg{static set sdkConfigOverrides(e){Hg.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Hg.sdkConfigOverrides}constructor(){const e=new Cp({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),Vg.add(this),this.stepState=new Cp({}),Gg.set(this,void 0),Kg.set(this,null),zg.set(this,null),Jg.set(this,{visibilitychange:r(this,Vg,"m",Zg).bind(this)}),this.bridgeVersion=2,this.nativeCallbacks={},iv.set(this,!1),this.handleRedirect=e=>{window.location.assign(e)},sv.set(this,(e=>{const t=()=>{this.contentRootElement.classList.toggle("hidden",e),this.slotElement.classList.toggle("hidden",!e),e&&(this.contentRootElement.innerHTML="")};e&&this.contentRootElement.hasChildNodes()?r(this,Vg,"m",av).call(this,t):t()})),dv.set(this,((e,t,o,s,a=!1)=>{const d=[hf,"E103202",ff];if(this.flowState.current.action===Df){if(r(this,cv,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const l=Date.now(),c=a?500:2e3;i(this,Gg,setTimeout((()=>n(this,void 0,void 0,(function*(){var n,i;this.logger.debug("polling - Calling next");const u=this.sdk.flow.next(e,t,Gf,o,s,{}),h=document.hidden&&!a&&Date.now()-l>c+500;let f;h&&this.logger.debug("polling - The polling seems to be throttled");try{const e=h?1e3:6e3;f=yield ap(e,u)}catch(n){return this.logger.warn(`polling - The ${h?"throttled fetch":"fetch"} call timed out or was aborted`),void r(this,dv,"f").call(this,e,t,o,s,h)}if((null===(n=null==f?void 0:f.error)||void 0===n?void 0:n.errorCode)===uf)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void r(this,dv,"f").call(this,e,t,o,s);this.logger.debug("polling - Got a response"),(null==f?void 0:f.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),(null===(i=null==f?void 0:f.error)||void 0===i?void 0:i.errorCode)&&d.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):r(this,dv,"f").call(this,e,t,o,s),r(this,uv,"f").call(this,f)}))),c),"f")}})),lv.set(this,(()=>{clearTimeout(r(this,Gg,"f")),i(this,Gg,null,"f")})),cv.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),uv.set(this,(e=>{var t,n,o,s,a,d,l,c,u,h,f,p,g;if(!(null==e?void 0:e.ok)){const i=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,l=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;r(this,Vg,"m",Ev).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:l,errorMessage:i}),this.loggerWrapper.error((null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorDescription)||i,(null===(a=null==e?void 0:e.error)||void 0===a?void 0:a.errorMessage)||l);const c=null===(d=null==e?void 0:e.error)||void 0===d?void 0:d.errorCode;return void("E102004"!==c&&c!==hf&&c!==ff||!this.isRestartOnError||r(this,Vg,"m",rv).call(this))}null===(c=null===(l=e.data)||void 0===l?void 0:l.runnerLogs)||void 0===c||c.forEach((e=>{const{level:t,title:n,log:r}=e;t&&this.loggerWrapper[t]?this.loggerWrapper[t](n,r):this.loggerWrapper.info(n,r)}));const v=null===(f=null===(h=null===(u=e.data)||void 0===u?void 0:u.screen)||void 0===h?void 0:h.state)||void 0===f?void 0:f.errorText;(null===(p=e.data)||void 0===p?void 0:p.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${v?`${v} - `:""}${e.data.error.message}`):v&&this.loggerWrapper.error(v);const{status:m,authInfo:$,lastAuth:y,action:b,openInNewTabUrl:w}=e.data;if(b!==Df&&r(this,lv,"f").call(this),"completed"===m){this.storeLastAuthenticatedUser&&Wp(Object.assign(Object.assign({},y),{lastUsedPerScreen:Dp()})),Fp(this.loggerWrapper);const t=Object.assign({},$);return e.data.output&&Object.keys(e.data.output).length>0&&(t.flowOutput=e.data.output),void r(this,Vg,"m",Ev).call(this,"success",t)}this.storeLastAuthenticatedUser&&Wp(y,!0),w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:x,redirect:I,webauthn:O,error:E,samlIdpResponse:A,wsFedIdpResponse:P,nativeResponse:N}=e.data,j=Date.now();b!==Df?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:x,status:m,stepId:k,stepName:S,action:b,error:E}),(null===(g=x.state)||void 0===g?void 0:g.clientScripts)&&i(this,zg,this.loadSdkScripts(x.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==I?void 0:I.url,redirectIsPopup:null==I?void 0:I.isPopup,screenId:null==x?void 0:x.id,screenState:null==x?void 0:x.state,webauthnTransactionId:null==O?void 0:O.transactionId,webauthnOptions:null==O?void 0:O.options,samlIdpResponseUrl:null==A?void 0:A.url,samlIdpResponseSamlResponse:null==A?void 0:A.samlResponse,samlIdpResponseRelayState:null==A?void 0:A.relayState,wsFedIdpResponseUrl:null==P?void 0:P.url,wsFedIdpResponseWresult:null==P?void 0:P.wresult,wsFedIdpResponseWctx:null==P?void 0:P.wctx,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:j})):this.flowState.update({action:b,reqTimestamp:j})})),hv.set(this,op((()=>n(this,void 0,void 0,(function*(){var e;try{const t=yield this.sdk.webauthn.signIn.start("",window.location.origin);return t.ok||this.loggerWrapper.warn("Webauthn start failed",null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.errorMessage),t.data}catch(e){this.loggerWrapper.warn("Webauthn start failed",e.message)}}))))),$v.set(this,null),Cv.set(this,up(((e,t,i)=>n(this,void 0,void 0,(function*(){var n,o;if("true"===e.getAttribute("formnovalidate")||r(this,Vg,"m",vv).call(this)){const s=null==e?void 0:e.getAttribute("id");r(this,Vg,"m",xv).call(this,e,s,i),r(this,Vg,"m",yv).call(this,e);const a=yield r(this,Vg,"m",mv).call(this),d=(e=>Array.from((null==e?void 0:e.attributes)||[]).reduce(((e,t)=>{var n;const r=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return r?Object.assign(e,{[r]:t.value}):e}),{}))(e);this.nextRequestStatus.update({isLoading:!0});const l=Object.assign(Object.assign(Object.assign({},d),a),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin}),c=yield t(s,l);this.nextRequestStatus.update({isLoading:!1}),this.captureLastSubmittedLoginId(a,null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.executionId),this.storeCredentials(a)}}))))),this.flowState=e}nativeResume(e,t){var n,i,o,s,a,d;const l=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let e,{exchangeCode:t}=l;if(!t){const r=new URL(l.url);t=null===(n=r.searchParams)||void 0===n?void 0:n.get(mf),e=(null===(i=r.searchParams)||void 0===i?void 0:i.get(yf))||void 0}null===(s=(o=this.nativeCallbacks).complete)||void 0===s||s.call(o,{exchangeCode:t,exchangeError:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(l.url),t=e.searchParams.get("t"),n=e.searchParams.get(vf).split("_").pop();r(this,lv,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const{screenResolve:e}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:t}=l;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=l,{screenNext:n}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(d=(a=this.nativeCallbacks).complete)||void 0===d||d.call(a,l)}loadSdkScriptsModules(){const e=this.shadowRoot.querySelectorAll("div[data-script-id]");return Array.from(e).map((e=>e.moduleRes)).filter((e=>!!e))}loadSdkScripts(e){if(!(null==e?void 0:e.length))return null;const t=(e,t)=>n=>{this.dispatchEvent(new CustomEvent("components-context",{detail:{[vp(e.id,e.resultKey)]:n},bubbles:!0,composed:!0})),t(e.id)};this.loggerWrapper.debug(`Preparing to load scripts: ${e.map((e=>e.id)).join(", ")}`);const r=Promise.all(null==e?void 0:e.map((e=>n(this,void 0,void 0,(function*(){var n,r,i;const o=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(o){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=o;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}(null===(r=globalThis.descope)||void 0===r?void 0:r[e.id])||(yield this.injectNpmLib("@descope/flow-scripts","1.0.17",`dist/${e.id}.js`));const s=null===(i=globalThis.descope)||void 0===i?void 0:i[e.id];return new Promise(((n,r)=>{try{const r=s(e.initArgs,{baseUrl:this.baseUrl,ref:this},t(e,n),this.loggerWrapper);if(r){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=r,this.shadowRoot.appendChild(t);const n=this.nextRequestStatus.subscribe((()=>{var i;this.loggerWrapper.debug("Stopping script",e.id),(null===(i=r.stop)||void 0===i?void 0:i.call(r))&&(this.nextRequestStatus.unsubscribe(n),this.loggerWrapper.debug("Removing script",e.id),this.shadowRoot.removeChild(t))}))}}catch(e){r(e)}}))}))))),i=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([r,i])}get isDismissScreenErrorOnInput(){return"true"===this.getAttribute("dismiss-screen-error-on-input")}init(){if(!window.descopeBridge)return this._init();this.lazyInit=this._init}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t,n;this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),r(this,Vg,"m",tv).call(this),window.addEventListener("visibilitychange",r(this,Jg,"f").visibilitychange)),yield null===(n=e.init)||void 0===n?void 0:n.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),r(this,lv,"f").call(this),null===(e=r(this,Kg,"f"))||void 0===e||e.abort(),i(this,Kg,null,"f"),window.removeEventListener("visibilitychange",r(this,Jg,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return n(this,void 0,void 0,(function*(){let n;const r=y(e),i=yield this.getTargetLocales();return i.includes(r.locale)?n=`${t}-${r.locale}.html`:i.includes(r.fallback)&&(n=`${t}-${r.fallback}.html`),n}))}getPageContent(e,t){return n(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield this.fetchStaticResource(t,"text");return e}catch(n){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,n)}try{const{body:t}=yield this.fetchStaticResource(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,o,s){return n(this,void 0,void 0,(function*(){var a,d;const{projectId:l,flowId:c,tenant:u,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectIsPopup:$,redirectUrl:b,token:w,code:C,isPopup:k,exchangeError:S,webauthnTransactionId:x,webauthnOptions:I,redirectAuthCodeChallenge:O,redirectAuthCallbackUrl:E,redirectAuthBackupCallbackUri:A,redirectAuthInitiator:P,locale:N,samlIdpResponseUrl:j,samlIdpResponseSamlResponse:R,samlIdpResponseRelayState:T,wsFedIdpResponseUrl:M,wsFedIdpResponseWresult:U,wsFedIdpResponseWctx:L,nativeResponseType:_,nativePayload:W,reqTimestamp:D}=e,F=t(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx","nativeResponseType","nativePayload","reqTimestamp"]);let q,B,H;const V=(()=>{const e=Mp(Up);if(!e){const e=Math.floor(100*Math.random()+1);return Tp(Up,e.toString()),e}return Number(e)})(),{outboundAppId:G}=this,{outboundAppScopes:K}=this,z=this.sdk.getLastUserLoginId(),J=yield this.getFlowConfig(),Z=yield this.getProjectConfig(),Y=Object.entries(Z.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),X=E&&O?{callbackUrl:E,codeChallenge:O,backupCallbackUri:A}:void 0,Q=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect,externalAuthRedirect:this.nativeOptions.externalAuthRedirect}:void 0;let ee={};if(!f){Fp(this.loggerWrapper);const e=[...J.clientScripts||[],...J.sdkScripts||[]];if(J.conditions){let t=[];({startScreenId:q,conditionInteractionId:H,startScreenName:B,clientScripts:t,componentsConfig:ee}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:r})=>{var i;if("ELSE"===t)return!0;const o=null===(i=Lp[t])||void 0===i?void 0:i[n];return!!(null==o?void 0:o(e,r))}));return n?{startScreenId:n.met.screenId,startScreenName:n.met.screenName,conditionInteractionId:n.met.interactionId,clientScripts:n.met.clientScripts,componentsConfig:n.met.componentsConfig}:{}})({loginId:z,code:C,token:w,abTestingKey:V,lastAuth:_p(z,this.loggerWrapper)},J.conditions)),e.push(...t||[])}else J.condition?({startScreenId:q,conditionInteractionId:H}=((e,t)=>{var n;const r=null===(n=Lp[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!r)return{};const i=r(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==i?void 0:i.screenId,startScreenName:null==i?void 0:i.screenName,conditionInteractionId:null==i?void 0:i.interactionId}})(J.condition,{loginId:z,code:C,token:w,abTestingKey:V,lastAuth:_p(z,this.loggerWrapper)})):(B=J.startScreenName,q=J.startScreenId);if(i(this,zg,this.loadSdkScripts(e),"f"),J.fingerprintEnabled&&J.fingerprintKey?yield ma(J.fingerprintKey,this.baseUrl):Ks(ga),!dp(q,F)){const e=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},F),{client:this.client}),b&&{redirectUrl:b}),{lastAuth:_p(z,this.loggerWrapper),abTestingKey:V,locale:y(N).locale,nativeOptions:Q,outboundAppId:G,outboundAppScopes:K}),H,"",Z.componentsVersion,Y,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),C?{exchangeCode:C,idpInitiated:!0}:{}),F.descopeIdpInitiated&&{idpInitiated:!0}),w?{token:w}:{}),F.oidcLoginHint?{externalId:F.oidcLoginHint}:{}));return r(this,uv,"f").call(this,e),void("completed"!==(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.status)&&this.flowState.update({code:void 0,token:void 0}))}}if(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:k,code:C,exchangeError:S,isCodeChanged:s("code"),isExchangeErrorChanged:s("exchangeError")})),k&&(s("code")&&C||s("exchangeError")&&S))return void r(this,Vg,"m",Av).call(this,f,C,S);if(f&&(s("token")&&w||s("code")&&C||s("exchangeError")&&S)){const e=yield this.sdk.flow.next(f,h,Vf,J.version,Z.componentsVersion,{token:w,exchangeCode:C,exchangeError:S});return r(this,uv,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Hf&&j&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>s(e)))){if(!R)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,r)=>{const i=document.createElement("form");i.method="POST",i.action=e,i.innerHTML=`\n <input type="hidden" role="saml-response" name="SAMLResponse" value="${t}" />\n <input type="hidden" role="saml-relay-state" name="RelayState" value="${n}" />\n <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />\n `,document.body.appendChild(i),r(i)})(j,R,T||"",lp)}if(p===Hf&&M&&["wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx"].some((e=>s(e)))){if(!U)return void this.loggerWrapper.error("Did not get wsfed idp params data to load");((e,t,n,r)=>{const i=document.createElement("form");i.method="POST",i.action=e;const o=(e,t)=>{const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n};i.appendChild(o("wa","wsignin1.0")),i.appendChild(o("wresult",t)),i.appendChild(o("wctx",n));const s=document.createElement("input");s.type="submit",s.id="WSFedSubmitButton",s.value="Continue",s.style.display="none",i.appendChild(s),document.body.appendChild(i),r(i)})(M,U,L||"",lp)}if(p===Wf&&(s("redirectTo")||s("deferredRedirect"))){if(!m)return void this.loggerWrapper.error("Did not get redirect url");if("no-op"===m)return;if("android"===P&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${$}`),$){this.loggerWrapper.debug("Opening redirect in popup");const e=((e,t,n,r)=>{const i=void 0!==window.screenLeft?window.screenLeft:window.screen.left,o=void 0!==window.screenTop?window.screenTop:window.screen.top,s=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-n)/2+i,a=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-r)/2+o,d=function(){const e=navigator.userAgent||"",t=/\b(iPhone)\b/.test(e),n=/Safari/.test(e)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(e);return t&&n}()?"about:blank":"",l=window.open(d,t,`width=${n},height=${r},top=${a},left=${s},scrollbars=yes,resizable=yes`);return l.location.href=e,l.focus(),l})(m,"?",598,700),t=this.shouldUsePopupPostMessage();t&&(e.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(t?"postMessage":"BroadcastChannel"));let n=!1;const i=e=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(e.data));const r=t?this.popupOrigin:window.location.origin;if(e.origin!==r)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${e.origin}", expected: "${r}"`);const{action:i,data:o}=e.data||{};"code"===i&&(n=!0,this.flowState.update({code:o.code,exchangeError:o.exchangeError}))};let o;this.loggerWrapper.debug("Starting popup closed detection");const s=setInterval((()=>{e.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(s),r(this,Vg,"m",Ev).call(this,"popupclosed",{abandoned:!n}),this.loggerWrapper.debug("Cleaning up popup listeners"),null==o||o())}),1e3);if(t)window.addEventListener("message",i),o=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",i)};else{this.loggerWrapper.debug("Creating broadcast channel");const e=new BroadcastChannel(f);e.onmessage=i,o=()=>{this.loggerWrapper.debug("Closing channel"),e.close()}}}else this.handleRedirect(m),this.flowState.update({redirectTo:"no-op"}),r(this,Vg,"m",Ev).call(this,"popupclosed",{});return}if(p===Ff||p===qf){if(!x||!I)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t,n,o;null===(d=r(this,Kg,"f"))||void 0===d||d.abort(),i(this,Kg,null,"f");try{e=p===Ff?yield this.sdk.webauthn.helpers.create(I):yield this.sdk.webauthn.helpers.get(I)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name,n=e.reason,o=e.message}const s=yield this.sdk.flow.next(f,h,Vf,J.version,Z.componentsVersion,{transactionId:x,response:e,failure:t,failureReason:n,failureMessage:o});r(this,uv,"f").call(this,s)}if(p===Bf)return this.nativeCallbacks.complete=e=>n(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,Vf,J.version,Z.componentsVersion,e);r(this,uv,"f").call(this,t)})),r(this,Vg,"m",Qg).call(this,_,W),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((s("action")||s("deferredPolling"))&&r(this,dv,"f").call(this,f,h,J.version,Z.componentsVersion),!g&&!q)return void this.loggerWrapper.warn("No screen was found to show");const te=q||g,ne=yield this.getHtmlFilenameWithLocale(N,te),{oidcLoginHint:re,oidcPrompt:ie,oidcErrorRedirectUri:oe,oidcResource:se,samlIdpUsername:ae}=F,de={direction:ep(h,o.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:z,name:this.sdk.getLastUserDisplayName()||z},componentsConfig:Object.assign(Object.assign(Object.assign({},J.componentsConfig),ee),null==v?void 0:v.componentsConfig)}),htmlFilename:`${te}.html`,htmlLocaleFilename:ne,screenId:te,stepName:e.stepName||B,samlIdpUsername:ae,oidcLoginHint:re,oidcPrompt:ie,oidcErrorRedirectUri:oe,oidcResource:se,action:p,locale:y(N).locale},le=_p(z,this.loggerWrapper);dp(q,F)?de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==J?void 0:J.clientScripts)||[];yield r(this,Vg,"m",kv).call(this,n);const i=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},F),{lastAuth:le,preview:this.preview,abTestingKey:V,client:this.client}),b&&{redirectUrl:b}),{locale:y(N).locale,nativeOptions:Q,outboundAppId:G,outboundAppScopes:K}),H,e,Z.componentsVersion,Y,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),gp(t)),C&&{exchangeCode:C,idpInitiated:!0}),F.descopeIdpInitiated&&{idpInitiated:!0}),w&&{token:w}),de.next.isCustomScreen);return r(this,uv,"f").call(this,i),i})):(s("projectId")||s("baseUrl")||s("executionId")||s("stepId"))&&(de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==v?void 0:v.clientScripts)||[];yield r(this,Vg,"m",kv).call(this,n);const i=yield this.sdk.flow.next(f,h,e,J.version,Z.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),gp(t)),de.next.isCustomScreen);return r(this,uv,"f").call(this,i),i}))),this.loggerWrapper.debug("Got a screen with id",de.screenId),yield r(this,Vg,"m",ov).call(this,de),this.stepState.update(de)}))}onStepChange(e,t){return n(this,void 0,void 0,(function*(){var i,o,s;const{htmlFilename:a,htmlLocaleFilename:d,direction:l,next:c,screenState:u,screenId:h}=e;this.loggerWrapper.debug("Rendering a flow screen"),this.updateScreenUser(null==u?void 0:u.user);const f=document.createElement("template");f.innerHTML=yield this.getPageContent(a,d);const p=f.content.cloneNode(!0),g=this.loadDescopeUiComponents(f);this.sdk.webauthn.helpers.isSupported()?yield r(this,Vg,"m",pv).call(this,p,c):(e=>{e.querySelectorAll(`descope-button[${_f}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(p),!e.samlIdpUsername||(null===(i=u.form)||void 0===i?void 0:i.loginId)||(null===(o=u.form)||void 0===o?void 0:o.email)||(u.form||(u.form={}),u.form.loginId=e.samlIdpUsername,u.form.email=e.samlIdpUsername),Np(p,u,this.formConfig,this.loggerWrapper),this.applyComponentsState(p,null==u?void 0:u.componentsState);const{geo:v}=null!==(s=yield this.getExecutionContext())&&void 0!==s?s:{};((e,t)=>{Object.entries({"default-code":"autoDetect","default-country":"autoDetect"}).forEach((([n,r])=>{Array.from(e.querySelectorAll(`[${n}="${r}"]`)).forEach((e=>{e.setAttribute(n,t||r)}))}))})(p,v),((e,t)=>{let n=t;if(t)try{const[e]=Intl.getCanonicalLocales(t);e&&(n=e)}catch(e){}Object.entries({lang:"autoDetect"}).forEach((([t,r])=>{Array.from(e.querySelectorAll(`[${t}="${r}"]`)).forEach((e=>{e.setAttribute(t,n||r)}))}))})(p,e.locale);const m=()=>n(this,void 0,void 0,(function*(){var n,i;yield g;const o=this.contentRootElement;((e,t)=>{Pp(e,"descope-totp-image",t)})(o,null===(n=null==u?void 0:u.totp)||void 0===n?void 0:n.image),((e,t)=>{Pp(e,"descope-notp-image",t)})(o,null===(i=null==u?void 0:u.notp)||void 0===i?void 0:i.image),((e,t,n,r)=>{n&&Object.keys(n).forEach((i=>{if(!t.querySelector(i))return void r.debug(`Skipping css vars for component "${i}"`,`Got css vars for component ${i} but Could not find it on next page`);const o=customElements.get(i);o?Object.keys(n[i]).forEach((t=>{var s;const a=n[i],d=null===(s=null==o?void 0:o.cssVarList)||void 0===s?void 0:s[t];if(!d)return void r.info(`Could not find css variable name for ${t} in ${i}`,"Check if the css variable is defined in the component");const l=a[t];e.style.setProperty(d,l)})):r.debug(`Could not find component class for ${i}`,"Check if the component is registered")}))})(o,p,u.cssVars,this.loggerWrapper),o.replaceChildren(p);const s=!t.htmlFilename;setTimeout((()=>{r(this,Vg,"m",bv).call(this),this.updateUsernameAnchor(),this.validateOnBlur&&(e=>{e.querySelectorAll("*[name]").forEach((t=>{t.addEventListener("blur",(()=>{var n;const r=()=>{var e;const n=t.focus;t.focus=()=>{},null===(e=t.reportValidity)||void 0===e||e.call(t),setTimeout((()=>{t.focus=n}))};if("true"===t.getAttribute("invalid")||(null===(n=t.value)||void 0===n?void 0:n.length))return void r();const i={timer:void 0},o=e=>{"true"===e.target.getAttribute("formnovalidate")&&(clearTimeout(i.timer),i.timer=void 0)};i.timer=setTimeout((()=>{e.removeEventListener("click",o),r(),i.timer=void 0}),150),e.addEventListener("click",o,{once:!0})}))}))})(o),((e,t)=>{Ip(e,null==t?void 0:t.inputs),Ip(e,null==t?void 0:t.form)})(o,u),this.initRealtimeConditions(o,u),r(this,Vg,"m",gv).call(this,{isFirstScreen:s,isCustomScreen:!1,stepName:e.stepName}),sp(o,this.autoFocus,s),r(this,Vg,"m",Iv).call(this,h)})),r(this,Vg,"m",Ov).call(this,c,h),o.querySelector(`[${_f}="polling"]`)&&c(Gf,{})}));l?r(this,Vg,"m",av).call(this,m):m()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${bf}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch(e){return!1}return!0}}Gg=new WeakMap,Kg=new WeakMap,zg=new WeakMap,Jg=new WeakMap,iv=new WeakMap,sv=new WeakMap,dv=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,hv=new WeakMap,$v=new WeakMap,Cv=new WeakMap,Vg=new WeakSet,Zg=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},Yg=function(e,t,i){return n(this,void 0,void 0,(function*(){var n;return(null===(n=this.nativeOptions)||void 0===n?void 0:n.bridgeVersion)>=2&&new Promise((n=>{this.nativeCallbacks.screenNext=i,this.nativeCallbacks.screenResolve=n,r(this,Vg,"m",Qg).call(this,"beforeScreen",{screen:e,context:t})}))}))},Xg=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&r(this,Vg,"m",Qg).call(this,"afterScreen",{screen:e})},Qg=function(e,t){r(this,Vg,"m",Ev).call(this,"bridge",{type:e,payload:t})},ev=function({errorText:e,errorType:t}){const n=()=>{var n;let r=e;try{r=(null===(n=this.errorTransformer)||void 0===n?void 0:n.call(this,{text:e,type:t}))||e}catch(e){this.loggerWrapper.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${_f}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(this.contentRootElement,"error-message",r)};this.addEventListener("screen-updated",n,{once:!0}),n()},tv=function(){var e,n,i;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var n=e.screenState,r=t(void 0===n?{}:n,["errorText","errorType"]),i=t(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:r})})),null===(n=this.stepState)||void 0===n||n.subscribe(r(this,Vg,"m",ev).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}),{forceUpdate:!0}),null===(i=this.stepState)||void 0===i||i.subscribe(r(this,Vg,"m",nv).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}),{forceUpdate:!0})},nv=function({errorText:e,errorType:t}){(t||e)&&(this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((e=>{e.shadowRoot.querySelectorAll("descope-text-field[data-id]").forEach((e=>{e.value=""}))})),sp(this.contentRootElement,this.autoFocus,!1))},rv=function(){return n(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Trying to restart the flow");const e=yield this.getComponentsVersion();this.reset(),e===(yield this.getComponentsVersion())?(this.loggerWrapper.debug("Components version was not changed, restarting flow"),this.flowState.update({stepId:null,executionId:null})):this.loggerWrapper.error("Components version mismatch, please reload the page")}))},ov=function(e){return n(this,void 0,void 0,(function*(){var n;const o=Object.assign(Object.assign({},this.stepState.current),e),{next:s,stepName:a}=o,d=(e=>{const t=(n=e.screenState,r=(e,t)=>Jf.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([e,t])=>!r(0,e)))));var n,r;const{screenState:{errorText:i,errorType:o}}=e;(i||o)&&(t.error={text:i,type:o}),e.action&&(t.action=e.action);const s=(e=>{if(!e)return;const t={};return pp.forEach((({key:n,from:r})=>{const i=r(e);void 0!==i&&(t[n]=i)})),Object.keys(t).length?t:void 0})(e.screenState);return s&&(t.data=s),t})(t(o,["next","stepName"]));let l=yield r(this,Vg,"m",Yg).call(this,a,d,s);l||(l=Boolean(yield null===(n=this.onScreenUpdate)||void 0===n?void 0:n.call(this,a,d,s,this)));const c=!this.stepState.current.htmlFilename;if(r(this,sv,"f").call(this,l),s&&(s.isCustomScreen=l),r(this,iv,"f")!==l){const[e,t]=["flow","custom"].sort((()=>l?-1:1));this.loggerWrapper.debug(`Switching from ${t} screen to ${e} screen`),i(this,iv,l,"f"),l?this.stepState.unsubscribeAll():r(this,Vg,"m",tv).call(this)}l?(this.loggerWrapper.debug("Showing a custom screen"),r(this,Vg,"m",gv).call(this,{isFirstScreen:c,isCustomScreen:l,stepName:e.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=l}))},av=function(e){this.contentRootElement.addEventListener("transitionend",(()=>{this.loggerWrapper.debug("page switch transition end"),this.contentRootElement.classList.remove("fade-out"),e()}),{once:!0}),this.loggerWrapper.debug("page switch transition start"),this.contentRootElement.classList.add("fade-out")},fv=function(e){const t=e.getAttribute("name");if(!["email"].includes(t)){const n=`user-${t}`;e.setAttribute("name",n),e.addEventListener("input",(()=>{e.setAttribute("name",e.value?t:n)}))}},pv=function(e,t){return n(this,void 0,void 0,(function*(){var o;null===(o=r(this,Kg,"f"))||void 0===o||o.abort();const s=e.querySelector('*[autocomplete="webauthn"]');if(s&&(yield jp())){const{options:e,transactionId:o}=(yield r(this,hv,"f").call(this))||{};e&&o&&(r(this,Vg,"m",fv).call(this,s),i(this,Kg,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,r(this,Kg,"f")).then((e=>n(this,void 0,void 0,(function*(){t(s.id,{transactionId:o,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},gv=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&r(this,Vg,"m",Ev).call(this,"ready",{}),t||r(this,Vg,"m",Xg).call(this,n),r(this,Vg,"m",Ev).call(this,"page-updated",{screenName:n}),r(this,Vg,"m",Ev).call(this,"screen-updated",{screenName:n})},vv=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,r;"slot"===t.localName||t.classList.contains("hidden")||(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(r=t.checkValidity)||void 0===r?void 0:r.call(t)))})),e},mv=function(){return n(this,void 0,void 0,(function*(){const e=this.getInputs();return(yield Promise.all(e.map((e=>n(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},yv=function(e){var t,o;const s=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((t=>t!==e)),a=(null===(o=null===(t=this.flowState.current)||void 0===t?void 0:t.screenState)||void 0===o?void 0:o.clientScripts)||[],d=()=>{e.removeAttribute("loading"),s.forEach((e=>{e.removeAttribute("disabled")}))},l=e=>n(this,void 0,void 0,(function*(){var t;if(this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",l),!0===(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.abandoned)&&a.length)return i(this,zg,(()=>n(this,void 0,void 0,(function*(){try{yield this.loadSdkScripts(a)}catch(e){this.loggerWrapper.warn("Failed to refresh client scripts on popup close",null==e?void 0:e.message)}})))(),"f"),void d();d();const r=yield this.getFlowConfig(),o=[...r.clientScripts||[],...r.sdkScripts||[]];this.loadSdkScripts(o)})),c=()=>{var e;window.removeEventListener("pageshow",r(this,$v,"f")),i(this,$v,(e=>{e.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),l())}),"f"),window.addEventListener("pageshow",r(this,$v,"f"),{once:!0});const t=null===(e=this.stepState)||void 0===e?void 0:e.subscribe(((e,n)=>{e===n&&l(),this.removeEventListener("popupclosed",l),this.stepState.unsubscribe(t)}),(e=>e.screenId),{forceUpdate:!0})},u=this.nextRequestStatus.subscribe((({isLoading:t})=>{t?(this.addEventListener("popupclosed",l,{once:!0}),e.setAttribute("loading","true"),s.forEach((e=>e.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(u),"success"===this.flowStatus?(this.removeEventListener("popupclosed",l),d()):c())}))},bv=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>r(this,Vg,"m",wv).call(this,e)))},wv=function(e){e&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),r=`input-${e.id}-${n}`,i=document.createElement("slot");i.setAttribute("name",r),i.setAttribute("slot",n),e.appendChild(i),t.setAttribute("slot",r),this.appendChild(t)}))},kv=function(e){return n(this,void 0,void 0,(function*(){if(r(this,zg,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield r(this,zg,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const t=this.loadSdkScriptsModules(),n=e.map((e=>e.id));for(const e of t)if(n.includes(e.id))try{"function"==typeof e.present&&((yield e.present())||this.loggerWrapper.debug(`Sdk script ${e.id} was cancelled`))}catch(t){this.loggerWrapper.error(`Failed to present ${e.id} script module`,t.message)}const i=[];for(const e of t)"function"==typeof e.refresh&&i.push(e.refresh());if(i.length>0)try{yield ap(5e3,Promise.all(i),null)}catch(e){this.loggerWrapper.error("Failed to refresh script module",e.message)}}))},Sv=function(e,t){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((n=>{n.addEventListener("input",(()=>{var i;(null===(i=n.checkValidity)||void 0===i?void 0:i.call(n))&&r(this,Cv,"f").call(this,n,e,t)}))}))},xv=function(e,t,n){t&&n&&"true"===e.getAttribute("data-opt-in-last-used-auth")&&function(e,t,n){try{const n=Dp();n[e]=t,Tp(zf,JSON.stringify(n))}catch(e){null==n||n.warn("[Descope] Failed to update in-flight last auth storage",String(e))}}(n,t,this.loggerWrapper)},Iv=function(e){var t;const n=null===(t=_p(this.sdk.getLastUserLoginId(),this.loggerWrapper).lastUsedPerScreen)||void 0===t?void 0:t[e];if(!n)return;const r=this.contentRootElement.querySelector('descope-attachment[data-type="last-auth-badge"]'),i=this.contentRootElement.querySelector(`#${CSS.escape(n)}`);r&&i&&(i.replaceWith(r),r.appendChild(i))},Ov=function(e,t){this.contentRootElement.querySelectorAll(`descope-button:not([${wf}]), [data-type="button"]:not([${wf}]`).forEach((n=>{n.onclick=()=>{r(this,Cv,"f").call(this,n,e,t)}})),r(this,Vg,"m",Sv).call(this,e,t),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${bf}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},Ev=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},Av=function(e,t,n){var r;const[i,o]=(null===(r=window.name)||void 0===r?void 0:r.split("|"))||[],s={data:{code:t,exchangeError:n},action:"code"};if("descope-wc"===i&&o){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",o);try{window.opener.postMessage(s,o)}catch(e){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",null==e?void 0:e.message)}}else{this.loggerWrapper.debug("Creating popup channel",e);const t=new BroadcastChannel(e);t.postMessage(s),t.close()}try{window.close()}catch(e){}},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",Pv);var Nv=Object.freeze({__proto__:null,default:Pv});const jv=(e,t,n,r={})=>{var i,o,s,a;return[Math.min(Math.max(t,("all"===r.left?e.offsetWidth:null!==(i=r.left)&&void 0!==i?i:0)-e.offsetWidth),window.innerWidth-("all"===r.right?e.offsetWidth:null!==(o=r.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===r.top?e.offsetHeight:null!==(s=r.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===r.bottom?e.offsetHeight:null!==(a=r.bottom)&&void 0!==a?a:0))]},Rv=(e,t,n)=>{let r=0,i=0,o=0,s=0;function a(t){t.preventDefault(),r=o-t.clientX,i=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=jv(e,e.offsetLeft-r,e.offsetTop-i,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l};var Tv,Mv,Uv,Lv,_v,Wv,Dv,Fv,qv,Bv,Hv;const Vv=document.createElement("template");Vv.innerHTML='\n<div class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n';const Gv=o(J)(HTMLElement);class Kv extends Gv{constructor(){super(),Tv.add(this),Mv.set(this,new Cp({messages:[]})),Uv.set(this,void 0),Lv.set(this,void 0),_v.set(this,void 0),Wv.set(this,{resize:r(this,Tv,"m",Hv).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Vv.content.cloneNode(!0)),i(this,Uv,this.shadowRoot.querySelector(".debugger"),"f"),i(this,Lv,r(this,Uv,"f").querySelector(".content"),"f"),i(this,_v,r(this,Uv,"f").querySelector(".header"),"f"),r(this,Tv,"m",Dv).call(this)}updateData(e){r(this,Mv,"f").update((t=>({messages:t.messages.concat(e)})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;null===(t=e.init)||void 0===t||t.call(this),Rv(r(this,Uv,"f"),r(this,_v,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",r(this,Wv,"f").resize),(e=>{e.onmousemove=t=>{(t.target.w&&t.target.w!==t.target.offsetWidth||t.target.h&&t.target.h!==t.target.offsetHeight)&&e.onresize(t),t.target.w=t.target.offsetWidth,t.target.h=t.target.offsetHeight}})(r(this,Uv,"f")),r(this,Uv,"f").onresize=r(this,Tv,"m",Bv).bind(this),r(this,Mv,"f").subscribe(r(this,Tv,"m",Fv).bind(this))}))}disconnectedCallback(){r(this,Mv,"f").unsubscribeAll(),window.removeEventListener("resize",r(this,Wv,"f").resize)}}Mv=new WeakMap,Uv=new WeakMap,Lv=new WeakMap,_v=new WeakMap,Wv=new WeakMap,Tv=new WeakSet,Dv=function(){this.injectStyle('\n .debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),r(this,Uv,"f").style.top="32px",r(this,Uv,"f").style.left=window.innerWidth-300-32+"px"},Fv=function(e){r(this,Tv,"m",qv).call(this,e),r(this,Tv,"m",Bv).call(this)},qv=function(e){r(this,Lv,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},Bv=function(){r(this,Lv,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,r=t.clientHeight>20;n||r?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},Hv=function(){const[e,t]=jv(r(this,Uv,"f"),Number.parseInt(r(this,Uv,"f").style.left,10),Number.parseInt(r(this,Uv,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});r(this,Uv,"f").style.top=`${t}px`,r(this,Uv,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Kv);var zv=Object.freeze({__proto__:null,default:Kv});return Kh}();
5
+ this["descope-user-management-widget"]=function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function n(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{d(r.next(e))}catch(e){o(e)}}function a(e){try{d(r.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((r=r.apply(e,t||[])).next())}))}function r(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function i(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function o(...e){return t=>e.reduce(((e,t)=>t(e)),t)}"function"==typeof SuppressedError&&SuppressedError;const s=e=>{const t=document.createElement("template");return t.innerHTML=e,t},a=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),d=e=>{let t,n;return(...r)=>(t&&a(t,r)||(t=r,n=e(...r)),n)},l=e=>(t,...n)=>t.reduce(((t,r,i)=>{var o;return`${t}${r}${(null===(o=null==n?void 0:n[i])||void 0===o?void 0:o[e>1?1:0])||""}`}),""),c=(e,t=500)=>{let n;return function(...r){clearTimeout(n),n=setTimeout((()=>e.apply(this,r)),t)}},u=(e={})=>{const t=s("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),(e=>"string"==typeof e?e:(e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype)(e)?JSON.stringify(e):"")(n))})),t},h=e=>{const t=Symbol((e=>{const t=e.toString();let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return n.toString(16)})(e));return n=>{if(n[t])return n;const r=e(n);return r[t]=!0,r}};var f,p,g,v;function m(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const i=n[r],o=e[i],s=t[i];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!m(o,s))return!1}else if(o!==s)return!1}return!0}let $=class{constructor(e={},{forceUpdate:t=!1}={}){f.set(this,void 0),p.set(this,{}),g.set(this,0),v.set(this,!0),this.update=e=>{const t="function"==typeof e?e(r(this,f,"f")):e,n=Object.assign(Object.assign({},r(this,f,"f")),t);if(r(this,v,"f")||!m(r(this,f,"f"),n)){const e=r(this,f,"f");i(this,f,n,"f"),Object.freeze(r(this,f,"f")),setTimeout((()=>{Object.values(r(this,p,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},i(this,f,e,"f"),i(this,v,t,"f")}get current(){return Object.assign({},r(this,f,"f"))}subscribe(e){return i(this,g,r(this,g,"f")+1,"f"),r(this,p,"f")[r(this,g,"f")]=e,r(this,g,"f").toString()}unsubscribe(e){const t=!!r(this,p,"f")[e];return t&&delete r(this,p,"f")[e],t}unsubscribeAll(){return i(this,p,{},"f"),!0}};function y(e){if(e)return{locale:e.toLowerCase(),fallback:e.toLowerCase()};const t=navigator.language;return t?t.includes("-")?{locale:t.toLowerCase(),fallback:t.split("-")[0].toLowerCase()}:{locale:t.toLowerCase(),fallback:t.toLowerCase()}:{locale:"",fallback:""}}f=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakMap;const b=["error","warn","info","debug"],w={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},C=h((e=>{var t,n,o,s;return s=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,r(this,t,"m",o).call(this,w))}set logger(e){i(this,n,r(this,t,"m",o).call(this,e||w),"f")}get logger(){return r(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return b.reduce(((t,n)=>(t[n]=(...t)=>{var r;this.onLogEvent(n,t),null===(r=e[n])||void 0===r||r.call(e,...t)},t)),{})},s})),k="undefined"!=typeof localStorage,S="https://static.descope.com/pages",x="https://static2.descope.com/pages",I=k&&localStorage.getItem("base.content.url")||"",O=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,E=h((e=>{var t,n;return n=class extends e{constructor(){super(...arguments),t.set(this,!0)}connectedCallback(){var e,n;null===(e=super.connectedCallback)||void 0===e||e.call(this),(null===(n=this.shadowRoot)||void 0===n?void 0:n.isConnected)&&r(this,t,"f")&&(i(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),A=h((e=>{var t,n;const i=o(C,E)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,i;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,i=e=>{var n;null===(n=r(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>i(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&i(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){r(this,t,"f")[e]||(r(this,t,"f")[e]=[]);const i=r(this,t,"f")[e].push(n);return()=>r(this,t,"f")[e].splice(i,1)}observeAttributes(e,t){const n=e.reduce(((e,n)=>(e.push(this.observeAttribute(n,t)),e)),[]);return()=>n.forEach((e=>e()))}},t=new WeakMap,n})),P=e=>t=>{var n,i,s;const a=o(C,E,A)(t),d=Object.keys(e);return s=class extends a{constructor(...e){super(...e),n.add(this),this.observeAttributes(d,r(this,n,"m",i).bind(this))}async init(){var e;d.forEach((e=>r(this,n,"m",i).call(this,e,this.getAttribute(e)))),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},n=new WeakSet,i=function(t,n){const r=e[t],i="function"==typeof r?r(t,n):r;i&&this.logger.error(i)},s};P.missingAttrValidator=O;const N=h((e=>{const t=o(P({"project-id":O}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),j=h((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),R="Trying the next fallback URL...",T=async(e,t,{logger:n}={})=>{try{return await fetch(e,t)}catch(r){return null==n||n.debug(`Network error fetching URL ${e} [${r.message}], retrying...`),fetch(e,t)}};const M=h((e=>{var t,n,s,a,d,l,c;const u=o(C,N,j)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,new Set)}async fetchStaticResource(e,n){const o=r(this,t,"m",d).call(this,e),l=Array.isArray(o)?e=>{const{baseUrl:t}=o[e];i(this,s,t,"f");for(let t=0;t<e;t++){const e=o[t].baseUrl;r(this,a,"f").add(e)}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:r}={})=>{const i=Array.isArray(e)?e:[e];for(let e=0;e<i.length;e++){const o=i[e],s=e===i.length-1;try{const i=await T(o.toString(),t,{logger:n});if(i.ok)return null==r||r(e),null==n||n.debug(`Successfully fetched URL ${o}`),i;const a=`Error fetching URL ${o} [${i.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${R}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${R}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:l});return{body:await e[n](),headers:Object.fromEntries(e.headers.entries())}}catch(e){this.logger.error(e.message)}}get baseStaticUrl(){return this.getAttribute("base-static-url")||""}},n=new WeakMap,s=new WeakMap,a=new WeakMap,t=new WeakSet,d=function(e){const o=I||this.baseStaticUrl;if(o)return r(this,t,"m",l).call(this,e,o);r(this,n,"f")!==this.baseUrl&&(i(this,n,this.baseUrl,"f"),i(this,s,void 0,"f"),r(this,a,"f").clear());const d=[];if(r(this,s,"f"))d.push(r(this,t,"m",l).call(this,e,r(this,s,"f"))),r(this,s,"f")===S&&d.push(r(this,t,"m",l).call(this,e,x));else{const n=this.baseUrl+"/pages";this.baseUrl&&!r(this,a,"f").has(n)&&d.push(r(this,t,"m",l).call(this,e,n)),r(this,a,"f").has(S)||d.push(r(this,t,"m",l).call(this,e,S)),d.push(r(this,t,"m",l).call(this,e,x))}return 1===d.length?d[0]:d},l=function(e,t){return function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:r=S}){const i=new URL(r);return i.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(i.pathname,e,n,t),i.baseUrl=r,i}({projectId:this.projectId,filename:e,baseUrl:t})},c})),U=h((e=>{var t,n;const i=o(P({"project-id":O}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return r(this,t,"f").set(e,n),()=>{r(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(r(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!r(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=r(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),L=h((e=>{var t,n,s,a,d;const l=o(M,U,E)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.set(this,(async()=>{try{const{body:e,headers:t}=await this.fetchStaticResource("config.json","json");return{projectConfig:e,executionContext:{geo:t["x-geo"]}}}catch(e){this.logger.error("Cannot fetch config file","make sure that your projectId & flowId are correct")}}))}async init(){await super.init(),this.onReset("config",r(this,t,"m",n).bind(this))}get config(){return r(this,s,"f")||i(this,s,r(this,a,"f").call(this),"f"),r(this,s,"f")}},s=new WeakMap,a=new WeakMap,t=new WeakSet,n=function(){i(this,s,void 0,"f")},d})),_=h((e=>{var t,n,s,a,d,l,c;return c=class extends(o(E,C)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,i),"debug"===e&&r(this,t,"m",d).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var i;null===(i=super.onLogEvent)||void 0===i||i.call(this,e,n),"error"===e&&r(this,t,"m",l).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),r(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){var e;null===(e=r(this,n,"f"))||void 0===e||e.remove(),i(this,n,null,"f")},a=async function(){i(this,n,document.createElement("descope-debugger"),"f"),Object.assign(r(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Ef})),document.body.appendChild(r(this,n,"f"))},d=function(){this.debug?r(this,t,"m",a).call(this):r(this,t,"m",s).call(this)},l=function(e,t){var i;e&&(null===(i=r(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},c})),W=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],F=e=>{let t=0;const n=e.toString();for(let e=0;e<n.length;e++){t=(t<<5)-t+n.charCodeAt(e),t|=0}return`${Math.abs(t).toString()}`},D=(e,t,n)=>new Promise(((r,i)=>{const o=((e,t)=>{const n=document.createElement("script");return n.id=e,t&&(n.integrity=t,n.crossOrigin="anonymous"),window.DESCOPE_NONCE&&n.setAttribute("nonce",window.DESCOPE_NONCE),n})(e,n);o.onerror=e=>{o.setAttribute("status","error"),i(e)},o.onload=()=>{o.setAttribute("status","loaded"),r(o)},o.src=t.toString(),document.body.appendChild(o)})),q=(e,t)=>{if(t){const n=e.integrity;if(n!==t)return Promise.reject(new Error(`Integrity mismatch: expected ${t}, found ${n}`))}return"loaded"===e.getAttribute("status")?Promise.resolve(e):(e=>"error"===e.getAttribute("status"))(e)?Promise.reject():new Promise(((t,n)=>{e.addEventListener("load",(()=>{t(e)})),e.addEventListener("error",(e=>{n(e)}))}))},B=h((e=>{const t=o(C)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(e,t,n="",r=[],i){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"${i?" with SRI integrity check":""}`),(async(e,t)=>{for(const r of e){const{id:e,url:i,integrity:o}=r,s=(n=e,document.querySelector(`script#${n}`));if(s)try{return await q(s,o),r}catch(e){t(r,!0)}else try{return await D(e,i,o),r}catch(e){t(r,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,r="",i)=>e.reduce(((e,o)=>{const s=o;if(!s)return e;let a;try{a=new URL(s)}catch(e){throw new Error(`Invalid URL: ${s}`)}"/"!==a.pathname||(a.pathname=`/npm/${t}@${n}/${r}`);const d={url:a,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${F(a)}`};return i&&(d.integrity=i),[...e,d]}),[]))([...r,this.baseCdnUrl,...W],e,t,n,i),((e,t)=>{t?this.logger.error(`Existing script cannot be loaded: "${e.url}"`):this.logger.error(`Cannot load script from URL, Make sure this URL is valid and return the correct script: "${e.url}"`)}))}}})),H="base.ui.components.url",V=k&&localStorage.getItem(H),G=h((e=>{var t,n,s,a,d,l,c;const u=o(C,L,B)(e);return c=class extends u{constructor(){super(...arguments),t.add(this),a.set(this,void 0)}get descopeUi(){return r(this,a,"f")||i(this,a,r(this,t,"m",l).call(this),"f"),r(this,a,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>r(this,t,"m",d).call(this,e))))}},a=new WeakMap,t=new WeakSet,n=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},s=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersionSri;return n&&this.logger.debug("SRI hash available for components"),n},d=async function(e){if(!!customElements.get(e))return void this.logger.debug(`Loading component "${e}" is skipped as it is already defined`);const t=await this.descopeUi;if(t[e])try{return await t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`Encountered an error while attempting to define the "${e}" component, it is likely that this component is already defined`)}else this.logger.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)},l=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const e=await r(this,t,"m",n).call(this),i=V?void 0:await r(this,t,"m",s).call(this);return await this.injectNpmLib("@descope/web-components-ui",e,"dist/umd/index.js",[V],i),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},c})),K=h((e=>{var t,n,i;const s=o(E,A)(e);return i=class extends s{constructor(){super(...arguments),t.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.observeAttribute("nonce",r(this,t,"m",n).bind(this)),r(this,t,"m",n).call(this)}},t=new WeakSet,n=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},i}));class z{constructor(e,t,{prepend:n=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(n?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return null===(e=this.styleEle.sheet)||void 0===e?void 0:e.cssRules}}const J=h((e=>{const t=o(K)(e);return class extends t{injectStyle(e,{prepend:t=!1}={}){let n;try{n=new CSSStyleSheet}catch(e){n=new z(this.shadowRoot,this.nonce,{prepend:t})}if(e&&n.replaceSync(e),n instanceof CSSStyleSheet){const e=this.shadowRoot;if(e&&"adoptedStyleSheets"in e){const r=[...e.adoptedStyleSheets||[]];r[t?"unshift":"push"](n),e.adoptedStyleSheets=r}}return n}}})),Z="content-root",Y="root",X=h((e=>{const t=o(J)(e);return class extends t{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${Y}">\n <div id="${Z}"></div>\n </div>\n `,this.injectStyle(`\n #${Y}, #${Z} {\n height: 100%;\n }\n #${Y} {\n position: relative;\n height: fit-content;\n }\n `),this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Z),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Y)}}})),Q="descope-modal";var ee,te,ne;let re=class{constructor(e,t){ee.set(this,void 0),this.nodeName="",i(this,ee,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>new Promise((t=>{const n=setInterval((()=>{const r="function"==typeof e?e():e;r&&(clearInterval(n),t(r))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(r(this,ee,"f"))}get ele(){var e,t;const n="function"==typeof r(this,ee,"f")?r(this,ee,"f").call(this):r(this,ee,"f");return n?(null==n?void 0:n.localName)!==this.nodeName?(null===(t=this.logger)||void 0===t||t.debug(`node name do not match, expected "${this.nodeName}", received "${n.localName}" `,Error()),null):n:(null===(e=this.logger)||void 0===e||e.debug(`Driver element is not available for ${this.nodeName}`,new Error),null)}get isExists(){return!!this.ele}};ee=new WeakMap;let ie=class extends re{constructor(){super(...arguments),this.nodeName="descope-filter",te.set(this,null)}get data(){var e;try{return JSON.parse((null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data"))||"[]")}catch(e){return[]}}set data(e){var t,n;i(this,te,JSON.stringify(e),"f"),r(this,te,"f")!==(null===(t=this.ele)||void 0===t?void 0:t.getAttribute("data"))&&(null===(n=this.ele)||void 0===n||n.setAttribute("data",r(this,te,"f")))}get value(){var e;try{return JSON.parse((null===(e=this.ele)||void 0===e?void 0:e.getAttribute("value"))||"[]")}catch(e){return[]}}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",JSON.stringify(e))}onApply(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("filter-apply",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("filter-apply",n)}}onClear(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("filter-clear",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("filter-clear",n)}}onDataChange(e){const t=this.ele;if(!t)return()=>{};const n=new MutationObserver((()=>{var n;(null!==(n=t.getAttribute("data"))&&void 0!==n?n:"[]")!==r(this,te,"f")&&e()}));return n.observe(t,{attributes:!0,attributeFilter:["data"]}),()=>n.disconnect()}};te=new WeakMap;let oe=class extends re{constructor(){super(...arguments),this.nodeName="descope-button"}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}},se=class extends re{constructor(){super(...arguments),this.nodeName="descope-wc"}set projectId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("project-id",e)}set baseUrl(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("base-url",e)}set flowId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("flow-id",e)}set theme(e){var t,n;e?null===(n=this.ele)||void 0===n||n.setAttribute("theme",e):null===(t=this.ele)||void 0===t||t.removeAttribute("theme")}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}onPageUpdated(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("page-updated",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("page-updated",e)}}},ae=class extends oe{get flowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id"))||""}get enableMode(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("enable-mode")}};const de=/^descope-grid-([^-]+)-column$/,le={text:class extends re{constructor(){super(...arguments),this.nodeName="descope-grid-text-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}},custom:class extends re{constructor(){super(...arguments),this.nodeName="descope-grid-custom-column"}onSortDirectionChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("direction-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}}};let ce=class extends re{constructor(){super(...arguments),this.nodeName="descope-grid",ne.set(this,void 0)}onSelectedItemsChange(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("selected-items-changed",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("selected-items-changed",e)}}get ele(){return super.ele}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}set data(e){this.ele&&(this.ele.data=e)}get columns(){return this.ele?Array.from(this.ele.children).reduce(((e,t)=>{var n;const r=null===(n=de.exec(t.localName))||void 0===n?void 0:n[1],i=le[r];return i?(e.push(new i(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const i=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);i&&this.ele.columns&&(a(i,this.ele.columns)||(this.ele.columns=i,null===(n=r(this,ne,"f"))||void 0===n||n.call(this,i)))}onColumnsChange(e){i(this,ne,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};var ue,he,fe,pe;ne=new WeakMap;let ge=class extends re{constructor(...e){super(...e),ue.add(this),he.set(this,void 0),fe.set(this,void 0),this.nodeName="descope-modal",r(this,ue,"m",pe).call(this)}get isOpen(){var e;return"true"===(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("opened"))}get isClosed(){return!this.isOpen}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),r(this,ue,"m",pe).call(this),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),r(this,he,"f")&&(null===(e=this.ele)||void 0===e||e.append(r(this,he,"f").content.cloneNode(!0)))}setContent(e){i(this,he,e,"f"),this.reset()}remove(){var e,t;null===(e=r(this,fe,"f"))||void 0===e||e.disconnect(),null===(t=this.ele)||void 0===t||t.remove()}};he=new WeakMap,fe=new WeakMap,ue=new WeakSet,pe=function(){if(r(this,fe,"f"))return;const e=this.ele;e&&(i(this,fe,new MutationObserver((t=>{t.forEach(((n,r)=>{var i;const o="true"===n.oldValue,s=t[r+1]?t[r+1].oldValue:e.getAttribute("opened");o&&"true"!==s&&(null===(i=this.afterClose)||void 0===i||i.call(this))}))})),"f"),r(this,fe,"f").observe(e,{attributes:!0,attributeFilter:["opened"],attributeOldValue:!0}))};let ve=class extends re{constructor(){super(...arguments),this.nodeName="descope-multi-line-mappings"}setData(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("data",JSON.stringify(e))}get value(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.value)||[]}set value(e){this.ele&&(this.ele.value=e)}get mergedValue(){return Object.entries(this.value.filter((({tenantId:e})=>!!e)).reduce(((e,{tenantId:t,roleNames:n})=>(e[t]=[...new Set([...e[t]||[],...n])],e)),{})).map((([e,t])=>({tenantId:e,roleNames:t})))}},me=class extends re{constructor(){super(...arguments),this.nodeName="descope-multi-select-combo-box"}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}},$e=class extends re{constructor(){super(...arguments),this.nodeName="descope-notification"}close(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("opened")}show(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("opened","true")}setContent(e){this.ele.innerHTML="",this.ele.appendChild(e.content.cloneNode(!0))}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}},ye=class extends re{constructor(){super(...arguments),this.nodeName="descope-text"}get ele(){return super.ele}get text(){var e;return null===(e=this.ele)||void 0===e?void 0:e.innerText}set text(e){this.ele&&(this.ele.innerText=e)}},be=class extends re{constructor(){super(...arguments),this.nodeName="descope-text-field"}onInput(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("input",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("input",e)}}get value(){var e;return null===(e=this.ele)||void 0===e?void 0:e.value}set value(e){this.ele&&(this.ele.value=e)}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}};const we=h((e=>{var t,n;const i=o(E,X,G)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ge{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Q);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Q]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Ce="descope-notification",ke=h((e=>{var t,n;const i=o(E,X,G)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends $e{setContent(t){const n="string"==typeof t?s(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Ce);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(r(this,t,"f"))(n,{logger:this.logger})}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.loadDescopeUiComponents([Ce])}},t=new WeakMap,n})),Se="theme",xe=(e,t,n="")=>Object.entries(e).reduce(((e,[r,i])=>{if(!/^[a-zA-Z0-9-]+$/.test(r))return t("Ignoring invalid override-css token path segment"),e;const o=n?`${n}-${r}`:r;if("object"==typeof i&&null!==i)return e+xe(i,t,o);const s=(e=>"number"==typeof e?Number.isFinite(e)?String(e):null:"string"!=typeof e||/[;{}]/.test(e)?null:e.trim())(i);return null===s?(t("Ignoring invalid override-css token value"),e):`${e}--descope-${o}:${s};`}),"");function Ie(e,t){const n=Object.assign({},e);for(const[e,r]of Object.entries(t||{}))if(null!=r)if("object"==typeof r){if(0===Object.keys(r).length)continue;n[e]=Ie(n[e]||{},r)}else n[e]="string"==typeof r?(n[e]||"")+r:r;return n}const Oe=(e,t)=>null!==t&&!/^[a-zA-Z0-9_-]*$/.test(t)&&"tenant must contain only alphanumeric characters, hyphens, or underscores",Ee=h((e=>{const t=o(P({tenant:Oe}))(e);return class extends t{get tenantId(){return this.getAttribute("tenant")||void 0}}})),Ae=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Pe=h((e=>{var t,n,s,a,d,l,c,u,h,f,p,g,v,m,$,y,b,w,C,k,S,x;const I=o(P({theme:Ae}),Ee,M,E,G,L,X,A,J)(e);return x=class extends I{constructor(){super(...arguments),t.add(this),n.set(this,void 0),s.set(this,void 0),a.set(this,void 0),l.set(this,void 0),c.set(this,void 0),C.set(this,(()=>{r(this,t,"m",k).call(this),r(this,S,"f").call(this,"os"===this.getAttribute("theme"))})),S.set(this,(e=>{var n,i,o;const s=e?"addEventListener":"removeEventListener";null===(o=null===(i=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===i?void 0:i[s])||void 0===o||o.call(i,"change",(()=>r(this,t,"m",k).call(this)))}))}get theme(){var e,t;const n=this.getAttribute("theme");if("os"===n){return window.matchMedia&&(null===(t=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)"))||void 0===t?void 0:t.matches)?"dark":"light"}return n||"light"}get styleId(){return this.getAttribute("style-id")||Se}get themeOverride(){const e=this.getAttribute("theme-override");if(!e)return null;try{return JSON.parse(e)}catch(e){return this.logger.error("Failed to parse theme-override attribute. error: ",e),null}}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),r(this,C,"f").call(this),await Promise.all([r(this,t,"m",f).call(this),r(this,t,"m",v).call(this),r(this,t,"m",$).call(this)]),r(this,t,"m",m).call(this),this.observeAttributes(["theme"],r(this,C,"f")),this.observeAttributes(["theme-override"],(()=>r(this,t,"m",m).call(this))),this.observeAttributes(["tenant"],(()=>{i(this,c,null,"f"),r(this,t,"m",v).call(this),r(this,t,"m",$).call(this)})),this.observeAttributes(["style-id"],(()=>{i(this,l,null,"f"),r(this,t,"m",b).call(this),r(this,t,"m",f).call(this),r(this,t,"m",$).call(this)}))}},n=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,C=new WeakMap,S=new WeakMap,t=new WeakSet,d=function(){const e=this.themeOverride;return e?["light","dark"].map((t=>{var n,r,i,o,s,a;const d=null===(i=null===(r=null===(n=e[t])||void 0===n?void 0:n.globals)||void 0===r?void 0:r.colors)||void 0===i?void 0:i.primary,l=null===(a=null===(s=null===(o=e[t])||void 0===o?void 0:o.globals)||void 0===s?void 0:s.colors)||void 0===a?void 0:a.secondary;return d||l?`[data-theme="${t}"]{${xe({colors:{primary:d,secondary:l}},(e=>this.logger.error(e)))}}`:""})).join(""):""},u=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(H))try{this.logger.warn("You are in DEV mode, and UI components override URL was found\ntrying to merge project theme with the default theme of the UI components");const t=await(async()=>{const e=localStorage.getItem(H),t=null==e?void 0:e.replace(/[^\/]+$/,"DescopeDev.js");console.warn("Trying to load DescopeDev.js from",t);const n=document.createElement("script");if(n.src=t,document.body.appendChild(n),await new Promise(((e,t)=>{n.onload=e,n.onerror=t})),globalThis.DescopeDev){const{themeToStyle:e,defaultTheme:t,darkTheme:n}=globalThis.DescopeDev;return{light:e(t),dark:e(n)}}})();t&&(e.light.components=Object.assign(Object.assign({},e.light.components),t.light.components),e.dark.components=Object.assign(Object.assign({},e.dark.components),t.dark.components),this.logger.warn("Theme was merged successfully"),console.log("%cNOTICE! This is not the theme that will be used in production!\n\nMake sure to test it without the override UI components URL!","color: black; background-color:yellow; font-size: x-large"))}catch(e){this.logger.error("Failed to merge UI components theme\n",e)}return e}catch(e){this.logger.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}},h=function(){return r(this,l,"f")||(i(this,l,r(this,t,"m",u).call(this),"f"),r(this,l,"f").then((e=>this.logger.debug("Fetched theme",e)))),r(this,l,"f")},f=async function(){var e,o;const s=await r(this,t,"a",h);if(!s)return;const a=((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.globals)||"")+((null===(o=null==s?void 0:s.dark)||void 0===o?void 0:o.globals)||"");r(this,n,"f")?r(this,n,"f").replaceSync(a):i(this,n,this.injectStyle(a,{prepend:!0}),"f")},p=async function(){const e=this.tenantId;if(e)try{const{body:t}=await this.fetchStaticResource(`${e}/theme.json`,"json");return t}catch(e){this.logger.warn("No tenant style exists, using project default theme.")}},g=function(){return r(this,c,"f")||i(this,c,r(this,t,"m",p).call(this),"f"),r(this,c,"f")},v=async function(){var e,n,o,a;if(!this.tenantId)return void(null===(e=r(this,s,"f"))||void 0===e||e.replaceSync(""));const d=await r(this,t,"a",g);if(!d)return void(null===(n=r(this,s,"f"))||void 0===n||n.replaceSync(""));const l=((null===(o=d.light)||void 0===o?void 0:o.globals)||"")+((null===(a=d.dark)||void 0===a?void 0:a.globals)||"");r(this,s,"f")?r(this,s,"f").replaceSync(l):i(this,s,this.injectStyle(l),"f")},m=async function(){var e;if(!this.themeOverride)return void(null===(e=r(this,a,"f"))||void 0===e||e.replaceSync(""));const n=r(this,t,"m",d).call(this);r(this,a,"f")?r(this,a,"f").replaceSync(n):i(this,a,this.injectStyle(n),"f")},$=async function(){var e,n,i,o;const s=await r(this,t,"a",h);if(!s)return;const a=await this.descopeUi;if(!(null==a?void 0:a.componentsThemeManager))return;const d=await r(this,t,"a",g);a.componentsThemeManager.themes={light:Ie((null===(e=null==s?void 0:s.light)||void 0===e?void 0:e.components)||{},(null===(n=null==d?void 0:d.light)||void 0===n?void 0:n.components)||{}),dark:Ie((null===(i=null==s?void 0:s.dark)||void 0===i?void 0:i.components)||{},(null===(o=null==d?void 0:d.dark)||void 0===o?void 0:o.components)||{})}},y=async function(){var e,t;const{projectConfig:n}=await this.config||{},r=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],i=null==n?void 0:n.cssTemplate,o=r||i;return null===(t=null==o?void 0:o[this.theme])||void 0===t?void 0:t.fonts},b=async function(){const e=await r(this,t,"m",y).call(this);e?Object.values(e).forEach((e=>{e.url&&(this.logger.debug(`Loading font from URL "${e.url}"`),(e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url))})):this.logger.debug("No fonts to load")},w=async function(){this.rootElement.setAttribute("data-theme",this.theme);const e=await this.descopeUi;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)},k=function(){r(this,t,"m",b).call(this),r(this,t,"m",w).call(this)},x}));var Ne=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),je=()=>Math.random().toString(36).substring(7).split("").join("."),Re={INIT:`@@redux/INIT${je()}`,REPLACE:`@@redux/REPLACE${je()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${je()}`};function Te(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Me(e){if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";const n=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function Ue(e){let t=typeof e;return t=Me(e),t}function Le(e,t,n){if("function"!=typeof e)throw new Error(`Expected the root reducer to be a function. Instead, received: '${Ue(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(`Expected the enhancer to be a function. Instead, received: '${Ue(n)}'`);return n(Le)(e,t)}let r=e,i=t,o=new Map,s=o,a=0,d=!1;function l(){s===o&&(s=new Map,o.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function u(e){if("function"!=typeof e)throw new Error(`Expected the listener to be a function. Instead, received: '${Ue(e)}'`);if(d)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let t=!0;l();const n=a++;return s.set(n,e),function(){if(t){if(d)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,l(),s.delete(n),o=null}}}function h(e){if(!Te(e))throw new Error(`Actions must be plain objects. Instead, the actual type was: '${Ue(e)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if("string"!=typeof e.type)throw new Error(`Action "type" property must be a string. Instead, the actual type was: '${Ue(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,i=r(i,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Re.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(`Expected the nextReducer to be a function. Instead, received: '${Ue(e)}`);r=e,h({type:Re.REPLACE})},[Ne]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(`Expected the observer to be an object. Instead, received: '${Ue(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Ne](){return this}}}}}function _e(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function We(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];void 0===e[i]&&_e(`No reducer provided for key "${i}"`),"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i,o;i={};try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Re.INIT}))throw new Error(`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(void 0===n(void 0,{type:Re.PROBE_UNKNOWN_ACTION()}))throw new Error(`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Re.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;{const r=function(e,t,n,r){const i=Object.keys(t),o=n&&n.type===Re.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===i.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Te(e))return`The ${o} has unexpected type of "${Ue(e)}". Expected argument to be an object with the following keys: "${i.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!r[e]));return s.forEach((e=>{r[e]=!0})),n&&n.type===Re.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${o}. Expected to find one of the known reducer keys instead: "${i.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,i);r&&_e(r)}let s=!1;const a={};for(let i=0;i<r.length;i++){const o=r[i],d=n[o],l=e[o],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error(`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${o}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}a[o]=c,s=s||c!==l}return s=s||r.length!==Object.keys(e).length,s?a:e}}function Fe(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function De(e){return Te(e)&&"type"in e&&"string"==typeof e.type}var qe=Symbol.for("immer-nothing"),Be=Symbol.for("immer-draftable"),He=Symbol.for("immer-state"),Ve=[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}];function Ge(e,...t){{const n=Ve[e],r="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}}var Ke=Object.getPrototypeOf;function ze(e){return!!e&&!!e[He]}function Je(e){return!!e&&(Ye(e)||Array.isArray(e)||!!e[Be]||!!e.constructor?.[Be]||nt(e)||rt(e))}var Ze=Object.prototype.constructor.toString();function Ye(e){if(!e||"object"!=typeof e)return!1;const t=Ke(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ze}function Xe(e,t){0===Qe(e)?Object.entries(e).forEach((([n,r])=>{t(n,r,e)})):e.forEach(((n,r)=>t(r,n,e)))}function Qe(e){const t=e[He];return t?t.type_:Array.isArray(e)?1:nt(e)?2:rt(e)?3:0}function et(e,t){return 2===Qe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function tt(e,t,n){const r=Qe(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function nt(e){return e instanceof Map}function rt(e){return e instanceof Set}function it(e){return e.copy_||e.base_}function ot(e,t){if(nt(e))return new Map(e);if(rt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Ye(e)){if(!Ke(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[He];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const i=r[t],o=n[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(n[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Ke(e),n)}function st(e,t=!1){return dt(e)||ze(e)||!Je(e)||(Qe(e)>1&&(e.set=e.add=e.clear=e.delete=at),Object.freeze(e),t&&Xe(e,((e,t)=>st(t,!0)))),e}function at(){Ge(2)}function dt(e){return Object.isFrozen(e)}var lt,ct={};function ut(e){const t=ct[e];return t||Ge(0,e),t}function ht(){return lt}function ft(e,t){t&&(ut("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function pt(e){gt(e),e.drafts_.forEach(mt),e.drafts_=null}function gt(e){e===lt&&(lt=e.parent_)}function vt(e){return lt={drafts_:[],parent_:lt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function mt(e){const t=e[He];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function $t(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[He].modified_&&(pt(t),Ge(4)),Je(e)&&(e=yt(t,e),t.parent_||wt(t,e)),t.patches_&&ut("Patches").generateReplacementPatches_(n[He].base_,e,t.patches_,t.inversePatches_)):e=yt(t,n,[]),pt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==qe?e:void 0}function yt(e,t,n){if(dt(t))return t;const r=t[He];if(!r)return Xe(t,((i,o)=>bt(e,r,t,i,o,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return wt(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let i=t,o=!1;3===r.type_&&(i=new Set(t),t.clear(),o=!0),Xe(i,((i,s)=>bt(e,r,t,i,s,n,o))),wt(e,t,!1),n&&e.patches_&&ut("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function bt(e,t,n,r,i,o,s){if(i===n&&Ge(5),ze(i)){const s=yt(e,i,o&&t&&3!==t.type_&&!et(t.assigned_,r)?o.concat(r):void 0);if(tt(n,r,s),!ze(s))return;e.canAutoFreeze_=!1}else s&&n.add(i);if(Je(i)&&!dt(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;yt(e,i),t&&t.scope_.parent_||wt(e,i)}}function wt(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&st(t,n)}var Ct={get(e,t){if(t===He)return e;const n=it(e);if(!et(n,t))return function(e,t,n){const r=xt(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Je(r)?r:r===St(e.base_,t)?(Ot(e),e.copy_[t]=Et(r,e)):r},has:(e,t)=>t in it(e),ownKeys:e=>Reflect.ownKeys(it(e)),set(e,t,n){const r=xt(it(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=St(it(e),t),i=r?.[He];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,r)&&(void 0!==n||et(e.base_,t)))return!0;Ot(e),It(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==St(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Ot(e),It(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=it(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ge(11)},getPrototypeOf:e=>Ke(e.base_),setPrototypeOf(){Ge(12)}},kt={};function St(e,t){const n=e[He];return(n?it(n):e)[t]}function xt(e,t){if(!(t in e))return;let n=Ke(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ke(n)}}function It(e){e.modified_||(e.modified_=!0,e.parent_&&It(e.parent_))}function Ot(e){e.copy_||(e.copy_=ot(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Xe(Ct,((e,t)=>{kt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),kt.deleteProperty=function(e,t){return isNaN(parseInt(t))&&Ge(13),kt.set.call(this,e,t,void 0)},kt.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&Ge(14),Ct.set.call(this,e[0],t,n,e[0])};function Et(e,t){const n=nt(e)?ut("MapSet").proxyMap_(e,t):rt(e)?ut("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ht(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Ct;n&&(i=[r],o=kt);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:ht()).drafts_.push(n),n}function At(e){return ze(e)||Ge(10,e),Pt(e)}function Pt(e){if(!Je(e)||dt(e))return e;const t=e[He];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ot(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ot(e,!0);return Xe(n,((e,t)=>{tt(n,e,Pt(t))})),t&&(t.finalized_=!1),n}var Nt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,(e=>t.call(this,e,...i)))}}let r;if("function"!=typeof t&&Ge(6),void 0!==n&&"function"!=typeof n&&Ge(7),Je(e)){const i=vt(this),o=Et(e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?pt(i):gt(i)}return ft(i,n),$t(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===qe&&(r=void 0),this.autoFreeze_&&st(r,!0),n){const t=[],i=[];ut("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}Ge(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;const i=this.produce(e,t,((e,t)=>{n=e,r=t}));return[i,n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Je(e)||Ge(8),ze(e)&&(e=At(e));const t=vt(this),n=Et(e,void 0);return n[He].isManual_=!0,gt(t),n}finishDraft(e,t){const n=e&&e[He];n&&n.isManual_||Ge(9);const{scope_:r}=n;return ft(r,t),$t(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ut("Patches").applyPatches_;return ze(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},jt=Nt.produce;Nt.produceWithPatches.bind(Nt),Nt.setAutoFreeze.bind(Nt),Nt.setUseStrictShallowCopy.bind(Nt),Nt.applyPatches.bind(Nt),Nt.createDraft.bind(Nt),Nt.finishDraft.bind(Nt);var Rt=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},Tt=(e,t,n)=>{const{memoize:r,memoizeOptions:i}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=r((()=>({})),...i);if(!(a.apply(null,o)===a.apply(null,s))){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:o,secondInputs:s,stack:e})}},Mt={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Ut=e=>Array.isArray(e)?e:[e];function Lt(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function _t(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Wt="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},Ft=0,Dt=1;function qt(){return{s:Ft,v:void 0,o:null,p:null}}function Bt(e,t={}){let n=qt();const{resultEqualityCheck:r}=t;let i,o=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=qt(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=qt(),e.set(n,t)):t=r}}const a=t;let d;if(t.s===Dt)d=t.v;else if(d=e.apply(null,arguments),o++,r){const e=i?.deref?.()??i;null!=e&&r(e,d)&&(d=e,0!==o&&o--);i="object"==typeof d&&null!==d||"function"==typeof d?new Wt(d):d}return a.s=Dt,a.v=d,d}return s.clearCache=()=>{n=qt(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function Ht(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...o},{memoize:d,memoizeOptions:l=[],argsMemoize:c=Bt,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=Ut(l),p=Ut(u),g=Lt(e),v=d((function(){return r++,s.apply(null,arguments)}),...f);let m=!0;const $=c((function(){i++;const e=_t(g,arguments);t=v.apply(null,e);{const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Mt,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Rt},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:Tt}}})(m,h);if(n.shouldRun&&n.run(s,e,t),r.shouldRun){const t=_t(g,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign($,{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:d,argsMemoize:c})};return Object.assign(r,{withTypes:()=>r}),r}var Vt=Ht(Bt),Gt=Object.assign(((e,t=Vt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e),r=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})));return r}),{withTypes:()=>Gt});function Kt(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var zt=Kt(),Jt=Kt;((...e)=>{const t=Ht(...e)})(Bt);var Zt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Fe:Fe.apply(null,arguments)},Yt=e=>e&&"function"==typeof e.match;function Xt(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>De(t)&&t.type===e,n}function Qt(e){return"function"==typeof e&&"type"in e&&Yt(e)}function en(e,t){let n=0;return{measureTime(e){const t=Date.now();try{return e()}finally{const e=Date.now();n+=e-t}},warnIfExceeded(){n>e&&console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.`)}}}var tn=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function nn(e){return Je(e)?jt(e,(()=>{})):e}function rn(e,t,n){if(e.has(t)){let r=e.get(t);return n.update&&(r=n.update(r,t,e),e.set(t,r)),r}if(!n.insert)throw new Error("No insert provided for key not already in map");const r=n.insert(t,e);return e.set(t,r),r}function on(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function sn(e,t,n){const r=an(e,t,n);return{detectMutations:()=>dn(e,t,r,n)}}function an(e,t=[],n,r="",i=new Set){const o={value:n};if(!e(n)&&!i.has(n)){i.add(n),o.children={};for(const i in n){const s=r?r+"."+i:i;t.length&&-1!==t.indexOf(s)||(o.children[i]=an(e,t,n[i],s))}}return o}function dn(e,t=[],n,r,i=!1,o=""){const s=n?n.value:void 0,a=s===r;if(i&&!a&&!Number.isNaN(r))return{wasMutated:!0,path:o};if(e(s)||e(r))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in r)d[e]=!0;const l=t.length>0;for(let i in d){const s=o?o+"."+i:i;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=dn(e,t,n.children[i],r[i],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function ln(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Te(e)}function cn(e,t="",n=ln,r,i=[],o){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(o?.has(e))return!1;const a=null!=r?r(e):Object.entries(e),d=i.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(i.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=cn(l,a,n,r,i,o),s))return s}return o&&un(e)&&o.add(e),!1}function un(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!un(t))return!1;return!0}function hn(e){return"boolean"==typeof e}var fn=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let o=new tn;if(t&&(hn(t)?o.push(zt):o.push(Jt(t.extraArgument))),n){let e={};hn(n)||(e=n),o.unshift(function(e={}){{let t=function(e,t,r,i){return JSON.stringify(e,n(t,i),r)},n=function(e,t){let n=[],r=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(t)).join(".")+"]"}),function(i,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,i):r.push(i),~n.indexOf(o)&&(o=t.call(this,i,o))}else n.push(o);return null==e?o:e.call(this,i,o)}},{isImmutable:r=on,ignoredPaths:i,warnAfter:o=32}=e;const s=sn.bind(null,r,i);return({getState:e})=>{let n,r=e(),i=s(r);return a=>d=>{const l=en(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(r=e(),n=i.detectMutations(),i=s(r),n.wasMutated)throw new Error(`A state mutation was detected between dispatches, in the path '${n.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}));const c=a(d);return l.measureTime((()=>{if(r=e(),n=i.detectMutations(),i=s(r),n.wasMutated)throw new Error(`A state mutation was detected inside a dispatch, in the path: ${n.path||""}. Take a look at the reducer(s) handling the action ${t(d)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)})),l.warnIfExceeded(),c}}}}(e))}if(r){let e={};hn(r)||(e=r),o.push(function(e={}){{const{isSerializable:t=ln,getEntries:n,ignoredActions:r=[],ignoredActionPaths:i=["meta.arg","meta.baseQueryMeta"],ignoredPaths:o=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:l=!1}=e,c=!l&&WeakSet?new WeakSet:void 0;return e=>l=>u=>{if(!De(u))return l(u);const h=l(u),f=en(s,"SerializableStateInvariantMiddleware");return d||r.length&&-1!==r.indexOf(u.type)||f.measureTime((()=>{const e=cn(u,"",t,n,i,c);if(e){const{keyPath:t,value:n}=e;console.error(`A non-serializable value was detected in an action, in the path: \`${t}\`. Value:`,n,"\nTake a look at the logic that dispatched this action: ",u,"\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)","\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)")}})),a||(f.measureTime((()=>{const r=cn(e.getState(),"",t,n,o,c);if(r){const{keyPath:e,value:t}=r;console.error(`A non-serializable value was detected in the state, in the path: \`${e}\`. Value:`,t,`\nTake a look at the reducer(s) handling this action type: ${u.type}.\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}})),f.warnIfExceeded()),h}}}(e))}if(i){let e={};hn(i)||(e=i),o.unshift(function(e={}){const{isActionCreator:t=Qt}=e;return()=>e=>n=>(t(n)&&console.warn(function(e){const t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}(n.type)),e(n))}(e))}return o},pn=e=>t=>{setTimeout(t,e)},gn="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:pn(10),vn=e=>function(t){const{autoBatch:n=!0}=t??{};let r=new tn(e);return n&&r.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,o=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?gn:"callback"===e.type?e.queueNotification:pn(e.timeout),l=()=>{s=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},r,{subscribe(e){const t=r.subscribe((()=>i&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,o=!i,o&&(s||(s=!0,d(l))),r.dispatch(e)}finally{i=!0}}})})("object"==typeof n?n:void 0)),r};function mn(e){const t=fn(),{reducer:n,middleware:r,devTools:i=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Te(n))throw new Error("`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=We(n)}if(r&&"function"!=typeof r)throw new Error("`middleware` field must be a callback");if("function"==typeof r){if(d=r(t),!Array.isArray(d))throw new Error("when using a middleware builder function, an array of middleware must be returned")}else d=t();if(d.some((e=>"function"!=typeof e)))throw new Error("each middleware provided to configureStore must be a function");let l=Fe;i&&(l=Zt({trace:!0,..."object"==typeof i&&i}));const c=function(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:i.getState,dispatch:(e,...t)=>o(e,...t)},a=e.map((e=>e(s)));return o=Fe(...a)(i.dispatch),{...i,dispatch:o}}}(...d),u=vn(c);if(s&&"function"!=typeof s)throw new Error("`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Array.isArray(h))throw new Error("`enhancers` callback must return an array");if(h.some((e=>"function"!=typeof e)))throw new Error("each enhancer provided to configureStore must be a function");d.length&&!h.includes(c)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");return Le(a,o,l(...h))}function $n(e){const t={},n=[];let r;const i={addCase(e,o){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");const s="string"==typeof e?e:e.type;if(!s)throw new Error("`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error(`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,i},addMatcher(e,t){if(r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){if(r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,i}};return e(i),[t,n,r]}function yn(...e){return t=>e.some((e=>((e,t)=>Yt(e)?e.match(t):e(t))(e,t)))}var bn=["name","message","stack","code"],wn=class{constructor(e,t){this.payload=e,this.meta=t}_type},Cn=class{constructor(e,t){this.payload=e,this.meta=t}_type},kn=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of bn)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Sn=(()=>{function e(e,t,n){const r=Xt(e+"/fulfilled",((e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),i=Xt(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=Xt(e+"/rejected",((e,t,r,i,o)=>({payload:i,error:(n&&n.serializeError||kn)(e||"Rejected"),meta:{...o||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const l=n?.idGenerator?n.idGenerator(e):((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),c=new AbortController;let u;function h(e){u=e,c.abort()}const f=async function(){let f;try{let o=n?.condition?.(e,{getState:a,extra:d});if(null!==(p=o)&&"object"==typeof p&&"function"==typeof p.then&&(o=await o),!1===o||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const g=new Promise(((e,t)=>c.signal.addEventListener("abort",(()=>t({name:"AbortError",message:u||"Aborted"})))));s(i(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([g,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:h,rejectWithValue:(e,t)=>new wn(e,t),fulfillWithValue:(e,t)=>new Cn(e,t)})).then((t=>{if(t instanceof wn)throw t;return t instanceof Cn?r(t.payload,l,e,t.meta):r(t,l,e)}))])}catch(t){f=t instanceof wn?o(null,l,e,t.payload,t.meta):o(t,l,e)}var p;return n&&!n.dispatchConditionRejection&&o.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:h,requestId:l,arg:e,unwrap:()=>f.then(xn)})}}),{pending:i,rejected:o,fulfilled:r,settled:yn(o,r),typePrefix:e})}return e.withTypes=()=>e,e})();function xn(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var In=Symbol.for("rtk-slice-createasyncthunk");function On(e,t){return`${e}/${t}`}function En(e,t,n,r){function i(i,...o){let s=n.call(e,i);if(void 0===s){if(!r)throw new Error("selectState returned undefined for an uninjected slice reducer");s=e.getInitialState()}return t(s,...o)}return i.unwrapped=t,i}var An=function({creators:e}={}){const t=e?.asyncThunk?.[In];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error("`name` is a required option for createSlice");"undefined"!=typeof process&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(i),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("`context.addCase` cannot be called with two reducers for the same action type: "+n);return s.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(s.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(s.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(s.sliceCaseReducersByName[e]=t,a)};function d(){if("object"==typeof e.extraReducers)throw new Error("The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[t={},n=[],r]="function"==typeof e.extraReducers?$n(e.extraReducers):[e.extraReducers],i={...t,...s.sliceCaseReducersByType};return function(e,t){if("object"==typeof t)throw new Error("The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[r,i,o]=$n(t);if(function(e){return"function"==typeof e}(e))n=()=>nn(e());else{const t=nn(e);n=()=>t}function s(e=n(),t){let s=[r[t.type],...i.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[o]),s.reduce(((e,n)=>{if(n){if(ze(e)){const r=n(e,t);return void 0===r?e:r}if(Je(e))return jt(e,(e=>n(e,t)));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw new Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in i)e.addCase(t,i[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)}))}o.forEach((r=>{const o=i[r],s={reducerName:r,type:On(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},r,i){let o,s;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error("Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=r.reducer,s=r.prepare}else o=r;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?Xt(e,s):Xt(e))}(s,o,a):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error("Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:o,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=i(e,o,c);r.exposeAction(t,u),s&&r.addCase(u.fulfilled,s);a&&r.addCase(u.pending,a);d&&r.addCase(u.rejected,d);l&&r.addMatcher(u.settled,l);r.exposeCaseReducer(t,{fulfilled:s||Pn,pending:a||Pn,rejected:d||Pn,settled:l||Pn})}(s,o,a,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:r,reducer:(e,t)=>(u||(u=d()),u(e,t)),actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:()=>(u||(u=d()),u.getInitialState()),getSelectors(t=l){const n=rn(c,this,{insert:()=>new WeakMap});return rn(n,t,{insert:()=>{const n={};for(const[r,i]of Object.entries(e.selectors??{}))n[r]=En(this,i,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t){if(this===h)throw new Error("selectSlice returned undefined for an uninjected slice reducer");t=this.getInitialState()}return t},get selectors(){return this.getSelectors(this.selectSlice)},injectInto(e,{reducerPath:t,...n}={}){const r=t??this.reducerPath;return e.inject({reducerPath:r,reducer:this.reducer},n),{...this,reducerPath:r}}};return h}}();function Pn(){}var Nn="listenerMiddleware";Xt(`${Nn}/add`),Xt(`${Nn}/removeAll`),Xt(`${Nn}/remove`);const jn=e=>h((t=>{const n=An(e),r=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(o(C)(t)){constructor(...e){super(...e);const t=mn({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),i=e=>async(...n)=>{const r=await t.dispatch(e(...n));try{xn(r)}catch(e){this.logger.error(e.message,r.type,e.stack)}return r},o=Object.keys(r).reduce(((e,t)=>(e[t]=i(r[t]),e)),{});this.actions=o,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}})),Rn=h((e=>class extends(C(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}})),Tn=h((e=>{const t=o(P({"widget-id":O}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}}})),Mn=h((e=>{const t=o(L,Tn)(e);return class extends t{async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async getWidgetConfig(){var e,t;const n=await this.config;return null===(t=null===(e=null==n?void 0:n.projectConfig)||void 0===e?void 0:e.widgets)||void 0===t?void 0:t[this.widgetId]}}})),Un=h((e=>class extends e{get locale(){return this.getAttribute("locale")||""}get localeCandidates(){const{locale:e,fallback:t}=y(this.locale);return[...new Set([e,t].filter(Boolean))]}firstAvailableLocale(e){var t;const n=(null!=e?e:[]).map((e=>e.toLowerCase()));return null!==(t=this.localeCandidates.find((e=>n.includes(e))))&&void 0!==t?t:""}})),Ln=e=>h((t=>{var n,i,s;const a=o(M,Tn,Mn,Un)(t);return s=class extends a{constructor(){super(...arguments),n.add(this)}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this))}async fetchWidgetPage(t){const o=await r(this,n,"m",i).call(this,t);if(void 0!==o)return o;const s=await this.fetchStaticResource(`${e}/${this.widgetId}/${t}`,"text");return null==s?void 0:s.body}},n=new WeakSet,i=async function(t){var n;const r=await this.getWidgetConfig(),i=this.firstAvailableLocale(null!==(n=null==r?void 0:r.targetLocales)&&void 0!==n?n:[]);if(!i)return;const o=".html",s=t.endsWith(o)?t.slice(0,-5):t;try{const t=await this.fetchStaticResource(`${e}/${this.widgetId}/${s}-${i}${o}`,"text");return null==t?void 0:t.body}catch(e){return}},s})),_n=h((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),Wn=h((e=>{var n,i,o;return o=class extends(Pe(e)){constructor(){super(...arguments),n.add(this)}get clientInput(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get formInput(){return this.getAttribute("form")||void 0}createFlowTemplate(e){var{flowId:o,client:s,form:a}=e,d=t(e,["flowId","client","form"]);return u(Object.assign({projectId:this.getAttribute("project-id"),flowId:o,baseUrl:this.getAttribute("base-url")||"",baseStaticUrl:this.getAttribute("base-static-url")||"",baseCdnUrl:this.getAttribute("base-cdn-url")||"",refreshCookieName:this.getAttribute("refresh-cookie-name")||"",theme:this.theme,"style-id":this.styleId,locale:this.getAttribute("locale")||"",form:r(this,n,"m",i).call(this,a),client:Object.assign(Object.assign({},this.clientInput),s)},d))}},n=new WeakSet,i=function(e){const t=this.formInput;if(!e)return t;if(!t)return e;try{return Object.assign(Object.assign({},JSON.parse(t)),e)}catch(t){return e}},o}));var Fn;!function(e){e[e.text=1]="text",e[e.numeric=2]="numeric",e[e.bool=3]="bool",e[e.singleSelect=4]="singleSelect",e[e.array=5]="array",e[e.date=6]="date"}(Fn||(Fn={}));const Dn=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>{const[i,...o]=n.split(".");return t!==i?Object.assign(e,{[n]:r}):(e[i]||(e[i]={}),e[i][o.join(".")]=r,e)}),{}),qn=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Bn=(e,t)=>e===Fn.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t;function Hn(e){return new URLSearchParams(window.location.search).get(e)}const Vn={enabled:"active",disabled:"disabled",invited:"invited"},Gn=e=>e.tenantRoles.data,Kn=e=>e.selectedUsersLoginIds,zn=e=>e.notifications,Jn=e=>e.customAttributes.data,Zn=Vt((e=>e.subTenantRoles.data),(e=>Object.fromEntries(e.map((({tenantId:e,tenantName:t,roleNames:n})=>[e,t?{label:t,options:n}:n]))))),Yn=Vt(Zn,(e=>Object.keys(e).length>0)),Xn=Vt(Jn,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),Qn=Vt((e=>e.usersList.data),Xn,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes||{}).map((([e,n])=>[e,Bn(t[e],n)])))}))))),er=e=>{const t=[e.roleNames||[],...(e.userTenants||[]).map((e=>e.roleNames||[]))].filter((e=>e.length>0));if(0===t.length)return e.roleNames||[];const n=t.map((e=>[...e].sort().join("\0"))),r=n.every((e=>e===n[0]));return r?t[0]:"Multiple roles"},tr=Vt(Qn,(e=>e.map((e=>{var t;return Object.assign(Object.assign(Object.assign({},e),qn(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:Vn[e.status]||e.status,roles:er(e),tenants:null===(t=e.userTenants)||void 0===t?void 0:t.map((e=>e.tenantName||e.tenantId))})})))),nr=Vt(Kn,tr,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),rr=Vt(nr,(e=>e.map((e=>e.userId)))),ir=Vt(nr,(e=>e.map((({userId:e,loginIds:t})=>({userId:e,loginIds:t}))))),or=Vt(nr,(e=>e.map((e=>({userId:e.userId,roles:e.roleNames}))))),sr=Vt(nr,(e=>e.map((e=>e.status)))),ar=Vt(nr,(e=>e.every((e=>e.editable)))),dr=Vt(Kn,(e=>!!e.length)),lr=Vt(Kn,(e=>1===e.length)),cr=Vt(Kn,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),ur=Vt(lr,sr,((e,t)=>e&&t.every((e=>e===Vn.enabled)))),hr=Vt(sr,(e=>e.every((e=>e===Vn.disabled)))),fr=Vt(nr,(e=>{var t;return 1===e.length?e[0].name||e[0].email||(null===(t=e[0].loginIds)||void 0===t?void 0:t[0]):`${e.length} users`})),pr=Vt(lr,hr,ar,((e,t,n)=>e&&t&&n)),gr=Vt(lr,ur,ar,((e,t,n)=>e&&t&&n)),vr=Vt(lr,ar,((e,t)=>e&&t)),mr=Vt(lr,ar,((e,t)=>e&&t)),$r=Vt(lr,ar,((e,t)=>e&&t)),yr=dr,br=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},wr=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),Cr=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{t&&e.notifications.push({type:"success",msg:t(n)})},onRejected:(t,n)=>{e&&t.notifications.push({type:"error",msg:e(n)})}}),kr=Sn("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Sr=br(kr)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},wr((e=>e.createUser)),Cr({getSuccessMsg:()=>"User created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),xr={action:kr,reducer:Sr},Ir=Sn("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Or=br(Ir)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},wr((e=>e.deleteUser)),Cr({getSuccessMsg:e=>l(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>l(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Er={action:Ir,reducer:Or},Ar=Sn("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Pr=br(Ar)(wr((e=>e.setTempUserPassword)),Cr({getSuccessMsg:()=>"Successfully reset user password",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to reset user's password</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Nr={action:Ar,reducer:Pr},jr=Sn("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Rr=br(jr)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},wr((e=>e.customAttributes))),Tr={action:jr,reducer:Rr},Mr=Sn("users/search",((e,{extra:{api:t},getState:n})=>{const r=n().searchParams;return t.user.search(Object.assign(Object.assign({},r),e))})),Ur=br(Mr)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},wr((e=>e.usersList))),Lr={action:Mr,reducer:Ur},_r=Sn("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Wr=br(_r)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},wr((e=>e.tenantRoles))),Fr={action:_r,reducer:Wr},Dr=Sn("tenant/getSubTenantRoles",((e,{extra:{api:t}})=>t.tenant.getSubTenantRoles())),qr=br(Dr)({onFulfilled:(e,t)=>{e.subTenantRoles.data=t.payload.roles},onRejected:e=>{e.subTenantRoles.data=[]}},wr((e=>e.subTenantRoles))),Br={action:Dr,reducer:qr},Hr=Sn("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Vr=br(Hr)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>a(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},wr((e=>e.updateUser)),Cr({getSuccessMsg:()=>"User updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Gr={action:Hr,reducer:Vr},Kr=Sn("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),zr=br(Kr)({onFulfilled:(e,t)=>{var n;const r=e.usersList.data.findIndex((e=>{var n;return a(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==r&&(e.usersList.data[r].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},wr((e=>e.enableUser)),Cr({getSuccessMsg:()=>"User enabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to enable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Jr={action:Kr,reducer:zr},Zr=Sn("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Yr=br(Zr)({onFulfilled:(e,t)=>{var n;const r=e.usersList.data.findIndex((e=>{var n;return a(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==r&&(e.usersList.data[r].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},wr((e=>e.disableUser)),Cr({getSuccessMsg:()=>"User disabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to disable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Xr={action:Zr,reducer:Yr},Qr=Sn("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),ei={action:Qr,reducer:br(Qr)(wr((e=>e.removePasskey)),Cr({getSuccessMsg:()=>"Successfully removed user's passkey",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to remove user's passkey</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}}))},ti={usersList:{data:[],loading:!1,error:null},createUser:{loading:!1,error:null},updateUser:{loading:!1,error:null},deleteUser:{loading:!1,error:null},enableUser:{loading:!1,error:null},disableUser:{loading:!1,error:null},removePasskey:{loading:!1,error:null},setTempUserPassword:{loading:!1,error:null},customAttributes:{loading:!1,error:null,data:[]},tenantRoles:{loading:!1,error:null,data:[]},subTenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]};class ni extends Error{}function ri(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return atob(t)}}function ii(e,t){if("string"!=typeof e)throw new ni("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new ni(`Invalid token specified: missing part #${n+1}`);let i;try{i=ri(r)}catch(e){throw new ni(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new ni(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}ni.prototype.name="InvalidTokenError";var oi={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},sso:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const si="<region>",ai=`https://api.${si}descope.com`,di=6e5,li="dct",ci=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},ui=[503,520,521,522,524,530],hi=[100,5e3,5e3],fi=e=>new Promise((t=>setTimeout(t,e))),pi=e=>async function(...t){let n=await e(...t),r=0;for(;ui.includes(n.status)&&r<hi.length;)await fi(hi[r]),n=await e(...t),r++;r>0&&(n.retries=r);const i=await n.text();return n.text=()=>Promise.resolve(i),n.json=()=>Promise.resolve(JSON.parse(i)),n.clone=()=>n,n};let gi;const vi=()=>{if(gi)return gi;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return gi=`${t}-${n}`,gi};var mi;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(mi||(mi={}));const $i=({path:e,baseUrl:t,queryParams:n,projectId:r})=>{const i=r.slice(1,-27);t=t.replace(si,i?i+".":"");let o=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,r)=>{o=`${o}${0===r?"?":""}${t}=${encodeURIComponent(n[t])}${r===e.length-1?"":"&"}`}))}return o},yi=(...e)=>new Headers(e.reduce(((e,t)=>((e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t).forEach((([t,n])=>{e[t]="function"==typeof n?n():n})),e)),{})),bi={"Content-Type":"application/json"},wi=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Ci=(e,t)=>{const n={"x-descope-sdk-session-id":vi(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.68.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},ki=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e};var Si=e=>{var t;return(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:r,logger:i,hooks:o,cookiePolicy:s,fetch:a})=>{const d=e||ai,l=((e,t)=>{const n=t||fetch;return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async function(...t){if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>ci().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const r=await pi(n)(...t);return e[r.ok?"log":"error"](await(async e=>{const t=await e.text();return ci().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).retries(e.retries).build()})(r)),r}:pi(n)})(i,a),c=async e=>{var i;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(e):e,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=a,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:yi(wi(t,g),Ci(t,r),(null==n?void 0:n.baseHeaders)||{},ki(v)?bi:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const $=await l($i({path:c,baseUrl:d,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(e,null==$?void 0:$.clone()),null==o?void 0:o.transformResponse){const e=await $.json(),t=(y=(null===(i=$.headers)||void 0===i?void 0:i.get("set-cookie"))||"",Object.fromEntries(function(e){if(!e)return[];const t=[];let n=0;function r(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function i(){const t=e.charAt(n);return"="!==t&&";"!==t&&","!==t}for(;n<e.length;){const o=n;let s,a,d=!1;for(;r();)if(","===e.charAt(n)){for(s=n,n+=1,r(),a=n;n<e.length&&i();)n+=1;if(n<e.length&&"="===e.charAt(n)){d=!0,n=a,t.push(e.substring(o,s));break}n=s+1}else n+=1;(!d||n>=e.length)&&t.push(e.substring(o,e.length))}return t}(y).map((e=>{const t=e.split(";")[0],n=t.indexOf("=");return n<1?null:[t.substring(0,n).trim(),t.substring(n+1).trim()]})).filter(Boolean))),n=Object.assign(Object.assign({},$),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}var y;return $};return{get:(e,{headers:t,queryParams:n,token:r}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:mi.get,token:r}),post:(e,t,{headers:n,queryParams:r,token:i}={})=>c({path:e,headers:n,queryParams:r,body:t,method:mi.post,token:i}),patch:(e,t,{headers:n,queryParams:r,token:i}={})=>c({path:e,headers:n,queryParams:r,body:t,method:mi.patch,token:i}),put:(e,t,{headers:n,queryParams:r,token:i}={})=>c({path:e,headers:n,queryParams:r,body:t,method:mi.put,token:i}),delete:(e,{headers:t,queryParams:n,token:r}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:mi.delete,token:r}),hooks:o,buildUrl:(e,n)=>$i({projectId:t,baseUrl:d,path:e,queryParams:n})}})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const r=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==r?void 0:r.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var r;const i=[].concat((null===(r=e.hooks)||void 0===r?void 0:r.afterRequest)||[]);0!=i.length&&(await Promise.allSettled(null==i?void 0:i.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))},xi=429;function Ii(e,t,n){var r;let i=Oi(e);if(t){if(!(null==i?void 0:i.tenants)&&(null==i?void 0:i[li])===t)return(null==i?void 0:i[n])||[];i=null===(r=null==i?void 0:i.tenants)||void 0===r?void 0:r[t]}const o=null==i?void 0:i[n];return Array.isArray(o)?o:[]}function Oi(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return ii(e)}function Ei(e){const{exp:t}=Oi(e);return(new Date).getTime()/1e3>t}function Ai(e){let t=Oi(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Pi(e,t){return Ii(e,t,"permissions")}function Ni(e,t){return Ii(e,t,"roles")}const ji=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Ri(e,t){var n;const r=await e,i={code:r.status,ok:r.ok,response:r},o=await r.clone().json();return r.ok?i.data=o:(i.error=o,r.status===xi&&Object.assign(i.error,{retryAfter:Number.parseInt(null===(n=r.headers)||void 0===n?void 0:n.get("retry-after"))||0})),i}function Ti(e){var t;return(null===(t=Oi(e))||void 0===t?void 0:t[li])||""}const Mi=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Ui=(e,t)=>(n=t)=>t=>{const r=e.filter((e=>e(t)));return!(r.length<e.length)&&(n?n.replace("{val}",t):r.join(" OR "))},Li=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),_i=e=>t=>e.test(t),Wi=_i(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Fi=_i(/^\+[1-9]{1}[0-9]{3,14}$/),Di=Mi(Wi,'"{val}" is not a valid email'),qi=Mi(Fi,'"{val}" is not a valid phone number'),Bi=Mi((e=>e.length>=1),"Minimum length is 1");const Hi=Mi((e=>"string"==typeof e),"Input is not a string"),Vi=Mi((e=>Array.isArray(e)),"Input is not an array"),Gi=Mi((e=>"boolean"==typeof e),"Input is not a boolean"),Ki=Mi((e=>void 0===e),"Input is defined"),zi=Ui([Hi(),Ki()],"Input is not a string or undefined"),Ji=Ui([Vi(),Gi()],"Input is not an array or boolean"),Zi=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Li(...e).validate(n[t]))),t(...n)),Yi=e=>[Hi(`"${e}" must be a string`)],Xi=e=>[zi(`"${e}" must be string or undefined`)],Qi=e=>[Hi(`"${e}" must be a string`),Bi(`"${e}" must not be empty`)],eo=e=>[Hi(`"${e}" must be a string`),Di()],to=e=>[Hi(`"${e}" must be a string`),qi()],no=Zi(Qi("accessKey")),ro=e=>({exchange:no(((t,n)=>Ri(e.post(oi.accessKey.exchange,{loginOptions:n},{token:t}))))}),io=(e,t,n)=>(t.forEach((t=>{const r=t.split(".");let i=r.shift(),o=e;for(;r.length>0;){if(o=o[i],!i||!o)throw Error(`Invalid path "${t}", "${i}" is missing or has no value`);i=r.shift()}if("function"!=typeof o[i])throw Error(`"${t}" is not a function`);const s=o[i];o[i]=n(s)})),e),oo=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||di,di)});var so,ao;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"}(so||(so={})),function(e){e.email="email"}(ao||(ao={}));const lo=Object.assign(Object.assign({},so),ao);var co;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(co||(co={}));const uo=Qi("loginId"),ho=Zi(Qi("token")),fo=Zi(uo),po=Zi(Qi("pendingRef")),go=Zi(uo,eo("email")),vo=e=>({verify:ho((t=>Ri(e.post(oi.enchantedLink.verify,{token:t})))),signIn:fo(((n,r,i={},o)=>{var{providerId:s}=i,a=t(i,["providerId"]);return Ri(e.post(ji(oi.enchantedLink.signIn,lo.email),{loginId:n,URI:r,loginOptions:a,providerId:s},{token:o}))})),signUpOrIn:fo(((n,r,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ri(e.post(ji(oi.enchantedLink.signUpOrIn,lo.email),{loginId:n,URI:r,loginOptions:s,providerId:o}))})),signUp:fo(((n,r,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ri(e.post(ji(oi.enchantedLink.signUp,lo.email),{loginId:n,URI:r,user:i,loginOptions:a,providerId:s}))})),waitForSession:po(((t,n)=>new Promise((r=>{const{pollingIntervalMs:i,timeoutMs:o}=oo(n);let s;const a=setInterval((async()=>{const n=await e.post(oi.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Ri(Promise.resolve(n))))}),i);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:go(((t,n,r,i,o)=>Ri(e.post(oi.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:r},o),{token:i}))))}}),mo=Zi(Qi("flowId")),$o=Zi(Qi("executionId"),Qi("stepId"),Qi("interactionId")),yo=e=>({start:mo(((t,n,r,i,o,s,a,d=!1)=>Ri(e.post(oi.flow.start,{flowId:t,options:n,conditionInteractionId:r,interactionId:i,componentsVersion:o,flowVersions:s,input:a,isCustomScreen:d})))),next:$o(((t,n,r,i,o,s,a=!1)=>Ri(e.post(oi.flow.next,{executionId:t,stepId:n,interactionId:r,version:i,componentsVersion:o,input:s,isCustomScreen:a}))))}),bo=Qi("loginId"),wo=Zi(Qi("token")),Co=Zi(bo),ko=Zi(bo,to("phone")),So=Zi(bo,eo("email")),xo=Object.keys(lo).filter((e=>e!==so.voice&&e!==so.im)),Io=e=>({verify:wo((t=>Ri(e.post(oi.magicLink.verify,{token:t})))),signIn:xo.reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Co(((n,i,o={},s)=>{var{providerId:a}=o,d=t(o,["providerId"]);return Ri(e.post(ji(oi.magicLink.signIn,r),{loginId:n,URI:i,loginOptions:d,providerId:a},{token:s}))}))})),{}),signUp:xo.reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Co(((n,i,o,s={})=>{var{providerId:a}=s,d=t(s,["providerId"]);return Ri(e.post(ji(oi.magicLink.signUp,r),{loginId:n,URI:i,user:o,loginOptions:d,providerId:a}))}))})),{}),signUpOrIn:xo.reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Co(((n,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ri(e.post(ji(oi.magicLink.signUpOrIn,r),{loginId:n,URI:i,loginOptions:a,providerId:s}))}))})),{}),update:{email:So(((t,n,r,i,o)=>Ri(e.post(oi.magicLink.update.email,Object.assign({loginId:t,email:n,URI:r},o),{token:i})))),phone:Object.keys(so).filter((e=>e!==so.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ko(((t,r,i,o,s)=>Ri(e.post(ji(oi.magicLink.update.phone,n),Object.assign({loginId:t,phone:r,URI:i},s),{token:o}))))})),{})}});var Oo;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple",e.discord="discord",e.linkedin="linkedin",e.slack="slack"}(Oo||(Oo={}));const Eo=Zi(Qi("code")),Ao=e=>({start:Object.assign(((t,n,r,i,o)=>Ri(e.post(oi.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),o&&{loginHint:o}),token:i}))),Object.keys(Oo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,r,i,o)=>Ri(e.post(oi.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},t&&{redirectURL:t}),o&&{loginHint:o}),token:i}))})),{})),exchange:Eo((t=>Ri(e.post(oi.oauth.exchange,{code:t})))),startNative:(t,n,r)=>Ri(e.post(oi.oauth.startNative,{provider:t,loginOptions:n,implicit:r})),finishNative:(t,n,r,i,o)=>Ri(e.post(oi.oauth.finishNative,{provider:t,stateId:n,user:r,code:i,idToken:o})),getOneTapClientId:t=>Ri(e.get(oi.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,r,i)=>Ri(e.post(oi.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:r,loginOptions:i})),exchangeOneTapIDToken:(t,n,r,i)=>Ri(e.post(oi.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:r,loginOptions:i}))}),Po=Qi("appId"),No=Zi(Po),jo=e=>({connect:No(((t,n,r)=>{const i=null==n?void 0:n.tenantId,o=null==n?void 0:n.tenantLevel;return null==n||delete n.tenantId,null==n||delete n.tenantLevel,Ri(e.post(oi.outbound.connect,{appId:t,tenantId:i,tenantLevel:o,options:n},{token:r}))}))}),Ro=Qi("loginId"),To=Zi(Ro,Qi("code")),Mo=Zi(Ro),Uo=Zi(Ro,to("phone")),Lo=Zi(Ro,eo("email")),_o=e=>({verify:Object.keys(lo).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:To(((t,r)=>Ri(e.post(ji(oi.otp.verify,n),{code:r,loginId:t}))))})),{}),signIn:Object.keys(lo).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Mo(((n,i={},o)=>{var{providerId:s}=i,a=t(i,["providerId"]);return Ri(e.post(ji(oi.otp.signIn,r),{loginId:n,loginOptions:a,providerId:s},{token:o}))}))})),{}),signUp:Object.keys(lo).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Mo(((n,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ri(e.post(ji(oi.otp.signUp,r),{loginId:n,user:i,loginOptions:a,providerId:s}))}))})),{}),signUpOrIn:Object.keys(lo).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:Mo(((n,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ri(e.post(ji(oi.otp.signUpOrIn,r),{loginId:n,loginOptions:s,providerId:o}))}))})),{}),update:{email:Lo(((t,n,r,i)=>Ri(e.post(oi.otp.update.email,Object.assign({loginId:t,email:n},i),{token:r})))),phone:Object.keys(so).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Uo(((t,r,i,o)=>Ri(e.post(ji(oi.otp.update.phone,n),Object.assign({loginId:t,phone:r},o),{token:i}))))})),{})}}),Wo=Zi(Qi("tenant")),Fo=Zi(Qi("code")),Do=e=>({start:Wo(((t,n,r,i,o,s,a,d)=>Ri(e.post(oi.sso.start,r||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o}),s&&{forceAuthn:"true"}),a&&{loginHint:a}),d&&{initiatedEmail:t})},i&&{token:i}))))),exchange:Fo((t=>Ri(e.post(oi.sso.exchange,{code:t}))))}),qo=Qi("loginId"),Bo=Zi(qo,Qi("code")),Ho=Zi(qo),Vo=Zi(qo),Go=e=>({signUp:Ho(((t,n)=>Ri(e.post(oi.totp.signUp,{loginId:t,user:n})))),verify:Bo(((t,n,r,i)=>Ri(e.post(oi.totp.verify,{loginId:t,code:n,loginOptions:r},{token:i})))),update:Vo(((t,n)=>Ri(e.post(oi.totp.update,{loginId:t},{token:n}))))}),Ko=Qi("loginId"),zo=Qi("newPassword"),Jo=Zi(Ko,Qi("password")),Zo=Zi(Ko),Yo=Zi(Ko,zo),Xo=Zi(Ko,Qi("oldPassword"),zo),Qo=e=>({signUp:Jo(((n,r,i,o={})=>{var{providerId:s}=o,a=t(o,["providerId"]);return Ri(e.post(oi.password.signUp,{loginId:n,password:r,user:i,loginOptions:a,providerId:s}))})),signIn:Jo(((n,r,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ri(e.post(oi.password.signIn,{loginId:n,password:r,loginOptions:s,providerId:o}))})),sendReset:Zo(((t,n,r)=>Ri(e.post(oi.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:r})))),update:Yo(((t,n,r)=>Ri(e.post(oi.password.update,{loginId:t,newPassword:n},{token:r})))),replace:Xo(((t,n,r)=>Ri(e.post(oi.password.replace,{loginId:t,oldPassword:n,newPassword:r})))),policy:()=>Ri(e.get(oi.password.policy))}),es=Yi("loginId"),ts=Qi("loginId"),ns=Yi("origin"),rs=Zi(ts,ns,Qi("name")),is=Zi(ts,ns),os=Zi(es,ns),ss=Zi(ts,ns,Xi("token")),as=Zi(Qi("transactionId"),Qi("response")),ds=e=>({signUp:{start:rs(((t,n,r,i,o)=>Ri(e.post(oi.webauthn.signUp.start,{user:{loginId:t,name:r},origin:n,loginOptions:o,passkeyOptions:i})))),finish:as(((t,n)=>Ri(e.post(oi.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:os(((t,n,r,i,o)=>Ri(e.post(oi.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:o},{token:i})))),finish:as(((t,n)=>Ri(e.post(oi.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:is(((t,n,r,i)=>Ri(e.post(oi.webauthn.signUpOrIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:r}))))},update:{start:ss(((t,n,r,i,o)=>Ri(e.post(oi.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:i,mfa:o},{token:r})))),finish:as(((t,n)=>Ri(e.post(oi.webauthn.update.finish,{transactionId:t,response:n}))))}}),ls=Yi("loginId"),cs=Zi(ls),us=Zi(Qi("pendingRef")),hs=e=>({signUpOrIn:cs(((n,r={})=>{var{providerId:i}=r,o=t(r,["providerId"]);return Ri(e.post(oi.notp.signUpOrIn,{loginId:n,loginOptions:o,providerId:i}))})),signUp:cs(((n,r,i={})=>{var{providerId:o}=i,s=t(i,["providerId"]);return Ri(e.post(oi.notp.signUp,{loginId:n,user:r,providerId:o,loginOptions:s}))})),signIn:cs(((n,r={},i)=>{var{providerId:o}=r,s=t(r,["providerId"]);return Ri(e.post(oi.notp.signIn,{loginId:n,loginOptions:s,providerId:o},{token:i}))})),waitForSession:us(((t,n)=>new Promise((r=>{const{pollingIntervalMs:i,timeoutMs:o}=oo(n);let s;const a=setInterval((async()=>{const n=await e.post(oi.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(Ri(Promise.resolve(n))))}),i);s=setTimeout((()=>{r({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),fs=Zi(Qi("token")),ps=Zi(Xi("token"));var gs,vs=Zi([(gs=Qi("projectId"),Mi(((e,t)=>n=>Li(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=n.length;let i=0,o=e===Object(e)?e:void 0;for(;null!=o&&i<r;)o=o[n[i++]];return i&&i===r&&void 0!==o?o:void 0})(n,e)))("projectId",gs))())])((e=>{const{projectId:t,logger:n,baseUrl:r,cookiePolicy:i,baseHeaders:o={},refreshCookieName:s,fetch:a}=e;return d=Si({baseUrl:r,projectId:t,logger:n,hooks:{get beforeRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest},get afterRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.afterRequest},get transformResponse(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}},cookiePolicy:i,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:ro(d),otp:_o(d),magicLink:Io(d),enchantedLink:vo(d),oauth:Ao(d),outbound:jo(d),sso:Do(d),saml:Do(d),totp:Go(d),notp:hs(d),webauthn:ds(d),password:Qo(d),flow:yo(d),refresh:ps(((e,t,n,r)=>{const i={};n&&(i.externalToken=n);const o=r?oi.tryRefresh:oi.refresh;return Ri(d.post(o,i,{token:e,queryParams:t}))})),selectTenant:Zi([Hi("tenantId")],[zi('"token" must be string or undefined')])(((e,t)=>Ri(d.post(oi.selectTenant,{tenant:e},{token:t})))),logout:ps((e=>Ri(d.post(oi.logout,{},{token:e})))),logoutAll:ps((e=>Ri(d.post(oi.logoutAll,{},{token:e})))),me:ps((e=>Ri(d.get(oi.me,{token:e})))),myTenants:Zi([Ji('"tenants" must a string array or a boolean')],[zi('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,Ri(d.post(oi.myTenants,n,{token:t}))})),history:ps((e=>Ri(d.get(oi.history,{token:e})))),isJwtExpired:fs(Ei),getTenants:fs(Ai),getJwtPermissions:fs(Pi),getJwtRoles:fs(Ni),getCurrentTenant:fs(Ti),httpClient:d};var d})),ms=Object.assign(vs,{DeliveryMethods:lo});
6
+ /*! js-cookie v3.0.8 | MIT */function $s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)"__proto__"!==r&&(e[r]=n[r])}return e}var ys=function e(t,n){function r(e,r,i){if("undefined"!=typeof document){"number"==typeof(i=$s({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in i)i[s]&&(o+="; "+s,!0!==i[s]&&(o+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+o}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},i=0;i<n.length;i++){var o=n[i].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(a in r||(r[a]=t.read(s,a)),e===a)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",$s({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,$s({},this.attributes,t))},withConverter:function(t){return e($s({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});var bs={default:"endpoint"},ws="Blocked by CSP",Cs="The endpoint parameter is not a valid URL",ks="Failed to load the JS script of the agent",Ss="9319";function xs(e,t){var n,r,i,o,s,a=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),o=0,r=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,o++))},i=new Set,[n.current(),function(e,t){var o,s=t instanceof Error?t.message:"";if(s===ws||s===Cs)n.exclude(),o=0;else if(s===Ss)n.exclude();else if(s===ks){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!i.has(d)&&(i.add(d),o=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=o?o:e.getTime()+r()-Date.now()]}]),l=d[0],c=d[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var u=function(e){var n=new Date,r=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r()}),r),i.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=c(n,e);if(!t)throw s;var r,i=t[0],o=t[1];return(r=o,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return u(i)}))}))};return u(l).then((function(e){return[e,a]}))}var Is="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Os=Is;function Es(n){var r;n.scriptUrlPattern;var i=n.token,o=n.apiKey,s=void 0===o?i:o,a=t(n,["scriptUrlPattern","token","apiKey"]),d=null!==(r=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(n,"scriptUrlPattern"))&&void 0!==r?r:Is,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,r){return e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r)}}(document,"visibilitychange",t);return t(),[e,n]}(),c=l[0],u=l[1];return Promise.resolve().then((function(){if(!s||"string"!=typeof s)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.6"):e}))}(String(e),t)}))}(d,s);return xs(e,As)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Ss?new Error(ks):e}(e)})).then((function(t){var n=t[0],r=t[1];return u(),n.load(e(e({},a),{ldi:{attempts:r,visibilityStates:c}}))}))}function As(e){return function(e,t,n){var r,i=document,o="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(r=t,a())};i.addEventListener(o,s);var a=function(){return i.removeEventListener(o,s)};return Promise.resolve().then(t).then((function(e){return a(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(a(),r)return n(r);throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(Cs);var r=document.createElement("script"),i=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},o=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),t()},r.onerror=function(){i(),n(new Error(ks))},r.async=!0,r.src=e,o.appendChild(r)}))}(e)}),(function(){throw new Error(ws)})).then(Ps)}function Ps(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,r=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==r?void 0:r.configurable)?delete e[t]:r&&!r.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(Ss);return n}const Ns="3.2.0",js="undefined"!=typeof window,Rs=Math.pow(2,31)-1,Ts=`https://descopecdn.com/npm/oidc-client-ts@${Ns}/dist/browser/oidc-client-ts.min.js`,Ms=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Ns}/dist/browser/oidc-client-ts.min.js`,Us=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let Ls;const _s=e=>{try{return ii(e).exp}catch(e){return null}},Ws=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:_s(n)},Fs=e=>{const{expires_in:t,expires_at:n,access_token:r}=e;return n||(t?Math.floor(Date.now()/1e3)+t:r?_s(r):void 0)},Ds=e=>{const{access_token:n,id_token:r,refresh_token:i,refresh_expire_in:o}=e,s=t(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||n,idToken:r,refreshJwt:e.refreshJwt||i,sessionExpiration:e.sessionExpiration||Fs(e),cookieExpiration:e.cookieExpiration||Ws(e)},s)},qs=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,r)=>{var i;return n[r]=[].concat((null===(i=e.hooks)||void 0===i?void 0:i[r])||[]).concat((null==t?void 0:t[r])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Bs=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json()),n=(null==t?void 0:t.authInfo)||t||{};return Ds(n)},Hs=()=>js&&!!window.descopeBridge,Vs=(e,t)=>{if(!((null==t?void 0:t.status)>=400&&(null==t?void 0:t.status)<500))return!1;const n=(null==e?void 0:e.path)||"";return Us.includes(n)},Gs=void 0!==Ls||js&&void 0!==window.localStorage,Ks=(e,t)=>{var n,r;return null===(r=null===(n=Ls||js&&window.localStorage)||void 0===n?void 0:n.setItem)||void 0===r?void 0:r.call(n,e,t)},zs=e=>{var t,n;return null===(n=null===(t=Ls||js&&window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e)},Js=e=>{var t,n;return null===(n=null===(t=Ls||js&&window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n?void 0:n.call(t,e)},Zs=e=>{var t,n,r,i,o;return null!==(o=null!==(n=null===(t=null==Ls?void 0:Ls.key)||void 0===t?void 0:t.call(Ls,e))&&void 0!==n?n:js&&(null===(i=null===(r=window.localStorage)||void 0===r?void 0:r.key)||void 0===i?void 0:i.call(r,e)))&&void 0!==o?o:null},Ys=e=>{var t,n;return js&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e))||null},Xs=e=>{var t,n;try{js&&(null===(n=null===(t=window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n||n.call(t,e))}catch(e){}},Qs=(...e)=>{console.debug(...e)},ea=(...e)=>{console.warn(...e)},ta="DS",na="DSR",ra="DSI",ia="DSRCN";function oa(e,t,n){if(t){const{cookieDomain:r,cookiePath:i,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=sa(r);ys.set(e,t,{path:i,domain:l?r:void 0,expires:d,sameSite:o,secure:a})}}function sa(e){const t=window.location.hostname.split("."),n=null==e?void 0:e.split(".");return t.slice(-(null==n?void 0:n.length)).join(".")===e}const aa=e=>(null==e?void 0:e.cookieName)||ta,da=e=>(null==e?void 0:e.cookieName)||na;function la(e="",t){return ys.get(da(t))||zs(`${e}${na}`)||""}function ca(e="",t){return ys.get(aa(t))||zs(`${e}${ta}`)||""}function ua(e=""){return zs(`${e}${ra}`)||""}function ha(e="",t,n,r){Js(`${e}${na}`),Js(`${e}${ta}`),Js(`${e}${ra}`),Js(`${e}${ia}`);const i=aa(t);ys.remove(i,null==r?void 0:r.session);const o=da(n);ys.remove(o,null==r?void 0:r.refresh)}const fa=(e,t,n)=>r=>{const i=Object.assign(r,{token:r.token||la(e,t)});if(!n){const t=function(e=""){return zs(`${e}${ia}`)}(e);t&&(i.headers=Object.assign(Object.assign({},i.headers||{}),{"x-descope-refresh-cookie-name":t}))}const o=function(e=""){return zs(`${e}DTD`)||""}(e);return o&&(i.headers=Object.assign(Object.assign({},i.headers||{}),{"x-descope-trusted-device-token":o})),i},pa=js&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",ga="vsid",va="vrid",ma="fp",$a=(e=!1)=>{const t=zs(ma);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},ya=async(e,t=pa)=>{try{if($a())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const i=new URL(t);i.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const o=i.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Es({apiKey:e,endpoint:[r.toString(),bs],scriptUrlPattern:[o,Os]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[ga]:e,[va]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};Ks(ma,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},ba=e=>{const t=$a(!0);return t&&e.body&&(e.body.fpData=t),e},wa="descopeFlowNonce",Ca="X-Descope-Flow-Nonce",ka="/v1/flow/start",Sa="/v1/flow/next",xa=(e,t=wa)=>`${t}${e}`,Ia=(e,t=wa)=>{try{const n=xa(e,t),r=zs(n);if(!r)return null;const i=JSON.parse(r);return i.expiry<Date.now()?(Oa(e,t),null):{value:i.value,seq:i.seq}}catch(e){return console.error("Error getting flow nonce:",e),null}},Oa=(e,t=wa)=>{try{const n=xa(e,t);Js(n)}catch(e){console.error("Error removing flow nonce:",e)}},Ea=e=>{var t;return(null===(t=/.*\|#\|(.*)/.exec(e))||void 0===t?void 0:t[1])||null},Aa=e=>{var t;return e.path===Sa&&(null===(t=e.body)||void 0===t?void 0:t.executionId)?Ea(e.body.executionId):null},Pa="dls_last_user_login_id",Na="dls_last_user_display_name",ja=e=>Ks(Pa,e),Ra=()=>zs(Pa),Ta=()=>zs(Na),Ma=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,r={}]=t,i=Ra(),o=Ta();return i&&(null!==(n=r.lastAuth)&&void 0!==n||(r.lastAuth={}),r.lastAuth.loginId=i,r.lastAuth.name=o),await e(...t)},Ua="DSLI",La=e=>async(...t)=>{const n=await e(...t);return Xs(Ua),n};function _a(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}async function Wa(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Ga(n.publicKey.challenge),n.publicKey.user.id=Ga(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Ga(e.id)})),n}(e);try{return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Ka(n.rawId),type:n.type,response:{attestationObject:Ka(n.response.attestationObject),clientDataJSON:Ka(n.response.clientDataJSON)}})}catch(e){throw await qa(e,t,!0)}var n}async function Fa(e){const t=Ha(e);try{return Va(await navigator.credentials.get(t))}catch(e){throw await qa(e,t,!1)}}async function Da(e,t){const n=Ha(e);n.signal=t.signal,n.mediation="conditional";try{return Va(await navigator.credentials.get(n))}catch(e){throw await qa(e,n,!1)}}async function qa(e,t,n){if(e&&"object"==typeof e)try{e.reason=await async function(e,t,n){var r,i;const o=null==e?void 0:e.name;if("AbortError"===o&&(null==t?void 0:t.signal)instanceof AbortSignal)return"aborted";if("InvalidStateError"===o&&n)return"authenticator_already_registered";if("NotSupportedError"===o)return"no_supported_algorithm";if("ConstraintError"===o)return"authenticator_constraints_unsupported";if("SecurityError"===o){const e=window.location.hostname;return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)?"invalid_rpid":"invalid_domain"}if(!await Ba())return"webauthn_unsupported";const s="platform"===(null===(i=null===(r=null==t?void 0:t.publicKey)||void 0===r?void 0:r.authenticatorSelection)||void 0===i?void 0:i.authenticatorAttachment);return n&&s&&!await Ba(!0)?"platform_authenticator_unsupported":"NotAllowedError"===o?"not_allowed":"unknown"}(e,t,n)}catch(e){}return e}async function Ba(e=!1){var t,n;if(!js)return Promise.resolve(!1);if(Hs()){const e=null===(n=null===(t=window.descopeBridge)||void 0===t?void 0:t.hostInfo)||void 0===n?void 0:n.webauthn;if("boolean"==typeof e)return e}const r=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return r&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():r}function Ha(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Ga(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Ga(e.id)})),n}function Va(e){return JSON.stringify({id:e.id,rawId:Ka(e.rawId),type:e.type,response:{authenticatorData:Ka(e.response.authenticatorData),clientDataJSON:Ka(e.response.clientDataJSON),signature:Ka(e.response.signature),userHandle:e.response.userHandle?Ka(e.response.userHandle):void 0}})}function Ga(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Ka(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var za,Ja=(za=e=>({async signUp(t,n,r){const i=await e.webauthn.signUp.start(t,window.location.origin,n,r);if(!i.ok)return i;const o=await Wa(i.data.options);return await e.webauthn.signUp.finish(i.data.transactionId,o)},async signIn(t,n){const r=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!r.ok)return r;const i=await Fa(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)},async signUpOrIn(t,n){var r;const i=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!i.ok)return i;if(null===(r=i.data)||void 0===r?void 0:r.create){const t=await Wa(i.data.options);return await e.webauthn.signUp.finish(i.data.transactionId,t)}{const t=await Fa(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,t)}},async update(t,n,r){const i=await e.webauthn.update.start(t,window.location.origin,n,r);if(!i.ok)return i;const o=await Wa(i.data.options);return await e.webauthn.update.finish(i.data.transactionId,o)},helpers:{create:Wa,get:Fa,isSupported:Ba,conditional:Da}}),(...e)=>{const t=za(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const Za="/fedcm/config",Ya=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("")}return Math.random().toString(36).substring(2)};async function Xa(e,t){var n;try{await Qa(e,t)}catch(e){null===(n=null==t?void 0:t.onFailed)||void 0===n||n.call(t,e)}}async function Qa(e,t){var n,r;const i=await async function(e,t="google",n,r,i){const o=Ya(),s=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}(),a=await e.oauth.getOneTapClientId(t);if(!a.ok)throw new Error("Failed to get OneTap client ID for provider "+t);const d=a.data.clientId;return new Promise((e=>{var a,l;const c=n=>{e({provider:t,nonce:o,credential:null==n?void 0:n.credential})};s.initialize(Object.assign(Object.assign({},n),{itp_support:null===(a=null==n?void 0:n.itp_support)||void 0===a||a,use_fedcm_for_prompt:null===(l=null==n?void 0:n.use_fedcm_for_prompt)||void 0===l||l,client_id:d,callback:c,nonce:o})),s.prompt((e=>{var t,n;if(i&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);return null==i||i(n),void c()}if(r&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);return null==r||r(t),void c()}}))}))}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!i.credential)return null;if(null==t?void 0:t.onCodeReceived){const r=await e.oauth.verifyOneTapIDToken(i.provider,i.credential,i.nonce,null==t?void 0:t.loginOptions);if(!r.ok||!r.data)throw new Error("Failed to verify OneTap client ID for provider "+i.provider);null===(n=null==t?void 0:t.onCodeReceived)||void 0===n||n.call(t,r.data.code)}else{const n=await e.oauth.exchangeOneTapIDToken(i.provider,i.credential,i.nonce,null==t?void 0:t.loginOptions);if(!n.ok||!n.data)throw new Error("Failed to exchange OneTap client ID for provider "+i.provider);null===(r=null==t?void 0:t.onAuthenticated)||void 0===r||r.call(t,n.data)}}var ed=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Ba(),r=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=r,e.flow.start(...t)}});let td;const nd=(e,t)=>new Promise(((n,r)=>{if(!e.length)return r(new Error("No URLs provided to loadScriptWithFallback"));const i=t();if(i)return n(i);const o=e.shift(),s=document.createElement("script");s.src=o,s.id=(e=>{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t).toString(16)})(o),s.onload=()=>{const e=t();if(e)return n(e);throw new Error("Could not get entry after loading script from URL")},s.addEventListener("error",(()=>{nd(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),rd=(e,t,n)=>{const r=async()=>{let r,i;return r&&i||({client:r,stateUserKey:i}=await(async(e,t,n)=>{td||(td=(async()=>{try{return require("oidc-client-ts")}catch(e){return nd([Ts,Ms],(()=>window.oidc))}})());const{OidcClient:r,WebStorageStateStore:i}=await td;if(!r)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=(null==n?void 0:n.redirectUri)||window.location.href;let s,a,d,l;if(null==n?void 0:n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,a=n.clientId,d=`${a}_user`,l="openid"}else(null==n?void 0:n.applicationId)?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access");const c={authority:s,client_id:a,redirect_uri:o,response_type:"code",scope:(null==n?void 0:n.scope)||l,stateStore:new i({store:window.localStorage,prefix:a}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),{client:new r(c),stateUserKey:d}})(e,t,n)),{client:r,stateUserKey:i}},i=async(t="")=>{var n;const{client:i,stateUserKey:o}=await r(),s=await i.processSigninResponse(t||window.location.href);var a;return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(s)))),Ks(o,JSON.stringify({id_token:(a=s).id_token,session_state:a.session_state,profile:a.profile})),(()=>{const e=new URL(window.location.href);e.searchParams.delete("code"),e.searchParams.delete("state"),window.history.replaceState({},document.title,e.toString())})(),s};return{loginWithRedirect:async(t={},n=!1)=>{var i;const{client:o}=await r(),s=await o.createSigninRequest(t),{url:a}=s;return n||(await(null===(i=e.httpClient.hooks)||void 0===i?void 0:i.afterRequest({},new Response(JSON.stringify(s)))),window.location.href=a),{ok:!0,data:s}},finishLogin:i,finishLoginIfNeed:async(e="")=>{if(window.location.search.includes("code")&&window.location.search.includes("state"))return await i(e)},refreshToken:async t=>{var n;const{client:i,stateUserKey:o}=await r(),s=(e=>{const t=zs(e);return t?JSON.parse(t):null})(o);if(!s)throw new Error("User not found in storage to refresh token");let a=t;if(!a){const t={};e.httpClient.hooks.beforeRequest(t),a=t.token}const d=await i.useRefreshToken({state:{refresh_token:a,session_state:s.session_state,profile:s.profile}});return await(null===(n=e.httpClient.hooks)||void 0===n?void 0:n.afterRequest({},new Response(JSON.stringify(d)))),d},logout:async(e,t=!1)=>{const{client:n,stateUserKey:i}=await r();e||(e={}),e.id_token_hint=e.id_token_hint||ua(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return Js(i),t||window.location.replace(s),o}}},id=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var n;return n=t.customStorage,Ls=n,e(t)}),(e=>n=>{var{fpKey:r,fpLoad:i}=n,o=t(n,["fpKey","fpLoad"]);return js?(r&&i&&ya(r).catch((()=>null)),e(qs(o,{beforeRequest:ba}))):e(o)}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.51.5"},t.baseHeaders)}))),(e=>t=>{const n=_a(),r=_a(),i=_a(),o=_a(),s=e(qs(t,{afterRequest:async(e,t)=>{if(Vs(e,t))Qs("Session invalidated, notifying subscribers with empty values"),r.pub(null),i.pub(null),n.pub(null),o.pub(null);else{const e=await(async e=>{const t=await Bs(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)})(t);e&&i.pub(e);const{sessionJwt:s,sessionExpiration:a,claims:d}=await Bs(t);s&&r.pub(s),d&&o.pub(d),(a||s)&&n.pub(a||42)}}})),a=io(s,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const s=await e(...t);return r.pub(null),i.pub(null),n.pub(null),o.pub(null),s}));return Object.assign(a,{onSessionTokenChange:r.sub,onUserChange:i.sub,onClaimsChange:o.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>n=>{var r;const{enableFlowNonce:i=!0,nonceStoragePrefix:o=wa}=n,s=t(n,["enableFlowNonce","nonceStoragePrefix"]);if(!i)return e(s);((e=wa)=>{try{if(!Gs)return;for(let i=0;i<(void 0,n=void 0,void 0,null!==(r=null!==(t=null==Ls?void 0:Ls.length)&&void 0!==t?t:js&&(null===(n=window.localStorage)||void 0===n?void 0:n.length))&&void 0!==r?r:0);i++){const t=Zs(i);if(t&&t.startsWith(e)){const n=zs(t);if(n)try{JSON.parse(n).expiry<Date.now()&&Js(t)}catch(e){Js(t)}}}}catch(e){console.error("Error cleaning up expired nonces:",e)}var t,n,r})(o);const a=e(qs(s,{afterRequest:async(e,t)=>{var n;if(e.path!==ka&&e.path!==Sa)return;const{nonce:r,seq:i,executionId:s}=await(async(e,t)=>{try{const n=t.headers.get(Ca),r=null===n?void 0:(e=>{const t=e.indexOf(".");if(t<=0)return;const n=e.slice(0,t);if(!/^\d+$/.test(n))return;const r=Number(n);return Number.isSafeInteger(r)?r:void 0})(n);let i=await t.clone().json().then((e=>(null==e?void 0:e.executionId)||null)).catch((()=>null));return i||(i=Aa(e)),{nonce:n,seq:r,executionId:Ea(i)}}catch(e){return{nonce:null,seq:void 0,executionId:null}}})(e,t);if(!r||!s)return;const a=e.path===ka,d=null===(n=Ia(s,o))||void 0===n?void 0:n.seq;!a&&void 0!==i&&void 0!==d&&i<=d||((e,t,n,r=wa,i)=>{try{const o=xa(e,r),s=n?172800:10800,a={value:t,expiry:Date.now()+1e3*s,isStart:n,seq:i};Ks(o,JSON.stringify(a))}catch(e){console.error("Error setting flow nonce:",e)}})(s,r,a,o,null!=i?i:a?void 0:d)},beforeRequest:e=>{if(e.path===Sa){const t=Aa(e);if(t){const n=((e,t=wa)=>{var n,r;return null!==(r=null===(n=Ia(e,t))||void 0===n?void 0:n.value)&&void 0!==r?r:null})(t,o);n&&(e.headers=e.headers||{},e.headers[Ca]=n)}}return e}}));if(null===(r=a.flow)||void 0===r?void 0:r.next){let e=Promise.resolve();const t=a.flow.next.bind(a.flow);a.flow.next=async(...n)=>{const r=e;let i;e=new Promise((e=>{i=e})),await r;try{return await t(...n)}finally{i()}}}return a}),(e=>t=>{const n=e(qs(t,{afterRequest:async(e,t)=>{if(Vs(e,t))return void Xs(Ua);const n=await Bs(t);(null==n?void 0:n.sessionExpiration)&&((e,t)=>{var n,r;try{js&&(null===(r=null===(n=window.localStorage)||void 0===n?void 0:n.setItem)||void 0===r||r.call(n,e,t))}catch(e){}})(Ua,String(n.sessionExpiration))}}));return io(n,["logout","logoutAll","oidc.logout"],La)}),(e=>n=>{var{autoRefresh:r}=n,i=t(n,["autoRefresh"]);const o=!!r,s="object"==typeof r&&(null==r?void 0:r.customActivityTracking);if(!o||Hs())return Object.assign(e(i),{markUserActive:()=>{ea("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:d}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let l,c,u=null,h=!1,f=!1;s&&(Qs("Activity-based refresh enabled"),u=(()=>{let e=!0;return{hadActivity:()=>e,reset:()=>{e=!1},markActive:()=>{e=!0}}})()),js&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&l&&new Date>l&&(Qs("Expiration time passed, refreshing session"),p.refresh(la()||c))}));const p=e(qs(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:r,sessionExpiration:i,nextRefreshSeconds:o}=await Bs(t);if(Vs(e,t))Qs("Session invalidated, canceling all timers"),a();else if(n||i){if(l=((e,t)=>{if(t)return new Date(1e3*t);Qs("Could not extract expiration time from session token, trying to decode the token");try{const t=ii(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,i),!l)return void Qs("Could not extract expiration time from session token");c=r,h=o>0;const e=((e,t)=>{let n;var r;return t>0?(n=1e3*t,Qs(`Using provided nextRefreshSeconds: ${t}s`)):n=((r=e)?r.getTime()-(new Date).getTime():0)-2e4,n>Rs&&(Qs(`Timeout is too large (${n}ms), setting it to ${Rs}ms`),n=Rs),n})(l,o);if(a(),e<=2e4)return void Qs("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Qs(`Setting refresh timer for ${t}. (${e}ms)`),u&&(u.reset(),f=!1),d((()=>{if(js&&"hidden"===document.visibilityState)Qs("Skipping refresh due to timer - document is hidden");else{if(u&&h&&!u.hadActivity())return Qs("Skipping refresh due to timer - user is idle"),void(f=!0);Qs("Refreshing session due to timer"),p.refresh(la()||r)}}),e)}}}));return Object.assign(io(p,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return Qs("Clearing all timers"),a(),n})),{markUserActive:u?()=>{Qs("markUserActive() called"),h||Qs("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),f&&(Qs("User became active after skipped refresh, triggering refresh"),f=!1,a(),p.refresh(la()||c))}:()=>{ea("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})}),(e=>n=>{var{storeLastAuthenticatedUser:r=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=n,o=t(n,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!r)return Object.assign(e(o),{getLastUserLoginId:Ra,getLastUserDisplayName:Ta});const s=e(qs(o,{afterRequest:async(e,t)=>{var n;const{userInfo:r,lastAuth:i}=await(async e=>{if(!(null==e?void 0:e.ok))return{userInfo:void 0,lastAuth:void 0};const t=await(null==e?void 0:e.clone().json()),n=Ds((null==t?void 0:t.authInfo)||t||{});return{userInfo:(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0),lastAuth:t.lastAuth}})(t),o=null===(n=null==r?void 0:r.loginIds)||void 0===n?void 0:n[0],s=null==r?void 0:r.name;o?(ja(o),(e=>{Ks(Na,e)})(s)):(null==i?void 0:i.loginId)&&ja(i.loginId)}}));let a=io(s,["flow.start"],Ma);return a=io(a,["logout","logoutAll"],(e=>t=>async(...n)=>{const r=await t(...n);return e||(Js(Pa),Js(Na)),r})(i)),Object.assign(a,{getLastUserLoginId:Ra,getLastUserDisplayName:Ta})}),(e=>n=>{var{persistTokens:r,sessionTokenViaCookie:i,refreshTokenViaCookie:o,storagePrefix:s,refreshCookieName:a}=n,d=t(n,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!r||!js)return e(Object.assign({refreshCookieName:a},d));let l;const c=e(qs(Object.assign({refreshCookieName:a},d),{beforeRequest:fa(s,o,a),afterRequest:async(e,t)=>{if(Vs(e,t))Qs("Session invalidated, clearing persisted tokens"),ha(s,i,o,l);else{const e=await Bs(t);e.cookieName?Ks(`${s||""}${ia}`,e.cookieName):e.refreshJwt&&Js(`${s||""}${ia}`);const n=((e={},t=!1,n="",r=!1)=>{var i,o,s,a;const{sessionJwt:d,refreshJwt:l,trustedDeviceJwt:c}=e;let u;if(l)if(r){Js(`${n}${na}`);const t=r.sameSite||"Strict",s=null===(i=r.secure)||void 0===i||i,a=null!==(o=r.domain)&&void 0!==o?o:e.cookieDomain,d=da(r);s&&"https:"!==window.location.protocol&&ea("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const c=Object.assign(Object.assign({},e),{cookieSameSite:t,cookieSecure:s,cookieDomain:a});oa(d,l,c);const h=sa(a);u=Object.assign(Object.assign({},u),{refresh:{path:c.cookiePath,domain:h?a:void 0}})}else{const e=da(r);ys.remove(e),Ks(`${n}${na}`,l)}if(d)if(t){const n=t.sameSite||"Strict",r=null===(s=t.secure)||void 0===s||s,i=null!==(a=t.domain)&&void 0!==a?a:e.cookieDomain,o=aa(t);r&&"https:"!==window.location.protocol&&ea("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const l=Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:r,cookieDomain:i});oa(o,d,l);const c=sa(i);u=Object.assign(Object.assign({},u),{session:{path:l.cookiePath,domain:c?i:void 0}})}else Ks(`${n}${ta}`,d);return e.idToken&&Ks(`${n}${ra}`,e.idToken),c&&Ks(`${n}DTD`,c),u})(e,i,s,o);n&&(l=n)}}})),u=io(c,["logout","logoutAll","oidc.logout"],((e,t,n,r)=>i=>async(...o)=>{const s=await i(...o);return ha(e,t,n,null==r?void 0:r()),s})(s,i,o,(()=>l)));return Object.assign(u,{getRefreshToken:()=>la(s,o),getSessionToken:()=>ca(s,i),getIdToken:()=>ua(s)})}))((e=>{const t=ms(e),n=rd(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(r,i)=>{var o;if(Hs())return Qs(`Refresh called in native flow: ${(new Error).stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(r),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}if(i&&js&&void 0!==window.localStorage&&!Ys(Ua)&&!zs(Pa)&&!Ys("DSLI_DISABLED"))return Promise.resolve({ok:!0});const s=ca(),a=la();let d="";if(e.getExternalToken)try{d=await(null===(o=e.getExternalToken)||void 0===o?void 0:o.call(e))}catch(e){Qs("Error getting external token while refreshing",e)}return t.refresh(r,{dcs:s?"t":"f",dcr:a?"t":"f"},d,i)},logout:async r=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:r}),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:e.toString()}})}return t.logout(r)},flow:ed(t),webauthn:Ja(t),fedcm:(r=t,i=e.projectId,{onetap:{requestExchangeCode(e){Xa(r,e)},requestAuthentication(e){Xa(r,e)}},async oneTap(e,t,n,i,o){await Qa(r,{provider:e,oneTapConfig:t,loginOptions:n,onSkipped:i,onDismissed:o})},async launch(e){var t;const n={identity:{context:e||"signin",providers:[{configURL:r.httpClient.buildUrl(i+Za),clientId:i}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return r.refresh(o.token)},isSupported:()=>js&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=r.httpClient.buildUrl(i+Za);try{const r={identity:{context:e||"signin",providers:[{configURL:n,clientId:i}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(r));return!!o&&!!o.token}catch(e){return!1}}}),oidc:n});var r,i})),od={search:"/v1/mgmt/user/search",deleteBatch:"/v1/mgmt/user/delete/batch",create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/patch",status:"/v1/mgmt/user/update/status",setTempPassword:"/v1/mgmt/user/password/set/temporary",removePasskey:"/v1/mgmt/user/passkeys/delete",customAttributes:"/v1/mgmt/user/customattributes"},sd={roles:"/v1/mgmt/role/all",subTenantRoles:"/v1/mgmt/role/subtenant/all"},ad=e=>n(void 0,void 0,void 0,(function*(){const t=yield e.text(),n=JSON.parse(t);if(!e.ok){const t=`${n.errorDescription}${n.errorMessage?`: ${n.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(n),e.text=()=>Promise.resolve(t)})),dd=e=>n(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const r=[],i=(new Date).getTime();for(let e=1;e<10;e+=1)r.push({loginIds:[`user${e}@company.com`],externalIds:[`user${e}@company.com`],userId:`user-${e}`,name:`User ${e}`,email:`user${e}@company.com`,roleNames:[`Role ${e}`],phone:`+1-202-555-010${e}`,recoveryEmail:`recovery${e}@company.com`,recoveryPhone:`+1-202-555-020${e}`,verifiedEmail:!0,verifiedPhone:!0,verifiedRecoveryEmail:!0,verifiedRecoveryPhone:!0,userTenants:[{tenantId:"sub-tenant-1",tenantName:"Hurray",roleNames:["Role 1","Role 2"]}],status:"enabled",editable:!0,createdTime:i,createdTimeFormatted:new Date(1e3*(i||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:e%3==0,OIDC:e%3==1,SCIM:e%3==2,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{r.sort(((t,n)=>((e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof t){const r=e?1:0,i=t?1:0;return n?r-i:i-r}const r=(null==e?void 0:e.toString())||"",i=(null==t?void 0:t.toString())||"";return n?i.localeCompare(r):r.localeCompare(i)})(t[e.field],n[e.field],e.desc)))})),n(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.phone.toLowerCase().includes(e.toLowerCase())||t.status.toLowerCase().includes(e.toLowerCase())||"active"===e.toLowerCase()||t.familyName.toLowerCase().includes(e.toLowerCase())||t.givenName.toLowerCase().includes(e.toLowerCase())||t.middleName.toLowerCase().includes(e.toLowerCase())||t.email.toLowerCase().includes(e.toLowerCase()))))}))})),ld=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:r,roles:i,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,userTenants:h}){return new Promise((f=>{const p=Math.random().toString(10).substring(15);f({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:r,roleNames:i,customAttributes:o,picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),cd=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:r,roles:i,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,userTenants:h}){return new Promise((f=>{f({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:r,roleNames:i,customAttributes:o||{},picture:s,recoveryEmail:"",recoveryPhone:"",verifiedEmail:a,verifiedPhone:d,verifiedRecoveryEmail:!1,verifiedRecoveryPhone:!1,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:h||[],webauthn:!1})}))})),ud=()=>n(void 0,void 0,void 0,(function*(){})),hd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),fd=()=>n(void 0,void 0,void 0,(function*(){})),pd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),gd=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),vd=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),md=e=>new Promise((t=>{const n=[];for(let t=1;t<5;t+=1)n.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:n})})),$d=()=>new Promise((e=>{e({roles:[{tenantId:"sub-tenant-1",tenantName:"Sub Tenant 1",roleNames:["Role 1","Role 2"]},{tenantId:"sub-tenant-2",tenantName:"Sub Tenant 2",roleNames:["Role 1","Role 3"]},{tenantId:"sub-tenant-3",tenantName:"Sub Tenant 3",roleNames:["Role 2"]}]})})),yd=({httpClient:e,tenant:r,mock:i})=>({search:(...o)=>n(void 0,[...o],void 0,(function*(n={}){const{limit:o=1e4}=n,s=t(n,["limit"]);if(i)return dd(Object.assign(Object.assign({},s),{limit:o}));const a=yield e.post(od.search,Object.assign(Object.assign({},s),{limit:o,withTestUser:!1}),{queryParams:{tenant:r}});yield ad(a);return(yield a.json()).users})),deleteBatch:t=>n(void 0,void 0,void 0,(function*(){if(i)return ud();const n=yield e.post(od.deleteBatch,{userIds:t},{queryParams:{tenant:r}});return yield ad(n),n.json()})),create:t=>n(void 0,[t],void 0,(function*({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C}){if(i)return ld({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w,userTenants:C});const k=yield e.post(od.create,{loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:C,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m,sendSMS:$,sendMail:y,inviteUrl:b,invite:w},{queryParams:{tenant:r}});yield ad(k);return(yield k.json()).user})),update:t=>n(void 0,[t],void 0,(function*({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$}){if(i)return cd({loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,roles:l,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,givenName:p,middleName:g,familyName:v,additionalLoginIds:m,userTenants:$});const y=yield e.patch(od.update,{loginId:t,email:n,phone:o,recoveryEmail:s,recoveryPhone:a,displayName:d,givenName:p,middleName:g,familyName:v,roleNames:l,userTenants:$,customAttributes:c,picture:u,verifiedEmail:h,verifiedPhone:f,verifiedRecoveryEmail:!!s||void 0,verifiedRecoveryPhone:!!a||void 0,additionalLoginIds:m},{queryParams:{tenant:r}});yield ad(y);return(yield y.json()).user})),enable:t=>n(void 0,void 0,void 0,(function*(){if(i)return pd(t);const n=yield e.post(od.status,{loginId:t,status:"enabled"},{queryParams:{tenant:r}});return yield ad(n),n.json()})),disable:t=>n(void 0,void 0,void 0,(function*(){if(i)return gd(t);const n=yield e.post(od.status,{loginId:t,status:"disabled"},{queryParams:{tenant:r}});return yield ad(n),n.json()})),removePasskey:t=>n(void 0,void 0,void 0,(function*(){if(i)return fd();const n=yield e.post(od.removePasskey,{loginId:t},{queryParams:{tenant:r}});return yield ad(n),n.json()})),setTempPassword:t=>n(void 0,void 0,void 0,(function*(){if(i)return hd();const n=yield e.post(od.setTempPassword,{loginId:t},{queryParams:{tenant:r}});return yield ad(n),n.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(i)return vd();const t=yield e.get(od.customAttributes,{queryParams:{tenant:r}});yield ad(t);return(yield t.json()).data}))}),bd=({httpClient:e,tenant:t,mock:r})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(r)return md(t);const n=yield e.get(sd.roles,{queryParams:{tenant:t}});return yield ad(n),n.json()})),getSubTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(r)return $d();const n=yield e.get(sd.subTenantRoles,{queryParams:{tenant:t}});return yield ad(n),n.json()}))}),wd=h((e=>{var t,s,a,d;const l=o(N,Tn,A,C,j,_n,P({tenant:P.missingAttrValidator}))(e);return d=class extends l{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||Se}get api(){return r(this,s,"f")||r(this,t,"m",a).call(this),r(this,s,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{r(this,s,"f")&&r(this,t,"m",a).call(this)}))}))}},s=new WeakMap,t=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,s,((e,t,n,r)=>{const i=id(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":r,"x-descope-widget-version":"0.17.0"}}));return{user:yd({httpClient:i.httpClient,tenant:t,mock:n}),tenant:bd({httpClient:i.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},d})),Cd=h((e=>{const t=o(jn({name:"widget",initialState:ti,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{xr.reducer(e),Gr.reducer(e),Jr.reducer(e),Xr.reducer(e),Er.reducer(e),Lr.reducer(e),Nr.reducer(e),ei.reducer(e),Tr.reducer(e),Fr.reducer(e),Br.reducer(e)},asyncActions:{searchUsers:Lr.action,createUser:xr.action,updateUser:Gr.action,enableUser:Jr.action,disableUser:Xr.action,deleteUsers:Er.action,removePasskey:ei.action,getCustomAttributes:Tr.action,getTenantRoles:Fr.action,getSubTenantRoles:Br.action,setTempUserPassword:Nr.action}}),E,C,wd)(e);return class extends t{constructor(...e){super(...e),this.state=ti,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),kd=h((e=>{var t,i,a;return a=class extends(o(C,E,G,X,Ln("user-management-widget"),Cd,Mn)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return n(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this),this.injectStyle(".hidden { display: none; }");const o=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([r(this,t,"m",i).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes(),o]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,i=function(){return n(this,void 0,void 0,(function*(){const e=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},a})),Sd=h((e=>{var t,a,d,l,c,u,h,f,p;return p=class extends(o(Cd,we,Rn,C,Mn,kd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,(()=>n(this,void 0,void 0,(function*(){yield r(this,a,"f").setData(Gn(this.state).map((({name:e})=>({value:e,label:e}))))})))),f.set(this,(()=>{var e;const t=Yn(this.state);null===(e=r(this,d,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&r(this,l,"f").setData(Zn(this.state))}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",c).call(this)}))}},a=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,t=new WeakSet,c=function(){return n(this,void 0,void 0,(function*(){var e;this.createUserModal=this.createModal(),this.createUserModal.setContent(s(yield this.fetchWidgetPage("create-user-modal.html")));const o=new oe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}),c=()=>{this.resetFormData(this.createUserModal.ele),r(this,l,"f").value=[]};o.onClick((()=>{this.createUserModal.close(),c()}));const p=new oe((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});p.onClick((()=>n(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele),t=r(this,l,"f").mergedValue;this.actions.createUser(Object.assign(Object.assign({},Dn(e,"customAttributes")),{userTenants:t,invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),c()}})))),i(this,a,new me((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),i(this,d,null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-section"]'),"f"),i(this,l,new ve((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),r(this,h,"f").call(this),this.createUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield r(this,h,"f").call(this),r(this,f,"f").call(this),r(this,t,"m",u).call(this)}))}))},u=function(){const e=Jn(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,r]=t.split(".");if("customAttributes"!==n)return;const i=e.find((e=>e.name===r));i?i.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},p})),xd=h((e=>{var t,i,s;return s=class extends(o(C,Sd,kd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",i).call(this)}))}},t=new WeakSet,i=function(){var e;this.createButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},s})),Id=h((e=>{var t,i,a;return a=class extends(o(Cd,we,C,kd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",i).call(this)}))}},t=new WeakSet,i=function(){return n(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(s(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new oe((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteUsersModal.close()));const n=new oe((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=rr(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const r=new ye(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=fr(this.state);r.text=`Delete ${e}?`}}))},a})),Od=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd,Id)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),yr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.deleteButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-users"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteUsersModal.open()}))},a})),Ed=h((e=>{var t,i,a,d,l;return l=class extends(o(Cd,we,C,Rn,kd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new oe((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.disableUserModal.close()))},a=function(){new oe((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=cr(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(s(yield this.fetchWidgetPage("disable-user-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new ye(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=fr(this.state);o.text=`Disable ${e}?`}))}))},l})),Ad=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd,Ed,Rn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),gr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.disableButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="disable-user"]'),{logger:this.logger}),this.disableButton.disable(),this.disableButton.onClick((()=>{this.disableUserModal.open()}))},a}));var Pd={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-35])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:[56]94\\d|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",[6,7,8,9,10,11]],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[25-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[0135-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","(?:596\\d|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","38\\d{6}|[78]\\d{9,13}|(?:20|9\\d)\\d{8}",[8,10,11,12,13,14],[["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["3"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|8\\d\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[468]))\\d{4}|(?:305[3-9]|472[24]|505[2-57-9]|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["305209\\d{4}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","7093\\d{5}|(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function Nd(e){return Nd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nd(e)}function jd(e){var t=Ud();return function(){var n,r=_d(e);if(t){var i=_d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Nd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Rd(e)}(this,n)}}function Rd(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Td(e){var t="function"==typeof Map?new Map:void 0;return Td=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Md(e,arguments,_d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ld(r,e)},Td(e)}function Md(e,t,n){return Md=Ud()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&Ld(i,n.prototype),i},Md.apply(null,arguments)}function Ud(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ld(e,t){return Ld=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ld(e,t)}function _d(e){return _d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_d(e)}var Wd=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ld(e,t)}(r,e);var t,n=jd(r);function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),t=n.call(this,e),Object.setPrototypeOf(Rd(t),r.prototype),t.name=t.constructor.name,t}return t=r,Object.defineProperty(t,"prototype",{writable:!1}),t}(Td(Error)),Fd=2,Dd=17,qd=3,Bd="0-90-9٠-٩۰-۹",Hd="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~"),Vd="++";function Gd(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),r=t[0].split("."),i=0;i<3;i++){var o=Number(n[i]),s=Number(r[i]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}var Kd={}.constructor;function zd(e){return null!=e&&e.constructor===Kd}function Jd(e){return Jd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jd(e)}function Zd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yd(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Xd=" ext. ",Qd=/^\d+$/,el=function(){function e(t){Zd(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!zd(e)||!zd(e.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(zd(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+sl(e)+": "+e,"."))}(t),this.metadata=t,ll.call(this,t)}return Yd(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&Qd.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new tl(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new tl(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var n=this.nonGeographic()[e];if(n)return n}else{var r=this.countryCallingCodes()[e];if(r&&1===r.length&&"001"===r[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),tl=function(){function e(t,n){Zd(this,e),this.globalMetadataObject=n,this.metadata=t,ll.call(this,n.metadata)}return Yd(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this,t=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return t.map((function(t){return new nl(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(e){if(this.hasTypes()&&ol(this.types(),e))return new il(ol(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?Xd:this.metadata[13]||Xd}}]),e}(),nl=function(){function e(t,n){Zd(this,e),this._format=t,this.metadata=n}return Yd(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||rl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),rl=/^\(?\$1\)?$/,il=function(){function e(t,n){Zd(this,e),this.type=t,this.metadata=n}return Yd(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function ol(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var sl=function(e){return Jd(e)};function al(e,t){if((t=new el(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function dl(e,t){return t.countries.hasOwnProperty(e)}function ll(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===Gd(t,"1.2.0")?this.v2=!0:-1===Gd(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var cl=function(e){return"([".concat(Bd,"]{1,").concat(e,"})")};function ul(e){var t="[  \\t,]*",n="[:\\..]?[  \\t,-]*",r="#?",i="[  \\t]*";return";ext="+cl("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+cl("20")+r)+"|"+(t+"(?:[xx##~~]|int|int)"+n+cl("9")+r)+"|"+("[- ]+"+cl("6")+"#")+"|"+(i+"(?:,{2}|;)"+n+cl("15")+r)+"|"+(i+"(?:,)+"+n+cl("9")+r)}var hl="["+Bd+"]{"+Fd+"}",fl="[++]{0,1}(?:["+Hd+"]*["+Bd+"]){3,}["+Hd+Bd+"]*",pl=new RegExp("^[++]{0,1}(?:["+Hd+"]*["+Bd+"]){1,2}$","i"),gl=fl+"(?:"+ul()+")?",vl=new RegExp("^"+hl+"$|^"+gl+"$","i");var ml=new RegExp("(?:"+ul()+")$","i");function $l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return yl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yl(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var bl={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function wl(e){return bl[e]}function Cl(e){for(var t,n="",r=$l(e.split(""));!(t=r()).done;){var i=wl(t.value);i&&(n+=i)}return n}function kl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Sl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sl(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Sl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xl(e){for(var t,n="",r=kl(e.split(""));!(t=r()).done;){n+=Il(t.value,n)||""}return n}function Il(e,t,n){if("+"===e){if(t)return;return"+"}return wl(e)}function Ol(e,t){return function(e,t,n){var r=n.type(t),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=e.length,s=i[0];if(s===o)return"IS_POSSIBLE";if(s>o)return"TOO_SHORT";if(i[i.length-1]<o)return"TOO_LONG";return i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function El(e,t){return"IS_POSSIBLE"===Ol(e,t)}function Al(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Pl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nl(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var jl=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Rl(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new el(n)).selectNumberingPlan(e.country,e.countryCallingCode);var r=t.v2?e.nationalNumber:e.phone;if(Al(r,n.nationalNumberPattern())){if(Tl(r,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Tl(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,o=Pl(jl);!(i=o()).done;){var s=i.value;if(Tl(r,s,n))return s}}}}function Tl(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Al(e,t.pattern()))}function Ml(e,t,n){var r=new el(n).getCountryCodesForCallingCode(e);return r?r.filter((function(e){return function(e,t,n){var r=new el(n);if(r.selectNumberingPlan(t),r.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function Ul(e){return e.replace(new RegExp("[".concat(Hd,"]+"),"g")," ").trim()}var Ll=/(\$\d)/;function _l(e,t,n){var r=n.useInternationalFormat,i=n.withNationalPrefix;n.carrierCode,n.metadata;var o=e.replace(new RegExp(t.pattern()),r?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(Ll,t.nationalPrefixFormattingRule()):t.format());return r?Ul(o):o}var Wl=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Fl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Dl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dl(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ql(Object(n),!0).forEach((function(t){Hl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vl={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function Gl(e,t,n,r){if(n=n?Bl(Bl({},Vl),n):Vl,r=new el(r),e.country&&"001"!==e.country){if(!r.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));r.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";r.selectNumberingPlan(e.countryCallingCode)}var i,o=r.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?Jl(i=Kl(s,e.carrierCode,"NATIONAL",r,n),e.ext,r,n.formatExtension):"";case"INTERNATIONAL":return s?(i=Kl(s,null,"INTERNATIONAL",r,n),Jl(i="+".concat(o," ").concat(i),e.ext,r,n.formatExtension)):"+".concat(o);case"E.164":return"+".concat(o).concat(s);case"RFC3966":return function(e){var t=e.number,n=e.ext;if(!t)return"";if("+"!==t[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(n?";ext="+n:"")}({number:"+".concat(o).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,r,i){var o=al(r,i.metadata);if(o===n){var s=Kl(e,t,"NATIONAL",i);return"1"===n?n+" "+s:s}var a=function(e,t,n){var r=new el(n);return r.selectNumberingPlan(e,t),r.defaultIDDPrefix()?r.defaultIDDPrefix():Wl.test(r.IDDPrefix())?r.IDDPrefix():void 0}(r,void 0,i.metadata);if(a)return"".concat(a," ").concat(n," ").concat(Kl(e,null,"INTERNATIONAL",i))}(s,e.carrierCode,o,n.fromCountry,r);return Jl(a,e.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function Kl(e,t,n,r,i){var o=zl(r.formats(),e);return o?_l(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:r}):e}function zl(e,t){for(var n,r=Fl(e);!(n=r()).done;){var i=n.value;if(i.leadingDigitsPatterns().length>0){var o=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(Al(t,i.pattern()))return i}}function Jl(e,t,n,r){return t?r(e,t,n):e}function Zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zl(Object(n),!0).forEach((function(t){Xl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ql(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ec=function(){function e(t,n,r){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new TypeError("`country` or `countryCallingCode` not passed");if(!n)throw new TypeError("`nationalNumber` not passed");if(!r)throw new TypeError("`metadata` not passed");var i=function(e,t){var n,r,i=new el(t);tc(e)?(n=e,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=e;return{country:n,countryCallingCode:r}}(t,r),o=i.country,s=i.countryCallingCode;this.country=o,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return Ql(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Ml(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new el(n),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!n.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}}if(n.possibleLengths())return El(e.phone||e.nationalNumber,n);if(e.countryCallingCode&&n.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return function(e,t,n){return t=t||{},(n=new el(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Rl(e,t,n.metadata):Al(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new el(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Rl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Gl(this,e,t?Yl(Yl({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}]),e}(),tc=function(e){return/^[A-Z]{2}$/.test(e)};var nc=new RegExp("(["+Bd+"])");function rc(e,t,n,r){if(t){var i=new el(r);i.selectNumberingPlan(t,n);var o=new RegExp(i.IDDPrefix());if(0===e.search(o)){var s=(e=e.slice(e.match(o)[0].length)).match(nc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function ic(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(e);if(r){var i,o,s,a=r.length-1,d=a>0&&r[a];if(t.nationalPrefixTransformRule()&&d)i=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(o=r[1]);else{var l=r[0];i=e.slice(l.length),d&&(o=r[1])}if(d){var c=e.indexOf(r[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=r[0];return{nationalNumber:i,nationalPrefix:s,carrierCode:o}}}return{nationalNumber:e}}function oc(e,t){var n=ic(e,t),r=n.carrierCode,i=n.nationalNumber;if(i!==e){if(!function(e,t,n){if(Al(e,n.nationalNumberPattern())&&!Al(t,n.nationalNumberPattern()))return!1;return!0}(e,i,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Ol(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(i,t))return{nationalNumber:e}}return{nationalNumber:i,carrierCode:r}}function sc(e,t,n,r){var i=t?al(t,r):n;if(0===e.indexOf(i)){(r=new el(r)).selectNumberingPlan(t,n);var o=e.slice(i.length),s=oc(o,r).nationalNumber,a=oc(e,r).nationalNumber;if(!Al(a,r.nationalNumberPattern())&&Al(s,r.nationalNumberPattern())||"TOO_LONG"===Ol(a,r))return{countryCallingCode:i,number:o}}return{number:e}}function ac(e,t,n,r){if(!e)return{};var i;if("+"!==e[0]){var o=rc(e,t,n,r);if(!o||o===e){if(t||n){var s=sc(e,t,n,r),a=s.countryCallingCode,d=s.number;if(a)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:d}}return{number:e}}i=!0,e="+"+o}if("0"===e[1])return{};r=new el(r);for(var l=2;l-1<=qd&&l<=e.length;){var c=e.slice(1,l);if(r.hasCallingCode(c))return r.selectNumberingPlan(c),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function dc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return lc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lc(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function lc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cc(e,t){var n=t.countries;t.defaultCountry;var r=t.metadata;r=new el(r);for(var i,o=dc(n);!(i=o()).done;){var s=i.value;if(r.country(s),r.leadingDigits()){if(e&&0===e.search(r.leadingDigits()))return s}else if(Rl({phone:e,country:s},void 0,r.metadata))return s}}function uc(e,t){var n=t.nationalNumber,r=t.defaultCountry,i=t.metadata,o=i.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:cc(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var hc="+",fc="(["+Bd+"]|[\\-\\.\\(\\)]?)",pc=new RegExp("^\\"+hc+fc+"*["+Bd+"]"+fc+"*$","g"),gc=new RegExp("^("+("["+Bd+"]+((\\-)*["+Bd+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Bd+"])*")+"\\.?$","g"),vc="tel:",mc=";phone-context=",$c=";isub=";function yc(e,t){var n,r=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf(mc);if(t<0)return null;var n=t+mc.length;if(n>=e.length)return"";var r=e.indexOf(";",n);return r>=0?e.substring(n,r):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(pc.test(e)||gc.test(e))}(i))throw new Wd("NOT_A_NUMBER");if(null===i)n=r(e)||"";else{n="",i.charAt(0)===hc&&(n+=i);var o,s=e.indexOf(vc);o=s>=0?s+vc.length:0;var a=e.indexOf(mc);n+=e.substring(o,a)}var d=n.indexOf($c);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var bc=250,wc=new RegExp("[++"+Bd+"]"),Cc=new RegExp("[^"+Bd+"#]+$");function kc(e,t,n){if(t=t||{},n=new el(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Wd("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var r=function(e,t,n){var r=yc(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>bc){if(n)throw new Wd("TOO_LONG");return}if(!1===t)return e;var r=e.search(wc);if(r<0)return;return e.slice(r).replace(Cc,"")}(e,n,t)}});if(!r)return{};if(!function(e){return e.length>=Fd&&vl.test(e)}(r))return function(e){return pl.test(e)}(r)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(ml);if(t<0)return{};for(var n=e.slice(0,t),r=e.match(ml),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}(r);if(i.ext)return i;return{number:r}}(e,t.v2,t.extract),i=r.number,o=r.ext,s=r.error;if(!i){if(t.v2){if("TOO_SHORT"===s)throw new Wd("TOO_SHORT");throw new Wd("NOT_A_NUMBER")}return{}}var a=function(e,t,n,r){var i,o=ac(xl(e),t,n,r.metadata),s=o.countryCallingCodeSource,a=o.countryCallingCode,d=o.number;if(a)r.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};r.selectNumberingPlan(t,n),t&&(i=t),a=n||al(t,r.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=oc(xl(d),r),c=l.nationalNumber,u=l.carrierCode,h=uc(a,{nationalNumber:c,defaultCountry:t,metadata:r});h&&(i=h,"001"===h||r.country(i));return{country:i,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(i,t.defaultCountry,t.defaultCallingCode,n),d=a.country,l=a.nationalNumber,c=a.countryCallingCode,u=a.countryCallingCodeSource,h=a.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2)throw new Wd("INVALID_COUNTRY");return{}}if(!l||l.length<Fd){if(t.v2)throw new Wd("TOO_SHORT");return{}}if(l.length>Dd){if(t.v2)throw new Wd("TOO_LONG");return{}}if(t.v2){var f=new ec(c,l,n.metadata);return d&&(f.country=d),h&&(f.carrierCode=h),o&&(f.ext=o),f.__countryCallingCodeSource=u,f}var p=!!(t.extended?n.hasSelectedNumberingPlan():d)&&Al(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!El(l,n)),phone:l,ext:o}:p?function(e,t,n){var r={country:e,phone:t};n&&(r.ext=n);return r}(d,l,o):{}}function Sc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sc(Object(n),!0).forEach((function(t){Ic(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ic(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ac(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pc(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Nc(e){var t,n,r,i=Ac(Array.prototype.slice.call(e),4),o=i[0],s=i[1],a=i[2],d=i[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,s&&"string"!=typeof s){if(!zd(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,r=a):r=s}else d?(n=a,r=d):(n=void 0,r=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oc(Object(n),!0).forEach((function(t){Ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:r}}function jc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Rc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jc(Object(n),!0).forEach((function(t){Tc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Tc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mc(e,t,n){t&&t.defaultCountry&&!dl(t.defaultCountry,n)&&(t=Rc(Rc({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return kc(e,xc(xc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Wd))throw e}}function Uc(){var e=Nc(arguments);return Mc(e.text,e.options,e.metadata)}function Lc(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Wc=Lc((function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_c(this,e),this.key=t,this.value=n,this.next=r,this.prev=i})),Fc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;_c(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return Lc(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Wc(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Wc(e,t);this.cache[e]=this.head,this.size++}},{key:"get",value:function(e){if(this.cache[e]){var t=this.cache[e].value;return this.remove(e),this.put(e,t),t}console.log("Item not available in cache for key ".concat(e))}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(e){var t=this.cache[e];null!==t.prev?t.prev.next=t.next:this.head=t.next,null!==t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.cache[e],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),e}();function Dc(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var qc=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cache=new Fc(t)}return Dc(e,[{key:"getPatternForRegExp",value:function(e){var t=this.cache.get(e);return t||(t=new RegExp("^"+e),this.cache.put(e,t)),t}}]),e}();function Bc(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function Hc(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var Vc="   ᠎ - \u2028\u2029   ",Gc="[".concat(Vc,"]"),Kc="[^".concat(Vc,"]"),zc="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),Jc="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Zc="[".concat(Jc,"]"),Yc=new RegExp(Zc),Xc="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),Qc=new RegExp(Xc),eu="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),tu=new RegExp(eu),nu=new RegExp("[\0-€-ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function ru(e){return!(!Yc.test(e)&&!tu.test(e))&&nu.test(e)}function iu(e){return"%"===e||Qc.test(e)}function ou(e,t,n){var r=!0,i=Uc(e,n);if(i||(r=!1,i=Uc(e,{defaultCallingCode:t.countryCallingCode},n)),!i)return"INVALID_NUMBER";if(t.ext){if(i.ext!==t.ext)return"NO_MATCH"}else if(i.ext)return"NO_MATCH";return r&&t.countryCallingCode!==i.countryCallingCode?"NO_MATCH":t.number===i.number?r?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(i.nationalNumber)||0===i.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var su={POSSIBLE:function(e,t){return t.candidate,t.metadata,!0},VALID:function(e,t){var n=t.candidate;t.defaultCountry;var r=t.metadata;return!(!e.isValid()||!au(e,n,r))},STRICT_GROUPING:function(e,t){var n=t.candidate,r=t.defaultCountry,i=t.metadata;return t.regExpCache,!(!e.isValid()||!au(e,n,i)||lu(e,n)||!du(e,{defaultCountry:r,metadata:i}))&&cu()},EXACT_GROUPING:function(e,t){var n=t.candidate,r=t.defaultCountry,i=t.metadata;return t.regExpCache,!(!e.isValid()||!au(e,n,i)||lu(e,n)||!du(e,{defaultCountry:r,metadata:i}))&&cu()}};function au(e,t,n){for(var r=0;r<t.length-1;r++){var i=t.charAt(r);if("x"===i||"X"===i){var o=t.charAt(r+1);if("x"===o||"X"===o){if(r++,"NSN_MATCH"!==ou(t.substring(r),e,n))return!1}else{var s=Cl(t.substring(r));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function du(e,t){var n=t.defaultCountry,r=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var i=new el(r);i.selectNumberingPlan(e.countryCallingCode),e.country||uc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:i});var o=e.nationalNumber,s=zl(i.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!i.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function lu(e,t){var n=t.indexOf("/");if(n<0)return!1;var r=t.indexOf("/",n+1);return!(r<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===e.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===e.__countryCallingCodeSource)||Cl(t.substring(0,n))!==e.countryCallingCode||t.slice(r+1).indexOf("/")>=0)}function cu(e,t,n,r,i){throw new Error("This part of code hasn't been ported")}var uu=/[\\/] *x/;function hu(e){return Hc(uu,e)}var fu=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,pu=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,gu=/^:[0-5]\d/;function vu(e,t,n){if(fu.test(e))return!1;if(pu.test(e)){var r=n.slice(t+e.length);if(gu.test(r))return!1}return!0}var mu="(\\[([",$u=")\\])]",yu="[^".concat(mu).concat($u,"]"),bu="[".concat(mu).concat(Vd,"]"),wu=new RegExp("^"+bu),Cu=Bc(0,3),ku=new RegExp("^(?:[(\\[([])?(?:"+yu+"+["+$u+"])?"+yu+"+(?:["+mu+"]"+yu+"+["+$u+"])"+Cu+yu+"*$"),Su=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function xu(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Iu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Iu(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Iu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ou(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Eu=ul(),Au=["\\/+(.*)/","(\\([^(]*)","(?:".concat(Gc,"-|-").concat(Gc,")").concat(Gc,"*(.+)"),"[‒-―-]".concat(Gc,"*(.+)"),"\\.+".concat(Gc,"*([^.]+)"),"".concat(Gc,"+(").concat(Kc,"+)")],Pu=Bc(0,2),Nu=Bc(0,4),ju=Dd+qd,Ru=Bc(0,ju),Tu="[".concat(Hd,"]")+Nu,Mu=zc+Bc(1,ju),Uu="(?:"+bu+Tu+")"+Pu+Mu+"(?:"+Tu+Mu+")"+Ru+"(?:"+Eu+")?",Lu=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(Jc,"#]+$")),_u=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Wu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(n={v2:n.v2,defaultCallingCode:n.defaultCallingCode,defaultCountry:n.defaultCountry&&dl(n.defaultCountry,r)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||_u}).leniency)throw new TypeError("`leniency` is required");if("POSSIBLE"!==n.leniency&&"VALID"!==n.leniency)throw new TypeError('Invalid `leniency`: "'.concat(n.leniency,'". Supported values: "POSSIBLE", "VALID".'));if(n.maxTries<0)throw new TypeError("`maxTries` must be `>= 0`");if(this.text=t,this.options=n,this.metadata=r,this.leniency=su[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(Uu,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new qc(32)}return Ou(e,[{key:"find",value:function(){for(var e;this.maxTries>0&&null!==(e=this.PATTERN.exec(this.text));){var t=e[0],n=e.index;if(vu(t=hu(t),n,this.text)){var r=this.parseAndVerify(t,n,this.text)||this.extractInnerMatch(t,n,this.text);if(r){if(this.options.v2)return{startsAt:r.startsAt,endsAt:r.endsAt,number:r.phoneNumber};var i=r.phoneNumber,o={startsAt:r.startsAt,endsAt:r.endsAt,phone:i.nationalNumber};return i.country?o.country=i.country:o.countryCallingCode=i.countryCallingCode,i.ext&&(o.ext=i.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,n){for(var r,i=xu(Au);!(r=i()).done;)for(var o=r.value,s=!0,a=void 0,d=new RegExp(o,"g");this.maxTries>0&&null!==(a=d.exec(e));){if(s){var l=Hc(Lu,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=Hc(Lu,a[1]),h=e.indexOf(u,a.index),f=this.parseAndVerify(u,t+h,n);if(f)return f;this.maxTries--}}},{key:"parseAndVerify",value:function(e,t,n){if(function(e,t,n,r){if(ku.test(e)&&!Su.test(e)){if("POSSIBLE"!==r){if(t>0&&!wu.test(e)){var i=n[t-1];if(iu(i)||ru(i))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(iu(s)||ru(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var r=Uc(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(r&&r.isPossible())return this.leniency(r,{candidate:e,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+e.length,phoneNumber:r}:void 0}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var e=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",e}}]),e}();function Fu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Du=function(){function e(t){var n=t.onCountryChange,r=t.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.onCountryChange=n,this.onCallingCodeChange=r}return Fu(e,[{key:"reset",value:function(e){var t=e.country,n=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,n)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];this[r]=e[r]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}]),e}();function qu(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Bu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bu(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Hu="x",Vu=new RegExp(Hu);function Gu(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function Ku(e,t){return")"===e[t]&&t++,function(e){var t=[],n=0;for(;n<e.length;)"("===e[n]?t.push(n):")"===e[n]&&t.pop(),n++;var r=0,i="";t.push(e.length);for(var o=0,s=t;o<s.length;o++){var a=s[o];i+=e.slice(r,a),r=a+1}return i}(e.slice(0,t))}function zu(e,t,n){var r=n.metadata,i=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,n){var r=n.metadata,i=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var s=Ju(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:r});if(s)return s}return Ju(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:r})}(e,t,{metadata:r,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:o})}function Ju(e,t,n){var r=n.metadata,i=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=_l(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:r});if(i||(e.nationalPrefix?s=e.nationalPrefix+o(t)+s:e.complexPrefixBeforeNationalSignificantNumber&&(s=e.complexPrefixBeforeNationalSignificantNumber+" "+s)),function(e,t){return Cl(e)===t.getNationalDigits()}(s,e))return s}function Zu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Yu=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return Zu(e,[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw new Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],n=t.branches,r=t.instructions;if(n)return{op:"|",args:n.concat([th(r)])};if(0===r.length)throw new Error("Pattern is required");return 1===r.length?r[0]:r}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw new Error("Pattern is required");var t=e.match(eh);if(t){var n=t[1],r=e.slice(0,t.index),i=e.slice(t.index+n.length);switch(n){case"(?:":r&&this.parsePattern(r),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(r&&this.parsePattern(r),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(th(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:o});break;case"|":if(!this.getContext().or)throw new Error('"|" operator can only be used inside "or" groups');if(r&&this.parsePattern(r),!this.getContext().branches){if(1!==this.context.length)throw new Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(th(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":r&&this.parsePattern(r),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw new Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:Xu(r)});break;default:throw new Error("Unknown operator: ".concat(n))}i&&this.parsePattern(i)}else{if(Qu.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function Xu(e){for(var t=[],n=0;n<e.length;){if("-"===e[n]){if(0===n||n===e.length-1)throw new Error("Couldn't parse a one-of set pattern: ".concat(e));for(var r=e[n-1].charCodeAt(0)+1,i=e[n+1].charCodeAt(0)-1,o=r;o<=i;)t.push(String.fromCharCode(o)),o++}else t.push(e[n]);n++}return t}var Qu=/[\(\)\[\]\?\:\|]/,eh=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function th(e){return 1===e.length?e[0]:e}function nh(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return rh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rh(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function rh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ih(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var oh=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matchTree=(new Yu).parse(t)}return ih(e,[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw new Error("String is required");var n=sh(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function sh(e,t,n){if("string"==typeof t){var r=e.join("");return 0===t.indexOf(r)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===r.indexOf(t)?n&&e.length>t.length?{overflow:!0}:{match:!0,matchedChars:e.slice(0,t.length)}:void 0}if(Array.isArray(t)){for(var i=e.slice(),o=0;o<t.length;){var s=sh(i,t[o],n&&o===t.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw new Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(i=i.slice(s.matchedChars.length)).length)return o===t.length-1?{match:!0,matchedChars:e}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:e.slice(0,e.length-i.length)}}switch(t.op){case"|":for(var a,d,l=nh(t.args);!(d=l()).done;){var c=sh(e,d.value,n);if(c){if(c.overflow)return c;if(c.match)return{match:!0,matchedChars:c.matchedChars};if(!c.partialMatch)throw new Error("Unsupported match result:\n".concat(JSON.stringify(c,null,2)));a=!0}}return a?{partialMatch:!0}:void 0;case"[]":for(var u,h=nh(t.args);!(u=h()).done;){var f=u.value;if(e[0]===f)return 1===e.length?{match:!0,matchedChars:e}:n?{overflow:!0}:{match:!0,matchedChars:[f]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function ah(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return dh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dh(e,t)}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function dh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ch=Gu("9",15),uh=/[- ]/,hh=new RegExp("["+Hd+"]*\\$1["+Hd+"]*(\\$\\d["+Hd+"]*)*$"),fh=function(){function e(t){t.state;var n=t.metadata;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=n,this.resetFormat()}return lh(e,[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var n=this;if(function(e,t){return"IS_POSSIBLE"===Ol(e,t)}(t.nationalSignificantNumber,this.metadata))for(var r,i=ah(this.matchingFormats);!(r=i()).done;){var o=r.value,s=zu(t,o,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return n.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return n.getSeparatorAfterNationalPrefix(e)}});if(s)return this.resetFormat(),this.chosenFormat=o,this.setNationalNumberTemplate(s.replace(/\d/g,Hu),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(Hu),s}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var n=this.chosenFormat,r=this.chooseFormat(t);if(r)return r===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,n=e.nationalSignificantNumber,r=e.nationalPrefix,i=e.international,o=n,s=o.length-3;s<0&&(s=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,i,r)&&t.formatMatches(e,o,s)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,n){return!(n&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat())&&!(!t&&!n&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,n){var r=e.leadingDigitsPatterns().length;if(0===r)return!0;n=Math.min(n,r-1);var i=e.leadingDigitsPatterns()[n];if(t.length<3)try{return void 0!==new oh(i).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(i,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,n=this,r=function(){var r=t.value;return n.chosenFormat===r?"break":hh.test(n.getFormatFormat(r,e.international))?n.createTemplateForFormat(r,e)?(n.chosenFormat=r,"break"):(n.matchingFormats=n.matchingFormats.filter((function(e){return e!==r})),"continue"):"continue"},i=ah(this.matchingFormats.slice());!(t=i()).done;){var o=r();if("break"===o)break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var n=this.getTemplateForFormat(e,t);return n?(this.setNationalNumberTemplate(n,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&uh.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var n=e.IDDPrefix,r=e.missingPlus;return n?t&&!1===t.spacing?n:n+" ":r?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,n=0,r=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";n<r.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(Hu,t+1),n++;return Ku(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,Hu)+Gu(Hu,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var n=t.nationalSignificantNumber,r=t.international,i=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,s=e.pattern();s=s.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var a=ch.match(s)[0];if(!(n.length>a.length)){var d=new RegExp("^"+s+"$"),l=n.replace(/\d/g,"9");d.test(l)&&(a=l);var c,u=this.getFormatFormat(e,r);if(this.shouldTryNationalPrefixFormattingRule(e,{international:r,nationalPrefix:i})){var h=u.replace(Ll,e.nationalPrefixFormattingRule());if(Cl(e.nationalPrefixFormattingRule())===(i||"")+Cl("$1")&&(u=h,c=!0,i))for(var f=i.length;f>0;)u=u.replace(/\d/,Hu),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),Hu);return c||(o?p=Gu(Hu,o.length)+" "+p:i&&(p=Gu(Hu,i.length)+this.getSeparatorAfterNationalPrefix(e)+p)),r&&(p=Ul(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var r,i=qu(n.split(""));!(r=i()).done;){var o=r.value;if(e.slice(t+1).search(Vu)<0)return;t=e.search(Vu),e=e.replace(Vu,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Ku(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var n=t.international,r=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&r||!i&&!n)return!0}}}]),e}();function ph(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return gh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var mh=new RegExp("^"+("["+Hd+Bd+"]+")+"$","i"),$h="(?:[++]["+Hd+Bd+"]*|["+Hd+Bd+"]+)",yh=new RegExp("[^"+Hd+Bd+"]+.*$"),bh=/[^\d\[\]]/,wh=function(){function e(t){var n=t.defaultCountry,r=t.defaultCallingCode,i=t.metadata,o=t.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaultCountry=n,this.defaultCallingCode=r,this.metadata=i,this.onNationalSignificantNumberChange=o}return vh(e,[{key:"input",value:function(e,t){var n,r=function(e){var t=function(e){var t=function(e){var t,n=e.search($h);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(yh,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=ph(t,2),r=n[0],i=n[1];mh.test(r)||(r="");return[r,i]}(e),i=ph(r,2),o=i[0],s=i[1],a=Cl(o);return s&&(t.digits||(t.startInternationalNumber(),a||(n=!0))),a&&this.inputDigits(a,t),{digits:a,justLeadingPlus:n}}},{key:"inputDigits",value:function(e,t){var n=t.digits,r=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),r&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,n=e.callingCode;return t&&!n}},{key:"extractCountryCallingCode",value:function(e){var t=ac("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode,r=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:r}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&bh.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=ic(e,this.metadata),r=n.nationalPrefix,i=n.nationalNumber,o=n.carrierCode;if(i!==e)return this.onExtractedNationalNumber(r,o,i,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var r=ic(e,this.metadata),i=r.nationalPrefix,o=r.nationalNumber,s=r.carrierCode;if(o!==t)return this.onExtractedNationalNumber(i,s,o,e,n),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,n,r,i){var o,s,a=r.lastIndexOf(n);if(a>=0&&a===r.length-n.length){s=!0;var d=r.slice(0,a);d!==e&&(o=d)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:n,nationalSignificantNumberMatchesInput:s,complexPrefixBeforeNationalSignificantNumber:o}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,n=e.IDDPrefix,r=e.digits;if(e.nationalSignificantNumber,!t&&!n){var i=rc(r,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==i&&i!==r?(e.update({IDDPrefix:r.slice(0,r.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=sc(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),n=t.countryCallingCode;if(t.number,n)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:n}),!0}}},{key:"startInternationalNumber",value:function(e,t){var n=t.country,r=t.callingCode;e.startInternationalNumber(n,r),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}]),e}();function Ch(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return kh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var xh=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata=new el(n);var r=Ch(this.getCountryAndCallingCode(t),2),i=r[0],o=r[1];this.defaultCountry=i,this.defaultCallingCode=o,this.reset()}return Sh(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(zd(e)?(t=e.defaultCountry,n=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,n]}},{key:"input",value:function(e){var t=this.parser.input(e,this.state),n=t.digits;if(t.justLeadingPlus)this.formattedOutput="+";else if(n){var r;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(r=this.formatter.format(n,this.state)),void 0===r&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var i=this.state.getNationalDigits();i&&(r=this.formatter.format(i,this.state))}this.formattedOutput=r?this.getFullNumber(r):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Du({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,n){e.metadata.selectNumberingPlan(n,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new fh({state:this.state,metadata:this.metadata}),this.parser=new wh({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){var t=this;if(this.isInternational()){var n=function(e){return t.formatter.getInternationalPrefixBeforeCountryCallingCode(t.state,{spacing:!!e})+e},r=this.state.callingCode;return n(r?e?"".concat(r," ").concat(e):r:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.complexPrefixBeforeNationalSignificantNumber,r=e.nationalPrefix,i=t,o=n||r;return o&&(i=o+i),i}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,Hu)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(uc(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,n=e.callingCode,r=e.country,i=e.nationalSignificantNumber;if(t)return this.isInternational()?n?"+"+n+i:"+"+t:r||n?"+"+(r?this.metadata.countryCallingCode():n)+i:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,r=e.callingCode,i=this._getCountry();if(t&&(i||r)){if(i&&i===this.defaultCountry){var o=new el(this.metadata.metadata);o.selectNumberingPlan(i);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=cc(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(i=d)}}var l=new ec(i||r,t,this.metadata.metadata);return n&&(l.carrierCode=n),l}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function Ih(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Pd),e.apply(this,n)}(Uc,arguments)}function Oh(e,t){return Wu.call(this,e,t,Pd)}function Eh(e){return xh.call(this,e,Pd)}function Ah(){return el.call(this,Pd)}Oh.prototype=Object.create(Wu.prototype,{}),Oh.prototype.constructor=Oh,Eh.prototype=Object.create(xh.prototype,{}),Eh.prototype.constructor=Eh,Ah.prototype=Object.create(el.prototype,{}),Ah.prototype.constructor=Ah;const Ph=e=>{if(!e)return e;const t=Ih(e.startsWith("+")?e:`+${e}`);if(!t)return e;const n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return(null==t?void 0:t.number.replace(n,"$1-$2"))||e},Nh=h((e=>{var a,d,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(Cd,we,C,Rn,Mn,kd)(e)){constructor(){super(...arguments),a.add(this),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),u.set(this,void 0),p.set(this,(()=>n(this,void 0,void 0,(function*(){yield r(this,l,"f").setData(Gn(this.state).map((({name:e})=>({value:e,label:e}))))})))),g.set(this,(()=>{var e;const t=Yn(this.state);null===(e=r(this,c,"f"))||void 0===e||e.classList.toggle("hidden",!t),t&&r(this,u,"f").setData(Zn(this.state))})),m.set(this,(()=>{var e,t;const n=null===(e=nr(this.state))||void 0===e?void 0:e[0],i=Object.assign({loginId:null===(t=null==n?void 0:n.loginIds)||void 0===t?void 0:t.join(", "),displayName:null==n?void 0:n.name,email:null==n?void 0:n.email,phone:Ph(null==n?void 0:n.phone),recoveryEmail:null==n?void 0:n.recoveryEmail,recoveryPhone:Ph(null==n?void 0:n.recoveryPhone),roles:null==n?void 0:n.roleNames,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},qn(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i),r(this,u,"f").value=(null==n?void 0:n.userTenants)||[]}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),yield r(this,a,"m",$).call(this)}))}},d=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,a=new WeakSet,h=function(){new oe((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editUserModal.close()))},f=function(){new oe((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{if(this.validateForm(this.editUserModal.ele)){const e=this.getFormData(this.editUserModal.ele),{loginId:n}=e,i=t(e,["loginId"]),o=r(this,c,"f")&&!r(this,c,"f").classList.contains("hidden")?r(this,u,"f").mergedValue:void 0;this.actions.updateUser(Object.assign(Object.assign({loginId:n.split(", ")[0]},Dn(i,"customAttributes")),void 0!==o&&{userTenants:o})),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},v=function(){const e=Jn(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,r]=t.split(".");if("customAttributes"!==n)return;const i=e.find((e=>e.name===r));i?i.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},$=function(){return n(this,void 0,void 0,(function*(){var e,t;this.editUserModal=this.createModal(),this.editUserModal.setContent(s(yield this.fetchWidgetPage("edit-user-modal.html"))),r(this,a,"m",h).call(this),r(this,a,"m",f).call(this),i(this,d,new be(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),i(this,l,new me((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),i(this,c,null===(t=this.editUserModal.ele)||void 0===t?void 0:t.querySelector('[data-id="sub-tenant-section"]'),"f"),i(this,u,new ve((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="sub-tenant-mappings"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=this.getWidgetConfig().then((e=>(null==e?void 0:e.allowSubTenants)?this.actions.getSubTenantRoles():void 0));yield Promise.all([this.actions.getTenantRoles(),e]),yield r(this,p,"f").call(this),r(this,d,"f").disable(),r(this,g,"f").call(this),r(this,m,"f").call(this),r(this,a,"m",v).call(this)}))}))},y})),jh=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd,Nh,Rn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),vr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.editButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-user"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editUserModal.open()}))},a})),Rh=h((e=>{var t,i,a,d,l;return l=class extends(o(Cd,we,C,Rn,kd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new oe((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.enableUserModal.close()))},a=function(){new oe((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=cr(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(s(yield this.fetchWidgetPage("enable-user-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new ye(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=fr(this.state);o.text=`Activate ${e}?`}))}))},l})),Th=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd,Rh,Rn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),pr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.enableButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="enable-user"]'),{logger:this.logger}),this.enableButton.disable(),this.enableButton.onClick((()=>{this.enableUserModal.open()}))},a})),Mh=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,c((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",s).call(this)}))}},i=new WeakMap,t=new WeakSet,s=function(){var e;this.searchInput=new be(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(r(this,i,"f"))},a})),Uh=new Set(["contains","not-contains","starts-with","ends-with","not-equal"]),Lh=e=>{const t=Array.isArray(e)?e[0]:e;return null==t||""===t?null:String(t)},_h=e=>Array.isArray(e)?e:null==e||""===e?[]:[String(e)],Wh=(e,t)=>({[e]:t}),Fh=(e,t)=>({customAttributes:{[e]:t}}),Dh=(e,t)=>{var n,r;const i=Lh(t.value);if(null===i)return{};return((e,t,n)=>({searchFields:[Object.assign({field:e,valStr:t},n?{negative:!0}:{})]}))(e,`${null!==(n=t.prefix)&&void 0!==n?n:""}${i}${null!==(r=t.suffix)&&void 0!==r?r:""}`,t.operator.startsWith("not-"))},qh=(e,t)=>((e,t)=>"equal"===t.operator&&null!=e.exactField)(e,t)?((e,t)=>{const n=_h(t.value);return n.length?Wh(e,n):{}})(e.exactField,t):((e,t)=>Uh.has(t.operator)&&null!=e.likeField)(e,t)?Dh(e.likeField,t):null,Bh=(e,t,n)=>{if((e=>"is-empty"===e.operator)(t))return Fh(e.name,null);if(!(e=>"equal"===e.operator||"is-any-of"===e.operator)(t))return{};const r=((e,t)=>{if(Array.isArray(e))return e.length?e:void 0;if(null!=e&&""!==e){if("boolean"===t)return"true"===e||"false"!==e&&void 0;if("number"===t){const t=Number(e);return Number.isFinite(t)?t:void 0}return e}})(t.value,n);return void 0===r?{}:Fh(e.name,r)},Hh=(e,t)=>{const{mapping:n}=e;if(!n)return null;switch(n.kind){case"array":return((e,t)=>{if("is-any-of"!==t.operator)return null;const n=_h(t.value);if(!n.length)return{};const r=e.valueMap?n.map((t=>{var n;return null!==(n=e.valueMap[t])&&void 0!==n?n:t})):n;return Wh(e.field,r)})(n,t);case"boolean":return((e,t)=>{if("equal"!==t.operator)return null;const n=Lh(t.value);return"true"===n?Wh(e.field,!0):"false"===n?Wh(e.field,!1):{}})(n,t);case"text":return qh(n,t);case"customAttribute":return Bh(n,t,e.inputType);default:return null}},Vh=(e,n)=>{const{searchFields:r,customAttributes:i}=n,o=t(n,["searchFields","customAttributes"]),s=r?(a=e.searchFields,d=r,[...null!=a?a:[],...d]):e.searchFields;var a,d;const l=i?((e,t)=>Object.assign(Object.assign({},null!=e?e:{}),t))(e.customAttributes,i):e.customAttributes,c=Object.assign({},e);return Object.entries(o).forEach((([e,t])=>{var n,r;c[e]=(n=c[e],r=t,Array.isArray(n)&&Array.isArray(r)?[...n,...r.filter((e=>!n.includes(e)))]:r)})),Object.assign(Object.assign({},c),{searchFields:s,customAttributes:l})},Gh=(e,t=[])=>{const n={};(e=>{const t=new Set(["searchFields","customAttributes"]);return e.forEach((e=>{const n=null==e?void 0:e.mapping;n&&("array"===n.kind||"boolean"===n.kind?t.add(n.field):"text"===n.kind&&n.exactField&&t.add(n.exactField))})),t})(t).forEach((e=>{n[e]=void 0}));const r=new Map(t.filter((e=>Boolean(e))).map((e=>[e.id,e])));return e.reduce(((e,t)=>{const n=((e,t)=>{if(e.column&&e.operator)return t.get(e.column)})(t,r);if(!n)return e;const i=Hh(n,t);return i?Vh(e,i):e}),n)},Kh="customAttributes.",zh="roles",Jh=e=>{if("string"==typeof e)return{value:e,label:e};const{value:t,label:n}=e;return{value:t,label:n||t}},Zh=(e,t)=>{const n=e.id.slice(17),r=null==t?void 0:t.find((e=>e.name===n));if(!r)return e;const i=e.label||r.displayName||n,o=(e=>Array.isArray(e.options)&&e.options.length?e.options.map(Jh):void 0)(r),s=Object.assign(Object.assign({},e),{label:i});return o&&(s.options=o),s},Yh=(e,t,n)=>{var r;const i=((e,t)=>{if(!(null==t?void 0:t.length))return e.filter((e=>(null==e?void 0:e.id)!==zh));const n=t.map((e=>({value:e.name,label:e.name})));return e.map((e=>(null==e?void 0:e.id)===zh?Object.assign(Object.assign({},e),{options:n}):e))})(null!==(r=null==e?void 0:e.slice())&&void 0!==r?r:[],t);return((e,t)=>e.filter((e=>{var n;if(!(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n.startsWith(Kh))||void 0===t)return!0;const r=e.id.slice(17);return t.some((e=>e.name===r))})).map((e=>{var n;return(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n.startsWith(Kh))?Zh(e,t):e})))(i,n)},Xh=h((e=>{var t,s,a,l,c,u,h,f;return f=class extends(o(C,kd,Cd)(e)){constructor(){super(...arguments),t.set(this,null),s.set(this,(()=>r(this,t,"f")?[...r(this,t,"f")]:this.filter.data)),a.set(this,(e=>{const t=Array.isArray(null==e?void 0:e.value)?e.value:[];this.actions.searchUsers(Object.assign(Object.assign({},Gh(t,r(this,s,"f").call(this))),{page:0}))})),l.set(this,(()=>{this.actions.searchUsers(Object.assign(Object.assign({},Gh([],r(this,s,"f").call(this))),{page:0}))})),c.set(this,d(((e,t,n)=>{this.filter.data=Yh(e,t,n)}))),u.set(this,(()=>{var e;(null===(e=this.filter)||void 0===e?void 0:e.isExists)&&r(this,c,"f").call(this,r(this,t,"f"),Gn(this.state),Jn(this.state))})),h.set(this,(()=>{i(this,t,Object.freeze(this.filter.data.slice()),"f"),r(this,u,"f").call(this)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var t,n;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this);const i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector("descope-filter");this.filter=new ie(i,{logger:this.logger}),this.filter.isExists&&(this.filter.onDataChange(r(this,h,"f")),r(this,h,"f").call(this),this.subscribe(r(this,u,"f"),Gn),this.subscribe(r(this,u,"f"),Jn),this.filter.onApply(r(this,a,"f")),this.filter.onClear(r(this,l,"f")))}))}},t=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,h=new WeakMap,f}));const Qh={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},ef=h((e=>{var t,i,s,a,l;return l=class extends(o(C,Cd,ke,E)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{e.length&&(e.forEach((({type:e,msg:n})=>{const o=r(this,t,"m",s).call(this,e);o.setContent(r(this,t,"m",i).call(this,{type:e,msg:n})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(r(this,a,"f").bind(this),zn)}))}},a=new WeakMap,t=new WeakSet,i=function({type:e,msg:t}){const n=Qh[e],r=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==n?void 0:n.outerHTML)||""}${t}${r.outerHTML}`},s=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},l})),tf=h((e=>{var t,i,a,d,l;return l=class extends(o(Cd,we,C,Rn,kd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new oe((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.removePasskeyModal.close()))},a=function(){new oe((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=cr(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(s(yield this.fetchWidgetPage("remove-passkey-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new ye(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=fr(this.state);o.text=`Remove passkey for ${e}?`}))}))},l})),nf=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd,tf,Rn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),mr)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.removePasskeyButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="remove-passkey"]'),{logger:this.logger}),this.removePasskeyButton.disable(),this.removePasskeyButton.onClick((()=>{this.removePasskeyModal.open()}))},a})),rf=h((e=>{var t,i,s,a,l,u,h,f;return f=class extends(o(Cd,C,kd)(e)){constructor(){super(...arguments),t.add(this),a.set(this,d((e=>{this.usersTable.data=e}))),l.set(this,c(((e,t)=>{const n=[],{value:r}=t;if(r){const t=e.path;n.push({field:t,desc:"desc"===r})}this.actions.searchUsers({sort:n})}))),u.set(this,d((e=>{this.usersTable.filterColumns((t=>{var n;const[r,i]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==r||!!(null==e?void 0:e.find((e=>e.name===i)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",s).call(this),r(this,a,"f").call(this,tr(this.state)),r(this,u,"f").call(this,Jn(this.state)),this.subscribe(r(this,u,"f").bind(this),Jn),this.subscribe(r(this,a,"f").bind(this),tr)}))}},a=new WeakMap,l=new WeakMap,u=new WeakMap,t=new WeakSet,i=function(){const e=e=>{var t;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(`[path="${e}"]`)},t=e=>{var t;const n=`descope-grid-${e}-column`;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(n)},n=this.usersTable.renderColumn;this.usersTable.renderColumn=({path:r,header:i,type:o,attrs:s})=>{const a=e(r)||t(o);if(!a)return n({path:r,header:i,type:o,attrs:s});const d=a.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:i});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},s=function(){var e;this.usersTable=new ce(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="users-table"]'),{logger:this.logger}),this.usersTable.onSelectedItemsChange((e=>{this.actions.setSelectedUsersIds(e.detail.value.map((({loginIds:e})=>e)))})),this.usersTable.onColumnsChange(r(this,t,"m",h).bind(this)),r(this,t,"m",i).call(this),r(this,t,"m",h).call(this)},h=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{r(this,l,"f").call(this,e.target,e.detail)}))}))},f})),of=h((e=>{var t,i,a;return a=class extends(o(Cd,we,C,Rn,kd)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",i).call(this)}))}},t=new WeakSet,i=function(){return n(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(s(yield this.fetchWidgetPage("generated-password-modal.html")));new oe((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.generatedPasswordModal.ele)["generated-password"]),this.resetFormData(this.generatedPasswordModal.ele),this.generatedPasswordModal.close()}))}))},a})),sf=h((e=>{var t,i,a,d,l;return l=class extends(o(Cd,we,C,Rn,kd,of)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield r(this,t,"m",d).call(this)}))}},t=new WeakSet,i=function(){new oe((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.resetPasswordModal.close()))},a=function(){new oe((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){var e;const t=cr(this.state),n=yield this.actions.setTempUserPassword(t);this.resetPasswordModal.close(),this.setFormData(this.generatedPasswordModal.ele,{"generated-password":null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext}),this.generatedPasswordModal.open()}))))},d=function(){return n(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(s(yield this.fetchWidgetPage("reset-password-modal.html"))),r(this,t,"m",i).call(this),r(this,t,"m",a).call(this);const o=new ye(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=fr(this.state);o.text=`This will generate a new temporary password for ${e}?`}))}))},l})),af=h((e=>{var t,i,s,a;return a=class extends(o(C,kd,Cd,sf,Rn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,d((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;r(this,t,"m",i).call(this),yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.subscribe(r(this,s,"f").bind(this),$r)}))}},s=new WeakMap,t=new WeakSet,i=function(){var e;this.resetPasswordButton=new oe(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="reset-password"]'),{logger:this.logger}),this.resetPasswordButton.disable(),this.resetPasswordButton.onClick((()=>{this.resetPasswordModal.open()}))},a})),df=h((e=>class extends(o(Pe,A)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),lf=h((e=>{var t,s,a,l,c,u,h,f,p,g,v,m,$,y;return y=class extends(o(Un,df,Cd,we,C,Rn,kd,Wn)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),a.set(this,void 0),l.set(this,[]),c.set(this,null),u.set(this,null),$.set(this,d((e=>{r(this,l,"f").forEach((t=>{"onlyOne"===t.enableMode&&1===e.length||"oneOrMore"===t.enableMode&&e.length>0||"always"===t.enableMode?t.enable():t.disable()}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),r(this,t,"m",p).call(this),r(this,t,"m",f).call(this),r(this,$,"f").call(this,Kn(this.state))}))}},s=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,$=new WeakMap,t=new WeakSet,h=function(e){const n=new ae(e,{logger:this.logger});n.onClick((()=>{r(this,t,"m",m).call(this,n.flowId)})),this.subscribe(r(this,$,"f").bind(this),Kn),r(this,l,"f").push(n)},f=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{r(this,t,"m",h).call(this,e)}))},p=function(){i(this,s,this.createModal({"data-id":"generic-flow-modal"}),"f"),r(this,s,"f").afterClose=()=>{var e;r(this,c,"f")&&(null===(e=r(this,u,"f"))||void 0===e||e.call(this),i(this,c,null,"f"))},i(this,a,new se((()=>{var e;return null===(e=r(this,s,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(r(this,a,"f"))},g=function(){var e;r(this,s,"f").open(),null===(e=r(this,u,"f"))||void 0===e||e.call(this)},v=function(e,n){n=()=>r(this,t,"m",g).call(this),i(this,u,r(this,a,"f").onPageUpdated(n),"f")},m=function(e){r(this,s,"f").setContent(this.createFlowTemplate({flowId:e,client:{userIds:rr(this.state),loginIds:ir(this.state),usersAndRoles:or(this.state)},tenant:this.tenantId})),r(this,t,"m",v).call(this,r(this,s,"f"),r(this,c,"f")),r(this,a,"f").onSuccess((()=>{r(this,s,"f").close(),this.actions.searchUsers()}))},y})),cf="widget-flow",uf=h((e=>{var t,i,s;return s=class extends(o(Un,E,we,Cd,_n,C,Pe,Wn)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var n;yield null===(n=e.init)||void 0===n?void 0:n.call(this);const o=Hn(cf);o&&(!function(e){if(window.history.replaceState&&Hn(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}(cf),r(this,t,"m",i).call(this,o))}))}},t=new WeakSet,i=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(this.createFlowTemplate({flowId:e}));new se((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close()})),t.afterClose=()=>{t.remove()},t.open()},s})),hf=h((e=>class extends(o(_,Pe,uf,rf,xd,Od,jh,Th,Ad,af,nf,Mh,Xh,ef,lf)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),ff=o((e=>class extends(hf(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield Promise.resolve().then((function(){return Yv})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.17.0"}}}))}}))(HTMLElement);customElements.define("descope-user-management-widget",ff);const pf=(e,t,n,r={})=>{var i,o,s,a;return[Math.min(Math.max(t,("all"===r.left?e.offsetWidth:null!==(i=r.left)&&void 0!==i?i:0)-e.offsetWidth),window.innerWidth-("all"===r.right?e.offsetWidth:null!==(o=r.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===r.top?e.offsetHeight:null!==(s=r.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===r.bottom?e.offsetHeight:null!==(a=r.bottom)&&void 0!==a?a:0))]};var gf,vf,mf,$f,yf,bf,wf,Cf,kf,Sf;const xf=document.createElement("template");xf.innerHTML='\n<div class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n';const If=o(J)(HTMLElement);class Of extends If{constructor(){var e;super(),gf.add(this),vf.set(this,new $({messages:[]})),mf.set(this,void 0),$f.set(this,void 0),yf.set(this,void 0),bf.set(this,{resize:r(this,gf,"m",Sf).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(xf.content.cloneNode(!0)),this.injectStyle('\n.debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),i(this,mf,this.shadowRoot.querySelector(".debugger"),"f"),r(this,mf,"f").style.top="32px",r(this,mf,"f").style.left=window.innerWidth-300-32+"px",i(this,$f,r(this,mf,"f").querySelector(".content"),"f"),i(this,yf,r(this,mf,"f").querySelector(".header"),"f")}updateData(e){r(this,vf,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let r=0,i=0,o=0,s=0;function a(t){t.preventDefault(),r=o-t.clientX,i=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=pf(e,e.offsetLeft-r,e.offsetTop-i,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(r(this,mf,"f"),r(this,yf,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",r(this,bf,"f").resize),(e=r(this,mf,"f")).onmousemove=t=>{var n;const r=t.target;(r.w&&r.w!==r.offsetWidth||r.h&&r.h!==r.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),r.w=r.offsetWidth,r.h=r.offsetHeight},r(this,mf,"f").onresize=r(this,gf,"m",kf).bind(this),r(this,vf,"f").subscribe(r(this,gf,"m",wf).bind(this))}disconnectedCallback(){r(this,vf,"f").unsubscribeAll(),window.removeEventListener("resize",r(this,bf,"f").resize)}}vf=new WeakMap,mf=new WeakMap,$f=new WeakMap,yf=new WeakMap,bf=new WeakMap,gf=new WeakSet,wf=function(e){r(this,gf,"m",Cf).call(this,e),r(this,gf,"m",kf).call(this)},Cf=function(e){r(this,$f,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description||""}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},kf=function(){r(this,$f,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),r=n.scrollWidth>n.clientWidth,i=n.clientHeight>20;r||i?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Sf=function(){const[e,t]=pf(r(this,mf,"f"),Number.parseInt(r(this,mf,"f").style.left,10),Number.parseInt(r(this,mf,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});r(this,mf,"f").style.top=`${t}px`,r(this,mf,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Of);var Ef=Object.freeze({__proto__:null,default:Of});const Af="undefined"!=typeof localStorage,Pf="J151000",Nf="E103205",jf="E108201",Rf=Af&&localStorage.getItem("base.content.url")||"",Tf="base.ui.components.url";Af&&localStorage.getItem(Tf),Af&&localStorage.getItem(Tf);const Mf="descope-login-flow",Uf="code",Lf="redirect_mode",_f="err",Wf="data-exclude-field",Ff="data-exclude-next",Df="dls_last_auth",qf="dls_last_submitted_login_id",Bf="state_id",Hf="saml_idp_state_id",Vf="wsfed_idp_state_id",Gf="saml_idp_username",Kf="descope_idp_initiated",zf="sso_app_id",Jf="custom_app_id",Zf="third_party_app_id",Yf="third_party_app_state_id",Xf="oidc_login_hint",Qf="oidc_prompt",ep="oidc_resource",tp="oidc_error_redirect_uri",np="application_scopes",rp="data-type",ip="redirect",op="poll",sp="webauthnCreate",ap="webauthnGet",dp="nativeBridge",lp="loadForm",cp="submit",up="polling",hp=["descope-multi-select-combo-box","descope-text-area"],fp="dls_last_auth_in_flight",pp=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts","data","totp","notp","sentTo","sso","selfProvisionDomains"];var gp;!function(e){e.backward="backward",e.forward="forward"}(gp||(gp={}));const vp=["descope-enriched-text"];function mp(e){return new URLSearchParams(window.location.search).get(e)}function $p(e){if(window.history.replaceState&&mp(e)){const t=new URL(window.location.href),n=new URLSearchParams(t.search);n.delete(e),t.search=n.toString(),window.history.replaceState({},"",t.toString())}}function yp(e,t){if(!t)return;const n=+e,r=+t;return Number.isNaN(n)||Number.isNaN(r)?void 0:n>r?gp.forward:n<r?gp.backward:void 0}const bp=e=>{let[t="",n=""]=(mp(Mf)||"").split("_");const r=(e=>{var t;return(null===(t=/(.*)\|#\|.*/.exec(e))||void 0===t?void 0:t[1])||""})(t);return(!e||r&&r!==e)&&(t="",n=""),{executionId:t,stepId:n,executionFlowId:r}};function wp(){$p(Mf)}const Cp=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),kp=(e,t)=>{const{executionId:n,stepId:r,executionFlowId:i}=bp(e);if(i&&e!==i)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||r)&&wp();const o=mp("t")||void 0;o&&$p("t");const s=mp(Uf)||void 0;s&&$p(Uf);const a="popup"===mp(Lf);a&&$p(Lf);const d=mp(_f)||void 0;d&&$p(_f);const{redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h}={redirectAuthCodeChallenge:mp("ra-challenge"),redirectAuthCallbackUrl:mp("ra-callback"),redirectAuthBackupCallbackUri:mp("ra-backup-callback"),redirectAuthInitiator:mp("ra-initiator")},f=mp(Bf);f&&$p(Bf);const p=mp(Hf);p&&$p(Hf);const g=mp(Vf);g&&$p(Vf);const v=mp(Gf);p&&$p(Gf);const m=mp(Kf);m&&$p(Kf);const $=mp(zf);$&&$p(zf);const y=mp(Jf);y&&$p(Jf);const b=mp(Zf);b&&$p(Zf);const w=mp(Yf);w&&$p(Yf);const C=mp(np);C&&$p(np);const k=mp(Xf);k&&$p(Xf);const S=mp(Qf);S&&$p(Qf);const x=mp(tp);x&&$p(tp);const I=mp(ep);return I&&$p(ep),{executionId:n,stepId:r,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h,ssoQueryParams:{oidcIdpStateId:f,samlIdpStateId:p,wsfedIdpStateId:g,samlIdpUsername:v,descopeIdpInitiated:"true"===m,ssoAppId:$,customAppId:y,oidcLoginHint:k,oidcPrompt:S,oidcErrorRedirectUri:x,oidcResource:I,thirdPartyAppId:b,thirdPartyAppStateId:w,applicationScopes:C}}},Sp=e=>{let t,n;return Object.assign(((...r)=>{return t&&(o=r,(i=t).length===o.length&&i.every(((e,t)=>e===o[t])))||(t=r,n=e(...r)),n;var i,o}),{reset:()=>{t=void 0,n=void 0}})},xp=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector('*[name]:not([auto-focus="false"]):not([aria-hidden="true"])');setTimeout((()=>{null==t||t.focus()}))}};function Ip(e,t,n){return new Promise(((r,i)=>{let o=!1;const s=setTimeout((()=>{o=!0,void 0!==n?r(n):i(new Error(`Promise timed out after ${e} ms`))}),e);t.then((e=>{o||(clearTimeout(s),r(e))})).catch((e=>{o||(clearTimeout(s),i(e))}))}))}const Op=(e,{oidcIdpStateId:t,samlIdpStateId:n,wsfedIdpStateId:r,samlIdpUsername:i,ssoAppId:o,customAppId:s,oidcLoginHint:a,oidcPrompt:d,oidcErrorRedirectUri:l,oidcResource:c,thirdPartyAppId:u,thirdPartyAppStateId:h,applicationScopes:f})=>!(!e||t||n||r||i||o||s||a||d||l||c||u||h||f),Ep=e=>null==e?void 0:e.submit(),Ap=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},Pp=(e,t=100)=>{let n;return function(...r){n||e.apply(this,r),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}},Np={minLength:"data-password-policy-value-minlength",strength:"data-password-policy-value-passwordstrength",disallowedChars:"data-password-policy-value-disallowedchars",email:"data-password-policy-value-email",activePolicies:"active-policies",availablePolicies:"available-policies"},jp=(e,t)=>{var n;const r=null==e?void 0:e.componentsDynamicAttrs;if(!r)return;const i=Object.entries(r).find((([e])=>(e=>{var t;return null===(t=e.match(/\[data-name=["']([^"']+)["']\]/))||void 0===t?void 0:t[1]})(e)===t));return null===(n=null==i?void 0:i[1])||void 0===n?void 0:n.attributes},Rp=[{key:"totp",from:e=>e.totp},{key:"notp",from:e=>e.notp},{key:"sentTo",from:e=>e.sentTo},{key:"sso",from:e=>e.sso},{key:"selfProvisionDomains",from:e=>e.selfProvisionDomains},{key:"inboundAppApproveScopes",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.thirdPartyAppApproveScopes)||void 0===n?void 0:n.data}},{key:"securityQuestionsSetup",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqSetup}},{key:"securityQuestionsVerify",from:e=>{var t;return null===(t=e.componentsConfig)||void 0===t?void 0:t.sqVerify}},{key:"userTenants",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userSelectedTenant)||void 0===n?void 0:n.data}},{key:"userRoles",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.userRoles)||void 0===n?void 0:n.data}},{key:"ssoApplications",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoApplications)||void 0===n?void 0:n.data}},{key:"ssoConfigurations",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.ssoConfigurations)||void 0===n?void 0:n.data}},{key:"samlAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlMappings)||void 0===n?void 0:n.options}},{key:"oidcAttributeMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.oidcMappings)||void 0===n?void 0:n.options}},{key:"samlGroupMappings",from:e=>{var t,n;return null===(n=null===(t=e.componentsConfig)||void 0===t?void 0:t.samlGroupMappings)||void 0===n?void 0:n.options}},{key:"passwordPolicy",from:e=>{var t;return(e=>{if(!e)return;const t=Object.fromEntries(Object.entries(Np).map((([t,n])=>[t,e[n]])).filter((([,e])=>void 0!==e)));return Object.keys(t).length?t:void 0})(null===(t=e.componentsConfig)||void 0===t?void 0:t.newPassword)}},{key:"recoveryCodes",from:e=>(e=>{const t=jp(e,"recoveryCodes");if(t)return Array.isArray(t.data)?t.data.map((e=>e.value)):[]})(e.componentsConfig)},{key:"outboundApp",from:e=>(e=>{const t=jp(e,"outboundApp");if(t)return{label:t.label,iconSrc:t["icon-src"],appId:t["data-descope-outbound-oauth-app-id"]}})(e.componentsConfig)}],Tp=e=>{const t=Object.assign({},e);return e.inboundAppApproveScopes&&(t.thirdPartyAppApproveScopes=e.inboundAppApproveScopes),t};function Mp(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var Up,Lp,_p,Wp;function Fp(e,t){const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const i=n[r],o=e[i],s=t[i];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!Fp(o,s))return!1}else if(o!==s)return!1}return!0}let Dp=class{constructor(e={},{forceUpdate:t=!1}={}){Up.set(this,void 0),Lp.set(this,{}),_p.set(this,0),Wp.set(this,!0),this.update=e=>{const t="function"==typeof e?e(r(this,Up,"f")):e,n=Object.assign(Object.assign({},r(this,Up,"f")),t),o=r(this,Up,"f");i(this,Up,n,"f"),Object.freeze(r(this,Up,"f")),setTimeout((()=>{Object.values(r(this,Lp,"f")).forEach((({cb:e,selector:t,forceUpdate:i})=>{const s=t(o),a=t(n);(r(this,Wp,"f")||i||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(a)?!Fp(s,a):s!==a))&&e(a,s,((e,t)=>n=>e[n]!==t[n])(a,s))}))}),0)},i(this,Up,e,"f"),i(this,Wp,t,"f")}get current(){return Object.assign({},r(this,Up,"f"))}set forceUpdate(e){i(this,Wp,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return i(this,_p,r(this,_p,"f")+1,"f"),r(this,Lp,"f")[r(this,_p,"f")]={cb:e,selector:t,forceUpdate:n},r(this,_p,"f").toString()}unsubscribe(e){const t=!!r(this,Lp,"f")[e];return t&&delete r(this,Lp,"f")[e],t}unsubscribeAll(){return i(this,Lp,{},"f"),!0}};Up=new WeakMap,Lp=new WeakMap,_p=new WeakMap,Wp=new WeakMap;const qp=["*","#","/","(",")","[","]","_","<",">","`"],Bp=e=>"string"!=typeof e?e:e.replace((e=>{const t=qp.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),Hp=["disabled"],Vp=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Wf}])`)).forEach((e=>{e.value=n}))}))},Gp=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),Kp=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,r)=>n?Bp(Gp(t,r)):Gp(t,r))),zp=(e,t,n)=>{e.querySelectorAll(`[${rp}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Jp=(e,t,n)=>{var r,i;const o=null===(r=customElements.get(t))||void 0===r?void 0:r.cssVarList.url;n&&o&&(null===(i=null==e?void 0:e.style)||void 0===i||i.setProperty(o,`url(data:image/jpg;base64,${n})`))},Zp=(e,n,r,i)=>{var o,s;zp(e,"totp-link",null===(o=null==n?void 0:n.totp)||void 0===o?void 0:o.provisionUrl),zp(e,"notp-link",null===(s=null==n?void 0:n.notp)||void 0===s?void 0:s.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{const n=(e=>vp.includes(e))(e.localName);e.textContent=Kp(e.textContent,t,n);const r=e.getAttribute("href");r&&e.setAttribute("href",Kp(r,t))}))})(e,n),((e,n,r)=>{if(!n)return;const{componentsDynamicAttrs:i}=n,o=t(n,["componentsDynamicAttrs"]),s=Object.keys(o).reduce(((e,t)=>(e[`[name=${t}]`]=o[t],e)),{});i&&Object.keys(i).forEach((e=>{const t=i[e];if(t){const{attributes:n}=t;n&&Object.keys(n).length&&(s[e]=n)}})),Object.keys(s).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const n=s[t];Object.keys(n).forEach((t=>{let i=n[t];if("string"!=typeof i)try{i=JSON.stringify(i)}catch(e){r.error(`Could not stringify value "${i}" for "${t}"`,e.message),i=""}e.setAttribute(t,i)}))}))}))})(e,null==n?void 0:n.componentsConfig,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Kp(e.value,t)}))}))})(e,n),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{Hp.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,r)},Yp=Sp((()=>n(void 0,void 0,void 0,(function*(){var e,t;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const n=Promise.all([null===(e=window.PublicKeyCredential)||void 0===e?void 0:e.isConditionalMediationAvailable(),null===(t=window.PublicKeyCredential)||void 0===t?void 0:t.isUserVerifyingPlatformAuthenticatorAvailable()]).then((e=>e.every((e=>!!e)))),r=(()=>{var e;const t=null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===e?void 0:e.brands,n=null==t?void 0:t.find((({brand:e,version:t})=>"Chromium"===e&&parseFloat(t)));return n?n.version:0})()>=108;return yield Ip(100,n,r)}catch(e){return console.error("Conditional login check failed",e),!1}}))));let Xp;const Qp=(e,t)=>{Xp?Xp.setItem(e,t):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.setItem(e,t)},eg=e=>Xp?Xp.getItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)?window.localStorage.getItem(e):null,tg="dls_ab_testing_id",ng={"lastAuth.loginId":{"not-empty":e=>{var t;return!!e.loginId||!!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)},empty:e=>{var t;return!e.loginId&&!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)}},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t,"greater-than-or-equal":(e,t)=>(e.abTestingKey||0)>=t,"less-than-or-equal":(e,t)=>(e.abTestingKey||0)<=t,"in-range":(e,t)=>{const[n,r]=t?t.split(",").map(Number):[void 0,void 0];return(e.abTestingKey||0)>=(null!=n?n:0)&&(e.abTestingKey||0)<=(null!=r?r:0)},"not-in-range":(e,t)=>{const[n,r]=t?t.split(",").map(Number):[void 0,void 0];return!(void 0!==n&&void 0!==r&&!Number.isNaN(n)&&!Number.isNaN(r))||(e.abTestingKey||0)<n||(e.abTestingKey||0)>r},"devised-by":(e,t)=>{const n=Number(t);return!Number.isNaN(n)&&(e.abTestingKey||0)%n==0}}};function rg(e,t){const n={};try{Object.assign(n,JSON.parse(eg(Df)))}catch(e){null==t||t.warn("[Descope] Failed to read last auth from storage",String(e))}return n.loginId||e?n:{}}function ig(e,t){(null==e?void 0:e.authMethod)&&(t&&!e.loginId||Qp(Df,JSON.stringify(e)))}function og(){try{return JSON.parse(eg(fp)||"{}")}catch(e){return{}}}function sg(e){try{(e=>{Xp?Xp.removeItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.removeItem(e)})(fp)}catch(t){null==e||e.warn("[Descope] Failed to clear in-flight last auth storage",String(t))}}const ag=(e,t="")=>Object.keys(e).reduce(((n,r)=>{var i;if(Array.isArray(e[r]))return Object.assign(Object.assign({},n),{[r]:{value:e[r].map((e=>"object"==typeof e&&null!==e?ag(e):e))}});if("object"==typeof e[r]&&null!==e[r]&&!(null===(i=e[r])||void 0===i?void 0:i.value))return Object.assign(Object.assign({},n),ag(e[r],`${t+r}.`));const o="object"==typeof e[r]?e[r]:{value:e[r]},s=Object.assign(Object.assign({},n),{[t+r]:o,[`form.${t}${r}`]:o});return"displayName"===r?Object.assign(Object.assign({},s),{[`${t}fullName`]:o,[`form.${t}fullName`]:o}):s}),[]),dg=h((e=>{var t,n,i,o;return o=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;r(this,t,"m",n).call(this)&&r(this,t,"m",i).call(this),null===(e=super.connectedCallback)||void 0===e||e.call(this)}},t=new WeakSet,n=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},i=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",t.style.height="100%",e.parentElement.appendChild(t),t.appendChild(e)},o})),lg=["input","change"];function cg(e){if("number"==typeof e&&Number.isFinite(e))return{value:e,ok:!0};if("boolean"==typeof e)return{value:e?1:0,ok:!0};if("string"==typeof e){if(""===e.trim())return{value:0,ok:!1};const t=Number(e);if(Number.isFinite(t))return{value:t,ok:!0}}return{value:0,ok:!1}}function ug(e){return null==e?"":"string"==typeof e?e:"boolean"==typeof e?e?"true":"false":"number"==typeof e?Number.isFinite(e)?String(e):"":String(e)}function hg(e){if("boolean"==typeof e)return{value:e,ok:!0};if("string"==typeof e){if("true"===e)return{value:!0,ok:!0};if("false"===e)return{value:!1,ok:!0}}return"number"==typeof e?{value:0!==e,ok:!0}:{value:!1,ok:!1}}function fg(e){return Array.isArray(e)?e:"string"==typeof e?e.split(","):null}function pg(e){return null==e||("string"==typeof e?""===e:Array.isArray(e)?0===e.length:"object"==typeof e&&0===Object.keys(e).length)}const gg=new Map,vg={equal:(e,t)=>e===t||ug(e)===ug(t),"not-equal":(e,t)=>e!==t&&ug(e)!==ug(t),contains:(e,t)=>Array.isArray(e)?e.includes(t):"string"==typeof e&&e.includes(ug(t)),"doesnt-contains":(e,t)=>Array.isArray(e)?!e.includes(t):"string"==typeof e&&!e.includes(ug(t)),"greater-than":(e,t)=>{const n=cg(e),r=cg(t);return n.ok&&r.ok&&n.value>r.value},"greater-than-or-equal":(e,t)=>{const n=cg(e),r=cg(t);return n.ok&&r.ok&&n.value>=r.value},"less-than":(e,t)=>{const n=cg(e),r=cg(t);return n.ok&&r.ok&&n.value<r.value},"less-than-or-equal":(e,t)=>{const n=cg(e),r=cg(t);return n.ok&&r.ok&&n.value<=r.value},empty:e=>pg(e),"not-empty":e=>!pg(e),"is-true":e=>{const t=hg(e);return t.ok&&t.value},"is-false":e=>{const t=hg(e);return t.ok&&!t.value},in:(e,t)=>{const n=fg(t);return null!==n&&n.includes(e)},"not-in":(e,t)=>{const n=fg(t);return null!==n&&!n.includes(e)},matches:(e,t)=>{if("string"!=typeof e)return!1;const n=function(e){var t;if(gg.has(e))return null!==(t=gg.get(e))&&void 0!==t?t:null;let n;try{n=new RegExp(e)}catch(e){n=null}return gg.set(e,n),n}(ug(t));return null!==n&&n.test(e)}};function mg(e,t){var n;if(e)return"form"===e.kind&&e.form?t[e.form]:"list"===e.kind?(null!==(n=e.items)&&void 0!==n?n:[]).map((e=>mg(e,t))):e.value}function $g(e,t){const n=vg[e.operator];return!!n&&n(mg(e.target,t),mg(e.predicate,t))}function yg(e,t){const n={};return(null!=e?e:[]).forEach((e=>{var r;(function(e,t){var n;return(null!==(n=e.rules)&&void 0!==n?n:[]).some((e=>function(e,t){var n;const r=null!==(n=e.atomicConditions)&&void 0!==n?n:[];return!!r.length&&(e.logicalOr?r.some((e=>$g(e,t))):r.every((e=>$g(e,t))))}(e,t)))})(e,t)&&(null!==(r=e.componentIds)&&void 0!==r?r:[]).forEach((t=>{n[t]=e.action}))})),n}const bg=["hide","disable","read-only"];const wg=/(["\\])/g;function Cg(e){return"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(e):e.replace(wg,"\\$1")}function kg(e,t){return Array.from(e.querySelectorAll(`[id="${Cg(t)}"]`))}function Sg(e,t,n){return Object.keys(t).forEach((r=>{const i=t[r];n[r]!==i&&kg(e,r).forEach((e=>function(e,t){switch(t){case"hide":e.classList.remove("hidden");break;case"disable":e.removeAttribute("disabled");break;case"read-only":e.removeAttribute("readonly")}}(e,i)))})),Object.keys(n).forEach((r=>{const i=n[r],o=t[r];i!==o&&kg(e,r).forEach((e=>function(e,t){switch(t){case"hide":e.classList.add("hidden");break;case"disable":e.setAttribute("disabled","true");break;case"read-only":e.setAttribute("readonly","true")}}(e,i)))})),Object.assign({},n)}const xg="component-conditions:";function Ig(e){return e instanceof HTMLInputElement?"checkbox"===e.type?e.checked:e.value:"checked"in e?e.checked:"value"in e?e.value:void 0}function Og(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>e[n]===t[n]))}function Eg(){return{conditions:[],touchedIds:new Set,snapshot:{},applied:{},serverBaseline:{},debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:null}}function Ag(e,t,n){const r={};return n.forEach((n=>{e[n]?r[n]=e[n]:t[n]&&(r[n]=t[n])})),r}const Pg=h((e=>{var t,n,s,a,d,l;const c=o(C)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,Eg())}applyComponentsState(e,t){t&&(Object.entries(t).forEach((([e,t])=>{bg.includes(t)||this.logger.error(`Unknown component action "${t}" for component with id "${e}"`,`Valid actions are ${bg.map((e=>`"${e}"`)).join(", ")}`)})),Sg(e,{},t))}initRealtimeConditions(e,o){var a,l,c,u;r(this,t,"m",d).call(this);const h=null!==(a=null==o?void 0:o.realtimeComponentsConditions)&&void 0!==a?a:[];if(!h.length)return void this.logger.debug(`${xg} no real-time rules to apply on this screen`);this.logger.info(`${xg} found ${h.length} real-time rule(s) for this screen`);const f={};Object.entries(null!==(l=null==o?void 0:o.form)&&void 0!==l?l:{}).forEach((([e,t])=>{f[`form.${e}`]=t})),function(e){const t=new Set,n=e=>{var r;e&&("form"===e.kind&&e.form?t.add(e.form):"list"===e.kind&&(null!==(r=e.items)&&void 0!==r?r:[]).forEach(n))};return(null!=e?e:[]).forEach((e=>{var t;return(null!==(t=e.rules)&&void 0!==t?t:[]).forEach((e=>{var t;return(null!==(t=e.atomicConditions)&&void 0!==t?t:[]).forEach((e=>{n(e.target),n(e.predicate)}))}))})),t}(h).forEach((t=>{const n=function(e,t){const n=t.startsWith("form.")?t.slice(5):t;return e.querySelector(`[name="${Cg(t)}"]`)||e.querySelector(`[name="${Cg(n)}"]`)}(e,t);if(!n)return;const r=Ig(n);void 0!==r&&(f[t]=r)}));const p=function(e){const t=new Set;return(null!=e?e:[]).forEach((e=>{var n;(null!==(n=e.componentIds)&&void 0!==n?n:[]).forEach((e=>t.add(e)))})),t}(h),g={},v={};Object.entries(null!==(c=null==o?void 0:o.componentsState)&&void 0!==c?c:{}).forEach((([e,t])=>{p.has(e)&&(v[e]=t)})),Object.entries(null!==(u=null==o?void 0:o.serverOnlyComponentsState)&&void 0!==u?u:{}).forEach((([e,t])=>{p.has(e)&&(g[e]=t)}));const m={conditions:h,touchedIds:p,snapshot:f,applied:v,serverBaseline:g,debounceTimer:null,paused:!1,unsubscribePauseListener:null,inputHandler:()=>{},root:e},$=Ag(yg(h,f),g,p);Og(v,$)||(m.applied=Sg(e,v,$)),m.inputHandler=e=>r(this,t,"m",s).call(this,e),lg.forEach((t=>{e.addEventListener(t,m.inputHandler,!0)})),this.logger.debug(`${xg} listening for "${lg.join('" and "')}" events on form fields; ${Object.keys(v).length} component(s) start hidden / disabled / read-only by these rules`);const y=this.nextRequestStatus;if(null==y?void 0:y.subscribe){const e=({isLoading:e})=>{m.paused=e,e&&m.debounceTimer&&(clearTimeout(m.debounceTimer),m.debounceTimer=null)},t=y.subscribe(e);m.unsubscribePauseListener=()=>{var e;null!=t&&(null===(e=y.unsubscribe)||void 0===e||e.call(y,t))}}i(this,n,m,"f")}disconnectedCallback(){var e;null===(e=super.disconnectedCallback)||void 0===e||e.call(this),r(this,t,"m",d).call(this)}},n=new WeakMap,t=new WeakSet,s=function(e){var i,o;const s=r(this,n,"f");if(!s.root||s.paused)return;const d=e.target;if(!d)return;if(null===(i=d.hasAttribute)||void 0===i?void 0:i.call(d,Wf))return;const l=null===(o=d.getAttribute)||void 0===o?void 0:o.call(d,"name");if(!l)return;const c=function(e){return e.startsWith("form.")?e:`form.${e}`}(l);s.snapshot[c]=Ig(d),s.debounceTimer&&clearTimeout(s.debounceTimer),s.debounceTimer=setTimeout((()=>{s.debounceTimer=null,r(this,t,"m",a).call(this)}),50)},a=function(){const e=r(this,n,"f");if(!e.root)return;let t;try{t=Ag(yg(e.conditions,e.snapshot),e.serverBaseline,e.touchedIds)}catch(e){return void this.logger.error(`${xg} failed to evaluate real-time rules — keeping the previous state`,null==e?void 0:e.message)}const i=e.applied;Og(i,t)||(this.logger.debug(`${xg} form changed — updating components: was ${JSON.stringify(i)}, now ${JSON.stringify(t)}`),e.applied=Sg(e.root,i,t))},d=function(){const e=r(this,n,"f");e.debounceTimer&&clearTimeout(e.debounceTimer),e.unsubscribePauseListener&&e.unsubscribePauseListener(),e.root&&(Object.keys(e.applied).length>0&&e.root.isConnected&&Sg(e.root,e.applied,{}),lg.forEach((t=>{e.root.removeEventListener(t,e.inputHandler,!0)}))),i(this,n,Eg(),"f")},l})),Ng="project-id",jg="flow-id",Rg=e=>{const t=(e=>{const t=e.getAttribute(Ng),n=e.getAttribute(jg);return t&&n?Array.from(e.ownerDocument.querySelectorAll("descope-wc")).filter((e=>e.getAttribute(Ng)===t&&e.getAttribute(jg)===n)):[]})(e);return t.length>1&&t[0]!==e},Tg=h((e=>{var t,n,s,a;const d=o(C)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}connectedCallback(){var e;null===(e=super.connectedCallback)||void 0===e||e.call(this),r(this,t,"m",s).call(this)}attributeChangedCallback(e,n,i){var o;null===(o=super.attributeChangedCallback)||void 0===o||o.call(this,e,n,i),n===i||e!==Ng&&e!==jg||r(this,t,"m",s).call(this)}},n=new WeakMap,t=new WeakSet,s=function(){queueMicrotask((()=>{if(!this.isConnected)return;const e=this.getAttribute(Ng),t=this.getAttribute(jg),o=`${e}|${t}`;r(this,n,"f")!==o&&Rg(this)&&(i(this,n,o,"f"),this.logger.warn("Multiple Descope flow components detected on the same page",`The same flow ("${t}") and project ("${e}") are running more than once on this page. This is not supported and may cause the flow to behave unexpectedly.`))}))},a})),Mg=["externalId","email","phone"],Ug=["newPassword","password"],Lg="data-username-anchor",_g=e=>{var t;if(!e)return"";try{const n=null===(t=window.sessionStorage)||void 0===t?void 0:t.getItem(qf);if(!n)return"";const r=JSON.parse(n);return r.executionId===e&&r.loginId||""}catch(e){return""}},Wg=h((e=>{var t,n,s,a,d;const l=o(C)(e);return d=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}updateScreenUser(e){var o,d,l;i(this,n,{email:null==e?void 0:e.email,loginIds:(null===(o=null==e?void 0:e.loginIds)||void 0===o?void 0:o.length)?e.loginIds:[_g(r(this,t,"a",a))||(null===(l=null===(d=r(this,t,"a",s).sdk)||void 0===d?void 0:d.getLastUserLoginId)||void 0===l?void 0:l.call(d))].filter(Boolean)},"f")}updateUsernameAnchor(){document.querySelectorAll(`[${Lg}="true"]`).forEach((e=>e.remove())),((e,t,n,r)=>{var i;const o=(null==n?void 0:n.email)||(null===(i=null==n?void 0:n.loginIds)||void 0===i?void 0:i[0]);(e=>e.querySelector("descope-new-password")||e.querySelector("descope-password"))(t)?o?(e=>{const t=['input[autocomplete="username"]',...Mg.map((e=>`[name="${e}"]`))].join(", ");return e.some((e=>e.querySelector(t)))})([e,t])?r.debug("Username anchor: screen already has an identifier field"):(r.debug("Username anchor: injecting hidden username input"),e.appendChild((e=>{const t=document.createElement("input");return t.setAttribute("autocomplete","username"),t.setAttribute("name","username"),t.setAttribute("type","email"),t.setAttribute("readonly","true"),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.setAttribute(Wf,"true"),t.setAttribute(Lg,"true"),t.setAttribute("value",e),t.value=e,Object.assign(t.style,{position:"absolute",opacity:"0",pointerEvents:"none",height:"0",border:"0"}),t})(o))):r.debug("Username anchor: no user identifier available"):r.debug("Username anchor: no password component on screen")})(this,r(this,t,"a",s).contentRootElement,r(this,n,"f"),this.logger)}captureLastSubmittedLoginId(e={},n){const i=Ap(e,Mg);i&&((e,t)=>{var n;if(e&&t)try{null===(n=window.sessionStorage)||void 0===n||n.setItem(qf,JSON.stringify({executionId:t,loginId:e}))}catch(e){}})(i,n||r(this,t,"a",a))}storeCredentials(e={}){var t,i,o,s,a,d;const l=Ap(e,Mg)||(null===(t=r(this,n,"f"))||void 0===t?void 0:t.email)||(null===(o=null===(i=r(this,n,"f"))||void 0===i?void 0:i.loginIds)||void 0===o?void 0:o[0]),c=Ap(e,Ug);if(l&&c)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:l,password:c});null===(d=null===(a=null===(s=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===s?void 0:s.store)||void 0===a?void 0:a.call(s,e))||void 0===d||d.catch((e=>{this.logger.error("Could not store credentials",null==e?void 0:e.message)}))}catch(e){this.logger.error("Could not store credentials",e.message)}}},n=new WeakMap,t=new WeakSet,s=function(){return this},a=function(){var e,n;return(null===(n=null===(e=r(this,t,"a",s).flowState)||void 0===e?void 0:e.current)||void 0===n?void 0:n.executionId)||""},d}));var Fg,Dg,qg,Bg,Hg,Vg,Gg,Kg,zg,Jg,Zg,Yg,Xg,Qg,ev,tv,nv,rv,iv,ov,sv,av;const dv=o(Pe,M,dg,Pg,Tg,Wg,J)(HTMLElement);class lv extends dv{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id"]}constructor(e){super(),Fg.add(this),qg.set(this,!1),Bg.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),r(this,Fg,"m",av).call(this,e,t)},warn:(e,t="")=>{this.logger.warn(e,t)},info:(e,t="",n={})=>{this.logger.info(e,t,n)},debug:(e,t="")=>{this.logger.debug(e,t)}},Hg.set(this,new Dp),Vg.set(this,new Dp),Gg.set(this,{}),this.getComponentsContext=()=>r(this,Gg,"f"),this.nextRequestStatus=new Dp({isLoading:!1}),Kg.set(this,void 0),zg.set(this,{popstate:r(this,Fg,"m",Qg).bind(this),componentsContext:r(this,Fg,"m",iv).bind(this)}),Jg.set(this,void 0),this.getConfig=()=>n(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),i(this,Jg,e,"f"),r(this,Fg,"m",Yg).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get redirectUrl(){return this.getAttribute("redirect-url")||void 0}get debug(){return"true"===this.getAttribute("debug")}get locale(){return this.getAttribute("locale")||void 0}get autoFocus(){var e;const t=null!==(e=this.getAttribute("auto-focus"))&&void 0!==e?e:"true";return"skipFirstScreen"===t?t:"true"===t}get validateOnBlur(){return"true"===this.getAttribute("validate-on-blur")}get storeLastAuthenticatedUser(){var e;return"true"===(null!==(e=this.getAttribute("store-last-authenticated-user"))&&void 0!==e?e:"true")}get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}get keepLastAuthenticatedUserAfterLogout(){return"true"===this.getAttribute("keep-last-authenticated-user-after-logout")}get storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{return ag(JSON.parse(e))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return((e,t)=>Object.fromEntries(Object.entries(e).map((([e,n])=>[e,n[t]]))))(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{return JSON.parse(this.getAttribute("outbound-app-scopes"))||null}catch(e){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return r(this,Bg,"f")}set customStorage(e){if(e&&"function"!=typeof e.getItem)throw new Error("Custom storage must have a getItem method");if(e&&"function"!=typeof e.setItem)throw new Error("Custom storage must have a setItem method");if(e&&"function"!=typeof e.removeItem)throw new Error("Custom storage must have a removeItem method");i(this,Bg,e,"f"),(e=>{Xp=e})(e)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return n(this,void 0,void 0,(function*(){var e,t;const n=yield this.getProjectConfig(),r=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=r.version)&&void 0!==t||(r.version=0),r}))}getTargetLocales(){return n(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,n,r;const i=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=hp.includes(null!==(r=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==r?r:"");if("Enter"!==e.key||i||o)return;e.preventDefault();const s=this.rootElement.querySelectorAll("descope-button");if(1===s.length&&"false"!==s[0].getAttribute("auto-submit"))return void s[0].click();const a=Array.from(s).filter((e=>"true"===e.getAttribute("auto-submit")));if(1===a.length)return void a[0].click();const d=Array.from(s).filter((e=>"button"===e.getAttribute("data-type")));if(1===d.length)"false"!==d[0].getAttribute("auto-submit")&&d[0].click();else if(0===d.length){const e=Array.from(s).filter((e=>"sso"===e.getAttribute("data-type")));1===e.length&&"false"!==e[0].getAttribute("auto-submit")&&e[0].click()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return n(this,void 0,void 0,(function*(){var e;const t=yield this.getConfig();return("projectConfig"in t?null===(e=t.projectConfig)||void 0===e?void 0:e.componentsVersion:{})||(this.logger.error("Did not get components version, using latest version"),"latest")}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;if(this.flowStatus="loading",["ready","error","success"].forEach((e=>this.addEventListener(e,(()=>{this.flowStatus=e})))),yield null===(t=e.init)||void 0===t?void 0:t.call(this),r(this,Vg,"f").subscribe(r(this,Fg,"m",sv).bind(this)),r(this,Vg,"f").update({isDebug:this.debug}),r(this,Fg,"m",Xg).call(this),yield r(this,Fg,"m",nv).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const n=yield this.getConfig();if("isMissingConfig"in n&&n.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:o,stepId:s,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:g}=kp(this.flowId,this.loggerWrapper);window.addEventListener("popstate",r(this,zg,"f").popstate),window.addEventListener("components-context",r(this,zg,"f").componentsContext),r(this,Hg,"f").subscribe(r(this,Fg,"m",tv).bind(this)),r(this,Hg,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:s,executionId:o,token:a,code:d,isPopup:l,exchangeError:c,redirectAuthCallbackUrl:u,redirectAuthBackupCallbackUri:h,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},g)),i(this,qg,!0,"f")}))}disconnectedCallback(){var e;r(this,Hg,"f").unsubscribeAll(),r(this,Vg,"f").unsubscribeAll(),r(this,Fg,"m",ov).call(this),window.removeEventListener("popstate",r(this,zg,"f").popstate),window.removeEventListener("components-context",r(this,zg,"f").componentsContext),null===(e=super.disconnectedCallback)||void 0===e||e.call(this)}attributeChangedCallback(e,t,n){var i;if(null===(i=super.attributeChangedCallback)||void 0===i||i.call(this,e,t,n),this.shadowRoot.isConnected&&r(this,qg,"f")&&t!==n&&Dg.observedAttributes.includes(e)){r(this,Fg,"m",Xg).call(this);const i=null===t;r(this,Hg,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,wp()),{[Cp(e)]:n,stepId:o,executionId:s}})),r(this,Vg,"f").update({isDebug:this.debug})}}}var cv,uv,hv,fv,pv,gv,vv,mv,$v,yv,bv,wv,Cv,kv,Sv,xv,Iv,Ov,Ev,Av,Pv,Nv,jv,Rv,Tv,Mv,Uv,Lv,_v,Wv,Fv,Dv,qv,Bv,Hv,Vv,Gv,Kv,zv,Jv;Dg=lv,qg=new WeakMap,Bg=new WeakMap,Hg=new WeakMap,Vg=new WeakMap,Gg=new WeakMap,Kg=new WeakMap,zg=new WeakMap,Jg=new WeakMap,Fg=new WeakSet,Zg=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},Yg=function(){r(this,Fg,"m",Zg).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},Xg=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","outbound-app-id","outbound-app-scopes","theme-override"];Dg.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Cp(t)])throw Error(`${t} cannot be empty`)}))},Qg=function(){const{stepId:e,executionId:t}=bp(this.flowId);r(this,Hg,"f").update({stepId:e,executionId:t})},ev=function(e,t){id&&"function"==typeof id||this.logger.error("SDK was not loaded properly",id,JSON.stringify(id));const i=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},Dg.sdkConfigOverrides),{projectId:e,baseUrl:t});r(this,Bg,"f")&&(i.customStorage=r(this,Bg,"f")),this.sdk=id(i),["start","next"].forEach((e=>{const t=function(e,t,r){return(...i)=>n(this,void 0,void 0,(function*(){let n;const o=r+1;for(let s=0;s<o;s++)try{return yield e(...i)}catch(e){n=e,s<r&&(yield new Promise((e=>{setTimeout(e,t*Math.pow(2,s+1))})))}throw n}))}(this.sdk.flow[e],1e3,3);this.sdk.flow[e]=(...r)=>n(this,void 0,void 0,(function*(){try{return yield t(...r)}catch(t){return this.logger.error(`Error in sdk flow ${e} function`,t),{error:{errorCode:Pf,errorDescription:t.toString()}}}}))}))},tv=function(e,t,i){return n(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:n}=e;if(i("projectId")||i("baseUrl")){if(!t)return;r(this,Fg,"m",ev).call(this,t,n)}r(this,Jg,"f").call(this,e)}))},nv=function(){return n(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield r(this,Fg,"m",rv).call(this))}))},rv=function(){return n(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:r}){const i=new URL(Rf||r||"https://static.descope.com/pages");return i.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(i.pathname,e,n,t),i.toString()}({projectId:this.projectId,filename:"config.json",assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield function(e,t){return n(this,void 0,void 0,(function*(){const n=yield fetch(e,{cache:"default"});if(!n.ok)throw Error(`Error fetching URL ${e} [${n.status}]`);return{body:yield n[t](),headers:Object.fromEntries(n.headers.entries())}}))}(e,"json"),!0}catch(e){return!1}}))},iv=function(e){i(this,Gg,Object.assign(Object.assign({},r(this,Gg,"f")),e.detail),"f")},ov=function(){var e;null===(e=r(this,Kg,"f"))||void 0===e||e.remove(),i(this,Kg,null,"f")},sv=function(e){return n(this,arguments,void 0,(function*({isDebug:e}){e?(i(this,Kg,document.createElement("descope-debugger"),"f"),Object.assign(r(this,Kg,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return pm})),document.body.appendChild(r(this,Kg,"f"))):r(this,Fg,"m",ov).call(this)}))},av=function(e,t){var n;e&&this.debug&&(null===(n=r(this,Kg,"f"))||void 0===n||n.updateData({title:e,description:t}))},lv.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"4.1.0"}};class Zv extends lv{static set sdkConfigOverrides(e){lv.sdkConfigOverrides=e}static get sdkConfigOverrides(){return lv.sdkConfigOverrides}constructor(){const e=new Dp({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),cv.add(this),this.stepState=new Dp({}),uv.set(this,void 0),hv.set(this,null),fv.set(this,null),pv.set(this,{visibilitychange:r(this,cv,"m",gv).bind(this)}),this.bridgeVersion=Zv.bridgeVersion,vv.set(this,void 0),this.nativeCallbacks={},Sv.set(this,!1),this.handleRedirect=e=>{window.location.assign(e)},Iv.set(this,(e=>{const t=()=>{this.contentRootElement.classList.toggle("hidden",e),this.slotElement.classList.toggle("hidden",!e),e&&(this.contentRootElement.innerHTML="")};e&&this.contentRootElement.hasChildNodes()?r(this,cv,"m",Ov).call(this,t):t()})),Ev.set(this,((e,t,o,s,a=!1)=>{const d=[Nf,"E103202",jf];if(this.flowState.current.action===op){if(r(this,Pv,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const l=Date.now(),c=a?500:2e3;i(this,uv,setTimeout((()=>n(this,void 0,void 0,(function*(){var n,i;this.logger.debug("polling - Calling next");const u=this.sdk.flow.next(e,t,up,o,s,{}),h=document.hidden&&!a&&Date.now()-l>c+500;let f;h&&this.logger.debug("polling - The polling seems to be throttled");try{const e=h?1e3:6e3;f=yield Ip(e,u)}catch(n){return this.logger.warn(`polling - The ${h?"throttled fetch":"fetch"} call timed out or was aborted`),void r(this,Ev,"f").call(this,e,t,o,s,h)}if((null===(n=null==f?void 0:f.error)||void 0===n?void 0:n.errorCode)===Pf)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void r(this,Ev,"f").call(this,e,t,o,s);this.logger.debug("polling - Got a response"),(null==f?void 0:f.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),(null===(i=null==f?void 0:f.error)||void 0===i?void 0:i.errorCode)&&d.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):r(this,Ev,"f").call(this,e,t,o,s),r(this,Nv,"f").call(this,f)}))),c),"f")}})),Av.set(this,(()=>{clearTimeout(r(this,uv,"f")),i(this,uv,null,"f")})),Pv.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),Nv.set(this,(e=>{var t,n,o,s,a,d,l,c,u,h,f,p,g;if(!(null==e?void 0:e.ok)){const i=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,l=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;r(this,cv,"m",zv).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:l,errorMessage:i}),this.loggerWrapper.error((null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorDescription)||i,(null===(a=null==e?void 0:e.error)||void 0===a?void 0:a.errorMessage)||l);const c=null===(d=null==e?void 0:e.error)||void 0===d?void 0:d.errorCode;return void("E102004"!==c&&c!==Nf&&c!==jf||!this.isRestartOnError||r(this,cv,"m",kv).call(this))}null===(c=null===(l=e.data)||void 0===l?void 0:l.runnerLogs)||void 0===c||c.forEach((e=>{const{level:t,title:n,log:r}=e;t&&this.loggerWrapper[t]?this.loggerWrapper[t](n,r):this.loggerWrapper.info(n,r)}));const v=null===(f=null===(h=null===(u=e.data)||void 0===u?void 0:u.screen)||void 0===h?void 0:h.state)||void 0===f?void 0:f.errorText;(null===(p=e.data)||void 0===p?void 0:p.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${v?`${v} - `:""}${e.data.error.message}`):v&&this.loggerWrapper.error(v);const{status:m,authInfo:$,lastAuth:y,action:b,openInNewTabUrl:w}=e.data;if(b!==op&&r(this,Av,"f").call(this),"completed"===m){this.storeLastAuthenticatedUser&&ig(Object.assign(Object.assign({},y),{lastUsedPerScreen:og()})),sg(this.loggerWrapper);const t=Object.assign({},$);return e.data.output&&Object.keys(e.data.output).length>0&&(t.flowOutput=e.data.output),void r(this,cv,"m",zv).call(this,"success",t)}this.storeLastAuthenticatedUser&&ig(y,!0),w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:x,redirect:I,webauthn:O,error:E,samlIdpResponse:A,wsFedIdpResponse:P,nativeResponse:N}=e.data,j=Date.now();b!==op?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:x,status:m,stepId:k,stepName:S,action:b,error:E}),(null===(g=x.state)||void 0===g?void 0:g.clientScripts)&&i(this,fv,this.loadSdkScripts(x.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==I?void 0:I.url,redirectIsPopup:null==I?void 0:I.isPopup,screenId:null==x?void 0:x.id,screenState:null==x?void 0:x.state,webauthnTransactionId:null==O?void 0:O.transactionId,webauthnOptions:null==O?void 0:O.options,samlIdpResponseUrl:null==A?void 0:A.url,samlIdpResponseSamlResponse:null==A?void 0:A.samlResponse,samlIdpResponseRelayState:null==A?void 0:A.relayState,wsFedIdpResponseUrl:null==P?void 0:P.url,wsFedIdpResponseWresult:null==P?void 0:P.wresult,wsFedIdpResponseWctx:null==P?void 0:P.wctx,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:j})):this.flowState.update({action:b,reqTimestamp:j})})),jv.set(this,Sp((()=>n(this,void 0,void 0,(function*(){var e;try{const t=yield this.sdk.webauthn.signIn.start("",window.location.origin);return t.ok||this.loggerWrapper.warn("Webauthn start failed",null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.errorMessage),t.data}catch(e){this.loggerWrapper.warn("Webauthn start failed",e.message)}}))))),_v.set(this,null),qv.set(this,Pp(((e,t,i)=>n(this,void 0,void 0,(function*(){var n,o;if("true"===e.getAttribute("formnovalidate")||r(this,cv,"m",Uv).call(this)){const s=null==e?void 0:e.getAttribute("id");r(this,cv,"m",Vv).call(this,e,s,i),r(this,cv,"m",Wv).call(this,e);const a=yield r(this,cv,"m",Lv).call(this),d=(e=>Array.from((null==e?void 0:e.attributes)||[]).reduce(((e,t)=>{var n;const r=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return r?Object.assign(e,{[r]:t.value}):e}),{}))(e);this.nextRequestStatus.update({isLoading:!0});const l=Object.assign(Object.assign(Object.assign({},d),a),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin}),c=yield t(s,l);this.nextRequestStatus.update({isLoading:!1}),this.captureLastSubmittedLoginId(a,null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.executionId),this.storeCredentials(a)}}))))),this.flowState=e}nativeResume(e,t){var n,i,o,s,a,d;const l=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let e,{exchangeCode:t}=l;if(!t){const r=new URL(l.url);t=null===(n=r.searchParams)||void 0===n?void 0:n.get(Uf),e=(null===(i=r.searchParams)||void 0===i?void 0:i.get(_f))||void 0}null===(s=(o=this.nativeCallbacks).complete)||void 0===s||s.call(o,{exchangeCode:t,exchangeError:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(l.url),t=e.searchParams.get("t"),n=e.searchParams.get(Mf).split("_").pop();r(this,Av,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const{screenResolve:e}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:t}=l;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=l,{screenNext:n}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(d=(a=this.nativeCallbacks).complete)||void 0===d||d.call(a,l)}loadSdkScriptsModules(){const e=this.shadowRoot.querySelectorAll("div[data-script-id]");return Array.from(e).map((e=>e.moduleRes)).filter((e=>!!e))}loadSdkScripts(e){if(!(null==e?void 0:e.length))return null;const t=(e,t)=>n=>{this.dispatchEvent(new CustomEvent("components-context",{detail:{[Mp(e.id,e.resultKey)]:n},bubbles:!0,composed:!0})),t(e.id)};this.loggerWrapper.debug(`Preparing to load scripts: ${e.map((e=>e.id)).join(", ")}`);const r=Promise.all(null==e?void 0:e.map((e=>n(this,void 0,void 0,(function*(){var n,r,i;const o=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(o){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=o;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}(null===(r=globalThis.descope)||void 0===r?void 0:r[e.id])||(yield this.injectNpmLib("@descope/flow-scripts","1.0.17",`dist/${e.id}.js`));const s=null===(i=globalThis.descope)||void 0===i?void 0:i[e.id];return new Promise(((n,r)=>{try{const r=s(e.initArgs,{baseUrl:this.baseUrl,ref:this},t(e,n),this.loggerWrapper);if(r){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=r,this.shadowRoot.appendChild(t);const n=this.nextRequestStatus.subscribe((()=>{var i;this.loggerWrapper.debug("Stopping script",e.id),(null===(i=r.stop)||void 0===i?void 0:i.call(r))&&(this.nextRequestStatus.unsubscribe(n),this.loggerWrapper.debug("Removing script",e.id),this.shadowRoot.removeChild(t))}))}}catch(e){r(e)}}))}))))),i=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([r,i])}get isDismissScreenErrorOnInput(){return"true"===this.getAttribute("dismiss-screen-error-on-input")}init(){var e,t;if(!window.descopeBridge)return this._init();this.lazyInit=this._init,i(this,vv,null===(t=null===(e=null===window||void 0===window?void 0:window.descopeBridge)||void 0===e?void 0:e.registerFlow)||void 0===t?void 0:t.call(e,this),"f")}_init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t,n;this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),r(this,cv,"m",wv).call(this),window.addEventListener("visibilitychange",r(this,pv,"f").visibilitychange)),yield null===(n=e.init)||void 0===n?void 0:n.call(this)}))}disconnectedCallback(){var e,t,n;super.disconnectedCallback(),r(this,vv,"f")&&(null===(t=null===(e=window.descopeBridge)||void 0===e?void 0:e.unregisterFlow)||void 0===t||t.call(e,r(this,vv,"f")),i(this,vv,void 0,"f")),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),r(this,Av,"f").call(this),null===(n=r(this,hv,"f"))||void 0===n||n.abort(),i(this,hv,null,"f"),window.removeEventListener("visibilitychange",r(this,pv,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return n(this,void 0,void 0,(function*(){let n;const r=y(e),i=yield this.getTargetLocales();return i.includes(r.locale)?n=`${t}-${r.locale}.html`:i.includes(r.fallback)&&(n=`${t}-${r.fallback}.html`),n}))}getPageContent(e,t){return n(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield this.fetchStaticResource(t,"text");return e}catch(n){this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`,n)}try{const{body:t}=yield this.fetchStaticResource(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,o,s){return n(this,void 0,void 0,(function*(){var a,d;const{projectId:l,flowId:c,tenant:u,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectIsPopup:$,redirectUrl:b,token:w,code:C,isPopup:k,exchangeError:S,webauthnTransactionId:x,webauthnOptions:I,redirectAuthCodeChallenge:O,redirectAuthCallbackUrl:E,redirectAuthBackupCallbackUri:A,redirectAuthInitiator:P,locale:N,samlIdpResponseUrl:j,samlIdpResponseSamlResponse:R,samlIdpResponseRelayState:T,wsFedIdpResponseUrl:M,wsFedIdpResponseWresult:U,wsFedIdpResponseWctx:L,nativeResponseType:_,nativePayload:W,reqTimestamp:F}=e,D=t(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx","nativeResponseType","nativePayload","reqTimestamp"]);let q,B,H;const V=(()=>{const e=eg(tg);if(!e){const e=Math.floor(100*Math.random()+1);return Qp(tg,e.toString()),e}return Number(e)})(),{outboundAppId:G}=this,{outboundAppScopes:K}=this,z=this.sdk.getLastUserLoginId(),J=yield this.getFlowConfig(),Z=yield this.getProjectConfig(),Y=Object.entries(Z.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),X=E&&O?{callbackUrl:E,codeChallenge:O,backupCallbackUri:A}:void 0,Q=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect,externalAuthRedirect:this.nativeOptions.externalAuthRedirect}:void 0;let ee={};if(!f){sg(this.loggerWrapper);const e=[...J.clientScripts||[],...J.sdkScripts||[]];if(J.conditions){let t=[];({startScreenId:q,conditionInteractionId:H,startScreenName:B,clientScripts:t,componentsConfig:ee}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:r})=>{var i;if("ELSE"===t)return!0;const o=null===(i=ng[t])||void 0===i?void 0:i[n];return!!(null==o?void 0:o(e,r))}));return n?{startScreenId:n.met.screenId,startScreenName:n.met.screenName,conditionInteractionId:n.met.interactionId,clientScripts:n.met.clientScripts,componentsConfig:n.met.componentsConfig}:{}})({loginId:z,code:C,token:w,abTestingKey:V,lastAuth:rg(z,this.loggerWrapper)},J.conditions)),e.push(...t||[])}else J.condition?({startScreenId:q,conditionInteractionId:H}=((e,t)=>{var n;const r=null===(n=ng[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!r)return{};const i=r(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==i?void 0:i.screenId,startScreenName:null==i?void 0:i.screenName,conditionInteractionId:null==i?void 0:i.interactionId}})(J.condition,{loginId:z,code:C,token:w,abTestingKey:V,lastAuth:rg(z,this.loggerWrapper)})):(B=J.startScreenName,q=J.startScreenId);if(i(this,fv,this.loadSdkScripts(e),"f"),J.fingerprintEnabled&&J.fingerprintKey?yield ya(J.fingerprintKey,this.baseUrl):Js(ma),!Op(q,D)){const e=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},D),{client:this.client}),b&&{redirectUrl:b}),{lastAuth:rg(z,this.loggerWrapper),abTestingKey:V,locale:y(N).locale,nativeOptions:Q,outboundAppId:G,outboundAppScopes:K}),H,"",Z.componentsVersion,Y,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),C?{exchangeCode:C,idpInitiated:!0}:{}),D.descopeIdpInitiated&&{idpInitiated:!0}),w?{token:w}:{}),D.oidcLoginHint?{externalId:D.oidcLoginHint}:{}));return r(this,Nv,"f").call(this,e),void("completed"!==(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.status)&&this.flowState.update({code:void 0,token:void 0}))}}if(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:k,code:C,exchangeError:S,isCodeChanged:s("code"),isExchangeErrorChanged:s("exchangeError")})),k&&(s("code")&&C||s("exchangeError")&&S))return void r(this,cv,"m",Jv).call(this,f,C,S);if(f&&(s("token")&&w||s("code")&&C||s("exchangeError")&&S)){const e=yield this.sdk.flow.next(f,h,cp,J.version,Z.componentsVersion,{token:w,exchangeCode:C,exchangeError:S});return r(this,Nv,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===lp&&j&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>s(e)))){if(!R)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,r)=>{const i=document.createElement("form");i.method="POST",i.action=e,i.innerHTML=`\n <input type="hidden" role="saml-response" name="SAMLResponse" value="${t}" />\n <input type="hidden" role="saml-relay-state" name="RelayState" value="${n}" />\n <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />\n `,document.body.appendChild(i),r(i)})(j,R,T||"",Ep)}if(p===lp&&M&&["wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx"].some((e=>s(e)))){if(!U)return void this.loggerWrapper.error("Did not get wsfed idp params data to load");((e,t,n,r)=>{const i=document.createElement("form");i.method="POST",i.action=e;const o=(e,t)=>{const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n};i.appendChild(o("wa","wsignin1.0")),i.appendChild(o("wresult",t)),i.appendChild(o("wctx",n));const s=document.createElement("input");s.type="submit",s.id="WSFedSubmitButton",s.value="Continue",s.style.display="none",i.appendChild(s),document.body.appendChild(i),r(i)})(M,U,L||"",Ep)}if(p===ip&&(s("redirectTo")||s("deferredRedirect"))){if(!m)return void this.loggerWrapper.error("Did not get redirect url");if("no-op"===m)return;if("android"===P&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${$}`),$){this.loggerWrapper.debug("Opening redirect in popup");const e=((e,t,n,r)=>{const i=void 0!==window.screenLeft?window.screenLeft:window.screen.left,o=void 0!==window.screenTop?window.screenTop:window.screen.top,s=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-n)/2+i,a=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-r)/2+o,d=function(){const e=navigator.userAgent||"",t=/\b(iPhone)\b/.test(e),n=/Safari/.test(e)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(e);return t&&n}()?"about:blank":"",l=window.open(d,t,`width=${n},height=${r},top=${a},left=${s},scrollbars=yes,resizable=yes`);return l.location.href=e,l.focus(),l})(m,"?",598,700),t=this.shouldUsePopupPostMessage();t&&(e.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(t?"postMessage":"BroadcastChannel"));let n=!1;const i=e=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(e.data));const r=t?this.popupOrigin:window.location.origin;if(e.origin!==r)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${e.origin}", expected: "${r}"`);const{action:i,data:o}=e.data||{};"code"===i&&(n=!0,this.flowState.update({code:o.code,exchangeError:o.exchangeError}))};let o;this.loggerWrapper.debug("Starting popup closed detection");const s=setInterval((()=>{e.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(s),r(this,cv,"m",zv).call(this,"popupclosed",{abandoned:!n}),this.loggerWrapper.debug("Cleaning up popup listeners"),null==o||o())}),1e3);if(t)window.addEventListener("message",i),o=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",i)};else{this.loggerWrapper.debug("Creating broadcast channel");const e=new BroadcastChannel(f);e.onmessage=i,o=()=>{this.loggerWrapper.debug("Closing channel"),e.close()}}}else this.handleRedirect(m),this.flowState.update({redirectTo:"no-op"}),r(this,cv,"m",zv).call(this,"popupclosed",{});return}if(p===sp||p===ap){if(!x||!I)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t,n,o;null===(d=r(this,hv,"f"))||void 0===d||d.abort(),i(this,hv,null,"f");try{e=p===sp?yield this.sdk.webauthn.helpers.create(I):yield this.sdk.webauthn.helpers.get(I)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name,n=e.reason,o=e.message}const s=yield this.sdk.flow.next(f,h,cp,J.version,Z.componentsVersion,{transactionId:x,response:e,failure:t,failureReason:n,failureMessage:o});r(this,Nv,"f").call(this,s)}if(p===dp)return this.nativeCallbacks.complete=e=>n(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,cp,J.version,Z.componentsVersion,e);r(this,Nv,"f").call(this,t)})),r(this,cv,"m",yv).call(this,_,W),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((s("action")||s("deferredPolling"))&&r(this,Ev,"f").call(this,f,h,J.version,Z.componentsVersion),!g&&!q)return void this.loggerWrapper.warn("No screen was found to show");const te=q||g,ne=yield this.getHtmlFilenameWithLocale(N,te),{oidcLoginHint:re,oidcPrompt:ie,oidcErrorRedirectUri:oe,oidcResource:se,samlIdpUsername:ae}=D,de={direction:yp(h,o.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:z,name:this.sdk.getLastUserDisplayName()||z},componentsConfig:Object.assign(Object.assign(Object.assign({},J.componentsConfig),ee),null==v?void 0:v.componentsConfig)}),htmlFilename:`${te}.html`,htmlLocaleFilename:ne,screenId:te,stepName:e.stepName||B,samlIdpUsername:ae,oidcLoginHint:re,oidcPrompt:ie,oidcErrorRedirectUri:oe,oidcResource:se,action:p,locale:y(N).locale},le=rg(z,this.loggerWrapper);Op(q,D)?de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==J?void 0:J.clientScripts)||[];yield r(this,cv,"m",Bv).call(this,n);const i=yield this.sdk.flow.start(c,Object.assign(Object.assign(Object.assign(Object.assign({tenant:u,redirectAuth:X},D),{lastAuth:le,preview:this.preview,abTestingKey:V,client:this.client}),b&&{redirectUrl:b}),{locale:y(N).locale,nativeOptions:Q,outboundAppId:G,outboundAppScopes:K}),H,e,Z.componentsVersion,Y,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),Tp(t)),C&&{exchangeCode:C,idpInitiated:!0}),D.descopeIdpInitiated&&{idpInitiated:!0}),w&&{token:w}),de.next.isCustomScreen);return r(this,Nv,"f").call(this,i),i})):(s("projectId")||s("baseUrl")||s("executionId")||s("stepId"))&&(de.next=(e,t)=>n(this,void 0,void 0,(function*(){const n=(null==v?void 0:v.clientScripts)||[];yield r(this,cv,"m",Bv).call(this,n);const i=yield this.sdk.flow.next(f,h,e,J.version,Z.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),Tp(t)),de.next.isCustomScreen);return r(this,Nv,"f").call(this,i),i}))),this.loggerWrapper.debug("Got a screen with id",de.screenId),yield r(this,cv,"m",xv).call(this,de),this.stepState.update(de)}))}onStepChange(e,t){return n(this,void 0,void 0,(function*(){var i,o,s;const{htmlFilename:a,htmlLocaleFilename:d,direction:l,next:c,screenState:u,screenId:h}=e;this.loggerWrapper.debug("Rendering a flow screen"),this.updateScreenUser(null==u?void 0:u.user);const f=document.createElement("template");f.innerHTML=yield this.getPageContent(a,d);const p=f.content.cloneNode(!0),g=this.loadDescopeUiComponents(f);this.sdk.webauthn.helpers.isSupported()?yield r(this,cv,"m",Tv).call(this,p,c):(e=>{e.querySelectorAll(`descope-button[${rp}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(p),!e.samlIdpUsername||(null===(i=u.form)||void 0===i?void 0:i.loginId)||(null===(o=u.form)||void 0===o?void 0:o.email)||(u.form||(u.form={}),u.form.loginId=e.samlIdpUsername,u.form.email=e.samlIdpUsername),Zp(p,u,this.formConfig,this.loggerWrapper),this.applyComponentsState(p,null==u?void 0:u.componentsState);const{geo:v}=null!==(s=yield this.getExecutionContext())&&void 0!==s?s:{};((e,t)=>{Object.entries({"default-code":"autoDetect","default-country":"autoDetect"}).forEach((([n,r])=>{Array.from(e.querySelectorAll(`[${n}="${r}"]`)).forEach((e=>{e.setAttribute(n,t||r)}))}))})(p,v),((e,t)=>{let n=t;if(t)try{const[e]=Intl.getCanonicalLocales(t);e&&(n=e)}catch(e){}Object.entries({lang:"autoDetect"}).forEach((([t,r])=>{Array.from(e.querySelectorAll(`[${t}="${r}"]`)).forEach((e=>{e.setAttribute(t,n||r)}))}))})(p,e.locale);const m=()=>n(this,void 0,void 0,(function*(){var n,i;yield g;const o=this.contentRootElement;((e,t)=>{Jp(e,"descope-totp-image",t)})(o,null===(n=null==u?void 0:u.totp)||void 0===n?void 0:n.image),((e,t)=>{Jp(e,"descope-notp-image",t)})(o,null===(i=null==u?void 0:u.notp)||void 0===i?void 0:i.image),((e,t,n,r)=>{n&&Object.keys(n).forEach((i=>{if(!t.querySelector(i))return void r.debug(`Skipping css vars for component "${i}"`,`Got css vars for component ${i} but Could not find it on next page`);const o=customElements.get(i);o?Object.keys(n[i]).forEach((t=>{var s;const a=n[i],d=null===(s=null==o?void 0:o.cssVarList)||void 0===s?void 0:s[t];if(!d)return void r.info(`Could not find css variable name for ${t} in ${i}`,"Check if the css variable is defined in the component");const l=a[t];e.style.setProperty(d,l)})):r.debug(`Could not find component class for ${i}`,"Check if the component is registered")}))})(o,p,u.cssVars,this.loggerWrapper),o.replaceChildren(p);const s=!t.htmlFilename;setTimeout((()=>{r(this,cv,"m",Fv).call(this),this.updateUsernameAnchor(),this.validateOnBlur&&(e=>{e.querySelectorAll("*[name]").forEach((t=>{t.addEventListener("blur",(()=>{var n;const r=()=>{var e;const n=t.focus;t.focus=()=>{},null===(e=t.reportValidity)||void 0===e||e.call(t),setTimeout((()=>{t.focus=n}))};if("true"===t.getAttribute("invalid")||(null===(n=t.value)||void 0===n?void 0:n.length))return void r();const i={timer:void 0},o=e=>{"true"===e.target.getAttribute("formnovalidate")&&(clearTimeout(i.timer),i.timer=void 0)};i.timer=setTimeout((()=>{e.removeEventListener("click",o),r(),i.timer=void 0}),150),e.addEventListener("click",o,{once:!0})}))}))})(o),((e,t)=>{Vp(e,null==t?void 0:t.inputs),Vp(e,null==t?void 0:t.form)})(o,u),this.initRealtimeConditions(o,u),r(this,cv,"m",Mv).call(this,{isFirstScreen:s,isCustomScreen:!1,stepName:e.stepName}),xp(o,this.autoFocus,s),r(this,cv,"m",Gv).call(this,h)})),r(this,cv,"m",Kv).call(this,c,h),o.querySelector(`[${rp}="polling"]`)&&c(up,{})}));l?r(this,cv,"m",Ov).call(this,m):m()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${Wf}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch(e){return!1}return!0}}uv=new WeakMap,hv=new WeakMap,fv=new WeakMap,pv=new WeakMap,vv=new WeakMap,Sv=new WeakMap,Iv=new WeakMap,Ev=new WeakMap,Av=new WeakMap,Pv=new WeakMap,Nv=new WeakMap,jv=new WeakMap,_v=new WeakMap,qv=new WeakMap,cv=new WeakSet,gv=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},mv=function(e,t,i){return n(this,void 0,void 0,(function*(){var n;return(null===(n=this.nativeOptions)||void 0===n?void 0:n.bridgeVersion)>=2&&new Promise((n=>{this.nativeCallbacks.screenNext=i,this.nativeCallbacks.screenResolve=n,r(this,cv,"m",yv).call(this,"beforeScreen",{screen:e,context:t})}))}))},$v=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&r(this,cv,"m",yv).call(this,"afterScreen",{screen:e})},yv=function(e,t){r(this,cv,"m",zv).call(this,"bridge",{type:e,payload:t})},bv=function({errorText:e,errorType:t}){const n=()=>{var n;let r=e;try{r=(null===(n=this.errorTransformer)||void 0===n?void 0:n.call(this,{text:e,type:t}))||e}catch(e){this.loggerWrapper.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${rp}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(this.contentRootElement,"error-message",r)};this.addEventListener("screen-updated",n,{once:!0}),n()},wv=function(){var e,n,i;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var n=e.screenState,r=t(void 0===n?{}:n,["errorText","errorType"]),i=t(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:r})})),null===(n=this.stepState)||void 0===n||n.subscribe(r(this,cv,"m",bv).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}),{forceUpdate:!0}),null===(i=this.stepState)||void 0===i||i.subscribe(r(this,cv,"m",Cv).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}),{forceUpdate:!0})},Cv=function({errorText:e,errorType:t}){(t||e)&&(this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((e=>{e.shadowRoot.querySelectorAll("descope-text-field[data-id]").forEach((e=>{e.value=""}))})),xp(this.contentRootElement,this.autoFocus,!1))},kv=function(){return n(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Trying to restart the flow");const e=yield this.getComponentsVersion();this.reset(),e===(yield this.getComponentsVersion())?(this.loggerWrapper.debug("Components version was not changed, restarting flow"),this.flowState.update({stepId:null,executionId:null})):this.loggerWrapper.error("Components version mismatch, please reload the page")}))},xv=function(e){return n(this,void 0,void 0,(function*(){var n;const o=Object.assign(Object.assign({},this.stepState.current),e),{next:s,stepName:a}=o,d=(e=>{const t=(n=e.screenState,r=(e,t)=>pp.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([e,t])=>!r(0,e)))));var n,r;const{screenState:{errorText:i,errorType:o}}=e;(i||o)&&(t.error={text:i,type:o}),e.action&&(t.action=e.action);const s=(e=>{if(!e)return;const t={};return Rp.forEach((({key:n,from:r})=>{const i=r(e);void 0!==i&&(t[n]=i)})),Object.keys(t).length?t:void 0})(e.screenState);return s&&(t.data=s),t})(t(o,["next","stepName"]));let l=yield r(this,cv,"m",mv).call(this,a,d,s);l||(l=Boolean(yield null===(n=this.onScreenUpdate)||void 0===n?void 0:n.call(this,a,d,s,this)));const c=!this.stepState.current.htmlFilename;if(r(this,Iv,"f").call(this,l),s&&(s.isCustomScreen=l),r(this,Sv,"f")!==l){const[e,t]=["flow","custom"].sort((()=>l?-1:1));this.loggerWrapper.debug(`Switching from ${t} screen to ${e} screen`),i(this,Sv,l,"f"),l?this.stepState.unsubscribeAll():r(this,cv,"m",wv).call(this)}l?(this.loggerWrapper.debug("Showing a custom screen"),r(this,cv,"m",Mv).call(this,{isFirstScreen:c,isCustomScreen:l,stepName:e.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=l}))},Ov=function(e){this.contentRootElement.addEventListener("transitionend",(()=>{this.loggerWrapper.debug("page switch transition end"),this.contentRootElement.classList.remove("fade-out"),e()}),{once:!0}),this.loggerWrapper.debug("page switch transition start"),this.contentRootElement.classList.add("fade-out")},Rv=function(e){const t=e.getAttribute("name");if(!["email"].includes(t)){const n=`user-${t}`;e.setAttribute("name",n),e.addEventListener("input",(()=>{e.setAttribute("name",e.value?t:n)}))}},Tv=function(e,t){return n(this,void 0,void 0,(function*(){var o;null===(o=r(this,hv,"f"))||void 0===o||o.abort();const s=e.querySelector('*[autocomplete="webauthn"]');if(s&&(yield Yp())){const{options:e,transactionId:o}=(yield r(this,jv,"f").call(this))||{};e&&o&&(r(this,cv,"m",Rv).call(this,s),i(this,hv,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,r(this,hv,"f")).then((e=>n(this,void 0,void 0,(function*(){t(s.id,{transactionId:o,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},Mv=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&r(this,cv,"m",zv).call(this,"ready",{}),t||r(this,cv,"m",$v).call(this,n),r(this,cv,"m",zv).call(this,"page-updated",{screenName:n}),r(this,cv,"m",zv).call(this,"screen-updated",{screenName:n})},Uv=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,r;"slot"===t.localName||t.classList.contains("hidden")||(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(r=t.checkValidity)||void 0===r?void 0:r.call(t)))})),e},Lv=function(){return n(this,void 0,void 0,(function*(){const e=this.getInputs();return(yield Promise.all(e.map((e=>n(this,void 0,void 0,(function*(){return{name:e.getAttribute("name"),value:e.value}})))))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:t.value})),{})}))},Wv=function(e){var t,o;const s=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((t=>t!==e)),a=(null===(o=null===(t=this.flowState.current)||void 0===t?void 0:t.screenState)||void 0===o?void 0:o.clientScripts)||[],d=()=>{e.removeAttribute("loading"),s.forEach((e=>{e.removeAttribute("disabled")}))},l=e=>n(this,void 0,void 0,(function*(){var t;if(this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",l),!0===(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.abandoned)&&a.length)return i(this,fv,(()=>n(this,void 0,void 0,(function*(){try{yield this.loadSdkScripts(a)}catch(e){this.loggerWrapper.warn("Failed to refresh client scripts on popup close",null==e?void 0:e.message)}})))(),"f"),void d();d();const r=yield this.getFlowConfig(),o=[...r.clientScripts||[],...r.sdkScripts||[]];this.loadSdkScripts(o)})),c=()=>{var e;window.removeEventListener("pageshow",r(this,_v,"f")),i(this,_v,(e=>{e.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),l())}),"f"),window.addEventListener("pageshow",r(this,_v,"f"),{once:!0});const t=null===(e=this.stepState)||void 0===e?void 0:e.subscribe(((e,n)=>{e===n&&l(),this.removeEventListener("popupclosed",l),this.stepState.unsubscribe(t)}),(e=>e.screenId),{forceUpdate:!0})},u=this.nextRequestStatus.subscribe((({isLoading:t})=>{t?(this.addEventListener("popupclosed",l,{once:!0}),e.setAttribute("loading","true"),s.forEach((e=>e.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(u),"success"===this.flowStatus?(this.removeEventListener("popupclosed",l),d()):c())}))},Fv=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>r(this,cv,"m",Dv).call(this,e)))},Dv=function(e){e&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),r=`input-${e.id}-${n}`,i=document.createElement("slot");i.setAttribute("name",r),i.setAttribute("slot",n),e.appendChild(i),t.setAttribute("slot",r),this.appendChild(t)}))},Bv=function(e){return n(this,void 0,void 0,(function*(){if(r(this,fv,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield r(this,fv,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const t=this.loadSdkScriptsModules(),n=e.map((e=>e.id));for(const e of t)if(n.includes(e.id))try{"function"==typeof e.present&&((yield e.present())||this.loggerWrapper.debug(`Sdk script ${e.id} was cancelled`))}catch(t){this.loggerWrapper.error(`Failed to present ${e.id} script module`,t.message)}const i=[];for(const e of t)"function"==typeof e.refresh&&i.push(e.refresh());if(i.length>0)try{yield Ip(5e3,Promise.all(i),null)}catch(e){this.loggerWrapper.error("Failed to refresh script module",e.message)}}))},Hv=function(e,t){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((n=>{n.addEventListener("input",(()=>{var i;(null===(i=n.checkValidity)||void 0===i?void 0:i.call(n))&&r(this,qv,"f").call(this,n,e,t)}))}))},Vv=function(e,t,n){t&&n&&"true"===e.getAttribute("data-opt-in-last-used-auth")&&function(e,t,n){try{const n=og();n[e]=t,Qp(fp,JSON.stringify(n))}catch(e){null==n||n.warn("[Descope] Failed to update in-flight last auth storage",String(e))}}(n,t,this.loggerWrapper)},Gv=function(e){var t;const n=null===(t=rg(this.sdk.getLastUserLoginId(),this.loggerWrapper).lastUsedPerScreen)||void 0===t?void 0:t[e];if(!n)return;const r=this.contentRootElement.querySelector('descope-attachment[data-type="last-auth-badge"]'),i=this.contentRootElement.querySelector(`#${CSS.escape(n)}`);r&&i&&(i.replaceWith(r),r.appendChild(i))},Kv=function(e,t){this.contentRootElement.querySelectorAll(`descope-button:not([${Ff}]), [data-type="button"]:not([${Ff}]`).forEach((n=>{n.onclick=()=>{r(this,qv,"f").call(this,n,e,t)}})),r(this,cv,"m",Hv).call(this,e,t),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Wf}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},zv=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},Jv=function(e,t,n){var r;const[i,o]=(null===(r=window.name)||void 0===r?void 0:r.split("|"))||[],s={data:{code:t,exchangeError:n},action:"code"};if("descope-wc"===i&&o){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",o);try{window.opener.postMessage(s,o)}catch(e){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",null==e?void 0:e.message)}}else{this.loggerWrapper.debug("Creating popup channel",e);const t=new BroadcastChannel(e);t.postMessage(s),t.close()}try{window.close()}catch(e){}},Zv.bridgeVersion=3,customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",Zv);var Yv=Object.freeze({__proto__:null,default:Zv});const Xv=(e,t,n,r={})=>{var i,o,s,a;return[Math.min(Math.max(t,("all"===r.left?e.offsetWidth:null!==(i=r.left)&&void 0!==i?i:0)-e.offsetWidth),window.innerWidth-("all"===r.right?e.offsetWidth:null!==(o=r.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===r.top?e.offsetHeight:null!==(s=r.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===r.bottom?e.offsetHeight:null!==(a=r.bottom)&&void 0!==a?a:0))]},Qv=(e,t,n)=>{let r=0,i=0,o=0,s=0;function a(t){t.preventDefault(),r=o-t.clientX,i=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=Xv(e,e.offsetLeft-r,e.offsetTop-i,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function l(e){e.preventDefault(),o=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l};var em,tm,nm,rm,im,om,sm,am,dm,lm,cm;const um=document.createElement("template");um.innerHTML='\n<div class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n';const hm=o(J)(HTMLElement);class fm extends hm{constructor(){super(),em.add(this),tm.set(this,new Dp({messages:[]})),nm.set(this,void 0),rm.set(this,void 0),im.set(this,void 0),om.set(this,{resize:r(this,em,"m",cm).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(um.content.cloneNode(!0)),i(this,nm,this.shadowRoot.querySelector(".debugger"),"f"),i(this,rm,r(this,nm,"f").querySelector(".content"),"f"),i(this,im,r(this,nm,"f").querySelector(".header"),"f"),r(this,em,"m",sm).call(this)}updateData(e){r(this,tm,"f").update((t=>({messages:t.messages.concat(e)})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;null===(t=e.init)||void 0===t||t.call(this),Qv(r(this,nm,"f"),r(this,im,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",r(this,om,"f").resize),(e=>{e.onmousemove=t=>{(t.target.w&&t.target.w!==t.target.offsetWidth||t.target.h&&t.target.h!==t.target.offsetHeight)&&e.onresize(t),t.target.w=t.target.offsetWidth,t.target.h=t.target.offsetHeight}})(r(this,nm,"f")),r(this,nm,"f").onresize=r(this,em,"m",lm).bind(this),r(this,tm,"f").subscribe(r(this,em,"m",am).bind(this))}))}disconnectedCallback(){r(this,tm,"f").unsubscribeAll(),window.removeEventListener("resize",r(this,om,"f").resize)}}tm=new WeakMap,nm=new WeakMap,rm=new WeakMap,im=new WeakMap,om=new WeakMap,em=new WeakSet,sm=function(){this.injectStyle('\n .debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),r(this,nm,"f").style.top="32px",r(this,nm,"f").style.left=window.innerWidth-300-32+"px"},am=function(e){r(this,em,"m",dm).call(this,e),r(this,em,"m",lm).call(this)},dm=function(e){r(this,rm,"f").innerHTML=e.messages.map((e=>`\n <div class="msg">\n <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.99984 13.167L8.99984 10.167L11.9998 13.167L13.1665 12.0003L10.1665 9.00033L13.1665 6.00033L11.9998 4.83366L8.99984 7.83366L5.99984 4.83366L4.83317 6.00033L7.83317 9.00033L4.83317 12.0003L5.99984 13.167ZM8.99984 17.3337C7.84706 17.3337 6.76373 17.1148 5.74984 16.677C4.73595 16.2398 3.854 15.6462 3.104 14.8962C2.354 14.1462 1.76039 13.2642 1.32317 12.2503C0.885393 11.2364 0.666504 10.1531 0.666504 9.00033C0.666504 7.84755 0.885393 6.76421 1.32317 5.75033C1.76039 4.73644 2.354 3.85449 3.104 3.10449C3.854 2.35449 4.73595 1.7606 5.74984 1.32283C6.76373 0.885603 7.84706 0.666992 8.99984 0.666992C10.1526 0.666992 11.2359 0.885603 12.2498 1.32283C13.2637 1.7606 14.1457 2.35449 14.8957 3.10449C15.6457 3.85449 16.2393 4.73644 16.6765 5.75033C17.1143 6.76421 17.3332 7.84755 17.3332 9.00033C17.3332 10.1531 17.1143 11.2364 16.6765 12.2503C16.2393 13.2642 15.6457 14.1462 14.8957 14.8962C14.1457 15.6462 13.2637 16.2398 12.2498 16.677C11.2359 17.1148 10.1526 17.3337 8.99984 17.3337ZM8.99984 15.667C10.8609 15.667 12.4373 15.0212 13.729 13.7295C15.0207 12.4378 15.6665 10.8614 15.6665 9.00033C15.6665 7.13921 15.0207 5.56283 13.729 4.27116C12.4373 2.97949 10.8609 2.33366 8.99984 2.33366C7.13873 2.33366 5.56234 2.97949 4.27067 4.27116C2.979 5.56283 2.33317 7.13921 2.33317 9.00033C2.33317 10.8614 2.979 12.4378 4.27067 13.7295C5.56234 15.0212 7.13873 15.667 8.99984 15.667Z" fill="#ED404A"/>\n</svg>\n\n <div class="msg_content">\n <div class="msg_title">\n ${e.title}\n </div>\n <div class="msg_desc">\n ${e.description}\n </div>\n </div>\n <div class="chevron"></div>\n </div>\n `)).join("")},lm=function(){r(this,rm,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,r=t.clientHeight>20;n||r?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},cm=function(){const[e,t]=Xv(r(this,nm,"f"),Number.parseInt(r(this,nm,"f").style.left,10),Number.parseInt(r(this,nm,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});r(this,nm,"f").style.top=`${t}px`,r(this,nm,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",fm);var pm=Object.freeze({__proto__:null,default:fm});return ff}();
7
7
  //# sourceMappingURL=index.js.map