@descope/react-sdk 2.0.39 → 2.0.41
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/README.md +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
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";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);const r=o.default.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)},s=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},a={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.0.39"},d="undefined"!=typeof window;var c=function(){return c=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)};function l(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function u(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{d(o.next(e))}catch(e){i(e)}}function a(e){try{d(o.throw(e))}catch(e){i(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((o=o.apply(e,t||[])).next())}))}function h(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function p(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!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"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function f(e){this.message=e}"function"==typeof SuppressedError&&SuppressedError,f.prototype=new Error,f.prototype.name="InvalidCharacterError";var g="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new f("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,r=0,i=0,s="";o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?s+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function m(e){this.message=e}function v(e,t){if("string"!=typeof e)throw new m("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(g(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return g(t)}}(e.split(".")[n]))}catch(e){throw new m("Invalid token specified: "+e.message)}}m.prototype=new Error,m.prototype.name="InvalidTokenError";var y="/v1/auth/accesskey/exchange",b="/v1/auth/otp/verify",$="/v1/auth/otp/signin",w="/v1/auth/otp/signup",E={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},k="/v1/auth/otp/signup-in",C="/v1/auth/magiclink/verify",x="/v1/auth/magiclink/signin",O="/v1/auth/magiclink/signup",S={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},I="/v1/auth/magiclink/signup-in",j="/v1/auth/enchantedlink/verify",R="/v1/auth/enchantedlink/signin",N="/v1/auth/enchantedlink/signup",M="/v1/auth/enchantedlink/pending-session",A={email:"/v1/auth/enchantedlink/update/email"},D="/v1/auth/enchantedlink/signup-in",T="/v1/auth/oauth/authorize",P="/v1/auth/oauth/exchange",U="v1/auth/oauth/native/start",_="v1/auth/oauth/native/finish",W="/v1/auth/saml/authorize",L="/v1/auth/saml/exchange",F="/v1/auth/totp/verify",V="/v1/auth/totp/signup",q="/v1/auth/totp/update",B="/v1/auth/notp/whatsapp/signin",z="/v1/auth/notp/whatsapp/signup",K="/v1/auth/notp/whatsapp/signup-in",H="/v1/auth/notp/pending-session",G={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},J={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},X={start:"/v1/auth/webauthn/signup-in/start"},Z={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Y="/v1/auth/password/signup",Q="/v1/auth/password/signin",ee="/v1/auth/password/reset",te="/v1/auth/password/update",ne="/v1/auth/password/replace",oe="/v1/auth/password/policy",re="/v1/auth/refresh",ie="/v1/auth/tenant/select",se="/v1/auth/logout",ae="/v1/auth/logoutall",de="/v1/auth/me",ce="/v1/auth/me/history",le="/v1/flow/start",ue="/v1/flow/next";const he="<region>",pe=`https://api.${he}descope.com`,fe=6e5,ge=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var me;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(me||(me={}));const ve=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(he,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},ye=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),be=e=>void 0===e?void 0:JSON.stringify(e),$e=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},we=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...t)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>ge().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return ge().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:c,body:l,headers:u,queryParams:h,method:p,token:f}=d,g={headers:ye($e(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.19.2"},(null==n?void 0:n.baseHeaders)||{},u),method:p,body:be(l)};null!==i&&(g.credentials=i||"include");const m=await a(ve({path:c,baseUrl:e,queryParams:h,projectId:t}),g);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==m?void 0:m.clone()),null==r?void 0:r.transformResponse){const e=await m.json(),t=((null===(s=m.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},m),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return m};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:me.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:me.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:me.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:me.delete,token:o}),hooks:r,buildUrl:(n,o)=>ve({projectId:t,baseUrl:e,path:n,queryParams:o})}};var Ee=429;function ke(e,t,n){var o;let r=Ce(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function Ce(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return v(e)}function xe(e){const{exp:t}=Ce(e);return(new Date).getTime()/1e3>t}function Oe(e){let t=Ce(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Se(e,t){return ke(e,t,"permissions")}function Ie(e,t){return ke(e,t,"roles")}const je=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Re(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===Ee&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Ne=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Me=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ae=e=>t=>e.test(t),De=Ae(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Te=Ae(/^\+[1-9]{1}[0-9]{3,14}$/),Pe=Ne(De,'"{val}" is not a valid email'),Ue=Ne(Te,'"{val}" is not a valid phone number'),_e=Ne((1,e=>e.length>=1),"Minimum length is 1");const We=Ne((e=>"string"==typeof e),"Input is not a string"),Le=Ne((e=>void 0===e),"Input is defined"),Fe=(Ve=[We(),Le()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=Ve.filter((e=>e(t)));return!(n.length<Ve.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var Ve;const qe=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Me(...e).validate(n[t]))),t(...n)),Be=e=>[We(`"${e}" must be a string`)],ze=e=>[We(`"${e}" must be a string`),_e(`"${e}" must not be empty`)],Ke=e=>[We(`"${e}" must be a string`),Pe()],He=e=>[We(`"${e}" must be a string`),Ue()],Ge=qe(ze("accessKey")),Je=e=>({exchange:Ge(((t,n)=>Re(e.post(y,{loginOptions:n},{token:t}))))}),Xe=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),Ze=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||fe,fe)});var Ye,Qe;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Ye||(Ye={})),function(e){e.email="email"}(Qe||(Qe={}));const et=Object.assign(Object.assign({},Ye),Qe);var tt;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(tt||(tt={}));const nt=ze("loginId"),ot=qe(ze("token")),rt=qe(nt),it=qe(ze("pendingRef")),st=qe(nt,Ke("email")),at=e=>({verify:ot((t=>Re(e.post(j,{token:t})))),signIn:rt(((t,n,o,r)=>Re(e.post(je(R,et.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:rt(((t,n,o)=>Re(e.post(je(D,et.email),{loginId:t,URI:n,loginOptions:o})))),signUp:rt(((t,n,o,r)=>Re(e.post(je(N,et.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:it(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Ze(n);let s;const a=setInterval((async()=>{const n=await e.post(M,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:st(((t,n,o,r,i)=>Re(e.post(A.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),dt=qe(ze("flowId")),ct=qe(ze("executionId"),ze("stepId"),ze("interactionId")),lt=e=>({start:dt(((t,n,o,r,i,s,a)=>Re(e.post(le,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:ct(((t,n,o,r,i,s)=>Re(e.post(ue,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),ut=ze("loginId"),ht=qe(ze("token")),pt=qe(ut),ft=qe(ut,He("phone")),gt=qe(ut,Ke("email")),mt=Object.keys(et).filter((e=>e!==Ye.voice)),vt=e=>({verify:ht((t=>Re(e.post(C,{token:t})))),signIn:mt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r,i)=>Re(e.post(je(x,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:mt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r,i)=>Re(e.post(je(O,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:mt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r)=>Re(e.post(je(I,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:gt(((t,n,o,r,i)=>Re(e.post(S.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Ye).filter((e=>e!==Ye.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i,s)=>Re(e.post(je(S.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var yt;!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"}(yt||(yt={}));const bt=qe(ze("code")),$t=e=>({start:Object.assign(((t,n,o,r)=>Re(e.post(T,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(yt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>Re(e.post(T,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:bt((t=>Re(e.post(P,{code:t})))),startNative:(t,n)=>Re(e.post(U,{provider:t,loginOptions:n})),finishNative:(t,n,o,r,i)=>Re(e.post(_,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),wt=ze("loginId"),Et=qe(wt,ze("code")),kt=qe(wt),Ct=qe(wt,He("phone")),xt=qe(wt,Ke("email")),Ot=e=>({verify:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o)=>Re(e.post(je(b,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o,r)=>Re(e.post(je($,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o,r)=>Re(e.post(je(w,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o)=>Re(e.post(je(k,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:xt(((t,n,o,r)=>Re(e.post(E.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Ye).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o,r,i)=>Re(e.post(je(E.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),St=qe(ze("tenant")),It=qe(ze("code")),jt=e=>({start:St(((t,n,o,r)=>Re(e.post(W,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:It((t=>Re(e.post(L,{code:t}))))}),Rt=ze("loginId"),Nt=qe(Rt,ze("code")),Mt=qe(Rt),At=qe(Rt),Dt=e=>({signUp:Mt(((t,n)=>Re(e.post(V,{loginId:t,user:n})))),verify:Nt(((t,n,o,r)=>Re(e.post(F,{loginId:t,code:n,loginOptions:o},{token:r})))),update:At(((t,n)=>Re(e.post(q,{loginId:t},{token:n}))))}),Tt=ze("loginId"),Pt=ze("newPassword"),Ut=qe(Tt,ze("password")),_t=qe(Tt),Wt=qe(Tt,Pt),Lt=qe(Tt,ze("oldPassword"),Pt),Ft=e=>({signUp:Ut(((t,n,o,r)=>Re(e.post(Y,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Ut(((t,n,o)=>Re(e.post(Q,{loginId:t,password:n,loginOptions:o})))),sendReset:_t(((t,n,o)=>Re(e.post(ee,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Wt(((t,n,o)=>Re(e.post(te,{loginId:t,newPassword:n},{token:o})))),replace:Lt(((t,n,o)=>Re(e.post(ne,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Re(e.get(oe))}),Vt=Be("loginId"),qt=ze("loginId"),Bt=ze("origin"),zt=qe(qt,Bt,ze("name")),Kt=qe(qt,Bt),Ht=qe(Vt,Bt),Gt=qe(qt,Bt,ze("token")),Jt=qe(ze("transactionId"),ze("response")),Xt=e=>({signUp:{start:zt(((t,n,o)=>Re(e.post(G.start,{user:{loginId:t,name:o},origin:n})))),finish:Jt(((t,n)=>Re(e.post(G.finish,{transactionId:t,response:n}))))},signIn:{start:Ht(((t,n,o,r)=>Re(e.post(J.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Jt(((t,n)=>Re(e.post(J.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Kt(((t,n)=>Re(e.post(X.start,{loginId:t,origin:n}))))},update:{start:Gt(((t,n,o)=>Re(e.post(Z.start,{loginId:t,origin:n},{token:o})))),finish:Jt(((t,n)=>Re(e.post(Z.finish,{transactionId:t,response:n}))))}}),Zt=Be("loginId"),Yt=qe(Zt),Qt=qe(ze("pendingRef")),en=e=>({signUpOrIn:Yt(((t,n)=>Re(e.post(K,{loginId:t,loginOptions:n})))),signUp:Yt(((t,n,o)=>Re(e.post(z,{loginId:t,user:n,loginOptions:o})))),signIn:Yt(((t,n,o)=>Re(e.post(B,{loginId:t,loginOptions:n},{token:o})))),waitForSession:Qt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Ze(n);let s;const a=setInterval((async()=>{const n=await e.post(H,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),tn=qe(ze("token")),nn=qe([Fe('"token" must be string or undefined')]);var on,rn=qe([("projectId",on=ze("projectId"),Ne(((e,t)=>n=>Me(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",on))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=we({baseUrl:n||pe,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Je(a),otp:Ot(a),magicLink:vt(a),enchantedLink:at(a),oauth:$t(a),saml:jt(a),totp:Dt(a),notp:en(a),webauthn:Xt(a),password:Ft(a),flow:lt(a),refresh:nn((e=>Re(a.post(re,{},{token:e})))),selectTenant:qe([We("tenantId")],[Fe('"token" must be string or undefined')])(((e,t)=>Re(a.post(ie,{tenant:e},{token:t})))),logout:nn((e=>Re(a.post(se,{},{token:e})))),logoutAll:nn((e=>Re(a.post(ae,{},{token:e})))),me:nn((e=>Re(a.get(de,{token:e})))),history:nn((e=>Re(a.get(ce,{token:e})))),isJwtExpired:tn(xe),getTenants:tn(Oe),getJwtPermissions:tn(Se),getJwtRoles:tn(Ie),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);(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}}))})),sn=Object.assign(rn,{DeliveryMethods:et});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function an(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dn={exports:{}};
|
|
2
|
-
/*! js-cookie v3.0.5 | MIT */!function(e,t){e.exports=function(){function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+s}}function i(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=n.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}}return Object.create({set:r,get:i,remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}return 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:"/"})}()}(dn);var cn=an(dn.exports);var ln={default:"endpoint"},un="Blocked by CSP",hn="The endpoint parameter is not a valid URL",pn="Failed to load the JS script of the agent",fn="9319";function gn(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||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),100,3e3,i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===un||s===hn)n.exclude(),i=0;else if(s===fn)n.exclude();else if(s===pn){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),i=0),n.postpone()}else n.postpone();var c=n.current();return void 0===c?void 0:[c,null!=i?i:e.getTime()+o()-Date.now()]}]),d=a[0],c=a[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var l=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=c(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return l(r)}))}))};return l(d).then((function(e){return[e,s]}))}var mn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",vn=mn;function yn(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=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:mn,a=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),d=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.9.6"):e}))}(String(e),t)}))}(s,r);return gn(e,bn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===fn?new Error(pn):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(c(c({},i),{ldi:{attempts:n,visibilityStates:d}}))}))}function bn(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,d())};i.addEventListener(s,a);var d=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return d(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(d(),r)return function(){throw new Error(un)}();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(hn);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(pn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then($n)}function $n(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(fn);return n}const wn=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},En=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},kn=async e=>{const t=await En(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Cn="undefined"!=typeof localStorage,xn=(e,t)=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),On=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Sn=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),In=(...e)=>{console.debug(...e)},jn="undefined"!=typeof window,Rn=Math.pow(2,31)-1,Nn="DS",Mn="DSR";function An(e=""){return On(`${e}${Mn}`)||""}function Dn(e=""){Sn(`${e}${Mn}`),Sn(`${e}${Nn}`),cn.remove(Nn)}const Tn=jn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Pn="fp",Un=(e=!1)=>{const t=localStorage.getItem(Pn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},_n=async(e,t=Tn)=>{try{if(Un())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=yn({apiKey:e,endpoint:[o.toString(),ln],scriptUrlPattern:[i,vn]}),a=await s,{requestId:d}=await a.get({linkedId:n}),c=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Pn,JSON.stringify(t))})(c)}catch(e){console.warn("Could not load fingerprint",e)}},Wn=e=>{const t=Un(!0);return t&&e.body&&(e.body.fpData=t),e},Ln="dls_last_user_login_id",Fn="dls_last_user_display_name",Vn=()=>On(Ln),qn=()=>On(Fn),Bn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Vn(),i=qn();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},zn=e=>async(...t)=>{const n=await e(...t);return Sn(Ln),Sn(Fn),n};function Kn(){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 Hn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),n.publicKey.user.id=Qn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:eo(n.rawId),type:n.type,response:{attestationObject:eo(n.response.attestationObject),clientDataJSON:eo(n.response.clientDataJSON)}});var n}async function Gn(e){const t=Zn(e);return Yn(await navigator.credentials.get(t))}async function Jn(e,t){const n=Zn(e);return n.signal=t.signal,n.mediation="conditional",Yn(await navigator.credentials.get(n))}async function Xn(e=!1){if(!jn)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Zn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}function Yn(e){return JSON.stringify({id:e.id,rawId:eo(e.rawId),type:e.type,response:{authenticatorData:eo(e.response.authenticatorData),clientDataJSON:eo(e.response.clientDataJSON),signature:eo(e.response.signature),userHandle:e.response.userHandle?eo(e.response.userHandle):void 0}})}function Qn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function eo(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var to,no=(to=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await Gn(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Gn(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Hn,get:Gn,isSupported:Xn,conditional:Jn}}),(...e)=>{const t=to(...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 oo="/fedcm/config",ro=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:c}=s.data,l=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")}}))}();return new Promise((t=>{var o,s;l.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:c})),l.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+oo),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>jn&&"IdentityCredential"in window});var io=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Xn(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const so=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=l(t,["fpKey","fpLoad"]);return jn?(n&&o&&_n(n).catch((()=>null)),e(wn(r,{beforeRequest:Wn}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=l(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;jn&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(In("Expiration time passed, refreshing session"),d.refresh(An()||a))}));const d=e(wn(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await En(t);if(401===(null==t?void 0:t.status))In("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=v(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void In("Could not extract expiration time from session token");a=n;let e=((c=s)?c.getTime()-(new Date).getTime():0)-2e4;e>Rn&&(In(`Timeout is too large (${e}ms), setting it to ${Rn}ms`),e=Rn),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});In(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{In("Refreshing session due to timer"),d.refresh(An()||n)}),e)}var c}}));return Xe(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return In("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.12.2"},t.baseHeaders)}))),(e=>t=>{const n=Kn(),o=Kn(),r=e(wn(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await kn(t);e&&o.pub(e);const{sessionJwt:r}=await En(t);r&&n.pub(r)}}})),i=Xe(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0}=t,o=l(t,["storeLastAuthenticatedUser"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:Vn,getLastUserDisplayName:qn});const r=e(wn(o,{afterRequest:async(e,t)=>{var n;const o=await kn(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{xn(Ln,e)})(r),(e=>{xn(Fn,e)})(i))}}));let i=Xe(r,["flow.start"],Bn);return i=Xe(i,["logout","logoutAll"],zn),Object.assign(i,{getLastUserLoginId:Vn,getLastUserDisplayName:qn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=l(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!jn)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e(wn(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||An(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Dn(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=l(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&xn(`${n}${Mn}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);cn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(Nn,r,i):xn(`${n}${Nn}`,r))})(await En(t),o,r)}}));var a;const d=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Dn(e),o})(r));return Object.assign(d,{getRefreshToken:()=>An(r),getSessionToken:()=>function(e=""){return cn.get(Nn)||On(`${e}${Nn}`)||""}(r)})}))(((...e)=>{const t=sn(...e);return Object.assign(Object.assign({},t),{flow:io(t),webauthn:no(t),fedcm:ro(t,e[0].projectId)})}));let ao;const co=e=>{const t=so(Object.assign({persistTokens:d,autoRefresh:d},e));return ao=t,t},lo=()=>co({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});ao=lo();const uo=()=>d?null==ao?void 0:ao.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),ho=()=>d?null==ao?void 0:ao.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),po=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtPermissions(e,t))),fo=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtRoles(e,t)));const go=t.lazy((async()=>((await Promise.resolve().then((function(){return Mi}))).default.sdkConfigOverrides={baseHeaders:a,persistTokens:!1,hooks:{get beforeRequest(){return ao.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,baseStaticUrl:r,innerRef:i,tenant:s,theme:a,locale:d,debug:c,redirectUrl:l,client:u,form:h,autoFocus:p,validateOnBlur:f})=>o.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,"base-static-url":r,ref:i,tenant:s,theme:a,locale:d,debug:c,client:u,form:h,"redirect-url":l,"auto-focus":p,"validate-on-blur":f})}))),mo=o.default.forwardRef((({flowId:e,onSuccess:n,onError:i,onReady:s,logger:a,tenant:d,theme:c,locale:l,debug:u,client:h,form:p,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,errorTransformer:y},b)=>{const[$,w]=t.useState(null);t.useImperativeHandle(b,(()=>$));const{projectId:E,baseUrl:k,baseStaticUrl:C,storeLastAuthenticatedUser:x,sdk:O}=o.default.useContext(r),S=t.useCallback((async e=>{await O.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=$;return null==e||e.addEventListener("success",S),i&&(null==e||e.addEventListener("error",i)),s&&(null==e||e.addEventListener("ready",s)),()=>{i&&(null==e||e.removeEventListener("error",i)),s&&(null==e||e.removeEventListener("ready",s)),null==e||e.removeEventListener("success",S)}}),[$,i,S]),t.useEffect((()=>{const e=$;return null==e||e.addEventListener("success",S),()=>{null==e||e.removeEventListener("success",S)}}),[$,S]),t.useEffect((()=>{const e=$;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[$,i]),t.useEffect((()=>{const e=$;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[$,s]),t.useEffect((()=>{$&&($.errorTransformer=y)}),[$,y]),t.useEffect((()=>{$&&a&&($.logger=a)}),[$,a]);const{form:I,client:j}=t.useMemo((()=>({form:JSON.stringify(p||{}),client:JSON.stringify(h||{})})),[p,h]);return o.default.createElement("form",null,o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(go,{projectId:E,flowId:e,baseUrl:k,baseStaticUrl:C,innerRef:w,tenant:d,theme:c,locale:l,debug:u,form:I,client:j,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,storeLastAuthenticatedUser:x})))})),vo=t.lazy((async()=>(await Promise.resolve().then((function(){return Bh})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),yo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[c,l]=t.useState(null);t.useImperativeHandle(d,(()=>c));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(vo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:l,tenant:n,theme:i,debug:s}))})),bo=t.lazy((async()=>(await Promise.resolve().then((function(){return wg})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),$o=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[c,l]=t.useState(null);t.useImperativeHandle(d,(()=>c));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(bo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:l,tenant:n,theme:i,debug:s}))})),wo=t.lazy((async()=>(await Promise.resolve().then((function(){return ry})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Eo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[c,l]=t.useState(null);t.useImperativeHandle(d,(()=>c));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(wo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:l,tenant:n,theme:i,debug:s}))})),ko=t.lazy((async()=>(await Promise.resolve().then((function(){return Yb})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Co=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[c,l]=t.useState(null);t.useImperativeHandle(d,(()=>c));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(ko,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:l,tenant:n,theme:i,debug:s}))})),xo=t.lazy((async()=>(await Promise.resolve().then((function(){return hE})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":i,"base-url":t,"base-static-url":n,theme:s,debug:a,ref:r})}))),Oo=o.default.forwardRef((({logger:e,theme:n,debug:i,widgetId:s,onLogout:a},d)=>{const[c,l]=t.useState(null);t.useImperativeHandle(d,(()=>c));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),t.useEffect((()=>{if(c&&a)return c.addEventListener("logout",a),()=>c.removeEventListener("logout",a)}),[c,a]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(xo,{projectId:u,widgetId:s,baseUrl:h,baseStaticUrl:p,innerRef:l,theme:n,debug:i}))}));var So=()=>{const e=t.useContext(r);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const Io=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,jo={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],jo);if("function"==typeof e[t])return()=>{throw Error(Io("function"))};throw Error(Io("attribute"))}},Ro="undefined"!=typeof localStorage,No=Ro&&localStorage.getItem("base.content.url")||"",Mo="config.json",Ao="base.ui.components.url",Do=Ro&&localStorage.getItem(Ao)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",To=Ro&&localStorage.getItem(Ao)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Po="descope-login-flow",Uo="code",_o="ra-challenge",Wo="ra-callback",Lo="ra-backup-callback",Fo="ra-initiator",Vo="data-exclude-field",qo="dls_last_auth",Bo="state_id",zo="saml_idp_state_id",Ko="saml_idp_username",Ho="descope_idp_initiated",Go="sso_app_id",Jo="oidc_login_hint",Xo="data-type",Zo="poll",Yo="webauthnCreate",Qo="submit",er="polling",tr=["descope-multi-select-combo-box","descope-text-area"];var nr;function or(e){return new URLSearchParams(window.location.search).get(e)}function rr(e){if(window.history.replaceState&&or(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 ir(e,t){return u(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||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function sr({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(No||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function ar(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?nr.forward:n<o?nr.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(nr||(nr={}));const dr=()=>{const[e="",t=""]=(or(Po)||"").split("_");return{executionId:e,stepId:t}};function cr(){rr(Po)}const lr=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),ur=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},hr=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,pr=e=>null==e?void 0:e.submit(),fr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},gr=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function mr(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var vr,yr,br,$r;function wr(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!wr(i,s))return!1}else if(i!==s)return!1}return!0}class Er{constructor(e={},{updateOnlyOnChange:t=!0}={}){vr.set(this,void 0),yr.set(this,{}),br.set(this,0),$r.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,vr,"f")):e,n=Object.assign(Object.assign({},h(this,vr,"f")),t);if(!h(this,$r,"f")||!wr(h(this,vr,"f"),n)){const e=h(this,vr,"f");p(this,vr,n,"f"),Object.freeze(h(this,vr,"f")),setTimeout((()=>{Object.values(h(this,yr,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,vr,e,"f"),p(this,$r,t,"f")}get current(){return Object.assign({},h(this,vr,"f"))}subscribe(e){return p(this,br,h(this,br,"f")+1,"f"),h(this,yr,"f")[h(this,br,"f")]=e,h(this,br,"f").toString()}unsubscribe(e){const t=!!h(this,yr,"f")[e];return t&&delete h(this,yr,"f")[e],t}unsubscribeAll(){return p(this,yr,{},"f"),!0}}vr=new WeakMap,yr=new WeakMap,br=new WeakMap,$r=new WeakMap;const kr=["disabled"],Cr=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Vo}])`)).forEach((e=>{e.value=n}))}))},xr=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),Or=(e,t,n)=>{e.querySelectorAll(`[${Xo}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Sr=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},Ir=ur((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=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(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),jr={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function Rr(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(qo)))}catch(e){}return t}const Nr="dls_ab_testing_id",Mr=document.createElement("template");var Ar,Dr,Tr,Pr,Ur,_r,Wr,Lr,Fr,Vr,qr,Br,zr,Kr,Hr,Gr,Jr,Xr,Zr,Yr,Qr,ei,ti,ni,oi,ri,ii,si,ai,di,ci,li,ui,hi,pi,fi,gi,mi,vi,yi,bi,$i,wi,Ei,ki,Ci,xi,Oi,Si,Ii,ji;Mr.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class Ri extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","validate-on-blur"]}constructor(e){super(),Ar.add(this),this.logger=console,Dr.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,Ar,"m",ai).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)}},Tr.set(this,new Er({deferredRedirect:!1})),Pr.set(this,new Er),Ur.set(this,{}),this.getComponentsContext=()=>h(this,Ur,"f"),this.nextRequestStatus=new Er({isLoading:!1}),_r.set(this,void 0),Wr.set(this,{popstate:h(this,Ar,"m",zr).bind(this),visibilitychange:h(this,Ar,"m",Kr).bind(this),componentsContext:h(this,Ar,"m",oi).bind(this)}),Lr.set(this,void 0),Zr.set(this,ur((()=>u(this,void 0,void 0,(function*(){const e=sr({projectId:this.projectId,filename:Mo,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield ir(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Qr.set(this,void 0),p(this,Lr,e,"f"),h(this,Ar,"m",Fr).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){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 theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?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":n||"light"}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 storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield h(this,Zr,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,Zr,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(h(this,Pr,"f").subscribe(h(this,Ar,"m",si).bind(this)),h(this,Pr,"f").update({isDebug:this.debug}),h(this,Ar,"m",Vr).call(this))return void h(this,Ar,"m",qr).call(this);if(h(this,Ar,"m",Br).call(this),p(this,Qr,h(this,Ar,"m",Yr).call(this),"f"),yield h(this,Ar,"m",Jr).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");if((yield h(this,Zr,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,Ar,"m",ei).call(this),yield h(this,Ar,"m",li).call(this),yield h(this,Ar,"m",ti).call(this),h(this,Ar,"m",di).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:c,samlIdpStateId:l,samlIdpUsername:u,descopeIdpInitiated:f,ssoAppId:g,oidcLoginHint:m}=(()=>{const{executionId:e,stepId:t}=dr();(e||t)&&cr();const n=or("t")||void 0;n&&rr("t");const o=or(Uo)||void 0;o&&rr(Uo);const r=or("err")||void 0;r&&rr("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:or(_o),redirectAuthCallbackUrl:or(Wo),redirectAuthBackupCallbackUri:or(Lo),redirectAuthInitiator:or(Fo)};(i||s||a||d)&&(rr(_o),rr(Wo),rr(Lo),rr(Fo));const c=or(Bo);c&&rr(Bo);const l=or(zo);l&&rr(zo);const u=or(Ko);l&&rr(Ko);const h=or(Ho);h&&rr(Ho);const p=or(Go);p&&rr(Go);const f=or(Jo);return f&&rr(Jo),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:c,samlIdpStateId:l,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}})();window.addEventListener("popstate",h(this,Wr,"f").popstate),window.addEventListener("components-context",h(this,Wr,"f").componentsContext),window.addEventListener("visibilitychange",h(this,Wr,"f").visibilitychange),h(this,Tr,"f").subscribe(h(this,Ar,"m",Gr).bind(this)),h(this,Tr,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:c,samlIdpStateId:l,samlIdpUsername:u,descopeIdpInitiated:f,ssoAppId:g,oidcLoginHint:m}),p(this,Dr,!0,"f")}}))}disconnectedCallback(){h(this,Tr,"f").unsubscribeAll(),h(this,Pr,"f").unsubscribeAll(),h(this,Ar,"m",ii).call(this),window.removeEventListener("popstate",h(this,Wr,"f").popstate),window.removeEventListener("visibilitychange",h(this,Wr,"f").visibilitychange),window.removeEventListener("components-context",h(this,Wr,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,Dr,"f")&&t!==n&&Ri.observedAttributes.includes(e)){h(this,Ar,"m",Br).call(this);const o=null===t;h(this,Tr,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,cr()),{[lr(e)]:n,stepId:i,executionId:s}})),h(this,Pr,"f").update({isDebug:this.debug})}}}Dr=new WeakMap,Tr=new WeakMap,Pr=new WeakMap,Ur=new WeakMap,_r=new WeakMap,Wr=new WeakMap,Lr=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,Ar=new WeakSet,Fr=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(Mr.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},Vr=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},qr=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)},Br=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client","validate-on-blur"];if(Ri.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[lr(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},zr=function(){const{stepId:e,executionId:t}=dr();h(this,Tr,"f").update({stepId:e,executionId:t})},Kr=function(){document.hidden||setTimeout((()=>{h(this,Tr,"f").update({deferredRedirect:!1})}),300)},Hr=function(e,t){this.sdk=so(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},Ri.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},Gr=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;h(this,Ar,"m",Hr).call(this,t,o)}h(this,Lr,"f").call(this,e)}))},Jr=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,Zr,"f").call(this)).isMissingConfig&&(yield h(this,Ar,"m",Xr).call(this))}))},Xr=function(){return u(this,void 0,void 0,(function*(){const e=sr({projectId:this.projectId,filename:Mo,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield ir(e,"json"),!0}catch(e){return!1}}))},Yr=function(){return u(this,void 0,void 0,(function*(){const e=sr({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield ir(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},ei=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,Zr,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},ti=function(){return u(this,void 0,void 0,(function*(){yield h(this,Ar,"m",ni).call(this),yield h(this,Ar,"m",ri).call(this)}))},ni=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield h(this,Qr,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield Ri.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},oi=function(e){p(this,Ur,Object.assign(Object.assign({},h(this,Ur,"f")),e.detail),"f")},ri=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Ri.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},ii=function(){var e;null===(e=h(this,_r,"f"))||void 0===e||e.remove(),p(this,_r,null,"f")},si=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,_r,document.createElement("descope-debugger"),"f"),Object.assign(h(this,_r,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return OE})),document.body.appendChild(h(this,_r,"f"))):h(this,Ar,"m",ii).call(this)}))},ai=function(e,t){var n;e&&this.debug&&(null===(n=h(this,_r,"f"))||void 0===n||n.updateData({title:e,description:t}))},di=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=tr.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)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()}}},ci=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,Zr,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},li=function(){return u(this,void 0,void 0,(function*(){Ri.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Ri.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield h(this,Ar,"m",ci).call(this),i=t(n(Do,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(To,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},Ri.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.16.0"}};class Ni extends Ri{static set sdkConfigOverrides(e){Ri.sdkConfigOverrides=e}constructor(){const e=new Er;super(e.update.bind(e)),ui.add(this),this.stepState=new Er({},{updateOnlyOnChange:!1}),hi.set(this,void 0),pi.set(this,null),fi.set(this,((e,t,n,o,r)=>{n===Zo&&p(this,hi,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,er,o,r,{});h(this,mi,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,fi,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),gi.set(this,(()=>{clearTimeout(h(this,hi,"f")),p(this,hi,null,"f")})),mi.set(this,(e=>{var t,n,o,r,i,s,a,d,c;if(!(null==e?void 0:e.ok)){h(this,ui,"m",ji).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}const l=null===(d=null===(a=null===(s=e.data)||void 0===s?void 0:s.screen)||void 0===a?void 0:a.state)||void 0===d?void 0:d.errorText;(null===(c=e.data)||void 0===c?void 0:c.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${l?`${l} - `:""}${e.data.error.message}`):l&&this.loggerWrapper.error(l);const{status:u,authInfo:p,lastAuth:f}=e.data;if("completed"===u)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&Ro&&localStorage.setItem(qo,JSON.stringify(e))}(f),void h(this,ui,"m",ji).call(this,"success",p);const{executionId:g,stepId:m,stepName:v,action:y,screen:b,redirect:$,openInNewTabUrl:w,webauthn:E,error:k,samlIdpResponse:C}=e.data;y!==Zo?(this.loggerWrapper.info(`Step "${v||`#${m}`}" is ${u}`,"",{screen:b,status:u,stepId:m,stepName:v,action:y,error:k}),this.flowState.update({stepId:m,executionId:g,action:y,redirectTo:null==$?void 0:$.url,openInNewTabUrl:w,screenId:null==b?void 0:b.id,screenState:null==b?void 0:b.state,webauthnTransactionId:null==E?void 0:E.transactionId,webauthnOptions:null==E?void 0:E.options,samlIdpResponseUrl:null==C?void 0:C.url,samlIdpResponseSamlResponse:null==C?void 0:C.samlResponse,samlIdpResponseRelayState:null==C?void 0:C.relayState})):this.flowState.update({action:y})})),vi.set(this,ur((()=>u(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)}}))))),xi.set(this,gr(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,ui,"m",wi).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,ui,"m",ki).call(this,e);const r=yield h(this,ui,"m",Ei).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),c=yield this.getProjectConfig(),l=yield t(o,d.version,c.componentsVersion,a);h(this,mi,"f").call(this,l),h(this,ui,"m",Ci).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=h(this,pi,"f"))||void 0===e||e.abort(),p(this,pi,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=mr(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield ir(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 ir(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:c,action:l,screenId:u,screenState:f,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:y,code:b,exchangeError:$,webauthnTransactionId:w,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:O,oidcIdpStateId:S,locale:I,samlIdpStateId:j,samlIdpUsername:R,descopeIdpInitiated:N,samlIdpResponseUrl:M,samlIdpResponseSamlResponse:A,samlIdpResponseRelayState:D,ssoAppId:T,oidcLoginHint:P}=e;let U,_;const W=(()=>{const e=localStorage.getItem(Nr);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Nr,e.toString()),e}return Number(e)})(),L=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!c&&(F.fingerprintEnabled&&F.fingerprintKey?yield _n(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Pn),F.conditions?({startScreenId:U,conditionInteractionId:_}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=jr[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:L,code:b,token:y,abTestingKey:W},F.conditions)):F.condition?({startScreenId:U,conditionInteractionId:_}=((e,t)=>{var n;const o=null===(n=jr[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:L,code:b,token:y,abTestingKey:W})):U=F.startScreenId,!hr(U,S,j,R,T,P))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:S,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:P,client:this.client},v&&{redirectUrl:v}),{lastAuth:Rr(L),abTestingKey:W,locale:mr(I)}),_,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),b?{exchangeCode:b,idpInitiated:!0}:{}),N&&{idpInitiated:!0}),y?{token:y}:{}),P?{externalId:P}:{}));return h(this,mi,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(c&&(n("token")&&y||n("code")&&b||n("exchangeError")&&$)){const e=yield this.sdk.flow.next(c,d,Qo,F.version,V.componentsVersion,{token:y,exchangeCode:b,exchangeError:$});return h(this,mi,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===l&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!M||!A)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{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),o(r)})(M,A,D||"",pr)}if("redirect"===l&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===O&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(l===Yo||"webauthnGet"===l){if(!w||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=h(this,pi,"f"))||void 0===r||r.abort(),p(this,pi,null,"f");try{e=l===Yo?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(c,d,Qo,F.version,V.componentsVersion,{transactionId:w,response:e,failure:t});h(this,mi,"f").call(this,n)}if(h(this,fi,"f").call(this,c,d,l,F.version,V.componentsVersion),!u&&!U)return void this.loggerWrapper.warn("No screen was found to show");const B=U||u,z=yield this.getHtmlFilenameWithLocale(I,B),K={direction:ar(d,t.stepId),screenState:Object.assign(Object.assign({},f),{form:Object.assign(Object.assign({},this.formConfigValues),null==f?void 0:f.form),lastAuth:{loginId:L,name:this.sdk.getLastUserDisplayName()||L}}),htmlUrl:sr({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&sr({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:R,oidcLoginHint:P,openInNewTabUrl:m},H=Rr(L);hr(U,S,j,R,T,P)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:S,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:P,lastAuth:H,preview:this.preview,abTestingKey:W,client:this.client},v&&{redirectUrl:v}),{locale:mr(I)}),_,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),b&&{exchangeCode:b,idpInitiated:!0}),N&&{idpInitiated:!0}),y&&{token:y})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(c,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield Ri.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:c}=e,l=document.createElement("template");l.innerHTML=yield this.getPageContent(r,i);const p=l.content.cloneNode(!0),f=this.loadDescopeUiComponents(l.content);this.sdk.webauthn.helpers.isSupported()?yield h(this,ui,"m",$i).call(this,p,a):p.querySelectorAll(`descope-button[${Xo}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Xo}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),Or(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),Or(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=xr(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",xr(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=xr(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])=>{kr.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(p,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(p,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,Sr(r,"descope-totp-image",i),((e,t)=>{Sr(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(p),setTimeout((()=>{((e,t)=>{Cr(e,null==t?void 0:t.inputs),Cr(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-password"),t=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t].forEach((e=>h(this,ui,"m",bi).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),h(this,ui,"m",Si).call(this,a),s&&h(this,ui,"m",ji).call(this,"ready",{}),h(this,ui,"m",ji).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Xo}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(er,e.version,t.componentsVersion,{});h(this,mi,"f").call(this,n)}c&&!t.openInNewTabUrl&&window.open(c,"_blank")}));s?h(this,ui,"m",Ii).call(this,m,s):m()}))}}hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,gi=new WeakMap,mi=new WeakMap,vi=new WeakMap,xi=new WeakMap,ui=new WeakSet,yi=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)}))}},bi=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},$i=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,pi,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield Ir())){const{options:e,transactionId:n}=(yield h(this,vi,"f").call(this))||{};if(e&&n){h(this,ui,"m",yi).call(this,o),p(this,pi,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,pi,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});h(this,mi,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},wi=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).every((e=>{var t,n;return"slot"===e.localName||(null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e))}))},Ei=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Vo}])`));return(yield Promise.all(e.map((e=>u(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})),{})}))},ki=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Ci=function(e={}){var t,n;const o=fr(e,["externalId","email","phone"]),r=fr(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,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)}},Oi=function(e){this.rootElement.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))&&h(this,xi,"f").call(this,t,e)}))}))},Si=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,xi,"f").call(this,t,e)}})),h(this,ui,"m",Oi).call(this,e)},Ii=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===nr.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},ji=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",Ni);var Mi=Object.freeze({__proto__:null,default:Ni});function Ai(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Di=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Ti=(...e)=>e.join("/").replace(/\/+/g,"/"),Pi=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Ui=e=>{let t,n;return(...o)=>(t&&Pi(t,o)||(t=o,n=e(...o)),n)},_i=e=>(t,...n)=>t.reduce(((t,o,r)=>{var i;return`${t}${o}${(null===(i=null==n?void 0:n[r])||void 0===i?void 0:i[e>1?1:0])||""}`}),""),Wi=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},Li=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 o=e(n);return o[t]=!0,o}};var Fi,Vi,qi,Bi,zi,Ki;function Hi(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!Hi(i,s))return!1}else if(i!==s)return!1}return!0}class Gi{constructor(e={},{updateOnlyOnChange:t=!0}={}){Fi.set(this,void 0),Vi.set(this,{}),qi.set(this,0),Bi.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,Fi,"f")):e,n=Object.assign(Object.assign({},h(this,Fi,"f")),t);if(!h(this,Bi,"f")||!Hi(h(this,Fi,"f"),n)){const e=h(this,Fi,"f");p(this,Fi,n,"f"),Object.freeze(h(this,Fi,"f")),setTimeout((()=>{Object.values(h(this,Vi,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,Fi,e,"f"),p(this,Bi,t,"f")}get current(){return Object.assign({},h(this,Fi,"f"))}subscribe(e){return p(this,qi,h(this,qi,"f")+1,"f"),h(this,Vi,"f")[h(this,qi,"f")]=e,h(this,qi,"f").toString()}unsubscribe(e){const t=!!h(this,Vi,"f")[e];return t&&delete h(this,Vi,"f")[e],t}unsubscribeAll(){return p(this,Vi,{},"f"),!0}}Fi=new WeakMap,Vi=new WeakMap,qi=new WeakMap,Bi=new WeakMap;class Ji{constructor(e,t){zi.set(this,void 0),this.nodeName="",p(this,zi,e,"f"),this.logger=t.logger}get asyncEle(){return(async(e,t)=>new Promise((t=>{const n=setInterval((()=>{const o="function"==typeof e?e():e;o&&(clearInterval(n),t(o))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(h(this,zi,"f"))}get ele(){var e,t;const n="function"==typeof h(this,zi,"f")?h(this,zi,"f").call(this):h(this,zi,"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("no element for driver ",this.constructor.name,new Error),null)}}zi=new WeakMap;const Xi=/^descope-grid-([^-]+)-column$/,Zi={text:class extends Ji{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 Ji{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)}}}};class Yi extends Ji{constructor(){super(...arguments),this.nodeName="descope-grid",Ki.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 o=null===(n=Xi.exec(t.localName))||void 0===n?void 0:n[1],r=Zi[o];return r?(e.push(new r(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const o=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);Pi(o,this.ele.columns)||(this.ele.columns=o,null===(n=h(this,Ki,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){p(this,Ki,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}Ki=new WeakMap;class Qi extends Ji{constructor(){super(...arguments),this.nodeName="descope-button"}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}}var es;class ts extends Ji{constructor(){super(...arguments),es.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=""),h(this,es,"f")&&(null===(e=this.ele)||void 0===e||e.append(h(this,es,"f").content.cloneNode(!0)))}setContent(e){p(this,es,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}es=new WeakMap;class ns extends Ji{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()))}}class os extends Ji{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()))}}class rs extends Ji{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()}}class is extends Ji{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)}}class ss extends Ji{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")}}class as extends Ji{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)}}}class ds extends Ji{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)}}}class cs extends Ji{constructor(){super(...arguments),this.nodeName="descope-user-auth-method"}set fulfilled(e){var t,n;e?null===(t=this.ele)||void 0===t||t.setAttribute("fulfilled","true"):null===(n=this.ele)||void 0===n||n.removeAttribute("fulfilled")}onButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}}class ls extends Ji{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)}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)}}}function us(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var hs=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ps=()=>Math.random().toString(36).substring(7).split("").join("."),fs={INIT:`@@redux/INIT${ps()}`,REPLACE:`@@redux/REPLACE${ps()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ps()}`};function gs(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 ms(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 vs(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=ms(e)),t}function ys(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?us(2):`Expected the root reducer to be a function. Instead, received: '${vs(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?us(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?us(1):`Expected the enhancer to be a function. Instead, received: '${vs(n)}'`);return n(ys)(e,t)}let o=e,r=t,i=new Map,s=i,a=0,d=!1;function c(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function l(){if(d)throw new Error("production"===process.env.NODE_ENV?us(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?us(4):`Expected the listener to be a function. Instead, received: '${vs(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?us(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;c();const n=a++;return s.set(n,e),function(){if(t){if(d)throw new Error("production"===process.env.NODE_ENV?us(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,c(),s.delete(n),i=null}}}function h(e){if(!gs(e))throw new Error("production"===process.env.NODE_ENV?us(7):`Actions must be plain objects. Instead, the actual type was: '${vs(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?us(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?us(17):`Action "type" property must be a string. Instead, the actual type was: '${vs(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?us(9):"Reducers may not dispatch actions.");try{d=!0,r=o(r,e)}finally{d=!1}return(i=s).forEach((e=>{e()})),e}function p(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?us(10):`Expected the nextReducer to be a function. Instead, received: '${vs(e)}`);o=e,h({type:fs.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?us(11):`Expected the observer to be an object. Instead, received: '${vs(t)}'`);function n(){const e=t;e.next&&e.next(l())}n();return{unsubscribe:e(n)}},[hs](){return this}}}h({type:fs.INIT});const g={dispatch:h,subscribe:u,getState:l,replaceReducer:p,[hs]:f};return g}function bs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function $s(e){const t=Object.keys(e),n={};for(let o=0;o<t.length;o++){const r=t[o];"production"!==process.env.NODE_ENV&&void 0===e[r]&&bs(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const o=Object.keys(n);let r,i;"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:fs.INIT}))throw new Error("production"===process.env.NODE_ENV?us(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:fs.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?us(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${fs.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){i=e}return function(e={},t){if(i)throw i;if("production"!==process.env.NODE_ENV){const o=function(e,t,n,o){const r=Object.keys(t),i=n&&n.type===fs.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(!gs(e))return`The ${i} has unexpected type of "${vs(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!o[e]));return s.forEach((e=>{o[e]=!0})),n&&n.type===fs.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);o&&bs(o)}let s=!1;const a={};for(let r=0;r<o.length;r++){const i=o[r],d=n[i],c=e[i],l=d(c,t);if(void 0===l){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?us(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${i}" 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[i]=l,s=s||l!==c}return s=s||o.length!==Object.keys(e).length,s?a:e}}function ws(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function Es(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?us(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)=>i(e,...t)},a=e.map((e=>e(s)));return i=ws(...a)(r.dispatch),{...r,dispatch:i}}}function ks(e){return gs(e)&&"type"in e&&"string"==typeof e.type}var Cs=Symbol.for("immer-nothing"),xs=Symbol.for("immer-draftable"),Os=Symbol.for("immer-state"),Ss="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 Is(e,...t){if("production"!==process.env.NODE_ENV){const n=Ss[e],o="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var js=Object.getPrototypeOf;function Rs(e){return!!e&&!!e[Os]}function Ns(e){return!!e&&(As(e)||Array.isArray(e)||!!e[xs]||!!e.constructor?.[xs]||_s(e)||Ws(e))}var Ms=Object.prototype.constructor.toString();function As(e){if(!e||"object"!=typeof e)return!1;const t=js(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)===Ms}function Ds(e,t){0===Ts(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function Ts(e){const t=e[Os];return t?t.type_:Array.isArray(e)?1:_s(e)?2:Ws(e)?3:0}function Ps(e,t){return 2===Ts(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Us(e,t,n){const o=Ts(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function _s(e){return e instanceof Map}function Ws(e){return e instanceof Set}function Ls(e){return e.copy_||e.base_}function Fs(e,t){if(_s(e))return new Map(e);if(Ws(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&As(e)){if(!js(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Os];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(js(e),n)}function Vs(e,t=!1){return Bs(e)||Rs(e)||!Ns(e)||(Ts(e)>1&&(e.set=e.add=e.clear=e.delete=qs),Object.freeze(e),t&&Ds(e,((e,t)=>Vs(t,!0)))),e}function qs(){Is(2)}function Bs(e){return Object.isFrozen(e)}var zs,Ks={};function Hs(e){const t=Ks[e];return t||Is(0,e),t}function Gs(){return zs}function Js(e,t){t&&(Hs("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xs(e){Zs(e),e.drafts_.forEach(Qs),e.drafts_=null}function Zs(e){e===zs&&(zs=e.parent_)}function Ys(e){return zs={drafts_:[],parent_:zs,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Qs(e){const t=e[Os];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ea(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Os].modified_&&(Xs(t),Is(4)),Ns(e)&&(e=ta(t,e),t.parent_||oa(t,e)),t.patches_&&Hs("Patches").generateReplacementPatches_(n[Os].base_,e,t.patches_,t.inversePatches_)):e=ta(t,n,[]),Xs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Cs?e:void 0}function ta(e,t,n){if(Bs(t))return t;const o=t[Os];if(!o)return Ds(t,((r,i)=>na(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return oa(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),Ds(r,((r,s)=>na(e,o,t,r,s,n,i))),oa(e,t,!1),n&&e.patches_&&Hs("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function na(e,t,n,o,r,i,s){if("production"!==process.env.NODE_ENV&&r===n&&Is(5),Rs(r)){const s=ta(e,r,i&&t&&3!==t.type_&&!Ps(t.assigned_,o)?i.concat(o):void 0);if(Us(n,o,s),!Rs(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(Ns(r)&&!Bs(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ta(e,r),t&&t.scope_.parent_||oa(e,r)}}function oa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vs(t,n)}var ra={get(e,t){if(t===Os)return e;const n=Ls(e);if(!Ps(n,t))return function(e,t,n){const o=aa(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!Ns(o)?o:o===sa(e.base_,t)?(ca(e),e.copy_[t]=la(o,e)):o},has:(e,t)=>t in Ls(e),ownKeys:e=>Reflect.ownKeys(Ls(e)),set(e,t,n){const o=aa(Ls(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=sa(Ls(e),t),r=o?.[Os];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,o)&&(void 0!==n||Ps(e.base_,t)))return!0;ca(e),da(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!==sa(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ca(e),da(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ls(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){Is(11)},getPrototypeOf:e=>js(e.base_),setPrototypeOf(){Is(12)}},ia={};function sa(e,t){const n=e[Os];return(n?Ls(n):e)[t]}function aa(e,t){if(!(t in e))return;let n=js(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=js(n)}}function da(e){e.modified_||(e.modified_=!0,e.parent_&&da(e.parent_))}function ca(e){e.copy_||(e.copy_=Fs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ds(ra,((e,t)=>{ia[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ia.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Is(13),ia.set.call(this,e,t,void 0)},ia.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Is(14),ra.set.call(this,e[0],t,n,e[0])};function la(e,t){const n=_s(e)?Hs("MapSet").proxyMap_(e,t):Ws(e)?Hs("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Gs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=ra;n&&(r=[o],i=ia);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:Gs()).drafts_.push(n),n}function ua(e){return Rs(e)||Is(10,e),ha(e)}function ha(e){if(!Ns(e)||Bs(e))return e;const t=e[Os];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fs(e,!0);return Ds(n,((e,t)=>{Us(n,e,ha(t))})),t&&(t.finalized_=!1),n}var pa=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 o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&Is(6),void 0!==n&&"function"!=typeof n&&Is(7),Ns(e)){const r=Ys(this),i=la(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Xs(r):Zs(r)}return Js(r,n),ea(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===Cs&&(o=void 0),this.autoFreeze_&&Vs(o,!0),n){const t=[],r=[];Hs("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}Is(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;const r=this.produce(e,t,((e,t)=>{n=e,o=t}));return[r,n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Ns(e)||Is(8),Rs(e)&&(e=ua(e));const t=Ys(this),n=la(e,void 0);return n[Os].isManual_=!0,Zs(t),n}finishDraft(e,t){const n=e&&e[Os];n&&n.isManual_||Is(9);const{scope_:o}=n;return Js(o,t),ea(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=Hs("Patches").applyPatches_;return Rs(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},fa=pa.produce;pa.produceWithPatches.bind(pa),pa.setAutoFreeze.bind(pa),pa.setUseStrictShallowCopy.bind(pa),pa.applyPatches.bind(pa),pa.createDraft.bind(pa),pa.finishDraft.bind(pa);var ga=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},ma=(e,t,n)=>{const{memoize:o,memoizeOptions:r}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=o((()=>({})),...r);if(!(a.apply(null,i)===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:i,secondInputs:s,stack:e})}},va={inputStabilityCheck:"once",identityFunctionCheck:"once"};var ya=e=>Array.isArray(e)?e:[e];function ba(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 $a(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var wa=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...va,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:ga},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:ma}}},Ea="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function ka(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:o}=t;let r,i=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 o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}else{let e=t.p;null===e&&(t.p=e=new Map);const o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}}const a=t;let d;if(1===t.s?d=t.v:(d=e.apply(null,arguments),i++),a.s=1,o){const e=r?.deref?.()??r;null!=e&&o(e,d)&&(d=e,0!==i&&i--);r="object"==typeof d&&null!==d||"function"==typeof d?new Ea(d):d}return a.v=d,d}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Ca(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,o=(...e)=>{let t,o=0,r=0,i={},s=e.pop();"object"==typeof s&&(i=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,...i},{memoize:d,memoizeOptions:c=[],argsMemoize:l=ka,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=ya(c),f=ya(u),g=ba(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const y=l((function(){r++;const e=$a(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=wa(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=$a(g,arguments);o.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:p},arguments)}v&&(v=!1)}return t}),...f);return Object.assign(y,{resultFunc:s,memoizedResultFunc:m,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:l})};return Object.assign(o,{withTypes:()=>o}),o}var xa=Ca(ka),Oa=Object.assign(((e,t=xa)=>{!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),o=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,o)=>(e[n[o]]=t,e)),{})));return o}),{withTypes:()=>Oa});function Sa(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var Ia=Sa(),ja=Sa;((...e)=>{const t=Ca(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Rs(e)?ua(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ka);var Ra="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ws:ws.apply(null,arguments)},Na=e=>e&&"function"==typeof e.match;function Ma(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?vd(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ks(t)&&t.type===e,n}function Aa(e){return"function"==typeof e&&"type"in e&&Na(e)}function Da(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 Ta=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 Pa(e){return Ns(e)?fa(e,(()=>{})):e}function Ua(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?vd(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function _a(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Wa(e,t,n){const o=La(e,t,n);return{detectMutations:()=>Fa(e,t,o,n)}}function La(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=La(e,t,n[r],s))}}return i}function Fa(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const c=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(c){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Fa(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Va(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||gs(e)}function qa(e,t="",n=Va,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,c]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(c))return{keyPath:a,value:c};if("object"==typeof c&&(s=qa(c,a,n,o,r,i),s))return s}return i&&Ba(e)&&i.add(e),!1}function Ba(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Ba(t))return!1;return!0}function za(e){return"boolean"==typeof e}var Ka=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Ta;if(t&&(za(t)?i.push(Ia):i.push(ja(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};za(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=_a,ignoredPaths:r,warnAfter:i=32}=e;const s=Wa.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Da(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vd(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 l=a(d);return c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vd(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)`)})),c.warnIfExceeded(),l}}}}(e))}if(o){let e={};za(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Va,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:c=!1}=e,l=!c&&WeakSet?new WeakSet:void 0;return e=>c=>u=>{if(!ks(u))return c(u);const h=c(u),p=Da(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=qa(u,"",t,n,r,l);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||(p.measureTime((()=>{const o=qa(e.getState(),"",t,n,i,l);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};za(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Aa}=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 i},Ha=e=>t=>{setTimeout(t,e)},Ga="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ha(10),Ja=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Ta(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Ga:"callback"===e.type?e.queueNotification:Ha(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(c))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Xa="production"===process.env.NODE_ENV;function Za(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?vd(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?vd(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?vd(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?vd(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?vd(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&&o)throw new Error("production"===process.env.NODE_ENV?vd(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Ya=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Qa(...e){return t=>e.some((e=>((e,t)=>Na(e)?e.match(t):e(t))(e,t)))}var ed=["name","message","stack","code"],td=class{constructor(e,t){this.payload=e,this.meta=t}_type},nd=class{constructor(e,t){this.payload=e,this.meta=t}_type},od=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of ed)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},rd=(()=>{function e(e,t,n){const o=Ma(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Ma(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Ma(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||od)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const c=n?.idGenerator?n.idGenerator(e):Ya(),l=new AbortController;let u,h;function p(e){h=e,l.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||l.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},l.signal.addEventListener("abort",u)}));s(r(c,e,n?.getPendingMeta?.({requestId:c,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:c,signal:l.signal,abort:p,rejectWithValue:(e,t)=>new td(e,t),fulfillWithValue:(e,t)=>new nd(e,t)})).then((t=>{if(t instanceof td)throw t;return t instanceof nd?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof td?i(null,c,e,t.payload,t.meta):i(t,c,e)}finally{u&&l.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:c,arg:e,unwrap:()=>f.then(id)})}}),{pending:r,rejected:i,fulfilled:o,settled:Qa(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function id(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var sd=Symbol.for("rtk-slice-createasyncthunk");function ad(e,t){return`${e}/${t}`}function dd({creators:e}={}){const t=e?.asyncThunk?.[sd];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?vd(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)||{},i=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?vd(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?vd(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?vd(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=[],o]="function"==typeof e.extraReducers?Za(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?vd(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,[o,r,i]=Za(t);if(function(e){return"function"==typeof e}(e))n=()=>Pa(e());else{const t=Pa(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(Rs(e)){const o=n(e,t);return void 0===o?e:o}if(Ns(e))return fa(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?vd(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:ad(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?vd(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Ma(e,s):Ma(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?vd(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:c,options:l}=n,u=r(e,i,l);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);c&&o.addMatcher(u.settled,c);o.exposeCaseReducer(t,{fulfilled:s||ud,pending:a||ud,rejected:d||ud,settled:c||ud})}(s,i,a,t)}));const c=e=>e,l=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vd(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Ua(l,n,{insert:()=>new WeakMap});return Ua(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=cd(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function cd(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vd(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var ld=dd();function ud(){}var hd="listenerMiddleware",pd=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Ma(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?vd(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?vd(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},fd=Object.assign((e=>{const{type:t,predicate:n,effect:o}=pd(e);return{id:Ya(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?vd(22):"Unsubscribe not initialized")}}}),{withTypes:()=>fd}),gd=Object.assign(Ma(`${hd}/add`),{withTypes:()=>gd});Ma(`${hd}/removeAll`);var md=Object.assign(Ma(`${hd}/remove`),{withTypes:()=>md});function vd(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. `}const yd=["error","warn","info","debug"],bd=Li((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return yd.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),$d="undefined"!=typeof localStorage,wd=$d&&localStorage.getItem("base.content.url")||"",Ed=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,kd=Li((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)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Cd=Li((e=>{var t,n;const o=Ai(bd,kd)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,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})),xd=e=>t=>{var n,o,r;const i=Ai(bd,kd,Cd)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};xd.missingAttrValidator=Ed;const Od=Li((e=>{const t=Ai(xd({"project-id":Ed}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Sd=Li((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Id=Li((e=>{const t=Ai(bd,Od,Sd)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(wd||o||"https://static.descope.com/pages");return r.pathname=Ti(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),jd=Li((e=>{var t,n,o;const r=Ai(Id)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),Rd=Li((e=>{var t,n,o,r,i,s,a;return a=class extends(Ai(kd,bd)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(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)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return dc})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),Nd="load-descope-ui",Md="base.ui.components.url",Ad=$d&&localStorage.getItem(Md)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Dd=$d&&localStorage.getItem(Md)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Td=e=>{const t=document.createElement("script");return t.id=e,t},Pd=(e,t)=>e.replace("<version>",t),Ud=Li((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=Ai(bd,jd)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),c.set(this,void 0)}get descopeUi(){return h(this,c,"f")||p(this,c,h(this,t,"m",u).call(this),"f"),h(this,c,"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=>h(this,t,"m",l).call(this,e))))}},n=new WeakMap,o=new WeakMap,c=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=Td("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=Pd(Dd,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Nd}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Td(Nd);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Pd(Ad,await h(this,t,"m",r).call(this))}return document.getElementById(Nd)},l=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),_d="content-root",Wd="root",Ld=Li((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Wd}, #${_d} {\n height: 100%;\n }\n #${Wd} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Wd}">\n <div id="${_d}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(_d),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Wd)}})),Fd="descope-modal",Vd=Li((e=>{var t,n;const o=Ai(kd,Ld,Ud)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ts{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Fd);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Fd]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),qd="descope-notification",Bd=Li((e=>{var t,n;const o=Ai(kd,Ld,Ud)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends rs{setContent(t){const n="string"==typeof t?Di(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(qd);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(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([qd])}},t=new WeakMap,n})),zd=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Kd=Li((e=>{var t,n,o,r,i,s,a,d,c;const l=Ai(xd({theme:zd}),Id,kd,Ud,jd,Ld,Cd)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Md)))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(Md),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},c})),Hd=e=>Li((t=>{const n=ld(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ai(bd)(t)){constructor(...e){super(...e);const t=function(e){const t=Ka(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!gs(n))throw new Error("production"===process.env.NODE_ENV?vd(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=$s(n)}if(!Xa&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?vd(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Xa&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?vd(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Xa&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vd(4):"each middleware provided to configureStore must be a function");let c=ws;r&&(c=Ra({trace:!Xa,..."object"==typeof r&&r}));const l=Es(...d),u=Ja(l);if(!Xa&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?vd(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Xa&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?vd(6):"`enhancers` callback must return an array");if(!Xa&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vd(7):"each enhancer provided to configureStore must be a function");return Xa||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),ys(a,i,c(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{id(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Gd=Li((e=>class extends(bd(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()}}));Li((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Jd=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Xd,Zd,Yd,Qd,ec,tc,nc,oc,rc,ic;const sc=document.createElement("template");sc.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class ac extends HTMLElement{constructor(){var e;super(),Xd.add(this),Zd.set(this,new Gi({messages:[]})),Yd.set(this,void 0),Qd.set(this,void 0),ec.set(this,void 0),tc.set(this,{resize:h(this,Xd,"m",ic).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sc.content.cloneNode(!0)),p(this,Yd,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Qd,h(this,Yd,"f").querySelector(".content"),"f"),p(this,ec,h(this,Yd,"f").querySelector(".header"),"f")}updateData(e){h(this,Zd,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Jd(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function c(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=c:e.onmousedown=c})(h(this,Yd,"f"),h(this,ec,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,tc,"f").resize),(e=h(this,Yd,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,Yd,"f").onresize=h(this,Xd,"m",rc).bind(this),h(this,Zd,"f").subscribe(h(this,Xd,"m",nc).bind(this))}disconnectedCallback(){h(this,Zd,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,tc,"f").resize)}}Zd=new WeakMap,Yd=new WeakMap,Qd=new WeakMap,ec=new WeakMap,tc=new WeakMap,Xd=new WeakSet,nc=function(e){h(this,Xd,"m",oc).call(this,e),h(this,Xd,"m",rc).call(this)},oc=function(e){h(this,Qd,"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(){h(this,Qd,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},ic=function(){const[e,t]=Jd(h(this,Yd,"f"),Number.parseInt(h(this,Yd,"f").style.left,10),Number.parseInt(h(this,Yd,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Yd,"f").style.top=`${t}px`,h(this,Yd,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",ac);var dc=Object.freeze({__proto__:null}),cc={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|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-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]|22"],"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","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?: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))\\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)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|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-8]\\d|90)\\d{8}|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])|90[25])[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(?:00|2[125-9]|33|44|66|77|88)|622)[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|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-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]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\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{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"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],[["(\\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[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"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])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($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","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[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|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-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],[["(\\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",["(?:1[3-79]|[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[0235])|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-2]))|(?: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{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|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{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"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))\\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]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\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],[["(\\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}"],["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]],0,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}|[257-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",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"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",["[257-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",["60|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[013-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{6}|(?: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))\\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",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"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{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"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]","1(?:(?:22|44|7[27]|87|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-689]|8[1-69]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",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[047]"]]]],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","2[0-24-9]\\d{8}|[78]\\d{10,13}|[7-9]\\d{9}|[1-9]\\d{7}|[124-7]\\d{6}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-6]|7(?:0[0-689]|[1-79])|8[2-9]"],"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|80\\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","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"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]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|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]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\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],[["(\\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-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"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|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],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[1-5]"]],["(\\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,[["(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|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-57-9]|1[02-9]|2[013569]|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[1247]|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}"]]],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","810","(?:20|33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],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],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)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\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","(?: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])\\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}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],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,0,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 lc(e,t){var n=Array.prototype.slice.call(t);return n.push(cc),e.apply(this,n)}function uc(e){return uc="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},uc(e)}function hc(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function pc(e,t){if(t&&("object"===uc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return fc(e)}function fc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gc(e){var t="function"==typeof Map?new Map:void 0;return gc=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,o)}function o(){return mc(e,arguments,bc(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),yc(o,e)},gc(e)}function mc(e,t,n){return mc=vc()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&yc(r,n.prototype),r},mc.apply(null,arguments)}function vc(){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 yc(e,t){return yc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},yc(e,t)}function bc(e){return bc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},bc(e)}var $c=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&&yc(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=vc(),function(){var e,o=bc(t);if(n){var r=bc(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return pc(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=s.call(this,e),Object.setPrototypeOf(fc(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&hc(o.prototype,r),i&&hc(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(gc(Error)),wc="0-90-9٠-٩۰-۹",Ec="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function kc(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),o=t[0].split("."),r=0;r<3;r++){var i=Number(n[r]),s=Number(o[r]);if(i>s)return 1;if(s>i)return-1;if(!isNaN(i)&&isNaN(s))return 1;if(isNaN(i)&&!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 Cc={}.constructor;function xc(e){return null!=e&&e.constructor===Cc}function Oc(e){return Oc="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},Oc(e)}function Sc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ic(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function jc(e,t,n){return t&&Ic(e.prototype,t),n&&Ic(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Rc=" ext. ",Nc=/^\d+$/,Mc=function(){function e(t){Sc(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!xc(e)||!xc(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(xc(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+_c(e)+": "+e,"."))}(t),this.metadata=t,Lc.call(this,t)}return jc(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&&Nc.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Ac(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Ac(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 o=this.countryCallingCodes()[e];if(o&&1===o.length&&"001"===o[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}(),Ac=function(){function e(t,n){Sc(this,e),this.globalMetadataObject=n,this.metadata=t,Lc.call(this,n.metadata)}return jc(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 Dc(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()&&Uc(this.types(),e))return new Pc(Uc(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?Rc:this.metadata[13]||Rc}}]),e}(),Dc=function(){function e(t,n){Sc(this,e),this._format=t,this.metadata=n}return jc(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()||Tc.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Tc=/^\(?\$1\)?$/,Pc=function(){function e(t,n){Sc(this,e),this.type=t,this.metadata=n}return jc(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 Uc(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 _c=function(e){return Oc(e)};function Wc(e,t){if((t=new Mc(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Lc(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===kc(t,"1.2.0")?this.v2=!0:-1===kc(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Fc=function(e){return"([".concat(wc,"]{1,").concat(e,"})")};function Vc(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",o="#?",r="[ \\t]*";return";ext="+Fc("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+Fc("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+Fc("9")+o)+"|"+("[- ]+"+Fc("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+Fc("15")+o)+"|"+(r+"(?:,)+"+n+Fc("9")+o)}var qc="["+wc+"]{2}",Bc="[++]{0,1}(?:["+Ec+"]*["+wc+"]){3,}["+Ec+wc+"]*",zc=new RegExp("^[++]{0,1}(?:["+Ec+"]*["+wc+"]){1,2}$","i"),Kc=Bc+"(?:"+Vc()+")?",Hc=new RegExp("^"+qc+"$|^"+Kc+"$","i");var Gc=new RegExp("(?:"+Vc()+")$","i");var Jc={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 Xc(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 Zc(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 Zc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Zc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Yc(e){for(var t,n="",o=Xc(e.split(""));!(t=o()).done;){n+=Qc(t.value,n)||""}return n}function Qc(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return Jc[e]}(e)}function el(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return tl(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 tl(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function tl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function nl(e,t){return ol(e,void 0,t)}function ol(e,t,n){var o=n.type(t),r=o&&o.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!n.type("FIXED_LINE"))return ol(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=el(t);!(n=r()).done;){var i=n.value;e.indexOf(i)<0&&o.push(i)}return o.sort((function(e,t){return e-t}))}(r,i.possibleLengths()))}else if(t&&!o)return"INVALID_LENGTH";var s=e.length,a=r[0];return a===s?"IS_POSSIBLE":a>s?"TOO_SHORT":r[r.length-1]<s?"TOO_LONG":r.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function rl(e,t){return"IS_POSSIBLE"===nl(e,t)}function il(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function sl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return al(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return al(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var dl=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function cl(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Mc(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(il(o,n.nationalNumberPattern())){if(ll(o,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?ll(o,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,i=sl(dl);!(r=i()).done;){var s=r.value;if(ll(o,s,n))return s}}}}function ll(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&il(e,t.pattern()))}function ul(e,t,n){var o=new Mc(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new Mc(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var hl=/(\$\d)/;function pl(e,t,n){var o=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var i=e.replace(new RegExp(t.pattern()),o?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(hl,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(Ec,"]+"),"g")," ").trim()}(i):i}var fl=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function gl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ml(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function yl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vl(Object(n),!0).forEach((function(t){bl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $l={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function wl(e,t,n,o){if(n=n?yl(yl({},$l),n):$l,o=new Mc(o),e.country&&"001"!==e.country){if(!o.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));o.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";o.selectNumberingPlan(e.countryCallingCode)}var r,i=o.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?kl(r=El(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=El(s,null,"INTERNATIONAL",o,n),kl(r="+".concat(i," ").concat(r),e.ext,o,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).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(i).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,o,r){var i=Wc(o,r.metadata);if(i===n){var s=El(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new Mc(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():fl.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(El(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return kl(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function El(e,t,n,o,r){var i=function(e,t){for(var n,o=gl(e);!(n=o()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var i=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(i))continue}if(il(t,r.pattern()))return r}}(o.formats(),e);return i?pl(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function kl(e,t,n,o){return t?o(e,t,n):e}function Cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function xl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cl(Object(n),!0).forEach((function(t){Ol(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ol(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sl(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var Il=function(){function e(t,n,o){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(!o)throw new TypeError("`metadata` not passed");var r=function(e,t){var n,o,r=new Mc(t);i=e,/^[A-Z]{2}$/.test(i)?(n=e,r.selectNumberingPlan(n),o=r.countryCallingCode()):o=e;var i;return{country:n,countryCallingCode:o}}(t,o),i=r.country,s=r.countryCallingCode;this.country=i,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}var t,n,o;return t=e,n=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:ul(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Mc(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 rl(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 Mc(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==cl(e,t,n.metadata):il(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Mc(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return cl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return wl(this,e,t?xl(xl({},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)}}],n&&Sl(t.prototype,n),o&&Sl(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var jl=new RegExp("(["+wc+"])");function Rl(e,t){var n=function(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),o=n.exec(e);if(o){var r,i,s,a=o.length-1,d=a>0&&o[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(i=o[1]);else{var c=o[0];r=e.slice(c.length),d&&(i=o[1])}if(d){var l=e.indexOf(o[1]);e.slice(0,l)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=o[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:i}}}return{nationalNumber:e}}(e,t),o=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(il(e,n.nationalNumberPattern())&&!il(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(nl(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:o}}function Nl(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new Mc(o);r.selectNumberingPlan(t,n);var i=new RegExp(r.IDDPrefix());if(0===e.search(i)){var s=(e=e.slice(e.match(i)[0].length)).match(jl);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}(e,t,n,o);if(!i||i===e){if(t||n){var s=function(e,t,n,o){var r=t?Wc(t,o):n;if(0===e.indexOf(r)){(o=new Mc(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=Rl(i,o).nationalNumber,a=Rl(e,o).nationalNumber;if(!il(a,o.nationalNumberPattern())&&il(s,o.nationalNumberPattern())||"TOO_LONG"===nl(a,o))return{countryCallingCode:r,number:i}}return{number:e}}(e,t,n,o),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="+"+i}if("0"===e[1])return{};o=new Mc(o);for(var c=2;c-1<=3&&c<=e.length;){var l=e.slice(1,c);if(o.hasCallingCode(l))return o.selectNumberingPlan(l),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:l,number:e.slice(c)};c++}return{}}function Ml(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Al(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Al(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Dl(e,t){var n=t.nationalNumber,o=t.defaultCountry,r=t.metadata,i=r.getCountryCodesForCallingCode(e);if(i)return 1===i.length?i[0]:function(e,t){var n=t.countries,o=t.defaultCountry,r=t.metadata;r=new Mc(r);for(var i,s=[],a=Ml(n);!(i=a()).done;){var d=i.value;if(r.country(d),r.leadingDigits()){if(e&&0===e.search(r.leadingDigits()))return d}else if(cl({phone:e,country:d},void 0,r.metadata)){if(!o)return d;if(d===o)return d;s.push(d)}}if(s.length>0)return s[0]}(n,{countries:i,defaultCountry:o,metadata:r.metadata})}var Tl="(["+wc+"]|[\\-\\.\\(\\)]?)",Pl=new RegExp("^\\+"+Tl+"*["+wc+"]"+Tl+"*$","g"),Ul=new RegExp("^("+("["+wc+"]+((\\-)*["+wc+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+wc+"])*")+"\\.?$","g"),_l="tel:",Wl=";phone-context=";function Ll(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Wl);if(t<0)return null;var n=t+Wl.length;if(n>=e.length)return"";var o=e.indexOf(";",n);return o>=0?e.substring(n,o):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&(Pl.test(e)||Ul.test(e))}(r))throw new $c("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(_l);i=s>=0?s+_l.length:0;var a=e.indexOf(Wl);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Fl=new RegExp("[++"+wc+"]"),Vl=new RegExp("[^"+wc+"#]+$");function ql(e,t,n){if(t=t||{},n=new Mc(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new $c("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=Ll(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new $c("TOO_LONG");return}if(!1===t)return e;var o=e.search(Fl);if(o<0)return;return e.slice(o).replace(Vl,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&Hc.test(e)}(o))return function(e){return zc.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Gc);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(Gc),r=1;r<o.length;){if(o[r])return{number:n,ext:o[r]};r++}}(o);if(r.ext)return r;return{number:o}}(e,t.v2,t.extract),r=o.number,i=o.ext,s=o.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new $c("TOO_SHORT");throw new $c("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=Nl(Yc(e),t,n,o.metadata),s=i.countryCallingCodeSource,a=i.countryCallingCode,d=i.number;if(a)o.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};o.selectNumberingPlan(t,n),t&&(r=t),a=n||Wc(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var c=Rl(Yc(d),o),l=c.nationalNumber,u=c.carrierCode,h=Dl(a,{nationalNumber:l,defaultCountry:t,metadata:o});h&&(r=h,"001"===h||o.country(r));return{country:r,countryCallingCode:a,countryCallingCodeSource:s,nationalNumber:l,carrierCode:u}}(r,t.defaultCountry,t.defaultCallingCode,n),d=a.country,c=a.nationalNumber,l=a.countryCallingCode,u=a.countryCallingCodeSource,h=a.carrierCode;if(!n.hasSelectedNumberingPlan()){if(t.v2)throw new $c("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new $c("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new $c("TOO_LONG");return{}}if(t.v2){var p=new Il(l,c,n.metadata);return d&&(p.country=d),h&&(p.carrierCode=h),i&&(p.ext=i),p.__countryCallingCodeSource=u,p}var f=!!(t.extended?n.hasSelectedNumberingPlan():d)&&il(c,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:l,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!rl(c,n)),phone:c,ext:i}:f?function(e,t,n){var o={country:e,phone:t};n&&(o.ext=n);return o}(d,c,i):{}}function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function zl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bl(Object(n),!0).forEach((function(t){Kl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Gl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jl(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 o,r,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Xl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xl(e,t)}(e,t)||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 Xl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Zl(e){var t,n,o,r=Jl(Array.prototype.slice.call(e),4),i=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof i)throw new TypeError("A text for parsing must be a string.");if(t=i,s&&"string"!=typeof s){if(!xc(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,o=a):o=s}else d?(n=a,o=d):(n=void 0,o=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hl(Object(n),!0).forEach((function(t){Gl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:o}}function Yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yl(Object(n),!0).forEach((function(t){eu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function eu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tu(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=Ql(Ql({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return ql(e,zl(zl({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof $c))throw e}}function nu(){var e=Zl(arguments),t=e.text,n=e.options,o=e.metadata;return tu(t,n,o)}const ou=(e,t)=>Object.entries(e).reduce(((e,[n,o])=>{const[r,...i]=n.split(".");return t!==r?Object.assign(e,{[n]:o}):(e[r]||(e[r]={}),e[r][i.join(".")]=o,e)}),{}),ru=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),iu={enabled:"active",disabled:"disabled",invited:"invited"},su=e=>e.tenantRoles.data,au=e=>e.selectedUsersLoginIds,du=e=>e.notifications,cu=e=>e.customAttributes.data,lu=xa((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),ru(null==e?void 0:e.customAttributes,"customAttributes")),{status:iu[e.status]||e.status,roles:e.roleNames}))))),uu=xa(au,lu,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),hu=xa(uu,(e=>e.map((e=>e.userId)))),pu=xa(uu,(e=>e.map((e=>e.status)))),fu=xa(uu,(e=>e.every((e=>e.editable)))),gu=xa(au,(e=>!!e.length)),mu=xa(au,(e=>1===e.length)),vu=xa(au,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),yu=xa(mu,pu,((e,t)=>e&&t.every((e=>e===iu.enabled)))),bu=xa(pu,(e=>e.every((e=>e===iu.disabled)))),$u=xa(uu,(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`})),wu=xa(mu,bu,fu,((e,t,n)=>e&&t&&n)),Eu=xa(mu,yu,fu,((e,t,n)=>e&&t&&n)),ku=xa(mu,fu,((e,t)=>e&&t)),Cu=xa(mu,fu,((e,t)=>e&&t)),xu=xa(mu,fu,((e,t)=>e&&t)),Ou=xa(gu,(e=>e)),Su=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)}))}))},Iu=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}}),ju=({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)})}}),Ru=rd("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Nu=Su(Ru)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},Iu((e=>e.createUser)),ju({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>`}})),Mu={action:Ru,reducer:Nu},Au=rd("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Du=Su(Au)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Iu((e=>e.deleteUser)),ju({getSuccessMsg:e=>_i(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>_i(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Tu={action:Au,reducer:Du},Pu=rd("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Uu=Su(Pu)(Iu((e=>e.setTempUserPassword)),ju({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>`}})),_u={action:Pu,reducer:Uu},Wu=rd("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Lu=Su(Wu)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Iu((e=>e.customAttributes))),Fu={action:Wu,reducer:Lu},Vu=rd("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),qu=Su(Vu)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Iu((e=>e.usersList))),Bu={action:Vu,reducer:qu},zu=rd("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Ku=Su(zu)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Iu((e=>e.tenantRoles))),Hu={action:zu,reducer:Ku},Gu=rd("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Ju=Su(Gu)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Pi(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Iu((e=>e.updateUser)),ju({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>`}})),Xu={action:Gu,reducer:Ju},Zu=rd("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Yu=Su(Zu)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return Pi(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Iu((e=>e.enableUser)),ju({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>`}})),Qu={action:Zu,reducer:Yu},eh=rd("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),th=Su(eh)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return Pi(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},Iu((e=>e.disableUser)),ju({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>`}})),nh={action:eh,reducer:th},oh=rd("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),rh={action:oh,reducer:Su(oh)(Iu((e=>e.removePasskey)),ju({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>`}}))},ih={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:[]},sh="/v1/mgmt/user/search",ah="/v1/mgmt/user/delete/batch",dh="/v1/mgmt/user/create",ch="/v1/mgmt/user/update",lh="/v1/mgmt/user/update/status",uh="/v1/mgmt/user/password/set/temporary",hh="/v1/mgmt/user/passkeys/delete",ph="/v1/mgmt/user/customattributes",fh="/v1/mgmt/role/all",gh=e=>u(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)})),mh=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,customAttributes:i,statuses:s,emails:a,phones:d,text:c,sort:l}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.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:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.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:o,limit:r,customAttributes:i,statuses:s,emails:a,phones:d,text:c,sort:l});const h=yield e.post(sh,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:c,sort:l},{queryParams:{tenant:t}});return yield gh(h),(yield h.json()).users})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(ah,{userIds:o},{queryParams:{tenant:t}});return yield gh(r),r.json()})),create:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:l,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:y,inviteUrl:b,invite:$})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:c,middleName:l,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{const p=Math.random().toString(10).substring(15);u({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:c,middleName:l,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:l,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:y,inviteUrl:b,invite:$});const w=yield e.post(dh,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:c,verifiedEmail:l,verifiedPhone:h,additionalLoginIds:m,sendSMS:v,sendMail:y,inviteUrl:b,invite:$},{queryParams:{tenant:t}});return yield gh(w),(yield w.json()).user})),update:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:l,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:c,middleName:l,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{u({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:c,middleName:l,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:c,verifiedEmail:l,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m});const v=yield e.post(ch,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,customAttributes:d,picture:c,verifiedEmail:l,verifiedPhone:h,additionalLoginIds:m},{queryParams:{tenant:t}});return yield gh(v),(yield v.json()).user})),enable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(o);const r=yield e.post(lh,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield gh(r),r.json()})),disable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(o);const r=yield e.post(lh,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield gh(r),r.json()})),removePasskey:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(hh,{loginId:o},{queryParams:{tenant:t}});return yield gh(r),r.json()})),setTempPassword:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(uh,{loginId:o},{queryParams:{tenant:t}});return yield gh(r),r.json()})),getCustomAttributes:()=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const o=yield e.get(ph,{queryParams:{tenant:t}});return yield gh(o),(yield o.json()).data}))}),vh=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(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 o=yield e.get(fh,{queryParams:{tenant:t}});return yield gh(o),o.json()}))}),yh=Li((e=>{var t,n,o,r;const i=Ai(Od,Cd,bd,Sd,xd({tenant:xd.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.4.88"}}));return{user:mh({httpClient:r.httpClient,tenant:t,mock:n}),tenant:vh({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),bh=Li((e=>{const t=Ai(Hd({name:"widget",initialState:ih,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Mu.reducer(e),Xu.reducer(e),Qu.reducer(e),nh.reducer(e),Tu.reducer(e),Bu.reducer(e),_u.reducer(e),rh.reducer(e),Fu.reducer(e),Hu.reducer(e)},asyncActions:{searchUsers:Bu.action,createUser:Mu.action,updateUser:Xu.action,enableUser:Qu.action,disableUser:nh.action,deleteUsers:Tu.action,removePasskey:rh.action,getCustomAttributes:Fu.action,getTenantRoles:Hu.action,setTempUserPassword:_u.action}}),kd,bd,yh)(e);return class extends t{constructor(...e){super(...e),this.state=ih,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),$h=Li((e=>{const t=Ai(Id,xd({"widget-id":xd.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),wh=Li((e=>{var t,n,o;return o=class extends(Ai(bd,kd,Ud,Ld,$h,bh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=Di(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Eh=Li((e=>{var t,n,o,r,i,s;return s=class extends(Ai(bh,Vd,Gd,bd,wh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){yield h(this,n,"f").setData(su(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(Di(yield this.fetchWidgetPage("create-user-modal.html")));new Qi((()=>{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)}));const e=new Qi((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(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({},ou(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),p(this,n,new ns((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),h(this,i,"f").call(this),this.createUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield h(this,i,"f").call(this),h(this,t,"m",r).call(this)}))}))},r=function(){const e=cu(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),kh=Li((e=>{var t,n,o;return o=class extends(Ai(bd,Eh,wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Qi(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},o})),Ch=Li((e=>{var t,n,o;return o=class extends(Ai(bh,Vd,bd,wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(Di(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Qi((()=>{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 Qi((()=>{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=hu(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new is(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=$u(this.state);o.text=`Delete ${e}?`}}))},o})),xh=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh,Ch)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Ou)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Qi(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})),Oh=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(bh,Vd,bd,Gd,wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Qi((()=>{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()))},o=function(){new Qi((()=>{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=vu(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.disableUserModal=this.createModal(),this.disableUserModal.setContent(Di(yield this.fetchWidgetPage("disable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new is(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=$u(this.state);r.text=`Disable ${e}?`}))}))},i})),Sh=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh,Oh,Gd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Eu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Qi(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})),Ih=e=>{if(!e)return e;const t=function(){return lc(nu,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},jh=Li((e=>{var t,n,o,r,i,s,a,d,c,f;return f=class extends(Ai(bh,Vd,bd,Gd,wh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),s.set(this,(()=>u(this,void 0,void 0,(function*(){yield h(this,o,"f").setData(su(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=uu(this.state))||void 0===e?void 0:e[0],o=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:Ih(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},ru(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,o)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",c).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){new Qi((()=>{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()))},i=function(){new Qi((()=>{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]},ou(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=cu(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},c=function(){var e;return u(this,void 0,void 0,(function*(){this.editUserModal=this.createModal(),this.editUserModal.setContent(Di(yield this.fetchWidgetPage("edit-user-modal.html"))),h(this,t,"m",r).call(this),h(this,t,"m",i).call(this),p(this,n,new ss(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),p(this,o,new ns((()=>{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=()=>u(this,void 0,void 0,(function*(){yield h(this,s,"f").call(this),h(this,n,"f").disable(),h(this,d,"f").call(this),h(this,t,"m",a).call(this)}))}))},f})),Rh=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh,jh,Gd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),ku)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Qi(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})),Nh=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(bh,Vd,bd,Gd,wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Qi((()=>{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()))},o=function(){new Qi((()=>{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=vu(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.enableUserModal=this.createModal(),this.enableUserModal.setContent(Di(yield this.fetchWidgetPage("enable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new is(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=$u(this.state);r.text=`Activate ${e}?`}))}))},i})),Mh=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh,Nh,Gd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),wu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Qi(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})),Ah=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Wi((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new ss(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r})),Dh={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},Th=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(bd,bh,Bd,kd)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ui((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=h(this,t,"m",o).call(this,e);i.setContent(h(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(h(this,r,"f").bind(this),du)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Dh[e],o=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}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),Ph=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(bh,Vd,bd,Gd,wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Qi((()=>{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()))},o=function(){new Qi((()=>{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=vu(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(Di(yield this.fetchWidgetPage("remove-passkey-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new is(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=$u(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),Uh=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh,Ph,Gd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),Cu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Qi(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})),_h=Li((e=>{var t,n,o,r,i,s,a,d;return d=class extends(Ai(bh,bd,wh)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ui((e=>{this.usersTable.data=e}))),i.set(this,Wi(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchUsers({sort:n})}))),s.set(this,Ui((e=>{this.usersTable.filterColumns((t=>{var n;const[o,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==o||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this),h(this,r,"f").call(this,lu(this.state)),h(this,s,"f").call(this,cu(this.state)),this.subscribe(h(this,s,"f").bind(this),cu),this.subscribe(h(this,r,"f").bind(this),lu)}))}},r=new WeakMap,i=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:o,header:r,type:i,attrs:s})=>{const a=e(o)||t(i);if(!a)return n({path:o,header:r,type:i,attrs:s});const d=a.cloneNode(!0),c=Object.assign(Object.assign({},s),{header:r});return Object.entries(c).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},o=function(){var e;this.usersTable=new Yi(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(h(this,t,"m",a).bind(this)),h(this,t,"m",n).call(this),h(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,i,"f").call(this,e.target,e.detail)}))}))},d})),Wh=Li((e=>{var t,n,o;return o=class extends(Ai(bh,Vd,bd,Gd,wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(Di(yield this.fetchWidgetPage("generated-password-modal.html")));new Qi((()=>{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()}))}))},o})),Lh=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(bh,Vd,bd,Gd,wh,Wh)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Qi((()=>{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()))},o=function(){new Qi((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>u(this,void 0,void 0,(function*(){var e;const t=vu(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(){var e;return u(this,void 0,void 0,(function*(){this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(Di(yield this.fetchWidgetPage("reset-password-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new is(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=$u(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),Fh=Li((e=>{var t,n,o,r;return r=class extends(Ai(bd,wh,bh,Lh,Gd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){h(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(h(this,o,"f").bind(this),xu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Qi(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})),Vh=Li((e=>class extends(Ai(Rd,Kd,_h,kh,xh,Rh,Mh,Sh,Fh,Uh,Ah,Th)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),qh=Ai((e=>class extends(Vh(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",qh);var Bh=Object.freeze({__proto__:null,default:qh});((...e)=>{const t=Ca(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Rs(e)?ua(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ka);var zh="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ws:ws.apply(null,arguments)},Kh=e=>e&&"function"==typeof e.match;function Hh(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Mp(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ks(t)&&t.type===e,n}function Gh(e){return"function"==typeof e&&"type"in e&&Kh(e)}function Jh(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 Xh=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 Zh(e){return Ns(e)?fa(e,(()=>{})):e}function Yh(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?Mp(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Qh(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function ep(e,t,n){const o=tp(e,t,n);return{detectMutations:()=>np(e,t,o,n)}}function tp(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=tp(e,t,n[r],s))}}return i}function np(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const c=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(c){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=np(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function op(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||gs(e)}function rp(e,t="",n=op,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,c]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(c))return{keyPath:a,value:c};if("object"==typeof c&&(s=rp(c,a,n,o,r,i),s))return s}return i&&ip(e)&&i.add(e),!1}function ip(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!ip(t))return!1;return!0}function sp(e){return"boolean"==typeof e}var ap=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Xh;if(t&&(sp(t)?i.push(Ia):i.push(ja(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};sp(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Qh,ignoredPaths:r,warnAfter:i=32}=e;const s=ep.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Jh(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Mp(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 l=a(d);return c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Mp(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)`)})),c.warnIfExceeded(),l}}}}(e))}if(o){let e={};sp(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=op,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:c=!1}=e,l=!c&&WeakSet?new WeakSet:void 0;return e=>c=>u=>{if(!ks(u))return c(u);const h=c(u),p=Jh(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=rp(u,"",t,n,r,l);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||(p.measureTime((()=>{const o=rp(e.getState(),"",t,n,i,l);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};sp(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Gh}=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 i},dp=e=>t=>{setTimeout(t,e)},cp="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:dp(10),lp=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Xh(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?cp:"callback"===e.type?e.queueNotification:dp(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(c))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},up="production"===process.env.NODE_ENV;function hp(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Mp(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Mp(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?Mp(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Mp(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Mp(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&&o)throw new Error("production"===process.env.NODE_ENV?Mp(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var pp=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function fp(...e){return t=>e.some((e=>((e,t)=>Kh(e)?e.match(t):e(t))(e,t)))}var gp=["name","message","stack","code"],mp=class{constructor(e,t){this.payload=e,this.meta=t}_type},vp=class{constructor(e,t){this.payload=e,this.meta=t}_type},yp=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of gp)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},bp=(()=>{function e(e,t,n){const o=Hh(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Hh(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Hh(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||yp)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const c=n?.idGenerator?n.idGenerator(e):pp(),l=new AbortController;let u,h;function p(e){h=e,l.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||l.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},l.signal.addEventListener("abort",u)}));s(r(c,e,n?.getPendingMeta?.({requestId:c,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:c,signal:l.signal,abort:p,rejectWithValue:(e,t)=>new mp(e,t),fulfillWithValue:(e,t)=>new vp(e,t)})).then((t=>{if(t instanceof mp)throw t;return t instanceof vp?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof mp?i(null,c,e,t.payload,t.meta):i(t,c,e)}finally{u&&l.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:c,arg:e,unwrap:()=>f.then($p)})}}),{pending:r,rejected:i,fulfilled:o,settled:fp(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function $p(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var wp=Symbol.for("rtk-slice-createasyncthunk");function Ep(e,t){return`${e}/${t}`}function kp({creators:e}={}){const t=e?.asyncThunk?.[wp];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Mp(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)||{},i=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?Mp(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Mp(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?Mp(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=[],o]="function"==typeof e.extraReducers?hp(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?Mp(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,[o,r,i]=hp(t);if(function(e){return"function"==typeof e}(e))n=()=>Zh(e());else{const t=Zh(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(Rs(e)){const o=n(e,t);return void 0===o?e:o}if(Ns(e))return fa(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?Mp(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Ep(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?Mp(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Hh(e,s):Hh(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Mp(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:c,options:l}=n,u=r(e,i,l);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);c&&o.addMatcher(u.settled,c);o.exposeCaseReducer(t,{fulfilled:s||Op,pending:a||Op,rejected:d||Op,settled:c||Op})}(s,i,a,t)}));const c=e=>e,l=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Mp(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Yh(l,n,{insert:()=>new WeakMap});return Yh(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Cp(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function Cp(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Mp(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var xp=kp();function Op(){}var Sp="listenerMiddleware",Ip=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Hh(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?Mp(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Mp(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},jp=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Ip(e);return{id:pp(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Mp(22):"Unsubscribe not initialized")}}}),{withTypes:()=>jp}),Rp=Object.assign(Hh(`${Sp}/add`),{withTypes:()=>Rp});Hh(`${Sp}/removeAll`);var Np=Object.assign(Hh(`${Sp}/remove`),{withTypes:()=>Np});function Mp(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. `}const Ap=["error","warn","info","debug"],Dp=Li((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return Ap.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),Tp="undefined"!=typeof localStorage,Pp=Tp&&localStorage.getItem("base.content.url")||"",Up=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,_p=Li((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)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Wp=Li((e=>{var t,n;const o=Ai(Dp,_p)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,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})),Lp=e=>t=>{var n,o,r;const i=Ai(Dp,_p,Wp)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};Lp.missingAttrValidator=Up;const Fp=Li((e=>{const t=Ai(Lp({"project-id":Up}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Vp=Li((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const qp=Li((e=>{const t=Ai(Dp,Fp,Vp)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Pp||o||"https://static.descope.com/pages");return r.pathname=Ti(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),Bp=Li((e=>{var t,n,o;const r=Ai(qp)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),zp=Li((e=>{var t,n,o,r,i,s,a;return a=class extends(Ai(_p,Dp)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(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)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Cf})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),Kp="load-descope-ui",Hp="base.ui.components.url",Gp=Tp&&localStorage.getItem(Hp)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Jp=Tp&&localStorage.getItem(Hp)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Xp=e=>{const t=document.createElement("script");return t.id=e,t},Zp=(e,t)=>e.replace("<version>",t),Yp=Li((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=Ai(Dp,Bp)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),c.set(this,void 0)}get descopeUi(){return h(this,c,"f")||p(this,c,h(this,t,"m",u).call(this),"f"),h(this,c,"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=>h(this,t,"m",l).call(this,e))))}},n=new WeakMap,o=new WeakMap,c=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=Xp("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=Zp(Jp,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Kp}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Xp(Kp);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Zp(Gp,await h(this,t,"m",r).call(this))}return document.getElementById(Kp)},l=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),Qp="content-root",ef="root",tf=Li((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${ef}, #${Qp} {\n height: 100%;\n }\n #${ef} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${ef}">\n <div id="${Qp}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Qp),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(ef)}})),nf="descope-modal",of=Li((e=>{var t,n;const o=Ai(_p,tf,Yp)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ts{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(nf);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([nf]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),rf="descope-notification",sf=Li((e=>{var t,n;const o=Ai(_p,tf,Yp)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends rs{setContent(t){const n="string"==typeof t?Di(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(rf);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(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([rf])}},t=new WeakMap,n})),af=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',df=Li((e=>{var t,n,o,r,i,s,a,d,c;const l=Ai(Lp({theme:af}),qp,_p,Yp,Bp,tf,Wp)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Hp)))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(Hp),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},c})),cf=e=>Li((t=>{const n=xp(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ai(Dp)(t)){constructor(...e){super(...e);const t=function(e){const t=ap(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!gs(n))throw new Error("production"===process.env.NODE_ENV?Mp(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=$s(n)}if(!up&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Mp(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!up&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Mp(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!up&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Mp(4):"each middleware provided to configureStore must be a function");let c=ws;r&&(c=zh({trace:!up,..."object"==typeof r&&r}));const l=Es(...d),u=lp(l);if(!up&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Mp(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!up&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Mp(6):"`enhancers` callback must return an array");if(!up&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Mp(7):"each enhancer provided to configureStore must be a function");return up||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),ys(a,i,c(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{$p(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),lf=Li((e=>class extends(Dp(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()}}));Li((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const uf=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var hf,pf,ff,gf,mf,vf,yf,bf,$f,wf;const Ef=document.createElement("template");Ef.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class kf extends HTMLElement{constructor(){var e;super(),hf.add(this),pf.set(this,new Gi({messages:[]})),ff.set(this,void 0),gf.set(this,void 0),mf.set(this,void 0),vf.set(this,{resize:h(this,hf,"m",wf).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ef.content.cloneNode(!0)),p(this,ff,this.shadowRoot.querySelector(".debugger"),"f"),p(this,gf,h(this,ff,"f").querySelector(".content"),"f"),p(this,mf,h(this,ff,"f").querySelector(".header"),"f")}updateData(e){h(this,pf,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=uf(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function c(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=c:e.onmousedown=c})(h(this,ff,"f"),h(this,mf,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,vf,"f").resize),(e=h(this,ff,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,ff,"f").onresize=h(this,hf,"m",$f).bind(this),h(this,pf,"f").subscribe(h(this,hf,"m",yf).bind(this))}disconnectedCallback(){h(this,pf,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,vf,"f").resize)}}pf=new WeakMap,ff=new WeakMap,gf=new WeakMap,mf=new WeakMap,vf=new WeakMap,hf=new WeakSet,yf=function(e){h(this,hf,"m",bf).call(this,e),h(this,hf,"m",$f).call(this)},bf=function(e){h(this,gf,"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("")},$f=function(){h(this,gf,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},wf=function(){const[e,t]=uf(h(this,ff,"f"),Number.parseInt(h(this,ff,"f").style.left,10),Number.parseInt(h(this,ff,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,ff,"f").style.top=`${t}px`,h(this,ff,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",kf);var Cf=Object.freeze({__proto__:null});const xf=e=>e.selectedRolesIds,Of=e=>e.notifications,Sf=e=>e.tenantPermissions.data||[],If=xa((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"})})))),jf=xa(xf,If,((e,t)=>t.filter((t=>e.includes(t.name))))),Rf=xa(xf,(e=>!!e.length)),Nf=xa(xf,(e=>1===e.length)),Mf=xa(jf,(e=>1===e.length?e[0].name:`${e.length} roles`)),Af=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)}))}))},Df=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}}),Tf=({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)})}}),Pf=bp("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),Uf=Af(Pf)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},Df((e=>e.createRole)),Tf({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>`}})),_f={action:Pf,reducer:Uf},Wf=bp("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Lf=Af(Wf)({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=[]}},Df((e=>e.deleteRole)),Tf({getSuccessMsg:e=>_i(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>_i(e.meta.arg.length)`Failed to delete role${["","s"]}`})),Ff={action:Wf,reducer:Lf},Vf=bp("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),qf=Af(Vf)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},Df((e=>e.rolesList))),Bf={action:Vf,reducer:qf},zf=bp("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),Kf=Af(zf)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},Df((e=>e.updateRole)),Tf({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>`}})),Hf={action:zf,reducer:Kf},Gf=bp("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),Jf={action:Gf,reducer:Af(Gf)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},Df((e=>e.tenantPermissions)))},Xf={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:[]},Zf="/v1/mgmt/role/search",Yf="/v1/mgmt/role/delete/batch",Qf="/v1/mgmt/role/create",eg="/v1/mgmt/role/update",tg="/v1/mgmt/permission/all",ng=e=>u(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)})),og=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t},n)=>u(void 0,void 0,void 0,(function*(){return new Promise((o=>{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 o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),o(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s},t);const a=yield e.post(Zf,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield ng(a),(yield a.json()).roles})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Yf,{roleNames:o},{queryParams:{tenant:t}});return yield ng(r),r.json()})),create:({name:o,description:r,permissionNames:i})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,description:t,permissionNames:n},o)=>u(void 0,void 0,void 0,(function*(){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:o})}))})))({name:o,description:r,permissionNames:i},t);const s=yield e.post(Qf,{name:o,description:r,permissionNames:i,tenantId:t},{queryParams:{tenant:t}});return yield ng(s),yield s.json()})),update:({name:o,newName:r,description:i,permissionNames:s})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,newName:t,description:n,permissionNames:o},r)=>u(void 0,void 0,void 0,(function*(){return new Promise((i=>{i({name:t,description:n,permissionNames:o,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:o,newName:r,description:i,permissionNames:s},t);const a=yield e.post(eg,{name:o,newName:r,description:i,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield ng(a);const d=yield a.json();return d.oldName=o,d}))}),rg=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>u(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 o=yield e.get(tg,{queryParams:{tenant:t}});return yield ng(o),o.json()}))}),ig=Li((e=>{var t,n,o,r;const i=Ai(Fp,Wp,Dp,Vp,Lp({tenant:Lp.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.85"}}));return{role:og({httpClient:r.httpClient,tenant:t,mock:n}),tenant:rg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),sg=Li((e=>{const t=Ai(cf({name:"widget",initialState:Xf,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{_f.reducer(e),Hf.reducer(e),Ff.reducer(e),Bf.reducer(e),Jf.reducer(e)},asyncActions:{searchRoles:Bf.action,createRole:_f.action,updateRole:Hf.action,deleteRoles:Ff.action,getTenantPermissions:Jf.action}}),_p,Dp,ig)(e);return class extends t{constructor(...e){super(...e),this.state=Xf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),ag=Li((e=>{const t=Ai(qp,Lp({"widget-id":Lp.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),dg=Li((e=>{var t,n,o;return o=class extends(Ai(Dp,_p,Yp,tf,ag,sg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=Di(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),cg=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(sg,of,lf,Dp,dg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield h(this,n,"f").setData(null===(e=Sf(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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(Di(yield this.fetchWidgetPage("create-role-modal.html")));new Qi((()=>{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)}));const e=new Qi((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(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))})))),p(this,n,new ns((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),h(this,r,"f").call(this)}))},i})),lg=Li((e=>{var t,n,o;return o=class extends(Ai(Dp,cg,dg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Qi(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},o})),ug=Li((e=>{var t,n,o;return o=class extends(Ai(sg,of,Dp,dg)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(Di(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Qi((()=>{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 Qi((()=>{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=jf(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new is(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=Mf(this.state);o.text=`Delete ${e}?`}}))},o})),hg=Li((e=>{var t,n,o,r;return r=class extends(Ai(Dp,dg,sg,ug)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),Rf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Qi(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-roles"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteRolesModal.open()}))},r})),pg=Li((e=>{var t,n,o,r,i,s,a,d;return d=class extends(Ai(sg,of,Dp,lf,dg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield h(this,n,"f").setData(null===(e=Sf(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=jf(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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield h(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,t=new WeakSet,o=function(){new Qi((()=>{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 Qi((()=>{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,o=l(t,["name"]),r=null===(e=jf(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},o)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return u(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(Di(yield this.fetchWidgetPage("edit-role-modal.html"))),h(this,t,"m",o).call(this),h(this,t,"m",r).call(this),p(this,n,new ns((()=>{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=()=>u(this,void 0,void 0,(function*(){yield h(this,i,"f").call(this),h(this,s,"f").call(this)}))}))},d})),fg=Li((e=>{var t,n,o,r;return r=class extends(Ai(Dp,dg,sg,pg,lf)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),Nf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Qi(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})),gg=Li((e=>{var t,n,o,r;return r=class extends(Ai(Dp,dg,sg)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Wi((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new ss(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r})),mg={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},vg=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(Dp,sg,sf,_p)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ui((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=h(this,t,"m",o).call(this,e);i.setContent(h(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(h(this,r,"f").bind(this),Of)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=mg[e],o=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}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),yg=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(sg,Dp,dg)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{this.rolesTable.data=e}))),r.set(this,Wi(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchRoles({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),h(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,r,"f").call(this,e.target,e.detail)}))})),h(this,o,"f").call(this,If(this.state)),this.subscribe(h(this,o,"f").bind(this),If)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Yi(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)))}))},i})),bg=Li((e=>class extends(Ai(zp,df,yg,lg,hg,fg,gg,vg)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),$g=Ai((e=>class extends(bg(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",$g);var wg=Object.freeze({__proto__:null,default:$g});((...e)=>{const t=Ca(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Rs(e)?ua(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ka);var Eg="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ws:ws.apply(null,arguments)},kg=e=>e&&"function"==typeof e.match;function Cg(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?cm(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ks(t)&&t.type===e,n}function xg(e){return"function"==typeof e&&"type"in e&&kg(e)}function Og(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 Sg=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 Ig(e){return Ns(e)?fa(e,(()=>{})):e}function jg(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?cm(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Rg(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Ng(e,t,n){const o=Mg(e,t,n);return{detectMutations:()=>Ag(e,t,o,n)}}function Mg(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Mg(e,t,n[r],s))}}return i}function Ag(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const c=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(c){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Ag(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Dg(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||gs(e)}function Tg(e,t="",n=Dg,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,c]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(c))return{keyPath:a,value:c};if("object"==typeof c&&(s=Tg(c,a,n,o,r,i),s))return s}return i&&Pg(e)&&i.add(e),!1}function Pg(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Pg(t))return!1;return!0}function Ug(e){return"boolean"==typeof e}var _g=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Sg;if(t&&(Ug(t)?i.push(Ia):i.push(ja(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Ug(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Rg,ignoredPaths:r,warnAfter:i=32}=e;const s=Ng.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Og(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?cm(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 l=a(d);return c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?cm(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)`)})),c.warnIfExceeded(),l}}}}(e))}if(o){let e={};Ug(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Dg,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:c=!1}=e,l=!c&&WeakSet?new WeakSet:void 0;return e=>c=>u=>{if(!ks(u))return c(u);const h=c(u),p=Og(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Tg(u,"",t,n,r,l);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||(p.measureTime((()=>{const o=Tg(e.getState(),"",t,n,i,l);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};Ug(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=xg}=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 i},Wg=e=>t=>{setTimeout(t,e)},Lg="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Wg(10),Fg=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Sg(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Lg:"callback"===e.type?e.queueNotification:Wg(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(c))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Vg="production"===process.env.NODE_ENV;function qg(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?cm(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?cm(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?cm(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?cm(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?cm(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&&o)throw new Error("production"===process.env.NODE_ENV?cm(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Bg=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function zg(...e){return t=>e.some((e=>((e,t)=>kg(e)?e.match(t):e(t))(e,t)))}var Kg=["name","message","stack","code"],Hg=class{constructor(e,t){this.payload=e,this.meta=t}_type},Gg=class{constructor(e,t){this.payload=e,this.meta=t}_type},Jg=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Kg)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Xg=(()=>{function e(e,t,n){const o=Cg(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Cg(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Cg(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Jg)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const c=n?.idGenerator?n.idGenerator(e):Bg(),l=new AbortController;let u,h;function p(e){h=e,l.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||l.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},l.signal.addEventListener("abort",u)}));s(r(c,e,n?.getPendingMeta?.({requestId:c,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:c,signal:l.signal,abort:p,rejectWithValue:(e,t)=>new Hg(e,t),fulfillWithValue:(e,t)=>new Gg(e,t)})).then((t=>{if(t instanceof Hg)throw t;return t instanceof Gg?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Hg?i(null,c,e,t.payload,t.meta):i(t,c,e)}finally{u&&l.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:c,arg:e,unwrap:()=>f.then(Zg)})}}),{pending:r,rejected:i,fulfilled:o,settled:zg(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Zg(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Yg=Symbol.for("rtk-slice-createasyncthunk");function Qg(e,t){return`${e}/${t}`}function em({creators:e}={}){const t=e?.asyncThunk?.[Yg];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?cm(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)||{},i=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?cm(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?cm(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?cm(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=[],o]="function"==typeof e.extraReducers?qg(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?cm(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,[o,r,i]=qg(t);if(function(e){return"function"==typeof e}(e))n=()=>Ig(e());else{const t=Ig(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(Rs(e)){const o=n(e,t);return void 0===o?e:o}if(Ns(e))return fa(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?cm(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Qg(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?cm(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Cg(e,s):Cg(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?cm(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:c,options:l}=n,u=r(e,i,l);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);c&&o.addMatcher(u.settled,c);o.exposeCaseReducer(t,{fulfilled:s||om,pending:a||om,rejected:d||om,settled:c||om})}(s,i,a,t)}));const c=e=>e,l=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?cm(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=jg(l,n,{insert:()=>new WeakMap});return jg(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=tm(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function tm(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?cm(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var nm=em();function om(){}var rm="listenerMiddleware",im=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Cg(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?cm(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?cm(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},sm=Object.assign((e=>{const{type:t,predicate:n,effect:o}=im(e);return{id:Bg(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?cm(22):"Unsubscribe not initialized")}}}),{withTypes:()=>sm}),am=Object.assign(Cg(`${rm}/add`),{withTypes:()=>am});Cg(`${rm}/removeAll`);var dm=Object.assign(Cg(`${rm}/remove`),{withTypes:()=>dm});function cm(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. `}const lm=["error","warn","info","debug"],um=Li((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return lm.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),hm="undefined"!=typeof localStorage,pm=hm&&localStorage.getItem("base.content.url")||"",fm=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,gm=Li((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)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),mm=Li((e=>{var t,n;const o=Ai(um,gm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,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})),vm=e=>t=>{var n,o,r;const i=Ai(um,gm,mm)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};vm.missingAttrValidator=fm;const ym=Li((e=>{const t=Ai(vm({"project-id":fm}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),bm=Li((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const $m=Li((e=>{const t=Ai(um,ym,bm)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(pm||o||"https://static.descope.com/pages");return r.pathname=Ti(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),wm=Li((e=>{var t,n,o;const r=Ai($m)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),Em=Li((e=>{var t,n,o,r,i,s,a;return a=class extends(Ai(gm,um)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(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)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return ev})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),km="load-descope-ui",Cm="base.ui.components.url",xm=hm&&localStorage.getItem(Cm)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Om=hm&&localStorage.getItem(Cm)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Sm=e=>{const t=document.createElement("script");return t.id=e,t},Im=(e,t)=>e.replace("<version>",t),jm=Li((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=Ai(um,wm)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),c.set(this,void 0)}get descopeUi(){return h(this,c,"f")||p(this,c,h(this,t,"m",u).call(this),"f"),h(this,c,"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=>h(this,t,"m",l).call(this,e))))}},n=new WeakMap,o=new WeakMap,c=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=Sm("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=Im(Om,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${km}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Sm(km);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Im(xm,await h(this,t,"m",r).call(this))}return document.getElementById(km)},l=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),Rm="content-root",Nm="root",Mm=Li((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Nm}, #${Rm} {\n height: 100%;\n }\n #${Nm} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Nm}">\n <div id="${Rm}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Rm),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Nm)}})),Am="descope-modal",Dm=Li((e=>{var t,n;const o=Ai(gm,Mm,jm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ts{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Am);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Am]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Tm="descope-notification",Pm=Li((e=>{var t,n;const o=Ai(gm,Mm,jm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends rs{setContent(t){const n="string"==typeof t?Di(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Tm);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(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([Tm])}},t=new WeakMap,n})),Um=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',_m=Li((e=>{var t,n,o,r,i,s,a,d,c;const l=Ai(vm({theme:Um}),$m,gm,jm,wm,Mm,mm)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Cm)))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(Cm),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},c})),Wm=e=>Li((t=>{const n=nm(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ai(um)(t)){constructor(...e){super(...e);const t=function(e){const t=_g(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!gs(n))throw new Error("production"===process.env.NODE_ENV?cm(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=$s(n)}if(!Vg&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?cm(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Vg&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?cm(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Vg&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?cm(4):"each middleware provided to configureStore must be a function");let c=ws;r&&(c=Eg({trace:!Vg,..."object"==typeof r&&r}));const l=Es(...d),u=Fg(l);if(!Vg&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?cm(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Vg&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?cm(6):"`enhancers` callback must return an array");if(!Vg&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?cm(7):"each enhancer provided to configureStore must be a function");return Vg||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),ys(a,i,c(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{Zg(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Lm=Li((e=>class extends(um(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()}}));Li((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Fm=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Vm,qm,Bm,zm,Km,Hm,Gm,Jm,Xm,Zm;const Ym=document.createElement("template");Ym.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Qm extends HTMLElement{constructor(){var e;super(),Vm.add(this),qm.set(this,new Gi({messages:[]})),Bm.set(this,void 0),zm.set(this,void 0),Km.set(this,void 0),Hm.set(this,{resize:h(this,Vm,"m",Zm).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ym.content.cloneNode(!0)),p(this,Bm,this.shadowRoot.querySelector(".debugger"),"f"),p(this,zm,h(this,Bm,"f").querySelector(".content"),"f"),p(this,Km,h(this,Bm,"f").querySelector(".header"),"f")}updateData(e){h(this,qm,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Fm(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function c(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=c:e.onmousedown=c})(h(this,Bm,"f"),h(this,Km,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Hm,"f").resize),(e=h(this,Bm,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,Bm,"f").onresize=h(this,Vm,"m",Xm).bind(this),h(this,qm,"f").subscribe(h(this,Vm,"m",Gm).bind(this))}disconnectedCallback(){h(this,qm,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Hm,"f").resize)}}qm=new WeakMap,Bm=new WeakMap,zm=new WeakMap,Km=new WeakMap,Hm=new WeakMap,Vm=new WeakSet,Gm=function(e){h(this,Vm,"m",Jm).call(this,e),h(this,Vm,"m",Xm).call(this)},Jm=function(e){h(this,zm,"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("")},Xm=function(){h(this,zm,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},Zm=function(){const[e,t]=Fm(h(this,Bm,"f"),Number.parseInt(h(this,Bm,"f").style.left,10),Number.parseInt(h(this,Bm,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Bm,"f").style.top=`${t}px`,h(this,Bm,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Qm);var ev=Object.freeze({__proto__:null});const tv=e=>e.selectedAccessKeysIds,nv=e=>e.notifications,ov=xa((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}))))),rv=xa(tv,ov,((e,t)=>t.filter((t=>e.includes(t.id))))),iv=xa(tv,(e=>!!e.length)),sv=xa(rv,(e=>e.every((e=>e.editable)))),av=xa(sv,iv,((e,t)=>e&&t));xa(tv,(e=>1===e.length));const dv=xa(rv,(e=>1===e.length?e[0].name:`${e.length} access keys`)),cv=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)}))}))},lv=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}}),uv=({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)})}}),hv=Xg("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),pv=cv(hv)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},lv((e=>e.createAccessKey)),uv({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>`}})),fv={action:hv,reducer:pv},gv=Xg("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),mv=cv(gv)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},lv((e=>e.deleteAccessKey)),uv({getSuccessMsg:e=>_i(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>_i(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),vv={action:gv,reducer:mv},yv=Xg("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),bv=cv(yv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},lv((e=>e.accessKeysList))),$v={action:yv,reducer:bv},wv=Xg("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),Ev=cv(wv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},lv((e=>e.activateAccessKey)),uv({getSuccessMsg:e=>_i(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>_i(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),kv={action:wv,reducer:Ev},Cv=Xg("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),xv=cv(Cv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},lv((e=>e.deactivateAccessKey)),uv({getSuccessMsg:e=>_i(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>_i(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),Ov={action:Cv,reducer:xv},Sv=Xg("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Iv={action:Sv,reducer:cv(Sv)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},lv((e=>e.tenantRoles)))},jv={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:[]},Rv="/v1/mgmt/accesskey/search",Nv="/v1/mgmt/accesskey/delete/batch",Mv="/v1/mgmt/accesskey/create",Av="/v1/mgmt/accesskey/deactivate/batch",Dv="/v1/mgmt/accesskey/activate/batch",Tv="/v1/mgmt/role/all",Pv=e=>u(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)})),Uv=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t}={})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.push({id:`access-key-id-${e}`,name:`Access Key ${e}`,createdBy:`User ${e}`,editable:!0,expireTime:(new Date).getTime()/1e3+2592e3,createdTime:(new Date).getTime()/1e3,roleNames:[`Role ${e}`],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s});const a=yield e.post(Rv,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Pv(a),(yield a.json()).keys})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Nv,{ids:o},{queryParams:{tenant:t}});return yield Pv(r),r.json()})),create:({name:o,expiration:r,roleNames:i,userId:s})=>u(void 0,void 0,void 0,(function*(){const a=new Date;a.setDate(a.getDate()+ +r);const d="0"===r[0]?0:Math.floor(a.getTime()/1e3);if(n)return(({name:e,roleNames:t,userId:n},o)=>u(void 0,void 0,void 0,(function*(){const r=Math.random().toString(10).substring(15);return new Promise((i=>{i({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${r}`,name:e||`Access Key ${r}`,createdBy:n||`User ${r}`,editable:!0,expireTime:o,createdTime:(new Date).getTime()/1e3,roleNames:t,status:"active",clientId:`Client ID ${r}`,boundUserId:n||`User ${r}`}})}))})))({name:o,expiration:r,roleNames:i,userId:s},d);const c=yield e.post(Mv,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield Pv(c),yield c.json()})),activate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Dv,{ids:o},{queryParams:{tenant:t}});return yield Pv(r),yield r.json()})),deactivate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Av,{ids:o},{queryParams:{tenant:t}});return yield Pv(r),yield r.json()}))}),_v=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(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 o=yield e.get(Tv,{queryParams:{tenant:t}});return yield Pv(o),o.json()}))}),Wv=Li((e=>{var t,n,o,r;const i=Ai(ym,mm,um,bm,vm({tenant:vm.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.87"}}));return{accesskey:Uv({httpClient:r.httpClient,tenant:t,mock:n}),tenant:_v({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Lv=Li((e=>{const t=Ai(Wm({name:"widget",initialState:jv,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{fv.reducer(e),vv.reducer(e),$v.reducer(e),kv.reducer(e),Ov.reducer(e),Iv.reducer(e)},asyncActions:{searchAccessKeys:$v.action,createAccessKey:fv.action,activateAccessKeys:kv.action,deactivateAccessKeys:Ov.action,deleteAccessKeys:vv.action,getTenantRoles:Iv.action}}),gm,um,Wv)(e);return class extends t{constructor(...e){super(...e),this.state=jv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Fv=Li((e=>{const t=Ai($m,vm({"widget-id":vm.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Vv=Li((e=>{var t,n,o;return o=class extends(Ai(um,gm,jm,Mm,Fv,Lv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=Di(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),qv=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(Lv,um,Vv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{this.accessKeysTable.data=e}))),r.set(this,Wi(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchAccessKeys({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),h(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{h(this,r,"f").call(this,e.target,e.detail)}))})),h(this,o,"f").call(this,ov(this.state)),this.subscribe(h(this,o,"f").bind(this),ov)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Yi(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)))}))},i})),Bv=Li((e=>{var t,n,o;return o=class extends(Ai(Lv,Dm,um,Vv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(Di(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Qi((()=>{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 Qi((()=>{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=rv(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new is(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=dv(this.state);o.text=`Activate ${e}?`}}))},o})),zv=Li((e=>{var t,n,o,r;return r=class extends(Ai(um,Vv,Lv,Bv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),av)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Qi(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})),Kv=Li((e=>{var t,n,o;return o=class extends(Ai(Lv,Dm,Lm,um,Vv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(Di(yield this.fetchWidgetPage("created-access-key-modal.html")));new Qi((()=>{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()}))}))},o})),Hv=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(Lv,Dm,Lm,um,Vv,Kv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e,t;yield h(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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function e(){return u(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(Di(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Qi((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});o.onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)}));const i=new Qi((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});i.onClick((()=>u(this,void 0,void 0,(function*(){var e;if(this.validateForm(this.createAccessKeyModal.ele)){const t=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(e=null==t?void 0:t.payload)||void 0===e?void 0:e.cleartext}),this.createdAccessKeyModal.open()}})))),p(this,n,new ns((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),h(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{h(this,t,"m",e).call(this)}}))},i})),Gv=Li((e=>{var t,n,o;return o=class extends(Ai(um,Hv,Vv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Qi(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()))},o})),Jv=Li((e=>{var t,n,o;return o=class extends(Ai(Lv,Dm,um,Vv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(Di(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Qi((()=>{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 Qi((()=>{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=rv(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new is(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=dv(this.state);o.text=`Deactivate ${e}?`}}))},o})),Xv=Li((e=>{var t,n,o,r;return r=class extends(Ai(um,Vv,Lv,Jv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),av)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Qi(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})),Zv=Li((e=>{var t,n,o;return o=class extends(Ai(Lv,Dm,um,Vv)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(Di(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Qi((()=>{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 Qi((()=>{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=rv(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new is(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=dv(this.state);o.text=`Delete ${e}?`}}))},o})),Yv=Li((e=>{var t,n,o,r;return r=class extends(Ai(um,Vv,Lv,Zv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),this.subscribe(h(this,o,"f").bind(this),av)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Qi(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})),Qv=Li((e=>{var t,n,o,r;return r=class extends(Ai(um,Vv,Lv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Wi((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new ss(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r})),ey={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},ty=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(um,Lv,Pm,gm)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ui((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=h(this,t,"m",o).call(this,e);i.setContent(h(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(h(this,r,"f").bind(this),nv)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=ey[e],o=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}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),ny=Li((e=>class extends(Ai(Em,_m,qv,Gv,Yv,Qv,zv,Xv,ty)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),oy=Ai((e=>class extends(ny(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",oy);var ry=Object.freeze({__proto__:null,default:oy});((...e)=>{const t=Ca(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Rs(e)?ua(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ka);var iy="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ws:ws.apply(null,arguments)},sy=e=>e&&"function"==typeof e.match;function ay(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Ky(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ks(t)&&t.type===e,n}function dy(e){return"function"==typeof e&&"type"in e&&sy(e)}function cy(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 ly=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 uy(e){return Ns(e)?fa(e,(()=>{})):e}function hy(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?Ky(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function py(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function fy(e,t,n){const o=gy(e,t,n);return{detectMutations:()=>my(e,t,o,n)}}function gy(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=gy(e,t,n[r],s))}}return i}function my(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const c=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(c){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=my(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function vy(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||gs(e)}function yy(e,t="",n=vy,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,c]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(c))return{keyPath:a,value:c};if("object"==typeof c&&(s=yy(c,a,n,o,r,i),s))return s}return i&&by(e)&&i.add(e),!1}function by(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!by(t))return!1;return!0}function $y(e){return"boolean"==typeof e}var wy=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new ly;if(t&&($y(t)?i.push(Ia):i.push(ja(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};$y(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=py,ignoredPaths:r,warnAfter:i=32}=e;const s=fy.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=cy(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ky(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 l=a(d);return c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ky(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)`)})),c.warnIfExceeded(),l}}}}(e))}if(o){let e={};$y(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=vy,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:c=!1}=e,l=!c&&WeakSet?new WeakSet:void 0;return e=>c=>u=>{if(!ks(u))return c(u);const h=c(u),p=cy(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=yy(u,"",t,n,r,l);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||(p.measureTime((()=>{const o=yy(e.getState(),"",t,n,i,l);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};$y(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=dy}=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 i},Ey=e=>t=>{setTimeout(t,e)},ky="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ey(10),Cy=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new ly(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?ky:"callback"===e.type?e.queueNotification:Ey(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(c))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},xy="production"===process.env.NODE_ENV;function Oy(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Ky(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Ky(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?Ky(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Ky(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Ky(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&&o)throw new Error("production"===process.env.NODE_ENV?Ky(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Sy=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Iy(...e){return t=>e.some((e=>((e,t)=>sy(e)?e.match(t):e(t))(e,t)))}var jy=["name","message","stack","code"],Ry=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ny=class{constructor(e,t){this.payload=e,this.meta=t}_type},My=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of jy)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Ay=(()=>{function e(e,t,n){const o=ay(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=ay(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=ay(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||My)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const c=n?.idGenerator?n.idGenerator(e):Sy(),l=new AbortController;let u,h;function p(e){h=e,l.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||l.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},l.signal.addEventListener("abort",u)}));s(r(c,e,n?.getPendingMeta?.({requestId:c,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:c,signal:l.signal,abort:p,rejectWithValue:(e,t)=>new Ry(e,t),fulfillWithValue:(e,t)=>new Ny(e,t)})).then((t=>{if(t instanceof Ry)throw t;return t instanceof Ny?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Ry?i(null,c,e,t.payload,t.meta):i(t,c,e)}finally{u&&l.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:c,arg:e,unwrap:()=>f.then(Dy)})}}),{pending:r,rejected:i,fulfilled:o,settled:Iy(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Dy(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Ty=Symbol.for("rtk-slice-createasyncthunk");function Py(e,t){return`${e}/${t}`}function Uy({creators:e}={}){const t=e?.asyncThunk?.[Ty];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Ky(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)||{},i=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?Ky(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Ky(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?Ky(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=[],o]="function"==typeof e.extraReducers?Oy(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?Ky(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,[o,r,i]=Oy(t);if(function(e){return"function"==typeof e}(e))n=()=>uy(e());else{const t=uy(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(Rs(e)){const o=n(e,t);return void 0===o?e:o}if(Ns(e))return fa(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?Ky(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Py(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?Ky(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?ay(e,s):ay(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Ky(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:c,options:l}=n,u=r(e,i,l);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);c&&o.addMatcher(u.settled,c);o.exposeCaseReducer(t,{fulfilled:s||Ly,pending:a||Ly,rejected:d||Ly,settled:c||Ly})}(s,i,a,t)}));const c=e=>e,l=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Ky(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=hy(l,n,{insert:()=>new WeakMap});return hy(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=_y(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function _y(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Ky(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Wy=Uy();function Ly(){}var Fy="listenerMiddleware",Vy=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=ay(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?Ky(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Ky(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},qy=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Vy(e);return{id:Sy(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Ky(22):"Unsubscribe not initialized")}}}),{withTypes:()=>qy}),By=Object.assign(ay(`${Fy}/add`),{withTypes:()=>By});ay(`${Fy}/removeAll`);var zy=Object.assign(ay(`${Fy}/remove`),{withTypes:()=>zy});function Ky(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. `}const Hy=["error","warn","info","debug"],Gy=Li((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return Hy.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),Jy="undefined"!=typeof localStorage,Xy=Jy&&localStorage.getItem("base.content.url")||"",Zy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Yy=Li((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)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Qy=Li((e=>{var t,n;const o=Ai(Gy,Yy)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,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})),eb=e=>t=>{var n,o,r;const i=Ai(Gy,Yy,Qy)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};eb.missingAttrValidator=Zy;const tb=Li((e=>{const t=Ai(eb({"project-id":Zy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),nb=Li((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const ob=Li((e=>{const t=Ai(Gy,tb,nb)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Xy||o||"https://static.descope.com/pages");return r.pathname=Ti(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),rb=Li((e=>{var t,n,o;const r=Ai(ob)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),ib=Li((e=>{var t,n,o,r,i,s,a;return a=class extends(Ai(Yy,Gy)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(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)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Db})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),sb="load-descope-ui",ab="base.ui.components.url",db=Jy&&localStorage.getItem(ab)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",cb=Jy&&localStorage.getItem(ab)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",lb=e=>{const t=document.createElement("script");return t.id=e,t},ub=(e,t)=>e.replace("<version>",t),hb=Li((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=Ai(Gy,rb)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),c.set(this,void 0)}get descopeUi(){return h(this,c,"f")||p(this,c,h(this,t,"m",u).call(this),"f"),h(this,c,"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=>h(this,t,"m",l).call(this,e))))}},n=new WeakMap,o=new WeakMap,c=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=lb("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=ub(cb,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${sb}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=lb(sb);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=ub(db,await h(this,t,"m",r).call(this))}return document.getElementById(sb)},l=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),pb="content-root",fb="root",gb=Li((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${fb}, #${pb} {\n height: 100%;\n }\n #${fb} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${fb}">\n <div id="${pb}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(pb),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(fb)}})),mb="descope-modal";Li((e=>{var t,n;const o=Ai(Yy,gb,hb)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ts{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(mb);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([mb]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const vb="descope-notification";Li((e=>{var t,n;const o=Ai(Yy,gb,hb)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends rs{setContent(t){const n="string"==typeof t?Di(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(vb);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(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([vb])}},t=new WeakMap,n}));const yb=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',bb=Li((e=>{var t,n,o,r,i,s,a,d,c;const l=Ai(eb({theme:yb}),ob,Yy,hb,rb,gb,Qy)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(ab)))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(ab),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},c})),$b=e=>Li((t=>{const n=Wy(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ai(Gy)(t)){constructor(...e){super(...e);const t=function(e){const t=wy(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!gs(n))throw new Error("production"===process.env.NODE_ENV?Ky(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=$s(n)}if(!xy&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Ky(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!xy&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Ky(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!xy&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ky(4):"each middleware provided to configureStore must be a function");let c=ws;r&&(c=iy({trace:!xy,..."object"==typeof r&&r}));const l=Es(...d),u=Cy(l);if(!xy&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Ky(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!xy&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Ky(6):"`enhancers` callback must return an array");if(!xy&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ky(7):"each enhancer provided to configureStore must be a function");return xy||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),ys(a,i,c(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{Dy(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));Li((e=>class extends(Gy(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()}})),Li((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const wb=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Eb,kb,Cb,xb,Ob,Sb,Ib,jb,Rb,Nb;const Mb=document.createElement("template");Mb.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Ab extends HTMLElement{constructor(){var e;super(),Eb.add(this),kb.set(this,new Gi({messages:[]})),Cb.set(this,void 0),xb.set(this,void 0),Ob.set(this,void 0),Sb.set(this,{resize:h(this,Eb,"m",Nb).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Mb.content.cloneNode(!0)),p(this,Cb,this.shadowRoot.querySelector(".debugger"),"f"),p(this,xb,h(this,Cb,"f").querySelector(".content"),"f"),p(this,Ob,h(this,Cb,"f").querySelector(".header"),"f")}updateData(e){h(this,kb,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=wb(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function c(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=c:e.onmousedown=c})(h(this,Cb,"f"),h(this,Ob,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Sb,"f").resize),(e=h(this,Cb,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,Cb,"f").onresize=h(this,Eb,"m",Rb).bind(this),h(this,kb,"f").subscribe(h(this,Eb,"m",Ib).bind(this))}disconnectedCallback(){h(this,kb,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Sb,"f").resize)}}kb=new WeakMap,Cb=new WeakMap,xb=new WeakMap,Ob=new WeakMap,Sb=new WeakMap,Eb=new WeakSet,Ib=function(e){h(this,Eb,"m",jb).call(this,e),h(this,Eb,"m",Rb).call(this)},jb=function(e){h(this,xb,"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("")},Rb=function(){h(this,xb,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},Nb=function(){const[e,t]=wb(h(this,Cb,"f"),Number.parseInt(h(this,Cb,"f").style.left,10),Number.parseInt(h(this,Cb,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Cb,"f").style.top=`${t}px`,h(this,Cb,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Ab);var Db=Object.freeze({__proto__:null});const Tb=e=>e.selectedAuditId,Pb=xa((e=>e.auditList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{occurredFormatted:(null==e?void 0:e.occurred)?new Date(Number(null==e?void 0:e.occurred)||0).toLocaleString():"N/A"})))));xa(Tb,Pb,((e,t)=>t.find((t=>e===t.id)))),xa(Tb,(e=>!!e));const Ub=Ay("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),_b=(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)}))}))})(Ub)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Wb=e=>e.auditList,{onFulfilled:e=>{Wb(e).loading=!1},onPending:e=>{Wb(e).loading=!0,Wb(e).error=null},onRejected:(e,t)=>{Wb(e).loading=!1,Wb(e).error=t.error}}));var Wb;const Lb={action:Ub,reducer:_b},Fb={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Vb="/v1/mgmt/audit/search",qb=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s,from:a}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<9;e+=1)o.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:(new Date).getTime()});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.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:o,limit:r,text:i,sort:s});const d=yield e.post(Vb,{limit:r,page:o,text:i,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>u(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}))}),Bb=Li((e=>{var t,n,o,r;const i=Ai(tb,Qy,Gy,nb,eb({tenant:eb.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.50"}}));return{audit:qb({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),zb=Li((e=>{const t=Ai($b({name:"widget",initialState:Fb,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Lb.reducer(e)},asyncActions:{searchAudit:Lb.action}}),Yy,Gy,Bb)(e);return class extends t{constructor(...e){super(...e),this.state=Fb,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Kb=Li((e=>{const t=Ai(ob,eb({"widget-id":eb.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Hb=Li((e=>{var t,n,o;return o=class extends(Ai(Gy,Yy,hb,gb,Kb,zb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([h(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=Di(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Gb=Li((e=>{var t,n,o,r,i;return i=class extends(Ai(Gy,Hb,zb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Wi((()=>{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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",o).call(this),h(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new ss(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(h(this,n,"f"))},r=function(){var e;this.rangeInput=new os(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(h(this,n,"f"))},i})),Jb=Li((e=>{var t,n,o,r;return r=class extends(Ai(zb,Gy,Hb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ui((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),h(this,t,"m",n).call(this),h(this,o,"f").call(this,Pb(this.state)),this.subscribe(h(this,o,"f").bind(this),Pb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Yi(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})),Xb=Li((e=>class extends(Ai(ib,bb,Jb,Gb)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Zb=Ai((e=>class extends(Xb(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Zb);var Yb=Object.freeze({__proto__:null,default:Zb});((...e)=>{const t=Ca(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Rs(e)?ua(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ka);var Qb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ws:ws.apply(null,arguments)},e$=e=>e&&"function"==typeof e.match;function t$(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?L$(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ks(t)&&t.type===e,n}function n$(e){return"function"==typeof e&&"type"in e&&e$(e)}function o$(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 r$=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 i$(e){return Ns(e)?fa(e,(()=>{})):e}function s$(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?L$(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function a$(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function d$(e,t,n){const o=c$(e,t,n);return{detectMutations:()=>l$(e,t,o,n)}}function c$(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=c$(e,t,n[r],s))}}return i}function l$(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const c=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(c){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=l$(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function u$(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||gs(e)}function h$(e,t="",n=u$,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(e):Object.entries(e),d=r.length>0;for(const[e,c]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(c))return{keyPath:a,value:c};if("object"==typeof c&&(s=h$(c,a,n,o,r,i),s))return s}return i&&p$(e)&&i.add(e),!1}function p$(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!p$(t))return!1;return!0}function f$(e){return"boolean"==typeof e}var g$=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new r$;if(t&&(f$(t)?i.push(Ia):i.push(ja(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};f$(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=a$,ignoredPaths:r,warnAfter:i=32}=e;const s=d$.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=o$(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?L$(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 l=a(d);return c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?L$(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)`)})),c.warnIfExceeded(),l}}}}(e))}if(o){let e={};f$(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=u$,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],warnAfter:s=32,ignoreState:a=!1,ignoreActions:d=!1,disableCache:c=!1}=e,l=!c&&WeakSet?new WeakSet:void 0;return e=>c=>u=>{if(!ks(u))return c(u);const h=c(u),p=o$(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=h$(u,"",t,n,r,l);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||(p.measureTime((()=>{const o=h$(e.getState(),"",t,n,i,l);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};f$(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=n$}=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 i},m$=e=>t=>{setTimeout(t,e)},v$="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:m$(10),y$=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new r$(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?v$:"callback"===e.type?e.queueNotification:m$(e.timeout),c=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(c))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},b$="production"===process.env.NODE_ENV;function $$(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?L$(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?L$(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?L$(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?L$(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?L$(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&&o)throw new Error("production"===process.env.NODE_ENV?L$(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var w$=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function E$(...e){return t=>e.some((e=>((e,t)=>e$(e)?e.match(t):e(t))(e,t)))}var k$=["name","message","stack","code"],C$=class{constructor(e,t){this.payload=e,this.meta=t}_type},x$=class{constructor(e,t){this.payload=e,this.meta=t}_type},O$=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of k$)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},S$=(()=>{function e(e,t,n){const o=t$(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=t$(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=t$(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||O$)(e||"Rejected"),meta:{...i||{},arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===e?.name,condition:"ConditionError"===e?.name}})));return Object.assign((function(e){return(s,a,d)=>{const c=n?.idGenerator?n.idGenerator(e):w$(),l=new AbortController;let u,h;function p(e){h=e,l.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||l.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},l.signal.addEventListener("abort",u)}));s(r(c,e,n?.getPendingMeta?.({requestId:c,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:c,signal:l.signal,abort:p,rejectWithValue:(e,t)=>new C$(e,t),fulfillWithValue:(e,t)=>new x$(e,t)})).then((t=>{if(t instanceof C$)throw t;return t instanceof x$?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof C$?i(null,c,e,t.payload,t.meta):i(t,c,e)}finally{u&&l.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:c,arg:e,unwrap:()=>f.then(I$)})}}),{pending:r,rejected:i,fulfilled:o,settled:E$(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function I$(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var j$=Symbol.for("rtk-slice-createasyncthunk");function R$(e,t){return`${e}/${t}`}function N$({creators:e}={}){const t=e?.asyncThunk?.[j$];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?L$(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)||{},i=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?L$(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?L$(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?L$(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=[],o]="function"==typeof e.extraReducers?$$(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?L$(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,[o,r,i]=$$(t);if(function(e){return"function"==typeof e}(e))n=()=>i$(e());else{const t=i$(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(Rs(e)){const o=n(e,t);return void 0===o?e:o}if(Ns(e))return fa(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?L$(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:R$(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?L$(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?t$(e,s):t$(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?L$(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:c,options:l}=n,u=r(e,i,l);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);c&&o.addMatcher(u.settled,c);o.exposeCaseReducer(t,{fulfilled:s||D$,pending:a||D$,rejected:d||D$,settled:c||D$})}(s,i,a,t)}));const c=e=>e,l=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?L$(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=s$(l,n,{insert:()=>new WeakMap});return s$(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=M$(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function M$(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?L$(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var A$=N$();function D$(){}var T$="listenerMiddleware",P$=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=t$(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?L$(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?L$(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},U$=Object.assign((e=>{const{type:t,predicate:n,effect:o}=P$(e);return{id:w$(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?L$(22):"Unsubscribe not initialized")}}}),{withTypes:()=>U$}),_$=Object.assign(t$(`${T$}/add`),{withTypes:()=>_$});t$(`${T$}/removeAll`);var W$=Object.assign(t$(`${T$}/remove`),{withTypes:()=>W$});function L$(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. `}const F$=["error","warn","info","debug"],V$=Li((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,h(this,t,"m",o).call(this,console))}set logger(e){p(this,n,h(this,t,"m",o).call(this,e),"f")}get logger(){return h(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return F$.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),q$="undefined"!=typeof localStorage,B$=q$&&localStorage.getItem("base.content.url")||"",z$=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,K$=Li((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)&&h(this,t,"f")&&(p(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),H$=Li((e=>{var t,n;const o=Ai(V$,K$)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=h(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){h(this,t,"f")[e]||(h(this,t,"f")[e]=[]);const o=h(this,t,"f")[e].push(n);return()=>h(this,t,"f")[e].splice(o,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})),G$=e=>t=>{var n,o,r;const i=Ai(V$,K$,H$)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,h(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>h(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};G$.missingAttrValidator=z$;const J$=Li((e=>{const t=Ai(G$({"project-id":z$}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),X$=Li((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Z$=Li((e=>{const t=Ai(V$,J$,X$)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(B$||o||"https://static.descope.com/pages");return r.pathname=Ti(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),Y$=Li((e=>{var t,n,o;const r=Ai(Z$)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return h(this,t,"f")||p(this,t,h(this,n,"f").call(this),"f"),h(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),Q$=Li((e=>{var t,n,o,r,i,s,a;return a=class extends(Ai(K$,V$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&h(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&h(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)),h(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=h(this,n,"f"))||void 0===e||e.remove(),p(this,n,null,"f")},r=async function(){p(this,n,document.createElement("descope-debugger"),"f"),Object.assign(h(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Rw})),document.body.appendChild(h(this,n,"f"))},i=function(){this.debug?h(this,t,"m",r).call(this):h(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=h(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),ew="load-descope-ui",tw="base.ui.components.url",nw=q$&&localStorage.getItem(tw)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ow=q$&&localStorage.getItem(tw)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",rw=e=>{const t=document.createElement("script");return t.id=e,t},iw=(e,t)=>e.replace("<version>",t),sw=Li((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=Ai(V$,Y$)(e);return f=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),c.set(this,void 0)}get descopeUi(){return h(this,c,"f")||p(this,c,h(this,t,"m",u).call(this),"f"),h(this,c,"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=>h(this,t,"m",l).call(this,e))))}},n=new WeakMap,o=new WeakMap,c=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=h(this,n,"f"),r=h(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=rw("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=iw(ow,await h(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[h(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),h(this,t,"m",s).call(this,e[h(this,n,"f")],e[h(this,o,"f")])})),e.addEventListener("load",(()=>{e[h(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${ew}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=rw(ew);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=iw(nw,await h(this,t,"m",r).call(this))}return document.getElementById(ew)},l=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),h(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},f})),aw="content-root",dw="root",cw=Li((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${dw}, #${aw} {\n height: 100%;\n }\n #${dw} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${dw}">\n <div id="${aw}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(aw),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(dw)}})),lw="descope-modal",uw=Li((e=>{var t,n;const o=Ai(K$,cw,sw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends ts{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(lw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([lw]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),hw="descope-notification";Li((e=>{var t,n;const o=Ai(K$,cw,sw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends rs{setContent(t){const n="string"==typeof t?Di(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(hw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(h(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([hw])}},t=new WeakMap,n}));const pw=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',fw=Li((e=>{var t,n,o,r,i,s,a,d,c;const l=Ai(G$({theme:pw}),Z$,K$,sw,Y$,cw,H$)(e);return c=class extends l{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),h(this,t,"m",i).call(this),h(this,t,"m",s).call(this),h(this,t,"m",a).call(this),h(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{h(this,t,"m",a).call(this),h(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(tw)))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(tw),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return h(this,n,"f")||(p(this,n,h(this,t,"m",o).call(this),"f"),h(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),h(this,n,"f")},i=async function(){var e,n;const o=await h(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await h(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},c})),gw=e=>Li((t=>{const n=A$(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(Ai(V$)(t)){constructor(...e){super(...e);const t=function(e){const t=g$(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!gs(n))throw new Error("production"===process.env.NODE_ENV?L$(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=$s(n)}if(!b$&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?L$(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!b$&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?L$(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!b$&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?L$(4):"each middleware provided to configureStore must be a function");let c=ws;r&&(c=Qb({trace:!b$,..."object"==typeof r&&r}));const l=Es(...d),u=y$(l);if(!b$&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?L$(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!b$&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?L$(6):"`enhancers` callback must return an array");if(!b$&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?L$(7):"each enhancer provided to configureStore must be a function");return b$||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),ys(a,i,c(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{I$(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));Li((e=>class extends(V$(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()}}));const mw=Li((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}})),vw=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var yw,bw,$w,ww,Ew,kw,Cw,xw,Ow,Sw;const Iw=document.createElement("template");Iw.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class jw extends HTMLElement{constructor(){var e;super(),yw.add(this),bw.set(this,new Gi({messages:[]})),$w.set(this,void 0),ww.set(this,void 0),Ew.set(this,void 0),kw.set(this,{resize:h(this,yw,"m",Sw).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Iw.content.cloneNode(!0)),p(this,$w,this.shadowRoot.querySelector(".debugger"),"f"),p(this,ww,h(this,$w,"f").querySelector(".content"),"f"),p(this,Ew,h(this,$w,"f").querySelector(".header"),"f")}updateData(e){h(this,bw,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=vw(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function c(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=c:e.onmousedown=c})(h(this,$w,"f"),h(this,Ew,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,kw,"f").resize),(e=h(this,$w,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},h(this,$w,"f").onresize=h(this,yw,"m",Ow).bind(this),h(this,bw,"f").subscribe(h(this,yw,"m",Cw).bind(this))}disconnectedCallback(){h(this,bw,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,kw,"f").resize)}}bw=new WeakMap,$w=new WeakMap,ww=new WeakMap,Ew=new WeakMap,kw=new WeakMap,yw=new WeakSet,Cw=function(e){h(this,yw,"m",xw).call(this,e),h(this,yw,"m",Ow).call(this)},xw=function(e){h(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("")},Ow=function(){h(this,ww,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},Sw=function(){const[e,t]=vw(h(this,$w,"f"),Number.parseInt(h(this,$w,"f").style.left,10),Number.parseInt(h(this,$w,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,$w,"f").style.top=`${t}px`,h(this,$w,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",jw);var Rw=Object.freeze({__proto__:null});const Nw=e=>e.me.data,Mw=xa(Nw,(e=>e.picture)),Aw=xa(Nw,(e=>e.email)),Dw=xa(Nw,(e=>e.verifiedEmail)),Tw=xa(Nw,(e=>e.name)),Pw=xa(Nw,(e=>e.phone)),Uw=xa(Nw,(e=>e.verifiedPhone)),_w=xa(Nw,(e=>e.webauthn));xa(Nw,(e=>e.password));const Ww=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)}))}))},Lw=S$("users/me",((e,{extra:{api:t}})=>t.user.me())),Fw=Ww(Lw)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(Vw=e=>e.me,{onFulfilled:e=>{Vw(e).loading=!1},onPending:e=>{Vw(e).loading=!0,Vw(e).error=null},onRejected:(e,t)=>{Vw(e).loading=!1,Vw(e).error=t.error}}));var Vw;const qw={action:Lw,reducer:Fw},Bw=S$("users/logout",((e,{extra:{api:t}})=>t.user.logout())),zw={action:Bw,reducer:Ww(Bw)({})},Kw={me:{loading:!1,error:null,data:{}}},Hw="/v1/auth/me",Gw=({httpClient:e,mock:t})=>({me:()=>u(void 0,void 0,void 0,(function*(){if(t)return u(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(Hw);return yield(e=>u(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()}))}),Jw=Li((e=>{var t,n,o,r;const i=Ai(J$,H$,V$,X$)(e);return r=class extends i{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 h(this,n,"f")||h(this,t,"m",o).call(this),h(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{h(this,n,"f")&&h(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),p(this,n,((e,t,n)=>{const o=so(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.0.59"}}));return{user:Object.assign(Object.assign({},Gw({httpClient:o.httpClient,mock:t})),{logout:t?()=>u(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},r})),Xw=Li((e=>{const t=Ai(gw({name:"widget",initialState:Kw,reducers:{},extraReducers:e=>{qw.reducer(e),zw.reducer(e)},asyncActions:{getMe:qw.action,logout:zw.action}}),K$,V$,Jw)(e);return class extends t{constructor(...e){super(...e),this.state=Kw,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Zw=Li((e=>{const t=Ai(Z$,G$({"widget-id":G$.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Yw=Li((e=>{var t,n,o;return o=class extends(Ai(V$,K$,sw,cw,Zw,Xw)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([this.actions.getMe(),h(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=Di(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Qw=(e={})=>{const t=Di("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),n)})),t};function eE(e){return new URLSearchParams(window.location.search).get(e)}const tE=Li((e=>{var t,n,o,r,i,s,a,d,c;return c=class extends(Ai(Xw,V$,Yw,uw,mw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,Ui((e=>{this.avatar.image=e}))),d.set(this,Ui((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",s).call(this),h(this,t,"m",r).call(this),h(this,a,"f").call(this,Mw(this.state)),h(this,d,"f").call(this,Tw(this.state)),this.subscribe(h(this,a,"f").bind(this),Mw),this.subscribe(h(this,d,"f").bind(this),Tw)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){p(this,n,this.createModal({"data-id":"update-pic"}),"f"),p(this,o,new ls((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",i).bind(this),h(this,t,"m",i).call(this)},i=function(){h(this,n,"f").setContent(Qw({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new as((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{h(this,n,"f").open()}))},c})),nE=Li((e=>{var t,n,o,r,i,s,a,d,c,l,f,g,m;return m=class extends(Ai(Xw,V$,Yw,uw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),f.set(this,Ui((e=>{this.emailUserAttr.value=e}))),g.set(this,Ui((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",l).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,f,"f").call(this,Aw(this.state)),h(this,g,"f").call(this,Dw(this.state)),this.subscribe(h(this,f,"f").bind(this),Aw),this.subscribe(h(this,g,"f").bind(this),Dw)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){p(this,n,this.createModal({"data-id":"edit-email"}),"f"),p(this,o,new ls((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",a).bind(this),h(this,t,"m",a).call(this)},a=function(){h(this,n,"f").setContent(Qw({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},d=function(){p(this,r,this.createModal({"data-id":"delete-email"}),"f"),p(this,i,new ls((()=>{var e;return null===(e=h(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,r,"f").afterClose=h(this,t,"m",c).bind(this),h(this,t,"m",c).call(this)},c=function(){h(this,r,"f").setContent(Qw({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.emailUserAttr=new ds((()=>{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((()=>{h(this,n,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{h(this,r,"f").open()}))},m})),oE=Li((e=>{var t,n,o,r,i,s,a,d,c,l,f,g;return g=class extends(Ai(Xw,V$,Yw,uw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),f.set(this,Ui((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",l).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,f,"f").call(this,Tw(this.state)),this.subscribe(h(this,f,"f").bind(this),Tw)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,f=new WeakMap,t=new WeakSet,s=function(){p(this,n,this.createModal({"data-id":"edit-name"}),"f"),p(this,o,new ls((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",a).bind(this),h(this,t,"m",a).call(this)},a=function(){h(this,n,"f").setContent(Qw({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},d=function(){p(this,r,this.createModal({"data-id":"delete-name"}),"f"),p(this,i,new ls((()=>{var e;return null===(e=h(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,r,"f").afterClose=h(this,t,"m",c).bind(this),h(this,t,"m",c).call(this)},c=function(){h(this,r,"f").setContent(Qw({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.nameUserAttr=new ds((()=>{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((()=>{h(this,n,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{h(this,r,"f").open()}))},g})),rE=Li((e=>{var t,n,o,r,i,s,a,d,c,l,f,g,m;return m=class extends(Ai(Xw,V$,Yw,uw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),f.set(this,Ui((e=>{this.phoneUserAttr.value=e}))),g.set(this,Ui((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",l).call(this),h(this,t,"m",s).call(this),h(this,t,"m",d).call(this),h(this,f,"f").call(this,Pw(this.state)),h(this,g,"f").call(this,Uw(this.state)),this.subscribe(h(this,f,"f").bind(this),Pw),this.subscribe(h(this,g,"f").bind(this),Uw)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,f=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){p(this,n,this.createModal({"data-id":"edit-phone"}),"f"),p(this,o,new ls((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",a).bind(this),h(this,t,"m",a).call(this)},a=function(){h(this,n,"f").setContent(Qw({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},d=function(){p(this,r,this.createModal({"data-id":"delete-phone"}),"f"),p(this,i,new ls((()=>{var e;return null===(e=h(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,r,"f").afterClose=h(this,t,"m",c).bind(this),h(this,t,"m",c).call(this)},c=function(){h(this,r,"f").setContent(Qw({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.phoneUserAttr=new ds((()=>{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((()=>{h(this,n,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{h(this,r,"f").open()}))},m})),iE=Li((e=>{var t,n,o,r,i,s,a,d;return d=class extends(Ai(Xw,V$,Yw,uw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,Ui((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",s).call(this),h(this,t,"m",r).call(this),h(this,a,"f").call(this,_w(this.state)),this.subscribe(h(this,a,"f").bind(this),_w)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){p(this,n,this.createModal({"data-id":"passkey"}),"f"),p(this,o,new ls((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",i).bind(this),h(this,t,"m",i).call(this)},i=function(){h(this,n,"f").setContent(Qw({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new cs((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{h(this,n,"f").open()}))},d})),sE=Li((e=>{var t,n,o,r,i,s,a;return a=class extends(Ai(Xw,V$,Yw,uw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),h(this,t,"m",s).call(this),h(this,t,"m",r).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,r=function(){p(this,n,this.createModal({"data-id":"password"}),"f"),p(this,o,new ls((()=>{var e;return null===(e=h(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),h(this,n,"f").afterClose=h(this,t,"m",i).bind(this),h(this,t,"m",i).call(this)},i=function(){h(this,n,"f").setContent(Qw({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new cs((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{h(this,n,"f").open()}))},a})),aE=Li((e=>{var t,n,o;return o=class extends(Ai(Xw,V$,Yw,uw)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),h(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Qi((()=>{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((()=>u(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),dE="widget-flow",cE=Li((e=>{var t,n,o;return o=class extends(Ai(K$,uw,Xw,V$)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this);const r=eE(dE);r&&(function(e){if(window.history.replaceState&&eE(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())}}(dE),h(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Qw({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));const n=new ls((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger});n.onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},o})),lE=Li((e=>class extends(Ai(Q$,fw,cE,nE,tE,oE,rE,iE,sE,aE)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),uE=Ai((e=>class extends(lE(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),Ni.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.59"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",uE);var hE=Object.freeze({__proto__:null,default:uE});const pE=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var fE,gE,mE,vE,yE,bE,$E,wE,EE,kE;const CE=document.createElement("template");CE.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class xE extends HTMLElement{constructor(){super(),fE.add(this),gE.set(this,new Er({messages:[]})),mE.set(this,void 0),vE.set(this,void 0),yE.set(this,void 0),bE.set(this,{resize:h(this,fE,"m",kE).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(CE.content.cloneNode(!0)),p(this,mE,this.shadowRoot.querySelector(".debugger"),"f"),p(this,vE,h(this,mE,"f").querySelector(".content"),"f"),p(this,yE,h(this,mE,"f").querySelector(".header"),"f")}updateData(e){h(this,gE,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=pE(e,e.offsetLeft-o,e.offsetTop-r,n);e.style.top=`${d}px`,e.style.left=`${a}px`}function d(){document.onmouseup=null,document.onmousemove=null}function c(e){e.preventDefault(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=c:e.onmousedown=c})(h(this,mE,"f"),h(this,yE,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,bE,"f").resize),(e=h(this,mE,"f")).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},h(this,mE,"f").onresize=h(this,fE,"m",EE).bind(this),h(this,gE,"f").subscribe(h(this,fE,"m",$E).bind(this))}disconnectedCallback(){h(this,gE,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,bE,"f").resize)}}gE=new WeakMap,mE=new WeakMap,vE=new WeakMap,yE=new WeakMap,bE=new WeakMap,fE=new WeakSet,$E=function(e){h(this,fE,"m",wE).call(this,e),h(this,fE,"m",EE).call(this)},wE=function(e){h(this,vE,"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("")},EE=function(){h(this,vE,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},kE=function(){const[e,t]=pE(h(this,mE,"f"),Number.parseInt(h(this,mE,"f").style.left,10),Number.parseInt(h(this,mE,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,mE,"f").style.top=`${t}px`,h(this,mE,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",xE);var OE=Object.freeze({__proto__:null,default:xE});e.AccessKeyManagement=Eo,e.AuditManagement=Co,e.AuthProvider=({projectId:e,baseUrl:n="",baseStaticUrl:s="",sessionTokenViaCookie:d=!1,persistTokens:c=!0,storeLastAuthenticatedUser:l=!0,children:u})=>{const[h,p]=t.useState(),[f,g]=t.useState(),[m,v]=t.useState(!1),[y,b]=t.useState(!1),$=(({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,storeLastAuthenticatedUser:i})=>t.useMemo((()=>{if(e)return co({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:a,persistTokens:o,storeLastAuthenticatedUser:i,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:c,sessionTokenViaCookie:d,storeLastAuthenticatedUser:l});t.useEffect((()=>{if($){const e=$.onSessionTokenChange(g),t=$.onUserChange(p);return()=>{e(),t()}}}),[$]);const w=t.useRef(!1),E=t.useCallback((()=>{w.current||(w.current=!0,b(!0),i(null==$?void 0:$.refresh)().then((()=>{b(!1)})))}),[$]),k=t.useCallback((()=>{v(!0),i($.me)().then((()=>{v(!1)}))}),[$]),C=t.useMemo((()=>({fetchUser:k,user:h,isUserLoading:m,fetchSession:E,session:f,isSessionLoading:y,isSessionFetched:w.current,projectId:e,baseUrl:n,baseStaticUrl:s,storeLastAuthenticatedUser:l,setUser:p,setSession:g,sdk:$})),[k,h,m,E,f,y,w.current,e,n,s,p,g,$]);return o.default.createElement(r.Provider,{value:C},u)},e.Descope=mo,e.RoleManagement=$o,e.SignInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=yo,e.UserProfile=Oo,e.baseHeaders=a,e.getJwtPermissions=po,e.getJwtRoles=fo,e.getRefreshToken=ho,e.getSessionToken=uo,e.isRefreshTokenExpired=(e=ho())=>null==ao?void 0:ao.isJwtExpired(e),e.isSessionTokenExpired=(e=uo())=>null==ao?void 0:ao.isJwtExpired(e),e.refresh=(e=ho())=>null==ao?void 0:ao.refresh(e),e.useDescope=()=>{const{sdk:e}=So();return t.useMemo((()=>e||new Proxy(lo(),jo)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:o,isSessionFetched:r}=So(),i=t.useRef(n);t.useMemo((()=>{i.current=n}),[n]);const s=!e&&!n;return t.useMemo((()=>{s&&!r&&(i.current=!0)}),[r]),t.useEffect((()=>{s&&o()}),[o]),{isSessionLoading:i.current,sessionToken:e,isAuthenticated:!!e}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:o,session:r}=So(),[i,s]=t.useState(!1),a=t.useRef(o),d=t.useMemo((()=>!e&&!o&&r&&!i),[n,r,i]);return t.useMemo((()=>{a.current=o}),[o]),t.useMemo((()=>{d&&(a.current=!0)}),[d]),t.useEffect((()=>{d&&(s(!0),n())}),[d]),{isUserLoading:a.current,user:e}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
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";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);const r=o.default.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)},s=e=>(...t)=>{let n;try{n=e(...t)}catch(e){console.error(e)}return n},a={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.0.41"},d="undefined"!=typeof window;var l=function(){return l=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},l.apply(this,arguments)};function c(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function u(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{d(o.next(e))}catch(e){i(e)}}function a(e){try{d(o.throw(e))}catch(e){i(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((o=o.apply(e,t||[])).next())}))}function h(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function p(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function f(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!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"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function g(e){this.message=e}"function"==typeof SuppressedError&&SuppressedError,g.prototype=new Error,g.prototype.name="InvalidCharacterError";var m="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new g("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,r=0,i=0,s="";o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?s+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function v(e){this.message=e}function b(e,t){if("string"!=typeof e)throw new v("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(m(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return m(t)}}(e.split(".")[n]))}catch(e){throw new v("Invalid token specified: "+e.message)}}v.prototype=new Error,v.prototype.name="InvalidTokenError";var y="/v1/auth/accesskey/exchange",w="/v1/auth/otp/verify",$="/v1/auth/otp/signin",E="/v1/auth/otp/signup",k={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},C="/v1/auth/otp/signup-in",x="/v1/auth/magiclink/verify",I="/v1/auth/magiclink/signin",O="/v1/auth/magiclink/signup",S={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},j="/v1/auth/magiclink/signup-in",A="/v1/auth/enchantedlink/verify",R="/v1/auth/enchantedlink/signin",N="/v1/auth/enchantedlink/signup",M="/v1/auth/enchantedlink/pending-session",U={email:"/v1/auth/enchantedlink/update/email"},T="/v1/auth/enchantedlink/signup-in",D="/v1/auth/oauth/authorize",P="/v1/auth/oauth/exchange",L="v1/auth/oauth/native/start",_="v1/auth/oauth/native/finish",W="/v1/auth/saml/authorize",F="/v1/auth/saml/exchange",V="/v1/auth/totp/verify",q="/v1/auth/totp/signup",B="/v1/auth/totp/update",z="/v1/auth/notp/whatsapp/signin",K="/v1/auth/notp/whatsapp/signup",H="/v1/auth/notp/whatsapp/signup-in",G="/v1/auth/notp/pending-session",J={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},Z={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},X={start:"/v1/auth/webauthn/signup-in/start"},Y={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Q="/v1/auth/password/signup",ee="/v1/auth/password/signin",te="/v1/auth/password/reset",ne="/v1/auth/password/update",oe="/v1/auth/password/replace",re="/v1/auth/password/policy",ie="/v1/auth/refresh",se="/v1/auth/tenant/select",ae="/v1/auth/logout",de="/v1/auth/logoutall",le="/v1/auth/me",ce="/v1/auth/me/history",ue="/v1/flow/start",he="/v1/flow/next";const pe="<region>",fe=`https://api.${pe}descope.com`,ge=6e5,me=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var ve;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(ve||(ve={}));const be=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(pe,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},ye=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),we=e=>void 0===e?void 0:JSON.stringify(e),$e=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Ee=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...t)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>me().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return me().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:c,headers:u,queryParams:h,method:p,token:f}=d,g={headers:ye($e(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.19.2"},(null==n?void 0:n.baseHeaders)||{},u),method:p,body:we(c)};null!==i&&(g.credentials=i||"include");const m=await a(be({path:l,baseUrl:e,queryParams:h,projectId:t}),g);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==m?void 0:m.clone()),null==r?void 0:r.transformResponse){const e=await m.json(),t=((null===(s=m.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},m),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return m};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:ve.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:ve.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:ve.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:ve.delete,token:o}),hooks:r,buildUrl:(n,o)=>be({projectId:t,baseUrl:e,path:n,queryParams:o})}};var ke=429;function Ce(e,t,n){var o;let r=xe(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function xe(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return b(e)}function Ie(e){const{exp:t}=xe(e);return(new Date).getTime()/1e3>t}function Oe(e){let t=xe(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Se(e,t){return Ce(e,t,"permissions")}function je(e,t){return Ce(e,t,"roles")}const Ae=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Re(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===ke&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Ne=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Me=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ue=e=>t=>e.test(t),Te=Ue(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),De=Ue(/^\+[1-9]{1}[0-9]{3,14}$/),Pe=Ne(Te,'"{val}" is not a valid email'),Le=Ne(De,'"{val}" is not a valid phone number'),_e=Ne((1,e=>e.length>=1),"Minimum length is 1");const We=Ne((e=>"string"==typeof e),"Input is not a string"),Fe=Ne((e=>void 0===e),"Input is defined"),Ve=(qe=[We(),Fe()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=qe.filter((e=>e(t)));return!(n.length<qe.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var qe;const Be=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Me(...e).validate(n[t]))),t(...n)),ze=e=>[We(`"${e}" must be a string`)],Ke=e=>[We(`"${e}" must be a string`),_e(`"${e}" must not be empty`)],He=e=>[We(`"${e}" must be a string`),Pe()],Ge=e=>[We(`"${e}" must be a string`),Le()],Je=Be(Ke("accessKey")),Ze=e=>({exchange:Je(((t,n)=>Re(e.post(y,{loginOptions:n},{token:t}))))}),Xe=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),Ye=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||ge,ge)});var Qe,et;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Qe||(Qe={})),function(e){e.email="email"}(et||(et={}));const tt=Object.assign(Object.assign({},Qe),et);var nt;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(nt||(nt={}));const ot=Ke("loginId"),rt=Be(Ke("token")),it=Be(ot),st=Be(Ke("pendingRef")),at=Be(ot,He("email")),dt=e=>({verify:rt((t=>Re(e.post(A,{token:t})))),signIn:it(((t,n,o,r)=>Re(e.post(Ae(R,tt.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:it(((t,n,o)=>Re(e.post(Ae(T,tt.email),{loginId:t,URI:n,loginOptions:o})))),signUp:it(((t,n,o,r)=>Re(e.post(Ae(N,tt.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:st(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Ye(n);let s;const a=setInterval((async()=>{const n=await e.post(M,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:at(((t,n,o,r,i)=>Re(e.post(U.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),lt=Be(Ke("flowId")),ct=Be(Ke("executionId"),Ke("stepId"),Ke("interactionId")),ut=e=>({start:lt(((t,n,o,r,i,s,a)=>Re(e.post(ue,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:ct(((t,n,o,r,i,s)=>Re(e.post(he,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),ht=Ke("loginId"),pt=Be(Ke("token")),ft=Be(ht),gt=Be(ht,Ge("phone")),mt=Be(ht,He("email")),vt=Object.keys(tt).filter((e=>e!==Qe.voice)),bt=e=>({verify:pt((t=>Re(e.post(x,{token:t})))),signIn:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i)=>Re(e.post(Ae(I,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r,i)=>Re(e.post(Ae(O,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:vt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ft(((t,o,r)=>Re(e.post(Ae(j,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:mt(((t,n,o,r,i)=>Re(e.post(S.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Qe).filter((e=>e!==Qe.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:gt(((t,o,r,i,s)=>Re(e.post(Ae(S.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var yt;!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"}(yt||(yt={}));const wt=Be(Ke("code")),$t=e=>({start:Object.assign(((t,n,o,r)=>Re(e.post(D,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(yt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>Re(e.post(D,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:wt((t=>Re(e.post(P,{code:t})))),startNative:(t,n)=>Re(e.post(L,{provider:t,loginOptions:n})),finishNative:(t,n,o,r,i)=>Re(e.post(_,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),Et=Ke("loginId"),kt=Be(Et,Ke("code")),Ct=Be(Et),xt=Be(Et,Ge("phone")),It=Be(Et,He("email")),Ot=e=>({verify:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o)=>Re(e.post(Ae(w,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o,r)=>Re(e.post(Ae($,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o,r)=>Re(e.post(Ae(E,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct(((t,o)=>Re(e.post(Ae(C,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:It(((t,n,o,r)=>Re(e.post(k.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xt(((t,o,r,i)=>Re(e.post(Ae(k.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),St=Be(Ke("tenant")),jt=Be(Ke("code")),At=e=>({start:St(((t,n,o,r)=>Re(e.post(W,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:jt((t=>Re(e.post(F,{code:t}))))}),Rt=Ke("loginId"),Nt=Be(Rt,Ke("code")),Mt=Be(Rt),Ut=Be(Rt),Tt=e=>({signUp:Mt(((t,n)=>Re(e.post(q,{loginId:t,user:n})))),verify:Nt(((t,n,o,r)=>Re(e.post(V,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Ut(((t,n)=>Re(e.post(B,{loginId:t},{token:n}))))}),Dt=Ke("loginId"),Pt=Ke("newPassword"),Lt=Be(Dt,Ke("password")),_t=Be(Dt),Wt=Be(Dt,Pt),Ft=Be(Dt,Ke("oldPassword"),Pt),Vt=e=>({signUp:Lt(((t,n,o,r)=>Re(e.post(Q,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Lt(((t,n,o)=>Re(e.post(ee,{loginId:t,password:n,loginOptions:o})))),sendReset:_t(((t,n,o)=>Re(e.post(te,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Wt(((t,n,o)=>Re(e.post(ne,{loginId:t,newPassword:n},{token:o})))),replace:Ft(((t,n,o)=>Re(e.post(oe,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Re(e.get(re))}),qt=ze("loginId"),Bt=Ke("loginId"),zt=Ke("origin"),Kt=Be(Bt,zt,Ke("name")),Ht=Be(Bt,zt),Gt=Be(qt,zt),Jt=Be(Bt,zt,Ke("token")),Zt=Be(Ke("transactionId"),Ke("response")),Xt=e=>({signUp:{start:Kt(((t,n,o)=>Re(e.post(J.start,{user:{loginId:t,name:o},origin:n})))),finish:Zt(((t,n)=>Re(e.post(J.finish,{transactionId:t,response:n}))))},signIn:{start:Gt(((t,n,o,r)=>Re(e.post(Z.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Zt(((t,n)=>Re(e.post(Z.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Ht(((t,n)=>Re(e.post(X.start,{loginId:t,origin:n}))))},update:{start:Jt(((t,n,o)=>Re(e.post(Y.start,{loginId:t,origin:n},{token:o})))),finish:Zt(((t,n)=>Re(e.post(Y.finish,{transactionId:t,response:n}))))}}),Yt=ze("loginId"),Qt=Be(Yt),en=Be(Ke("pendingRef")),tn=e=>({signUpOrIn:Qt(((t,n)=>Re(e.post(H,{loginId:t,loginOptions:n})))),signUp:Qt(((t,n,o)=>Re(e.post(K,{loginId:t,user:n,loginOptions:o})))),signIn:Qt(((t,n,o)=>Re(e.post(z,{loginId:t,loginOptions:n},{token:o})))),waitForSession:en(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Ye(n);let s;const a=setInterval((async()=>{const n=await e.post(G,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Re(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),nn=Be(Ke("token")),on=Be([Ve('"token" must be string or undefined')]);var rn,sn=Be([("projectId",rn=Ke("projectId"),Ne(((e,t)=>n=>Me(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",rn))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=Ee({baseUrl:n||fe,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Ze(a),otp:Ot(a),magicLink:bt(a),enchantedLink:dt(a),oauth:$t(a),saml:At(a),totp:Tt(a),notp:tn(a),webauthn:Xt(a),password:Vt(a),flow:ut(a),refresh:on((e=>Re(a.post(ie,{},{token:e})))),selectTenant:Be([We("tenantId")],[Ve('"token" must be string or undefined')])(((e,t)=>Re(a.post(se,{tenant:e},{token:t})))),logout:on((e=>Re(a.post(ae,{},{token:e})))),logoutAll:on((e=>Re(a.post(de,{},{token:e})))),me:on((e=>Re(a.get(le,{token:e})))),history:on((e=>Re(a.get(ce,{token:e})))),isJwtExpired:nn(Ie),getTenants:nn(Oe),getJwtPermissions:nn(Se),getJwtRoles:nn(je),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);(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}}))})),an=Object.assign(sn,{DeliveryMethods:tt});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ln={exports:{}};
|
|
2
|
+
/*! js-cookie v3.0.5 | MIT */!function(e,t){e.exports=function(){function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+s}}function i(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=n.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}}return Object.create({set:r,get:i,remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}return 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:"/"})}()}(ln);var cn=dn(ln.exports);var un={default:"endpoint"},hn="Blocked by CSP",pn="The endpoint parameter is not a valid URL",fn="Failed to load the JS script of the agent",gn="9319";var mn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",vn=mn;function bn(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(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:mn,a=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),d=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.9.6"):e}))}(String(e),t)}))}(s,r);return function(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=h([],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),i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===hn||s===pn)n.exclude(),i=0;else if(s===gn)n.exclude();else if(s===fn){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),d=a[0],l=a[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var c=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return c(r)}))}))};return c(d).then((function(e){return[e,s]}))}(e,yn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===gn?new Error(fn):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(l(l({},i),{ldi:{attempts:n,visibilityStates:d}}))}))}function yn(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,d())};i.addEventListener(s,a);var d=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return d(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(d(),r)return function(){throw new Error(hn)}();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(pn);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(fn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(wn)}function wn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(gn);return n}const $n=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},En=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},kn=async e=>{const t=await En(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Cn="undefined"!=typeof localStorage,xn=(e,t)=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),In=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),On=e=>Cn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Sn=(...e)=>{console.debug(...e)},jn="undefined"!=typeof window,An=Math.pow(2,31)-1,Rn="DS",Nn="DSR";function Mn(e=""){return In(`${e}${Nn}`)||""}function Un(e=""){On(`${e}${Nn}`),On(`${e}${Rn}`),cn.remove(Rn)}const Tn=jn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Dn="fp",Pn=(e=!1)=>{const t=localStorage.getItem(Dn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Ln=async(e,t=Tn)=>{try{if(Pn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=bn({apiKey:e,endpoint:[o.toString(),un],scriptUrlPattern:[i,vn]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Dn,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},_n=e=>{const t=Pn(!0);return t&&e.body&&(e.body.fpData=t),e},Wn="dls_last_user_login_id",Fn="dls_last_user_display_name",Vn=()=>In(Wn),qn=()=>In(Fn),Bn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Vn(),i=qn();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},zn=e=>async(...t)=>{const n=await e(...t);return On(Wn),On(Fn),n};function Kn(){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 Hn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),n.publicKey.user.id=Qn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:eo(n.rawId),type:n.type,response:{attestationObject:eo(n.response.attestationObject),clientDataJSON:eo(n.response.clientDataJSON)}});var n}async function Gn(e){const t=Xn(e);return Yn(await navigator.credentials.get(t))}async function Jn(e,t){const n=Xn(e);return n.signal=t.signal,n.mediation="conditional",Yn(await navigator.credentials.get(n))}async function Zn(e=!1){if(!jn)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Xn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Qn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Qn(e.id)})),n}function Yn(e){return JSON.stringify({id:e.id,rawId:eo(e.rawId),type:e.type,response:{authenticatorData:eo(e.response.authenticatorData),clientDataJSON:eo(e.response.clientDataJSON),signature:eo(e.response.signature),userHandle:e.response.userHandle?eo(e.response.userHandle):void 0}})}function Qn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function eo(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var to,no=(to=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await Gn(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await Hn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Gn(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await Hn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Hn,get:Gn,isSupported:Zn,conditional:Jn}}),(...e)=>{const t=to(...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 oo="/fedcm/config",ro=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:l}=s.data,c=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")}}))}();return new Promise((t=>{var o,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+oo),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>jn&&"IdentityCredential"in window});var io=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Zn(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const so=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=c(t,["fpKey","fpLoad"]);return jn?(n&&o&&Ln(n).catch((()=>null)),e($n(r,{beforeRequest:_n}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=c(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;jn&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Sn("Expiration time passed, refreshing session"),d.refresh(Mn()||a))}));const d=e($n(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await En(t);if(401===(null==t?void 0:t.status))Sn("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=b(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void Sn("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>An&&(Sn(`Timeout is too large (${e}ms), setting it to ${An}ms`),e=An),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Sn(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{Sn("Refreshing session due to timer"),d.refresh(Mn()||n)}),e)}var l}}));return Xe(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Sn("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.12.2"},t.baseHeaders)}))),(e=>t=>{const n=Kn(),o=Kn(),r=e($n(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await kn(t);e&&o.pub(e);const{sessionJwt:r}=await En(t);r&&n.pub(r)}}})),i=Xe(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0}=t,o=c(t,["storeLastAuthenticatedUser"]);if(!n)return Object.assign(e(o),{getLastUserLoginId:Vn,getLastUserDisplayName:qn});const r=e($n(o,{afterRequest:async(e,t)=>{var n;const o=await kn(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{xn(Wn,e)})(r),(e=>{xn(Fn,e)})(i))}}));let i=Xe(r,["flow.start"],Bn);return i=Xe(i,["logout","logoutAll"],zn),Object.assign(i,{getLastUserLoginId:Vn,getLastUserDisplayName:qn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!jn)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e($n(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Mn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Un(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&xn(`${n}${Nn}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);cn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(Rn,r,i):xn(`${n}${Rn}`,r))})(await En(t),o,r)}}));var a;const d=Xe(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Un(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Mn(r),getSessionToken:()=>function(e=""){return cn.get(Rn)||In(`${e}${Rn}`)||""}(r)})}))(((...e)=>{const t=an(...e);return Object.assign(Object.assign({},t),{flow:io(t),webauthn:no(t),fedcm:ro(t,e[0].projectId)})}));let ao;const lo=e=>{const t=so(Object.assign({persistTokens:d,autoRefresh:d},e));return ao=t,t},co=()=>lo({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});ao=co();const uo=()=>d?null==ao?void 0:ao.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),ho=()=>d?null==ao?void 0:ao.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),po=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtPermissions(e,t))),fo=s(((e=uo(),t)=>null==ao?void 0:ao.getJwtRoles(e,t)));const go=t.lazy((async()=>((await Promise.resolve().then((function(){return ml}))).default.sdkConfigOverrides={baseHeaders:a,persistTokens:!1,hooks:{get beforeRequest(){return ao.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,baseStaticUrl:r,innerRef:i,tenant:s,theme:a,locale:d,debug:l,redirectUrl:c,client:u,form:h,autoFocus:p,validateOnBlur:f})=>o.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,"base-static-url":r,ref:i,tenant:s,theme:a,locale:d,debug:l,client:u,form:h,"redirect-url":c,"auto-focus":p,"validate-on-blur":f})}))),mo=o.default.forwardRef((({flowId:e,onSuccess:n,onError:i,onReady:s,logger:a,tenant:d,theme:l,locale:c,debug:u,client:h,form:p,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,errorTransformer:b},y)=>{const[w,$]=t.useState(null);t.useImperativeHandle(y,(()=>w));const{projectId:E,baseUrl:k,baseStaticUrl:C,storeLastAuthenticatedUser:x,keepLastAuthenticatedUserAfterLogout:I,sdk:O}=o.default.useContext(r),S=t.useCallback((async e=>{await O.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=w;return null==e||e.addEventListener("success",S),i&&(null==e||e.addEventListener("error",i)),s&&(null==e||e.addEventListener("ready",s)),()=>{i&&(null==e||e.removeEventListener("error",i)),s&&(null==e||e.removeEventListener("ready",s)),null==e||e.removeEventListener("success",S)}}),[w,i,S]),t.useEffect((()=>{const e=w;return null==e||e.addEventListener("success",S),()=>{null==e||e.removeEventListener("success",S)}}),[w,S]),t.useEffect((()=>{const e=w;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[w,i]),t.useEffect((()=>{const e=w;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[w,s]),t.useEffect((()=>{w&&(w.errorTransformer=b)}),[w,b]),t.useEffect((()=>{w&&a&&(w.logger=a)}),[w,a]);const{form:j,client:A}=t.useMemo((()=>({form:JSON.stringify(p||{}),client:JSON.stringify(h||{})})),[p,h]);return o.default.createElement("form",null,o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(go,{projectId:E,flowId:e,baseUrl:k,baseStaticUrl:C,innerRef:$,tenant:d,theme:l,locale:c,debug:u,form:j,client:A,telemetryKey:f,redirectUrl:g,autoFocus:m,validateOnBlur:v,storeLastAuthenticatedUser:x,keepLastAuthenticatedUserAfterLogout:I})))})),vo=t.lazy((async()=>(await Promise.resolve().then((function(){return jm})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),bo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(vo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),yo=t.lazy((async()=>(await Promise.resolve().then((function(){return iy})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),wo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(yo,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),$o=t.lazy((async()=>(await Promise.resolve().then((function(){return V$})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Eo=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement($o,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),ko=t.lazy((async()=>(await Promise.resolve().then((function(){return Dk})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,tenant:i,widgetId:s,theme:a,debug:d})=>o.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":s,"base-url":t,"base-static-url":n,theme:a,tenant:i,debug:d,ref:r})}))),Co=o.default.forwardRef((({logger:e,tenant:n,theme:i,debug:s,widgetId:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(ko,{projectId:u,widgetId:a,baseUrl:h,baseStaticUrl:p,innerRef:c,tenant:n,theme:i,debug:s}))})),xo=t.lazy((async()=>(await Promise.resolve().then((function(){return QO})),{default:({projectId:e,baseUrl:t,baseStaticUrl:n,innerRef:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":i,"base-url":t,"base-static-url":n,theme:s,debug:a,ref:r})}))),Io=o.default.forwardRef((({logger:e,theme:n,debug:i,widgetId:s,onLogout:a},d)=>{const[l,c]=t.useState(null);t.useImperativeHandle(d,(()=>l));const{projectId:u,baseUrl:h,baseStaticUrl:p}=o.default.useContext(r);return t.useEffect((()=>{l&&e&&(l.logger=e)}),[l,e]),t.useEffect((()=>{if(l&&a)return l.addEventListener("logout",a),()=>l.removeEventListener("logout",a)}),[l,a]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(xo,{projectId:u,widgetId:s,baseUrl:h,baseStaticUrl:p,innerRef:c,theme:n,debug:i}))}));var Oo=()=>{const e=t.useContext(r);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const So=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,jo={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],jo);if("function"==typeof e[t])return()=>{throw Error(So("function"))};throw Error(So("attribute"))}};var Ao="/v1/auth/accesskey/exchange",Ro="/v1/auth/otp/verify",No="/v1/auth/otp/signin",Mo="/v1/auth/otp/signup",Uo={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},To="/v1/auth/otp/signup-in",Do="/v1/auth/magiclink/verify",Po="/v1/auth/magiclink/signin",Lo="/v1/auth/magiclink/signup",_o={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},Wo="/v1/auth/magiclink/signup-in",Fo="/v1/auth/enchantedlink/verify",Vo="/v1/auth/enchantedlink/signin",qo="/v1/auth/enchantedlink/signup",Bo="/v1/auth/enchantedlink/pending-session",zo={email:"/v1/auth/enchantedlink/update/email"},Ko="/v1/auth/enchantedlink/signup-in",Ho="/v1/auth/oauth/authorize",Go="/v1/auth/oauth/exchange",Jo="v1/auth/oauth/native/start",Zo="v1/auth/oauth/native/finish",Xo="/v1/auth/saml/authorize",Yo="/v1/auth/saml/exchange",Qo="/v1/auth/totp/verify",er="/v1/auth/totp/signup",tr="/v1/auth/totp/update",nr="/v1/auth/notp/whatsapp/signin",or="/v1/auth/notp/whatsapp/signup",rr="/v1/auth/notp/whatsapp/signup-in",ir="/v1/auth/notp/pending-session",sr={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},ar={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},dr={start:"/v1/auth/webauthn/signup-in/start"},lr={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},cr="/v1/auth/password/signup",ur="/v1/auth/password/signin",hr="/v1/auth/password/reset",pr="/v1/auth/password/update",fr="/v1/auth/password/replace",gr="/v1/auth/password/policy",mr="/v1/auth/refresh",vr="/v1/auth/tenant/select",br="/v1/auth/logout",yr="/v1/auth/logoutall",wr="/v1/auth/me",$r="/v1/auth/me/history",Er="/v1/flow/start",kr="/v1/flow/next";const Cr="<region>",xr=`https://api.${Cr}descope.com`,Ir=6e5,Or=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var Sr;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(Sr||(Sr={}));const jr=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(Cr,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},Ar=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),Rr={"Content-Type":"application/json"},Nr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Mr=e=>{try{e=JSON.parse(e)}catch(e){return!1}return"object"==typeof e&&null!==e},Ur=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...t)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>Or().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return Or().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),d=async o=>{var s;const d=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:c,headers:u,queryParams:h,method:p,token:f}=d,g=(e=>void 0===e?void 0:JSON.stringify(e))(c),m={headers:Ar(Nr(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.21.0"},(null==n?void 0:n.baseHeaders)||{},Mr(g)?Rr:{},u),method:p,body:g};null!==i&&(m.credentials=i||"include");const v=await a(jr({path:l,baseUrl:e,queryParams:h,projectId:t}),m);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==v?void 0:v.clone()),null==r?void 0:r.transformResponse){const e=await v.json(),t=((null===(s=v.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},v),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return v};return{get:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:Sr.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>d({path:e,headers:n,queryParams:o,body:t,method:Sr.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>d({path:e,headers:t,queryParams:n,body:void 0,method:Sr.delete,token:o}),hooks:r,buildUrl:(n,o)=>jr({projectId:t,baseUrl:e,path:n,queryParams:o})}};var Tr=429;function Dr(e,t,n){var o;let r=Pr(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r.dct)===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function Pr(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return b(e)}function Lr(e){const{exp:t}=Pr(e);return(new Date).getTime()/1e3>t}function _r(e){let t=Pr(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Wr(e,t){return Dr(e,t,"permissions")}function Fr(e,t){return Dr(e,t,"roles")}const Vr=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function qr(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===Tr&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Br=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),zr=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Kr=e=>t=>e.test(t),Hr=Kr(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Gr=Kr(/^\+[1-9]{1}[0-9]{3,14}$/),Jr=Br(Hr,'"{val}" is not a valid email'),Zr=Br(Gr,'"{val}" is not a valid phone number'),Xr=Br((1,e=>e.length>=1),"Minimum length is 1");const Yr=Br((e=>"string"==typeof e),"Input is not a string"),Qr=Br((e=>void 0===e),"Input is defined"),ei=(ti=[Yr(),Qr()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=ti.filter((e=>e(t)));return!(n.length<ti.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var ti;const ni=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>zr(...e).validate(n[t]))),t(...n)),oi=e=>[Yr(`"${e}" must be a string`)],ri=e=>[Yr(`"${e}" must be a string`),Xr(`"${e}" must not be empty`)],ii=e=>[Yr(`"${e}" must be a string`),Jr()],si=e=>[Yr(`"${e}" must be a string`),Zr()],ai=ni(ri("accessKey")),di=e=>({exchange:ai(((t,n)=>qr(e.post(Ao,{loginOptions:n},{token:t}))))}),li=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),ci=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||Ir,Ir)});var ui,hi;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(ui||(ui={})),function(e){e.email="email"}(hi||(hi={}));const pi=Object.assign(Object.assign({},ui),hi);var fi;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(fi||(fi={}));const gi=ri("loginId"),mi=ni(ri("token")),vi=ni(gi),bi=ni(ri("pendingRef")),yi=ni(gi,ii("email")),wi=e=>({verify:mi((t=>qr(e.post(Fo,{token:t})))),signIn:vi(((t,n,o,r)=>qr(e.post(Vr(Vo,pi.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:vi(((t,n,o)=>qr(e.post(Vr(Ko,pi.email),{loginId:t,URI:n,loginOptions:o})))),signUp:vi(((t,n,o,r)=>qr(e.post(Vr(qo,pi.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:bi(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=ci(n);let s;const a=setInterval((async()=>{const n=await e.post(Bo,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:yi(((t,n,o,r,i)=>qr(e.post(zo.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),$i=ni(ri("flowId")),Ei=ni(ri("executionId"),ri("stepId"),ri("interactionId")),ki=e=>({start:$i(((t,n,o,r,i,s,a)=>qr(e.post(Er,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:Ei(((t,n,o,r,i,s)=>qr(e.post(kr,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),Ci=ri("loginId"),xi=ni(ri("token")),Ii=ni(Ci),Oi=ni(Ci,si("phone")),Si=ni(Ci,ii("email")),ji=Object.keys(pi).filter((e=>e!==ui.voice)),Ai=e=>({verify:xi((t=>qr(e.post(Do,{token:t})))),signIn:ji.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r,i)=>qr(e.post(Vr(Po,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:ji.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r,i)=>qr(e.post(Vr(Lo,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:ji.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ii(((t,o,r)=>qr(e.post(Vr(Wo,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:Si(((t,n,o,r,i)=>qr(e.post(_o.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(ui).filter((e=>e!==ui.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Oi(((t,o,r,i,s)=>qr(e.post(Vr(_o.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var Ri;!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"}(Ri||(Ri={}));const Ni=ni(ri("code")),Mi=e=>({start:Object.assign(((t,n,o,r)=>qr(e.post(Ho,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(Ri).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>qr(e.post(Ho,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:Ni((t=>qr(e.post(Go,{code:t})))),startNative:(t,n,o)=>qr(e.post(Jo,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>qr(e.post(Zo,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),Ui=ri("loginId"),Ti=ni(Ui,ri("code")),Di=ni(Ui),Pi=ni(Ui,si("phone")),Li=ni(Ui,ii("email")),_i=e=>({verify:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Ti(((t,o)=>qr(e.post(Vr(Ro,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o,r)=>qr(e.post(Vr(No,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o,r)=>qr(e.post(Vr(Mo,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(pi).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Di(((t,o)=>qr(e.post(Vr(To,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:Li(((t,n,o,r)=>qr(e.post(Uo.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(ui).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Pi(((t,o,r,i)=>qr(e.post(Vr(Uo.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Wi=ni(ri("tenant")),Fi=ni(ri("code")),Vi=e=>({start:Wi(((t,n,o,r)=>qr(e.post(Xo,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:Fi((t=>qr(e.post(Yo,{code:t}))))}),qi=ri("loginId"),Bi=ni(qi,ri("code")),zi=ni(qi),Ki=ni(qi),Hi=e=>({signUp:zi(((t,n)=>qr(e.post(er,{loginId:t,user:n})))),verify:Bi(((t,n,o,r)=>qr(e.post(Qo,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Ki(((t,n)=>qr(e.post(tr,{loginId:t},{token:n}))))}),Gi=ri("loginId"),Ji=ri("newPassword"),Zi=ni(Gi,ri("password")),Xi=ni(Gi),Yi=ni(Gi,Ji),Qi=ni(Gi,ri("oldPassword"),Ji),es=e=>({signUp:Zi(((t,n,o,r)=>qr(e.post(cr,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Zi(((t,n,o)=>qr(e.post(ur,{loginId:t,password:n,loginOptions:o})))),sendReset:Xi(((t,n,o)=>qr(e.post(hr,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Yi(((t,n,o)=>qr(e.post(pr,{loginId:t,newPassword:n},{token:o})))),replace:Qi(((t,n,o)=>qr(e.post(fr,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>qr(e.get(gr))}),ts=oi("loginId"),ns=ri("loginId"),os=ri("origin"),rs=ni(ns,os,ri("name")),is=ni(ns,os),ss=ni(ts,os),as=ni(ns,os,ri("token")),ds=ni(ri("transactionId"),ri("response")),ls=e=>({signUp:{start:rs(((t,n,o)=>qr(e.post(sr.start,{user:{loginId:t,name:o},origin:n})))),finish:ds(((t,n)=>qr(e.post(sr.finish,{transactionId:t,response:n}))))},signIn:{start:ss(((t,n,o,r)=>qr(e.post(ar.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:ds(((t,n)=>qr(e.post(ar.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:is(((t,n)=>qr(e.post(dr.start,{loginId:t,origin:n}))))},update:{start:as(((t,n,o)=>qr(e.post(lr.start,{loginId:t,origin:n},{token:o})))),finish:ds(((t,n)=>qr(e.post(lr.finish,{transactionId:t,response:n}))))}}),cs=oi("loginId"),us=ni(cs),hs=ni(ri("pendingRef")),ps=e=>({signUpOrIn:us(((t,n)=>qr(e.post(rr,{loginId:t,loginOptions:n})))),signUp:us(((t,n,o)=>qr(e.post(or,{loginId:t,user:n,loginOptions:o})))),signIn:us(((t,n,o)=>qr(e.post(nr,{loginId:t,loginOptions:n},{token:o})))),waitForSession:hs(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=ci(n);let s;const a=setInterval((async()=>{const n=await e.post(ir,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(qr(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),fs=ni(ri("token")),gs=ni([ei('"token" must be string or undefined')]);var ms,vs=ni([("projectId",ms=ri("projectId"),Br(((e,t)=>n=>zr(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",ms))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=Ur({baseUrl:n||xr,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:di(a),otp:_i(a),magicLink:Ai(a),enchantedLink:wi(a),oauth:Mi(a),saml:Vi(a),totp:Hi(a),notp:ps(a),webauthn:ls(a),password:es(a),flow:ki(a),refresh:gs((e=>qr(a.post(mr,{},{token:e})))),selectTenant:ni([Yr("tenantId")],[ei('"token" must be string or undefined')])(((e,t)=>qr(a.post(vr,{tenant:e},{token:t})))),logout:gs((e=>qr(a.post(br,{},{token:e})))),logoutAll:gs((e=>qr(a.post(yr,{},{token:e})))),me:gs((e=>qr(a.get(wr,{token:e})))),history:gs((e=>qr(a.get($r,{token:e})))),isJwtExpired:fs(Lr),getTenants:fs(_r),getJwtPermissions:fs(Wr),getJwtRoles:fs(Fr),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.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}}))})),bs=Object.assign(vs,{DeliveryMethods:pi});var ys={default:"endpoint"},ws="Blocked by CSP",$s="The endpoint parameter is not a valid URL",Es="Failed to load the JS script of the agent",ks="9319";var Cs="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",xs=Cs;function Is(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(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:Cs,a=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),d=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.9.8"):e}))}(String(e),t)}))}(s,r);return function(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=h([],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),i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===ws||s===$s)n.exclude(),i=0;else if(s===ks)n.exclude();else if(s===Es){var a=Date.now()-e.getTime()<50,d=n.current();d&&a&&!r.has(d)&&(r.add(d),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),d=a[0],l=a[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var c=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return c(r)}))}))};return c(d).then((function(e){return[e,s]}))}(e,Os)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===ks?new Error(Es):e}(e)})).then((function(e){var t=e[0],n=e[1];return u(),t.load(l(l({},i),{ldi:{attempts:n,visibilityStates:d}}))}))}function Os(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,d())};i.addEventListener(s,a);var d=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return d(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(d(),r)return function(){throw new Error(ws)}();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($s);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(Es))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(Ss)}function Ss(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(ks);return n}const js=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},As=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},Rs=async e=>{const t=await As(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},Ns="undefined"!=typeof localStorage,Ms=(e,t)=>Ns&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),Us=e=>Ns&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),Ts=e=>Ns&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Ds=(...e)=>{console.debug(...e)},Ps="undefined"!=typeof window,Ls=Math.pow(2,31)-1,_s="DS",Ws="DSR";function Fs(e=""){return Us(`${e}${Ws}`)||""}function Vs(e=""){Ts(`${e}${Ws}`),Ts(`${e}${_s}`),cn.remove(_s)}const qs=Ps&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Bs="fp",zs=(e=!1)=>{const t=localStorage.getItem(Bs);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Ks=async(e,t=qs)=>{try{if(zs())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=Is({apiKey:e,endpoint:[o.toString(),ys],scriptUrlPattern:[i,xs]}),a=await s,{requestId:d}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,d);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(Bs,JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Hs=e=>{const t=zs(!0);return t&&e.body&&(e.body.fpData=t),e},Gs="dls_last_user_login_id",Js="dls_last_user_display_name",Zs=()=>Us(Gs),Xs=()=>Us(Js),Ys=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Zs(),i=Xs();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)};function Qs(){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 ea(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=sa(n.publicKey.challenge),n.publicKey.user.id=sa(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=sa(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:aa(n.rawId),type:n.type,response:{attestationObject:aa(n.response.attestationObject),clientDataJSON:aa(n.response.clientDataJSON)}});var n}async function ta(e){const t=ra(e);return ia(await navigator.credentials.get(t))}async function na(e,t){const n=ra(e);return n.signal=t.signal,n.mediation="conditional",ia(await navigator.credentials.get(n))}async function oa(e=!1){if(!Ps)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function ra(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=sa(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=sa(e.id)})),n}function ia(e){return JSON.stringify({id:e.id,rawId:aa(e.rawId),type:e.type,response:{authenticatorData:aa(e.response.authenticatorData),clientDataJSON:aa(e.response.clientDataJSON),signature:aa(e.response.signature),userHandle:e.response.userHandle?aa(e.response.userHandle):void 0}})}function sa(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function aa(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var da,la=(da=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await ea(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await ta(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await ea(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await ta(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await ea(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:ea,get:ta,isSupported:oa,conditional:na}}),(...e)=>{const t=da(...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 ca="/fedcm/config",ua=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o,!0);if(!s.ok)return s;const{clientId:a,stateId:d,nonce:l}=s.data,c=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")}}))}();return new Promise((t=>{var o,s;c.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,d,"","",n.credential))},nonce:l})),c.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+ca),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>Ps&&"IdentityCredential"in window});var ha=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await oa(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const pa=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((e=>t=>{var{fpKey:n,fpLoad:o}=t,r=c(t,["fpKey","fpLoad"]);return Ps?(n&&o&&Ks(n).catch((()=>null)),e(js(r,{beforeRequest:Hs}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(r))}),(e=>t=>{var{autoRefresh:n}=t,o=c(t,["autoRefresh"]);if(!n)return e(o);const{clearAllTimers:r,setTimer:i}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let s,a;Ps&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Ds("Expiration time passed, refreshing session"),d.refresh(Fs()||a))}));const d=e(js(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await As(t);if(401===(null==t?void 0:t.status))Ds("Received 401, canceling all timers"),r();else if(o){if(s=(e=>{try{const t=b(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(o),!s)return void Ds("Could not extract expiration time from session token");a=n;let e=((l=s)?l.getTime()-(new Date).getTime():0)-2e4;e>Ls&&(Ds(`Timeout is too large (${e}ms), setting it to ${Ls}ms`),e=Ls),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});Ds(`Setting refresh timer for ${t}. (${e}ms)`),i((()=>{Ds("Refreshing session due to timer"),d.refresh(Fs()||n)}),e)}var l}}));return li(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return Ds("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.14.0"},t.baseHeaders)}))),(e=>t=>{const n=Qs(),o=Qs(),r=e(js(t,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))n.pub(null),o.pub(null);else{const e=await Rs(t);e&&o.pub(e);const{sessionJwt:r}=await As(t);r&&n.pub(r)}}})),i=li(r,["logout","logoutAll"],(e=>async(...t)=>{const r=await e(...t);return n.pub(null),o.pub(null),r}));return Object.assign(i,{onSessionTokenChange:n.sub,onUserChange:o.sub})}),(e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=c(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:Zs,getLastUserDisplayName:Xs});const i=e(js(r,{afterRequest:async(e,t)=>{var n;const o=await Rs(t),r=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],i=null==o?void 0:o.name;r&&((e=>{Ms(Gs,e)})(r),(e=>{Ms(Js,e)})(i))}}));let s=li(i,["flow.start"],Ys);return s=li(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return e||(Ts(Gs),Ts(Js)),o})(o)),Object.assign(s,{getLastUserLoginId:Zs,getLastUserDisplayName:Xs})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=c(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!Ps)return n&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(i);const s=e(js(i,{beforeRequest:(a=r,e=>Object.assign(e,{token:e.token||Fs(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||Vs(r):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:r}=e,i=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&Ms(`${n}${Ws}`,o),r&&(t?function(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);cn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(_s,r,i):Ms(`${n}${_s}`,r))})(await As(t),o,r)}}));var a;const d=li(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return Vs(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Fs(r),getSessionToken:()=>function(e=""){return cn.get(_s)||Us(`${e}${_s}`)||""}(r)})}))(((...e)=>{const t=bs(...e);return Object.assign(Object.assign({},t),{flow:ha(t),webauthn:la(t),fedcm:ua(t,e[0].projectId)})})),fa="undefined"!=typeof localStorage,ga=fa&&localStorage.getItem("base.content.url")||"",ma="config.json",va="base.ui.components.url",ba=fa&&localStorage.getItem(va)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ya=fa&&localStorage.getItem(va)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",wa="descope-login-flow",$a="code",Ea="ra-challenge",ka="ra-callback",Ca="ra-backup-callback",xa="ra-initiator",Ia="data-exclude-field",Oa="dls_last_auth",Sa="state_id",ja="saml_idp_state_id",Aa="saml_idp_username",Ra="descope_idp_initiated",Na="sso_app_id",Ma="oidc_login_hint",Ua="data-type",Ta="poll",Da="webauthnCreate",Pa="submit",La="polling",_a=["descope-multi-select-combo-box","descope-text-area"];var Wa;function Fa(e){return new URLSearchParams(window.location.search).get(e)}function Va(e){if(window.history.replaceState&&Fa(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 qa(e,t){return u(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||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function Ba({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(ga||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function za(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?Wa.forward:n<o?Wa.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(Wa||(Wa={}));const Ka=()=>{const[e="",t=""]=(Fa(wa)||"").split("_");return{executionId:e,stepId:t}};function Ha(){Va(wa)}const Ga=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),Ja=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},Za=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,Xa=e=>null==e?void 0:e.submit(),Ya=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},Qa=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function ed(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var td,nd,od,rd;function id(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!id(i,s))return!1}else if(i!==s)return!1}return!0}class sd{constructor(e={},{updateOnlyOnChange:t=!0}={}){td.set(this,void 0),nd.set(this,{}),od.set(this,0),rd.set(this,!1),this.update=e=>{const t="function"==typeof e?e(p(this,td,"f")):e,n=Object.assign(Object.assign({},p(this,td,"f")),t);if(!p(this,rd,"f")||!id(p(this,td,"f"),n)){const e=p(this,td,"f");f(this,td,n,"f"),Object.freeze(p(this,td,"f")),setTimeout((()=>{Object.values(p(this,nd,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,td,e,"f"),f(this,rd,t,"f")}get current(){return Object.assign({},p(this,td,"f"))}subscribe(e){return f(this,od,p(this,od,"f")+1,"f"),p(this,nd,"f")[p(this,od,"f")]=e,p(this,od,"f").toString()}unsubscribe(e){const t=!!p(this,nd,"f")[e];return t&&delete p(this,nd,"f")[e],t}unsubscribeAll(){return f(this,nd,{},"f"),!0}}td=new WeakMap,nd=new WeakMap,od=new WeakMap,rd=new WeakMap;const ad=["disabled"],dd=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Ia}])`)).forEach((e=>{e.value=n}))}))},ld=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),cd=(e,t,n)=>{e.querySelectorAll(`[${Ua}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},ud=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},hd=Ja((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=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(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),pd={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function fd(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Oa)))}catch(e){}return t}const gd="dls_ab_testing_id",md=document.createElement("template");var vd,bd,yd,wd,$d,Ed,kd,Cd,xd,Id,Od,Sd,jd,Ad,Rd,Nd,Md,Ud,Td,Dd,Pd,Ld,_d,Wd,Fd,Vd,qd,Bd,zd,Kd,Hd,Gd,Jd,Zd,Xd,Yd,Qd,el,tl,nl,ol,rl,il,sl,al,dl,ll,cl,ul,hl,pl;md.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class fl extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","keep-last-authenticated-user-after-logout","validate-on-blur"]}constructor(e){super(),vd.add(this),this.logger=console,bd.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),p(this,vd,"m",zd).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)}},yd.set(this,new sd({deferredRedirect:!1})),wd.set(this,new sd),$d.set(this,{}),this.getComponentsContext=()=>p(this,$d,"f"),this.nextRequestStatus=new sd({isLoading:!1}),Ed.set(this,void 0),kd.set(this,{popstate:p(this,vd,"m",jd).bind(this),visibilitychange:p(this,vd,"m",Ad).bind(this),componentsContext:p(this,vd,"m",Fd).bind(this)}),Cd.set(this,void 0),Td.set(this,Ja((()=>u(this,void 0,void 0,(function*(){const e=Ba({projectId:this.projectId,filename:ma,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield qa(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Pd.set(this,void 0),f(this,Cd,e,"f"),p(this,vd,"m",xd).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){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 theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?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":n||"light"}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 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{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield p(this,Td,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield p(this,Td,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(p(this,wd,"f").subscribe(p(this,vd,"m",Bd).bind(this)),p(this,wd,"f").update({isDebug:this.debug}),p(this,vd,"m",Id).call(this))return void p(this,vd,"m",Od).call(this);if(p(this,vd,"m",Sd).call(this),f(this,Pd,p(this,vd,"m",Dd).call(this),"f"),yield p(this,vd,"m",Md).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");if((yield p(this,Td,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");p(this,vd,"m",Ld).call(this),yield p(this,vd,"m",Gd).call(this),yield p(this,vd,"m",_d).call(this),p(this,vd,"m",Kd).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}=(()=>{const{executionId:e,stepId:t}=Ka();(e||t)&&Ha();const n=Fa("t")||void 0;n&&Va("t");const o=Fa($a)||void 0;o&&Va($a);const r=Fa("err")||void 0;r&&Va("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:Fa(Ea),redirectAuthCallbackUrl:Fa(ka),redirectAuthBackupCallbackUri:Fa(Ca),redirectAuthInitiator:Fa(xa)};(i||s||a||d)&&(Va(Ea),Va(ka),Va(Ca),Va(xa));const l=Fa(Sa);l&&Va(Sa);const c=Fa(ja);c&&Va(ja);const u=Fa(Aa);c&&Va(Aa);const h=Fa(Ra);h&&Va(Ra);const p=Fa(Na);p&&Va(Na);const f=Fa(Ma);return f&&Va(Ma),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}})();window.addEventListener("popstate",p(this,kd,"f").popstate),window.addEventListener("components-context",p(this,kd,"f").componentsContext),window.addEventListener("visibilitychange",p(this,kd,"f").visibilitychange),p(this,yd,"f").subscribe(p(this,vd,"m",Nd).bind(this)),p(this,yd,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}),f(this,bd,!0,"f")}}))}disconnectedCallback(){p(this,yd,"f").unsubscribeAll(),p(this,wd,"f").unsubscribeAll(),p(this,vd,"m",qd).call(this),window.removeEventListener("popstate",p(this,kd,"f").popstate),window.removeEventListener("visibilitychange",p(this,kd,"f").visibilitychange),window.removeEventListener("components-context",p(this,kd,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&p(this,bd,"f")&&t!==n&&fl.observedAttributes.includes(e)){p(this,vd,"m",Sd).call(this);const o=null===t;p(this,yd,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,Ha()),{[Ga(e)]:n,stepId:i,executionId:s}})),p(this,wd,"f").update({isDebug:this.debug})}}}bd=new WeakMap,yd=new WeakMap,wd=new WeakMap,$d=new WeakMap,Ed=new WeakMap,kd=new WeakMap,Cd=new WeakMap,Td=new WeakMap,Pd=new WeakMap,vd=new WeakSet,xd=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(md.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},Id=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},Od=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)},Sd=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","keep-last-authenticated-user-after-logout","preview","storage-prefix","form","client","validate-on-blur"];if(fl.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[Ga(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},jd=function(){const{stepId:e,executionId:t}=Ka();p(this,yd,"f").update({stepId:e,executionId:t})},Ad=function(){document.hidden||setTimeout((()=>{p(this,yd,"f").update({deferredRedirect:!1})}),300)},Rd=function(e,t){this.sdk=pa(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser,keepLastAuthenticatedUserAfterLogout:this.keepLastAuthenticatedUserAfterLogout},fl.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},Nd=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;p(this,vd,"m",Rd).call(this,t,o)}p(this,Cd,"f").call(this,e)}))},Md=function(){return u(this,void 0,void 0,(function*(){return(yield p(this,Td,"f").call(this)).isMissingConfig&&(yield p(this,vd,"m",Ud).call(this))}))},Ud=function(){return u(this,void 0,void 0,(function*(){const e=Ba({projectId:this.projectId,filename:ma,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield qa(e,"json"),!0}catch(e){return!1}}))},Dd=function(){return u(this,void 0,void 0,(function*(){const e=Ba({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield qa(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},Ld=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield p(this,Td,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},_d=function(){return u(this,void 0,void 0,(function*(){yield p(this,vd,"m",Wd).call(this),yield p(this,vd,"m",Vd).call(this)}))},Wd=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield p(this,Pd,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield fl.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},Fd=function(e){f(this,$d,Object.assign(Object.assign({},p(this,$d,"f")),e.detail),"f")},Vd=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield fl.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},qd=function(){var e;null===(e=p(this,Ed,"f"))||void 0===e||e.remove(),f(this,Ed,null,"f")},Bd=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(f(this,Ed,document.createElement("descope-debugger"),"f"),Object.assign(p(this,Ed,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return pS})),document.body.appendChild(p(this,Ed,"f"))):p(this,vd,"m",qd).call(this)}))},zd=function(e,t){var n;e&&this.debug&&(null===(n=p(this,Ed,"f"))||void 0===n||n.updateData({title:e,description:t}))},Kd=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=_a.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)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()}}},Hd=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield p(this,Td,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},Gd=function(){return u(this,void 0,void 0,(function*(){fl.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):fl.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield p(this,vd,"m",Hd).call(this),i=t(n(ba,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(ya,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},fl.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.18.0"}};class gl extends fl{static set sdkConfigOverrides(e){fl.sdkConfigOverrides=e}constructor(){const e=new sd;super(e.update.bind(e)),Jd.add(this),this.stepState=new sd({},{updateOnlyOnChange:!1}),Zd.set(this,void 0),Xd.set(this,null),Yd.set(this,((e,t,n,o,r)=>{n===Ta&&f(this,Zd,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,La,o,r,{});p(this,el,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};p(this,Yd,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),Qd.set(this,(()=>{clearTimeout(p(this,Zd,"f")),f(this,Zd,null,"f")})),el.set(this,(e=>{var t,n,o,r,i,s,a,d,l,c,u;if(!(null==e?void 0:e.ok)){p(this,Jd,"m",pl).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}null===(a=null===(s=e.data)||void 0===s?void 0:s.runnerLogs)||void 0===a||a.forEach((e=>this.loggerWrapper.info(e.title,e.log)));const h=null===(c=null===(l=null===(d=e.data)||void 0===d?void 0:d.screen)||void 0===l?void 0:l.state)||void 0===c?void 0:c.errorText;(null===(u=e.data)||void 0===u?void 0:u.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${h?`${h} - `:""}${e.data.error.message}`):h&&this.loggerWrapper.error(h);const{status:f,authInfo:g,lastAuth:m}=e.data;if("completed"===f)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&fa&&localStorage.setItem(Oa,JSON.stringify(e))}(m),void p(this,Jd,"m",pl).call(this,"success",g);const{executionId:v,stepId:b,stepName:y,action:w,screen:$,redirect:E,openInNewTabUrl:k,webauthn:C,error:x,samlIdpResponse:I}=e.data;w!==Ta?(this.loggerWrapper.info(`Step "${y||`#${b}`}" is ${f}`,"",{screen:$,status:f,stepId:b,stepName:y,action:w,error:x}),this.flowState.update({stepId:b,executionId:v,action:w,redirectTo:null==E?void 0:E.url,openInNewTabUrl:k,screenId:null==$?void 0:$.id,screenState:null==$?void 0:$.state,webauthnTransactionId:null==C?void 0:C.transactionId,webauthnOptions:null==C?void 0:C.options,samlIdpResponseUrl:null==I?void 0:I.url,samlIdpResponseSamlResponse:null==I?void 0:I.samlResponse,samlIdpResponseRelayState:null==I?void 0:I.relayState})):this.flowState.update({action:w})})),tl.set(this,Ja((()=>u(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)}}))))),ll.set(this,Qa(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||p(this,Jd,"m",il).call(this)){const o=null==e?void 0:e.getAttribute("id");p(this,Jd,"m",al).call(this,e);const r=yield p(this,Jd,"m",sl).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(o,d.version,l.componentsVersion,a);p(this,el,"f").call(this,c),p(this,Jd,"m",dl).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=p(this,Xd,"f"))||void 0===e||e.abort(),f(this,Xd,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=ed(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield qa(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 qa(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:l,action:c,screenId:u,screenState:h,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:b,code:y,exchangeError:w,webauthnTransactionId:$,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:I,oidcIdpStateId:O,locale:S,samlIdpStateId:j,samlIdpUsername:A,descopeIdpInitiated:R,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,L;const _=(()=>{const e=localStorage.getItem(gd);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(gd,e.toString()),e}return Number(e)})(),W=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(F.fingerprintEnabled&&F.fingerprintKey?yield Ks(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Bs),F.conditions?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=pd[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:W,code:y,token:b,abTestingKey:_},F.conditions)):F.condition?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{var n;const o=null===(n=pd[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:W,code:y,token:b,abTestingKey:_})):P=F.startScreenId,!Za(P,O,j,A,T,D))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,client:this.client},v&&{redirectUrl:v}),{lastAuth:fd(W),abTestingKey:_,locale:ed(S)}),L,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),R&&{idpInitiated:!0}),b?{token:b}:{}),D?{externalId:D}:{}));return p(this,el,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&b||n("code")&&y||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(l,d,Pa,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return p(this,el,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===c&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!N||!M)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{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),o(r)})(N,M,U||"",Xa)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===I&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===Da||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=p(this,Xd,"f"))||void 0===r||r.abort(),f(this,Xd,null,"f");try{e=c===Da?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(l,d,Pa,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});p(this,el,"f").call(this,n)}if(p(this,Yd,"f").call(this,l,d,c,F.version,V.componentsVersion),!u&&!P)return void this.loggerWrapper.warn("No screen was found to show");const B=P||u,z=yield this.getHtmlFilenameWithLocale(S,B),K={direction:za(d,t.stepId),screenState:Object.assign(Object.assign({},h),{form:Object.assign(Object.assign({},this.formConfigValues),null==h?void 0:h.form),lastAuth:{loginId:W,name:this.sdk.getLastUserDisplayName()||W}}),htmlUrl:Ba({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&Ba({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:A,oidcLoginHint:D,openInNewTabUrl:m},H=fd(W);Za(P,O,j,A,T,D)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,lastAuth:H,preview:this.preview,abTestingKey:_,client:this.client},v&&{redirectUrl:v}),{locale:ed(S)}),L,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),y&&{exchangeCode:y,idpInitiated:!0}),R&&{idpInitiated:!0}),b&&{token:b})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield fl.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const h=c.content.cloneNode(!0),f=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield p(this,Jd,"m",rl).call(this,h,a):h.querySelectorAll(`descope-button[${Ua}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${Ua}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),cd(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),cd(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=ld(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",ld(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=ld(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])=>{ad.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(h,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,ud(r,"descope-totp-image",i),((e,t)=>{ud(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(h),setTimeout((()=>{((e,t)=>{dd(e,null==t?void 0:t.inputs),dd(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-email-field"),t=this.rootElement.querySelectorAll("descope-password"),n=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t,...n].forEach((e=>p(this,Jd,"m",ol).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),p(this,Jd,"m",ul).call(this,a),s&&p(this,Jd,"m",pl).call(this,"ready",{}),p(this,Jd,"m",pl).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Ua}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(La,e.version,t.componentsVersion,{});p(this,el,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?p(this,Jd,"m",hl).call(this,m,s):m()}))}}Zd=new WeakMap,Xd=new WeakMap,Yd=new WeakMap,Qd=new WeakMap,el=new WeakMap,tl=new WeakMap,ll=new WeakMap,Jd=new WeakSet,nl=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)}))}},ol=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},rl=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=p(this,Xd,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield hd())){const{options:e,transactionId:n}=(yield p(this,tl,"f").call(this))||{};if(e&&n){p(this,Jd,"m",nl).call(this,o),f(this,Xd,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,p(this,Xd,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});p(this,el,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},il=function(){let e=!0;return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach((t=>{var n,o;"slot"!==t.localName&&(null===(n=t.reportValidity)||void 0===n||n.call(t),e&&(e=null===(o=t.checkValidity)||void 0===o?void 0:o.call(t)))})),e},sl=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Ia}])`));return(yield Promise.all(e.map((e=>u(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})),{})}))},al=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},dl=function(e={}){var t,n;const o=Ya(e,["externalId","email","phone"]),r=Ya(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,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)}},cl=function(e){this.rootElement.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))&&p(this,ll,"f").call(this,t,e)}))}))},ul=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{p(this,ll,"f").call(this,t,e)}})),p(this,Jd,"m",cl).call(this,e)},hl=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===Wa.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},pl=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",gl);var ml=Object.freeze({__proto__:null,default:gl});function vl(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const bl=e=>{const t=document.createElement("template");return t.innerHTML=e,t},yl=(...e)=>e.join("/").replace(/\/+/g,"/"),wl=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),$l=e=>{let t,n;return(...o)=>(t&&wl(t,o)||(t=o,n=e(...o)),n)},El=e=>(t,...n)=>t.reduce(((t,o,r)=>{var i;return`${t}${o}${(null===(i=null==n?void 0:n[r])||void 0===i?void 0:i[e>1?1:0])||""}`}),""),kl=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},Cl=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 o=e(n);return o[t]=!0,o}};var xl,Il,Ol,Sl,jl,Al;function Rl(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!Rl(i,s))return!1}else if(i!==s)return!1}return!0}class Nl{constructor(e={},{updateOnlyOnChange:t=!0}={}){xl.set(this,void 0),Il.set(this,{}),Ol.set(this,0),Sl.set(this,!1),this.update=e=>{const t="function"==typeof e?e(p(this,xl,"f")):e,n=Object.assign(Object.assign({},p(this,xl,"f")),t);if(!p(this,Sl,"f")||!Rl(p(this,xl,"f"),n)){const e=p(this,xl,"f");f(this,xl,n,"f"),Object.freeze(p(this,xl,"f")),setTimeout((()=>{Object.values(p(this,Il,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,xl,e,"f"),f(this,Sl,t,"f")}get current(){return Object.assign({},p(this,xl,"f"))}subscribe(e){return f(this,Ol,p(this,Ol,"f")+1,"f"),p(this,Il,"f")[p(this,Ol,"f")]=e,p(this,Ol,"f").toString()}unsubscribe(e){const t=!!p(this,Il,"f")[e];return t&&delete p(this,Il,"f")[e],t}unsubscribeAll(){return f(this,Il,{},"f"),!0}}xl=new WeakMap,Il=new WeakMap,Ol=new WeakMap,Sl=new WeakMap;class Ml{constructor(e,t){jl.set(this,void 0),this.nodeName="",f(this,jl,e,"f"),this.logger=t.logger}get asyncEle(){return(async(e,t)=>new Promise((t=>{const n=setInterval((()=>{const o="function"==typeof e?e():e;o&&(clearInterval(n),t(o))}),100);setTimeout((()=>{clearInterval(n),t(null)}),1e3)})))(p(this,jl,"f"))}get ele(){var e,t;const n="function"==typeof p(this,jl,"f")?p(this,jl,"f").call(this):p(this,jl,"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("no element for driver ",this.constructor.name,new Error),null)}}jl=new WeakMap;const Ul=/^descope-grid-([^-]+)-column$/,Tl={text:class extends Ml{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 Ml{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)}}}};class Dl extends Ml{constructor(){super(...arguments),this.nodeName="descope-grid",Al.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 o=null===(n=Ul.exec(t.localName))||void 0===n?void 0:n[1],r=Tl[o];return r?(e.push(new r(t,{logger:this.logger})),e):e}),[]):[]}filterColumns(e){var t,n;const o=null===(t=this.ele.columns)||void 0===t?void 0:t.filter(e);wl(o,this.ele.columns)||(this.ele.columns=o,null===(n=p(this,Al,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){f(this,Al,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}Al=new WeakMap;class Pl extends Ml{constructor(){super(...arguments),this.nodeName="descope-button"}onClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("click",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("click",e)}}disable(){var e;null===(e=this.ele)||void 0===e||e.setAttribute("disabled","true")}enable(){var e;null===(e=this.ele)||void 0===e||e.removeAttribute("disabled")}}var Ll;class _l extends Ml{constructor(){super(...arguments),Ll.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=""),p(this,Ll,"f")&&(null===(e=this.ele)||void 0===e||e.append(p(this,Ll,"f").content.cloneNode(!0)))}setContent(e){f(this,Ll,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Ll=new WeakMap;class Wl extends Ml{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()))}}class Fl extends Ml{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()))}}class Vl extends Ml{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()}}class ql extends Ml{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)}}class Bl extends Ml{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")}}class zl extends Ml{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)}}}class Kl extends Ml{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)}}}class Hl extends Ml{constructor(){super(...arguments),this.nodeName="descope-user-auth-method"}set fulfilled(e){var t,n;e?null===(t=this.ele)||void 0===t||t.setAttribute("fulfilled","true"):null===(n=this.ele)||void 0===n||n.removeAttribute("fulfilled")}onButtonClick(e){var t;return null===(t=this.ele)||void 0===t||t.addEventListener("button-clicked",e),()=>{var t;return null===(t=this.ele)||void 0===t?void 0:t.removeEventListener("button-clicked",e)}}get flowId(){var e;return null===(e=this.ele)||void 0===e?void 0:e.getAttribute("flow-id")}}class Gl extends Ml{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)}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)}}}function Jl(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 Zl=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Xl=()=>Math.random().toString(36).substring(7).split("").join("."),Yl={INIT:`@@redux/INIT${Xl()}`,REPLACE:`@@redux/REPLACE${Xl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Xl()}`};function Ql(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 ec(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 tc(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=ec(e)),t}function nc(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Jl(2):`Expected the root reducer to be a function. Instead, received: '${tc(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Jl(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?Jl(1):`Expected the enhancer to be a function. Instead, received: '${tc(n)}'`);return n(nc)(e,t)}let o=e,r=t,i=new Map,s=i,a=0,d=!1;function l(){s===i&&(s=new Map,i.forEach(((e,t)=>{s.set(t,e)})))}function c(){if(d)throw new Error("production"===process.env.NODE_ENV?Jl(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?Jl(4):`Expected the listener to be a function. Instead, received: '${tc(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?Jl(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?Jl(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),i=null}}}function h(e){if(!Ql(e))throw new Error("production"===process.env.NODE_ENV?Jl(7):`Actions must be plain objects. Instead, the actual type was: '${tc(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?Jl(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?Jl(17):`Action "type" property must be a string. Instead, the actual type was: '${tc(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?Jl(9):"Reducers may not dispatch actions.");try{d=!0,r=o(r,e)}finally{d=!1}return(i=s).forEach((e=>{e()})),e}function p(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Jl(10):`Expected the nextReducer to be a function. Instead, received: '${tc(e)}`);o=e,h({type:Yl.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?Jl(11):`Expected the observer to be an object. Instead, received: '${tc(t)}'`);function n(){const e=t;e.next&&e.next(c())}n();return{unsubscribe:e(n)}},[Zl](){return this}}}h({type:Yl.INIT});const g={dispatch:h,subscribe:u,getState:c,replaceReducer:p,[Zl]:f};return g}function oc(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function rc(e){const t=Object.keys(e),n={};for(let o=0;o<t.length;o++){const r=t[o];"production"!==process.env.NODE_ENV&&void 0===e[r]&&oc(`No reducer provided for key "${r}"`),"function"==typeof e[r]&&(n[r]=e[r])}const o=Object.keys(n);let r,i;"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:Yl.INIT}))throw new Error("production"===process.env.NODE_ENV?Jl(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:Yl.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?Jl(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Yl.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){i=e}return function(e={},t){if(i)throw i;if("production"!==process.env.NODE_ENV){const o=function(e,t,n,o){const r=Object.keys(t),i=n&&n.type===Yl.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(!Ql(e))return`The ${i} has unexpected type of "${tc(e)}". Expected argument to be an object with the following keys: "${r.join('", "')}"`;const s=Object.keys(e).filter((e=>!t.hasOwnProperty(e)&&!o[e]));return s.forEach((e=>{o[e]=!0})),n&&n.type===Yl.REPLACE?void 0:s.length>0?`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${r.join('", "')}". Unexpected keys will be ignored.`:void 0}(e,n,t,r);o&&oc(o)}let s=!1;const a={};for(let r=0;r<o.length;r++){const i=o[r],d=n[i],l=e[i],c=d(l,t);if(void 0===c){const e=t&&t.type;throw new Error("production"===process.env.NODE_ENV?Jl(14):`When called with an action of type ${e?`"${String(e)}"`:"(unknown type)"}, the slice reducer for key "${i}" 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[i]=c,s=s||c!==l}return s=s||o.length!==Object.keys(e).length,s?a:e}}function ic(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function sc(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?Jl(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)=>i(e,...t)},a=e.map((e=>e(s)));return i=ic(...a)(r.dispatch),{...r,dispatch:i}}}function ac(e){return Ql(e)&&"type"in e&&"string"==typeof e.type}var dc=Symbol.for("immer-nothing"),lc=Symbol.for("immer-draftable"),cc=Symbol.for("immer-state"),uc="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 hc(e,...t){if("production"!==process.env.NODE_ENV){const n=uc[e],o="function"==typeof n?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pc=Object.getPrototypeOf;function fc(e){return!!e&&!!e[cc]}function gc(e){return!!e&&(vc(e)||Array.isArray(e)||!!e[lc]||!!e.constructor?.[lc]||Ec(e)||kc(e))}var mc=Object.prototype.constructor.toString();function vc(e){if(!e||"object"!=typeof e)return!1;const t=pc(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)===mc}function bc(e,t){0===yc(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function yc(e){const t=e[cc];return t?t.type_:Array.isArray(e)?1:Ec(e)?2:kc(e)?3:0}function wc(e,t){return 2===yc(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $c(e,t,n){const o=yc(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Ec(e){return e instanceof Map}function kc(e){return e instanceof Set}function Cc(e){return e.copy_||e.base_}function xc(e,t){if(Ec(e))return new Map(e);if(kc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&vc(e)){if(!pc(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[cc];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(pc(e),n)}function Ic(e,t=!1){return Sc(e)||fc(e)||!gc(e)||(yc(e)>1&&(e.set=e.add=e.clear=e.delete=Oc),Object.freeze(e),t&&bc(e,((e,t)=>Ic(t,!0)))),e}function Oc(){hc(2)}function Sc(e){return Object.isFrozen(e)}var jc,Ac={};function Rc(e){const t=Ac[e];return t||hc(0,e),t}function Nc(){return jc}function Mc(e,t){t&&(Rc("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Uc(e){Tc(e),e.drafts_.forEach(Pc),e.drafts_=null}function Tc(e){e===jc&&(jc=e.parent_)}function Dc(e){return jc={drafts_:[],parent_:jc,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Pc(e){const t=e[cc];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Lc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[cc].modified_&&(Uc(t),hc(4)),gc(e)&&(e=_c(t,e),t.parent_||Fc(t,e)),t.patches_&&Rc("Patches").generateReplacementPatches_(n[cc].base_,e,t.patches_,t.inversePatches_)):e=_c(t,n,[]),Uc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==dc?e:void 0}function _c(e,t,n){if(Sc(t))return t;const o=t[cc];if(!o)return bc(t,((r,i)=>Wc(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Fc(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),bc(r,((r,s)=>Wc(e,o,t,r,s,n,i))),Fc(e,t,!1),n&&e.patches_&&Rc("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Wc(e,t,n,o,r,i,s){if("production"!==process.env.NODE_ENV&&r===n&&hc(5),fc(r)){const s=_c(e,r,i&&t&&3!==t.type_&&!wc(t.assigned_,o)?i.concat(o):void 0);if($c(n,o,s),!fc(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(gc(r)&&!Sc(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;_c(e,r),t&&t.scope_.parent_||Fc(e,r)}}function Fc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ic(t,n)}var Vc={get(e,t){if(t===cc)return e;const n=Cc(e);if(!wc(n,t))return function(e,t,n){const o=zc(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!gc(o)?o:o===Bc(e.base_,t)?(Hc(e),e.copy_[t]=Gc(o,e)):o},has:(e,t)=>t in Cc(e),ownKeys:e=>Reflect.ownKeys(Cc(e)),set(e,t,n){const o=zc(Cc(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Bc(Cc(e),t),r=o?.[cc];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,o)&&(void 0!==n||wc(e.base_,t)))return!0;Hc(e),Kc(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!==Bc(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Hc(e),Kc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Cc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){hc(11)},getPrototypeOf:e=>pc(e.base_),setPrototypeOf(){hc(12)}},qc={};function Bc(e,t){const n=e[cc];return(n?Cc(n):e)[t]}function zc(e,t){if(!(t in e))return;let n=pc(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pc(n)}}function Kc(e){e.modified_||(e.modified_=!0,e.parent_&&Kc(e.parent_))}function Hc(e){e.copy_||(e.copy_=xc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}bc(Vc,((e,t)=>{qc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),qc.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&hc(13),qc.set.call(this,e,t,void 0)},qc.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&hc(14),Vc.set.call(this,e[0],t,n,e[0])};function Gc(e,t){const n=Ec(e)?Rc("MapSet").proxyMap_(e,t):kc(e)?Rc("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Nc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Vc;n&&(r=[o],i=qc);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:Nc()).drafts_.push(n),n}function Jc(e){return fc(e)||hc(10,e),Zc(e)}function Zc(e){if(!gc(e)||Sc(e))return e;const t=e[cc];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xc(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xc(e,!0);return bc(n,((e,t)=>{$c(n,e,Zc(t))})),t&&(t.finalized_=!1),n}var Xc=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 o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&hc(6),void 0!==n&&"function"!=typeof n&&hc(7),gc(e)){const r=Dc(this),i=Gc(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Uc(r):Tc(r)}return Mc(r,n),Lc(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===dc&&(o=void 0),this.autoFreeze_&&Ic(o,!0),n){const t=[],r=[];Rc("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}hc(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;const r=this.produce(e,t,((e,t)=>{n=e,o=t}));return[r,n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){gc(e)||hc(8),fc(e)&&(e=Jc(e));const t=Dc(this),n=Gc(e,void 0);return n[cc].isManual_=!0,Tc(t),n}finishDraft(e,t){const n=e&&e[cc];n&&n.isManual_||hc(9);const{scope_:o}=n;return Mc(o,t),Lc(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=Rc("Patches").applyPatches_;return fc(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},Yc=Xc.produce;Xc.produceWithPatches.bind(Xc),Xc.setAutoFreeze.bind(Xc),Xc.setUseStrictShallowCopy.bind(Xc),Xc.applyPatches.bind(Xc),Xc.createDraft.bind(Xc),Xc.finishDraft.bind(Xc);var Qc=(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})}}},eu=(e,t,n)=>{const{memoize:o,memoizeOptions:r}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=o((()=>({})),...r);if(!(a.apply(null,i)===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:i,secondInputs:s,stack:e})}},tu={inputStabilityCheck:"once",identityFunctionCheck:"once"};var nu=e=>Array.isArray(e)?e:[e];function ou(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 ru(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var iu=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...tu,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Qc},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:eu}}},su="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function au(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:o}=t;let r,i=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 o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}else{let e=t.p;null===e&&(t.p=e=new Map);const o=e.get(n);void 0===o?(t={s:0,v:void 0,o:null,p:null},e.set(n,t)):t=o}}const a=t;let d;if(1===t.s?d=t.v:(d=e.apply(null,arguments),i++),a.s=1,o){const e=r?.deref?.()??r;null!=e&&o(e,d)&&(d=e,0!==i&&i--);r="object"==typeof d&&null!==d||"function"==typeof d?new su(d):d}return a.v=d,d}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function du(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,o=(...e)=>{let t,o=0,r=0,i={},s=e.pop();"object"==typeof s&&(i=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,...i},{memoize:d,memoizeOptions:l=[],argsMemoize:c=au,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=nu(l),f=nu(u),g=ou(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const b=c((function(){r++;const e=ru(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=iu(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=ru(g,arguments);o.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:d,memoizeOptions:p},arguments)}v&&(v=!1)}return t}),...f);return Object.assign(b,{resultFunc:s,memoizedResultFunc:m,dependencies:g,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>t,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:c})};return Object.assign(o,{withTypes:()=>o}),o}var lu=du(au),cu=Object.assign(((e,t=lu)=>{!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),o=t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,o)=>(e[n[o]]=t,e)),{})));return o}),{withTypes:()=>cu});function uu(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var hu=uu(),pu=uu;((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var fu="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},gu=e=>e&&"function"==typeof e.match;function mu(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?th(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function vu(e){return"function"==typeof e&&"type"in e&&gu(e)}function bu(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 yu=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 wu(e){return gc(e)?Yc(e,(()=>{})):e}function $u(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?th(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Eu(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function ku(e,t,n){const o=Cu(e,t,n);return{detectMutations:()=>xu(e,t,o,n)}}function Cu(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Cu(e,t,n[r],s))}}return i}function xu(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=xu(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Iu(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function Ou(e,t="",n=Iu,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(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=Ou(l,a,n,o,r,i),s))return s}return i&&Su(e)&&i.add(e),!1}function Su(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Su(t))return!1;return!0}function ju(e){return"boolean"==typeof e}var Au=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new yu;if(t&&(ju(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};ju(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Eu,ignoredPaths:r,warnAfter:i=32}=e;const s=ku.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=bu(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?th(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(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?th(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(o){let e={};ju(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Iu,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],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(!ac(u))return l(u);const h=l(u),p=bu(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Ou(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||(p.measureTime((()=>{const o=Ou(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};ju(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=vu}=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 i},Ru=e=>t=>{setTimeout(t,e)},Nu="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Ru(10),Mu=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new yu(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Nu:"callback"===e.type?e.queueNotification:Ru(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Uu="production"===process.env.NODE_ENV;function Tu(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?th(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?th(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?th(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?th(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?th(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&&o)throw new Error("production"===process.env.NODE_ENV?th(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Du=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Pu(...e){return t=>e.some((e=>((e,t)=>gu(e)?e.match(t):e(t))(e,t)))}var Lu=["name","message","stack","code"],_u=class{constructor(e,t){this.payload=e,this.meta=t}_type},Wu=class{constructor(e,t){this.payload=e,this.meta=t}_type},Fu=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Lu)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Vu=(()=>{function e(e,t,n){const o=mu(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=mu(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=mu(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Fu)(e||"Rejected"),meta:{...i||{},arg:o,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):Du(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new _u(e,t),fulfillWithValue:(e,t)=>new Wu(e,t)})).then((t=>{if(t instanceof _u)throw t;return t instanceof Wu?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof _u?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(qu)})}}),{pending:r,rejected:i,fulfilled:o,settled:Pu(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function qu(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Bu=Symbol.for("rtk-slice-createasyncthunk");function zu(e,t){return`${e}/${t}`}function Ku({creators:e}={}){const t=e?.asyncThunk?.[Bu];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?th(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)||{},i=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?th(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?th(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?th(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=[],o]="function"==typeof e.extraReducers?Tu(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?th(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,[o,r,i]=Tu(t);if(function(e){return"function"==typeof e}(e))n=()=>wu(e());else{const t=wu(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?th(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:zu(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?th(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?mu(e,s):mu(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?th(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||Ju,pending:a||Ju,rejected:d||Ju,settled:l||Ju})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?th(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=$u(c,n,{insert:()=>new WeakMap});return $u(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Hu(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function Hu(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?th(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Gu=Ku();function Ju(){}var Zu="listenerMiddleware",Xu=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=mu(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?th(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?th(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Yu=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Xu(e);return{id:Du(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?th(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Yu}),Qu=Object.assign(mu(`${Zu}/add`),{withTypes:()=>Qu});mu(`${Zu}/removeAll`);var eh=Object.assign(mu(`${Zu}/remove`),{withTypes:()=>eh});function th(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. `}const nh=["error","warn","info","debug"],oh=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return nh.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),rh="undefined"!=typeof localStorage,ih=rh&&localStorage.getItem("base.content.url")||"",sh=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,ah=Cl((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)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),dh=Cl((e=>{var t,n;const o=vl(oh,ah)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,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})),lh=e=>t=>{var n,o,r;const i=vl(oh,ah,dh)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};lh.missingAttrValidator=sh;const ch=Cl((e=>{const t=vl(lh({"project-id":sh}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),uh=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const hh=Cl((e=>{const t=vl(oh,ch,uh)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(ih||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),ph=Cl((e=>{var t,n,o;const r=vl(hh)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),fh=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(ah,oh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(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)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Kh})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),gh="load-descope-ui",mh="base.ui.components.url",vh=rh&&localStorage.getItem(mh)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",bh=rh&&localStorage.getItem(mh)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",yh=e=>{const t=document.createElement("script");return t.id=e,t},wh=(e,t)=>e.replace("<version>",t),$h=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(oh,ph)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=yh("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=wh(bh,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${gh}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=yh(gh);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=wh(vh,await p(this,t,"m",r).call(this))}return document.getElementById(gh)},c=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),Eh="content-root",kh="root",Ch=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${kh}, #${Eh} {\n height: 100%;\n }\n #${kh} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${kh}">\n <div id="${Eh}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Eh),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(kh)}})),xh="descope-modal",Ih=Cl((e=>{var t,n;const o=vl(ah,Ch,$h)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(xh);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([xh]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Oh="descope-notification",Sh=Cl((e=>{var t,n;const o=vl(ah,Ch,$h)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Oh);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(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([Oh])}},t=new WeakMap,n})),jh=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Ah=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(lh({theme:jh}),hh,ah,$h,ph,Ch,dh)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(mh)))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(mh),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},l})),Rh=e=>Cl((t=>{const n=Gu(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(oh)(t)){constructor(...e){super(...e);const t=function(e){const t=Au(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?th(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!Uu&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?th(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Uu&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?th(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Uu&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?th(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=fu({trace:!Uu,..."object"==typeof r&&r}));const c=sc(...d),u=Mu(c);if(!Uu&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?th(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Uu&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?th(6):"`enhancers` callback must return an array");if(!Uu&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?th(7):"each enhancer provided to configureStore must be a function");return Uu||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{qu(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Nh=Cl((e=>class extends(oh(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()}}));Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Mh=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Uh,Th,Dh,Ph,Lh,_h,Wh,Fh,Vh,qh;const Bh=document.createElement("template");Bh.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class zh extends HTMLElement{constructor(){var e;super(),Uh.add(this),Th.set(this,new Nl({messages:[]})),Dh.set(this,void 0),Ph.set(this,void 0),Lh.set(this,void 0),_h.set(this,{resize:p(this,Uh,"m",qh).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Bh.content.cloneNode(!0)),f(this,Dh,this.shadowRoot.querySelector(".debugger"),"f"),f(this,Ph,p(this,Dh,"f").querySelector(".content"),"f"),f(this,Lh,p(this,Dh,"f").querySelector(".header"),"f")}updateData(e){p(this,Th,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Mh(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,Dh,"f"),p(this,Lh,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,_h,"f").resize),(e=p(this,Dh,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,Dh,"f").onresize=p(this,Uh,"m",Vh).bind(this),p(this,Th,"f").subscribe(p(this,Uh,"m",Wh).bind(this))}disconnectedCallback(){p(this,Th,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,_h,"f").resize)}}Th=new WeakMap,Dh=new WeakMap,Ph=new WeakMap,Lh=new WeakMap,_h=new WeakMap,Uh=new WeakSet,Wh=function(e){p(this,Uh,"m",Fh).call(this,e),p(this,Uh,"m",Vh).call(this)},Fh=function(e){p(this,Ph,"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("")},Vh=function(){p(this,Ph,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},qh=function(){const[e,t]=Mh(p(this,Dh,"f"),Number.parseInt(p(this,Dh,"f").style.left,10),Number.parseInt(p(this,Dh,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,Dh,"f").style.top=`${t}px`,p(this,Dh,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",zh);var Kh=Object.freeze({__proto__:null}),Hh={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|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-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]|22"],"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","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?: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))\\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)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|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-8]\\d|90)\\d{8}|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])|90[25])[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(?:00|2[125-9]|33|44|66|77|88)|622)[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|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-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]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\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{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"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],[["(\\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[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"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])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($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","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[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|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-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],[["(\\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",["(?:1[3-79]|[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[0235])|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-2]))|(?: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{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|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{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"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))\\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]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\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],[["(\\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}"],["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]],0,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}|[257-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",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"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",["[257-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",["60|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[013-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{6}|(?: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))\\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",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"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{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"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]","1(?:(?:22|44|7[27]|87|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-689]|8[1-69]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",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[047]"]]]],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","2[0-24-9]\\d{8}|[78]\\d{10,13}|[7-9]\\d{9}|[1-9]\\d{7}|[124-7]\\d{6}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-6]|7(?:0[0-689]|[1-79])|8[2-9]"],"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|80\\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","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"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]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|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]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\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],[["(\\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-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"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|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],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[1-5]"]],["(\\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,[["(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|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-57-9]|1[02-9]|2[013569]|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[1247]|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}"]]],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","810","(?:20|33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],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],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)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\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","(?: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])\\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}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],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,0,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 Gh(e,t){var n=Array.prototype.slice.call(t);return n.push(Hh),e.apply(this,n)}function Jh(e){return Jh="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},Jh(e)}function Zh(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Xh(e,t){if(t&&("object"===Jh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Yh(e)}function Yh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qh(e){var t="function"==typeof Map?new Map:void 0;return Qh=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,o)}function o(){return ep(e,arguments,op(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),np(o,e)},Qh(e)}function ep(e,t,n){return ep=tp()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&np(r,n.prototype),r},ep.apply(null,arguments)}function tp(){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 np(e,t){return np=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},np(e,t)}function op(e){return op=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},op(e)}var rp=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&&np(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=tp(),function(){var e,o=op(t);if(n){var r=op(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return Xh(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=s.call(this,e),Object.setPrototypeOf(Yh(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&Zh(o.prototype,r),i&&Zh(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(Qh(Error)),ip="0-90-9٠-٩۰-۹",sp="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function ap(e,t){e=e.split("-"),t=t.split("-");for(var n=e[0].split("."),o=t[0].split("."),r=0;r<3;r++){var i=Number(n[r]),s=Number(o[r]);if(i>s)return 1;if(s>i)return-1;if(!isNaN(i)&&isNaN(s))return 1;if(isNaN(i)&&!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 dp={}.constructor;function lp(e){return null!=e&&e.constructor===dp}function cp(e){return cp="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},cp(e)}function up(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hp(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function pp(e,t,n){return t&&hp(e.prototype,t),n&&hp(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var fp=" ext. ",gp=/^\d+$/,mp=function(){function e(t){up(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 "+Ep(e)+": "+e,"."))}(t),this.metadata=t,Cp.call(this,t)}return pp(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 vp(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new vp(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 o=this.countryCallingCodes()[e];if(o&&1===o.length&&"001"===o[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}(),vp=function(){function e(t,n){up(this,e),this.globalMetadataObject=n,this.metadata=t,Cp.call(this,n.metadata)}return pp(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 bp(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()&&$p(this.types(),e))return new wp($p(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?fp:this.metadata[13]||fp}}]),e}(),bp=function(){function e(t,n){up(this,e),this._format=t,this.metadata=n}return pp(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()||yp.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),yp=/^\(?\$1\)?$/,wp=function(){function e(t,n){up(this,e),this.type=t,this.metadata=n}return pp(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 $p(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 Ep=function(e){return cp(e)};function kp(e,t){if((t=new mp(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Cp(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===ap(t,"1.2.0")?this.v2=!0:-1===ap(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var xp=function(e){return"([".concat(ip,"]{1,").concat(e,"})")};function Ip(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",o="#?",r="[ \\t]*";return";ext="+xp("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+xp("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+xp("9")+o)+"|"+("[- ]+"+xp("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+xp("15")+o)+"|"+(r+"(?:,)+"+n+xp("9")+o)}var Op="["+ip+"]{2}",Sp="[++]{0,1}(?:["+sp+"]*["+ip+"]){3,}["+sp+ip+"]*",jp=new RegExp("^[++]{0,1}(?:["+sp+"]*["+ip+"]){1,2}$","i"),Ap=Sp+"(?:"+Ip()+")?",Rp=new RegExp("^"+Op+"$|^"+Ap+"$","i");var Np=new RegExp("(?:"+Ip()+")$","i");var Mp={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 Up(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 Tp(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 Tp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Dp(e){for(var t,n="",o=Up(e.split(""));!(t=o()).done;){n+=Pp(t.value,n)||""}return n}function Pp(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return Mp[e]}(e)}function Lp(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 _p(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 _p(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Wp(e,t){return Fp(e,void 0,t)}function Fp(e,t,n){var o=n.type(t),r=o&&o.possibleLengths()||n.possibleLengths();if(!r)return"IS_POSSIBLE";if("FIXED_LINE_OR_MOBILE"===t){if(!n.type("FIXED_LINE"))return Fp(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=Lp(t);!(n=r()).done;){var i=n.value;e.indexOf(i)<0&&o.push(i)}return o.sort((function(e,t){return e-t}))}(r,i.possibleLengths()))}else if(t&&!o)return"INVALID_LENGTH";var s=e.length,a=r[0];return a===s?"IS_POSSIBLE":a>s?"TOO_SHORT":r[r.length-1]<s?"TOO_LONG":r.indexOf(s,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function Vp(e,t){return"IS_POSSIBLE"===Wp(e,t)}function qp(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function Bp(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 zp(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 zp(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var Kp=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Hp(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new mp(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(qp(o,n.nationalNumberPattern())){if(Gp(o,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?Gp(o,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,i=Bp(Kp);!(r=i()).done;){var s=r.value;if(Gp(o,s,n))return s}}}}function Gp(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&qp(e,t.pattern()))}function Jp(e,t,n){var o=new mp(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new mp(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var Zp=/(\$\d)/;function Xp(e,t,n){var o=n.useInternationalFormat,r=n.withNationalPrefix;n.carrierCode,n.metadata;var i=e.replace(new RegExp(t.pattern()),o?t.internationalFormat():r&&t.nationalPrefixFormattingRule()?t.format().replace(Zp,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(sp,"]+"),"g")," ").trim()}(i):i}var Yp=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Qp(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 ef(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 ef(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ef(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function tf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function nf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tf(Object(n),!0).forEach((function(t){of(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function of(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rf={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function sf(e,t,n,o){if(n=n?nf(nf({},rf),n):rf,o=new mp(o),e.country&&"001"!==e.country){if(!o.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));o.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";o.selectNumberingPlan(e.countryCallingCode)}var r,i=o.countryCallingCode(),s=n.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return s?df(r=af(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=af(s,null,"INTERNATIONAL",o,n),df(r="+".concat(i," ").concat(r),e.ext,o,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).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(i).concat(s),ext:e.ext});case"IDD":if(!n.fromCountry)return;var a=function(e,t,n,o,r){var i=kp(o,r.metadata);if(i===n){var s=af(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new mp(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():Yp.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(af(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return df(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function af(e,t,n,o,r){var i=function(e,t){for(var n,o=Qp(e);!(n=o()).done;){var r=n.value;if(r.leadingDigitsPatterns().length>0){var i=r.leadingDigitsPatterns()[r.leadingDigitsPatterns().length-1];if(0!==t.search(i))continue}if(qp(t,r.pattern()))return r}}(o.formats(),e);return i?Xp(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function df(e,t,n,o){return t?o(e,t,n):e}function lf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function cf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lf(Object(n),!0).forEach((function(t){uf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hf(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var pf=function(){function e(t,n,o){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(!o)throw new TypeError("`metadata` not passed");var r=function(e,t){var n,o,r=new mp(t);i=e,/^[A-Z]{2}$/.test(i)?(n=e,r.selectNumberingPlan(n),o=r.countryCallingCode()):o=e;var i;return{country:n,countryCallingCode:o}}(t,o),i=r.country,s=r.countryCallingCode;this.country=i,this.countryCallingCode=s,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}var t,n,o;return t=e,n=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Jp(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new mp(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 Vp(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 mp(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==Hp(e,t,n.metadata):qp(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new mp(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Hp(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return sf(this,e,t?cf(cf({},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)}}],n&&hf(t.prototype,n),o&&hf(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var ff=new RegExp("(["+ip+"])");function gf(e,t){var n=function(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),o=n.exec(e);if(o){var r,i,s,a=o.length-1,d=a>0&&o[a];if(t.nationalPrefixTransformRule()&&d)r=e.replace(n,t.nationalPrefixTransformRule()),a>1&&(i=o[1]);else{var l=o[0];r=e.slice(l.length),d&&(i=o[1])}if(d){var c=e.indexOf(o[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(s=t.numberingPlan.nationalPrefix())}else s=o[0];return{nationalNumber:r,nationalPrefix:s,carrierCode:i}}}return{nationalNumber:e}}(e,t),o=n.carrierCode,r=n.nationalNumber;if(r!==e){if(!function(e,t,n){if(qp(e,n.nationalNumberPattern())&&!qp(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Wp(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:o}}function mf(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new mp(o);r.selectNumberingPlan(t,n);var i=new RegExp(r.IDDPrefix());if(0===e.search(i)){var s=(e=e.slice(e.match(i)[0].length)).match(ff);if(!(s&&null!=s[1]&&s[1].length>0&&"0"===s[1]))return e}}}(e,t,n,o);if(!i||i===e){if(t||n){var s=function(e,t,n,o){var r=t?kp(t,o):n;if(0===e.indexOf(r)){(o=new mp(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=gf(i,o).nationalNumber,a=gf(e,o).nationalNumber;if(!qp(a,o.nationalNumberPattern())&&qp(s,o.nationalNumberPattern())||"TOO_LONG"===Wp(a,o))return{countryCallingCode:r,number:i}}return{number:e}}(e,t,n,o),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="+"+i}if("0"===e[1])return{};o=new mp(o);for(var l=2;l-1<=3&&l<=e.length;){var c=e.slice(1,l);if(o.hasCallingCode(c))return o.selectNumberingPlan(c),{countryCallingCodeSource:r?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(l)};l++}return{}}function vf(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 bf(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 bf(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function yf(e,t){var n=t.nationalNumber,o=t.defaultCountry,r=t.metadata,i=r.getCountryCodesForCallingCode(e);if(i)return 1===i.length?i[0]:function(e,t){var n=t.countries,o=t.defaultCountry,r=t.metadata;r=new mp(r);for(var i,s=[],a=vf(n);!(i=a()).done;){var d=i.value;if(r.country(d),r.leadingDigits()){if(e&&0===e.search(r.leadingDigits()))return d}else if(Hp({phone:e,country:d},void 0,r.metadata)){if(!o)return d;if(d===o)return d;s.push(d)}}if(s.length>0)return s[0]}(n,{countries:i,defaultCountry:o,metadata:r.metadata})}var wf="(["+ip+"]|[\\-\\.\\(\\)]?)",$f=new RegExp("^\\+"+wf+"*["+ip+"]"+wf+"*$","g"),Ef=new RegExp("^("+("["+ip+"]+((\\-)*["+ip+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+ip+"])*")+"\\.?$","g"),kf="tel:",Cf=";phone-context=";function xf(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Cf);if(t<0)return null;var n=t+Cf.length;if(n>=e.length)return"";var o=e.indexOf(";",n);return o>=0?e.substring(n,o):e.substring(n)}(e);if(!function(e){return null===e||0!==e.length&&($f.test(e)||Ef.test(e))}(r))throw new rp("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(kf);i=s>=0?s+kf.length:0;var a=e.indexOf(Cf);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var If=new RegExp("[++"+ip+"]"),Of=new RegExp("[^"+ip+"#]+$");function Sf(e,t,n){if(t=t||{},n=new mp(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new rp("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=xf(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new rp("TOO_LONG");return}if(!1===t)return e;var o=e.search(If);if(o<0)return;return e.slice(o).replace(Of,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&Rp.test(e)}(o))return function(e){return jp.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Np);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(Np),r=1;r<o.length;){if(o[r])return{number:n,ext:o[r]};r++}}(o);if(r.ext)return r;return{number:o}}(e,t.v2,t.extract),r=o.number,i=o.ext,s=o.error;if(!r){if(t.v2){if("TOO_SHORT"===s)throw new rp("TOO_SHORT");throw new rp("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=mf(Dp(e),t,n,o.metadata),s=i.countryCallingCodeSource,a=i.countryCallingCode,d=i.number;if(a)o.selectNumberingPlan(a);else{if(!d||!t&&!n)return{};o.selectNumberingPlan(t,n),t&&(r=t),a=n||kp(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var l=gf(Dp(d),o),c=l.nationalNumber,u=l.carrierCode,h=yf(a,{nationalNumber:c,defaultCountry:t,metadata:o});h&&(r=h,"001"===h||o.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 rp("INVALID_COUNTRY");return{}}if(!l||l.length<2){if(t.v2)throw new rp("TOO_SHORT");return{}}if(l.length>17){if(t.v2)throw new rp("TOO_LONG");return{}}if(t.v2){var p=new pf(c,l,n.metadata);return d&&(p.country=d),h&&(p.carrierCode=h),i&&(p.ext=i),p.__countryCallingCodeSource=u,p}var f=!!(t.extended?n.hasSelectedNumberingPlan():d)&&qp(l,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:c,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!Vp(l,n)),phone:l,ext:i}:f?function(e,t,n){var o={country:e,phone:t};n&&(o.ext=n);return o}(d,l,i):{}}function jf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Af(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jf(Object(n),!0).forEach((function(t){Rf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Mf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uf(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 o,r,i=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Tf(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 Tf(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 Tf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Df(e){var t,n,o,r=Uf(Array.prototype.slice.call(e),4),i=r[0],s=r[1],a=r[2],d=r[3];if("string"!=typeof i)throw new TypeError("A text for parsing must be a string.");if(t=i,s&&"string"!=typeof s){if(!lp(s))throw new Error("Invalid second argument: ".concat(s));a?(n=s,o=a):o=s}else d?(n=a,o=d):(n=void 0,o=a),s&&(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nf(Object(n),!0).forEach((function(t){Mf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:o}}function Pf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Lf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pf(Object(n),!0).forEach((function(t){_f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wf(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=Lf(Lf({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Sf(e,Af(Af({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof rp))throw e}}function Ff(){var e=Df(arguments),t=e.text,n=e.options,o=e.metadata;return Wf(t,n,o)}const Vf=(e,t)=>Object.entries(e).reduce(((e,[n,o])=>{const[r,...i]=n.split(".");return t!==r?Object.assign(e,{[n]:o}):(e[r]||(e[r]={}),e[r][i.join(".")]=o,e)}),{}),qf=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),Bf={enabled:"active",disabled:"disabled",invited:"invited"},zf=e=>e.tenantRoles.data,Kf=e=>e.selectedUsersLoginIds,Hf=e=>e.notifications,Gf=e=>e.customAttributes.data,Jf=lu((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),qf(null==e?void 0:e.customAttributes,"customAttributes")),{status:Bf[e.status]||e.status,roles:e.roleNames}))))),Zf=lu(Kf,Jf,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Xf=lu(Zf,(e=>e.map((e=>e.userId)))),Yf=lu(Zf,(e=>e.map((e=>e.status)))),Qf=lu(Zf,(e=>e.every((e=>e.editable)))),eg=lu(Kf,(e=>!!e.length)),tg=lu(Kf,(e=>1===e.length)),ng=lu(Kf,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),og=lu(tg,Yf,((e,t)=>e&&t.every((e=>e===Bf.enabled)))),rg=lu(Yf,(e=>e.every((e=>e===Bf.disabled)))),ig=lu(Zf,(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`})),sg=lu(tg,rg,Qf,((e,t,n)=>e&&t&&n)),ag=lu(tg,og,Qf,((e,t,n)=>e&&t&&n)),dg=lu(tg,Qf,((e,t)=>e&&t)),lg=lu(tg,Qf,((e,t)=>e&&t)),cg=lu(tg,Qf,((e,t)=>e&&t)),ug=lu(eg,(e=>e)),hg=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)}))}))},pg=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}}),fg=({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)})}}),gg=Vu("users/create",((e,{extra:{api:t}})=>t.user.create(e))),mg=hg(gg)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},pg((e=>e.createUser)),fg({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>`}})),vg={action:gg,reducer:mg},bg=Vu("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),yg=hg(bg)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},pg((e=>e.deleteUser)),fg({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to delete user${["","s"]}`})),wg={action:bg,reducer:yg},$g=Vu("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Eg=hg($g)(pg((e=>e.setTempUserPassword)),fg({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>`}})),kg={action:$g,reducer:Eg},Cg=Vu("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),xg=hg(Cg)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},pg((e=>e.customAttributes))),Ig={action:Cg,reducer:xg},Og=Vu("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),Sg=hg(Og)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},pg((e=>e.usersList))),jg={action:Og,reducer:Sg},Ag=Vu("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Rg=hg(Ag)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},pg((e=>e.tenantRoles))),Ng={action:Ag,reducer:Rg},Mg=Vu("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Ug=hg(Mg)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>wl(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},pg((e=>e.updateUser)),fg({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>`}})),Tg={action:Mg,reducer:Ug},Dg=Vu("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Pg=hg(Dg)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return wl(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},pg((e=>e.enableUser)),fg({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>`}})),Lg={action:Dg,reducer:Pg},_g=Vu("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Wg=hg(_g)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return wl(e.loginIds,null===(n=t.payload.user)||void 0===n?void 0:n.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(n=t.payload.user)||void 0===n?void 0:n.status)}},pg((e=>e.disableUser)),fg({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>`}})),Fg={action:_g,reducer:Wg},Vg=Vu("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),qg={action:Vg,reducer:hg(Vg)(pg((e=>e.removePasskey)),fg({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>`}}))},Bg={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:[]},zg="/v1/mgmt/user/search",Kg="/v1/mgmt/user/delete/batch",Hg="/v1/mgmt/user/create",Gg="/v1/mgmt/user/update",Jg="/v1/mgmt/user/update/status",Zg="/v1/mgmt/user/password/set/temporary",Xg="/v1/mgmt/user/passkeys/delete",Yg="/v1/mgmt/user/customattributes",Qg="/v1/mgmt/role/all",em=e=>u(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)})),tm=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.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:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.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:o,limit:r,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c});const h=yield e.post(zg,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:l,sort:c},{queryParams:{tenant:t}});return yield em(h),(yield h.json()).users})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Kg,{userIds:o},{queryParams:{tenant:t}});return yield em(r),r.json()})),create:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{const p=Math.random().toString(10).substring(15);u({loginIds:[e],externalIds:[e],userId:`user-${p}`,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w});const $=yield e.post(Hg,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:m,sendSMS:v,sendMail:b,inviteUrl:y,invite:w},{queryParams:{tenant:t}});return yield em($),(yield $.json()).user})),update:({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m})=>u(void 0,void 0,void 0,(function*(){if(n)return(({loginId:e,email:t,phone:n,displayName:o,roles:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h})=>u(void 0,void 0,void 0,(function*(){return new Promise((u=>{u({loginIds:[e],externalIds:[e],userId:e,email:t,phone:n,name:o,roleNames:r,customAttributes:i,picture:s,verifiedEmail:a,verifiedPhone:d,givenName:l,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})))({loginId:o,email:r,phone:i,displayName:s,roles:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,givenName:p,middleName:f,familyName:g,additionalLoginIds:m});const v=yield e.post(Gg,{loginId:o,email:r,phone:i,displayName:s,givenName:p,middleName:f,familyName:g,roleNames:a,customAttributes:d,picture:l,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:m},{queryParams:{tenant:t}});return yield em(v),(yield v.json()).user})),enable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})))(o);const r=yield e.post(Jg,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield em(r),r.json()})),disable:o=>u(void 0,void 0,void 0,(function*(){if(n)return(e=>u(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})))(o);const r=yield e.post(Jg,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield em(r),r.json()})),removePasskey:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Xg,{loginId:o},{queryParams:{tenant:t}});return yield em(r),r.json()})),setTempPassword:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))}));const r=yield e.post(Zg,{loginId:o},{queryParams:{tenant:t}});return yield em(r),r.json()})),getCustomAttributes:()=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}));const o=yield e.get(Yg,{queryParams:{tenant:t}});return yield em(o),(yield o.json()).data}))}),nm=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(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 o=yield e.get(Qg,{queryParams:{tenant:t}});return yield em(o),o.json()}))}),om=Cl((e=>{var t,n,o,r;const i=vl(ch,dh,oh,uh,lh({tenant:lh.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.4.88"}}));return{user:tm({httpClient:r.httpClient,tenant:t,mock:n}),tenant:nm({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),rm=Cl((e=>{const t=vl(Rh({name:"widget",initialState:Bg,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{vg.reducer(e),Tg.reducer(e),Lg.reducer(e),Fg.reducer(e),wg.reducer(e),jg.reducer(e),kg.reducer(e),qg.reducer(e),Ig.reducer(e),Ng.reducer(e)},asyncActions:{searchUsers:jg.action,createUser:vg.action,updateUser:Tg.action,enableUser:Lg.action,disableUser:Fg.action,deleteUsers:wg.action,removePasskey:qg.action,getCustomAttributes:Ig.action,getTenantRoles:Ng.action,setTempUserPassword:kg.action}}),ah,oh,om)(e);return class extends t{constructor(...e){super(...e),this.state=Bg,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),im=Cl((e=>{const t=vl(hh,lh({"widget-id":lh.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),sm=Cl((e=>{var t,n,o;return o=class extends(vl(oh,ah,$h,Ch,im,rm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),am=Cl((e=>{var t,n,o,r,i,s;return s=class extends(vl(rm,Ih,Nh,oh,sm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){yield p(this,n,"f").setData(zf(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,i=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(bl(yield this.fetchWidgetPage("create-user-modal.html")));new Pl((()=>{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)}));const e=new Pl((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(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({},Vf(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),f(this,n,new Wl((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),p(this,i,"f").call(this),this.createUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){yield p(this,i,"f").call(this),p(this,t,"m",r).call(this)}))}))},r=function(){const e=Gf(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},s})),dm=Cl((e=>{var t,n,o;return o=class extends(vl(oh,am,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},o})),lm=Cl((e=>{var t,n,o;return o=class extends(vl(rm,Ih,oh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(bl(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Pl((()=>{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 Pl((()=>{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=Xf(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new ql(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=ig(this.state);o.text=`Delete ${e}?`}}))},o})),cm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,lm)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),ug)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Pl(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})),um=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{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()))},o=function(){new Pl((()=>{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=ng(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.disableUserModal=this.createModal(),this.disableUserModal.setContent(bl(yield this.fetchWidgetPage("disable-user-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`Disable ${e}?`}))}))},i})),hm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,um,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),ag)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Pl(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})),pm=e=>{if(!e)return e;const t=function(){return Gh(Ff,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},fm=Cl((e=>{var t,n,o,r,i,s,a,d,l,h;return h=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),s.set(this,(()=>u(this,void 0,void 0,(function*(){yield p(this,o,"f").setData(zf(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=Zf(this.state))||void 0===e?void 0:e[0],o=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:pm(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},qf(n.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,o)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",l).call(this)}))}},n=new WeakMap,o=new WeakMap,s=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){new Pl((()=>{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()))},i=function(){new Pl((()=>{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=c(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},Vf(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=Gf(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[n,o]=t.split(".");if("customAttributes"!==n)return;const r=e.find((e=>e.name===o));r?r.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},l=function(){var e;return u(this,void 0,void 0,(function*(){this.editUserModal=this.createModal(),this.editUserModal.setContent(bl(yield this.fetchWidgetPage("edit-user-modal.html"))),p(this,t,"m",r).call(this),p(this,t,"m",i).call(this),f(this,n,new Bl(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),f(this,o,new Wl((()=>{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=()=>u(this,void 0,void 0,(function*(){yield p(this,s,"f").call(this),p(this,n,"f").disable(),p(this,d,"f").call(this),p(this,t,"m",a).call(this)}))}))},h})),gm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,fm,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),dg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Pl(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})),mm=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{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()))},o=function(){new Pl((()=>{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=ng(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.enableUserModal=this.createModal(),this.enableUserModal.setContent(bl(yield this.fetchWidgetPage("enable-user-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`Activate ${e}?`}))}))},i})),vm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,mm,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),sg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Pl(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})),bm=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r})),ym={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},wm=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(oh,rm,Sh,ah)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=p(this,t,"m",o).call(this,e);i.setContent(p(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(p(this,r,"f").bind(this),Hf)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=ym[e],o=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}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),$m=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{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()))},o=function(){new Pl((()=>{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=ng(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},r=function(){var e;return u(this,void 0,void 0,(function*(){this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(bl(yield this.fetchWidgetPage("remove-passkey-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),Em=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,$m,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),lg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Pl(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})),km=Cl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(vl(rm,oh,sm)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{this.usersTable.data=e}))),i.set(this,kl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchUsers({sort:n})}))),s.set(this,$l((e=>{this.usersTable.filterColumns((t=>{var n;const[o,r]=(null===(n=t.path)||void 0===n?void 0:n.split("."))||[];return"customAttributes"!==o||!!(null==e?void 0:e.find((e=>e.name===r)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this),p(this,r,"f").call(this,Jf(this.state)),p(this,s,"f").call(this,Gf(this.state)),this.subscribe(p(this,s,"f").bind(this),Gf),this.subscribe(p(this,r,"f").bind(this),Jf)}))}},r=new WeakMap,i=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:o,header:r,type:i,attrs:s})=>{const a=e(o)||t(i);if(!a)return n({path:o,header:r,type:i,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}},o=function(){var e;this.usersTable=new Dl(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(p(this,t,"m",a).bind(this)),p(this,t,"m",n).call(this),p(this,t,"m",a).call(this)},a=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{p(this,i,"f").call(this,e.target,e.detail)}))}))},d})),Cm=Cl((e=>{var t,n,o;return o=class extends(vl(rm,Ih,oh,Nh,sm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(bl(yield this.fetchWidgetPage("generated-password-modal.html")));new Pl((()=>{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()}))}))},o})),xm=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(rm,Ih,oh,Nh,sm,Cm)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",r).call(this)}))}},t=new WeakSet,n=function(){new Pl((()=>{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()))},o=function(){new Pl((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>u(this,void 0,void 0,(function*(){var e;const t=ng(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(){var e;return u(this,void 0,void 0,(function*(){this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(bl(yield this.fetchWidgetPage("reset-password-modal.html"))),p(this,t,"m",n).call(this),p(this,t,"m",o).call(this);const r=new ql(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=ig(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),Im=Cl((e=>{var t,n,o,r;return r=class extends(vl(oh,sm,rm,xm,Nh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){p(this,t,"m",n).call(this),yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),this.subscribe(p(this,o,"f").bind(this),cg)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Pl(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})),Om=Cl((e=>class extends(vl(fh,Ah,km,dm,cm,gm,vm,hm,Im,Em,bm,wm)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Sm=vl((e=>class extends(Om(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Sm);var jm=Object.freeze({__proto__:null,default:Sm});((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var Am="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},Rm=e=>e&&"function"==typeof e.match;function Nm(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?vv(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function Mm(e){return"function"==typeof e&&"type"in e&&Rm(e)}function Um(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 Tm=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 Dm(e){return gc(e)?Yc(e,(()=>{})):e}function Pm(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?vv(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Lm(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function _m(e,t,n){const o=Wm(e,t,n);return{detectMutations:()=>Fm(e,t,o,n)}}function Wm(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Wm(e,t,n[r],s))}}return i}function Fm(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Fm(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Vm(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function qm(e,t="",n=Vm,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(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=qm(l,a,n,o,r,i),s))return s}return i&&Bm(e)&&i.add(e),!1}function Bm(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Bm(t))return!1;return!0}function zm(e){return"boolean"==typeof e}var Km=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Tm;if(t&&(zm(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};zm(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Lm,ignoredPaths:r,warnAfter:i=32}=e;const s=_m.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Um(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vv(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(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?vv(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(o){let e={};zm(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Vm,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],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(!ac(u))return l(u);const h=l(u),p=Um(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=qm(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||(p.measureTime((()=>{const o=qm(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};zm(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Mm}=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 i},Hm=e=>t=>{setTimeout(t,e)},Gm="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Hm(10),Jm=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Tm(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Gm:"callback"===e.type?e.queueNotification:Hm(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Zm="production"===process.env.NODE_ENV;function Xm(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?vv(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?vv(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?vv(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?vv(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?vv(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&&o)throw new Error("production"===process.env.NODE_ENV?vv(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Ym=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Qm(...e){return t=>e.some((e=>((e,t)=>Rm(e)?e.match(t):e(t))(e,t)))}var ev=["name","message","stack","code"],tv=class{constructor(e,t){this.payload=e,this.meta=t}_type},nv=class{constructor(e,t){this.payload=e,this.meta=t}_type},ov=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of ev)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},rv=(()=>{function e(e,t,n){const o=Nm(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Nm(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Nm(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||ov)(e||"Rejected"),meta:{...i||{},arg:o,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):Ym(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new tv(e,t),fulfillWithValue:(e,t)=>new nv(e,t)})).then((t=>{if(t instanceof tv)throw t;return t instanceof nv?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof tv?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(iv)})}}),{pending:r,rejected:i,fulfilled:o,settled:Qm(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function iv(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var sv=Symbol.for("rtk-slice-createasyncthunk");function av(e,t){return`${e}/${t}`}function dv({creators:e}={}){const t=e?.asyncThunk?.[sv];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?vv(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)||{},i=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?vv(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?vv(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?vv(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=[],o]="function"==typeof e.extraReducers?Xm(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?vv(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,[o,r,i]=Xm(t);if(function(e){return"function"==typeof e}(e))n=()=>Dm(e());else{const t=Dm(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?vv(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:av(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?vv(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Nm(e,s):Nm(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?vv(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||uv,pending:a||uv,rejected:d||uv,settled:l||uv})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vv(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Pm(c,n,{insert:()=>new WeakMap});return Pm(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=lv(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function lv(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?vv(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var cv=dv();function uv(){}var hv="listenerMiddleware",pv=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Nm(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?vv(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?vv(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},fv=Object.assign((e=>{const{type:t,predicate:n,effect:o}=pv(e);return{id:Ym(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?vv(22):"Unsubscribe not initialized")}}}),{withTypes:()=>fv}),gv=Object.assign(Nm(`${hv}/add`),{withTypes:()=>gv});Nm(`${hv}/removeAll`);var mv=Object.assign(Nm(`${hv}/remove`),{withTypes:()=>mv});function vv(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. `}const bv=["error","warn","info","debug"],yv=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return bv.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),wv="undefined"!=typeof localStorage,$v=wv&&localStorage.getItem("base.content.url")||"",Ev=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,kv=Cl((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)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),Cv=Cl((e=>{var t,n;const o=vl(yv,kv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,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})),xv=e=>t=>{var n,o,r;const i=vl(yv,kv,Cv)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};xv.missingAttrValidator=Ev;const Iv=Cl((e=>{const t=vl(xv({"project-id":Ev}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Ov=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Sv=Cl((e=>{const t=vl(yv,Iv,Ov)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL($v||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),jv=Cl((e=>{var t,n,o;const r=vl(Sv)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),Av=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(kv,yv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(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)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return db})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),Rv="load-descope-ui",Nv="base.ui.components.url",Mv=wv&&localStorage.getItem(Nv)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Uv=wv&&localStorage.getItem(Nv)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Tv=e=>{const t=document.createElement("script");return t.id=e,t},Dv=(e,t)=>e.replace("<version>",t),Pv=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(yv,jv)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=Tv("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=Dv(Uv,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${Rv}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Tv(Rv);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=Dv(Mv,await p(this,t,"m",r).call(this))}return document.getElementById(Rv)},c=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),Lv="content-root",_v="root",Wv=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${_v}, #${Lv} {\n height: 100%;\n }\n #${_v} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${_v}">\n <div id="${Lv}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Lv),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(_v)}})),Fv="descope-modal",Vv=Cl((e=>{var t,n;const o=vl(kv,Wv,Pv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Fv);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([Fv]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),qv="descope-notification",Bv=Cl((e=>{var t,n;const o=vl(kv,Wv,Pv)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(qv);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(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([qv])}},t=new WeakMap,n})),zv=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Kv=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(xv({theme:zv}),Sv,kv,Pv,jv,Wv,Cv)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(Nv)))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(Nv),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},l})),Hv=e=>Cl((t=>{const n=cv(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(yv)(t)){constructor(...e){super(...e);const t=function(e){const t=Km(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?vv(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!Zm&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?vv(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Zm&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?vv(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Zm&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vv(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=Am({trace:!Zm,..."object"==typeof r&&r}));const c=sc(...d),u=Jm(c);if(!Zm&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?vv(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Zm&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?vv(6):"`enhancers` callback must return an array");if(!Zm&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?vv(7):"each enhancer provided to configureStore must be a function");return Zm||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{iv(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Gv=Cl((e=>class extends(yv(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()}}));Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const Jv=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Zv,Xv,Yv,Qv,eb,tb,nb,ob,rb,ib;const sb=document.createElement("template");sb.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class ab extends HTMLElement{constructor(){var e;super(),Zv.add(this),Xv.set(this,new Nl({messages:[]})),Yv.set(this,void 0),Qv.set(this,void 0),eb.set(this,void 0),tb.set(this,{resize:p(this,Zv,"m",ib).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(sb.content.cloneNode(!0)),f(this,Yv,this.shadowRoot.querySelector(".debugger"),"f"),f(this,Qv,p(this,Yv,"f").querySelector(".content"),"f"),f(this,eb,p(this,Yv,"f").querySelector(".header"),"f")}updateData(e){p(this,Xv,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=Jv(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,Yv,"f"),p(this,eb,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,tb,"f").resize),(e=p(this,Yv,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,Yv,"f").onresize=p(this,Zv,"m",rb).bind(this),p(this,Xv,"f").subscribe(p(this,Zv,"m",nb).bind(this))}disconnectedCallback(){p(this,Xv,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,tb,"f").resize)}}Xv=new WeakMap,Yv=new WeakMap,Qv=new WeakMap,eb=new WeakMap,tb=new WeakMap,Zv=new WeakSet,nb=function(e){p(this,Zv,"m",ob).call(this,e),p(this,Zv,"m",rb).call(this)},ob=function(e){p(this,Qv,"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("")},rb=function(){p(this,Qv,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},ib=function(){const[e,t]=Jv(p(this,Yv,"f"),Number.parseInt(p(this,Yv,"f").style.left,10),Number.parseInt(p(this,Yv,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,Yv,"f").style.top=`${t}px`,p(this,Yv,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",ab);var db=Object.freeze({__proto__:null});const lb=e=>e.selectedRolesIds,cb=e=>e.notifications,ub=e=>e.tenantPermissions.data||[],hb=lu((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"})})))),pb=lu(lb,hb,((e,t)=>t.filter((t=>e.includes(t.name))))),fb=lu(lb,(e=>!!e.length)),gb=lu(lb,(e=>1===e.length)),mb=lu(pb,(e=>1===e.length?e[0].name:`${e.length} roles`)),vb=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)}))}))},bb=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}}),yb=({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)})}}),wb=rv("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),$b=vb(wb)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},bb((e=>e.createRole)),yb({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>`}})),Eb={action:wb,reducer:$b},kb=rv("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Cb=vb(kb)({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=[]}},bb((e=>e.deleteRole)),yb({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to delete role${["","s"]}`})),xb={action:kb,reducer:Cb},Ib=rv("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),Ob=vb(Ib)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},bb((e=>e.rolesList))),Sb={action:Ib,reducer:Ob},jb=rv("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),Ab=vb(jb)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},bb((e=>e.updateRole)),yb({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>`}})),Rb={action:jb,reducer:Ab},Nb=rv("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),Mb={action:Nb,reducer:vb(Nb)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},bb((e=>e.tenantPermissions)))},Ub={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:[]},Tb="/v1/mgmt/role/search",Db="/v1/mgmt/role/delete/batch",Pb="/v1/mgmt/role/create",Lb="/v1/mgmt/role/update",_b="/v1/mgmt/permission/all",Wb=e=>u(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:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t},n)=>u(void 0,void 0,void 0,(function*(){return new Promise((o=>{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 o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),o(r.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.description.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s},t);const a=yield e.post(Tb,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Wb(a),(yield a.json()).roles})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(Db,{roleNames:o},{queryParams:{tenant:t}});return yield Wb(r),r.json()})),create:({name:o,description:r,permissionNames:i})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,description:t,permissionNames:n},o)=>u(void 0,void 0,void 0,(function*(){return new Promise((r=>{r({name:e,description:t,permissionNames:n,createdTime:new Date,tenantId:o})}))})))({name:o,description:r,permissionNames:i},t);const s=yield e.post(Pb,{name:o,description:r,permissionNames:i,tenantId:t},{queryParams:{tenant:t}});return yield Wb(s),yield s.json()})),update:({name:o,newName:r,description:i,permissionNames:s})=>u(void 0,void 0,void 0,(function*(){if(n)return(({name:e,newName:t,description:n,permissionNames:o},r)=>u(void 0,void 0,void 0,(function*(){return new Promise((i=>{i({name:t,description:n,permissionNames:o,createdTime:new Date,oldName:e,tenantId:r})}))})))({name:o,newName:r,description:i,permissionNames:s},t);const a=yield e.post(Lb,{name:o,newName:r,description:i,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Wb(a);const d=yield a.json();return d.oldName=o,d}))}),Vb=({httpClient:e,tenant:t,mock:n})=>({getTenantPermissions:()=>u(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 o=yield e.get(_b,{queryParams:{tenant:t}});return yield Wb(o),o.json()}))}),qb=Cl((e=>{var t,n,o,r;const i=vl(Iv,Cv,yv,Ov,xv({tenant:xv.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"role-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.85"}}));return{role:Fb({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Vb({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Bb=Cl((e=>{const t=vl(Hv({name:"widget",initialState:Ub,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Eb.reducer(e),Rb.reducer(e),xb.reducer(e),Sb.reducer(e),Mb.reducer(e)},asyncActions:{searchRoles:Sb.action,createRole:Eb.action,updateRole:Rb.action,deleteRoles:xb.action,getTenantPermissions:Mb.action}}),kv,yv,qb)(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=Cl((e=>{const t=vl(Sv,xv({"widget-id":xv.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`role-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Kb=Cl((e=>{var t,n,o;return o=class extends(vl(yv,kv,Pv,Wv,zb,Bb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this),this.actions.searchRoles(),this.actions.getTenantPermissions()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Hb=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(Bb,Vv,Gv,yv,Kb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield p(this,n,"f").setData(null===(e=ub(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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function(){return u(this,void 0,void 0,(function*(){this.createRoleModal=this.createModal(),this.createRoleModal.setContent(bl(yield this.fetchWidgetPage("create-role-modal.html")));new Pl((()=>{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)}));const e=new Pl((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>u(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))})))),f(this,n,new Wl((()=>{var e;return null===(e=this.createRoleModal.ele)||void 0===e?void 0:e.querySelector('[data-id="permissions-multiselect"]')}),{logger:this.logger}),"f"),p(this,r,"f").call(this)}))},i})),Gb=Cl((e=>{var t,n,o;return o=class extends(vl(yv,Hb,Kb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Pl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-role"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createRoleModal.open()))},o})),Jb=Cl((e=>{var t,n,o;return o=class extends(vl(Bb,Vv,yv,Kb)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteRolesModal=this.createModal(),this.deleteRolesModal.setContent(bl(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Pl((()=>{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 Pl((()=>{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=pb(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new ql(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=mb(this.state);o.text=`Delete ${e}?`}}))},o})),Zb=Cl((e=>{var t,n,o,r;return r=class extends(vl(yv,Kb,Bb,Jb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),fb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Pl(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})),Xb=Cl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(vl(Bb,Vv,yv,Gv,Kb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),i.set(this,(()=>u(this,void 0,void 0,(function*(){var e;yield p(this,n,"f").setData(null===(e=ub(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=pb(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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),yield p(this,t,"m",a).call(this)}))}},n=new WeakMap,i=new WeakMap,s=new WeakMap,t=new WeakSet,o=function(){new Pl((()=>{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 Pl((()=>{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,o=c(t,["name"]),r=null===(e=pb(this.state))||void 0===e?void 0:e[0];this.actions.updateRole(Object.assign({newName:n,name:r.name},o)),this.editRoleModal.close(),this.resetFormData(this.editRoleModal.ele)}}))},a=function(){return u(this,void 0,void 0,(function*(){this.editRoleModal=this.createModal(),this.editRoleModal.setContent(bl(yield this.fetchWidgetPage("edit-role-modal.html"))),p(this,t,"m",o).call(this),p(this,t,"m",r).call(this),f(this,n,new Wl((()=>{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=()=>u(this,void 0,void 0,(function*(){yield p(this,i,"f").call(this),p(this,s,"f").call(this)}))}))},d})),Yb=Cl((e=>{var t,n,o,r;return r=class extends(vl(yv,Kb,Bb,Xb,Gv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),gb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Pl(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})),Qb=Cl((e=>{var t,n,o,r;return r=class extends(vl(yv,Kb,Bb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{this.actions.searchRoles({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r})),ey={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},ty=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(yv,Bb,Bv,kv)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=p(this,t,"m",o).call(this,e);i.setContent(p(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(p(this,r,"f").bind(this),cb)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=ey[e],o=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}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),ny=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(Bb,yv,Kb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{this.rolesTable.data=e}))),r.set(this,kl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchRoles({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),p(this,t,"m",n).call(this),this.rolesTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{p(this,r,"f").call(this,e.target,e.detail)}))})),p(this,o,"f").call(this,hb(this.state)),this.subscribe(p(this,o,"f").bind(this),hb)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Dl(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)))}))},i})),oy=Cl((e=>class extends(vl(Av,Kv,ny,Gb,Zb,Yb,Qb,ty)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),ry=vl((e=>class extends(oy(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",ry);var iy=Object.freeze({__proto__:null,default:ry});((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var sy="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},ay=e=>e&&"function"==typeof e.match;function dy(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Hy(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function ly(e){return"function"==typeof e&&"type"in e&&ay(e)}function cy(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 uy=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 hy(e){return gc(e)?Yc(e,(()=>{})):e}function py(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?Hy(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function fy(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function gy(e,t,n){const o=my(e,t,n);return{detectMutations:()=>vy(e,t,o,n)}}function my(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=my(e,t,n[r],s))}}return i}function vy(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=vy(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function by(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function yy(e,t="",n=by,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(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=yy(l,a,n,o,r,i),s))return s}return i&&wy(e)&&i.add(e),!1}function wy(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!wy(t))return!1;return!0}function $y(e){return"boolean"==typeof e}var Ey=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new uy;if(t&&($y(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};$y(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=fy,ignoredPaths:r,warnAfter:i=32}=e;const s=gy.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=cy(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Hy(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(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Hy(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(o){let e={};$y(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=by,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],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(!ac(u))return l(u);const h=l(u),p=cy(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=yy(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||(p.measureTime((()=>{const o=yy(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};$y(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ly}=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 i},ky=e=>t=>{setTimeout(t,e)},Cy="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ky(10),xy=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new uy(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?Cy:"callback"===e.type?e.queueNotification:ky(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},Iy="production"===process.env.NODE_ENV;function Oy(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?Hy(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Hy(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?Hy(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Hy(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?Hy(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&&o)throw new Error("production"===process.env.NODE_ENV?Hy(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Sy=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function jy(...e){return t=>e.some((e=>((e,t)=>ay(e)?e.match(t):e(t))(e,t)))}var Ay=["name","message","stack","code"],Ry=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ny=class{constructor(e,t){this.payload=e,this.meta=t}_type},My=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Ay)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Uy=(()=>{function e(e,t,n){const o=dy(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=dy(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=dy(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||My)(e||"Rejected"),meta:{...i||{},arg:o,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):Sy(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new Ry(e,t),fulfillWithValue:(e,t)=>new Ny(e,t)})).then((t=>{if(t instanceof Ry)throw t;return t instanceof Ny?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof Ry?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(Ty)})}}),{pending:r,rejected:i,fulfilled:o,settled:jy(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Ty(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Dy=Symbol.for("rtk-slice-createasyncthunk");function Py(e,t){return`${e}/${t}`}function Ly({creators:e}={}){const t=e?.asyncThunk?.[Dy];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Hy(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)||{},i=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?Hy(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Hy(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?Hy(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=[],o]="function"==typeof e.extraReducers?Oy(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?Hy(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,[o,r,i]=Oy(t);if(function(e){return"function"==typeof e}(e))n=()=>hy(e());else{const t=hy(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?Hy(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:Py(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?Hy(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?dy(e,s):dy(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Hy(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||Fy,pending:a||Fy,rejected:d||Fy,settled:l||Fy})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Hy(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=py(c,n,{insert:()=>new WeakMap});return py(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=_y(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function _y(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?Hy(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Wy=Ly();function Fy(){}var Vy="listenerMiddleware",qy=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=dy(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?Hy(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Hy(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},By=Object.assign((e=>{const{type:t,predicate:n,effect:o}=qy(e);return{id:Sy(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Hy(22):"Unsubscribe not initialized")}}}),{withTypes:()=>By}),zy=Object.assign(dy(`${Vy}/add`),{withTypes:()=>zy});dy(`${Vy}/removeAll`);var Ky=Object.assign(dy(`${Vy}/remove`),{withTypes:()=>Ky});function Hy(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. `}const Gy=["error","warn","info","debug"],Jy=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return Gy.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),Zy="undefined"!=typeof localStorage,Xy=Zy&&localStorage.getItem("base.content.url")||"",Yy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Qy=Cl((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)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),ew=Cl((e=>{var t,n;const o=vl(Jy,Qy)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,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})),tw=e=>t=>{var n,o,r;const i=vl(Jy,Qy,ew)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};tw.missingAttrValidator=Yy;const nw=Cl((e=>{const t=vl(tw({"project-id":Yy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),ow=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const rw=Cl((e=>{const t=vl(Jy,nw,ow)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Xy||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),iw=Cl((e=>{var t,n,o;const r=vl(rw)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),sw=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(Qy,Jy)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(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)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return Lw})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),aw="load-descope-ui",dw="base.ui.components.url",lw=Zy&&localStorage.getItem(dw)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",cw=Zy&&localStorage.getItem(dw)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",uw=e=>{const t=document.createElement("script");return t.id=e,t},hw=(e,t)=>e.replace("<version>",t),pw=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(Jy,iw)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=uw("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=hw(cw,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${aw}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=uw(aw);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=hw(lw,await p(this,t,"m",r).call(this))}return document.getElementById(aw)},c=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),fw="content-root",gw="root",mw=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${gw}, #${fw} {\n height: 100%;\n }\n #${gw} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${gw}">\n <div id="${fw}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(fw),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(gw)}})),vw="descope-modal",bw=Cl((e=>{var t,n;const o=vl(Qy,mw,pw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(vw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([vw]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),yw="descope-notification",ww=Cl((e=>{var t,n;const o=vl(Qy,mw,pw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(yw);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(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([yw])}},t=new WeakMap,n})),$w=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Ew=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(tw({theme:$w}),rw,Qy,pw,iw,mw,ew)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(dw)))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(dw),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},l})),kw=e=>Cl((t=>{const n=Wy(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(Jy)(t)){constructor(...e){super(...e);const t=function(e){const t=Ey(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?Hy(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!Iy&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Hy(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Iy&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Hy(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Iy&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Hy(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=sy({trace:!Iy,..."object"==typeof r&&r}));const c=sc(...d),u=xy(c);if(!Iy&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Hy(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Iy&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Hy(6):"`enhancers` callback must return an array");if(!Iy&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Hy(7):"each enhancer provided to configureStore must be a function");return Iy||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{Ty(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}})),Cw=Cl((e=>class extends(Jy(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()}}));Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const xw=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var Iw,Ow,Sw,jw,Aw,Rw,Nw,Mw,Uw,Tw;const Dw=document.createElement("template");Dw.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class Pw extends HTMLElement{constructor(){var e;super(),Iw.add(this),Ow.set(this,new Nl({messages:[]})),Sw.set(this,void 0),jw.set(this,void 0),Aw.set(this,void 0),Rw.set(this,{resize:p(this,Iw,"m",Tw).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Dw.content.cloneNode(!0)),f(this,Sw,this.shadowRoot.querySelector(".debugger"),"f"),f(this,jw,p(this,Sw,"f").querySelector(".content"),"f"),f(this,Aw,p(this,Sw,"f").querySelector(".header"),"f")}updateData(e){p(this,Ow,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=xw(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,Sw,"f"),p(this,Aw,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,Rw,"f").resize),(e=p(this,Sw,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,Sw,"f").onresize=p(this,Iw,"m",Uw).bind(this),p(this,Ow,"f").subscribe(p(this,Iw,"m",Nw).bind(this))}disconnectedCallback(){p(this,Ow,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,Rw,"f").resize)}}Ow=new WeakMap,Sw=new WeakMap,jw=new WeakMap,Aw=new WeakMap,Rw=new WeakMap,Iw=new WeakSet,Nw=function(e){p(this,Iw,"m",Mw).call(this,e),p(this,Iw,"m",Uw).call(this)},Mw=function(e){p(this,jw,"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("")},Uw=function(){p(this,jw,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},Tw=function(){const[e,t]=xw(p(this,Sw,"f"),Number.parseInt(p(this,Sw,"f").style.left,10),Number.parseInt(p(this,Sw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,Sw,"f").style.top=`${t}px`,p(this,Sw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Pw);var Lw=Object.freeze({__proto__:null});const _w=e=>e.selectedAccessKeysIds,Ww=e=>e.notifications,Fw=lu((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}))))),Vw=lu(_w,Fw,((e,t)=>t.filter((t=>e.includes(t.id))))),qw=lu(_w,(e=>!!e.length)),Bw=lu(Vw,(e=>e.every((e=>e.editable)))),zw=lu(Bw,qw,((e,t)=>e&&t));lu(_w,(e=>1===e.length));const Kw=lu(Vw,(e=>1===e.length?e[0].name:`${e.length} access keys`)),Hw=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)}))}))},Gw=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}}),Jw=({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)})}}),Zw=Uy("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),Xw=Hw(Zw)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},Gw((e=>e.createAccessKey)),Jw({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>`}})),Yw={action:Zw,reducer:Xw},Qw=Uy("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),e$=Hw(Qw)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},Gw((e=>e.deleteAccessKey)),Jw({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),t$={action:Qw,reducer:e$},n$=Uy("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),o$=Hw(n$)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},Gw((e=>e.accessKeysList))),r$={action:n$,reducer:o$},i$=Uy("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),s$=Hw(i$)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},Gw((e=>e.activateAccessKey)),Jw({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),a$={action:i$,reducer:s$},d$=Uy("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),l$=Hw(d$)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},Gw((e=>e.deactivateAccessKey)),Jw({getSuccessMsg:e=>El(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>El(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),c$={action:d$,reducer:l$},u$=Uy("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),h$={action:u$,reducer:Hw(u$)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Gw((e=>e.tenantRoles)))},p$={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:[]},f$="/v1/mgmt/accesskey/search",g$="/v1/mgmt/accesskey/delete/batch",m$="/v1/mgmt/accesskey/create",v$="/v1/mgmt/accesskey/deactivate/batch",b$="/v1/mgmt/accesskey/activate/batch",y$="/v1/mgmt/role/all",w$=e=>u(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)})),$$=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t}={})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<10;e+=1)o.push({id:`access-key-id-${e}`,name:`Access Key ${e}`,createdBy:`User ${e}`,editable:!0,expireTime:(new Date).getTime()/1e3+2592e3,createdTime:(new Date).getTime()/1e3,roleNames:[`Role ${e}`],status:"active",clientId:`Client ID ${e}`,boundUserId:`User ${e}`});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.createdBy.toLowerCase().includes(e.toLowerCase()))))}))})))({page:o,limit:r,text:i,sort:s});const a=yield e.post(f$,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield w$(a),(yield a.json()).keys})),deleteBatch:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(g$,{ids:o},{queryParams:{tenant:t}});return yield w$(r),r.json()})),create:({name:o,expiration:r,roleNames:i,userId:s})=>u(void 0,void 0,void 0,(function*(){const a=new Date;a.setDate(a.getDate()+ +r);const d="0"===r[0]?0:Math.floor(a.getTime()/1e3);if(n)return(({name:e,roleNames:t,userId:n},o)=>u(void 0,void 0,void 0,(function*(){const r=Math.random().toString(10).substring(15);return new Promise((i=>{i({cleartext:Math.random().toString(20).substring(2),key:{id:`access-key-id-${r}`,name:e||`Access Key ${r}`,createdBy:n||`User ${r}`,editable:!0,expireTime:o,createdTime:(new Date).getTime()/1e3,roleNames:t,status:"active",clientId:`Client ID ${r}`,boundUserId:n||`User ${r}`}})}))})))({name:o,expiration:r,roleNames:i,userId:s},d);const l=yield e.post(m$,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield w$(l),yield l.json()})),activate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(b$,{ids:o},{queryParams:{tenant:t}});return yield w$(r),yield r.json()})),deactivate:o=>u(void 0,void 0,void 0,(function*(){if(n)return u(void 0,void 0,void 0,(function*(){}));const r=yield e.post(v$,{ids:o},{queryParams:{tenant:t}});return yield w$(r),yield r.json()}))}),E$=({httpClient:e,tenant:t,mock:n})=>({getTenantRoles:()=>u(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 o=yield e.get(y$,{queryParams:{tenant:t}});return yield w$(o),o.json()}))}),k$=Cl((e=>{var t,n,o,r;const i=vl(nw,ew,Jy,ow,tw({tenant:tw.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"access-key-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.87"}}));return{accesskey:$$({httpClient:r.httpClient,tenant:t,mock:n}),tenant:E$({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),C$=Cl((e=>{const t=vl(kw({name:"widget",initialState:p$,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Yw.reducer(e),t$.reducer(e),r$.reducer(e),a$.reducer(e),c$.reducer(e),h$.reducer(e)},asyncActions:{searchAccessKeys:r$.action,createAccessKey:Yw.action,activateAccessKeys:a$.action,deactivateAccessKeys:c$.action,deleteAccessKeys:t$.action,getTenantRoles:h$.action}}),Qy,Jy,k$)(e);return class extends t{constructor(...e){super(...e),this.state=p$,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),x$=Cl((e=>{const t=vl(rw,tw({"widget-id":tw.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`access-key-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),I$=Cl((e=>{var t,n,o;return o=class extends(vl(Jy,Qy,pw,mw,x$,C$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this),this.actions.searchAccessKeys(),this.actions.getTenantRoles()]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),O$=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(C$,Jy,I$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{this.accessKeysTable.data=e}))),r.set(this,kl(((e,t)=>{const n=[],{value:o}=t;if(o){const t=e.path;n.push({field:t,desc:"desc"===o})}this.actions.searchAccessKeys({sort:n})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var i;return u(this,void 0,void 0,(function*(){yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),p(this,t,"m",n).call(this),this.accessKeysTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{p(this,r,"f").call(this,e.target,e.detail)}))})),p(this,o,"f").call(this,Fw(this.state)),this.subscribe(p(this,o,"f").bind(this),Fw)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Dl(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)))}))},i})),S$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.activateAccessKeysModal=this.createModal(),this.activateAccessKeysModal.setContent(bl(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Pl((()=>{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 Pl((()=>{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=Vw(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new ql(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=Kw(this.state);o.text=`Activate ${e}?`}}))},o})),j$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$,S$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.activateButton.enable():this.activateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),zw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Pl(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})),A$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Cw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){this.createdAccessKeyModal=this.createModal(),this.createdAccessKeyModal.setContent(bl(yield this.fetchWidgetPage("created-access-key-modal.html")));new Pl((()=>{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()}))}))},o})),R$=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(C$,bw,Cw,Jy,I$,A$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),r.set(this,(()=>u(this,void 0,void 0,(function*(){var e,t;yield p(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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,r=new WeakMap,t=new WeakSet,o=function e(){return u(this,void 0,void 0,(function*(){this.createAccessKeyModal=this.createModal(),this.createAccessKeyModal.setContent(bl(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Pl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});o.onClick((()=>{this.createAccessKeyModal.close(),this.resetFormData(this.createAccessKeyModal.ele)}));const i=new Pl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});i.onClick((()=>u(this,void 0,void 0,(function*(){var e;if(this.validateForm(this.createAccessKeyModal.ele)){const t=yield this.actions.createAccessKey(Object.assign({},this.getFormData(this.createAccessKeyModal.ele)));this.createAccessKeyModal.close(),this.setFormData(this.createdAccessKeyModal.ele,{"generated-key":null===(e=null==t?void 0:t.payload)||void 0===e?void 0:e.cleartext}),this.createdAccessKeyModal.open()}})))),f(this,n,new Wl((()=>{var e;return null===(e=this.createAccessKeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),p(this,r,"f").call(this),this.createAccessKeyModal.afterClose=()=>{p(this,t,"m",e).call(this)}}))},i})),N$=Cl((e=>{var t,n,o;return o=class extends(vl(Jy,R$,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;this.createButton=new Pl(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()))},o})),M$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deactivateAccessKeysModal=this.createModal(),this.deactivateAccessKeysModal.setContent(bl(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Pl((()=>{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 Pl((()=>{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=Vw(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new ql(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=Kw(this.state);o.text=`Deactivate ${e}?`}}))},o})),U$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$,M$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deactivateButton.enable():this.deactivateButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),zw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Pl(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})),T$=Cl((e=>{var t,n,o;return o=class extends(vl(C$,bw,Jy,I$)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),yield p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){var e;return u(this,void 0,void 0,(function*(){this.deleteAccessKeysModal=this.createModal(),this.deleteAccessKeysModal.setContent(bl(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Pl((()=>{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 Pl((()=>{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=Vw(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new ql(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=Kw(this.state);o.text=`Delete ${e}?`}}))},o})),D$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$,T$)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),this.subscribe(p(this,o,"f").bind(this),zw)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Pl(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})),P$=Cl((e=>{var t,n,o,r;return r=class extends(vl(Jy,I$,C$)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{this.actions.searchAccessKeys({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r})),L$={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},_$=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(Jy,C$,ww,Qy)(e)){constructor(){super(...arguments),t.add(this),r.set(this,$l((e=>{e.length&&(e.forEach((({type:e,msg:r})=>{const i=p(this,t,"m",o).call(this,e);i.setContent(p(this,t,"m",n).call(this,{type:e,msg:r})),i.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(p(this,r,"f").bind(this),Ww)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=L$[e],o=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}${o.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},i})),W$=Cl((e=>class extends(vl(sw,Ew,O$,N$,D$,P$,j$,U$,_$)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),F$=vl((e=>class extends(W$(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",F$);var V$=Object.freeze({__proto__:null,default:F$});((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var q$="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},B$=e=>e&&"function"==typeof e.match;function z$(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?AE(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function K$(e){return"function"==typeof e&&"type"in e&&B$(e)}function H$(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 G$=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 J$(e){return gc(e)?Yc(e,(()=>{})):e}function Z$(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?AE(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function X$(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Y$(e,t,n){const o=Q$(e,t,n);return{detectMutations:()=>eE(e,t,o,n)}}function Q$(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Q$(e,t,n[r],s))}}return i}function eE(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=eE(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function tE(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function nE(e,t="",n=tE,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(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=nE(l,a,n,o,r,i),s))return s}return i&&oE(e)&&i.add(e),!1}function oE(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!oE(t))return!1;return!0}function rE(e){return"boolean"==typeof e}var iE=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new G$;if(t&&(rE(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};rE(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=X$,ignoredPaths:r,warnAfter:i=32}=e;const s=Y$.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=H$(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?AE(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(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?AE(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(o){let e={};rE(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=tE,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],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(!ac(u))return l(u);const h=l(u),p=H$(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=nE(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||(p.measureTime((()=>{const o=nE(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};rE(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=K$}=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 i},sE=e=>t=>{setTimeout(t,e)},aE="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:sE(10),dE=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new G$(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?aE:"callback"===e.type?e.queueNotification:sE(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},lE="production"===process.env.NODE_ENV;function cE(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?AE(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?AE(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?AE(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?AE(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?AE(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&&o)throw new Error("production"===process.env.NODE_ENV?AE(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var uE=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function hE(...e){return t=>e.some((e=>((e,t)=>B$(e)?e.match(t):e(t))(e,t)))}var pE=["name","message","stack","code"],fE=class{constructor(e,t){this.payload=e,this.meta=t}_type},gE=class{constructor(e,t){this.payload=e,this.meta=t}_type},mE=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of pE)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},vE=(()=>{function e(e,t,n){const o=z$(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=z$(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=z$(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||mE)(e||"Rejected"),meta:{...i||{},arg:o,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):uE(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new fE(e,t),fulfillWithValue:(e,t)=>new gE(e,t)})).then((t=>{if(t instanceof fE)throw t;return t instanceof gE?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof fE?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(bE)})}}),{pending:r,rejected:i,fulfilled:o,settled:hE(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function bE(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var yE=Symbol.for("rtk-slice-createasyncthunk");function wE(e,t){return`${e}/${t}`}function $E({creators:e}={}){const t=e?.asyncThunk?.[yE];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?AE(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)||{},i=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?AE(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?AE(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?AE(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=[],o]="function"==typeof e.extraReducers?cE(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?AE(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,[o,r,i]=cE(t);if(function(e){return"function"==typeof e}(e))n=()=>J$(e());else{const t=J$(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?AE(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:wE(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?AE(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?z$(e,s):z$(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?AE(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||CE,pending:a||CE,rejected:d||CE,settled:l||CE})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?AE(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Z$(c,n,{insert:()=>new WeakMap});return Z$(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=EE(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function EE(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?AE(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var kE=$E();function CE(){}var xE="listenerMiddleware",IE=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=z$(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?AE(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?AE(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},OE=Object.assign((e=>{const{type:t,predicate:n,effect:o}=IE(e);return{id:uE(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?AE(22):"Unsubscribe not initialized")}}}),{withTypes:()=>OE}),SE=Object.assign(z$(`${xE}/add`),{withTypes:()=>SE});z$(`${xE}/removeAll`);var jE=Object.assign(z$(`${xE}/remove`),{withTypes:()=>jE});function AE(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. `}const RE=["error","warn","info","debug"],NE=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return RE.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),ME="undefined"!=typeof localStorage,UE=ME&&localStorage.getItem("base.content.url")||"",TE=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,DE=Cl((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)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),PE=Cl((e=>{var t,n;const o=vl(NE,DE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,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})),LE=e=>t=>{var n,o,r;const i=vl(NE,DE,PE)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};LE.missingAttrValidator=TE;const _E=Cl((e=>{const t=vl(LE({"project-id":TE}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),WE=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const FE=Cl((e=>{const t=vl(NE,_E,WE)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(UE||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),VE=Cl((e=>{var t,n,o;const r=vl(FE)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),qE=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(DE,NE)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(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)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return bk})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),BE="load-descope-ui",zE="base.ui.components.url",KE=ME&&localStorage.getItem(zE)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",HE=ME&&localStorage.getItem(zE)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",GE=e=>{const t=document.createElement("script");return t.id=e,t},JE=(e,t)=>e.replace("<version>",t),ZE=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(NE,VE)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=GE("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=JE(HE,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${BE}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=GE(BE);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=JE(KE,await p(this,t,"m",r).call(this))}return document.getElementById(BE)},c=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),XE="content-root",YE="root",QE=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${YE}, #${XE} {\n height: 100%;\n }\n #${YE} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${YE}">\n <div id="${XE}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(XE),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(YE)}})),ek="descope-modal";Cl((e=>{var t,n;const o=vl(DE,QE,ZE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(ek);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([ek]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const tk="descope-notification";Cl((e=>{var t,n;const o=vl(DE,QE,ZE)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(tk);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(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([tk])}},t=new WeakMap,n}));const nk=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',ok=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(LE({theme:nk}),FE,DE,ZE,VE,QE,PE)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(zE)))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(zE),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},l})),rk=e=>Cl((t=>{const n=kE(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(NE)(t)){constructor(...e){super(...e);const t=function(e){const t=iE(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?AE(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!lE&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?AE(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!lE&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?AE(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!lE&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?AE(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=q$({trace:!lE,..."object"==typeof r&&r}));const c=sc(...d),u=dE(c);if(!lE&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?AE(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!lE&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?AE(6):"`enhancers` callback must return an array");if(!lE&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?AE(7):"each enhancer provided to configureStore must be a function");return lE||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{bE(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));Cl((e=>class extends(NE(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()}})),Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}}));const ik=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var sk,ak,dk,lk,ck,uk,hk,pk,fk,gk;const mk=document.createElement("template");mk.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class vk extends HTMLElement{constructor(){var e;super(),sk.add(this),ak.set(this,new Nl({messages:[]})),dk.set(this,void 0),lk.set(this,void 0),ck.set(this,void 0),uk.set(this,{resize:p(this,sk,"m",gk).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(mk.content.cloneNode(!0)),f(this,dk,this.shadowRoot.querySelector(".debugger"),"f"),f(this,lk,p(this,dk,"f").querySelector(".content"),"f"),f(this,ck,p(this,dk,"f").querySelector(".header"),"f")}updateData(e){p(this,ak,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=ik(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,dk,"f"),p(this,ck,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,uk,"f").resize),(e=p(this,dk,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,dk,"f").onresize=p(this,sk,"m",fk).bind(this),p(this,ak,"f").subscribe(p(this,sk,"m",hk).bind(this))}disconnectedCallback(){p(this,ak,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,uk,"f").resize)}}ak=new WeakMap,dk=new WeakMap,lk=new WeakMap,ck=new WeakMap,uk=new WeakMap,sk=new WeakSet,hk=function(e){p(this,sk,"m",pk).call(this,e),p(this,sk,"m",fk).call(this)},pk=function(e){p(this,lk,"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("")},fk=function(){p(this,lk,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},gk=function(){const[e,t]=ik(p(this,dk,"f"),Number.parseInt(p(this,dk,"f").style.left,10),Number.parseInt(p(this,dk,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,dk,"f").style.top=`${t}px`,p(this,dk,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",vk);var bk=Object.freeze({__proto__:null});const yk=e=>e.selectedAuditId,wk=lu((e=>e.auditList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{occurredFormatted:(null==e?void 0:e.occurred)?new Date(Number(null==e?void 0:e.occurred)||0).toLocaleString():"N/A"})))));lu(yk,wk,((e,t)=>t.find((t=>e===t.id)))),lu(yk,(e=>!!e));const $k=vE("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),Ek=(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)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(kk=e=>e.auditList,{onFulfilled:e=>{kk(e).loading=!1},onPending:e=>{kk(e).loading=!0,kk(e).error=null},onRejected:(e,t)=>{kk(e).loading=!1,kk(e).error=t.error}}));var kk;const Ck={action:$k,reducer:Ek},xk={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Ik="/v1/mgmt/audit/search",Ok=({httpClient:e,tenant:t,mock:n})=>({search:({page:o,limit:r=1e4,text:i,sort:s,from:a}={})=>u(void 0,void 0,void 0,(function*(){if(n)return(({text:e,sort:t})=>u(void 0,void 0,void 0,(function*(){return new Promise((n=>{const o=[];for(let e=1;e<9;e+=1)o.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:(new Date).getTime()});t.forEach((e=>{o.sort(((t,n)=>{var o,r;return e.desc?null===(r=n[e.field])||void 0===r?void 0:r.localeCompare(t[e.field]):null===(o=t[e.field])||void 0===o?void 0:o.localeCompare(n[e.field])}))})),n(o.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:o,limit:r,text:i,sort:s});const d=yield e.post(Ik,{limit:r,page:o,text:i,sort:s,from:a},{queryParams:{tenant:t}});return yield(e=>u(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}))}),Sk=Cl((e=>{var t,n,o,r;const i=vl(_E,PE,NE,WE,LE({tenant:LE.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n,o)=>{const r=so(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"audit-management-widget","x-descope-widget-id":o,"x-descope-widget-version":"0.1.50"}}));return{audit:Ok({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),jk=Cl((e=>{const t=vl(rk({name:"widget",initialState:xk,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Ck.reducer(e)},asyncActions:{searchAudit:Ck.action}}),DE,NE,Sk)(e);return class extends t{constructor(...e){super(...e),this.state=xk,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Ak=Cl((e=>{const t=vl(FE,LE({"widget-id":LE.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`audit-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),Rk=Cl((e=>{var t,n,o;return o=class extends(vl(NE,DE,ZE,QE,Ak,jk)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([p(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Nk=Cl((e=>{var t,n,o,r,i;return i=class extends(vl(NE,Rk,jk)(e)){constructor(){super(...arguments),t.add(this),n.set(this,kl((()=>{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}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",o).call(this),p(this,t,"m",r).call(this)}))}},n=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new Bl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(p(this,n,"f"))},r=function(){var e;this.rangeInput=new Fl(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="range-input"]'),{logger:this.logger}),this.rangeInput.onInput(p(this,n,"f"))},i})),Mk=Cl((e=>{var t,n,o,r;return r=class extends(vl(jk,NE,Rk)(e)){constructor(){super(...arguments),t.add(this),o.set(this,$l((e=>{this.auditTable.data=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.onWidgetRootReady)||void 0===r?void 0:r.call(this),p(this,t,"m",n).call(this),p(this,o,"f").call(this,wk(this.state)),this.subscribe(p(this,o,"f").bind(this),wk)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Dl(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})),Uk=Cl((e=>class extends(vl(qE,ok,Mk,Nk)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Tk=vl((e=>class extends(Uk(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Tk);var Dk=Object.freeze({__proto__:null,default:Tk});const Pk="undefined"!=typeof localStorage,Lk=Pk&&localStorage.getItem("base.content.url")||"",_k="config.json",Wk="base.ui.components.url",Fk=Pk&&localStorage.getItem(Wk)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Vk=Pk&&localStorage.getItem(Wk)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",qk="descope-login-flow",Bk="code",zk="ra-challenge",Kk="ra-callback",Hk="ra-backup-callback",Gk="ra-initiator",Jk="data-exclude-field",Zk="dls_last_auth",Xk="state_id",Yk="saml_idp_state_id",Qk="saml_idp_username",eC="descope_idp_initiated",tC="sso_app_id",nC="oidc_login_hint",oC="data-type",rC="poll",iC="webauthnCreate",sC="submit",aC="polling",dC=["descope-multi-select-combo-box","descope-text-area"];var lC;function cC(e){return new URLSearchParams(window.location.search).get(e)}function uC(e){if(window.history.replaceState&&cC(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 hC(e,t){return u(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||"text"](),headers:Object.fromEntries(n.headers.entries())}}))}function pC({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(Lk||o||"https://static.descope.com/pages");return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function fC(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?lC.forward:n<o?lC.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(lC||(lC={}));const gC=()=>{const[e="",t=""]=(cC(qk)||"").split("_");return{executionId:e,stepId:t}};function mC(){uC(qk)}const vC=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),bC=()=>{const{executionId:e,stepId:t}=gC();(e||t)&&mC();const n=cC("t")||void 0;n&&uC("t");const o=cC(Bk)||void 0;o&&uC(Bk);const r=cC("err")||void 0;r&&uC("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:cC(zk),redirectAuthCallbackUrl:cC(Kk),redirectAuthBackupCallbackUri:cC(Hk),redirectAuthInitiator:cC(Gk)};(i||s||a||d)&&(uC(zk),uC(Kk),uC(Hk),uC(Gk));const l=cC(Xk);l&&uC(Xk);const c=cC(Yk);c&&uC(Yk);const u=cC(Qk);c&&uC(Qk);const h=cC(eC);h&&uC(eC);const p=cC(tC);p&&uC(tC);const f=cC(nC);return f&&uC(nC),{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:"true"===h,ssoAppId:p,oidcLoginHint:f}},yC=e=>{let t,n;return(...o)=>{return t&&(i=o,(r=t).length===i.length&&r.every(((e,t)=>e===i[t])))||(t=o,n=e(...o)),n;var r,i}},wC=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,$C=e=>null==e?void 0:e.submit(),EC=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},kC=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};function CC(e){let t=navigator.language;return t&&"zh-TW"!==t&&(t=t.split("-")[0]),(e||t||"").toLowerCase()}var xC,IC,OC,SC;function jC(e,t){const n=Object.getOwnPropertyNames(e),o=Object.getOwnPropertyNames(t);if(n.length!==o.length)return!1;for(let o=0;o<n.length;o+=1){const r=n[o],i=e[r],s=t[r];if(null===i||null===s){if(i!==s)return!1}else if("object"==typeof i&&"object"==typeof s){if(!jC(i,s))return!1}else if(i!==s)return!1}return!0}class AC{constructor(e={},{updateOnlyOnChange:t=!0}={}){xC.set(this,void 0),IC.set(this,{}),OC.set(this,0),SC.set(this,!1),this.update=e=>{const t="function"==typeof e?e(p(this,xC,"f")):e,n=Object.assign(Object.assign({},p(this,xC,"f")),t);if(!p(this,SC,"f")||!jC(p(this,xC,"f"),n)){const e=p(this,xC,"f");f(this,xC,n,"f"),Object.freeze(p(this,xC,"f")),setTimeout((()=>{Object.values(p(this,IC,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},f(this,xC,e,"f"),f(this,SC,t,"f")}get current(){return Object.assign({},p(this,xC,"f"))}subscribe(e){return f(this,OC,p(this,OC,"f")+1,"f"),p(this,IC,"f")[p(this,OC,"f")]=e,p(this,OC,"f").toString()}unsubscribe(e){const t=!!p(this,IC,"f")[e];return t&&delete p(this,IC,"f")[e],t}unsubscribeAll(){return f(this,IC,{},"f"),!0}}xC=new WeakMap,IC=new WeakMap,OC=new WeakMap,SC=new WeakMap;const RC=["disabled"],NC=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Jk}])`)).forEach((e=>{e.value=n}))}))},MC=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),UC=(e,t,n)=>{e.querySelectorAll(`[${oC}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},TC=(e,t,n)=>{var o,r;const i=null===(o=customElements.get(t))||void 0===o?void 0:o.cssVarList.url;n&&i&&(null===(r=null==e?void 0:e.style)||void 0===r||r.setProperty(i,`url(data:image/jpg;base64,${n})`))},DC=yC((()=>u(void 0,void 0,void 0,(function*(){var e,t,n,o;if(!window.PublicKeyCredential||!PublicKeyCredential.isConditionalMediationAvailable||!PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)return!1;try{const r=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(100,n=r,o=i,new Promise(((e,t)=>{let r=!1;const i=setTimeout((()=>{r=!0,void 0!==o?e(o):t(new Error("Promise timed out after 100 ms"))}),100);n.then((t=>{r||(clearTimeout(i),e(t))})).catch((e=>{r||(clearTimeout(i),t(e))}))})))}catch(e){return console.error("Conditional login check failed",e),!1}})))),PC={"lastAuth.loginId":{"not-empty":e=>!!e.loginId,empty:e=>!e.loginId},idpInitiated:{"is-true":e=>!!e.code,"is-false":e=>!e.code},externalToken:{"is-true":e=>!!e.token,"is-false":e=>!e.token},abTestingKey:{"greater-than":(e,t)=>(e.abTestingKey||0)>t,"less-than":(e,t)=>(e.abTestingKey||0)<t}};function LC(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Zk)))}catch(e){}return t}const _C="dls_ab_testing_id",WC=document.createElement("template");var FC,VC,qC,BC,zC,KC,HC,GC,JC,ZC,XC,YC,QC,ex,tx,nx,ox,rx,ix,sx,ax,dx,lx,cx,ux,hx,px,fx,gx,mx,vx,bx,yx,wx,$x,Ex,kx,Cx,xx,Ix,Ox,Sx,jx,Ax,Rx,Nx,Mx,Ux,Tx,Dx,Px;WC.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: block;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n display: flex;\n\t\t}\n\n\t\t#wc-root[data-theme] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<div id="wc-root"></div>\n\t';class Lx extends HTMLElement{static get observedAttributes(){return["project-id","flow-id","base-url","tenant","theme","locale","debug","storage-prefix","preview","redirect-url","auto-focus","store-last-authenticated-user","validate-on-blur"]}constructor(e){super(),FC.add(this),this.logger=console,VC.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),p(this,FC,"m",gx).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)}},qC.set(this,new AC({deferredRedirect:!1})),BC.set(this,new AC),zC.set(this,{}),this.getComponentsContext=()=>p(this,zC,"f"),this.nextRequestStatus=new AC({isLoading:!1}),KC.set(this,void 0),HC.set(this,{popstate:p(this,FC,"m",QC).bind(this),visibilitychange:p(this,FC,"m",ex).bind(this),componentsContext:p(this,FC,"m",ux).bind(this)}),GC.set(this,void 0),ix.set(this,yC((()=>u(this,void 0,void 0,(function*(){const e=pC({projectId:this.projectId,filename:_k,baseUrl:this.baseStaticUrl});try{const{body:t,headers:n}=yield hC(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),ax.set(this,void 0),f(this,GC,e,"f"),p(this,FC,"m",JC).call(this)}get projectId(){return this.getAttribute("project-id")}get flowId(){return this.getAttribute("flow-id")}get client(){try{return JSON.parse(this.getAttribute("client"))||{}}catch(e){return{}}}get baseUrl(){return this.getAttribute("base-url")||void 0}get baseStaticUrl(){return this.getAttribute("base-static-url")}get tenant(){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 theme(){var e,t;const n=this.getAttribute("theme");return"os"===n?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":n||"light"}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 storagePrefix(){return this.getAttribute("storage-prefix")||""}get preview(){return!!this.getAttribute("preview")}get formConfig(){return(e=>{try{const t=JSON.parse(e);return Object.fromEntries(Object.keys(t).map((e=>"string"!=typeof t[e]?[e,t[e]]:[e,{value:t[e]}])).flatMap((([e,t])=>[[e,t],[`form.${e}`,t]])))}catch(e){return{}}})(this.form)}get form(){return this.getAttribute("form")}get formConfigValues(){return e=this.formConfig,"value",Object.fromEntries(Object.entries(e).map((([e,t])=>[e,t.value])));var e}getExecutionContext(){return u(this,void 0,void 0,(function*(){const{executionContext:e}=yield p(this,ix,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield p(this,ix,"f").call(this);return e}))}getFlowConfig(){var e,t;return u(this,void 0,void 0,(function*(){const n=yield this.getProjectConfig(),o=(null===(e=null==n?void 0:n.flows)||void 0===e?void 0:e[this.flowId])||{};return null!==(t=o.version)&&void 0!==t||(o.version=0),o}))}getTargetLocales(){return u(this,void 0,void 0,(function*(){const e=yield this.getFlowConfig();return((null==e?void 0:e.targetLocales)||[]).map((e=>e.toLowerCase()))}))}connectedCallback(){return u(this,void 0,void 0,(function*(){if(this.shadowRoot.isConnected){if(p(this,BC,"f").subscribe(p(this,FC,"m",fx).bind(this)),p(this,BC,"f").update({isDebug:this.debug}),p(this,FC,"m",ZC).call(this))return void p(this,FC,"m",XC).call(this);if(p(this,FC,"m",YC).call(this),f(this,ax,p(this,FC,"m",sx).call(this),"f"),yield p(this,FC,"m",ox).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");if((yield p(this,ix,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");p(this,FC,"m",dx).call(this),yield p(this,FC,"m",bx).call(this),yield p(this,FC,"m",lx).call(this),p(this,FC,"m",mx).call(this);const{executionId:e,stepId:t,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}=bC();window.addEventListener("popstate",p(this,HC,"f").popstate),window.addEventListener("components-context",p(this,HC,"f").componentsContext),window.addEventListener("visibilitychange",p(this,HC,"f").visibilitychange),p(this,qC,"f").subscribe(p(this,FC,"m",nx).bind(this)),p(this,qC,"f").update({projectId:this.projectId,flowId:this.flowId,baseUrl:this.baseUrl,tenant:this.tenant,redirectUrl:this.redirectUrl,locale:this.locale,stepId:t,executionId:e,token:n,code:o,exchangeError:r,redirectAuthCallbackUrl:i,redirectAuthBackupCallbackUri:s,redirectAuthCodeChallenge:a,redirectAuthInitiator:d,oidcIdpStateId:l,samlIdpStateId:c,samlIdpUsername:u,descopeIdpInitiated:h,ssoAppId:g,oidcLoginHint:m}),f(this,VC,!0,"f")}}))}disconnectedCallback(){p(this,qC,"f").unsubscribeAll(),p(this,BC,"f").unsubscribeAll(),p(this,FC,"m",px).call(this),window.removeEventListener("popstate",p(this,HC,"f").popstate),window.removeEventListener("visibilitychange",p(this,HC,"f").visibilitychange),window.removeEventListener("components-context",p(this,HC,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&p(this,VC,"f")&&t!==n&&Lx.observedAttributes.includes(e)){p(this,FC,"m",YC).call(this);const o=null===t;p(this,qC,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,mC()),{[vC(e)]:n,stepId:i,executionId:s}})),p(this,BC,"f").update({isDebug:this.debug})}}}VC=new WeakMap,qC=new WeakMap,BC=new WeakMap,zC=new WeakMap,KC=new WeakMap,HC=new WeakMap,GC=new WeakMap,ix=new WeakMap,ax=new WeakMap,FC=new WeakSet,JC=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(WC.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},ZC=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},XC=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)},YC=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client","validate-on-blur"];if(Lx.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[vC(t)])throw Error(`${t} cannot be empty`)})),this.theme&&"light"!==this.theme&&"dark"!==this.theme)throw Error('Supported theme values are "light", "dark", or leave empty for using the OS theme')},QC=function(){const{stepId:e,executionId:t}=gC();p(this,qC,"f").update({stepId:e,executionId:t})},ex=function(){document.hidden||setTimeout((()=>{p(this,qC,"f").update({deferredRedirect:!1})}),300)},tx=function(e,t){this.sdk=so(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},Lx.sdkConfigOverrides),{projectId:e,baseUrl:t})),["start","next"].forEach((e=>{const t=this.sdk.flow[e];this.sdk.flow[e]=(...e)=>u(this,void 0,void 0,(function*(){this.nextRequestStatus.update({isLoading:!0});try{return yield t(...e)}finally{this.nextRequestStatus.update({isLoading:!1})}}))}))},nx=function(e,t,n){return u(this,void 0,void 0,(function*(){const{projectId:t,baseUrl:o}=e;if(n("projectId")||n("baseUrl")){if(!t)return;p(this,FC,"m",tx).call(this,t,o)}p(this,GC,"f").call(this,e)}))},ox=function(){return u(this,void 0,void 0,(function*(){return(yield p(this,ix,"f").call(this)).isMissingConfig&&(yield p(this,FC,"m",rx).call(this))}))},rx=function(){return u(this,void 0,void 0,(function*(){const e=pC({projectId:this.projectId,filename:_k,assetsFolder:"v2-alpha",baseUrl:this.baseStaticUrl});try{return yield hC(e,"json"),!0}catch(e){return!1}}))},sx=function(){return u(this,void 0,void 0,(function*(){const e=pC({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseStaticUrl});try{const{body:t}=yield hC(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},dx=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield p(this,ix,"f").call(this),o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).forEach((e=>(e=>{if(!e)return;const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)})(e.url)))}))},lx=function(){return u(this,void 0,void 0,(function*(){yield p(this,FC,"m",cx).call(this),yield p(this,FC,"m",hx).call(this)}))},cx=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield p(this,ax,"f");r.innerText=((null===(e=null==i?void 0:i.light)||void 0===e?void 0:e.globals)||"")+((null===(t=null==i?void 0:i.dark)||void 0===t?void 0:t.globals)||"");const s=yield Lx.descopeUI;(null==s?void 0:s.componentsThemeManager)&&!s.componentsThemeManager.hasThemes&&(s.componentsThemeManager.themes={light:null===(n=null==i?void 0:i.light)||void 0===n?void 0:n.components,dark:null===(o=null==i?void 0:i.dark)||void 0===o?void 0:o.components}),this.shadowRoot.appendChild(r)}))},ux=function(e){f(this,zC,Object.assign(Object.assign({},p(this,zC,"f")),e.detail),"f")},hx=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Lx.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},px=function(){var e;null===(e=p(this,KC,"f"))||void 0===e||e.remove(),f(this,KC,null,"f")},fx=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(f(this,KC,document.createElement("descope-debugger"),"f"),Object.assign(p(this,KC,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return OS})),document.body.appendChild(p(this,KC,"f"))):p(this,FC,"m",px).call(this)}))},gx=function(e,t){var n;e&&this.debug&&(null===(n=p(this,KC,"f"))||void 0===n||n.updateData({title:e,description:t}))},mx=function(){this.rootElement.onkeydown=e=>{var t,n,o;const r=!!(null===(t=this.shadowRoot.activeElement)||void 0===t?void 0:t.getAttribute("href")),i=dC.includes(null!==(o=null===(n=this.shadowRoot.activeElement)||void 0===n?void 0:n.localName)&&void 0!==o?o:"");if("Enter"!==e.key||r||i)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()}}},vx=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield p(this,ix,"f").call(this))||void 0===e?void 0:e.projectConfig)||void 0===t?void 0:t.componentsVersion)||(this.logger.error("Did not get components version, using latest version"),"latest")}))},bx=function(){return u(this,void 0,void 0,(function*(){Lx.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Lx.descopeUI=new Promise((e=>{if(globalThis.DescopeUI)return void e(globalThis.DescopeUI);const t=e=>{const t=document.createElement("script");return t.id="load-descope-ui",t.src=e,t},n=(e,t)=>e.replace("<version>",t),o=(t,n)=>{const o=()=>{this.loggerWrapper.error("Cannot load DescopeUI",`Make sure this URL is valid and return the correct script: "${t.src}"`),n()};t.addEventListener("load",(()=>{globalThis.DescopeUI||o(),e(globalThis.DescopeUI)})),t.addEventListener("error",o)};(()=>{u(this,void 0,void 0,(function*(){const r=yield p(this,FC,"m",vx).call(this),i=t(n(Fk,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Vk,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},Lx.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.16.0"}};class _x extends Lx{static set sdkConfigOverrides(e){Lx.sdkConfigOverrides=e}constructor(){const e=new AC;super(e.update.bind(e)),yx.add(this),this.stepState=new AC({},{updateOnlyOnChange:!1}),wx.set(this,void 0),$x.set(this,null),Ex.set(this,((e,t,n,o,r)=>{n===rC&&f(this,wx,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,aC,o,r,{});p(this,Cx,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};p(this,Ex,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),kx.set(this,(()=>{clearTimeout(p(this,wx,"f")),f(this,wx,null,"f")})),Cx.set(this,(e=>{var t,n,o,r,i,s,a,d,l;if(!(null==e?void 0:e.ok)){p(this,yx,"m",Px).call(this,"error",null==e?void 0:e.error);const s=null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.url,a=`${null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status} - ${null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.statusText}`;return void this.loggerWrapper.error((null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.errorDescription)||s,(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.errorMessage)||a)}const c=null===(d=null===(a=null===(s=e.data)||void 0===s?void 0:s.screen)||void 0===a?void 0:a.state)||void 0===d?void 0:d.errorText;(null===(l=e.data)||void 0===l?void 0:l.error)?this.loggerWrapper.error(`[${e.data.error.code}]: ${e.data.error.description}`,`${c?`${c} - `:""}${e.data.error.message}`):c&&this.loggerWrapper.error(c);const{status:u,authInfo:h,lastAuth:f}=e.data;if("completed"===u)return this.storeLastAuthenticatedUser&&function(e){(null==e?void 0:e.authMethod)&&Pk&&localStorage.setItem(Zk,JSON.stringify(e))}(f),void p(this,yx,"m",Px).call(this,"success",h);const{executionId:g,stepId:m,stepName:v,action:b,screen:y,redirect:w,openInNewTabUrl:$,webauthn:E,error:k,samlIdpResponse:C}=e.data;b!==rC?(this.loggerWrapper.info(`Step "${v||`#${m}`}" is ${u}`,"",{screen:y,status:u,stepId:m,stepName:v,action:b,error:k}),this.flowState.update({stepId:m,executionId:g,action:b,redirectTo:null==w?void 0:w.url,openInNewTabUrl:$,screenId:null==y?void 0:y.id,screenState:null==y?void 0:y.state,webauthnTransactionId:null==E?void 0:E.transactionId,webauthnOptions:null==E?void 0:E.options,samlIdpResponseUrl:null==C?void 0:C.url,samlIdpResponseSamlResponse:null==C?void 0:C.samlResponse,samlIdpResponseRelayState:null==C?void 0:C.relayState})):this.flowState.update({action:b})})),xx.set(this,yC((()=>u(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)}}))))),Mx.set(this,kC(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||p(this,yx,"m",jx).call(this)){const o=null==e?void 0:e.getAttribute("id");p(this,yx,"m",Rx).call(this,e);const r=yield p(this,yx,"m",Ax).call(this),i=(n=e,Array.from((null==n?void 0:n.attributes)||[]).reduce(((e,t)=>{var n;const o=null===(n=new RegExp("^data-descope-(\\S+)$").exec(t.name))||void 0===n?void 0:n[1];return o?Object.assign(e,{[o]:t.value}):e}),{})),s=this.getComponentsContext(),a=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),r),{origin:window.location.origin}),d=yield this.getFlowConfig(),l=yield this.getProjectConfig(),c=yield t(o,d.version,l.componentsVersion,a);p(this,Cx,"f").call(this,c),p(this,yx,"m",Nx).call(this,r)}var n}))))),this.flowState=e}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t,n;return u(this,void 0,void 0,(function*(){this.shadowRoot.isConnected&&(null===(t=this.flowState)||void 0===t||t.subscribe(this.onFlowChange.bind(this)),null===(n=this.stepState)||void 0===n||n.subscribe(this.onStepChange.bind(this))),yield e.connectedCallback.call(this)}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.flowState.unsubscribeAll(),this.stepState.unsubscribeAll(),null===(e=p(this,$x,"f"))||void 0===e||e.abort(),f(this,$x,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n;const o=CC(e);return(yield this.getTargetLocales()).includes(o)&&(n=`${t}-${o}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield hC(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 hC(e,"text");return t}catch(e){this.loggerWrapper.error("Failed to fetch flow page",e.message)}return null}))}onFlowChange(e,t,n){var o,r;return u(this,void 0,void 0,(function*(){const{projectId:i,flowId:s,tenant:a,stepId:d,executionId:l,action:c,screenId:u,screenState:h,redirectTo:g,openInNewTabUrl:m,redirectUrl:v,token:b,code:y,exchangeError:w,webauthnTransactionId:$,webauthnOptions:E,redirectAuthCodeChallenge:k,redirectAuthCallbackUrl:C,redirectAuthBackupCallbackUri:x,redirectAuthInitiator:I,oidcIdpStateId:O,locale:S,samlIdpStateId:j,samlIdpUsername:A,descopeIdpInitiated:R,samlIdpResponseUrl:N,samlIdpResponseSamlResponse:M,samlIdpResponseRelayState:U,ssoAppId:T,oidcLoginHint:D}=e;let P,L;const _=(()=>{const e=localStorage.getItem(_C);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(_C,e.toString()),e}return Number(e)})(),W=this.sdk.getLastUserLoginId(),F=yield this.getFlowConfig(),V=yield this.getProjectConfig(),q=C&&k?{callbackUrl:C,codeChallenge:k,backupCallbackUri:x}:void 0;if(!l&&(F.fingerprintEnabled&&F.fingerprintKey?yield Ln(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Dn),F.conditions?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{const n=null==t?void 0:t.find((({key:t,operator:n,predicate:o})=>{var r;if("ELSE"===t)return!0;const i=null===(r=PC[t])||void 0===r?void 0:r[n];return!!(null==i?void 0:i(e,o))}));return n?{startScreenId:n.met.screenId,conditionInteractionId:n.met.interactionId}:{}})({loginId:W,code:y,token:b,abTestingKey:_},F.conditions)):F.condition?({startScreenId:P,conditionInteractionId:L}=((e,t)=>{var n;const o=null===(n=PC[null==e?void 0:e.key])||void 0===n?void 0:n[e.operator];if(!o)return{};const r=o(t,e.predicate)?e.met:e.unmet;return{startScreenId:null==r?void 0:r.screenId,conditionInteractionId:null==r?void 0:r.interactionId}})(F.condition,{loginId:W,code:y,token:b,abTestingKey:_})):P=F.startScreenId,!wC(P,O,j,A,T,D))){const e=yield this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,client:this.client},v&&{redirectUrl:v}),{lastAuth:LC(W),abTestingKey:_,locale:CC(S)}),L,"",F.version,V.componentsVersion,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),y?{exchangeCode:y,idpInitiated:!0}:{}),R&&{idpInitiated:!0}),b?{token:b}:{}),D?{externalId:D}:{}));return p(this,Cx,"f").call(this,e),void("completed"!==(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.status)&&this.flowState.update({code:void 0,token:void 0}))}if(l&&(n("token")&&b||n("code")&&y||n("exchangeError")&&w)){const e=yield this.sdk.flow.next(l,d,sC,F.version,V.componentsVersion,{token:b,exchangeCode:y,exchangeError:w});return p(this,Cx,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if("loadForm"===c&&["samlIdpResponseUrl","samlIdpResponseSamlResponse","samlIdpResponseRelayState"].some((e=>n(e)))){if(!N||!M)return void this.loggerWrapper.error("Did not get saml idp params data to load");((e,t,n,o)=>{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),o(r)})(N,M,U||"",$C)}if("redirect"===c&&(n("redirectTo")||n("deferredRedirect")))return g?"android"===I&&document.hidden?void this.flowState.update({deferredRedirect:!0}):void window.location.assign(g):void this.loggerWrapper.error("Did not get redirect url");if(c===iC||"webauthnGet"===c){if(!$||!E)return void this.loggerWrapper.error("Did not get webauthn transaction id or options");let e,t;null===(r=p(this,$x,"f"))||void 0===r||r.abort(),f(this,$x,null,"f");try{e=c===iC?yield this.sdk.webauthn.helpers.create(E):yield this.sdk.webauthn.helpers.get(E)}catch(i){"InvalidStateError"===i.name?this.loggerWrapper.warn("WebAuthn operation failed",i.message):"NotAllowedError"!==i.name&&this.loggerWrapper.error(i.message),t=i.name}const n=yield this.sdk.flow.next(l,d,sC,F.version,V.componentsVersion,{transactionId:$,response:e,failure:t});p(this,Cx,"f").call(this,n)}if(p(this,Ex,"f").call(this,l,d,c,F.version,V.componentsVersion),!u&&!P)return void this.loggerWrapper.warn("No screen was found to show");const B=P||u,z=yield this.getHtmlFilenameWithLocale(S,B),K={direction:fC(d,t.stepId),screenState:Object.assign(Object.assign({},h),{form:Object.assign(Object.assign({},this.formConfigValues),null==h?void 0:h.form),lastAuth:{loginId:W,name:this.sdk.getLastUserDisplayName()||W}}),htmlUrl:pC({projectId:i,filename:`${B}.html`,baseUrl:this.baseStaticUrl}),htmlLocaleUrl:z&&pC({projectId:i,filename:z,baseUrl:this.baseStaticUrl}),samlIdpUsername:A,oidcLoginHint:D,openInNewTabUrl:m},H=LC(W);wC(P,O,j,A,T,D)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign(Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:O,samlIdpStateId:j,samlIdpUsername:A,ssoAppId:T,oidcLoginHint:D,lastAuth:H,preview:this.preview,abTestingKey:_,client:this.client},v&&{redirectUrl:v}),{locale:CC(S)}),L,e,t,n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.formConfigValues),o),y&&{exchangeCode:y,idpInitiated:!0}),R&&{idpInitiated:!0}),b&&{token:b})):(n("projectId")||n("baseUrl")||n("executionId")||n("stepId"))&&(K.next=(...e)=>this.sdk.flow.next(l,d,...e)),this.stepState.update(K)}))}loadDescopeUiComponents(e){return u(this,void 0,void 0,(function*(){const t=yield Lx.descopeUI;if(!t)return;const n=(e=>[...Array.from(e.querySelectorAll("*")).reduce(((e,t)=>t.tagName.startsWith("DESCOPE-")?e.add(t.tagName.toLocaleLowerCase()):e),new Set)])(e);yield Promise.all(n.map((e=>u(this,void 0,void 0,(function*(){if(!customElements.get(e))if(t[e])try{return yield t[e]()}catch(t){if("NotSupportedError"!==t.name)throw t;console.debug(`${e} is already registered`)}else this.loggerWrapper.error(`Cannot load UI component "${e}"`,`Descope UI does not have a component named "${e}", available components are: "${Object.keys(t).join(", ")}"`)})))))}))}onStepChange(e,t){var n,o;return u(this,void 0,void 0,(function*(){const{htmlUrl:r,htmlLocaleUrl:i,direction:s,next:a,screenState:d,openInNewTabUrl:l}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const h=c.content.cloneNode(!0),f=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield p(this,yx,"m",Sx).call(this,h,a):h.querySelectorAll(`descope-button[${oC}="biometrics"]`).forEach((e=>e.setAttribute("disabled","true"))),!e.samlIdpUsername||(null===(n=d.form)||void 0===n?void 0:n.loginId)||(null===(o=d.form)||void 0===o?void 0:o.email)||(d.form||(d.form={}),d.form.loginId=e.samlIdpUsername,d.form.email=e.samlIdpUsername),((e,t,n,o,r,i)=>{var s,a;let d=null==t?void 0:t.errorText;try{d=(null==r?void 0:r({text:null==t?void 0:t.errorText,type:null==t?void 0:t.errorType}))||(null==t?void 0:t.errorText)}catch(e){i.error("Error transforming error message",e.message)}((e,t,n="")=>{e.querySelectorAll(`[${oC}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),UC(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),UC(e,"notp-link",null===(a=null==t?void 0:t.notp)||void 0===a?void 0:a.redirectUrl),((e,t)=>{e.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach((e=>{e.textContent=MC(e.textContent,t);const n=e.getAttribute("href");n&&e.setAttribute("href",MC(n,t))}))})(e,t),((e,t,n)=>{t&&Object.keys(t).forEach((o=>{e.querySelectorAll(`[name=${o}]`).forEach((e=>{const r=t[o];Object.keys(r).forEach((t=>{let o=r[t];if("string"!=typeof o)try{o=JSON.stringify(o)}catch(e){n.error(`Could not stringify value "${o}" for "${t}"`,e.message),o=""}e.setAttribute(t,o)}))}))}))})(e,n,i),((e,t)=>{e.querySelectorAll("[data-has-dynamic-attr-values]").forEach((e=>{Array.from(e.attributes).forEach((e=>{e.value=MC(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])=>{RC.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(h,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:g}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(h,g);const m=()=>u(this,void 0,void 0,(function*(){var e,n;yield f;const o=this.shadowRoot.querySelector("div");var r,i;r=o,i=null===(e=null==d?void 0:d.totp)||void 0===e?void 0:e.image,TC(r,"descope-totp-image",i),((e,t)=>{TC(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(h),setTimeout((()=>{((e,t)=>{NC(e,null==t?void 0:t.inputs),NC(e,null==t?void 0:t.form)})(this.rootElement,d);const e=this.rootElement.querySelectorAll("descope-password"),t=this.rootElement.querySelectorAll("descope-new-password");document.querySelectorAll('[data-hidden-input="true"]').forEach((e=>e.remove())),[...e,...t].forEach((e=>p(this,yx,"m",Ox).call(this,e)))}));const s=!t.htmlUrl;if(((e,t,n)=>{if(!0===t||"skipFirstScreen"===t&&!n){const t=e.querySelector("*[name]");setTimeout((()=>{null==t||t.focus()}))}})(this.rootElement,this.autoFocus,s),this.validateOnBlur&&(e=>{this.rootElement.querySelectorAll("*[name]").forEach((e=>{e.addEventListener("blur",(()=>{var t;const n=e.focus;e.focus=()=>{},null===(t=e.reportValidity)||void 0===t||t.call(e),setTimeout((()=>{e.focus=n}))}))}))})(),p(this,yx,"m",Tx).call(this,a),s&&p(this,yx,"m",Px).call(this,"ready",{}),p(this,yx,"m",Px).call(this,"page-updated",{}),this.rootElement.querySelector(`[${oC}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(aC,e.version,t.componentsVersion,{});p(this,Cx,"f").call(this,n)}l&&!t.openInNewTabUrl&&window.open(l,"_blank")}));s?p(this,yx,"m",Dx).call(this,m,s):m()}))}}wx=new WeakMap,$x=new WeakMap,Ex=new WeakMap,kx=new WeakMap,Cx=new WeakMap,xx=new WeakMap,Mx=new WeakMap,yx=new WeakSet,Ix=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)}))}},Ox=function(e){e&&"true"===e.getAttribute("external-input")&&e.querySelectorAll("input").forEach((t=>{const n=t.getAttribute("slot"),o=`input-${e.id}-${n}`,r=document.createElement("slot");r.setAttribute("name",o),r.setAttribute("slot",n),e.appendChild(r),t.setAttribute("slot",o),this.appendChild(t)}))},Sx=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=p(this,$x,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield DC())){const{options:e,transactionId:n}=(yield p(this,xx,"f").call(this))||{};if(e&&n){p(this,yx,"m",Ix).call(this,o),f(this,$x,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,p(this,$x,"f")).then((e=>u(this,void 0,void 0,(function*(){const s=yield t(o.id,r.version,i.componentsVersion,{transactionId:n,response:e});p(this,Cx,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},jx=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).every((e=>{var t,n;return"slot"===e.localName||(null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e))}))},Ax=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Jk}])`));return(yield Promise.all(e.map((e=>u(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})),{})}))},Rx=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},Nx=function(e={}){var t,n;const o=EC(e,["externalId","email","phone"]),r=EC(e,["newPassword","password"]);if(o&&r)try{if(!globalThis.PasswordCredential)return;const e=new globalThis.PasswordCredential({id:o,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)}},Ux=function(e){this.rootElement.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))&&p(this,Mx,"f").call(this,t,e)}))}))},Tx=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{p(this,Mx,"f").call(this,t,e)}})),p(this,yx,"m",Ux).call(this,e)},Dx=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===lC.forward?"slide-forward":"slide-backward";Array.from(this.rootElement.getElementsByClassName("input-container")).forEach(((e,t)=>{e.style["transition-delay"]=40*t+"ms",e.classList.add(n)})),this.rootElement.classList.add("fade-out")},Px=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},customElements.get("descope-wc")?console.log("descope-wc is already defined"):customElements.define("descope-wc",_x);((...e)=>{const t=du(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(fc(e)?Jc(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(au);var Wx="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ic:ic.apply(null,arguments)},Fx=e=>e&&"function"==typeof e.match;function Vx(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?OI(0):"prepareAction did not return an object");return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ac(t)&&t.type===e,n}function qx(e){return"function"==typeof e&&"type"in e&&Fx(e)}function Bx(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 zx=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 Kx(e){return gc(e)?Yc(e,(()=>{})):e}function Hx(e,t,n){if(e.has(t)){let o=e.get(t);return n.update&&(o=n.update(o,t,e),e.set(t,o)),o}if(!n.insert)throw new Error("production"===process.env.NODE_ENV?OI(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Gx(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Jx(e,t,n){const o=Zx(e,t,n);return{detectMutations:()=>Xx(e,t,o,n)}}function Zx(e,t=[],n,o="",r=new Set){const i={value:n};if(!e(n)&&!r.has(n)){r.add(n),i.children={};for(const r in n){const s=o?o+"."+r:r;t.length&&-1!==t.indexOf(s)||(i.children[r]=Zx(e,t,n[r],s))}}return i}function Xx(e,t=[],n,o,r=!1,i=""){const s=n?n.value:void 0,a=s===o;if(r&&!a&&!Number.isNaN(o))return{wasMutated:!0,path:i};if(e(s)||e(o))return{wasMutated:!1};const d={};for(let e in n.children)d[e]=!0;for(let e in o)d[e]=!0;const l=t.length>0;for(let r in d){const s=i?i+"."+r:r;if(l){if(t.some((e=>e instanceof RegExp?e.test(s):s===e)))continue}const d=Xx(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Yx(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||Ql(e)}function Qx(e,t="",n=Yx,o,r=[],i){let s;if(!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;if(i?.has(e))return!1;const a=null!=o?o(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=Qx(l,a,n,o,r,i),s))return s}return i&&eI(e)&&i.add(e),!1}function eI(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!eI(t))return!1;return!0}function tI(e){return"boolean"==typeof e}var nI=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new zx;if(t&&(tI(t)?i.push(hu):i.push(pu(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};tI(n)||(e=n),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{let t=function(e,t,o,r){return JSON.stringify(e,n(t,r),o)},n=function(e,t){let n=[],o=[];return t||(t=function(e,t){return n[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(t)).join(".")+"]"}),function(r,i){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?o.splice(s,1/0,r):o.push(r),~n.indexOf(i)&&(i=t.call(this,r,i))}else n.push(i);return null==e?i:e.call(this,r,i)}},{isImmutable:o=Gx,ignoredPaths:r,warnAfter:i=32}=e;const s=Jx.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const l=Bx(i,"ImmutableStateInvariantMiddleware");l.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?OI(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(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?OI(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(o){let e={};tI(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Yx,getEntries:n,ignoredActions:o=[],ignoredActionPaths:r=["meta.arg","meta.baseQueryMeta"],ignoredPaths:i=[],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(!ac(u))return l(u);const h=l(u),p=Bx(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Qx(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||(p.measureTime((()=>{const o=Qx(e.getState(),"",t,n,i,c);if(o){const{keyPath:e,value:t}=o;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)`)}})),p.warnIfExceeded()),h}}}(e))}if(r){let e={};tI(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=qx}=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 i},oI=e=>t=>{setTimeout(t,e)},rI="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:oI(10),iI=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new zx(e);return n&&o.push(((e={type:"raf"})=>t=>(...n)=>{const o=t(...n);let r=!0,i=!1,s=!1;const a=new Set,d="tick"===e.type?queueMicrotask:"raf"===e.type?rI:"callback"===e.type?e.queueNotification:oI(e.timeout),l=()=>{s=!1,i&&(i=!1,a.forEach((e=>e())))};return Object.assign({},o,{subscribe(e){const t=o.subscribe((()=>r&&e()));return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return r=!e?.meta?.RTK_autoBatch,i=!r,i&&(s||(s=!0,d(l))),o.dispatch(e)}finally{r=!0}}})})("object"==typeof n?n:void 0)),o},sI="production"===process.env.NODE_ENV;function aI(e){const t={},n=[];let o;const r={addCase(e,i){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("production"===process.env.NODE_ENV?OI(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?OI(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?OI(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?OI(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${s}'`);return t[s]=i,r},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&o)throw new Error("production"===process.env.NODE_ENV?OI(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&&o)throw new Error("production"===process.env.NODE_ENV?OI(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var dI=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function lI(...e){return t=>e.some((e=>((e,t)=>Fx(e)?e.match(t):e(t))(e,t)))}var cI=["name","message","stack","code"],uI=class{constructor(e,t){this.payload=e,this.meta=t}_type},hI=class{constructor(e,t){this.payload=e,this.meta=t}_type},pI=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of cI)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},fI=(()=>{function e(e,t,n){const o=Vx(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Vx(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Vx(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||pI)(e||"Rejected"),meta:{...i||{},arg:o,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):dI(),c=new AbortController;let u,h;function p(e){h=e,c.abort()}const f=async function(){let f;try{let i=n?.condition?.(e,{getState:a,extra:d});if(null!==(g=i)&&"object"==typeof g&&"function"==typeof g.then&&(i=await i),!1===i||c.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise(((e,t)=>{u=()=>{t({name:"AbortError",message:h||"Aborted"})},c.signal.addEventListener("abort",u)}));s(r(l,e,n?.getPendingMeta?.({requestId:l,arg:e},{getState:a,extra:d}))),f=await Promise.race([m,Promise.resolve(t(e,{dispatch:s,getState:a,extra:d,requestId:l,signal:c.signal,abort:p,rejectWithValue:(e,t)=>new uI(e,t),fulfillWithValue:(e,t)=>new hI(e,t)})).then((t=>{if(t instanceof uI)throw t;return t instanceof hI?o(t.payload,l,e,t.meta):o(t,l,e)}))])}catch(t){f=t instanceof uI?i(null,l,e,t.payload,t.meta):i(t,l,e)}finally{u&&c.signal.removeEventListener("abort",u)}var g;return n&&!n.dispatchConditionRejection&&i.match(f)&&f.meta.condition||s(f),f}();return Object.assign(f,{abort:p,requestId:l,arg:e,unwrap:()=>f.then(gI)})}}),{pending:r,rejected:i,fulfilled:o,settled:lI(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function gI(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var mI=Symbol.for("rtk-slice-createasyncthunk");function vI(e,t){return`${e}/${t}`}function bI({creators:e}={}){const t=e?.asyncThunk?.[mI];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?OI(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)||{},i=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?OI(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?OI(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?OI(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=[],o]="function"==typeof e.extraReducers?aI(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?OI(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,[o,r,i]=aI(t);if(function(e){return"function"==typeof e}(e))n=()=>Kx(e());else{const t=Kx(e);n=()=>t}function s(e=n(),t){let s=[o[t.type],...r.filter((({matcher:e})=>e(t))).map((({reducer:e})=>e))];return 0===s.filter((e=>!!e)).length&&(s=[i]),s.reduce(((e,n)=>{if(n){if(fc(e)){const o=n(e,t);return void 0===o?e:o}if(gc(e))return Yc(e,(e=>n(e,t)));{const o=n(e,t);if(void 0===o){if(null===e)return e;throw new Error("production"===process.env.NODE_ENV?OI(9):"A case reducer on a non-draftable value must not return undefined")}return o}}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);o&&e.addDefaultCase(o)}))}i.forEach((o=>{const i=r[o],s={reducerName:o,type:vI(n,o),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(i)?function({type:e,reducerName:t,createNotation:n},o,r){let i,s;if("reducer"in o){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(o))throw new Error("production"===process.env.NODE_ENV?OI(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");i=o.reducer,s=o.prepare}else i=o;r.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,s?Vx(e,s):Vx(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?OI(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:i,fulfilled:s,pending:a,rejected:d,settled:l,options:c}=n,u=r(e,i,c);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s);a&&o.addCase(u.pending,a);d&&o.addCase(u.rejected,d);l&&o.addMatcher(u.settled,l);o.exposeCaseReducer(t,{fulfilled:s||$I,pending:a||$I,rejected:d||$I,settled:l||$I})}(s,i,a,t)}));const l=e=>e,c=new Map;let u;function h(e,t){return u||(u=d()),u(e,t)}function p(){return u||(u=d()),u.getInitialState()}function f(t,n=!1){function o(e){let o=e[t];if(void 0===o)if(n)o=p();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?OI(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=l){const o=Hx(c,n,{insert:()=>new WeakMap});return Hx(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=yI(i,t,p,n);return o}})}return{reducerPath:t,getSelectors:r,get selectors(){return r(o)},selectSlice:o}}const g={name:n,reducer:h,actions:s.actionCreators,caseReducers:s.sliceCaseReducersByName,getInitialState:p,...f(o),injectInto(e,{reducerPath:t,...n}={}){const r=t??o;return e.inject({reducerPath:r,reducer:h},n),{...g,...f(r,!0)}}};return g}}function yI(e,t,n,o){function r(r,...i){let s=t(r);if(void 0===s)if(o)s=n();else if("production"!==process.env.NODE_ENV)throw new Error("production"===process.env.NODE_ENV?OI(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var wI=bI();function $I(){}var EI="listenerMiddleware",kI=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Vx(t).match;else if(n)t=n.type,r=n.match;else if(o)r=o;else if(!r)throw new Error("production"===process.env.NODE_ENV?OI(21):"Creating or removing a listener requires one of the known fields for matching an action");return((e,t)=>{if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?OI(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},CI=Object.assign((e=>{const{type:t,predicate:n,effect:o}=kI(e);return{id:dI(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?OI(22):"Unsubscribe not initialized")}}}),{withTypes:()=>CI}),xI=Object.assign(Vx(`${EI}/add`),{withTypes:()=>xI});Vx(`${EI}/removeAll`);var II=Object.assign(Vx(`${EI}/remove`),{withTypes:()=>II});function OI(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. `}const SI=["error","warn","info","debug"],jI=Cl((e=>{var t,n,o,r;return r=class extends e{constructor(){super(...arguments),t.add(this),n.set(this,p(this,t,"m",o).call(this,console))}set logger(e){f(this,n,p(this,t,"m",o).call(this,e),"f")}get logger(){return p(this,n,"f")}onLogEvent(e,t){}},n=new WeakMap,t=new WeakSet,o=function(e){return SI.reduce(((t,n)=>(t[n]=(...t)=>{var o;this.onLogEvent(n,t),null===(o=e[n])||void 0===o||o.call(e,...t)},t)),{})},r})),AI="undefined"!=typeof localStorage,RI=AI&&localStorage.getItem("base.content.url")||"",NI=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,MI=Cl((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)&&p(this,t,"f")&&(f(this,t,!1,"f"),this.init())}async init(){}},t=new WeakMap,n})),UI=Cl((e=>{var t,n;const o=vl(jI,MI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,{})}async init(){var e,n,o;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),n=this,o=e=>{var n;null===(n=p(this,t,"f")[e])||void 0===n||n.forEach((t=>{t(e,this.getAttribute(e))}))},Array.from(n.attributes).forEach((e=>o(e.name))),new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&o(e.attributeName)}))})).observe(n,{attributes:!0})}observeAttribute(e,n){p(this,t,"f")[e]||(p(this,t,"f")[e]=[]);const o=p(this,t,"f")[e].push(n);return()=>p(this,t,"f")[e].splice(o,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})),TI=e=>t=>{var n,o,r;const i=vl(jI,MI,UI)(t),s=Object.keys(e);return r=class extends i{constructor(...e){super(...e),n.add(this),this.observeAttributes(s,p(this,n,"m",o).bind(this))}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),s.forEach((e=>p(this,n,"m",o).call(this,e,this.getAttribute(e))))}},n=new WeakSet,o=function(t,n){const o=e[t],r="function"==typeof o?o(t,n):o;r&&this.logger.error(r)},r};TI.missingAttrValidator=NI;const DI=Cl((e=>{const t=vl(TI({"project-id":NI}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),PI=Cl((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const LI=Cl((e=>{const t=vl(jI,DI,PI)(e);return class extends t{async fetchStaticResource(e,t){const n=function({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o}){const r=new URL(RI||o||"https://static.descope.com/pages");return r.pathname=yl(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseStaticUrl}),o=await fetch(n,{cache:"default"});return o.ok||this.logger.error(`Error fetching URL ${n} [${o.status}]`),{body:await o[t](),headers:Object.fromEntries(o.headers.entries())}}get baseStaticUrl(){return this.getAttribute("base-static-url")}}})),_I=Cl((e=>{var t,n,o;const r=vl(LI)(e);return o=class extends r{constructor(){super(...arguments),t.set(this,void 0),n.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")}}))}get config(){return p(this,t,"f")||f(this,t,p(this,n,"f").call(this),"f"),p(this,t,"f")}},t=new WeakMap,n=new WeakMap,o})),WI=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(MI,jI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),this.attributeChangedCallback=(e,n,o)=>{var r;null===(r=super.attributeChangedCallback)||void 0===r||r.call(this,e,n,o),"debug"===e&&p(this,t,"m",i).call(this)}}get debug(){return"true"===this.getAttribute("debug")}onLogEvent(e,n){var o;null===(o=super.onLogEvent)||void 0===o||o.call(this,e,n),"error"===e&&p(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)),p(this,t,"m",i).call(this)}},n=new WeakMap,t=new WeakSet,o=function(){var e;null===(e=p(this,n,"f"))||void 0===e||e.remove(),f(this,n,null,"f")},r=async function(){f(this,n,document.createElement("descope-debugger"),"f"),Object.assign(p(this,n,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),await Promise.resolve().then((function(){return vO})),document.body.appendChild(p(this,n,"f"))},i=function(){this.debug?p(this,t,"m",r).call(this):p(this,t,"m",o).call(this)},s=function(e,t){var o;e&&(null===(o=p(this,n,"f"))||void 0===o||o.updateData({title:e,description:t}))},a})),FI="load-descope-ui",VI="base.ui.components.url",qI=AI&&localStorage.getItem(VI)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",BI=AI&&localStorage.getItem(VI)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",zI=e=>{const t=document.createElement("script");return t.id=e,t},KI=(e,t)=>e.replace("<version>",t),HI=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,u,h;const g=vl(jI,_I)(e);return h=class extends g{constructor(){super(...arguments),t.add(this),n.set(this,Symbol("errorCbs")),o.set(this,Symbol("loadCbs")),l.set(this,void 0)}get descopeUi(){return p(this,l,"f")||f(this,l,p(this,t,"m",u).call(this),"f"),p(this,l,"f")}async loadDescopeUiComponents(e){const n=Array.isArray(e)?e:(e=>[...Array.from(e.content.querySelectorAll("*")).reduce(((e,t)=>t.localName.startsWith("descope-")?e.add(t.localName):e),new Set)])(e);return Promise.all(n.map((e=>p(this,t,"m",c).call(this,e))))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,t=new WeakSet,r=async function(){var e;const t=await this.config,n=null===(e=null==t?void 0:t.projectConfig)||void 0===e?void 0:e.componentsVersion;return n?this.logger.debug(`Got component version "${n}"`):this.logger.error("Could not get components version"),n},i=function(e){const t=p(this,n,"f"),r=p(this,o,"f");e[t]=[],e[r]=[],Object.defineProperty(e,"onerror",{set(n){e[t].push(n)}}),Object.defineProperty(e,"onload",{set(t){e[r].push(t)}})},s=async function(e,n){this.logger.debug("Trying to load DescopeUI from a fallback URL");const o=zI("load-descope-ui-fallback-script");document.body.append(o),o.addEventListener("error",(()=>{e.forEach((e=>e(`Cannot load DescopeUI from fallback URL, Make sure this URL is valid and return the correct script: "${o.src}"`)))})),o.addEventListener("load",(()=>{n.forEach((e=>e()))})),o.src=KI(BI,await p(this,t,"m",r).call(this))},a=function(e){e.addEventListener("error",(()=>{e[p(this,n,"f")].forEach((t=>t(`Cannot load DescopeUI from main URL, Make sure this URL is valid and return the correct script: "${e.src}"`))),p(this,t,"m",s).call(this,e[p(this,n,"f")],e[p(this,o,"f")])})),e.addEventListener("load",(()=>{e[p(this,o,"f")].forEach((e=>e()))}))},d=async function(){if(document.querySelector(`script#${FI}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=zI(FI);document.body.append(e),p(this,t,"m",i).call(this,e),p(this,t,"m",a).call(this,e),e.src=KI(qI,await p(this,t,"m",r).call(this))}return document.getElementById(FI)},c=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(", ")}"`)},u=function(){return new Promise((e=>{globalThis.DescopeUI&&e(globalThis.DescopeUI),p(this,t,"m",d).call(this).then((t=>{t.onerror=this.logger.error,t.onload=()=>{this.logger.debug("DescopeUI was loaded"),e(globalThis.DescopeUI)},setTimeout((()=>{globalThis.DescopeUI&&e(globalThis.DescopeUI)}))}))}))},h})),GI="content-root",JI="root",ZI=Cl((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${JI}, #${GI} {\n height: 100%;\n }\n #${JI} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${JI}">\n <div id="${GI}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(GI),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(JI)}})),XI="descope-modal",YI=Cl((e=>{var t,n;const o=vl(MI,ZI,HI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends _l{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(XI);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(this,t,"f"))(n,{logger:this.logger})}async init(){var e;this.loadDescopeUiComponents([XI]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),QI="descope-notification";Cl((e=>{var t,n;const o=vl(MI,ZI,HI)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Vl{setContent(t){const n="string"==typeof t?bl(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(QI);return Object.keys(e).forEach((n=>{t.setAttribute(n,e[n])})),t})(Object.assign(Object.assign({},{}),e));return this.rootElement.append(n),new(p(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([QI])}},t=new WeakMap,n}));const eO=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',tO=Cl((e=>{var t,n,o,r,i,s,a,d,l;const c=vl(TI({theme:eO}),LI,MI,HI,_I,ZI,UI)(e);return l=class extends c{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}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"}async init(){var e;await(null===(e=super.init)||void 0===e?void 0:e.call(this)),p(this,t,"m",i).call(this),p(this,t,"m",s).call(this),p(this,t,"m",a).call(this),p(this,t,"m",d).call(this),this.observeAttributes(["theme"],(()=>{p(this,t,"m",a).call(this),p(this,t,"m",d).call(this)}))}},n=new WeakMap,t=new WeakSet,o=async function(){try{const{body:e}=await this.fetchStaticResource("theme.json","json");if("development"===process.env.NODE_ENV&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(VI)))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(VI),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({},t.light.components),e.light.components),e.dark.components=Object.assign(Object.assign({},t.dark.components),e.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")}},r=function(){return p(this,n,"f")||(f(this,n,p(this,t,"m",o).call(this),"f"),p(this,n,"f").then((e=>this.logger.debug("Fetched theme",e)))),p(this,n,"f")},i=async function(){var e,n;const o=await p(this,t,"a",r);if(!o)return;const i=document.createElement("style");i.innerText=((null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.globals)||"")+((null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.globals)||""),this.shadowRoot.appendChild(i)},s=async function(){var e,n;const o=Object.assign({},await p(this,t,"a",r));if(!o)return;const i=await this.descopeUi;(null==i?void 0:i.componentsThemeManager)&&(i.componentsThemeManager.themes={light:null===(e=null==o?void 0:o.light)||void 0===e?void 0:e.components,dark:null===(n=null==o?void 0:o.dark)||void 0===n?void 0:n.components})},a=async function(){var e,t;const{projectConfig:n}=await this.config,o=null===(t=null===(e=null==n?void 0:n.cssTemplate)||void 0===e?void 0:e[this.theme])||void 0===t?void 0:t.fonts;o&&Object.values(o).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))}))},d=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)},l})),nO=e=>Cl((t=>{const n=wI(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(vl(jI)(t)){constructor(...e){super(...e);const t=function(e){const t=nI(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!Ql(n))throw new Error("production"===process.env.NODE_ENV?OI(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=rc(n)}if(!sI&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?OI(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!sI&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?OI(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!sI&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?OI(4):"each middleware provided to configureStore must be a function");let l=ic;r&&(l=Wx({trace:!sI,..."object"==typeof r&&r}));const c=sc(...d),u=iI(c);if(!sI&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?OI(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!sI&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?OI(6):"`enhancers` callback must return an array");if(!sI&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?OI(7):"each enhancer provided to configureStore must be a function");return sI||!d.length||h.includes(c)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),nc(a,i,l(...h))}({reducer:n.reducer,middleware:e=>e({thunk:{extraArgument:this},serializableCheck:!1}),devTools:!1}),r=e=>async(...n)=>{const o=await t.dispatch(e(...n));try{gI(o)}catch(e){this.logger.error(e.message,o.type,e.stack)}return o},i=Object.keys(o).reduce(((e,t)=>(e[t]=r(o[t]),e)),{});this.actions=i,this.subscribe=(e,n=(e=>e))=>t.subscribe((()=>e(n(t.getState()))))}}}));Cl((e=>class extends(jI(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()}}));const oO=Cl((e=>class extends e{get baseStaticUrl(){return this.getAttribute("base-static-url")}})),rO=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var iO,sO,aO,dO,lO,cO,uO,hO,pO,fO;const gO=document.createElement("template");gO.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class mO extends HTMLElement{constructor(){var e;super(),iO.add(this),sO.set(this,new Nl({messages:[]})),aO.set(this,void 0),dO.set(this,void 0),lO.set(this,void 0),cO.set(this,{resize:p(this,iO,"m",fO).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(gO.content.cloneNode(!0)),f(this,aO,this.shadowRoot.querySelector(".debugger"),"f"),f(this,dO,p(this,aO,"f").querySelector(".content"),"f"),f(this,lO,p(this,aO,"f").querySelector(".header"),"f")}updateData(e){p(this,sO,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=rO(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,aO,"f"),p(this,lO,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,cO,"f").resize),(e=p(this,aO,"f")).onmousemove=t=>{var n;const o=t.target;(o.w&&o.w!==o.offsetWidth||o.h&&o.h!==o.offsetHeight)&&(null===(n=e.onresize)||void 0===n||n.call(e,t)),o.w=o.offsetWidth,o.h=o.offsetHeight},p(this,aO,"f").onresize=p(this,iO,"m",pO).bind(this),p(this,sO,"f").subscribe(p(this,iO,"m",uO).bind(this))}disconnectedCallback(){p(this,sO,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,cO,"f").resize)}}sO=new WeakMap,aO=new WeakMap,dO=new WeakMap,lO=new WeakMap,cO=new WeakMap,iO=new WeakSet,uO=function(e){p(this,iO,"m",hO).call(this,e),p(this,iO,"m",pO).call(this)},hO=function(e){p(this,dO,"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("")},pO=function(){p(this,dO,"f").querySelectorAll(".msg").forEach((e=>{const t=e,n=t.querySelector(".msg_desc"),o=n.scrollWidth>n.clientWidth,r=n.clientHeight>20;o||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)}))},fO=function(){const[e,t]=rO(p(this,aO,"f"),Number.parseInt(p(this,aO,"f").style.left,10),Number.parseInt(p(this,aO,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,aO,"f").style.top=`${t}px`,p(this,aO,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",mO);var vO=Object.freeze({__proto__:null});const bO=e=>e.me.data,yO=lu(bO,(e=>e.picture)),wO=lu(bO,(e=>e.email)),$O=lu(bO,(e=>e.verifiedEmail)),EO=lu(bO,(e=>e.name)),kO=lu(bO,(e=>e.phone)),CO=lu(bO,(e=>e.verifiedPhone)),xO=lu(bO,(e=>e.webauthn));lu(bO,(e=>e.password));const IO=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)}))}))},OO=fI("users/me",((e,{extra:{api:t}})=>t.user.me())),SO=IO(OO)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(jO=e=>e.me,{onFulfilled:e=>{jO(e).loading=!1},onPending:e=>{jO(e).loading=!0,jO(e).error=null},onRejected:(e,t)=>{jO(e).loading=!1,jO(e).error=t.error}}));var jO;const AO={action:OO,reducer:SO},RO=fI("users/logout",((e,{extra:{api:t}})=>t.user.logout())),NO={action:RO,reducer:IO(RO)({})},MO={me:{loading:!1,error:null,data:{}}},UO="/v1/auth/me",TO=({httpClient:e,mock:t})=>({me:()=>u(void 0,void 0,void 0,(function*(){if(t)return u(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(UO);return yield(e=>u(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()}))}),DO=Cl((e=>{var t,n,o,r;const i=vl(DI,UI,jI,PI)(e);return r=class extends i{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 p(this,n,"f")||p(this,t,"m",o).call(this),p(this,n,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});var r;return u(this,void 0,void 0,(function*(){yield null===(r=e.init)||void 0===r?void 0:r.call(this),this.observeAttributes(["project-id","base-url"],(()=>{p(this,n,"f")&&p(this,t,"m",o).call(this)}))}))}},n=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),f(this,n,((e,t,n)=>{const o=so(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.0.59"}}));return{user:Object.assign(Object.assign({},TO({httpClient:o.httpClient,mock:t})),{logout:t?()=>u(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},r})),PO=Cl((e=>{const t=vl(nO({name:"widget",initialState:MO,reducers:{},extraReducers:e=>{AO.reducer(e),NO.reducer(e)},asyncActions:{getMe:AO.action,logout:NO.action}}),MI,jI,DO)(e);return class extends t{constructor(...e){super(...e),this.state=MO,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),LO=Cl((e=>{const t=vl(LI,TI({"widget-id":TI.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return u(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),_O=Cl((e=>{var t,n,o;return o=class extends(vl(jI,MI,HI,ZI,LO,PO)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return u(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this),yield Promise.all([this.actions.getMe(),p(this,t,"m",n).call(this)]),this.onWidgetRootReady()}))}},t=new WeakSet,n=function(){return u(this,void 0,void 0,(function*(){const e=bl(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),WO=(e={})=>{const t=bl("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,n])=>{t.content.querySelector("descope-wc").setAttribute((e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase())(e),n)})),t};function FO(e){return new URLSearchParams(window.location.search).get(e)}const VO=Cl((e=>{var t,n,o,r,i,s,a,d,l;return l=class extends(vl(PO,jI,_O,YI,oO)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,$l((e=>{this.avatar.image=e}))),d.set(this,$l((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",s).call(this),p(this,t,"m",r).call(this),p(this,a,"f").call(this,yO(this.state)),p(this,d,"f").call(this,EO(this.state)),this.subscribe(p(this,a,"f").bind(this),yO),this.subscribe(p(this,d,"f").bind(this),EO)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,d=new WeakMap,t=new WeakSet,r=function(){f(this,n,this.createModal({"data-id":"update-pic"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",i).bind(this),p(this,t,"m",i).call(this)},i=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new zl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{p(this,n,"f").open()}))},l})),qO=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,h,g,m;return m=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),h.set(this,$l((e=>{this.emailUserAttr.value=e}))),g.set(this,$l((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",c).call(this),p(this,t,"m",s).call(this),p(this,t,"m",d).call(this),p(this,h,"f").call(this,wO(this.state)),p(this,g,"f").call(this,$O(this.state)),this.subscribe(p(this,h,"f").bind(this),wO),this.subscribe(p(this,g,"f").bind(this),$O)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,h=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-email"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",a).bind(this),p(this,t,"m",a).call(this)},a=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},d=function(){f(this,r,this.createModal({"data-id":"delete-email"}),"f"),f(this,i,new Gl((()=>{var e;return null===(e=p(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,r,"f").afterClose=p(this,t,"m",l).bind(this),p(this,t,"m",l).call(this)},l=function(){p(this,r,"f").setContent(WO({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,i,"f").onSuccess((()=>{p(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.emailUserAttr=new Kl((()=>{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((()=>{p(this,n,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{p(this,r,"f").open()}))},m})),BO=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,h,g;return g=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),h.set(this,$l((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",c).call(this),p(this,t,"m",s).call(this),p(this,t,"m",d).call(this),p(this,h,"f").call(this,EO(this.state)),this.subscribe(p(this,h,"f").bind(this),EO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,h=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-name"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",a).bind(this),p(this,t,"m",a).call(this)},a=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},d=function(){f(this,r,this.createModal({"data-id":"delete-name"}),"f"),f(this,i,new Gl((()=>{var e;return null===(e=p(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,r,"f").afterClose=p(this,t,"m",l).bind(this),p(this,t,"m",l).call(this)},l=function(){p(this,r,"f").setContent(WO({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,i,"f").onSuccess((()=>{p(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.nameUserAttr=new Kl((()=>{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((()=>{p(this,n,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{p(this,r,"f").open()}))},g})),zO=Cl((e=>{var t,n,o,r,i,s,a,d,l,c,h,g,m;return m=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),r.set(this,void 0),i.set(this,void 0),h.set(this,$l((e=>{this.phoneUserAttr.value=e}))),g.set(this,$l((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",c).call(this),p(this,t,"m",s).call(this),p(this,t,"m",d).call(this),p(this,h,"f").call(this,kO(this.state)),p(this,g,"f").call(this,CO(this.state)),this.subscribe(p(this,h,"f").bind(this),kO),this.subscribe(p(this,g,"f").bind(this),CO)}))}},n=new WeakMap,o=new WeakMap,r=new WeakMap,i=new WeakMap,h=new WeakMap,g=new WeakMap,t=new WeakSet,s=function(){f(this,n,this.createModal({"data-id":"edit-phone"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",a).bind(this),p(this,t,"m",a).call(this)},a=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},d=function(){f(this,r,this.createModal({"data-id":"delete-phone"}),"f"),f(this,i,new Gl((()=>{var e;return null===(e=p(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,r,"f").afterClose=p(this,t,"m",l).bind(this),p(this,t,"m",l).call(this)},l=function(){p(this,r,"f").setContent(WO({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,i,"f").onSuccess((()=>{p(this,r,"f").close(),this.actions.getMe()}))},c=function(){this.phoneUserAttr=new Kl((()=>{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((()=>{p(this,n,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{p(this,r,"f").open()}))},m})),KO=Cl((e=>{var t,n,o,r,i,s,a,d;return d=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,$l((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",s).call(this),p(this,t,"m",r).call(this),p(this,a,"f").call(this,xO(this.state)),this.subscribe(p(this,a,"f").bind(this),xO)}))}},n=new WeakMap,o=new WeakMap,a=new WeakMap,t=new WeakSet,r=function(){f(this,n,this.createModal({"data-id":"passkey"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",i).bind(this),p(this,t,"m",i).call(this)},i=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new Hl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{p(this,n,"f").open()}))},d})),HO=Cl((e=>{var t,n,o,r,i,s,a;return a=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var n;return u(this,void 0,void 0,(function*(){yield null===(n=e.onWidgetRootReady)||void 0===n?void 0:n.call(this),p(this,t,"m",s).call(this),p(this,t,"m",r).call(this)}))}},n=new WeakMap,o=new WeakMap,t=new WeakSet,r=function(){f(this,n,this.createModal({"data-id":"password"}),"f"),f(this,o,new Gl((()=>{var e;return null===(e=p(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),p(this,n,"f").afterClose=p(this,t,"m",i).bind(this),p(this,t,"m",i).call(this)},i=function(){p(this,n,"f").setContent(WO({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),p(this,o,"f").onSuccess((()=>{p(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new Hl((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{p(this,n,"f").open()}))},a})),GO=Cl((e=>{var t,n,o;return o=class extends(vl(PO,jI,_O,YI)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.onWidgetRootReady)||void 0===o?void 0:o.call(this),p(this,t,"m",n).call(this)}))}},t=new WeakSet,n=function(){this.logout=new Pl((()=>{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((()=>u(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),JO="widget-flow",ZO=Cl((e=>{var t,n,o;return o=class extends(vl(MI,YI,PO,jI)(e)){constructor(){super(...arguments),t.add(this)}init(){const e=Object.create(null,{init:{get:()=>super.init}});var o;return u(this,void 0,void 0,(function*(){yield null===(o=e.init)||void 0===o?void 0:o.call(this);const r=FO(JO);r&&(function(e){if(window.history.replaceState&&FO(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())}}(JO),p(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(WO({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));const n=new Gl((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger});n.onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},o})),XO=Cl((e=>class extends(vl(WI,tO,ZO,qO,VO,BO,zO,KO,HO,GO)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),YO=vl((e=>class extends(XO(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});var t;return u(this,void 0,void 0,(function*(){yield null===(t=e.init)||void 0===t?void 0:t.call(this),_x.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.59"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",YO);var QO=Object.freeze({__proto__:null,default:YO});const eS=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var tS,nS,oS,rS,iS,sS,aS,dS,lS,cS;const uS=document.createElement("template");uS.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class hS extends HTMLElement{constructor(){super(),tS.add(this),nS.set(this,new sd({messages:[]})),oS.set(this,void 0),rS.set(this,void 0),iS.set(this,void 0),sS.set(this,{resize:p(this,tS,"m",cS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(uS.content.cloneNode(!0)),f(this,oS,this.shadowRoot.querySelector(".debugger"),"f"),f(this,rS,p(this,oS,"f").querySelector(".content"),"f"),f(this,iS,p(this,oS,"f").querySelector(".header"),"f")}updateData(e){p(this,nS,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=eS(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,oS,"f"),p(this,iS,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,sS,"f").resize),(e=p(this,oS,"f")).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},p(this,oS,"f").onresize=p(this,tS,"m",lS).bind(this),p(this,nS,"f").subscribe(p(this,tS,"m",aS).bind(this))}disconnectedCallback(){p(this,nS,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,sS,"f").resize)}}nS=new WeakMap,oS=new WeakMap,rS=new WeakMap,iS=new WeakMap,sS=new WeakMap,tS=new WeakSet,aS=function(e){p(this,tS,"m",dS).call(this,e),p(this,tS,"m",lS).call(this)},dS=function(e){p(this,rS,"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("")},lS=function(){p(this,rS,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},cS=function(){const[e,t]=eS(p(this,oS,"f"),Number.parseInt(p(this,oS,"f").style.left,10),Number.parseInt(p(this,oS,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,oS,"f").style.top=`${t}px`,p(this,oS,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",hS);var pS=Object.freeze({__proto__:null,default:hS});const fS=(e,t,n,o={})=>{var r,i,s,a;return[Math.min(Math.max(t,("all"===o.left?e.offsetWidth:null!==(r=o.left)&&void 0!==r?r:0)-e.offsetWidth),window.innerWidth-("all"===o.right?e.offsetWidth:null!==(i=o.right)&&void 0!==i?i:0)),Math.min(Math.max(n,("all"===o.top?e.offsetHeight:null!==(s=o.top)&&void 0!==s?s:0)-e.offsetHeight),window.innerHeight-("all"===o.bottom?e.offsetHeight:null!==(a=o.bottom)&&void 0!==a?a:0))]};var gS,mS,vS,bS,yS,wS,$S,ES,kS,CS;const xS=document.createElement("template");xS.innerHTML=`\n<style>\n .debugger {\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</style>\n\n<div style="top:32px; left:${window.innerWidth-300-32}px;" class="debugger">\n <div class="header">\n <span>Debugger messages</span>\n </div>\n <div class="content">\n <div class="empty-state">\n No errors detected 👀\n </div>\n </div>\n</div>\n`;class IS extends HTMLElement{constructor(){super(),gS.add(this),mS.set(this,new AC({messages:[]})),vS.set(this,void 0),bS.set(this,void 0),yS.set(this,void 0),wS.set(this,{resize:p(this,gS,"m",CS).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(xS.content.cloneNode(!0)),f(this,vS,this.shadowRoot.querySelector(".debugger"),"f"),f(this,bS,p(this,vS,"f").querySelector(".content"),"f"),f(this,yS,p(this,vS,"f").querySelector(".header"),"f")}updateData(e){p(this,mS,"f").update((t=>({messages:t.messages.concat(e)})))}connectedCallback(){var e;((e,t,n)=>{let o=0,r=0,i=0,s=0;function a(t){t.preventDefault(),o=i-t.clientX,r=s-t.clientY,i=t.clientX,s=t.clientY;const[a,d]=fS(e,e.offsetLeft-o,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(),i=e.clientX,s=e.clientY,document.onmouseup=d,document.onmousemove=a}t?t.onmousedown=l:e.onmousedown=l})(p(this,vS,"f"),p(this,yS,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",p(this,wS,"f").resize),(e=p(this,vS,"f")).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},p(this,vS,"f").onresize=p(this,gS,"m",kS).bind(this),p(this,mS,"f").subscribe(p(this,gS,"m",$S).bind(this))}disconnectedCallback(){p(this,mS,"f").unsubscribeAll(),window.removeEventListener("resize",p(this,wS,"f").resize)}}mS=new WeakMap,vS=new WeakMap,bS=new WeakMap,yS=new WeakMap,wS=new WeakMap,gS=new WeakSet,$S=function(e){p(this,gS,"m",ES).call(this,e),p(this,gS,"m",kS).call(this)},ES=function(e){p(this,bS,"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("")},kS=function(){p(this,bS,"f").querySelectorAll(".msg").forEach((e=>{const t=e.querySelector(".msg_desc"),n=t.scrollWidth>t.clientWidth,o=t.clientHeight>20;n||o?(e.classList.add("collapsible"),e.onclick=t=>{t.target.classList.contains("msg_desc")||e.classList.toggle("collapsed")}):(e.classList.remove("collapsible"),e.onclick=null)}))},CS=function(){const[e,t]=fS(p(this,vS,"f"),Number.parseInt(p(this,vS,"f").style.left,10),Number.parseInt(p(this,vS,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});p(this,vS,"f").style.top=`${t}px`,p(this,vS,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",IS);var OS=Object.freeze({__proto__:null,default:IS});e.AccessKeyManagement=Eo,e.AuditManagement=Co,e.AuthProvider=({projectId:e,baseUrl:n="",baseStaticUrl:s="",sessionTokenViaCookie:d=!1,persistTokens:l=!0,storeLastAuthenticatedUser:c=!0,keepLastAuthenticatedUserAfterLogout:u=!1,children:h})=>{const[p,f]=t.useState(),[g,m]=t.useState(),[v,b]=t.useState(!1),[y,w]=t.useState(!1),$=(({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,storeLastAuthenticatedUser:i,keepLastAuthenticatedUserAfterLogout:s})=>t.useMemo((()=>{if(e)return lo({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:a,persistTokens:o,storeLastAuthenticatedUser:i,keepLastAuthenticatedUserAfterLogout:s,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:l,sessionTokenViaCookie:d,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u});t.useEffect((()=>{if($){const e=$.onSessionTokenChange(m),t=$.onUserChange(f);return()=>{e(),t()}}}),[$]);const E=t.useRef(!1),k=t.useCallback((()=>{E.current||(E.current=!0,w(!0),i(null==$?void 0:$.refresh)().then((()=>{w(!1)})))}),[$]),C=t.useCallback((()=>{b(!0),i($.me)().then((()=>{b(!1)}))}),[$]),x=t.useMemo((()=>({fetchUser:C,user:p,isUserLoading:v,fetchSession:k,session:g,isSessionLoading:y,isSessionFetched:E.current,projectId:e,baseUrl:n,baseStaticUrl:s,storeLastAuthenticatedUser:c,keepLastAuthenticatedUserAfterLogout:u,setUser:f,setSession:m,sdk:$})),[C,p,v,k,g,y,E.current,e,n,s,f,m,$]);return o.default.createElement(r.Provider,{value:x},h)},e.Descope=mo,e.RoleManagement=wo,e.SignInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>o.default.createElement(mo,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=bo,e.UserProfile=Io,e.baseHeaders=a,e.getJwtPermissions=po,e.getJwtRoles=fo,e.getRefreshToken=ho,e.getSessionToken=uo,e.isRefreshTokenExpired=(e=ho())=>null==ao?void 0:ao.isJwtExpired(e),e.isSessionTokenExpired=(e=uo())=>null==ao?void 0:ao.isJwtExpired(e),e.refresh=(e=ho())=>null==ao?void 0:ao.refresh(e),e.useDescope=()=>{const{sdk:e}=Oo();return t.useMemo((()=>e||new Proxy(co(),jo)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:o,isSessionFetched:r}=Oo(),i=t.useRef(n);t.useMemo((()=>{i.current=n}),[n]);const s=!e&&!n;return t.useMemo((()=>{s&&!r&&(i.current=!0)}),[r]),t.useEffect((()=>{s&&o()}),[o]),{isSessionLoading:i.current,sessionToken:e,isAuthenticated:!!e}},e.useUser=()=>{const{user:e,fetchUser:n,isUserLoading:o,session:r}=Oo(),[i,s]=t.useState(!1),a=t.useRef(o),d=t.useMemo((()=>!e&&!o&&r&&!i),[n,r,i]);return t.useMemo((()=>{a.current=o}),[o]),t.useMemo((()=>{d&&(a.current=!0)}),[d]),t.useEffect((()=>{d&&(s(!0),n())}),[d]),{isUserLoading:a.current,user:e}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
3
3
|
//# sourceMappingURL=index.umd.js.map
|