@descope/react-sdk 2.27.10 → 2.27.12
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.d.ts +66 -6
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/sdk.d.ts +198 -18
- package/package.json +12 -12
package/dist/index.umd.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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=()=>"undefined"!=typeof window&&!!window.descopeBridge,s={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.27.10"},a="undefined"!=typeof window;var d=function(){return d=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},d.apply(this,arguments)};function l(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 c(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 u(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 h(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 f extends Error{}function p(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 g(e,t){if("string"!=typeof e)throw new f("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 f(`Invalid token specified: missing part #${n+1}`);let r;try{r=p(i)}catch(e){throw new f(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new f(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}f.prototype.name="InvalidTokenError";var v={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",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const m="<region>",y=`https://api.${m}descope.com`,b=6e5,$="dct",w=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},C=[503,521,522,524,530],k=[100,5e3,5e3],S=e=>new Promise((t=>setTimeout(t,e))),I=e=>async(...t)=>{let n=await e(...t),i=0;for(;C.includes(n.status)&&i<k.length;)await S(k[i]),n=await e(...t),i++;i>0&&(n.retries=i);const r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n};let x;const R=()=>{if(x)return x;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 x=`${t}-${n}`,x};var O;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(O||(O={}));const E=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(m,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},A=(...e)=>new Headers(e.reduce(((e,t)=>((e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t).forEach((([t,n])=>{e[t]="function"==typeof n?n():n})),e)),{})),N={"Content-Type":"application/json"},j=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},M=(e,t)=>{const n={"x-descope-sdk-session-id":R(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.60.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},P=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e};var U=e=>{var t;return(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{const d=e||y,l=((e,t)=>{const n=t||fetch;return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...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=>w().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await I(n)(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return w().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).retries(e.retries).build()})(i)),i}:I(n)})(r,a),c=async e=>{var r;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(e):e,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=a,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:A(j(t,g),M(t,i),(null==n?void 0:n.baseHeaders)||{},P(v)?N:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const y=await l(E({path:c,baseUrl:d,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(e,null==y?void 0:y.clone()),null==o?void 0:o.transformResponse){const e=await y.json(),t=(b=(null===(r=y.headers)||void 0===r?void 0:r.get("set-cookie"))||"",Object.fromEntries(function(e){if(!e)return[];const t=[];let n=0;function i(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function r(){const t=e.charAt(n);return"="!==t&&";"!==t&&","!==t}for(;n<e.length;){const o=n;let s,a,d=!1;for(;i();)if(","===e.charAt(n)){for(s=n,n+=1,i(),a=n;n<e.length&&r();)n+=1;if(n<e.length&&"="===e.charAt(n)){d=!0,n=a,t.push(e.substring(o,s));break}n=s+1}else n+=1;(!d||n>=e.length)&&t.push(e.substring(o,e.length))}return t}(b).map((e=>{const t=e.split(";")[0],n=t.indexOf("=");return n<1?null:[t.substring(0,n).trim(),t.substring(n+1).trim()]})).filter(Boolean))),n=Object.assign(Object.assign({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}var b;return y};return{get:(e,{headers:t,queryParams:n,token:i}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:O.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:r}={})=>c({path:e,headers:n,queryParams:i,body:t,method:O.post,token:r}),patch:(e,t,{headers:n,queryParams:i,token:r}={})=>c({path:e,headers:n,queryParams:i,body:t,method:O.patch,token:r}),put:(e,t,{headers:n,queryParams:i,token:r}={})=>c({path:e,headers:n,queryParams:i,body:t,method:O.put,token:r}),delete:(e,{headers:t,queryParams:n,token:i}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:O.delete,token:i}),hooks:o,buildUrl:(e,n)=>E({projectId:t,baseUrl:d,path:e,queryParams:n})}})(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}}))},T=429;function W(e,t,n){var i;let r=L(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 L(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return g(e)}function D(e){const{exp:t}=L(e);return(new Date).getTime()/1e3>t}function _(e){let t=L(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function F(e,t){return W(e,t,"permissions")}function q(e,t){return W(e,t,"roles")}const B=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function V(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===T&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function K(e){var t;return(null===(t=L(e))||void 0===t?void 0:t[$])||""}const H=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),z=(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 "))},G=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),J=e=>t=>e.test(t),Z=J(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Y=J(/^\+[1-9]{1}[0-9]{3,14}$/),X=H(Z,'"{val}" is not a valid email'),Q=H(Y,'"{val}" is not a valid phone number'),ee=H((e=>e.length>=1),"Minimum length is 1");const te=H((e=>"string"==typeof e),"Input is not a string"),ne=H((e=>Array.isArray(e)),"Input is not an array"),ie=H((e=>"boolean"==typeof e),"Input is not a boolean"),re=H((e=>void 0===e),"Input is defined"),oe=z([te(),re()],"Input is not a string or undefined"),se=z([ne(),ie()],"Input is not an array or boolean"),ae=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>G(...e).validate(n[t]))),t(...n)),de=e=>[te(`"${e}" must be a string`)],le=e=>[oe(`"${e}" must be string or undefined`)],ce=e=>[te(`"${e}" must be a string`),ee(`"${e}" must not be empty`)],ue=e=>[te(`"${e}" must be a string`),X()],he=e=>[te(`"${e}" must be a string`),Q()],fe=ae(ce("accessKey")),pe=e=>({exchange:fe(((t,n)=>V(e.post(v.accessKey.exchange,{loginOptions:n},{token:t}))))}),ge=(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),ve=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||b,b)});var me,ye;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"}(me||(me={})),function(e){e.email="email"}(ye||(ye={}));const be=Object.assign(Object.assign({},me),ye);var $e;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}($e||($e={}));const we=ce("loginId"),Ce=ae(ce("token")),ke=ae(we),Se=ae(ce("pendingRef")),Ie=ae(we,ue("email")),xe=e=>({verify:Ce((t=>V(e.post(v.enchantedLink.verify,{token:t})))),signIn:ke(((t,n,i={},r)=>{var{providerId:o}=i,s=l(i,["providerId"]);return V(e.post(B(v.enchantedLink.signIn,be.email),{loginId:t,URI:n,loginOptions:s,providerId:o},{token:r}))})),signUpOrIn:ke(((t,n,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(B(v.enchantedLink.signUpOrIn,be.email),{loginId:t,URI:n,loginOptions:o,providerId:r}))})),signUp:ke(((t,n,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(B(v.enchantedLink.signUp,be.email),{loginId:t,URI:n,user:i,loginOptions:s,providerId:o}))})),waitForSession:Se(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ve(n);let s;const a=setInterval((async()=>{const n=await e.post(v.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(V(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:Ie(((t,n,i,r,o)=>V(e.post(v.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),Re=ae(ce("flowId")),Oe=ae(ce("executionId"),ce("stepId"),ce("interactionId")),Ee=e=>({start:Re(((t,n,i,r,o,s,a,d=!1)=>V(e.post(v.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a,isCustomScreen:d})))),next:Oe(((t,n,i,r,o,s,a=!1)=>V(e.post(v.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s,isCustomScreen:a}))))}),Ae=ce("loginId"),Ne=ae(ce("token")),je=ae(Ae),Me=ae(Ae,he("phone")),Pe=ae(Ae,ue("email")),Ue=Object.keys(be).filter((e=>e!==me.voice&&e!==me.im)),Te=e=>({verify:Ne((t=>V(e.post(v.magicLink.verify,{token:t})))),signIn:Ue.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:je(((t,i,r={},o)=>{var{providerId:s}=r,a=l(r,["providerId"]);return V(e.post(B(v.magicLink.signIn,n),{loginId:t,URI:i,loginOptions:a,providerId:s},{token:o}))}))})),{}),signUp:Ue.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:je(((t,i,r,o={})=>{var{providerId:s}=o,a=l(o,["providerId"]);return V(e.post(B(v.magicLink.signUp,n),{loginId:t,URI:i,user:r,loginOptions:a,providerId:s}))}))})),{}),signUpOrIn:Ue.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:je(((t,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(B(v.magicLink.signUpOrIn,n),{loginId:t,URI:i,loginOptions:s,providerId:o}))}))})),{}),update:{email:Pe(((t,n,i,r,o)=>V(e.post(v.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(me).filter((e=>e!==me.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Me(((t,i,r,o,s)=>V(e.post(B(v.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var We;!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"}(We||(We={}));const Le=ae(ce("code")),De=e=>({start:Object.assign(((t,n,i,r,o)=>V(e.post(v.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),o&&{loginHint:o}),token:r}))),Object.keys(We).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r,o)=>V(e.post(v.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:n},t&&{redirectURL:t}),o&&{loginHint:o}),token:r}))})),{})),exchange:Le((t=>V(e.post(v.oauth.exchange,{code:t})))),startNative:(t,n,i)=>V(e.post(v.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>V(e.post(v.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>V(e.get(v.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>V(e.post(v.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>V(e.post(v.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),_e=ce("appId"),Fe=ae(_e),qe=e=>({connect:Fe(((t,n,i)=>{const r=null==n?void 0:n.tenantId,o=null==n?void 0:n.tenantLevel;return null==n||delete n.tenantId,null==n||delete n.tenantLevel,V(e.post(v.outbound.connect,{appId:t,tenantId:r,tenantLevel:o,options:n},{token:i}))}))}),Be=ce("loginId"),Ve=ae(Be,ce("code")),Ke=ae(Be),He=ae(Be,he("phone")),ze=ae(Be,ue("email")),Ge=e=>({verify:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ve(((t,i)=>V(e.post(B(v.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ke(((t,i={},r)=>{var{providerId:o}=i,s=l(i,["providerId"]);return V(e.post(B(v.otp.signIn,n),{loginId:t,loginOptions:s,providerId:o},{token:r}))}))})),{}),signUp:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ke(((t,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(B(v.otp.signUp,n),{loginId:t,user:i,loginOptions:s,providerId:o}))}))})),{}),signUpOrIn:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ke(((t,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(B(v.otp.signUpOrIn,n),{loginId:t,loginOptions:o,providerId:r}))}))})),{}),update:{email:ze(((t,n,i,r)=>V(e.post(v.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(me).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:He(((t,i,r,o)=>V(e.post(B(v.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Je=ae(ce("tenant")),Ze=ae(ce("code")),Ye=e=>({start:Je(((t,n,i,r,o,s,a,d)=>V(e.post(v.saml.start,i||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o}),s&&{forceAuthn:"true"}),a&&{loginHint:a}),d&&{initiatedEmail:t})},r&&{token:r}))))),exchange:Ze((t=>V(e.post(v.saml.exchange,{code:t}))))}),Xe=ce("loginId"),Qe=ae(Xe,ce("code")),et=ae(Xe),tt=ae(Xe),nt=e=>({signUp:et(((t,n)=>V(e.post(v.totp.signUp,{loginId:t,user:n})))),verify:Qe(((t,n,i,r)=>V(e.post(v.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:tt(((t,n)=>V(e.post(v.totp.update,{loginId:t},{token:n}))))}),it=ce("loginId"),rt=ce("newPassword"),ot=ae(it,ce("password")),st=ae(it),at=ae(it,rt),dt=ae(it,ce("oldPassword"),rt),lt=e=>({signUp:ot(((t,n,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(v.password.signUp,{loginId:t,password:n,user:i,loginOptions:s,providerId:o}))})),signIn:ot(((t,n,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(v.password.signIn,{loginId:t,password:n,loginOptions:o,providerId:r}))})),sendReset:st(((t,n,i)=>V(e.post(v.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:at(((t,n,i)=>V(e.post(v.password.update,{loginId:t,newPassword:n},{token:i})))),replace:dt(((t,n,i)=>V(e.post(v.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>V(e.get(v.password.policy))}),ct=de("loginId"),ut=ce("loginId"),ht=ce("origin"),ft=ae(ut,ht,ce("name")),pt=ae(ut,ht),gt=ae(ct,ht),vt=ae(ut,ht,le("token")),mt=ae(ce("transactionId"),ce("response")),yt=e=>({signUp:{start:ft(((t,n,i,r)=>V(e.post(v.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,passkeyOptions:r})))),finish:mt(((t,n)=>V(e.post(v.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:gt(((t,n,i,r,o)=>V(e.post(v.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:mt(((t,n)=>V(e.post(v.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:pt(((t,n,i)=>V(e.post(v.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:i}))))},update:{start:vt(((t,n,i,r)=>V(e.post(v.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:i})))),finish:mt(((t,n)=>V(e.post(v.webauthn.update.finish,{transactionId:t,response:n}))))}}),bt=de("loginId"),$t=ae(bt),wt=ae(ce("pendingRef")),Ct=e=>({signUpOrIn:$t(((t,n={})=>{var{providerId:i}=n,r=l(n,["providerId"]);return V(e.post(v.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:i}))})),signUp:$t(((t,n,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(v.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:o}))})),signIn:$t(((t,n={},i)=>{var{providerId:r}=n,o=l(n,["providerId"]);return V(e.post(v.notp.signIn,{loginId:t,loginOptions:o,providerId:r},{token:i}))})),waitForSession:wt(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ve(n);let s;const a=setInterval((async()=>{const n=await e.post(v.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(V(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),kt=ae(ce("token")),St=ae(le("token"));var It,xt=ae([(It=ce("projectId"),H(((e,t)=>n=>G(...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",It))())])((e=>{const{projectId:t,logger:n,baseUrl:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a}=e;return d=U({baseUrl:i,projectId:t,logger:n,hooks:{get beforeRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest},get afterRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.afterRequest},get transformResponse(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:pe(d),otp:Ge(d),magicLink:Te(d),enchantedLink:xe(d),oauth:De(d),outbound:qe(d),saml:Ye(d),totp:nt(d),notp:Ct(d),webauthn:yt(d),password:lt(d),flow:Ee(d),refresh:St(((e,t,n,i)=>{const r={};n&&(r.externalToken=n);const o=i?v.tryRefresh:v.refresh;return V(d.post(o,r,{token:e,queryParams:t}))})),selectTenant:ae([te("tenantId")],[oe('"token" must be string or undefined')])(((e,t)=>V(d.post(v.selectTenant,{tenant:e},{token:t})))),logout:St((e=>V(d.post(v.logout,{},{token:e})))),logoutAll:St((e=>V(d.post(v.logoutAll,{},{token:e})))),me:St((e=>V(d.get(v.me,{token:e})))),myTenants:ae([se('"tenants" must a string array or a boolean')],[oe('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,V(d.post(v.myTenants,n,{token:t}))})),history:St((e=>V(d.get(v.history,{token:e})))),isJwtExpired:kt(D),getTenants:kt(_),getJwtPermissions:kt(F),getJwtRoles:kt(q),getCurrentTenant:kt(K),httpClient:d};var d})),Rt=Object.assign(xt,{DeliveryMethods:be});
|
|
2
|
-
/*! js-cookie v3.0.5 | MIT */function Ot(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 Et=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=Ot({},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,"",Ot({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Ot({},this.attributes,t))},withConverter:function(t){return e(Ot({},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 At={default:"endpoint"},Nt="Blocked by CSP",jt="The endpoint parameter is not a valid URL",Mt="Failed to load the JS script of the agent",Pt="9319";function Ut(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===Nt||s===jt)n.exclude(),o=0;else if(s===Pt)n.exclude();else if(s===Mt){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 Tt="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Wt=Tt;function Lt(e){var t;e.scriptUrlPattern;var n=e.token,i=e.apiKey,r=void 0===i?n:i,o=l(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:Tt,a=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=a[0],u=a[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 Ut(e,Dt)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Pt?new Error(Mt):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(d(d({},o),{ldi:{attempts:n,visibilityStates:c}}))}))}function Dt(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(jt);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(Mt))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(Nt)})).then(_t)}function _t(){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(Pt);return n}const Ft="3.2.0",qt="undefined"!=typeof window,Bt=Math.pow(2,31)-1,Vt=`https://descopecdn.com/npm/oidc-client-ts@${Ft}/dist/browser/oidc-client-ts.min.js`,Kt=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Ft}/dist/browser/oidc-client-ts.min.js`,Ht=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let zt;const Gt=e=>{try{return g(e).exp}catch(e){return null}},Jt=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Gt(n)},Zt=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Gt(i):void 0)},Yt=e=>{const{access_token:t,id_token:n,refresh_token:i,refresh_expire_in:r}=e,o=l(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||Zt(e),cookieExpiration:e.cookieExpiration||Jt(e)},o)},Xt=(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},Qt=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json()),n=(null==t?void 0:t.authInfo)||t||{};return Yt(n)},en=()=>qt&&!!window.descopeBridge,tn=(e,t)=>{if(!((null==t?void 0:t.status)>=400&&(null==t?void 0:t.status)<500))return!1;const n=(null==e?void 0:e.path)||"";return Ht.includes(n)},nn=void 0!==zt||qt&&void 0!==window.localStorage,rn=(e,t)=>{var n,i;return null===(i=null===(n=zt||qt&&window.localStorage)||void 0===n?void 0:n.setItem)||void 0===i?void 0:i.call(n,e,t)},on=e=>{var t,n;return null===(n=null===(t=zt||qt&&window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e)},sn=e=>{var t,n;return null===(n=null===(t=zt||qt&&window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n?void 0:n.call(t,e)},an=e=>{var t,n,i,r,o;return null!==(o=null!==(n=null===(t=null==zt?void 0:zt.key)||void 0===t?void 0:t.call(zt,e))&&void 0!==n?n:qt&&(null===(r=null===(i=window.localStorage)||void 0===i?void 0:i.key)||void 0===r?void 0:r.call(i,e)))&&void 0!==o?o:null},dn=(...e)=>{console.debug(...e)},ln=(...e)=>{console.warn(...e)},cn="DS",un="DSR",hn="DSI",fn="DSRCN";function pn(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=gn(i);Et.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}function gn(e){const t=window.location.hostname.split("."),n=null==e?void 0:e.split(".");return t.slice(-(null==n?void 0:n.length)).join(".")===e}const vn=e=>(null==e?void 0:e.cookieName)||cn,mn=e=>(null==e?void 0:e.cookieName)||un;function yn(e="",t){return Et.get(mn(t))||on(`${e}${un}`)||""}function bn(e="",t){return Et.get(vn(t))||on(`${e}${cn}`)||""}function $n(e=""){return on(`${e}${hn}`)||""}function wn(e="",t,n,i){sn(`${e}${un}`),sn(`${e}${cn}`),sn(`${e}${hn}`),sn(`${e}${fn}`);const r=vn(t);Et.remove(r,null==i?void 0:i.session);const o=mn(n);Et.remove(o,null==i?void 0:i.refresh)}const Cn=(e,t,n)=>i=>{const r=Object.assign(i,{token:i.token||yn(e,t)});if(!n){const t=function(e=""){return on(`${e}${fn}`)}(e);t&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":t}))}const o=function(e=""){return on(`${e}DTD`)||""}(e);return o&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":o})),r},kn=qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Sn="vsid",In="vrid",xn="fp",Rn=(e=!1)=>{const t=on(xn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},On=async(e,t=kn)=>{try{if(Rn())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=Lt({apiKey:e,endpoint:[i.toString(),At],scriptUrlPattern:[o,Wt]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[Sn]:e,[In]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};rn(xn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},En=e=>{const t=Rn(!0);return t&&e.body&&(e.body.fpData=t),e},An="descopeFlowNonce",Nn="X-Descope-Flow-Nonce",jn="/v1/flow/start",Mn="/v1/flow/next",Pn=(e,t=An)=>`${t}${e}`,Un=e=>{var t;return(null===(t=/.*\|#\|(.*)/.exec(e))||void 0===t?void 0:t[1])||null},Tn=e=>{var t;return e.path===Mn&&(null===(t=e.body)||void 0===t?void 0:t.executionId)?Un(e.body.executionId):null},Wn="dls_last_user_login_id",Ln="dls_last_user_display_name",Dn=e=>rn(Wn,e),_n=()=>on(Wn),Fn=()=>on(Ln),qn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=_n(),o=Fn();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)};function Bn(){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 Vn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Zn(n.publicKey.challenge),n.publicKey.user.id=Zn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Zn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Yn(n.rawId),type:n.type,response:{attestationObject:Yn(n.response.attestationObject),clientDataJSON:Yn(n.response.clientDataJSON)}});var n}async function Kn(e){const t=Gn(e);return Jn(await navigator.credentials.get(t))}async function Hn(e,t){const n=Gn(e);return n.signal=t.signal,n.mediation="conditional",Jn(await navigator.credentials.get(n))}async function zn(e=!1){var t,n;if(!qt)return Promise.resolve(!1);if(en()){const e=null===(n=null===(t=window.descopeBridge)||void 0===t?void 0:t.hostInfo)||void 0===n?void 0:n.webauthn;if("boolean"==typeof e)return e}const i=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return i&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():i}function Gn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Zn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Zn(e.id)})),n}function Jn(e){return JSON.stringify({id:e.id,rawId:Yn(e.rawId),type:e.type,response:{authenticatorData:Yn(e.response.authenticatorData),clientDataJSON:Yn(e.response.clientDataJSON),signature:Yn(e.response.signature),userHandle:e.response.userHandle?Yn(e.response.userHandle):void 0}})}function Zn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Yn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Xn,Qn=(Xn=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 Vn(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 Kn(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 Vn(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await Kn(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 Vn(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:Vn,get:Kn,isSupported:zn,conditional:Hn}}),(...e)=>{const t=Xn(...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 ei="/fedcm/config",ti=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("")}return Math.random().toString(36).substring(2)};async function ni(e,t){var n;try{await ii(e,t)}catch(e){null===(n=null==t?void 0:t.onFailed)||void 0===n||n.call(t,e)}}async function ii(e,t){var n,i;const r=await async function(e,t="google",n,i,r){const o=ti(),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)}}var ri=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await zn(),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 oi;const si=(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",(()=>{si(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),ai=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{oi||(oi=(async()=>{try{return require("oidc-client-ts")}catch(e){return si([Vt,Kt],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await oi;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=(null==n?void 0:n.redirectUri)||window.location.href;let s,a,d,l;if(null==n?void 0:n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,a=n.clientId,d=`${a}_user`,l="openid"}else(null==n?void 0:n.applicationId)?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access");const c={authority:s,client_id:a,redirect_uri:o,response_type:"code",scope:(null==n?void 0:n.scope)||l,stateStore:new r({store:window.localStorage,prefix:a}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),{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)))),rn(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=on(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||$n(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return sn(r),t||window.location.replace(s),o}}},di=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var n;return n=t.customStorage,zt=n,e(t)}),(e=>t=>{var{fpKey:n,fpLoad:i}=t,r=l(t,["fpKey","fpLoad"]);return qt?(n&&i&&On(n).catch((()=>null)),e(Xt(r,{beforeRequest:En}))):e(r)}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.48.2"},t.baseHeaders)}))),(e=>t=>{const n=Bn(),i=Bn(),r=Bn(),o=Bn(),s=e(Xt(t,{afterRequest:async(e,t)=>{if(tn(e,t))dn("Session invalidated, notifying subscribers with empty values"),i.pub(null),r.pub(null),n.pub(null),o.pub(null);else{const e=await(async e=>{const t=await Qt(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)})(t);e&&r.pub(e);const{sessionJwt:s,sessionExpiration:a,claims:d}=await Qt(t);s&&i.pub(s),d&&o.pub(d),(a||s)&&n.pub(a||42)}}})),a=ge(s,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const s=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o.pub(null),s}));return Object.assign(a,{onSessionTokenChange:i.sub,onUserChange:r.sub,onClaimsChange:o.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:i=An}=t,r=l(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((e=An)=>{try{if(!nn)return;for(let r=0;r<(void 0,n=void 0,void 0,null!==(i=null!==(t=null==zt?void 0:zt.length)&&void 0!==t?t:qt&&(null===(n=window.localStorage)||void 0===n?void 0:n.length))&&void 0!==i?i:0);r++){const t=an(r);if(t&&t.startsWith(e)){const n=on(t);if(n)try{JSON.parse(n).expiry<Date.now()&&sn(t)}catch(e){sn(t)}}}}catch(e){console.error("Error cleaning up expired nonces:",e)}var t,n,i})(i),e(Xt(r,{afterRequest:async(e,t)=>{if(e.path!==jn&&e.path!==Mn)return;const{nonce:n,executionId:r}=await(async(e,t)=>{try{const n=t.headers.get(Nn);let i=await t.clone().json().then((e=>(null==e?void 0:e.executionId)||null)).catch((()=>null));return i||(i=Tn(e)),{nonce:n,executionId:Un(i)}}catch(e){return{nonce:null,executionId:null}}})(e,t);n&&r&&((e,t,n,i=An)=>{try{const r=Pn(e,i),o=n?172800:10800,s={value:t,expiry:Date.now()+1e3*o,isStart:n};rn(r,JSON.stringify(s))}catch(e){console.error("Error setting flow nonce:",e)}})(r,n,e.path===jn,i)},beforeRequest:e=>{if(e.path===Mn){const t=Tn(e);if(t){const n=((e,t=An)=>{try{const n=Pn(e,t),i=on(n);if(!i)return null;const r=JSON.parse(i);return r.expiry<Date.now()?(((e,t=An)=>{try{const n=Pn(e,t);sn(n)}catch(e){console.error("Error removing flow nonce:",e)}})(e,t),null):r.value}catch(e){return console.error("Error getting flow nonce:",e),null}})(t,i);n&&(e.headers=e.headers||{},e.headers[Nn]=n)}}return e}}))):e(r)}),(e=>t=>{var{autoRefresh:n}=t,i=l(t,["autoRefresh"]);const r=!!n,o="object"==typeof n&&(null==n?void 0:n.customActivityTracking);if(!r||en())return Object.assign(e(i),{markUserActive:()=>{ln("markUserActive() called but has no effect")}});const{clearAllTimers:s,setTimer:a}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let d,c,u=null,h=!1,f=!1;o&&(dn("Activity-based refresh enabled"),u=(()=>{let e=!0;return{hadActivity:()=>e,reset:()=>{e=!1},markActive:()=>{e=!0}}})()),qt&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&d&&new Date>d&&(dn("Expiration time passed, refreshing session"),p.refresh(yn()||c))}));const p=e(Xt(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:r,nextRefreshSeconds:o}=await Qt(t);if(tn(e,t))dn("Session invalidated, canceling all timers"),s();else if(n||r){if(d=((e,t)=>{if(t)return new Date(1e3*t);dn("Could not extract expiration time from session token, trying to decode the token");try{const t=g(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,r),!d)return void dn("Could not extract expiration time from session token");c=i,h=o>0;const e=((e,t)=>{let n;var i;return t>0?(n=1e3*t,dn(`Using provided nextRefreshSeconds: ${t}s`)):n=((i=e)?i.getTime()-(new Date).getTime():0)-2e4,n>Bt&&(dn(`Timeout is too large (${n}ms), setting it to ${Bt}ms`),n=Bt),n})(d,o);if(s(),e<=2e4)return void dn("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});dn(`Setting refresh timer for ${t}. (${e}ms)`),u&&(u.reset(),f=!1),a((()=>{if(qt&&"hidden"===document.visibilityState)dn("Skipping refresh due to timer - document is hidden");else{if(u&&h&&!u.hadActivity())return dn("Skipping refresh due to timer - user is idle"),void(f=!0);dn("Refreshing session due to timer"),p.refresh(yn()||i)}}),e)}}}));return Object.assign(ge(p,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return dn("Clearing all timers"),s(),n})),{markUserActive:u?()=>{dn("markUserActive() called"),h||dn("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),f&&(dn("User became active after skipped refresh, triggering refresh"),f=!1,s(),p.refresh(yn()||c))}:()=>{ln("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=t,r=l(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:_n,getLastUserDisplayName:Fn});const o=e(Xt(r,{afterRequest:async(e,t)=>{var n;const{userInfo:i,lastAuth:r}=await(async e=>{if(!(null==e?void 0:e.ok))return{userInfo:void 0,lastAuth:void 0};const t=await(null==e?void 0:e.clone().json()),n=Yt((null==t?void 0:t.authInfo)||t||{});return{userInfo:(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0),lastAuth:t.lastAuth}})(t),o=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],s=null==i?void 0:i.name;o?(Dn(o),(e=>{rn(Ln,e)})(s)):(null==r?void 0:r.loginId)&&Dn(r.loginId)}}));let s=ge(o,["flow.start"],qn);return s=ge(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(sn(Wn),sn(Ln)),i})(i)),Object.assign(s,{getLastUserLoginId:_n,getLastUserDisplayName:Fn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:i,refreshTokenViaCookie:r,storagePrefix:o,refreshCookieName:s}=t,a=l(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!n||!qt)return e(Object.assign({refreshCookieName:s},a));let d;const c=e(Xt(Object.assign({refreshCookieName:s},a),{beforeRequest:Cn(o,r,s),afterRequest:async(e,t)=>{if(tn(e,t))dn("Session invalidated, clearing persisted tokens"),wn(o,i,r,d);else{const e=await Qt(t);e.cookieName?rn(`${o||""}${fn}`,e.cookieName):e.refreshJwt&&sn(`${o||""}${fn}`);const n=((e={},t=!1,n="",i=!1)=>{var r,o,s,a;const{sessionJwt:d,refreshJwt:l,trustedDeviceJwt:c}=e;let u;if(l)if(i){sn(`${n}${un}`);const t=i.sameSite||"Strict",s=null===(r=i.secure)||void 0===r||r,a=null!==(o=i.domain)&&void 0!==o?o:e.cookieDomain,d=mn(i);s&&"https:"!==window.location.protocol&&ln("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const c=Object.assign(Object.assign({},e),{cookieSameSite:t,cookieSecure:s,cookieDomain:a});pn(d,l,c);const h=gn(a);u=Object.assign(Object.assign({},u),{refresh:{path:c.cookiePath,domain:h?a:void 0}})}else{const e=mn(i);Et.remove(e),rn(`${n}${un}`,l)}if(d)if(t){const n=t.sameSite||"Strict",i=null===(s=t.secure)||void 0===s||s,r=null!==(a=t.domain)&&void 0!==a?a:e.cookieDomain,o=vn(t);i&&"https:"!==window.location.protocol&&ln("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const l=Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:i,cookieDomain:r});pn(o,d,l);const c=gn(r);u=Object.assign(Object.assign({},u),{session:{path:l.cookiePath,domain:c?r:void 0}})}else rn(`${n}${cn}`,d);return e.idToken&&rn(`${n}${hn}`,e.idToken),c&&rn(`${n}DTD`,c),u})(e,i,o,r);n&&(d=n)}}})),u=ge(c,["logout","logoutAll","oidc.logout"],((e,t,n,i)=>r=>async(...o)=>{const s=await r(...o);return wn(e,t,n,null==i?void 0:i()),s})(o,i,r,(()=>d)));return Object.assign(u,{getRefreshToken:()=>yn(o,r),getSessionToken:()=>bn(o,i),getIdToken:()=>$n(o)})}))((e=>{const t=Rt(e),n=ai(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,r)=>{var o;if(en())return dn(`Refresh called in native flow: ${(new Error).stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}const s=bn(),a=yn();let d="";if(e.getExternalToken)try{d=await(null===(o=e.getExternalToken)||void 0===o?void 0:o.call(e))}catch(e){dn("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:s?"t":"f",dcr:a?"t":"f"},d,r)},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:ri(t),webauthn:Qn(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){ni(i,e)},requestAuthentication(e){ni(i,e)}},async oneTap(e,t,n,r,o){await ii(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+ei),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>qt&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+ei);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 li;const ci=e=>{const t=di(Object.assign({persistTokens:a,autoRefresh:a},e));return li=t,t},ui=()=>ci({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});li=ui();const hi=()=>a?null==li?void 0:li.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),fi=()=>a?null==li?void 0:li.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),pi=r(((e=hi(),t)=>null==li?void 0:li.getJwtPermissions(e,t))),gi=r(((e=hi(),t)=>null==li?void 0:li.getJwtRoles(e,t))),vi=r(((e=hi())=>null==li?void 0:li.getCurrentTenant(e)));function mi(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const yi=e=>{const t=document.createElement("template");return t.innerHTML=e,t},bi=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),$i=e=>{let t,n;return(...i)=>(t&&bi(t,i)||(t=i,n=e(...i)),n)},wi=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Ci=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])||""}`}),""),ki=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},Si=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 Ii,xi,Ri,Oi;function Ei(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(!Ei(o,s))return!1}else if(o!==s)return!1}return!0}let Ai=class{constructor(e={},{forceUpdate:t=!1}={}){Ii.set(this,void 0),xi.set(this,{}),Ri.set(this,0),Oi.set(this,!0),this.update=e=>{const t="function"==typeof e?e(u(this,Ii,"f")):e,n=Object.assign(Object.assign({},u(this,Ii,"f")),t);if(u(this,Oi,"f")||!Ei(u(this,Ii,"f"),n)){const e=u(this,Ii,"f");h(this,Ii,n,"f"),Object.freeze(u(this,Ii,"f")),setTimeout((()=>{Object.values(u(this,xi,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},h(this,Ii,e,"f"),h(this,Oi,t,"f")}get current(){return Object.assign({},u(this,Ii,"f"))}subscribe(e){return h(this,Ri,u(this,Ri,"f")+1,"f"),u(this,xi,"f")[u(this,Ri,"f")]=e,u(this,Ri,"f").toString()}unsubscribe(e){const t=!!u(this,xi,"f")[e];return t&&delete u(this,xi,"f")[e],t}unsubscribeAll(){return h(this,xi,{},"f"),!0}};Ii=new WeakMap,xi=new WeakMap,Ri=new WeakMap,Oi=new WeakMap;const Ni=["=","+","-","@","\t","\r"],ji=e=>{const t=(e=>e.length>0&&Ni.includes(e[0])?`'${e}`:e)(Array.isArray(e)?e.join("; "):String(null!=e?e:""));return t.includes(",")||t.includes('"')||t.includes("\n")||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t},Mi=e=>"string"==typeof e||null==e?e:JSON.stringify(e),Pi=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([wi(i),Mi(n)]):Object.assign(e.rest,{[wi(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))})),Ui=t.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await Promise.resolve().then((function(){return ba})).then((e=>e.default))).sdkConfigOverrides={baseHeaders:s,persistTokens:!1,hooks:{get beforeRequest(){return li.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:Pi(t.forwardRef(((e,n)=>{var{"external-request-id":i}=e,r=l(e,["external-request-id"]);return t.useMemo((()=>{var e,t;e="x-external-rid",(t=i)?s[e]=t:delete s[e]}),[i]),t.createElement("descope-wc",Object.assign({ref:n},r))})))}))),Ti=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:b,styleId:$,onScreenUpdate:w,dismissScreenErrorOnInput:C,outboundAppId:k,outboundAppScopes:S,popupOrigin:I,children:x,externalRequestId:R},O)=>{const[E,A]=t.useState(null);t.useImperativeHandle(O,(()=>E));const{projectId:N,baseUrl:j,baseStaticUrl:M,baseCdnUrl:P,storeLastAuthenticatedUser:U,keepLastAuthenticatedUserAfterLogout:T,refreshCookieName:W,customStorage:L,sdk:D}=t.useContext(n),_=t.useCallback((async e=>{await D.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),i&&i(e)}),[i]);return t.useEffect((()=>{const e=E;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",_)}}),[E,r,_]),t.useEffect((()=>{const e=E;return null==e||e.addEventListener("success",_),()=>{null==e||e.removeEventListener("success",_)}}),[E,_]),t.useEffect((()=>{const e=E;return r&&(null==e||e.addEventListener("error",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[E,r]),t.useEffect((()=>{const e=E;return o&&(null==e||e.addEventListener("ready",o)),()=>{o&&(null==e||e.removeEventListener("error",o))}}),[E,o]),t.createElement("form",null,t.createElement(t.Suspense,{fallback:null},t.createElement(Ui,{projectId:N,flowId:e,baseUrl:j,baseStaticUrl:M,baseCdnUrl:P,ref:A,telemetryKey:p,redirectUrl:g,autoFocus:v,styleId:$,validateOnBlur:m,restartOnError:y,keepLastAuthenticatedUserAfterLogout:T,tenant:a,externalRequestId:R,customStorage:L,"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,"popup-origin.attr":I,"store-last-authenticated-user.attr":U,"refreshCookieName.attr":W,"dismiss-screen-error-on-input.attr":C,"errorTransformer.prop":b,"logger.prop":s,"onScreenUpdate.prop":w,"customStorage.prop":L},x)))}));var Wi=()=>{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`,Di={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],Di);if("function"==typeof e[t])return()=>{throw Error(Li("function"))};throw Error(Li("attribute"))}},_i=t.lazy((async()=>(await Promise.resolve().then((function(){return au})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-access-key-management-widget",Object.assign({ref:n},e)))))}))),Fi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(_i,{ref:u,projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),qi=t.lazy((async()=>(await Promise.resolve().then((function(){return Eu})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-applications-portal-widget",Object.assign({ref:n},e)))))}))),Bi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s,onReady: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.useEffect((()=>{const e=l;return a&&(null==e||e.addEventListener("ready",a)),()=>{a&&(null==e||e.removeEventListener("ready",a))}}),[l,a]),t.createElement(t.Suspense,{fallback:null},t.createElement(qi,{ref:c,projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":g,"logger.prop":e}))})),Vi=t.lazy((async()=>(await Promise.resolve().then((function(){return Yu})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-audit-management-widget",Object.assign({ref:n},e)))))}))),Ki=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Vi,{ref:u,projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),Hi=t.lazy((async()=>(await Promise.resolve().then((function(){return Eh})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-outbound-applications-widget",Object.assign({ref:n},e)))))}))),zi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s,onReady: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.useEffect((()=>{const e=l;return a&&(null==e||e.addEventListener("ready",a)),()=>{a&&(null==e||e.removeEventListener("ready",a))}}),[l,a]),t.createElement(t.Suspense,{fallback:null},t.createElement(Hi,{ref:c,projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":g,"logger.prop":e}))})),Gi=t.lazy((async()=>(await Promise.resolve().then((function(){return Of})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-role-management-widget",Object.assign({ref:n},e)))))}))),Ji=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Gi,{ref:u,projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),Zi=t.lazy((async()=>(await Promise.resolve().then((function(){return bp})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-tenant-profile-widget",Object.assign({ref:n},e)))))}))),Yi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s,tenant:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Zi,{projectId:h,widgetId:o,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,styleId:s,tenant:a,ref:u,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"tenant.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),Xi=t.lazy((async()=>(await Promise.resolve().then((function(){return b$})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-user-management-widget",Object.assign({ref:n},e)))))}))),Qi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Xi,{projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,ref:u,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),er=t.lazy((async()=>(await Promise.resolve().then((function(){return Nw})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-user-profile-widget",Object.assign({ref:n},e)))))}))),tr=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,onLogout:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v,setSession:m,setUser:y,setIsAuthenticated:b}=t.useContext(n),$=t.useCallback((e=>{s&&s(e),b(!1),m(""),y(null)}),[s,m,b,y]);return t.useEffect((()=>{if(c)return c.addEventListener("logout",$),()=>c.removeEventListener("logout",$)}),[c,$]),t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(er,{projectId:h,widgetId:o,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,styleId:a,ref:u,"theme.attr":i,"debug.attr":r,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),nr="undefined"!=typeof localStorage,ir="J151000",rr="E103205",or=nr&&localStorage.getItem("base.content.url")||"",sr="base.ui.components.url";nr&&localStorage.getItem(sr),nr&&localStorage.getItem(sr);const ar="descope-login-flow",dr="code",lr="redirect_mode",cr="err",ur="data-exclude-field",hr="data-exclude-next",fr="dls_last_auth",pr="state_id",gr="saml_idp_state_id",vr="wsfed_idp_state_id",mr="saml_idp_username",yr="descope_idp_initiated",br="sso_app_id",$r="third_party_app_id",wr="third_party_app_state_id",Cr="oidc_login_hint",kr="oidc_prompt",Sr="oidc_resource",Ir="oidc_error_redirect_uri",xr="application_scopes",Rr="data-type",Or="redirect",Er="poll",Ar="webauthnCreate",Nr="webauthnGet",jr="nativeBridge",Mr="loadForm",Pr="submit",Ur="polling",Tr=["descope-multi-select-combo-box","descope-text-area"],Wr=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var Lr;!function(e){e.backward="backward",e.forward="forward"}(Lr||(Lr={}));const Dr=["descope-enriched-text"];function _r(e){return new URLSearchParams(window.location.search).get(e)}function Fr(e){if(window.history.replaceState&&_r(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 qr(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?Lr.forward:n<i?Lr.backward:void 0}const Br=e=>{let[t="",n=""]=(_r(ar)||"").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 Vr(){Fr(ar)}const Kr=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),Hr=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=Br(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&Vr();const o=_r("t")||void 0;o&&Fr("t");const s=_r(dr)||void 0;s&&Fr(dr);const a="popup"===_r(lr);a&&Fr(lr);const d=_r(cr)||void 0;d&&Fr(cr);const{redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h}={redirectAuthCodeChallenge:_r("ra-challenge"),redirectAuthCallbackUrl:_r("ra-callback"),redirectAuthBackupCallbackUri:_r("ra-backup-callback"),redirectAuthInitiator:_r("ra-initiator")},f=_r(pr);f&&Fr(pr);const p=_r(gr);p&&Fr(gr);const g=_r(vr);g&&Fr(vr);const v=_r(mr);p&&Fr(mr);const m=_r(yr);m&&Fr(yr);const y=_r(br);y&&Fr(br);const b=_r($r);b&&Fr($r);const $=_r(wr);$&&Fr(wr);const w=_r(xr);w&&Fr(xr);const C=_r(Cr);C&&Fr(Cr);const k=_r(kr);k&&Fr(kr);const S=_r(Ir);S&&Fr(Ir);const I=_r(Sr);return I&&Fr(Sr),{executionId:n,stepId:i,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h,ssoQueryParams:{oidcIdpStateId:f,samlIdpStateId:p,wsfedIdpStateId:g,samlIdpUsername:v,descopeIdpInitiated:"true"===m,ssoAppId:y,oidcLoginHint:C,oidcPrompt:k,oidcErrorRedirectUri:S,oidcResource:I,thirdPartyAppId:b,thirdPartyAppStateId:$,applicationScopes:w}}},zr=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}})},Gr=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector('*[name]:not([auto-focus="false"]):not([aria-hidden="true"])');setTimeout((()=>{null==t||t.focus()}))}};function Jr(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 Zr=(e,{oidcIdpStateId:t,samlIdpStateId:n,wsfedIdpStateId:i,samlIdpUsername:r,ssoAppId:o,oidcLoginHint:s,oidcPrompt:a,oidcErrorRedirectUri:d,oidcResource:l,thirdPartyAppId:c,thirdPartyAppStateId:u,applicationScopes:h})=>!(!e||t||n||i||r||o||s||a||d||l||c||u||h),Yr=e=>null==e?void 0:e.submit(),Xr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},Qr=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function eo(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:""}}const to=e=>{const t=Object.assign({},e);return e.inboundAppApproveScopes&&(t.thirdPartyAppApproveScopes=e.inboundAppApproveScopes),t};function no(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var io,ro,oo,so;function ao(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(!ao(o,s))return!1}else if(o!==s)return!1}return!0}let lo=class{constructor(e={},{forceUpdate:t=!1}={}){io.set(this,void 0),ro.set(this,{}),oo.set(this,0),so.set(this,!0),this.update=e=>{const t="function"==typeof e?e(u(this,io,"f")):e,n=Object.assign(Object.assign({},u(this,io,"f")),t),i=u(this,io,"f");h(this,io,n,"f"),Object.freeze(u(this,io,"f")),setTimeout((()=>{Object.values(u(this,ro,"f")).forEach((({cb:e,selector:t,forceUpdate:r})=>{const o=t(i),s=t(n);(u(this,so,"f")||r||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(s)?!ao(o,s):o!==s))&&e(s,o,((e,t)=>n=>e[n]!==t[n])(s,o))}))}),0)},h(this,io,e,"f"),h(this,so,t,"f")}get current(){return Object.assign({},u(this,io,"f"))}set forceUpdate(e){h(this,so,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return h(this,oo,u(this,oo,"f")+1,"f"),u(this,ro,"f")[u(this,oo,"f")]={cb:e,selector:t,forceUpdate:n},u(this,oo,"f").toString()}unsubscribe(e){const t=!!u(this,ro,"f")[e];return t&&delete u(this,ro,"f")[e],t}unsubscribeAll(){return h(this,ro,{},"f"),!0}};io=new WeakMap,ro=new WeakMap,oo=new WeakMap,so=new WeakMap;const co=["*","#","/","(",")","[","]","_","<",">","`"],uo=e=>"string"!=typeof e?e:e.replace((e=>{const t=co.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),ho=["disabled"],fo=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${ur}])`)).forEach((e=>{e.value=n}))}))},po=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),go=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?uo(po(t,i)):po(t,i))),vo=(e,t,n)=>{e.querySelectorAll(`[${Rr}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},mo=(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})`))},yo=(e,t,n,i)=>{var r,o;vo(e,"totp-link",null===(r=null==t?void 0:t.totp)||void 0===r?void 0:r.provisionUrl),vo(e,"notp-link",null===(o=null==t?void 0:t.notp)||void 0===o?void 0:o.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{const n=(e=>Dr.includes(e))(e.localName);e.textContent=go(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",go(i,t))}))})(e,t),((e,t,n)=>{if(!t)return;const{componentsDynamicAttrs:i}=t,r=l(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,null==t?void 0:t.componentsConfig,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=go(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])=>{ho.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,n),((e,t={},n)=>{Object.entries(t).forEach((([t,i])=>{e.querySelectorAll(`[id="${CSS.escape(t)}"]`).forEach((e=>{switch(i){case"disable":e.setAttribute("disabled","true");break;case"hide":e.classList.add("hidden");break;default:null==n||n.error(`Unknown component state "${i}" for component with id "${t}"`,'Valid states are "disable" and "hide"')}}))}))})(e,null==t?void 0:t.componentsState,i)},bo=zr((()=>c(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 Jr(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}}))));let $o;const wo=(e,t)=>{$o?$o.setItem(e,t):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.setItem(e,t)},Co=e=>$o?$o.getItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)?window.localStorage.getItem(e):null,ko="dls_ab_testing_id",So={"lastAuth.loginId":{"not-empty":e=>{var t;return!!e.loginId||!!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)},empty:e=>{var t;return!e.loginId&&!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)}},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t,"greater-than-or-equal":(e,t)=>(e.abTestingKey||0)>=t,"less-than-or-equal":(e,t)=>(e.abTestingKey||0)<=t,"in-range":(e,t)=>{const[n,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 Io(e){const t={};try{Object.assign(t,JSON.parse(Co(fr)))}catch(e){}return(null==t?void 0:t.loginId)||e?t:{}}function xo(e,t){(null==e?void 0:e.authMethod)&&(t&&!(null==e?void 0:e.loginId)||wo(fr,JSON.stringify(e)))}const Ro=["error","warn","info","debug"],Oo={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},Eo=Si((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,u(this,t,"m",i).call(this,Oo))}set logger(e){h(this,n,u(this,t,"m",i).call(this,e||Oo),"f")}get logger(){return u(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return Ro.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})),Ao="undefined"!=typeof localStorage,No="https://static.descope.com/pages",jo="https://static2.descope.com/pages",Mo=Ao&&localStorage.getItem("base.content.url")||"",Po=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Uo=Si((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)&&u(this,t,"f")&&(h(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),To=Si((e=>{var t,n;const i=mi(Eo,Uo)(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=u(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){u(this,t,"f")[e]||(u(this,t,"f")[e]=[]);const i=u(this,t,"f")[e].push(n);return()=>u(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})),Wo=e=>t=>{var n,i,r;const o=mi(Eo,Uo,To)(t),s=Object.keys(e);return r=class extends o{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,u(this,n,"m",i).bind(this))}async init(){var e;s.forEach((e=>u(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};Wo.missingAttrValidator=Po;const Lo=Si((e=>{const t=mi(Wo({"project-id":Po}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Do=Si((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),_o="Trying the next fallback URL...",Fo=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)}};const qo=Si((e=>{var t,n,i,r,o,s,a;const d=mi(Eo,Lo,Do)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,new Set)}async fetchStaticResource(e,n){const s=u(this,t,"m",o).call(this,e),a=Array.isArray(s)?e=>{const{baseUrl:t}=s[e];h(this,i,t,"f");for(let t=0;t<e;t++){const e=s[t].baseUrl;u(this,r,"f").add(e)}}: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 Fo(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}. ${_o}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${_o}`)}}})(s,{cache:"default"},{logger:this.logger,onSuccess:a});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,r=new WeakMap,t=new WeakSet,o=function(e){const o=Mo||this.baseStaticUrl;if(o)return u(this,t,"m",s).call(this,e,o);u(this,n,"f")!==this.baseUrl&&(h(this,n,this.baseUrl,"f"),h(this,i,void 0,"f"),u(this,r,"f").clear());const a=[];if(u(this,i,"f"))a.push(u(this,t,"m",s).call(this,e,u(this,i,"f"))),u(this,i,"f")===No&&a.push(u(this,t,"m",s).call(this,e,jo));else{const n=this.baseUrl+"/pages";this.baseUrl&&!u(this,r,"f").has(n)&&a.push(u(this,t,"m",s).call(this,e,n)),u(this,r,"f").has(No)||a.push(u(this,t,"m",s).call(this,e,No)),a.push(u(this,t,"m",s).call(this,e,jo))}return 1===a.length?a[0]:a},s=function(e,t){return function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i=No}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}({projectId:this.projectId,filename:e,baseUrl:t})},a})),Bo=Si((e=>{var t,n;const i=mi(Wo({"project-id":Po}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(u(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return u(this,t,"f").set(e,n),()=>{u(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(u(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!u(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=u(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),Vo=Si((e=>{var t,n,i,r,o;const s=mi(qo,Bo,Uo)(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",u(this,t,"m",n).bind(this))}get config(){return u(this,i,"f")||h(this,i,u(this,r,"f").call(this),"f"),u(this,i,"f")}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){h(this,i,void 0,"f")},o})),Ko=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],Ho=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()}`},zo=(e,t,n)=>new Promise(((i,r)=>{const o=((e,t)=>{const n=document.createElement("script");return n.id=e,t&&(n.integrity=t,n.crossOrigin="anonymous"),window.DESCOPE_NONCE&&n.setAttribute("nonce",window.DESCOPE_NONCE),n})(e,n);o.onerror=e=>{o.setAttribute("status","error"),r(e)},o.onload=()=>{o.setAttribute("status","loaded"),i(o)},o.src=t.toString(),document.body.appendChild(o)})),Go=(e,t)=>{if(t){const n=e.integrity;if(n!==t)return Promise.reject(new Error(`Integrity mismatch: expected ${t}, found ${n}`))}return"loaded"===e.getAttribute("status")?Promise.resolve(e):(e=>"error"===e.getAttribute("status"))(e)?Promise.reject():new Promise(((t,n)=>{e.addEventListener("load",(()=>{t(e)})),e.addEventListener("error",(e=>{n(e)}))}))},Jo=Si((e=>{const t=mi(Eo)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(e,t,n="",i=[],r){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"${r?" with SRI integrity check":""}`),(async(e,t)=>{for(const i of e){const{id:e,url:r,integrity:o}=i,s=(n=e,document.querySelector(`script#${n}`));if(s)try{return await Go(s,o),i}catch(e){t(i,!0)}else try{return await zo(e,r,o),i}catch(e){t(i,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,i="",r)=>e.reduce(((e,o)=>{const s=o;if(!s)return e;let a;try{a=new URL(s)}catch(e){throw new Error(`Invalid URL: ${s}`)}"/"!==a.pathname||(a.pathname=`/npm/${t}@${n}/${i}`);const d={url:a,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${Ho(a)}`};return r&&(d.integrity=r),[...e,d]}),[]))([...i,this.baseCdnUrl,...Ko],e,t,n,r),((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}"`)}))}}})),Zo="base.ui.components.url",Yo=Ao&&localStorage.getItem(Zo),Xo=Si((e=>{var t,n,i,r,o,s,a;const d=mi(Eo,Vo,Jo)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),r.set(this,void 0)}get descopeUi(){return u(this,r,"f")||h(this,r,u(this,t,"m",s).call(this),"f"),u(this,r,"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=>u(this,t,"m",o).call(this,e))))}},r=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},i=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersionSri;return n&&this.logger.debug("SRI hash available for components"),n},o=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(", ")}"`)},s=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const e=await u(this,t,"m",n).call(this),r=await u(this,t,"m",i).call(this);return await this.injectNpmLib("@descope/web-components-ui",e,"dist/umd/index.js",[Yo],r),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},a})),Qo=Si((e=>{var t,n,i;const r=mi(Uo,To)(e);return i=class extends r{constructor(){super(...arguments),t.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.observeAttribute("nonce",u(this,t,"m",n).bind(this)),u(this,t,"m",n).call(this)}},t=new WeakSet,n=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},i}));class es{constructor(e,t,{prepend:n=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(n?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return null===(e=this.styleEle.sheet)||void 0===e?void 0:e.cssRules}}const ts=Si((e=>{const t=mi(Qo)(e);return class extends t{injectStyle(e,{prepend:t=!1}={}){let n;try{n=new CSSStyleSheet}catch(e){n=new es(this.shadowRoot,this.nonce,{prepend:t})}if(e&&n.replaceSync(e),n instanceof CSSStyleSheet){const e=this.shadowRoot;if(e&&"adoptedStyleSheets"in e){const i=[...e.adoptedStyleSheets||[]];i[t?"unshift":"push"](n),e.adoptedStyleSheets=i}}return n}}})),ns="content-root",is="root",rs=Si((e=>{const t=mi(ts)(e);return class extends t{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${is}">\n <div id="${ns}"></div>\n </div>\n `,this.injectStyle(`\n #${is}, #${ns} {\n height: 100%;\n }\n #${is} {\n position: relative;\n height: fit-content;\n }\n `),this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(ns),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(is)}}})),os="theme",ss=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',as=Si((e=>{var t,n,i,r,o,s,a,d,l,c,f,p,g,v;const m=mi(Wo({theme:ss}),qo,Uo,Xo,Vo,rs,To,ts)(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,(()=>{u(this,t,"m",p).call(this),u(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",(()=>u(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")||os}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),u(this,f,"f").call(this),await Promise.all([u(this,t,"m",s).call(this),u(this,t,"m",a).call(this)]),this.observeAttributes(["theme"],u(this,f,"f")),this.observeAttributes(["style-id"],(()=>{h(this,i,null,"f"),u(this,t,"m",l).call(this),u(this,t,"m",s).call(this),u(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(Zo)))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(Zo),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 u(this,i,"f")||(h(this,i,u(this,t,"m",r).call(this),"f"),u(this,i,"f").then((e=>this.logger.debug("Fetched theme",e)))),u(this,i,"f")},s=async function(){var e,i;const r=await u(this,t,"a",o);r&&(u(this,n,"f")||h(this,n,this.injectStyle(""),"f"),u(this,n,"f").replaceSync(((null===(e=null==r?void 0:r.light)||void 0===e?void 0:e.globals)||"")+((null===(i=null==r?void 0:r.dark)||void 0===i?void 0:i.globals)||"")))},a=async function(){var e,n;const i=await u(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 u(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")},c=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(){u(this,t,"m",l).call(this),u(this,t,"m",c).call(this)},v})),ds=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if(Array.isArray(e[i]))return Object.assign(Object.assign({},n),{[i]:{value:e[i].map((e=>"object"==typeof e&&null!==e?ds(e):e))}});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),ds(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}),[]),ls=Si((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;u(this,t,"m",n).call(this)&&u(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 cs,us,hs,fs,ps,gs,vs,ms,ys,bs,$s,ws,Cs,ks,Ss,Is,xs,Rs,Os,Es,As,Ns;const js=mi(as,qo,ls,ts)(HTMLElement);let Ms=class extends js{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id"]}constructor(e){super(),cs.add(this),hs.set(this,!1),fs.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),u(this,cs,"m",Ns).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)}},ps.set(this,new lo),gs.set(this,new lo),vs.set(this,{}),this.getComponentsContext=()=>u(this,vs,"f"),this.nextRequestStatus=new lo({isLoading:!1}),ms.set(this,void 0),ys.set(this,{popstate:u(this,cs,"m",ks).bind(this),componentsContext:u(this,cs,"m",Os).bind(this)}),bs.set(this,void 0),this.getConfig=()=>c(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),h(this,bs,e,"f"),u(this,cs,"m",ws).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 ds(JSON.parse(e))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return((e,t)=>Object.fromEntries(Object.entries(e).map((([e,n])=>[e,n[t]]))))(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{return JSON.parse(this.getAttribute("outbound-app-scopes"))||null}catch(e){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return u(this,fs,"f")}set customStorage(e){if(e&&"function"!=typeof e.getItem)throw new Error("Custom storage must have a getItem method");if(e&&"function"!=typeof e.setItem)throw new Error("Custom storage must have a setItem method");if(e&&"function"!=typeof e.removeItem)throw new Error("Custom storage must have a removeItem method");h(this,fs,e,"f"),(e=>{$o=e})(e)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return c(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return c(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return c(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 c(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Tr.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()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return c(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 c(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),u(this,gs,"f").subscribe(u(this,cs,"m",As).bind(this)),u(this,gs,"f").update({isDebug:this.debug}),u(this,cs,"m",Cs).call(this),yield u(this,cs,"m",xs).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const n=yield this.getConfig();if("isMissingConfig"in n&&n.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:i,stepId:r,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:g}=Hr(this.flowId,this.loggerWrapper);window.addEventListener("popstate",u(this,ys,"f").popstate),window.addEventListener("components-context",u(this,ys,"f").componentsContext),u(this,ps,"f").subscribe(u(this,cs,"m",Is).bind(this)),u(this,ps,"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,isPopup:a,exchangeError:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},g)),h(this,hs,!0,"f")}))}disconnectedCallback(){u(this,ps,"f").unsubscribeAll(),u(this,gs,"f").unsubscribeAll(),u(this,cs,"m",Es).call(this),window.removeEventListener("popstate",u(this,ys,"f").popstate),window.removeEventListener("components-context",u(this,ys,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&u(this,hs,"f")&&t!==n&&us.observedAttributes.includes(e)){u(this,cs,"m",Cs).call(this);const i=null===t;u(this,ps,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,Vr()),{[Kr(e)]:n,stepId:o,executionId:s}})),u(this,gs,"f").update({isDebug:this.debug})}}};var Ps,Us,Ts,Ws,Ls,Ds,_s,Fs,qs,Bs,Vs,Ks,Hs,zs,Gs,Js,Zs,Ys,Xs,Qs,ea,ta,na,ia,ra,oa,sa,aa,da,la,ca,ua,ha,fa,pa,ga,va,ma;us=Ms,hs=new WeakMap,fs=new WeakMap,ps=new WeakMap,gs=new WeakMap,vs=new WeakMap,ms=new WeakMap,ys=new WeakMap,bs=new WeakMap,cs=new WeakSet,$s=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},ws=function(){u(this,cs,"m",$s).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},Cs=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","outbound-app-id","outbound-app-scopes"];us.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Kr(t)])throw Error(`${t} cannot be empty`)}))},ks=function(){const{stepId:e,executionId:t}=Br(this.flowId);u(this,ps,"f").update({stepId:e,executionId:t})},Ss=function(e,t){di&&"function"==typeof di||this.logger.error("SDK was not loaded properly",di,JSON.stringify(di));const n=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},us.sdkConfigOverrides),{projectId:e,baseUrl:t});u(this,fs,"f")&&(n.customStorage=u(this,fs,"f")),this.sdk=di(n),["start","next"].forEach((e=>{const t=function(e,t,n){return(...i)=>c(this,void 0,void 0,(function*(){let r;const o=n+1;for(let s=0;s<o;s++)try{return yield e(...i)}catch(e){r=e,s<n&&(yield new Promise((e=>{setTimeout(e,t*Math.pow(2,s+1))})))}throw r}))}(this.sdk.flow[e],1e3,3);this.sdk.flow[e]=(...n)=>c(this,void 0,void 0,(function*(){try{return yield t(...n)}catch(t){return this.logger.error(`Error in sdk flow ${e} function`,t),{error:{errorCode:ir,errorDescription:t.toString()}}}}))}))},Is=function(e,t,n){return c(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;u(this,cs,"m",Ss).call(this,t,i)}u(this,bs,"f").call(this,e)}))},xs=function(){return c(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield u(this,cs,"m",Rs).call(this))}))},Rs=function(){return c(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(or||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 c(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}}))},Os=function(e){h(this,vs,Object.assign(Object.assign({},u(this,vs,"f")),e.detail),"f")},Es=function(){var e;null===(e=u(this,ms,"f"))||void 0===e||e.remove(),h(this,ms,null,"f")},As=function(e){return c(this,arguments,void 0,(function*({isDebug:e}){e?(h(this,ms,document.createElement("descope-debugger"),"f"),Object.assign(u(this,ms,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return Gw})),document.body.appendChild(u(this,ms,"f"))):u(this,cs,"m",Es).call(this)}))},Ns=function(e,t){var n;e&&this.debug&&(null===(n=u(this,ms,"f"))||void 0===n||n.updateData({title:e,description:t}))},Ms.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.60.0"}};let ya=class extends Ms{static set sdkConfigOverrides(e){Ms.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Ms.sdkConfigOverrides}constructor(){const e=new lo({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),Ps.add(this),this.stepState=new lo({}),Us.set(this,void 0),Ts.set(this,null),Ws.set(this,null),Ls.set(this,{visibilitychange:u(this,Ps,"m",Ds).bind(this)}),this.bridgeVersion=2,this.nativeCallbacks={},zs.set(this,!1),this.handleRedirect=e=>{window.location.assign(e)},Js.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()?u(this,Ps,"m",Zs).call(this,t):t()})),Ys.set(this,((e,t,n,i,r=!1)=>{const o=[rr,"E103202"];if(this.flowState.current.action===Er){if(u(this,Qs,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const s=Date.now(),a=r?500:2e3;h(this,Us,setTimeout((()=>c(this,void 0,void 0,(function*(){var d,l;this.logger.debug("polling - Calling next");const c=this.sdk.flow.next(e,t,Ur,n,i,{}),h=document.hidden&&!r&&Date.now()-s>a+500;let f;h&&this.logger.debug("polling - The polling seems to be throttled");try{const e=h?1e3:6e3;f=yield Jr(e,c)}catch(d){return this.logger.warn(`polling - The ${h?"throttled fetch":"fetch"} call timed out or was aborted`),void u(this,Ys,"f").call(this,e,t,n,i,h)}if((null===(d=null==f?void 0:f.error)||void 0===d?void 0:d.errorCode)===ir)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void u(this,Ys,"f").call(this,e,t,n,i);this.logger.debug("polling - Got a response"),(null==f?void 0:f.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),(null===(l=null==f?void 0:f.error)||void 0===l?void 0:l.errorCode)&&o.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):u(this,Ys,"f").call(this,e,t,n,i),u(this,ea,"f").call(this,f)}))),a),"f")}})),Xs.set(this,(()=>{clearTimeout(u(this,Us,"f")),h(this,Us,null,"f")})),Qs.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),ea.set(this,(e=>{var t,n,i,r,o,s,a,d,l,c,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}`;u(this,Ps,"m",va).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&&l!==rr||!this.isRestartOnError||u(this,Ps,"m",Hs).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===(c=null===(l=e.data)||void 0===l?void 0:l.screen)||void 0===c?void 0:c.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:b,action:$,openInNewTabUrl:w}=e.data;if($!==Er&&u(this,Xs,"f").call(this),"completed"===m){this.storeLastAuthenticatedUser&&xo(b);const t=Object.assign({},y);return e.data.output&&Object.keys(e.data.output).length>0&&(t.flowOutput=e.data.output),void u(this,Ps,"m",va).call(this,"success",t)}this.storeLastAuthenticatedUser&&xo(b,!0),w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:I,redirect:x,webauthn:R,error:O,samlIdpResponse:E,wsFedIdpResponse:A,nativeResponse:N}=e.data,j=Date.now();$!==Er?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:I,status:m,stepId:k,stepName:S,action:$,error:O}),(null===(g=I.state)||void 0===g?void 0:g.clientScripts)&&h(this,Ws,this.loadSdkScripts(I.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:$,redirectTo:null==x?void 0:x.url,redirectIsPopup:null==x?void 0:x.isPopup,screenId:null==I?void 0:I.id,screenState:null==I?void 0:I.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,wsFedIdpResponseUrl:null==A?void 0:A.url,wsFedIdpResponseWresult:null==A?void 0:A.wresult,wsFedIdpResponseWctx:null==A?void 0:A.wctx,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:j})):this.flowState.update({action:$,reqTimestamp:j})})),ta.set(this,zr((()=>c(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)}}))))),aa.set(this,null),ha.set(this,Qr(((e,t)=>c(this,void 0,void 0,(function*(){var n;if("true"===e.getAttribute("formnovalidate")||u(this,Ps,"m",oa).call(this)){const i=null==e?void 0:e.getAttribute("id");u(this,Ps,"m",da).call(this,e);const r=yield u(this,Ps,"m",sa).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);this.nextRequestStatus.update({isLoading:!0});const s=Object.assign(Object.assign(Object.assign({},o),r),{origin:(null===(n=this.nativeOptions)||void 0===n?void 0:n.origin)||window.location.origin});yield t(i,s),this.nextRequestStatus.update({isLoading:!1}),u(this,Ps,"m",la).call(this,r)}}))))),this.flowState=e}nativeResume(e,t){var n,i,r,o,s,a;const d=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let e,{exchangeCode:t}=d;if(!t){const r=new URL(d.url);t=null===(n=r.searchParams)||void 0===n?void 0:n.get(dr),e=(null===(i=r.searchParams)||void 0===i?void 0:i.get(cr))||void 0}null===(o=(r=this.nativeCallbacks).complete)||void 0===o||o.call(r,{exchangeCode:t,exchangeError:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(d.url),t=e.searchParams.get("t"),n=e.searchParams.get(ar).split("_").pop();u(this,Xs,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const{screenResolve:e}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:t}=d;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=d,{screenNext:n}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(a=(s=this.nativeCallbacks).complete)||void 0===a||a.call(s,d)}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:{[no(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=>c(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.14",`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,ref:this},t(e,n),this.loggerWrapper);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 c(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)),u(this,Ps,"m",Vs).call(this),window.addEventListener("visibilitychange",u(this,Ls,"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(),u(this,Xs,"f").call(this),null===(e=u(this,Ts,"f"))||void 0===e||e.abort(),h(this,Ts,null,"f"),window.removeEventListener("visibilitychange",u(this,Ls,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return c(this,void 0,void 0,(function*(){let n;const i=eo(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 c(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 c(this,void 0,void 0,(function*(){var i,r;const{projectId:o,flowId:s,tenant:a,stepId:d,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectIsPopup:y,redirectUrl:b,token:$,code:w,isPopup:C,exchangeError:k,webauthnTransactionId:S,webauthnOptions:I,redirectAuthCodeChallenge:x,redirectAuthCallbackUrl:R,redirectAuthBackupCallbackUri:O,redirectAuthInitiator:E,locale:A,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:j,samlIdpResponseRelayState:M,wsFedIdpResponseUrl:P,wsFedIdpResponseWresult:U,wsFedIdpResponseWctx:T,nativeResponseType:W,nativePayload:L,reqTimestamp:D}=e,_=l(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx","nativeResponseType","nativePayload","reqTimestamp"]);let F,q,B;const V=(()=>{const e=Co(ko);if(!e){const e=Math.floor(100*Math.random()+1);return wo(ko,e.toString()),e}return Number(e)})(),{outboundAppId:K}=this,{outboundAppScopes:H}=this,z=this.sdk.getLastUserLoginId(),G=yield this.getFlowConfig(),J=yield this.getProjectConfig(),Z=Object.entries(J.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),Y=R&&x?{callbackUrl:R,codeChallenge:x,backupCallbackUri:O}:void 0,X=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect,externalAuthRedirect:this.nativeOptions.externalAuthRedirect}:void 0;let Q={};if(!f){const e=[...G.clientScripts||[],...G.sdkScripts||[]];if(G.conditions){let t=[];({startScreenId:F,conditionInteractionId:B,startScreenName:q,clientScripts:t,componentsConfig:Q}=((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=So[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:z,code:w,token:$,abTestingKey:V,lastAuth:Io(z)},G.conditions)),e.push(...t||[])}else G.condition?({startScreenId:F,conditionInteractionId:B}=((e,t)=>{var n;const i=null===(n=So[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}})(G.condition,{loginId:z,code:w,token:$,abTestingKey:V,lastAuth:Io(z)})):(q=G.startScreenName,F=G.startScreenId);if(h(this,Ws,this.loadSdkScripts(e),"f"),G.fingerprintEnabled&&G.fingerprintKey?yield On(G.fingerprintKey,this.baseUrl):sn(xn),!Zr(F,_)){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:Y},_),{client:this.client}),b&&{redirectUrl:b}),{lastAuth:Io(z),abTestingKey:V,locale:eo(A).locale,nativeOptions:X,outboundAppId:K,outboundAppScopes:H}),B,"",J.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),w?{exchangeCode:w,idpInitiated:!0}:{}),_.descopeIdpInitiated&&{idpInitiated:!0}),$?{token:$}:{}),_.oidcLoginHint?{externalId:_.oidcLoginHint}:{}));return u(this,ea,"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(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:C,code:w,exchangeError:k,isCodeChanged:n("code"),isExchangeErrorChanged:n("exchangeError")})),C&&(n("code")&&w||n("exchangeError")&&k))return void u(this,Ps,"m",ma).call(this,f,w,k);if(f&&(n("token")&&$||n("code")&&w||n("exchangeError")&&k)){const e=yield this.sdk.flow.next(f,d,Pr,G.version,J.componentsVersion,{token:$,exchangeCode:w,exchangeError:k});return u(this,ea,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Mr&&N&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!j)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)})(N,j,M||"",Yr)}if(p===Mr&&P&&["wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx"].some((e=>n(e)))){if(!U)return void this.loggerWrapper.error("Did not get wsfed idp params data to load");((e,t,n,i)=>{const r=document.createElement("form");r.method="POST",r.action=e;const o=(e,t)=>{const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n};r.appendChild(o("wa","wsignin1.0")),r.appendChild(o("wresult",t)),r.appendChild(o("wctx",n));const s=document.createElement("input");s.type="submit",s.id="WSFedSubmitButton",s.value="Continue",s.style.display="none",r.appendChild(s),document.body.appendChild(r),i(r)})(P,U,T||"",Yr)}if(p===Or&&(n("redirectTo")||n("deferredRedirect"))){if(!m)return void this.loggerWrapper.error("Did not get redirect url");if("no-op"===m)return;if("android"===E&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${y}`),y){this.loggerWrapper.debug("Opening redirect in popup");const e=((e,t,n,i)=>{const r=void 0!==window.screenLeft?window.screenLeft:window.screen.left,o=void 0!==window.screenTop?window.screenTop:window.screen.top,s=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-n)/2+r,a=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-i)/2+o,d=function(){const e=navigator.userAgent||"",t=/\b(iPhone)\b/.test(e),n=/Safari/.test(e)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(e);return t&&n}()?"about:blank":"",l=window.open(d,t,`width=${n},height=${i},top=${a},left=${s},scrollbars=yes,resizable=yes`);return l.location.href=e,l.focus(),l})(m,"?",598,700),t=this.shouldUsePopupPostMessage();t&&(e.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(t?"postMessage":"BroadcastChannel"));const n=e=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(e.data));const n=t?this.popupOrigin:window.location.origin;if(e.origin!==n)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${e.origin}", expected: "${n}"`);const{action:i,data:r}=e.data||{};"code"===i&&this.flowState.update({code:r.code,exchangeError:r.exchangeError})};let i;this.loggerWrapper.debug("Starting popup closed detection");const r=setInterval((()=>{e.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(r),u(this,Ps,"m",va).call(this,"popupclosed",{}),this.loggerWrapper.debug("Cleaning up popup listeners"),null==i||i())}),1e3);if(t)window.addEventListener("message",n),i=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",n)};else{this.loggerWrapper.debug("Creating broadcast channel");const e=new BroadcastChannel(f);e.onmessage=n,i=()=>{this.loggerWrapper.debug("Closing channel"),e.close()}}}else this.handleRedirect(m),this.flowState.update({redirectTo:"no-op"}),u(this,Ps,"m",va).call(this,"popupclosed",{});return}if(p===Ar||p===Nr){if(!S||!I)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=u(this,Ts,"f"))||void 0===r||r.abort(),h(this,Ts,null,"f");try{e=p===Ar?yield this.sdk.webauthn.helpers.create(I):yield this.sdk.webauthn.helpers.get(I)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name}const n=yield this.sdk.flow.next(f,d,Pr,G.version,J.componentsVersion,{transactionId:S,response:e,failure:t});u(this,ea,"f").call(this,n)}if(p===jr)return this.nativeCallbacks.complete=e=>c(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,d,Pr,G.version,J.componentsVersion,e);u(this,ea,"f").call(this,t)})),u(this,Ps,"m",qs).call(this,W,L),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((n("action")||n("deferredPolling"))&&u(this,Ys,"f").call(this,f,d,G.version,J.componentsVersion),!g&&!F)return void this.loggerWrapper.warn("No screen was found to show");const ee=F||g,te=yield this.getHtmlFilenameWithLocale(A,ee),{oidcLoginHint:ne,oidcPrompt:ie,oidcErrorRedirectUri:re,oidcResource:oe,samlIdpUsername:se}=_,ae={direction:qr(d,t.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:z,name:this.sdk.getLastUserDisplayName()||z},componentsConfig:Object.assign(Object.assign(Object.assign({},G.componentsConfig),Q),null==v?void 0:v.componentsConfig)}),htmlFilename:`${ee}.html`,htmlLocaleFilename:te,screenId:ee,stepName:e.stepName||q,samlIdpUsername:se,oidcLoginHint:ne,oidcPrompt:ie,oidcErrorRedirectUri:re,oidcResource:oe,action:p,locale:eo(A).locale},de=Io(z);Zr(F,_)?ae.next=(e,t)=>c(this,void 0,void 0,(function*(){const n=(null==G?void 0:G.clientScripts)||[];yield u(this,Ps,"m",fa).call(this,n);const i=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:Y},_),{lastAuth:de,preview:this.preview,abTestingKey:V,client:this.client}),b&&{redirectUrl:b}),{locale:eo(A).locale,nativeOptions:X,outboundAppId:K,outboundAppScopes:H}),B,e,J.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),to(t)),w&&{exchangeCode:w,idpInitiated:!0}),_.descopeIdpInitiated&&{idpInitiated:!0}),$&&{token:$}),ae.next.isCustomScreen);return u(this,ea,"f").call(this,i),i})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(ae.next=(e,t)=>c(this,void 0,void 0,(function*(){const n=(null==v?void 0:v.clientScripts)||[];yield u(this,Ps,"m",fa).call(this,n);const i=yield this.sdk.flow.next(f,d,e,G.version,J.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),to(t)),ae.next.isCustomScreen);return u(this,ea,"f").call(this,i),i}))),this.loggerWrapper.debug("Got a screen with id",ae.screenId),yield u(this,Ps,"m",Gs).call(this,ae),this.stepState.update(ae)}))}onStepChange(e,t){return c(this,void 0,void 0,(function*(){var n,i,r;const{htmlFilename:o,htmlLocaleFilename:s,direction:a,next:d,screenState:l}=e;this.loggerWrapper.debug("Rendering a flow screen");const h=document.createElement("template");h.innerHTML=yield this.getPageContent(o,s);const f=h.content.cloneNode(!0),p=this.loadDescopeUiComponents(h);this.sdk.webauthn.helpers.isSupported()?yield u(this,Ps,"m",ia).call(this,f,d):(e=>{e.querySelectorAll(`descope-button[${Rr}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(f),!e.samlIdpUsername||(null===(n=l.form)||void 0===n?void 0:n.loginId)||(null===(i=l.form)||void 0===i?void 0:i.email)||(l.form||(l.form={}),l.form.loginId=e.samlIdpUsername,l.form.email=e.samlIdpUsername),yo(f,l,this.formConfig,this.loggerWrapper);const{geo:g}=null!==(r=yield this.getExecutionContext())&&void 0!==r?r:{};((e,t)=>{Object.entries({"default-code":"autoDetect","default-country":"autoDetect"}).forEach((([n,i])=>{Array.from(e.querySelectorAll(`[${n}="${i}"]`)).forEach((e=>{e.setAttribute(n,t||i)}))}))})(f,g),((e,t)=>{let n=t;if(t)try{const[e]=Intl.getCanonicalLocales(t);e&&(n=e)}catch(e){}Object.entries({lang:"autoDetect"}).forEach((([t,i])=>{Array.from(e.querySelectorAll(`[${t}="${i}"]`)).forEach((e=>{e.setAttribute(t,n||i)}))}))})(f,e.locale);const v=()=>c(this,void 0,void 0,(function*(){var n,i;yield p;const r=this.contentRootElement;((e,t)=>{mo(e,"descope-totp-image",t)})(r,null===(n=null==l?void 0:l.totp)||void 0===n?void 0:n.image),((e,t)=>{mo(e,"descope-notp-image",t)})(r,null===(i=null==l?void 0:l.notp)||void 0===i?void 0:i.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{if(!t.querySelector(r))return void 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.debug(`Could not find component class for ${r}`,"Check if the component is registered")}))})(r,f,l.cssVars,this.loggerWrapper),r.replaceChildren(f);const o=!t.htmlFilename;setTimeout((()=>{u(this,Ps,"m",ca).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)=>{fo(e,null==t?void 0:t.inputs),fo(e,null==t?void 0:t.form)})(r,l),u(this,Ps,"m",ra).call(this,{isFirstScreen:o,isCustomScreen:!1,stepName:e.stepName}),Gr(r,this.autoFocus,o)})),u(this,Ps,"m",ga).call(this,d),r.querySelector(`[${Rr}="polling"]`)&&d(Ur,{})}));a?u(this,Ps,"m",Zs).call(this,v):v()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${ur}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch(e){return!1}return!0}};Us=new WeakMap,Ts=new WeakMap,Ws=new WeakMap,Ls=new WeakMap,zs=new WeakMap,Js=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,Qs=new WeakMap,ea=new WeakMap,ta=new WeakMap,aa=new WeakMap,ha=new WeakMap,Ps=new WeakSet,Ds=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},_s=function(e,t,n){return c(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,u(this,Ps,"m",qs).call(this,"beforeScreen",{screen:e,context:t})}))}))},Fs=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&u(this,Ps,"m",qs).call(this,"afterScreen",{screen:e})},qs=function(e,t){u(this,Ps,"m",va).call(this,"bridge",{type:e,payload:t})},Bs=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(`[${Rr}="${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()},Vs=function(){var e,t,n;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var t=e.screenState,n=l(void 0===t?{}:t,["errorText","errorType"]),i=l(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:n})})),null===(t=this.stepState)||void 0===t||t.subscribe(u(this,Ps,"m",Bs).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}),{forceUpdate:!0}),null===(n=this.stepState)||void 0===n||n.subscribe(u(this,Ps,"m",Ks).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})},Ks=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=""}))})),Gr(this.contentRootElement,this.autoFocus,!1))},Hs=function(){return c(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")}))},Gs=function(e){return c(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=>{var t,n,i;const r=(o=e.screenState,s=(e,t)=>Wr.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(o).filter((([e,t])=>!s(0,e)))));var o,s;const{screenState:{errorText:a,errorType:d}}=e;return(a||d)&&(r.error={text:a,type:d}),e.action&&(r.action=e.action),(null===(i=null===(n=null===(t=e.screenState)||void 0===t?void 0:t.componentsConfig)||void 0===n?void 0:n.thirdPartyAppApproveScopes)||void 0===i?void 0:i.data)&&(r.inboundAppApproveScopes=e.screenState.componentsConfig.thirdPartyAppApproveScopes.data),r})(l(n,["next","stepName"]));let s=yield u(this,Ps,"m",_s).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(u(this,Js,"f").call(this,s),i&&(i.isCustomScreen=s),u(this,zs,"f")!==s){const[e,t]=["flow","custom"].sort((()=>s?-1:1));this.loggerWrapper.debug(`Switching from ${t} screen to ${e} screen`),h(this,zs,s,"f"),s?this.stepState.unsubscribeAll():u(this,Ps,"m",Vs).call(this)}s?(this.loggerWrapper.debug("Showing a custom screen"),u(this,Ps,"m",ra).call(this,{isFirstScreen:a,isCustomScreen:s,stepName:e.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=s}))},Zs=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")},na=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)}))}},ia=function(e,t){return c(this,void 0,void 0,(function*(){var n;null===(n=u(this,Ts,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield bo())){const{options:e,transactionId:n}=(yield u(this,ta,"f").call(this))||{};e&&n&&(u(this,Ps,"m",na).call(this,i),h(this,Ts,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,u(this,Ts,"f")).then((e=>c(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)})))}}))},ra=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&u(this,Ps,"m",va).call(this,"ready",{}),t||u(this,Ps,"m",Fs).call(this,n),u(this,Ps,"m",va).call(this,"page-updated",{screenName:n}),u(this,Ps,"m",va).call(this,"screen-updated",{screenName:n})},oa=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,i;"slot"===t.localName||t.classList.contains("hidden")||(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},sa=function(){return c(this,void 0,void 0,(function*(){const e=this.getInputs();return(yield Promise.all(e.map((e=>c(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})),{})}))},da=function(e){const t=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((t=>t!==e)),n=()=>c(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",n),e.removeAttribute("loading"),t.forEach((e=>{e.removeAttribute("disabled")}));const i=yield this.getFlowConfig(),r=[...i.clientScripts||[],...i.sdkScripts||[]];this.loadSdkScripts(r)})),i=()=>{var e;window.removeEventListener("pageshow",u(this,aa,"f")),h(this,aa,(e=>{e.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),n())}),"f"),window.addEventListener("pageshow",u(this,aa,"f"),{once:!0});const t=null===(e=this.stepState)||void 0===e?void 0:e.subscribe(((e,i)=>{e===i&&n(),this.removeEventListener("popupclosed",n),this.stepState.unsubscribe(t)}),(e=>e.screenId),{forceUpdate:!0})},r=this.nextRequestStatus.subscribe((({isLoading:o})=>{o?(this.addEventListener("popupclosed",n,{once:!0}),e.setAttribute("loading","true"),t.forEach((e=>e.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(r),i())}))},la=function(e={}){var t,n;const i=Xr(e,["externalId","email","phone"]),r=Xr(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)}},ca=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>u(this,Ps,"m",ua).call(this,e)))},ua=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)}))},fa=function(e){return c(this,void 0,void 0,(function*(){if(u(this,Ws,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield u(this,Ws,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const t=this.loadSdkScriptsModules(),n=e.map((e=>e.id));for(const e of t)if(n.includes(e.id))try{"function"==typeof e.present&&((yield e.present())||this.loggerWrapper.debug(`Sdk script ${e.id} was cancelled`))}catch(t){this.loggerWrapper.error(`Failed to present ${e.id} script module`,t.message)}const i=[];for(const e of t)"function"==typeof e.refresh&&i.push(e.refresh());if(i.length>0)try{yield Jr(5e3,Promise.all(i),null)}catch(e){this.loggerWrapper.error("Failed to refresh script module",e.message)}}))},pa=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))&&u(this,ha,"f").call(this,t,e)}))}))},ga=function(e){this.contentRootElement.querySelectorAll(`descope-button:not([${hr}]), [data-type="button"]:not([${hr}]`).forEach((t=>{t.onclick=()=>{u(this,ha,"f").call(this,t,e)}})),u(this,Ps,"m",pa).call(this,e),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${ur}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},va=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},ma=function(e,t,n){var i;const[r,o]=(null===(i=window.name)||void 0===i?void 0:i.split("|"))||[],s={data:{code:t,exchangeError:n},action:"code"};if("descope-wc"===r&&o){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",o);try{window.opener.postMessage(s,o)}catch(e){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",null==e?void 0:e.message)}}else{this.loggerWrapper.debug("Creating popup channel",e);const t=new BroadcastChannel(e);t.postMessage(s),t.close()}try{window.close()}catch(e){}},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",ya);var ba=Object.freeze({__proto__:null,default:ya});const $a=Si((e=>{var t,n,i,r,o,s,a;return a=class extends(mi(Uo,Eo)(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&&u(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&&u(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)),u(this,t,"m",o).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=u(this,n,"f"))||void 0===e||e.remove(),h(this,n,null,"f")},r=async function(){h(this,n,document.createElement("descope-debugger"),"f"),Object.assign(u(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return lC})),document.body.appendChild(u(this,n,"f"))},o=function(){this.debug?u(this,t,"m",r).call(this):u(this,t,"m",i).call(this)},s=function(e,t){var i;e&&(null===(i=u(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},a})),wa="descope-modal";var Ca,ka;class Sa{constructor(e,t){Ca.set(this,void 0),this.nodeName="",h(this,Ca,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)})))(u(this,Ca,"f"))}get ele(){var e,t;const n="function"==typeof u(this,Ca,"f")?u(this,Ca,"f").call(this):u(this,Ca,"f");return n?(null==n?void 0:n.localName)!==this.nodeName?(null===(t=this.logger)||void 0===t||t.debug(`node name do not match, expected "${this.nodeName}", received "${n.localName}" `,Error()),null):n:(null===(e=this.logger)||void 0===e||e.debug(`Driver element is not available for ${this.nodeName}`,new Error),null)}get isExists(){return!!this.ele}}Ca=new WeakMap;class Ia extends Sa{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}}let xa=class extends Sa{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)}}},Ra=class extends Sa{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")}},Oa=class extends Sa{constructor(){super(...arguments),this.nodeName="descope-wc"}set projectId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("project-id",e)}set baseUrl(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("base-url",e)}set flowId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("flow-id",e)}set theme(e){var t,n;e?null===(n=this.ele)||void 0===n||n.setAttribute("theme",e):null===(t=this.ele)||void 0===t||t.removeAttribute("theme")}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}onPageUpdated(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("page-updated",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("page-updated",e)}}};class Ea extends Ra{get flowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id"))||""}get enableMode(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("enable-mode")}}const Aa=/^descope-grid-([^-]+)-column$/,Na={text:class extends Sa{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 Sa{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 ja=class extends Sa{constructor(){super(...arguments),this.nodeName="descope-grid",ka.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=Aa.exec(t.localName))||void 0===n?void 0:n[1],r=Na[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);i&&this.ele.columns&&(bi(i,this.ele.columns)||(this.ele.columns=i,null===(n=u(this,ka,"f"))||void 0===n||n.call(this,i)))}onColumnsChange(e){h(this,ka,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};ka=new WeakMap;let Ma=class extends Sa{constructor(){super(...arguments),this.nodeName="descope-link"}get ele(){return super.ele}get href(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("href")}set href(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("href",null!=e?e:"")}};var Pa;let Ua=class extends Sa{constructor(){super(...arguments),Pa.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=""),u(this,Pa,"f")&&(null===(e=this.ele)||void 0===e||e.append(u(this,Pa,"f").content.cloneNode(!0)))}setContent(e){h(this,Pa,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}};Pa=new WeakMap;let Ta=class extends Sa{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()))}},Wa=class extends Sa{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()}},La=class extends Sa{constructor(){super(...arguments),this.nodeName="descope-outbound-apps"}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}get connectFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("connect-flow-id"))||""}get disconnectFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("disconnect-flow-id"))||""}onConnectClick(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("connect-clicked",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("connect-clicked",n)}}onDisconnectClick(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("disconnect-clicked",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("disconnect-clicked",n)}}},Da=class extends Sa{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()))}setAllowCustomValue(e){this.ele&&this.ele.toggleAttribute("allow-custom-value",e)}},_a=class extends Sa{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)}},Fa=class extends Sa{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")}},qa=class extends Sa{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)}}},Ba=class extends Sa{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")}onUnfulfilledButtonClick(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)}}onFulfilledButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("fulfilled-button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("fulfilled-button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}get fulfilledFlowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("fulfilled-flow-id")}},Va=class extends Sa{constructor(){super(...arguments),this.nodeName="descope-trusted-devices"}set displayName(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("display-name",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 flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}onRemoveDeviceClick(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("remove-device-clicked",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("remove-device-clicked",n)}}},Ka=class extends Da{get action(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data-action"))||""}get refreshTimeout(){var e;return Number(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data-refresh-timeout"))||500}get shouldReload(){return"reload"===this.action}};const Ha=Si((e=>{var t,n;const i=mi(Uo,rs,Xo)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Ua{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(wa);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(u(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([wa]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),za="descope-notification",Ga=Si((e=>{var t,n;const i=mi(Uo,rs,Xo)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Wa{setContent(t){const n="string"==typeof t?yi(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(za);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(u(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([za])}},t=new WeakMap,n}));function Ja(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 Za=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Ya=()=>Math.random().toString(36).substring(7).split("").join("."),Xa={INIT:`@@redux/INIT${Ya()}`,REPLACE:`@@redux/REPLACE${Ya()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ya()}`};function Qa(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 ed(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 td(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=ed(e)),t}function nd(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ja(2):`Expected the root reducer to be a function. Instead, received: '${td(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Ja(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?Ja(1):`Expected the enhancer to be a function. Instead, received: '${td(n)}'`);return n(nd)(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?Ja(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?Ja(4):`Expected the listener to be a function. Instead, received: '${td(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Ja(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?Ja(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(!Qa(e))throw new Error("production"===process.env.NODE_ENV?Ja(7):`Actions must be plain objects. Instead, the actual type was: '${td(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?Ja(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?Ja(17):`Action "type" property must be a string. Instead, the actual type was: '${td(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Ja(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:Xa.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ja(10):`Expected the nextReducer to be a function. Instead, received: '${td(e)}`);i=e,h({type:Xa.REPLACE})},[Za]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Ja(11):`Expected the observer to be an object. Instead, received: '${td(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Za](){return this}}}}}function id(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function rd(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]&&id(`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:Xa.INIT}))throw new Error("production"===process.env.NODE_ENV?Ja(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:Xa.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Ja(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Xa.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===Xa.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(!Qa(e))return`The ${o} has unexpected type of "${td(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===Xa.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&&id(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?Ja(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 od(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function sd(e){return Qa(e)&&"type"in e&&"string"==typeof e.type}var ad=Symbol.for("immer-nothing"),dd=Symbol.for("immer-draftable"),ld=Symbol.for("immer-state"),cd="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 ud(e,...t){if("production"!==process.env.NODE_ENV){const n=cd[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 hd=Object.getPrototypeOf;function fd(e){return!!e&&!!e[ld]}function pd(e){return!!e&&(vd(e)||Array.isArray(e)||!!e[dd]||!!e.constructor?.[dd]||wd(e)||Cd(e))}var gd=Object.prototype.constructor.toString();function vd(e){if(!e||"object"!=typeof e)return!1;const t=hd(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)===gd}function md(e,t){0===yd(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function yd(e){const t=e[ld];return t?t.type_:Array.isArray(e)?1:wd(e)?2:Cd(e)?3:0}function bd(e,t){return 2===yd(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $d(e,t,n){const i=yd(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function wd(e){return e instanceof Map}function Cd(e){return e instanceof Set}function kd(e){return e.copy_||e.base_}function Sd(e,t){if(wd(e))return new Map(e);if(Cd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&vd(e)){if(!hd(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ld];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(hd(e),n)}function Id(e,t=!1){return Rd(e)||fd(e)||!pd(e)||(yd(e)>1&&(e.set=e.add=e.clear=e.delete=xd),Object.freeze(e),t&&md(e,((e,t)=>Id(t,!0)))),e}function xd(){ud(2)}function Rd(e){return Object.isFrozen(e)}var Od,Ed={};function Ad(e){const t=Ed[e];return t||ud(0,e),t}function Nd(){return Od}function jd(e,t){t&&(Ad("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Md(e){Pd(e),e.drafts_.forEach(Td),e.drafts_=null}function Pd(e){e===Od&&(Od=e.parent_)}function Ud(e){return Od={drafts_:[],parent_:Od,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Td(e){const t=e[ld];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Wd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ld].modified_&&(Md(t),ud(4)),pd(e)&&(e=Ld(t,e),t.parent_||_d(t,e)),t.patches_&&Ad("Patches").generateReplacementPatches_(n[ld].base_,e,t.patches_,t.inversePatches_)):e=Ld(t,n,[]),Md(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ad?e:void 0}function Ld(e,t,n){if(Rd(t))return t;const i=t[ld];if(!i)return md(t,((r,o)=>Dd(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return _d(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),md(r,((r,s)=>Dd(e,i,t,r,s,n,o))),_d(e,t,!1),n&&e.patches_&&Ad("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Dd(e,t,n,i,r,o,s){if("production"!==process.env.NODE_ENV&&r===n&&ud(5),fd(r)){const s=Ld(e,r,o&&t&&3!==t.type_&&!bd(t.assigned_,i)?o.concat(i):void 0);if($d(n,i,s),!fd(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(pd(r)&&!Rd(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ld(e,r),t&&t.scope_.parent_||_d(e,r)}}function _d(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Id(t,n)}var Fd={get(e,t){if(t===ld)return e;const n=kd(e);if(!bd(n,t))return function(e,t,n){const i=Vd(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_||!pd(i)?i:i===Bd(e.base_,t)?(Hd(e),e.copy_[t]=zd(i,e)):i},has:(e,t)=>t in kd(e),ownKeys:e=>Reflect.ownKeys(kd(e)),set(e,t,n){const i=Vd(kd(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=Bd(kd(e),t),r=i?.[ld];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||bd(e.base_,t)))return!0;Hd(e),Kd(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!==Bd(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Hd(e),Kd(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=kd(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){ud(11)},getPrototypeOf:e=>hd(e.base_),setPrototypeOf(){ud(12)}},qd={};function Bd(e,t){const n=e[ld];return(n?kd(n):e)[t]}function Vd(e,t){if(!(t in e))return;let n=hd(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=hd(n)}}function Kd(e){e.modified_||(e.modified_=!0,e.parent_&&Kd(e.parent_))}function Hd(e){e.copy_||(e.copy_=Sd(e.base_,e.scope_.immer_.useStrictShallowCopy_))}md(Fd,((e,t)=>{qd[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),qd.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&ud(13),qd.set.call(this,e,t,void 0)},qd.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&ud(14),Fd.set.call(this,e[0],t,n,e[0])};function zd(e,t){const n=wd(e)?Ad("MapSet").proxyMap_(e,t):Cd(e)?Ad("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:Nd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=Fd;n&&(r=[i],o=qd);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:Nd()).drafts_.push(n),n}function Gd(e){return fd(e)||ud(10,e),Jd(e)}function Jd(e){if(!pd(e)||Rd(e))return e;const t=e[ld];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Sd(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Sd(e,!0);return md(n,((e,t)=>{$d(n,e,Jd(t))})),t&&(t.finalized_=!1),n}var Zd=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&&ud(6),void 0!==n&&"function"!=typeof n&&ud(7),pd(e)){const r=Ud(this),o=zd(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?Md(r):Pd(r)}return jd(r,n),Wd(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===ad&&(i=void 0),this.autoFreeze_&&Id(i,!0),n){const t=[],r=[];Ad("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}ud(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){pd(e)||ud(8),fd(e)&&(e=Gd(e));const t=Ud(this),n=zd(e,void 0);return n[ld].isManual_=!0,Pd(t),n}finishDraft(e,t){const n=e&&e[ld];n&&n.isManual_||ud(9);const{scope_:i}=n;return jd(i,t),Wd(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=Ad("Patches").applyPatches_;return fd(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},Yd=Zd.produce;Zd.produceWithPatches.bind(Zd),Zd.setAutoFreeze.bind(Zd),Zd.setUseStrictShallowCopy.bind(Zd),Zd.applyPatches.bind(Zd),Zd.createDraft.bind(Zd),Zd.finishDraft.bind(Zd);var Xd=(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})}}},Qd=(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})}},el={inputStabilityCheck:"once",identityFunctionCheck:"once"};var tl=e=>Array.isArray(e)?e:[e];function nl(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 il(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var rl="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},ol=0,sl=1;function al(){return{s:ol,v:void 0,o:null,p:null}}function dl(e,t={}){let n=al();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=al(),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=al(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===sl)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 rl(d):d}return a.s=sl,a.v=d,d}return s.clearCache=()=>{n=al(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function ll(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=dl,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=tl(l),p=tl(u),g=nl(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const y=c((function(){r++;const e=il(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}={...el,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Xd},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:Qd}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=il(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 cl=ll(dl),ul=Object.assign(((e,t=cl)=>{!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:()=>ul});function hl(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var fl=hl(),pl=hl;((...e)=>{const t=ll(...e)})(dl);var gl="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?od:od.apply(null,arguments)},vl=e=>e&&"function"==typeof e.match;function ml(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?Yl(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=>sd(t)&&t.type===e,n}function yl(e){return"function"==typeof e&&"type"in e&&vl(e)}function bl(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 $l=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 wl(e){return pd(e)?Yd(e,(()=>{})):e}function Cl(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?Yl(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function kl(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Sl(e,t,n){const i=Il(e,t,n);return{detectMutations:()=>xl(e,t,i,n)}}function Il(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]=Il(e,t,n[r],s))}}return o}function xl(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=xl(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Rl(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Qa(e)}function Ol(e,t="",n=Rl,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=Ol(l,a,n,i,r,o),s))return s}return o&&El(e)&&o.add(e),!1}function El(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!El(t))return!1;return!0}function Al(e){return"boolean"==typeof e}var Nl=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new $l;if(t&&(Al(t)?o.push(fl):o.push(pl(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Al(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=kl,ignoredPaths:r,warnAfter:o=32}=e;const s=Sl.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=bl(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Yl(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?Yl(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={};Al(i)||(e=i),o.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Rl,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(!sd(u))return l(u);const h=l(u),f=bl(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=Ol(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=Ol(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={};Al(r)||(e=r),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=yl}=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},jl=e=>t=>{setTimeout(t,e)},Ml="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:jl(10),Pl=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new $l(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?Ml:"callback"===e.type?e.queueNotification:jl(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},Ul="production"===process.env.NODE_ENV;function Tl(e){const t=Nl(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Qa(n))throw new Error("production"===process.env.NODE_ENV?Yl(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rd(n)}if(!Ul&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?Yl(2):"`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!Ul&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Yl(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Ul&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Yl(4):"each middleware provided to configureStore must be a function");let l=od;r&&(l=gl({trace:!Ul,..."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?Ja(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=od(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=Pl(c);if(!Ul&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Yl(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Ul&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Yl(6):"`enhancers` callback must return an array");if(!Ul&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Yl(7):"each enhancer provided to configureStore must be a function");Ul||!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 nd(a,o,l(...h))}function Wl(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?Yl(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?Yl(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?Yl(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Yl(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?Yl(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?Yl(31):"`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function Ll(...e){return t=>e.some((e=>((e,t)=>vl(e)?e.match(t):e(t))(e,t)))}var Dl=["name","message","stack","code"],_l=class{constructor(e,t){this.payload=e,this.meta=t}_type},Fl=class{constructor(e,t){this.payload=e,this.meta=t}_type},ql=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Dl)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Bl=(()=>{function e(e,t,n){const i=ml(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=ml(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=ml(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||ql)(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 _l(e,t),fulfillWithValue:(e,t)=>new Fl(e,t)})).then((t=>{if(t instanceof _l)throw t;return t instanceof Fl?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof _l?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(Vl)})}}),{pending:r,rejected:o,fulfilled:i,settled:Ll(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function Vl(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Kl=Symbol.for("rtk-slice-createasyncthunk");function Hl(e,t){return`${e}/${t}`}function zl(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?Yl(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...o)}return r.unwrapped=t,r}var Gl=function({creators:e}={}){const t=e?.asyncThunk?.[Kl];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Yl(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?Yl(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Yl(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?Yl(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?Wl(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?Yl(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]=Wl(t);if(function(e){return"function"==typeof e}(e))n=()=>wl(e());else{const t=wl(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(fd(e)){const i=n(e,t);return void 0===i?e:i}if(pd(e))return Yd(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?Yl(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:Hl(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?Yl(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?ml(e,s):ml(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Yl(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||Jl,pending:a||Jl,rejected:d||Jl,settled:l||Jl})}(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=Cl(c,this,{insert:()=>new WeakMap});return Cl(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=zl(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?Yl(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 Jl(){}var Zl="listenerMiddleware";function Yl(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. `}ml(`${Zl}/add`),ml(`${Zl}/removeAll`),ml(`${Zl}/remove`);const Xl=e=>Si((t=>{const n=Gl(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(mi(Eo)(t)){constructor(...e){super(...e);const t=Tl({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{Vl(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()))))}}})),Ql=Si((e=>class extends(Eo(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()}})),ec=Si((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),tc=e=>e.selectedAccessKeysIds,nc=e=>e.notifications,ic=cl((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}))))),rc=cl(tc,ic,((e,t)=>t.filter((t=>e.includes(t.id))))),oc=cl(tc,(e=>!!e.length)),sc=cl(rc,(e=>e.every((e=>e.editable)))),ac=cl(sc,oc,((e,t)=>e&&t)),dc=cl(rc,(e=>e.some((e=>"expired"===e.status)))),lc=cl(ac,dc,((e,t)=>e&&!t));cl(tc,(e=>1===e.length));const cc=cl(rc,(e=>1===e.length?e[0].name:`${e.length} access keys`)),uc=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)}))}))},hc=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}}),fc=({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)})}}),pc=Bl("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),gc=uc(pc)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},hc((e=>e.createAccessKey)),fc({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>`}})),vc={action:pc,reducer:gc},mc=Bl("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),yc=uc(mc)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},hc((e=>e.deleteAccessKey)),fc({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),bc={action:mc,reducer:yc},$c=Bl("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),wc=uc($c)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},hc((e=>e.accessKeysList))),Cc={action:$c,reducer:wc},kc=Bl("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),Sc=uc(kc)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},hc((e=>e.activateAccessKey)),fc({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),Ic={action:kc,reducer:Sc},xc=Bl("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),Rc=uc(xc)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},hc((e=>e.deactivateAccessKey)),fc({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),Oc={action:xc,reducer:Rc},Ec=Bl("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Ac={action:Ec,reducer:uc(Ec)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},hc((e=>e.tenantRoles)))},Nc={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:[]},jc="/v1/mgmt/accesskey/search",Mc="/v1/mgmt/accesskey/delete/batch",Pc="/v1/mgmt/accesskey/create",Uc="/v1/mgmt/accesskey/deactivate/batch",Tc="/v1/mgmt/accesskey/activate/batch",Wc="/v1/mgmt/role/all",Lc=e=>c(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)})),Dc=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((...e)=>c(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(jc,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield Lc(a),(yield a.json()).keys})),deleteBatch:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Mc,{ids:i},{queryParams:{tenant:t}});return yield Lc(r),r.json()})),create:i=>c(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 l="0"===r[0]?0:Math.floor(d.getTime()/1e3);if(n)return((e,t)=>c(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},l);const u=yield e.post(Pc,{name:i,expireTime:l,roleNames:o,userId:s,permittedIps:a},{queryParams:{tenant:t}});return yield Lc(u),yield u.json()})),activate:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Tc,{ids:i},{queryParams:{tenant:t}});return yield Lc(r),yield r.json()})),deactivate:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Uc,{ids:i},{queryParams:{tenant:t}});return yield Lc(r),yield r.json()}))}),_c=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>c(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(Wc,{queryParams:{tenant:t}});return yield Lc(i),i.json()}))}),Fc=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,Do,ec,Wo({tenant:Wo.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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.5.43"}}));return{accesskey:Dc({httpClient:r.httpClient,tenant:t,mock:n}),tenant:_c({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})),qc=Si((e=>{const t=mi(Xl({name:"widget",initialState:Nc,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{vc.reducer(e),bc.reducer(e),Cc.reducer(e),Ic.reducer(e),Oc.reducer(e),Ac.reducer(e)},asyncActions:{searchAccessKeys:Cc.action,createAccessKey:vc.action,activateAccessKeys:Ic.action,deactivateAccessKeys:Oc.action,deleteAccessKeys:bc.action,getTenantRoles:Ac.action}}),Uo,Eo,Fc)(e);return class extends t{constructor(...e){super(...e),this.state=Nc,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Bc=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){const t=yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text");return null==t?void 0:t.body}))}}})),Vc=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Uo,Xo,rs,Bc,qc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Kc=Si((e=>{var t,n,i,r,o;return o=class extends(mi(qc,Eo,Vc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.accessKeysTable.data=e}))),r.set(this,ki(((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 c(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),u(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{u(this,r,"f").call(this,e.target,e.detail)}))})),u(this,i,"f").call(this,ic(this.state)),this.subscribe(u(this,i,"f").bind(this),ic)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new ja(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})),Hc=Si((e=>{var t,n,i;return i=class extends(mi(qc,Ha,Eo,Vc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(yi(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Ra((()=>{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 Ra((()=>{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=rc(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new _a(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=cc(this.state);i.text=`Activate ${e}?`}}))},i})),zc=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Vc,qc,Hc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),lc)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Ra(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})),Gc=Si((e=>{var t,n,i;return i=class extends(mi(qc,Ha,Ql,Eo,Vc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(yi(yield this.fetchWidgetPage("created-access-key-modal.html"))),new Ra((()=>{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})),Jc=Si((e=>{var t,n,i,r,o;return o=class extends(mi(qc,Ha,Ql,Eo,Vc,Gc)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>c(this,void 0,void 0,(function*(){var e,t;yield u(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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function e(){return c(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(yi(yield this.fetchWidgetPage("create-access-key-modal.html"))),new Ra((()=>{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 Ra((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(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())}})))),h(this,n,new Ta((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),u(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{u(this,t,"m",e).call(this)}}))},o})),Zc=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Jc,Vc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Ra(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})),Yc=Si((e=>{var t,n,i;return i=class extends(mi(qc,Ha,Eo,Vc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(yi(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Ra((()=>{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 Ra((()=>{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=rc(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new _a(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=cc(this.state);i.text=`Deactivate ${e}?`}}))},i})),Xc=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Vc,qc,Yc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),lc)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Ra(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})),Qc=Si((e=>{var t,n,i;return i=class extends(mi(qc,Ha,Eo,Vc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(yi(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Ra((()=>{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 Ra((()=>{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=rc(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new _a(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=cc(this.state);i.text=`Delete ${e}?`}}))},i})),eu=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Vc,qc,Qc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),ac)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ra(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})),tu=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Vc,qc)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Fa(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f"))},r})),nu={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},iu=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Eo,qc,Ga,Uo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),nc)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=nu[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})),ru=Si((e=>class extends(mi($a,as,Kc,Zc,eu,tu,zc,Xc,iu)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),ou=mi((e=>class extends(ru(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",ou);var su,au=Object.freeze({__proto__:null,default:ou});!function(e){e.oidc="oidc",e.saml="saml",e.wsfed="wsfed",e.custom="custom"}(su||(su={}));const du=e=>e.ssoAppsList.data,lu=cl(du,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===su.saml))})),cu=cl(du,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>{var t;return e.appType===su.oidc&&(null===(t=e.oidcSettings)||void 0===t?void 0:t.customIdpInitiatedLoginPageUrl)}))})),uu=cl(du,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>{var t;return e.appType===su.wsfed&&(null===(t=e.wsfedSettings)||void 0===t?void 0:t.idpInitiatedUrl)}))})),hu=cl(du,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===su.custom))})),fu=e=>{var t,n,i,r;switch(e.appType){case su.saml:return null===(t=e.samlSettings)||void 0===t?void 0:t.idpInitiatedUrl;case su.oidc:return null===(n=e.oidcSettings)||void 0===n?void 0:n.customIdpInitiatedLoginPageUrl;case su.wsfed:return null===(i=e.wsfedSettings)||void 0===i?void 0:i.idpInitiatedUrl;case su.custom:return null===(r=e.customSettings)||void 0===r?void 0:r.loginPageUrl;default:return}},pu=cl(lu,cu,uu,hu,((e,t,n,i)=>[...e,...t,...n,...i].map((e=>({name:e.name,icon:e.logo,url:fu(e)}))))),gu=Bl("ssoApps/load",((e,{extra:{api:t}})=>t.ssoApps.load())),vu=(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)}))}))})(gu)({onFulfilled:(e,t)=>{var n;e.ssoAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},(mu=e=>e.ssoAppsList,{onFulfilled:e=>{mu(e).loading=!1},onPending:e=>{mu(e).loading=!0,mu(e).error=null},onRejected:(e,t)=>{mu(e).loading=!1,mu(e).error=t.error}}));var mu;const yu={action:gu,reducer:vu},bu={ssoAppsList:{data:[],loading:!1,error:null}},$u="/v1/mgmt/sso/idp/apps/load",wu=({httpClient:e,mock:t})=>({load:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(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:su.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:su.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:su.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp4",name:"App 4",description:"This is a WS-Fed app",enabled:!0,appType:su.wsfed,logo:"logo4",wsfedSettings:{idpInitiatedUrl:"http://localhost/wsfed/idp-initiated",realm:"urn:mock:realm",replyUrl:"http://localhost/reply",loginPageUrl:"http://localhost/login"}}]})}))}));const n=yield e.get($u);return yield(e=>c(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()}))}),Cu=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,ec,Do)(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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n)=>{const i=di(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.6.3"}}));return{ssoApps:wu({httpClient:i.httpClient,mock:t})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),ku=Si((e=>{const t=mi(Xl({name:"widget",initialState:bu,reducers:{},extraReducers:e=>{yu.reducer(e)},asyncActions:{loadSSOApps:yu.action}}),Uo,Eo,Cu)(e);return class extends t{constructor(...e){super(...e),this.state=bu,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Su=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Iu=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Uo,Xo,rs,Su,ku)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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([u(this,t,"m",n).call(this),this.actions.loadSSOApps()]);u(this,t,"m",i).call(this,o),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r})),xu=Si((e=>{var t,n,i;return i=class extends(mi(ku,Eo,Iu)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this,pu(this.state))}))}},t=new WeakSet,n=function(e){this.appsList=new Ia((()=>{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})),Ru=Si((e=>class extends(mi($a,as,xu)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Ou=mi((e=>class extends(Ru(e)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",Ou);var Eu=Object.freeze({__proto__:null,default:Ou});const Au=(e,t)=>t?{[e]:t}:{},Nu=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},ju=e=>e.selectedAuditId,Mu=cl((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:"",scim_request:"",scim_result:"",Change:""}:o,{saml_request:a,saml_response:d,saml_generated_user:c,saml_generated_roles:u,oidc_response:h,oidc_generated_user:f,scim_request:p,scim_result:g,Change:v}=s,m=l(s,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user","scim_request","scim_result","Change"]),y=l(t,["occurred","ID","type","data"]);var b;return(e=>Object.fromEntries(Object.entries(e).filter((([e,t])=>!!t))))(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},y),{data:m}),Au("type",(b=r)&&b[0].toUpperCase()+b.slice(1))),Au("saml_request",a)),Au("saml_response",d)),Au("saml_generated_user",Nu(c))),Au("saml_generated_roles",Nu(u))),Au("oidc_response",Nu(h))),Au("oidc_generated_user",Nu(f))),Au("scim_request",p)),Au("scim_result",g)),Au("Change",v)),{occurredFormatted:n?new Date(Number(n)||0).toLocaleString():"N/A"}))}))));cl(ju,Mu,((e,t)=>t.find((t=>e===t.id)))),cl(ju,(e=>!!e));const Pu=Bl("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),Uu=(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)}))}))})(Pu)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Tu=e=>e.auditList,{onFulfilled:e=>{Tu(e).loading=!1},onPending:e=>{Tu(e).loading=!0,Tu(e).error=null},onRejected:(e,t)=>{Tu(e).loading=!1,Tu(e).error=t.error}}));var Tu;const Wu={action:Pu,reducer:Uu},Lu={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Du="/v1/mgmt/audit/search",_u=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s,from:a}={}){if(n)return(e=>c(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(Du,{limit:r,page:i,text:o,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>c(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}))}),Fu=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,Do,ec,Wo({tenant:Wo.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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.6.5"}}));return{audit:_u({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})),qu=Si((e=>{const t=mi(Xl({name:"widget",initialState:Lu,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Wu.reducer(e)},asyncActions:{searchAudit:Wu.action}}),Uo,Eo,Fu)(e);return class extends t{constructor(...e){super(...e),this.state=Lu,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Bu=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Vu=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Uo,Xo,rs,Bu,qu)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this)]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Ku=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Eo,Vu,qu)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this),u(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Fa(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f")),u(this,n,"f").call(this)},r=function(){var e;this.rangeInput=new Da(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(u(this,n,"f"))},o})),Hu=Si((e=>{var t,n,i,r;return r=class extends(mi(qu,Eo,Vu)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),u(this,i,"f").call(this,Mu(this.state)),this.subscribe(u(this,i,"f").bind(this),Mu)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new ja(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})),zu=[{header:"Occurred",path:"occurredFormatted"},{header:"User ID",path:"userId"},{header:"Actor",path:"actorId"},{header:"Login IDs",path:"externalIds"},{header:"Remote Address",path:"remoteAddress"},{header:"Type",path:"type"},{header:"Action",path:"action"},{header:"Device",path:"device"},{header:"Method",path:"method"},{header:"Geo",path:"geo"}],Gu=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Vu,qu)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.exportButton=new Ra(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="export-button"]'),{logger:this.logger}),this.exportButton.onClick((()=>{const e=Mu(this.state);if(!e.length)return void this.logger.warn("No audit data to export");const t=((e,t)=>[t.map((e=>ji(e.header))).join(","),...e.map((e=>t.map((t=>ji(e[t.path]))).join(",")))].join("\n"))(e,zu);((e,t)=>{const n=new Blob(["\ufeff"+e],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",t),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)})(t,`audit_logs_${(new Date).toISOString().slice(0,10)}.csv`)}))},i})),Ju=Si((e=>class extends(mi($a,as,Hu,Ku,Gu)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Zu=mi((e=>class extends(Ju(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Zu);var Yu=Object.freeze({__proto__:null,default:Zu});const Xu=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),n)})),t};function Qu(e){return new URLSearchParams(window.location.search).get(e)}const eh=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)}))}))},th=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}}),nh=Bl("outboundApps/load",((e,{extra:{api:t}})=>t.outboundApps.getAllOutboundApps())),ih=eh(nh)({onFulfilled:(e,t)=>{var n;e.outboundAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},th((e=>e.outboundAppsList))),rh={action:nh,reducer:ih},oh=Bl("outboundApps/getConnectedOutboundApps",((e,{extra:{api:t}})=>t.outboundApps.getConnectedOutboundApps(e))),sh=eh(oh)({onFulfilled:(e,t)=>{var n;e.connectedOutboundAppsIds.data=null===(n=t.payload)||void 0===n?void 0:n.appIds}},th((e=>e.connectedOutboundAppsIds))),ah={action:oh,reducer:sh},dh={outboundAppsList:{data:[],loading:!1,error:null},connectedOutboundAppsIds:{data:[],loading:!1,error:null},allowedAppsIds:{data:void 0},me:{loading:!1,error:null,data:{}}},lh="/v1/mgmt/outbound/apps",ch="/v1/mgmt/outbound/apps-with-user-token",uh="/v1/auth/me",hh=e=>c(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)})),fh=({httpClient:e,mock:t})=>({getAllOutboundApps:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:[{id:"appId1",name:"Application 1",description:"Description"},{id:"appId2",name:"Application 2",description:"Description"},{id:"appId3",name:"Application 3",description:"Description"}]})}))}));const n=yield e.get(lh);return yield hh(n),n.json()})),getConnectedOutboundApps:n=>c(void 0,[n],void 0,(function*({userId:n,tenantId:i}){if(t)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:["outboundApp3"]})}))}));const r=yield e.get(ch,{queryParams:i?{userId:n,tenantId:i}:{userId:n}});return yield hh(r),r.json()}))}),ph=({httpClient:e,mock:t})=>({me:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({userId:"user-1"})}))}));const n=yield e.get(uh);return yield hh(n),n.json()}))}),gh=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,ec,Do)(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 styleId(){return this.getAttribute("style-id")||os}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n)=>{const i=di(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"outbound-applications-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.2.35"}}));return{outboundApps:fh({httpClient:i.httpClient,mock:t}),user:Object.assign({},ph({httpClient:i.httpClient,mock:t}))}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),vh=Bl("users/me",((e,{extra:{api:t}})=>t.user.me())),mh={action:vh,reducer:eh(vh)({onFulfilled:(e,t)=>{e.me.data=t.payload}},th((e=>e.me)))},yh=Si((e=>{const t=mi(Xl({name:"widget",initialState:dh,reducers:{setAllowedAppsIds:(e,{payload:t})=>{e.allowedAppsIds.data=t}},extraReducers:e=>{mh.reducer(e),ah.reducer(e),rh.reducer(e)},asyncActions:{getMe:mh.action,getOutboundApps:rh.action,getConnectedOutboundApps:ah.action}}),Uo,Eo,gh)(e);return class extends t{constructor(...e){super(...e),this.state=dh,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),bh="widget-flow",$h=Si((e=>{var t,n,i;return i=class extends(mi(Uo,Ha,yh,ec,Eo,as)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=Qu(bh);r&&(function(e){if(window.history.replaceState&&Qu(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())}}(bh),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Xu({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Oa((()=>{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})),wh=cl((e=>e.outboundAppsList.data),(e=>e.connectedOutboundAppsIds.data),(e=>e.allowedAppsIds.data),((e,t,n)=>e.filter((e=>void 0===n||n.includes(e.id))).map((e=>{const n=(null==t?void 0:t.includes(e.id))||!1;return Object.assign(Object.assign({},e),{appId:e.id,isConnected:n})})).sort(((e,t)=>e.name.localeCompare(t.name))))),Ch=cl((e=>e.me.data),(e=>e.userId)),kh=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`outbound-applications-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Sh=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Eo,Uo,Xo,rs,kh,yh)(e)){constructor(){super(...arguments),t.add(this)}static get observedAttributes(){return["allowed-outbound-apps-ids"]}attributeChangedCallback(e,n,i){"allowed-outbound-apps-ids"===e&&n!==i&&this.actions.setAllowedAppsIds(u(this,t,"a",r))}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var o;yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield this.actions.getMe(),yield this.actions.setAllowedAppsIds(u(this,t,"a",r)),yield Promise.all([this.actions.getOutboundApps(),this.actions.getConnectedOutboundApps({userId:Ch(this.state),tenantId:this.tenantId})]);const s=yield u(this,t,"m",n).call(this);u(this,t,"m",i).call(this,s),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r=function(){var e;if(!this.hasAttribute("allowed-outbound-apps-ids"))return;const t=null===(e=this.getAttribute("allowed-outbound-apps-ids"))||void 0===e?void 0:e.trim();return t?t.split(",").map((e=>e.trim())).filter(Boolean):[]},o})),Ih=Si((e=>class extends(mi(as,To)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),xh=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v,m,y,b,$;return $=class extends(mi(Ih,yh,Eo,Sh,Ha)(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),s.set(this,void 0),a.set(this,null),d.set(this,null),b.set(this,$i((e=>{u(this,n,"f").data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",y).call(this,wh(this.state)),u(this,t,"m",l).call(this),u(this,t,"m",g).call(this),this.subscribe(u(this,b,"f").bind(this),wh)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakMap,d=new WeakMap,b=new WeakMap,t=new WeakSet,l=function(){u(this,n,"f").connectFlowId&&(h(this,i,this.createModal({"data-id":"outbound-apps-connect"}),"f"),u(this,i,"f").afterClose=()=>{var e;if(u(this,a,"f")){const t=null===(e=u(this,i,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc");null==t||t.removeEventListener("page-updated",u(this,a,"f")),h(this,a,null,"f")}},h(this,o,new Oa((()=>{var e;return null===(e=u(this,i,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(u(this,o,"f")))},f=function(e,t,n){e.open(),t.removeEventListener("page-updated",n)},p=function(e,n){var i;const r=null===(i=e.ele)||void 0===i?void 0:i.querySelector("descope-wc"),o=()=>u(this,t,"m",f).call(this,e,r,o);n=o,null==r||r.addEventListener("page-updated",n)},g=function(){h(this,r,this.createModal({"data-id":"outbound-apps-disconnect"}),"f"),h(this,s,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=()=>{var e;if(u(this,d,"f")){const t=null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc");null==t||t.removeEventListener("page-updated",u(this,d,"f")),h(this,d,null,"f")}},this.syncFlowTheme(u(this,s,"f"))},v=function(e){u(this,i,"f").setContent(Xu({projectId:this.projectId,flowId:u(this,n,"f").connectFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,outboundAppId:e})),u(this,t,"m",p).call(this,u(this,i,"f"),u(this,a,"f")),u(this,o,"f").onSuccess((()=>{u(this,i,"f").close(),this.actions.getConnectedOutboundApps({userId:Ch(this.state),tenantId:this.tenantId})}))},m=function(e){u(this,r,"f").setContent(Xu({projectId:this.projectId,flowId:u(this,n,"f").disconnectFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,outboundAppId:e})),u(this,t,"m",p).call(this,u(this,r,"f"),u(this,d,"f")),u(this,s,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getConnectedOutboundApps({userId:Ch(this.state)})}))},y=function(e){h(this,n,new La((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-outbound-apps")}),{logger:this.logger}),"f"),u(this,n,"f").onConnectClick((({id:e})=>{u(this,t,"m",v).call(this,e)})),u(this,n,"f").onDisconnectClick((({id:e})=>{u(this,t,"m",m).call(this,e)})),u(this,n,"f").data=e},$})),Rh=Si((e=>class extends(mi($a,as,$h,xh)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Oh=mi((e=>class extends(Rh(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 ba})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"outbound-applications-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.35"}}}))}}))(HTMLElement);customElements.define("descope-outbound-applications-widget",Oh);var Eh=Object.freeze({__proto__:null,default:Oh});const Ah=e=>e.selectedRolesIds,Nh=e=>e.notifications,jh=e=>e.tenantPermissions.data||[],Mh=cl((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"})})))),Ph=cl(Ah,Mh,((e,t)=>t.filter((t=>e.includes(t.name))))),Uh=cl(Ah,(e=>!!e.length)),Th=cl(Ah,(e=>1===e.length)),Wh=cl(Ph,Th,((e,t)=>t&&"yes"===e[0].editable)),Lh=cl(Ph,(e=>1===e.length?e[0].name:`${e.length} roles`)),Dh=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)}))}))},_h=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}}),Fh=({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)})}}),qh=Bl("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),Bh=Dh(qh)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},_h((e=>e.createRole)),Fh({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>`}})),Vh={action:qh,reducer:Bh},Kh=Bl("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Hh=Dh(Kh)({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=[]}},_h((e=>e.deleteRole)),Fh({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to delete role${["","s"]}`})),zh={action:Kh,reducer:Hh},Gh=Bl("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),Jh=Dh(Gh)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},_h((e=>e.rolesList))),Zh={action:Gh,reducer:Jh},Yh=Bl("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),Xh=Dh(Yh)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},_h((e=>e.updateRole)),Fh({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>`}})),Qh={action:Yh,reducer:Xh},ef=Bl("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),tf={action:ef,reducer:Dh(ef)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},_h((e=>e.tenantPermissions)))},nf={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:[]},rf="/v1/mgmt/role/search",of="/v1/mgmt/role/delete/batch",sf="/v1/mgmt/role/create",af="/v1/mgmt/role/update",df="/v1/mgmt/permission/all",lf=e=>c(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)})),cf=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((e,t)=>c(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(rf,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield lf(a),(yield a.json()).roles})),deleteBatch:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(of,{roleNames:i},{queryParams:{tenant:t}});return yield lf(r),r.json()})),create:i=>c(void 0,[i],void 0,(function*({name:i,description:r,permissionNames:o}){if(n)return((e,t)=>c(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(sf,{name:i,description:r,permissionNames:o,tenantId:t},{queryParams:{tenant:t}});return yield lf(s),yield s.json()})),update:i=>c(void 0,[i],void 0,(function*({name:i,newName:r,description:o,permissionNames:s}){if(n)return((e,t)=>c(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(af,{name:i,newName:r,description:o,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield lf(a);const d=yield a.json();return d.oldName=i,d}))}),uf=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>c(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(df,{queryParams:{tenant:t}});return yield lf(i),i.json()}))}),hf=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,Do,ec,Wo({tenant:Wo.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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.5.35"}}));return{role:cf({httpClient:r.httpClient,tenant:t,mock:n}),tenant:uf({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})),ff=Si((e=>{const t=mi(Xl({name:"widget",initialState:nf,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Vh.reducer(e),Qh.reducer(e),zh.reducer(e),Zh.reducer(e),tf.reducer(e)},asyncActions:{searchRoles:Zh.action,createRole:Vh.action,updateRole:Qh.action,deleteRoles:zh.action,getTenantPermissions:tf.action}}),Uo,Eo,hf)(e);return class extends t{constructor(...e){super(...e),this.state=nf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),pf=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),gf=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Uo,Xo,rs,pf,ff)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),vf=Si((e=>{var t,n,i,r,o;return o=class extends(mi(ff,Ha,Ql,Eo,gf)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>c(this,void 0,void 0,(function*(){var e;yield u(this,n,"f").setData(null===(e=jh(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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function(){return c(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(yi(yield this.fetchWidgetPage("create-role-modal.html"))),new Ra((()=>{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 Ra((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(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))})))),h(this,n,new Ta((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),u(this,r,"f").call(this)}))},o})),mf=Si((e=>{var t,n,i;return i=class extends(mi(Eo,vf,gf)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Ra(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})),yf=Si((e=>{var t,n,i;return i=class extends(mi(ff,Ha,Eo,gf)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(yi(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Ra((()=>{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 Ra((()=>{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=Ph(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new _a(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Lh(this.state);i.text=`Delete ${e}?`}}))},i})),bf=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,gf,ff,yf)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),Uh)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ra(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})),$f=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(ff,Ha,Eo,Ql,gf)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>c(this,void 0,void 0,(function*(){var e;yield u(this,n,"f").setData(null===(e=jh(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=Ph(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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",a).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,i=function(){new Ra((()=>{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 Ra((()=>{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=l(t,["name"]),r=null===(e=Ph(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 c(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(yi(yield this.fetchWidgetPage("edit-role-modal.html"))),u(this,t,"m",i).call(this),u(this,t,"m",r).call(this),h(this,n,new Ta((()=>{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=()=>c(this,void 0,void 0,(function*(){yield u(this,o,"f").call(this),u(this,s,"f").call(this)}))}))},d})),wf=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,gf,ff,$f,Ql)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),Wh)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ra(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})),Cf=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,gf,ff)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Fa(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f"))},r})),kf={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},Sf=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Eo,ff,Ga,Uo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),Nh)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=kf[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})),If=Si((e=>{var t,n,i,r,o;return o=class extends(mi(ff,Eo,gf)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.rolesTable.data=e}))),r.set(this,ki(((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 c(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),u(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{u(this,r,"f").call(this,e.target,e.detail)}))})),u(this,i,"f").call(this,Mh(this.state)),this.subscribe(u(this,i,"f").bind(this),Mh)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new ja(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})),xf=Si((e=>class extends(mi($a,as,If,mf,bf,wf,Cf,Sf)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Rf=mi((e=>class extends(xf(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",Rf);var Of=Object.freeze({__proto__:null,default:Rf});const Ef=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),n)})),t};function Af(e){return new URLSearchParams(window.location.search).get(e)}const Nf=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)}))}))},jf=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}}),Mf=Bl("users/me",((e,{extra:{api:t}})=>t.user.me())),Pf=Nf(Mf)({onFulfilled:(e,t)=>{e.me.data=t.payload}},jf((e=>e.me))),Uf={action:Mf,reducer:Pf},Tf=Bl("tenant/details",((e,{extra:{api:t}})=>t.tenant.details())),Wf=Nf(Tf)({onFulfilled:(e,t)=>{e.tenant.data=t.payload}},jf((e=>e.tenant))),Lf={action:Tf,reducer:Wf},Df=Bl("tenant/adminLinkSso",((e,{extra:{api:t}})=>t.tenant.adminLinkSso())),_f={action:Df,reducer:Nf(Df)({onFulfilled:(e,t)=>{var n;e.tenantAdminLinkSSO.data=(null===(n=t.payload)||void 0===n?void 0:n.adminSSOConfigurationLink)||""}},jf((e=>e.tenantAdminLinkSSO)))},Ff={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:""}},qf="/v1/auth/me",Bf="/v1/mgmt/tenant",Vf="/v1/mgmt/tenant/adminlinks/sso/authenticated",Kf=e=>c(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)})),Hf=({httpClient:e,tenantId:t,mock:n})=>{const i=encodeURIComponent(t||""),r=`?tenant=${i}&id=${i}`;return{details:()=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({tenantId:"tenant-1",roleNames:["admin"],id:"tenant-1",name:"Test Tenant",selfProvisioningDomains:["example1.com","example2.com"],customAttributes:{},authType:"password",domains:[],createdTime:Date.now(),disabled:!1,enforceSSO:!0})}))}));if(!t)throw new Error("tenantId is not defined");const i=`${Bf}${r}`,o=yield e.get(i);return yield Kf(o),yield o.json()})),adminLinkSso:()=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({adminSSOConfigurationLink:"_blank"})}))}));if(!t)throw new Error("tenantId is not defined");const r=yield e.post(`${Vf}?tenant=${i}`,{tenantId:i},{headers:{"Content-Type":"application/json"}});return yield Kf(r),yield r.json()}))}},zf=({httpClient:e,mock:t})=>({me:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(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(qf);return yield Kf(n),n.json()}))}),Gf=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,Do,ec)(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 tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||os}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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","mock"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.5.34"}}));return{user:zf({httpClient:r.httpClient,mock:n}),tenant:Hf({httpClient:r.httpClient,tenantId:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),Jf=Si((e=>{const t=mi(Xl({name:"widget",initialState:Ff,reducers:{},extraReducers:e=>{Uf.reducer(e),Lf.reducer(e),_f.reducer(e)},asyncActions:{getMe:Uf.action,getTenant:Lf.action,getTenantAdminLinkSSO:_f.action}}),Uo,Eo,Gf)(e);return class extends t{constructor(...e){super(...e),this.state=Ff,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Zf="widget-flow",Yf=Si((e=>{var t,n,i;return i=class extends(mi(Uo,Ha,Jf,ec,Eo,as)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=Af(Zf);r&&(function(e){if(window.history.replaceState&&Af(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())}}(Zf),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Ef({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Oa((()=>{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(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()})),t.afterClose=()=>{t.remove()},t.open()},i})),Xf=e=>e.tenant.data,Qf=e=>e.tenantAdminLinkSSO.data,ep=cl(Xf,(e=>e.customAttributes||{})),tp=cl(Xf,(e=>e.name||"")),np=cl(Xf,(e=>e.selfProvisioningDomains||[])),ip=cl(Xf,(e=>e.enforceSSOExclusions||[])),rp=cl(Xf,(e=>e.enforceSSO||!1)),op=Si((e=>class extends(mi(as,To)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),sp=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`tenant-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),ap=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Uo,Xo,rs,sp,Jf)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);try{yield Promise.all([this.actions.getMe(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()])}catch(i){}const r=this.state.me.error||(()=>this.state.tenant.error)()||(()=>this.state.tenantAdminLinkSSO.error)();if(r){this.contentRootElement.innerHTML="";const e="object"==typeof r&&null!==r&&"message"in r?r.message:String(r)||"An error occurred";this.contentRootElement.append(function({mainMessage:e="An error occurred"}){const t=document.createElement("div");t.setAttribute("data-id","widget-error"),t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="center",t.style.justifyContent="center",t.style.padding="72px 36px",t.style.background="#fff",t.style.borderRadius="12px",t.style.boxShadow="0 2px 8px rgba(0,0,0,0.03)",t.style.margin="32px auto",t.style.maxWidth="400px";const n=document.createElement("div");n.innerHTML='\n <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="20" cy="20" r="18" stroke="#FF3B3B" stroke-width="3" fill="#fff"/>\n <text x="20" y="27" text-anchor="middle" font-size="24" font-family="Arial, sans-serif" fill="#FF3B3B">!</text>\n </svg>\n ',n.style.marginBottom="12px",t.appendChild(n);const i=document.createElement("div");return i.textContent=e,i.style.fontWeight="bold",i.style.fontSize="20px",i.style.color="#222",i.style.textAlign="center",i.style.marginTop="8px",t.appendChild(i),t}({mainMessage:e}))}else yield u(this,t,"m",n).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),dp=Si((e=>{var t,n,i,r;return r=class extends(mi(op,Jf,Eo,ap,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.tenantAdminLinkSSODriver.href=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),u(this,i,"f").call(this,Qf(this.state)),this.subscribe(u(this,i,"f").bind(this),Qf)}))}},i=new WeakMap,t=new WeakSet,n=function(){this.tenantAdminLinkSSODriver=new Ma((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-link[data-id="tenant-admin-link-sso"]')}),{logger:this.logger})},r}));var lp;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(lp||(lp={}));const cp=Si((e=>{var t,n,i,r,o,s,a,d,l,h,f;return f=class extends(mi(op,Jf,Eo,ap,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,{}),i.set(this,{}),r.set(this,{}),o.set(this,{}),d.set(this,$i((e=>{var n;const i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(i).forEach((n=>{const i=n.getAttribute("data-id").replace("customAttributes.",""),r=n.getAttribute("data-type")||lp.TEXT,o=e[i],s=new qa(n,{logger:this.logger});s.value=((e,t)=>e===lp.DATE&&t?new Date(t).toLocaleString():e===lp.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString())(r,o),u(this,t,"m",l).call(this,n,i,s,r,i),u(this,t,"m",h).call(this,n,i,s)}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),u(this,d,"f").call(this,ep(this.state)),this.subscribe(u(this,d,"f").bind(this),ep)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,d=new WeakMap,t=new WeakSet,s=function(e,t,r){var o,s;const a=ep(this.state)[r],d=t===lp.ARRAY?(a||[]).join(","):a;null===(o=u(this,n,"f")[e])||void 0===o||o.setContent(Ef({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({customAttributes:{[r]:d}})})),null===(s=u(this,i,"f")[e])||void 0===s||s.onSuccess((()=>{var t;null===(t=u(this,n,"f")[e])||void 0===t||t.close(),this.actions.getTenant()}))},a=function(e){var t,n;null===(t=u(this,r,"f")[e])||void 0===t||t.setContent(Ef({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,o,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(this,r,"f")[e])||void 0===t||t.close(),this.actions.getTenant()}))},l=function(e,r,o,a,d){const l=e.getAttribute("edit-flow-id");l&&(u(this,n,"f")[l]||(u(this,n,"f")[l]=this.createModal({"data-id":`edit-${r}`}),u(this,i,"f")[l]=new Oa((()=>{var e,t;return null===(t=null===(e=u(this,n,"f")[l])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,n,"f")[l].beforeOpen=u(this,t,"m",s).bind(this,l,a,d),o.onEditClick((()=>{var e,t;null===(t=null===(e=u(this,n,"f"))||void 0===e?void 0:e[l])||void 0===t||t.open()})),this.syncFlowTheme(u(this,i,"f")[l])))},h=function(e,n,i){const s=e.getAttribute("delete-flow-id");s&&(u(this,r,"f")[s]||(u(this,r,"f")[s]=this.createModal({"data-id":`delete-${n}`}),u(this,o,"f")[s]=new Oa((()=>{var e,t;return null===(t=null===(e=u(this,r,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,r,"f")[s].beforeOpen=u(this,t,"m",a).bind(this,s),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=u(this,r,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),this.syncFlowTheme(u(this,o,"f")[s])))},f})),up=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(op,Jf,Eo,ap,ec,Ha)(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,$i((e=>{this.tenantEmailDomainsDriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,np(this.state)),this.subscribe(u(this,p,"f").bind(this),np)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.tenantEmailDomainsDriver.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({tenantEmailDomains:np(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},d=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-tenant-email-domains"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").beforeOpen=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantEmailDomainsDriver=new qa((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-email-domains-edit"]')}),{logger:this.logger}),this.tenantEmailDomainsDriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),hp=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(op,Jf,Eo,ap,ec,Ha)(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,$i((e=>{this.tenantSSOExclusionsDriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,ip(this.state)),this.subscribe(u(this,p,"f").bind(this),ip)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.tenantSSOExclusionsDriver.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({enforceSSOExclusions:ip(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},d=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").beforeOpen=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantSSOExclusionsDriver=new qa((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-force-sso-exclusions-edit"]')}),{logger:this.logger}),this.tenantSSOExclusionsDriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),fp=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(op,Jf,Eo,ap,ec,Ha)(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,$i((e=>{this.tenantEnforceSSODriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,rp(this.state)),this.subscribe(u(this,p,"f").bind(this),rp)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.tenantEnforceSSODriver.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({enforceSSO:rp(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},d=function(){this.tenantEnforceSSODriver.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").beforeOpen=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantEnforceSSODriver=new qa((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-enforce-sso-edit"]')}),{logger:this.logger}),this.tenantEnforceSSODriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),pp=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(op,Jf,Eo,ap,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,$i((e=>{this.tenantNameDriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this),u(this,a,"f").call(this,tp(this.state)),this.subscribe(u(this,a,"f").bind(this),tp)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.tenantNameDriver.editFlowId&&(h(this,n,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(Ef({projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({tenantName:tp(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},s=function(){this.tenantNameDriver=new qa((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-name-edit"]')}),{logger:this.logger}),this.tenantNameDriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))},d})),gp=Si((e=>{var t,n,i,r,o,s,a;return a=class extends(mi(op,Jf,Eo,ap,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.TenantPasswordPolicyUserAuthMethodDriver.flowId&&(h(this,n,this.createModal({"data-id":"password-policy"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(Ef({projectId:this.projectId,flowId:this.TenantPasswordPolicyUserAuthMethodDriver.flowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},s=function(){this.TenantPasswordPolicyUserAuthMethodDriver=new Ba((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password-policy"]')}),{logger:this.logger}),this.TenantPasswordPolicyUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))},a})),vp=Si((e=>{var t,n,i,r,o,s,a;return a=class extends(mi(op,Jf,Eo,ap,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.TenantSessionSettingsUserAuthMethodDriver.flowId&&(h(this,n,this.createModal({"data-id":"session-settings"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(Ef({projectId:this.projectId,flowId:this.TenantSessionSettingsUserAuthMethodDriver.flowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},s=function(){this.TenantSessionSettingsUserAuthMethodDriver=new Ba((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="session-settings"]')}),{logger:this.logger}),this.TenantSessionSettingsUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))},a})),mp=Si((e=>class extends(mi($a,as,Yf,ap,pp,up,hp,fp,cp,dp,gp,vp)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),yp=mi((e=>class extends(mp(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 ba})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.5.34"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",yp);var bp=Object.freeze({__proto__:null,default:yp}),$p={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 wp(e){return wp="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},wp(e)}function Cp(e){var t=xp();return function(){var n,i=Op(e);if(t){var r=Op(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===wp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return kp(e)}(this,n)}}function kp(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sp(e){var t="function"==typeof Map?new Map:void 0;return Sp=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 Ip(e,arguments,Op(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Rp(i,e)},Sp(e)}function Ip(e,t,n){return Ip=xp()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&Rp(r,n.prototype),r},Ip.apply(null,arguments)}function xp(){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 Rp(e,t){return Rp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Rp(e,t)}function Op(e){return Op=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Op(e)}var Ep=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&&Rp(e,t)}(i,e);var t,n=Cp(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(kp(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(Sp(Error)),Ap=2,Np=17,jp=3,Mp="0-90-9٠-٩۰-۹",Pp="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),Up="++";function Tp(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 Wp={}.constructor;function Lp(e){return null!=e&&e.constructor===Wp}function Dp(e){return Dp="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},Dp(e)}function _p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fp(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 qp=" ext. ",Bp=/^\d+$/,Vp=function(){function e(t){_p(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Lp(e)||!Lp(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(Lp(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Zp(e)+": "+e,"."))}(t),this.metadata=t,Qp.call(this,t)}return Fp(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&&Bp.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Kp(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Kp(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}(),Kp=function(){function e(t,n){_p(this,e),this.globalMetadataObject=n,this.metadata=t,Qp.call(this,n.metadata)}return Fp(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 Hp(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()&&Jp(this.types(),e))return new Gp(Jp(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?qp:this.metadata[13]||qp}}]),e}(),Hp=function(){function e(t,n){_p(this,e),this._format=t,this.metadata=n}return Fp(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()||zp.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),zp=/^\(?\$1\)?$/,Gp=function(){function e(t,n){_p(this,e),this.type=t,this.metadata=n}return Fp(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 Jp(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 Zp=function(e){return Dp(e)};function Yp(e,t){if((t=new Vp(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Xp(e,t){return t.countries.hasOwnProperty(e)}function Qp(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===Tp(t,"1.2.0")?this.v2=!0:-1===Tp(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var eg=function(e){return"([".concat(Mp,"]{1,").concat(e,"})")};function tg(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+eg("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+eg("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+eg("9")+i)+"|"+("[- ]+"+eg("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+eg("15")+i)+"|"+(r+"(?:,)+"+n+eg("9")+i)}var ng="["+Mp+"]{"+Ap+"}",ig="[++]{0,1}(?:["+Pp+"]*["+Mp+"]){3,}["+Pp+Mp+"]*",rg=new RegExp("^[++]{0,1}(?:["+Pp+"]*["+Mp+"]){1,2}$","i"),og=ig+"(?:"+tg()+")?",sg=new RegExp("^"+ng+"$|^"+og+"$","i");var ag=new RegExp("(?:"+tg()+")$","i");function dg(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 lg(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 lg(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 lg(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 cg={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 ug(e){return cg[e]}function hg(e){for(var t,n="",i=dg(e.split(""));!(t=i()).done;){var r=ug(t.value);r&&(n+=r)}return n}function fg(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 pg(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 pg(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 pg(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 gg(e){for(var t,n="",i=fg(e.split(""));!(t=i()).done;){n+=vg(t.value,n)||""}return n}function vg(e,t,n){if("+"===e){if(t)return;return"+"}return ug(e)}function mg(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 yg(e,t){return"IS_POSSIBLE"===mg(e,t)}function bg(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function $g(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 wg(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 wg(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 wg(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 Cg=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function kg(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Vp(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(bg(i,n.nationalNumberPattern())){if(Sg(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Sg(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=$g(Cg);!(r=o()).done;){var s=r.value;if(Sg(i,s,n))return s}}}}function Sg(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&bg(e,t.pattern()))}function Ig(e,t,n){var i=new Vp(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new Vp(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function xg(e){return e.replace(new RegExp("[".concat(Pp,"]+"),"g")," ").trim()}var Rg=/(\$\d)/;function Og(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(Rg,t.nationalPrefixFormattingRule()):t.format());return i?xg(o):o}var Eg=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Ag(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 Ng(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 Ng(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 Ng(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 jg(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 Mg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jg(Object(n),!0).forEach((function(t){Pg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jg(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ug={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function Tg(e,t,n,i){if(n=n?Mg(Mg({},Ug),n):Ug,i=new Vp(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?Dg(r=Wg(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=Wg(s,null,"INTERNATIONAL",i,n),Dg(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=Yp(i,r.metadata);if(o===n){var s=Wg(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new Vp(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():Eg.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(Wg(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return Dg(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function Wg(e,t,n,i,r){var o=Lg(i.formats(),e);return o?Og(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function Lg(e,t){for(var n,i=Ag(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(bg(t,r.pattern()))return r}}function Dg(e,t,n,i){return t?i(e,t,n):e}function _g(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 Fg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_g(Object(n),!0).forEach((function(t){qg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function qg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bg(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 Vg=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 Vp(t);Kg(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 Bg(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Ig(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Vp(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 yg(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 Vp(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==kg(e,t,n.metadata):bg(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Vp(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return kg(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Tg(this,e,t?Fg(Fg({},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}(),Kg=function(e){return/^[A-Z]{2}$/.test(e)};var Hg=new RegExp("(["+Mp+"])");function zg(e,t,n,i){if(t){var r=new Vp(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(Hg);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function Gg(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 Jg(e,t){var n=Gg(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(bg(e,n.nationalNumberPattern())&&!bg(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(mg(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function Zg(e,t,n,i){var r=t?Yp(t,i):n;if(0===e.indexOf(r)){(i=new Vp(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=Jg(o,i).nationalNumber,a=Jg(e,i).nationalNumber;if(!bg(a,i.nationalNumberPattern())&&bg(s,i.nationalNumberPattern())||"TOO_LONG"===mg(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function Yg(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=zg(e,t,n,i);if(!o||o===e){if(t||n){var s=Zg(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 Vp(i);for(var l=2;l-1<=jp&&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 Xg(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 Qg(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 Qg(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 Qg(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 ev(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new Vp(i);for(var r,o=Xg(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(kg({phone:e,country:s},void 0,i.metadata))return s}}function tv(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:ev(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var nv="+",iv="(["+Mp+"]|[\\-\\.\\(\\)]?)",rv=new RegExp("^\\"+nv+iv+"*["+Mp+"]"+iv+"*$","g"),ov=new RegExp("^("+("["+Mp+"]+((\\-)*["+Mp+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Mp+"])*")+"\\.?$","g"),sv="tel:",av=";phone-context=",dv=";isub=";function lv(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(av);if(t<0)return null;var n=t+av.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&&(rv.test(e)||ov.test(e))}(r))throw new Ep("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===nv&&(n+=r);var o,s=e.indexOf(sv);o=s>=0?s+sv.length:0;var a=e.indexOf(av);n+=e.substring(o,a)}var d=n.indexOf(dv);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var cv=250,uv=new RegExp("[++"+Mp+"]"),hv=new RegExp("[^"+Mp+"#]+$");function fv(e,t,n){if(t=t||{},n=new Vp(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Ep("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=lv(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>cv){if(n)throw new Ep("TOO_LONG");return}if(!1===t)return e;var i=e.search(uv);if(i<0)return;return e.slice(i).replace(hv,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=Ap&&sg.test(e)}(i))return function(e){return rg.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(ag);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(ag),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 Ep("TOO_SHORT");throw new Ep("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=Yg(gg(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||Yp(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=Jg(gg(d),i),c=l.nationalNumber,u=l.carrierCode,h=tv(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 Ep("INVALID_COUNTRY");return{}}if(!l||l.length<Ap){if(t.v2)throw new Ep("TOO_SHORT");return{}}if(l.length>Np){if(t.v2)throw new Ep("TOO_LONG");return{}}if(t.v2){var f=new Vg(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)&&bg(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!yg(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 pv(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 gv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pv(Object(n),!0).forEach((function(t){vv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mv(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 yv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bv(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 $v(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 $v(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 $v(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 wv(e){var t,n,i,r=bv(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(!Lp(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?mv(Object(n),!0).forEach((function(t){yv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mv(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 Cv(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 kv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cv(Object(n),!0).forEach((function(t){Sv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Iv(e,t,n){t&&t.defaultCountry&&!Xp(t.defaultCountry,n)&&(t=kv(kv({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return fv(e,gv(gv({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Ep))throw e}}function xv(){var e=wv(arguments);return Iv(e.text,e.options,e.metadata)}function Rv(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 Ov(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ev=Rv((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;Ov(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),Av=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Ov(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return Rv(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Ev(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Ev(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 Nv(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 jv=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 Av(t)}return Nv(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 Mv(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function Pv(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var Uv=" - \u2028\u2029 ",Tv="[".concat(Uv,"]"),Wv="[^".concat(Uv,"]"),Lv="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),Dv="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",_v="[".concat(Dv,"]"),Fv=new RegExp(_v),qv="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),Bv=new RegExp(qv),Vv="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),Kv=new RegExp(Vv),Hv=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function zv(e){return!(!Fv.test(e)&&!Kv.test(e))&&Hv.test(e)}function Gv(e){return"%"===e||Bv.test(e)}function Jv(e,t,n){var i=!0,r=xv(e,n);if(r||(i=!1,r=xv(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 Zv={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()||!Yv(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!Yv(e,n,r)||Qv(e,n)||!Xv(e,{defaultCountry:i,metadata:r}))&&em()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!Yv(e,n,r)||Qv(e,n)||!Xv(e,{defaultCountry:i,metadata:r}))&&em()}};function Yv(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"!==Jv(t.substring(i),e,n))return!1}else{var s=hg(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function Xv(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new Vp(i);r.selectNumberingPlan(e.countryCallingCode),e.country||tv(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=Lg(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function Qv(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)||hg(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function em(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var tm=/[\\/] *x/;function nm(e){return Pv(tm,e)}var im=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,rm=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,om=/^:[0-5]\d/;function sm(e,t,n){if(im.test(e))return!1;if(rm.test(e)){var i=n.slice(t+e.length);if(om.test(i))return!1}return!0}var am="(\\[([",dm=")\\])]",lm="[^".concat(am).concat(dm,"]"),cm="[".concat(am).concat(Up,"]"),um=new RegExp("^"+cm),hm=Mv(0,3),fm=new RegExp("^(?:[(\\[([])?(?:"+lm+"+["+dm+"])?"+lm+"+(?:["+am+"]"+lm+"+["+dm+"])"+hm+lm+"*$"),pm=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function gm(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 vm(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 vm(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 vm(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 mm(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 ym=tg(),bm=["\\/+(.*)/","(\\([^(]*)","(?:".concat(Tv,"-|-").concat(Tv,")").concat(Tv,"*(.+)"),"[‒-―-]".concat(Tv,"*(.+)"),"\\.+".concat(Tv,"*([^.]+)"),"".concat(Tv,"+(").concat(Wv,"+)")],$m=Mv(0,2),wm=Mv(0,4),Cm=Np+jp,km=Mv(0,Cm),Sm="[".concat(Pp,"]")+wm,Im=Lv+Mv(1,Cm),xm="(?:"+cm+Sm+")"+$m+Im+"(?:"+Sm+Im+")"+km+"(?:"+ym+")?",Rm=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(Dv,"#]+$")),Om=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Em=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&&Xp(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Om}).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=Zv[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(xm,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new jv(32)}return mm(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(sm(t=nm(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=gm(bm);!(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=Pv(Rm,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=Pv(Rm,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(fm.test(e)&&!pm.test(e)){if("POSSIBLE"!==i){if(t>0&&!um.test(e)){var r=n[t-1];if(Gv(r)||zv(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(Gv(s)||zv(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=xv(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 Am(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 Nm=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 Am(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 jm(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 Mm(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 Mm(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 Mm(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 Pm="x",Um=new RegExp(Pm);function Tm(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function Wm(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 Lm(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=Dm(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return Dm(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function Dm(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Og(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 hg(e)===t.getNationalDigits()}(s,e))return s}function _m(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 Fm=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return _m(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([Km(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(Vm);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(Km(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(Km(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:qm(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(Bm.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function qm(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 Bm=/[\(\)\[\]\?\:\|]/,Vm=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Km(e){return 1===e.length?e[0]:e}function Hm(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 zm(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 zm(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 zm(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 Gm(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 Jm=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 Fm).parse(t)}return Gm(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=Zm(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function Zm(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=Zm(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=Hm(t.args);!(d=l()).done;){var c=Zm(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=Hm(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 Ym(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 Xm(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 Xm(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 Xm(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 Qm(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 ey=Tm("9",15),ty=/[- ]/,ny=new RegExp("["+Pp+"]*\\$1["+Pp+"]*(\\$\\d["+Pp+"]*)*$"),iy=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 Qm(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"===mg(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=Ym(this.matchingFormats);!(i=r()).done;){var o=i.value,s=Lm(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,Pm),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(Pm),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 Jm(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":ny.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=Ym(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()&&ty.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(Pm,t+1),n++;return Wm(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,Pm)+Tm(Pm,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=ey.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(Rg,e.nationalPrefixFormattingRule());if(hg(e.nationalPrefixFormattingRule())===(r||"")+hg("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,Pm),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),Pm);return c||(o?p=Tm(Pm,o.length)+" "+p:r&&(p=Tm(Pm,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=xg(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=jm(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(Um)<0)return;t=e.search(Um),e=e.replace(Um,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Wm(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 ry(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 oy(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 oy(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 oy(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 sy(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 ay=new RegExp("^"+("["+Pp+Mp+"]+")+"$","i"),dy="(?:[++]["+Pp+Mp+"]*|["+Pp+Mp+"]+)",ly=new RegExp("[^"+Pp+Mp+"]+.*$"),cy=/[^\d\[\]]/,uy=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 sy(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(dy);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(ly,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=ry(t,2),i=n[0],r=n[1];ay.test(i)||(i="");return[i,r]}(e),r=ry(i,2),o=r[0],s=r[1],a=hg(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=Yg("+"+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&&cy.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=Gg(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=Gg(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=zg(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=Zg(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 hy(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 fy(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 fy(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 fy(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 py(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 gy,vy=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 Vp(n);var i=hy(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return py(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(Lp(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 Nm({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 iy({state:this.state,metadata:this.metadata}),this.parser=new uy({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,Pm)}},{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(tv(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 Vp(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=ev(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new Vg(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 my(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push($p),e.apply(this,n)}(xv,arguments)}function yy(e,t){return Em.call(this,e,t,$p)}function by(e){return vy.call(this,e,$p)}function $y(){return Vp.call(this,$p)}yy.prototype=Object.create(Em.prototype,{}),yy.prototype.constructor=yy,by.prototype=Object.create(vy.prototype,{}),by.prototype.constructor=by,$y.prototype=Object.create(Vp.prototype,{}),$y.prototype.constructor=$y,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"}(gy||(gy={}));const wy=(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)}),{}),Cy=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),ky=(e,t)=>e===gy.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t,Sy=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),n)})),t};function Iy(e){return new URLSearchParams(window.location.search).get(e)}const xy={enabled:"active",disabled:"disabled",invited:"invited"},Ry=e=>e.tenantRoles.data,Oy=e=>e.selectedUsersLoginIds,Ey=e=>e.notifications,Ay=e=>e.customAttributes.data,Ny=cl(Ay,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),jy=cl((e=>e.usersList.data),Ny,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes).map((([e,n])=>[e,ky(t[e],n)])))}))))),My=cl(jy,(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Cy(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:xy[e.status]||e.status,roles:e.roleNames}))))),Py=cl(Oy,My,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Uy=cl(Py,(e=>e.map((e=>e.userId)))),Ty=cl(Py,(e=>e.map((({userId:e,loginIds:t})=>({userId:e,loginIds:t}))))),Wy=cl(Py,(e=>e.map((e=>({userId:e.userId,roles:e.roles}))))),Ly=cl(Py,(e=>e.map((e=>e.status)))),Dy=cl(Py,(e=>e.every((e=>e.editable)))),_y=cl(Oy,(e=>!!e.length)),Fy=cl(Oy,(e=>1===e.length)),qy=cl(Oy,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),By=cl(Fy,Ly,((e,t)=>e&&t.every((e=>e===xy.enabled)))),Vy=cl(Ly,(e=>e.every((e=>e===xy.disabled)))),Ky=cl(Py,(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`})),Hy=cl(Fy,Vy,Dy,((e,t,n)=>e&&t&&n)),zy=cl(Fy,By,Dy,((e,t,n)=>e&&t&&n)),Gy=cl(Fy,Dy,((e,t)=>e&&t)),Jy=cl(Fy,Dy,((e,t)=>e&&t)),Zy=cl(Fy,Dy,((e,t)=>e&&t)),Yy=_y,Xy=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)}))}))},Qy=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}}),eb=({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)})}}),tb=Bl("users/create",((e,{extra:{api:t}})=>t.user.create(e))),nb=Xy(tb)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},Qy((e=>e.createUser)),eb({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>`}})),ib={action:tb,reducer:nb},rb=Bl("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),ob=Xy(rb)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Qy((e=>e.deleteUser)),eb({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to delete user${["","s"]}`})),sb={action:rb,reducer:ob},ab=Bl("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),db=Xy(ab)(Qy((e=>e.setTempUserPassword)),eb({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>`}})),lb={action:ab,reducer:db},cb=Bl("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),ub=Xy(cb)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Qy((e=>e.customAttributes))),hb={action:cb,reducer:ub},fb=Bl("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),pb=Xy(fb)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Qy((e=>e.usersList))),gb={action:fb,reducer:pb},vb=Bl("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),mb=Xy(vb)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Qy((e=>e.tenantRoles))),yb={action:vb,reducer:mb},bb=Bl("users/update",((e,{extra:{api:t}})=>t.user.update(e))),$b=Xy(bb)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>bi(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Qy((e=>e.updateUser)),eb({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>`}})),wb={action:bb,reducer:$b},Cb=Bl("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),kb=Xy(Cb)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return bi(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)}},Qy((e=>e.enableUser)),eb({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>`}})),Sb={action:Cb,reducer:kb},Ib=Bl("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),xb=Xy(Ib)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return bi(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)}},Qy((e=>e.disableUser)),eb({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>`}})),Rb={action:Ib,reducer:xb},Ob=Bl("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Eb={action:Ob,reducer:Xy(Ob)(Qy((e=>e.removePasskey)),eb({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>`}}))},Ab={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:[]},Nb="/v1/mgmt/user/search",jb="/v1/mgmt/user/delete/batch",Mb="/v1/mgmt/user/create",Pb="/v1/mgmt/user/patch",Ub="/v1/mgmt/user/update/status",Tb="/v1/mgmt/user/password/set/temporary",Wb="/v1/mgmt/user/passkeys/delete",Lb="/v1/mgmt/user/customattributes",Db="/v1/mgmt/role/all",_b=e=>c(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)})),Fb=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:u}={}){if(n)return(e=>c(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:e%3==0,OIDC:e%3==1,SCIM:e%3==2,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>((e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof t){const i=e?1:0,r=t?1:0;return n?i-r:r-i}const i=(null==e?void 0:e.toString())||"",r=(null==t?void 0:t.toString())||"";return n?r.localeCompare(i):i.localeCompare(r)})(t[e.field],n[e.field],e.desc)))})),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:l,sort:u});const h=yield e.post(Nb,{limit:r,page:i,withTestUser:!1,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:u},{queryParams:{tenant:t}});return yield _b(h),(yield h.json()).users})),deleteBatch:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(jb,{userIds:i},{queryParams:{tenant:t}});return yield _b(r),r.json()})),create:i=>c(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:b,invite:$}){if(n)return(e=>c(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,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:b,invite:$});const w=yield e.post(Mb,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:b,invite:$},{queryParams:{tenant:t}});return yield _b(w),(yield w.json()).user})),update:i=>c(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v}){if(n)return(e=>c(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,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v});const m=yield e.patch(Pb,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v},{queryParams:{tenant:t}});return yield _b(m),(yield m.json()).user})),enable:i=>c(void 0,void 0,void 0,(function*(){if(n)return(e=>c(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(i);const r=yield e.post(Ub,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield _b(r),r.json()})),disable:i=>c(void 0,void 0,void 0,(function*(){if(n)return(e=>c(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(i);const r=yield e.post(Ub,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield _b(r),r.json()})),removePasskey:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Wb,{loginId:i},{queryParams:{tenant:t}});return yield _b(r),r.json()})),setTempPassword:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(Tb,{loginId:i},{queryParams:{tenant:t}});return yield _b(r),r.json()})),getCustomAttributes:()=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const i=yield e.get(Lb,{queryParams:{tenant:t}});return yield _b(i),(yield i.json()).data}))}),qb=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>c(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(Db,{queryParams:{tenant:t}});return yield _b(i),i.json()}))}),Bb=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,Do,ec,Wo({tenant:Wo.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 styleId(){return this.getAttribute("style-id")||os}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.11.23"}}));return{user:Fb({httpClient:r.httpClient,tenant:t,mock:n}),tenant:qb({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})),Vb=Si((e=>{const t=mi(Xl({name:"widget",initialState:Ab,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{ib.reducer(e),wb.reducer(e),Sb.reducer(e),Rb.reducer(e),sb.reducer(e),gb.reducer(e),lb.reducer(e),Eb.reducer(e),hb.reducer(e),yb.reducer(e)},asyncActions:{searchUsers:gb.action,createUser:ib.action,updateUser:wb.action,enableUser:Sb.action,disableUser:Rb.action,deleteUsers:sb.action,removePasskey:Eb.action,getCustomAttributes:hb.action,getTenantRoles:yb.action,setTempUserPassword:lb.action}}),Uo,Eo,Bb)(e);return class extends t{constructor(...e){super(...e),this.state=Ab,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Kb=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Hb=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Uo,Xo,rs,Kb,Vb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),zb=Si((e=>{var t,n,i,r,o,s;return s=class extends(mi(Vb,Ha,Ql,Eo,Hb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>c(this,void 0,void 0,(function*(){yield u(this,n,"f").setData(Ry(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){return c(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(yi(yield this.fetchWidgetPage("create-user-modal.html"))),new Ra((()=>{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 Ra((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(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({},wy(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),h(this,n,new Ta((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),u(this,o,"f").call(this),this.createUserModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){yield u(this,o,"f").call(this),u(this,t,"m",r).call(this)}))}))},r=function(){const e=Ay(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})),Gb=Si((e=>{var t,n,i;return i=class extends(mi(Eo,zb,Hb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Ra(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})),Jb=Si((e=>{var t,n,i;return i=class extends(mi(Vb,Ha,Eo,Hb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(yi(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Ra((()=>{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 Ra((()=>{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=Uy(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new _a(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Ky(this.state);i.text=`Delete ${e}?`}}))},i})),Zb=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb,Jb)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Yy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ra(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})),Yb=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Vb,Ha,Eo,Ql,Hb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ra((()=>{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 Ra((()=>{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=qy(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){return c(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(yi(yield this.fetchWidgetPage("disable-user-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new _a(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Ky(this.state);r.text=`Disable ${e}?`}))}))},o})),Xb=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb,Yb,Ql)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),zy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Ra(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})),Qb=e=>{if(!e)return e;const t=my(e.startsWith("+")?e:`+${e}`);if(!t)return e;const n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return(null==t?void 0:t.number.replace(n,"$1-$2"))||e},e$=Si((e=>{var t,n,i,r,o,s,a,d,f,p;return p=class extends(mi(Vb,Ha,Eo,Ql,Hb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),s.set(this,(()=>c(this,void 0,void 0,(function*(){yield u(this,i,"f").setData(Ry(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=Py(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:Qb(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},Cy(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",f).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){new Ra((()=>{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 Ra((()=>{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=l(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},wy(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=Ay(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 c(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(yi(yield this.fetchWidgetPage("edit-user-modal.html"))),u(this,t,"m",r).call(this),u(this,t,"m",o).call(this),h(this,n,new Fa(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),h(this,i,new Ta((()=>{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=()=>c(this,void 0,void 0,(function*(){yield u(this,s,"f").call(this),u(this,n,"f").disable(),u(this,d,"f").call(this),u(this,t,"m",a).call(this)}))}))},p})),t$=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb,e$,Ql)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Gy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ra(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})),n$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Vb,Ha,Eo,Ql,Hb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ra((()=>{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 Ra((()=>{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=qy(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){return c(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(yi(yield this.fetchWidgetPage("enable-user-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new _a(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Ky(this.state);r.text=`Activate ${e}?`}))}))},o})),i$=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb,n$,Ql)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Hy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Ra(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})),r$=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Fa(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f"))},r})),o$={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},s$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Eo,Vb,Ga,Uo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),Ey)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=o$[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})),a$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Vb,Ha,Eo,Ql,Hb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ra((()=>{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 Ra((()=>{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=qy(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){return c(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(yi(yield this.fetchWidgetPage("remove-passkey-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new _a(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Ky(this.state);r.text=`Remove passkey for ${e}?`}))}))},o})),d$=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb,a$,Ql)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Jy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Ra(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})),l$=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(Vb,Eo,Hb)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{this.usersTable.data=e}))),o.set(this,ki(((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,$i((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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this),u(this,r,"f").call(this,My(this.state)),u(this,s,"f").call(this,Ay(this.state)),this.subscribe(u(this,s,"f").bind(this),Ay),this.subscribe(u(this,r,"f").bind(this),My)}))}},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 ja(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(u(this,t,"m",a).bind(this)),u(this,t,"m",n).call(this),u(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{u(this,o,"f").call(this,e.target,e.detail)}))}))},d})),c$=Si((e=>{var t,n,i;return i=class extends(mi(Vb,Ha,Eo,Ql,Hb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(yi(yield this.fetchWidgetPage("generated-password-modal.html"))),new Ra((()=>{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})),u$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Vb,Ha,Eo,Ql,Hb,c$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Ra((()=>{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 Ra((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(this,void 0,void 0,(function*(){var e;const t=qy(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 c(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(yi(yield this.fetchWidgetPage("reset-password-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new _a(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Ky(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},o})),h$=Si((e=>{var t,n,i,r;return r=class extends(mi(Eo,Hb,Vb,u$,Ql)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Zy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Ra(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})),f$=Si((e=>class extends(mi(as,To)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),p$=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v,m;return m=class extends(mi(f$,Vb,Ha,Eo,Ql,Hb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,[]),o.set(this,null),s.set(this,null),v.set(this,$i((e=>{u(this,r,"f").forEach((t=>{"onlyOne"===t.enableMode&&1===e.length||"oneOrMore"===t.enableMode&&e.length>0||"always"===t.enableMode?t.enable():t.disable()}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",l).call(this),u(this,t,"m",d).call(this),u(this,v,"f").call(this,Oy(this.state))}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,v=new WeakMap,t=new WeakSet,a=function(e){const n=new Ea(e,{logger:this.logger});n.onClick((()=>{u(this,t,"m",g).call(this,n.flowId)})),this.subscribe(u(this,v,"f").bind(this),Oy),u(this,r,"f").push(n)},d=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{u(this,t,"m",a).call(this,e)}))},l=function(){h(this,n,this.createModal({"data-id":"generic-flow-modal"}),"f"),u(this,n,"f").afterClose=()=>{var e;u(this,o,"f")&&(null===(e=u(this,s,"f"))||void 0===e||e.call(this),h(this,o,null,"f"))},h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(u(this,i,"f"))},f=function(){var e;u(this,n,"f").open(),null===(e=u(this,s,"f"))||void 0===e||e.call(this)},p=function(e,n){n=()=>u(this,t,"m",f).call(this),h(this,s,u(this,i,"f").onPageUpdated(n),"f")},g=function(e){u(this,n,"f").setContent(Sy({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,client:JSON.stringify({userIds:Uy(this.state),loginIds:Ty(this.state),usersAndRoles:Wy(this.state)}),tenant:this.tenantId})),u(this,t,"m",p).call(this,u(this,n,"f"),u(this,o,"f")),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.searchUsers()}))},m})),g$="widget-flow",v$=Si((e=>{var t,n,i;return i=class extends(mi(Uo,Ha,Vb,ec,Eo,as)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=Iy(g$);r&&(function(e){if(window.history.replaceState&&Iy(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())}}(g$),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Sy({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Oa((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close()})),t.afterClose=()=>{t.remove()},t.open()},i})),m$=Si((e=>class extends(mi($a,as,v$,l$,Gb,Zb,t$,i$,Xb,h$,d$,r$,s$,p$)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),y$=mi((e=>class extends(m$(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 ba})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.11.23"}}}))}}))(HTMLElement);customElements.define("descope-user-management-widget",y$);var b$=Object.freeze({__proto__:null,default:y$});const $$=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),(e=>"string"==typeof e?e:(e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype)(e)?JSON.stringify(e):"")(n))})),t};function w$(e){return new URLSearchParams(window.location.search).get(e)}const C$=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)}))}))},k$=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}}),S$=Bl("users/me",((e,{extra:{api:t}})=>t.user.me())),I$=C$(S$)({onFulfilled:(e,t)=>{e.me.data=t.payload}},k$((e=>e.me))),x$={action:S$,reducer:I$},R$=Bl("users/devices",((e,{extra:{api:t}})=>t.device.devices(e))),O$=C$(R$)({onFulfilled:(e,t)=>{e.devices.data=t.payload.devices}},k$((e=>e.devices))),E$={action:R$,reducer:O$},A$=Bl("users/logout",((e,{extra:{api:t}})=>t.user.logout())),N$={action:A$,reducer:C$(A$)({})},j$=e=>{if(!e)return null;const t=(e=>{try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(n)}catch(e){return null}})(e);return(null==t?void 0:t.dct)||null},M$=e=>e.me.data,P$=cl(M$,(e=>e.userId)),U$=cl(M$,(e=>e.picture)),T$=cl(M$,(e=>e.email)),W$=cl(M$,(e=>e.verifiedEmail)),L$=cl(M$,(e=>e.name)),D$=cl(M$,(e=>e.phone)),_$=cl(M$,(e=>e.verifiedPhone)),F$=cl(T$,W$,((e,t)=>e&&""!==e.trim()&&!t?"Unverified":"")),q$=cl(D$,_$,((e,t)=>e&&""!==e.trim()&&!t?"Unverified":"")),B$=cl(M$,(e=>e.webauthn));cl(M$,(e=>e.password));const V$=cl(M$,(e=>e.TOTP)),K$=cl(M$,(e=>e.customAttributes)),H$=cl(M$,(e=>({givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}))),z$=cl((e=>e.devices.data),(e=>e.map((({id:e,name:t,deviceType:n,lastLoginTime:i,isCurrentDevice:r})=>({id:e,name:t,deviceType:n,lastLoginDate:1e3*parseInt(i,10),isCurrent:r}))))),G$=e=>e.notifications,J$=cl(M$,(e=>e.userTenants||[])),Z$=e=>e.tenant.currentTenantId,Y$=Bl("tenant/select",((e,t)=>c(void 0,[e,t],void 0,(function*(e,{extra:{api:t},getState:n}){if(e===Z$(n()))return null;const i=yield t.user.setCurrentTenant(e),r=i.sessionJwt||i.sessionToken;try{return{tenantId:j$(r)}}catch(e){return console.error("Failed to switch tenant:",e),null}})))),X$={action:Y$,reducer:C$(Y$)({onPending:e=>{e.tenant.previousTenantId=e.tenant.currentTenantId},onFulfilled:(e,t)=>{var n;e.tenant.currentTenantId=null===(n=t.payload)||void 0===n?void 0:n.tenantId,e.tenant.previousTenantId=null},onRejected:e=>{e.tenant.currentTenantId=e.tenant.previousTenantId,e.tenant.previousTenantId=null}},k$((e=>e.selectTenant)),(({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{if(t){const i=t(n);i&&e.notifications.push({type:"success",msg:i})}},onRejected:(t,n)=>{if(e){const i=e(n);i&&t.notifications.push({type:"error",msg:i})}}}))({getErrorMsg:e=>{var t,n;const i=(null===(t=e.error)||void 0===t?void 0:t.message)||"";return"Error"===(null===(n=e.error)||void 0===n?void 0:n.name)?i:`${i||"Error"}`}}))},Q$={me:{loading:!1,error:null,data:{}},devices:{loading:!1,error:null,data:[]},tenant:{currentTenantId:null,previousTenantId:null},selectTenant:{loading:!1,error:null},notifications:[]},ew="/v1/auth/me",tw="/v1/mgmt/user/trusteddevices/list",nw="/v1/auth/tenant/select",iw=e=>c(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)})),rw=[{tenantName:"Tenant 1",tenantId:"tn1",roleNames:["Role"]},{tenantName:"Tenant 2",tenantId:"tn2",roleNames:["Role"]}],ow=({httpClient:e,mock:t})=>({me:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(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:rw,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(ew);return yield iw(n),n.json()})),setCurrentTenant:t=>c(void 0,void 0,void 0,(function*(){const n=yield e.post(nw,{tenant:t});return yield iw(n),n.json()}))}),sw=({httpClient:e,mock:t})=>({devices:n=>c(void 0,[n],void 0,(function*({userId:n}){if(t)return{devices:[{id:"device-id-1",name:"Device 1",deviceType:"desktop",lastLoginDate:17359776e5,isCurrent:!1},{id:"device-id-2",name:"Device 2",deviceType:"mobile",lastLoginDate:17387505e5,isCurrentDevice:!0},{id:"device-id-3",name:"Device 3",deviceType:"tablet",lastLoginDate:17412642e5,isCurrent:!1},{id:"device-id-4",name:"Device 4",deviceType:"unknown",lastLoginDate:17440371e5,isCurrent:!1},{id:"device-id-5",name:"Device 5",deviceType:"desktop",lastLoginDate:174672e7,isCurrent:!1}]};const i=yield e.post(tw,{identifiers:[n]});return yield iw(i),i.json()}))}),aw=Si((e=>{var t,n,i,r;const o=mi(Lo,To,Eo,Do,ec)(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 styleId(){return this.getAttribute("style-id")||os}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n)=>{const i=di(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.9.18"}}));return{user:Object.assign(Object.assign({},ow({httpClient:i.httpClient,mock:t})),{logout:t?()=>c(void 0,void 0,void 0,(function*(){})):i.logout}),device:Object.assign({},sw({httpClient:i.httpClient,mock:t}))}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),dw=Si((e=>{const t=mi(Xl({name:"widget",initialState:Q$,reducers:{clearNotifications:e=>{e.notifications=[]},setCurrentTenantId:(e,{payload:t})=>{e.tenant.currentTenantId=t}},extraReducers:e=>{x$.reducer(e),E$.reducer(e),N$.reducer(e),X$.reducer(e)},asyncActions:{getMe:x$.action,listDevices:E$.action,logout:N$.action,selectTenant:X$.action}}),Uo,Eo,aw)(e);return class extends t{constructor(...e){super(...e),this.state=Q$,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),lw="widget-flow",cw=Si((e=>{var t,n,i;return i=class extends(mi(Uo,Ha,dw,ec,Eo,as)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=w$(lw);r&&(function(e){if(window.history.replaceState&&w$(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())}}(lw),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent($$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Oa((()=>{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})),uw=Si((e=>{const t=mi(qo,Wo({"widget-id":Wo.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),hw=Si((e=>{var t,n,i;return i=class extends(mi(Eo,Uo,Xo,rs,uw,dw)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield this.actions.getMe(),yield u(this,t,"m",n).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),fw=Si((e=>class extends(mi(as,To)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),pw=Si((e=>{var t,n,i,r,o,s,a,d,l;return l=class extends(mi(fw,as,dw,Eo,ec,hw,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,$i((e=>{this.avatar.image=e}))),d.set(this,$i((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this),u(this,a,"f").call(this,U$(this.state)),u(this,d,"f").call(this,L$(this.state)),this.subscribe(u(this,a,"f").bind(this),U$),this.subscribe(u(this,d,"f").bind(this),L$)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){this.avatar.flowId&&(h(this,n,this.createModal({"data-id":"update-pic"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new xa((()=>{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=u(this,n,"f"))||void 0===e||e.open()}))},l})),gw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v;return v=class extends(mi(fw,dw,Eo,hw,ec,Ha)(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,$i((e=>{this.emailUserAttr.value=e}))),g.set(this,$i((e=>{this.emailUserAttr.badgeLabel=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,T$(this.state)),u(this,g,"f").call(this,F$(this.state)),this.subscribe(u(this,p,"f").bind(this),T$),this.subscribe(u(this,g,"f").bind(this),F$)}))}},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&&(h(this,n,this.createModal({"data-id":"edit-email"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.emailUserAttr.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-email"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent($$({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr=new qa((()=>{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=u(this,n,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},v})),vw=Si((e=>{var t,n,i;return i=class extends(mi(dw,Eo,hw,Ha)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Ra((()=>{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((()=>c(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},i})),mw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(fw,dw,Eo,hw,ec,Ha)(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,$i((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,L$(this.state)),this.subscribe(u(this,p,"f").bind(this),L$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.nameUserAttr.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-name"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.nameUserAttr.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-name"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent($$({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr=new qa((()=>{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=u(this,n,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),yw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(fw,dw,Eo,hw,ec,Ha)(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,$i((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,B$(this.state)),this.subscribe(u(this,p,"f").bind(this),B$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.passkeyUserAuthMethod.flowId&&(h(this,n,this.createModal({"data-id":"add-passkey"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.passkeyUserAuthMethod.fulfilledFlowId&&(h(this,r,this.createModal({"data-id":"remove-passkey"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent($$({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.passkeyUserAuthMethod=new Ba((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.passkeyUserAuthMethod.onFulfilledButtonClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),bw=Si((e=>{var t,n,i,r,o,s;return s=class extends(mi(fw,dw,Eo,hw,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new Ba((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.initPasswordAuthMethod(),u(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.passwordUserAuthMethod.flowId&&(h(this,n,this.createModal({"data-id":"password"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close()}))},s})),$w=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v;return v=class extends(mi(fw,dw,Eo,hw,ec,Ha)(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,$i((e=>{this.phoneUserAttr.value=e}))),g.set(this,$i((e=>{this.phoneUserAttr.badgeLabel=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,D$(this.state)),u(this,g,"f").call(this,q$(this.state)),this.subscribe(u(this,p,"f").bind(this),D$),this.subscribe(u(this,g,"f").bind(this),q$)}))}},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&&(h(this,n,this.createModal({"data-id":"edit-phone"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.phoneUserAttr.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-phone"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent($$({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr=new qa((()=>{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=u(this,n,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},v})),ww=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(fw,dw,Eo,hw,ec,Ha)(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,$i((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,V$(this.state)),this.subscribe(u(this,p,"f").bind(this),V$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.totpUserAuthMethod.flowId&&(h(this,n,this.createModal({"data-id":"totp"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.totpUserAuthMethod.fulfilledFlowId&&(h(this,r,this.createModal({"data-id":"remove-totp"}),"f"),h(this,o,new Oa((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent($$({projectId:this.projectId,flowId:this.totpUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.totpUserAuthMethod=new Ba((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.totpUserAuthMethod.onFulfilledButtonClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),Cw=Si((e=>{var t,n,i,r,o,s,a,d,l,h,f;return f=class extends(mi(fw,dw,Eo,hw,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,{}),i.set(this,{}),r.set(this,{}),o.set(this,{}),d.set(this,$i((e=>{var n;const i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelectorAll('descope-user-attribute[data-id^="builtin."]');Array.from(i).forEach((n=>{const i=n.getAttribute("data-id").replace("builtin.",""),r=e[i],o=new qa(n,{logger:this.logger});o.value=(r||"").toString(),u(this,t,"m",l).call(this,n,i,o),u(this,t,"m",h).call(this,n,i,o)}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),u(this,d,"f").call(this,H$(this.state)),this.subscribe(u(this,d,"f").bind(this),H$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,d=new WeakMap,t=new WeakSet,s=function(e){var t,r;null===(t=u(this,n,"f")[e])||void 0===t||t.setContent($$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(r=u(this,i,"f")[e])||void 0===r||r.onSuccess((()=>{var t;null===(t=u(this,n,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},a=function(e){var t,n;null===(t=u(this,r,"f")[e])||void 0===t||t.setContent($$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,o,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(this,r,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},l=function(e,r,o){const a=e.getAttribute("edit-flow-id");a&&(u(this,n,"f")[a]=this.createModal({"data-id":`edit-${r}`}),u(this,i,"f")[a]=new Oa((()=>{var e,t;return null===(t=null===(e=u(this,n,"f")[a])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,n,"f")[a].afterClose=u(this,t,"m",s).bind(this,a),o.onEditClick((()=>{var e,t;null===(t=null===(e=u(this,n,"f"))||void 0===e?void 0:e[a])||void 0===t||t.open()})),u(this,t,"m",s).call(this,a),this.syncFlowTheme(u(this,i,"f")[a]))},h=function(e,n,i){const s=e.getAttribute("delete-flow-id");s&&(u(this,r,"f")[s]=this.createModal({"data-id":`delete-${n}`}),u(this,o,"f")[s]=new Oa((()=>{var e,t;return null===(t=null===(e=u(this,r,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,r,"f")[s].afterClose=u(this,t,"m",a).bind(this,s),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=u(this,r,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),u(this,t,"m",a).call(this,s),this.syncFlowTheme(u(this,o,"f")[s]))},f}));var kw;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(kw||(kw={}));const Sw=Si((e=>{var t,n,i,r,o,s,a,d,l,h,f;return n=class extends(mi(fw,dw,Eo,hw,ec,Ha)(e)){constructor(){super(...arguments),t.add(this),i.set(this,{}),r.set(this,{}),o.set(this,{}),s.set(this,{}),l.set(this,$i((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")||kw.TEXT,s=e[r],a=new qa(i,{logger:this.logger});a.value=n.getFormattedValue(o,s),u(this,t,"m",h).call(this,i,r,a),u(this,t,"m",f).call(this,i,r,a)}))})))}static getFormattedValue(e,t){return e===kw.DATE&&t?new Date(t).toLocaleString():e===kw.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),u(this,l,"f").call(this,K$(this.state)),this.subscribe(u(this,l,"f").bind(this),K$)}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,a=function(e){var t,n;null===(t=u(this,i,"f")[e])||void 0===t||t.setContent($$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,r,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(this,i,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},d=function(e){var t,n;null===(t=u(this,o,"f")[e])||void 0===t||t.setContent($$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,s,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(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&&(u(this,i,"f")[s]=this.createModal({"data-id":`edit-${n}`}),u(this,r,"f")[s]=new Oa((()=>{var e,t;return null===(t=null===(e=u(this,i,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,i,"f")[s].afterClose=u(this,t,"m",a).bind(this,s),o.onEditClick((()=>{var e,t;null===(t=null===(e=u(this,i,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),u(this,t,"m",a).call(this,s),this.syncFlowTheme(u(this,r,"f")[s]))},f=function(e,n,i){const r=e.getAttribute("delete-flow-id");r&&(u(this,o,"f")[r]=this.createModal({"data-id":`delete-${n}`}),u(this,s,"f")[r]=new Oa((()=>{var e,t;return null===(t=null===(e=u(this,o,"f")[r])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,o,"f")[r].afterClose=u(this,t,"m",d).bind(this,r),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=u(this,o,"f"))||void 0===e?void 0:e[r])||void 0===t||t.open()})),u(this,t,"m",d).call(this,r),this.syncFlowTheme(u(this,s,"f")[r]))},n})),Iw=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(fw,as,dw,Eo,ec,hw,Ha)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),this.updateDeviceList=$i((e=>{this.deviceList.data=e}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.deviceList=new Va((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-trusted-devices")}),{logger:this.logger}),this.deviceList.isExists&&(yield u(this,t,"m",a).call(this),u(this,t,"m",s).call(this,z$(this.state)),u(this,t,"m",r).call(this),this.subscribe(this.updateDeviceList.bind(this),z$))}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.deviceList.flowId&&(h(this,n,this.createModal({"data-id":"untrust-device"}),"f"),h(this,i,new Oa((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=()=>u(this,t,"m",o).call(this,""),this.syncFlowTheme(u(this,i,"f")))},o=function(e=""){u(this,n,"f").setContent($$({projectId:this.projectId,flowId:this.deviceList.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:{deviceId:e}})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.listDevices({userId:P$(this.state)})}))},s=function(e){this.deviceList.onRemoveDeviceClick((({id:e})=>{var i;u(this,t,"m",o).call(this,e),null===(i=u(this,n,"f"))||void 0===i||i.open()})),this.deviceList.data=e},a=function(){return c(this,void 0,void 0,(function*(){yield this.actions.listDevices({userId:P$(this.state)})}))},d})),xw={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},Rw=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Eo,dw,Ga,Uo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),G$)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=xw[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})),Ow=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p;return p=class extends(mi(dw,Eo,hw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,null),r.set(this,(e=>c(this,void 0,void 0,(function*(){const t=e.target.value;yield this.actions.selectTenant(t)})))),o.set(this,(e=>{const i=Z$(e);this.tenantSelector.value!==i&&u(this,t,"m",l).call(this,i);const{loading:r,error:o}=e.selectTenant,a=null!==e.tenant.previousTenantId,d=i!==u(this,n,"f");!i||r||o||a||!d||(h(this,n,i,"f"),u(this,t,"m",s).call(this))}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.actions.setCurrentTenantId((()=>{const e=bn();return j$(e)})()),u(this,t,"m",i).call(this),u(this,t,"m",f).call(this),u(this,t,"m",d).call(this,J$(this.state)),this.subscribe(u(this,o,"f").bind(this))}))}},n=new WeakMap,r=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){this.tenantSelector=new Ka((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-combo-box[name="tenantSelector"]')}),{logger:this.logger}),this.tenantSelector.onInput(u(this,r,"f"))},s=function(){const e=Z$(this.state);this.dispatchEvent(new CustomEvent("tenant-changed",{bubbles:!0,composed:!0,detail:{tenantId:e}})),this.tenantSelector.shouldReload&&u(this,t,"m",a).call(this)},a=function(){setTimeout((()=>window.location.reload()),this.tenantSelector.refreshTimeout)},d=function(e){return c(this,void 0,void 0,(function*(){const t=e.map((e=>({label:e.tenantName||e.tenantId,value:e.tenantId})));yield this.tenantSelector.setData(t)}))},l=function(e){e&&(this.tenantSelector.value=e)},f=function(){this.tenantSelector.setAllowCustomValue(!0),setTimeout((()=>{u(this,t,"m",l).call(this,Z$(this.state)),this.tenantSelector.setAllowCustomValue(!1)}))},p})),Ew=Si((e=>class extends(mi($a,as,cw,Sw,gw,pw,mw,$w,yw,bw,ww,Cw,vw,Iw,Rw,Ow)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Aw=mi((e=>class extends(Ew(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 ba})).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.9.18"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Aw);var Nw=Object.freeze({__proto__:null,default:Aw});const jw=(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))]},Mw=(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]=jw(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};var Pw,Uw,Tw,Ww,Lw,Dw,_w,Fw,qw,Bw,Vw;const Kw=document.createElement("template");Kw.innerHTML='\n<div class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n';const Hw=mi(ts)(HTMLElement);class zw extends Hw{constructor(){super(),Pw.add(this),Uw.set(this,new lo({messages:[]})),Tw.set(this,void 0),Ww.set(this,void 0),Lw.set(this,void 0),Dw.set(this,{resize:u(this,Pw,"m",Vw).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Kw.content.cloneNode(!0)),h(this,Tw,this.shadowRoot.querySelector(".debugger"),"f"),h(this,Ww,u(this,Tw,"f").querySelector(".content"),"f"),h(this,Lw,u(this,Tw,"f").querySelector(".header"),"f"),u(this,Pw,"m",_w).call(this)}updateData(e){u(this,Uw,"f").update((t=>({messages:t.messages.concat(e)})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;null===(t=e.init)||void 0===t||t.call(this),Mw(u(this,Tw,"f"),u(this,Lw,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",u(this,Dw,"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}})(u(this,Tw,"f")),u(this,Tw,"f").onresize=u(this,Pw,"m",Bw).bind(this),u(this,Uw,"f").subscribe(u(this,Pw,"m",Fw).bind(this))}))}disconnectedCallback(){u(this,Uw,"f").unsubscribeAll(),window.removeEventListener("resize",u(this,Dw,"f").resize)}}Uw=new WeakMap,Tw=new WeakMap,Ww=new WeakMap,Lw=new WeakMap,Dw=new WeakMap,Pw=new WeakSet,_w=function(){this.injectStyle('\n .debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),u(this,Tw,"f").style.top="32px",u(this,Tw,"f").style.left=window.innerWidth-300-32+"px"},Fw=function(e){u(this,Pw,"m",qw).call(this,e),u(this,Pw,"m",Bw).call(this)},qw=function(e){u(this,Ww,"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("")},Bw=function(){u(this,Ww,"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)}))},Vw=function(){const[e,t]=jw(u(this,Tw,"f"),Number.parseInt(u(this,Tw,"f").style.left,10),Number.parseInt(u(this,Tw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});u(this,Tw,"f").style.top=`${t}px`,u(this,Tw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",zw);var Gw=Object.freeze({__proto__:null,default:zw});const Jw=(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 Zw,Yw,Xw,Qw,eC,tC,nC,iC,rC,oC;const sC=document.createElement("template");sC.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`;const aC=mi(ts)(HTMLElement);class dC extends aC{constructor(){var e;super(),Zw.add(this),Yw.set(this,new Ai({messages:[]})),Xw.set(this,void 0),Qw.set(this,void 0),eC.set(this,void 0),tC.set(this,{resize:u(this,Zw,"m",oC).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sC.content.cloneNode(!0)),this.injectStyle('\n.debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),h(this,Xw,this.shadowRoot.querySelector(".debugger"),"f"),h(this,Qw,u(this,Xw,"f").querySelector(".content"),"f"),h(this,eC,u(this,Xw,"f").querySelector(".header"),"f")}updateData(e){u(this,Yw,"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]=Jw(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})(u(this,Xw,"f"),u(this,eC,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",u(this,tC,"f").resize),(e=u(this,Xw,"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},u(this,Xw,"f").onresize=u(this,Zw,"m",rC).bind(this),u(this,Yw,"f").subscribe(u(this,Zw,"m",nC).bind(this))}disconnectedCallback(){u(this,Yw,"f").unsubscribeAll(),window.removeEventListener("resize",u(this,tC,"f").resize)}}Yw=new WeakMap,Xw=new WeakMap,Qw=new WeakMap,eC=new WeakMap,tC=new WeakMap,Zw=new WeakSet,nC=function(e){u(this,Zw,"m",iC).call(this,e),u(this,Zw,"m",rC).call(this)},iC=function(e){u(this,Qw,"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("")},rC=function(){u(this,Qw,"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)}))},oC=function(){const[e,t]=Jw(u(this,Xw,"f"),Number.parseInt(u(this,Xw,"f").style.left,10),Number.parseInt(u(this,Xw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});u(this,Xw,"f").style.top=`${t}px`,u(this,Xw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",dC);var lC=Object.freeze({__proto__:null,default:dC});e.AccessKeyManagement=Fi,e.ApplicationsPortal=Bi,e.AuditManagement=Ki,e.AuthProvider=({projectId:e,baseUrl:r="",baseStaticUrl:a="",baseCdnUrl:d="",sessionTokenViaCookie:l=!1,refreshTokenViaCookie:c=!1,hooks:u,persistTokens:h=!0,autoRefresh:f=!0,oidcConfig:p,storeLastAuthenticatedUser:g=!0,keepLastAuthenticatedUserAfterLogout:v=!1,refreshCookieName:m="",getExternalToken:y,customStorage:b,children:$})=>{const[w,C]=t.useState(),[k,S]=t.useState(),[I,x]=t.useState(),[R,O]=t.useState(!1),[E,A]=t.useState(!1),[N,j]=t.useState(!1),[M,P]=t.useState(!!p),U=t.useRef(!1),T=(({projectId:e,baseUrl:n,persistTokens:i,autoRefresh:r,sessionTokenViaCookie:o,refreshTokenViaCookie:a,refreshCookieName:d,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,getExternalToken:h,hooks:f,customStorage:p})=>t.useMemo((()=>{if(e)return ci({projectId:e,baseUrl:n,sessionTokenViaCookie:o,refreshTokenViaCookie:a,baseHeaders:s,persistTokens:i,autoRefresh:r,refreshCookieName:d,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,hooks:f,getExternalToken:h,customStorage:p})}),[e,n,JSON.stringify(o),JSON.stringify(a),h,p]))({projectId:e,baseUrl:r,persistTokens:h,autoRefresh:f,sessionTokenViaCookie:l,refreshTokenViaCookie:c,hooks:u,oidcConfig:p,storeLastAuthenticatedUser:g,keepLastAuthenticatedUserAfterLogout:v,refreshCookieName:m,getExternalToken:y,customStorage:b});t.useEffect((()=>{if(T){const e=T.onSessionTokenChange(S),t=T.onUserChange(C),n=T.onIsAuthenticatedChange(O),i=T.onClaimsChange(x);return()=>{e(),t(),n(),i()}}}),[T]);const W=t.useRef(!1),L=t.useRef(!1);t.useEffect((()=>{T&&p&&!U.current&&(U.current=!0,T.oidc.finishLoginIfNeed().finally((()=>{P(!1),W.current=!0})))}),[]);const D=t.useCallback((()=>{o()||W.current||(W.current=!0,j(!0),i(null==T?void 0:T.refresh)(void 0,!0).then((()=>{j(!1)})))}),[T]),_=t.useCallback((()=>{L.current||(L.current=!0,A(!0),i(T.me)().then((()=>{A(!1)})))}),[T]),F=t.useMemo((()=>({fetchUser:_,user:w,isUserLoading:E,isUserFetched:L.current,fetchSession:D,session:k,isAuthenticated:R,isSessionLoading:N,isOidcLoading:M,isSessionFetched:W.current,projectId:e,baseUrl:r,baseStaticUrl:a,baseCdnUrl:d,storeLastAuthenticatedUser:g,keepLastAuthenticatedUserAfterLogout:v,refreshCookieName:m,customStorage:b,setUser:C,setSession:S,setIsAuthenticated:O,claims:I,sdk:T})),[_,w,E,L.current,D,k,R,N,M,W.current,e,r,a,d,v,m,b,C,S,O,I,T]);return t.createElement(n.Provider,{value:F},$)},e.Descope=Ti,e.OutboundApplications=zi,e.RoleManagement=Ji,e.SignInFlow=e=>t.createElement(Ti,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>t.createElement(Ti,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>t.createElement(Ti,Object.assign({},e,{flowId:"sign-up-or-in"})),e.TenantProfile=Yi,e.UserManagement=Qi,e.UserProfile=tr,e.baseHeaders=s,e.getCurrentTenant=vi,e.getJwtPermissions=pi,e.getJwtRoles=gi,e.getRefreshToken=fi,e.getSessionToken=hi,e.isRefreshTokenExpired=(e=fi())=>null==li?void 0:li.isJwtExpired(e),e.isSessionTokenExpired=(e=hi())=>null==li?void 0:li.isJwtExpired(e),e.refresh=(e=fi())=>null==li?void 0:li.refresh(e),e.useDescope=()=>{const{sdk:e}=Wi();return t.useMemo((()=>e||new Proxy(ui(),Di)),[e])},e.useSession=()=>{const{session:e,claims:n,isSessionLoading:i,isOidcLoading:r,fetchSession:s,isSessionFetched:a,isAuthenticated:d}=Wi(),l=t.useRef(i||r);t.useMemo((()=>{l.current=i||r}),[i,r]);const c=!d&&!i&&!o();return t.useMemo((()=>{c&&!a&&(l.current=!0)}),[a]),t.useEffect((()=>{c&&s()}),[s]),{isSessionLoading:l.current,sessionToken:e,claims:n,isAuthenticated:d}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,isAuthenticated:r,isUserFetched:o}=Wi(),[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}}}));
|
|
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=()=>"undefined"!=typeof window&&!!window.descopeBridge,s={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.27.12"},a="undefined"!=typeof window;var d=function(){return d=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},d.apply(this,arguments)};function l(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 c(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 u(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 h(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 f extends Error{}function p(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 g(e,t){if("string"!=typeof e)throw new f("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 f(`Invalid token specified: missing part #${n+1}`);let r;try{r=p(i)}catch(e){throw new f(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new f(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}f.prototype.name="InvalidTokenError";var v={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",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const m="<region>",y=`https://api.${m}descope.com`,b=6e5,$="dct",w=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},C=[503,521,522,524,530],k=[100,5e3,5e3],S=e=>new Promise((t=>setTimeout(t,e))),I=e=>async(...t)=>{let n=await e(...t),i=0;for(;C.includes(n.status)&&i<k.length;)await S(k[i]),n=await e(...t),i++;i>0&&(n.retries=i);const r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n};let x;const R=()=>{if(x)return x;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 x=`${t}-${n}`,x};var O;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"}(O||(O={}));const E=({path:e,baseUrl:t,queryParams:n,projectId:i})=>{const r=i.slice(1,-27);t=t.replace(m,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},A=(...e)=>new Headers(e.reduce(((e,t)=>((e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t).forEach((([t,n])=>{e[t]="function"==typeof n?n():n})),e)),{})),N={"Content-Type":"application/json"},j=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},M=(e,t)=>{const n={"x-descope-sdk-session-id":R(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.61.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},P=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e};var U=e=>{var t;return(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:i,logger:r,hooks:o,cookiePolicy:s,fetch:a})=>{const d=e||y,l=((e,t)=>{const n=t||fetch;return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...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=>w().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const i=await I(n)(...t);return e[i.ok?"log":"error"](await(async e=>{const t=await e.text();return w().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).retries(e.retries).build()})(i)),i}:I(n)})(r,a),c=async e=>{var r;const a=(null==o?void 0:o.beforeRequest)?o.beforeRequest(e):e,{path:c,body:u,headers:h,queryParams:f,method:p,token:g}=a,v=(e=>void 0===e?void 0:JSON.stringify(e))(u),m={headers:A(j(t,g),M(t,i),(null==n?void 0:n.baseHeaders)||{},P(v)?N:{},h),method:p,body:v};null!==s&&(m.credentials=s||"include");const y=await l(E({path:c,baseUrl:d,queryParams:f,projectId:t}),m);if((null==o?void 0:o.afterRequest)&&await o.afterRequest(e,null==y?void 0:y.clone()),null==o?void 0:o.transformResponse){const e=await y.json(),t=(b=(null===(r=y.headers)||void 0===r?void 0:r.get("set-cookie"))||"",Object.fromEntries(function(e){if(!e)return[];const t=[];let n=0;function i(){for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length}function r(){const t=e.charAt(n);return"="!==t&&";"!==t&&","!==t}for(;n<e.length;){const o=n;let s,a,d=!1;for(;i();)if(","===e.charAt(n)){for(s=n,n+=1,i(),a=n;n<e.length&&r();)n+=1;if(n<e.length&&"="===e.charAt(n)){d=!0,n=a,t.push(e.substring(o,s));break}n=s+1}else n+=1;(!d||n>=e.length)&&t.push(e.substring(o,e.length))}return t}(b).map((e=>{const t=e.split(";")[0],n=t.indexOf("=");return n<1?null:[t.substring(0,n).trim(),t.substring(n+1).trim()]})).filter(Boolean))),n=Object.assign(Object.assign({},y),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,o.transformResponse(n)}var b;return y};return{get:(e,{headers:t,queryParams:n,token:i}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:O.get,token:i}),post:(e,t,{headers:n,queryParams:i,token:r}={})=>c({path:e,headers:n,queryParams:i,body:t,method:O.post,token:r}),patch:(e,t,{headers:n,queryParams:i,token:r}={})=>c({path:e,headers:n,queryParams:i,body:t,method:O.patch,token:r}),put:(e,t,{headers:n,queryParams:i,token:r}={})=>c({path:e,headers:n,queryParams:i,body:t,method:O.put,token:r}),delete:(e,{headers:t,queryParams:n,token:i}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:O.delete,token:i}),hooks:o,buildUrl:(e,n)=>E({projectId:t,baseUrl:d,path:e,queryParams:n})}})(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}}))},T=429;function W(e,t,n){var i;let r=L(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 L(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return g(e)}function D(e){const{exp:t}=L(e);return(new Date).getTime()/1e3>t}function _(e){let t=L(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function F(e,t){return W(e,t,"permissions")}function q(e,t){return W(e,t,"roles")}const B=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function V(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===T&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=i.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}function K(e){var t;return(null===(t=L(e))||void 0===t?void 0:t[$])||""}const H=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),z=(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 "))},G=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),J=e=>t=>e.test(t),Z=J(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Y=J(/^\+[1-9]{1}[0-9]{3,14}$/),X=H(Z,'"{val}" is not a valid email'),Q=H(Y,'"{val}" is not a valid phone number'),ee=H((e=>e.length>=1),"Minimum length is 1");const te=H((e=>"string"==typeof e),"Input is not a string"),ne=H((e=>Array.isArray(e)),"Input is not an array"),ie=H((e=>"boolean"==typeof e),"Input is not a boolean"),re=H((e=>void 0===e),"Input is defined"),oe=z([te(),re()],"Input is not a string or undefined"),se=z([ne(),ie()],"Input is not an array or boolean"),ae=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>G(...e).validate(n[t]))),t(...n)),de=e=>[te(`"${e}" must be a string`)],le=e=>[oe(`"${e}" must be string or undefined`)],ce=e=>[te(`"${e}" must be a string`),ee(`"${e}" must not be empty`)],ue=e=>[te(`"${e}" must be a string`),X()],he=e=>[te(`"${e}" must be a string`),Q()],fe=ae(ce("accessKey")),pe=e=>({exchange:fe(((t,n)=>V(e.post(v.accessKey.exchange,{loginOptions:n},{token:t}))))}),ge=(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),ve=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||b,b)});var me,ye;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"}(me||(me={})),function(e){e.email="email"}(ye||(ye={}));const be=Object.assign(Object.assign({},me),ye);var $e;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}($e||($e={}));const we=ce("loginId"),Ce=ae(ce("token")),ke=ae(we),Se=ae(ce("pendingRef")),Ie=ae(we,ue("email")),xe=e=>({verify:Ce((t=>V(e.post(v.enchantedLink.verify,{token:t})))),signIn:ke(((t,n,i={},r)=>{var{providerId:o}=i,s=l(i,["providerId"]);return V(e.post(B(v.enchantedLink.signIn,be.email),{loginId:t,URI:n,loginOptions:s,providerId:o},{token:r}))})),signUpOrIn:ke(((t,n,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(B(v.enchantedLink.signUpOrIn,be.email),{loginId:t,URI:n,loginOptions:o,providerId:r}))})),signUp:ke(((t,n,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(B(v.enchantedLink.signUp,be.email),{loginId:t,URI:n,user:i,loginOptions:s,providerId:o}))})),waitForSession:Se(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ve(n);let s;const a=setInterval((async()=>{const n=await e.post(v.enchantedLink.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(V(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:Ie(((t,n,i,r,o)=>V(e.post(v.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r}))))}}),Re=ae(ce("flowId")),Oe=ae(ce("executionId"),ce("stepId"),ce("interactionId")),Ee=e=>({start:Re(((t,n,i,r,o,s,a,d=!1)=>V(e.post(v.flow.start,{flowId:t,options:n,conditionInteractionId:i,interactionId:r,componentsVersion:o,flowVersions:s,input:a,isCustomScreen:d})))),next:Oe(((t,n,i,r,o,s,a=!1)=>V(e.post(v.flow.next,{executionId:t,stepId:n,interactionId:i,version:r,componentsVersion:o,input:s,isCustomScreen:a}))))}),Ae=ce("loginId"),Ne=ae(ce("token")),je=ae(Ae),Me=ae(Ae,he("phone")),Pe=ae(Ae,ue("email")),Ue=Object.keys(be).filter((e=>e!==me.voice&&e!==me.im)),Te=e=>({verify:Ne((t=>V(e.post(v.magicLink.verify,{token:t})))),signIn:Ue.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:je(((t,i,r={},o)=>{var{providerId:s}=r,a=l(r,["providerId"]);return V(e.post(B(v.magicLink.signIn,n),{loginId:t,URI:i,loginOptions:a,providerId:s},{token:o}))}))})),{}),signUp:Ue.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:je(((t,i,r,o={})=>{var{providerId:s}=o,a=l(o,["providerId"]);return V(e.post(B(v.magicLink.signUp,n),{loginId:t,URI:i,user:r,loginOptions:a,providerId:s}))}))})),{}),signUpOrIn:Ue.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:je(((t,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(B(v.magicLink.signUpOrIn,n),{loginId:t,URI:i,loginOptions:s,providerId:o}))}))})),{}),update:{email:Pe(((t,n,i,r,o)=>V(e.post(v.magicLink.update.email,Object.assign({loginId:t,email:n,URI:i},o),{token:r})))),phone:Object.keys(me).filter((e=>e!==me.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Me(((t,i,r,o,s)=>V(e.post(B(v.magicLink.update.phone,n),Object.assign({loginId:t,phone:i,URI:r},s),{token:o}))))})),{})}});var We;!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"}(We||(We={}));const Le=ae(ce("code")),De=e=>({start:Object.assign(((t,n,i,r,o)=>V(e.post(v.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),o&&{loginHint:o}),token:r}))),Object.keys(We).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,i,r,o)=>V(e.post(v.oauth.start,i||{},{queryParams:Object.assign(Object.assign({provider:n},t&&{redirectURL:t}),o&&{loginHint:o}),token:r}))})),{})),exchange:Le((t=>V(e.post(v.oauth.exchange,{code:t})))),startNative:(t,n,i)=>V(e.post(v.oauth.startNative,{provider:t,loginOptions:n,implicit:i})),finishNative:(t,n,i,r,o)=>V(e.post(v.oauth.finishNative,{provider:t,stateId:n,user:i,code:r,idToken:o})),getOneTapClientId:t=>V(e.get(v.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,i,r)=>V(e.post(v.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r})),exchangeOneTapIDToken:(t,n,i,r)=>V(e.post(v.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:i,loginOptions:r}))}),_e=ce("appId"),Fe=ae(_e),qe=e=>({connect:Fe(((t,n,i)=>{const r=null==n?void 0:n.tenantId,o=null==n?void 0:n.tenantLevel;return null==n||delete n.tenantId,null==n||delete n.tenantLevel,V(e.post(v.outbound.connect,{appId:t,tenantId:r,tenantLevel:o,options:n},{token:i}))}))}),Be=ce("loginId"),Ve=ae(Be,ce("code")),Ke=ae(Be),He=ae(Be,he("phone")),ze=ae(Be,ue("email")),Ge=e=>({verify:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ve(((t,i)=>V(e.post(B(v.otp.verify,n),{code:i,loginId:t}))))})),{}),signIn:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ke(((t,i={},r)=>{var{providerId:o}=i,s=l(i,["providerId"]);return V(e.post(B(v.otp.signIn,n),{loginId:t,loginOptions:s,providerId:o},{token:r}))}))})),{}),signUp:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ke(((t,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(B(v.otp.signUp,n),{loginId:t,user:i,loginOptions:s,providerId:o}))}))})),{}),signUpOrIn:Object.keys(be).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ke(((t,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(B(v.otp.signUpOrIn,n),{loginId:t,loginOptions:o,providerId:r}))}))})),{}),update:{email:ze(((t,n,i,r)=>V(e.post(v.otp.update.email,Object.assign({loginId:t,email:n},r),{token:i})))),phone:Object.keys(me).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:He(((t,i,r,o)=>V(e.post(B(v.otp.update.phone,n),Object.assign({loginId:t,phone:i},o),{token:r}))))})),{})}}),Je=ae(ce("tenant")),Ze=ae(ce("code")),Ye=e=>({start:Je(((t,n,i,r,o,s,a,d)=>V(e.post(v.saml.start,i||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),o&&{ssoId:o}),s&&{forceAuthn:"true"}),a&&{loginHint:a}),d&&{initiatedEmail:t})},r&&{token:r}))))),exchange:Ze((t=>V(e.post(v.saml.exchange,{code:t}))))}),Xe=ce("loginId"),Qe=ae(Xe,ce("code")),et=ae(Xe),tt=ae(Xe),nt=e=>({signUp:et(((t,n)=>V(e.post(v.totp.signUp,{loginId:t,user:n})))),verify:Qe(((t,n,i,r)=>V(e.post(v.totp.verify,{loginId:t,code:n,loginOptions:i},{token:r})))),update:tt(((t,n)=>V(e.post(v.totp.update,{loginId:t},{token:n}))))}),it=ce("loginId"),rt=ce("newPassword"),ot=ae(it,ce("password")),st=ae(it),at=ae(it,rt),dt=ae(it,ce("oldPassword"),rt),lt=e=>({signUp:ot(((t,n,i,r={})=>{var{providerId:o}=r,s=l(r,["providerId"]);return V(e.post(v.password.signUp,{loginId:t,password:n,user:i,loginOptions:s,providerId:o}))})),signIn:ot(((t,n,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(v.password.signIn,{loginId:t,password:n,loginOptions:o,providerId:r}))})),sendReset:st(((t,n,i)=>V(e.post(v.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:i})))),update:at(((t,n,i)=>V(e.post(v.password.update,{loginId:t,newPassword:n},{token:i})))),replace:dt(((t,n,i)=>V(e.post(v.password.replace,{loginId:t,oldPassword:n,newPassword:i})))),policy:()=>V(e.get(v.password.policy))}),ct=de("loginId"),ut=ce("loginId"),ht=ce("origin"),ft=ae(ut,ht,ce("name")),pt=ae(ut,ht),gt=ae(ct,ht),vt=ae(ut,ht,le("token")),mt=ae(ce("transactionId"),ce("response")),yt=e=>({signUp:{start:ft(((t,n,i,r,o)=>V(e.post(v.webauthn.signUp.start,{user:{loginId:t,name:i},origin:n,loginOptions:o,passkeyOptions:r})))),finish:mt(((t,n)=>V(e.post(v.webauthn.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:gt(((t,n,i,r,o)=>V(e.post(v.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:i,passkeyOptions:o},{token:r})))),finish:mt(((t,n)=>V(e.post(v.webauthn.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:pt(((t,n,i,r)=>V(e.post(v.webauthn.signUpOrIn.start,{loginId:t,origin:n,loginOptions:r,passkeyOptions:i}))))},update:{start:vt(((t,n,i,r)=>V(e.post(v.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:i})))),finish:mt(((t,n)=>V(e.post(v.webauthn.update.finish,{transactionId:t,response:n}))))}}),bt=de("loginId"),$t=ae(bt),wt=ae(ce("pendingRef")),Ct=e=>({signUpOrIn:$t(((t,n={})=>{var{providerId:i}=n,r=l(n,["providerId"]);return V(e.post(v.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:i}))})),signUp:$t(((t,n,i={})=>{var{providerId:r}=i,o=l(i,["providerId"]);return V(e.post(v.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:o}))})),signIn:$t(((t,n={},i)=>{var{providerId:r}=n,o=l(n,["providerId"]);return V(e.post(v.notp.signIn,{loginId:t,loginOptions:o,providerId:r},{token:i}))})),waitForSession:wt(((t,n)=>new Promise((i=>{const{pollingIntervalMs:r,timeoutMs:o}=ve(n);let s;const a=setInterval((async()=>{const n=await e.post(v.notp.session,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),i(V(Promise.resolve(n))))}),r);s=setTimeout((()=>{i({error:{errorDescription:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),o)}))))}),kt=ae(ce("token")),St=ae(le("token"));var It,xt=ae([(It=ce("projectId"),H(((e,t)=>n=>G(...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",It))())])((e=>{const{projectId:t,logger:n,baseUrl:i,cookiePolicy:r,baseHeaders:o={},refreshCookieName:s,fetch:a}=e;return d=U({baseUrl:i,projectId:t,logger:n,hooks:{get beforeRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest},get afterRequest(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.afterRequest},get transformResponse(){var t;return null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:o},refreshCookieName:s,fetch:a}),{accessKey:pe(d),otp:Ge(d),magicLink:Te(d),enchantedLink:xe(d),oauth:De(d),outbound:qe(d),saml:Ye(d),totp:nt(d),notp:Ct(d),webauthn:yt(d),password:lt(d),flow:Ee(d),refresh:St(((e,t,n,i)=>{const r={};n&&(r.externalToken=n);const o=i?v.tryRefresh:v.refresh;return V(d.post(o,r,{token:e,queryParams:t}))})),selectTenant:ae([te("tenantId")],[oe('"token" must be string or undefined')])(((e,t)=>V(d.post(v.selectTenant,{tenant:e},{token:t})))),logout:St((e=>V(d.post(v.logout,{},{token:e})))),logoutAll:St((e=>V(d.post(v.logoutAll,{},{token:e})))),me:St((e=>V(d.get(v.me,{token:e})))),myTenants:ae([se('"tenants" must a string array or a boolean')],[oe('"token" must be string or undefined')])(((e,t)=>{const n={};return"boolean"==typeof e?n.dct=e:n.ids=e,V(d.post(v.myTenants,n,{token:t}))})),history:St((e=>V(d.get(v.history,{token:e})))),isJwtExpired:kt(D),getTenants:kt(_),getJwtPermissions:kt(F),getJwtRoles:kt(q),getCurrentTenant:kt(K),httpClient:d};var d})),Rt=Object.assign(xt,{DeliveryMethods:be});
|
|
2
|
+
/*! js-cookie v3.0.5 | MIT */function Ot(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 Et=function e(t,n){function i(e,i,r){if("undefined"!=typeof document){"number"==typeof(r=Ot({},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,"",Ot({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Ot({},this.attributes,t))},withConverter:function(t){return e(Ot({},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 At={default:"endpoint"},Nt="Blocked by CSP",jt="The endpoint parameter is not a valid URL",Mt="Failed to load the JS script of the agent",Pt="9319";function Ut(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===Nt||s===jt)n.exclude(),o=0;else if(s===Pt)n.exclude();else if(s===Mt){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 Tt="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Wt=Tt;function Lt(e){var t;e.scriptUrlPattern;var n=e.token,i=e.apiKey,r=void 0===i?n:i,o=l(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:Tt,a=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=a[0],u=a[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 Ut(e,Dt)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===Pt?new Error(Mt):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(d(d({},o),{ldi:{attempts:n,visibilityStates:c}}))}))}function Dt(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(jt);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(Mt))},i.async=!0,i.src=e,o.appendChild(i)}))}(e)}),(function(){throw new Error(Nt)})).then(_t)}function _t(){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(Pt);return n}const Ft="3.2.0",qt="undefined"!=typeof window,Bt=Math.pow(2,31)-1,Vt=`https://descopecdn.com/npm/oidc-client-ts@${Ft}/dist/browser/oidc-client-ts.min.js`,Kt=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${Ft}/dist/browser/oidc-client-ts.min.js`,Ht=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let zt;const Gt=e=>{try{return g(e).exp}catch(e){return null}},Jt=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:Gt(n)},Zt=e=>{const{expires_in:t,expires_at:n,access_token:i}=e;return n||(t?Math.floor(Date.now()/1e3)+t:i?Gt(i):void 0)},Yt=e=>{const{access_token:t,id_token:n,refresh_token:i,refresh_expire_in:r}=e,o=l(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||Zt(e),cookieExpiration:e.cookieExpiration||Jt(e)},o)},Xt=(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},Qt=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json()),n=(null==t?void 0:t.authInfo)||t||{};return Yt(n)},en=()=>qt&&!!window.descopeBridge,tn=(e,t)=>{if(!((null==t?void 0:t.status)>=400&&(null==t?void 0:t.status)<500))return!1;const n=(null==e?void 0:e.path)||"";return Ht.includes(n)},nn=void 0!==zt||qt&&void 0!==window.localStorage,rn=(e,t)=>{var n,i;return null===(i=null===(n=zt||qt&&window.localStorage)||void 0===n?void 0:n.setItem)||void 0===i?void 0:i.call(n,e,t)},on=e=>{var t,n;return null===(n=null===(t=zt||qt&&window.localStorage)||void 0===t?void 0:t.getItem)||void 0===n?void 0:n.call(t,e)},sn=e=>{var t,n;return null===(n=null===(t=zt||qt&&window.localStorage)||void 0===t?void 0:t.removeItem)||void 0===n?void 0:n.call(t,e)},an=e=>{var t,n,i,r,o;return null!==(o=null!==(n=null===(t=null==zt?void 0:zt.key)||void 0===t?void 0:t.call(zt,e))&&void 0!==n?n:qt&&(null===(r=null===(i=window.localStorage)||void 0===i?void 0:i.key)||void 0===r?void 0:r.call(i,e)))&&void 0!==o?o:null},dn=(...e)=>{console.debug(...e)},ln=(...e)=>{console.warn(...e)},cn="DS",un="DSR",hn="DSI",fn="DSRCN";function pn(e,t,n){if(t){const{cookieDomain:i,cookiePath:r,cookieSameSite:o,cookieExpiration:s,cookieSecure:a}=n,d=new Date(1e3*s),l=gn(i);Et.set(e,t,{path:r,domain:l?i:void 0,expires:d,sameSite:o,secure:a})}}function gn(e){const t=window.location.hostname.split("."),n=null==e?void 0:e.split(".");return t.slice(-(null==n?void 0:n.length)).join(".")===e}const vn=e=>(null==e?void 0:e.cookieName)||cn,mn=e=>(null==e?void 0:e.cookieName)||un;function yn(e="",t){return Et.get(mn(t))||on(`${e}${un}`)||""}function bn(e="",t){return Et.get(vn(t))||on(`${e}${cn}`)||""}function $n(e=""){return on(`${e}${hn}`)||""}function wn(e="",t,n,i){sn(`${e}${un}`),sn(`${e}${cn}`),sn(`${e}${hn}`),sn(`${e}${fn}`);const r=vn(t);Et.remove(r,null==i?void 0:i.session);const o=mn(n);Et.remove(o,null==i?void 0:i.refresh)}const Cn=(e,t,n)=>i=>{const r=Object.assign(i,{token:i.token||yn(e,t)});if(!n){const t=function(e=""){return on(`${e}${fn}`)}(e);t&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":t}))}const o=function(e=""){return on(`${e}DTD`)||""}(e);return o&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":o})),r},kn=qt&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Sn="vsid",In="vrid",xn="fp",Rn=(e=!1)=>{const t=on(xn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},On=async(e,t=kn)=>{try{if(Rn())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=Lt({apiKey:e,endpoint:[i.toString(),At],scriptUrlPattern:[o,Wt]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({[Sn]:e,[In]:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};rn(xn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},En=e=>{const t=Rn(!0);return t&&e.body&&(e.body.fpData=t),e},An="descopeFlowNonce",Nn="X-Descope-Flow-Nonce",jn="/v1/flow/start",Mn="/v1/flow/next",Pn=(e,t=An)=>`${t}${e}`,Un=e=>{var t;return(null===(t=/.*\|#\|(.*)/.exec(e))||void 0===t?void 0:t[1])||null},Tn=e=>{var t;return e.path===Mn&&(null===(t=e.body)||void 0===t?void 0:t.executionId)?Un(e.body.executionId):null},Wn="dls_last_user_login_id",Ln="dls_last_user_display_name",Dn=e=>rn(Wn,e),_n=()=>on(Wn),Fn=()=>on(Ln),qn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,i={}]=t,r=_n(),o=Fn();return r&&(null!==(n=i.lastAuth)&&void 0!==n||(i.lastAuth={}),i.lastAuth.loginId=r,i.lastAuth.name=o),await e(...t)};function Bn(){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 Vn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Zn(n.publicKey.challenge),n.publicKey.user.id=Zn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Zn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Yn(n.rawId),type:n.type,response:{attestationObject:Yn(n.response.attestationObject),clientDataJSON:Yn(n.response.clientDataJSON)}});var n}async function Kn(e){const t=Gn(e);return Jn(await navigator.credentials.get(t))}async function Hn(e,t){const n=Gn(e);return n.signal=t.signal,n.mediation="conditional",Jn(await navigator.credentials.get(n))}async function zn(e=!1){var t,n;if(!qt)return Promise.resolve(!1);if(en()){const e=null===(n=null===(t=window.descopeBridge)||void 0===t?void 0:t.hostInfo)||void 0===n?void 0:n.webauthn;if("boolean"==typeof e)return e}const i=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return i&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():i}function Gn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Zn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Zn(e.id)})),n}function Jn(e){return JSON.stringify({id:e.id,rawId:Yn(e.rawId),type:e.type,response:{authenticatorData:Yn(e.response.authenticatorData),clientDataJSON:Yn(e.response.clientDataJSON),signature:Yn(e.response.signature),userHandle:e.response.userHandle?Yn(e.response.userHandle):void 0}})}function Zn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Yn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Xn,Qn=(Xn=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 Vn(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 Kn(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 Vn(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await Kn(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 Vn(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:Vn,get:Kn,isSupported:zn,conditional:Hn}}),(...e)=>{const t=Xn(...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 ei="/fedcm/config",ti=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("")}return Math.random().toString(36).substring(2)};async function ni(e,t){var n;try{await ii(e,t)}catch(e){null===(n=null==t?void 0:t.onFailed)||void 0===n||n.call(t,e)}}async function ii(e,t){var n,i;const r=await async function(e,t="google",n,i,r){const o=ti(),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)}}var ri=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await zn(),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 oi;const si=(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",(()=>{si(e,t),s.setAttribute("data-error","true")})),document.body.appendChild(s)})),ai=(e,t,n)=>{const i=async()=>{let i,r;return i&&r||({client:i,stateUserKey:r}=await(async(e,t,n)=>{oi||(oi=(async()=>{try{return require("oidc-client-ts")}catch(e){return si([Vt,Kt],(()=>window.oidc))}})());const{OidcClient:i,WebStorageStateStore:r}=await oi;if(!i)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const o=(null==n?void 0:n.redirectUri)||window.location.href;let s,a,d,l;if(null==n?void 0:n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");s=n.issuer,a=n.clientId,d=`${a}_user`,l="openid"}else(null==n?void 0:n.applicationId)?(s=e.httpClient.buildUrl(t),s=`${s}/${n.applicationId}`,a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access"):(s=e.httpClient.buildUrl(t),a=t,d=`${a}_user`,l="openid email roles descope.custom_claims offline_access");const c={authority:s,client_id:a,redirect_uri:o,response_type:"code",scope:(null==n?void 0:n.scope)||l,stateStore:new r({store:window.localStorage,prefix:a}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return(null==n?void 0:n.redirectUri)&&(c.redirect_uri=n.redirectUri),{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)))),rn(o,JSON.stringify({id_token:(a=s).id_token,session_state:a.session_state,profile:a.profile})),(()=>{const e=new URL(window.location.href);e.searchParams.delete("code"),e.searchParams.delete("state"),window.history.replaceState({},document.title,e.toString())})(),s};return{loginWithRedirect:async(t={},n=!1)=>{var r;const{client:o}=await i(),s=await o.createSigninRequest(t),{url:a}=s;return n||(await(null===(r=e.httpClient.hooks)||void 0===r?void 0:r.afterRequest({},new Response(JSON.stringify(s)))),window.location.href=a),{ok:!0,data:s}},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=on(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||$n(),e.post_logout_redirect_uri=e.post_logout_redirect_uri||window.location.href;const o=await n.createSignoutRequest(e),{url:s}=o;return sn(r),t||window.location.replace(s),o}}},di=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var n;return n=t.customStorage,zt=n,e(t)}),(e=>t=>{var{fpKey:n,fpLoad:i}=t,r=l(t,["fpKey","fpLoad"]);return qt?(n&&i&&On(n).catch((()=>null)),e(Xt(r,{beforeRequest:En}))):e(r)}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.48.4"},t.baseHeaders)}))),(e=>t=>{const n=Bn(),i=Bn(),r=Bn(),o=Bn(),s=e(Xt(t,{afterRequest:async(e,t)=>{if(tn(e,t))dn("Session invalidated, notifying subscribers with empty values"),i.pub(null),r.pub(null),n.pub(null),o.pub(null);else{const e=await(async e=>{const t=await Qt(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)})(t);e&&r.pub(e);const{sessionJwt:s,sessionExpiration:a,claims:d}=await Qt(t);s&&i.pub(s),d&&o.pub(d),(a||s)&&n.pub(a||42)}}})),a=ge(s,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const s=await e(...t);return i.pub(null),r.pub(null),n.pub(null),o.pub(null),s}));return Object.assign(a,{onSessionTokenChange:i.sub,onUserChange:r.sub,onClaimsChange:o.sub,onIsAuthenticatedChange:e=>n.sub((t=>{e(!!t)}))})}),(e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:i=An}=t,r=l(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((e=An)=>{try{if(!nn)return;for(let r=0;r<(void 0,n=void 0,void 0,null!==(i=null!==(t=null==zt?void 0:zt.length)&&void 0!==t?t:qt&&(null===(n=window.localStorage)||void 0===n?void 0:n.length))&&void 0!==i?i:0);r++){const t=an(r);if(t&&t.startsWith(e)){const n=on(t);if(n)try{JSON.parse(n).expiry<Date.now()&&sn(t)}catch(e){sn(t)}}}}catch(e){console.error("Error cleaning up expired nonces:",e)}var t,n,i})(i),e(Xt(r,{afterRequest:async(e,t)=>{if(e.path!==jn&&e.path!==Mn)return;const{nonce:n,executionId:r}=await(async(e,t)=>{try{const n=t.headers.get(Nn);let i=await t.clone().json().then((e=>(null==e?void 0:e.executionId)||null)).catch((()=>null));return i||(i=Tn(e)),{nonce:n,executionId:Un(i)}}catch(e){return{nonce:null,executionId:null}}})(e,t);n&&r&&((e,t,n,i=An)=>{try{const r=Pn(e,i),o=n?172800:10800,s={value:t,expiry:Date.now()+1e3*o,isStart:n};rn(r,JSON.stringify(s))}catch(e){console.error("Error setting flow nonce:",e)}})(r,n,e.path===jn,i)},beforeRequest:e=>{if(e.path===Mn){const t=Tn(e);if(t){const n=((e,t=An)=>{try{const n=Pn(e,t),i=on(n);if(!i)return null;const r=JSON.parse(i);return r.expiry<Date.now()?(((e,t=An)=>{try{const n=Pn(e,t);sn(n)}catch(e){console.error("Error removing flow nonce:",e)}})(e,t),null):r.value}catch(e){return console.error("Error getting flow nonce:",e),null}})(t,i);n&&(e.headers=e.headers||{},e.headers[Nn]=n)}}return e}}))):e(r)}),(e=>t=>{var{autoRefresh:n}=t,i=l(t,["autoRefresh"]);const r=!!n,o="object"==typeof n&&(null==n?void 0:n.customActivityTracking);if(!r||en())return Object.assign(e(i),{markUserActive:()=>{ln("markUserActive() called but has no effect")}});const{clearAllTimers:s,setTimer:a}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let d,c,u=null,h=!1,f=!1;o&&(dn("Activity-based refresh enabled"),u=(()=>{let e=!0;return{hadActivity:()=>e,reset:()=>{e=!1},markActive:()=>{e=!0}}})()),qt&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&d&&new Date>d&&(dn("Expiration time passed, refreshing session"),p.refresh(yn()||c))}));const p=e(Xt(i,{afterRequest:async(e,t)=>{const{sessionJwt:n,refreshJwt:i,sessionExpiration:r,nextRefreshSeconds:o}=await Qt(t);if(tn(e,t))dn("Session invalidated, canceling all timers"),s();else if(n||r){if(d=((e,t)=>{if(t)return new Date(1e3*t);dn("Could not extract expiration time from session token, trying to decode the token");try{const t=g(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(n,r),!d)return void dn("Could not extract expiration time from session token");c=i,h=o>0;const e=((e,t)=>{let n;var i;return t>0?(n=1e3*t,dn(`Using provided nextRefreshSeconds: ${t}s`)):n=((i=e)?i.getTime()-(new Date).getTime():0)-2e4,n>Bt&&(dn(`Timeout is too large (${n}ms), setting it to ${Bt}ms`),n=Bt),n})(d,o);if(s(),e<=2e4)return void dn("Session is too close to expiration, not setting refresh timer");const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});dn(`Setting refresh timer for ${t}. (${e}ms)`),u&&(u.reset(),f=!1),a((()=>{if(qt&&"hidden"===document.visibilityState)dn("Skipping refresh due to timer - document is hidden");else{if(u&&h&&!u.hadActivity())return dn("Skipping refresh due to timer - user is idle"),void(f=!0);dn("Refreshing session due to timer"),p.refresh(yn()||i)}}),e)}}}));return Object.assign(ge(p,["logout","logoutAll","oidc.logout"],(e=>async(...t)=>{const n=await e(...t);return dn("Clearing all timers"),s(),n})),{markUserActive:u?()=>{dn("markUserActive() called"),h||dn("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),f&&(dn("User became active after skipped refresh, triggering refresh"),f=!1,s(),p.refresh(yn()||c))}:()=>{ln("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:i=!1}=t,r=l(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:_n,getLastUserDisplayName:Fn});const o=e(Xt(r,{afterRequest:async(e,t)=>{var n;const{userInfo:i,lastAuth:r}=await(async e=>{if(!(null==e?void 0:e.ok))return{userInfo:void 0,lastAuth:void 0};const t=await(null==e?void 0:e.clone().json()),n=Yt((null==t?void 0:t.authInfo)||t||{});return{userInfo:(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0),lastAuth:t.lastAuth}})(t),o=null===(n=null==i?void 0:i.loginIds)||void 0===n?void 0:n[0],s=null==i?void 0:i.name;o?(Dn(o),(e=>{rn(Ln,e)})(s)):(null==r?void 0:r.loginId)&&Dn(r.loginId)}}));let s=ge(o,["flow.start"],qn);return s=ge(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const i=await t(...n);return e||(sn(Wn),sn(Ln)),i})(i)),Object.assign(s,{getLastUserLoginId:_n,getLastUserDisplayName:Fn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:i,refreshTokenViaCookie:r,storagePrefix:o,refreshCookieName:s}=t,a=l(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!n||!qt)return e(Object.assign({refreshCookieName:s},a));let d;const c=e(Xt(Object.assign({refreshCookieName:s},a),{beforeRequest:Cn(o,r,s),afterRequest:async(e,t)=>{if(tn(e,t))dn("Session invalidated, clearing persisted tokens"),wn(o,i,r,d);else{const e=await Qt(t);e.cookieName?rn(`${o||""}${fn}`,e.cookieName):e.refreshJwt&&sn(`${o||""}${fn}`);const n=((e={},t=!1,n="",i=!1)=>{var r,o,s,a;const{sessionJwt:d,refreshJwt:l,trustedDeviceJwt:c}=e;let u;if(l)if(i){sn(`${n}${un}`);const t=i.sameSite||"Strict",s=null===(r=i.secure)||void 0===r||r,a=null!==(o=i.domain)&&void 0!==o?o:e.cookieDomain,d=mn(i);s&&"https:"!==window.location.protocol&&ln("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const c=Object.assign(Object.assign({},e),{cookieSameSite:t,cookieSecure:s,cookieDomain:a});pn(d,l,c);const h=gn(a);u=Object.assign(Object.assign({},u),{refresh:{path:c.cookiePath,domain:h?a:void 0}})}else{const e=mn(i);Et.remove(e),rn(`${n}${un}`,l)}if(d)if(t){const n=t.sameSite||"Strict",i=null===(s=t.secure)||void 0===s||s,r=null!==(a=t.domain)&&void 0!==a?a:e.cookieDomain,o=vn(t);i&&"https:"!==window.location.protocol&&ln("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const l=Object.assign(Object.assign({},e),{cookieSameSite:n,cookieSecure:i,cookieDomain:r});pn(o,d,l);const c=gn(r);u=Object.assign(Object.assign({},u),{session:{path:l.cookiePath,domain:c?r:void 0}})}else rn(`${n}${cn}`,d);return e.idToken&&rn(`${n}${hn}`,e.idToken),c&&rn(`${n}DTD`,c),u})(e,i,o,r);n&&(d=n)}}})),u=ge(c,["logout","logoutAll","oidc.logout"],((e,t,n,i)=>r=>async(...o)=>{const s=await r(...o);return wn(e,t,n,null==i?void 0:i()),s})(o,i,r,(()=>d)));return Object.assign(u,{getRefreshToken:()=>yn(o,r),getSessionToken:()=>bn(o,i),getIdToken:()=>$n(o)})}))((e=>{const t=Rt(e),n=ai(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,r)=>{var o;if(en())return dn(`Refresh called in native flow: ${(new Error).stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(e){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:e.toString()}})}const s=bn(),a=yn();let d="";if(e.getExternalToken)try{d=await(null===(o=e.getExternalToken)||void 0===o?void 0:o.call(e))}catch(e){dn("Error getting external token while refreshing",e)}return t.refresh(i,{dcs:s?"t":"f",dcr:a?"t":"f"},d,r)},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:ri(t),webauthn:Qn(t),fedcm:(i=t,r=e.projectId,{onetap:{requestExchangeCode(e){ni(i,e)},requestAuthentication(e){ni(i,e)}},async oneTap(e,t,n,r,o){await ii(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+ei),clientId:r}]}},o=await(null===(t=navigator.credentials)||void 0===t?void 0:t.get(n));return i.refresh(o.token)},isSupported:()=>qt&&"IdentityCredential"in window,async isLoggedIn(e){var t;const n=i.httpClient.buildUrl(r+ei);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 li;const ci=e=>{const t=di(Object.assign({persistTokens:a,autoRefresh:a},e));return li=t,t},ui=()=>ci({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});li=ui();const hi=()=>a?null==li?void 0:li.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),fi=()=>a?null==li?void 0:li.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),pi=r(((e=hi(),t)=>null==li?void 0:li.getJwtPermissions(e,t))),gi=r(((e=hi(),t)=>null==li?void 0:li.getJwtRoles(e,t))),vi=r(((e=hi())=>null==li?void 0:li.getCurrentTenant(e)));function mi(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const yi=e=>{const t=document.createElement("template");return t.innerHTML=e,t},bi=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),$i=e=>{let t,n;return(...i)=>(t&&bi(t,i)||(t=i,n=e(...i)),n)},wi=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),Ci=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])||""}`}),""),ki=(e,t=500)=>{let n;return function(...i){clearTimeout(n),n=setTimeout((()=>e.apply(this,i)),t)}},Si=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 Ii,xi,Ri,Oi;function Ei(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(!Ei(o,s))return!1}else if(o!==s)return!1}return!0}let Ai=class{constructor(e={},{forceUpdate:t=!1}={}){Ii.set(this,void 0),xi.set(this,{}),Ri.set(this,0),Oi.set(this,!0),this.update=e=>{const t="function"==typeof e?e(u(this,Ii,"f")):e,n=Object.assign(Object.assign({},u(this,Ii,"f")),t);if(u(this,Oi,"f")||!Ei(u(this,Ii,"f"),n)){const e=u(this,Ii,"f");h(this,Ii,n,"f"),Object.freeze(u(this,Ii,"f")),setTimeout((()=>{Object.values(u(this,xi,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},h(this,Ii,e,"f"),h(this,Oi,t,"f")}get current(){return Object.assign({},u(this,Ii,"f"))}subscribe(e){return h(this,Ri,u(this,Ri,"f")+1,"f"),u(this,xi,"f")[u(this,Ri,"f")]=e,u(this,Ri,"f").toString()}unsubscribe(e){const t=!!u(this,xi,"f")[e];return t&&delete u(this,xi,"f")[e],t}unsubscribeAll(){return h(this,xi,{},"f"),!0}};Ii=new WeakMap,xi=new WeakMap,Ri=new WeakMap,Oi=new WeakMap;const Ni=["=","+","-","@","\t","\r"],ji=e=>{const t=(e=>e.length>0&&Ni.includes(e[0])?`'${e}`:e)(Array.isArray(e)?e.join("; "):String(null!=e?e:""));return t.includes(",")||t.includes('"')||t.includes("\n")||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t},Mi=e=>"string"==typeof e||null==e?e:JSON.stringify(e),Pi=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([wi(i),Mi(n)]):Object.assign(e.rest,{[wi(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))})),Ui=t.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await Promise.resolve().then((function(){return Sa})).then((e=>e.default))).sdkConfigOverrides={baseHeaders:s,persistTokens:!1,hooks:{get beforeRequest(){return li.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:Pi(t.forwardRef(((e,n)=>{var{"external-request-id":i}=e,r=l(e,["external-request-id"]);return t.useMemo((()=>{var e,t;e="x-external-rid",(t=i)?s[e]=t:delete s[e]}),[i]),t.createElement("descope-wc",Object.assign({ref:n},r))})))}))),Ti=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:b,styleId:$,onScreenUpdate:w,dismissScreenErrorOnInput:C,outboundAppId:k,outboundAppScopes:S,popupOrigin:I,children:x,externalRequestId:R},O)=>{const[E,A]=t.useState(null);t.useImperativeHandle(O,(()=>E));const{projectId:N,baseUrl:j,baseStaticUrl:M,baseCdnUrl:P,storeLastAuthenticatedUser:U,keepLastAuthenticatedUserAfterLogout:T,refreshCookieName:W,customStorage:L,sdk:D}=t.useContext(n),_=t.useCallback((async e=>{await D.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),i&&i(e)}),[i]);return t.useEffect((()=>{const e=E;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",_)}}),[E,r,_]),t.useEffect((()=>{const e=E;return null==e||e.addEventListener("success",_),()=>{null==e||e.removeEventListener("success",_)}}),[E,_]),t.useEffect((()=>{const e=E;return r&&(null==e||e.addEventListener("error",r)),()=>{r&&(null==e||e.removeEventListener("error",r))}}),[E,r]),t.useEffect((()=>{const e=E;return o&&(null==e||e.addEventListener("ready",o)),()=>{o&&(null==e||e.removeEventListener("error",o))}}),[E,o]),t.createElement("form",null,t.createElement(t.Suspense,{fallback:null},t.createElement(Ui,{projectId:N,flowId:e,baseUrl:j,baseStaticUrl:M,baseCdnUrl:P,ref:A,telemetryKey:p,redirectUrl:g,autoFocus:v,styleId:$,validateOnBlur:m,restartOnError:y,keepLastAuthenticatedUserAfterLogout:T,tenant:a,externalRequestId:R,customStorage:L,"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,"popup-origin.attr":I,"store-last-authenticated-user.attr":U,"refreshCookieName.attr":W,"dismiss-screen-error-on-input.attr":C,"errorTransformer.prop":b,"logger.prop":s,"onScreenUpdate.prop":w,"customStorage.prop":L},x)))}));var Wi=()=>{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`,Di={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],Di);if("function"==typeof e[t])return()=>{throw Error(Li("function"))};throw Error(Li("attribute"))}},_i=t.lazy((async()=>(await Promise.resolve().then((function(){return hu})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-access-key-management-widget",Object.assign({ref:n},e)))))}))),Fi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(_i,{ref:u,projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),qi=t.lazy((async()=>(await Promise.resolve().then((function(){return Pu})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-applications-portal-widget",Object.assign({ref:n},e)))))}))),Bi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s,onReady: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.useEffect((()=>{const e=l;return a&&(null==e||e.addEventListener("ready",a)),()=>{a&&(null==e||e.removeEventListener("ready",a))}}),[l,a]),t.createElement(t.Suspense,{fallback:null},t.createElement(qi,{ref:c,projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":g,"logger.prop":e}))})),Vi=t.lazy((async()=>(await Promise.resolve().then((function(){return nh})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-audit-management-widget",Object.assign({ref:n},e)))))}))),Ki=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Vi,{ref:u,projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),Hi=t.lazy((async()=>(await Promise.resolve().then((function(){return Ph})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-outbound-applications-widget",Object.assign({ref:n},e)))))}))),zi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s,onReady: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.useEffect((()=>{const e=l;return a&&(null==e||e.addEventListener("ready",a)),()=>{a&&(null==e||e.removeEventListener("ready",a))}}),[l,a]),t.createElement(t.Suspense,{fallback:null},t.createElement(Hi,{ref:c,projectId:u,widgetId:o,baseUrl:h,baseStaticUrl:f,baseCdnUrl:p,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"refreshCookieName.attr":g,"logger.prop":e}))})),Gi=t.lazy((async()=>(await Promise.resolve().then((function(){return Mf})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-role-management-widget",Object.assign({ref:n},e)))))}))),Ji=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Gi,{ref:u,projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),Zi=t.lazy((async()=>(await Promise.resolve().then((function(){return Sp})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-tenant-profile-widget",Object.assign({ref:n},e)))))}))),Yi=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,styleId:s,tenant:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Zi,{projectId:h,widgetId:o,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,styleId:s,tenant:a,ref:u,"theme.attr":i,"debug.attr":r,"styleId.attr":s,"tenant.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),Xi=t.lazy((async()=>(await Promise.resolve().then((function(){return S$})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-user-management-widget",Object.assign({ref:n},e)))))}))),Qi=t.forwardRef((({logger:e,tenant:i,theme:r,debug:o,widgetId:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v}=t.useContext(n);return t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(Xi,{projectId:h,widgetId:s,tenant:i,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,ref:u,"theme.attr":r,"debug.attr":o,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),er=t.lazy((async()=>(await Promise.resolve().then((function(){return Ww})),{default:Pi(t.forwardRef(((e,n)=>t.createElement("descope-user-profile-widget",Object.assign({ref:n},e)))))}))),tr=t.forwardRef((({logger:e,theme:i,debug:r,widgetId:o,onLogout:s,styleId:a,onReady:d},l)=>{const[c,u]=t.useState(null);t.useImperativeHandle(l,(()=>c));const{projectId:h,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,refreshCookieName:v,setSession:m,setUser:y,setIsAuthenticated:b}=t.useContext(n),$=t.useCallback((e=>{s&&s(e),b(!1),m(""),y(null)}),[s,m,b,y]);return t.useEffect((()=>{if(c)return c.addEventListener("logout",$),()=>c.removeEventListener("logout",$)}),[c,$]),t.useEffect((()=>{const e=c;return d&&(null==e||e.addEventListener("ready",d)),()=>{d&&(null==e||e.removeEventListener("ready",d))}}),[c,d]),t.createElement(t.Suspense,{fallback:null},t.createElement(er,{projectId:h,widgetId:o,baseUrl:f,baseStaticUrl:p,baseCdnUrl:g,styleId:a,ref:u,"theme.attr":i,"debug.attr":r,"styleId.attr":a,"refreshCookieName.attr":v,"logger.prop":e}))})),nr="undefined"!=typeof localStorage,ir="J151000",rr="E103205",or=nr&&localStorage.getItem("base.content.url")||"",sr="base.ui.components.url";nr&&localStorage.getItem(sr),nr&&localStorage.getItem(sr);const ar="descope-login-flow",dr="code",lr="redirect_mode",cr="err",ur="data-exclude-field",hr="data-exclude-next",fr="dls_last_auth",pr="state_id",gr="saml_idp_state_id",vr="wsfed_idp_state_id",mr="saml_idp_username",yr="descope_idp_initiated",br="sso_app_id",$r="third_party_app_id",wr="third_party_app_state_id",Cr="oidc_login_hint",kr="oidc_prompt",Sr="oidc_resource",Ir="oidc_error_redirect_uri",xr="application_scopes",Rr="data-type",Or="redirect",Er="poll",Ar="webauthnCreate",Nr="webauthnGet",jr="nativeBridge",Mr="loadForm",Pr="submit",Ur="polling",Tr=["descope-multi-select-combo-box","descope-text-area"],Wr="dls_last_auth_in_flight",Lr=["cssVars","componentsConfig","inputs","errorText","errorType","clientScripts"];var Dr;!function(e){e.backward="backward",e.forward="forward"}(Dr||(Dr={}));const _r=["descope-enriched-text"];function Fr(e){return new URLSearchParams(window.location.search).get(e)}function qr(e){if(window.history.replaceState&&Fr(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 Br(e,t){if(!t)return;const n=+e,i=+t;return Number.isNaN(n)||Number.isNaN(i)?void 0:n>i?Dr.forward:n<i?Dr.backward:void 0}const Vr=e=>{let[t="",n=""]=(Fr(ar)||"").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 Kr(){qr(ar)}const Hr=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),zr=(e,t)=>{const{executionId:n,stepId:i,executionFlowId:r}=Vr(e);if(r&&e!==r)return t.debug("Flow id does not match the execution flow id, skipping url params handling"),{ssoQueryParams:{}};(n||i)&&Kr();const o=Fr("t")||void 0;o&&qr("t");const s=Fr(dr)||void 0;s&&qr(dr);const a="popup"===Fr(lr);a&&qr(lr);const d=Fr(cr)||void 0;d&&qr(cr);const{redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h}={redirectAuthCodeChallenge:Fr("ra-challenge"),redirectAuthCallbackUrl:Fr("ra-callback"),redirectAuthBackupCallbackUri:Fr("ra-backup-callback"),redirectAuthInitiator:Fr("ra-initiator")},f=Fr(pr);f&&qr(pr);const p=Fr(gr);p&&qr(gr);const g=Fr(vr);g&&qr(vr);const v=Fr(mr);p&&qr(mr);const m=Fr(yr);m&&qr(yr);const y=Fr(br);y&&qr(br);const b=Fr($r);b&&qr($r);const $=Fr(wr);$&&qr(wr);const w=Fr(xr);w&&qr(xr);const C=Fr(Cr);C&&qr(Cr);const k=Fr(kr);k&&qr(kr);const S=Fr(Ir);S&&qr(Ir);const I=Fr(Sr);return I&&qr(Sr),{executionId:n,stepId:i,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCodeChallenge:l,redirectAuthCallbackUrl:c,redirectAuthBackupCallbackUri:u,redirectAuthInitiator:h,ssoQueryParams:{oidcIdpStateId:f,samlIdpStateId:p,wsfedIdpStateId:g,samlIdpUsername:v,descopeIdpInitiated:"true"===m,ssoAppId:y,oidcLoginHint:C,oidcPrompt:k,oidcErrorRedirectUri:S,oidcResource:I,thirdPartyAppId:b,thirdPartyAppStateId:$,applicationScopes:w}}},Gr=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}})},Jr=(e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector('*[name]:not([auto-focus="false"]):not([aria-hidden="true"])');setTimeout((()=>{null==t||t.focus()}))}};function Zr(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 Yr=(e,{oidcIdpStateId:t,samlIdpStateId:n,wsfedIdpStateId:i,samlIdpUsername:r,ssoAppId:o,oidcLoginHint:s,oidcPrompt:a,oidcErrorRedirectUri:d,oidcResource:l,thirdPartyAppId:c,thirdPartyAppStateId:u,applicationScopes:h})=>!(!e||t||n||i||r||o||s||a||d||l||c||u||h),Xr=e=>null==e?void 0:e.submit(),Qr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},eo=(e,t=100)=>{let n;return function(...i){n||e.apply(this,i),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function to(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:""}}const no=e=>{const t=Object.assign({},e);return e.inboundAppApproveScopes&&(t.thirdPartyAppApproveScopes=e.inboundAppApproveScopes),t};function io(e,t){return`sdkScriptsResults.${t?`${e}_${t}`:e}`}var ro,oo,so,ao;function lo(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(!lo(o,s))return!1}else if(o!==s)return!1}return!0}let co=class{constructor(e={},{forceUpdate:t=!1}={}){ro.set(this,void 0),oo.set(this,{}),so.set(this,0),ao.set(this,!0),this.update=e=>{const t="function"==typeof e?e(u(this,ro,"f")):e,n=Object.assign(Object.assign({},u(this,ro,"f")),t),i=u(this,ro,"f");h(this,ro,n,"f"),Object.freeze(u(this,ro,"f")),setTimeout((()=>{Object.values(u(this,oo,"f")).forEach((({cb:e,selector:t,forceUpdate:r})=>{const o=t(i),s=t(n);(u(this,ao,"f")||r||(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(s)?!lo(o,s):o!==s))&&e(s,o,((e,t)=>n=>e[n]!==t[n])(s,o))}))}),0)},h(this,ro,e,"f"),h(this,ao,t,"f")}get current(){return Object.assign({},u(this,ro,"f"))}set forceUpdate(e){h(this,ao,e,"f")}subscribe(e,t=e=>e,{forceUpdate:n=!1}={}){return h(this,so,u(this,so,"f")+1,"f"),u(this,oo,"f")[u(this,so,"f")]={cb:e,selector:t,forceUpdate:n},u(this,so,"f").toString()}unsubscribe(e){const t=!!u(this,oo,"f")[e];return t&&delete u(this,oo,"f")[e],t}unsubscribeAll(){return h(this,oo,{},"f"),!0}};ro=new WeakMap,oo=new WeakMap,so=new WeakMap,ao=new WeakMap;const uo=["*","#","/","(",")","[","]","_","<",">","`"],ho=e=>"string"!=typeof e?e:e.replace((e=>{const t=uo.map((t=>`${e}${t}`)).join("|");return new RegExp(`(${t})`,"g")})("\\"),"\\$1"),fo=["disabled"],po=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${ur}])`)).forEach((e=>{e.value=n}))}))},go=(e,t)=>t.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),e),vo=(e,t,n)=>e.replace(/{{(.+?)}}/g,((e,i)=>n?ho(go(t,i)):go(t,i))),mo=(e,t,n)=>{e.querySelectorAll(`[${Rr}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},yo=(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})`))},bo=(e,t,n,i)=>{var r,o;mo(e,"totp-link",null===(r=null==t?void 0:t.totp)||void 0===r?void 0:r.provisionUrl),mo(e,"notp-link",null===(o=null==t?void 0:t.notp)||void 0===o?void 0:o.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{const n=(e=>_r.includes(e))(e.localName);e.textContent=vo(e.textContent,t,n);const i=e.getAttribute("href");i&&e.setAttribute("href",vo(i,t))}))})(e,t),((e,t,n)=>{if(!t)return;const{componentsDynamicAttrs:i}=t,r=l(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,null==t?void 0:t.componentsConfig,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=vo(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])=>{fo.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,n),((e,t={},n)=>{Object.entries(t).forEach((([t,i])=>{e.querySelectorAll(`[id="${CSS.escape(t)}"]`).forEach((e=>{switch(i){case"disable":e.setAttribute("disabled","true");break;case"hide":e.classList.add("hidden");break;default:null==n||n.error(`Unknown component state "${i}" for component with id "${t}"`,'Valid states are "disable" and "hide"')}}))}))})(e,null==t?void 0:t.componentsState,i)},$o=Gr((()=>c(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 Zr(100,n,i)}catch(e){return console.error("Conditional login check failed",e),!1}}))));let wo;const Co=(e,t)=>{wo?wo.setItem(e,t):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.setItem(e,t)},ko=e=>wo?wo.getItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)?window.localStorage.getItem(e):null,So="dls_ab_testing_id",Io={"lastAuth.loginId":{"not-empty":e=>{var t;return!!e.loginId||!!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)},empty:e=>{var t;return!e.loginId&&!(null===(t=e.lastAuth)||void 0===t?void 0:t.loginId)}},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t,"greater-than-or-equal":(e,t)=>(e.abTestingKey||0)>=t,"less-than-or-equal":(e,t)=>(e.abTestingKey||0)<=t,"in-range":(e,t)=>{const[n,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 xo(e,t){const n={};try{Object.assign(n,JSON.parse(ko(fr)))}catch(e){null==t||t.warn("[Descope] Failed to read last auth from storage",String(e))}return n.loginId||e?n:{}}function Ro(e,t){(null==e?void 0:e.authMethod)&&(t&&!e.loginId||Co(fr,JSON.stringify(e)))}function Oo(){try{return JSON.parse(ko(Wr)||"{}")}catch(e){return{}}}function Eo(e){try{(e=>{wo?wo.removeItem(e):void 0!==(null===window||void 0===window?void 0:window.localStorage)&&window.localStorage.removeItem(e)})(Wr)}catch(t){null==e||e.warn("[Descope] Failed to clear in-flight last auth storage",String(t))}}const Ao=["error","warn","info","debug"],No={error:console.error.bind(console,"[Descope]"),warn:console.warn.bind(console,"[Descope]"),info:console.info.bind(console,"[Descope]"),debug:console.debug.bind(console,"[Descope]")},jo=Si((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,u(this,t,"m",i).call(this,No))}set logger(e){h(this,n,u(this,t,"m",i).call(this,e||No),"f")}get logger(){return u(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,i=function(e){return Ao.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})),Mo="undefined"!=typeof localStorage,Po="https://static.descope.com/pages",Uo="https://static2.descope.com/pages",To=Mo&&localStorage.getItem("base.content.url")||"",Wo=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Lo=Si((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)&&u(this,t,"f")&&(h(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Do=Si((e=>{var t,n;const i=mi(jo,Lo)(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=u(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){u(this,t,"f")[e]||(u(this,t,"f")[e]=[]);const i=u(this,t,"f")[e].push(n);return()=>u(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})),_o=e=>t=>{var n,i,r;const o=mi(jo,Lo,Do)(t),s=Object.keys(e);return r=class extends o{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,u(this,n,"m",i).bind(this))}async init(){var e;s.forEach((e=>u(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};_o.missingAttrValidator=Wo;const Fo=Si((e=>{const t=mi(_o({"project-id":Wo}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),qo=Si((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")||""}})),Bo="Trying the next fallback URL...",Vo=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)}};const Ko=Si((e=>{var t,n,i,r,o,s,a;const d=mi(jo,Fo,qo)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,new Set)}async fetchStaticResource(e,n){const s=u(this,t,"m",o).call(this,e),a=Array.isArray(s)?e=>{const{baseUrl:t}=s[e];h(this,i,t,"f");for(let t=0;t<e;t++){const e=s[t].baseUrl;u(this,r,"f").add(e)}}: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 Vo(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}. ${Bo}`)}catch(e){const t=`Error fetching URL ${o} [${e.message}]`;if(s)throw new Error(t);null==n||n.debug(`${t}. ${Bo}`)}}})(s,{cache:"default"},{logger:this.logger,onSuccess:a});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,r=new WeakMap,t=new WeakSet,o=function(e){const o=To||this.baseStaticUrl;if(o)return u(this,t,"m",s).call(this,e,o);u(this,n,"f")!==this.baseUrl&&(h(this,n,this.baseUrl,"f"),h(this,i,void 0,"f"),u(this,r,"f").clear());const a=[];if(u(this,i,"f"))a.push(u(this,t,"m",s).call(this,e,u(this,i,"f"))),u(this,i,"f")===Po&&a.push(u(this,t,"m",s).call(this,e,Uo));else{const n=this.baseUrl+"/pages";this.baseUrl&&!u(this,r,"f").has(n)&&a.push(u(this,t,"m",s).call(this,e,n)),u(this,r,"f").has(Po)||a.push(u(this,t,"m",s).call(this,e,Po)),a.push(u(this,t,"m",s).call(this,e,Uo))}return 1===a.length?a[0]:a},s=function(e,t){return function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i=Po}){const r=new URL(i);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.baseUrl=i,r}({projectId:this.projectId,filename:e,baseUrl:t})},a})),Ho=Si((e=>{var t,n;const i=mi(_o({"project-id":Wo}))(e);return n=class extends i{constructor(){super(...arguments),t.set(this,new Map)}onReset(e,n){if(u(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} already exists`);return u(this,t,"f").set(e,n),()=>{u(this,t,"f").delete(e)}}async reset(...e){0===e.length?await Promise.all(Array.from(u(this,t,"f").values()).map((e=>e()))):await Promise.all(e.map((e=>{var n;if(!u(this,t,"f").has(e))throw new Error(`Callback for sectionId ${e} does not exist`);return null===(n=u(this,t,"f").get(e))||void 0===n?void 0:n()})))}},t=new WeakMap,n})),zo=Si((e=>{var t,n,i,r,o;const s=mi(Ko,Ho,Lo)(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",u(this,t,"m",n).bind(this))}get config(){return u(this,i,"f")||h(this,i,u(this,r,"f").call(this),"f"),u(this,i,"f")}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){h(this,i,void 0,"f")},o})),Go=["https://descopecdn.com","https://static.descope.com","https://cdn.jsdelivr.net"],Jo=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()}`},Zo=(e,t,n)=>new Promise(((i,r)=>{const o=((e,t)=>{const n=document.createElement("script");return n.id=e,t&&(n.integrity=t,n.crossOrigin="anonymous"),window.DESCOPE_NONCE&&n.setAttribute("nonce",window.DESCOPE_NONCE),n})(e,n);o.onerror=e=>{o.setAttribute("status","error"),r(e)},o.onload=()=>{o.setAttribute("status","loaded"),i(o)},o.src=t.toString(),document.body.appendChild(o)})),Yo=(e,t)=>{if(t){const n=e.integrity;if(n!==t)return Promise.reject(new Error(`Integrity mismatch: expected ${t}, found ${n}`))}return"loaded"===e.getAttribute("status")?Promise.resolve(e):(e=>"error"===e.getAttribute("status"))(e)?Promise.reject():new Promise(((t,n)=>{e.addEventListener("load",(()=>{t(e)})),e.addEventListener("error",(e=>{n(e)}))}))},Xo=Si((e=>{const t=mi(jo)(e);return class extends t{get baseCdnUrl(){return this.getAttribute("base-cdn-url")||""}injectNpmLib(e,t,n="",i=[],r){return this.logger.debug(`Injecting npm lib: "${e}" with version: "${t}"${r?" with SRI integrity check":""}`),(async(e,t)=>{for(const i of e){const{id:e,url:r,integrity:o}=i,s=(n=e,document.querySelector(`script#${n}`));if(s)try{return await Yo(s,o),i}catch(e){t(i,!0)}else try{return await Zo(e,r,o),i}catch(e){t(i,!1)}}var n;throw new Error("All scripts failed to load")})(((e,t,n,i="",r)=>e.reduce(((e,o)=>{const s=o;if(!s)return e;let a;try{a=new URL(s)}catch(e){throw new Error(`Invalid URL: ${s}`)}"/"!==a.pathname||(a.pathname=`/npm/${t}@${n}/${i}`);const d={url:a,id:`npmlib-${t.replaceAll("@","").replaceAll("/","_")}-${Jo(a)}`};return r&&(d.integrity=r),[...e,d]}),[]))([...i,this.baseCdnUrl,...Go],e,t,n,r),((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}"`)}))}}})),Qo="base.ui.components.url",es=Mo&&localStorage.getItem(Qo),ts=Si((e=>{var t,n,i,r,o,s,a;const d=mi(jo,zo,Xo)(e);return a=class extends d{constructor(){super(...arguments),t.add(this),r.set(this,void 0)}get descopeUi(){return u(this,r,"f")||h(this,r,u(this,t,"m",s).call(this),"f"),u(this,r,"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=>u(this,t,"m",o).call(this,e))))}},r=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},i=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersionSri;return n&&this.logger.debug("SRI hash available for components"),n},o=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(", ")}"`)},s=async function(){if(globalThis.DescopeUI)return globalThis.DescopeUI;try{const e=await u(this,t,"m",n).call(this),r=await u(this,t,"m",i).call(this);return await this.injectNpmLib("@descope/web-components-ui",e,"dist/umd/index.js",[es],r),this.logger.debug("DescopeUI was loaded"),globalThis.DescopeUI}catch(e){throw this.logger.error(e),new Error("DescopeUI was not loaded")}},a})),ns=Si((e=>{var t,n,i;const r=mi(Lo,Do)(e);return i=class extends r{constructor(){super(...arguments),t.add(this)}get nonce(){return this.getAttribute("nonce")||""}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),this.observeAttribute("nonce",u(this,t,"m",n).bind(this)),u(this,t,"m",n).call(this)}},t=new WeakSet,n=function(){this.nonce&&(window.DESCOPE_NONCE=this.nonce)},i}));class is{constructor(e,t,{prepend:n=!1}={}){this.styleEle=document.createElement("style"),this.styleEle.setAttribute("nonce",t),this.ref=e,this.ref&&(n?this.ref.prepend(this.styleEle):this.ref.append(this.styleEle))}replaceSync(e){this.styleEle.textContent=e}get cssRules(){var e;return null===(e=this.styleEle.sheet)||void 0===e?void 0:e.cssRules}}const rs=Si((e=>{const t=mi(ns)(e);return class extends t{injectStyle(e,{prepend:t=!1}={}){let n;try{n=new CSSStyleSheet}catch(e){n=new is(this.shadowRoot,this.nonce,{prepend:t})}if(e&&n.replaceSync(e),n instanceof CSSStyleSheet){const e=this.shadowRoot;if(e&&"adoptedStyleSheets"in e){const i=[...e.adoptedStyleSheets||[]];i[t?"unshift":"push"](n),e.adoptedStyleSheets=i}}return n}}})),os="content-root",ss="root",as=Si((e=>{const t=mi(rs)(e);return class extends t{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n <div id="${ss}">\n <div id="${os}"></div>\n </div>\n `,this.injectStyle(`\n #${ss}, #${os} {\n height: 100%;\n }\n #${ss} {\n position: relative;\n height: fit-content;\n }\n `),this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(os),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(ss)}}})),ds="theme",ls=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',cs=Si((e=>{var t,n,i,r,o,s,a,d,l,c,f,p,g,v;const m=mi(_o({theme:ls}),Ko,Lo,ts,zo,as,Do,rs)(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,(()=>{u(this,t,"m",p).call(this),u(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",(()=>u(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")||ds}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),u(this,f,"f").call(this),await Promise.all([u(this,t,"m",s).call(this),u(this,t,"m",a).call(this)]),this.observeAttributes(["theme"],u(this,f,"f")),this.observeAttributes(["style-id"],(()=>{h(this,i,null,"f"),u(this,t,"m",l).call(this),u(this,t,"m",s).call(this),u(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(Qo)))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(Qo),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 u(this,i,"f")||(h(this,i,u(this,t,"m",r).call(this),"f"),u(this,i,"f").then((e=>this.logger.debug("Fetched theme",e)))),u(this,i,"f")},s=async function(){var e,i;const r=await u(this,t,"a",o);r&&(u(this,n,"f")||h(this,n,this.injectStyle(""),"f"),u(this,n,"f").replaceSync(((null===(e=null==r?void 0:r.light)||void 0===e?void 0:e.globals)||"")+((null===(i=null==r?void 0:r.dark)||void 0===i?void 0:i.globals)||"")))},a=async function(){var e,n;const i=await u(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 u(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")},c=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(){u(this,t,"m",l).call(this),u(this,t,"m",c).call(this)},v})),us=(e,t="")=>Object.keys(e).reduce(((n,i)=>{var r;if(Array.isArray(e[i]))return Object.assign(Object.assign({},n),{[i]:{value:e[i].map((e=>"object"==typeof e&&null!==e?us(e):e))}});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),us(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}),[]),hs=Si((e=>{var t,n,i,r;return r=class extends e{constructor(){super(...arguments),t.add(this)}connectedCallback(){var e;u(this,t,"m",n).call(this)&&u(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 fs,ps,gs,vs,ms,ys,bs,$s,ws,Cs,ks,Ss,Is,xs,Rs,Os,Es,As,Ns,js,Ms,Ps;const Us=mi(cs,Ko,hs,rs)(HTMLElement);let Ts=class extends Us{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","validate-on-blur","style-id"]}constructor(e){super(),fs.add(this),gs.set(this,!1),vs.set(this,void 0),this.flowStatus="initial",this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),u(this,fs,"m",Ps).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)}},ms.set(this,new co),ys.set(this,new co),bs.set(this,{}),this.getComponentsContext=()=>u(this,bs,"f"),this.nextRequestStatus=new co({isLoading:!1}),$s.set(this,void 0),ws.set(this,{popstate:u(this,fs,"m",xs).bind(this),componentsContext:u(this,fs,"m",Ns).bind(this)}),Cs.set(this,void 0),this.getConfig=()=>c(this,void 0,void 0,(function*(){return(yield this.config)||{isMissingConfig:!0}})),h(this,Cs,e,"f"),u(this,fs,"m",Ss).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 us(JSON.parse(e))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return((e,t)=>Object.fromEntries(Object.entries(e).map((([e,n])=>[e,n[t]]))))(this.formConfig,"value")}get outboundAppId(){return this.getAttribute("outbound-app-id")}get outboundAppScopes(){try{return JSON.parse(this.getAttribute("outbound-app-scopes"))||null}catch(e){return null}}get popupOrigin(){return this.getAttribute("popup-origin")}get customStorage(){return u(this,vs,"f")}set customStorage(e){if(e&&"function"!=typeof e.getItem)throw new Error("Custom storage must have a getItem method");if(e&&"function"!=typeof e.setItem)throw new Error("Custom storage must have a setItem method");if(e&&"function"!=typeof e.removeItem)throw new Error("Custom storage must have a removeItem method");h(this,vs,e,"f"),(e=>{wo=e})(e)}get isRestartOnError(){return"true"===this.getAttribute("restart-on-error")}getExecutionContext(){return c(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"executionContext"in e?e.executionContext:void 0}))}getProjectConfig(){return c(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"projectConfig"in e?e.projectConfig:void 0}))}getFlowConfig(){return c(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 c(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}handleKeyPress(){this.logger.debug("Enable key press handler"),this.rootElement.onkeydown=e=>{var t,n,i;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),o=Tr.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()}}}disableKeyPressHandler(){this.logger.debug("Disable key press handler"),this.rootElement.onkeydown=null}getComponentsVersion(){return c(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 c(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),u(this,ys,"f").subscribe(u(this,fs,"m",Ms).bind(this)),u(this,ys,"f").update({isDebug:this.debug}),u(this,fs,"m",Is).call(this),yield u(this,fs,"m",Es).call(this))return void this.loggerWrapper.error("This SDK version does not support your flows version","Make sure to upgrade your flows to the latest version or use an older SDK version");const n=yield this.getConfig();if("isMissingConfig"in n&&n.isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");const{executionId:i,stepId:r,token:o,code:s,isPopup:a,exchangeError:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthCodeChallenge:f,redirectAuthInitiator:p,ssoQueryParams:g}=zr(this.flowId,this.loggerWrapper);window.addEventListener("popstate",u(this,ws,"f").popstate),window.addEventListener("components-context",u(this,ws,"f").componentsContext),u(this,ms,"f").subscribe(u(this,fs,"m",Os).bind(this)),u(this,ms,"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,isPopup:a,exchangeError:d,redirectAuthCallbackUrl:l,redirectAuthBackupCallbackUri:c,redirectAuthCodeChallenge:f,redirectAuthInitiator:p},g)),h(this,gs,!0,"f")}))}disconnectedCallback(){u(this,ms,"f").unsubscribeAll(),u(this,ys,"f").unsubscribeAll(),u(this,fs,"m",js).call(this),window.removeEventListener("popstate",u(this,ws,"f").popstate),window.removeEventListener("components-context",u(this,ws,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&u(this,gs,"f")&&t!==n&&ps.observedAttributes.includes(e)){u(this,fs,"m",Is).call(this);const i=null===t;u(this,ms,"f").update((({stepId:t,executionId:r})=>{let o=t,s=r;return i||(s=null,o=null,Kr()),{[Hr(e)]:n,stepId:o,executionId:s}})),u(this,ys,"f").update({isDebug:this.debug})}}};var Ws,Ls,Ds,_s,Fs,qs,Bs,Vs,Ks,Hs,zs,Gs,Js,Zs,Ys,Xs,Qs,ea,ta,na,ia,ra,oa,sa,aa,da,la,ca,ua,ha,fa,pa,ga,va,ma,ya,ba,$a,wa,Ca;ps=Ts,gs=new WeakMap,vs=new WeakMap,ms=new WeakMap,ys=new WeakMap,bs=new WeakMap,$s=new WeakMap,ws=new WeakMap,Cs=new WeakMap,fs=new WeakSet,ks=function(){this.injectStyle("\n :host {\n\t\t\twidth: 100%;\n display: block;\n\t\t}\n\n\t\t#root {\n\t\t\theight: 100%;\n display: flex;\n flex-direction: column;\n\t\t}\n\n #content-root {\n all: initial;\n transition: opacity 200ms ease-in-out;\n }\n\n\t\t#root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1!important;\n\t\t}\n\n .hidden {\n display: none;\n }\n ")},Ss=function(){u(this,fs,"m",ks).call(this),this.slotElement=document.createElement("slot"),this.slotElement.classList.add("hidden"),this.rootElement.appendChild(this.slotElement)},Is=function(){const e=["base-url","tenant","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","refresh-cookie-name","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur","style-id","outbound-app-id","outbound-app-scopes"];ps.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Hr(t)])throw Error(`${t} cannot be empty`)}))},xs=function(){const{stepId:e,executionId:t}=Vr(this.flowId);u(this,ms,"f").update({stepId:e,executionId:t})},Rs=function(e,t){di&&"function"==typeof di||this.logger.error("SDK was not loaded properly",di,JSON.stringify(di));const n=Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout,refreshCookieName:this.refreshCookieName},ps.sdkConfigOverrides),{projectId:e,baseUrl:t});u(this,vs,"f")&&(n.customStorage=u(this,vs,"f")),this.sdk=di(n),["start","next"].forEach((e=>{const t=function(e,t,n){return(...i)=>c(this,void 0,void 0,(function*(){let r;const o=n+1;for(let s=0;s<o;s++)try{return yield e(...i)}catch(e){r=e,s<n&&(yield new Promise((e=>{setTimeout(e,t*Math.pow(2,s+1))})))}throw r}))}(this.sdk.flow[e],1e3,3);this.sdk.flow[e]=(...n)=>c(this,void 0,void 0,(function*(){try{return yield t(...n)}catch(t){return this.logger.error(`Error in sdk flow ${e} function`,t),{error:{errorCode:ir,errorDescription:t.toString()}}}}))}))},Os=function(e,t,n){return c(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:i}=e;if(n("projectId")||n("baseUrl")){if(!t)return;u(this,fs,"m",Rs).call(this,t,i)}u(this,Cs,"f").call(this,e)}))},Es=function(){return c(this,void 0,void 0,(function*(){const e=yield this.getConfig();return"isMissingConfig"in e&&e.isMissingConfig&&(yield u(this,fs,"m",As).call(this))}))},As=function(){return c(this,void 0,void 0,(function*(){const e=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:i}){const r=new URL(or||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 c(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}}))},Ns=function(e){h(this,bs,Object.assign(Object.assign({},u(this,bs,"f")),e.detail),"f")},js=function(){var e;null===(e=u(this,$s,"f"))||void 0===e||e.remove(),h(this,$s,null,"f")},Ms=function(e){return c(this,arguments,void 0,(function*({isDebug:e}){e?(h(this,$s,document.createElement("descope-debugger"),"f"),Object.assign(u(this,$s,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return eC})),document.body.appendChild(u(this,$s,"f"))):u(this,fs,"m",js).call(this)}))},Ps=function(e,t){var n;e&&this.debug&&(null===(n=u(this,$s,"f"))||void 0===n||n.updateData({title:e,description:t}))},Ts.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.62.0"}};let ka=class extends Ts{static set sdkConfigOverrides(e){Ts.sdkConfigOverrides=e}static get sdkConfigOverrides(){return Ts.sdkConfigOverrides}constructor(){const e=new co({deferredRedirect:!1,deferredPolling:!1});super(e.update.bind(e)),Ws.add(this),this.stepState=new co({}),Ls.set(this,void 0),Ds.set(this,null),_s.set(this,null),Fs.set(this,{visibilitychange:u(this,Ws,"m",qs).bind(this)}),this.bridgeVersion=2,this.nativeCallbacks={},Zs.set(this,!1),this.handleRedirect=e=>{window.location.assign(e)},Xs.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()?u(this,Ws,"m",Qs).call(this,t):t()})),ea.set(this,((e,t,n,i,r=!1)=>{const o=[rr,"E103202"];if(this.flowState.current.action===Er){if(u(this,na,"f").call(this)&&document.hidden)return this.logger.debug("polling - Deferring polling until in foreground"),void this.flowState.update({deferredPolling:!0});this.logger.debug("polling - Scheduling polling request");const s=Date.now(),a=r?500:2e3;h(this,Ls,setTimeout((()=>c(this,void 0,void 0,(function*(){var d,l;this.logger.debug("polling - Calling next");const c=this.sdk.flow.next(e,t,Ur,n,i,{}),h=document.hidden&&!r&&Date.now()-s>a+500;let f;h&&this.logger.debug("polling - The polling seems to be throttled");try{const e=h?1e3:6e3;f=yield Zr(e,c)}catch(d){return this.logger.warn(`polling - The ${h?"throttled fetch":"fetch"} call timed out or was aborted`),void u(this,ea,"f").call(this,e,t,n,i,h)}if((null===(d=null==f?void 0:f.error)||void 0===d?void 0:d.errorCode)===ir)return this.logger.debug("polling - Got a generic error due to exception in fetch call"),void u(this,ea,"f").call(this,e,t,n,i);this.logger.debug("polling - Got a response"),(null==f?void 0:f.error)&&this.logger.debug("polling - Response has an error",JSON.stringify(f.error,null,4)),(null===(l=null==f?void 0:f.error)||void 0===l?void 0:l.errorCode)&&o.includes(f.error.errorCode)?this.logger.debug("polling - Stopping polling due to error"):u(this,ea,"f").call(this,e,t,n,i),u(this,ia,"f").call(this,f)}))),a),"f")}})),ta.set(this,(()=>{clearTimeout(u(this,Ls,"f")),h(this,Ls,null,"f")})),na.set(this,(()=>!!window.descopeBridge||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))),ia.set(this,(e=>{var t,n,i,r,o,s,a,d,l,c,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}`;u(this,Ws,"m",wa).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&&l!==rr||!this.isRestartOnError||u(this,Ws,"m",Js).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===(c=null===(l=e.data)||void 0===l?void 0:l.screen)||void 0===c?void 0:c.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:b,action:$,openInNewTabUrl:w}=e.data;if($!==Er&&u(this,ta,"f").call(this),"completed"===m){this.storeLastAuthenticatedUser&&Ro(Object.assign(Object.assign({},b),{lastUsedPerScreen:Oo()})),Eo(this.loggerWrapper);const t=Object.assign({},y);return e.data.output&&Object.keys(e.data.output).length>0&&(t.flowOutput=e.data.output),void u(this,Ws,"m",wa).call(this,"success",t)}this.storeLastAuthenticatedUser&&Ro(b,!0),w&&window.open(w,"_blank");const{executionId:C,stepId:k,stepName:S,screen:I,redirect:x,webauthn:R,error:O,samlIdpResponse:E,wsFedIdpResponse:A,nativeResponse:N}=e.data,j=Date.now();$!==Er?(this.loggerWrapper.info(`Step "${S||`#${k}`}" is ${m}`,"",{screen:I,status:m,stepId:k,stepName:S,action:$,error:O}),(null===(g=I.state)||void 0===g?void 0:g.clientScripts)&&h(this,_s,this.loadSdkScripts(I.state.clientScripts),"f"),this.flowState.update({stepId:k,stepName:S,executionId:C,action:$,redirectTo:null==x?void 0:x.url,redirectIsPopup:null==x?void 0:x.isPopup,screenId:null==I?void 0:I.id,screenState:null==I?void 0:I.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,wsFedIdpResponseUrl:null==A?void 0:A.url,wsFedIdpResponseWresult:null==A?void 0:A.wresult,wsFedIdpResponseWctx:null==A?void 0:A.wctx,nativeResponseType:null==N?void 0:N.type,nativePayload:null==N?void 0:N.payload,reqTimestamp:j})):this.flowState.update({action:$,reqTimestamp:j})})),ra.set(this,Gr((()=>c(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)}}))))),ca.set(this,null),ga.set(this,eo(((e,t,n)=>c(this,void 0,void 0,(function*(){var i;if("true"===e.getAttribute("formnovalidate")||u(this,Ws,"m",da).call(this)){const r=null==e?void 0:e.getAttribute("id");u(this,Ws,"m",ya).call(this,e,r,n),u(this,Ws,"m",ua).call(this,e);const o=yield u(this,Ws,"m",la).call(this),s=(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);this.nextRequestStatus.update({isLoading:!0});const a=Object.assign(Object.assign(Object.assign({},s),o),{origin:(null===(i=this.nativeOptions)||void 0===i?void 0:i.origin)||window.location.origin});yield t(r,a),this.nextRequestStatus.update({isLoading:!1}),u(this,Ws,"m",ha).call(this,o)}}))))),this.flowState=e}nativeResume(e,t){var n,i,r,o,s,a;const d=JSON.parse(t);if("oauthWeb"===e||"sso"===e){let e,{exchangeCode:t}=d;if(!t){const r=new URL(d.url);t=null===(n=r.searchParams)||void 0===n?void 0:n.get(dr),e=(null===(i=r.searchParams)||void 0===i?void 0:i.get(cr))||void 0}null===(o=(r=this.nativeCallbacks).complete)||void 0===o||o.call(r,{exchangeCode:t,exchangeError:e,idpInitiated:!0})}else if("magicLink"===e){const e=new URL(d.url),t=e.searchParams.get("t"),n=e.searchParams.get(ar).split("_").pop();u(this,ta,"f").call(this),this.flowState.update({token:t,stepId:n,action:void 0})}else if("beforeScreen"===e){const{screenResolve:e}=this.nativeCallbacks;this.nativeCallbacks.screenResolve=null;const{override:t}=d;t||(this.nativeCallbacks.screenNext=null),null==e||e(t)}else if("resumeScreen"===e){const{interactionId:e,form:t}=d,{screenNext:n}=this.nativeCallbacks;this.nativeCallbacks.screenNext=null,null==n||n(e,t)}else null===(a=(s=this.nativeCallbacks).complete)||void 0===a||a.call(s,d)}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:{[io(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=>c(this,void 0,void 0,(function*(){var n,i,r;const o=this.shadowRoot.querySelector(`[data-script-id="${e.id}"]`);if(o){this.loggerWrapper.debug("Script already loaded",e.id);const{moduleRes:t}=o;return null===(n=null==t?void 0:t.start)||void 0===n||n.call(t),t}(null===(i=globalThis.descope)||void 0===i?void 0:i[e.id])||(yield this.injectNpmLib("@descope/flow-scripts","1.0.16",`dist/${e.id}.js`));const s=null===(r=globalThis.descope)||void 0===r?void 0:r[e.id];return new Promise(((n,i)=>{try{const i=s(e.initArgs,{baseUrl:this.baseUrl,ref:this},t(e,n),this.loggerWrapper);if(i){const t=document.createElement("div");t.setAttribute("data-script-id",e.id),t.moduleRes=i,this.shadowRoot.appendChild(t);const n=this.nextRequestStatus.subscribe((()=>{var r;this.loggerWrapper.debug("Stopping script",e.id),(null===(r=i.stop)||void 0===r?void 0:r.call(i))&&(this.nextRequestStatus.unsubscribe(n),this.loggerWrapper.debug("Removing script",e.id),this.shadowRoot.removeChild(t))}))}}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 c(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)),u(this,Ws,"m",zs).call(this),window.addEventListener("visibilitychange",u(this,Fs,"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(),u(this,ta,"f").call(this),null===(e=u(this,Ds,"f"))||void 0===e||e.abort(),h(this,Ds,null,"f"),window.removeEventListener("visibilitychange",u(this,Fs,"f").visibilitychange)}getHtmlFilenameWithLocale(e,t){return c(this,void 0,void 0,(function*(){let n;const i=to(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 c(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 c(this,void 0,void 0,(function*(){var i,r;const{projectId:o,flowId:s,tenant:a,stepId:d,executionId:f,action:p,screenId:g,screenState:v,redirectTo:m,redirectIsPopup:y,redirectUrl:b,token:$,code:w,isPopup:C,exchangeError:k,webauthnTransactionId:S,webauthnOptions:I,redirectAuthCodeChallenge:x,redirectAuthCallbackUrl:R,redirectAuthBackupCallbackUri:O,redirectAuthInitiator:E,locale:A,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:j,samlIdpResponseRelayState:M,wsFedIdpResponseUrl:P,wsFedIdpResponseWresult:U,wsFedIdpResponseWctx:T,nativeResponseType:W,nativePayload:L,reqTimestamp:D}=e,_=l(e,["projectId","flowId","tenant","stepId","executionId","action","screenId","screenState","redirectTo","redirectIsPopup","redirectUrl","token","code","isPopup","exchangeError","webauthnTransactionId","webauthnOptions","redirectAuthCodeChallenge","redirectAuthCallbackUrl","redirectAuthBackupCallbackUri","redirectAuthInitiator","locale","samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState","wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx","nativeResponseType","nativePayload","reqTimestamp"]);let F,q,B;const V=(()=>{const e=ko(So);if(!e){const e=Math.floor(100*Math.random()+1);return Co(So,e.toString()),e}return Number(e)})(),{outboundAppId:K}=this,{outboundAppScopes:H}=this,z=this.sdk.getLastUserLoginId(),G=yield this.getFlowConfig(),J=yield this.getProjectConfig(),Z=Object.entries(J.flows||{}).reduce(((e,[t,n])=>(e[t]=n.version,e)),{}),Y=R&&x?{callbackUrl:R,codeChallenge:x,backupCallbackUri:O}:void 0,X=this.nativeOptions?{platform:this.nativeOptions.platform,bridgeVersion:this.nativeOptions.bridgeVersion,oauthProvider:this.nativeOptions.oauthProvider,oauthRedirect:this.nativeOptions.oauthRedirect,magicLinkRedirect:this.nativeOptions.magicLinkRedirect,ssoRedirect:this.nativeOptions.ssoRedirect,externalAuthRedirect:this.nativeOptions.externalAuthRedirect}:void 0;let Q={};if(!f){Eo(this.loggerWrapper);const e=[...G.clientScripts||[],...G.sdkScripts||[]];if(G.conditions){let t=[];({startScreenId:F,conditionInteractionId:B,startScreenName:q,clientScripts:t,componentsConfig:Q}=((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=Io[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:z,code:w,token:$,abTestingKey:V,lastAuth:xo(z,this.loggerWrapper)},G.conditions)),e.push(...t||[])}else G.condition?({startScreenId:F,conditionInteractionId:B}=((e,t)=>{var n;const i=null===(n=Io[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}})(G.condition,{loginId:z,code:w,token:$,abTestingKey:V,lastAuth:xo(z,this.loggerWrapper)})):(q=G.startScreenName,F=G.startScreenId);if(h(this,_s,this.loadSdkScripts(e),"f"),G.fingerprintEnabled&&G.fingerprintKey?yield On(G.fingerprintKey,this.baseUrl):sn(xn),!Yr(F,_)){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:Y},_),{client:this.client}),b&&{redirectUrl:b}),{lastAuth:xo(z,this.loggerWrapper),abTestingKey:V,locale:to(A).locale,nativeOptions:X,outboundAppId:K,outboundAppScopes:H}),B,"",J.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),w?{exchangeCode:w,idpInitiated:!0}:{}),_.descopeIdpInitiated&&{idpInitiated:!0}),$?{token:$}:{}),_.oidcLoginHint?{externalId:_.oidcLoginHint}:{}));return u(this,ia,"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(this.loggerWrapper.debug("Before popup postmessage send",JSON.stringify({isPopup:C,code:w,exchangeError:k,isCodeChanged:n("code"),isExchangeErrorChanged:n("exchangeError")})),C&&(n("code")&&w||n("exchangeError")&&k))return void u(this,Ws,"m",Ca).call(this,f,w,k);if(f&&(n("token")&&$||n("code")&&w||n("exchangeError")&&k)){const e=yield this.sdk.flow.next(f,d,Pr,G.version,J.componentsVersion,{token:$,exchangeCode:w,exchangeError:k});return u(this,ia,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(p===Mr&&N&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!j)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)})(N,j,M||"",Xr)}if(p===Mr&&P&&["wsFedIdpResponseUrl","wsFedIdpResponseWresult","wsFedIdpResponseWctx"].some((e=>n(e)))){if(!U)return void this.loggerWrapper.error("Did not get wsfed idp params data to load");((e,t,n,i)=>{const r=document.createElement("form");r.method="POST",r.action=e;const o=(e,t)=>{const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n};r.appendChild(o("wa","wsignin1.0")),r.appendChild(o("wresult",t)),r.appendChild(o("wctx",n));const s=document.createElement("input");s.type="submit",s.id="WSFedSubmitButton",s.value="Continue",s.style.display="none",r.appendChild(s),document.body.appendChild(r),i(r)})(P,U,T||"",Xr)}if(p===Or&&(n("redirectTo")||n("deferredRedirect"))){if(!m)return void this.loggerWrapper.error("Did not get redirect url");if("no-op"===m)return;if("android"===E&&document.hidden)return void this.flowState.update({deferredRedirect:!0});if(this.loggerWrapper.debug(`Redirect is popup ${y}`),y){this.loggerWrapper.debug("Opening redirect in popup");const e=((e,t,n,i)=>{const r=void 0!==window.screenLeft?window.screenLeft:window.screen.left,o=void 0!==window.screenTop?window.screenTop:window.screen.top,s=((window.innerWidth||document.documentElement.clientWidth||window.screen.width)-n)/2+r,a=((window.innerHeight||document.documentElement.clientHeight||window.screen.height)-i)/2+o,d=function(){const e=navigator.userAgent||"",t=/\b(iPhone)\b/.test(e),n=/Safari/.test(e)&&!/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(e);return t&&n}()?"about:blank":"",l=window.open(d,t,`width=${n},height=${i},top=${a},left=${s},scrollbars=yes,resizable=yes`);return l.location.href=e,l.focus(),l})(m,"?",598,700),t=this.shouldUsePopupPostMessage();t&&(e.name=`descope-wc|${window.location.origin}`),this.loggerWrapper.debug("Popup communication method: "+(t?"postMessage":"BroadcastChannel"));const n=e=>{this.loggerWrapper.debug("Received popup message",JSON.stringify(e.data));const n=t?this.popupOrigin:window.location.origin;if(e.origin!==n)return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${e.origin}", expected: "${n}"`);const{action:i,data:r}=e.data||{};"code"===i&&this.flowState.update({code:r.code,exchangeError:r.exchangeError})};let i;this.loggerWrapper.debug("Starting popup closed detection");const r=setInterval((()=>{e.closed&&(this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"),clearInterval(r),u(this,Ws,"m",wa).call(this,"popupclosed",{}),this.loggerWrapper.debug("Cleaning up popup listeners"),null==i||i())}),1e3);if(t)window.addEventListener("message",n),i=()=>{this.loggerWrapper.debug("Cleaning up popup postMessage listener"),window.removeEventListener("message",n)};else{this.loggerWrapper.debug("Creating broadcast channel");const e=new BroadcastChannel(f);e.onmessage=n,i=()=>{this.loggerWrapper.debug("Closing channel"),e.close()}}}else this.handleRedirect(m),this.flowState.update({redirectTo:"no-op"}),u(this,Ws,"m",wa).call(this,"popupclosed",{});return}if(p===Ar||p===Nr){if(!S||!I)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=u(this,Ds,"f"))||void 0===r||r.abort(),h(this,Ds,null,"f");try{e=p===Ar?yield this.sdk.webauthn.helpers.create(I):yield this.sdk.webauthn.helpers.get(I)}catch(e){"InvalidStateError"===e.name?this.loggerWrapper.warn("WebAuthn operation failed",e.message):"NotAllowedError"!==e.name&&this.loggerWrapper.error(e.message),t=e.name}const n=yield this.sdk.flow.next(f,d,Pr,G.version,J.componentsVersion,{transactionId:S,response:e,failure:t});u(this,ia,"f").call(this,n)}if(p===jr)return this.nativeCallbacks.complete=e=>c(this,void 0,void 0,(function*(){const t=yield this.sdk.flow.next(f,d,Pr,G.version,J.componentsVersion,e);u(this,ia,"f").call(this,t)})),u(this,Ws,"m",Ks).call(this,W,L),void setTimeout((()=>{this.dispatchEvent(new Event("popupclosed"))}),500);if((n("action")||n("deferredPolling"))&&u(this,ea,"f").call(this,f,d,G.version,J.componentsVersion),!g&&!F)return void this.loggerWrapper.warn("No screen was found to show");const ee=F||g,te=yield this.getHtmlFilenameWithLocale(A,ee),{oidcLoginHint:ne,oidcPrompt:ie,oidcErrorRedirectUri:re,oidcResource:oe,samlIdpUsername:se}=_,ae={direction:Br(d,t.stepId),screenState:Object.assign(Object.assign({},v),{form:Object.assign(Object.assign({},this.formConfigValues),null==v?void 0:v.form),lastAuth:{loginId:z,name:this.sdk.getLastUserDisplayName()||z},componentsConfig:Object.assign(Object.assign(Object.assign({},G.componentsConfig),Q),null==v?void 0:v.componentsConfig)}),htmlFilename:`${ee}.html`,htmlLocaleFilename:te,screenId:ee,stepName:e.stepName||q,samlIdpUsername:se,oidcLoginHint:ne,oidcPrompt:ie,oidcErrorRedirectUri:re,oidcResource:oe,action:p,locale:to(A).locale},de=xo(z,this.loggerWrapper);Yr(F,_)?ae.next=(e,t)=>c(this,void 0,void 0,(function*(){const n=(null==G?void 0:G.clientScripts)||[];yield u(this,Ws,"m",va).call(this,n);const i=yield this.sdk.flow.start(s,Object.assign(Object.assign(Object.assign(Object.assign({tenant:a,redirectAuth:Y},_),{lastAuth:de,preview:this.preview,abTestingKey:V,client:this.client}),b&&{redirectUrl:b}),{locale:to(A).locale,nativeOptions:X,outboundAppId:K,outboundAppScopes:H}),B,e,J.componentsVersion,Z,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),this.getComponentsContext()),no(t)),w&&{exchangeCode:w,idpInitiated:!0}),_.descopeIdpInitiated&&{idpInitiated:!0}),$&&{token:$}),ae.next.isCustomScreen);return u(this,ia,"f").call(this,i),i})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(ae.next=(e,t)=>c(this,void 0,void 0,(function*(){const n=(null==v?void 0:v.clientScripts)||[];yield u(this,Ws,"m",va).call(this,n);const i=yield this.sdk.flow.next(f,d,e,G.version,J.componentsVersion,Object.assign(Object.assign({},this.getComponentsContext()),no(t)),ae.next.isCustomScreen);return u(this,ia,"f").call(this,i),i}))),this.loggerWrapper.debug("Got a screen with id",ae.screenId),yield u(this,Ws,"m",Ys).call(this,ae),this.stepState.update(ae)}))}onStepChange(e,t){return c(this,void 0,void 0,(function*(){var n,i,r;const{htmlFilename:o,htmlLocaleFilename:s,direction:a,next:d,screenState:l,screenId:h}=e;this.loggerWrapper.debug("Rendering a flow screen");const f=document.createElement("template");f.innerHTML=yield this.getPageContent(o,s);const p=f.content.cloneNode(!0),g=this.loadDescopeUiComponents(f);this.sdk.webauthn.helpers.isSupported()?yield u(this,Ws,"m",sa).call(this,p,d):(e=>{e.querySelectorAll(`descope-button[${Rr}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true")))})(p),!e.samlIdpUsername||(null===(n=l.form)||void 0===n?void 0:n.loginId)||(null===(i=l.form)||void 0===i?void 0:i.email)||(l.form||(l.form={}),l.form.loginId=e.samlIdpUsername,l.form.email=e.samlIdpUsername),bo(p,l,this.formConfig,this.loggerWrapper);const{geo:v}=null!==(r=yield this.getExecutionContext())&&void 0!==r?r:{};((e,t)=>{Object.entries({"default-code":"autoDetect","default-country":"autoDetect"}).forEach((([n,i])=>{Array.from(e.querySelectorAll(`[${n}="${i}"]`)).forEach((e=>{e.setAttribute(n,t||i)}))}))})(p,v),((e,t)=>{let n=t;if(t)try{const[e]=Intl.getCanonicalLocales(t);e&&(n=e)}catch(e){}Object.entries({lang:"autoDetect"}).forEach((([t,i])=>{Array.from(e.querySelectorAll(`[${t}="${i}"]`)).forEach((e=>{e.setAttribute(t,n||i)}))}))})(p,e.locale);const m=()=>c(this,void 0,void 0,(function*(){var n,i;yield g;const r=this.contentRootElement;((e,t)=>{yo(e,"descope-totp-image",t)})(r,null===(n=null==l?void 0:l.totp)||void 0===n?void 0:n.image),((e,t)=>{yo(e,"descope-notp-image",t)})(r,null===(i=null==l?void 0:l.notp)||void 0===i?void 0:i.image),((e,t,n,i)=>{n&&Object.keys(n).forEach((r=>{if(!t.querySelector(r))return void 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.debug(`Could not find component class for ${r}`,"Check if the component is registered")}))})(r,p,l.cssVars,this.loggerWrapper),r.replaceChildren(p);const o=!t.htmlFilename;setTimeout((()=>{u(this,Ws,"m",fa).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)=>{po(e,null==t?void 0:t.inputs),po(e,null==t?void 0:t.form)})(r,l),u(this,Ws,"m",aa).call(this,{isFirstScreen:o,isCustomScreen:!1,stepName:e.stepName}),Jr(r,this.autoFocus,o),u(this,Ws,"m",ba).call(this,h)})),u(this,Ws,"m",$a).call(this,d,h),r.querySelector(`[${Rr}="polling"]`)&&d(Ur,{})}));a?u(this,Ws,"m",Qs).call(this,m):m()}))}getInputs(){return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${ur}])`))}shouldUsePopupPostMessage(){if(!this.popupOrigin)return!1;try{new URL(this.popupOrigin)}catch(e){return!1}return!0}};Ls=new WeakMap,Ds=new WeakMap,_s=new WeakMap,Fs=new WeakMap,Zs=new WeakMap,Xs=new WeakMap,ea=new WeakMap,ta=new WeakMap,na=new WeakMap,ia=new WeakMap,ra=new WeakMap,ca=new WeakMap,ga=new WeakMap,Ws=new WeakSet,qs=function(){document.hidden||setTimeout((()=>{this.flowState.update({deferredRedirect:!1,deferredPolling:!1})}),300)},Bs=function(e,t,n){return c(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,u(this,Ws,"m",Ks).call(this,"beforeScreen",{screen:e,context:t})}))}))},Vs=function(e){var t;(null===(t=this.nativeOptions)||void 0===t?void 0:t.bridgeVersion)>=2&&u(this,Ws,"m",Ks).call(this,"afterScreen",{screen:e})},Ks=function(e,t){u(this,Ws,"m",wa).call(this,"bridge",{type:e,payload:t})},Hs=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(`[${Rr}="${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()},zs=function(){var e,t,n;null===(e=this.stepState)||void 0===e||e.subscribe(this.onStepChange.bind(this),(e=>{var t=e.screenState,n=l(void 0===t?{}:t,["errorText","errorType"]),i=l(e,["screenState"]);return Object.assign(Object.assign({},i),{screenState:n})})),null===(t=this.stepState)||void 0===t||t.subscribe(u(this,Ws,"m",Hs).bind(this),(e=>{var t,n;return{errorText:null===(t=null==e?void 0:e.screenState)||void 0===t?void 0:t.errorText,errorType:null===(n=null==e?void 0:e.screenState)||void 0===n?void 0:n.errorType}}),{forceUpdate:!0}),null===(n=this.stepState)||void 0===n||n.subscribe(u(this,Ws,"m",Gs).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})},Gs=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=""}))})),Jr(this.contentRootElement,this.autoFocus,!1))},Js=function(){return c(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")}))},Ys=function(e){return c(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=>{var t,n,i;const r=(o=e.screenState,s=(e,t)=>Lr.includes(t)||t.startsWith("_"),Object.fromEntries(Object.entries(o).filter((([e,t])=>!s(0,e)))));var o,s;const{screenState:{errorText:a,errorType:d}}=e;return(a||d)&&(r.error={text:a,type:d}),e.action&&(r.action=e.action),(null===(i=null===(n=null===(t=e.screenState)||void 0===t?void 0:t.componentsConfig)||void 0===n?void 0:n.thirdPartyAppApproveScopes)||void 0===i?void 0:i.data)&&(r.inboundAppApproveScopes=e.screenState.componentsConfig.thirdPartyAppApproveScopes.data),r})(l(n,["next","stepName"]));let s=yield u(this,Ws,"m",Bs).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(u(this,Xs,"f").call(this,s),i&&(i.isCustomScreen=s),u(this,Zs,"f")!==s){const[e,t]=["flow","custom"].sort((()=>s?-1:1));this.loggerWrapper.debug(`Switching from ${t} screen to ${e} screen`),h(this,Zs,s,"f"),s?this.stepState.unsubscribeAll():u(this,Ws,"m",zs).call(this)}s?(this.loggerWrapper.debug("Showing a custom screen"),u(this,Ws,"m",aa).call(this,{isFirstScreen:a,isCustomScreen:s,stepName:e.stepName}),this.disableKeyPressHandler()):this.handleKeyPress(),this.stepState.forceUpdate=s}))},Qs=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")},oa=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)}))}},sa=function(e,t){return c(this,void 0,void 0,(function*(){var n;null===(n=u(this,Ds,"f"))||void 0===n||n.abort();const i=e.querySelector('*[autocomplete="webauthn"]');if(i&&(yield $o())){const{options:e,transactionId:n}=(yield u(this,ra,"f").call(this))||{};e&&n&&(u(this,Ws,"m",oa).call(this,i),h(this,Ds,new AbortController,"f"),this.sdk.webauthn.helpers.conditional(e,u(this,Ds,"f")).then((e=>c(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)})))}}))},aa=function({isFirstScreen:e,isCustomScreen:t,stepName:n}){e&&u(this,Ws,"m",wa).call(this,"ready",{}),t||u(this,Ws,"m",Vs).call(this,n),u(this,Ws,"m",wa).call(this,"page-updated",{screenName:n}),u(this,Ws,"m",wa).call(this,"screen-updated",{screenName:n})},da=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,i;"slot"===t.localName||t.classList.contains("hidden")||(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},la=function(){return c(this,void 0,void 0,(function*(){const e=this.getInputs();return(yield Promise.all(e.map((e=>c(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})),{})}))},ua=function(e){const t=Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter((t=>t!==e)),n=()=>c(this,void 0,void 0,(function*(){this.loggerWrapper.debug("Restoring components state"),this.removeEventListener("popupclosed",n),e.removeAttribute("loading"),t.forEach((e=>{e.removeAttribute("disabled")}));const i=yield this.getFlowConfig(),r=[...i.clientScripts||[],...i.sdkScripts||[]];this.loadSdkScripts(r)})),i=()=>{var e;window.removeEventListener("pageshow",u(this,ca,"f")),h(this,ca,(e=>{e.persisted&&(this.logger.debug("Page was loaded from cache, restoring components state"),n())}),"f"),window.addEventListener("pageshow",u(this,ca,"f"),{once:!0});const t=null===(e=this.stepState)||void 0===e?void 0:e.subscribe(((e,i)=>{e===i&&n(),this.removeEventListener("popupclosed",n),this.stepState.unsubscribe(t)}),(e=>e.screenId),{forceUpdate:!0})},r=this.nextRequestStatus.subscribe((({isLoading:o})=>{o?(this.addEventListener("popupclosed",n,{once:!0}),e.setAttribute("loading","true"),t.forEach((e=>e.setAttribute("disabled","true")))):(this.nextRequestStatus.unsubscribe(r),i())}))},ha=function(e={}){var t,n;const i=Qr(e,["externalId","email","phone"]),r=Qr(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)}},fa=function(){document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),this.contentRootElement.querySelectorAll('[external-input="true"]').forEach((e=>u(this,Ws,"m",pa).call(this,e)))},pa=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)}))},va=function(e){return c(this,void 0,void 0,(function*(){if(u(this,_s,"f")){this.loggerWrapper.debug("Waiting for sdk scripts to load");const e=Date.now();yield u(this,_s,"f"),this.loggerWrapper.debug("Sdk scripts loaded for",(Date.now()-e).toString())}const t=this.loadSdkScriptsModules(),n=e.map((e=>e.id));for(const e of t)if(n.includes(e.id))try{"function"==typeof e.present&&((yield e.present())||this.loggerWrapper.debug(`Sdk script ${e.id} was cancelled`))}catch(t){this.loggerWrapper.error(`Failed to present ${e.id} script module`,t.message)}const i=[];for(const e of t)"function"==typeof e.refresh&&i.push(e.refresh());if(i.length>0)try{yield Zr(5e3,Promise.all(i),null)}catch(e){this.loggerWrapper.error("Failed to refresh script module",e.message)}}))},ma=function(e,t){this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach((n=>{n.addEventListener("input",(()=>{var i;(null===(i=n.checkValidity)||void 0===i?void 0:i.call(n))&&u(this,ga,"f").call(this,n,e,t)}))}))},ya=function(e,t,n){t&&n&&"true"===e.getAttribute("data-opt-in-last-used-auth")&&function(e,t,n){try{const n=Oo();n[e]=t,Co(Wr,JSON.stringify(n))}catch(e){null==n||n.warn("[Descope] Failed to update in-flight last auth storage",String(e))}}(n,t,this.loggerWrapper)},ba=function(e){var t;const n=null===(t=xo(this.sdk.getLastUserLoginId(),this.loggerWrapper).lastUsedPerScreen)||void 0===t?void 0:t[e];if(!n)return;const i=this.contentRootElement.querySelector('descope-attachment[data-type="last-auth-badge"]'),r=this.contentRootElement.querySelector(`#${CSS.escape(n)}`);i&&r&&(r.replaceWith(i),i.appendChild(r))},$a=function(e,t){this.contentRootElement.querySelectorAll(`descope-button:not([${hr}]), [data-type="button"]:not([${hr}]`).forEach((n=>{n.onclick=()=>{u(this,ga,"f").call(this,n,e,t)}})),u(this,Ws,"m",ma).call(this,e,t),this.isDismissScreenErrorOnInput&&this.contentRootElement.querySelectorAll(`*[name]:not([${ur}])`).forEach((e=>{e.addEventListener("input",(()=>{this.stepState.update((e=>Object.assign(Object.assign({},e),{screenState:Object.assign(Object.assign({},e.screenState),{errorText:"",errorType:""})})))}))}))},wa=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},Ca=function(e,t,n){var i;const[r,o]=(null===(i=window.name)||void 0===i?void 0:i.split("|"))||[],s={data:{code:t,exchangeError:n},action:"code"};if("descope-wc"===r&&o){this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin",o);try{window.opener.postMessage(s,o)}catch(e){this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)",null==e?void 0:e.message)}}else{this.loggerWrapper.debug("Creating popup channel",e);const t=new BroadcastChannel(e);t.postMessage(s),t.close()}try{window.close()}catch(e){}},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",ka);var Sa=Object.freeze({__proto__:null,default:ka});const Ia=Si((e=>{var t,n,i,r,o,s,a;return a=class extends(mi(Lo,jo)(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&&u(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&&u(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)),u(this,t,"m",o).call(this)}},n=new WeakMap,t=new WeakSet,i=function(){var e;null===(e=u(this,n,"f"))||void 0===e||e.remove(),h(this,n,null,"f")},r=async function(){h(this,n,document.createElement("descope-debugger"),"f"),Object.assign(u(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return gC})),document.body.appendChild(u(this,n,"f"))},o=function(){this.debug?u(this,t,"m",r).call(this):u(this,t,"m",i).call(this)},s=function(e,t){var i;e&&(null===(i=u(this,n,"f"))||void 0===i||i.updateData({title:e,description:t}))},a})),xa="descope-modal";var Ra,Oa;class Ea{constructor(e,t){Ra.set(this,void 0),this.nodeName="",h(this,Ra,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)})))(u(this,Ra,"f"))}get ele(){var e,t;const n="function"==typeof u(this,Ra,"f")?u(this,Ra,"f").call(this):u(this,Ra,"f");return n?(null==n?void 0:n.localName)!==this.nodeName?(null===(t=this.logger)||void 0===t||t.debug(`node name do not match, expected "${this.nodeName}", received "${n.localName}" `,Error()),null):n:(null===(e=this.logger)||void 0===e||e.debug(`Driver element is not available for ${this.nodeName}`,new Error),null)}get isExists(){return!!this.ele}}Ra=new WeakMap;class Aa extends Ea{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}}let Na=class extends Ea{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)}}},ja=class extends Ea{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")}},Ma=class extends Ea{constructor(){super(...arguments),this.nodeName="descope-wc"}set projectId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("project-id",e)}set baseUrl(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("base-url",e)}set flowId(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("flow-id",e)}set theme(e){var t,n;e?null===(n=this.ele)||void 0===n||n.setAttribute("theme",e):null===(t=this.ele)||void 0===t||t.removeAttribute("theme")}onSuccess(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("success",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("success",e)}}onPageUpdated(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("page-updated",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("page-updated",e)}}};class Pa extends ja{get flowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id"))||""}get enableMode(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("enable-mode")}}const Ua=/^descope-grid-([^-]+)-column$/,Ta={text:class extends Ea{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 Ea{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 Wa=class extends Ea{constructor(){super(...arguments),this.nodeName="descope-grid",Oa.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=Ua.exec(t.localName))||void 0===n?void 0:n[1],r=Ta[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);i&&this.ele.columns&&(bi(i,this.ele.columns)||(this.ele.columns=i,null===(n=u(this,Oa,"f"))||void 0===n||n.call(this,i)))}onColumnsChange(e){h(this,Oa,e,"f")}set renderColumn(e){this.ele.renderColumn=e}};Oa=new WeakMap;let La=class extends Ea{constructor(){super(...arguments),this.nodeName="descope-link"}get ele(){return super.ele}get href(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("href")}set href(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("href",null!=e?e:"")}};var Da;let _a=class extends Ea{constructor(){super(...arguments),Da.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=""),u(this,Da,"f")&&(null===(e=this.ele)||void 0===e||e.append(u(this,Da,"f").content.cloneNode(!0)))}setContent(e){h(this,Da,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}};Da=new WeakMap;let Fa=class extends Ea{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()))}},qa=class extends Ea{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()}},Ba=class extends Ea{constructor(){super(...arguments),this.nodeName="descope-outbound-apps"}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}get connectFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("connect-flow-id"))||""}get disconnectFlowId(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("disconnect-flow-id"))||""}onConnectClick(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("connect-clicked",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("connect-clicked",n)}}onDisconnectClick(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("disconnect-clicked",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("disconnect-clicked",n)}}},Va=class extends Ea{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()))}setAllowCustomValue(e){this.ele&&this.ele.toggleAttribute("allow-custom-value",e)}},Ka=class extends Ea{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)}},Ha=class extends Ea{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")}},za=class extends Ea{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)}}},Ga=class extends Ea{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")}onUnfulfilledButtonClick(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)}}onFulfilledButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("fulfilled-button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("fulfilled-button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}get fulfilledFlowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("fulfilled-flow-id")}},Ja=class extends Ea{constructor(){super(...arguments),this.nodeName="descope-trusted-devices"}set displayName(e){var t;null===(t=this.ele)||void 0===t||t.setAttribute("display-name",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 flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}onRemoveDeviceClick(e){var t;const n=t=>e(t.detail);return null===(t=this.ele)||void 0===t||t.addEventListener("remove-device-clicked",n),()=>{var e;return null===(e=this.ele)||void 0===e?void 0:e.removeEventListener("remove-device-clicked",n)}}},Za=class extends Va{get action(){var e;return(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data-action"))||""}get refreshTimeout(){var e;return Number(null===(e=this.ele)||void 0===e?void 0:e.getAttribute("data-refresh-timeout"))||500}get shouldReload(){return"reload"===this.action}};const Ya=Si((e=>{var t,n;const i=mi(Lo,as,ts)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _a{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(xa);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(u(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([xa]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Xa="descope-notification",Qa=Si((e=>{var t,n;const i=mi(Lo,as,ts)(e);return n=class extends i{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends qa{setContent(t){const n="string"==typeof t?yi(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Xa);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(u(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([Xa])}},t=new WeakMap,n}));function ed(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 td=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),nd=()=>Math.random().toString(36).substring(7).split("").join("."),id={INIT:`@@redux/INIT${nd()}`,REPLACE:`@@redux/REPLACE${nd()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${nd()}`};function rd(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 od(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 sd(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=od(e)),t}function ad(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?ed(2):`Expected the root reducer to be a function. Instead, received: '${sd(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?ed(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?ed(1):`Expected the enhancer to be a function. Instead, received: '${sd(n)}'`);return n(ad)(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?ed(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?ed(4):`Expected the listener to be a function. Instead, received: '${sd(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?ed(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?ed(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(!rd(e))throw new Error("production"===process.env.NODE_ENV?ed(7):`Actions must be plain objects. Instead, the actual type was: '${sd(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?ed(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?ed(17):`Action "type" property must be a string. Instead, the actual type was: '${sd(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?ed(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:id.INIT});return{dispatch:h,subscribe:u,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?ed(10):`Expected the nextReducer to be a function. Instead, received: '${sd(e)}`);i=e,h({type:id.REPLACE})},[td]:function(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?ed(11):`Expected the observer to be an object. Instead, received: '${sd(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[td](){return this}}}}}function dd(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function ld(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]&&dd(`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:id.INIT}))throw new Error("production"===process.env.NODE_ENV?ed(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:id.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?ed(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${id.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===id.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(!rd(e))return`The ${o} has unexpected type of "${sd(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===id.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&&dd(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?ed(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 cd(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ud(e){return rd(e)&&"type"in e&&"string"==typeof e.type}var hd=Symbol.for("immer-nothing"),fd=Symbol.for("immer-draftable"),pd=Symbol.for("immer-state"),gd="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 vd(e,...t){if("production"!==process.env.NODE_ENV){const n=gd[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 md=Object.getPrototypeOf;function yd(e){return!!e&&!!e[pd]}function bd(e){return!!e&&(wd(e)||Array.isArray(e)||!!e[fd]||!!e.constructor?.[fd]||xd(e)||Rd(e))}var $d=Object.prototype.constructor.toString();function wd(e){if(!e||"object"!=typeof e)return!1;const t=md(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)===$d}function Cd(e,t){0===kd(e)?Object.entries(e).forEach((([n,i])=>{t(n,i,e)})):e.forEach(((n,i)=>t(i,n,e)))}function kd(e){const t=e[pd];return t?t.type_:Array.isArray(e)?1:xd(e)?2:Rd(e)?3:0}function Sd(e,t){return 2===kd(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Id(e,t,n){const i=kd(e);2===i?e.set(t,n):3===i?e.add(n):e[t]=n}function xd(e){return e instanceof Map}function Rd(e){return e instanceof Set}function Od(e){return e.copy_||e.base_}function Ed(e,t){if(xd(e))return new Map(e);if(Rd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&wd(e)){if(!md(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[pd];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(md(e),n)}function Ad(e,t=!1){return jd(e)||yd(e)||!bd(e)||(kd(e)>1&&(e.set=e.add=e.clear=e.delete=Nd),Object.freeze(e),t&&Cd(e,((e,t)=>Ad(t,!0)))),e}function Nd(){vd(2)}function jd(e){return Object.isFrozen(e)}var Md,Pd={};function Ud(e){const t=Pd[e];return t||vd(0,e),t}function Td(){return Md}function Wd(e,t){t&&(Ud("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ld(e){Dd(e),e.drafts_.forEach(Fd),e.drafts_=null}function Dd(e){e===Md&&(Md=e.parent_)}function _d(e){return Md={drafts_:[],parent_:Md,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Fd(e){const t=e[pd];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function qd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[pd].modified_&&(Ld(t),vd(4)),bd(e)&&(e=Bd(t,e),t.parent_||Kd(t,e)),t.patches_&&Ud("Patches").generateReplacementPatches_(n[pd].base_,e,t.patches_,t.inversePatches_)):e=Bd(t,n,[]),Ld(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==hd?e:void 0}function Bd(e,t,n){if(jd(t))return t;const i=t[pd];if(!i)return Cd(t,((r,o)=>Vd(e,i,t,r,o,n))),t;if(i.scope_!==e)return t;if(!i.modified_)return Kd(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),Cd(r,((r,s)=>Vd(e,i,t,r,s,n,o))),Kd(e,t,!1),n&&e.patches_&&Ud("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Vd(e,t,n,i,r,o,s){if("production"!==process.env.NODE_ENV&&r===n&&vd(5),yd(r)){const s=Bd(e,r,o&&t&&3!==t.type_&&!Sd(t.assigned_,i)?o.concat(i):void 0);if(Id(n,i,s),!yd(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(bd(r)&&!jd(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Bd(e,r),t&&t.scope_.parent_||Kd(e,r)}}function Kd(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ad(t,n)}var Hd={get(e,t){if(t===pd)return e;const n=Od(e);if(!Sd(n,t))return function(e,t,n){const i=Jd(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_||!bd(i)?i:i===Gd(e.base_,t)?(Yd(e),e.copy_[t]=Xd(i,e)):i},has:(e,t)=>t in Od(e),ownKeys:e=>Reflect.ownKeys(Od(e)),set(e,t,n){const i=Jd(Od(e),t);if(i?.set)return i.set.call(e.draft_,n),!0;if(!e.modified_){const i=Gd(Od(e),t),r=i?.[pd];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||Sd(e.base_,t)))return!0;Yd(e),Zd(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!==Gd(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Yd(e),Zd(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Od(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty(){vd(11)},getPrototypeOf:e=>md(e.base_),setPrototypeOf(){vd(12)}},zd={};function Gd(e,t){const n=e[pd];return(n?Od(n):e)[t]}function Jd(e,t){if(!(t in e))return;let n=md(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=md(n)}}function Zd(e){e.modified_||(e.modified_=!0,e.parent_&&Zd(e.parent_))}function Yd(e){e.copy_||(e.copy_=Ed(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Cd(Hd,((e,t)=>{zd[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),zd.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&vd(13),zd.set.call(this,e,t,void 0)},zd.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&vd(14),Hd.set.call(this,e[0],t,n,e[0])};function Xd(e,t){const n=xd(e)?Ud("MapSet").proxyMap_(e,t):Rd(e)?Ud("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),i={type_:n?1:0,scope_:t?t.scope_:Td(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,o=Hd;n&&(r=[i],o=zd);const{revoke:s,proxy:a}=Proxy.revocable(r,o);return i.draft_=a,i.revoke_=s,a}(e,t);return(t?t.scope_:Td()).drafts_.push(n),n}function Qd(e){return yd(e)||vd(10,e),el(e)}function el(e){if(!bd(e)||jd(e))return e;const t=e[pd];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ed(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ed(e,!0);return Cd(n,((e,t)=>{Id(n,e,el(t))})),t&&(t.finalized_=!1),n}var tl=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&&vd(6),void 0!==n&&"function"!=typeof n&&vd(7),bd(e)){const r=_d(this),o=Xd(e,void 0);let s=!0;try{i=t(o),s=!1}finally{s?Ld(r):Dd(r)}return Wd(r,n),qd(i,r)}if(!e||"object"!=typeof e){if(i=t(e),void 0===i&&(i=e),i===hd&&(i=void 0),this.autoFreeze_&&Ad(i,!0),n){const t=[],r=[];Ud("Patches").generateReplacementPatches_(e,i,t,r),n(t,r)}return i}vd(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){bd(e)||vd(8),yd(e)&&(e=Qd(e));const t=_d(this),n=Xd(e,void 0);return n[pd].isManual_=!0,Dd(t),n}finishDraft(e,t){const n=e&&e[pd];n&&n.isManual_||vd(9);const{scope_:i}=n;return Wd(i,t),qd(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=Ud("Patches").applyPatches_;return yd(e)?i(e,t):this.produce(e,(e=>i(e,t)))}},nl=tl.produce;tl.produceWithPatches.bind(tl),tl.setAutoFreeze.bind(tl),tl.setUseStrictShallowCopy.bind(tl),tl.applyPatches.bind(tl),tl.createDraft.bind(tl),tl.finishDraft.bind(tl);var il=(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})}}},rl=(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})}},ol={inputStabilityCheck:"once",identityFunctionCheck:"once"};var sl=e=>Array.isArray(e)?e:[e];function al(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 dl(e,t){const n=[],{length:i}=e;for(let r=0;r<i;r++)n.push(e[r].apply(null,t));return n}var ll="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},cl=0,ul=1;function hl(){return{s:cl,v:void 0,o:null,p:null}}function fl(e,t={}){let n=hl();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=hl(),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=hl(),e.set(n,t)):t=i}}const a=t;let d;if(t.s===ul)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 ll(d):d}return a.s=ul,a.v=d,d}return s.clearCache=()=>{n=hl(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function pl(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=fl,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,f=sl(l),p=sl(u),g=al(e),v=d((function(){return i++,s.apply(null,arguments)}),...f);let m=!0;const y=c((function(){r++;const e=dl(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}={...ol,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:il},inputStabilityCheck:{shouldRun:"always"===i||"once"===i&&e,run:rl}}})(m,h);if(n.shouldRun&&n.run(s,e,t),i.shouldRun){const t=dl(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 gl=pl(fl),vl=Object.assign(((e,t=gl)=>{!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:()=>vl});function ml(e){return({dispatch:t,getState:n})=>i=>r=>"function"==typeof r?r(t,n,e):i(r)}var yl=ml(),bl=ml;((...e)=>{const t=pl(...e)})(fl);var $l="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?cd:cd.apply(null,arguments)},wl=e=>e&&"function"==typeof e.match;function Cl(e,t){function n(...n){if(t){let i=t(...n);if(!i)throw new Error("production"===process.env.NODE_ENV?nc(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=>ud(t)&&t.type===e,n}function kl(e){return"function"==typeof e&&"type"in e&&wl(e)}function Sl(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 Il=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 xl(e){return bd(e)?nl(e,(()=>{})):e}function Rl(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?nc(10):"No insert provided for key not already in map");const i=n.insert(t,e);return e.set(t,i),i}function Ol(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function El(e,t,n){const i=Al(e,t,n);return{detectMutations:()=>Nl(e,t,i,n)}}function Al(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]=Al(e,t,n[r],s))}}return o}function Nl(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=Nl(e,t,n.children[r],i[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function jl(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||rd(e)}function Ml(e,t="",n=jl,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=Ml(l,a,n,i,r,o),s))return s}return o&&Pl(e)&&o.add(e),!1}function Pl(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Pl(t))return!1;return!0}function Ul(e){return"boolean"==typeof e}var Tl=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:r=!0}=e??{};let o=new Il;if(t&&(Ul(t)?o.push(yl):o.push(bl(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Ul(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=Ol,ignoredPaths:r,warnAfter:o=32}=e;const s=El.bind(null,i,r);return({getState:e})=>{let n,i=e(),r=s(i);return a=>d=>{const l=Sl(o,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(i=e(),n=r.detectMutations(),r=s(i),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?nc(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?nc(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={};Ul(i)||(e=i),o.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=jl,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(!ud(u))return l(u);const h=l(u),f=Sl(s,"SerializableStateInvariantMiddleware");return d||i.length&&-1!==i.indexOf(u.type)||f.measureTime((()=>{const e=Ml(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=Ml(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={};Ul(r)||(e=r),o.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=kl}=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},Wl=e=>t=>{setTimeout(t,e)},Ll="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Wl(10),Dl=e=>function(t){const{autoBatch:n=!0}=t??{};let i=new Il(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?Ll:"callback"===e.type?e.queueNotification:Wl(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},_l="production"===process.env.NODE_ENV;function Fl(e){const t=Tl(),{reducer:n,middleware:i,devTools:r=!0,preloadedState:o,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!rd(n))throw new Error("production"===process.env.NODE_ENV?nc(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ld(n)}if(!_l&&i&&"function"!=typeof i)throw new Error("production"===process.env.NODE_ENV?nc(2):"`middleware` field must be a callback");if("function"==typeof i){if(d=i(t),!_l&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?nc(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!_l&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?nc(4):"each middleware provided to configureStore must be a function");let l=cd;r&&(l=$l({trace:!_l,..."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?ed(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=cd(...a)(r.dispatch),{...r,dispatch:o}}}(...d),u=Dl(c);if(!_l&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?nc(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!_l&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?nc(6):"`enhancers` callback must return an array");if(!_l&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?nc(7):"each enhancer provided to configureStore must be a function");_l||!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 ad(a,o,l(...h))}function ql(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?nc(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(i)throw new Error("production"===process.env.NODE_ENV?nc(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?nc(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?nc(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?nc(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?nc(31):"`builder.addDefaultCase` can only be called once");return i=e,r}};return e(r),[t,n,i]}function Bl(...e){return t=>e.some((e=>((e,t)=>wl(e)?e.match(t):e(t))(e,t)))}var Vl=["name","message","stack","code"],Kl=class{constructor(e,t){this.payload=e,this.meta=t}_type},Hl=class{constructor(e,t){this.payload=e,this.meta=t}_type},zl=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Vl)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Gl=(()=>{function e(e,t,n){const i=Cl(e+"/fulfilled",((e,t,n,i)=>({payload:e,meta:{...i||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Cl(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),o=Cl(e+"/rejected",((e,t,i,r,o)=>({payload:r,error:(n&&n.serializeError||zl)(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 Kl(e,t),fulfillWithValue:(e,t)=>new Hl(e,t)})).then((t=>{if(t instanceof Kl)throw t;return t instanceof Hl?i(t.payload,l,e,t.meta):i(t,l,e)}))])}catch(t){f=t instanceof Kl?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(Jl)})}}),{pending:r,rejected:o,fulfilled:i,settled:Bl(o,i),typePrefix:e})}return e.withTypes=()=>e,e})();function Jl(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Zl=Symbol.for("rtk-slice-createasyncthunk");function Yl(e,t){return`${e}/${t}`}function Xl(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?nc(16):"selectState returned undefined for an uninjected slice reducer");return t(s,...o)}return r.unwrapped=t,r}var Ql=function({creators:e}={}){const t=e?.asyncThunk?.[Zl];return function(e){const{name:n,reducerPath:i=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?nc(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?nc(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?nc(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?nc(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?ql(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?nc(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]=ql(t);if(function(e){return"function"==typeof e}(e))n=()=>xl(e());else{const t=xl(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(yd(e)){const i=n(e,t);return void 0===i?e:i}if(bd(e))return nl(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?nc(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:Yl(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?nc(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?Cl(e,s):Cl(e))}(s,o,a):function({type:e,reducerName:t},n,i,r){if(!r)throw new Error("production"===process.env.NODE_ENV?nc(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||ec,pending:a||ec,rejected:d||ec,settled:l||ec})}(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=Rl(c,this,{insert:()=>new WeakMap});return Rl(n,t,{insert:()=>{const n={};for(const[i,r]of Object.entries(e.selectors??{}))n[i]=Xl(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?nc(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 ec(){}var tc="listenerMiddleware";function nc(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. `}Cl(`${tc}/add`),Cl(`${tc}/removeAll`),Cl(`${tc}/remove`);const ic=e=>Si((t=>{const n=Ql(e),i=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(mi(jo)(t)){constructor(...e){super(...e);const t=Fl({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{Jl(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()))))}}})),rc=Si((e=>class extends(jo(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()}})),oc=Si((e=>class extends e{get refreshCookieName(){return this.getAttribute("refresh-cookie-name")||""}})),sc=e=>e.selectedAccessKeysIds,ac=e=>e.notifications,dc=gl((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}))))),lc=gl(sc,dc,((e,t)=>t.filter((t=>e.includes(t.id))))),cc=gl(sc,(e=>!!e.length)),uc=gl(lc,(e=>e.every((e=>e.editable)))),hc=gl(uc,cc,((e,t)=>e&&t)),fc=gl(lc,(e=>e.some((e=>"expired"===e.status)))),pc=gl(hc,fc,((e,t)=>e&&!t));gl(sc,(e=>1===e.length));const gc=gl(lc,(e=>1===e.length?e[0].name:`${e.length} access keys`)),vc=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)}))}))},mc=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}}),yc=({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)})}}),bc=Gl("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),$c=vc(bc)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},mc((e=>e.createAccessKey)),yc({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>`}})),wc={action:bc,reducer:$c},Cc=Gl("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),kc=vc(Cc)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},mc((e=>e.deleteAccessKey)),yc({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),Sc={action:Cc,reducer:kc},Ic=Gl("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},i),e))})),xc=vc(Ic)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},mc((e=>e.accessKeysList))),Rc={action:Ic,reducer:xc},Oc=Gl("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),Ec=vc(Oc)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},mc((e=>e.activateAccessKey)),yc({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),Ac={action:Oc,reducer:Ec},Nc=Gl("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),jc=vc(Nc)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},mc((e=>e.deactivateAccessKey)),yc({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),Mc={action:Nc,reducer:jc},Pc=Gl("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Uc={action:Pc,reducer:vc(Pc)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},mc((e=>e.tenantRoles)))},Tc={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:[]},Wc="/v1/mgmt/accesskey/search",Lc="/v1/mgmt/accesskey/delete/batch",Dc="/v1/mgmt/accesskey/create",_c="/v1/mgmt/accesskey/deactivate/batch",Fc="/v1/mgmt/accesskey/activate/batch",qc="/v1/mgmt/role/all",Bc=e=>c(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)})),Vc=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((...e)=>c(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(Wc,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield Bc(a),(yield a.json()).keys})),deleteBatch:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Lc,{ids:i},{queryParams:{tenant:t}});return yield Bc(r),r.json()})),create:i=>c(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 l="0"===r[0]?0:Math.floor(d.getTime()/1e3);if(n)return((e,t)=>c(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},l);const u=yield e.post(Dc,{name:i,expireTime:l,roleNames:o,userId:s,permittedIps:a},{queryParams:{tenant:t}});return yield Bc(u),yield u.json()})),activate:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Fc,{ids:i},{queryParams:{tenant:t}});return yield Bc(r),yield r.json()})),deactivate:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(_c,{ids:i},{queryParams:{tenant:t}});return yield Bc(r),yield r.json()}))}),Kc=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>c(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(qc,{queryParams:{tenant:t}});return yield Bc(i),i.json()}))}),Hc=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,qo,oc,_o({tenant:_o.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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.5.45"}}));return{accesskey:Vc({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Kc({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})),zc=Si((e=>{const t=mi(ic({name:"widget",initialState:Tc,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{wc.reducer(e),Sc.reducer(e),Rc.reducer(e),Ac.reducer(e),Mc.reducer(e),Uc.reducer(e)},asyncActions:{searchAccessKeys:Rc.action,createAccessKey:wc.action,activateAccessKeys:Ac.action,deactivateAccessKeys:Mc.action,deleteAccessKeys:Sc.action,getTenantRoles:Uc.action}}),Lo,jo,Hc)(e);return class extends t{constructor(...e){super(...e),this.state=Tc,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Gc=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){const t=yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text");return null==t?void 0:t.body}))}}})),Jc=Si((e=>{var t,n,i;return i=class extends(mi(jo,Lo,ts,as,Gc,zc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Zc=Si((e=>{var t,n,i,r,o;return o=class extends(mi(zc,jo,Jc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.accessKeysTable.data=e}))),r.set(this,ki(((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 c(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),u(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{u(this,r,"f").call(this,e.target,e.detail)}))})),u(this,i,"f").call(this,dc(this.state)),this.subscribe(u(this,i,"f").bind(this),dc)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Wa(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})),Yc=Si((e=>{var t,n,i;return i=class extends(mi(zc,Ya,jo,Jc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(yi(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new ja((()=>{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 ja((()=>{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=lc(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const i=new Ka(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=gc(this.state);i.text=`Activate ${e}?`}}))},i})),Xc=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Jc,zc,Yc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),pc)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new ja(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})),Qc=Si((e=>{var t,n,i;return i=class extends(mi(zc,Ya,rc,jo,Jc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(yi(yield this.fetchWidgetPage("created-access-key-modal.html"))),new ja((()=>{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})),eu=Si((e=>{var t,n,i,r,o;return o=class extends(mi(zc,Ya,rc,jo,Jc,Qc)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>c(this,void 0,void 0,(function*(){var e,t;yield u(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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function e(){return c(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(yi(yield this.fetchWidgetPage("create-access-key-modal.html"))),new ja((()=>{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 ja((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(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())}})))),h(this,n,new Fa((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),u(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{u(this,t,"m",e).call(this)}}))},o})),tu=Si((e=>{var t,n,i;return i=class extends(mi(jo,eu,Jc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new ja(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})),nu=Si((e=>{var t,n,i;return i=class extends(mi(zc,Ya,jo,Jc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(yi(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new ja((()=>{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 ja((()=>{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=lc(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const i=new Ka(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=gc(this.state);i.text=`Deactivate ${e}?`}}))},i})),iu=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Jc,zc,nu)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),pc)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new ja(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})),ru=Si((e=>{var t,n,i;return i=class extends(mi(zc,Ya,jo,Jc)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(yi(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new ja((()=>{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 ja((()=>{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=lc(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const i=new Ka(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=gc(this.state);i.text=`Delete ${e}?`}}))},i})),ou=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Jc,zc,ru)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),hc)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new ja(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})),su=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Jc,zc)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Ha(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f"))},r})),au={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},du=Si((e=>{var t,n,i,r,o;return o=class extends(mi(jo,zc,Qa,Lo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),ac)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=au[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})),lu=Si((e=>class extends(mi(Ia,cs,Zc,tu,ou,su,Xc,iu,du)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),cu=mi((e=>class extends(lu(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",cu);var uu,hu=Object.freeze({__proto__:null,default:cu});!function(e){e.oidc="oidc",e.saml="saml",e.wsfed="wsfed",e.custom="custom"}(uu||(uu={}));const fu=e=>e.ssoAppsList.data,pu=gl(fu,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===uu.saml))})),gu=gl(fu,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>{var t;return e.appType===uu.oidc&&(null===(t=e.oidcSettings)||void 0===t?void 0:t.customIdpInitiatedLoginPageUrl)}))})),vu=gl(fu,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>{var t;return e.appType===uu.wsfed&&(null===(t=e.wsfedSettings)||void 0===t?void 0:t.idpInitiatedUrl)}))})),mu=gl(fu,(e=>{var t;return null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.call(e,(e=>e.appType===uu.custom))})),yu=e=>{var t,n,i,r;switch(e.appType){case uu.saml:return null===(t=e.samlSettings)||void 0===t?void 0:t.idpInitiatedUrl;case uu.oidc:return null===(n=e.oidcSettings)||void 0===n?void 0:n.customIdpInitiatedLoginPageUrl;case uu.wsfed:return null===(i=e.wsfedSettings)||void 0===i?void 0:i.idpInitiatedUrl;case uu.custom:return null===(r=e.customSettings)||void 0===r?void 0:r.loginPageUrl;default:return}},bu=gl(pu,gu,vu,mu,((e,t,n,i)=>[...e,...t,...n,...i].map((e=>({name:e.name,icon:e.logo,url:yu(e)}))))),$u=Gl("ssoApps/load",((e,{extra:{api:t}})=>t.ssoApps.load())),wu=(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)}))}))})($u)({onFulfilled:(e,t)=>{var n;e.ssoAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},(Cu=e=>e.ssoAppsList,{onFulfilled:e=>{Cu(e).loading=!1},onPending:e=>{Cu(e).loading=!0,Cu(e).error=null},onRejected:(e,t)=>{Cu(e).loading=!1,Cu(e).error=t.error}}));var Cu;const ku={action:$u,reducer:wu},Su={ssoAppsList:{data:[],loading:!1,error:null}},Iu="/v1/mgmt/sso/idp/apps/load",xu=({httpClient:e,mock:t})=>({load:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(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:uu.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:uu.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:uu.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp4",name:"App 4",description:"This is a WS-Fed app",enabled:!0,appType:uu.wsfed,logo:"logo4",wsfedSettings:{idpInitiatedUrl:"http://localhost/wsfed/idp-initiated",realm:"urn:mock:realm",replyUrl:"http://localhost/reply",loginPageUrl:"http://localhost/login"}}]})}))}));const n=yield e.get(Iu);return yield(e=>c(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()}))}),Ru=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,oc,qo)(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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n)=>{const i=di(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.6.5"}}));return{ssoApps:xu({httpClient:i.httpClient,mock:t})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),Ou=Si((e=>{const t=mi(ic({name:"widget",initialState:Su,reducers:{},extraReducers:e=>{ku.reducer(e)},asyncActions:{loadSSOApps:ku.action}}),Lo,jo,Ru)(e);return class extends t{constructor(...e){super(...e),this.state=Su,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Eu=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Au=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Lo,ts,as,Eu,Ou)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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([u(this,t,"m",n).call(this),this.actions.loadSSOApps()]);u(this,t,"m",i).call(this,o),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r})),Nu=Si((e=>{var t,n,i;return i=class extends(mi(Ou,jo,Au)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this,bu(this.state))}))}},t=new WeakSet,n=function(e){this.appsList=new Aa((()=>{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})),ju=Si((e=>class extends(mi(Ia,cs,Nu)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Mu=mi((e=>class extends(ju(e)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",Mu);var Pu=Object.freeze({__proto__:null,default:Mu});const Uu=(e,t)=>t?{[e]:t}:{},Tu=e=>{if(!e)return;const t=JSON.parse(e);return Array.isArray(t)&&0===t.length?void 0:t},Wu=e=>e.selectedAuditId,Lu=gl((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:"",scim_request:"",scim_result:"",Change:""}:o,{saml_request:a,saml_response:d,saml_generated_user:c,saml_generated_roles:u,oidc_response:h,oidc_generated_user:f,scim_request:p,scim_result:g,Change:v}=s,m=l(s,["saml_request","saml_response","saml_generated_user","saml_generated_roles","oidc_response","oidc_generated_user","scim_request","scim_result","Change"]),y=l(t,["occurred","ID","type","data"]);var b;return(e=>Object.fromEntries(Object.entries(e).filter((([e,t])=>!!t))))(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},y),{data:m}),Uu("type",(b=r)&&b[0].toUpperCase()+b.slice(1))),Uu("saml_request",a)),Uu("saml_response",d)),Uu("saml_generated_user",Tu(c))),Uu("saml_generated_roles",Tu(u))),Uu("oidc_response",Tu(h))),Uu("oidc_generated_user",Tu(f))),Uu("scim_request",p)),Uu("scim_result",g)),Uu("Change",v)),{occurredFormatted:n?new Date(Number(n)||0).toLocaleString():"N/A"}))}))));gl(Wu,Lu,((e,t)=>t.find((t=>e===t.id)))),gl(Wu,(e=>!!e));const Du=Gl("audit/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.audit.search(Object.assign(Object.assign({},i),e))})),_u=(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)}))}))})(Du)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Fu=e=>e.auditList,{onFulfilled:e=>{Fu(e).loading=!1},onPending:e=>{Fu(e).loading=!0,Fu(e).error=null},onRejected:(e,t)=>{Fu(e).loading=!1,Fu(e).error=t.error}}));var Fu;const qu={action:Du,reducer:_u},Bu={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Vu="/v1/mgmt/audit/search",Ku=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s,from:a}={}){if(n)return(e=>c(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(Vu,{limit:r,page:i,text:o,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>c(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}))}),Hu=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,qo,oc,_o({tenant:_o.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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.6.7"}}));return{audit:Ku({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})),zu=Si((e=>{const t=mi(ic({name:"widget",initialState:Bu,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{qu.reducer(e)},asyncActions:{searchAudit:qu.action}}),Lo,jo,Hu)(e);return class extends t{constructor(...e){super(...e),this.state=Bu,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Gu=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Ju=Si((e=>{var t,n,i;return i=class extends(mi(jo,Lo,ts,as,Gu,zu)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this)]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Zu=Si((e=>{var t,n,i,r,o;return o=class extends(mi(jo,Ju,zu)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this),u(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Ha(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f")),u(this,n,"f").call(this)},r=function(){var e;this.rangeInput=new Va(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(u(this,n,"f"))},o})),Yu=Si((e=>{var t,n,i,r;return r=class extends(mi(zu,jo,Ju)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),u(this,i,"f").call(this,Lu(this.state)),this.subscribe(u(this,i,"f").bind(this),Lu)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Wa(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})),Xu=[{header:"Occurred",path:"occurredFormatted"},{header:"User ID",path:"userId"},{header:"Actor",path:"actorId"},{header:"Login IDs",path:"externalIds"},{header:"Remote Address",path:"remoteAddress"},{header:"Type",path:"type"},{header:"Action",path:"action"},{header:"Device",path:"device"},{header:"Method",path:"method"},{header:"Geo",path:"geo"}],Qu=Si((e=>{var t,n,i;return i=class extends(mi(jo,Ju,zu)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.exportButton=new ja(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="export-button"]'),{logger:this.logger}),this.exportButton.onClick((()=>{const e=Lu(this.state);if(!e.length)return void this.logger.warn("No audit data to export");const t=((e,t)=>[t.map((e=>ji(e.header))).join(","),...e.map((e=>t.map((t=>ji(e[t.path]))).join(",")))].join("\n"))(e,Xu);((e,t)=>{const n=new Blob(["\ufeff"+e],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",t),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)})(t,`audit_logs_${(new Date).toISOString().slice(0,10)}.csv`)}))},i})),eh=Si((e=>class extends(mi(Ia,cs,Yu,Zu,Qu)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),th=mi((e=>class extends(eh(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",th);var nh=Object.freeze({__proto__:null,default:th});const ih=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),n)})),t};function rh(e){return new URLSearchParams(window.location.search).get(e)}const oh=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)}))}))},sh=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}}),ah=Gl("outboundApps/load",((e,{extra:{api:t}})=>t.outboundApps.getAllOutboundApps())),dh=oh(ah)({onFulfilled:(e,t)=>{var n;e.outboundAppsList.data=null===(n=t.payload)||void 0===n?void 0:n.apps}},sh((e=>e.outboundAppsList))),lh={action:ah,reducer:dh},ch=Gl("outboundApps/getConnectedOutboundApps",((e,{extra:{api:t}})=>t.outboundApps.getConnectedOutboundApps(e))),uh=oh(ch)({onFulfilled:(e,t)=>{var n;e.connectedOutboundAppsIds.data=null===(n=t.payload)||void 0===n?void 0:n.appIds}},sh((e=>e.connectedOutboundAppsIds))),hh={action:ch,reducer:uh},fh={outboundAppsList:{data:[],loading:!1,error:null},connectedOutboundAppsIds:{data:[],loading:!1,error:null},allowedAppsIds:{data:void 0},me:{loading:!1,error:null,data:{}}},ph="/v1/mgmt/outbound/apps",gh="/v1/mgmt/outbound/apps-with-user-token",vh="/v1/auth/me",mh=e=>c(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)})),yh=({httpClient:e,mock:t})=>({getAllOutboundApps:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:[{id:"appId1",name:"Application 1",description:"Description"},{id:"appId2",name:"Application 2",description:"Description"},{id:"appId3",name:"Application 3",description:"Description"}]})}))}));const n=yield e.get(ph);return yield mh(n),n.json()})),getConnectedOutboundApps:n=>c(void 0,[n],void 0,(function*({userId:n,tenantId:i}){if(t)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({apps:["outboundApp3"]})}))}));const r=yield e.get(gh,{queryParams:i?{userId:n,tenantId:i}:{userId:n}});return yield mh(r),r.json()}))}),bh=({httpClient:e,mock:t})=>({me:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({userId:"user-1"})}))}));const n=yield e.get(vh);return yield mh(n),n.json()}))}),$h=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,oc,qo)(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 styleId(){return this.getAttribute("style-id")||ds}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n)=>{const i=di(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"outbound-applications-widget","x-descope-widget-id":n,"x-descope-widget-version":"0.2.37"}}));return{outboundApps:yh({httpClient:i.httpClient,mock:t}),user:Object.assign({},bh({httpClient:i.httpClient,mock:t}))}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),wh=Gl("users/me",((e,{extra:{api:t}})=>t.user.me())),Ch={action:wh,reducer:oh(wh)({onFulfilled:(e,t)=>{e.me.data=t.payload}},sh((e=>e.me)))},kh=Si((e=>{const t=mi(ic({name:"widget",initialState:fh,reducers:{setAllowedAppsIds:(e,{payload:t})=>{e.allowedAppsIds.data=t}},extraReducers:e=>{Ch.reducer(e),hh.reducer(e),lh.reducer(e)},asyncActions:{getMe:Ch.action,getOutboundApps:lh.action,getConnectedOutboundApps:hh.action}}),Lo,jo,$h)(e);return class extends t{constructor(...e){super(...e),this.state=fh,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Sh="widget-flow",Ih=Si((e=>{var t,n,i;return i=class extends(mi(Lo,Ya,kh,oc,jo,cs)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=rh(Sh);r&&(function(e){if(window.history.replaceState&&rh(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())}}(Sh),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(ih({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Ma((()=>{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})),xh=gl((e=>e.outboundAppsList.data),(e=>e.connectedOutboundAppsIds.data),(e=>e.allowedAppsIds.data),((e,t,n)=>e.filter((e=>void 0===n||n.includes(e.id))).map((e=>{const n=(null==t?void 0:t.includes(e.id))||!1;return Object.assign(Object.assign({},e),{appId:e.id,isConnected:n})})).sort(((e,t)=>e.name.localeCompare(t.name))))),Rh=gl((e=>e.me.data),(e=>e.userId)),Oh=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`outbound-applications-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Eh=Si((e=>{var t,n,i,r,o;return o=class extends(mi(jo,Lo,ts,as,Oh,kh)(e)){constructor(){super(...arguments),t.add(this)}static get observedAttributes(){return["allowed-outbound-apps-ids"]}attributeChangedCallback(e,n,i){"allowed-outbound-apps-ids"===e&&n!==i&&this.actions.setAllowedAppsIds(u(this,t,"a",r))}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var o;yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield this.actions.getMe(),yield this.actions.setAllowedAppsIds(u(this,t,"a",r)),yield Promise.all([this.actions.getOutboundApps(),this.actions.getConnectedOutboundApps({userId:Rh(this.state),tenantId:this.tenantId})]);const s=yield u(this,t,"m",n).call(this);u(this,t,"m",i).call(this,s),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(e),e}))},i=function(e){this.contentRootElement.append(e.content.cloneNode(!0))},r=function(){var e;if(!this.hasAttribute("allowed-outbound-apps-ids"))return;const t=null===(e=this.getAttribute("allowed-outbound-apps-ids"))||void 0===e?void 0:e.trim();return t?t.split(",").map((e=>e.trim())).filter(Boolean):[]},o})),Ah=Si((e=>class extends(mi(cs,Do)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),Nh=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v,m,y,b,$;return $=class extends(mi(Ah,kh,jo,Eh,Ya)(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),s.set(this,void 0),a.set(this,null),d.set(this,null),b.set(this,$i((e=>{u(this,n,"f").data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",y).call(this,xh(this.state)),u(this,t,"m",l).call(this),u(this,t,"m",g).call(this),this.subscribe(u(this,b,"f").bind(this),xh)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,a=new WeakMap,d=new WeakMap,b=new WeakMap,t=new WeakSet,l=function(){u(this,n,"f").connectFlowId&&(h(this,i,this.createModal({"data-id":"outbound-apps-connect"}),"f"),u(this,i,"f").afterClose=()=>{var e;if(u(this,a,"f")){const t=null===(e=u(this,i,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc");null==t||t.removeEventListener("page-updated",u(this,a,"f")),h(this,a,null,"f")}},h(this,o,new Ma((()=>{var e;return null===(e=u(this,i,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(u(this,o,"f")))},f=function(e,t,n){e.open(),t.removeEventListener("page-updated",n)},p=function(e,n){var i;const r=null===(i=e.ele)||void 0===i?void 0:i.querySelector("descope-wc"),o=()=>u(this,t,"m",f).call(this,e,r,o);n=o,null==r||r.addEventListener("page-updated",n)},g=function(){h(this,r,this.createModal({"data-id":"outbound-apps-disconnect"}),"f"),h(this,s,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=()=>{var e;if(u(this,d,"f")){const t=null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc");null==t||t.removeEventListener("page-updated",u(this,d,"f")),h(this,d,null,"f")}},this.syncFlowTheme(u(this,s,"f"))},v=function(e){u(this,i,"f").setContent(ih({projectId:this.projectId,flowId:u(this,n,"f").connectFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,outboundAppId:e})),u(this,t,"m",p).call(this,u(this,i,"f"),u(this,a,"f")),u(this,o,"f").onSuccess((()=>{u(this,i,"f").close(),this.actions.getConnectedOutboundApps({userId:Rh(this.state),tenantId:this.tenantId})}))},m=function(e){u(this,r,"f").setContent(ih({projectId:this.projectId,flowId:u(this,n,"f").disconnectFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,outboundAppId:e})),u(this,t,"m",p).call(this,u(this,r,"f"),u(this,d,"f")),u(this,s,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getConnectedOutboundApps({userId:Rh(this.state)})}))},y=function(e){h(this,n,new Ba((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-outbound-apps")}),{logger:this.logger}),"f"),u(this,n,"f").onConnectClick((({id:e})=>{u(this,t,"m",v).call(this,e)})),u(this,n,"f").onDisconnectClick((({id:e})=>{u(this,t,"m",m).call(this,e)})),u(this,n,"f").data=e},$})),jh=Si((e=>class extends(mi(Ia,cs,Ih,Nh)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Mh=mi((e=>class extends(jh(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 Sa})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"outbound-applications-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.37"}}}))}}))(HTMLElement);customElements.define("descope-outbound-applications-widget",Mh);var Ph=Object.freeze({__proto__:null,default:Mh});const Uh=e=>e.selectedRolesIds,Th=e=>e.notifications,Wh=e=>e.tenantPermissions.data||[],Lh=gl((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"})})))),Dh=gl(Uh,Lh,((e,t)=>t.filter((t=>e.includes(t.name))))),_h=gl(Uh,(e=>!!e.length)),Fh=gl(Uh,(e=>1===e.length)),qh=gl(Dh,Fh,((e,t)=>t&&"yes"===e[0].editable)),Bh=gl(Dh,(e=>1===e.length?e[0].name:`${e.length} roles`)),Vh=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)}))}))},Kh=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}}),Hh=({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)})}}),zh=Gl("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),Gh=Vh(zh)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},Kh((e=>e.createRole)),Hh({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>`}})),Jh={action:zh,reducer:Gh},Zh=Gl("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Yh=Vh(Zh)({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=[]}},Kh((e=>e.deleteRole)),Hh({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to delete role${["","s"]}`})),Xh={action:Zh,reducer:Yh},Qh=Gl("roles/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.role.search(Object.assign(Object.assign({},i),e))})),ef=Vh(Qh)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},Kh((e=>e.rolesList))),tf={action:Qh,reducer:ef},nf=Gl("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),rf=Vh(nf)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},Kh((e=>e.updateRole)),Hh({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>`}})),of={action:nf,reducer:rf},sf=Gl("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),af={action:sf,reducer:Vh(sf)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},Kh((e=>e.tenantPermissions)))},df={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:[]},lf="/v1/mgmt/role/search",cf="/v1/mgmt/role/delete/batch",uf="/v1/mgmt/role/create",hf="/v1/mgmt/role/update",ff="/v1/mgmt/permission/all",pf=e=>c(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)})),gf=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,text:o,sort:s}={}){if(n)return((e,t)=>c(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(lf,{limit:r,page:i,text:o,sort:s},{queryParams:{tenant:t}});return yield pf(a),(yield a.json()).roles})),deleteBatch:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(cf,{roleNames:i},{queryParams:{tenant:t}});return yield pf(r),r.json()})),create:i=>c(void 0,[i],void 0,(function*({name:i,description:r,permissionNames:o}){if(n)return((e,t)=>c(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(uf,{name:i,description:r,permissionNames:o,tenantId:t},{queryParams:{tenant:t}});return yield pf(s),yield s.json()})),update:i=>c(void 0,[i],void 0,(function*({name:i,newName:r,description:o,permissionNames:s}){if(n)return((e,t)=>c(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(hf,{name:i,newName:r,description:o,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield pf(a);const d=yield a.json();return d.oldName=i,d}))}),vf=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>c(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(ff,{queryParams:{tenant:t}});return yield pf(i),i.json()}))}),mf=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,qo,oc,_o({tenant:_o.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 u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.5.37"}}));return{role:gf({httpClient:r.httpClient,tenant:t,mock:n}),tenant:vf({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})),yf=Si((e=>{const t=mi(ic({name:"widget",initialState:df,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Jh.reducer(e),of.reducer(e),Xh.reducer(e),tf.reducer(e),af.reducer(e)},asyncActions:{searchRoles:tf.action,createRole:Jh.action,updateRole:of.action,deleteRoles:Xh.action,getTenantPermissions:af.action}}),Lo,jo,mf)(e);return class extends t{constructor(...e){super(...e),this.state=df,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),bf=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),$f=Si((e=>{var t,n,i;return i=class extends(mi(jo,Lo,ts,as,bf,yf)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),wf=Si((e=>{var t,n,i,r,o;return o=class extends(mi(yf,Ya,rc,jo,$f)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>c(this,void 0,void 0,(function*(){var e;yield u(this,n,"f").setData(null===(e=Wh(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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,i=function(){return c(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(yi(yield this.fetchWidgetPage("create-role-modal.html"))),new ja((()=>{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 ja((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(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))})))),h(this,n,new Fa((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),u(this,r,"f").call(this)}))},o})),Cf=Si((e=>{var t,n,i;return i=class extends(mi(jo,wf,$f)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new ja(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})),kf=Si((e=>{var t,n,i;return i=class extends(mi(yf,Ya,jo,$f)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(yi(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new ja((()=>{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 ja((()=>{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=Dh(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const i=new Ka(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Bh(this.state);i.text=`Delete ${e}?`}}))},i})),Sf=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,$f,yf,kf)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),_h)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new ja(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})),If=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(yf,Ya,jo,rc,$f)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>c(this,void 0,void 0,(function*(){var e;yield u(this,n,"f").setData(null===(e=Wh(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=Dh(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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",a).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,t=new WeakSet,i=function(){new ja((()=>{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 ja((()=>{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=l(t,["name"]),r=null===(e=Dh(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 c(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(yi(yield this.fetchWidgetPage("edit-role-modal.html"))),u(this,t,"m",i).call(this),u(this,t,"m",r).call(this),h(this,n,new Fa((()=>{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=()=>c(this,void 0,void 0,(function*(){yield u(this,o,"f").call(this),u(this,s,"f").call(this)}))}))},d})),xf=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,$f,yf,If,rc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),this.subscribe(u(this,i,"f").bind(this),qh)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new ja(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})),Rf=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,$f,yf)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Ha(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f"))},r})),Of={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},Ef=Si((e=>{var t,n,i,r,o;return o=class extends(mi(jo,yf,Qa,Lo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),Th)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Of[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})),Af=Si((e=>{var t,n,i,r,o;return o=class extends(mi(yf,jo,$f)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.rolesTable.data=e}))),r.set(this,ki(((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 c(this,void 0,void 0,(function*(){var o;yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),u(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{u(this,r,"f").call(this,e.target,e.detail)}))})),u(this,i,"f").call(this,Lh(this.state)),this.subscribe(u(this,i,"f").bind(this),Lh)}))}},i=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Wa(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})),Nf=Si((e=>class extends(mi(Ia,cs,Af,Cf,Sf,xf,Rf,Ef)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),jf=mi((e=>class extends(Nf(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",jf);var Mf=Object.freeze({__proto__:null,default:jf});const Pf=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),n)})),t};function Uf(e){return new URLSearchParams(window.location.search).get(e)}const Tf=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)}))}))},Wf=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}}),Lf=Gl("users/me",((e,{extra:{api:t}})=>t.user.me())),Df=Tf(Lf)({onFulfilled:(e,t)=>{e.me.data=t.payload}},Wf((e=>e.me))),_f={action:Lf,reducer:Df},Ff=Gl("tenant/details",((e,{extra:{api:t}})=>t.tenant.details())),qf=Tf(Ff)({onFulfilled:(e,t)=>{e.tenant.data=t.payload}},Wf((e=>e.tenant))),Bf={action:Ff,reducer:qf},Vf=Gl("tenant/adminLinkSso",((e,{extra:{api:t}})=>t.tenant.adminLinkSso())),Kf={action:Vf,reducer:Tf(Vf)({onFulfilled:(e,t)=>{var n;e.tenantAdminLinkSSO.data=(null===(n=t.payload)||void 0===n?void 0:n.adminSSOConfigurationLink)||""}},Wf((e=>e.tenantAdminLinkSSO)))},Hf={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:""}},zf="/v1/auth/me",Gf="/v1/mgmt/tenant",Jf="/v1/mgmt/tenant/adminlinks/sso/authenticated",Zf=e=>c(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)})),Yf=({httpClient:e,tenantId:t,mock:n})=>{const i=encodeURIComponent(t||""),r=`?tenant=${i}&id=${i}`;return{details:()=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({tenantId:"tenant-1",roleNames:["admin"],id:"tenant-1",name:"Test Tenant",selfProvisioningDomains:["example1.com","example2.com"],customAttributes:{},authType:"password",domains:[],createdTime:Date.now(),disabled:!1,enforceSSO:!0})}))}));if(!t)throw new Error("tenantId is not defined");const i=`${Gf}${r}`,o=yield e.get(i);return yield Zf(o),yield o.json()})),adminLinkSso:()=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({adminSSOConfigurationLink:"_blank"})}))}));if(!t)throw new Error("tenantId is not defined");const r=yield e.post(`${Jf}?tenant=${i}`,{tenantId:i},{headers:{"Content-Type":"application/json"}});return yield Zf(r),yield r.json()}))}},Xf=({httpClient:e,mock:t})=>({me:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(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(zf);return yield Zf(n),n.json()}))}),Qf=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,qo,oc)(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 tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||ds}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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","mock"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.5.36"}}));return{user:Xf({httpClient:r.httpClient,mock:n}),tenant:Yf({httpClient:r.httpClient,tenantId:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},r})),ep=Si((e=>{const t=mi(ic({name:"widget",initialState:Hf,reducers:{},extraReducers:e=>{_f.reducer(e),Bf.reducer(e),Kf.reducer(e)},asyncActions:{getMe:_f.action,getTenant:Bf.action,getTenantAdminLinkSSO:Kf.action}}),Lo,jo,Qf)(e);return class extends t{constructor(...e){super(...e),this.state=Hf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),tp="widget-flow",np=Si((e=>{var t,n,i;return i=class extends(mi(Lo,Ya,ep,oc,jo,cs)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=Uf(tp);r&&(function(e){if(window.history.replaceState&&Uf(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())}}(tp),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Pf({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Ma((()=>{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(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()})),t.afterClose=()=>{t.remove()},t.open()},i})),ip=e=>e.tenant.data,rp=e=>e.tenantAdminLinkSSO.data,op=gl(ip,(e=>e.customAttributes||{})),sp=gl(ip,(e=>e.name||"")),ap=gl(ip,(e=>e.selfProvisioningDomains||[])),dp=gl(ip,(e=>e.enforceSSOExclusions||[])),lp=gl(ip,(e=>e.enforceSSO||!1)),cp=Si((e=>class extends(mi(cs,Do)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),up=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`tenant-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),hp=Si((e=>{var t,n,i;return i=class extends(mi(jo,Lo,ts,as,up,ep)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);try{yield Promise.all([this.actions.getMe(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()])}catch(i){}const r=this.state.me.error||(()=>this.state.tenant.error)()||(()=>this.state.tenantAdminLinkSSO.error)();if(r){this.contentRootElement.innerHTML="";const e="object"==typeof r&&null!==r&&"message"in r?r.message:String(r)||"An error occurred";this.contentRootElement.append(function({mainMessage:e="An error occurred"}){const t=document.createElement("div");t.setAttribute("data-id","widget-error"),t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="center",t.style.justifyContent="center",t.style.padding="72px 36px",t.style.background="#fff",t.style.borderRadius="12px",t.style.boxShadow="0 2px 8px rgba(0,0,0,0.03)",t.style.margin="32px auto",t.style.maxWidth="400px";const n=document.createElement("div");n.innerHTML='\n <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="20" cy="20" r="18" stroke="#FF3B3B" stroke-width="3" fill="#fff"/>\n <text x="20" y="27" text-anchor="middle" font-size="24" font-family="Arial, sans-serif" fill="#FF3B3B">!</text>\n </svg>\n ',n.style.marginBottom="12px",t.appendChild(n);const i=document.createElement("div");return i.textContent=e,i.style.fontWeight="bold",i.style.fontSize="20px",i.style.color="#222",i.style.textAlign="center",i.style.marginTop="8px",t.appendChild(i),t}({mainMessage:e}))}else yield u(this,t,"m",n).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),fp=Si((e=>{var t,n,i,r;return r=class extends(mi(cp,ep,jo,hp,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{this.tenantAdminLinkSSODriver.href=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),u(this,t,"m",n).call(this),u(this,i,"f").call(this,rp(this.state)),this.subscribe(u(this,i,"f").bind(this),rp)}))}},i=new WeakMap,t=new WeakSet,n=function(){this.tenantAdminLinkSSODriver=new La((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-link[data-id="tenant-admin-link-sso"]')}),{logger:this.logger})},r}));var pp;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(pp||(pp={}));const gp=Si((e=>{var t,n,i,r,o,s,a,d,l,h,f;return f=class extends(mi(cp,ep,jo,hp,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,{}),i.set(this,{}),r.set(this,{}),o.set(this,{}),d.set(this,$i((e=>{var n;const i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(i).forEach((n=>{const i=n.getAttribute("data-id").replace("customAttributes.",""),r=n.getAttribute("data-type")||pp.TEXT,o=e[i],s=new za(n,{logger:this.logger});s.value=((e,t)=>e===pp.DATE&&t?new Date(t).toLocaleString():e===pp.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString())(r,o),u(this,t,"m",l).call(this,n,i,s,r,i),u(this,t,"m",h).call(this,n,i,s)}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),u(this,d,"f").call(this,op(this.state)),this.subscribe(u(this,d,"f").bind(this),op)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,d=new WeakMap,t=new WeakSet,s=function(e,t,r){var o,s;const a=op(this.state)[r],d=t===pp.ARRAY?(a||[]).join(","):a;null===(o=u(this,n,"f")[e])||void 0===o||o.setContent(Pf({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({customAttributes:{[r]:d}})})),null===(s=u(this,i,"f")[e])||void 0===s||s.onSuccess((()=>{var t;null===(t=u(this,n,"f")[e])||void 0===t||t.close(),this.actions.getTenant()}))},a=function(e){var t,n;null===(t=u(this,r,"f")[e])||void 0===t||t.setContent(Pf({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,o,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(this,r,"f")[e])||void 0===t||t.close(),this.actions.getTenant()}))},l=function(e,r,o,a,d){const l=e.getAttribute("edit-flow-id");l&&(u(this,n,"f")[l]||(u(this,n,"f")[l]=this.createModal({"data-id":`edit-${r}`}),u(this,i,"f")[l]=new Ma((()=>{var e,t;return null===(t=null===(e=u(this,n,"f")[l])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,n,"f")[l].beforeOpen=u(this,t,"m",s).bind(this,l,a,d),o.onEditClick((()=>{var e,t;null===(t=null===(e=u(this,n,"f"))||void 0===e?void 0:e[l])||void 0===t||t.open()})),this.syncFlowTheme(u(this,i,"f")[l])))},h=function(e,n,i){const s=e.getAttribute("delete-flow-id");s&&(u(this,r,"f")[s]||(u(this,r,"f")[s]=this.createModal({"data-id":`delete-${n}`}),u(this,o,"f")[s]=new Ma((()=>{var e,t;return null===(t=null===(e=u(this,r,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,r,"f")[s].beforeOpen=u(this,t,"m",a).bind(this,s),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=u(this,r,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),this.syncFlowTheme(u(this,o,"f")[s])))},f})),vp=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(cp,ep,jo,hp,oc,Ya)(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,$i((e=>{this.tenantEmailDomainsDriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,ap(this.state)),this.subscribe(u(this,p,"f").bind(this),ap)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.tenantEmailDomainsDriver.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({tenantEmailDomains:ap(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},d=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-tenant-email-domains"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").beforeOpen=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantEmailDomainsDriver=new za((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-email-domains-edit"]')}),{logger:this.logger}),this.tenantEmailDomainsDriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),mp=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(cp,ep,jo,hp,oc,Ya)(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,$i((e=>{this.tenantSSOExclusionsDriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,dp(this.state)),this.subscribe(u(this,p,"f").bind(this),dp)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.tenantSSOExclusionsDriver.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({enforceSSOExclusions:dp(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},d=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").beforeOpen=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantSSOExclusionsDriver=new za((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-force-sso-exclusions-edit"]')}),{logger:this.logger}),this.tenantSSOExclusionsDriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),yp=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(cp,ep,jo,hp,oc,Ya)(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,$i((e=>{this.tenantEnforceSSODriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,lp(this.state)),this.subscribe(u(this,p,"f").bind(this),lp)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.tenantEnforceSSODriver.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({enforceSSO:lp(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},d=function(){this.tenantEnforceSSODriver.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").beforeOpen=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantEnforceSSODriver=new za((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-enforce-sso-edit"]')}),{logger:this.logger}),this.tenantEnforceSSODriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),bp=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(cp,ep,jo,hp,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,$i((e=>{this.tenantNameDriver.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this),u(this,a,"f").call(this,sp(this.state)),this.subscribe(u(this,a,"f").bind(this),sp)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){this.tenantNameDriver.editFlowId&&(h(this,n,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").beforeOpen=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(Pf({projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({tenantName:sp(this.state)})})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},s=function(){this.tenantNameDriver=new za((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="tenant-name-edit"]')}),{logger:this.logger}),this.tenantNameDriver.onEditClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))},d})),$p=Si((e=>{var t,n,i,r,o,s,a;return a=class extends(mi(cp,ep,jo,hp,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.TenantPasswordPolicyUserAuthMethodDriver.flowId&&(h(this,n,this.createModal({"data-id":"password-policy"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(Pf({projectId:this.projectId,flowId:this.TenantPasswordPolicyUserAuthMethodDriver.flowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},s=function(){this.TenantPasswordPolicyUserAuthMethodDriver=new Ga((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password-policy"]')}),{logger:this.logger}),this.TenantPasswordPolicyUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))},a})),wp=Si((e=>{var t,n,i,r,o,s,a;return a=class extends(mi(cp,ep,jo,hp,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.TenantSessionSettingsUserAuthMethodDriver.flowId&&(h(this,n,this.createModal({"data-id":"session-settings"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(Pf({projectId:this.projectId,flowId:this.TenantSessionSettingsUserAuthMethodDriver.flowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getTenant()}))},s=function(){this.TenantSessionSettingsUserAuthMethodDriver=new Ga((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="session-settings"]')}),{logger:this.logger}),this.TenantSessionSettingsUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))},a})),Cp=Si((e=>class extends(mi(Ia,cs,np,hp,bp,vp,mp,yp,gp,fp,$p,wp)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),kp=mi((e=>class extends(Cp(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 Sa})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.5.36"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",kp);var Sp=Object.freeze({__proto__:null,default:kp}),Ip={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 xp(e){return xp="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},xp(e)}function Rp(e){var t=Np();return function(){var n,i=Mp(e);if(t){var r=Mp(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===xp(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Op(e)}(this,n)}}function Op(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ep(e){var t="function"==typeof Map?new Map:void 0;return Ep=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 Ap(e,arguments,Mp(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),jp(i,e)},Ep(e)}function Ap(e,t,n){return Ap=Np()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&jp(r,n.prototype),r},Ap.apply(null,arguments)}function Np(){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 jp(e,t){return jp=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},jp(e,t)}function Mp(e){return Mp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Mp(e)}var Pp=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&&jp(e,t)}(i,e);var t,n=Rp(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(Op(t),i.prototype),t.name=t.constructor.name,t}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(Ep(Error)),Up=2,Tp=17,Wp=3,Lp="0-90-9٠-٩۰-۹",Dp="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~"),_p="++";function Fp(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 qp={}.constructor;function Bp(e){return null!=e&&e.constructor===qp}function Vp(e){return Vp="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},Vp(e)}function Kp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hp(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 zp=" ext. ",Gp=/^\d+$/,Jp=function(){function e(t){Kp(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Bp(e)||!Bp(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(Bp(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+tg(e)+": "+e,"."))}(t),this.metadata=t,rg.call(this,t)}return Hp(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&&Gp.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Zp(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Zp(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}(),Zp=function(){function e(t,n){Kp(this,e),this.globalMetadataObject=n,this.metadata=t,rg.call(this,n.metadata)}return Hp(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 Yp(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()&&eg(this.types(),e))return new Qp(eg(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?zp:this.metadata[13]||zp}}]),e}(),Yp=function(){function e(t,n){Kp(this,e),this._format=t,this.metadata=n}return Hp(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()||Xp.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Xp=/^\(?\$1\)?$/,Qp=function(){function e(t,n){Kp(this,e),this.type=t,this.metadata=n}return Hp(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 eg(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 tg=function(e){return Vp(e)};function ng(e,t){if((t=new Jp(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function ig(e,t){return t.countries.hasOwnProperty(e)}function rg(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===Fp(t,"1.2.0")?this.v2=!0:-1===Fp(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var og=function(e){return"([".concat(Lp,"]{1,").concat(e,"})")};function sg(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",i="#?",r="[ \\t]*";return";ext="+og("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+og("20")+i)+"|"+(t+"(?:[xx##~~]|int|int)"+n+og("9")+i)+"|"+("[- ]+"+og("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+og("15")+i)+"|"+(r+"(?:,)+"+n+og("9")+i)}var ag="["+Lp+"]{"+Up+"}",dg="[++]{0,1}(?:["+Dp+"]*["+Lp+"]){3,}["+Dp+Lp+"]*",lg=new RegExp("^[++]{0,1}(?:["+Dp+"]*["+Lp+"]){1,2}$","i"),cg=dg+"(?:"+sg()+")?",ug=new RegExp("^"+ag+"$|^"+cg+"$","i");var hg=new RegExp("(?:"+sg()+")$","i");function fg(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 pg(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 pg(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 pg(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 gg={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 vg(e){return gg[e]}function mg(e){for(var t,n="",i=fg(e.split(""));!(t=i()).done;){var r=vg(t.value);r&&(n+=r)}return n}function yg(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 bg(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 bg(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 bg(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 $g(e){for(var t,n="",i=yg(e.split(""));!(t=i()).done;){n+=wg(t.value,n)||""}return n}function wg(e,t,n){if("+"===e){if(t)return;return"+"}return vg(e)}function Cg(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 kg(e,t){return"IS_POSSIBLE"===Cg(e,t)}function Sg(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Ig(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 xg(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 xg(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 xg(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 Rg=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Og(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Jp(n)).selectNumberingPlan(e.country,e.countryCallingCode);var i=t.v2?e.nationalNumber:e.phone;if(Sg(i,n.nationalNumberPattern())){if(Eg(i,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Eg(i,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,o=Ig(Rg);!(r=o()).done;){var s=r.value;if(Eg(i,s,n))return s}}}}function Eg(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&Sg(e,t.pattern()))}function Ag(e,t,n){var i=new Jp(n).getCountryCodesForCallingCode(e);return i?i.filter((function(e){return function(e,t,n){var i=new Jp(n);if(i.selectNumberingPlan(t),i.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}function Ng(e){return e.replace(new RegExp("[".concat(Dp,"]+"),"g")," ").trim()}var jg=/(\$\d)/;function Mg(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(jg,t.nationalPrefixFormattingRule()):t.format());return i?Ng(o):o}var Pg=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Ug(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 Tg(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 Tg(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 Tg(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 Wg(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 Lg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wg(Object(n),!0).forEach((function(t){Dg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wg(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Dg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _g={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function Fg(e,t,n,i){if(n=n?Lg(Lg({},_g),n):_g,i=new Jp(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?Vg(r=qg(s,e.carrierCode,"NATIONAL",i,n),e.ext,i,n.formatExtension):"";case"INTERNATIONAL":return s?(r=qg(s,null,"INTERNATIONAL",i,n),Vg(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=ng(i,r.metadata);if(o===n){var s=qg(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var i=new Jp(n);return i.selectNumberingPlan(e,t),i.defaultIDDPrefix()?i.defaultIDDPrefix():Pg.test(i.IDDPrefix())?i.IDDPrefix():void 0}(i,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(qg(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,o,n.fromCountry,i);return Vg(a,e.ext,i,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function qg(e,t,n,i,r){var o=Bg(i.formats(),e);return o?Mg(e,o,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:i}):e}function Bg(e,t){for(var n,i=Ug(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(Sg(t,r.pattern()))return r}}function Vg(e,t,n,i){return t?i(e,t,n):e}function Kg(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 Hg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kg(Object(n),!0).forEach((function(t){zg(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kg(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gg(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 Jg=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 Jp(t);Zg(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 Gg(e,[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Ag(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Jp(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 kg(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 Jp(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Og(e,t,n.metadata):Sg(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Jp(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Og(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return Fg(this,e,t?Hg(Hg({},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}(),Zg=function(e){return/^[A-Z]{2}$/.test(e)};var Yg=new RegExp("(["+Lp+"])");function Xg(e,t,n,i){if(t){var r=new Jp(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(Yg);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}function Qg(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 ev(e,t){var n=Qg(e,t),i=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(Sg(e,n.nationalNumberPattern())&&!Sg(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Cg(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:i}}function tv(e,t,n,i){var r=t?ng(t,i):n;if(0===e.indexOf(r)){(i=new Jp(i)).selectNumberingPlan(t,n);var o=e.slice(r.length),s=ev(o,i).nationalNumber,a=ev(e,i).nationalNumber;if(!Sg(a,i.nationalNumberPattern())&&Sg(s,i.nationalNumberPattern())||"TOO_LONG"===Cg(a,i))return{countryCallingCode:r,number:o}}return{number:e}}function nv(e,t,n,i){if(!e)return{};var r;if("+"!==e[0]){var o=Xg(e,t,n,i);if(!o||o===e){if(t||n){var s=tv(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 Jp(i);for(var l=2;l-1<=Wp&&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 iv(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 rv(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 rv(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 rv(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 ov(e,t){var n=t.countries;t.defaultCountry;var i=t.metadata;i=new Jp(i);for(var r,o=iv(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(Og({phone:e,country:s},void 0,i.metadata))return s}}function sv(e,t){var n=t.nationalNumber,i=t.defaultCountry,r=t.metadata,o=r.getCountryCodesForCallingCode(e);if(o)return 1===o.length?o[0]:ov(n,{countries:o,defaultCountry:i,metadata:r.metadata})}var av="+",dv="(["+Lp+"]|[\\-\\.\\(\\)]?)",lv=new RegExp("^\\"+av+dv+"*["+Lp+"]"+dv+"*$","g"),cv=new RegExp("^("+("["+Lp+"]+((\\-)*["+Lp+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+Lp+"])*")+"\\.?$","g"),uv="tel:",hv=";phone-context=",fv=";isub=";function pv(e,t){var n,i=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(hv);if(t<0)return null;var n=t+hv.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&&(lv.test(e)||cv.test(e))}(r))throw new Pp("NOT_A_NUMBER");if(null===r)n=i(e)||"";else{n="",r.charAt(0)===av&&(n+=r);var o,s=e.indexOf(uv);o=s>=0?s+uv.length:0;var a=e.indexOf(hv);n+=e.substring(o,a)}var d=n.indexOf(fv);if(d>0&&(n=n.substring(0,d)),""!==n)return n}var gv=250,vv=new RegExp("[++"+Lp+"]"),mv=new RegExp("[^"+Lp+"#]+$");function yv(e,t,n){if(t=t||{},n=new Jp(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new Pp("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var i=function(e,t,n){var i=pv(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>gv){if(n)throw new Pp("TOO_LONG");return}if(!1===t)return e;var i=e.search(vv);if(i<0)return;return e.slice(i).replace(mv,"")}(e,n,t)}});if(!i)return{};if(!function(e){return e.length>=Up&&ug.test(e)}(i))return function(e){return lg.test(e)}(i)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(hg);if(t<0)return{};for(var n=e.slice(0,t),i=e.match(hg),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 Pp("TOO_SHORT");throw new Pp("NOT_A_NUMBER")}return{}}var a=function(e,t,n,i){var r,o=nv($g(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||ng(t,i.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=ev($g(d),i),c=l.nationalNumber,u=l.carrierCode,h=sv(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 Pp("INVALID_COUNTRY");return{}}if(!l||l.length<Up){if(t.v2)throw new Pp("TOO_SHORT");return{}}if(l.length>Tp){if(t.v2)throw new Pp("TOO_LONG");return{}}if(t.v2){var f=new Jg(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)&&Sg(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:p,possible:!!p||!(!0!==t.extended||!n.possibleLengths()||!kg(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 bv(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 $v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bv(Object(n),!0).forEach((function(t){wv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cv(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 kv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sv(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 Iv(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 Iv(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 Iv(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 xv(e){var t,n,i,r=Sv(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(!Bp(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?Cv(Object(n),!0).forEach((function(t){kv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cv(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 Rv(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 Ov(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rv(Object(n),!0).forEach((function(t){Ev(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ev(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Av(e,t,n){t&&t.defaultCountry&&!ig(t.defaultCountry,n)&&(t=Ov(Ov({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return yv(e,$v($v({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof Pp))throw e}}function Nv(){var e=xv(arguments);return Av(e.text,e.options,e.metadata)}function jv(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 Mv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Pv=jv((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;Mv(this,e),this.key=t,this.value=n,this.next=i,this.prev=r})),Uv=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Mv(this,e),this.size=0,this.limit=t,this.head=null,this.tail=null,this.cache={}}return jv(e,[{key:"put",value:function(e,t){if(this.ensureLimit(),this.head){var n=new Pv(e,t,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Pv(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 Tv(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 Wv=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 Uv(t)}return Tv(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 Lv(e,t){if(e<0||t<=0||t<e)throw new TypeError;return"{".concat(e,",").concat(t,"}")}function Dv(e,t){var n=t.search(e);return n>=0?t.slice(0,n):t}var _v=" - \u2028\u2029 ",Fv="[".concat(_v,"]"),qv="[^".concat(_v,"]"),Bv="[".concat("0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9","]"),Vv="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Kv="[".concat(Vv,"]"),Hv=new RegExp(Kv),zv="[".concat("$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩","]"),Gv=new RegExp(zv),Jv="[".concat("̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦","]"),Zv=new RegExp(Jv),Yv=new RegExp("[\0--ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function Xv(e){return!(!Hv.test(e)&&!Zv.test(e))&&Yv.test(e)}function Qv(e){return"%"===e||Gv.test(e)}function em(e,t,n){var i=!0,r=Nv(e,n);if(r||(i=!1,r=Nv(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 tm={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()||!nm(e,n,i))},STRICT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!nm(e,n,r)||rm(e,n)||!im(e,{defaultCountry:i,metadata:r}))&&om()},EXACT_GROUPING:function(e,t){var n=t.candidate,i=t.defaultCountry,r=t.metadata;return t.regExpCache,!(!e.isValid()||!nm(e,n,r)||rm(e,n)||!im(e,{defaultCountry:i,metadata:r}))&&om()}};function nm(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"!==em(t.substring(i),e,n))return!1}else{var s=mg(t.substring(i));if(s){if(e.ext!==s)return!1}else if(e.ext)return!1}}}return!0}function im(e,t){var n=t.defaultCountry,i=t.metadata;if("FROM_DEFAULT_COUNTRY"!==e.__countryCallingCodeSource)return!0;var r=new Jp(i);r.selectNumberingPlan(e.countryCallingCode),e.country||sv(e.countryCallingCode,{nationalNumber:e.nationalNumber,defaultCountry:n,metadata:r});var o=e.nationalNumber,s=Bg(r.numberingPlan.formats(),o);return!s.nationalPrefixFormattingRule()||(!!r.numberingPlan.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||(!s.usesNationalPrefix()||Boolean(e.nationalPrefix)))}function rm(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)||mg(t.substring(0,n))!==e.countryCallingCode||t.slice(i+1).indexOf("/")>=0)}function om(e,t,n,i,r){throw new Error("This part of code hasn't been ported")}var sm=/[\\/] *x/;function am(e){return Dv(sm,e)}var dm=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,lm=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,cm=/^:[0-5]\d/;function um(e,t,n){if(dm.test(e))return!1;if(lm.test(e)){var i=n.slice(t+e.length);if(cm.test(i))return!1}return!0}var hm="(\\[([",fm=")\\])]",pm="[^".concat(hm).concat(fm,"]"),gm="[".concat(hm).concat(_p,"]"),vm=new RegExp("^"+gm),mm=Lv(0,3),ym=new RegExp("^(?:[(\\[([])?(?:"+pm+"+["+fm+"])?"+pm+"+(?:["+hm+"]"+pm+"+["+fm+"])"+mm+pm+"*$"),bm=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;function $m(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 wm(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 wm(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 wm(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 Cm(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 km=sg(),Sm=["\\/+(.*)/","(\\([^(]*)","(?:".concat(Fv,"-|-").concat(Fv,")").concat(Fv,"*(.+)"),"[‒-―-]".concat(Fv,"*(.+)"),"\\.+".concat(Fv,"*([^.]+)"),"".concat(Fv,"+(").concat(qv,"+)")],Im=Lv(0,2),xm=Lv(0,4),Rm=Tp+Wp,Om=Lv(0,Rm),Em="[".concat(Dp,"]")+xm,Am=Bv+Lv(1,Rm),Nm="(?:"+gm+Em+")"+Im+Am+"(?:"+Em+Am+")"+Om+"(?:"+km+")?",jm=new RegExp("[^".concat("0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9").concat(Vv,"#]+$")),Mm=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Pm=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&&ig(n.defaultCountry,i)?n.defaultCountry:void 0,leniency:n.leniency||(n.extended?"POSSIBLE":"VALID"),maxTries:n.maxTries||Mm}).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=tm[n.leniency],!this.leniency)throw new TypeError('Unknown leniency: "'.concat(n.leniency,'"'));this.maxTries=n.maxTries,this.PATTERN=new RegExp(Nm,"ig"),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new Wv(32)}return Cm(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(um(t=am(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=$m(Sm);!(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=Dv(jm,e.slice(0,a.index)),c=this.parseAndVerify(l,t,n);if(c)return c;this.maxTries--,s=!1}var u=Dv(jm,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(ym.test(e)&&!bm.test(e)){if("POSSIBLE"!==i){if(t>0&&!vm.test(e)){var r=n[t-1];if(Qv(r)||Xv(r))return!1}var o=t+e.length;if(o<n.length){var s=n[o];if(Qv(s)||Xv(s))return!1}}return!0}}(e,t,n,this.options.leniency)){var i=Nv(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 Um(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 Tm=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 Um(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 Wm(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 Lm(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 Lm(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 Lm(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 Dm="x",_m=new RegExp(Dm);function Fm(e,t){if(t<1)return"";for(var n="";t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function qm(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 Bm(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=Vm(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:o,metadata:i});if(s)return s}return Vm(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:o,metadata:i})}(e,t,{metadata:i,shouldTryNationalPrefixFormattingRule:r,getSeparatorAfterNationalPrefix:o})}function Vm(e,t,n){var i=n.metadata,r=n.useNationalPrefixFormattingRule,o=n.getSeparatorAfterNationalPrefix,s=Mg(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 mg(e)===t.getNationalDigits()}(s,e))return s}function Km(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 Hm=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return Km(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([Zm(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(Jm);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(Zm(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(Zm(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:zm(i)});break;default:throw new Error("Unknown operator: ".concat(n))}r&&this.parsePattern(r)}else{if(Gm.test(e))throw new Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}]),e}();function zm(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 Gm=/[\(\)\[\]\?\:\|]/,Jm=new RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Zm(e){return 1===e.length?e[0]:e}function Ym(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 Xm(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 Xm(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 Xm(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 Qm(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 ey=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 Hm).parse(t)}return Qm(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=ty(e.split(""),this.matchTree,!0);if(n&&n.match&&delete n.matchedChars,!n||!n.overflow||t)return n}}]),e}();function ty(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=ty(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=Ym(t.args);!(d=l()).done;){var c=ty(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=Ym(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 ny(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 iy(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 iy(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 iy(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 ry(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 oy=Fm("9",15),sy=/[- ]/,ay=new RegExp("["+Dp+"]*\\$1["+Dp+"]*(\\$\\d["+Dp+"]*)*$"),dy=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 ry(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"===Cg(e,t)}(t.nationalSignificantNumber,this.metadata))for(var i,r=ny(this.matchingFormats);!(i=r()).done;){var o=i.value,s=Bm(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,Dm),t),this.populatedNationalNumberTemplate=s,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(Dm),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 ey(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":ay.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=ny(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()&&sy.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(Dm,t+1),n++;return qm(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,Dm)+Fm(Dm,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=oy.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(jg,e.nationalPrefixFormattingRule());if(mg(e.nationalPrefixFormattingRule())===(r||"")+mg("$1")&&(u=h,c=!0,r))for(var f=r.length;f>0;)u=u.replace(/\d/,Dm),f--}var p=a.replace(new RegExp(s),u).replace(new RegExp("9","g"),Dm);return c||(o?p=Fm(Dm,o.length)+" "+p:r&&(p=Fm(Dm,r.length)+this.getSeparatorAfterNationalPrefix(e)+p)),i&&(p=Ng(p)),p}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,n){for(var i,r=Wm(n.split(""));!(i=r()).done;){var o=i.value;if(e.slice(t+1).search(_m)<0)return;t=e.search(_m),e=e.replace(_m,o)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],qm(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 ly(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 cy(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 cy(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 cy(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 uy(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 hy=new RegExp("^"+("["+Dp+Lp+"]+")+"$","i"),fy="(?:[++]["+Dp+Lp+"]*|["+Dp+Lp+"]+)",py=new RegExp("[^"+Dp+Lp+"]+.*$"),gy=/[^\d\[\]]/,vy=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 uy(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(fy);if(n<0)return;e=e.slice(n),"+"===e[0]&&(t=!0,e=e.slice(1));e=e.replace(py,""),t&&(e="+"+e);return e}(e)||"";if("+"===t[0])return[t.slice(1),!0];return[t]}(e),n=ly(t,2),i=n[0],r=n[1];hy.test(i)||(i="");return[i,r]}(e),r=ly(i,2),o=r[0],s=r[1],a=mg(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=nv("+"+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&&gy.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var n=Qg(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=Qg(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=Xg(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=tv(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 my(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 yy(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 yy(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 yy(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 by(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 $y,wy=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 Jp(n);var i=my(this.getCountryAndCallingCode(t),2),r=i[0],o=i[1];this.defaultCountry=r,this.defaultCallingCode=o,this.reset()}return by(e,[{key:"getCountryAndCallingCode",value:function(e){var t,n;return e&&(Bp(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 Tm({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 dy({state:this.state,metadata:this.metadata}),this.parser=new vy({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,Dm)}},{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(sv(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 Jp(this.metadata.metadata);o.selectNumberingPlan(r);var s=o.numberingPlan.callingCode(),a=this.metadata.getCountryCodesForCallingCode(s);if(a.length>1){var d=ov(t,{countries:a,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});d&&(r=d)}}var l=new Jg(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 Cy(){return function(e,t){var n=Array.prototype.slice.call(t);return n.push(Ip),e.apply(this,n)}(Nv,arguments)}function ky(e,t){return Pm.call(this,e,t,Ip)}function Sy(e){return wy.call(this,e,Ip)}function Iy(){return Jp.call(this,Ip)}ky.prototype=Object.create(Pm.prototype,{}),ky.prototype.constructor=ky,Sy.prototype=Object.create(wy.prototype,{}),Sy.prototype.constructor=Sy,Iy.prototype=Object.create(Jp.prototype,{}),Iy.prototype.constructor=Iy,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"}($y||($y={}));const xy=(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)}),{}),Ry=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Oy=(e,t)=>e===$y.date?(e=>new Date(Number(e)).toLocaleDateString("en-US"))(`${t}`):t,Ey=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),n)})),t};function Ay(e){return new URLSearchParams(window.location.search).get(e)}const Ny={enabled:"active",disabled:"disabled",invited:"invited"},jy=e=>e.tenantRoles.data,My=e=>e.selectedUsersLoginIds,Py=e=>e.notifications,Uy=e=>e.customAttributes.data,Ty=gl(Uy,(e=>Object.fromEntries(e.map((e=>[e.name,e.type]))))),Wy=gl((e=>e.usersList.data),Ty,((e,t)=>e.map((e=>Object.assign(Object.assign({},e),{customAttributes:Object.fromEntries(Object.entries(e.customAttributes).map((([e,n])=>[e,Oy(t[e],n)])))}))))),Ly=gl(Wy,(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),Ry(null==e?void 0:e.customAttributes,"customAttributes")),{createdTimeFormatted:new Date(1e3*((null==e?void 0:e.createdTime)||0)).toLocaleString(),status:Ny[e.status]||e.status,roles:e.roleNames}))))),Dy=gl(My,Ly,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),_y=gl(Dy,(e=>e.map((e=>e.userId)))),Fy=gl(Dy,(e=>e.map((({userId:e,loginIds:t})=>({userId:e,loginIds:t}))))),qy=gl(Dy,(e=>e.map((e=>({userId:e.userId,roles:e.roles}))))),By=gl(Dy,(e=>e.map((e=>e.status)))),Vy=gl(Dy,(e=>e.every((e=>e.editable)))),Ky=gl(My,(e=>!!e.length)),Hy=gl(My,(e=>1===e.length)),zy=gl(My,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),Gy=gl(Hy,By,((e,t)=>e&&t.every((e=>e===Ny.enabled)))),Jy=gl(By,(e=>e.every((e=>e===Ny.disabled)))),Zy=gl(Dy,(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`})),Yy=gl(Hy,Jy,Vy,((e,t,n)=>e&&t&&n)),Xy=gl(Hy,Gy,Vy,((e,t,n)=>e&&t&&n)),Qy=gl(Hy,Vy,((e,t)=>e&&t)),eb=gl(Hy,Vy,((e,t)=>e&&t)),tb=gl(Hy,Vy,((e,t)=>e&&t)),nb=Ky,ib=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)}))}))},rb=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}}),ob=({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)})}}),sb=Gl("users/create",((e,{extra:{api:t}})=>t.user.create(e))),ab=ib(sb)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},rb((e=>e.createUser)),ob({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>`}})),db={action:sb,reducer:ab},lb=Gl("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),cb=ib(lb)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},rb((e=>e.deleteUser)),ob({getSuccessMsg:e=>Ci(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Ci(e.meta.arg.length)`Failed to delete user${["","s"]}`})),ub={action:lb,reducer:cb},hb=Gl("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),fb=ib(hb)(rb((e=>e.setTempUserPassword)),ob({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>`}})),pb={action:hb,reducer:fb},gb=Gl("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),vb=ib(gb)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},rb((e=>e.customAttributes))),mb={action:gb,reducer:vb},yb=Gl("users/search",((e,{extra:{api:t},getState:n})=>{const i=n().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),bb=ib(yb)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},rb((e=>e.usersList))),$b={action:yb,reducer:bb},wb=Gl("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Cb=ib(wb)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},rb((e=>e.tenantRoles))),kb={action:wb,reducer:Cb},Sb=Gl("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Ib=ib(Sb)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>bi(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},rb((e=>e.updateUser)),ob({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>`}})),xb={action:Sb,reducer:Ib},Rb=Gl("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Ob=ib(Rb)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return bi(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)}},rb((e=>e.enableUser)),ob({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>`}})),Eb={action:Rb,reducer:Ob},Ab=Gl("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Nb=ib(Ab)({onFulfilled:(e,t)=>{var n;const i=e.usersList.data.findIndex((e=>{var n;return bi(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)}},rb((e=>e.disableUser)),ob({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>`}})),jb={action:Ab,reducer:Nb},Mb=Gl("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Pb={action:Mb,reducer:ib(Mb)(rb((e=>e.removePasskey)),ob({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>`}}))},Ub={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:[]},Tb="/v1/mgmt/user/search",Wb="/v1/mgmt/user/delete/batch",Lb="/v1/mgmt/user/create",Db="/v1/mgmt/user/patch",_b="/v1/mgmt/user/update/status",Fb="/v1/mgmt/user/password/set/temporary",qb="/v1/mgmt/user/passkeys/delete",Bb="/v1/mgmt/user/customattributes",Vb="/v1/mgmt/role/all",Kb=e=>c(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)})),Hb=({httpClient:e,tenant:t,mock:n})=>({search:(...i)=>c(void 0,[...i],void 0,(function*({page:i,limit:r=1e4,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:u}={}){if(n)return(e=>c(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:e%3==0,OIDC:e%3==1,SCIM:e%3==2,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,n)=>((e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof t){const i=e?1:0,r=t?1:0;return n?i-r:r-i}const i=(null==e?void 0:e.toString())||"",r=(null==t?void 0:t.toString())||"";return n?r.localeCompare(i):i.localeCompare(r)})(t[e.field],n[e.field],e.desc)))})),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:l,sort:u});const h=yield e.post(Tb,{limit:r,page:i,withTestUser:!1,customAttributes:o,statuses:s,emails:a,phones:d,text:l,sort:u},{queryParams:{tenant:t}});return yield Kb(h),(yield h.json()).users})),deleteBatch:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Wb,{userIds:i},{queryParams:{tenant:t}});return yield Kb(r),r.json()})),create:i=>c(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:b,invite:$}){if(n)return(e=>c(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,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:b,invite:$});const w=yield e.post(Lb,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v,sendSMS:m,sendMail:y,inviteUrl:b,invite:$},{queryParams:{tenant:t}});return yield Kb(w),(yield w.json()).user})),update:i=>c(void 0,[i],void 0,(function*({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v}){if(n)return(e=>c(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,SCIM:!1,OIDC:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:i,email:r,phone:o,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,givenName:f,middleName:p,familyName:g,additionalLoginIds:v});const m=yield e.patch(Db,{loginId:i,email:r,phone:o,displayName:s,givenName:f,middleName:p,familyName:g,roleNames:a,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:h,additionalLoginIds:v},{queryParams:{tenant:t}});return yield Kb(m),(yield m.json()).user})),enable:i=>c(void 0,void 0,void 0,(function*(){if(n)return(e=>c(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(i);const r=yield e.post(_b,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield Kb(r),r.json()})),disable:i=>c(void 0,void 0,void 0,(function*(){if(n)return(e=>c(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(i);const r=yield e.post(_b,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield Kb(r),r.json()})),removePasskey:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){}));const r=yield e.post(qb,{loginId:i},{queryParams:{tenant:t}});return yield Kb(r),r.json()})),setTempPassword:i=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(Fb,{loginId:i},{queryParams:{tenant:t}});return yield Kb(r),r.json()})),getCustomAttributes:()=>c(void 0,void 0,void 0,(function*(){if(n)return c(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const i=yield e.get(Bb,{queryParams:{tenant:t}});return yield Kb(i),(yield i.json()).data}))}),zb=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>c(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(Vb,{queryParams:{tenant:t}});return yield Kb(i),i.json()}))}),Gb=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,qo,oc,_o({tenant:_o.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 styleId(){return this.getAttribute("style-id")||ds}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n,i)=>{const r=di(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.11.25"}}));return{user:Hb({httpClient:r.httpClient,tenant:t,mock:n}),tenant:zb({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})),Jb=Si((e=>{const t=mi(ic({name:"widget",initialState:Ub,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{db.reducer(e),xb.reducer(e),Eb.reducer(e),jb.reducer(e),ub.reducer(e),$b.reducer(e),pb.reducer(e),Pb.reducer(e),mb.reducer(e),kb.reducer(e)},asyncActions:{searchUsers:$b.action,createUser:db.action,updateUser:xb.action,enableUser:Eb.action,disableUser:jb.action,deleteUsers:ub.action,removePasskey:Pb.action,getCustomAttributes:mb.action,getTenantRoles:kb.action,setTempUserPassword:pb.action}}),Lo,jo,Gb)(e);return class extends t{constructor(...e){super(...e),this.state=Ub,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Zb=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Yb=Si((e=>{var t,n,i;return i=class extends(mi(jo,Lo,ts,as,Zb,Jb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([u(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),Xb=Si((e=>{var t,n,i,r,o,s;return s=class extends(mi(Jb,Ya,rc,jo,Yb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,(()=>c(this,void 0,void 0,(function*(){yield u(this,n,"f").setData(jy(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){return c(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(yi(yield this.fetchWidgetPage("create-user-modal.html"))),new ja((()=>{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 ja((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(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({},xy(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),h(this,n,new Fa((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),u(this,o,"f").call(this),this.createUserModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){yield u(this,o,"f").call(this),u(this,t,"m",r).call(this)}))}))},r=function(){const e=Uy(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})),Qb=Si((e=>{var t,n,i;return i=class extends(mi(jo,Xb,Yb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new ja(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})),e$=Si((e=>{var t,n,i;return i=class extends(mi(Jb,Ya,jo,Yb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(yi(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new ja((()=>{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 ja((()=>{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=_y(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new Ka(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Zy(this.state);i.text=`Delete ${e}?`}}))},i})),t$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb,e$)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),nb)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new ja(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})),n$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Jb,Ya,jo,rc,Yb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new ja((()=>{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 ja((()=>{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=zy(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){return c(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(yi(yield this.fetchWidgetPage("disable-user-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new Ka(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Zy(this.state);r.text=`Disable ${e}?`}))}))},o})),i$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb,n$,rc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Xy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new ja(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})),r$=e=>{if(!e)return e;const t=Cy(e.startsWith("+")?e:`+${e}`);if(!t)return e;const n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return(null==t?void 0:t.number.replace(n,"$1-$2"))||e},o$=Si((e=>{var t,n,i,r,o,s,a,d,f,p;return p=class extends(mi(Jb,Ya,jo,rc,Yb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),s.set(this,(()=>c(this,void 0,void 0,(function*(){yield u(this,i,"f").setData(jy(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=Dy(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:r$(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},Ry(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",f).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){new ja((()=>{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 ja((()=>{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=l(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},xy(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=Uy(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 c(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(yi(yield this.fetchWidgetPage("edit-user-modal.html"))),u(this,t,"m",r).call(this),u(this,t,"m",o).call(this),h(this,n,new Ha(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),h(this,i,new Fa((()=>{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=()=>c(this,void 0,void 0,(function*(){yield u(this,s,"f").call(this),u(this,n,"f").disable(),u(this,d,"f").call(this),u(this,t,"m",a).call(this)}))}))},p})),s$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb,o$,rc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Qy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new ja(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})),a$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Jb,Ya,jo,rc,Yb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new ja((()=>{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 ja((()=>{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=zy(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){return c(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(yi(yield this.fetchWidgetPage("enable-user-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new Ka(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Zy(this.state);r.text=`Activate ${e}?`}))}))},o})),d$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb,a$,rc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),Yy)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new ja(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})),l$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,ki((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this)}))}},n=new WeakMap,t=new WeakSet,i=function(){var e;this.searchInput=new Ha(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(u(this,n,"f"))},r})),c$={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},u$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(jo,Jb,Qa,Lo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),Py)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=c$[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})),h$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Jb,Ya,jo,rc,Yb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new ja((()=>{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 ja((()=>{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=zy(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){return c(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(yi(yield this.fetchWidgetPage("remove-passkey-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new Ka(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Zy(this.state);r.text=`Remove passkey for ${e}?`}))}))},o})),f$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb,h$,rc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),eb)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new ja(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$=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(Jb,jo,Yb)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{this.usersTable.data=e}))),o.set(this,ki(((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,$i((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 c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",i).call(this),u(this,r,"f").call(this,Ly(this.state)),u(this,s,"f").call(this,Uy(this.state)),this.subscribe(u(this,s,"f").bind(this),Uy),this.subscribe(u(this,r,"f").bind(this),Ly)}))}},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 Wa(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(u(this,t,"m",a).bind(this)),u(this,t,"m",n).call(this),u(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{u(this,o,"f").call(this,e.target,e.detail)}))}))},d})),g$=Si((e=>{var t,n,i;return i=class extends(mi(Jb,Ya,jo,rc,Yb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(yi(yield this.fetchWidgetPage("generated-password-modal.html"))),new ja((()=>{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})),v$=Si((e=>{var t,n,i,r,o;return o=class extends(mi(Jb,Ya,jo,rc,Yb,g$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield u(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new ja((()=>{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 ja((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>c(this,void 0,void 0,(function*(){var e;const t=zy(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 c(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(yi(yield this.fetchWidgetPage("reset-password-modal.html"))),u(this,t,"m",n).call(this),u(this,t,"m",i).call(this);const r=new Ka(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>c(this,void 0,void 0,(function*(){const e=Zy(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},o})),m$=Si((e=>{var t,n,i,r;return r=class extends(mi(jo,Yb,Jb,v$,rc)(e)){constructor(){super(...arguments),t.add(this),i.set(this,$i((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var r;u(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(u(this,i,"f").bind(this),tb)}))}},i=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new ja(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})),y$=Si((e=>class extends(mi(cs,Do)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),b$=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v,m;return m=class extends(mi(y$,Jb,Ya,jo,rc,Yb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,[]),o.set(this,null),s.set(this,null),v.set(this,$i((e=>{u(this,r,"f").forEach((t=>{"onlyOne"===t.enableMode&&1===e.length||"oneOrMore"===t.enableMode&&e.length>0||"always"===t.enableMode?t.enable():t.disable()}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",l).call(this),u(this,t,"m",d).call(this),u(this,v,"f").call(this,My(this.state))}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,v=new WeakMap,t=new WeakSet,a=function(e){const n=new Pa(e,{logger:this.logger});n.onClick((()=>{u(this,t,"m",g).call(this,n.flowId)})),this.subscribe(u(this,v,"f").bind(this),My),u(this,r,"f").push(n)},d=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{u(this,t,"m",a).call(this,e)}))},l=function(){h(this,n,this.createModal({"data-id":"generic-flow-modal"}),"f"),u(this,n,"f").afterClose=()=>{var e;u(this,o,"f")&&(null===(e=u(this,s,"f"))||void 0===e||e.call(this),h(this,o,null,"f"))},h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(u(this,i,"f"))},f=function(){var e;u(this,n,"f").open(),null===(e=u(this,s,"f"))||void 0===e||e.call(this)},p=function(e,n){n=()=>u(this,t,"m",f).call(this),h(this,s,u(this,i,"f").onPageUpdated(n),"f")},g=function(e){u(this,n,"f").setContent(Ey({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,client:JSON.stringify({userIds:_y(this.state),loginIds:Fy(this.state),usersAndRoles:qy(this.state)}),tenant:this.tenantId})),u(this,t,"m",p).call(this,u(this,n,"f"),u(this,o,"f")),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.searchUsers()}))},m})),$$="widget-flow",w$=Si((e=>{var t,n,i;return i=class extends(mi(Lo,Ya,Jb,oc,jo,cs)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=Ay($$);r&&(function(e){if(window.history.replaceState&&Ay(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())}}($$),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Ey({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Ma((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close()})),t.afterClose=()=>{t.remove()},t.open()},i})),C$=Si((e=>class extends(mi(Ia,cs,w$,p$,Qb,t$,s$,d$,i$,m$,f$,l$,u$,b$)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),k$=mi((e=>class extends(C$(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 Sa})).then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.11.25"}}}))}}))(HTMLElement);customElements.define("descope-user-management-widget",k$);var S$=Object.freeze({__proto__:null,default:k$});const I$=(e={})=>{const t=yi("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute(wi(e),(e=>"string"==typeof e?e:(e=>null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype)(e)?JSON.stringify(e):"")(n))})),t};function x$(e){return new URLSearchParams(window.location.search).get(e)}const R$=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},O$=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}}),E$=Gl("users/me",((e,{extra:{api:t}})=>t.user.me())),A$=R$(E$)({onFulfilled:(e,t)=>{e.me.data=t.payload}},O$((e=>e.me))),N$={action:E$,reducer:A$},j$=Gl("users/devices",((e,{extra:{api:t}})=>t.device.devices(e))),M$=R$(j$)({onFulfilled:(e,t)=>{e.devices.data=t.payload.devices}},O$((e=>e.devices))),P$={action:j$,reducer:M$},U$=Gl("users/logout",((e,{extra:{api:t}})=>t.user.logout())),T$={action:U$,reducer:R$(U$)({})},W$=e=>{if(!e)return null;const t=(e=>{try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(n)}catch(e){return null}})(e);return(null==t?void 0:t.dct)||null},L$=e=>e.me.data,D$=gl(L$,(e=>e.userId)),_$=gl(L$,(e=>e.picture)),F$=gl(L$,(e=>e.email)),q$=gl(L$,(e=>e.verifiedEmail)),B$=gl(L$,(e=>e.name)),V$=gl(L$,(e=>e.phone)),K$=gl(L$,(e=>e.verifiedPhone)),H$=gl(F$,q$,((e,t)=>e&&""!==e.trim()&&!t?"Unverified":"")),z$=gl(V$,K$,((e,t)=>e&&""!==e.trim()&&!t?"Unverified":"")),G$=gl(L$,(e=>e.webauthn));gl(L$,(e=>e.password));const J$=gl(L$,(e=>e.TOTP)),Z$=gl(L$,(e=>e.customAttributes)),Y$=gl(L$,(e=>({givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}))),X$=gl((e=>e.devices.data),(e=>e.map((({id:e,name:t,deviceType:n,lastLoginTime:i,isCurrentDevice:r})=>({id:e,name:t,deviceType:n,lastLoginDate:1e3*parseInt(i,10),isCurrent:r}))))),Q$=e=>e.notifications,ew=gl(L$,(e=>e.userTenants||[])),tw=e=>e.tenant.currentTenantId,nw=Gl("tenant/select",((e,t)=>c(void 0,[e,t],void 0,(function*(e,{extra:{api:t},getState:n}){if(e===tw(n()))return null;const i=yield t.user.setCurrentTenant(e),r=i.sessionJwt||i.sessionToken;try{return{tenantId:W$(r)}}catch(e){return console.error("Failed to switch tenant:",e),null}})))),iw={action:nw,reducer:R$(nw)({onPending:e=>{e.tenant.previousTenantId=e.tenant.currentTenantId},onFulfilled:(e,t)=>{var n;e.tenant.currentTenantId=null===(n=t.payload)||void 0===n?void 0:n.tenantId,e.tenant.previousTenantId=null},onRejected:e=>{e.tenant.currentTenantId=e.tenant.previousTenantId,e.tenant.previousTenantId=null}},O$((e=>e.selectTenant)),(({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,n)=>{if(t){const i=t(n);i&&e.notifications.push({type:"success",msg:i})}},onRejected:(t,n)=>{if(e){const i=e(n);i&&t.notifications.push({type:"error",msg:i})}}}))({getErrorMsg:e=>{var t,n;const i=(null===(t=e.error)||void 0===t?void 0:t.message)||"";return"Error"===(null===(n=e.error)||void 0===n?void 0:n.name)?i:`${i||"Error"}`}}))},rw={me:{loading:!1,error:null,data:{}},devices:{loading:!1,error:null,data:[]},tenant:{currentTenantId:null,previousTenantId:null},selectTenant:{loading:!1,error:null},notifications:[]},ow="/v1/auth/me",sw="/v1/mgmt/user/trusteddevices/list",aw="/v1/auth/tenant/select",dw=e=>c(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)})),lw=[{tenantName:"Tenant 1",tenantId:"tn1",roleNames:["Role"]},{tenantName:"Tenant 2",tenantId:"tn2",roleNames:["Role"]}],cw=({httpClient:e,mock:t})=>({me:()=>c(void 0,void 0,void 0,(function*(){if(t)return c(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:lw,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(ow);return yield dw(n),n.json()})),setCurrentTenant:t=>c(void 0,void 0,void 0,(function*(){const n=yield e.post(aw,{tenant:t});return yield dw(n),n.json()}))}),uw=({httpClient:e,mock:t})=>({devices:n=>c(void 0,[n],void 0,(function*({userId:n}){if(t)return{devices:[{id:"device-id-1",name:"Device 1",deviceType:"desktop",lastLoginDate:17359776e5,isCurrent:!1},{id:"device-id-2",name:"Device 2",deviceType:"mobile",lastLoginDate:17387505e5,isCurrentDevice:!0},{id:"device-id-3",name:"Device 3",deviceType:"tablet",lastLoginDate:17412642e5,isCurrent:!1},{id:"device-id-4",name:"Device 4",deviceType:"unknown",lastLoginDate:17440371e5,isCurrent:!1},{id:"device-id-5",name:"Device 5",deviceType:"desktop",lastLoginDate:174672e7,isCurrent:!1}]};const i=yield e.post(sw,{identifiers:[n]});return yield dw(i),i.json()}))}),hw=Si((e=>{var t,n,i,r;const o=mi(Fo,Do,jo,qo,oc)(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 styleId(){return this.getAttribute("style-id")||ds}get api(){return u(this,n,"f")||u(this,t,"m",i).call(this),u(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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"],(()=>{u(this,n,"f")&&u(this,t,"m",i).call(this)}))}))}},n=new WeakMap,t=new WeakSet,i=function(){this.logger.debug("creating an sdk instance"),h(this,n,((e,t,n)=>{const i=di(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.10.0"}}));return{user:Object.assign(Object.assign({},cw({httpClient:i.httpClient,mock:t})),{logout:t?()=>c(void 0,void 0,void 0,(function*(){})):i.logout}),device:Object.assign({},uw({httpClient:i.httpClient,mock:t}))}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},r})),fw=Si((e=>{const t=mi(ic({name:"widget",initialState:rw,reducers:{clearNotifications:e=>{e.notifications=[]},setCurrentTenantId:(e,{payload:t})=>{e.tenant.currentTenantId=t}},extraReducers:e=>{N$.reducer(e),P$.reducer(e),T$.reducer(e),iw.reducer(e)},asyncActions:{getMe:N$.action,listDevices:P$.action,logout:T$.action,selectTenant:iw.action}}),Lo,jo,hw)(e);return class extends t{constructor(...e){super(...e),this.state=rw,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),pw="widget-flow",gw=Si((e=>{var t,n,i;return i=class extends(mi(Lo,Ya,fw,oc,jo,cs)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this);const r=x$(pw);r&&(function(e){if(window.history.replaceState&&x$(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())}}(pw),u(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(I$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),new Ma((()=>{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})),vw=Si((e=>{const t=mi(Ko,_o({"widget-id":_o.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return c(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),mw=Si((e=>{var t,n,i;return i=class extends(mi(jo,Lo,ts,as,vw,fw)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return c(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield this.actions.getMe(),yield u(this,t,"m",n).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},t=new WeakSet,n=function(){return c(this,void 0,void 0,(function*(){const e=yi(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},i})),yw=Si((e=>class extends(mi(cs,Do)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),bw=Si((e=>{var t,n,i,r,o,s,a,d,l;return l=class extends(mi(yw,cs,fw,jo,oc,mw,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),a.set(this,$i((e=>{this.avatar.image=e}))),d.set(this,$i((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",s).call(this),u(this,t,"m",r).call(this),u(this,a,"f").call(this,_$(this.state)),u(this,d,"f").call(this,B$(this.state)),this.subscribe(u(this,a,"f").bind(this),_$),this.subscribe(u(this,d,"f").bind(this),B$)}))}},n=new WeakMap,i=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){this.avatar.flowId&&(h(this,n,this.createModal({"data-id":"update-pic"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new Na((()=>{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=u(this,n,"f"))||void 0===e||e.open()}))},l})),$w=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v;return v=class extends(mi(yw,fw,jo,mw,oc,Ya)(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,$i((e=>{this.emailUserAttr.value=e}))),g.set(this,$i((e=>{this.emailUserAttr.badgeLabel=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,F$(this.state)),u(this,g,"f").call(this,H$(this.state)),this.subscribe(u(this,p,"f").bind(this),F$),this.subscribe(u(this,g,"f").bind(this),H$)}))}},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&&(h(this,n,this.createModal({"data-id":"edit-email"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.emailUserAttr.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-email"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(I$({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr=new za((()=>{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=u(this,n,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},v})),ww=Si((e=>{var t,n,i;return i=class extends(mi(fw,jo,mw,Ya)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),u(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new ja((()=>{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((()=>c(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},i})),Cw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(yw,fw,jo,mw,oc,Ya)(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,$i((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,B$(this.state)),this.subscribe(u(this,p,"f").bind(this),B$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.nameUserAttr.editFlowId&&(h(this,n,this.createModal({"data-id":"edit-name"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.nameUserAttr.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-name"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(I$({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr=new za((()=>{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=u(this,n,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),kw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(yw,fw,jo,mw,oc,Ya)(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,$i((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,G$(this.state)),this.subscribe(u(this,p,"f").bind(this),G$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.passkeyUserAuthMethod.flowId&&(h(this,n,this.createModal({"data-id":"add-passkey"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.passkeyUserAuthMethod.fulfilledFlowId&&(h(this,r,this.createModal({"data-id":"remove-passkey"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(I$({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.passkeyUserAuthMethod=new Ga((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.passkeyUserAuthMethod.onFulfilledButtonClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),Sw=Si((e=>{var t,n,i,r,o,s;return s=class extends(mi(yw,fw,jo,mw,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new Ga((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.initPasswordAuthMethod(),u(this,t,"m",r).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.passwordUserAuthMethod.flowId&&(h(this,n,this.createModal({"data-id":"password"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",o).bind(this),u(this,t,"m",o).call(this),this.syncFlowTheme(u(this,i,"f")))},o=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close()}))},s})),Iw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g,v;return v=class extends(mi(yw,fw,jo,mw,oc,Ya)(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,$i((e=>{this.phoneUserAttr.value=e}))),g.set(this,$i((e=>{this.phoneUserAttr.badgeLabel=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,V$(this.state)),u(this,g,"f").call(this,z$(this.state)),this.subscribe(u(this,p,"f").bind(this),V$),this.subscribe(u(this,g,"f").bind(this),z$)}))}},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&&(h(this,n,this.createModal({"data-id":"edit-phone"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.phoneUserAttr.deleteFlowId&&(h(this,r,this.createModal({"data-id":"delete-phone"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(I$({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr=new za((()=>{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=u(this,n,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},v})),xw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p,g;return g=class extends(mi(yw,fw,jo,mw,oc,Ya)(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,$i((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",f).call(this),u(this,t,"m",s).call(this),u(this,t,"m",d).call(this),u(this,p,"f").call(this,J$(this.state)),this.subscribe(u(this,p,"f").bind(this),J$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,p=new WeakMap,t=new WeakSet,s=function(){this.totpUserAuthMethod.flowId&&(h(this,n,this.createModal({"data-id":"totp"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=u(this,t,"m",a).bind(this),u(this,t,"m",a).call(this),this.syncFlowTheme(u(this,i,"f")))},a=function(){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},d=function(){this.totpUserAuthMethod.fulfilledFlowId&&(h(this,r,this.createModal({"data-id":"remove-totp"}),"f"),h(this,o,new Ma((()=>{var e;return null===(e=u(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,r,"f").afterClose=u(this,t,"m",l).bind(this),u(this,t,"m",l).call(this),this.syncFlowTheme(u(this,o,"f")))},l=function(){u(this,r,"f").setContent(I$({projectId:this.projectId,flowId:this.totpUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),u(this,o,"f").onSuccess((()=>{u(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.totpUserAuthMethod=new Ga((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=u(this,n,"f"))||void 0===e||e.open()})),this.totpUserAuthMethod.onFulfilledButtonClick((()=>{var e;null===(e=u(this,r,"f"))||void 0===e||e.open()}))},g})),Rw=Si((e=>{var t,n,i,r,o,s,a,d,l,h,f;return f=class extends(mi(yw,fw,jo,mw,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,{}),i.set(this,{}),r.set(this,{}),o.set(this,{}),d.set(this,$i((e=>{var n;const i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelectorAll('descope-user-attribute[data-id^="builtin."]');Array.from(i).forEach((n=>{const i=n.getAttribute("data-id").replace("builtin.",""),r=e[i],o=new za(n,{logger:this.logger});o.value=(r||"").toString(),u(this,t,"m",l).call(this,n,i,o),u(this,t,"m",h).call(this,n,i,o)}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),u(this,d,"f").call(this,Y$(this.state)),this.subscribe(u(this,d,"f").bind(this),Y$)}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,d=new WeakMap,t=new WeakSet,s=function(e){var t,r;null===(t=u(this,n,"f")[e])||void 0===t||t.setContent(I$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(r=u(this,i,"f")[e])||void 0===r||r.onSuccess((()=>{var t;null===(t=u(this,n,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},a=function(e){var t,n;null===(t=u(this,r,"f")[e])||void 0===t||t.setContent(I$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,o,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(this,r,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},l=function(e,r,o){const a=e.getAttribute("edit-flow-id");a&&(u(this,n,"f")[a]=this.createModal({"data-id":`edit-${r}`}),u(this,i,"f")[a]=new Ma((()=>{var e,t;return null===(t=null===(e=u(this,n,"f")[a])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,n,"f")[a].afterClose=u(this,t,"m",s).bind(this,a),o.onEditClick((()=>{var e,t;null===(t=null===(e=u(this,n,"f"))||void 0===e?void 0:e[a])||void 0===t||t.open()})),u(this,t,"m",s).call(this,a),this.syncFlowTheme(u(this,i,"f")[a]))},h=function(e,n,i){const s=e.getAttribute("delete-flow-id");s&&(u(this,r,"f")[s]=this.createModal({"data-id":`delete-${n}`}),u(this,o,"f")[s]=new Ma((()=>{var e,t;return null===(t=null===(e=u(this,r,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,r,"f")[s].afterClose=u(this,t,"m",a).bind(this,s),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=u(this,r,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),u(this,t,"m",a).call(this,s),this.syncFlowTheme(u(this,o,"f")[s]))},f}));var Ow;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(Ow||(Ow={}));const Ew=Si((e=>{var t,n,i,r,o,s,a,d,l,h,f;return n=class extends(mi(yw,fw,jo,mw,oc,Ya)(e)){constructor(){super(...arguments),t.add(this),i.set(this,{}),r.set(this,{}),o.set(this,{}),s.set(this,{}),l.set(this,$i((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")||Ow.TEXT,s=e[r],a=new za(i,{logger:this.logger});a.value=n.getFormattedValue(o,s),u(this,t,"m",h).call(this,i,r,a),u(this,t,"m",f).call(this,i,r,a)}))})))}static getFormattedValue(e,t){return e===Ow.DATE&&t?new Date(t).toLocaleString():e===Ow.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.onWidgetRootReady)||void 0===t?void 0:t.call(this),u(this,l,"f").call(this,Z$(this.state)),this.subscribe(u(this,l,"f").bind(this),Z$)}))}},i=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,l=new WeakMap,t=new WeakSet,a=function(e){var t,n;null===(t=u(this,i,"f")[e])||void 0===t||t.setContent(I$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,r,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(this,i,"f")[e])||void 0===t||t.close(),this.actions.getMe()}))},d=function(e){var t,n;null===(t=u(this,o,"f")[e])||void 0===t||t.setContent(I$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(n=u(this,s,"f")[e])||void 0===n||n.onSuccess((()=>{var t;null===(t=u(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&&(u(this,i,"f")[s]=this.createModal({"data-id":`edit-${n}`}),u(this,r,"f")[s]=new Ma((()=>{var e,t;return null===(t=null===(e=u(this,i,"f")[s])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,i,"f")[s].afterClose=u(this,t,"m",a).bind(this,s),o.onEditClick((()=>{var e,t;null===(t=null===(e=u(this,i,"f"))||void 0===e?void 0:e[s])||void 0===t||t.open()})),u(this,t,"m",a).call(this,s),this.syncFlowTheme(u(this,r,"f")[s]))},f=function(e,n,i){const r=e.getAttribute("delete-flow-id");r&&(u(this,o,"f")[r]=this.createModal({"data-id":`delete-${n}`}),u(this,s,"f")[r]=new Ma((()=>{var e,t;return null===(t=null===(e=u(this,o,"f")[r])||void 0===e?void 0:e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),u(this,o,"f")[r].afterClose=u(this,t,"m",d).bind(this,r),i.onDeleteClick((()=>{var e,t;null===(t=null===(e=u(this,o,"f"))||void 0===e?void 0:e[r])||void 0===t||t.open()})),u(this,t,"m",d).call(this,r),this.syncFlowTheme(u(this,s,"f")[r]))},n})),Aw=Si((e=>{var t,n,i,r,o,s,a,d;return d=class extends(mi(yw,cs,fw,jo,oc,mw,Ya)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),this.updateDeviceList=$i((e=>{this.deviceList.data=e}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.deviceList=new Ja((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-trusted-devices")}),{logger:this.logger}),this.deviceList.isExists&&(yield u(this,t,"m",a).call(this),u(this,t,"m",s).call(this,X$(this.state)),u(this,t,"m",r).call(this),this.subscribe(this.updateDeviceList.bind(this),X$))}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,r=function(){this.deviceList.flowId&&(h(this,n,this.createModal({"data-id":"untrust-device"}),"f"),h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),u(this,n,"f").afterClose=()=>u(this,t,"m",o).call(this,""),this.syncFlowTheme(u(this,i,"f")))},o=function(e=""){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:this.deviceList.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:{deviceId:e}})),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.listDevices({userId:D$(this.state)})}))},s=function(e){this.deviceList.onRemoveDeviceClick((({id:e})=>{var i;u(this,t,"m",o).call(this,e),null===(i=u(this,n,"f"))||void 0===i||i.open()})),this.deviceList.data=e},a=function(){return c(this,void 0,void 0,(function*(){yield this.actions.listDevices({userId:D$(this.state)})}))},d})),Nw={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},jw=Si((e=>{var t,n,i,r,o;return o=class extends(mi(jo,fw,Qa,Lo)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$i((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const o=u(this,t,"m",i).call(this,e);o.setContent(u(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 c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(u(this,r,"f").bind(this),Q$)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Nw[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})),Mw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p;return p=class extends(mi(fw,jo,mw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,null),r.set(this,(e=>c(this,void 0,void 0,(function*(){const t=e.target.value;yield this.actions.selectTenant(t)})))),o.set(this,(e=>{const i=tw(e);this.tenantSelector.value!==i&&u(this,t,"m",l).call(this,i);const{loading:r,error:o}=e.selectTenant,a=null!==e.tenant.previousTenantId,d=i!==u(this,n,"f");!i||r||o||a||!d||(h(this,n,i,"f"),u(this,t,"m",s).call(this))}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),this.actions.setCurrentTenantId((()=>{const e=bn();return W$(e)})()),u(this,t,"m",i).call(this),u(this,t,"m",f).call(this),u(this,t,"m",d).call(this,ew(this.state)),this.subscribe(u(this,o,"f").bind(this))}))}},n=new WeakMap,r=new WeakMap,o=new WeakMap,t=new WeakSet,i=function(){this.tenantSelector=new Za((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-combo-box[name="tenantSelector"]')}),{logger:this.logger}),this.tenantSelector.onInput(u(this,r,"f"))},s=function(){const e=tw(this.state);this.dispatchEvent(new CustomEvent("tenant-changed",{bubbles:!0,composed:!0,detail:{tenantId:e}})),this.tenantSelector.shouldReload&&u(this,t,"m",a).call(this)},a=function(){setTimeout((()=>window.location.reload()),this.tenantSelector.refreshTimeout)},d=function(e){return c(this,void 0,void 0,(function*(){const t=e.map((e=>({label:e.tenantName||e.tenantId,value:e.tenantId})));yield this.tenantSelector.setData(t)}))},l=function(e){e&&(this.tenantSelector.value=e)},f=function(){this.tenantSelector.setAllowCustomValue(!0),setTimeout((()=>{u(this,t,"m",l).call(this,tw(this.state)),this.tenantSelector.setAllowCustomValue(!1)}))},p})),Pw=Si((e=>{var t,n,i,r,o,s,a,d,l,f,p;return p=class extends(mi(yw,fw,Ya,jo,mw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,void 0),r.set(this,[]),o.set(this,null)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return c(this,void 0,void 0,(function*(){var n;yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),u(this,t,"m",d).call(this),u(this,t,"m",a).call(this),u(this,r,"f").forEach((e=>e.enable()))}))}},n=new WeakMap,i=new WeakMap,r=new WeakMap,o=new WeakMap,t=new WeakSet,s=function(e){const n=new Pa(e,{logger:this.logger});n.onClick((()=>{u(this,t,"m",f).call(this,n.flowId,D$(this.state))})),u(this,r,"f").push(n)},a=function(){var e;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[data-generic-flow-button-id]");Array.from(n).forEach((e=>{u(this,t,"m",s).call(this,e)}))},d=function(){h(this,n,this.createModal({"data-id":"generic-flow-modal"}),"f"),u(this,n,"f").afterClose=()=>{var e;null===(e=u(this,o,"f"))||void 0===e||e.call(this),h(this,o,null,"f")},h(this,i,new Ma((()=>{var e;return null===(e=u(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(u(this,i,"f"))},l=function(){var e;u(this,n,"f").open(),null===(e=u(this,o,"f"))||void 0===e||e.call(this)},f=function(e,r){u(this,n,"f").setContent(I$({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,client:{userId:r}})),h(this,o,u(this,i,"f").onPageUpdated((()=>u(this,t,"m",l).call(this))),"f"),u(this,i,"f").onSuccess((()=>{u(this,n,"f").close(),this.actions.getMe()}))},p})),Uw=Si((e=>class extends(mi(Ia,cs,gw,Ew,$w,bw,Cw,Iw,kw,Sw,xw,Rw,ww,Aw,jw,Mw,Pw)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Tw=mi((e=>class extends(Uw(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(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 Sa})).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.10.0"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",Tw);var Ww=Object.freeze({__proto__:null,default:Tw});const Lw=(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))]},Dw=(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]=Lw(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};var _w,Fw,qw,Bw,Vw,Kw,Hw,zw,Gw,Jw,Zw;const Yw=document.createElement("template");Yw.innerHTML='\n<div class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n';const Xw=mi(rs)(HTMLElement);class Qw extends Xw{constructor(){super(),_w.add(this),Fw.set(this,new co({messages:[]})),qw.set(this,void 0),Bw.set(this,void 0),Vw.set(this,void 0),Kw.set(this,{resize:u(this,_w,"m",Zw).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Yw.content.cloneNode(!0)),h(this,qw,this.shadowRoot.querySelector(".debugger"),"f"),h(this,Bw,u(this,qw,"f").querySelector(".content"),"f"),h(this,Vw,u(this,qw,"f").querySelector(".header"),"f"),u(this,_w,"m",Hw).call(this)}updateData(e){u(this,Fw,"f").update((t=>({messages:t.messages.concat(e)})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return c(this,void 0,void 0,(function*(){var t;null===(t=e.init)||void 0===t||t.call(this),Dw(u(this,qw,"f"),u(this,Vw,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",u(this,Kw,"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}})(u(this,qw,"f")),u(this,qw,"f").onresize=u(this,_w,"m",Jw).bind(this),u(this,Fw,"f").subscribe(u(this,_w,"m",zw).bind(this))}))}disconnectedCallback(){u(this,Fw,"f").unsubscribeAll(),window.removeEventListener("resize",u(this,Kw,"f").resize)}}Fw=new WeakMap,qw=new WeakMap,Bw=new WeakMap,Vw=new WeakMap,Kw=new WeakMap,_w=new WeakSet,Hw=function(){this.injectStyle('\n .debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),u(this,qw,"f").style.top="32px",u(this,qw,"f").style.left=window.innerWidth-300-32+"px"},zw=function(e){u(this,_w,"m",Gw).call(this,e),u(this,_w,"m",Jw).call(this)},Gw=function(e){u(this,Bw,"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("")},Jw=function(){u(this,Bw,"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)}))},Zw=function(){const[e,t]=Lw(u(this,qw,"f"),Number.parseInt(u(this,qw,"f").style.left,10),Number.parseInt(u(this,qw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});u(this,qw,"f").style.top=`${t}px`,u(this,qw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Qw);var eC=Object.freeze({__proto__:null,default:Qw});const tC=(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 nC,iC,rC,oC,sC,aC,dC,lC,cC,uC;const hC=document.createElement("template");hC.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`;const fC=mi(rs)(HTMLElement);class pC extends fC{constructor(){var e;super(),nC.add(this),iC.set(this,new Ai({messages:[]})),rC.set(this,void 0),oC.set(this,void 0),sC.set(this,void 0),aC.set(this,{resize:u(this,nC,"m",uC).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(hC.content.cloneNode(!0)),this.injectStyle('\n.debugger {\n all: initial;\n width: 300px;\n height: 200px;\n background-color: #FAFAFA;\n position: fixed;\n font-family: "Helvetica Neue", sans-serif;\n box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 10px;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid lightgrey;\n pointer-events: initial;\n display: flex;\n flex-direction: column;\n min-width: 200px;\n max-width: 600px;\n max-height: calc(100% - 64px);\n min-height: 200px;\n resize: both;\n }\n\n .header {\n padding: 8px 16px;\n display: flex;\n align-items: center;\n background-color: #EEEEEE;\n cursor: move;\n border-bottom: 1px solid #e0e0e0;\n }\n\n .content {\n font-size: 14px;\n flex-grow: 1;\n overflow: auto;\n }\n\n .msg {\n border-bottom: 1px solid lightgrey;\n padding: 8px 16px;\n display: flex;\n gap: 5px;\n background-color: #FAFAFA;\n }\n\n .msg.collapsible {\n cursor: pointer;\n }\n\n .empty-state {\n padding: 8px 16px;\n background-color: #FAFAFA;\n }\n\n\n .msg.collapsible:not(.collapsed) {\n background-color: #F5F5F5;\n }\n\n .msg_title {\n padding-bottom: 5px;\n display: flex;\n gap: 8px;\n font-weight: 500;\n }\n\n .msg svg {\n padding: 1px;\n flex-shrink: 0;\n margin-top: -2px;\n }\n\n .msg_content {\n overflow: hidden;\n flex-grow: 1;\n margin-right:5px;\n }\n\n .msg_desc {\n color: #646464;\n cursor: initial;\n word-wrap: break-word;\n }\n\n .msg.collapsed .msg_desc {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .msg.collapsible.collapsed .chevron {\n transform: rotate(-45deg) translateX(-2px);\n }\n\n .msg.collapsible .chevron {\n content: "";\n width:6px;\n height:6px;\n border-bottom: 2px solid grey;\n border-right: 2px solid grey;\n transform: rotate(45deg) translateX(-1px);\n margin: 5px;\n flex-shrink:0;\n }\n'),h(this,rC,this.shadowRoot.querySelector(".debugger"),"f"),h(this,oC,u(this,rC,"f").querySelector(".content"),"f"),h(this,sC,u(this,rC,"f").querySelector(".header"),"f")}updateData(e){u(this,iC,"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]=tC(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})(u(this,rC,"f"),u(this,sC,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",u(this,aC,"f").resize),(e=u(this,rC,"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},u(this,rC,"f").onresize=u(this,nC,"m",cC).bind(this),u(this,iC,"f").subscribe(u(this,nC,"m",dC).bind(this))}disconnectedCallback(){u(this,iC,"f").unsubscribeAll(),window.removeEventListener("resize",u(this,aC,"f").resize)}}iC=new WeakMap,rC=new WeakMap,oC=new WeakMap,sC=new WeakMap,aC=new WeakMap,nC=new WeakSet,dC=function(e){u(this,nC,"m",lC).call(this,e),u(this,nC,"m",cC).call(this)},lC=function(e){u(this,oC,"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("")},cC=function(){u(this,oC,"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)}))},uC=function(){const[e,t]=tC(u(this,rC,"f"),Number.parseInt(u(this,rC,"f").style.left,10),Number.parseInt(u(this,rC,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});u(this,rC,"f").style.top=`${t}px`,u(this,rC,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",pC);var gC=Object.freeze({__proto__:null,default:pC});e.AccessKeyManagement=Fi,e.ApplicationsPortal=Bi,e.AuditManagement=Ki,e.AuthProvider=({projectId:e,baseUrl:r="",baseStaticUrl:a="",baseCdnUrl:d="",sessionTokenViaCookie:l=!1,refreshTokenViaCookie:c=!1,hooks:u,persistTokens:h=!0,autoRefresh:f=!0,oidcConfig:p,storeLastAuthenticatedUser:g=!0,keepLastAuthenticatedUserAfterLogout:v=!1,refreshCookieName:m="",getExternalToken:y,customStorage:b,children:$})=>{const[w,C]=t.useState(),[k,S]=t.useState(),[I,x]=t.useState(),[R,O]=t.useState(!1),[E,A]=t.useState(!1),[N,j]=t.useState(!1),[M,P]=t.useState(!!p),U=t.useRef(!1),T=(({projectId:e,baseUrl:n,persistTokens:i,autoRefresh:r,sessionTokenViaCookie:o,refreshTokenViaCookie:a,refreshCookieName:d,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,getExternalToken:h,hooks:f,customStorage:p})=>t.useMemo((()=>{if(e)return ci({projectId:e,baseUrl:n,sessionTokenViaCookie:o,refreshTokenViaCookie:a,baseHeaders:s,persistTokens:i,autoRefresh:r,refreshCookieName:d,oidcConfig:l,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,hooks:f,getExternalToken:h,customStorage:p})}),[e,n,JSON.stringify(o),JSON.stringify(a),h,p]))({projectId:e,baseUrl:r,persistTokens:h,autoRefresh:f,sessionTokenViaCookie:l,refreshTokenViaCookie:c,hooks:u,oidcConfig:p,storeLastAuthenticatedUser:g,keepLastAuthenticatedUserAfterLogout:v,refreshCookieName:m,getExternalToken:y,customStorage:b});t.useEffect((()=>{if(T){const e=T.onSessionTokenChange(S),t=T.onUserChange(C),n=T.onIsAuthenticatedChange(O),i=T.onClaimsChange(x);return()=>{e(),t(),n(),i()}}}),[T]);const W=t.useRef(!1),L=t.useRef(!1);t.useEffect((()=>{T&&p&&!U.current&&(U.current=!0,T.oidc.finishLoginIfNeed().finally((()=>{P(!1),W.current=!0})))}),[]);const D=t.useCallback((()=>{o()||W.current||(W.current=!0,j(!0),i(null==T?void 0:T.refresh)(void 0,!0).then((()=>{j(!1)})))}),[T]),_=t.useCallback((()=>{L.current||(L.current=!0,A(!0),i(T.me)().then((()=>{A(!1)})))}),[T]),F=t.useMemo((()=>({fetchUser:_,user:w,isUserLoading:E,isUserFetched:L.current,fetchSession:D,session:k,isAuthenticated:R,isSessionLoading:N,isOidcLoading:M,isSessionFetched:W.current,projectId:e,baseUrl:r,baseStaticUrl:a,baseCdnUrl:d,storeLastAuthenticatedUser:g,keepLastAuthenticatedUserAfterLogout:v,refreshCookieName:m,customStorage:b,setUser:C,setSession:S,setIsAuthenticated:O,claims:I,sdk:T})),[_,w,E,L.current,D,k,R,N,M,W.current,e,r,a,d,v,m,b,C,S,O,I,T]);return t.createElement(n.Provider,{value:F},$)},e.Descope=Ti,e.OutboundApplications=zi,e.RoleManagement=Ji,e.SignInFlow=e=>t.createElement(Ti,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>t.createElement(Ti,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>t.createElement(Ti,Object.assign({},e,{flowId:"sign-up-or-in"})),e.TenantProfile=Yi,e.UserManagement=Qi,e.UserProfile=tr,e.baseHeaders=s,e.getCurrentTenant=vi,e.getJwtPermissions=pi,e.getJwtRoles=gi,e.getRefreshToken=fi,e.getSessionToken=hi,e.isRefreshTokenExpired=(e=fi())=>null==li?void 0:li.isJwtExpired(e),e.isSessionTokenExpired=(e=hi())=>null==li?void 0:li.isJwtExpired(e),e.refresh=(e=fi())=>null==li?void 0:li.refresh(e),e.useDescope=()=>{const{sdk:e}=Wi();return t.useMemo((()=>e||new Proxy(ui(),Di)),[e])},e.useSession=()=>{const{session:e,claims:n,isSessionLoading:i,isOidcLoading:r,fetchSession:s,isSessionFetched:a,isAuthenticated:d}=Wi(),l=t.useRef(i||r);t.useMemo((()=>{l.current=i||r}),[i,r]);const c=!d&&!i&&!o();return t.useMemo((()=>{c&&!a&&(l.current=!0)}),[a]),t.useEffect((()=>{c&&s()}),[s]),{isSessionLoading:l.current,sessionToken:e,claims:n,isAuthenticated:d}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:i,isAuthenticated:r,isUserFetched:o}=Wi(),[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
3
|
//# sourceMappingURL=index.umd.js.map
|