@descope/react-sdk 2.14.5 → 2.14.6
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/cjs/constants.js +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -9
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Descope={},e.React)}(this,(function(e,t){"use strict";const n=t.createContext(void 0),i=e=>(...t)=>{if(!e)throw Error("You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component");return e(...t)},r=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},o={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.14.5"},s="undefined"!=typeof window;var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function d(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function l(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))}function c(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function u(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;class h extends Error{}function f(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 p(e,t){if("string"!=typeof e)throw new h("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,i=e.split(".")[n];if("string"!=typeof i)throw new h(`Invalid token specified: missing part #${n+1}`);let r;try{r=f(i)}catch(e){throw new h(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new h(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}h.prototype.name="InvalidTokenError";var g={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"},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",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 v="<region>",m=`https://api.${v}descope.com`,y=6e5,$="dct",b=()=>{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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};let w;const C=()=>{if(w)return w;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 w=`${t}-${n}`,w};var k;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(k||(k={}));const S=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(v,r?r+".":"");let o=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,i)=>{o=`${o}${0===i?"?":""}${t}=${encodeURIComponent(n[t])}${i===e.length-1?"":"&"}`}))}return o},x=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,i])=>(e[n]=i,e)),e),e}),{})),I={"Content-Type":"application/json"},R=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},O=e=>{const t={"x-descope-sdk-session-id":C(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.43.1"};return e&&(t["x-descope-refresh-cookie-name"]=e),t},E=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},N=({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{const d=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),i=await n.text();return n.text=()=>Promise.resolve(i),n.json=()=>Promise.resolve(JSON.parse(i)),n.clone=()=>n,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(...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=>b().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await n(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return b().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(i)),i}:n})(r,a),l=async r=>{var a;const l=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=l,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:x(R(t,g),O(i),(null==n?void 0:n.baseHeaders)||{},E(v)?I:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const y=await d(S({path:c,baseUrl:e,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==y?void 0:y.clone()),null==o?void 0:o.transformResponse){const e=await y.json(),t=((null===(a=y.headers)||void 0===a?void 0:a.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,i]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:i})}),{}),n=Object.assign(Object.assign({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}return y};return{get:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:k.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.post,token:r}),patch:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.patch,token:r}),put:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.put,token:r}),delete:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:k.delete,token:i}),hooks:o,buildUrl:(n,i)=>S({projectId:t,baseUrl:e,path:n,queryParams:i})}};var A=429;function j(e,t,n){var i;let r=P(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r[$])===t)return(null==r?void 0:r[n])||[];r=null===(i=null==r?void 0:r.tenants)||void 0===i?void 0:i[t]}const o=null==r?void 0:r[n];return Array.isArray(o)?o:[]}function P(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return p(e)}function M(e){const{exp:t}=P(e);return(new Date).getTime()/1e3>t}function T(e){let t=P(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function U(e,t){return j(e,t,"permissions")}function _(e,t){return j(e,t,"roles")}const L=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function W(e,t){var n;const i=await e,r={code:i.status,ok:i.ok,response:i},o=await i.clone().json();return i.ok?r.data=o:(r.error=o,i.status===A&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function D(e){var t;return(null===(t=P(e))||void 0===t?void 0:t[$])||""}const F=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),q=(e,t)=>(n=t)=>t=>{const i=e.filter((e=>e(t)));return!(i.length<e.length)&&(n?n.replace("{val}",t):i.join(" OR "))},B=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),V=e=>t=>e.test(t),K=V(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),H=V(/^\+[1-9]{1}[0-9]{3,14}$/),G=F(K,'"{val}" is not a valid email'),z=F(H,'"{val}" is not a valid phone number'),J=F((e=>e.length>=1),"Minimum length is 1");const Z=F((e=>"string"==typeof e),"Input is not a string"),Y=F((e=>Array.isArray(e)),"Input is not an array"),X=F((e=>"boolean"==typeof e),"Input is not a boolean"),Q=F((e=>void 0===e),"Input is defined"),ee=q([Z(),Q()],"Input is not a string or undefined"),te=q([Y(),X()],"Input is not an array or boolean"),ne=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>B(...e).validate(n[t]))),t(...n)),ie=e=>[Z(`"${e}" must be a string`)],re=e=>[ee(`"${e}" must be string or undefined`)],oe=e=>[Z(`"${e}" must be a string`),J(`"${e}" must not be empty`)],se=e=>[Z(`"${e}" must be a string`),G()],ae=e=>[Z(`"${e}" must be a string`),z()],de=ne(oe("accessKey")),le=e=>({exchange:de(((t,n)=>W(e.post(g.accessKey.exchange,{loginOptions:n},{token:t}))))}),ce=(e,t,n)=>(t.forEach((t=>{const i=t.split(".");let r=i.shift(),o=e;for(;i.length>0;){if(o=o[r],!r||!o)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=i.shift()}if("function"!=typeof o[r])throw Error(`"${t}" is not a function`);const s=o[r];o[r]=n(s)})),e),ue=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||y,y)});var he,fe;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(he||(he={})),function(e){e.email="email"}(fe||(fe={}));const pe=Object.assign(Object.assign({},he),fe);var ge;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(ge||(ge={}));const ve=oe("loginId"),me=ne(oe("token")),ye=ne(ve),$e=ne(oe("pendingRef")),be=ne(ve,se("email")),we=e=>({verify:me((t=>W(e.post(g.enchantedLink.verify,{token:t})))),signIn:ye(((t,n,i,r)=>W(e.post(L(g.enchantedLink.signIn,pe.email),{loginId:t,URI:n,loginOptions:i},{token:r})))),signUpOrIn:ye(((t,n,i)=>W(e.post(L(g.enchantedLink.signUpOrIn,pe.email),{loginId:t,URI:n,loginOptions:i})))),signUp:ye(((t,n,i,r)=>W(e.post(L(g.enchantedLink.signUp,pe.email),{loginId:t,URI:n,user:i,loginOptions:r})))),waitForSession:$e(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ue(n);let s;const a=setInterval((async()=>{const n=await e.post(g.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(W(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:be(((t,n,i,r,o)=>W(e.post(g.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),Ce=ne(oe("flowId")),ke=ne(oe("executionId"),oe("stepId"),oe("interactionId")),Se=e=>({start:Ce(((t,n,i,r,o,s,a)=>W(e.post(g.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a})))),next:ke(((t,n,i,r,o,s)=>W(e.post(g.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s}))))}),xe=oe("loginId"),Ie=ne(oe("token")),Re=ne(xe),Oe=ne(xe,ae("phone")),Ee=ne(xe,se("email")),Ne=Object.keys(pe).filter((e=>e!==he.voice)),Ae=e=>({verify:Ie((t=>W(e.post(g.magicLink.verify,{token:t})))),signIn:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r,o)=>W(e.post(L(g.magicLink.signIn,n),{loginId:t,URI:i,loginOptions:r},{token:o}))))})),{}),signUp:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r,o)=>W(e.post(L(g.magicLink.signUp,n),{loginId:t,URI:i,user:r,loginOptions:o}))))})),{}),signUpOrIn:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r)=>W(e.post(L(g.magicLink.signUpOrIn,n),{loginId:t,URI:i,loginOptions:r}))))})),{}),update:{email:Ee(((t,n,i,r,o)=>W(e.post(g.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(he).filter((e=>e!==he.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Oe(((t,i,r,o,s)=>W(e.post(L(g.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var je;!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"}(je||(je={}));const Pe=ne(oe("code")),Me=e=>({start:Object.assign(((t,n,i,r)=>W(e.post(g.oauth.start,i||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(je).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r)=>W(e.post(g.oauth.start,i||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:Pe((t=>W(e.post(g.oauth.exchange,{code:t})))),startNative:(t,n,i)=>W(e.post(g.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>W(e.post(g.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>W(e.get(g.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>W(e.post(g.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>W(e.post(g.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),Te=oe("appId"),Ue=ne(Te),_e=e=>({connect:Ue(((t,n,i)=>W(e.post(g.outbound.connect,{appId:t,options:n},{token:i}))))}),Le=oe("loginId"),We=ne(Le,oe("code")),De=ne(Le),Fe=ne(Le,ae("phone")),qe=ne(Le,se("email")),Be=e=>({verify:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:We(((t,i)=>W(e.post(L(g.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:De(((t,i,r)=>W(e.post(L(g.otp.signIn,n),{loginId:t,loginOptions:i},{token:r}))))})),{}),signUp:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:De(((t,i,r)=>W(e.post(L(g.otp.signUp,n),{loginId:t,user:i,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:De(((t,i)=>W(e.post(L(g.otp.signUpOrIn,n),{loginId:t,loginOptions:i}))))})),{}),update:{email:qe(((t,n,i,r)=>W(e.post(g.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(he).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Fe(((t,i,r,o)=>W(e.post(L(g.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Ve=ne(oe("tenant")),Ke=ne(oe("code")),He=e=>({start:Ve(((t,n,i,r,o)=>W(e.post(g.saml.start,i||{},Object.assign({queryParams:Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o})},r&&{token:r}))))),exchange:Ke((t=>W(e.post(g.saml.exchange,{code:t}))))}),Ge=oe("loginId"),ze=ne(Ge,oe("code")),Je=ne(Ge),Ze=ne(Ge),Ye=e=>({signUp:Je(((t,n)=>W(e.post(g.totp.signUp,{loginId:t,user:n})))),verify:ze(((t,n,i,r)=>W(e.post(g.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:Ze(((t,n)=>W(e.post(g.totp.update,{loginId:t},{token:n}))))}),Xe=oe("loginId"),Qe=oe("newPassword"),et=ne(Xe,oe("password")),tt=ne(Xe),nt=ne(Xe,Qe),it=ne(Xe,oe("oldPassword"),Qe),rt=e=>({signUp:et(((t,n,i,r)=>W(e.post(g.password.signUp,{loginId:t,password:n,user:i,loginOptions:r})))),signIn:et(((t,n,i)=>W(e.post(g.password.signIn,{loginId:t,password:n,loginOptions:i})))),sendReset:tt(((t,n,i)=>W(e.post(g.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:nt(((t,n,i)=>W(e.post(g.password.update,{loginId:t,newPassword:n},{token:i})))),replace:it(((t,n,i)=>W(e.post(g.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>W(e.get(g.password.policy))}),ot=ie("loginId"),st=oe("loginId"),at=oe("origin"),dt=ne(st,at,oe("name")),lt=ne(st,at),ct=ne(ot,at),ut=ne(st,at,re("token")),ht=ne(oe("transactionId"),oe("response")),ft=e=>({signUp:{start:dt(((t,n,i,r)=>W(e.post(g.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,passkeyOptions:r})))),finish:ht(((t,n)=>W(e.post(g.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:ct(((t,n,i,r,o)=>W(e.post(g.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:ht(((t,n)=>W(e.post(g.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:lt(((t,n,i)=>W(e.post(g.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:i}))))},update:{start:ut(((t,n,i,r)=>W(e.post(g.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:i})))),finish:ht(((t,n)=>W(e.post(g.webauthn.update.finish,{transactionId:t,response:n}))))}}),pt=ie("loginId"),gt=ne(pt),vt=ne(oe("pendingRef")),mt=e=>({signUpOrIn:gt(((t,n)=>W(e.post(g.notp.signUpOrIn,{loginId:t,loginOptions:n})))),signUp:gt(((t,n,i)=>W(e.post(g.notp.signUp,{loginId:t,user:n,loginOptions:i})))),signIn:gt(((t,n,i)=>W(e.post(g.notp.signIn,{loginId:t,loginOptions:n},{token:i})))),waitForSession:vt(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ue(n);let s;const a=setInterval((async()=>{const n=await e.post(g.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(W(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),yt=ne(oe("token")),$t=ne(re("token"));var bt,wt=ne([(bt=oe("projectId"),F(((e,t)=>n=>B(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),i=n.length;let r=0,o=e===Object(e)?e:void 0;for(;null!=o&&r<i;)o=o[n[r++]];return r&&r===i&&void 0!==o?o:void 0})(n,e)))("projectId",bt))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a})=>{return d=N({baseUrl:n||m,projectId:e,logger:t,hooks:i,cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:le(d),otp:Be(d),magicLink:Ae(d),enchantedLink:we(d),oauth:Me(d),outbound:_e(d),saml:He(d),totp:Ye(d),notp:mt(d),webauthn:ft(d),password:rt(d),flow:Se(d),refresh:$t(((e,t,n)=>{const i={};return n&&(i.externalToken=n),W(d.post(g.refresh,i,{token:e,queryParams:t}))})),selectTenant:ne([Z("tenantId")],[ee('"token" must be string or undefined')])(((e,t)=>W(d.post(g.selectTenant,{tenant:e},{token:t})))),logout:$t((e=>W(d.post(g.logout,{},{token:e})))),logoutAll:$t((e=>W(d.post(g.logoutAll,{},{token:e})))),me:$t((e=>W(d.get(g.me,{token:e})))),myTenants:ne([te('"tenants" must a string array or a boolean')],[ee('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,W(d.post(g.myTenants,n,{token:t}))})),history:$t((e=>W(d.get(g.history,{token:e})))),isJwtExpired:yt(M),getTenants:yt(T),getJwtPermissions:yt(U),getJwtRoles:yt(_),getCurrentTenant:yt(D),httpClient:d};var d})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const i=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==i?void 0:i.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var i;const r=[].concat((null===(i=e.hooks)||void 0===i?void 0:i.afterRequest)||[]);0!=r.length&&(await Promise.allSettled(null==r?void 0:r.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}}))})),Ct=Object.assign(wt,{DeliveryMethods:pe});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Descope={},e.React)}(this,(function(e,t){"use strict";const n=t.createContext(void 0),i=e=>(...t)=>{if(!e)throw Error("You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component");return e(...t)},r=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},o={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.14.6"},s="undefined"!=typeof window;var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function d(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function l(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))}function c(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function u(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;class h extends Error{}function f(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 p(e,t){if("string"!=typeof e)throw new h("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,i=e.split(".")[n];if("string"!=typeof i)throw new h(`Invalid token specified: missing part #${n+1}`);let r;try{r=f(i)}catch(e){throw new h(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new h(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}h.prototype.name="InvalidTokenError";var g={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"},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",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 v="<region>",m=`https://api.${v}descope.com`,y=6e5,$="dct",b=()=>{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},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};let w;const C=()=>{if(w)return w;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 w=`${t}-${n}`,w};var k;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(k||(k={}));const S=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(v,r?r+".":"");let o=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){const e=Object.keys(n);e.forEach(((t,i)=>{o=`${o}${0===i?"?":""}${t}=${encodeURIComponent(n[t])}${i===e.length-1?"":"&"}`}))}return o},x=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,i])=>(e[n]=i,e)),e),e}),{})),I={"Content-Type":"application/json"},R=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},O=e=>{const t={"x-descope-sdk-session-id":C(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.43.1"};return e&&(t["x-descope-refresh-cookie-name"]=e),t},E=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},N=({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{const d=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),i=await n.text();return n.text=()=>Promise.resolve(i),n.json=()=>Promise.resolve(JSON.parse(i)),n.clone=()=>n,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(...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=>b().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await n(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return b().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(i)),i}:n})(r,a),l=async r=>{var a;const l=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=l,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:x(R(t,g),O(i),(null==n?void 0:n.baseHeaders)||{},E(v)?I:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const y=await d(S({path:c,baseUrl:e,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==y?void 0:y.clone()),null==o?void 0:o.transformResponse){const e=await y.json(),t=((null===(a=y.headers)||void 0===a?void 0:a.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,i]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:i})}),{}),n=Object.assign(Object.assign({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}return y};return{get:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:k.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.post,token:r}),patch:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.patch,token:r}),put:(e,t,{headers:n,queryParams:i,token:r}={})=>l({path:e,headers:n,queryParams:i,body:t,method:k.put,token:r}),delete:(e,{headers:t,queryParams:n,token:i}={})=>l({path:e,headers:t,queryParams:n,body:void 0,method:k.delete,token:i}),hooks:o,buildUrl:(n,i)=>S({projectId:t,baseUrl:e,path:n,queryParams:i})}};var A=429;function j(e,t,n){var i;let r=P(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r[$])===t)return(null==r?void 0:r[n])||[];r=null===(i=null==r?void 0:r.tenants)||void 0===i?void 0:i[t]}const o=null==r?void 0:r[n];return Array.isArray(o)?o:[]}function P(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return p(e)}function M(e){const{exp:t}=P(e);return(new Date).getTime()/1e3>t}function T(e){let t=P(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function U(e,t){return j(e,t,"permissions")}function W(e,t){return j(e,t,"roles")}const L=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function _(e,t){var n;const i=await e,r={code:i.status,ok:i.ok,response:i},o=await i.clone().json();return i.ok?r.data=o:(r.error=o,i.status===A&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function D(e){var t;return(null===(t=P(e))||void 0===t?void 0:t[$])||""}const F=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),q=(e,t)=>(n=t)=>t=>{const i=e.filter((e=>e(t)));return!(i.length<e.length)&&(n?n.replace("{val}",t):i.join(" OR "))},B=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),K=e=>t=>e.test(t),V=K(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),H=K(/^\+[1-9]{1}[0-9]{3,14}$/),z=F(V,'"{val}" is not a valid email'),G=F(H,'"{val}" is not a valid phone number'),J=F((e=>e.length>=1),"Minimum length is 1");const Z=F((e=>"string"==typeof e),"Input is not a string"),Y=F((e=>Array.isArray(e)),"Input is not an array"),X=F((e=>"boolean"==typeof e),"Input is not a boolean"),Q=F((e=>void 0===e),"Input is defined"),ee=q([Z(),Q()],"Input is not a string or undefined"),te=q([Y(),X()],"Input is not an array or boolean"),ne=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>B(...e).validate(n[t]))),t(...n)),ie=e=>[Z(`"${e}" must be a string`)],re=e=>[ee(`"${e}" must be string or undefined`)],oe=e=>[Z(`"${e}" must be a string`),J(`"${e}" must not be empty`)],se=e=>[Z(`"${e}" must be a string`),z()],ae=e=>[Z(`"${e}" must be a string`),G()],de=ne(oe("accessKey")),le=e=>({exchange:de(((t,n)=>_(e.post(g.accessKey.exchange,{loginOptions:n},{token:t}))))}),ce=(e,t,n)=>(t.forEach((t=>{const i=t.split(".");let r=i.shift(),o=e;for(;i.length>0;){if(o=o[r],!r||!o)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=i.shift()}if("function"!=typeof o[r])throw Error(`"${t}" is not a function`);const s=o[r];o[r]=n(s)})),e),ue=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||y,y)});var he,fe;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(he||(he={})),function(e){e.email="email"}(fe||(fe={}));const pe=Object.assign(Object.assign({},he),fe);var ge;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(ge||(ge={}));const ve=oe("loginId"),me=ne(oe("token")),ye=ne(ve),$e=ne(oe("pendingRef")),be=ne(ve,se("email")),we=e=>({verify:me((t=>_(e.post(g.enchantedLink.verify,{token:t})))),signIn:ye(((t,n,i,r)=>_(e.post(L(g.enchantedLink.signIn,pe.email),{loginId:t,URI:n,loginOptions:i},{token:r})))),signUpOrIn:ye(((t,n,i)=>_(e.post(L(g.enchantedLink.signUpOrIn,pe.email),{loginId:t,URI:n,loginOptions:i})))),signUp:ye(((t,n,i,r)=>_(e.post(L(g.enchantedLink.signUp,pe.email),{loginId:t,URI:n,user:i,loginOptions:r})))),waitForSession:$e(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ue(n);let s;const a=setInterval((async()=>{const n=await e.post(g.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(_(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:be(((t,n,i,r,o)=>_(e.post(g.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),Ce=ne(oe("flowId")),ke=ne(oe("executionId"),oe("stepId"),oe("interactionId")),Se=e=>({start:Ce(((t,n,i,r,o,s,a)=>_(e.post(g.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a})))),next:ke(((t,n,i,r,o,s)=>_(e.post(g.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s}))))}),xe=oe("loginId"),Ie=ne(oe("token")),Re=ne(xe),Oe=ne(xe,ae("phone")),Ee=ne(xe,se("email")),Ne=Object.keys(pe).filter((e=>e!==he.voice)),Ae=e=>({verify:Ie((t=>_(e.post(g.magicLink.verify,{token:t})))),signIn:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r,o)=>_(e.post(L(g.magicLink.signIn,n),{loginId:t,URI:i,loginOptions:r},{token:o}))))})),{}),signUp:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r,o)=>_(e.post(L(g.magicLink.signUp,n),{loginId:t,URI:i,user:r,loginOptions:o}))))})),{}),signUpOrIn:Ne.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Re(((t,i,r)=>_(e.post(L(g.magicLink.signUpOrIn,n),{loginId:t,URI:i,loginOptions:r}))))})),{}),update:{email:Ee(((t,n,i,r,o)=>_(e.post(g.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(he).filter((e=>e!==he.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Oe(((t,i,r,o,s)=>_(e.post(L(g.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var je;!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"}(je||(je={}));const Pe=ne(oe("code")),Me=e=>({start:Object.assign(((t,n,i,r)=>_(e.post(g.oauth.start,i||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(je).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r)=>_(e.post(g.oauth.start,i||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:Pe((t=>_(e.post(g.oauth.exchange,{code:t})))),startNative:(t,n,i)=>_(e.post(g.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>_(e.post(g.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>_(e.get(g.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>_(e.post(g.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>_(e.post(g.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),Te=oe("appId"),Ue=ne(Te),We=e=>({connect:Ue(((t,n,i)=>_(e.post(g.outbound.connect,{appId:t,options:n},{token:i}))))}),Le=oe("loginId"),_e=ne(Le,oe("code")),De=ne(Le),Fe=ne(Le,ae("phone")),qe=ne(Le,se("email")),Be=e=>({verify:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:_e(((t,i)=>_(e.post(L(g.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:De(((t,i,r)=>_(e.post(L(g.otp.signIn,n),{loginId:t,loginOptions:i},{token:r}))))})),{}),signUp:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:De(((t,i,r)=>_(e.post(L(g.otp.signUp,n),{loginId:t,user:i,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(pe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:De(((t,i)=>_(e.post(L(g.otp.signUpOrIn,n),{loginId:t,loginOptions:i}))))})),{}),update:{email:qe(((t,n,i,r)=>_(e.post(g.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(he).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Fe(((t,i,r,o)=>_(e.post(L(g.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Ke=ne(oe("tenant")),Ve=ne(oe("code")),He=e=>({start:Ke(((t,n,i,r,o)=>_(e.post(g.saml.start,i||{},Object.assign({queryParams:Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o})},r&&{token:r}))))),exchange:Ve((t=>_(e.post(g.saml.exchange,{code:t}))))}),ze=oe("loginId"),Ge=ne(ze,oe("code")),Je=ne(ze),Ze=ne(ze),Ye=e=>({signUp:Je(((t,n)=>_(e.post(g.totp.signUp,{loginId:t,user:n})))),verify:Ge(((t,n,i,r)=>_(e.post(g.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:Ze(((t,n)=>_(e.post(g.totp.update,{loginId:t},{token:n}))))}),Xe=oe("loginId"),Qe=oe("newPassword"),et=ne(Xe,oe("password")),tt=ne(Xe),nt=ne(Xe,Qe),it=ne(Xe,oe("oldPassword"),Qe),rt=e=>({signUp:et(((t,n,i,r)=>_(e.post(g.password.signUp,{loginId:t,password:n,user:i,loginOptions:r})))),signIn:et(((t,n,i)=>_(e.post(g.password.signIn,{loginId:t,password:n,loginOptions:i})))),sendReset:tt(((t,n,i)=>_(e.post(g.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:nt(((t,n,i)=>_(e.post(g.password.update,{loginId:t,newPassword:n},{token:i})))),replace:it(((t,n,i)=>_(e.post(g.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>_(e.get(g.password.policy))}),ot=ie("loginId"),st=oe("loginId"),at=oe("origin"),dt=ne(st,at,oe("name")),lt=ne(st,at),ct=ne(ot,at),ut=ne(st,at,re("token")),ht=ne(oe("transactionId"),oe("response")),ft=e=>({signUp:{start:dt(((t,n,i,r)=>_(e.post(g.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,passkeyOptions:r})))),finish:ht(((t,n)=>_(e.post(g.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:ct(((t,n,i,r,o)=>_(e.post(g.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:ht(((t,n)=>_(e.post(g.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:lt(((t,n,i)=>_(e.post(g.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:i}))))},update:{start:ut(((t,n,i,r)=>_(e.post(g.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:i})))),finish:ht(((t,n)=>_(e.post(g.webauthn.update.finish,{transactionId:t,response:n}))))}}),pt=ie("loginId"),gt=ne(pt),vt=ne(oe("pendingRef")),mt=e=>({signUpOrIn:gt(((t,n)=>_(e.post(g.notp.signUpOrIn,{loginId:t,loginOptions:n})))),signUp:gt(((t,n,i)=>_(e.post(g.notp.signUp,{loginId:t,user:n,loginOptions:i})))),signIn:gt(((t,n,i)=>_(e.post(g.notp.signIn,{loginId:t,loginOptions:n},{token:i})))),waitForSession:vt(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ue(n);let s;const a=setInterval((async()=>{const n=await e.post(g.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(_(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),yt=ne(oe("token")),$t=ne(re("token"));var bt,wt=ne([(bt=oe("projectId"),F(((e,t)=>n=>B(...t).validate(((e,t)=>{const n=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),i=n.length;let r=0,o=e===Object(e)?e:void 0;for(;null!=o&&r<i;)o=o[n[r++]];return r&&r===i&&void 0!==o?o:void 0})(n,e)))("projectId",bt))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a})=>{return d=N({baseUrl:n||m,projectId:e,logger:t,hooks:i,cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:le(d),otp:Be(d),magicLink:Ae(d),enchantedLink:we(d),oauth:Me(d),outbound:We(d),saml:He(d),totp:Ye(d),notp:mt(d),webauthn:ft(d),password:rt(d),flow:Se(d),refresh:$t(((e,t,n)=>{const i={};return n&&(i.externalToken=n),_(d.post(g.refresh,i,{token:e,queryParams:t}))})),selectTenant:ne([Z("tenantId")],[ee('"token" must be string or undefined')])(((e,t)=>_(d.post(g.selectTenant,{tenant:e},{token:t})))),logout:$t((e=>_(d.post(g.logout,{},{token:e})))),logoutAll:$t((e=>_(d.post(g.logoutAll,{},{token:e})))),me:$t((e=>_(d.get(g.me,{token:e})))),myTenants:ne([te('"tenants" must a string array or a boolean')],[ee('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,_(d.post(g.myTenants,n,{token:t}))})),history:$t((e=>_(d.get(g.history,{token:e})))),isJwtExpired:yt(M),getTenants:yt(T),getJwtPermissions:yt(U),getJwtRoles:yt(W),getCurrentTenant:yt(D),httpClient:d};var d})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const i=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==i?void 0:i.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var i;const r=[].concat((null===(i=e.hooks)||void 0===i?void 0:i.afterRequest)||[]);0!=r.length&&(await Promise.allSettled(null==r?void 0:r.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}}))})),Ct=Object.assign(wt,{DeliveryMethods:pe});
|
|
2
2
|
/*! js-cookie v3.0.5 | MIT */
|
|
3
|
-
function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var St=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=kt({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in r)r[s]&&(o+="; "+s,!0!==r[s]&&(o+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r<n.length;r++){var o=n[r].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(i[a]=t.read(s,a),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",kt({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,kt({},this.attributes,t))},withConverter:function(t){return e(kt({},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 xt={default:"endpoint"},It="Blocked by CSP",Rt="The endpoint parameter is not a valid URL",Ot="Failed to load the JS script of the agent",Et="9319";function Nt(e,t){var n,i,r,o,s,a=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||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,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,o++))},r=new Set,[n.current(),function(e,t){var o,s=t instanceof Error?t.message:"";if(s===It||s===Rt)n.exclude(),o=0;else if(s===Et)n.exclude();else if(s===Ot){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.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()+i()-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,i=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return i()}),i),r.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=c(n,e);if(!t)throw s;var i,r=t[0],o=t[1];return(i=o,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return u(r)}))}))};return u(l).then((function(e){return[e,a]}))}var At="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",jt=At;function Pt(e){var t;e.scriptUrlPattern;var n=e.token,i=e.apiKey,r=void 0===i?n:i,o=d(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:At,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,i){return e.addEventListener(t,n,i),function(){return e.removeEventListener(t,n,i)}}(document,"visibilitychange",t);return t(),[e,n]}(),c=l[0],u=l[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)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)}))}(s,r);return Nt(e,Mt)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Et?new Error(Ot):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(a(a({},o),{ldi:{attempts:n,visibilityStates:c}}))}))}function Mt(e){return function(e,t,n){var i,r=document,o="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),r=t.blockedURI;r!==n.href&&r!==n.protocol.slice(0,-1)&&r!==n.origin||(i=t,a())};r.addEventListener(o,s);var a=function(){return r.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(),i)return n(i);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(Rt);var i=document.createElement("script"),r=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},o=document.head||document.getElementsByTagName("head")[0];i.onload=function(){r(),t()},i.onerror=function(){r(),n(new Error(Ot))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(It)})).then(Tt)}function Tt(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==i?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(Et);return n}const Ut=e=>{try{return p(e).exp}catch(e){return null}},_t=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Ut(n)},Lt=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Ut(i):void 0)},Wt=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,i)=>{var r;return n[i]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[i])||[]).concat((null==t?void 0:t[i])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Dt=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(e=>{const{access_token:t,id_token:n,refresh_token:i,refresh_expire_in:r}=e,o=d(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||i,sessionExpiration:e.sessionExpiration||Lt(e),cookieExpiration:e.cookieExpiration||_t(e)},o)})((null==t?void 0:t.authInfo)||t||{})},Ft=async e=>{const t=await Dt(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},qt="undefined"!=typeof localStorage,Bt=(e,t)=>qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Vt=e=>qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Kt=e=>qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Ht=(...e)=>{console.debug(...e)},Gt="3.2.0",zt="undefined"!=typeof window,Jt=Math.pow(2,31)-1,Zt=`https://descopecdn.com/npm/oidc-client-ts@${Gt}/dist/browser/oidc-client-ts.min.js`,Yt=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Gt}/dist/browser/oidc-client-ts.min.js`,Xt="DS",Qt="DSR",en="DSI";function tn(e=""){return Vt(`${e}${Qt}`)||""}function nn(e=""){return St.get(Xt)||Vt(`${e}${Xt}`)||""}function rn(e=""){return Vt(`${e}${en}`)||""}function on(e=""){Kt(`${e}${Qt}`),Kt(`${e}${Xt}`),Kt(`${e}${en}`),St.remove(Xt)}const sn=zt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",an="vsid",dn="vrid",ln="fp",cn=(e=!1)=>{const t=localStorage.getItem(ln);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},un=async(e,t=sn)=>{try{if(cn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),i=new URL(t);i.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const o=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Pt({apiKey:e,endpoint:[i.toString(),xt],scriptUrlPattern:[o,jt]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[an]:e,[dn]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(ln,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},hn=e=>{const t=cn(!0);return t&&e.body&&(e.body.fpData=t),e},fn="dls_last_user_login_id",pn="dls_last_user_display_name",gn=()=>Vt(fn),vn=()=>Vt(pn),mn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=gn(),o=vn();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)};function yn(){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 $n(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=xn(n.publicKey.challenge),n.publicKey.user.id=xn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=xn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:In(n.rawId),type:n.type,response:{attestationObject:In(n.response.attestationObject),clientDataJSON:In(n.response.clientDataJSON)}});var n}async function bn(e){const t=kn(e);return Sn(await navigator.credentials.get(t))}async function wn(e,t){const n=kn(e);return n.signal=t.signal,n.mediation="conditional",Sn(await navigator.credentials.get(n))}async function Cn(e=!1){if(!zt)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function kn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=xn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=xn(e.id)})),n}function Sn(e){return JSON.stringify({id:e.id,rawId:In(e.rawId),type:e.type,response:{authenticatorData:In(e.response.authenticatorData),clientDataJSON:In(e.response.clientDataJSON),signature:In(e.response.signature),userHandle:e.response.userHandle?In(e.response.userHandle):void 0}})}function xn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function In(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Rn,On=(Rn=e=>({async signUp(t,n,i){const r=await e.webauthn.signUp.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await $n(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,o)},async signIn(t,n){const i=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!i.ok)return i;const r=await bn(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,r)},async signUpOrIn(t,n){var i;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(null===(i=r.data)||void 0===i?void 0:i.create){const t=await $n(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await bn(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,t)}},async update(t,n,i){const r=await e.webauthn.update.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await $n(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:$n,get:bn,isSupported:Cn,conditional:wn}}),(...e)=>{const t=Rn(...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 En="/fedcm/config";async function Nn(e,t){var n,i,r;try{const r=await async function(e,t="google",n,i,r){const o=(()=>{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)})(),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(r&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);return null==r||r(n),void c()}if(i&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);return null==i||i(t),void c()}}))}))}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(null==t?void 0:t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,null==t?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);null===(n=null==t?void 0:t.onCodeReceived)||void 0===n||n.call(t,i.data.code)}else{const n=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,null==t?void 0:t.loginOptions);if(!n.ok||!n.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);null===(i=null==t?void 0:t.onAuthenticated)||void 0===i||i.call(t,n.data)}}catch(e){null===(r=null==t?void 0:t.onFailed)||void 0===r||r.call(t,e)}}var An=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Cn(),i=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=i,e.flow.start(...t)}});let jn;const Pn=(e,t)=>new Promise(((n,i)=>{if(!e.length)return i(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);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",(()=>{Pn(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),Mn=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{jn||(jn=(async()=>{try{return require("oidc-client-ts")}catch(e){return Pn([Zt,Yt],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await jn;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=t,s=(null==n?void 0:n.redirectUri)||window.location.href,a=(null==n?void 0:n.scope)||"openid email roles descope.custom_claims offline_access",d=`${o}_user`;let l=e.httpClient.buildUrl(t);(null==n?void 0:n.applicationId)&&(l=`${l}/${n.applicationId}`);const c={authority:l,client_id:t,redirect_uri:s,response_type:"code",scope:a,stateStore:new r({store:window.localStorage,prefix:o}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),(null==n?void 0:n.scope)&&(c.scope=n.scope),{client:new i(c),stateUserKey:d}})(e,t,n)),{client:i,stateUserKey:r}},r=async(t="")=>{var n;const{client:r,stateUserKey:o}=await i(),s=await r.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)))),window.localStorage.setItem(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(e={},t=!1)=>{const{client:n}=await i(),r=await n.createSigninRequest(e),{url:o}=r;return t||(window.location.href=o),{ok:!0,data:r}},finishLogin:r,finishLoginIfNeed:async(e="")=>{if(window.location.search.includes("code")&&window.location.search.includes("state"))return await r(e)},refreshToken:async t=>{var n;const{client:r,stateUserKey:o}=await i(),s=(e=>{const t=window.localStorage.getItem(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 r.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:r}=await i();e||(e={}),e.id_token_hint=e.id_token_hint||rn(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return window.localStorage.removeItem(r),t||window.location.replace(s),o}}},Tn=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:i}=t,r=d(t,["fpKey","fpLoad"]);return zt?(n&&i&&un(n).catch((()=>null)),e(Wt(r,{beforeRequest:hn}))):e(r)}),(e=>t=>{var{autoRefresh:n}=t,i=d(t,["autoRefresh"]);if(!n||"undefined"!=typeof window&&window.descopeBridge)return e(i);const{clearAllTimers:r,setTimer:o}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;zt&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&s&&new Date>s&&(Ht("Expiration time passed, refreshing session"),l.refresh(tn()||a))}));const l=e(Wt(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:d}=await Dt(t);if(401===(null==t?void 0:t.status))Ht("Received 401, canceling all timers"),r();else if(n||d){if(s=((e,t)=>{if(t)return new Date(1e3*t);Ht("Could not extract expiration time from session token, trying to decode the token");try{const t=p(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,d),!s)return void Ht("Could not extract expiration time from session token");a=i;const e=(e=>{let t=((n=e)?n.getTime()-(new Date).getTime():0)-2e4;var n;return t>Jt&&(Ht(`Timeout is too large (${t}ms), setting it to ${Jt}ms`),t=Jt),t})(s);if(r(),e<=2e4)return void Ht("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Ht(`Setting refresh timer for ${t}. (${e}ms)`),o((()=>{Ht("Refreshing session due to timer"),l.refresh(tn()||i)}),e)}}}));return ce(l,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return Ht("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.31.3"},t.baseHeaders)}))),(e=>t=>{const n=yn(),i=yn(),r=yn(),o=e(Wt(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))i.pub(null),r.pub(null),n.pub(null);else{const e=await Ft(t);e&&r.pub(e);const{sessionJwt:o,sessionExpiration:s}=await Dt(t);o&&i.pub(o),(s||o)&&n.pub(s||42)}}})),s=ce(o,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const o=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o}));return Object.assign(s,{onSessionTokenChange:i.sub,onUserChange:r.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=t,r=d(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:gn,getLastUserDisplayName:vn});const o=e(Wt(r,{afterRequest:async(e,t)=>{var n;const i=await Ft(t),r=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],o=null==i?void 0:i.name;r&&((e=>{Bt(fn,e)})(r),(e=>{Bt(pn,e)})(o))}}));let s=ce(o,["flow.start"],mn);return s=ce(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(Kt(fn),Kt(pn)),i})(i)),Object.assign(s,{getLastUserLoginId:gn,getLastUserDisplayName:vn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:i,storagePrefix:r}=t,o=d(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!zt)return e(o);const s=e(Wt(o,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||tn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||on(r):((e={},t=!1,n="")=>{var i;const{sessionJwt:r,refreshJwt:o}=e;if(o&&Bt(`${n}${Qt}`,o),r)if(t){const n=t.sameSite||"Strict",o=null===(i=t.secure)||void 0===i||i;!function(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(i);St.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}(Xt,r,Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:o}))}else Bt(`${n}${Xt}`,r);e.idToken&&Bt(`${n}${en}`,e.idToken)})(await Dt(t),i,r)}}));var a;const l=ce(s,["logout","logoutAll","oidc.logout"],(e=>t=>async(...n)=>{const i=await t(...n);return on(e),i})(r));return Object.assign(l,{getRefreshToken:()=>tn(r),getSessionToken:()=>nn(r),getIdToken:()=>rn(r)})}))((e=>{const t=Ct(e),n=Mn(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async i=>{var r;if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}const o=nn(),s=tn();let a="";if(e.getExternalToken)try{a=await(null===(r=e.getExternalToken)||void 0===r?void 0:r.call(e))}catch(e){Ht("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:o?"t":"f",dcr:s?"t":"f"},a)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:e.toString()}})}return t.logout(i)},flow:An(t),webauthn:On(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){Nn(i,e)},requestAuthentication(e){Nn(i,e)}},oneTap(e,t,n,r,o){Nn(i,{provider:e,oneTapConfig:t,loginOptions:n,onSkipped:r,onDismissed:o})},async launch(e){var t;const n={identity:{context:e||"signin",providers:[{configURL:i.httpClient.buildUrl(r+En),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>zt&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+En);try{const i={identity:{context:e||"signin",providers:[{configURL:n,clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(i));return!!o&&!!o.token}catch(e){return!1}}}),oidc:n});var i,r}));let Un;const _n=e=>{const t=Tn(Object.assign({persistTokens:s,autoRefresh:s},e));return Un=t,t},Ln=()=>_n({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});Un=Ln();const Wn=()=>s?null==Un?void 0:Un.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),Dn=()=>s?null==Un?void 0:Un.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),Fn=r(((e=Wn(),t)=>null==Un?void 0:Un.getJwtPermissions(e,t))),qn=r(((e=Wn(),t)=>null==Un?void 0:Un.getJwtRoles(e,t))),Bn=r(((e=Wn())=>null==Un?void 0:Un.getCurrentTenant(e)));function Vn(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Kn=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Hn=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Gn=e=>{let t,n;return(...i)=>(t&&Hn(t,i)||(t=i,n=e(...i)),n)},zn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Jn=e=>(t,...n)=>t.reduce(((t,i,r)=>{var o;return`${t}${i}${(null===(o=null==n?void 0:n[r])||void 0===o?void 0:o[e>1?1:0])||""}`}),""),Zn=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},Yn=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 i=e(n);return i[t]=!0,i}};var Xn,Qn,ei,ti;function ni(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i+=1){const r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!ni(o,s))return!1}else if(o!==s)return!1}return!0}let ii=class{constructor(e={},{forceUpdate:t=!1}={}){Xn.set(this,void 0),Qn.set(this,{}),ei.set(this,0),ti.set(this,!0),this.update=e=>{const t="function"==typeof e?e(c(this,Xn,"f")):e,n=Object.assign(Object.assign({},c(this,Xn,"f")),t);if(c(this,ti,"f")||!ni(c(this,Xn,"f"),n)){const e=c(this,Xn,"f");u(this,Xn,n,"f"),Object.freeze(c(this,Xn,"f")),setTimeout((()=>{Object.values(c(this,Qn,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},u(this,Xn,e,"f"),u(this,ti,t,"f")}get current(){return Object.assign({},c(this,Xn,"f"))}subscribe(e){return u(this,ei,c(this,ei,"f")+1,"f"),c(this,Qn,"f")[c(this,ei,"f")]=e,c(this,ei,"f").toString()}unsubscribe(e){const t=!!c(this,Qn,"f")[e];return t&&delete c(this,Qn,"f")[e],t}unsubscribeAll(){return u(this,Qn,{},"f"),!0}};Xn=new WeakMap,Qn=new WeakMap,ei=new WeakMap,ti=new WeakMap;const ri=e=>"string"==typeof e||null==e?e:JSON.stringify(e),oi=e=>t.forwardRef(((n,i)=>{const{prop:r,attr:o,rest:s}=t.useMemo((()=>Object.entries(n).reduce(((e,[t,n])=>{const{trimmedKey:i,category:r}=(e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}})(t);return"prop"===r?e.prop.push([i,n]):"attr"===r?e.attr.push([zn(i),ri(n)]):Object.assign(e.rest,{[zn(i)]:n}),e}),{attr:[],prop:[],rest:{}})),[n]),a=t.useRef(null),d=t.useCallback((e=>{a.current=e,e&&(r.forEach((([e,t])=>{a.current[e]=t})),o.forEach((([t,n])=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)})))}),[r,o,a]);return t.useImperativeHandle(i,(()=>a.current)),t.createElement(e,Object.assign({ref:d},s))})),si=t.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await Promise.resolve().then((function(){return bs})).then((e=>e.default))).sdkConfigOverrides={baseHeaders:o,persistTokens:!1,hooks:{get beforeRequest(){return Un.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-wc",Object.assign({ref:n},e)))))}))),ai=t.forwardRef((({flowId:e,onSuccess:i,onError:r,onReady:o,logger:s,tenant:a,theme:d,nonce:l,locale:c,debug:u,client:h,form:f,telemetryKey:p,redirectUrl:g,autoFocus:v,validateOnBlur:m,restartOnError:y,errorTransformer:$,styleId:b,onScreenUpdate:w,dismissScreenErrorOnInput:C,outboundAppId:k,outboundAppScopes:S,children:x},I)=>{const[R,O]=t.useState(null);t.useImperativeHandle(I,(()=>R));const{projectId:E,baseUrl:N,baseStaticUrl:A,baseCdnUrl:j,storeLastAuthenticatedUser:P,keepLastAuthenticatedUserAfterLogout:M,refreshCookieName:T,sdk:U}=t.useContext(n),_=t.useCallback((async e=>{await U.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),i&&i(e)}),[i]);return t.useEffect((()=>{const e=R;return null==e||e.addEventListener("success",_),r&&(null==e||e.addEventListener("error",r)),o&&(null==e||e.addEventListener("ready",o)),()=>{r&&(null==e||e.removeEventListener("error",r)),o&&(null==e||e.removeEventListener("ready",o)),null==e||e.removeEventListener("success",_)}}),[R,r,_]),t.useEffect((()=>{const e=R;return null==e||e.addEventListener("success",_),()=>{null==e||e.removeEventListener("success",_)}}),[R,_]),t.useEffect((()=>{const e=R;return r&&(null==e||e.addEventListener("error",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[R,r]),t.useEffect((()=>{const e=R;return o&&(null==e||e.addEventListener("ready",o)),()=>{o&&(null==e||e.removeEventListener("error",o))}}),[R,o]),t.createElement("form",null,t.createElement(t.Suspense,{fallback:null},t.createElement(si,{projectId:E,flowId:e,baseUrl:N,baseStaticUrl:A,baseCdnUrl:j,ref:O,telemetryKey:p,redirectUrl:g,autoFocus:v,styleId:b,validateOnBlur:m,restartOnError:y,keepLastAuthenticatedUserAfterLogout:M,tenant:a,"theme.attr":d,"nonce.attr":l,"locale.attr":c,"form.attr":f,"client.attr":h,"debug.attr":u,"outbound-app-id.attr":k,"outbound-app-scopes.attr":S,"store-last-authenticated-user.attr":P,"refreshCookieName.attr":T,"dismiss-screen-error-on-input.attr":C,"errorTransformer.prop":$,"logger.prop":s,"onScreenUpdate.prop":w},x)))}));var di=()=>{const e=t.useContext(n);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const li=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,ci={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],ci);if("function"==typeof e[t])return()=>{throw Error(li("function"))};throw Error(li("attribute"))}},ui=t.lazy((async()=>(await Promise.resolve().then((function(){return Bp})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-user-management-widget",Object.assign({ref:n},e)))))}))),hi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(ui,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,ref:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),fi=t.lazy((async()=>(await Promise.resolve().then((function(){return Fg})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-role-management-widget",Object.assign({ref:n},e)))))}))),pi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(fi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),gi=t.lazy((async()=>(await Promise.resolve().then((function(){return Kv})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-access-key-management-widget",Object.assign({ref:n},e)))))}))),vi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(gi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),mi=t.lazy((async()=>(await Promise.resolve().then((function(){return um})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-audit-management-widget",Object.assign({ref:n},e)))))}))),yi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(mi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),$i=t.lazy((async()=>(await Promise.resolve().then((function(){return ey})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-user-profile-widget",Object.assign({ref:n},e)))))}))),bi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,onLogout:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g,setSession:v,setUser:m,setIsAuthenticated:y}=t.useContext(n),$=t.useCallback((e=>{s&&s(e),y(!1),v(""),m(null)}),[s,v,y,m]);return t.useEffect((()=>{if(l)return l.addEventListener("logout",$),()=>l.removeEventListener("logout",$)}),[l,$]),t.createElement(t.Suspense,{fallback:null},t.createElement($i,{projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,styleId:a,ref:c,"theme.attr":i,"debug.attr":r,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),wi=t.lazy((async()=>(await Promise.resolve().then((function(){return my})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-applications-portal-widget",Object.assign({ref:n},e)))))}))),Ci=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:f,refreshCookieName:p}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(wi,{projectId:c,widgetId:o,baseUrl:u,baseStaticUrl:h,baseCdnUrl:f,innerRef:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),ki="undefined"!=typeof localStorage,Si="J151000",xi=ki&&localStorage.getItem("base.content.url")||"",Ii="base.ui.components.url";ki&&localStorage.getItem(Ii),ki&&localStorage.getItem(Ii);const Ri="descope-login-flow",Oi="code",Ei="data-exclude-field",Ni="data-exclude-next",Ai="dls_last_auth",ji="state_id",Pi="saml_idp_state_id",Mi="saml_idp_username",Ti="descope_idp_initiated",Ui="sso_app_id",_i="third_party_app_id",Li="third_party_app_state_id",Wi="oidc_login_hint",Di="oidc_prompt",Fi="oidc_error_redirect_uri",qi="application_scopes",Bi="data-type",Vi="redirect",Ki="poll",Hi="webauthnCreate",Gi="webauthnGet",zi="nativeBridge",Ji="loadForm",Zi="submit",Yi="polling",Xi=["descope-multi-select-combo-box","descope-text-area"],Qi=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var er;!function(e){e.backward="backward",e.forward="forward"}(er||(er={}));const tr=["descope-enriched-text"];function nr(e){return new URLSearchParams(window.location.search).get(e)}function ir(e){if(window.history.replaceState&&nr(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 rr(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?er.forward:n<i?er.backward:void 0}const or=e=>{let[t="",n=""]=(nr(Ri)||"").split("_");const i=(e=>{var t;return(null===(t=/(.*)\|#\|.*/.exec(e))||void 0===t?void 0:t[1])||""})(t);return(!e||i&&i!==e)&&(t="",n=""),{executionId:t,stepId:n,executionFlowId:i}};function sr(){ir(Ri)}const ar=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),dr=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=or(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&sr();const o=nr("t")||void 0;o&&ir("t");const s=nr(Oi)||void 0;s&&ir(Oi);const a=nr("err")||void 0;a&&ir("err");const{redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u}={redirectAuthCodeChallenge:nr("ra-challenge"),redirectAuthCallbackUrl:nr("ra-callback"),redirectAuthBackupCallbackUri:nr("ra-backup-callback"),redirectAuthInitiator:nr("ra-initiator")},h=nr(ji);h&&ir(ji);const f=nr(Pi);f&&ir(Pi);const p=nr(Mi);f&&ir(Mi);const g=nr(Ti);g&&ir(Ti);const v=nr(Ui);v&&ir(Ui);const m=nr(_i);m&&ir(_i);const y=nr(Li);y&&ir(Li);const $=nr(qi);$&&ir(qi);const b=nr(Wi);b&&ir(Wi);const w=nr(Di);w&&ir(Di);const C=nr(Fi);return C&&ir(Fi),{executionId:n,stepId:i,token:o,code:s,exchangeError:a,redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u,ssoQueryParams:{oidcIdpStateId:h,samlIdpStateId:f,samlIdpUsername:p,descopeIdpInitiated:"true"===g,ssoAppId:v,oidcLoginHint:b,oidcPrompt:w,oidcErrorRedirectUri:C,thirdPartyAppId:m,thirdPartyAppStateId:y,applicationScopes:$}}},lr=e=>{let t,n;return Object.assign(((...i)=>{return t&&(o=i,(r=t).length===o.length&&r.every(((e,t)=>e===o[t])))||(t=i,n=e(...i)),n;var r,o}),{reset:()=>{t=void 0,n=void 0}})},cr=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}};function ur(e,t,n){return new Promise(((i,r)=>{let o=!1;const s=setTimeout((()=>{o=!0,void 0!==n?i(n):r(new Error(`Promise timed out after ${e} ms`))}),e);t.then((e=>{o||(clearTimeout(s),i(e))})).catch((e=>{o||(clearTimeout(s),r(e))}))}))}const hr=(e,{oidcIdpStateId:t,samlIdpStateId:n,samlIdpUsername:i,ssoAppId:r,oidcLoginHint:o,oidcPrompt:s,oidcErrorRedirectUri:a,thirdPartyAppId:d,thirdPartyAppStateId:l,applicationScopes:c})=>!(!e||t||n||i||r||o||s||a||d||l||c),fr=e=>null==e?void 0:e.submit(),pr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},gr=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function vr(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:""}}var mr,yr,$r,br;function wr(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i+=1){const r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!wr(o,s))return!1}else if(o!==s)return!1}return!0}let Cr=class{constructor(e={},{forceUpdate:t=!1}={}){mr.set(this,void 0),yr.set(this,{}),$r.set(this,0),br.set(this,!0),this.update=e=>{const t="function"==typeof e?e(c(this,mr,"f")):e,n=Object.assign(Object.assign({},c(this,mr,"f")),t),i=c(this,mr,"f");u(this,mr,n,"f"),Object.freeze(c(this,mr,"f")),setTimeout((()=>{Object.values(c(this,yr,"f")).forEach((({cb:e,selector:t,forceUpdate:r})=>{const o=t(i),s=t(n);(c(this,br,"f")||r||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(s)?!wr(o,s):o!==s))&&e(s,o,((e,t)=>n=>e[n]!==t[n])(s,o))}))}),0)},u(this,mr,e,"f"),u(this,br,t,"f")}get current(){return Object.assign({},c(this,mr,"f"))}set forceUpdate(e){u(this,br,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return u(this,$r,c(this,$r,"f")+1,"f"),c(this,yr,"f")[c(this,$r,"f")]={cb:e,selector:t,forceUpdate:n},c(this,$r,"f").toString()}unsubscribe(e){const t=!!c(this,yr,"f")[e];return t&&delete c(this,yr,"f")[e],t}unsubscribeAll(){return u(this,yr,{},"f"),!0}};mr=new WeakMap,yr=new WeakMap,$r=new WeakMap,br=new WeakMap;const kr=["*","#","/","(",")","[","]","_","<",">","`"],Sr=e=>"string"!=typeof e?e:e.replace((e=>{const t=kr.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),xr=["disabled"],Ir=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Ei}])`)).forEach((e=>{e.value=n}))}))},Rr=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),Or=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?Sr(Rr(t,i)):Rr(t,i))),Er=(e,t,n)=>{e.querySelectorAll(`[${Bi}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Nr=(e,t,n)=>{var i,r;const o=null===(i=customElements.get(t))||void 0===i?void 0:i.cssVarList.url;n&&o&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(o,`url(data:image/jpg;base64,${n})`))},Ar=(e,t,n,i,r)=>{var o,s;Er(e,"totp-link",null===(o=null==t?void 0:t.totp)||void 0===o?void 0:o.provisionUrl),Er(e,"notp-link",null===(s=null==t?void 0:t.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=>tr.includes(e))(e.localName);e.textContent=Or(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",Or(i,t))}))})(e,t),((e,t,n)=>{if(!t)return;const{componentsDynamicAttrs:i}=t,r=d(t,["componentsDynamicAttrs"]),o=Object.keys(r).reduce(((e,t)=>(e[`[name=${t}]`]=r[t],e)),{});i&&Object.keys(i).forEach((e=>{const t=i[e];if(t){const{attributes:n}=t;n&&Object.keys(n).length&&(o[e]=n)}})),Object.keys(o).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const i=o[t];Object.keys(i).forEach((t=>{let r=i[t];if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){n.error(`Could not stringify value "${r}" for "${t}"`,e.message),r=""}e.setAttribute(t,r)}))}))}))})(e,n,r),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Or(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{xr.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,i)},jr=lr((()=>l(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)))),i=(()=>{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 ur(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}})))),Pr="dls_ab_testing_id",Mr={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.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,i]=t?t.split(",").map(Number):[void 0,void 0];return(e.abTestingKey||0)>=(null!=n?n:0)&&(e.abTestingKey||0)<=(null!=i?i:0)},"not-in-range":(e,t)=>{const[n,i]=t?t.split(",").map(Number):[void 0,void 0];return!(void 0!==n&&void 0!==i&&!Number.isNaN(n)&&!Number.isNaN(i))||(e.abTestingKey||0)<n||(e.abTestingKey||0)>i},"devised-by":(e,t)=>{const n=Number(t);return!Number.isNaN(n)&&(e.abTestingKey||0)%n==0}}};function Tr(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Ai)))}catch(e){}return t}const Ur=["error","warn","info","debug"],_r=Yn((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,c(this,t,"m",i).call(this,console))}set logger(e){u(this,n,c(this,t,"m",i).call(this,e||console),"f")}get logger(){return c(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return Ur.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},r})),Lr="undefined"!=typeof localStorage,Wr=Lr&&localStorage.getItem("base.content.url")||"",Dr=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Fr=Yn((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)&&c(this,t,"f")&&(u(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),qr=Yn((e=>{var t,n;const i=Vn(_r,Fr)(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=c(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){c(this,t,"f")[e]||(c(this,t,"f")[e]=[]);const i=c(this,t,"f")[e].push(n);return()=>c(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})),Br=e=>t=>{var n,i,r;const o=Vn(_r,Fr,qr)(t),s=Object.keys(e);return r=class extends o{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,c(this,n,"m",i).bind(this))}async init(){var e;s.forEach((e=>c(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 i=e[t],r="function"==typeof i?i(t,n):i;r&&this.logger.error(r)},r};Br.missingAttrValidator=Dr;const Vr=Yn((e=>{const t=Vn(Br({"project-id":Dr}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Kr=Yn((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),Hr="Trying the next fallback URL...",Gr=async(e,t,{logger:n}={})=>{try{return await fetch(e,t)}catch(i){return null==n||n.debug(`Network error fetching URL ${e} [${i.message}], retrying...`),fetch(e,t)}};function zr({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i="https://static.descope.com/pages"}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}const Jr=Yn((e=>{var t,n,i,r,o;const s=Vn(_r,Vr,Kr)(e);return o=class extends s{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}async fetchStaticResource(e,n){const o=c(this,t,"m",r).call(this,e),s=Array.isArray(o)?e=>{if(e!==o.length-1){const{baseUrl:t}=o[e];u(this,i,t,"f")}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:i}={})=>{const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=r[e],s=e===r.length-1;try{const r=await Gr(o.toString(),t,{logger:n});if(r.ok)return null==i||i(e),null==n||n.debug(`Successfully fetched URL ${o}`),r;const a=`Error fetching URL ${o} [${r.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${Hr}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${Hr}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:s});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,i=new WeakMap,t=new WeakSet,r=function(e){const t=Wr||this.baseStaticUrl;if(t)return zr({projectId:this.projectId,filename:e,baseUrl:t});const r=c(this,n,"f")!==this.baseUrl,o=r&&!!this.baseUrl;r&&(u(this,n,this.baseUrl,"f"),u(this,i,void 0,"f"));const s=zr({projectId:this.projectId,filename:e,baseUrl:c(this,i,"f")});if(!o)return s;return[zr({projectId:this.projectId,filename:e,baseUrl:this.baseUrl+"/pages"}),s]},o})),Zr=Yn((e=>{var t,n;const i=Vn(Br({"project-id":Dr}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(c(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return c(this,t,"f").set(e,n),()=>{c(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(c(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!c(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=c(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),Yr=Yn((e=>{var t,n,i,r,o;const s=Vn(Jr,Zr,Fr)(e);return o=class extends s{constructor(){super(...arguments),t.add(this),i.set(this,void 0),r.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",c(this,t,"m",n).bind(this))}get config(){return c(this,i,"f")||u(this,i,c(this,r,"f").call(this),"f"),c(this,i,"f")}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){u(this,i,void 0,"f")},o})),Xr="load-descope-ui",Qr="base.ui.components.url",eo=Lr&&localStorage.getItem(Qr)||"https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",to=Lr&&localStorage.getItem(Qr)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",no=Lr&&localStorage.getItem(Qr)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",io=e=>{const t=document.createElement("script");return t.id=e,t},ro=(e,t)=>e.replace("<version>",t),oo=Yn((e=>{var t,n,i,r,o,s,a,d,l,h,f,p;const g=Vn(_r,Yr)(e);return p=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),i.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return c(this,l,"f")||u(this,l,c(this,t,"m",f).call(this),"f"),c(this,l,"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=>c(this,t,"m",h).call(this,e))))}get baseCdnUrl(){return this.getAttribute("base-cdn-url")}},n=new WeakMap,i=new WeakMap,l=new WeakMap,t=new WeakSet,r=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},o=function(e){const t=c(this,n,"f"),r=c(this,i,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n,i,o){this.logger.debug("Trying to load DescopeUI from a fallback URL");const s=io(i);document.body.append(s),s.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${s.src}"`)))})),s.addEventListener("load",(()=>{n.forEach((e=>e()))})),s.src=ro(o,await c(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[c(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),c(this,t,"m",s).call(this,[c(this,t,"m",s).bind(this,e[c(this,n,"f")],e[c(this,i,"f")],"load-descope-ui-fallback-script-2",no),...e[c(this,n,"f")]],e[c(this,i,"f")],"load-descope-ui-fallback-script",to)})),e.addEventListener("load",(()=>{e[c(this,i,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Xr}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=io(Xr);document.body.append(e),c(this,t,"m",o).call(this,e),c(this,t,"m",a).call(this,e),e.src=ro(this.baseCdnUrl||eo,await c(this,t,"m",r).call(this))}return document.getElementById(Xr)},h=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(", ")}"`)},f=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),c(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},p})),so="content-root",ao="root",lo=Yn((e=>class extends e{constructor(...e){var t,n,i,r;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${ao}">\n <div id="${so}"></div>\n </div>\n `;const o=new CSSStyleSheet;o.replaceSync(`\n #${ao}, #${so} {\n height: 100%;\n }\n #${ao} {\n position: relative;\n height: fit-content;\n }\n `),null!==(t=(r=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(r.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,o],this.contentRootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(so),this.rootElement=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById(ao)}})),co=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',uo=Yn((e=>{var t,n,i,r,o,s,a,d,l,h,f,p,g,v;const m=Vn(Br({theme:co}),Jr,Fr,oo,Yr,lo,qr)(e);return v=class extends m{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),f.set(this,(()=>{c(this,t,"m",p).call(this),c(this,g,"f").call(this,"os"===this.getAttribute("theme"))})),g.set(this,(e=>{var n,i,r;const o=e?"addEventListener":"removeEventListener";null===(r=null===(i=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===i?void 0:i[o])||void 0===r||r.call(i,"change",(()=>c(this,t,"m",p).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")||"theme"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),c(this,t,"m",s).call(this),c(this,t,"m",a).call(this),c(this,f,"f").call(this),this.observeAttributes(["theme"],c(this,f,"f")),this.observeAttributes(["style-id"],(()=>{u(this,i,null,"f"),c(this,t,"m",l).call(this),c(this,t,"m",s).call(this),c(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,r=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Qr)))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(Qr),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")}},o=function(){return c(this,i,"f")||(u(this,i,c(this,t,"m",r).call(this),"f"),c(this,i,"f").then((e=>this.logger.debug("Fetched theme",e)))),c(this,i,"f")},s=async function(){var e,i,r,s;const a=await c(this,t,"a",o);a&&(c(this,n,"f")||(u(this,n,new CSSStyleSheet,"f"),null!==(e=(s=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(s.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,c(this,n,"f")]),c(this,n,"f").replaceSync(((null===(i=null==a?void 0:a.light)||void 0===i?void 0:i.globals)||"")+((null===(r=null==a?void 0:a.dark)||void 0===r?void 0:r.globals)||"")))},a=async function(){var e,n;const i=Object.assign({},await c(this,t,"a",o));if(!i)return;const r=await this.descopeUi;(null==r?void 0:r.componentsThemeManager)&&(r.componentsThemeManager.themes={light:null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.components,dark:null===(n=null==i?void 0:i.dark)||void 0===n?void 0:n.components})},d=async function(){var e,t;const{projectConfig:n}=await this.config||{},i=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],r=null==n?void 0:n.cssTemplate,o=i||r;return null===(t=null==o?void 0:o[this.theme])||void 0===t?void 0:t.fonts},l=async function(){const e=await c(this,t,"m",d).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")},h=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)},p=function(){c(this,t,"m",l).call(this),c(this,t,"m",h).call(this)},v})),ho=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if("object"==typeof e[i]&&null!==e[i]&&!(null===(r=e[i])||void 0===r?void 0:r.value))return Object.assign(Object.assign({},n),ho(e[i],`${t+i}.`));const o="object"==typeof e[i]?e[i]:{value:e[i]},s=Object.assign(Object.assign({},n),{[t+i]:o,[`form.${t}${i}`]:o});return"displayName"===i?Object.assign(Object.assign({},s),{[`${t}fullName`]:o,[`form.${t}fullName`]:o}):s}),[]),fo=Yn((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;c(this,t,"m",n).call(this)&&c(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)},r}));var po,go,vo,mo,yo,$o,bo,wo,Co,ko,So,xo,Io,Ro,Oo,Eo,No,Ao,jo,Po,Mo,To,Uo;const _o=Vn(uo,Jr,fo)(HTMLElement);let Lo=class extends _o{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","nonce"]}constructor(e){super(),po.add(this),vo.set(this,!1),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),c(this,po,"m",Mo).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)}},mo.set(this,new Cr),yo.set(this,new Cr),$o.set(this,{}),this.getComponentsContext=()=>c(this,$o,"f"),this.nextRequestStatus=new Cr({isLoading:!1}),bo.set(this,void 0),wo.set(this,{popstate:c(this,po,"m",Io).bind(this),componentsContext:c(this,po,"m",Ao).bind(this)}),Co.set(this,void 0),this.getConfig=()=>l(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),u(this,Co,e,"f"),c(this,po,"m",So).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get tenantId(){return this.getAttribute("tenant")||void 0}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 ho(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 isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return l(this,void 0,void 0,(function*(){var e,t;const n=yield this.getProjectConfig(),i=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=i.version)&&void 0!==t||(i.version=0),i}))}getTargetLocales(){return l(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}getComponentsVersion(){return l(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 l(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),c(this,yo,"f").subscribe(c(this,po,"m",Po).bind(this)),c(this,yo,"f").update({isDebug:this.debug}),c(this,po,"m",xo).call(this),c(this,po,"m",Uo).call(this),yield c(this,po,"m",Eo).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");c(this,po,"m",To).call(this);const{executionId:i,stepId:r,token:o,code:s,exchangeError:a,redirectAuthCallbackUrl:d,redirectAuthBackupCallbackUri:l,redirectAuthCodeChallenge:h,redirectAuthInitiator:f,ssoQueryParams:p}=dr(this.flowId,this.loggerWrapper);window.addEventListener("popstate",c(this,wo,"f").popstate),window.addEventListener("components-context",c(this,wo,"f").componentsContext),c(this,mo,"f").subscribe(c(this,po,"m",Oo).bind(this)),c(this,mo,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:r,executionId:i,token:o,code:s,exchangeError:a,redirectAuthCallbackUrl:d,redirectAuthBackupCallbackUri:l,redirectAuthCodeChallenge:h,redirectAuthInitiator:f},p)),u(this,vo,!0,"f")}))}disconnectedCallback(){c(this,mo,"f").unsubscribeAll(),c(this,yo,"f").unsubscribeAll(),c(this,po,"m",jo).call(this),window.removeEventListener("popstate",c(this,wo,"f").popstate),window.removeEventListener("components-context",c(this,wo,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&c(this,vo,"f")&&t!==n&&go.observedAttributes.includes(e)){c(this,po,"m",xo).call(this);const i=null===t;"nonce"===e&&c(this,po,"m",Uo).call(this),c(this,mo,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,sr()),{[ar(e)]:n,stepId:o,executionId:s}})),c(this,yo,"f").update({isDebug:this.debug})}}};function Wo(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var Do,Fo,qo,Bo,Vo,Ko,Ho,Go,zo,Jo,Zo,Yo,Xo,Qo,es,ts,ns,is,rs,os,ss,as,ds,ls,cs,us,hs,fs,ps,gs,vs,ms,ys;go=Lo,vo=new WeakMap,mo=new WeakMap,yo=new WeakMap,$o=new WeakMap,bo=new WeakMap,wo=new WeakMap,Co=new WeakMap,po=new WeakSet,ko=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync("\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 "),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n]},So=function(){c(this,po,"m",ko).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},xo=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","nonce","outbound-app-id","outbound-app-scopes"];go.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[ar(t)])throw Error(`${t} cannot be empty`)}))},Io=function(){const{stepId:e,executionId:t}=or(this.flowId);c(this,mo,"f").update({stepId:e,executionId:t})},Ro=function(e,t){this.sdk=Tn(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},go.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>l(this,void 0,void 0,(function*(){try{return yield t(...e)}catch(e){return{error:{errorCode:Si,errorDescription:e.toString()}}}}))}))},Oo=function(e,t,n){return l(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;c(this,po,"m",Ro).call(this,t,i)}c(this,Co,"f").call(this,e)}))},Eo=function(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield c(this,po,"m",No).call(this))}))},No=function(){return l(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(xi||i||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:"config.json",assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield function(e,t){return l(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}}))},Ao=function(e){u(this,$o,Object.assign(Object.assign({},c(this,$o,"f")),e.detail),"f")},jo=function(){var e;null===(e=c(this,bo,"f"))||void 0===e||e.remove(),u(this,bo,null,"f")},Po=function(e){return l(this,arguments,void 0,(function*({isDebug:e}){e?(u(this,bo,document.createElement("descope-debugger"),"f"),Object.assign(c(this,bo,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return jy})),document.body.appendChild(c(this,bo,"f"))):c(this,po,"m",jo).call(this)}))},Mo=function(e,t){var n;e&&this.debug&&(null===(n=c(this,bo,"f"))||void 0===n||n.updateData({title:e,description:t}))},To=function(){this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Xi.includes(null!==(i=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==i?i:"");if("Enter"!==e.key||r||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()}}},Uo=function(){this.getAttribute("nonce")&&(window.DESCOPE_NONCE=this.getAttribute("nonce"))},Lo.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.42.3"}};let $s=class extends Lo{static set sdkConfigOverrides(e){Lo.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Lo.sdkConfigOverrides}constructor(){const e=new Cr({deferredRedirect:!1});super(e.update.bind(e)),Do.add(this),this.stepState=new Cr({}),Fo.set(this,void 0),qo.set(this,null),Bo.set(this,null),Vo.set(this,{visibilitychange:c(this,Do,"m",Ko).bind(this)}),this.bridgeVersion=2,this.nativeCallbacks={},es.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()?c(this,Do,"m",ts).call(this,t):t()})),ns.set(this,((e,t,n,i,r=!1)=>{if(this.flowState.current.action===Ki){this.logger.debug("polling - Scheduling polling request");const o=Date.now(),s=r?500:2e3;u(this,Fo,setTimeout((()=>l(this,void 0,void 0,(function*(){var a;this.logger.debug("polling - Calling next");const d=this.sdk.flow.next(e,t,Yi,n,i,{}),l=document.hidden&&!r&&Date.now()-o>s+500;let u;l&&this.logger.debug("polling - The polling seems to be throttled");try{const e=l?1e3:6e3;u=yield ur(e,d)}catch(a){return this.logger.warn(`polling - The ${l?"throttled fetch":"fetch"} call timed out or was aborted`),void c(this,ns,"f").call(this,e,t,n,i,l)}if((null===(a=null==u?void 0:u.error)||void 0===a?void 0:a.errorCode)===Si)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void c(this,ns,"f").call(this,e,t,n,i);this.logger.debug("polling - Got a response"),(null==u?void 0:u.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(u.error,null,4)),c(this,ns,"f").call(this,e,t,n,i),c(this,rs,"f").call(this,u)}))),s),"f")}})),is.set(this,(()=>{clearTimeout(c(this,Fo,"f")),u(this,Fo,null,"f")})),rs.set(this,(e=>{var t,n,i,r,o,s,a,d,l,h,f,p,g;if(!(null==e?void 0:e.ok)){const a=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,d=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.statusText}`;c(this,Do,"m",ys).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:d,errorMessage:a}),this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||a,(null===(o=null==e?void 0:e.error)||void 0===o?void 0:o.errorMessage)||d);const l=null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorCode;return void("E102004"!==l&&"E103205"!==l||!this.isRestartOnError||c(this,Do,"m",Xo).call(this))}null===(d=null===(a=e.data)||void 0===a?void 0:a.runnerLogs)||void 0===d||d.forEach((e=>{const{level:t,title:n,log:i}=e;t&&this.loggerWrapper[t]?this.loggerWrapper[t](n,i):this.loggerWrapper.info(n,i)}));const v=null===(f=null===(h=null===(l=e.data)||void 0===l?void 0:l.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:y,lastAuth:$,action:b,openInNewTabUrl:w}=e.data;if(b!==Ki&&c(this,is,"f").call(this),"completed"===m)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&ki&&localStorage.setItem(Ai,JSON.stringify(e))}($),void c(this,Do,"m",ys).call(this,"success",y);w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:x,redirect:I,webauthn:R,error:O,samlIdpResponse:E,nativeResponse:N}=e.data,A=Date.now();b!==Ki?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:x,status:m,stepId:k,stepName:S,action:b,error:O}),(null===(g=x.state)||void 0===g?void 0:g.clientScripts)&&u(this,Bo,this.loadSdkScripts(x.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==I?void 0:I.url,screenId:null==x?void 0:x.id,screenState:null==x?void 0:x.state,webauthnTransactionId:null==R?void 0:R.transactionId,webauthnOptions:null==R?void 0:R.options,samlIdpResponseUrl:null==E?void 0:E.url,samlIdpResponseSamlResponse:null==E?void 0:E.samlResponse,samlIdpResponseRelayState:null==E?void 0:E.relayState,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:A})):this.flowState.update({action:b,reqTimestamp:A})})),os.set(this,lr((()=>l(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)}}))))),gs.set(this,gr(((e,t)=>l(this,void 0,void 0,(function*(){var n;if("true"===e.getAttribute("formnovalidate")||c(this,Do,"m",ls).call(this)){const i=null==e?void 0:e.getAttribute("id");c(this,Do,"m",us).call(this,e);const r=yield c(this,Do,"m",cs).call(this),o=(e=>Array.from((null==e?void 0:e.attributes)||[]).reduce(((e,t)=>{var n;const i=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return i?Object.assign(e,{[i]:t.value}):e}),{}))(e);if(this.nextRequestStatus.update({isLoading:!0}),c(this,Bo,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield c(this,Bo,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const s=this.loadSdkScriptsModules();if(s.length>0){const e=s.filter((e=>"function"==typeof e.refresh)).map((e=>e.refresh()));e.length>0&&(yield ur(5e3,Promise.all(e),null))}const a=this.getComponentsContext(),d=Object.assign(Object.assign(Object.assign(Object.assign({},a),o),r),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin});yield t(i,d),this.nextRequestStatus.update({isLoading:!1}),c(this,Do,"m",hs).call(this,r)}}))))),this.flowState=e}nativeResume(e,t){var n,i,r,o,s;const a=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let{exchangeCode:e}=a;e||(e=null===(n=new URL(a.url).searchParams)||void 0===n?void 0:n.get(Oi)),null===(r=(i=this.nativeCallbacks).complete)||void 0===r||r.call(i,{exchangeCode:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(a.url),t=e.searchParams.get("t"),n=e.searchParams.get(Ri).split("_").pop();c(this,is,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const e=this.nativeCallbacks.screenResolve;this.nativeCallbacks.screenResolve=null;const{override:t}=a;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=a,n=this.nativeCallbacks.screenNext;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(s=(o=this.nativeCallbacks).complete)||void 0===s||s.call(o,a)}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:{[Wo(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 n=Promise.all(null==e?void 0:e.map((e=>l(this,void 0,void 0,(function*(){var n;const i=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(i){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=i;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}const r=yield function(e){return l(this,void 0,void 0,(function*(){let t;switch(e){case"forter":return t=yield Promise.resolve().then((function(){return Py})),t.default;case"fingerprint":return t=yield Promise.resolve().then((function(){return Ty})),t.default;case"fingerprintDescope":return t=yield Promise.resolve().then((function(){return _y})),t.default;case"grecaptcha":return t=yield Promise.resolve().then((function(){return Dy})),t.default;default:throw new Error(`Unknown script id: ${e}`)}}))}(e.id);return new Promise(((n,i)=>{try{const i=r(e.initArgs,{baseUrl:this.baseUrl},t(e,n));if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t),this.nextRequestStatus.subscribe((()=>{var t;this.loggerWrapper.debug("Unloading script",e.id),null===(t=i.stop)||void 0===t||t.call(i)}))}}catch(e){i(e)}}))}))))),i=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([n,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 l(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)),c(this,Do,"m",Zo).call(this),window.addEventListener("visibilitychange",c(this,Vo,"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(),null===(e=c(this,qo,"f"))||void 0===e||e.abort(),u(this,qo,null,"f"),window.removeEventListener("visibilitychange",c(this,Vo,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return l(this,void 0,void 0,(function*(){let n;const i=vr(e),r=yield this.getTargetLocales();return r.includes(i.locale)?n=`${t}-${i.locale}.html`:r.includes(i.fallback)&&(n=`${t}-${i.fallback}.html`),n}))}getPageContent(e,t){return l(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,t,n){return l(this,void 0,void 0,(function*(){var i,r;const{projectId:o,flowId:s,tenant:a,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectUrl:y,token:$,code:b,exchangeError:w,webauthnTransactionId:C,webauthnOptions:k,redirectAuthCodeChallenge:S,redirectAuthCallbackUrl:x,redirectAuthBackupCallbackUri:I,redirectAuthInitiator:R,locale:O,samlIdpResponseUrl:E,samlIdpResponseSamlResponse:N,samlIdpResponseRelayState:A,nativeResponseType:j,nativePayload:P,reqTimestamp:M}=e,T=d(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectUrl","token","code","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","nativeResponseType","nativePayload","reqTimestamp"]);let U,_,L;const W=(()=>{const e=localStorage.getItem(Pr);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Pr,e.toString()),e}return Number(e)})(),D=this.outboundAppId,F=this.outboundAppScopes,q=this.sdk.getLastUserLoginId(),B=yield this.getFlowConfig(),V=yield this.getProjectConfig(),K=Object.entries(V.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),H=x&&S?{callbackUrl:x,codeChallenge:S,backupCallbackUri:I}:void 0,G=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}:void 0;let z={};if(!f){const e=[...B.clientScripts||[],...B.sdkScripts||[]];if(B.conditions){let t=[];({startScreenId:U,conditionInteractionId:L,startScreenName:_,clientScripts:t,componentsConfig:z}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:i})=>{var r;if("ELSE"===t)return!0;const o=null===(r=Mr[t])||void 0===r?void 0:r[n];return!!(null==o?void 0:o(e,i))}));return n?{startScreenId:n.met.screenId,startScreenName:n.met.screenName,conditionInteractionId:n.met.interactionId,clientScripts:n.met.clientScripts,componentsConfig:n.met.componentsConfig}:{}})({loginId:q,code:b,token:$,abTestingKey:W},B.conditions)),e.push(...t||[])}else B.condition?({startScreenId:U,conditionInteractionId:L}=((e,t)=>{var n;const i=null===(n=Mr[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!i)return{};const r=i(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,startScreenName:null==r?void 0:r.screenName,conditionInteractionId:null==r?void 0:r.interactionId}})(B.condition,{loginId:q,code:b,token:$,abTestingKey:W})):(_=B.startScreenName,U=B.startScreenId);if(u(this,Bo,this.loadSdkScripts(e),"f"),B.fingerprintEnabled&&B.fingerprintKey?yield un(B.fingerprintKey,this.baseUrl):localStorage.removeItem(ln),!hr(U,T)){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:H},T),{client:this.client}),y&&{redirectUrl:y}),{lastAuth:Tr(q),abTestingKey:W,locale:vr(O).locale,nativeOptions:G,outboundAppId:D,outboundAppScopes:F}),L,"",V.componentsVersion,K,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),b?{exchangeCode:b,idpInitiated:!0}:{}),T.descopeIdpInitiated&&{idpInitiated:!0}),$?{token:$}:{}),T.oidcLoginHint?{externalId:T.oidcLoginHint}:{}));return c(this,rs,"f").call(this,e),void("completed"!==(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.status)&&this.flowState.update({code:void 0,token:void 0}))}}if(f&&(n("token")&&$||n("code")&&b||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(f,h,Zi,B.version,V.componentsVersion,{token:$,exchangeCode:b,exchangeError:w});return c(this,rs,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Ji&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!E||!N)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,i)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.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(r),i(r)})(E,N,A||"",fr)}if(p===Vi&&(n("redirectTo")||n("deferredRedirect")))return m?"android"===R&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(m):void this.loggerWrapper.error("Did not get redirect url");if(p===Hi||p===Gi){if(!C||!k)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=c(this,qo,"f"))||void 0===r||r.abort(),u(this,qo,null,"f");try{e=p===Hi?yield this.sdk.webauthn.helpers.create(k):yield this.sdk.webauthn.helpers.get(k)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name}const n=yield this.sdk.flow.next(f,h,Zi,B.version,V.componentsVersion,{transactionId:C,response:e,failure:t});c(this,rs,"f").call(this,n)}if(p===zi)return this.nativeCallbacks.complete=e=>l(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,Zi,B.version,V.componentsVersion,e);c(this,rs,"f").call(this,t)})),void c(this,Do,"m",zo).call(this,j,P);if(n("action")&&c(this,ns,"f").call(this,f,h,B.version,V.componentsVersion),!g&&!U)return void this.loggerWrapper.warn("No screen was found to show");const J=U||g,Z=yield this.getHtmlFilenameWithLocale(O,J),{oidcLoginHint:Y,oidcPrompt:X,oidcErrorRedirectUri:Q,samlIdpUsername:ee}=T,te={direction:rr(h,t.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:q,name:this.sdk.getLastUserDisplayName()||q},componentsConfig:Object.assign(Object.assign(Object.assign({},B.componentsConfig),z),null==v?void 0:v.componentsConfig)}),htmlFilename:`${J}.html`,htmlLocaleFilename:Z,screenId:J,stepName:e.stepName||_,samlIdpUsername:ee,oidcLoginHint:Y,oidcPrompt:X,oidcErrorRedirectUri:Q,action:p},ne=Tr(q);hr(U,T)?te.next=(e,t)=>l(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:H},T),{lastAuth:ne,preview:this.preview,abTestingKey:W,client:this.client}),y&&{redirectUrl:y}),{locale:vr(O).locale,nativeOptions:G,outboundAppId:D,outboundAppScopes:F}),L,e,V.componentsVersion,K,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),t),b&&{exchangeCode:b,idpInitiated:!0}),T.descopeIdpInitiated&&{idpInitiated:!0}),$&&{token:$}));return c(this,rs,"f").call(this,n),n})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(te.next=(e,t)=>l(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.next(f,h,e,B.version,V.componentsVersion,t);return c(this,rs,"f").call(this,n),n}))),this.loggerWrapper.debug("Got a screen with id",te.screenId),yield c(this,Do,"m",Qo).call(this,te),this.stepState.update(te)}))}onStepChange(e,t){return l(this,void 0,void 0,(function*(){var n,i;const{htmlFilename:r,htmlLocaleFilename:o,direction:s,next:a,screenState:d}=e;this.loggerWrapper.debug("Rendering a flow screen");const u=document.createElement("template");u.innerHTML=yield this.getPageContent(r,o);const h=u.content.cloneNode(!0),f=this.loadDescopeUiComponents(u);this.sdk.webauthn.helpers.isSupported()?yield c(this,Do,"m",as).call(this,h,a):(e=>{e.querySelectorAll(`descope-button[${Bi}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(h),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(i=d.form)||void 0===i?void 0:i.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),Ar(h,d,d.componentsConfig,this.formConfig,this.loggerWrapper);const{geo:p}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,p);const g=()=>l(this,void 0,void 0,(function*(){var n,i;yield f;const r=this.contentRootElement;((e,t)=>{Nr(e,"descope-totp-image",t)})(r,null===(n=null==d?void 0:d.totp)||void 0===n?void 0:n.image),((e,t)=>{Nr(e,"descope-notp-image",t)})(r,null===(i=null==d?void 0:d.notp)||void 0===i?void 0:i.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{t.querySelector(r)||i.debug(`Skipping css vars for component "${r}}"`,`Got css vars for component ${r} but Could not find it on next page`);const o=customElements.get(r);o?Object.keys(n[r]).forEach((t=>{var s;const a=n[r],d=null===(s=null==o?void 0:o.cssVarList)||void 0===s?void 0:s[t];if(!d)return void i.info(`Could not find css variable name for ${t} in ${r}`,"Check if the css variable is defined in the component");const l=a[t];e.style.setProperty(d,l)})):i.info(`Could not find component class for ${r}`,"Check if the component is registered")}))})(r,h,d.cssVars,this.loggerWrapper),r.replaceChildren(h);const o=!t.htmlFilename;setTimeout((()=>{c(this,Do,"m",fs).call(this),this.validateOnBlur&&(e=>{e.querySelectorAll("*[name]").forEach((t=>{t.addEventListener("blur",(()=>{var n;const i=()=>{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 i();const r={timer:void 0},o=e=>{"true"===e.target.getAttribute("formnovalidate")&&(clearTimeout(r.timer),r.timer=void 0)};r.timer=setTimeout((()=>{e.removeEventListener("click",o),i(),r.timer=void 0}),150),e.addEventListener("click",o,{once:!0})}))}))})(r),((e,t)=>{Ir(e,null==t?void 0:t.inputs),Ir(e,null==t?void 0:t.form)})(r,d),c(this,Do,"m",ds).call(this,{isFirstScreen:o,isCustomScreen:!1,stepName:e.stepName}),cr(r,this.autoFocus,o)})),c(this,Do,"m",ms).call(this,a),r.querySelector(`[${Bi}="polling"]`)&&a(Yi,{})}));s?c(this,Do,"m",ts).call(this,g):g()}))}};Fo=new WeakMap,qo=new WeakMap,Bo=new WeakMap,Vo=new WeakMap,es=new WeakMap,ns=new WeakMap,is=new WeakMap,rs=new WeakMap,os=new WeakMap,gs=new WeakMap,Do=new WeakSet,Ko=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1})}),300)},Ho=function(e,t,n){return l(this,void 0,void 0,(function*(){var i;return(null===(i=this.nativeOptions)||void 0===i?void 0:i.bridgeVersion)>=2&&new Promise((i=>{this.nativeCallbacks.screenNext=n,this.nativeCallbacks.screenResolve=i,c(this,Do,"m",zo).call(this,"beforeScreen",{screen:e,context:t})}))}))},Go=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&c(this,Do,"m",zo).call(this,"afterScreen",{screen:e})},zo=function(e,t){c(this,Do,"m",ys).call(this,"bridge",{type:e,payload:t})},Jo=function({errorText:e,errorType:t}){const n=()=>{var n;let i=e;try{i=(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(`[${Bi}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(this.contentRootElement,"error-message",i)};this.addEventListener("screen-updated",n,{once:!0}),n()},Zo=function(){var e,t,n;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var t=e.screenState,n=d(void 0===t?{}:t,["errorText","errorType"]),i=d(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:n})})),null===(t=this.stepState)||void 0===t||t.subscribe(c(this,Do,"m",Jo).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}})),null===(n=this.stepState)||void 0===n||n.subscribe(c(this,Do,"m",Yo).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})},Yo=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=""}))})),cr(this.contentRootElement,this.autoFocus,!1))},Xo=function(){return l(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")}))},Qo=function(e){return l(this,void 0,void 0,(function*(){var t;const n=Object.assign(Object.assign({},this.stepState.current),e),{next:i,stepName:r}=n,o=(e=>{const t=(n=e.screenState,i=(e,t)=>Qi.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([e,t])=>!i(0,e)))));var n,i;const{screenState:{errorText:r,errorType:o}}=e;return(r||o)&&(t.error={text:r,type:o}),e.action&&(t.action=e.action),t})(d(n,["next","stepName"]));let s=yield c(this,Do,"m",Ho).call(this,r,o,i);s||(s=Boolean(yield null===(t=this.onScreenUpdate)||void 0===t?void 0:t.call(this,r,o,i,this)));const a=!this.stepState.current.htmlFilename;if(c(this,es,"f").call(this,s),s){this.loggerWrapper.debug("Showing a custom screen"),c(this,Do,"m",ds).call(this,{isFirstScreen:a,isCustomScreen:s,stepName:e.stepName}),this.stepState.unsubscribeAll();const t=this.stepState.subscribe((()=>{this.stepState.unsubscribe(t),c(this,Do,"m",Zo).call(this)}))}this.stepState.forceUpdate=s}))},ts=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")},ss=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)}))}},as=function(e,t){return l(this,void 0,void 0,(function*(){var n;null===(n=c(this,qo,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield jr())){const{options:e,transactionId:n}=(yield c(this,os,"f").call(this))||{};e&&n&&(c(this,Do,"m",ss).call(this,i),u(this,qo,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,c(this,qo,"f")).then((e=>l(this,void 0,void 0,(function*(){t(i.id,{transactionId:n,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},ds=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&c(this,Do,"m",ys).call(this,"ready",{}),t||c(this,Do,"m",Go).call(this,n),c(this,Do,"m",ys).call(this,"page-updated",{screenName:n}),c(this,Do,"m",ys).call(this,"screen-updated",{screenName:n})},ls=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,i;"slot"!==t.localName&&(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(i=t.checkValidity)||void 0===i?void 0:i.call(t)))})),e},cs=function(){return l(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Ei}])`));return(yield Promise.all(e.map((e=>l(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})),{})}))},us=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},hs=function(e={}){var t,n;const i=pr(e,["externalId","email","phone"]),r=pr(e,["newPassword","password"]);if(i&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:i,password:r});null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.store)||void 0===n||n.call(t,e)}catch(e){this.loggerWrapper.error("Could not store credentials",e.message)}},fs=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>c(this,Do,"m",ps).call(this,e)))},ps=function(e){e&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),i=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",i),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",i),this.appendChild(t)}))},vs=function(e){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.addEventListener("input",(()=>{var n;(null===(n=t.checkValidity)||void 0===n?void 0:n.call(t))&&c(this,gs,"f").call(this,t,e)}))}))},ms=function(e){this.contentRootElement.querySelectorAll(`descope-button:not([${Ni}]), [data-type="button"]:not([${Ni}]`).forEach((t=>{t.onclick=()=>{c(this,gs,"f").call(this,t,e)}})),c(this,Do,"m",vs).call(this,e),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Ei}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},ys=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",$s);var bs=Object.freeze({__proto__:null,default:$s});const ws=Yn((e=>{var t,n,i,r,o,s,a;return a=class extends(Vn(Fr,_r)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,i),"debug"===e&&c(this,t,"m",o).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&&c(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),c(this,t,"m",o).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=c(this,n,"f"))||void 0===e||e.remove(),u(this,n,null,"f")},r=async function(){u(this,n,document.createElement("descope-debugger"),"f"),Object.assign(c(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return e$})),document.body.appendChild(c(this,n,"f"))},o=function(){this.debug?c(this,t,"m",r).call(this):c(this,t,"m",i).call(this)},s=function(e,t){var i;e&&(null===(i=c(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},a})),Cs="descope-modal";var ks,Ss;let xs=class{constructor(e,t){ks.set(this,void 0),this.nodeName="",u(this,ks,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>new Promise((t=>{const n=setInterval((()=>{const i="function"==typeof e?e():e;i&&(clearInterval(n),t(i))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(c(this,ks,"f"))}get ele(){var e,t;const n="function"==typeof c(this,ks,"f")?c(this,ks,"f").call(this):c(this,ks,"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)}};ks=new WeakMap;const Is=/^descope-grid-([^-]+)-column$/,Rs={text:class extends xs{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 xs{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 Os=class extends xs{constructor(){super(...arguments),this.nodeName="descope-grid",Ss.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 i=null===(n=Is.exec(t.localName))||void 0===n?void 0:n[1],r=Rs[i];return r?(e.push(new r(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);Hn(i,this.ele.columns)||(this.ele.columns=i,null===(n=c(this,Ss,"f"))||void 0===n||n.call(this,i))}onColumnsChange(e){u(this,Ss,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};Ss=new WeakMap;class Es extends xs{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")}}var Ns;class As extends xs{constructor(){super(...arguments),Ns.set(this,void 0),this.nodeName="descope-modal"}close(){var e,t;null===(e=this.ele)||void 0===e||e.removeAttribute("opened"),null===(t=this.afterClose)||void 0===t||t.call(this)}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),c(this,Ns,"f")&&(null===(e=this.ele)||void 0===e||e.append(c(this,Ns,"f").content.cloneNode(!0)))}setContent(e){u(this,Ns,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Ns=new WeakMap;let js=class extends xs{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()))}},Ps=class extends xs{constructor(){super(...arguments),this.nodeName="descope-combo-box"}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)}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}},Ms=class extends xs{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()}},Ts=class extends xs{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)}},Us=class extends xs{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")}},_s=class extends xs{constructor(){super(...arguments),this.nodeName="descope-avatar"}set displayName(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("display-name",e)}set image(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("img",e)}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}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)}}},Ls=class extends xs{constructor(){super(...arguments),this.nodeName="descope-user-attribute"}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",e)}set badgeLabel(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("badge-label",e)}get label(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("label"))||""}get editFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("edit-flow-id"))||""}get deleteFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("delete-flow-id"))||""}onEditClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("edit-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("edit-clicked",e)}}onDeleteClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("delete-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("delete-clicked",e)}}},Ws=class extends xs{constructor(){super(...arguments),this.nodeName="descope-user-auth-method"}set fulfilled(e){var t,n;e?null===(t=this.ele)||void 0===t||t.setAttribute("fulfilled","true"):null===(n=this.ele)||void 0===n||n.removeAttribute("fulfilled")}onButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}},Ds=class extends xs{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)}}},Fs=class extends xs{constructor(){super(...arguments),this.nodeName="descope-apps-list"}set data(e){this.ele&&(this.ele.data=e)}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}get ele(){return super.ele}};const qs=Yn((e=>{var t,n;const i=Vn(Fr,lo,oo)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends As{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Cs);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(c(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Cs]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Bs="descope-notification",Vs=Yn((e=>{var t,n;const i=Vn(Fr,lo,oo)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ms{setContent(t){const n="string"==typeof t?Kn(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Bs);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(c(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([Bs])}},t=new WeakMap,n}));function Ks(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Hs=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Gs=()=>Math.random().toString(36).substring(7).split("").join("."),zs={INIT:`@@redux/INIT${Gs()}`,REPLACE:`@@redux/REPLACE${Gs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Gs()}`};function Js(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 Zs(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 Ys(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Zs(e)),t}function Xs(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ks(2):`Expected the root reducer to be a function. Instead, received: '${Ys(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Ks(0):"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("production"===process.env.NODE_ENV?Ks(1):`Expected the enhancer to be a function. Instead, received: '${Ys(n)}'`);return n(Xs)(e,t)}let i=e,r=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("production"===process.env.NODE_ENV?Ks(3):"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 r}function u(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ks(4):`Expected the listener to be a function. Instead, received: '${Ys(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Ks(5):"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("production"===process.env.NODE_ENV?Ks(6):"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(!Js(e))throw new Error("production"===process.env.NODE_ENV?Ks(7):`Actions must be plain objects. Instead, the actual type was: '${Ys(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("production"===process.env.NODE_ENV?Ks(8):'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("production"===process.env.NODE_ENV?Ks(17):`Action "type" property must be a string. Instead, the actual type was: '${Ys(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Ks(9):"Reducers may not dispatch actions.");try{d=!0,r=i(r,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:zs.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ks(10):`Expected the nextReducer to be a function. Instead, received: '${Ys(e)}`);i=e,h({type:zs.REPLACE})},[Hs]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Ks(11):`Expected the observer to be an object. Instead, received: '${Ys(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Hs](){return this}}}}}function Qs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function ea(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];"production"!==process.env.NODE_ENV&&void 0===e[r]&&Qs(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r,o;"production"!==process.env.NODE_ENV&&(r={});try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:zs.INIT}))throw new Error("production"===process.env.NODE_ENV?Ks(12):`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:zs.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Ks(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${zs.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;if("production"!==process.env.NODE_ENV){const i=function(e,t,n,i){const r=Object.keys(t),o=n&&n.type===zs.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===r.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Js(e))return`The ${o} has unexpected type of "${Ys(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!i[e]));return s.forEach((e=>{i[e]=!0})),n&&n.type===zs.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: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);i&&Qs(i)}let s=!1;const a={};for(let r=0;r<i.length;r++){const o=i[r],d=n[o],l=e[o],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?Ks(14):`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||i.length!==Object.keys(e).length,s?a:e}}function ta(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function na(e){return Js(e)&&"type"in e&&"string"==typeof e.type}var ia=Symbol.for("immer-nothing"),ra=Symbol.for("immer-draftable"),oa=Symbol.for("immer-state"),sa="production"!==process.env.NODE_ENV?[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 aa(e,...t){if("production"!==process.env.NODE_ENV){const n=sa[e],i="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var da=Object.getPrototypeOf;function la(e){return!!e&&!!e[oa]}function ca(e){return!!e&&(ha(e)||Array.isArray(e)||!!e[ra]||!!e.constructor?.[ra]||ma(e)||ya(e))}var ua=Object.prototype.constructor.toString();function ha(e){if(!e||"object"!=typeof e)return!1;const t=da(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)===ua}function fa(e,t){0===pa(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function pa(e){const t=e[oa];return t?t.type_:Array.isArray(e)?1:ma(e)?2:ya(e)?3:0}function ga(e,t){return 2===pa(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function va(e,t,n){const i=pa(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function ma(e){return e instanceof Map}function ya(e){return e instanceof Set}function $a(e){return e.copy_||e.base_}function ba(e,t){if(ma(e))return new Map(e);if(ya(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&ha(e)){if(!da(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[oa];let i=Reflect.ownKeys(n);for(let t=0;t<i.length;t++){const r=i[t],o=n[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(n[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[r]})}return Object.create(da(e),n)}function wa(e,t=!1){return ka(e)||la(e)||!ca(e)||(pa(e)>1&&(e.set=e.add=e.clear=e.delete=Ca),Object.freeze(e),t&&fa(e,((e,t)=>wa(t,!0)))),e}function Ca(){aa(2)}function ka(e){return Object.isFrozen(e)}var Sa,xa={};function Ia(e){const t=xa[e];return t||aa(0,e),t}function Ra(){return Sa}function Oa(e,t){t&&(Ia("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ea(e){Na(e),e.drafts_.forEach(ja),e.drafts_=null}function Na(e){e===Sa&&(Sa=e.parent_)}function Aa(e){return Sa={drafts_:[],parent_:Sa,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ja(e){const t=e[oa];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Pa(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[oa].modified_&&(Ea(t),aa(4)),ca(e)&&(e=Ma(t,e),t.parent_||Ua(t,e)),t.patches_&&Ia("Patches").generateReplacementPatches_(n[oa].base_,e,t.patches_,t.inversePatches_)):e=Ma(t,n,[]),Ea(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ia?e:void 0}function Ma(e,t,n){if(ka(t))return t;const i=t[oa];if(!i)return fa(t,((r,o)=>Ta(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return Ua(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let r=t,o=!1;3===i.type_&&(r=new Set(t),t.clear(),o=!0),fa(r,((r,s)=>Ta(e,i,t,r,s,n,o))),Ua(e,t,!1),n&&e.patches_&&Ia("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Ta(e,t,n,i,r,o,s){if("production"!==process.env.NODE_ENV&&r===n&&aa(5),la(r)){const s=Ma(e,r,o&&t&&3!==t.type_&&!ga(t.assigned_,i)?o.concat(i):void 0);if(va(n,i,s),!la(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(ca(r)&&!ka(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ma(e,r),t&&t.scope_.parent_||Ua(e,r)}}function Ua(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&wa(t,n)}var _a={get(e,t){if(t===oa)return e;const n=$a(e);if(!ga(n,t))return function(e,t,n){const i=Da(t,n);return i?"value"in i?i.value:i.get?.call(e.draft_):void 0}(e,n,t);const i=n[t];return e.finalized_||!ca(i)?i:i===Wa(e.base_,t)?(qa(e),e.copy_[t]=Ba(i,e)):i},has:(e,t)=>t in $a(e),ownKeys:e=>Reflect.ownKeys($a(e)),set(e,t,n){const i=Da($a(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=Wa($a(e),t),r=i?.[oa];if(r&&r.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,i)&&(void 0!==n||ga(e.base_,t)))return!0;qa(e),Fa(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!==Wa(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,qa(e),Fa(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=$a(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){aa(11)},getPrototypeOf:e=>da(e.base_),setPrototypeOf(){aa(12)}},La={};function Wa(e,t){const n=e[oa];return(n?$a(n):e)[t]}function Da(e,t){if(!(t in e))return;let n=da(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=da(n)}}function Fa(e){e.modified_||(e.modified_=!0,e.parent_&&Fa(e.parent_))}function qa(e){e.copy_||(e.copy_=ba(e.base_,e.scope_.immer_.useStrictShallowCopy_))}fa(_a,((e,t)=>{La[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),La.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&aa(13),La.set.call(this,e,t,void 0)},La.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&aa(14),_a.set.call(this,e[0],t,n,e[0])};function Ba(e,t){const n=ma(e)?Ia("MapSet").proxyMap_(e,t):ya(e)?Ia("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:Ra(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=_a;n&&(r=[i],o=La);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:Ra()).drafts_.push(n),n}function Va(e){return la(e)||aa(10,e),Ka(e)}function Ka(e){if(!ca(e)||ka(e))return e;const t=e[oa];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ba(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ba(e,!0);return fa(n,((e,t)=>{va(n,e,Ka(t))})),t&&(t.finalized_=!1),n}var Ha=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 i=this;return function(e=n,...r){return i.produce(e,(e=>t.call(this,e,...r)))}}let i;if("function"!=typeof t&&aa(6),void 0!==n&&"function"!=typeof n&&aa(7),ca(e)){const r=Aa(this),o=Ba(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?Ea(r):Na(r)}return Oa(r,n),Pa(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===ia&&(i=void 0),this.autoFreeze_&&wa(i,!0),n){const t=[],r=[];Ia("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}aa(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,i;const r=this.produce(e,t,((e,t)=>{n=e,i=t}));return[r,n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ca(e)||aa(8),la(e)&&(e=Va(e));const t=Aa(this),n=Ba(e,void 0);return n[oa].isManual_=!0,Na(t),n}finishDraft(e,t){const n=e&&e[oa];n&&n.isManual_||aa(9);const{scope_:i}=n;return Oa(i,t),Pa(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));const i=Ia("Patches").applyPatches_;return la(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},Ga=Ha.produce;Ha.produceWithPatches.bind(Ha),Ha.setAutoFreeze.bind(Ha),Ha.setUseStrictShallowCopy.bind(Ha),Ha.applyPatches.bind(Ha),Ha.createDraft.bind(Ha),Ha.finishDraft.bind(Ha);var za=(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})}}},Ja=(e,t,n)=>{const{memoize:i,memoizeOptions:r}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=i((()=>({})),...r);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})}},Za={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Ya=e=>Array.isArray(e)?e:[e];function Xa(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 Qa(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var ed="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},td=0,nd=1;function id(){return{s:td,v:void 0,o:null,p:null}}function rd(e,t={}){let n=id();const{resultEqualityCheck:i}=t;let r,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 i=e.get(n);void 0===i?(t=id(),e.set(n,t)):t=i}else{let e=t.p;null===e&&(t.p=e=new Map);const i=e.get(n);void 0===i?(t=id(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===nd)d=t.v;else if(d=e.apply(null,arguments),o++,i){const e=r?.deref?.()??r;null!=e&&i(e,d)&&(d=e,0!==o&&o--);r="object"==typeof d&&null!==d||"function"==typeof d?new ed(d):d}return a.s=nd,a.v=d,d}return s.clearCache=()=>{n=id(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function od(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,i=(...e)=>{let t,i=0,r=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=rd,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=Ya(l),p=Ya(u),g=Xa(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const y=c((function(){r++;const e=Qa(g,arguments);if(t=v.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:i}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:i}={...Za,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:za},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Ja}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=Qa(g,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign(y,{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:d,argsMemoize:c})};return Object.assign(i,{withTypes:()=>i}),i}var sd=od(rd),ad=Object.assign(((e,t=sd)=>{!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),i=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,i)=>(e[n[i]]=t,e)),{})));return i}),{withTypes:()=>ad});function dd(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var ld=dd(),cd=dd;((...e)=>{const t=od(...e)})(rd);var ud="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ta:ta.apply(null,arguments)},hd=e=>e&&"function"==typeof e.match;function fd(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?Gd(0):"prepareAction did not return an object");return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>na(t)&&t.type===e,n}function pd(e){return"function"==typeof e&&"type"in e&&hd(e)}function gd(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 vd=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 md(e){return ca(e)?Ga(e,(()=>{})):e}function yd(e,t,n){if(e.has(t)){let i=e.get(t);return n.update&&(i=n.update(i,t,e),e.set(t,i)),i}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?Gd(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function $d(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function bd(e,t,n){const i=wd(e,t,n);return{detectMutations:()=>Cd(e,t,i,n)}}function wd(e,t=[],n,i="",r=new Set){const o={value:n};if(!e(n)&&!r.has(n)){r.add(n),o.children={};for(const r in n){const s=i?i+"."+r:r;t.length&&-1!==t.indexOf(s)||(o.children[r]=wd(e,t,n[r],s))}}return o}function Cd(e,t=[],n,i,r=!1,o=""){const s=n?n.value:void 0,a=s===i;if(r&&!a&&!Number.isNaN(i))return{wasMutated:!0,path:o};if(e(s)||e(i))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in i)d[e]=!0;const l=t.length>0;for(let r in d){const s=o?o+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Cd(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function kd(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Js(e)}function Sd(e,t="",n=kd,i,r=[],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!=i?i(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Sd(l,a,n,i,r,o),s))return s}return o&&xd(e)&&o.add(e),!1}function xd(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!xd(t))return!1;return!0}function Id(e){return"boolean"==typeof e}var Rd=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new vd;if(t&&(Id(t)?o.push(ld):o.push(cd(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Id(n)||(e=n),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,i,r){return JSON.stringify(e,n(t,r),i)},n=function(e,t){let n=[],i=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,r):i.push(r),~n.indexOf(o)&&(o=t.call(this,r,o))}else n.push(o);return null==e?o:e.call(this,r,o)}},{isImmutable:i=$d,ignoredPaths:r,warnAfter:o=32}=e;const s=bd.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=gd(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Gd(19):`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(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Gd(20):`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(i){let e={};Id(i)||(e=i),o.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=kd,getEntries:n,ignoredActions:i=[],ignoredActionPaths:r=["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(!na(u))return l(u);const h=l(u),f=gd(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=Sd(u,"",t,n,r,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 i=Sd(e.getState(),"",t,n,o,c);if(i){const{keyPath:e,value:t}=i;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(r){let e={};Id(r)||(e=r),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=pd}=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},Od=e=>t=>{setTimeout(t,e)},Ed="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Od(10),Nd=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new vd(e);return n&&i.push(((e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let r=!0,o=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Ed:"callback"===e.type?e.queueNotification:Od(e.timeout),l=()=>{s=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},i,{subscribe(e){const t=i.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,o=!r,o&&(s||(s=!0,d(l))),i.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),i},Ad="production"===process.env.NODE_ENV;function jd(e){const t=Rd(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Js(n))throw new Error("production"===process.env.NODE_ENV?Gd(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ea(n)}if(!Ad&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?Gd(2):"`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!Ad&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Gd(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Ad&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Gd(4):"each middleware provided to configureStore must be a function");let l=ta;r&&(l=ud({trace:!Ad,..."object"==typeof r&&r}));const c=function(...e){return t=>(n,i)=>{const r=t(n,i);let o=()=>{throw new Error("production"===process.env.NODE_ENV?Ks(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:r.getState,dispatch:(e,...t)=>o(e,...t)},a=e.map((e=>e(s)));return o=ta(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=Nd(c);if(!Ad&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Gd(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Ad&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Gd(6):"`enhancers` callback must return an array");if(!Ad&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Gd(7):"each enhancer provided to configureStore must be a function");Ad||!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 Xs(a,o,l(...h))}function Pd(e){const t={},n=[];let i;const r={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Gd(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?Gd(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?Gd(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Gd(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?Gd(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?Gd(31):"`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function Md(...e){return t=>e.some((e=>((e,t)=>hd(e)?e.match(t):e(t))(e,t)))}var Td=["name","message","stack","code"],Ud=class{constructor(e,t){this.payload=e,this.meta=t}_type},_d=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ld=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Td)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Wd=(()=>{function e(e,t,n){const i=fd(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=fd(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=fd(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||Ld)(e||"Rejected"),meta:{...o||{},arg:i,requestId:t,rejectedWithValue:!!r,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(r(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 Ud(e,t),fulfillWithValue:(e,t)=>new _d(e,t)})).then((t=>{if(t instanceof Ud)throw t;return t instanceof _d?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof Ud?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(Dd)})}}),{pending:r,rejected:o,fulfilled:i,settled:Md(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function Dd(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Fd=Symbol.for("rtk-slice-createasyncthunk");function qd(e,t){return`${e}/${t}`}function Bd(e,t,n,i){function r(r,...o){let s=n.call(e,r);if(void 0===s)if(i)s=e.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Gd(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...o)}return r.unwrapped=t,r}var Vd=function({creators:e}={}){const t=e?.asyncThunk?.[Fd];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Gd(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("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(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?Gd(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Gd(13):"`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("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?Gd(14):"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=[],i]="function"==typeof e.extraReducers?Pd(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?Gd(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[i,r,o]=Pd(t);if(function(e){return"function"==typeof e}(e))n=()=>md(e());else{const t=md(e);n=()=>t}function s(e=n(),t){let s=[i[t.type],...r.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(la(e)){const i=n(e,t);return void 0===i?e:i}if(ca(e))return Ga(e,(e=>n(e,t)));{const i=n(e,t);if(void 0===i){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?Gd(9):"A case reducer on a non-draftable value must not return undefined")}return i}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);i&&e.addDefaultCase(i)}))}o.forEach((i=>{const o=r[i],s={reducerName:i,type:qd(n,i),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},i,r){let o,s;if("reducer"in i){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(i))throw new Error("production"===process.env.NODE_ENV?Gd(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=i.reducer,s=i.prepare}else o=i;r.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?fd(e,s):fd(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Gd(18):"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=r(e,o,c);i.exposeAction(t,u),s&&i.addCase(u.fulfilled,s);a&&i.addCase(u.pending,a);d&&i.addCase(u.rejected,d);l&&i.addMatcher(u.settled,l);i.exposeCaseReducer(t,{fulfilled:s||Kd,pending:a||Kd,rejected:d||Kd,settled:l||Kd})}(s,o,a,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:i,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=yd(c,this,{insert:()=>new WeakMap});return yd(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Bd(this,r,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t)if(this!==h)t=this.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Gd(15):"selectSlice returned undefined for an uninjected slice reducer");return t},get selectors(){return this.getSelectors(this.selectSlice)},injectInto(e,{reducerPath:t,...n}={}){const i=t??this.reducerPath;return e.inject({reducerPath:i,reducer:this.reducer},n),{...this,reducerPath:i}}};return h}}();function Kd(){}var Hd="listenerMiddleware";function Gd(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}fd(`${Hd}/add`),fd(`${Hd}/removeAll`),fd(`${Hd}/remove`);const zd=e=>Yn((t=>{const n=Vd(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Vn(_r)(t)){constructor(...e){super(...e);const t=jd({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const i=await t.dispatch(e(...n));try{Dd(i)}catch(e){this.logger.error(e.message,i.type,e.stack)}return i},o=Object.keys(i).reduce(((e,t)=>(e[t]=r(i[t]),e)),{});this.actions=o,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}})),Jd=Yn((e=>class extends(_r(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()}})),Zd=Yn((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}}));var Yd={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 Xd(e){return Xd="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},Xd(e)}function Qd(e){var t=il();return function(){var n,i=ol(e);if(t){var r=ol(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Xd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return el(e)}(this,n)}}function el(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tl(e){var t="function"==typeof Map?new Map:void 0;return tl=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,i)}function i(){return nl(e,arguments,ol(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),rl(i,e)},tl(e)}function nl(e,t,n){return nl=il()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&rl(r,n.prototype),r},nl.apply(null,arguments)}function il(){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 rl(e,t){return rl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},rl(e,t)}function ol(e){return ol=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ol(e)}var sl=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&&rl(e,t)}(i,e);var t,n=Qd(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=n.call(this,e),Object.setPrototypeOf(el(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(tl(Error)),al=2,dl=17,ll=3,cl="0-90-9٠-٩۰-۹",ul="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),hl="++";function fl(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),i=t[0].split("."),r=0;r<3;r++){var o=Number(n[r]),s=Number(i[r]);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 pl={}.constructor;function gl(e){return null!=e&&e.constructor===pl}function vl(e){return vl="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},vl(e)}function ml(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yl(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var $l=" ext. ",bl=/^\d+$/,wl=function(){function e(t){ml(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!gl(e)||!gl(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(gl(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Rl(e)+": "+e,"."))}(t),this.metadata=t,Nl.call(this,t)}return yl(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&&bl.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Cl(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Cl(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 i=this.countryCallingCodes()[e];if(i&&1===i.length&&"001"===i[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(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}(),Cl=function(){function e(t,n){ml(this,e),this.globalMetadataObject=n,this.metadata=t,Nl.call(this,n.metadata)}return yl(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 kl(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()&&Il(this.types(),e))return new xl(Il(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?$l:this.metadata[13]||$l}}]),e}(),kl=function(){function e(t,n){ml(this,e),this._format=t,this.metadata=n}return yl(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()||Sl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Sl=/^\(?\$1\)?$/,xl=function(){function e(t,n){ml(this,e),this.type=t,this.metadata=n}return yl(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 Il(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 Rl=function(e){return vl(e)};function Ol(e,t){if((t=new wl(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function El(e,t){return t.countries.hasOwnProperty(e)}function Nl(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===fl(t,"1.2.0")?this.v2=!0:-1===fl(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Al=function(e){return"([".concat(cl,"]{1,").concat(e,"})")};function jl(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+Al("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+Al("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+Al("9")+i)+"|"+("[- ]+"+Al("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+Al("15")+i)+"|"+(r+"(?:,)+"+n+Al("9")+i)}var Pl="["+cl+"]{"+al+"}",Ml="[++]{0,1}(?:["+ul+"]*["+cl+"]){3,}["+ul+cl+"]*",Tl=new RegExp("^[++]{0,1}(?:["+ul+"]*["+cl+"]){1,2}$","i"),Ul=Ml+"(?:"+jl()+")?",_l=new RegExp("^"+Pl+"$|^"+Ul+"$","i");var Ll=new RegExp("(?:"+jl()+")$","i");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 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 i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Fl={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 ql(e){return Fl[e]}function Bl(e){for(var t,n="",i=Wl(e.split(""));!(t=i()).done;){var r=ql(t.value);r&&(n+=r)}return n}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 Kl(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 Kl(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Kl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Hl(e){for(var t,n="",i=Vl(e.split(""));!(t=i()).done;){n+=Gl(t.value,n)||""}return n}function Gl(e,t,n){if("+"===e){if(t)return;return"+"}return ql(e)}function zl(e,t){return function(e,t,n){var i=n.type(t),r=i&&i.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";var o=e.length,s=r[0];if(s===o)return"IS_POSSIBLE";if(s>o)return"TOO_SHORT";if(r[r.length-1]<o)return"TOO_LONG";return r.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Jl(e,t){return"IS_POSSIBLE"===zl(e,t)}function Zl(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Yl(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 Xl(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 Xl(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Xl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Ql=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ec(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new wl(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(Zl(i,n.nationalNumberPattern())){if(tc(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?tc(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=Yl(Ql);!(r=o()).done;){var s=r.value;if(tc(i,s,n))return s}}}}function tc(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Zl(e,t.pattern()))}function nc(e,t,n){var i=new wl(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new wl(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function ic(e){return e.replace(new RegExp("[".concat(ul,"]+"),"g")," ").trim()}var rc=/(\$\d)/;function oc(e,t,n){var i=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var o=e.replace(new RegExp(t.pattern()),i?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(rc,t.nationalPrefixFormattingRule()):t.format());return i?ic(o):o}var sc=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function ac(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 dc(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 dc(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function lc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lc(Object(n),!0).forEach((function(t){uc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hc={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function fc(e,t,n,i){if(n=n?cc(cc({},hc),n):hc,i=new wl(i),e.country&&"001"!==e.country){if(!i.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));i.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";i.selectNumberingPlan(e.countryCallingCode)}var r,o=i.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?vc(r=pc(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=pc(s,null,"INTERNATIONAL",i,n),vc(r="+".concat(o," ").concat(r),e.ext,i,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,i,r){var o=Ol(i,r.metadata);if(o===n){var s=pc(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new wl(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():sc.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(pc(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return vc(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function pc(e,t,n,i,r){var o=gc(i.formats(),e);return o?oc(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function gc(e,t){for(var n,i=ac(e);!(n=i()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var o=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(Zl(t,r.pattern()))return r}}function vc(e,t,n,i){return t?i(e,t,n):e}function mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function yc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mc(Object(n),!0).forEach((function(t){$c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bc(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var wc=function(){function e(t,n,i){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(!i)throw new TypeError("`metadata` not passed");var r=function(e,t){var n,i,r=new wl(t);Cc(e)?(n=e,r.selectNumberingPlan(n),i=r.countryCallingCode()):i=e;return{country:n,countryCallingCode:i}}(t,i),o=r.country,s=r.countryCallingCode;this.country=o,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return i}}return bc(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:nc(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new wl(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 Jl(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 wl(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==ec(e,t,n.metadata):Zl(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new wl(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return ec(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return fc(this,e,t?yc(yc({},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}(),Cc=function(e){return/^[A-Z]{2}$/.test(e)};var kc=new RegExp("(["+cl+"])");function Sc(e,t,n,i){if(t){var r=new wl(i);r.selectNumberingPlan(t,n);var o=new RegExp(r.IDDPrefix());if(0===e.search(o)){var s=(e=e.slice(e.match(o)[0].length)).match(kc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function xc(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),i=n.exec(e);if(i){var r,o,s,a=i.length-1,d=a>0&&i[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(o=i[1]);else{var l=i[0];r=e.slice(l.length),d&&(o=i[1])}if(d){var c=e.indexOf(i[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=i[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:o}}}return{nationalNumber:e}}function Ic(e,t){var n=xc(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Zl(e,n.nationalNumberPattern())&&!Zl(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(zl(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function Rc(e,t,n,i){var r=t?Ol(t,i):n;if(0===e.indexOf(r)){(i=new wl(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=Ic(o,i).nationalNumber,a=Ic(e,i).nationalNumber;if(!Zl(a,i.nationalNumberPattern())&&Zl(s,i.nationalNumberPattern())||"TOO_LONG"===zl(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function Oc(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=Sc(e,t,n,i);if(!o||o===e){if(t||n){var s=Rc(e,t,n,i),a=s.countryCallingCode,d=s.number;if(a)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:d}}return{number:e}}r=!0,e="+"+o}if("0"===e[1])return{};i=new wl(i);for(var l=2;l-1<=ll&&l<=e.length;){var c=e.slice(1,l);if(i.hasCallingCode(c))return i.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function Ec(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 Nc(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 Nc(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Nc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Ac(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new wl(i);for(var r,o=Ec(n);!(r=o()).done;){var s=r.value;if(i.country(s),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return s}else if(ec({phone:e,country:s},void 0,i.metadata))return s}}function jc(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:Ac(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var Pc="+",Mc="(["+cl+"]|[\\-\\.\\(\\)]?)",Tc=new RegExp("^\\"+Pc+Mc+"*["+cl+"]"+Mc+"*$","g"),Uc=new RegExp("^("+("["+cl+"]+((\\-)*["+cl+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+cl+"])*")+"\\.?$","g"),_c="tel:",Lc=";phone-context=",Wc=";isub=";function Dc(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Lc);if(t<0)return null;var n=t+Lc.length;if(n>=e.length)return"";var i=e.indexOf(";",n);return i>=0?e.substring(n,i):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(Tc.test(e)||Uc.test(e))}(r))throw new sl("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===Pc&&(n+=r);var o,s=e.indexOf(_c);o=s>=0?s+_c.length:0;var a=e.indexOf(Lc);n+=e.substring(o,a)}var d=n.indexOf(Wc);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Fc=250,qc=new RegExp("[++"+cl+"]"),Bc=new RegExp("[^"+cl+"#]+$");function Vc(e,t,n){if(t=t||{},n=new wl(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new sl("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=Dc(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>Fc){if(n)throw new sl("TOO_LONG");return}if(!1===t)return e;var i=e.search(qc);if(i<0)return;return e.slice(i).replace(Bc,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=al&&_l.test(e)}(i))return function(e){return Tl.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Ll);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(Ll),r=1;r<i.length;){if(i[r])return{number:n,ext:i[r]};r++}}(i);if(r.ext)return r;return{number:i}}(e,t.v2,t.extract),r=i.number,o=i.ext,s=i.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new sl("TOO_SHORT");throw new sl("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=Oc(Hl(e),t,n,i.metadata),s=o.countryCallingCodeSource,a=o.countryCallingCode,d=o.number;if(a)i.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};i.selectNumberingPlan(t,n),t&&(r=t),a=n||Ol(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=Ic(Hl(d),i),c=l.nationalNumber,u=l.carrierCode,h=jc(a,{nationalNumber:c,defaultCountry:t,metadata:i});h&&(r=h,"001"===h||i.country(r));return{country:r,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(r,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 sl("INVALID_COUNTRY");return{}}if(!l||l.length<al){if(t.v2)throw new sl("TOO_SHORT");return{}}if(l.length>dl){if(t.v2)throw new sl("TOO_LONG");return{}}if(t.v2){var f=new wc(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)&&Zl(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!Jl(l,n)),phone:l,ext:o}:p?function(e,t,n){var i={country:e,phone:t};n&&(i.ext=n);return i}(d,l,o):{}}function Kc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Hc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kc(Object(n),!0).forEach((function(t){Gc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}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 Zc(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 i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Yc(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 Yc(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 Yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Xc(e){var t,n,i,r=Zc(Array.prototype.slice.call(e),4),o=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,s&&"string"!=typeof s){if(!gl(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,i=a):i=s}else d?(n=a,i=d):(n=void 0,i=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zc(Object(n),!0).forEach((function(t){Jc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:i}}function Qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function eu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(n),!0).forEach((function(t){tu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nu(e,t,n){t&&t.defaultCountry&&!El(t.defaultCountry,n)&&(t=eu(eu({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Vc(e,Hc(Hc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof sl))throw e}}function iu(){var e=Xc(arguments);return nu(e.text,e.options,e.metadata)}function ru(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ou(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var su=ru((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;ou(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),au=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;ou(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return ru(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new su(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new su(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 du(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var lu=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 au(t)}return du(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 cu(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function uu(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var hu=" - \u2028\u2029 ",fu="[".concat(hu,"]"),pu="[^".concat(hu,"]"),gu="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),vu="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",mu="[".concat(vu,"]"),yu=new RegExp(mu),$u="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),bu=new RegExp($u),wu="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),Cu=new RegExp(wu),ku=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function Su(e){return!(!yu.test(e)&&!Cu.test(e))&&ku.test(e)}function xu(e){return"%"===e||bu.test(e)}function Iu(e,t,n){var i=!0,r=iu(e,n);if(r||(i=!1,r=iu(e,{defaultCallingCode:t.countryCallingCode},n)),!r)return"INVALID_NUMBER";if(t.ext){if(r.ext!==t.ext)return"NO_MATCH"}else if(r.ext)return"NO_MATCH";return i&&t.countryCallingCode!==r.countryCallingCode?"NO_MATCH":t.number===r.number?i?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(r.nationalNumber)||0===r.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var Ru={POSSIBLE:function(e,t){return t.candidate,t.metadata,!0},VALID:function(e,t){var n=t.candidate;t.defaultCountry;var i=t.metadata;return!(!e.isValid()||!Ou(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!Ou(e,n,r)||Nu(e,n)||!Eu(e,{defaultCountry:i,metadata:r}))&&Au()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!Ou(e,n,r)||Nu(e,n)||!Eu(e,{defaultCountry:i,metadata:r}))&&Au()}};function Ou(e,t,n){for(var i=0;i<t.length-1;i++){var r=t.charAt(i);if("x"===r||"X"===r){var o=t.charAt(i+1);if("x"===o||"X"===o){if(i++,"NSN_MATCH"!==Iu(t.substring(i),e,n))return!1}else{var s=Bl(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function Eu(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new wl(i);r.selectNumberingPlan(e.countryCallingCode),e.country||jc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=gc(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function Nu(e,t){var n=t.indexOf("/");if(n<0)return!1;var i=t.indexOf("/",n+1);return!(i<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===e.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===e.__countryCallingCodeSource)||Bl(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function Au(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var ju=/[\\/] *x/;function Pu(e){return uu(ju,e)}var Mu=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,Tu=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Uu=/^:[0-5]\d/;function _u(e,t,n){if(Mu.test(e))return!1;if(Tu.test(e)){var i=n.slice(t+e.length);if(Uu.test(i))return!1}return!0}var Lu="(\\[([",Wu=")\\])]",Du="[^".concat(Lu).concat(Wu,"]"),Fu="[".concat(Lu).concat(hl,"]"),qu=new RegExp("^"+Fu),Bu=cu(0,3),Vu=new RegExp("^(?:[(\\[([])?(?:"+Du+"+["+Wu+"])?"+Du+"+(?:["+Lu+"]"+Du+"+["+Wu+"])"+Bu+Du+"*$"),Ku=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function Hu(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 Gu(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 Gu(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Gu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function zu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ju=jl(),Zu=["\\/+(.*)/","(\\([^(]*)","(?:".concat(fu,"-|-").concat(fu,")").concat(fu,"*(.+)"),"[‒-―-]".concat(fu,"*(.+)"),"\\.+".concat(fu,"*([^.]+)"),"".concat(fu,"+(").concat(pu,"+)")],Yu=cu(0,2),Xu=cu(0,4),Qu=dl+ll,eh=cu(0,Qu),th="[".concat(ul,"]")+Xu,nh=gu+cu(1,Qu),ih="(?:"+Fu+th+")"+Yu+nh+"(?:"+th+nh+")"+eh+"(?:"+Ju+")?",rh=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(vu,"#]+$")),oh=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,sh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=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&&El(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||oh}).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=i,this.leniency=Ru[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(ih,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new lu(32)}return zu(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(_u(t=Pu(t),n,this.text)){var i=this.parseAndVerify(t,n,this.text)||this.extractInnerMatch(t,n,this.text);if(i){if(this.options.v2)return{startsAt:i.startsAt,endsAt:i.endsAt,number:i.phoneNumber};var r=i.phoneNumber,o={startsAt:i.startsAt,endsAt:i.endsAt,phone:r.nationalNumber};return r.country?o.country=r.country:o.countryCallingCode=r.countryCallingCode,r.ext&&(o.ext=r.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,n){for(var i,r=Hu(Zu);!(i=r()).done;)for(var o=i.value,s=!0,a=void 0,d=new RegExp(o,"g");this.maxTries>0&&null!==(a=d.exec(e));){if(s){var l=uu(rh,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=uu(rh,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,i){if(Vu.test(e)&&!Ku.test(e)){if("POSSIBLE"!==i){if(t>0&&!qu.test(e)){var r=n[t-1];if(xu(r)||Su(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(xu(s)||Su(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=iu(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(i&&i.isPossible())return this.leniency(i,{candidate:e,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+e.length,phoneNumber:i}: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 ah(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var dh=function(){function e(t){var n=t.onCountryChange,i=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=i}return ah(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 i=n[t];this[i]=e[i]}}},{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 lh(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 ch(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 ch(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 ch(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var uh="x",hh=new RegExp(uh);function fh(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function ph(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 i=0,r="";t.push(e.length);for(var o=0,s=t;o<s.length;o++){var a=s[o];r+=e.slice(i,a),i=a+1}return r}(e.slice(0,t))}function gh(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,r(t)){var s=vh(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return vh(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function vh(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=oc(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:r,metadata:i});if(r||(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 mh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var yh=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return mh(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,i=t.instructions;if(n)return{op:"|",args:n.concat([Ch(i)])};if(0===i.length)throw new Error("Pattern is required");return 1===i.length?i[0]:i}},{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(wh);if(t){var n=t[1],i=e.slice(0,t.index),r=e.slice(t.index+n.length);switch(n){case"(?:":i&&this.parsePattern(i),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(i&&this.parsePattern(i),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(Ch(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(i&&this.parsePattern(i),!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(Ch(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":i&&this.parsePattern(i),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:$h(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(bh.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function $h(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 i=e[n-1].charCodeAt(0)+1,r=e[n+1].charCodeAt(0)-1,o=i;o<=r;)t.push(String.fromCharCode(o)),o++}else t.push(e[n]);n++}return t}var bh=/[\(\)\[\]\?\:\|]/,wh=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Ch(e){return 1===e.length?e[0]:e}function kh(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 i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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,i=new Array(t);n<t;n++)i[n]=e[n];return i}function xh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ih=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 yh).parse(t)}return xh(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=Rh(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function Rh(e,t,n){if("string"==typeof t){var i=e.join("");return 0===t.indexOf(i)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===i.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 r=e.slice(),o=0;o<t.length;){var s=Rh(r,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===(r=r.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-r.length)}}switch(t.op){case"|":for(var a,d,l=kh(t.args);!(d=l()).done;){var c=Rh(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=kh(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 Eh(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 Eh(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Eh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Nh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ah=fh("9",15),jh=/[- ]/,Ph=new RegExp("["+ul+"]*\\$1["+ul+"]*(\\$\\d["+ul+"]*)*$"),Mh=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 Nh(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"===zl(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=Oh(this.matchingFormats);!(i=r()).done;){var o=i.value,s=gh(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,uh),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(uh),s}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var n=this.chosenFormat,i=this.chooseFormat(t);if(i)return i===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,n=e.nationalSignificantNumber,i=e.nationalPrefix,r=e.international,o=n,s=o.length-3;s<0&&(s=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,r,i)&&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 i=e.leadingDigitsPatterns().length;if(0===i)return!0;n=Math.min(n,i-1);var r=e.leadingDigitsPatterns()[n];if(t.length<3)try{return void 0!==new Ih(r).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(r,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,n=this,i=function(){var i=t.value;return n.chosenFormat===i?"break":Ph.test(n.getFormatFormat(i,e.international))?n.createTemplateForFormat(i,e)?(n.chosenFormat=i,"break"):(n.matchingFormats=n.matchingFormats.filter((function(e){return e!==i})),"continue"):"continue"},r=Oh(this.matchingFormats.slice());!(t=r()).done;){var o=i();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()&&jh.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var n=e.IDDPrefix,i=e.missingPlus;return n?t&&!1===t.spacing?n:n+" ":i?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,n=0,i=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";n<i.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(uh,t+1),n++;return ph(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,uh)+fh(uh,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var n=t.nationalSignificantNumber,i=t.international,r=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,s=e.pattern();s=s.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var a=Ah.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,i);if(this.shouldTryNationalPrefixFormattingRule(e,{international:i,nationalPrefix:r})){var h=u.replace(rc,e.nationalPrefixFormattingRule());if(Bl(e.nationalPrefixFormattingRule())===(r||"")+Bl("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,uh),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),uh);return c||(o?p=fh(uh,o.length)+" "+p:r&&(p=fh(uh,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=ic(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=lh(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(hh)<0)return;t=e.search(hh),e=e.replace(hh,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],ph(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var n=t.international,i=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var r=e.usesNationalPrefix();if(r&&i||!r&&!n)return!0}}}]),e}();function Th(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 i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Uh(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 Uh(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 Uh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _h(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Lh=new RegExp("^"+("["+ul+cl+"]+")+"$","i"),Wh="(?:[++]["+ul+cl+"]*|["+ul+cl+"]+)",Dh=new RegExp("[^"+ul+cl+"]+.*$"),Fh=/[^\d\[\]]/,qh=function(){function e(t){var n=t.defaultCountry,i=t.defaultCallingCode,r=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=i,this.metadata=r,this.onNationalSignificantNumberChange=o}return _h(e,[{key:"input",value:function(e,t){var n,i=function(e){var t=function(e){var t=function(e){var t,n=e.search(Wh);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(Dh,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=Th(t,2),i=n[0],r=n[1];Lh.test(i)||(i="");return[i,r]}(e),r=Th(i,2),o=r[0],s=r[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,i=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),i&&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,i=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:i}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Fh.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=xc(e,this.metadata),i=n.nationalPrefix,r=n.nationalNumber,o=n.carrierCode;if(r!==e)return this.onExtractedNationalNumber(i,o,r,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var i=xc(e,this.metadata),r=i.nationalPrefix,o=i.nationalNumber,s=i.carrierCode;if(o!==t)return this.onExtractedNationalNumber(r,s,o,e,n),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,n,i,r){var o,s,a=i.lastIndexOf(n);if(a>=0&&a===i.length-n.length){s=!0;var d=i.slice(0,a);d!==e&&(o=d)}r({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,i=e.digits;if(e.nationalSignificantNumber,!t&&!n){var r=Sc(i,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==i?(e.update({IDDPrefix:i.slice(0,i.length-r.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=Rc(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,i=t.callingCode;e.startInternationalNumber(n,i),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 i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Vh(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 Vh(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 Vh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Kh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Hh,Gh=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 wl(n);var i=Bh(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return Kh(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(gl(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 i;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(i=this.formatter.format(n,this.state)),void 0===i&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(i=this.formatter.format(r,this.state))}this.formattedOutput=i?this.getFullNumber(i):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new dh({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 Mh({state:this.state,metadata:this.metadata}),this.parser=new qh({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},i=this.state.callingCode;return n(i?e?"".concat(i," ").concat(e):i:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.complexPrefixBeforeNationalSignificantNumber,i=e.nationalPrefix,r=t,o=n||i;return o&&(r=o+r),r}},{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,uh)}},{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(jc(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,i=e.country,r=e.nationalSignificantNumber;if(t)return this.isInternational()?n?"+"+n+r:"+"+t:i||n?"+"+(i?this.metadata.countryCallingCode():n)+r:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,i=e.callingCode,r=this._getCountry();if(t&&(r||i)){if(r&&r===this.defaultCountry){var o=new wl(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=Ac(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new wc(r||i,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 zh(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Yd),e.apply(this,n)}(iu,arguments)}function Jh(e,t){return sh.call(this,e,t,Yd)}function Zh(e){return Gh.call(this,e,Yd)}function Yh(){return wl.call(this,Yd)}Jh.prototype=Object.create(sh.prototype,{}),Jh.prototype.constructor=Jh,Zh.prototype=Object.create(Gh.prototype,{}),Zh.prototype.constructor=Zh,Yh.prototype=Object.create(wl.prototype,{}),Yh.prototype.constructor=Yh,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"}(Hh||(Hh={}));const Xh=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>{const[r,...o]=n.split(".");return t!==r?Object.assign(e,{[n]:i}):(e[r]||(e[r]={}),e[r][o.join(".")]=i,e)}),{}),Qh=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),ef=(e,t)=>e===Hh.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t,tf={enabled:"active",disabled:"disabled",invited:"invited"},nf=e=>e.tenantRoles.data,rf=e=>e.selectedUsersLoginIds,of=e=>e.notifications,sf=e=>e.customAttributes.data,af=sd(sf,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),df=sd((e=>e.usersList.data),af,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes).map((([e,n])=>[e,ef(t[e],n)])))}))))),lf=sd(df,(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Qh(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:tf[e.status]||e.status,roles:e.roleNames}))))),cf=sd(rf,lf,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),uf=sd(cf,(e=>e.map((e=>e.userId)))),hf=sd(cf,(e=>e.map((e=>e.status)))),ff=sd(cf,(e=>e.every((e=>e.editable)))),pf=sd(rf,(e=>!!e.length)),gf=sd(rf,(e=>1===e.length)),vf=sd(rf,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),mf=sd(gf,hf,((e,t)=>e&&t.every((e=>e===tf.enabled)))),yf=sd(hf,(e=>e.every((e=>e===tf.disabled)))),$f=sd(cf,(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`})),bf=sd(gf,yf,ff,((e,t,n)=>e&&t&&n)),wf=sd(gf,mf,ff,((e,t,n)=>e&&t&&n)),Cf=sd(gf,ff,((e,t)=>e&&t)),kf=sd(gf,ff,((e,t)=>e&&t)),Sf=sd(gf,ff,((e,t)=>e&&t)),xf=pf,If=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)}))}))},Rf=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}}),Of=({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)})}}),Ef=Wd("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Nf=If(Ef)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},Rf((e=>e.createUser)),Of({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>`}})),Af={action:Ef,reducer:Nf},jf=Wd("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Pf=If(jf)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Rf((e=>e.deleteUser)),Of({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Mf={action:jf,reducer:Pf},Tf=Wd("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Uf=If(Tf)(Rf((e=>e.setTempUserPassword)),Of({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>`}})),_f={action:Tf,reducer:Uf},Lf=Wd("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Wf=If(Lf)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Rf((e=>e.customAttributes))),Df={action:Lf,reducer:Wf},Ff=Wd("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),qf=If(Ff)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Rf((e=>e.usersList))),Bf={action:Ff,reducer:qf},Vf=Wd("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Kf=If(Vf)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Rf((e=>e.tenantRoles))),Hf={action:Vf,reducer:Kf},Gf=Wd("users/update",((e,{extra:{api:t}})=>t.user.update(e))),zf=If(Gf)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Hn(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Rf((e=>e.updateUser)),Of({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>`}})),Jf={action:Gf,reducer:zf},Zf=Wd("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Yf=If(Zf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Hn(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==i&&(e.usersList.data[i].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Rf((e=>e.enableUser)),Of({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>`}})),Xf={action:Zf,reducer:Yf},Qf=Wd("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),ep=If(Qf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Hn(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==i&&(e.usersList.data[i].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Rf((e=>e.disableUser)),Of({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>`}})),tp={action:Qf,reducer:ep},np=Wd("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),ip={action:np,reducer:If(np)(Rf((e=>e.removePasskey)),Of({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>`}}))},rp={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:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]},op="/v1/mgmt/user/search",sp="/v1/mgmt/user/delete/batch",ap="/v1/mgmt/user/create",dp="/v1/mgmt/user/update",lp="/v1/mgmt/user/update/status",cp="/v1/mgmt/user/password/set/temporary",up="/v1/mgmt/user/passkeys/delete",hp="/v1/mgmt/user/customattributes",fp="/v1/mgmt/role/all",pp=e=>l(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)})),gp=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u}={}){if(n)return(e=>l(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const i=[],r=(new Date).getTime();for(let e=1;e<10;e+=1)i.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}`,verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:r,createdTimeFormatted:new Date(1e3*(r||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.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()))))}))})))({page:i,limit:r,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u});const h=yield e.post(op,{limit:r,page:i,withTestUser:!1,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u},{queryParams:{tenant:t}});return yield pp(h),(yield h.json()).users})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(sp,{userIds:i},{queryParams:{tenant:t}});return yield pp(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b}){if(n)return(e=>l(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{const f=Math.random().toString(10).substring(15);h({loginIds:[e],externalIds:[e],userId:`user-${f}`,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b});const w=yield e.post(ap,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b},{queryParams:{tenant:t}});return yield pp(w),(yield w.json()).user})),update:i=>l(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v}){if(n)return(e=>l(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{h({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v});const m=yield e.post(dp,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v},{queryParams:{tenant:t}});return yield pp(m),(yield m.json()).user})),enable:i=>l(void 0,void 0,void 0,(function*(){if(n)return(e=>l(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(i);const r=yield e.post(lp,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield pp(r),r.json()})),disable:i=>l(void 0,void 0,void 0,(function*(){if(n)return(e=>l(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(i);const r=yield e.post(lp,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield pp(r),r.json()})),removePasskey:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(up,{loginId:i},{queryParams:{tenant:t}});return yield pp(r),r.json()})),setTempPassword:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(cp,{loginId:i},{queryParams:{tenant:t}});return yield pp(r),r.json()})),getCustomAttributes:()=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const i=yield e.get(hp,{queryParams:{tenant:t}});return yield pp(i),(yield i.json()).data}))}),vp=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>l(void 0,void 0,void 0,(function*(){if(n)return(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})})))(t);const i=yield e.get(fp,{queryParams:{tenant:t}});return yield pp(i),i.json()}))}),mp=Yn((e=>{var t,n,i,r;const o=Vn(Vr,qr,_r,Kr,Zd,Br({tenant:Br.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.7.17"}}));return{user:gp({httpClient:r.httpClient,tenant:t,mock:n}),tenant:vp({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),yp=Yn((e=>{const t=Vn(zd({name:"widget",initialState:rp,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Af.reducer(e),Jf.reducer(e),Xf.reducer(e),tp.reducer(e),Mf.reducer(e),Bf.reducer(e),_f.reducer(e),ip.reducer(e),Df.reducer(e),Hf.reducer(e)},asyncActions:{searchUsers:Bf.action,createUser:Af.action,updateUser:Jf.action,enableUser:Xf.action,disableUser:tp.action,deleteUsers:Mf.action,removePasskey:ip.action,getCustomAttributes:Df.action,getTenantRoles:Hf.action,setTempUserPassword:_f.action}}),Fr,_r,mp)(e);return class extends t{constructor(...e){super(...e),this.state=rp,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),$p=Yn((e=>{const t=Vn(Jr,Br({"widget-id":Br.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),bp=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Fr,oo,lo,$p,yp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Kn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),wp=Yn((e=>{var t,n,i,r,o,s;return s=class extends(Vn(yp,qs,Jd,_r,bp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>l(this,void 0,void 0,(function*(){yield c(this,n,"f").setData(nf(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){return l(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(Kn(yield this.fetchWidgetPage("create-user-modal.html"))),new Es((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)})),new Es((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele);this.actions.createUser(Object.assign(Object.assign({},Xh(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),u(this,n,new js((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),c(this,o,"f").call(this),this.createUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,o,"f").call(this),c(this,t,"m",r).call(this)}))}))},r=function(){const e=sf(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),Cp=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,wp,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},i})),kp=Yn((e=>{var t,n,i;return i=class extends(Vn(yp,qs,_r,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(Kn(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Es((()=>{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 Es((()=>{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=uf(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new Ts(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=$f(this.state);i.text=`Delete ${e}?`}}))},i})),Sp=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp,kp)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),xf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Es(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()}))},r})),xp=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(yp,qs,_r,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{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=vf(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(Kn(yield this.fetchWidgetPage("disable-user-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`Disable ${e}?`}))}))},o})),Ip=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp,xp,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),wf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Es(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()}))},r})),Rp=e=>{if(!e)return e;const t=zh(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},Op=Yn((e=>{var t,n,i,r,o,s,a,h,f,p;return p=class extends(Vn(yp,qs,_r,Jd,bp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),s.set(this,(()=>l(this,void 0,void 0,(function*(){yield c(this,i,"f").setData(nf(this.state).map((({name:e})=>({value:e,label:e}))))})))),h.set(this,(()=>{var e,t;const n=null===(e=cf(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:Rp(null==n?void 0:n.phone),roles:null==n?void 0:n.roles,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},Qh(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",f).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,h=new WeakMap,t=new WeakSet,r=function(){new Es((()=>{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()))},o=function(){new Es((()=>{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:t}=e,n=d(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Xh(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=sf(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},f=function(){return l(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(Kn(yield this.fetchWidgetPage("edit-user-modal.html"))),c(this,t,"m",r).call(this),c(this,t,"m",o).call(this),u(this,n,new Us(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),u(this,i,new js((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,s,"f").call(this),c(this,n,"f").disable(),c(this,h,"f").call(this),c(this,t,"m",a).call(this)}))}))},p})),Ep=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp,Op,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),Cf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Es(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()}))},r})),Np=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(yp,qs,_r,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{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=vf(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(Kn(yield this.fetchWidgetPage("enable-user-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`Activate ${e}?`}))}))},o})),Ap=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp,Np,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),bf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Es(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()}))},r})),jp=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Pp={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},Mp=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(_r,yp,Vs,Fr)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Gn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),of)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Pp[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},o})),Tp=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(yp,qs,_r,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{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=vf(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(Kn(yield this.fetchWidgetPage("remove-passkey-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`Remove passkey for ${e}?`}))}))},o})),Up=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp,Tp,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),kf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Es(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()}))},r})),_p=Yn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Vn(yp,_r,bp)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Gn((e=>{this.usersTable.data=e}))),o.set(this,Zn(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchUsers({sort:n})}))),s.set(this,Gn((e=>{this.usersTable.filterColumns((t=>{var n;const[i,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this),c(this,r,"f").call(this,lf(this.state)),c(this,s,"f").call(this,sf(this.state)),this.subscribe(c(this,s,"f").bind(this),sf),this.subscribe(c(this,r,"f").bind(this),lf)}))}},r=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,n=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:i,header:r,type:o,attrs:s})=>{const a=e(i)||t(o);if(!a)return n({path:i,header:r,type:o,attrs:s});const d=a.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:r});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},i=function(){var e;this.usersTable=new Os(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(c(this,t,"m",a).bind(this)),c(this,t,"m",n).call(this),c(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,o,"f").call(this,e.target,e.detail)}))}))},d})),Lp=Yn((e=>{var t,n,i;return i=class extends(Vn(yp,qs,_r,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(Kn(yield this.fetchWidgetPage("generated-password-modal.html"))),new Es((()=>{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()}))}))},i})),Wp=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(yp,qs,_r,Jd,bp,Lp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){var e;const t=vf(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()}))))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(Kn(yield this.fetchWidgetPage("reset-password-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},o})),Dp=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,bp,yp,Wp,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),Sf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Es(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()}))},r})),Fp=Yn((e=>class extends(Vn(ws,uo,_p,Cp,Sp,Ep,Ap,Ip,Dp,Up,jp,Mp)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),qp=Vn((e=>class extends(Fp(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",qp);var Bp=Object.freeze({__proto__:null,default:qp});const Vp=e=>e.selectedRolesIds,Kp=e=>e.notifications,Hp=e=>e.tenantPermissions.data||[],Gp=sd((e=>e.rolesList.data),(e=>e.map((e=>{var t;return Object.assign(Object.assign({},e),{editable:0===(null===(t=null==e?void 0:e.tenantId)||void 0===t?void 0:t.length)?"no":"yes"})})))),zp=sd(Vp,Gp,((e,t)=>t.filter((t=>e.includes(t.name))))),Jp=sd(Vp,(e=>!!e.length)),Zp=sd(Vp,(e=>1===e.length)),Yp=sd(zp,Zp,((e,t)=>t&&"yes"===e[0].editable)),Xp=sd(zp,(e=>1===e.length?e[0].name:`${e.length} roles`)),Qp=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)}))}))},eg=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}}),tg=({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)})}}),ng=Wd("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),ig=Qp(ng)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},eg((e=>e.createRole)),tg({getSuccessMsg:()=>"Role created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),rg={action:ng,reducer:ig},og=Wd("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),sg=Qp(og)({onFulfilled:(e,t)=>{e.rolesList.data=e.rolesList.data.filter((e=>{var n;return 0===(null===(n=null==e?void 0:e.tenantId)||void 0===n?void 0:n.length)||!t.meta.arg.includes(e.name)})),e.selectedRolesIds=[]}},eg((e=>e.deleteRole)),tg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to delete role${["","s"]}`})),ag={action:og,reducer:sg},dg=Wd("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),lg=Qp(dg)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},eg((e=>e.rolesList))),cg={action:dg,reducer:lg},ug=Wd("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),hg=Qp(ug)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},eg((e=>e.updateRole)),tg({getSuccessMsg:()=>"Role updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),fg={action:ug,reducer:hg},pg=Wd("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),gg={action:pg,reducer:Qp(pg)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},eg((e=>e.tenantPermissions)))},vg={rolesList:{data:[],loading:!1,error:null},createRole:{loading:!1,error:null},updateRole:{loading:!1,error:null},deleteRole:{loading:!1,error:null},tenantPermissions:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedRolesIds:[],notifications:[]},mg="/v1/mgmt/role/search",yg="/v1/mgmt/role/delete/batch",$g="/v1/mgmt/role/create",bg="/v1/mgmt/role/update",wg="/v1/mgmt/permission/all",Cg=e=>l(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)})),kg=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({text:e,sort:t},n){return new Promise((i=>{const r=[];for(let e=1;e<10;e+=1)r.push({name:`Role ${e}`,description:`Role description ${e}`,permissionNames:[`Permission ${e}`],createdTime:new Date,tenantId:n});t.forEach((e=>{r.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),i(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s},t);const a=yield e.post(mg,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield Cg(a),(yield a.json()).roles})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(yg,{roleNames:i},{queryParams:{tenant:t}});return yield Cg(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({name:i,description:r,permissionNames:o}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,description:t,permissionNames:n},i){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:i})}))})))({name:i,description:r,permissionNames:o},t);const s=yield e.post($g,{name:i,description:r,permissionNames:o,tenantId:t},{queryParams:{tenant:t}});return yield Cg(s),yield s.json()})),update:i=>l(void 0,[i],void 0,(function*({name:i,newName:r,description:o,permissionNames:s}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,newName:t,description:n,permissionNames:i},r){return new Promise((o=>{o({name:t,description:n,permissionNames:i,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:i,newName:r,description:o,permissionNames:s},t);const a=yield e.post(bg,{name:i,newName:r,description:o,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Cg(a);const d=yield a.json();return d.oldName=i,d}))}),Sg=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>l(void 0,void 0,void 0,(function*(){if(n)return new Promise((e=>{const t=[];for(let e=1;e<5;e+=1)t.push({name:`Permission ${e}`});e({permissions:t})}));const i=yield e.get(wg,{queryParams:{tenant:t}});return yield Cg(i),i.json()}))}),xg=Yn((e=>{var t,n,i,r;const o=Vn(Vr,qr,_r,Kr,Zd,Br({tenant:Br.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.3.18"}}));return{role:kg({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Sg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),Ig=Yn((e=>{const t=Vn(zd({name:"widget",initialState:vg,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{rg.reducer(e),fg.reducer(e),ag.reducer(e),cg.reducer(e),gg.reducer(e)},asyncActions:{searchRoles:cg.action,createRole:rg.action,updateRole:fg.action,deleteRoles:ag.action,getTenantPermissions:gg.action}}),Fr,_r,xg)(e);return class extends t{constructor(...e){super(...e),this.state=vg,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Rg=Yn((e=>{const t=Vn(Jr,Br({"widget-id":Br.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Og=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Fr,oo,lo,Rg,Ig)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Kn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Eg=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(Ig,qs,Jd,_r,Og)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>l(this,void 0,void 0,(function*(){var e;yield c(this,n,"f").setData(null===(e=Hp(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function(){return l(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(Kn(yield this.fetchWidgetPage("create-role-modal.html"))),new Es((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele)})),new Es((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){this.validateForm(this.createRoleModal.ele)&&(this.actions.createRole(Object.assign({},this.getFormData(this.createRoleModal.ele))),this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele))})))),u(this,n,new js((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),c(this,r,"f").call(this)}))},o})),Ng=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Eg,Og)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},i})),Ag=Yn((e=>{var t,n,i;return i=class extends(Vn(Ig,qs,_r,Og)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(Kn(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Es((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteRolesModal.close()));const n=new Es((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=zp(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new Ts(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Xp(this.state);i.text=`Delete ${e}?`}}))},i})),jg=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Og,Ig,Ag)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Jp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-roles"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteRolesModal.open()}))},r})),Pg=Yn((e=>{var t,n,i,r,o,s,a,h;return h=class extends(Vn(Ig,qs,_r,Jd,Og)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>l(this,void 0,void 0,(function*(){var e;yield c(this,n,"f").setData(null===(e=Hp(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=zp(this.state))||void 0===e?void 0:e[0],n={name:null==t?void 0:t.name,description:null==t?void 0:t.description,permissionNames:null==t?void 0:t.permissionNames};this.setFormData(this.editRoleModal.ele,n)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",a).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,i=function(){new Es((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editRoleModal.close()))},r=function(){new Es((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{var e;if(this.validateForm(this.editRoleModal.ele)){const t=this.getFormData(this.editRoleModal.ele),{name:n}=t,i=d(t,["name"]),r=null===(e=zp(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},i)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return l(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(Kn(yield this.fetchWidgetPage("edit-role-modal.html"))),c(this,t,"m",i).call(this),c(this,t,"m",r).call(this),u(this,n,new js((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),this.editRoleModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,o,"f").call(this),c(this,s,"f").call(this)}))}))},h})),Mg=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Og,Ig,Pg,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Yp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-role"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editRoleModal.open()}))},r})),Tg=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Og,Ig)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Ug={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},_g=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(_r,Ig,Vs,Fr)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Gn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Kp)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Ug[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},o})),Lg=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(Ig,_r,Og)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{this.rolesTable.data=e}))),r.set(this,Zn(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchRoles({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),c(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,r,"f").call(this,e.target,e.detail)}))})),c(this,i,"f").call(this,Gp(this.state)),this.subscribe(c(this,i,"f").bind(this),Gp)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="roles-table"]'),{logger:this.logger}),this.rolesTable.onSelectedItemsChange((e=>{this.actions.setSelectedRolesIds(e.detail.value.map((({name:e})=>e)))}))},o})),Wg=Yn((e=>class extends(Vn(ws,uo,Lg,Ng,jg,Mg,Tg,_g)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Dg=Vn((e=>class extends(Wg(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Dg);var Fg=Object.freeze({__proto__:null,default:Dg});const qg=e=>e.selectedAccessKeysIds,Bg=e=>e.notifications,Vg=sd((e=>e.accessKeysList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{expireTimeFormatted:(null==e?void 0:e.expireTime)?new Date(1e3*((null==e?void 0:e.expireTime)||0)).toLocaleString():"Never",createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:(null==e?void 0:e.expireTime)&&new Date(1e3*((null==e?void 0:e.expireTime)||0))<new Date?"expired":null==e?void 0:e.status}))))),Kg=sd(qg,Vg,((e,t)=>t.filter((t=>e.includes(t.id))))),Hg=sd(qg,(e=>!!e.length)),Gg=sd(Kg,(e=>e.every((e=>e.editable)))),zg=sd(Gg,Hg,((e,t)=>e&&t));sd(qg,(e=>1===e.length));const Jg=sd(Kg,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Zg=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)}))}))},Yg=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}}),Xg=({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)})}}),Qg=Wd("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),ev=Zg(Qg)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},Yg((e=>e.createAccessKey)),Xg({getSuccessMsg:()=>"Access Key created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create access key</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),tv={action:Qg,reducer:ev},nv=Wd("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),iv=Zg(nv)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},Yg((e=>e.deleteAccessKey)),Xg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),rv={action:nv,reducer:iv},ov=Wd("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),sv=Zg(ov)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},Yg((e=>e.accessKeysList))),av={action:ov,reducer:sv},dv=Wd("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),lv=Zg(dv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},Yg((e=>e.activateAccessKey)),Xg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),cv={action:dv,reducer:lv},uv=Wd("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),hv=Zg(uv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},Yg((e=>e.deactivateAccessKey)),Xg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),fv={action:uv,reducer:hv},pv=Wd("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),gv={action:pv,reducer:Zg(pv)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Yg((e=>e.tenantRoles)))},vv={accessKeysList:{data:[],loading:!1,error:null},createAccessKey:{loading:!1,error:null},activateAccessKey:{loading:!1,error:null},deactivateAccessKey:{loading:!1,error:null},deleteAccessKey:{loading:!1,error:null},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedAccessKeysIds:[],notifications:[]},mv="/v1/mgmt/accesskey/search",yv="/v1/mgmt/accesskey/delete/batch",$v="/v1/mgmt/accesskey/create",bv="/v1/mgmt/accesskey/deactivate/batch",wv="/v1/mgmt/accesskey/activate/batch",Cv="/v1/mgmt/role/all",kv=e=>l(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)})),Sv=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((...e)=>l(void 0,[...e],void 0,(function*({text:e,sort:t}={}){return new Promise((n=>{const i=[],r=(new Date).getTime()/1e3+2592e3,o=new Date(r).toLocaleString();for(let e=1;e<10;e+=1)i.push({id:`access-key-id-${e}`,name:`Access Key ${e}`,createdBy:`User ${e}`,editable:!0,expireTime:r,expireTimeFormatted:o,createdTime:r,createdTimeFormatted:o,roleNames:[`Role ${e}`],permittedIps:["127.1.2.3"],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s});const a=yield e.post(mv,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield kv(a),(yield a.json()).keys})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(yv,{ids:i},{queryParams:{tenant:t}});return yield kv(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({name:i,expiration:r,roleNames:o,userId:s,permittedIps:a}){const d=new Date;d.setDate(d.getDate()+ +r);const c="0"===r[0]?0:Math.floor(d.getTime()/1e3);if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,roleNames:t,userId:n,permittedIps:i},r){const o=Math.random().toString(10).substring(15);return new Promise((s=>{s({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${o}`,name:e||`Access Key ${o}`,createdBy:n||`User ${o}`,editable:!0,expireTime:r,createdTime:(new Date).getTime()/1e3,roleNames:t,permittedIps:i,status:"active",clientId:`Client ID ${o}`,boundUserId:n||`User ${o}`}})}))})))({name:i,expiration:r,roleNames:o,userId:s,permittedIps:a},c);const u=yield e.post($v,{name:i,expireTime:c,roleNames:o,userId:s,permittedIps:a},{queryParams:{tenant:t}});return yield kv(u),yield u.json()})),activate:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(wv,{ids:i},{queryParams:{tenant:t}});return yield kv(r),yield r.json()})),deactivate:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(bv,{ids:i},{queryParams:{tenant:t}});return yield kv(r),yield r.json()}))}),xv=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>l(void 0,void 0,void 0,(function*(){if(n)return(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})})))(t);const i=yield e.get(Cv,{queryParams:{tenant:t}});return yield kv(i),i.json()}))}),Iv=Yn((e=>{var t,n,i,r;const o=Vn(Vr,qr,_r,Kr,Zd,Br({tenant:Br.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.17"}}));return{accesskey:Sv({httpClient:r.httpClient,tenant:t,mock:n}),tenant:xv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),Rv=Yn((e=>{const t=Vn(zd({name:"widget",initialState:vv,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{tv.reducer(e),rv.reducer(e),av.reducer(e),cv.reducer(e),fv.reducer(e),gv.reducer(e)},asyncActions:{searchAccessKeys:av.action,createAccessKey:tv.action,activateAccessKeys:cv.action,deactivateAccessKeys:fv.action,deleteAccessKeys:rv.action,getTenantRoles:gv.action}}),Fr,_r,Iv)(e);return class extends t{constructor(...e){super(...e),this.state=vv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Ov=Yn((e=>{const t=Vn(Jr,Br({"widget-id":Br.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Ev=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Fr,oo,lo,Ov,Rv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Kn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Nv=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(Rv,_r,Ev)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{this.accessKeysTable.data=e}))),r.set(this,Zn(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchAccessKeys({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),c(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,r,"f").call(this,e.target,e.detail)}))})),c(this,i,"f").call(this,Vg(this.state)),this.subscribe(c(this,i,"f").bind(this),Vg)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="access-keys-table"]'),{logger:this.logger}),this.accessKeysTable.onSelectedItemsChange((e=>{this.actions.setSelectedAccessKeysIds(e.detail.value.map((({id:e})=>e)))}))},o})),Av=Yn((e=>{var t,n,i;return i=class extends(Vn(Rv,qs,_r,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(Kn(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Es((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.activateAccessKeysModal.close()));const n=new Es((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Kg(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new Ts(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Jg(this.state);i.text=`Activate ${e}?`}}))},i})),jv=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Ev,Rv,Av)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),zg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="activate-access-keys"]'),{logger:this.logger}),this.activateButton.disable(),this.activateButton.onClick((()=>{this.activateAccessKeysModal.open()}))},r})),Pv=Yn((e=>{var t,n,i;return i=class extends(Vn(Rv,qs,Jd,_r,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(Kn(yield this.fetchWidgetPage("created-access-key-modal.html"))),new Es((()=>{var e;return null===(e=this.createdAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.createdAccessKeyModal.ele)["generated-key"]),this.resetFormData(this.createdAccessKeyModal.ele),this.createdAccessKeyModal.close()}))}))},i})),Mv=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(Rv,qs,Jd,_r,Ev,Pv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>l(this,void 0,void 0,(function*(){var e,t;yield c(this,n,"f").setData(null===(t=this.state,e=t.tenantRoles.data||[])||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function e(){return l(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(Kn(yield this.fetchWidgetPage("create-access-key-modal.html"))),new Es((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)})),new Es((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){var e,t;if(this.validateForm(this.createAccessKeyModal.ele)){const n=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),(null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext)&&(this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(t=null==n?void 0:n.payload)||void 0===t?void 0:t.cleartext}),this.createdAccessKeyModal.open())}})))),u(this,n,new js((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),c(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{c(this,t,"m",e).call(this)}}))},o})),Tv=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Mv,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-access-key"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createAccessKeyModal.open()))},i})),Uv=Yn((e=>{var t,n,i;return i=class extends(Vn(Rv,qs,_r,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(Kn(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Es((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deactivateAccessKeysModal.close()));const n=new Es((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Kg(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new Ts(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Jg(this.state);i.text=`Deactivate ${e}?`}}))},i})),_v=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Ev,Rv,Uv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),zg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="deactivate-access-keys"]'),{logger:this.logger}),this.deactivateButton.disable(),this.deactivateButton.onClick((()=>{this.deactivateAccessKeysModal.open()}))},r})),Lv=Yn((e=>{var t,n,i;return i=class extends(Vn(Rv,qs,_r,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(Kn(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Es((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteAccessKeysModal.close()));const n=new Es((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Kg(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new Ts(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Jg(this.state);i.text=`Delete ${e}?`}}))},i})),Wv=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Ev,Rv,Lv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),zg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-access-keys"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteAccessKeysModal.open()}))},r})),Dv=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Ev,Rv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Fv={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},qv=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(_r,Rv,Vs,Fr)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Gn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Bg)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Fv[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},o})),Bv=Yn((e=>class extends(Vn(ws,uo,Nv,Tv,Wv,Dv,jv,_v,qv)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Vv=Vn((e=>class extends(Bv(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Vv);var Kv=Object.freeze({__proto__:null,default:Vv});const Hv=(e,t)=>t?{[e]:t}:{},Gv=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},zv=e=>e.selectedAuditId,Jv=sd((e=>e.auditList.data),(e=>e.map((e=>{const t=e||{},{occurred:n,ID:i,type:r}=t,o=t.data,s=void 0===o?{saml_request:"",saml_response:"",saml_generated_user:"",saml_generated_roles:"",oidc_response:"",oidc_generated_user:""}:o,{saml_request:a,saml_response:l,saml_generated_user:c,saml_generated_roles:u,oidc_response:h,oidc_generated_user:f}=s,p=d(s,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user"]),g=d(t,["occurred","ID","type","data"]);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:p}),Hv("type",(v=r)&&v[0].toUpperCase()+v.slice(1))),Hv("saml_request",a)),Hv("saml_response",l)),Hv("saml_generated_user",Gv(c))),Hv("saml_generated_roles",Gv(u))),Hv("oidc_response",Gv(h))),Hv("oidc_generated_user",Gv(f))),{occurredFormatted:n?new Date(Number(n)||0).toLocaleString():"N/A"});var v}))));sd(zv,Jv,((e,t)=>t.find((t=>e===t.id)))),sd(zv,(e=>!!e));const Zv=Wd("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),Yv=(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)}))}))})(Zv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Xv=e=>e.auditList,{onFulfilled:e=>{Xv(e).loading=!1},onPending:e=>{Xv(e).loading=!0,Xv(e).error=null},onRejected:(e,t)=>{Xv(e).loading=!1,Xv(e).error=t.error}}));var Xv;const Qv={action:Zv,reducer:Yv},em={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},tm="/v1/mgmt/audit/search",nm=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s,from:a}={}){if(n)return(e=>l(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const i=[],r=(new Date).getTime()/1e3+2592e3,o=new Date(r).toLocaleString();for(let e=1;e<9;e+=1)i.push({id:`Audit ${e}`,action:`Action ${e}`,actorId:`Actor ${e}`,type:"info",method:`Method ${e}`,userId:`User ${e}`,device:`Device ${e}`,geo:`Geo ${e}`,remoteAddress:`127.0.0.${e}`,externalIds:[`Login ID ${e}`],occurred:r,occurredFormatted:o});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.filter((t=>t.id.toLowerCase().includes(e.toLowerCase())||t.action.toLowerCase().includes(e.toLowerCase())||t.type.toLowerCase().includes(e.toLowerCase())||t.device.toLowerCase().includes(e.toLowerCase())||t.method.toLowerCase().includes(e.toLowerCase())||t.geo.toLowerCase().includes(e.toLowerCase())||t.remoteAddress.toLowerCase().includes(e.toLowerCase())||t.externalIds.includes(e.toLowerCase())||t.userId.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s});const d=yield e.post(tm,{limit:r,page:i,text:o,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>l(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)})))(d),(yield d.json()).audits}))}),im=Yn((e=>{var t,n,i,r;const o=Vn(Vr,qr,_r,Kr,Zd,Br({tenant:Br.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.17"}}));return{audit:nm({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),rm=Yn((e=>{const t=Vn(zd({name:"widget",initialState:em,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Qv.reducer(e)},asyncActions:{searchAudit:Qv.action}}),Fr,_r,im)(e);return class extends t{constructor(...e){super(...e),this.state=em,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),om=Yn((e=>{const t=Vn(Jr,Br({"widget-id":Br.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),sm=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Fr,oo,lo,om,rm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Kn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),am=Yn((e=>{var t,n,i,r,o;return o=class extends(Vn(_r,sm,rm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{const e=this.rangeInput.value,t=new Date;let n;switch(e){case"minuets15":n=t.setMinutes(t.getMinutes()-15);break;case"hour":n=t.setHours(t.getHours()-1);break;case"hour6":n=t.setHours(t.getHours()-6);break;case"day":default:n=t.setDate(t.getDate()-1);break;case"day3":n=t.setDate(t.getDate()-3);break;case"week":n=t.setDate(t.getDate()-7);break;case"week2":n=t.setDate(t.getDate()-14);break;case"month":n=t.setMonth(t.getMonth()-1)}this.actions.searchAudit({text:this.searchInput.value,from:Math.floor(new Date(n).getTime())})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this),c(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f")),c(this,n,"f").call(this)},r=function(){var e;this.rangeInput=new Ps(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(c(this,n,"f"))},o})),dm=Yn((e=>{var t,n,i,r;return r=class extends(Vn(rm,_r,sm)(e)){constructor(){super(...arguments),t.add(this),i.set(this,Gn((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),c(this,i,"f").call(this,Jv(this.state)),this.subscribe(c(this,i,"f").bind(this),Jv)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="audit-table"]'),{logger:this.logger}),this.auditTable.onSelectedItemsChange((e=>{this.actions.setSelectedAuditId(e.detail.value.map((({id:e})=>e)))}))},r})),lm=Yn((e=>class extends(Vn(ws,uo,dm,am)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),cm=Vn((e=>class extends(lm(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",cm);var um=Object.freeze({__proto__:null,default:cm});const hm=(e={})=>{const t=Kn("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(zn(e),n)})),t};function fm(e){return new URLSearchParams(window.location.search).get(e)}const pm=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)}))}))},gm=Wd("users/me",((e,{extra:{api:t}})=>t.user.me())),vm=pm(gm)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(mm=e=>e.me,{onFulfilled:e=>{mm(e).loading=!1},onPending:e=>{mm(e).loading=!0,mm(e).error=null},onRejected:(e,t)=>{mm(e).loading=!1,mm(e).error=t.error}}));var mm;const ym={action:gm,reducer:vm},$m=Wd("users/logout",((e,{extra:{api:t}})=>t.user.logout())),bm={action:$m,reducer:pm($m)({})},wm={me:{loading:!1,error:null,data:{}}},Cm="/v1/auth/me",km=({httpClient:e,mock:t})=>({me:()=>l(void 0,void 0,void 0,(function*(){if(t)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))}));const n=yield e.get(Cm);return yield(e=>l(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)})))(n),n.json()}))}),Sm=Yn((e=>{var t,n,i,r;const o=Vn(Vr,qr,_r,Kr,Zd)(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n)=>{const i=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.4.20"}}));return{user:Object.assign(Object.assign({},km({httpClient:i.httpClient,mock:t})),{logout:t?()=>l(void 0,void 0,void 0,(function*(){})):i.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),xm=Yn((e=>{const t=Vn(zd({name:"widget",initialState:wm,reducers:{},extraReducers:e=>{ym.reducer(e),bm.reducer(e)},asyncActions:{getMe:ym.action,logout:bm.action}}),Fr,_r,Sm)(e);return class extends t{constructor(...e){super(...e),this.state=wm,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Im="widget-flow",Rm=Yn((e=>{var t,n,i;return i=class extends(Vn(Fr,qs,xm,Zd,_r,uo)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=fm(Im);r&&(function(e){if(window.history.replaceState&&fm(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())}}(Im),c(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(hm({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),new Ds((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},i})),Om=e=>e.me.data,Em=sd(Om,(e=>e.picture)),Nm=sd(Om,(e=>e.email)),Am=sd(Om,(e=>e.verifiedEmail)),jm=sd(Om,(e=>e.name)),Pm=sd(Om,(e=>e.phone)),Mm=sd(Om,(e=>e.verifiedPhone)),Tm=sd(Om,(e=>e.webauthn));sd(Om,(e=>e.password));const Um=sd(Om,(e=>e.TOTP)),_m=sd(Om,(e=>e.customAttributes)),Lm=Yn((e=>{const t=Vn(Jr,Br({"widget-id":Br.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Wm=Yn((e=>{var t,n,i;return i=class extends(Vn(_r,Fr,oo,lo,Lm,xm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),c(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Kn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Dm=Yn((e=>class extends(Vn(uo,qr)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),Fm=Yn((e=>{var t,n,i,r,o,s,a,d,h;return h=class extends(Vn(Dm,uo,xm,_r,Zd,Wm,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,Gn((e=>{this.avatar.image=e}))),d.set(this,Gn((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Em(this.state)),c(this,d,"f").call(this,jm(this.state)),this.subscribe(c(this,a,"f").bind(this),Em),this.subscribe(c(this,d,"f").bind(this),jm)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){this.avatar.flowId&&(u(this,n,this.createModal({"data-id":"update-pic"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new _s((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},h})),qm=Yn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g,v;return v=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,Gn((e=>{this.emailUserAttr.value=e}))),g.set(this,Gn((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,Nm(this.state)),c(this,g,"f").call(this,Am(this.state)),this.subscribe(c(this,p,"f").bind(this),Nm),this.subscribe(c(this,g,"f").bind(this),Am)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){this.emailUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-email"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.emailUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-email"}),"f"),u(this,o,new Ds((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(hm({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr=new Ls((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},v})),Bm=Yn((e=>{var t,n,i;return i=class extends(Vn(xm,_r,Wm,qs)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Es((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>l(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},i})),Vm=Yn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g;return g=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,Gn((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,jm(this.state)),this.subscribe(c(this,p,"f").bind(this),jm)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.nameUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-name"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.nameUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-name"}),"f"),u(this,o,new Ds((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(hm({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr=new Ls((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},g})),Km=Yn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,Gn((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Tm(this.state)),this.subscribe(c(this,a,"f").bind(this),Tm)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.passkeyUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"passkey"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new Ws((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},d})),Hm=Yn((e=>{var t,n,i,r,o,s;return s=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new Ws((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.initPasswordAuthMethod(),c(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.passwordUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"password"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close()}))},s})),Gm=Yn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g,v;return v=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,Gn((e=>{this.phoneUserAttr.value=e}))),g.set(this,Gn((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,Pm(this.state)),c(this,g,"f").call(this,Mm(this.state)),this.subscribe(c(this,p,"f").bind(this),Pm),this.subscribe(c(this,g,"f").bind(this),Mm)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){this.phoneUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-phone"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.phoneUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-phone"}),"f"),u(this,o,new Ds((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(hm({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr=new Ls((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},v}));var zm;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(zm||(zm={}));const Jm=Yn((e=>{var t,n,i,r,o,s,a,d,u,h,f;return n=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),i.set(this,{}),r.set(this,{}),o.set(this,{}),s.set(this,{}),u.set(this,Gn((e=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||zm.TEXT,s=e[r],a=new Ls(i,{logger:this.logger});a.value=n.getFormattedValue(o,s),c(this,t,"m",h).call(this,i,r,a),c(this,t,"m",f).call(this,i,r,a)}))})))}static getFormattedValue(e,t){return e===zm.DATE&&t?new Date(t).toLocaleString():e===zm.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),c(this,u,"f").call(this,_m(this.state)),this.subscribe(c(this,u,"f").bind(this),_m)}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,u=new WeakMap,t=new WeakSet,a=function(e){var t,n;null===(t=c(this,i,"f")[e])||void 0===t||t.setContent(hm({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(n=c(this,r,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=c(this,i,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},d=function(e){var t,n;null===(t=c(this,o,"f")[e])||void 0===t||t.setContent(hm({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(n=c(this,s,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=c(this,o,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},h=function(e,n,o){const s=e.getAttribute("edit-flow-id");s&&(c(this,i,"f")[s]=this.createModal({"data-id":`edit-${n}`}),c(this,r,"f")[s]=new Ds((()=>{var e,t;return null===(t=null===(e=c(this,i,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),c(this,i,"f")[s].afterClose=c(this,t,"m",a).bind(this,s),o.onEditClick((()=>{var e,t;null===(t=null===(e=c(this,i,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),c(this,t,"m",a).call(this,s),this.syncFlowTheme(c(this,r,"f")[s]))},f=function(e,n,i){const r=e.getAttribute("delete-flow-id");r&&(c(this,o,"f")[r]=this.createModal({"data-id":`delete-${n}`}),c(this,s,"f")[r]=new Ds((()=>{var e,t;return null===(t=null===(e=c(this,o,"f")[r])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),c(this,o,"f")[r].afterClose=c(this,t,"m",d).bind(this,r),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=c(this,o,"f"))||void 0===e?void 0:e[r])||void 0===t||t.open()})),c(this,t,"m",d).call(this,r),this.syncFlowTheme(c(this,s,"f")[r]))},n})),Zm=Yn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Vn(Dm,xm,_r,Wm,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,Gn((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Um(this.state)),this.subscribe(c(this,a,"f").bind(this),Um)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.totpUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"totp"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.totpUserAuthMethod=new Ws((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},d})),Ym=Yn((e=>class extends(Vn(ws,uo,Rm,Jm,qm,Fm,Vm,Gm,Km,Hm,Hm,Zm,Bm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Xm=Vn((e=>class extends(Ym(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(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 bs})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.4.20"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Xm);var Qm,ey=Object.freeze({__proto__:null,default:Xm});!function(e){e.oidc="oidc",e.saml="saml"}(Qm||(Qm={}));const ty=sd((e=>e.ssoAppsList.data),(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===Qm.saml))})),ny=sd(ty,(e=>e.map((e=>({name:e.name,icon:e.logo,url:e.samlSettings.idpInitiatedUrl}))))),iy=Wd("ssoApps/load",((e,{extra:{api:t}})=>t.ssoApps.load())),ry=(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)}))}))})(iy)({onFulfilled:(e,t)=>{var n;e.ssoAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},(oy=e=>e.ssoAppsList,{onFulfilled:e=>{oy(e).loading=!1},onPending:e=>{oy(e).loading=!0,oy(e).error=null},onRejected:(e,t)=>{oy(e).loading=!1,oy(e).error=t.error}}));var oy;const sy={action:iy,reducer:ry},ay={ssoAppsList:{data:[],loading:!1,error:null}},dy="/v1/mgmt/sso/idp/apps/load",ly=({httpClient:e,mock:t})=>({load:()=>l(void 0,void 0,void 0,(function*(){if(t)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:[{id:"ssoapp1",name:"App 1",description:"This is the first SAML app",enabled:!0,appType:Qm.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:Qm.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:Qm.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}}]})}))}));const n=yield e.get(dy);return yield(e=>l(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)})))(n),n.json()}))}),cy=Yn((e=>{var t,n,i,r;const o=Vn(Vr,qr,_r,Zd,Kr)(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n)=>{const i=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"applications-portal-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.3.17"}}));return{ssoApps:ly({httpClient:i.httpClient,mock:t})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),uy=Yn((e=>{const t=Vn(zd({name:"widget",initialState:ay,reducers:{},extraReducers:e=>{sy.reducer(e)},asyncActions:{loadSSOApps:sy.action}}),Fr,_r,cy)(e);return class extends t{constructor(...e){super(...e),this.state=ay,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),hy=Yn((e=>{const t=Vn(Jr,Br({"widget-id":Br.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${e}`,"text")).body}))}}})),fy=Yn((e=>{var t,n,i,r;return r=class extends(Vn(_r,Fr,oo,lo,hy,uy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this);const[o]=yield Promise.all([c(this,t,"m",n).call(this),this.actions.loadSSOApps()]);c(this,t,"m",i).call(this,o),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Kn(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r})),py=Yn((e=>{var t,n,i;return i=class extends(Vn(uy,_r,fy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this,ny(this.state))}))}},t=new WeakSet,n=function(e){this.appsList=new Fs((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=e},i})),gy=Yn((e=>class extends(Vn(ws,uo,py)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),vy=Vn((e=>class extends(gy(e)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",vy);var my=Object.freeze({__proto__:null,default:vy});const yy=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===i.top?e.offsetHeight:null!==(s=i.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===i.bottom?e.offsetHeight:null!==(a=i.bottom)&&void 0!==a?a:0))]};var $y,by,wy,Cy,ky,Sy,xy,Iy,Ry,Oy,Ey;const Ny=document.createElement("template");Ny.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';class Ay extends HTMLElement{constructor(){super(),$y.add(this),by.set(this,new Cr({messages:[]})),wy.set(this,void 0),Cy.set(this,void 0),ky.set(this,void 0),Sy.set(this,{resize:c(this,$y,"m",Ey).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ny.content.cloneNode(!0)),u(this,wy,this.shadowRoot.querySelector(".debugger"),"f"),u(this,Cy,c(this,wy,"f").querySelector(".content"),"f"),u(this,ky,c(this,wy,"f").querySelector(".header"),"f"),c(this,$y,"m",xy).call(this)}updateData(e){c(this,by,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=yy(e,e.offsetLeft-i,e.offsetTop-r,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})(c(this,wy,"f"),c(this,ky,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",c(this,Sy,"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}})(c(this,wy,"f")),c(this,wy,"f").onresize=c(this,$y,"m",Oy).bind(this),c(this,by,"f").subscribe(c(this,$y,"m",Iy).bind(this))}disconnectedCallback(){c(this,by,"f").unsubscribeAll(),window.removeEventListener("resize",c(this,Sy,"f").resize)}}by=new WeakMap,wy=new WeakMap,Cy=new WeakMap,ky=new WeakMap,Sy=new WeakMap,$y=new WeakSet,xy=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync('\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'),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n],c(this,wy,"f").style.top="32px",c(this,wy,"f").style.left=window.innerWidth-300-32+"px"},Iy=function(e){c(this,$y,"m",Ry).call(this,e),c(this,$y,"m",Oy).call(this)},Ry=function(e){c(this,Cy,"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("")},Oy=function(){c(this,Cy,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,i=t.clientHeight>20;n||i?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},Ey=function(){const[e,t]=yy(c(this,wy,"f"),Number.parseInt(c(this,wy,"f").style.left,10),Number.parseInt(c(this,wy,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});c(this,wy,"f").style.top=`${t}px`,c(this,wy,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Ay);var jy=Object.freeze({__proto__:null,default:Ay});var Py=Object.freeze({__proto__:null,default:(e,t,n)=>l(void 0,void 0,void 0,(function*(){const{siteId:t}=e,i='\n(function () {\nvar merchantConfig = {\n csp: false\n};\n\nvar siteId = "{{SITE_ID}}";\nfunction t(t,n){for(var e=t.split(""),r=0;r<e.length;++r)e[r]=String.fromCharCode(e[r].charCodeAt(0)+n);return e.join("")}function n(n){return t(n,-L).replace(/%SN%/g,siteId)}function e(){var t="no"+"op"+"fn",n="g"+"a",e="n"+"ame";return window[n]&&window[n][e]===t}function r(){return!(!navigator.brave||"function"!=typeof navigator.brave.isBrave)}function o(){return document.currentScript&&document.currentScript.src}function i(t){try{if("number"==typeof t&&window.location&&window.location.pathname){for(var n=window.location.pathname.split("/"),e=[],r=0;r<=Math.min(n.length-1,Math.abs(t));r++)e.push(n[r]);return e.join("/")||"/"}}catch(t){}return"/"}function c(t){try{G.ex=t,e()&&-1===G.ex.indexOf(B.uB)&&(G.ex+=B.uB),r()&&-1===G.ex.indexOf(B.uBr)&&(G.ex+=B.uBr),o()&&-1===G.ex.indexOf(B.nIL)&&(G.ex+=B.nIL),window.ftr__snp_cwc||(G.ex+=B.s),M(G)}catch(t){}}function a(t,n){function e(o){try{o.blockedURI===t&&(n(),document.removeEventListener(r,e))}catch(t){document.removeEventListener(r,e)}}var r="securitypolicyviolation";document.addEventListener(r,e),setTimeout(function(){document.removeEventListener(r,e)},2*60*1e3)}function u(t,n,e,r){var o=!1;t="https://"+t,a(t,function(){r(!0),o=!0});var i=document.createElement("script");i.onerror=function(){if(!o)try{r(!1),o=!0}catch(t){}},i.onload=e,i.type="text/javascript",i.id="ftr__script",i.async=!0,i.src=t;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(i,c)}function f(){J(B.uDF),setTimeout(h,I,B.uDF)}function d(t,n,e,r){var o=!1,i=new XMLHttpRequest;if(a("https:"+t,function(){e(new Error("CSP Violation"),!0),o=!0}),"//"===t.slice(0,2)&&(t="https:"+t),"withCredentials"in i)i.open("GET",t,!0);else{if("undefined"==typeof XDomainRequest)return;i=new XDomainRequest,i.open("GET",t)}Object.keys(r).forEach(function(t){i.setRequestHeader(t,r[t])}),i.onload=function(){"function"==typeof n&&n(i)},i.onerror=function(t){if("function"==typeof e&&!o)try{e(t,!1),o=!0}catch(t){}},i.onprogress=function(){},i.ontimeout=function(){"function"==typeof e&&e("tim"+"eo"+"ut",!1)},setTimeout(function(){i.send()},0)}function s(t,siteId,n){function e(t){var n=t.toString(16);return n.length%2?"0"+n:n}function r(t){if(t<=0)return"";for(var n="0123456789abcdef",e="",r=0;r<t;r++)e+=n[Math.floor(Math.random()*n.length)];return e}function o(t){for(var n="",r=0;r<t.length;r++)n+=e(t.charCodeAt(r));return n}function i(t){for(var n=t.split(""),e=0;e<n.length;++e)n[e]=String.fromCharCode(255^n[e].charCodeAt(0));return n.join("")}n=n?"1":"0";var c=[];return c.push(t),c.push(siteId),c.push(n),function(t){var n=40,e="";return t.length<n/2&&(e=","+r(n/2-t.length-1)),o(i(t+e))}(c.join(","))}function w(){function t(){D&&(J(B.dUAL),setTimeout(h,I,B.dUAL))}function n(t,n){c(n?B.uAS+B.uF+B.cP:B.uAS+B.uF)}window.ftr__fdad(t,n)}function h(t){try{var n;switch(t){case B.uFP:n=q;break;case B.uDF:n=E;break;default:n=D}if(!n)return;u(n,void 0,function(){try{K(),c(t+B.uS)}catch(t){}},function(n){try{K(),G.td=1*new Date-G.ts,c(n?t+B.uF+B.cP:t+B.uF),t===B.uFP&&f(),t===B.uDF&&w()}catch(t){c(B.eUoe)}})}catch(n){c(t+B.eTlu)}}var m="22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv",v="fort",l="erTo",p="ken";window.ftr__config={m:merchantConfig,s:"23",si:siteId};var g=!1,_=v+l+p,y=400*24*60,T=10,k={write:function(t,n,e,r){void 0===r&&(r=!0);var o=0;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.ckDepth&&(o=window.ftr__config.m.ckDepth);var c,a,u=i(o);if(e?(c=new Date,c.setTime(c.getTime()+60*e*1e3),a="; expires="+c.toGMTString()):a="",!r)return void(document.cookie=escape(t)+"="+escape(n)+a+"; path="+u);for(var f=1,d=document.domain.split("."),s=T,w=!0;w&&d.length>=f&&s>0;){var h=d.slice(-f).join(".");document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h;var m=k.read(t);null!=m&&m==n||(h="."+h,document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h),w=-1===document.cookie.indexOf(t+"="+n),f++,s--}},read:function(t){var n=null;try{for(var e=escape(t)+"=",r=document.cookie.split(";"),o=32,i=0;i<r.length;i++){for(var c=r[i];c.charCodeAt(0)===o;)c=c.substring(1,c.length);0===c.indexOf(e)&&(n=unescape(c.substring(e.length,c.length)))}}finally{return n}}},S=window.ftr__config.s;S+="ck";var x=function(t){var n=!1,e=null,r=function(){try{if(!e||!n)return;e.remove&&"function"==typeof e.remove?e.remove():document.head.removeChild(e),n=!1}catch(t){}};document.head&&(!function(){e=document.createElement("link"),e.setAttribute("rel","pre"+"con"+"nect"),e.setAttribute("cros"+"sori"+"gin","anonymous"),e.onload=r,e.onerror=r,e.setAttribute("href",t),document.head.appendChild(e),n=!0}(),setTimeout(r,3e3))},L=3,A=n(m||"22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv"),F=t("[0Uhtxhvw0LG",-L),U=t("[0Fruuhodwlrq0LG",-L),b=t("Li0Qrqh0Pdwfk",-L),D,C="fgq71iruwhu1frp",E=n("(VQ(1"+C+"2vq2(VQ(2vfulsw1mv"),V=n("(VQ(1"+C+"2vqV2(VQ(2vfulsw1mv"),q;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.fpi&&(q=window.ftr__config.m.fpi+n("2vq2(VQ(2vfulsw1mv"));var I=10;window.ftr__startScriptLoad=1*new Date;var R=function(t){var n="ft"+"r:tok"+"enR"+"eady";window.ftr__tt&&clearTimeout(window.ftr__tt),window.ftr__tt=setTimeout(function(){try{delete window.ftr__tt,t+="_tt";var e=document.createEvent("Event");e.initEvent(n,!1,!1),e.detail=t,document.dispatchEvent(e)}catch(t){}},1e3)},M=function(t){var n=function(t){return t||""},e=n(t.id)+"_"+n(t.ts)+"_"+n(t.td)+"_"+n(t.ex)+"_"+n(S),r=y;!isNaN(window.ftr__config.m.ckTTL)&&window.ftr__config.m.ckTTL&&(r=window.ftr__config.m.ckTTL),k.write(_,e,r,!0),R(e),window.ftr__gt=e},P=function(){var t=k.read(_)||"",n=t.split("_"),e=function(t){return n[t]||void 0};return{id:e(0),ts:e(1),td:e(2),ex:e(3),vr:e(4)}},j=function(){for(var t={},n="fgu",e=[],r=0;r<256;r++)e[r]=(r<16?"0":"")+r.toString(16);var o=function(t,n,r,o,i){var c=i?"-":"";return e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+c+e[255&n]+e[n>>8&255]+c+e[n>>16&15|64]+e[n>>24&255]+c+e[63&r|128]+e[r>>8&255]+c+e[r>>16&255]+e[r>>24&255]+e[255&o]+e[o>>8&255]+e[o>>16&255]+e[o>>24&255]},i=function(){if(window.Uint32Array&&window.crypto&&window.crypto.getRandomValues){var t=new window.Uint32Array(4);return window.crypto.getRandomValues(t),{d0:t[0],d1:t[1],d2:t[2],d3:t[3]}}return{d0:4294967296*Math.random()>>>0,d1:4294967296*Math.random()>>>0,d2:4294967296*Math.random()>>>0,d3:4294967296*Math.random()>>>0}},c=function(){var t="",n=function(t,n){for(var e="",r=t;r>0;--r)e+=n.charAt(1e3*Math.random()%n.length);return e};return t+=n(2,"0123456789"),t+=n(1,"123456789"),t+=n(8,"0123456789")};return t.safeGenerateNoDash=function(){try{var t=i();return o(t.d0,t.d1,t.d2,t.d3,!1)}catch(t){try{return n+c()}catch(t){}}},t.isValidNumericalToken=function(t){return t&&t.toString().length<=11&&t.length>=9&&parseInt(t,10).toString().length<=11&&parseInt(t,10).toString().length>=9},t.isValidUUIDToken=function(t){return t&&32===t.toString().length&&/^[a-z0-9]+$/.test(t)},t.isValidFGUToken=function(t){return 0==t.indexOf(n)&&t.length>=12},t}(),B={uDF:"UDF",dUAL:"dUAL",uAS:"UAS",uFP:"UFP",mLd:"1",eTlu:"2",eUoe:"3",uS:"4",uF:"9",tmos:["T5","T10","T15","T30","T60"],tmosSecs:[5,10,15,30,60],bIR:"43",uB:"u",uBr:"b",cP:"c",nIL:"i",s:"s"};try{var G=P();try{G.id&&(j.isValidNumericalToken(G.id)||j.isValidUUIDToken(G.id)||j.isValidFGUToken(G.id))?window.ftr__ncd=!1:(G.id=j.safeGenerateNoDash(),window.ftr__ncd=!0),G.ts=window.ftr__startScriptLoad,M(G),window.ftr__snp_cwc=!!k.read(_),window.ftr__snp_cwc||(E=V);for(var N="for"+"ter"+".co"+"m",O="ht"+"tps://c"+"dn9."+N,Q="ht"+"tps://"+G.id+"-"+siteId+".cd"+"n."+N,H="http"+"s://cd"+"n3."+N,X=[O,Q,H],z=0;z<X.length;z++)x(X[z]);var $=new Array(B.tmosSecs.length),J=function(t){for(var n=0;n<B.tmosSecs.length;n++)$[n]=setTimeout(c,1e3*B.tmosSecs[n],t+B.tmos[n])},K=function(){for(var t=0;t<B.tmosSecs.length;t++)clearTimeout($[t])};window.ftr__fdad=function(n,e){if(!g){g=!0;var r={};r[b]=s(window.ftr__config.s,siteId,window.ftr__config.m.csp),d(A,function(e){try{var r=e.getAllResponseHeaders().toLowerCase();if(r.indexOf(U.toLowerCase())>=0){var o=e.getResponseHeader(U);window.ftr__altd2=t(atob(o),-L-1)}if(r.indexOf(F.toLowerCase())<0)return;var i=e.getResponseHeader(F),c=t(atob(i),-L-1);if(c){var a=c.split(":");if(a&&2===a.length){for(var u=a[0],f=a[1],d="",s=0,w=0;s<20;++s)d+=s%3>0&&w<12?siteId.charAt(w++):G.id.charAt(s);var h=f.split(",");if(h.length>1){var m=h[0],v=h[1];D=u+"/"+m+"."+d+"."+v}}}n()}catch(t){}},function(t,n){e&&e(t,n)},r)}};var W=q?B.uFP:B.uDF;J(W),setTimeout(h,I,W)}catch(t){c(B.mLd)}}catch(t){}})();\n'.replace(/{{SITE_ID}}/g,t),r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("id",t),r.text=i,document.body.appendChild(r),document.addEventListener("ftr:tokenReady",(e=>{n(e.detail)}))}))});const My=(e,t,n)=>l(void 0,void 0,void 0,(function*(){try{const{publicApiKey:t,useCloudflareIntegration:i,cloudflareScriptUrl:r,cloudflareEndpointUrl:o}=e;let s=[];s=i&&o?[o,xt]:[xt];let a=[];if(i&&r){a=[`${new URL(r).toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,jt]}else a=[jt];const d=Pt({apiKey:t,endpoint:s,scriptUrlPattern:a}),l=yield d,{requestId:c}=yield l.get();n(c)}catch(e){console.warn("Could not load fingerprint",e)}}));var Ty=Object.freeze({__proto__:null,default:My,loadFingerprint:My});const Uy=(e,t,n)=>l(void 0,void 0,void 0,(function*(){try{const{customDomain:i,publicApiKey:r,cloudflareEndpointPath:o,cloudflareScriptPath:s}=e,{baseUrl:a}=t;let d;d=i?`https://${i}`:a||"https://api.descope.com";const l=new URL(d);l.pathname=o;const c=new URL(d);c.pathname=s;const u=`${c.toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,h=Pt({apiKey:r,endpoint:[l.toString(),xt],scriptUrlPattern:[u,jt]}),f=yield h,{requestId:p}=yield f.get();n(p)}catch(e){console.warn("Could not load descope fingerprint",e)}}));var _y=Object.freeze({__proto__:null,default:Uy,loadFingerprint:Uy});const Ly=105e3,Wy=(e,t,n)=>{let i=(new Date).getTime();const r=()=>{var t;return e.enterprise?null===(t=window.grecaptcha)||void 0===t?void 0:t.enterprise:window.grecaptcha};let o,s;const a=(t,r)=>{t.ready((()=>{e.siteKey&&(null==t||t.execute(s,{action:"load"}).then(((e,r)=>{r?console.warn("could not execute recaptcha",r):(n(e),i=(new Date).getTime(),o=setTimeout((()=>{a(t)}),Ly))})))}))},d=()=>{clearTimeout(o)},c=(()=>{const e=document.createElement("div");return e.style.display="none",e.id="recaptcha",document.body.appendChild(e)})(),u=()=>{const e=r();e&&a(e)};return window.onRecaptchaLoadCallback=()=>{const t=c;if(t.hasChildNodes())return;const n=r();n&&setTimeout((()=>{s=n.render(t,{sitekey:e.siteKey,badge:"inline",size:"invisible"}),a(n)}),0)},(()=>{const t=document.createElement("script");t.src=(()=>{const t=new URL("https://www.google.com/recaptcha/");return t.pathname+=(e.enterprise?"enterprise":"api")+".js",t.searchParams.append("onload","onRecaptchaLoadCallback"),t.searchParams.append("render","explicit"),t.toString()})(),t.async=!0,t.id="recaptcha-script",t.defer=!0,document.body.appendChild(t)})(),{stop:d,start:u,refresh:()=>l(void 0,void 0,void 0,(function*(){if(Date.now()-i>Ly){d();const e=i;return u(),new Promise((t=>{const n=setTimeout((()=>{console.warn("reCAPTCHA token refresh timed out"),t()}),5e3),r=()=>{i!==e?(clearTimeout(n),t()):setTimeout(r,150)};r()}))}return Promise.resolve()}))}};var Dy=Object.freeze({__proto__:null,default:Wy,loadGRecaptcha:Wy});const Fy=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===i.top?e.offsetHeight:null!==(s=i.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===i.bottom?e.offsetHeight:null!==(a=i.bottom)&&void 0!==a?a:0))]};var qy,By,Vy,Ky,Hy,Gy,zy,Jy,Zy,Yy;const Xy=document.createElement("template");Xy.innerHTML=`\n<div style="top:32px; left:${window.innerWidth-300-32}px;" 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`;class Qy extends HTMLElement{constructor(){var e,t,n;super(),qy.add(this),By.set(this,new ii({messages:[]})),Vy.set(this,void 0),Ky.set(this,void 0),Hy.set(this,void 0),Gy.set(this,{resize:c(this,qy,"m",Yy).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Xy.content.cloneNode(!0));const i=new CSSStyleSheet;i.replaceSync('\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'),null!==(t=(n=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(n.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,i],u(this,Vy,this.shadowRoot.querySelector(".debugger"),"f"),u(this,Ky,c(this,Vy,"f").querySelector(".content"),"f"),u(this,Hy,c(this,Vy,"f").querySelector(".header"),"f")}updateData(e){c(this,By,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=Fy(e,e.offsetLeft-i,e.offsetTop-r,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})(c(this,Vy,"f"),c(this,Hy,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",c(this,Gy,"f").resize),(e=c(this,Vy,"f")).onmousemove=t=>{var n;const i=t.target;(i.w&&i.w!==i.offsetWidth||i.h&&i.h!==i.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),i.w=i.offsetWidth,i.h=i.offsetHeight},c(this,Vy,"f").onresize=c(this,qy,"m",Zy).bind(this),c(this,By,"f").subscribe(c(this,qy,"m",zy).bind(this))}disconnectedCallback(){c(this,By,"f").unsubscribeAll(),window.removeEventListener("resize",c(this,Gy,"f").resize)}}By=new WeakMap,Vy=new WeakMap,Ky=new WeakMap,Hy=new WeakMap,Gy=new WeakMap,qy=new WeakSet,zy=function(e){c(this,qy,"m",Jy).call(this,e),c(this,qy,"m",Zy).call(this)},Jy=function(e){c(this,Ky,"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("")},Zy=function(){c(this,Ky,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),i=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;i||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},Yy=function(){const[e,t]=Fy(c(this,Vy,"f"),Number.parseInt(c(this,Vy,"f").style.left,10),Number.parseInt(c(this,Vy,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});c(this,Vy,"f").style.top=`${t}px`,c(this,Vy,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Qy);var e$=Object.freeze({__proto__:null,default:Qy});e.AccessKeyManagement=vi,e.ApplicationsPortal=Ci,e.AuditManagement=yi,e.AuthProvider=({projectId:e,baseUrl:r="",baseStaticUrl:s="",sessionTokenViaCookie:a=!1,persistTokens:d=!0,oidcConfig:l,storeLastAuthenticatedUser:c=!0,keepLastAuthenticatedUserAfterLogout:u=!1,refreshCookieName:h="",getExternalToken:f,children:p})=>{const[g,v]=t.useState(),[m,y]=t.useState(),[$,b]=t.useState(!1),[w,C]=t.useState(!1),[k,S]=t.useState(!1),[x,I]=t.useState(!!l),R=t.useRef(!1),O=(({projectId:e,baseUrl:n,persistTokens:i,sessionTokenViaCookie:r,refreshCookieName:s,oidcConfig:a,storeLastAuthenticatedUser:d,keepLastAuthenticatedUserAfterLogout:l,getExternalToken:c})=>t.useMemo((()=>{if(e)return _n({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:o,persistTokens:i,refreshCookieName:s,oidcConfig:a,storeLastAuthenticatedUser:d,keepLastAuthenticatedUserAfterLogout:l,autoRefresh:!0,getExternalToken:c})}),[e,n,r,c]))({projectId:e,baseUrl:r,persistTokens:d,sessionTokenViaCookie:a,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,refreshCookieName:h,getExternalToken:f});t.useEffect((()=>{if(O){const e=O.onSessionTokenChange(y),t=O.onUserChange(v),n=O.onIsAuthenticatedChange(b);return()=>{e(),t(),n()}}}),[O]);const E=t.useRef(!1),N=t.useRef(!1);t.useEffect((()=>{O&&l&&!R.current&&(R.current=!0,O.oidc.finishLoginIfNeed().finally((()=>{I(!1),E.current=!0})))}),[]);const A=t.useCallback((()=>{E.current||(E.current=!0,S(!0),i(null==O?void 0:O.refresh)().then((()=>{S(!1)})))}),[O]),j=t.useCallback((()=>{N.current||(N.current=!0,C(!0),i(O.me)().then((()=>{C(!1)})))}),[O]),P=t.useMemo((()=>({fetchUser:j,user:g,isUserLoading:w,isUserFetched:N.current,fetchSession:A,session:m,isAuthenticated:$,isSessionLoading:k,isOidcLoading:x,isSessionFetched:E.current,projectId:e,baseUrl:r,baseStaticUrl:s,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,refreshCookieName:h,setUser:v,setSession:y,setIsAuthenticated:b,sdk:O})),[j,g,w,N.current,A,m,$,k,x,E.current,e,r,s,u,h,v,y,b,O]);return t.createElement(n.Provider,{value:P},p)},e.Descope=ai,e.RoleManagement=pi,e.SignInFlow=e=>t.createElement(ai,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>t.createElement(ai,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>t.createElement(ai,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=hi,e.UserProfile=bi,e.baseHeaders=o,e.getCurrentTenant=Bn,e.getJwtPermissions=Fn,e.getJwtRoles=qn,e.getRefreshToken=Dn,e.getSessionToken=Wn,e.isRefreshTokenExpired=(e=Dn())=>null==Un?void 0:Un.isJwtExpired(e),e.isSessionTokenExpired=(e=Wn())=>null==Un?void 0:Un.isJwtExpired(e),e.refresh=(e=Dn())=>null==Un?void 0:Un.refresh(e),e.useDescope=()=>{const{sdk:e}=di();return t.useMemo((()=>e||new Proxy(Ln(),ci)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,isOidcLoading:i,fetchSession:r,isSessionFetched:o,isAuthenticated:s}=di(),a=t.useRef(n||i);t.useMemo((()=>{a.current=n||i}),[n,i]);const d=!s&&!n;return t.useMemo((()=>{d&&!o&&(a.current=!0)}),[o]),t.useEffect((()=>{d&&r()}),[r]),{isSessionLoading:a.current,sessionToken:e,isAuthenticated:s}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,isAuthenticated:r,isUserFetched:o}=di(),[s,a]=t.useState(!1),d=t.useRef(i),l=t.useMemo((()=>!e&&!i&&r&&!s),[n,r,s]);return t.useMemo((()=>{d.current=i}),[i]),t.useMemo((()=>{l&&!o&&(d.current=!0)}),[l,o]),t.useEffect((()=>{l&&(a(!0),n())}),[l]),{isUserLoading:d.current,user:e}}}));
|
|
3
|
+
function kt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var St=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=kt({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var s in r)r[s]&&(o+="; "+s,!0!==r[s]&&(o+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+o}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},r=0;r<n.length;r++){var o=n[r].split("="),s=o.slice(1).join("=");try{var a=decodeURIComponent(o[0]);if(i[a]=t.read(s,a),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",kt({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,kt({},this.attributes,t))},withConverter:function(t){return e(kt({},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 xt={default:"endpoint"},It="Blocked by CSP",Rt="The endpoint parameter is not a valid URL",Ot="Failed to load the JS script of the agent",Et="9319";function Nt(e,t){var n,i,r,o,s,a=[],d=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||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,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,o++))},r=new Set,[n.current(),function(e,t){var o,s=t instanceof Error?t.message:"";if(s===It||s===Rt)n.exclude(),o=0;else if(s===Et)n.exclude();else if(s===Ot){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.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()+i()-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,i=function(t){return a.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return i()}),i),r.catch((function(e){if(null!=s||(s=e),a.length>=5)throw s;var t=c(n,e);if(!t)throw s;var i,r=t[0],o=t[1];return(i=o,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return u(r)}))}))};return u(l).then((function(e){return[e,a]}))}var At="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",jt=At;function Pt(e){var t;e.scriptUrlPattern;var n=e.token,i=e.apiKey,r=void 0===i?n:i,o=d(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:At,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,i){return e.addEventListener(t,n,i),function(){return e.removeEventListener(t,n,i)}}(document,"visibilitychange",t);return t(),[e,n]}(),c=l[0],u=l[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)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)}))}(s,r);return Nt(e,Mt)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Et?new Error(Ot):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(a(a({},o),{ldi:{attempts:n,visibilityStates:c}}))}))}function Mt(e){return function(e,t,n){var i,r=document,o="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),r=t.blockedURI;r!==n.href&&r!==n.protocol.slice(0,-1)&&r!==n.origin||(i=t,a())};r.addEventListener(o,s);var a=function(){return r.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(),i)return n(i);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(Rt);var i=document.createElement("script"),r=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},o=document.head||document.getElementsByTagName("head")[0];i.onload=function(){r(),t()},i.onerror=function(){r(),n(new Error(Ot))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(It)})).then(Tt)}function Tt(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==i?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(Et);return n}const Ut=e=>{try{return p(e).exp}catch(e){return null}},Wt=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Ut(n)},Lt=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Ut(i):void 0)},_t=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,i)=>{var r;return n[i]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[i])||[]).concat((null==t?void 0:t[i])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},Dt=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(e=>{const{access_token:t,id_token:n,refresh_token:i,refresh_expire_in:r}=e,o=d(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||i,sessionExpiration:e.sessionExpiration||Lt(e),cookieExpiration:e.cookieExpiration||Wt(e)},o)})((null==t?void 0:t.authInfo)||t||{})},Ft=async e=>{const t=await Dt(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},qt="undefined"!=typeof localStorage,Bt=(e,t)=>qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Kt=e=>qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Vt=e=>qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Ht=(...e)=>{console.debug(...e)},zt="3.2.0",Gt="undefined"!=typeof window,Jt=Math.pow(2,31)-1,Zt=`https://descopecdn.com/npm/oidc-client-ts@${zt}/dist/browser/oidc-client-ts.min.js`,Yt=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${zt}/dist/browser/oidc-client-ts.min.js`,Xt="DS",Qt="DSR",en="DSI";function tn(e=""){return Kt(`${e}${Qt}`)||""}function nn(e=""){return St.get(Xt)||Kt(`${e}${Xt}`)||""}function rn(e=""){return Kt(`${e}${en}`)||""}function on(e=""){Vt(`${e}${Qt}`),Vt(`${e}${Xt}`),Vt(`${e}${en}`),St.remove(Xt)}const sn=Gt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",an="vsid",dn="vrid",ln="fp",cn=(e=!1)=>{const t=localStorage.getItem(ln);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},un=async(e,t=sn)=>{try{if(cn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),i=new URL(t);i.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const o=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Pt({apiKey:e,endpoint:[i.toString(),xt],scriptUrlPattern:[o,jt]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[an]:e,[dn]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(ln,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},hn=e=>{const t=cn(!0);return t&&e.body&&(e.body.fpData=t),e},fn="dls_last_user_login_id",pn="dls_last_user_display_name",gn=()=>Kt(fn),vn=()=>Kt(pn),mn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=gn(),o=vn();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)};function yn(){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 $n(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=xn(n.publicKey.challenge),n.publicKey.user.id=xn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=xn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:In(n.rawId),type:n.type,response:{attestationObject:In(n.response.attestationObject),clientDataJSON:In(n.response.clientDataJSON)}});var n}async function bn(e){const t=kn(e);return Sn(await navigator.credentials.get(t))}async function wn(e,t){const n=kn(e);return n.signal=t.signal,n.mediation="conditional",Sn(await navigator.credentials.get(n))}async function Cn(e=!1){if(!Gt)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function kn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=xn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=xn(e.id)})),n}function Sn(e){return JSON.stringify({id:e.id,rawId:In(e.rawId),type:e.type,response:{authenticatorData:In(e.response.authenticatorData),clientDataJSON:In(e.response.clientDataJSON),signature:In(e.response.signature),userHandle:e.response.userHandle?In(e.response.userHandle):void 0}})}function xn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function In(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Rn,On=(Rn=e=>({async signUp(t,n,i){const r=await e.webauthn.signUp.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await $n(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,o)},async signIn(t,n){const i=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!i.ok)return i;const r=await bn(i.data.options);return await e.webauthn.signIn.finish(i.data.transactionId,r)},async signUpOrIn(t,n){var i;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(null===(i=r.data)||void 0===i?void 0:i.create){const t=await $n(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await bn(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,t)}},async update(t,n,i){const r=await e.webauthn.update.start(t,window.location.origin,n,i);if(!r.ok)return r;const o=await $n(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:$n,get:bn,isSupported:Cn,conditional:wn}}),(...e)=>{const t=Rn(...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 En="/fedcm/config";async function Nn(e,t){var n,i,r;try{const r=await async function(e,t="google",n,i,r){const o=(()=>{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)})(),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(r&&(null==e?void 0:e.isDismissedMoment())){const n=null===(t=e.getDismissedReason)||void 0===t?void 0:t.call(e);return null==r||r(n),void c()}if(i&&(null==e?void 0:e.isSkippedMoment())){const t=null===(n=e.getSkippedReason)||void 0===n?void 0:n.call(e);return null==i||i(t),void c()}}))}))}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(null==t?void 0:t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,null==t?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);null===(n=null==t?void 0:t.onCodeReceived)||void 0===n||n.call(t,i.data.code)}else{const n=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,null==t?void 0:t.loginOptions);if(!n.ok||!n.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);null===(i=null==t?void 0:t.onAuthenticated)||void 0===i||i.call(t,n.data)}}catch(e){null===(r=null==t?void 0:t.onFailed)||void 0===r||r.call(t,e)}}var An=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Cn(),i=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=i,e.flow.start(...t)}});let jn;const Pn=(e,t)=>new Promise(((n,i)=>{if(!e.length)return i(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);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",(()=>{Pn(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),Mn=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{jn||(jn=(async()=>{try{return require("oidc-client-ts")}catch(e){return Pn([Zt,Yt],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await jn;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=t,s=(null==n?void 0:n.redirectUri)||window.location.href,a=(null==n?void 0:n.scope)||"openid email roles descope.custom_claims offline_access",d=`${o}_user`;let l=e.httpClient.buildUrl(t);(null==n?void 0:n.applicationId)&&(l=`${l}/${n.applicationId}`);const c={authority:l,client_id:t,redirect_uri:s,response_type:"code",scope:a,stateStore:new r({store:window.localStorage,prefix:o}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),(null==n?void 0:n.scope)&&(c.scope=n.scope),{client:new i(c),stateUserKey:d}})(e,t,n)),{client:i,stateUserKey:r}},r=async(t="")=>{var n;const{client:r,stateUserKey:o}=await i(),s=await r.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)))),window.localStorage.setItem(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(e={},t=!1)=>{const{client:n}=await i(),r=await n.createSigninRequest(e),{url:o}=r;return t||(window.location.href=o),{ok:!0,data:r}},finishLogin:r,finishLoginIfNeed:async(e="")=>{if(window.location.search.includes("code")&&window.location.search.includes("state"))return await r(e)},refreshToken:async t=>{var n;const{client:r,stateUserKey:o}=await i(),s=(e=>{const t=window.localStorage.getItem(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 r.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:r}=await i();e||(e={}),e.id_token_hint=e.id_token_hint||rn(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return window.localStorage.removeItem(r),t||window.location.replace(s),o}}},Tn=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:i}=t,r=d(t,["fpKey","fpLoad"]);return Gt?(n&&i&&un(n).catch((()=>null)),e(_t(r,{beforeRequest:hn}))):e(r)}),(e=>t=>{var{autoRefresh:n}=t,i=d(t,["autoRefresh"]);if(!n||"undefined"!=typeof window&&window.descopeBridge)return e(i);const{clearAllTimers:r,setTimer:o}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;Gt&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&s&&new Date>s&&(Ht("Expiration time passed, refreshing session"),l.refresh(tn()||a))}));const l=e(_t(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:d}=await Dt(t);if(401===(null==t?void 0:t.status))Ht("Received 401, canceling all timers"),r();else if(n||d){if(s=((e,t)=>{if(t)return new Date(1e3*t);Ht("Could not extract expiration time from session token, trying to decode the token");try{const t=p(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,d),!s)return void Ht("Could not extract expiration time from session token");a=i;const e=(e=>{let t=((n=e)?n.getTime()-(new Date).getTime():0)-2e4;var n;return t>Jt&&(Ht(`Timeout is too large (${t}ms), setting it to ${Jt}ms`),t=Jt),t})(s);if(r(),e<=2e4)return void Ht("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Ht(`Setting refresh timer for ${t}. (${e}ms)`),o((()=>{Ht("Refreshing session due to timer"),l.refresh(tn()||i)}),e)}}}));return ce(l,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return Ht("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.31.3"},t.baseHeaders)}))),(e=>t=>{const n=yn(),i=yn(),r=yn(),o=e(_t(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))i.pub(null),r.pub(null),n.pub(null);else{const e=await Ft(t);e&&r.pub(e);const{sessionJwt:o,sessionExpiration:s}=await Dt(t);o&&i.pub(o),(s||o)&&n.pub(s||42)}}})),s=ce(o,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const o=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o}));return Object.assign(s,{onSessionTokenChange:i.sub,onUserChange:r.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=t,r=d(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:gn,getLastUserDisplayName:vn});const o=e(_t(r,{afterRequest:async(e,t)=>{var n;const i=await Ft(t),r=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],o=null==i?void 0:i.name;r&&((e=>{Bt(fn,e)})(r),(e=>{Bt(pn,e)})(o))}}));let s=ce(o,["flow.start"],mn);return s=ce(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(Vt(fn),Vt(pn)),i})(i)),Object.assign(s,{getLastUserLoginId:gn,getLastUserDisplayName:vn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:i,storagePrefix:r}=t,o=d(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!Gt)return e(o);const s=e(_t(o,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||tn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||on(r):((e={},t=!1,n="")=>{var i;const{sessionJwt:r,refreshJwt:o}=e;if(o&&Bt(`${n}${Qt}`,o),r)if(t){const n=t.sameSite||"Strict",o=null===(i=t.secure)||void 0===i||i;!function(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(i);St.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}(Xt,r,Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:o}))}else Bt(`${n}${Xt}`,r);e.idToken&&Bt(`${n}${en}`,e.idToken)})(await Dt(t),i,r)}}));var a;const l=ce(s,["logout","logoutAll","oidc.logout"],(e=>t=>async(...n)=>{const i=await t(...n);return on(e),i})(r));return Object.assign(l,{getRefreshToken:()=>tn(r),getSessionToken:()=>nn(r),getIdToken:()=>rn(r)})}))((e=>{const t=Ct(e),n=Mn(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async i=>{var r;if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}const o=nn(),s=tn();let a="";if(e.getExternalToken)try{a=await(null===(r=e.getExternalToken)||void 0===r?void 0:r.call(e))}catch(e){Ht("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:o?"t":"f",dcr:s?"t":"f"},a)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:e.toString()}})}return t.logout(i)},flow:An(t),webauthn:On(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){Nn(i,e)},requestAuthentication(e){Nn(i,e)}},oneTap(e,t,n,r,o){Nn(i,{provider:e,oneTapConfig:t,loginOptions:n,onSkipped:r,onDismissed:o})},async launch(e){var t;const n={identity:{context:e||"signin",providers:[{configURL:i.httpClient.buildUrl(r+En),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>Gt&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+En);try{const i={identity:{context:e||"signin",providers:[{configURL:n,clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(i));return!!o&&!!o.token}catch(e){return!1}}}),oidc:n});var i,r}));let Un;const Wn=e=>{const t=Tn(Object.assign({persistTokens:s,autoRefresh:s},e));return Un=t,t},Ln=()=>Wn({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});Un=Ln();const _n=()=>s?null==Un?void 0:Un.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),Dn=()=>s?null==Un?void 0:Un.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),Fn=r(((e=_n(),t)=>null==Un?void 0:Un.getJwtPermissions(e,t))),qn=r(((e=_n(),t)=>null==Un?void 0:Un.getJwtRoles(e,t))),Bn=r(((e=_n())=>null==Un?void 0:Un.getCurrentTenant(e)));function Kn(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Vn=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Hn=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),zn=e=>{let t,n;return(...i)=>(t&&Hn(t,i)||(t=i,n=e(...i)),n)},Gn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Jn=e=>(t,...n)=>t.reduce(((t,i,r)=>{var o;return`${t}${i}${(null===(o=null==n?void 0:n[r])||void 0===o?void 0:o[e>1?1:0])||""}`}),""),Zn=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},Yn=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 i=e(n);return i[t]=!0,i}};var Xn,Qn,ei,ti;function ni(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i+=1){const r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!ni(o,s))return!1}else if(o!==s)return!1}return!0}let ii=class{constructor(e={},{forceUpdate:t=!1}={}){Xn.set(this,void 0),Qn.set(this,{}),ei.set(this,0),ti.set(this,!0),this.update=e=>{const t="function"==typeof e?e(c(this,Xn,"f")):e,n=Object.assign(Object.assign({},c(this,Xn,"f")),t);if(c(this,ti,"f")||!ni(c(this,Xn,"f"),n)){const e=c(this,Xn,"f");u(this,Xn,n,"f"),Object.freeze(c(this,Xn,"f")),setTimeout((()=>{Object.values(c(this,Qn,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},u(this,Xn,e,"f"),u(this,ti,t,"f")}get current(){return Object.assign({},c(this,Xn,"f"))}subscribe(e){return u(this,ei,c(this,ei,"f")+1,"f"),c(this,Qn,"f")[c(this,ei,"f")]=e,c(this,ei,"f").toString()}unsubscribe(e){const t=!!c(this,Qn,"f")[e];return t&&delete c(this,Qn,"f")[e],t}unsubscribeAll(){return u(this,Qn,{},"f"),!0}};Xn=new WeakMap,Qn=new WeakMap,ei=new WeakMap,ti=new WeakMap;const ri=e=>"string"==typeof e||null==e?e:JSON.stringify(e),oi=e=>t.forwardRef(((n,i)=>{const{prop:r,attr:o,rest:s}=t.useMemo((()=>Object.entries(n).reduce(((e,[t,n])=>{const{trimmedKey:i,category:r}=(e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}})(t);return"prop"===r?e.prop.push([i,n]):"attr"===r?e.attr.push([Gn(i),ri(n)]):Object.assign(e.rest,{[Gn(i)]:n}),e}),{attr:[],prop:[],rest:{}})),[n]),a=t.useRef(null),d=t.useCallback((e=>{a.current=e,e&&(r.forEach((([e,t])=>{a.current[e]=t})),o.forEach((([t,n])=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)})))}),[r,o,a]);return t.useImperativeHandle(i,(()=>a.current)),t.createElement(e,Object.assign({ref:d},s))})),si=t.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await Promise.resolve().then((function(){return bs})).then((e=>e.default))).sdkConfigOverrides={baseHeaders:o,persistTokens:!1,hooks:{get beforeRequest(){return Un.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-wc",Object.assign({ref:n},e)))))}))),ai=t.forwardRef((({flowId:e,onSuccess:i,onError:r,onReady:o,logger:s,tenant:a,theme:d,nonce:l,locale:c,debug:u,client:h,form:f,telemetryKey:p,redirectUrl:g,autoFocus:v,validateOnBlur:m,restartOnError:y,errorTransformer:$,styleId:b,onScreenUpdate:w,dismissScreenErrorOnInput:C,outboundAppId:k,outboundAppScopes:S,children:x},I)=>{const[R,O]=t.useState(null);t.useImperativeHandle(I,(()=>R));const{projectId:E,baseUrl:N,baseStaticUrl:A,baseCdnUrl:j,storeLastAuthenticatedUser:P,keepLastAuthenticatedUserAfterLogout:M,refreshCookieName:T,sdk:U}=t.useContext(n),W=t.useCallback((async e=>{await U.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),i&&i(e)}),[i]);return t.useEffect((()=>{const e=R;return null==e||e.addEventListener("success",W),r&&(null==e||e.addEventListener("error",r)),o&&(null==e||e.addEventListener("ready",o)),()=>{r&&(null==e||e.removeEventListener("error",r)),o&&(null==e||e.removeEventListener("ready",o)),null==e||e.removeEventListener("success",W)}}),[R,r,W]),t.useEffect((()=>{const e=R;return null==e||e.addEventListener("success",W),()=>{null==e||e.removeEventListener("success",W)}}),[R,W]),t.useEffect((()=>{const e=R;return r&&(null==e||e.addEventListener("error",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[R,r]),t.useEffect((()=>{const e=R;return o&&(null==e||e.addEventListener("ready",o)),()=>{o&&(null==e||e.removeEventListener("error",o))}}),[R,o]),t.createElement("form",null,t.createElement(t.Suspense,{fallback:null},t.createElement(si,{projectId:E,flowId:e,baseUrl:N,baseStaticUrl:A,baseCdnUrl:j,ref:O,telemetryKey:p,redirectUrl:g,autoFocus:v,styleId:b,validateOnBlur:m,restartOnError:y,keepLastAuthenticatedUserAfterLogout:M,tenant:a,"theme.attr":d,"nonce.attr":l,"locale.attr":c,"form.attr":f,"client.attr":h,"debug.attr":u,"outbound-app-id.attr":k,"outbound-app-scopes.attr":S,"store-last-authenticated-user.attr":P,"refreshCookieName.attr":T,"dismiss-screen-error-on-input.attr":C,"errorTransformer.prop":$,"logger.prop":s,"onScreenUpdate.prop":w},x)))}));var di=()=>{const e=t.useContext(n);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const li=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,ci={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],ci);if("function"==typeof e[t])return()=>{throw Error(li("function"))};throw Error(li("attribute"))}},ui=t.lazy((async()=>(await Promise.resolve().then((function(){return Bp})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-user-management-widget",Object.assign({ref:n},e)))))}))),hi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(ui,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,ref:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),fi=t.lazy((async()=>(await Promise.resolve().then((function(){return Fg})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-role-management-widget",Object.assign({ref:n},e)))))}))),pi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(fi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),gi=t.lazy((async()=>(await Promise.resolve().then((function(){return Vv})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-access-key-management-widget",Object.assign({ref:n},e)))))}))),vi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(gi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),mi=t.lazy((async()=>(await Promise.resolve().then((function(){return um})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-audit-management-widget",Object.assign({ref:n},e)))))}))),yi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(mi,{projectId:u,widgetId:s,tenant:i,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,innerRef:c,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),$i=t.lazy((async()=>(await Promise.resolve().then((function(){return ey})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-user-profile-widget",Object.assign({ref:n},e)))))}))),bi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,onLogout:s,styleId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,refreshCookieName:g,setSession:v,setUser:m,setIsAuthenticated:y}=t.useContext(n),$=t.useCallback((e=>{s&&s(e),y(!1),v(""),m(null)}),[s,v,y,m]);return t.useEffect((()=>{if(l)return l.addEventListener("logout",$),()=>l.removeEventListener("logout",$)}),[l,$]),t.createElement(t.Suspense,{fallback:null},t.createElement($i,{projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,styleId:a,ref:c,"theme.attr":i,"debug.attr":r,"styleId.attr":a,"refreshCookieName.attr":g,"logger.prop":e}))})),wi=t.lazy((async()=>(await Promise.resolve().then((function(){return my})),{default:oi(t.forwardRef(((e,n)=>t.createElement("descope-applications-portal-widget",Object.assign({ref:n},e)))))}))),Ci=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s},a)=>{const[d,l]=t.useState(null);t.useImperativeHandle(a,(()=>d));const{projectId:c,baseUrl:u,baseStaticUrl:h,baseCdnUrl:f,refreshCookieName:p}=t.useContext(n);return t.createElement(t.Suspense,{fallback:null},t.createElement(wi,{projectId:c,widgetId:o,baseUrl:u,baseStaticUrl:h,baseCdnUrl:f,innerRef:l,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":p,"logger.prop":e}))})),ki="undefined"!=typeof localStorage,Si="J151000",xi=ki&&localStorage.getItem("base.content.url")||"",Ii="base.ui.components.url";ki&&localStorage.getItem(Ii),ki&&localStorage.getItem(Ii);const Ri="descope-login-flow",Oi="code",Ei="data-exclude-field",Ni="data-exclude-next",Ai="dls_last_auth",ji="state_id",Pi="saml_idp_state_id",Mi="saml_idp_username",Ti="descope_idp_initiated",Ui="sso_app_id",Wi="third_party_app_id",Li="third_party_app_state_id",_i="oidc_login_hint",Di="oidc_prompt",Fi="oidc_error_redirect_uri",qi="application_scopes",Bi="data-type",Ki="redirect",Vi="poll",Hi="webauthnCreate",zi="webauthnGet",Gi="nativeBridge",Ji="loadForm",Zi="submit",Yi="polling",Xi=["descope-multi-select-combo-box","descope-text-area"],Qi=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var er;!function(e){e.backward="backward",e.forward="forward"}(er||(er={}));const tr=["descope-enriched-text"];function nr(e){return new URLSearchParams(window.location.search).get(e)}function ir(e){if(window.history.replaceState&&nr(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 rr(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?er.forward:n<i?er.backward:void 0}const or=e=>{let[t="",n=""]=(nr(Ri)||"").split("_");const i=(e=>{var t;return(null===(t=/(.*)\|#\|.*/.exec(e))||void 0===t?void 0:t[1])||""})(t);return(!e||i&&i!==e)&&(t="",n=""),{executionId:t,stepId:n,executionFlowId:i}};function sr(){ir(Ri)}const ar=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),dr=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=or(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&sr();const o=nr("t")||void 0;o&&ir("t");const s=nr(Oi)||void 0;s&&ir(Oi);const a=nr("err")||void 0;a&&ir("err");const{redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u}={redirectAuthCodeChallenge:nr("ra-challenge"),redirectAuthCallbackUrl:nr("ra-callback"),redirectAuthBackupCallbackUri:nr("ra-backup-callback"),redirectAuthInitiator:nr("ra-initiator")},h=nr(ji);h&&ir(ji);const f=nr(Pi);f&&ir(Pi);const p=nr(Mi);f&&ir(Mi);const g=nr(Ti);g&&ir(Ti);const v=nr(Ui);v&&ir(Ui);const m=nr(Wi);m&&ir(Wi);const y=nr(Li);y&&ir(Li);const $=nr(qi);$&&ir(qi);const b=nr(_i);b&&ir(_i);const w=nr(Di);w&&ir(Di);const C=nr(Fi);return C&&ir(Fi),{executionId:n,stepId:i,token:o,code:s,exchangeError:a,redirectAuthCodeChallenge:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthInitiator:u,ssoQueryParams:{oidcIdpStateId:h,samlIdpStateId:f,samlIdpUsername:p,descopeIdpInitiated:"true"===g,ssoAppId:v,oidcLoginHint:b,oidcPrompt:w,oidcErrorRedirectUri:C,thirdPartyAppId:m,thirdPartyAppStateId:y,applicationScopes:$}}},lr=e=>{let t,n;return Object.assign(((...i)=>{return t&&(o=i,(r=t).length===o.length&&r.every(((e,t)=>e===o[t])))||(t=i,n=e(...i)),n;var r,o}),{reset:()=>{t=void 0,n=void 0}})},cr=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}};function ur(e,t,n){return new Promise(((i,r)=>{let o=!1;const s=setTimeout((()=>{o=!0,void 0!==n?i(n):r(new Error(`Promise timed out after ${e} ms`))}),e);t.then((e=>{o||(clearTimeout(s),i(e))})).catch((e=>{o||(clearTimeout(s),r(e))}))}))}const hr=(e,{oidcIdpStateId:t,samlIdpStateId:n,samlIdpUsername:i,ssoAppId:r,oidcLoginHint:o,oidcPrompt:s,oidcErrorRedirectUri:a,thirdPartyAppId:d,thirdPartyAppStateId:l,applicationScopes:c})=>!(!e||t||n||i||r||o||s||a||d||l||c),fr=e=>null==e?void 0:e.submit(),pr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},gr=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function vr(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:""}}function mr(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var yr,$r,br,wr;function Cr(e,t){const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i+=1){const r=n[i],o=e[r],s=t[r];if(null===o||null===s){if(o!==s)return!1}else if("object"==typeof o&&"object"==typeof s){if(!Cr(o,s))return!1}else if(o!==s)return!1}return!0}let kr=class{constructor(e={},{forceUpdate:t=!1}={}){yr.set(this,void 0),$r.set(this,{}),br.set(this,0),wr.set(this,!0),this.update=e=>{const t="function"==typeof e?e(c(this,yr,"f")):e,n=Object.assign(Object.assign({},c(this,yr,"f")),t),i=c(this,yr,"f");u(this,yr,n,"f"),Object.freeze(c(this,yr,"f")),setTimeout((()=>{Object.values(c(this,$r,"f")).forEach((({cb:e,selector:t,forceUpdate:r})=>{const o=t(i),s=t(n);(c(this,wr,"f")||r||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(s)?!Cr(o,s):o!==s))&&e(s,o,((e,t)=>n=>e[n]!==t[n])(s,o))}))}),0)},u(this,yr,e,"f"),u(this,wr,t,"f")}get current(){return Object.assign({},c(this,yr,"f"))}set forceUpdate(e){u(this,wr,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return u(this,br,c(this,br,"f")+1,"f"),c(this,$r,"f")[c(this,br,"f")]={cb:e,selector:t,forceUpdate:n},c(this,br,"f").toString()}unsubscribe(e){const t=!!c(this,$r,"f")[e];return t&&delete c(this,$r,"f")[e],t}unsubscribeAll(){return u(this,$r,{},"f"),!0}};yr=new WeakMap,$r=new WeakMap,br=new WeakMap,wr=new WeakMap;const Sr=["*","#","/","(",")","[","]","_","<",">","`"],xr=e=>"string"!=typeof e?e:e.replace((e=>{const t=Sr.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),Ir=["disabled"],Rr=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Ei}])`)).forEach((e=>{e.value=n}))}))},Or=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),Er=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?xr(Or(t,i)):Or(t,i))),Nr=(e,t,n)=>{e.querySelectorAll(`[${Bi}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Ar=(e,t,n)=>{var i,r;const o=null===(i=customElements.get(t))||void 0===i?void 0:i.cssVarList.url;n&&o&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(o,`url(data:image/jpg;base64,${n})`))},jr=(e,t,n,i,r)=>{var o,s;Nr(e,"totp-link",null===(o=null==t?void 0:t.totp)||void 0===o?void 0:o.provisionUrl),Nr(e,"notp-link",null===(s=null==t?void 0:t.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=>tr.includes(e))(e.localName);e.textContent=Er(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",Er(i,t))}))})(e,t),((e,t,n)=>{if(!t)return;const{componentsDynamicAttrs:i}=t,r=d(t,["componentsDynamicAttrs"]),o=Object.keys(r).reduce(((e,t)=>(e[`[name=${t}]`]=r[t],e)),{});i&&Object.keys(i).forEach((e=>{const t=i[e];if(t){const{attributes:n}=t;n&&Object.keys(n).length&&(o[e]=n)}})),Object.keys(o).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const i=o[t];Object.keys(i).forEach((t=>{let r=i[t];if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){n.error(`Could not stringify value "${r}" for "${t}"`,e.message),r=""}e.setAttribute(t,r)}))}))}))})(e,n,r),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=Er(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{Ir.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,i)},Pr=lr((()=>l(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)))),i=(()=>{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 ur(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}})))),Mr="dls_ab_testing_id",Tr={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.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,i]=t?t.split(",").map(Number):[void 0,void 0];return(e.abTestingKey||0)>=(null!=n?n:0)&&(e.abTestingKey||0)<=(null!=i?i:0)},"not-in-range":(e,t)=>{const[n,i]=t?t.split(",").map(Number):[void 0,void 0];return!(void 0!==n&&void 0!==i&&!Number.isNaN(n)&&!Number.isNaN(i))||(e.abTestingKey||0)<n||(e.abTestingKey||0)>i},"devised-by":(e,t)=>{const n=Number(t);return!Number.isNaN(n)&&(e.abTestingKey||0)%n==0}}};function Ur(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Ai)))}catch(e){}return t}const Wr=["error","warn","info","debug"],Lr=Yn((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,c(this,t,"m",i).call(this,console))}set logger(e){u(this,n,c(this,t,"m",i).call(this,e||console),"f")}get logger(){return c(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return Wr.reduce(((t,n)=>(t[n]=(...t)=>{var i;this.onLogEvent(n,t),null===(i=e[n])||void 0===i||i.call(e,...t)},t)),{})},r})),_r="undefined"!=typeof localStorage,Dr=_r&&localStorage.getItem("base.content.url")||"",Fr=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,qr=Yn((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)&&c(this,t,"f")&&(u(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Br=Yn((e=>{var t,n;const i=Kn(Lr,qr)(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=c(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){c(this,t,"f")[e]||(c(this,t,"f")[e]=[]);const i=c(this,t,"f")[e].push(n);return()=>c(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})),Kr=e=>t=>{var n,i,r;const o=Kn(Lr,qr,Br)(t),s=Object.keys(e);return r=class extends o{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,c(this,n,"m",i).bind(this))}async init(){var e;s.forEach((e=>c(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 i=e[t],r="function"==typeof i?i(t,n):i;r&&this.logger.error(r)},r};Kr.missingAttrValidator=Fr;const Vr=Yn((e=>{const t=Kn(Kr({"project-id":Fr}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Hr=Yn((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),zr="Trying the next fallback URL...",Gr=async(e,t,{logger:n}={})=>{try{return await fetch(e,t)}catch(i){return null==n||n.debug(`Network error fetching URL ${e} [${i.message}], retrying...`),fetch(e,t)}};function Jr({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i="https://static.descope.com/pages"}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}const Zr=Yn((e=>{var t,n,i,r,o;const s=Kn(Lr,Vr,Hr)(e);return o=class extends s{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}async fetchStaticResource(e,n){const o=c(this,t,"m",r).call(this,e),s=Array.isArray(o)?e=>{if(e!==o.length-1){const{baseUrl:t}=o[e];u(this,i,t,"f")}}:null;try{const e=await(async(e,t,{logger:n,onSuccess:i}={})=>{const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=r[e],s=e===r.length-1;try{const r=await Gr(o.toString(),t,{logger:n});if(r.ok)return null==i||i(e),null==n||n.debug(`Successfully fetched URL ${o}`),r;const a=`Error fetching URL ${o} [${r.status}]`;if(s)throw new Error(a);null==n||n.debug(`${a}. ${zr}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${zr}`)}}})(o,{cache:"default"},{logger:this.logger,onSuccess:s});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,i=new WeakMap,t=new WeakSet,r=function(e){const t=Dr||this.baseStaticUrl;if(t)return Jr({projectId:this.projectId,filename:e,baseUrl:t});const r=c(this,n,"f")!==this.baseUrl,o=r&&!!this.baseUrl;r&&(u(this,n,this.baseUrl,"f"),u(this,i,void 0,"f"));const s=Jr({projectId:this.projectId,filename:e,baseUrl:c(this,i,"f")});if(!o)return s;return[Jr({projectId:this.projectId,filename:e,baseUrl:this.baseUrl+"/pages"}),s]},o})),Yr=Yn((e=>{var t,n;const i=Kn(Kr({"project-id":Fr}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(c(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return c(this,t,"f").set(e,n),()=>{c(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(c(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!c(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=c(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),Xr=Yn((e=>{var t,n,i,r,o;const s=Kn(Zr,Yr,qr)(e);return o=class extends s{constructor(){super(...arguments),t.add(this),i.set(this,void 0),r.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",c(this,t,"m",n).bind(this))}get config(){return c(this,i,"f")||u(this,i,c(this,r,"f").call(this),"f"),c(this,i,"f")}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){u(this,i,void 0,"f")},o})),Qr=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],eo=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()}`},to=(e,t)=>new Promise(((n,i)=>{const r=(e=>{const t=document.createElement("script");return t.id=e,t})(e);r.onerror=e=>{r.setAttribute("status","error"),i(e)},r.onload=()=>{r.setAttribute("status","loaded"),n(r)},r.src=t.toString(),document.body.appendChild(r)})),no=e=>"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)}))})),io=Yn((e=>{const t=Kn(Lr)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")}injectNpmLib(e,t,n="",i=[]){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"`),(async(e,t)=>{for(const i of e){const{id:e,url:r}=i,o=(n=e,document.querySelector(`script#${n}`));if(o)try{return await no(o),i}catch(e){t(i,!0)}else try{return await to(e,r),i}catch(e){t(i,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,i="")=>e.reduce(((e,r)=>{const o=r;if(!o)return e;let s;try{s=new URL(o)}catch(e){throw new Error(`Invalid URL: ${o}`)}return"/"!==s.pathname||(s.pathname=`/npm/${t}@${n}/${i}`),[...e,{url:s,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${eo(s)}`}]}),[]))([...i,this.baseCdnUrl,...Qr],e,t,n),((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}"`)}))}}})),ro="base.ui.components.url",oo=_r&&localStorage.getItem(ro),so=Yn((e=>{var t,n,i,r,o,s;const a=Kn(Lr,Xr,io)(e);return s=class extends a{constructor(){super(...arguments),t.add(this),i.set(this,void 0)}get descopeUi(){return c(this,i,"f")||u(this,i,c(this,t,"m",o).call(this),"f"),c(this,i,"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=>c(this,t,"m",r).call(this,e))))}},i=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},r=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(", ")}"`)},o=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{return await this.injectNpmLib("@descope/web-components-ui",await c(this,t,"m",n).call(this),"dist/umd/index.js",[oo]),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},s})),ao="content-root",lo="root",co=Yn((e=>class extends e{constructor(...e){var t,n,i,r;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${lo}">\n <div id="${ao}"></div>\n </div>\n `;const o=new CSSStyleSheet;o.replaceSync(`\n #${lo}, #${ao} {\n height: 100%;\n }\n #${lo} {\n position: relative;\n height: fit-content;\n }\n `),null!==(t=(r=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(r.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,o],this.contentRootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(ao),this.rootElement=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById(lo)}})),uo=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',ho=Yn((e=>{var t,n,i,r,o,s,a,d,l,h,f,p,g,v;const m=Kn(Kr({theme:uo}),Zr,qr,so,Xr,co,Br)(e);return v=class extends m{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),f.set(this,(()=>{c(this,t,"m",p).call(this),c(this,g,"f").call(this,"os"===this.getAttribute("theme"))})),g.set(this,(e=>{var n,i,r;const o=e?"addEventListener":"removeEventListener";null===(r=null===(i=null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-color-scheme: dark)"))||void 0===i?void 0:i[o])||void 0===r||r.call(i,"change",(()=>c(this,t,"m",p).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")||"theme"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),c(this,t,"m",s).call(this),c(this,t,"m",a).call(this),c(this,f,"f").call(this),this.observeAttributes(["theme"],c(this,f,"f")),this.observeAttributes(["style-id"],(()=>{u(this,i,null,"f"),c(this,t,"m",l).call(this),c(this,t,"m",s).call(this),c(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,r=async function(){try{const{body:e}=await this.fetchStaticResource(`${this.styleId}.json`,"json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(ro)))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(ro),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")}},o=function(){return c(this,i,"f")||(u(this,i,c(this,t,"m",r).call(this),"f"),c(this,i,"f").then((e=>this.logger.debug("Fetched theme",e)))),c(this,i,"f")},s=async function(){var e,i,r,s;const a=await c(this,t,"a",o);a&&(c(this,n,"f")||(u(this,n,new CSSStyleSheet,"f"),null!==(e=(s=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(s.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,c(this,n,"f")]),c(this,n,"f").replaceSync(((null===(i=null==a?void 0:a.light)||void 0===i?void 0:i.globals)||"")+((null===(r=null==a?void 0:a.dark)||void 0===r?void 0:r.globals)||"")))},a=async function(){var e,n;const i=Object.assign({},await c(this,t,"a",o));if(!i)return;const r=await this.descopeUi;(null==r?void 0:r.componentsThemeManager)&&(r.componentsThemeManager.themes={light:null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.components,dark:null===(n=null==i?void 0:i.dark)||void 0===n?void 0:n.components})},d=async function(){var e,t;const{projectConfig:n}=await this.config||{},i=null===(e=null==n?void 0:n.styles)||void 0===e?void 0:e[this.styleId],r=null==n?void 0:n.cssTemplate,o=i||r;return null===(t=null==o?void 0:o[this.theme])||void 0===t?void 0:t.fonts},l=async function(){const e=await c(this,t,"m",d).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")},h=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)},p=function(){c(this,t,"m",l).call(this),c(this,t,"m",h).call(this)},v})),fo=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if("object"==typeof e[i]&&null!==e[i]&&!(null===(r=e[i])||void 0===r?void 0:r.value))return Object.assign(Object.assign({},n),fo(e[i],`${t+i}.`));const o="object"==typeof e[i]?e[i]:{value:e[i]},s=Object.assign(Object.assign({},n),{[t+i]:o,[`form.${t}${i}`]:o});return"displayName"===i?Object.assign(Object.assign({},s),{[`${t}fullName`]:o,[`form.${t}fullName`]:o}):s}),[]),po=Yn((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;c(this,t,"m",n).call(this)&&c(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)},r}));var go,vo,mo,yo,$o,bo,wo,Co,ko,So,xo,Io,Ro,Oo,Eo,No,Ao,jo,Po,Mo,To,Uo,Wo;const Lo=Kn(ho,Zr,po)(HTMLElement);let _o=class extends Lo{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","nonce"]}constructor(e){super(),go.add(this),mo.set(this,!1),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),c(this,go,"m",To).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)}},yo.set(this,new kr),$o.set(this,new kr),bo.set(this,{}),this.getComponentsContext=()=>c(this,bo,"f"),this.nextRequestStatus=new kr({isLoading:!1}),wo.set(this,void 0),Co.set(this,{popstate:c(this,go,"m",Ro).bind(this),componentsContext:c(this,go,"m",jo).bind(this)}),ko.set(this,void 0),this.getConfig=()=>l(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),u(this,ko,e,"f"),c(this,go,"m",xo).call(this)}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get tenantId(){return this.getAttribute("tenant")||void 0}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 fo(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 isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return l(this,void 0,void 0,(function*(){var e,t;const n=yield this.getProjectConfig(),i=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=i.version)&&void 0!==t||(i.version=0),i}))}getTargetLocales(){return l(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}getComponentsVersion(){return l(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 l(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),c(this,$o,"f").subscribe(c(this,go,"m",Mo).bind(this)),c(this,$o,"f").update({isDebug:this.debug}),c(this,go,"m",Io).call(this),c(this,go,"m",Wo).call(this),yield c(this,go,"m",No).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");c(this,go,"m",Uo).call(this);const{executionId:i,stepId:r,token:o,code:s,exchangeError:a,redirectAuthCallbackUrl:d,redirectAuthBackupCallbackUri:l,redirectAuthCodeChallenge:h,redirectAuthInitiator:f,ssoQueryParams:p}=dr(this.flowId,this.loggerWrapper);window.addEventListener("popstate",c(this,Co,"f").popstate),window.addEventListener("components-context",c(this,Co,"f").componentsContext),c(this,yo,"f").subscribe(c(this,go,"m",Eo).bind(this)),c(this,yo,"f").update(Object.assign({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenantId,redirectUrl:this.redirectUrl,locale:this.locale,stepId:r,executionId:i,token:o,code:s,exchangeError:a,redirectAuthCallbackUrl:d,redirectAuthBackupCallbackUri:l,redirectAuthCodeChallenge:h,redirectAuthInitiator:f},p)),u(this,mo,!0,"f")}))}disconnectedCallback(){c(this,yo,"f").unsubscribeAll(),c(this,$o,"f").unsubscribeAll(),c(this,go,"m",Po).call(this),window.removeEventListener("popstate",c(this,Co,"f").popstate),window.removeEventListener("components-context",c(this,Co,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&c(this,mo,"f")&&t!==n&&vo.observedAttributes.includes(e)){c(this,go,"m",Io).call(this);const i=null===t;"nonce"===e&&c(this,go,"m",Wo).call(this),c(this,yo,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,sr()),{[ar(e)]:n,stepId:o,executionId:s}})),c(this,$o,"f").update({isDebug:this.debug})}}};var Do,Fo,qo,Bo,Ko,Vo,Ho,zo,Go,Jo,Zo,Yo,Xo,Qo,es,ts,ns,is,rs,os,ss,as,ds,ls,cs,us,hs,fs,ps,gs,vs,ms,ys;vo=_o,mo=new WeakMap,yo=new WeakMap,$o=new WeakMap,bo=new WeakMap,wo=new WeakMap,Co=new WeakMap,ko=new WeakMap,go=new WeakSet,So=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync("\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 "),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n]},xo=function(){c(this,go,"m",So).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},Io=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","nonce","outbound-app-id","outbound-app-scopes"];vo.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[ar(t)])throw Error(`${t} cannot be empty`)}))},Ro=function(){const{stepId:e,executionId:t}=or(this.flowId);c(this,yo,"f").update({stepId:e,executionId:t})},Oo=function(e,t){this.sdk=Tn(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},vo.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>l(this,void 0,void 0,(function*(){try{return yield t(...e)}catch(e){return{error:{errorCode:Si,errorDescription:e.toString()}}}}))}))},Eo=function(e,t,n){return l(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;c(this,go,"m",Oo).call(this,t,i)}c(this,ko,"f").call(this,e)}))},No=function(){return l(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield c(this,go,"m",Ao).call(this))}))},Ao=function(){return l(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(xi||i||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:"config.json",assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield function(e,t){return l(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}}))},jo=function(e){u(this,bo,Object.assign(Object.assign({},c(this,bo,"f")),e.detail),"f")},Po=function(){var e;null===(e=c(this,wo,"f"))||void 0===e||e.remove(),u(this,wo,null,"f")},Mo=function(e){return l(this,arguments,void 0,(function*({isDebug:e}){e?(u(this,wo,document.createElement("descope-debugger"),"f"),Object.assign(c(this,wo,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return jy})),document.body.appendChild(c(this,wo,"f"))):c(this,go,"m",Po).call(this)}))},To=function(e,t){var n;e&&this.debug&&(null===(n=c(this,wo,"f"))||void 0===n||n.updateData({title:e,description:t}))},Uo=function(){this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Xi.includes(null!==(i=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==i?i:"");if("Enter"!==e.key||r||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()}}},Wo=function(){this.getAttribute("nonce")&&(window.DESCOPE_NONCE=this.getAttribute("nonce"))},_o.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.43.0"}};let $s=class extends _o{static set sdkConfigOverrides(e){_o.sdkConfigOverrides=e}static get sdkConfigOverrides(){return _o.sdkConfigOverrides}constructor(){const e=new kr({deferredRedirect:!1});super(e.update.bind(e)),Do.add(this),this.stepState=new kr({}),Fo.set(this,void 0),qo.set(this,null),Bo.set(this,null),Ko.set(this,{visibilitychange:c(this,Do,"m",Vo).bind(this)}),this.bridgeVersion=2,this.nativeCallbacks={},es.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()?c(this,Do,"m",ts).call(this,t):t()})),ns.set(this,((e,t,n,i,r=!1)=>{if(this.flowState.current.action===Vi){this.logger.debug("polling - Scheduling polling request");const o=Date.now(),s=r?500:2e3;u(this,Fo,setTimeout((()=>l(this,void 0,void 0,(function*(){var a;this.logger.debug("polling - Calling next");const d=this.sdk.flow.next(e,t,Yi,n,i,{}),l=document.hidden&&!r&&Date.now()-o>s+500;let u;l&&this.logger.debug("polling - The polling seems to be throttled");try{const e=l?1e3:6e3;u=yield ur(e,d)}catch(a){return this.logger.warn(`polling - The ${l?"throttled fetch":"fetch"} call timed out or was aborted`),void c(this,ns,"f").call(this,e,t,n,i,l)}if((null===(a=null==u?void 0:u.error)||void 0===a?void 0:a.errorCode)===Si)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void c(this,ns,"f").call(this,e,t,n,i);this.logger.debug("polling - Got a response"),(null==u?void 0:u.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(u.error,null,4)),c(this,ns,"f").call(this,e,t,n,i),c(this,rs,"f").call(this,u)}))),s),"f")}})),is.set(this,(()=>{clearTimeout(c(this,Fo,"f")),u(this,Fo,null,"f")})),rs.set(this,(e=>{var t,n,i,r,o,s,a,d,l,h,f,p,g;if(!(null==e?void 0:e.ok)){const a=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,d=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.statusText}`;c(this,Do,"m",ys).call(this,"error",(null==e?void 0:e.error)||{errorCode:"J151001",errorDescription:d,errorMessage:a}),this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||a,(null===(o=null==e?void 0:e.error)||void 0===o?void 0:o.errorMessage)||d);const l=null===(s=null==e?void 0:e.error)||void 0===s?void 0:s.errorCode;return void("E102004"!==l&&"E103205"!==l||!this.isRestartOnError||c(this,Do,"m",Xo).call(this))}null===(d=null===(a=e.data)||void 0===a?void 0:a.runnerLogs)||void 0===d||d.forEach((e=>{const{level:t,title:n,log:i}=e;t&&this.loggerWrapper[t]?this.loggerWrapper[t](n,i):this.loggerWrapper.info(n,i)}));const v=null===(f=null===(h=null===(l=e.data)||void 0===l?void 0:l.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:y,lastAuth:$,action:b,openInNewTabUrl:w}=e.data;if(b!==Vi&&c(this,is,"f").call(this),"completed"===m)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&ki&&localStorage.setItem(Ai,JSON.stringify(e))}($),void c(this,Do,"m",ys).call(this,"success",y);w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:x,redirect:I,webauthn:R,error:O,samlIdpResponse:E,nativeResponse:N}=e.data,A=Date.now();b!==Vi?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:x,status:m,stepId:k,stepName:S,action:b,error:O}),(null===(g=x.state)||void 0===g?void 0:g.clientScripts)&&u(this,Bo,this.loadSdkScripts(x.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:b,redirectTo:null==I?void 0:I.url,screenId:null==x?void 0:x.id,screenState:null==x?void 0:x.state,webauthnTransactionId:null==R?void 0:R.transactionId,webauthnOptions:null==R?void 0:R.options,samlIdpResponseUrl:null==E?void 0:E.url,samlIdpResponseSamlResponse:null==E?void 0:E.samlResponse,samlIdpResponseRelayState:null==E?void 0:E.relayState,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:A})):this.flowState.update({action:b,reqTimestamp:A})})),os.set(this,lr((()=>l(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)}}))))),gs.set(this,gr(((e,t)=>l(this,void 0,void 0,(function*(){var n;if("true"===e.getAttribute("formnovalidate")||c(this,Do,"m",ls).call(this)){const i=null==e?void 0:e.getAttribute("id");c(this,Do,"m",us).call(this,e);const r=yield c(this,Do,"m",cs).call(this),o=(e=>Array.from((null==e?void 0:e.attributes)||[]).reduce(((e,t)=>{var n;const i=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return i?Object.assign(e,{[i]:t.value}):e}),{}))(e);if(this.nextRequestStatus.update({isLoading:!0}),c(this,Bo,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield c(this,Bo,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const s=this.loadSdkScriptsModules();if(s.length>0){const e=s.filter((e=>"function"==typeof e.refresh)).map((e=>e.refresh()));e.length>0&&(yield ur(5e3,Promise.all(e),null))}const a=this.getComponentsContext(),d=Object.assign(Object.assign(Object.assign(Object.assign({},a),o),r),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin});yield t(i,d),this.nextRequestStatus.update({isLoading:!1}),c(this,Do,"m",hs).call(this,r)}}))))),this.flowState=e}nativeResume(e,t){var n,i,r,o,s;const a=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let{exchangeCode:e}=a;e||(e=null===(n=new URL(a.url).searchParams)||void 0===n?void 0:n.get(Oi)),null===(r=(i=this.nativeCallbacks).complete)||void 0===r||r.call(i,{exchangeCode:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(a.url),t=e.searchParams.get("t"),n=e.searchParams.get(Ri).split("_").pop();c(this,is,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const e=this.nativeCallbacks.screenResolve;this.nativeCallbacks.screenResolve=null;const{override:t}=a;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=a,n=this.nativeCallbacks.screenNext;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(s=(o=this.nativeCallbacks).complete)||void 0===s||s.call(o,a)}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:{[mr(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 n=Promise.all(null==e?void 0:e.map((e=>l(this,void 0,void 0,(function*(){var n,i;const r=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(r){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=r;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}yield this.injectNpmLib("@descope/flow-scripts","1.0.4",`dist/${e.id}.js`);const o=null===(i=globalThis.descope)||void 0===i?void 0:i[e.id];return new Promise(((n,i)=>{try{const i=o(e.initArgs,{baseUrl:this.baseUrl},t(e,n));if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t),this.nextRequestStatus.subscribe((()=>{var t;this.loggerWrapper.debug("Unloading script",e.id),null===(t=i.stop)||void 0===t||t.call(i)}))}}catch(e){i(e)}}))}))))),i=new Promise((e=>{setTimeout((()=>{this.loggerWrapper.warn("SDK scripts loading timeout"),e(!0)}),5e3)}));return Promise.race([n,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 l(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)),c(this,Do,"m",Zo).call(this),window.addEventListener("visibilitychange",c(this,Ko,"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(),null===(e=c(this,qo,"f"))||void 0===e||e.abort(),u(this,qo,null,"f"),window.removeEventListener("visibilitychange",c(this,Ko,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return l(this,void 0,void 0,(function*(){let n;const i=vr(e),r=yield this.getTargetLocales();return r.includes(i.locale)?n=`${t}-${i.locale}.html`:r.includes(i.fallback)&&(n=`${t}-${i.fallback}.html`),n}))}getPageContent(e,t){return l(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,t,n){return l(this,void 0,void 0,(function*(){var i,r;const{projectId:o,flowId:s,tenant:a,stepId:h,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectUrl:y,token:$,code:b,exchangeError:w,webauthnTransactionId:C,webauthnOptions:k,redirectAuthCodeChallenge:S,redirectAuthCallbackUrl:x,redirectAuthBackupCallbackUri:I,redirectAuthInitiator:R,locale:O,samlIdpResponseUrl:E,samlIdpResponseSamlResponse:N,samlIdpResponseRelayState:A,nativeResponseType:j,nativePayload:P,reqTimestamp:M}=e,T=d(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectUrl","token","code","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","nativeResponseType","nativePayload","reqTimestamp"]);let U,W,L;const _=(()=>{const e=localStorage.getItem(Mr);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Mr,e.toString()),e}return Number(e)})(),D=this.outboundAppId,F=this.outboundAppScopes,q=this.sdk.getLastUserLoginId(),B=yield this.getFlowConfig(),K=yield this.getProjectConfig(),V=Object.entries(K.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),H=x&&S?{callbackUrl:x,codeChallenge:S,backupCallbackUri:I}:void 0,z=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}:void 0;let G={};if(!f){const e=[...B.clientScripts||[],...B.sdkScripts||[]];if(B.conditions){let t=[];({startScreenId:U,conditionInteractionId:L,startScreenName:W,clientScripts:t,componentsConfig:G}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:i})=>{var r;if("ELSE"===t)return!0;const o=null===(r=Tr[t])||void 0===r?void 0:r[n];return!!(null==o?void 0:o(e,i))}));return n?{startScreenId:n.met.screenId,startScreenName:n.met.screenName,conditionInteractionId:n.met.interactionId,clientScripts:n.met.clientScripts,componentsConfig:n.met.componentsConfig}:{}})({loginId:q,code:b,token:$,abTestingKey:_},B.conditions)),e.push(...t||[])}else B.condition?({startScreenId:U,conditionInteractionId:L}=((e,t)=>{var n;const i=null===(n=Tr[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!i)return{};const r=i(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,startScreenName:null==r?void 0:r.screenName,conditionInteractionId:null==r?void 0:r.interactionId}})(B.condition,{loginId:q,code:b,token:$,abTestingKey:_})):(W=B.startScreenName,U=B.startScreenId);if(u(this,Bo,this.loadSdkScripts(e),"f"),B.fingerprintEnabled&&B.fingerprintKey?yield un(B.fingerprintKey,this.baseUrl):localStorage.removeItem(ln),!hr(U,T)){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:H},T),{client:this.client}),y&&{redirectUrl:y}),{lastAuth:Ur(q),abTestingKey:_,locale:vr(O).locale,nativeOptions:z,outboundAppId:D,outboundAppScopes:F}),L,"",K.componentsVersion,V,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),b?{exchangeCode:b,idpInitiated:!0}:{}),T.descopeIdpInitiated&&{idpInitiated:!0}),$?{token:$}:{}),T.oidcLoginHint?{externalId:T.oidcLoginHint}:{}));return c(this,rs,"f").call(this,e),void("completed"!==(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.status)&&this.flowState.update({code:void 0,token:void 0}))}}if(f&&(n("token")&&$||n("code")&&b||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(f,h,Zi,B.version,K.componentsVersion,{token:$,exchangeCode:b,exchangeError:w});return c(this,rs,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Ji&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!E||!N)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,i)=>{const r=document.createElement("form");r.method="POST",r.action=e,r.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(r),i(r)})(E,N,A||"",fr)}if(p===Ki&&(n("redirectTo")||n("deferredRedirect")))return m?"android"===R&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(m):void this.loggerWrapper.error("Did not get redirect url");if(p===Hi||p===zi){if(!C||!k)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=c(this,qo,"f"))||void 0===r||r.abort(),u(this,qo,null,"f");try{e=p===Hi?yield this.sdk.webauthn.helpers.create(k):yield this.sdk.webauthn.helpers.get(k)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name}const n=yield this.sdk.flow.next(f,h,Zi,B.version,K.componentsVersion,{transactionId:C,response:e,failure:t});c(this,rs,"f").call(this,n)}if(p===Gi)return this.nativeCallbacks.complete=e=>l(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,h,Zi,B.version,K.componentsVersion,e);c(this,rs,"f").call(this,t)})),void c(this,Do,"m",Go).call(this,j,P);if(n("action")&&c(this,ns,"f").call(this,f,h,B.version,K.componentsVersion),!g&&!U)return void this.loggerWrapper.warn("No screen was found to show");const J=U||g,Z=yield this.getHtmlFilenameWithLocale(O,J),{oidcLoginHint:Y,oidcPrompt:X,oidcErrorRedirectUri:Q,samlIdpUsername:ee}=T,te={direction:rr(h,t.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:q,name:this.sdk.getLastUserDisplayName()||q},componentsConfig:Object.assign(Object.assign(Object.assign({},B.componentsConfig),G),null==v?void 0:v.componentsConfig)}),htmlFilename:`${J}.html`,htmlLocaleFilename:Z,screenId:J,stepName:e.stepName||W,samlIdpUsername:ee,oidcLoginHint:Y,oidcPrompt:X,oidcErrorRedirectUri:Q,action:p},ne=Ur(q);hr(U,T)?te.next=(e,t)=>l(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:H},T),{lastAuth:ne,preview:this.preview,abTestingKey:_,client:this.client}),y&&{redirectUrl:y}),{locale:vr(O).locale,nativeOptions:z,outboundAppId:D,outboundAppScopes:F}),L,e,K.componentsVersion,V,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),t),b&&{exchangeCode:b,idpInitiated:!0}),T.descopeIdpInitiated&&{idpInitiated:!0}),$&&{token:$}));return c(this,rs,"f").call(this,n),n})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(te.next=(e,t)=>l(this,void 0,void 0,(function*(){const n=yield this.sdk.flow.next(f,h,e,B.version,K.componentsVersion,t);return c(this,rs,"f").call(this,n),n}))),this.loggerWrapper.debug("Got a screen with id",te.screenId),yield c(this,Do,"m",Qo).call(this,te),this.stepState.update(te)}))}onStepChange(e,t){return l(this,void 0,void 0,(function*(){var n,i;const{htmlFilename:r,htmlLocaleFilename:o,direction:s,next:a,screenState:d}=e;this.loggerWrapper.debug("Rendering a flow screen");const u=document.createElement("template");u.innerHTML=yield this.getPageContent(r,o);const h=u.content.cloneNode(!0),f=this.loadDescopeUiComponents(u);this.sdk.webauthn.helpers.isSupported()?yield c(this,Do,"m",as).call(this,h,a):(e=>{e.querySelectorAll(`descope-button[${Bi}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(h),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(i=d.form)||void 0===i?void 0:i.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),jr(h,d,d.componentsConfig,this.formConfig,this.loggerWrapper);const{geo:p}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,p);const g=()=>l(this,void 0,void 0,(function*(){var n,i;yield f;const r=this.contentRootElement;((e,t)=>{Ar(e,"descope-totp-image",t)})(r,null===(n=null==d?void 0:d.totp)||void 0===n?void 0:n.image),((e,t)=>{Ar(e,"descope-notp-image",t)})(r,null===(i=null==d?void 0:d.notp)||void 0===i?void 0:i.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{t.querySelector(r)||i.debug(`Skipping css vars for component "${r}}"`,`Got css vars for component ${r} but Could not find it on next page`);const o=customElements.get(r);o?Object.keys(n[r]).forEach((t=>{var s;const a=n[r],d=null===(s=null==o?void 0:o.cssVarList)||void 0===s?void 0:s[t];if(!d)return void i.info(`Could not find css variable name for ${t} in ${r}`,"Check if the css variable is defined in the component");const l=a[t];e.style.setProperty(d,l)})):i.info(`Could not find component class for ${r}`,"Check if the component is registered")}))})(r,h,d.cssVars,this.loggerWrapper),r.replaceChildren(h);const o=!t.htmlFilename;setTimeout((()=>{c(this,Do,"m",fs).call(this),this.validateOnBlur&&(e=>{e.querySelectorAll("*[name]").forEach((t=>{t.addEventListener("blur",(()=>{var n;const i=()=>{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 i();const r={timer:void 0},o=e=>{"true"===e.target.getAttribute("formnovalidate")&&(clearTimeout(r.timer),r.timer=void 0)};r.timer=setTimeout((()=>{e.removeEventListener("click",o),i(),r.timer=void 0}),150),e.addEventListener("click",o,{once:!0})}))}))})(r),((e,t)=>{Rr(e,null==t?void 0:t.inputs),Rr(e,null==t?void 0:t.form)})(r,d),c(this,Do,"m",ds).call(this,{isFirstScreen:o,isCustomScreen:!1,stepName:e.stepName}),cr(r,this.autoFocus,o)})),c(this,Do,"m",ms).call(this,a),r.querySelector(`[${Bi}="polling"]`)&&a(Yi,{})}));s?c(this,Do,"m",ts).call(this,g):g()}))}};Fo=new WeakMap,qo=new WeakMap,Bo=new WeakMap,Ko=new WeakMap,es=new WeakMap,ns=new WeakMap,is=new WeakMap,rs=new WeakMap,os=new WeakMap,gs=new WeakMap,Do=new WeakSet,Vo=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1})}),300)},Ho=function(e,t,n){return l(this,void 0,void 0,(function*(){var i;return(null===(i=this.nativeOptions)||void 0===i?void 0:i.bridgeVersion)>=2&&new Promise((i=>{this.nativeCallbacks.screenNext=n,this.nativeCallbacks.screenResolve=i,c(this,Do,"m",Go).call(this,"beforeScreen",{screen:e,context:t})}))}))},zo=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&c(this,Do,"m",Go).call(this,"afterScreen",{screen:e})},Go=function(e,t){c(this,Do,"m",ys).call(this,"bridge",{type:e,payload:t})},Jo=function({errorText:e,errorType:t}){const n=()=>{var n;let i=e;try{i=(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(`[${Bi}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(this.contentRootElement,"error-message",i)};this.addEventListener("screen-updated",n,{once:!0}),n()},Zo=function(){var e,t,n;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var t=e.screenState,n=d(void 0===t?{}:t,["errorText","errorType"]),i=d(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:n})})),null===(t=this.stepState)||void 0===t||t.subscribe(c(this,Do,"m",Jo).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}})),null===(n=this.stepState)||void 0===n||n.subscribe(c(this,Do,"m",Yo).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})},Yo=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=""}))})),cr(this.contentRootElement,this.autoFocus,!1))},Xo=function(){return l(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")}))},Qo=function(e){return l(this,void 0,void 0,(function*(){var t;const n=Object.assign(Object.assign({},this.stepState.current),e),{next:i,stepName:r}=n,o=(e=>{const t=(n=e.screenState,i=(e,t)=>Qi.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(n).filter((([e,t])=>!i(0,e)))));var n,i;const{screenState:{errorText:r,errorType:o}}=e;return(r||o)&&(t.error={text:r,type:o}),e.action&&(t.action=e.action),t})(d(n,["next","stepName"]));let s=yield c(this,Do,"m",Ho).call(this,r,o,i);s||(s=Boolean(yield null===(t=this.onScreenUpdate)||void 0===t?void 0:t.call(this,r,o,i,this)));const a=!this.stepState.current.htmlFilename;if(c(this,es,"f").call(this,s),s){this.loggerWrapper.debug("Showing a custom screen"),c(this,Do,"m",ds).call(this,{isFirstScreen:a,isCustomScreen:s,stepName:e.stepName}),this.stepState.unsubscribeAll();const t=this.stepState.subscribe((()=>{this.stepState.unsubscribe(t),c(this,Do,"m",Zo).call(this)}))}this.stepState.forceUpdate=s}))},ts=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")},ss=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)}))}},as=function(e,t){return l(this,void 0,void 0,(function*(){var n;null===(n=c(this,qo,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield Pr())){const{options:e,transactionId:n}=(yield c(this,os,"f").call(this))||{};e&&n&&(c(this,Do,"m",ss).call(this,i),u(this,qo,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,c(this,qo,"f")).then((e=>l(this,void 0,void 0,(function*(){t(i.id,{transactionId:n,response:e})})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)})))}}))},ds=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&c(this,Do,"m",ys).call(this,"ready",{}),t||c(this,Do,"m",zo).call(this,n),c(this,Do,"m",ys).call(this,"page-updated",{screenName:n}),c(this,Do,"m",ys).call(this,"screen-updated",{screenName:n})},ls=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,i;"slot"!==t.localName&&(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(i=t.checkValidity)||void 0===i?void 0:i.call(t)))})),e},cs=function(){return l(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Ei}])`));return(yield Promise.all(e.map((e=>l(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})),{})}))},us=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},hs=function(e={}){var t,n;const i=pr(e,["externalId","email","phone"]),r=pr(e,["newPassword","password"]);if(i&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:i,password:r});null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.store)||void 0===n||n.call(t,e)}catch(e){this.loggerWrapper.error("Could not store credentials",e.message)}},fs=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>c(this,Do,"m",ps).call(this,e)))},ps=function(e){e&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),i=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",i),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",i),this.appendChild(t)}))},vs=function(e){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((t=>{t.addEventListener("input",(()=>{var n;(null===(n=t.checkValidity)||void 0===n?void 0:n.call(t))&&c(this,gs,"f").call(this,t,e)}))}))},ms=function(e){this.contentRootElement.querySelectorAll(`descope-button:not([${Ni}]), [data-type="button"]:not([${Ni}]`).forEach((t=>{t.onclick=()=>{c(this,gs,"f").call(this,t,e)}})),c(this,Do,"m",vs).call(this,e),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${Ei}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},ys=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",$s);var bs=Object.freeze({__proto__:null,default:$s});const ws=Yn((e=>{var t,n,i,r,o,s,a;return a=class extends(Kn(qr,Lr)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,i)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,i),"debug"===e&&c(this,t,"m",o).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&&c(this,t,"m",s).call(this,n[0]||"Error",n[1])}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),c(this,t,"m",o).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=c(this,n,"f"))||void 0===e||e.remove(),u(this,n,null,"f")},r=async function(){u(this,n,document.createElement("descope-debugger"),"f"),Object.assign(c(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Hy})),document.body.appendChild(c(this,n,"f"))},o=function(){this.debug?c(this,t,"m",r).call(this):c(this,t,"m",i).call(this)},s=function(e,t){var i;e&&(null===(i=c(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},a})),Cs="descope-modal";var ks,Ss;let xs=class{constructor(e,t){ks.set(this,void 0),this.nodeName="",u(this,ks,e,"f"),this.logger=t.logger}get asyncEle(){return(async e=>new Promise((t=>{const n=setInterval((()=>{const i="function"==typeof e?e():e;i&&(clearInterval(n),t(i))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(c(this,ks,"f"))}get ele(){var e,t;const n="function"==typeof c(this,ks,"f")?c(this,ks,"f").call(this):c(this,ks,"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)}};ks=new WeakMap;const Is=/^descope-grid-([^-]+)-column$/,Rs={text:class extends xs{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 xs{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 Os=class extends xs{constructor(){super(...arguments),this.nodeName="descope-grid",Ss.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 i=null===(n=Is.exec(t.localName))||void 0===n?void 0:n[1],r=Rs[i];return r?(e.push(new r(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);Hn(i,this.ele.columns)||(this.ele.columns=i,null===(n=c(this,Ss,"f"))||void 0===n||n.call(this,i))}onColumnsChange(e){u(this,Ss,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};Ss=new WeakMap;class Es extends xs{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")}}var Ns;class As extends xs{constructor(){super(...arguments),Ns.set(this,void 0),this.nodeName="descope-modal"}close(){var e,t;null===(e=this.ele)||void 0===e||e.removeAttribute("opened"),null===(t=this.afterClose)||void 0===t||t.call(this)}async open(){var e,t;await(null===(e=this.beforeOpen)||void 0===e?void 0:e.call(this)),null===(t=this.ele)||void 0===t||t.setAttribute("opened","true")}reset(){var e;this.ele&&(this.ele.innerHTML=""),c(this,Ns,"f")&&(null===(e=this.ele)||void 0===e||e.append(c(this,Ns,"f").content.cloneNode(!0)))}setContent(e){u(this,Ns,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Ns=new WeakMap;let js=class extends xs{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()))}},Ps=class extends xs{constructor(){super(...arguments),this.nodeName="descope-combo-box"}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)}async setData(e){var t;null===(t=await this.asyncEle)||void 0===t||t.setAttribute("data",JSON.stringify(e.sort()))}},Ms=class extends xs{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()}},Ts=class extends xs{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)}},Us=class extends xs{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")}},Ws=class extends xs{constructor(){super(...arguments),this.nodeName="descope-avatar"}set displayName(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("display-name",e)}set image(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("img",e)}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}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)}}},Ls=class extends xs{constructor(){super(...arguments),this.nodeName="descope-user-attribute"}set value(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("value",e)}set badgeLabel(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("badge-label",e)}get label(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("label"))||""}get editFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("edit-flow-id"))||""}get deleteFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("delete-flow-id"))||""}onEditClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("edit-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("edit-clicked",e)}}onDeleteClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("delete-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("delete-clicked",e)}}},_s=class extends xs{constructor(){super(...arguments),this.nodeName="descope-user-auth-method"}set fulfilled(e){var t,n;e?null===(t=this.ele)||void 0===t||t.setAttribute("fulfilled","true"):null===(n=this.ele)||void 0===n||n.removeAttribute("fulfilled")}onButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}},Ds=class extends xs{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)}}},Fs=class extends xs{constructor(){super(...arguments),this.nodeName="descope-apps-list"}set data(e){this.ele&&(this.ele.data=e)}get data(){var e;return null===(e=this.ele)||void 0===e?void 0:e.data}get ele(){return super.ele}};const qs=Yn((e=>{var t,n;const i=Kn(qr,co,so)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends As{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Cs);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(c(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Cs]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Bs="descope-notification",Ks=Yn((e=>{var t,n;const i=Kn(qr,co,so)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ms{setContent(t){const n="string"==typeof t?Vn(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Bs);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(c(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([Bs])}},t=new WeakMap,n}));function Vs(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Hs=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),zs=()=>Math.random().toString(36).substring(7).split("").join("."),Gs={INIT:`@@redux/INIT${zs()}`,REPLACE:`@@redux/REPLACE${zs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${zs()}`};function Js(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 Zs(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 Ys(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Zs(e)),t}function Xs(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Vs(2):`Expected the root reducer to be a function. Instead, received: '${Ys(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Vs(0):"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("production"===process.env.NODE_ENV?Vs(1):`Expected the enhancer to be a function. Instead, received: '${Ys(n)}'`);return n(Xs)(e,t)}let i=e,r=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("production"===process.env.NODE_ENV?Vs(3):"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 r}function u(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Vs(4):`Expected the listener to be a function. Instead, received: '${Ys(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Vs(5):"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("production"===process.env.NODE_ENV?Vs(6):"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(!Js(e))throw new Error("production"===process.env.NODE_ENV?Vs(7):`Actions must be plain objects. Instead, the actual type was: '${Ys(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("production"===process.env.NODE_ENV?Vs(8):'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("production"===process.env.NODE_ENV?Vs(17):`Action "type" property must be a string. Instead, the actual type was: '${Ys(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Vs(9):"Reducers may not dispatch actions.");try{d=!0,r=i(r,e)}finally{d=!1}return(o=s).forEach((e=>{e()})),e}h({type:Gs.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Vs(10):`Expected the nextReducer to be a function. Instead, received: '${Ys(e)}`);i=e,h({type:Gs.REPLACE})},[Hs]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Vs(11):`Expected the observer to be an object. Instead, received: '${Ys(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Hs](){return this}}}}}function Qs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function ea(e){const t=Object.keys(e),n={};for(let i=0;i<t.length;i++){const r=t[i];"production"!==process.env.NODE_ENV&&void 0===e[r]&&Qs(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const i=Object.keys(n);let r,o;"production"!==process.env.NODE_ENV&&(r={});try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:Gs.INIT}))throw new Error("production"===process.env.NODE_ENV?Vs(12):`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:Gs.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Vs(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Gs.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;if("production"!==process.env.NODE_ENV){const i=function(e,t,n,i){const r=Object.keys(t),o=n&&n.type===Gs.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===r.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Js(e))return`The ${o} has unexpected type of "${Ys(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!i[e]));return s.forEach((e=>{i[e]=!0})),n&&n.type===Gs.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: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);i&&Qs(i)}let s=!1;const a={};for(let r=0;r<i.length;r++){const o=i[r],d=n[o],l=e[o],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?Vs(14):`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||i.length!==Object.keys(e).length,s?a:e}}function ta(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function na(e){return Js(e)&&"type"in e&&"string"==typeof e.type}var ia=Symbol.for("immer-nothing"),ra=Symbol.for("immer-draftable"),oa=Symbol.for("immer-state"),sa="production"!==process.env.NODE_ENV?[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 aa(e,...t){if("production"!==process.env.NODE_ENV){const n=sa[e],i="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var da=Object.getPrototypeOf;function la(e){return!!e&&!!e[oa]}function ca(e){return!!e&&(ha(e)||Array.isArray(e)||!!e[ra]||!!e.constructor?.[ra]||ma(e)||ya(e))}var ua=Object.prototype.constructor.toString();function ha(e){if(!e||"object"!=typeof e)return!1;const t=da(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)===ua}function fa(e,t){0===pa(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function pa(e){const t=e[oa];return t?t.type_:Array.isArray(e)?1:ma(e)?2:ya(e)?3:0}function ga(e,t){return 2===pa(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function va(e,t,n){const i=pa(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function ma(e){return e instanceof Map}function ya(e){return e instanceof Set}function $a(e){return e.copy_||e.base_}function ba(e,t){if(ma(e))return new Map(e);if(ya(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&ha(e)){if(!da(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[oa];let i=Reflect.ownKeys(n);for(let t=0;t<i.length;t++){const r=i[t],o=n[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(n[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[r]})}return Object.create(da(e),n)}function wa(e,t=!1){return ka(e)||la(e)||!ca(e)||(pa(e)>1&&(e.set=e.add=e.clear=e.delete=Ca),Object.freeze(e),t&&fa(e,((e,t)=>wa(t,!0)))),e}function Ca(){aa(2)}function ka(e){return Object.isFrozen(e)}var Sa,xa={};function Ia(e){const t=xa[e];return t||aa(0,e),t}function Ra(){return Sa}function Oa(e,t){t&&(Ia("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ea(e){Na(e),e.drafts_.forEach(ja),e.drafts_=null}function Na(e){e===Sa&&(Sa=e.parent_)}function Aa(e){return Sa={drafts_:[],parent_:Sa,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ja(e){const t=e[oa];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Pa(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[oa].modified_&&(Ea(t),aa(4)),ca(e)&&(e=Ma(t,e),t.parent_||Ua(t,e)),t.patches_&&Ia("Patches").generateReplacementPatches_(n[oa].base_,e,t.patches_,t.inversePatches_)):e=Ma(t,n,[]),Ea(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ia?e:void 0}function Ma(e,t,n){if(ka(t))return t;const i=t[oa];if(!i)return fa(t,((r,o)=>Ta(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return Ua(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let r=t,o=!1;3===i.type_&&(r=new Set(t),t.clear(),o=!0),fa(r,((r,s)=>Ta(e,i,t,r,s,n,o))),Ua(e,t,!1),n&&e.patches_&&Ia("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Ta(e,t,n,i,r,o,s){if("production"!==process.env.NODE_ENV&&r===n&&aa(5),la(r)){const s=Ma(e,r,o&&t&&3!==t.type_&&!ga(t.assigned_,i)?o.concat(i):void 0);if(va(n,i,s),!la(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(ca(r)&&!ka(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ma(e,r),t&&t.scope_.parent_||Ua(e,r)}}function Ua(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&wa(t,n)}var Wa={get(e,t){if(t===oa)return e;const n=$a(e);if(!ga(n,t))return function(e,t,n){const i=Da(t,n);return i?"value"in i?i.value:i.get?.call(e.draft_):void 0}(e,n,t);const i=n[t];return e.finalized_||!ca(i)?i:i===_a(e.base_,t)?(qa(e),e.copy_[t]=Ba(i,e)):i},has:(e,t)=>t in $a(e),ownKeys:e=>Reflect.ownKeys($a(e)),set(e,t,n){const i=Da($a(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=_a($a(e),t),r=i?.[oa];if(r&&r.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,i)&&(void 0!==n||ga(e.base_,t)))return!0;qa(e),Fa(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!==_a(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,qa(e),Fa(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=$a(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){aa(11)},getPrototypeOf:e=>da(e.base_),setPrototypeOf(){aa(12)}},La={};function _a(e,t){const n=e[oa];return(n?$a(n):e)[t]}function Da(e,t){if(!(t in e))return;let n=da(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=da(n)}}function Fa(e){e.modified_||(e.modified_=!0,e.parent_&&Fa(e.parent_))}function qa(e){e.copy_||(e.copy_=ba(e.base_,e.scope_.immer_.useStrictShallowCopy_))}fa(Wa,((e,t)=>{La[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),La.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&aa(13),La.set.call(this,e,t,void 0)},La.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&aa(14),Wa.set.call(this,e[0],t,n,e[0])};function Ba(e,t){const n=ma(e)?Ia("MapSet").proxyMap_(e,t):ya(e)?Ia("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:Ra(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=Wa;n&&(r=[i],o=La);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:Ra()).drafts_.push(n),n}function Ka(e){return la(e)||aa(10,e),Va(e)}function Va(e){if(!ca(e)||ka(e))return e;const t=e[oa];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ba(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ba(e,!0);return fa(n,((e,t)=>{va(n,e,Va(t))})),t&&(t.finalized_=!1),n}var Ha=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 i=this;return function(e=n,...r){return i.produce(e,(e=>t.call(this,e,...r)))}}let i;if("function"!=typeof t&&aa(6),void 0!==n&&"function"!=typeof n&&aa(7),ca(e)){const r=Aa(this),o=Ba(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?Ea(r):Na(r)}return Oa(r,n),Pa(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===ia&&(i=void 0),this.autoFreeze_&&wa(i,!0),n){const t=[],r=[];Ia("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}aa(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,i;const r=this.produce(e,t,((e,t)=>{n=e,i=t}));return[r,n,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ca(e)||aa(8),la(e)&&(e=Ka(e));const t=Aa(this),n=Ba(e,void 0);return n[oa].isManual_=!0,Na(t),n}finishDraft(e,t){const n=e&&e[oa];n&&n.isManual_||aa(9);const{scope_:i}=n;return Oa(i,t),Pa(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));const i=Ia("Patches").applyPatches_;return la(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},za=Ha.produce;Ha.produceWithPatches.bind(Ha),Ha.setAutoFreeze.bind(Ha),Ha.setUseStrictShallowCopy.bind(Ha),Ha.applyPatches.bind(Ha),Ha.createDraft.bind(Ha),Ha.finishDraft.bind(Ha);var Ga=(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})}}},Ja=(e,t,n)=>{const{memoize:i,memoizeOptions:r}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=i((()=>({})),...r);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})}},Za={inputStabilityCheck:"once",identityFunctionCheck:"once"};var Ya=e=>Array.isArray(e)?e:[e];function Xa(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 Qa(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var ed="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},td=0,nd=1;function id(){return{s:td,v:void 0,o:null,p:null}}function rd(e,t={}){let n=id();const{resultEqualityCheck:i}=t;let r,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 i=e.get(n);void 0===i?(t=id(),e.set(n,t)):t=i}else{let e=t.p;null===e&&(t.p=e=new Map);const i=e.get(n);void 0===i?(t=id(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===nd)d=t.v;else if(d=e.apply(null,arguments),o++,i){const e=r?.deref?.()??r;null!=e&&i(e,d)&&(d=e,0!==o&&o--);r="object"==typeof d&&null!==d||"function"==typeof d?new ed(d):d}return a.s=nd,a.v=d,d}return s.clearCache=()=>{n=id(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function od(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,i=(...e)=>{let t,i=0,r=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=rd,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=Ya(l),p=Ya(u),g=Xa(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const y=c((function(){r++;const e=Qa(g,arguments);if(t=v.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:i}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:i}={...Za,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Ga},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Ja}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=Qa(g,arguments);i.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:f},arguments)}m&&(m=!1)}return t}),...p);return Object.assign(y,{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:d,argsMemoize:c})};return Object.assign(i,{withTypes:()=>i}),i}var sd=od(rd),ad=Object.assign(((e,t=sd)=>{!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),i=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,i)=>(e[n[i]]=t,e)),{})));return i}),{withTypes:()=>ad});function dd(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var ld=dd(),cd=dd;((...e)=>{const t=od(...e)})(rd);var ud="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ta:ta.apply(null,arguments)},hd=e=>e&&"function"==typeof e.match;function fd(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?zd(0):"prepareAction did not return an object");return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>na(t)&&t.type===e,n}function pd(e){return"function"==typeof e&&"type"in e&&hd(e)}function gd(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 vd=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 md(e){return ca(e)?za(e,(()=>{})):e}function yd(e,t,n){if(e.has(t)){let i=e.get(t);return n.update&&(i=n.update(i,t,e),e.set(t,i)),i}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?zd(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function $d(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function bd(e,t,n){const i=wd(e,t,n);return{detectMutations:()=>Cd(e,t,i,n)}}function wd(e,t=[],n,i="",r=new Set){const o={value:n};if(!e(n)&&!r.has(n)){r.add(n),o.children={};for(const r in n){const s=i?i+"."+r:r;t.length&&-1!==t.indexOf(s)||(o.children[r]=wd(e,t,n[r],s))}}return o}function Cd(e,t=[],n,i,r=!1,o=""){const s=n?n.value:void 0,a=s===i;if(r&&!a&&!Number.isNaN(i))return{wasMutated:!0,path:o};if(e(s)||e(i))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in i)d[e]=!0;const l=t.length>0;for(let r in d){const s=o?o+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Cd(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function kd(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Js(e)}function Sd(e,t="",n=kd,i,r=[],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!=i?i(e):Object.entries(e),d=r.length>0;for(const[e,l]of a){const a=t?t+"."+e:e;if(d){if(r.some((e=>e instanceof RegExp?e.test(a):a===e)))continue}if(!n(l))return{keyPath:a,value:l};if("object"==typeof l&&(s=Sd(l,a,n,i,r,o),s))return s}return o&&xd(e)&&o.add(e),!1}function xd(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!xd(t))return!1;return!0}function Id(e){return"boolean"==typeof e}var Rd=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new vd;if(t&&(Id(t)?o.push(ld):o.push(cd(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Id(n)||(e=n),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,i,r){return JSON.stringify(e,n(t,r),i)},n=function(e,t){let n=[],i=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,o){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,r):i.push(r),~n.indexOf(o)&&(o=t.call(this,r,o))}else n.push(o);return null==e?o:e.call(this,r,o)}},{isImmutable:i=$d,ignoredPaths:r,warnAfter:o=32}=e;const s=bd.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=gd(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?zd(19):`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(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?zd(20):`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(i){let e={};Id(i)||(e=i),o.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=kd,getEntries:n,ignoredActions:i=[],ignoredActionPaths:r=["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(!na(u))return l(u);const h=l(u),f=gd(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=Sd(u,"",t,n,r,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 i=Sd(e.getState(),"",t,n,o,c);if(i){const{keyPath:e,value:t}=i;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(r){let e={};Id(r)||(e=r),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=pd}=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},Od=e=>t=>{setTimeout(t,e)},Ed="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Od(10),Nd=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new vd(e);return n&&i.push(((e={type:"raf"})=>t=>(...n)=>{const i=t(...n);let r=!0,o=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Ed:"callback"===e.type?e.queueNotification:Od(e.timeout),l=()=>{s=!1,o&&(o=!1,a.forEach((e=>e())))};return Object.assign({},i,{subscribe(e){const t=i.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,o=!r,o&&(s||(s=!0,d(l))),i.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),i},Ad="production"===process.env.NODE_ENV;function jd(e){const t=Rd(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Js(n))throw new Error("production"===process.env.NODE_ENV?zd(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ea(n)}if(!Ad&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?zd(2):"`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!Ad&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?zd(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Ad&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?zd(4):"each middleware provided to configureStore must be a function");let l=ta;r&&(l=ud({trace:!Ad,..."object"==typeof r&&r}));const c=function(...e){return t=>(n,i)=>{const r=t(n,i);let o=()=>{throw new Error("production"===process.env.NODE_ENV?Vs(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:r.getState,dispatch:(e,...t)=>o(e,...t)},a=e.map((e=>e(s)));return o=ta(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=Nd(c);if(!Ad&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?zd(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Ad&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?zd(6):"`enhancers` callback must return an array");if(!Ad&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?zd(7):"each enhancer provided to configureStore must be a function");Ad||!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 Xs(a,o,l(...h))}function Pd(e){const t={},n=[];let i;const r={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?zd(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?zd(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(!s)throw new Error("production"===process.env.NODE_ENV?zd(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?zd(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=o,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?zd(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),r},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&i)throw new Error("production"===process.env.NODE_ENV?zd(31):"`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function Md(...e){return t=>e.some((e=>((e,t)=>hd(e)?e.match(t):e(t))(e,t)))}var Td=["name","message","stack","code"],Ud=class{constructor(e,t){this.payload=e,this.meta=t}_type},Wd=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ld=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Td)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},_d=(()=>{function e(e,t,n){const i=fd(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=fd(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=fd(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||Ld)(e||"Rejected"),meta:{...o||{},arg:i,requestId:t,rejectedWithValue:!!r,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(r(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 Ud(e,t),fulfillWithValue:(e,t)=>new Wd(e,t)})).then((t=>{if(t instanceof Ud)throw t;return t instanceof Wd?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof Ud?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(Dd)})}}),{pending:r,rejected:o,fulfilled:i,settled:Md(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function Dd(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Fd=Symbol.for("rtk-slice-createasyncthunk");function qd(e,t){return`${e}/${t}`}function Bd(e,t,n,i){function r(r,...o){let s=n.call(e,r);if(void 0===s)if(i)s=e.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?zd(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...o)}return r.unwrapped=t,r}var Kd=function({creators:e}={}){const t=e?.asyncThunk?.[Fd];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?zd(11):"`name` is a required option for createSlice");"undefined"!=typeof process&&"development"===process.env.NODE_ENV&&void 0===e.initialState&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const r=("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(r),s={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error("production"===process.env.NODE_ENV?zd(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?zd(13):"`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("production"!==process.env.NODE_ENV&&"object"==typeof e.extraReducers)throw new Error("production"===process.env.NODE_ENV?zd(14):"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=[],i]="function"==typeof e.extraReducers?Pd(e.extraReducers):[e.extraReducers],r={...t,...s.sliceCaseReducersByType};return function(e,t){if("production"!==process.env.NODE_ENV&&"object"==typeof t)throw new Error("production"===process.env.NODE_ENV?zd(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let n,[i,r,o]=Pd(t);if(function(e){return"function"==typeof e}(e))n=()=>md(e());else{const t=md(e);n=()=>t}function s(e=n(),t){let s=[i[t.type],...r.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(la(e)){const i=n(e,t);return void 0===i?e:i}if(ca(e))return za(e,(e=>n(e,t)));{const i=n(e,t);if(void 0===i){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?zd(9):"A case reducer on a non-draftable value must not return undefined")}return i}}return e}),e)}return s.getInitialState=n,s}(e.initialState,(e=>{for(let t in r)e.addCase(t,r[t]);for(let t of s.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);i&&e.addDefaultCase(i)}))}o.forEach((i=>{const o=r[i],s={reducerName:i,type:qd(n,i),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(o)?function({type:e,reducerName:t,createNotation:n},i,r){let o,s;if("reducer"in i){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(i))throw new Error("production"===process.env.NODE_ENV?zd(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");o=i.reducer,s=i.prepare}else o=i;r.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,s?fd(e,s):fd(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("production"===process.env.NODE_ENV?zd(18):"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=r(e,o,c);i.exposeAction(t,u),s&&i.addCase(u.fulfilled,s);a&&i.addCase(u.pending,a);d&&i.addCase(u.rejected,d);l&&i.addMatcher(u.settled,l);i.exposeCaseReducer(t,{fulfilled:s||Vd,pending:a||Vd,rejected:d||Vd,settled:l||Vd})}(s,o,a,t)}));const l=e=>e,c=new WeakMap;let u;const h={name:n,reducerPath:i,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=yd(c,this,{insert:()=>new WeakMap});return yd(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Bd(this,r,t,this!==h);return n}})},selectSlice(e){let t=e[this.reducerPath];if(void 0===t)if(this!==h)t=this.getInitialState();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?zd(15):"selectSlice returned undefined for an uninjected slice reducer");return t},get selectors(){return this.getSelectors(this.selectSlice)},injectInto(e,{reducerPath:t,...n}={}){const i=t??this.reducerPath;return e.inject({reducerPath:i,reducer:this.reducer},n),{...this,reducerPath:i}}};return h}}();function Vd(){}var Hd="listenerMiddleware";function zd(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}fd(`${Hd}/add`),fd(`${Hd}/removeAll`),fd(`${Hd}/remove`);const Gd=e=>Yn((t=>{const n=Kd(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Kn(Lr)(t)){constructor(...e){super(...e);const t=jd({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const i=await t.dispatch(e(...n));try{Dd(i)}catch(e){this.logger.error(e.message,i.type,e.stack)}return i},o=Object.keys(i).reduce(((e,t)=>(e[t]=r(i[t]),e)),{});this.actions=o,this.subscribe=(e,n=e=>e)=>t.subscribe((()=>e(n(t.getState()))))}}})),Jd=Yn((e=>class extends(Lr(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()}})),Zd=Yn((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}}));var Yd={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 Xd(e){return Xd="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},Xd(e)}function Qd(e){var t=il();return function(){var n,i=ol(e);if(t){var r=ol(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Xd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return el(e)}(this,n)}}function el(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tl(e){var t="function"==typeof Map?new Map:void 0;return tl=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,i)}function i(){return nl(e,arguments,ol(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),rl(i,e)},tl(e)}function nl(e,t,n){return nl=il()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&rl(r,n.prototype),r},nl.apply(null,arguments)}function il(){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 rl(e,t){return rl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},rl(e,t)}function ol(e){return ol=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ol(e)}var sl=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&&rl(e,t)}(i,e);var t,n=Qd(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=n.call(this,e),Object.setPrototypeOf(el(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(tl(Error)),al=2,dl=17,ll=3,cl="0-90-9٠-٩۰-۹",ul="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),hl="++";function fl(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),i=t[0].split("."),r=0;r<3;r++){var o=Number(n[r]),s=Number(i[r]);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 pl={}.constructor;function gl(e){return null!=e&&e.constructor===pl}function vl(e){return vl="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},vl(e)}function ml(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yl(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var $l=" ext. ",bl=/^\d+$/,wl=function(){function e(t){ml(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!gl(e)||!gl(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(gl(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Rl(e)+": "+e,"."))}(t),this.metadata=t,Nl.call(this,t)}return yl(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&&bl.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Cl(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Cl(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 i=this.countryCallingCodes()[e];if(i&&1===i.length&&"001"===i[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(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}(),Cl=function(){function e(t,n){ml(this,e),this.globalMetadataObject=n,this.metadata=t,Nl.call(this,n.metadata)}return yl(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 kl(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()&&Il(this.types(),e))return new xl(Il(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?$l:this.metadata[13]||$l}}]),e}(),kl=function(){function e(t,n){ml(this,e),this._format=t,this.metadata=n}return yl(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()||Sl.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Sl=/^\(?\$1\)?$/,xl=function(){function e(t,n){ml(this,e),this.type=t,this.metadata=n}return yl(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 Il(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 Rl=function(e){return vl(e)};function Ol(e,t){if((t=new wl(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function El(e,t){return t.countries.hasOwnProperty(e)}function Nl(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===fl(t,"1.2.0")?this.v2=!0:-1===fl(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Al=function(e){return"([".concat(cl,"]{1,").concat(e,"})")};function jl(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+Al("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+Al("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+Al("9")+i)+"|"+("[- ]+"+Al("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+Al("15")+i)+"|"+(r+"(?:,)+"+n+Al("9")+i)}var Pl="["+cl+"]{"+al+"}",Ml="[++]{0,1}(?:["+ul+"]*["+cl+"]){3,}["+ul+cl+"]*",Tl=new RegExp("^[++]{0,1}(?:["+ul+"]*["+cl+"]){1,2}$","i"),Ul=Ml+"(?:"+jl()+")?",Wl=new RegExp("^"+Pl+"$|^"+Ul+"$","i");var Ll=new RegExp("(?:"+jl()+")$","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 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 i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Fl={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 ql(e){return Fl[e]}function Bl(e){for(var t,n="",i=_l(e.split(""));!(t=i()).done;){var r=ql(t.value);r&&(n+=r)}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 Vl(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 Vl(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Hl(e){for(var t,n="",i=Kl(e.split(""));!(t=i()).done;){n+=zl(t.value,n)||""}return n}function zl(e,t,n){if("+"===e){if(t)return;return"+"}return ql(e)}function Gl(e,t){return function(e,t,n){var i=n.type(t),r=i&&i.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";var o=e.length,s=r[0];if(s===o)return"IS_POSSIBLE";if(s>o)return"TOO_SHORT";if(r[r.length-1]<o)return"TOO_LONG";return r.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Jl(e,t){return"IS_POSSIBLE"===Gl(e,t)}function Zl(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Yl(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 Xl(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 Xl(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Xl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Ql=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ec(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new wl(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(Zl(i,n.nationalNumberPattern())){if(tc(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?tc(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=Yl(Ql);!(r=o()).done;){var s=r.value;if(tc(i,s,n))return s}}}}function tc(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Zl(e,t.pattern()))}function nc(e,t,n){var i=new wl(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new wl(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function ic(e){return e.replace(new RegExp("[".concat(ul,"]+"),"g")," ").trim()}var rc=/(\$\d)/;function oc(e,t,n){var i=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var o=e.replace(new RegExp(t.pattern()),i?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(rc,t.nationalPrefixFormattingRule()):t.format());return i?ic(o):o}var sc=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function ac(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 dc(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 dc(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function lc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lc(Object(n),!0).forEach((function(t){uc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hc={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function fc(e,t,n,i){if(n=n?cc(cc({},hc),n):hc,i=new wl(i),e.country&&"001"!==e.country){if(!i.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));i.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";i.selectNumberingPlan(e.countryCallingCode)}var r,o=i.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?vc(r=pc(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=pc(s,null,"INTERNATIONAL",i,n),vc(r="+".concat(o," ").concat(r),e.ext,i,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,i,r){var o=Ol(i,r.metadata);if(o===n){var s=pc(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new wl(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():sc.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(pc(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return vc(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function pc(e,t,n,i,r){var o=gc(i.formats(),e);return o?oc(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function gc(e,t){for(var n,i=ac(e);!(n=i()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var o=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(o))continue}if(Zl(t,r.pattern()))return r}}function vc(e,t,n,i){return t?i(e,t,n):e}function mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function yc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mc(Object(n),!0).forEach((function(t){$c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bc(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var wc=function(){function e(t,n,i){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(!i)throw new TypeError("`metadata` not passed");var r=function(e,t){var n,i,r=new wl(t);Cc(e)?(n=e,r.selectNumberingPlan(n),i=r.countryCallingCode()):i=e;return{country:n,countryCallingCode:i}}(t,i),o=r.country,s=r.countryCallingCode;this.country=o,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return i}}return bc(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:nc(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new wl(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 Jl(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 wl(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==ec(e,t,n.metadata):Zl(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new wl(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return ec(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return fc(this,e,t?yc(yc({},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}(),Cc=function(e){return/^[A-Z]{2}$/.test(e)};var kc=new RegExp("(["+cl+"])");function Sc(e,t,n,i){if(t){var r=new wl(i);r.selectNumberingPlan(t,n);var o=new RegExp(r.IDDPrefix());if(0===e.search(o)){var s=(e=e.slice(e.match(o)[0].length)).match(kc);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function xc(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),i=n.exec(e);if(i){var r,o,s,a=i.length-1,d=a>0&&i[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(o=i[1]);else{var l=i[0];r=e.slice(l.length),d&&(o=i[1])}if(d){var c=e.indexOf(i[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=i[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:o}}}return{nationalNumber:e}}function Ic(e,t){var n=xc(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Zl(e,n.nationalNumberPattern())&&!Zl(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Gl(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function Rc(e,t,n,i){var r=t?Ol(t,i):n;if(0===e.indexOf(r)){(i=new wl(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=Ic(o,i).nationalNumber,a=Ic(e,i).nationalNumber;if(!Zl(a,i.nationalNumberPattern())&&Zl(s,i.nationalNumberPattern())||"TOO_LONG"===Gl(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function Oc(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=Sc(e,t,n,i);if(!o||o===e){if(t||n){var s=Rc(e,t,n,i),a=s.countryCallingCode,d=s.number;if(a)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:a,number:d}}return{number:e}}r=!0,e="+"+o}if("0"===e[1])return{};i=new wl(i);for(var l=2;l-1<=ll&&l<=e.length;){var c=e.slice(1,l);if(i.hasCallingCode(c))return i.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function Ec(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 Nc(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 Nc(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Nc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Ac(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new wl(i);for(var r,o=Ec(n);!(r=o()).done;){var s=r.value;if(i.country(s),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return s}else if(ec({phone:e,country:s},void 0,i.metadata))return s}}function jc(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:Ac(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var Pc="+",Mc="(["+cl+"]|[\\-\\.\\(\\)]?)",Tc=new RegExp("^\\"+Pc+Mc+"*["+cl+"]"+Mc+"*$","g"),Uc=new RegExp("^("+("["+cl+"]+((\\-)*["+cl+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+cl+"])*")+"\\.?$","g"),Wc="tel:",Lc=";phone-context=",_c=";isub=";function Dc(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Lc);if(t<0)return null;var n=t+Lc.length;if(n>=e.length)return"";var i=e.indexOf(";",n);return i>=0?e.substring(n,i):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(Tc.test(e)||Uc.test(e))}(r))throw new sl("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===Pc&&(n+=r);var o,s=e.indexOf(Wc);o=s>=0?s+Wc.length:0;var a=e.indexOf(Lc);n+=e.substring(o,a)}var d=n.indexOf(_c);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Fc=250,qc=new RegExp("[++"+cl+"]"),Bc=new RegExp("[^"+cl+"#]+$");function Kc(e,t,n){if(t=t||{},n=new wl(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new sl("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=Dc(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>Fc){if(n)throw new sl("TOO_LONG");return}if(!1===t)return e;var i=e.search(qc);if(i<0)return;return e.slice(i).replace(Bc,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=al&&Wl.test(e)}(i))return function(e){return Tl.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Ll);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(Ll),r=1;r<i.length;){if(i[r])return{number:n,ext:i[r]};r++}}(i);if(r.ext)return r;return{number:i}}(e,t.v2,t.extract),r=i.number,o=i.ext,s=i.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new sl("TOO_SHORT");throw new sl("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=Oc(Hl(e),t,n,i.metadata),s=o.countryCallingCodeSource,a=o.countryCallingCode,d=o.number;if(a)i.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};i.selectNumberingPlan(t,n),t&&(r=t),a=n||Ol(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=Ic(Hl(d),i),c=l.nationalNumber,u=l.carrierCode,h=jc(a,{nationalNumber:c,defaultCountry:t,metadata:i});h&&(r=h,"001"===h||i.country(r));return{country:r,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:c,carrierCode:u}}(r,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 sl("INVALID_COUNTRY");return{}}if(!l||l.length<al){if(t.v2)throw new sl("TOO_SHORT");return{}}if(l.length>dl){if(t.v2)throw new sl("TOO_LONG");return{}}if(t.v2){var f=new wc(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)&&Zl(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!Jl(l,n)),phone:l,ext:o}:p?function(e,t,n){var i={country:e,phone:t};n&&(i.ext=n);return i}(d,l,o):{}}function Vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Hc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vc(Object(n),!0).forEach((function(t){zc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}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 Zc(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 i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Yc(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 Yc(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 Yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Xc(e){var t,n,i,r=Zc(Array.prototype.slice.call(e),4),o=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof o)throw new TypeError("A text for parsing must be a string.");if(t=o,s&&"string"!=typeof s){if(!gl(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,i=a):i=s}else d?(n=a,i=d):(n=void 0,i=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gc(Object(n),!0).forEach((function(t){Jc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:i}}function Qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function eu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(n),!0).forEach((function(t){tu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nu(e,t,n){t&&t.defaultCountry&&!El(t.defaultCountry,n)&&(t=eu(eu({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Kc(e,Hc(Hc({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof sl))throw e}}function iu(){var e=Xc(arguments);return nu(e.text,e.options,e.metadata)}function ru(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ou(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var su=ru((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;ou(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),au=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;ou(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return ru(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new su(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new su(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 du(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var lu=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 au(t)}return du(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 cu(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function uu(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var hu=" - \u2028\u2029 ",fu="[".concat(hu,"]"),pu="[^".concat(hu,"]"),gu="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),vu="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",mu="[".concat(vu,"]"),yu=new RegExp(mu),$u="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),bu=new RegExp($u),wu="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),Cu=new RegExp(wu),ku=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function Su(e){return!(!yu.test(e)&&!Cu.test(e))&&ku.test(e)}function xu(e){return"%"===e||bu.test(e)}function Iu(e,t,n){var i=!0,r=iu(e,n);if(r||(i=!1,r=iu(e,{defaultCallingCode:t.countryCallingCode},n)),!r)return"INVALID_NUMBER";if(t.ext){if(r.ext!==t.ext)return"NO_MATCH"}else if(r.ext)return"NO_MATCH";return i&&t.countryCallingCode!==r.countryCallingCode?"NO_MATCH":t.number===r.number?i?"EXACT_MATCH":"NSN_MATCH":0===t.nationalNumber.indexOf(r.nationalNumber)||0===r.nationalNumber.indexOf(t.nationalNumber)?"SHORT_NSN_MATCH":"NO_MATCH"}var Ru={POSSIBLE:function(e,t){return t.candidate,t.metadata,!0},VALID:function(e,t){var n=t.candidate;t.defaultCountry;var i=t.metadata;return!(!e.isValid()||!Ou(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!Ou(e,n,r)||Nu(e,n)||!Eu(e,{defaultCountry:i,metadata:r}))&&Au()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!Ou(e,n,r)||Nu(e,n)||!Eu(e,{defaultCountry:i,metadata:r}))&&Au()}};function Ou(e,t,n){for(var i=0;i<t.length-1;i++){var r=t.charAt(i);if("x"===r||"X"===r){var o=t.charAt(i+1);if("x"===o||"X"===o){if(i++,"NSN_MATCH"!==Iu(t.substring(i),e,n))return!1}else{var s=Bl(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function Eu(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new wl(i);r.selectNumberingPlan(e.countryCallingCode),e.country||jc(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=gc(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function Nu(e,t){var n=t.indexOf("/");if(n<0)return!1;var i=t.indexOf("/",n+1);return!(i<0)&&(!("FROM_NUMBER_WITH_PLUS_SIGN"===e.__countryCallingCodeSource||"FROM_NUMBER_WITHOUT_PLUS_SIGN"===e.__countryCallingCodeSource)||Bl(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function Au(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var ju=/[\\/] *x/;function Pu(e){return uu(ju,e)}var Mu=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,Tu=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,Uu=/^:[0-5]\d/;function Wu(e,t,n){if(Mu.test(e))return!1;if(Tu.test(e)){var i=n.slice(t+e.length);if(Uu.test(i))return!1}return!0}var Lu="(\\[([",_u=")\\])]",Du="[^".concat(Lu).concat(_u,"]"),Fu="[".concat(Lu).concat(hl,"]"),qu=new RegExp("^"+Fu),Bu=cu(0,3),Ku=new RegExp("^(?:[(\\[([])?(?:"+Du+"+["+_u+"])?"+Du+"+(?:["+Lu+"]"+Du+"+["+_u+"])"+Bu+Du+"*$"),Vu=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function Hu(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 zu(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 zu(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 zu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Gu(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ju=jl(),Zu=["\\/+(.*)/","(\\([^(]*)","(?:".concat(fu,"-|-").concat(fu,")").concat(fu,"*(.+)"),"[‒-―-]".concat(fu,"*(.+)"),"\\.+".concat(fu,"*([^.]+)"),"".concat(fu,"+(").concat(pu,"+)")],Yu=cu(0,2),Xu=cu(0,4),Qu=dl+ll,eh=cu(0,Qu),th="[".concat(ul,"]")+Xu,nh=gu+cu(1,Qu),ih="(?:"+Fu+th+")"+Yu+nh+"(?:"+th+nh+")"+eh+"(?:"+Ju+")?",rh=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(vu,"#]+$")),oh=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,sh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=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&&El(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||oh}).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=i,this.leniency=Ru[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(ih,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new lu(32)}return Gu(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(Wu(t=Pu(t),n,this.text)){var i=this.parseAndVerify(t,n,this.text)||this.extractInnerMatch(t,n,this.text);if(i){if(this.options.v2)return{startsAt:i.startsAt,endsAt:i.endsAt,number:i.phoneNumber};var r=i.phoneNumber,o={startsAt:i.startsAt,endsAt:i.endsAt,phone:r.nationalNumber};return r.country?o.country=r.country:o.countryCallingCode=r.countryCallingCode,r.ext&&(o.ext=r.ext),o}}this.maxTries--}}},{key:"extractInnerMatch",value:function(e,t,n){for(var i,r=Hu(Zu);!(i=r()).done;)for(var o=i.value,s=!0,a=void 0,d=new RegExp(o,"g");this.maxTries>0&&null!==(a=d.exec(e));){if(s){var l=uu(rh,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=uu(rh,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,i){if(Ku.test(e)&&!Vu.test(e)){if("POSSIBLE"!==i){if(t>0&&!qu.test(e)){var r=n[t-1];if(xu(r)||Su(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(xu(s)||Su(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=iu(e,{extended:!0,defaultCountry:this.options.defaultCountry,defaultCallingCode:this.options.defaultCallingCode},this.metadata);if(i&&i.isPossible())return this.leniency(i,{candidate:e,defaultCountry:this.options.defaultCountry,metadata:this.metadata,regExpCache:this.regExpCache})?{startsAt:t,endsAt:t+e.length,phoneNumber:i}: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 ah(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var dh=function(){function e(t){var n=t.onCountryChange,i=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=i}return ah(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 i=n[t];this[i]=e[i]}}},{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 lh(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 ch(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 ch(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 ch(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var uh="x",hh=new RegExp(uh);function fh(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function ph(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 i=0,r="";t.push(e.length);for(var o=0,s=t;o<s.length;o++){var a=s[o];r+=e.slice(i,a),i=a+1}return r}(e.slice(0,t))}function gh(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,n){var i=n.metadata,r=n.shouldTryNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,r(t)){var s=vh(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return vh(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function vh(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=oc(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:r,metadata:i});if(r||(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 mh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var yh=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return mh(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,i=t.instructions;if(n)return{op:"|",args:n.concat([Ch(i)])};if(0===i.length)throw new Error("Pattern is required");return 1===i.length?i[0]:i}},{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(wh);if(t){var n=t[1],i=e.slice(0,t.index),r=e.slice(t.index+n.length);switch(n){case"(?:":i&&this.parsePattern(i),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw new Error('")" operator must be preceded by "(?:" operator');if(i&&this.parsePattern(i),0===this.getContext().instructions.length)throw new Error('No instructions found after "|" operator in an "or" group');var o=this.getContext().branches;o.push(Ch(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(i&&this.parsePattern(i),!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(Ch(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":i&&this.parsePattern(i),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:$h(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(bh.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function $h(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 i=e[n-1].charCodeAt(0)+1,r=e[n+1].charCodeAt(0)-1,o=i;o<=r;)t.push(String.fromCharCode(o)),o++}else t.push(e[n]);n++}return t}var bh=/[\(\)\[\]\?\:\|]/,wh=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Ch(e){return 1===e.length?e[0]:e}function kh(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 i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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,i=new Array(t);n<t;n++)i[n]=e[n];return i}function xh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ih=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 yh).parse(t)}return xh(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=Rh(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function Rh(e,t,n){if("string"==typeof t){var i=e.join("");return 0===t.indexOf(i)?e.length===t.length?{match:!0,matchedChars:e}:{partialMatch:!0}:0===i.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 r=e.slice(),o=0;o<t.length;){var s=Rh(r,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===(r=r.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-r.length)}}switch(t.op){case"|":for(var a,d,l=kh(t.args);!(d=l()).done;){var c=Rh(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=kh(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 Eh(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 Eh(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}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 Eh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Nh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Ah=fh("9",15),jh=/[- ]/,Ph=new RegExp("["+ul+"]*\\$1["+ul+"]*(\\$\\d["+ul+"]*)*$"),Mh=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 Nh(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"===Gl(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=Oh(this.matchingFormats);!(i=r()).done;){var o=i.value,s=gh(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,uh),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(uh),s}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var n=this.chosenFormat,i=this.chooseFormat(t);if(i)return i===n?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,n=e.nationalSignificantNumber,i=e.nationalPrefix,r=e.international,o=n,s=o.length-3;s<0&&(s=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,r,i)&&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 i=e.leadingDigitsPatterns().length;if(0===i)return!0;n=Math.min(n,i-1);var r=e.leadingDigitsPatterns()[n];if(t.length<3)try{return void 0!==new Ih(r).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(r,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,n=this,i=function(){var i=t.value;return n.chosenFormat===i?"break":Ph.test(n.getFormatFormat(i,e.international))?n.createTemplateForFormat(i,e)?(n.chosenFormat=i,"break"):(n.matchingFormats=n.matchingFormats.filter((function(e){return e!==i})),"continue"):"continue"},r=Oh(this.matchingFormats.slice());!(t=r()).done;){var o=i();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()&&jh.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var n=e.IDDPrefix,i=e.missingPlus;return n?t&&!1===t.spacing?n:n+" ":i?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,n=0,i=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";n<i.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf(uh,t+1),n++;return ph(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,uh)+fh(uh,t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var n=t.nationalSignificantNumber,i=t.international,r=t.nationalPrefix,o=t.complexPrefixBeforeNationalSignificantNumber,s=e.pattern();s=s.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var a=Ah.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,i);if(this.shouldTryNationalPrefixFormattingRule(e,{international:i,nationalPrefix:r})){var h=u.replace(rc,e.nationalPrefixFormattingRule());if(Bl(e.nationalPrefixFormattingRule())===(r||"")+Bl("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,uh),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),uh);return c||(o?p=fh(uh,o.length)+" "+p:r&&(p=fh(uh,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=ic(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=lh(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(hh)<0)return;t=e.search(hh),e=e.replace(hh,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],ph(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var n=t.international,i=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var r=e.usesNationalPrefix();if(r&&i||!r&&!n)return!0}}}]),e}();function Th(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 i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Uh(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 Uh(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 Uh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Wh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Lh=new RegExp("^"+("["+ul+cl+"]+")+"$","i"),_h="(?:[++]["+ul+cl+"]*|["+ul+cl+"]+)",Dh=new RegExp("[^"+ul+cl+"]+.*$"),Fh=/[^\d\[\]]/,qh=function(){function e(t){var n=t.defaultCountry,i=t.defaultCallingCode,r=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=i,this.metadata=r,this.onNationalSignificantNumberChange=o}return Wh(e,[{key:"input",value:function(e,t){var n,i=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(Dh,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=Th(t,2),i=n[0],r=n[1];Lh.test(i)||(i="");return[i,r]}(e),r=Th(i,2),o=r[0],s=r[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,i=n.length<3&&n.length+e.length>=3;if(t.appendDigits(e),i&&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,i=t.number;if(n)return e.setCallingCode(n),e.update({nationalSignificantNumber:i}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Fh.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=xc(e,this.metadata),i=n.nationalPrefix,r=n.nationalNumber,o=n.carrierCode;if(r!==e)return this.onExtractedNationalNumber(i,o,r,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,n){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,n);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var i=xc(e,this.metadata),r=i.nationalPrefix,o=i.nationalNumber,s=i.carrierCode;if(o!==t)return this.onExtractedNationalNumber(r,s,o,e,n),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,n,i,r){var o,s,a=i.lastIndexOf(n);if(a>=0&&a===i.length-n.length){s=!0;var d=i.slice(0,a);d!==e&&(o=d)}r({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,i=e.digits;if(e.nationalSignificantNumber,!t&&!n){var r=Sc(i,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==r&&r!==i?(e.update({IDDPrefix:i.slice(0,i.length-r.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=Rc(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,i=t.callingCode;e.startInternationalNumber(n,i),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 i,r,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(i=n.next()).done)&&(o.push(i.value),!t||o.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}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,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Vh(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Hh,zh=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 wl(n);var i=Bh(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return Vh(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(gl(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 i;if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(i=this.formatter.format(n,this.state)),void 0===i&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var r=this.state.getNationalDigits();r&&(i=this.formatter.format(r,this.state))}this.formattedOutput=i?this.getFullNumber(i):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new dh({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 Mh({state:this.state,metadata:this.metadata}),this.parser=new qh({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},i=this.state.callingCode;return n(i?e?"".concat(i," ").concat(e):i:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.complexPrefixBeforeNationalSignificantNumber,i=e.nationalPrefix,r=t,o=n||i;return o&&(r=o+r),r}},{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,uh)}},{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(jc(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,i=e.country,r=e.nationalSignificantNumber;if(t)return this.isInternational()?n?"+"+n+r:"+"+t:i||n?"+"+(i?this.metadata.countryCallingCode():n)+r:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,n=e.carrierCode,i=e.callingCode,r=this._getCountry();if(t&&(r||i)){if(r&&r===this.defaultCountry){var o=new wl(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=Ac(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new wc(r||i,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 Gh(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Yd),e.apply(this,n)}(iu,arguments)}function Jh(e,t){return sh.call(this,e,t,Yd)}function Zh(e){return zh.call(this,e,Yd)}function Yh(){return wl.call(this,Yd)}Jh.prototype=Object.create(sh.prototype,{}),Jh.prototype.constructor=Jh,Zh.prototype=Object.create(zh.prototype,{}),Zh.prototype.constructor=Zh,Yh.prototype=Object.create(wl.prototype,{}),Yh.prototype.constructor=Yh,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"}(Hh||(Hh={}));const Xh=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>{const[r,...o]=n.split(".");return t!==r?Object.assign(e,{[n]:i}):(e[r]||(e[r]={}),e[r][o.join(".")]=i,e)}),{}),Qh=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),ef=(e,t)=>e===Hh.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t,tf={enabled:"active",disabled:"disabled",invited:"invited"},nf=e=>e.tenantRoles.data,rf=e=>e.selectedUsersLoginIds,of=e=>e.notifications,sf=e=>e.customAttributes.data,af=sd(sf,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),df=sd((e=>e.usersList.data),af,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes).map((([e,n])=>[e,ef(t[e],n)])))}))))),lf=sd(df,(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Qh(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:tf[e.status]||e.status,roles:e.roleNames}))))),cf=sd(rf,lf,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),uf=sd(cf,(e=>e.map((e=>e.userId)))),hf=sd(cf,(e=>e.map((e=>e.status)))),ff=sd(cf,(e=>e.every((e=>e.editable)))),pf=sd(rf,(e=>!!e.length)),gf=sd(rf,(e=>1===e.length)),vf=sd(rf,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),mf=sd(gf,hf,((e,t)=>e&&t.every((e=>e===tf.enabled)))),yf=sd(hf,(e=>e.every((e=>e===tf.disabled)))),$f=sd(cf,(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`})),bf=sd(gf,yf,ff,((e,t,n)=>e&&t&&n)),wf=sd(gf,mf,ff,((e,t,n)=>e&&t&&n)),Cf=sd(gf,ff,((e,t)=>e&&t)),kf=sd(gf,ff,((e,t)=>e&&t)),Sf=sd(gf,ff,((e,t)=>e&&t)),xf=pf,If=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)}))}))},Rf=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}}),Of=({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)})}}),Ef=_d("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Nf=If(Ef)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},Rf((e=>e.createUser)),Of({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>`}})),Af={action:Ef,reducer:Nf},jf=_d("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Pf=If(jf)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Rf((e=>e.deleteUser)),Of({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Mf={action:jf,reducer:Pf},Tf=_d("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Uf=If(Tf)(Rf((e=>e.setTempUserPassword)),Of({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>`}})),Wf={action:Tf,reducer:Uf},Lf=_d("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),_f=If(Lf)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Rf((e=>e.customAttributes))),Df={action:Lf,reducer:_f},Ff=_d("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),qf=If(Ff)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Rf((e=>e.usersList))),Bf={action:Ff,reducer:qf},Kf=_d("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Vf=If(Kf)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Rf((e=>e.tenantRoles))),Hf={action:Kf,reducer:Vf},zf=_d("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Gf=If(zf)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Hn(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Rf((e=>e.updateUser)),Of({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>`}})),Jf={action:zf,reducer:Gf},Zf=_d("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Yf=If(Zf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Hn(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==i&&(e.usersList.data[i].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Rf((e=>e.enableUser)),Of({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>`}})),Xf={action:Zf,reducer:Yf},Qf=_d("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),ep=If(Qf)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return Hn(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==i&&(e.usersList.data[i].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Rf((e=>e.disableUser)),Of({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>`}})),tp={action:Qf,reducer:ep},np=_d("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),ip={action:np,reducer:If(np)(Rf((e=>e.removePasskey)),Of({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>`}}))},rp={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:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]},op="/v1/mgmt/user/search",sp="/v1/mgmt/user/delete/batch",ap="/v1/mgmt/user/create",dp="/v1/mgmt/user/update",lp="/v1/mgmt/user/update/status",cp="/v1/mgmt/user/password/set/temporary",up="/v1/mgmt/user/passkeys/delete",hp="/v1/mgmt/user/customattributes",fp="/v1/mgmt/role/all",pp=e=>l(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)})),gp=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u}={}){if(n)return(e=>l(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const i=[],r=(new Date).getTime();for(let e=1;e<10;e+=1)i.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}`,verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:r,createdTimeFormatted:new Date(1e3*(r||0)).toLocaleString(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.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()))))}))})))({page:i,limit:r,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u});const h=yield e.post(op,{limit:r,page:i,withTestUser:!1,customAttributes:o,statuses:s,emails:a,phones:d,text:c,sort:u},{queryParams:{tenant:t}});return yield pp(h),(yield h.json()).users})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(sp,{userIds:i},{queryParams:{tenant:t}});return yield pp(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b}){if(n)return(e=>l(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{const f=Math.random().toString(10).substring(15);h({loginIds:[e],externalIds:[e],userId:`user-${f}`,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b});const w=yield e.post(ap,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:$,invite:b},{queryParams:{tenant:t}});return yield pp(w),(yield w.json()).user})),update:i=>l(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v}){if(n)return(e=>l(void 0,[e],void 0,(function*({loginId:e,email:t,phone:n,displayName:i,roles:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u}){return new Promise((h=>{h({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:i,roleNames:r,customAttributes:o,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:u,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v});const m=yield e.post(dp,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,customAttributes:d,picture:c,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v},{queryParams:{tenant:t}});return yield pp(m),(yield m.json()).user})),enable:i=>l(void 0,void 0,void 0,(function*(){if(n)return(e=>l(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(i);const r=yield e.post(lp,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield pp(r),r.json()})),disable:i=>l(void 0,void 0,void 0,(function*(){if(n)return(e=>l(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(i);const r=yield e.post(lp,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield pp(r),r.json()})),removePasskey:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(up,{loginId:i},{queryParams:{tenant:t}});return yield pp(r),r.json()})),setTempPassword:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(cp,{loginId:i},{queryParams:{tenant:t}});return yield pp(r),r.json()})),getCustomAttributes:()=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const i=yield e.get(hp,{queryParams:{tenant:t}});return yield pp(i),(yield i.json()).data}))}),vp=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>l(void 0,void 0,void 0,(function*(){if(n)return(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})})))(t);const i=yield e.get(fp,{queryParams:{tenant:t}});return yield pp(i),i.json()}))}),mp=Yn((e=>{var t,n,i,r;const o=Kn(Vr,Br,Lr,Hr,Zd,Kr({tenant:Kr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.7.18"}}));return{user:gp({httpClient:r.httpClient,tenant:t,mock:n}),tenant:vp({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),yp=Yn((e=>{const t=Kn(Gd({name:"widget",initialState:rp,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Af.reducer(e),Jf.reducer(e),Xf.reducer(e),tp.reducer(e),Mf.reducer(e),Bf.reducer(e),Wf.reducer(e),ip.reducer(e),Df.reducer(e),Hf.reducer(e)},asyncActions:{searchUsers:Bf.action,createUser:Af.action,updateUser:Jf.action,enableUser:Xf.action,disableUser:tp.action,deleteUsers:Mf.action,removePasskey:ip.action,getCustomAttributes:Df.action,getTenantRoles:Hf.action,setTempUserPassword:Wf.action}}),qr,Lr,mp)(e);return class extends t{constructor(...e){super(...e),this.state=rp,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),$p=Yn((e=>{const t=Kn(Zr,Kr({"widget-id":Kr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),bp=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,qr,so,co,$p,yp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Vn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),wp=Yn((e=>{var t,n,i,r,o,s;return s=class extends(Kn(yp,qs,Jd,Lr,bp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>l(this,void 0,void 0,(function*(){yield c(this,n,"f").setData(nf(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){return l(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(Vn(yield this.fetchWidgetPage("create-user-modal.html"))),new Es((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)})),new Es((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele);this.actions.createUser(Object.assign(Object.assign({},Xh(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),u(this,n,new js((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),c(this,o,"f").call(this),this.createUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,o,"f").call(this),c(this,t,"m",r).call(this)}))}))},r=function(){const e=sf(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),Cp=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,wp,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},i})),kp=Yn((e=>{var t,n,i;return i=class extends(Kn(yp,qs,Lr,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(Vn(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Es((()=>{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 Es((()=>{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=uf(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new Ts(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=$f(this.state);i.text=`Delete ${e}?`}}))},i})),Sp=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp,kp)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),xf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Es(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()}))},r})),xp=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(yp,qs,Lr,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{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=vf(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(Vn(yield this.fetchWidgetPage("disable-user-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`Disable ${e}?`}))}))},o})),Ip=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp,xp,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),wf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Es(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()}))},r})),Rp=e=>{if(!e)return e;const t=Gh(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},Op=Yn((e=>{var t,n,i,r,o,s,a,h,f,p;return p=class extends(Kn(yp,qs,Lr,Jd,bp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),s.set(this,(()=>l(this,void 0,void 0,(function*(){yield c(this,i,"f").setData(nf(this.state).map((({name:e})=>({value:e,label:e}))))})))),h.set(this,(()=>{var e,t;const n=null===(e=cf(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:Rp(null==n?void 0:n.phone),roles:null==n?void 0:n.roles,givenName:null==n?void 0:n.givenName,familyName:null==n?void 0:n.familyName,middleName:null==n?void 0:n.middleName},Qh(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",f).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,h=new WeakMap,t=new WeakSet,r=function(){new Es((()=>{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()))},o=function(){new Es((()=>{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:t}=e,n=d(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Xh(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=sf(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,i]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===i));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},f=function(){return l(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(Vn(yield this.fetchWidgetPage("edit-user-modal.html"))),c(this,t,"m",r).call(this),c(this,t,"m",o).call(this),u(this,n,new Us(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),u(this,i,new js((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,s,"f").call(this),c(this,n,"f").disable(),c(this,h,"f").call(this),c(this,t,"m",a).call(this)}))}))},p})),Ep=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp,Op,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),Cf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Es(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()}))},r})),Np=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(yp,qs,Lr,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{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=vf(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(Vn(yield this.fetchWidgetPage("enable-user-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`Activate ${e}?`}))}))},o})),Ap=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp,Np,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),bf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Es(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()}))},r})),jp=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Pp={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},Mp=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Lr,yp,Ks,qr)(e)){constructor(){super(...arguments),t.add(this),r.set(this,zn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),of)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Pp[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},o})),Tp=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(yp,qs,Lr,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{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=vf(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(Vn(yield this.fetchWidgetPage("remove-passkey-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`Remove passkey for ${e}?`}))}))},o})),Up=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp,Tp,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),kf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Es(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()}))},r})),Wp=Yn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Kn(yp,Lr,bp)(e)){constructor(){super(...arguments),t.add(this),r.set(this,zn((e=>{this.usersTable.data=e}))),o.set(this,Zn(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchUsers({sort:n})}))),s.set(this,zn((e=>{this.usersTable.filterColumns((t=>{var n;const[i,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this),c(this,r,"f").call(this,lf(this.state)),c(this,s,"f").call(this,sf(this.state)),this.subscribe(c(this,s,"f").bind(this),sf),this.subscribe(c(this,r,"f").bind(this),lf)}))}},r=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,n=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:i,header:r,type:o,attrs:s})=>{const a=e(i)||t(o);if(!a)return n({path:i,header:r,type:o,attrs:s});const d=a.cloneNode(!0),l=Object.assign(Object.assign({},s),{header:r});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},i=function(){var e;this.usersTable=new Os(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(c(this,t,"m",a).bind(this)),c(this,t,"m",n).call(this),c(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,o,"f").call(this,e.target,e.detail)}))}))},d})),Lp=Yn((e=>{var t,n,i;return i=class extends(Kn(yp,qs,Lr,Jd,bp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(Vn(yield this.fetchWidgetPage("generated-password-modal.html"))),new Es((()=>{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()}))}))},i})),_p=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(yp,qs,Lr,Jd,bp,Lp)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Es((()=>{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()))},i=function(){new Es((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){var e;const t=vf(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()}))))},r=function(){return l(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(Vn(yield this.fetchWidgetPage("reset-password-modal.html"))),c(this,t,"m",n).call(this),c(this,t,"m",i).call(this);const r=new Ts(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){const e=$f(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},o})),Dp=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,bp,yp,_p,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;c(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(c(this,i,"f").bind(this),Sf)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Es(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()}))},r})),Fp=Yn((e=>class extends(Kn(ws,ho,Wp,Cp,Sp,Ep,Ap,Ip,Dp,Up,jp,Mp)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),qp=Kn((e=>class extends(Fp(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",qp);var Bp=Object.freeze({__proto__:null,default:qp});const Kp=e=>e.selectedRolesIds,Vp=e=>e.notifications,Hp=e=>e.tenantPermissions.data||[],zp=sd((e=>e.rolesList.data),(e=>e.map((e=>{var t;return Object.assign(Object.assign({},e),{editable:0===(null===(t=null==e?void 0:e.tenantId)||void 0===t?void 0:t.length)?"no":"yes"})})))),Gp=sd(Kp,zp,((e,t)=>t.filter((t=>e.includes(t.name))))),Jp=sd(Kp,(e=>!!e.length)),Zp=sd(Kp,(e=>1===e.length)),Yp=sd(Gp,Zp,((e,t)=>t&&"yes"===e[0].editable)),Xp=sd(Gp,(e=>1===e.length?e[0].name:`${e.length} roles`)),Qp=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)}))}))},eg=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}}),tg=({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)})}}),ng=_d("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),ig=Qp(ng)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},eg((e=>e.createRole)),tg({getSuccessMsg:()=>"Role created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),rg={action:ng,reducer:ig},og=_d("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),sg=Qp(og)({onFulfilled:(e,t)=>{e.rolesList.data=e.rolesList.data.filter((e=>{var n;return 0===(null===(n=null==e?void 0:e.tenantId)||void 0===n?void 0:n.length)||!t.meta.arg.includes(e.name)})),e.selectedRolesIds=[]}},eg((e=>e.deleteRole)),tg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to delete role${["","s"]}`})),ag={action:og,reducer:sg},dg=_d("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),lg=Qp(dg)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},eg((e=>e.rolesList))),cg={action:dg,reducer:lg},ug=_d("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),hg=Qp(ug)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},eg((e=>e.updateRole)),tg({getSuccessMsg:()=>"Role updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update role</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),fg={action:ug,reducer:hg},pg=_d("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),gg={action:pg,reducer:Qp(pg)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},eg((e=>e.tenantPermissions)))},vg={rolesList:{data:[],loading:!1,error:null},createRole:{loading:!1,error:null},updateRole:{loading:!1,error:null},deleteRole:{loading:!1,error:null},tenantPermissions:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedRolesIds:[],notifications:[]},mg="/v1/mgmt/role/search",yg="/v1/mgmt/role/delete/batch",$g="/v1/mgmt/role/create",bg="/v1/mgmt/role/update",wg="/v1/mgmt/permission/all",Cg=e=>l(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)})),kg=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({text:e,sort:t},n){return new Promise((i=>{const r=[];for(let e=1;e<10;e+=1)r.push({name:`Role ${e}`,description:`Role description ${e}`,permissionNames:[`Permission ${e}`],createdTime:new Date,tenantId:n});t.forEach((e=>{r.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),i(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s},t);const a=yield e.post(mg,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield Cg(a),(yield a.json()).roles})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(yg,{roleNames:i},{queryParams:{tenant:t}});return yield Cg(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({name:i,description:r,permissionNames:o}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,description:t,permissionNames:n},i){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:i})}))})))({name:i,description:r,permissionNames:o},t);const s=yield e.post($g,{name:i,description:r,permissionNames:o,tenantId:t},{queryParams:{tenant:t}});return yield Cg(s),yield s.json()})),update:i=>l(void 0,[i],void 0,(function*({name:i,newName:r,description:o,permissionNames:s}){if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,newName:t,description:n,permissionNames:i},r){return new Promise((o=>{o({name:t,description:n,permissionNames:i,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:i,newName:r,description:o,permissionNames:s},t);const a=yield e.post(bg,{name:i,newName:r,description:o,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Cg(a);const d=yield a.json();return d.oldName=i,d}))}),Sg=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>l(void 0,void 0,void 0,(function*(){if(n)return new Promise((e=>{const t=[];for(let e=1;e<5;e+=1)t.push({name:`Permission ${e}`});e({permissions:t})}));const i=yield e.get(wg,{queryParams:{tenant:t}});return yield Cg(i),i.json()}))}),xg=Yn((e=>{var t,n,i,r;const o=Kn(Vr,Br,Lr,Hr,Zd,Kr({tenant:Kr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.3.19"}}));return{role:kg({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Sg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),Ig=Yn((e=>{const t=Kn(Gd({name:"widget",initialState:vg,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{rg.reducer(e),fg.reducer(e),ag.reducer(e),cg.reducer(e),gg.reducer(e)},asyncActions:{searchRoles:cg.action,createRole:rg.action,updateRole:fg.action,deleteRoles:ag.action,getTenantPermissions:gg.action}}),qr,Lr,xg)(e);return class extends t{constructor(...e){super(...e),this.state=vg,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Rg=Yn((e=>{const t=Kn(Zr,Kr({"widget-id":Kr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Og=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,qr,so,co,Rg,Ig)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Vn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Eg=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Ig,qs,Jd,Lr,Og)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>l(this,void 0,void 0,(function*(){var e;yield c(this,n,"f").setData(null===(e=Hp(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function(){return l(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(Vn(yield this.fetchWidgetPage("create-role-modal.html"))),new Es((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele)})),new Es((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){this.validateForm(this.createRoleModal.ele)&&(this.actions.createRole(Object.assign({},this.getFormData(this.createRoleModal.ele))),this.createRoleModal.close(),this.resetFormData(this.createRoleModal.ele))})))),u(this,n,new js((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),c(this,r,"f").call(this)}))},o})),Ng=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,Eg,Og)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},i})),Ag=Yn((e=>{var t,n,i;return i=class extends(Kn(Ig,qs,Lr,Og)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(Vn(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Es((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteRolesModal.close()));const n=new Es((()=>{var e;return null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Gp(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new Ts(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Xp(this.state);i.text=`Delete ${e}?`}}))},i})),jg=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Og,Ig,Ag)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Jp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-roles"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteRolesModal.open()}))},r})),Pg=Yn((e=>{var t,n,i,r,o,s,a,h;return h=class extends(Kn(Ig,qs,Lr,Jd,Og)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>l(this,void 0,void 0,(function*(){var e;yield c(this,n,"f").setData(null===(e=Hp(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=Gp(this.state))||void 0===e?void 0:e[0],n={name:null==t?void 0:t.name,description:null==t?void 0:t.description,permissionNames:null==t?void 0:t.permissionNames};this.setFormData(this.editRoleModal.ele,n)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield c(this,t,"m",a).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,i=function(){new Es((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editRoleModal.close()))},r=function(){new Es((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{var e;if(this.validateForm(this.editRoleModal.ele)){const t=this.getFormData(this.editRoleModal.ele),{name:n}=t,i=d(t,["name"]),r=null===(e=Gp(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},i)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return l(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(Vn(yield this.fetchWidgetPage("edit-role-modal.html"))),c(this,t,"m",i).call(this),c(this,t,"m",r).call(this),u(this,n,new js((()=>{var e;return null===(e=this.editRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),this.editRoleModal.beforeOpen=()=>l(this,void 0,void 0,(function*(){yield c(this,o,"f").call(this),c(this,s,"f").call(this)}))}))},h})),Mg=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Og,Ig,Pg,Jd)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Yp)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-role"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editRoleModal.open()}))},r})),Tg=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Og,Ig)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Ug={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},Wg=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Lr,Ig,Ks,qr)(e)){constructor(){super(...arguments),t.add(this),r.set(this,zn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Vp)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Ug[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},o})),Lg=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Ig,Lr,Og)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{this.rolesTable.data=e}))),r.set(this,Zn(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchRoles({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),c(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,r,"f").call(this,e.target,e.detail)}))})),c(this,i,"f").call(this,zp(this.state)),this.subscribe(c(this,i,"f").bind(this),zp)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="roles-table"]'),{logger:this.logger}),this.rolesTable.onSelectedItemsChange((e=>{this.actions.setSelectedRolesIds(e.detail.value.map((({name:e})=>e)))}))},o})),_g=Yn((e=>class extends(Kn(ws,ho,Lg,Ng,jg,Mg,Tg,Wg)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Dg=Kn((e=>class extends(_g(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Dg);var Fg=Object.freeze({__proto__:null,default:Dg});const qg=e=>e.selectedAccessKeysIds,Bg=e=>e.notifications,Kg=sd((e=>e.accessKeysList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{expireTimeFormatted:(null==e?void 0:e.expireTime)?new Date(1e3*((null==e?void 0:e.expireTime)||0)).toLocaleString():"Never",createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:(null==e?void 0:e.expireTime)&&new Date(1e3*((null==e?void 0:e.expireTime)||0))<new Date?"expired":null==e?void 0:e.status}))))),Vg=sd(qg,Kg,((e,t)=>t.filter((t=>e.includes(t.id))))),Hg=sd(qg,(e=>!!e.length)),zg=sd(Vg,(e=>e.every((e=>e.editable)))),Gg=sd(zg,Hg,((e,t)=>e&&t));sd(qg,(e=>1===e.length));const Jg=sd(Vg,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Zg=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)}))}))},Yg=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}}),Xg=({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)})}}),Qg=_d("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),ev=Zg(Qg)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},Yg((e=>e.createAccessKey)),Xg({getSuccessMsg:()=>"Access Key created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create access key</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),tv={action:Qg,reducer:ev},nv=_d("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),iv=Zg(nv)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},Yg((e=>e.deleteAccessKey)),Xg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),rv={action:nv,reducer:iv},ov=_d("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),sv=Zg(ov)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},Yg((e=>e.accessKeysList))),av={action:ov,reducer:sv},dv=_d("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),lv=Zg(dv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},Yg((e=>e.activateAccessKey)),Xg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),cv={action:dv,reducer:lv},uv=_d("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),hv=Zg(uv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},Yg((e=>e.deactivateAccessKey)),Xg({getSuccessMsg:e=>Jn(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Jn(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),fv={action:uv,reducer:hv},pv=_d("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),gv={action:pv,reducer:Zg(pv)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Yg((e=>e.tenantRoles)))},vv={accessKeysList:{data:[],loading:!1,error:null},createAccessKey:{loading:!1,error:null},activateAccessKey:{loading:!1,error:null},deactivateAccessKey:{loading:!1,error:null},deleteAccessKey:{loading:!1,error:null},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedAccessKeysIds:[],notifications:[]},mv="/v1/mgmt/accesskey/search",yv="/v1/mgmt/accesskey/delete/batch",$v="/v1/mgmt/accesskey/create",bv="/v1/mgmt/accesskey/deactivate/batch",wv="/v1/mgmt/accesskey/activate/batch",Cv="/v1/mgmt/role/all",kv=e=>l(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)})),Sv=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((...e)=>l(void 0,[...e],void 0,(function*({text:e,sort:t}={}){return new Promise((n=>{const i=[],r=(new Date).getTime()/1e3+2592e3,o=new Date(r).toLocaleString();for(let e=1;e<10;e+=1)i.push({id:`access-key-id-${e}`,name:`Access Key ${e}`,createdBy:`User ${e}`,editable:!0,expireTime:r,expireTimeFormatted:o,createdTime:r,createdTimeFormatted:o,roleNames:[`Role ${e}`],permittedIps:["127.1.2.3"],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s});const a=yield e.post(mv,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield kv(a),(yield a.json()).keys})),deleteBatch:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(yv,{ids:i},{queryParams:{tenant:t}});return yield kv(r),r.json()})),create:i=>l(void 0,[i],void 0,(function*({name:i,expiration:r,roleNames:o,userId:s,permittedIps:a}){const d=new Date;d.setDate(d.getDate()+ +r);const c="0"===r[0]?0:Math.floor(d.getTime()/1e3);if(n)return((e,t)=>l(void 0,[e,t],void 0,(function*({name:e,roleNames:t,userId:n,permittedIps:i},r){const o=Math.random().toString(10).substring(15);return new Promise((s=>{s({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${o}`,name:e||`Access Key ${o}`,createdBy:n||`User ${o}`,editable:!0,expireTime:r,createdTime:(new Date).getTime()/1e3,roleNames:t,permittedIps:i,status:"active",clientId:`Client ID ${o}`,boundUserId:n||`User ${o}`}})}))})))({name:i,expiration:r,roleNames:o,userId:s,permittedIps:a},c);const u=yield e.post($v,{name:i,expireTime:c,roleNames:o,userId:s,permittedIps:a},{queryParams:{tenant:t}});return yield kv(u),yield u.json()})),activate:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(wv,{ids:i},{queryParams:{tenant:t}});return yield kv(r),yield r.json()})),deactivate:i=>l(void 0,void 0,void 0,(function*(){if(n)return l(void 0,void 0,void 0,(function*(){}));const r=yield e.post(bv,{ids:i},{queryParams:{tenant:t}});return yield kv(r),yield r.json()}))}),xv=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>l(void 0,void 0,void 0,(function*(){if(n)return(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})})))(t);const i=yield e.get(Cv,{queryParams:{tenant:t}});return yield kv(i),i.json()}))}),Iv=Yn((e=>{var t,n,i,r;const o=Kn(Vr,Br,Lr,Hr,Zd,Kr({tenant:Kr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.18"}}));return{accesskey:Sv({httpClient:r.httpClient,tenant:t,mock:n}),tenant:xv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),Rv=Yn((e=>{const t=Kn(Gd({name:"widget",initialState:vv,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{tv.reducer(e),rv.reducer(e),av.reducer(e),cv.reducer(e),fv.reducer(e),gv.reducer(e)},asyncActions:{searchAccessKeys:av.action,createAccessKey:tv.action,activateAccessKeys:cv.action,deactivateAccessKeys:fv.action,deleteAccessKeys:rv.action,getTenantRoles:gv.action}}),qr,Lr,Iv)(e);return class extends t{constructor(...e){super(...e),this.state=vv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Ov=Yn((e=>{const t=Kn(Zr,Kr({"widget-id":Kr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Ev=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,qr,so,co,Ov,Rv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Vn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Nv=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Rv,Lr,Ev)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{this.accessKeysTable.data=e}))),r.set(this,Zn(((e,t)=>{const n=[],{value:i}=t;if(i){const t=e.path;n.push({field:t,desc:"desc"===i})}this.actions.searchAccessKeys({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),c(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{c(this,r,"f").call(this,e.target,e.detail)}))})),c(this,i,"f").call(this,Kg(this.state)),this.subscribe(c(this,i,"f").bind(this),Kg)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="access-keys-table"]'),{logger:this.logger}),this.accessKeysTable.onSelectedItemsChange((e=>{this.actions.setSelectedAccessKeysIds(e.detail.value.map((({id:e})=>e)))}))},o})),Av=Yn((e=>{var t,n,i;return i=class extends(Kn(Rv,qs,Lr,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(Vn(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Es((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.activateAccessKeysModal.close()));const n=new Es((()=>{var e;return null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Vg(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new Ts(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Jg(this.state);i.text=`Activate ${e}?`}}))},i})),jv=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Ev,Rv,Av)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Gg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="activate-access-keys"]'),{logger:this.logger}),this.activateButton.disable(),this.activateButton.onClick((()=>{this.activateAccessKeysModal.open()}))},r})),Pv=Yn((e=>{var t,n,i;return i=class extends(Kn(Rv,qs,Jd,Lr,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(Vn(yield this.fetchWidgetPage("created-access-key-modal.html"))),new Es((()=>{var e;return null===(e=this.createdAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.createdAccessKeyModal.ele)["generated-key"]),this.resetFormData(this.createdAccessKeyModal.ele),this.createdAccessKeyModal.close()}))}))},i})),Mv=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Rv,qs,Jd,Lr,Ev,Pv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>l(this,void 0,void 0,(function*(){var e,t;yield c(this,n,"f").setData(null===(t=this.state,e=t.tenantRoles.data||[])||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function e(){return l(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(Vn(yield this.fetchWidgetPage("create-access-key-modal.html"))),new Es((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)})),new Es((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>l(this,void 0,void 0,(function*(){var e,t;if(this.validateForm(this.createAccessKeyModal.ele)){const n=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),(null===(e=null==n?void 0:n.payload)||void 0===e?void 0:e.cleartext)&&(this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(t=null==n?void 0:n.payload)||void 0===t?void 0:t.cleartext}),this.createdAccessKeyModal.open())}})))),u(this,n,new js((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),c(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{c(this,t,"m",e).call(this)}}))},o})),Tv=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,Mv,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-access-key"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createAccessKeyModal.open()))},i})),Uv=Yn((e=>{var t,n,i;return i=class extends(Kn(Rv,qs,Lr,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(Vn(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Es((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deactivateAccessKeysModal.close()));const n=new Es((()=>{var e;return null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Vg(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new Ts(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Jg(this.state);i.text=`Deactivate ${e}?`}}))},i})),Wv=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Ev,Rv,Uv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Gg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="deactivate-access-keys"]'),{logger:this.logger}),this.deactivateButton.disable(),this.deactivateButton.onClick((()=>{this.deactivateAccessKeysModal.open()}))},r})),Lv=Yn((e=>{var t,n,i;return i=class extends(Kn(Rv,qs,Lr,Ev)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){var e;this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(Vn(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Es((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteAccessKeysModal.close()));const n=new Es((()=>{var e;return null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});n.onClick((()=>{const e=Vg(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new Ts(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Jg(this.state);i.text=`Delete ${e}?`}}))},i})),_v=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Ev,Rv,Lv)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),this.subscribe(c(this,i,"f").bind(this),Gg)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Es(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-access-keys"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteAccessKeysModal.open()}))},r})),Dv=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,Ev,Rv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f"))},r})),Fv={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},qv=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Lr,Rv,Ks,qr)(e)){constructor(){super(...arguments),t.add(this),r.set(this,zn((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=c(this,t,"m",i).call(this,e);o.setContent(c(this,t,"m",n).call(this,{type:e,msg:r})),o.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(c(this,r,"f").bind(this),Bg)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Fv[e],i=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}${i.outerHTML}`},i=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},o})),Bv=Yn((e=>class extends(Kn(ws,ho,Nv,Tv,_v,Dv,jv,Wv,qv)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Kv=Kn((e=>class extends(Bv(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Kv);var Vv=Object.freeze({__proto__:null,default:Kv});const Hv=(e,t)=>t?{[e]:t}:{},zv=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},Gv=e=>e.selectedAuditId,Jv=sd((e=>e.auditList.data),(e=>e.map((e=>{const t=e||{},{occurred:n,ID:i,type:r}=t,o=t.data,s=void 0===o?{saml_request:"",saml_response:"",saml_generated_user:"",saml_generated_roles:"",oidc_response:"",oidc_generated_user:""}:o,{saml_request:a,saml_response:l,saml_generated_user:c,saml_generated_roles:u,oidc_response:h,oidc_generated_user:f}=s,p=d(s,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user"]),g=d(t,["occurred","ID","type","data"]);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:p}),Hv("type",(v=r)&&v[0].toUpperCase()+v.slice(1))),Hv("saml_request",a)),Hv("saml_response",l)),Hv("saml_generated_user",zv(c))),Hv("saml_generated_roles",zv(u))),Hv("oidc_response",zv(h))),Hv("oidc_generated_user",zv(f))),{occurredFormatted:n?new Date(Number(n)||0).toLocaleString():"N/A"});var v}))));sd(Gv,Jv,((e,t)=>t.find((t=>e===t.id)))),sd(Gv,(e=>!!e));const Zv=_d("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),Yv=(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)}))}))})(Zv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Xv=e=>e.auditList,{onFulfilled:e=>{Xv(e).loading=!1},onPending:e=>{Xv(e).loading=!0,Xv(e).error=null},onRejected:(e,t)=>{Xv(e).loading=!1,Xv(e).error=t.error}}));var Xv;const Qv={action:Zv,reducer:Yv},em={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},tm="/v1/mgmt/audit/search",nm=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>l(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s,from:a}={}){if(n)return(e=>l(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((n=>{const i=[],r=(new Date).getTime()/1e3+2592e3,o=new Date(r).toLocaleString();for(let e=1;e<9;e+=1)i.push({id:`Audit ${e}`,action:`Action ${e}`,actorId:`Actor ${e}`,type:"info",method:`Method ${e}`,userId:`User ${e}`,device:`Device ${e}`,geo:`Geo ${e}`,remoteAddress:`127.0.0.${e}`,externalIds:[`Login ID ${e}`],occurred:r,occurredFormatted:o});t.forEach((e=>{i.sort(((t,n)=>{var i,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(n[e.field])}))})),n(i.filter((t=>t.id.toLowerCase().includes(e.toLowerCase())||t.action.toLowerCase().includes(e.toLowerCase())||t.type.toLowerCase().includes(e.toLowerCase())||t.device.toLowerCase().includes(e.toLowerCase())||t.method.toLowerCase().includes(e.toLowerCase())||t.geo.toLowerCase().includes(e.toLowerCase())||t.remoteAddress.toLowerCase().includes(e.toLowerCase())||t.externalIds.includes(e.toLowerCase())||t.userId.toLowerCase().includes(e.toLowerCase()))))}))})))({page:i,limit:r,text:o,sort:s});const d=yield e.post(tm,{limit:r,page:i,text:o,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>l(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)})))(d),(yield d.json()).audits}))}),im=Yn((e=>{var t,n,i,r;const o=Kn(Vr,Br,Lr,Hr,Zd,Kr({tenant:Kr.missingAttrValidator}))(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenantId(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n,i)=>{const r=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.18"}}));return{audit:nm({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),rm=Yn((e=>{const t=Kn(Gd({name:"widget",initialState:em,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Qv.reducer(e)},asyncActions:{searchAudit:Qv.action}}),qr,Lr,im)(e);return class extends t{constructor(...e){super(...e),this.state=em,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),om=Yn((e=>{const t=Kn(Zr,Kr({"widget-id":Kr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),sm=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,qr,so,co,om,rm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([c(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Vn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),am=Yn((e=>{var t,n,i,r,o;return o=class extends(Kn(Lr,sm,rm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Zn((()=>{const e=this.rangeInput.value,t=new Date;let n;switch(e){case"minuets15":n=t.setMinutes(t.getMinutes()-15);break;case"hour":n=t.setHours(t.getHours()-1);break;case"hour6":n=t.setHours(t.getHours()-6);break;case"day":default:n=t.setDate(t.getDate()-1);break;case"day3":n=t.setDate(t.getDate()-3);break;case"week":n=t.setDate(t.getDate()-7);break;case"week2":n=t.setDate(t.getDate()-14);break;case"month":n=t.setMonth(t.getMonth()-1)}this.actions.searchAudit({text:this.searchInput.value,from:Math.floor(new Date(n).getTime())})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",i).call(this),c(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Us(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(c(this,n,"f")),c(this,n,"f").call(this)},r=function(){var e;this.rangeInput=new Ps(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(c(this,n,"f"))},o})),dm=Yn((e=>{var t,n,i,r;return r=class extends(Kn(rm,Lr,sm)(e)){constructor(){super(...arguments),t.add(this),i.set(this,zn((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),c(this,t,"m",n).call(this),c(this,i,"f").call(this,Jv(this.state)),this.subscribe(c(this,i,"f").bind(this),Jv)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="audit-table"]'),{logger:this.logger}),this.auditTable.onSelectedItemsChange((e=>{this.actions.setSelectedAuditId(e.detail.value.map((({id:e})=>e)))}))},r})),lm=Yn((e=>class extends(Kn(ws,ho,dm,am)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),cm=Kn((e=>class extends(lm(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",cm);var um=Object.freeze({__proto__:null,default:cm});const hm=(e={})=>{const t=Vn("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(Gn(e),n)})),t};function fm(e){return new URLSearchParams(window.location.search).get(e)}const pm=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)}))}))},gm=_d("users/me",((e,{extra:{api:t}})=>t.user.me())),vm=pm(gm)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(mm=e=>e.me,{onFulfilled:e=>{mm(e).loading=!1},onPending:e=>{mm(e).loading=!0,mm(e).error=null},onRejected:(e,t)=>{mm(e).loading=!1,mm(e).error=t.error}}));var mm;const ym={action:gm,reducer:vm},$m=_d("users/logout",((e,{extra:{api:t}})=>t.user.logout())),bm={action:$m,reducer:pm($m)({})},wm={me:{loading:!1,error:null,data:{}}},Cm="/v1/auth/me",km=({httpClient:e,mock:t})=>({me:()=>l(void 0,void 0,void 0,(function*(){if(t)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))}));const n=yield e.get(Cm);return yield(e=>l(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)})))(n),n.json()}))}),Sm=Yn((e=>{var t,n,i,r;const o=Kn(Vr,Br,Lr,Hr,Zd)(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n)=>{const i=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.4.21"}}));return{user:Object.assign(Object.assign({},km({httpClient:i.httpClient,mock:t})),{logout:t?()=>l(void 0,void 0,void 0,(function*(){})):i.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),xm=Yn((e=>{const t=Kn(Gd({name:"widget",initialState:wm,reducers:{},extraReducers:e=>{ym.reducer(e),bm.reducer(e)},asyncActions:{getMe:ym.action,logout:bm.action}}),qr,Lr,Sm)(e);return class extends t{constructor(...e){super(...e),this.state=wm,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Im="widget-flow",Rm=Yn((e=>{var t,n,i;return i=class extends(Kn(qr,qs,xm,Zd,Lr,ho)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=fm(Im);r&&(function(e){if(window.history.replaceState&&fm(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())}}(Im),c(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(hm({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),new Ds((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},i})),Om=e=>e.me.data,Em=sd(Om,(e=>e.picture)),Nm=sd(Om,(e=>e.email)),Am=sd(Om,(e=>e.verifiedEmail)),jm=sd(Om,(e=>e.name)),Pm=sd(Om,(e=>e.phone)),Mm=sd(Om,(e=>e.verifiedPhone)),Tm=sd(Om,(e=>e.webauthn));sd(Om,(e=>e.password));const Um=sd(Om,(e=>e.TOTP)),Wm=sd(Om,(e=>e.customAttributes)),Lm=Yn((e=>{const t=Kn(Zr,Kr({"widget-id":Kr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),_m=Yn((e=>{var t,n,i;return i=class extends(Kn(Lr,qr,so,co,Lm,xm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),c(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Vn(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Dm=Yn((e=>class extends(Kn(ho,Br)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),Fm=Yn((e=>{var t,n,i,r,o,s,a,d,h;return h=class extends(Kn(Dm,ho,xm,Lr,Zd,_m,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,zn((e=>{this.avatar.image=e}))),d.set(this,zn((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Em(this.state)),c(this,d,"f").call(this,jm(this.state)),this.subscribe(c(this,a,"f").bind(this),Em),this.subscribe(c(this,d,"f").bind(this),jm)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){this.avatar.flowId&&(u(this,n,this.createModal({"data-id":"update-pic"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new Ws((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},h})),qm=Yn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g,v;return v=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,zn((e=>{this.emailUserAttr.value=e}))),g.set(this,zn((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,Nm(this.state)),c(this,g,"f").call(this,Am(this.state)),this.subscribe(c(this,p,"f").bind(this),Nm),this.subscribe(c(this,g,"f").bind(this),Am)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){this.emailUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-email"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.emailUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-email"}),"f"),u(this,o,new Ds((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(hm({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr=new Ls((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},v})),Bm=Yn((e=>{var t,n,i;return i=class extends(Kn(xm,Lr,_m,qs)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Es((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>l(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},i})),Km=Yn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g;return g=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,zn((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,jm(this.state)),this.subscribe(c(this,p,"f").bind(this),jm)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.nameUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-name"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.nameUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-name"}),"f"),u(this,o,new Ds((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(hm({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr=new Ls((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},g})),Vm=Yn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,zn((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Tm(this.state)),this.subscribe(c(this,a,"f").bind(this),Tm)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.passkeyUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"passkey"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new _s((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},d})),Hm=Yn((e=>{var t,n,i,r,o,s;return s=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new _s((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.initPasswordAuthMethod(),c(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.passwordUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"password"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close()}))},s})),zm=Yn((e=>{var t,n,i,r,o,s,a,d,h,f,p,g,v;return v=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,void 0),o.set(this,void 0),p.set(this,zn((e=>{this.phoneUserAttr.value=e}))),g.set(this,zn((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",f).call(this),c(this,t,"m",s).call(this),c(this,t,"m",d).call(this),c(this,p,"f").call(this,Pm(this.state)),c(this,g,"f").call(this,Mm(this.state)),this.subscribe(c(this,p,"f").bind(this),Pm),this.subscribe(c(this,g,"f").bind(this),Mm)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){this.phoneUserAttr.editFlowId&&(u(this,n,this.createModal({"data-id":"edit-phone"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",a).bind(this),c(this,t,"m",a).call(this),this.syncFlowTheme(c(this,i,"f")))},a=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.phoneUserAttr.deleteFlowId&&(u(this,r,this.createModal({"data-id":"delete-phone"}),"f"),u(this,o,new Ds((()=>{var e;return null===(e=c(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,r,"f").afterClose=c(this,t,"m",h).bind(this),c(this,t,"m",h).call(this),this.syncFlowTheme(c(this,o,"f")))},h=function(){c(this,r,"f").setContent(hm({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,o,"f").onSuccess((()=>{c(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr=new Ls((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=c(this,r,"f"))||void 0===e||e.open()}))},v}));var Gm;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(Gm||(Gm={}));const Jm=Yn((e=>{var t,n,i,r,o,s,a,d,u,h,f;return n=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),i.set(this,{}),r.set(this,{}),o.set(this,{}),s.set(this,{}),u.set(this,zn((e=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||Gm.TEXT,s=e[r],a=new Ls(i,{logger:this.logger});a.value=n.getFormattedValue(o,s),c(this,t,"m",h).call(this,i,r,a),c(this,t,"m",f).call(this,i,r,a)}))})))}static getFormattedValue(e,t){return e===Gm.DATE&&t?new Date(t).toLocaleString():e===Gm.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),c(this,u,"f").call(this,Wm(this.state)),this.subscribe(c(this,u,"f").bind(this),Wm)}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,u=new WeakMap,t=new WeakSet,a=function(e){var t,n;null===(t=c(this,i,"f")[e])||void 0===t||t.setContent(hm({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(n=c(this,r,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=c(this,i,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},d=function(e){var t,n;null===(t=c(this,o,"f")[e])||void 0===t||t.setContent(hm({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(n=c(this,s,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=c(this,o,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},h=function(e,n,o){const s=e.getAttribute("edit-flow-id");s&&(c(this,i,"f")[s]=this.createModal({"data-id":`edit-${n}`}),c(this,r,"f")[s]=new Ds((()=>{var e,t;return null===(t=null===(e=c(this,i,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),c(this,i,"f")[s].afterClose=c(this,t,"m",a).bind(this,s),o.onEditClick((()=>{var e,t;null===(t=null===(e=c(this,i,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),c(this,t,"m",a).call(this,s),this.syncFlowTheme(c(this,r,"f")[s]))},f=function(e,n,i){const r=e.getAttribute("delete-flow-id");r&&(c(this,o,"f")[r]=this.createModal({"data-id":`delete-${n}`}),c(this,s,"f")[r]=new Ds((()=>{var e,t;return null===(t=null===(e=c(this,o,"f")[r])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),c(this,o,"f")[r].afterClose=c(this,t,"m",d).bind(this,r),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=c(this,o,"f"))||void 0===e?void 0:e[r])||void 0===t||t.open()})),c(this,t,"m",d).call(this,r),this.syncFlowTheme(c(this,s,"f")[r]))},n})),Zm=Yn((e=>{var t,n,i,r,o,s,a,d;return d=class extends(Kn(Dm,xm,Lr,_m,Zd,qs)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,zn((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),c(this,t,"m",s).call(this),c(this,t,"m",r).call(this),c(this,a,"f").call(this,Um(this.state)),this.subscribe(c(this,a,"f").bind(this),Um)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.totpUserAuthMethod.flowId&&(u(this,n,this.createModal({"data-id":"totp"}),"f"),u(this,i,new Ds((()=>{var e;return null===(e=c(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),c(this,n,"f").afterClose=c(this,t,"m",o).bind(this),c(this,t,"m",o).call(this),this.syncFlowTheme(c(this,i,"f")))},o=function(){c(this,n,"f").setContent(hm({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),c(this,i,"f").onSuccess((()=>{c(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.totpUserAuthMethod=new _s((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onButtonClick((()=>{var e;null===(e=c(this,n,"f"))||void 0===e||e.open()}))},d})),Ym=Yn((e=>class extends(Kn(ws,ho,Rm,Jm,qm,Fm,Km,zm,Vm,Hm,Hm,Zm,Bm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Xm=Kn((e=>class extends(Ym(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(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 bs})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.4.21"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Xm);var Qm,ey=Object.freeze({__proto__:null,default:Xm});!function(e){e.oidc="oidc",e.saml="saml"}(Qm||(Qm={}));const ty=sd((e=>e.ssoAppsList.data),(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===Qm.saml))})),ny=sd(ty,(e=>e.map((e=>({name:e.name,icon:e.logo,url:e.samlSettings.idpInitiatedUrl}))))),iy=_d("ssoApps/load",((e,{extra:{api:t}})=>t.ssoApps.load())),ry=(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)}))}))})(iy)({onFulfilled:(e,t)=>{var n;e.ssoAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},(oy=e=>e.ssoAppsList,{onFulfilled:e=>{oy(e).loading=!1},onPending:e=>{oy(e).loading=!0,oy(e).error=null},onRejected:(e,t)=>{oy(e).loading=!1,oy(e).error=t.error}}));var oy;const sy={action:iy,reducer:ry},ay={ssoAppsList:{data:[],loading:!1,error:null}},dy="/v1/mgmt/sso/idp/apps/load",ly=({httpClient:e,mock:t})=>({load:()=>l(void 0,void 0,void 0,(function*(){if(t)return l(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:[{id:"ssoapp1",name:"App 1",description:"This is the first SAML app",enabled:!0,appType:Qm.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:Qm.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:Qm.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}}]})}))}));const n=yield e.get(dy);return yield(e=>l(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)})))(n),n.json()}))}),cy=Yn((e=>{var t,n,i,r;const o=Kn(Vr,Br,Lr,Zd,Hr)(e);return r=class extends o{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return c(this,n,"f")||c(this,t,"m",i).call(this),c(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{c(this,n,"f")&&c(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),u(this,n,((e,t,n)=>{const i=Tn(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"applications-portal-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.3.18"}}));return{ssoApps:ly({httpClient:i.httpClient,mock:t})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),uy=Yn((e=>{const t=Kn(Gd({name:"widget",initialState:ay,reducers:{},extraReducers:e=>{sy.reducer(e)},asyncActions:{loadSSOApps:sy.action}}),qr,Lr,cy)(e);return class extends t{constructor(...e){super(...e),this.state=ay,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),hy=Yn((e=>{const t=Kn(Zr,Kr({"widget-id":Kr.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return l(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${e}`,"text")).body}))}}})),fy=Yn((e=>{var t,n,i,r;return r=class extends(Kn(Lr,qr,so,co,hy,uy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return l(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var r;yield null===(r=e.init)||void 0===r?void 0:r.call(this);const[o]=yield Promise.all([c(this,t,"m",n).call(this),this.actions.loadSSOApps()]);c(this,t,"m",i).call(this,o),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return l(this,void 0,void 0,(function*(){const e=Vn(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r})),py=Yn((e=>{var t,n,i;return i=class extends(Kn(uy,Lr,fy)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return l(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),c(this,t,"m",n).call(this,ny(this.state))}))}},t=new WeakSet,n=function(e){this.appsList=new Fs((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=e},i})),gy=Yn((e=>class extends(Kn(ws,ho,py)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return l(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),vy=Kn((e=>class extends(gy(e)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",vy);var my=Object.freeze({__proto__:null,default:vy});const yy=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===i.top?e.offsetHeight:null!==(s=i.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===i.bottom?e.offsetHeight:null!==(a=i.bottom)&&void 0!==a?a:0))]};var $y,by,wy,Cy,ky,Sy,xy,Iy,Ry,Oy,Ey;const Ny=document.createElement("template");Ny.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';class Ay extends HTMLElement{constructor(){super(),$y.add(this),by.set(this,new kr({messages:[]})),wy.set(this,void 0),Cy.set(this,void 0),ky.set(this,void 0),Sy.set(this,{resize:c(this,$y,"m",Ey).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Ny.content.cloneNode(!0)),u(this,wy,this.shadowRoot.querySelector(".debugger"),"f"),u(this,Cy,c(this,wy,"f").querySelector(".content"),"f"),u(this,ky,c(this,wy,"f").querySelector(".header"),"f"),c(this,$y,"m",xy).call(this)}updateData(e){c(this,by,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=yy(e,e.offsetLeft-i,e.offsetTop-r,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})(c(this,wy,"f"),c(this,ky,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",c(this,Sy,"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}})(c(this,wy,"f")),c(this,wy,"f").onresize=c(this,$y,"m",Oy).bind(this),c(this,by,"f").subscribe(c(this,$y,"m",Iy).bind(this))}disconnectedCallback(){c(this,by,"f").unsubscribeAll(),window.removeEventListener("resize",c(this,Sy,"f").resize)}}by=new WeakMap,wy=new WeakMap,Cy=new WeakMap,ky=new WeakMap,Sy=new WeakMap,$y=new WeakSet,xy=function(){var e,t;const n=new CSSStyleSheet;n.replaceSync('\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'),null!==(e=(t=this.shadowRoot).adoptedStyleSheets)&&void 0!==e||(t.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,n],c(this,wy,"f").style.top="32px",c(this,wy,"f").style.left=window.innerWidth-300-32+"px"},Iy=function(e){c(this,$y,"m",Ry).call(this,e),c(this,$y,"m",Oy).call(this)},Ry=function(e){c(this,Cy,"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("")},Oy=function(){c(this,Cy,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,i=t.clientHeight>20;n||i?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},Ey=function(){const[e,t]=yy(c(this,wy,"f"),Number.parseInt(c(this,wy,"f").style.left,10),Number.parseInt(c(this,wy,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});c(this,wy,"f").style.top=`${t}px`,c(this,wy,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Ay);var jy=Object.freeze({__proto__:null,default:Ay});const Py=(e,t,n,i={})=>{var r,o,s,a;return[Math.min(Math.max(t,("all"===i.left?e.offsetWidth:null!==(r=i.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===i.right?e.offsetWidth:null!==(o=i.right)&&void 0!==o?o:0)),Math.min(Math.max(n,("all"===i.top?e.offsetHeight:null!==(s=i.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===i.bottom?e.offsetHeight:null!==(a=i.bottom)&&void 0!==a?a:0))]};var My,Ty,Uy,Wy,Ly,_y,Dy,Fy,qy,By;const Ky=document.createElement("template");Ky.innerHTML=`\n<div style="top:32px; left:${window.innerWidth-300-32}px;" 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`;class Vy extends HTMLElement{constructor(){var e,t,n;super(),My.add(this),Ty.set(this,new ii({messages:[]})),Uy.set(this,void 0),Wy.set(this,void 0),Ly.set(this,void 0),_y.set(this,{resize:c(this,My,"m",By).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ky.content.cloneNode(!0));const i=new CSSStyleSheet;i.replaceSync('\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'),null!==(t=(n=this.shadowRoot).adoptedStyleSheets)&&void 0!==t||(n.adoptedStyleSheets=[]),this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,i],u(this,Uy,this.shadowRoot.querySelector(".debugger"),"f"),u(this,Wy,c(this,Uy,"f").querySelector(".content"),"f"),u(this,Ly,c(this,Uy,"f").querySelector(".header"),"f")}updateData(e){c(this,Ty,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let i=0,r=0,o=0,s=0;function a(t){t.preventDefault(),i=o-t.clientX,r=s-t.clientY,o=t.clientX,s=t.clientY;const[a,d]=Py(e,e.offsetLeft-i,e.offsetTop-r,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})(c(this,Uy,"f"),c(this,Ly,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",c(this,_y,"f").resize),(e=c(this,Uy,"f")).onmousemove=t=>{var n;const i=t.target;(i.w&&i.w!==i.offsetWidth||i.h&&i.h!==i.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),i.w=i.offsetWidth,i.h=i.offsetHeight},c(this,Uy,"f").onresize=c(this,My,"m",qy).bind(this),c(this,Ty,"f").subscribe(c(this,My,"m",Dy).bind(this))}disconnectedCallback(){c(this,Ty,"f").unsubscribeAll(),window.removeEventListener("resize",c(this,_y,"f").resize)}}Ty=new WeakMap,Uy=new WeakMap,Wy=new WeakMap,Ly=new WeakMap,_y=new WeakMap,My=new WeakSet,Dy=function(e){c(this,My,"m",Fy).call(this,e),c(this,My,"m",qy).call(this)},Fy=function(e){c(this,Wy,"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("")},qy=function(){c(this,Wy,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),i=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;i||r?(t.classList.add("collapsible"),t.onclick=e=>{e.target.classList.contains("msg_desc")||t.classList.toggle("collapsed")}):(t.classList.remove("collapsible"),t.onclick=null)}))},By=function(){const[e,t]=Py(c(this,Uy,"f"),Number.parseInt(c(this,Uy,"f").style.left,10),Number.parseInt(c(this,Uy,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});c(this,Uy,"f").style.top=`${t}px`,c(this,Uy,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Vy);var Hy=Object.freeze({__proto__:null,default:Vy});e.AccessKeyManagement=vi,e.ApplicationsPortal=Ci,e.AuditManagement=yi,e.AuthProvider=({projectId:e,baseUrl:r="",baseStaticUrl:s="",sessionTokenViaCookie:a=!1,persistTokens:d=!0,oidcConfig:l,storeLastAuthenticatedUser:c=!0,keepLastAuthenticatedUserAfterLogout:u=!1,refreshCookieName:h="",getExternalToken:f,children:p})=>{const[g,v]=t.useState(),[m,y]=t.useState(),[$,b]=t.useState(!1),[w,C]=t.useState(!1),[k,S]=t.useState(!1),[x,I]=t.useState(!!l),R=t.useRef(!1),O=(({projectId:e,baseUrl:n,persistTokens:i,sessionTokenViaCookie:r,refreshCookieName:s,oidcConfig:a,storeLastAuthenticatedUser:d,keepLastAuthenticatedUserAfterLogout:l,getExternalToken:c})=>t.useMemo((()=>{if(e)return Wn({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:o,persistTokens:i,refreshCookieName:s,oidcConfig:a,storeLastAuthenticatedUser:d,keepLastAuthenticatedUserAfterLogout:l,autoRefresh:!0,getExternalToken:c})}),[e,n,r,c]))({projectId:e,baseUrl:r,persistTokens:d,sessionTokenViaCookie:a,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,refreshCookieName:h,getExternalToken:f});t.useEffect((()=>{if(O){const e=O.onSessionTokenChange(y),t=O.onUserChange(v),n=O.onIsAuthenticatedChange(b);return()=>{e(),t(),n()}}}),[O]);const E=t.useRef(!1),N=t.useRef(!1);t.useEffect((()=>{O&&l&&!R.current&&(R.current=!0,O.oidc.finishLoginIfNeed().finally((()=>{I(!1),E.current=!0})))}),[]);const A=t.useCallback((()=>{E.current||(E.current=!0,S(!0),i(null==O?void 0:O.refresh)().then((()=>{S(!1)})))}),[O]),j=t.useCallback((()=>{N.current||(N.current=!0,C(!0),i(O.me)().then((()=>{C(!1)})))}),[O]),P=t.useMemo((()=>({fetchUser:j,user:g,isUserLoading:w,isUserFetched:N.current,fetchSession:A,session:m,isAuthenticated:$,isSessionLoading:k,isOidcLoading:x,isSessionFetched:E.current,projectId:e,baseUrl:r,baseStaticUrl:s,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,refreshCookieName:h,setUser:v,setSession:y,setIsAuthenticated:b,sdk:O})),[j,g,w,N.current,A,m,$,k,x,E.current,e,r,s,u,h,v,y,b,O]);return t.createElement(n.Provider,{value:P},p)},e.Descope=ai,e.RoleManagement=pi,e.SignInFlow=e=>t.createElement(ai,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>t.createElement(ai,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>t.createElement(ai,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=hi,e.UserProfile=bi,e.baseHeaders=o,e.getCurrentTenant=Bn,e.getJwtPermissions=Fn,e.getJwtRoles=qn,e.getRefreshToken=Dn,e.getSessionToken=_n,e.isRefreshTokenExpired=(e=Dn())=>null==Un?void 0:Un.isJwtExpired(e),e.isSessionTokenExpired=(e=_n())=>null==Un?void 0:Un.isJwtExpired(e),e.refresh=(e=Dn())=>null==Un?void 0:Un.refresh(e),e.useDescope=()=>{const{sdk:e}=di();return t.useMemo((()=>e||new Proxy(Ln(),ci)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,isOidcLoading:i,fetchSession:r,isSessionFetched:o,isAuthenticated:s}=di(),a=t.useRef(n||i);t.useMemo((()=>{a.current=n||i}),[n,i]);const d=!s&&!n;return t.useMemo((()=>{d&&!o&&(a.current=!0)}),[o]),t.useEffect((()=>{d&&r()}),[r]),{isSessionLoading:a.current,sessionToken:e,isAuthenticated:s}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,isAuthenticated:r,isUserFetched:o}=di(),[s,a]=t.useState(!1),d=t.useRef(i),l=t.useMemo((()=>!e&&!i&&r&&!s),[n,r,s]);return t.useMemo((()=>{d.current=i}),[i]),t.useMemo((()=>{l&&!o&&(d.current=!0)}),[l,o]),t.useEffect((()=>{l&&(a(!0),n())}),[l]),{isUserLoading:d.current,user:e}}}));
|
|
4
4
|
//# sourceMappingURL=index.umd.js.map
|