@descope/react-sdk 2.0.27 → 2.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +7 -7
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.27"},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",_="v1/auth/oauth/native/start",W="v1/auth/oauth/native/finish",L="/v1/auth/saml/authorize",U="/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={}));var ve=429;function ye(e,t,n){var o;let r=be(e);t&&(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 be(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return v(e)}function $e(e){const{exp:t}=be(e);return(new Date).getTime()/1e3>t}function we(e){let t=be(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Ee(e,t){return ye(e,t,"permissions")}function ke(e,t){return ye(e,t,"roles")}const Ce=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function xe(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===ve&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Oe=(...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}),{})),Se=e=>void 0===e?void 0:JSON.stringify(e),Ie=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},je=({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=>{const s=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:d,body:c,headers:l,queryParams:u,method:h,token:p}=s,f={headers:Oe(Ie(t,p),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.14.7"},(null==n?void 0:n.baseHeaders)||{},l),method:h,body:Se(c)};null!==i&&(f.credentials=i||"include");const g=await a((({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(he,r?r+".":"");const i=new URL(t);return i.pathname=Ce(i.pathname,e),n&&(i.search=new URLSearchParams(n).toString()),i})({path:d,baseUrl:e,queryParams:u,projectId:t}),f);return(null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==g?void 0:g.clone()),g};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}},Re=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Ne=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Me=e=>t=>e.test(t),Ae=Me(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),De=Me(/^\+[1-9]{1}[0-9]{3,14}$/),Te=Re(Ae,'"{val}" is not a valid email'),Pe=Re(De,'"{val}" is not a valid phone number'),_e=Re((1,e=>e.length>=1),"Minimum length is 1");const We=Re((e=>"string"==typeof e),"Input is not a string"),Le=Re((e=>void 0===e),"Input is defined"),Ue=(Fe=[We(),Le()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=Fe.filter((e=>e(t)));return!(n.length<Fe.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var Fe;const Ve=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Ne(...e).validate(n[t]))),t(...n)),qe=e=>[We(`"${e}" must be a string`)],Be=e=>[We(`"${e}" must be a string`),_e(`"${e}" must not be empty`)],ze=e=>[We(`"${e}" must be a string`),Te()],Ke=e=>[We(`"${e}" must be a string`),Pe()],He=Ve(Be("accessKey")),Ge=e=>({exchange:He(((t,n)=>xe(e.post(y,{loginOptions:n},{token:t}))))}),Je=(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),Xe=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||fe,fe)});var Ze,Ye;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Ze||(Ze={})),function(e){e.email="email"}(Ye||(Ye={}));const Qe=Object.assign(Object.assign({},Ze),Ye);var et;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(et||(et={}));const tt=Be("loginId"),nt=Ve(Be("token")),ot=Ve(tt),rt=Ve(Be("pendingRef")),it=Ve(tt,ze("email")),st=e=>({verify:nt((t=>xe(e.post(j,{token:t})))),signIn:ot(((t,n,o,r)=>xe(e.post(Ce(R,Qe.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:ot(((t,n,o)=>xe(e.post(Ce(D,Qe.email),{loginId:t,URI:n,loginOptions:o})))),signUp:ot(((t,n,o,r)=>xe(e.post(Ce(N,Qe.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:rt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Xe(n);let s;const a=setInterval((async()=>{const n=await e.post(M,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(xe(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:it(((t,n,o,r,i)=>xe(e.post(A.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),at=Ve(Be("flowId")),dt=Ve(Be("executionId"),Be("stepId"),Be("interactionId")),ct=e=>({start:at(((t,n,o,r,i,s,a)=>xe(e.post(le,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:dt(((t,n,o,r,i,s)=>xe(e.post(ue,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),lt=Be("loginId"),ut=Ve(Be("token")),ht=Ve(lt),pt=Ve(lt,Ke("phone")),ft=Ve(lt,ze("email")),gt=Object.keys(Qe).filter((e=>e!==Ze.voice)),mt=e=>({verify:ut((t=>xe(e.post(C,{token:t})))),signIn:gt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ht(((t,o,r,i)=>xe(e.post(Ce(x,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:gt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ht(((t,o,r,i)=>xe(e.post(Ce(O,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:gt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ht(((t,o,r)=>xe(e.post(Ce(I,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:ft(((t,n,o,r,i)=>xe(e.post(S.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Ze).filter((e=>e!==Ze.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r,i,s)=>xe(e.post(Ce(S.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var vt;!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"}(vt||(vt={}));const yt=Ve(Be("code")),bt=e=>({start:Object.assign(((t,n,o,r)=>xe(e.post(T,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(vt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>xe(e.post(T,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:yt((t=>xe(e.post(P,{code:t})))),startNative:(t,n)=>xe(e.post(_,{provider:t,loginOptions:n})),finishNative:(t,n,o,r,i)=>xe(e.post(W,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),$t=Be("loginId"),wt=Ve($t,Be("code")),Et=Ve($t),kt=Ve($t,Ke("phone")),Ct=Ve($t,ze("email")),xt=e=>({verify:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:wt(((t,o)=>xe(e.post(Ce(b,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o,r)=>xe(e.post(Ce($,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o,r)=>xe(e.post(Ce(w,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o)=>xe(e.post(Ce(k,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:Ct(((t,n,o,r)=>xe(e.post(E.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Ze).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o,r,i)=>xe(e.post(Ce(E.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Ot=Ve(Be("tenant")),St=Ve(Be("code")),It=e=>({start:Ot(((t,n,o,r)=>xe(e.post(L,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:St((t=>xe(e.post(U,{code:t}))))}),jt=Be("loginId"),Rt=Ve(jt,Be("code")),Nt=Ve(jt),Mt=Ve(jt),At=e=>({signUp:Nt(((t,n)=>xe(e.post(V,{loginId:t,user:n})))),verify:Rt(((t,n,o,r)=>xe(e.post(F,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Mt(((t,n)=>xe(e.post(q,{loginId:t},{token:n}))))}),Dt=Be("loginId"),Tt=Be("newPassword"),Pt=Ve(Dt,Be("password")),_t=Ve(Dt),Wt=Ve(Dt,Tt),Lt=Ve(Dt,Be("oldPassword"),Tt),Ut=e=>({signUp:Pt(((t,n,o)=>xe(e.post(Y,{loginId:t,password:n,user:o})))),signIn:Pt(((t,n)=>xe(e.post(Q,{loginId:t,password:n})))),sendReset:_t(((t,n,o)=>xe(e.post(ee,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Wt(((t,n,o)=>xe(e.post(te,{loginId:t,newPassword:n},{token:o})))),replace:Lt(((t,n,o)=>xe(e.post(ne,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>xe(e.get(oe))}),Ft=qe("loginId"),Vt=Be("loginId"),qt=Be("origin"),Bt=Ve(Vt,qt,Be("name")),zt=Ve(Vt,qt),Kt=Ve(Ft,qt),Ht=Ve(Vt,qt,Be("token")),Gt=Ve(Be("transactionId"),Be("response")),Jt=e=>({signUp:{start:Bt(((t,n,o)=>xe(e.post(G.start,{user:{loginId:t,name:o},origin:n})))),finish:Gt(((t,n)=>xe(e.post(G.finish,{transactionId:t,response:n}))))},signIn:{start:Kt(((t,n,o,r)=>xe(e.post(J.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Gt(((t,n)=>xe(e.post(J.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:zt(((t,n)=>xe(e.post(X.start,{loginId:t,origin:n}))))},update:{start:Ht(((t,n,o)=>xe(e.post(Z.start,{loginId:t,origin:n},{token:o})))),finish:Gt(((t,n)=>xe(e.post(Z.finish,{transactionId:t,response:n}))))}}),Xt=qe("loginId"),Zt=Ve(Xt),Yt=Ve(Be("pendingRef")),Qt=e=>({signUpOrIn:Zt(((t,n)=>xe(e.post(K,{loginId:t,loginOptions:n})))),signUp:Zt(((t,n,o)=>xe(e.post(z,{loginId:t,user:n,loginOptions:o})))),signIn:Zt(((t,n,o)=>xe(e.post(B,{loginId:t,loginOptions:n},{token:o})))),waitForSession:Yt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Xe(n);let s;const a=setInterval((async()=>{const n=await e.post(H,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(xe(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),en=Ve(Be("token")),tn=Ve([Ue('"token" must be string or undefined')]);var nn,on=Ve([("projectId",nn=Be("projectId"),Re(((e,t)=>n=>Ne(...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",nn))())])((e=>(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=je({baseUrl:n||pe,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Ge(a),otp:xt(a),magicLink:mt(a),enchantedLink:st(a),oauth:bt(a),saml:It(a),totp:At(a),notp:Qt(a),webauthn:Jt(a),password:Ut(a),flow:ct(a),refresh:tn((e=>xe(a.post(re,{},{token:e})))),selectTenant:Ve([We("tenantId")],[Ue('"token" must be string or undefined')])(((e,t)=>xe(a.post(ie,{tenant:e},{token:t})))),logout:tn((e=>xe(a.post(se,{},{token:e})))),logoutAll:tn((e=>xe(a.post(ae,{},{token:e})))),me:tn((e=>xe(a.get(de,{token:e})))),history:tn((e=>xe(a.get(ce,{token:e})))),isJwtExpired:en($e),getTenants:en(we),getJwtPermissions:en(Ee),getJwtRoles:en(ke),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))}))}}})))),rn=Object.assign(on,{DeliveryMethods:Qe});var sn={default:"endpoint"},an="Blocked by CSP",dn="The endpoint parameter is not a valid URL",cn="Failed to load the JS script of the agent",ln="9319";function un(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===an||s===dn)n.exclude(),i=0;else if(s===ln)n.exclude();else if(s===cn){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 hn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",pn=hn;function fn(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:hn,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.3"):e}))}(String(e),t)}))}(s,r);return un(e,gn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===ln?new Error(cn):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 gn(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(an)}();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(dn);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(cn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(mn)}function mn(){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(ln);return n}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yn={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:"/"})}()}(yn);var bn=vn(yn.exports);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},wn=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||{}},En=async e=>{const t=await wn(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},kn="undefined"!=typeof localStorage,Cn=(e,t)=>kn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),xn=e=>kn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),On=e=>kn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Sn=(...e)=>{console.debug(...e)},In="undefined"!=typeof window,jn=Math.pow(2,31)-1,Rn=In&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Nn="fp",Mn=(e=!1)=>{const t=localStorage.getItem(Nn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},An=async(e,t=Rn)=>{try{if(Mn())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=fn({apiKey:e,endpoint:[o.toString(),sn],scriptUrlPattern:[i,pn]}),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(Nn,JSON.stringify(t))})(c)}catch(e){console.warn("Could not load fingerprint",e)}},Dn=e=>{const t=Mn(!0);return t&&e.body&&(e.body.fpData=t),e},Tn="dls_last_user_login_id",Pn="dls_last_user_display_name",_n=()=>xn(Tn),Wn=()=>xn(Pn),Ln=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=_n(),i=Wn();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},Un=e=>async(...t)=>{const n=await e(...t);return On(Tn),On(Pn),n};function Fn(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const Vn="DS",qn="DSR";function Bn(e=""){return xn(`${e}${qn}`)||""}function zn(e=""){On(`${e}${qn}`),On(`${e}${Vn}`),bn.remove(Vn)}async function Kn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Yn(n.publicKey.challenge),n.publicKey.user.id=Yn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Yn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Qn(n.rawId),type:n.type,response:{attestationObject:Qn(n.response.attestationObject),clientDataJSON:Qn(n.response.clientDataJSON)}});var n}async function Hn(e){const t=Xn(e);return Zn(await navigator.credentials.get(t))}async function Gn(e,t){const n=Xn(e);return n.signal=t.signal,n.mediation="conditional",Zn(await navigator.credentials.get(n))}async function Jn(e=!1){if(!In)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=Yn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Yn(e.id)})),n}function Zn(e){return JSON.stringify({id:e.id,rawId:Qn(e.rawId),type:e.type,response:{authenticatorData:Qn(e.response.authenticatorData),clientDataJSON:Qn(e.response.clientDataJSON),signature:Qn(e.response.signature),userHandle:e.response.userHandle?Qn(e.response.userHandle):void 0}})}function Yn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Qn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var eo,to=(eo=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 Kn(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 Hn(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 Kn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Hn(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 Kn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Kn,get:Hn,isSupported:Jn,conditional:Gn}}),(...e)=>{const t=eo(...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 no=e=>({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())}))}))}});var oo=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Jn(),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 ro=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 In?(n&&o&&An(n).catch((()=>null)),e($n(r,{beforeRequest:Dn}))):(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;document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Sn("Expiration time passed, refreshing session"),d.refresh(a))}));const d=e($n(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await wn(t);if(401===(null==t?void 0:t.status))Sn("Received 401, canceling all timers"),r();else if(o){s=(e=>{const t=e.split(".");try{if(3===t.length){const e=JSON.parse(window.atob(t[1]));if(e.exp)return new Date(1e3*e.exp)}}catch(e){}return null})(o),a=n;let e=((c=s)?c.getTime()-(new Date).getTime():0)-2e4;e>jn&&(Sn(`Timeout is too large (${e}ms), setting it to ${jn}ms`),e=jn),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(n)}),e)}var c}}));return Je(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.10.45"},t.baseHeaders)}))),(e=>t=>{const n=Fn(),o=Fn(),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 En(t);e&&o.pub(e);const{sessionJwt:r}=await wn(t);r&&n.pub(r)}}})),i=Je(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:_n,getLastUserDisplayName:Wn});const r=e($n(o,{afterRequest:async(e,t)=>{var n;const o=await En(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=>{Cn(Tn,e)})(r),(e=>{Cn(Pn,e)})(i))}}));let i=Je(r,["flow.start"],Ln);return i=Je(i,["logout","logoutAll"],Un),Object.assign(i,{getLastUserLoginId:_n,getLastUserDisplayName:Wn})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=l(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!In)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||Bn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||zn(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&&Cn(`${n}${qn}`,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);bn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(Vn,r,i):Cn(`${n}${Vn}`,r))})(await wn(t),o,r)}}));var a;const d=Je(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return zn(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Bn(r),getSessionToken:()=>function(e=""){return bn.get(Vn)||xn(`${e}${Vn}`)||""}(r)})}))(((...e)=>{const t=rn(...e);return Object.assign(Object.assign({},t),{flow:oo(t),webauthn:to(t),fedcm:no(t)})}));let io;const so=e=>{const t=ro(Object.assign({persistTokens:d,autoRefresh:d},e));return io=t,t},ao=()=>so({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});io=ao();const co=()=>d?null==io?void 0:io.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),lo=()=>d?null==io?void 0:io.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),uo=s(((e=co(),t)=>null==io?void 0:io.getJwtPermissions(e,t))),ho=s(((e=co(),t)=>null==io?void 0:io.getJwtRoles(e,t)));const po=t.lazy((async()=>((await Promise.resolve().then((function(){return Ii}))).default.sdkConfigOverrides={baseHeaders:a,persistTokens:!1,hooks:{get beforeRequest(){return io.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,innerRef:r,tenant:i,theme:s,locale:a,debug:d,redirectUrl:c,client:l,form:u,autoFocus:h})=>o.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,ref:r,tenant:i,theme:s,locale:a,debug:d,client:l,form:u,"redirect-url":c,"auto-focus":h})}))),fo=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,errorTransformer:v},y)=>{const[b,$]=t.useState(null);t.useImperativeHandle(y,(()=>b));const{projectId:w,baseUrl:E,storeLastAuthenticatedUser:k,sdk:C}=o.default.useContext(r),x=t.useCallback((async e=>{await C.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=b;return null==e||e.addEventListener("success",x),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",x)}}),[b,i,x]),t.useEffect((()=>{const e=b;return null==e||e.addEventListener("success",x),()=>{null==e||e.removeEventListener("success",x)}}),[b,x]),t.useEffect((()=>{const e=b;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[b,i]),t.useEffect((()=>{const e=b;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[b,s]),t.useEffect((()=>{b&&(b.errorTransformer=v)}),[b,v]),t.useEffect((()=>{b&&a&&(b.logger=a)}),[b,a]);const{form:O,client:S}=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(po,{projectId:w,flowId:e,baseUrl:E,innerRef:$,tenant:d,theme:c,locale:l,debug:u,form:O,client:S,telemetryKey:f,redirectUrl:g,autoFocus:m,storeLastAuthenticatedUser:k})))})),go=t.lazy((async()=>(await Promise.resolve().then((function(){return Wh})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),mo=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}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(go,{projectId:u,widgetId:a,baseUrl:h,innerRef:l,tenant:n,theme:i,debug:s}))})),vo=t.lazy((async()=>(await Promise.resolve().then((function(){return fg})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),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}=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,innerRef:l,tenant:n,theme:i,debug:s}))})),bo=t.lazy((async()=>(await Promise.resolve().then((function(){return Xv})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),$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}=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,innerRef:l,tenant:n,theme:i,debug:s}))})),wo=t.lazy((async()=>(await Promise.resolve().then((function(){return qb})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),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}=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,innerRef:l,tenant:n,theme:i,debug:s}))})),ko=t.lazy((async()=>(await Promise.resolve().then((function(){return tE})),{default:({projectId:e,baseUrl:t,innerRef:n,widgetId:r,theme:i,debug:s})=>o.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":r,"base-url":t,theme:i,debug:s,ref:n})}))),Co=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}=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(ko,{projectId:u,widgetId:s,baseUrl:h,innerRef:l,theme:n,debug:i}))}));var xo=()=>{const e=t.useContext(r);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const Oo=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,So={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],So);if("function"==typeof e[t])return()=>{throw Error(Oo("function"))};throw Error(Oo("attribute"))}},Io="undefined"!=typeof localStorage,jo=Io&&localStorage.getItem("base.content.url")||"https://static.descope.com/pages",Ro="config.json",No="base.ui.components.url",Mo=Io&&localStorage.getItem(No)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Ao=Io&&localStorage.getItem(No)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Do="descope-login-flow",To="code",Po="ra-challenge",_o="ra-callback",Wo="ra-backup-callback",Lo="ra-initiator",Uo="data-exclude-field",Fo="dls_last_auth",Vo="state_id",qo="saml_idp_state_id",Bo="saml_idp_username",zo="descope_idp_initiated",Ko="sso_app_id",Ho="oidc_login_hint",Go="data-type",Jo="poll",Xo="webauthnCreate",Zo="submit",Yo="polling",Qo=["descope-multi-select-combo-box","descope-text-area"];var er;function tr(e){return new URLSearchParams(window.location.search).get(e)}function nr(e){if(window.history.replaceState&&tr(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 or(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 rr(e,t,n="v2-beta"){const o=new URL(jo);return o.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(o.pathname,e,n,t),o.toString()}function ir(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?er.forward:n<o?er.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(er||(er={}));const sr=()=>{const[e="",t=""]=(tr(Do)||"").split("_");return{executionId:e,stepId:t}};function ar(){nr(Do)}const dr=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),cr=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}},lr=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,ur=e=>null==e?void 0:e.submit(),hr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},pr=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};var fr,gr,mr,vr;function yr(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(!yr(i,s))return!1}else if(i!==s)return!1}return!0}class br{constructor(e={},{updateOnlyOnChange:t=!0}={}){fr.set(this,void 0),gr.set(this,{}),mr.set(this,0),vr.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,fr,"f")):e,n=Object.assign(Object.assign({},h(this,fr,"f")),t);if(!h(this,vr,"f")||!yr(h(this,fr,"f"),n)){const e=h(this,fr,"f");p(this,fr,n,"f"),Object.freeze(h(this,fr,"f")),setTimeout((()=>{Object.values(h(this,gr,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,fr,e,"f"),p(this,vr,t,"f")}get current(){return Object.assign({},h(this,fr,"f"))}subscribe(e){return p(this,mr,h(this,mr,"f")+1,"f"),h(this,gr,"f")[h(this,mr,"f")]=e,h(this,mr,"f").toString()}unsubscribe(e){const t=!!h(this,gr,"f")[e];return t&&delete h(this,gr,"f")[e],t}unsubscribeAll(){return p(this,gr,{},"f"),!0}}fr=new WeakMap,gr=new WeakMap,mr=new WeakMap,vr=new WeakMap;const $r=["disabled"],wr=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Uo}])`)).forEach((e=>{e.value=n}))}))},Er=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),kr=(e,t,n)=>{e.querySelectorAll(`[${Go}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Cr=(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})`))},xr=cr((()=>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}})))),Or={"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 Sr(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Fo)))}catch(e){}return t}const Ir="dls_ab_testing_id",jr=document.createElement("template");var Rr,Nr,Mr,Ar,Dr,Tr,Pr,_r,Wr,Lr,Ur,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;jr.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\n\t\t#wc-root {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\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 Oi 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"]}constructor(e){super(),Rr.add(this),this.logger=console,Nr.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,Rr,"m",ri).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)}},Mr.set(this,new br({deferredRedirect:!1})),Ar.set(this,new br),Dr.set(this,{}),this.getComponentsContext=()=>h(this,Dr,"f"),this.nextRequestStatus=new br({isLoading:!1}),Tr.set(this,void 0),Pr.set(this,{popstate:h(this,Rr,"m",Vr).bind(this),visibilitychange:h(this,Rr,"m",qr).bind(this),componentsContext:h(this,Rr,"m",ei).bind(this)}),_r.set(this,void 0),Gr.set(this,cr((()=>u(this,void 0,void 0,(function*(){const e=rr(this.projectId,Ro);try{const{body:t,headers:n}=yield or(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Xr.set(this,void 0),p(this,_r,e,"f"),h(this,Rr,"m",Wr).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 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 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.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,Gr,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,Gr,"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,Ar,"f").subscribe(h(this,Rr,"m",oi).bind(this)),h(this,Ar,"f").update({isDebug:this.debug}),h(this,Rr,"m",Lr).call(this))return void h(this,Rr,"m",Ur).call(this);if(h(this,Rr,"m",Fr).call(this),p(this,Xr,h(this,Rr,"m",Jr).call(this),"f"),yield h(this,Rr,"m",Kr).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,Gr,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,Rr,"m",Zr).call(this),yield h(this,Rr,"m",ai).call(this),yield h(this,Rr,"m",Yr).call(this),h(this,Rr,"m",ii).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}=sr();(e||t)&&ar();const n=tr("t")||void 0;n&&nr("t");const o=tr(To)||void 0;o&&nr(To);const r=tr("err")||void 0;r&&nr("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:tr(Po),redirectAuthCallbackUrl:tr(_o),redirectAuthBackupCallbackUri:tr(Wo),redirectAuthInitiator:tr(Lo)};(i||s||a||d)&&(nr(Po),nr(_o),nr(Wo),nr(Lo));const c=tr(Vo);c&&nr(Vo);const l=tr(qo);l&&nr(qo);const u=tr(Bo);l&&nr(Bo);const h=tr(zo);h&&nr(zo);const p=tr(Ko);p&&nr(Ko);const f=tr(Ho);return f&&nr(Ho),{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,Pr,"f").popstate),window.addEventListener("components-context",h(this,Pr,"f").componentsContext),window.addEventListener("visibilitychange",h(this,Pr,"f").visibilitychange),h(this,Mr,"f").subscribe(h(this,Rr,"m",zr).bind(this)),h(this,Mr,"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,Nr,!0,"f")}}))}disconnectedCallback(){h(this,Mr,"f").unsubscribeAll(),h(this,Ar,"f").unsubscribeAll(),h(this,Rr,"m",ni).call(this),window.removeEventListener("popstate",h(this,Pr,"f").popstate),window.removeEventListener("visibilitychange",h(this,Pr,"f").visibilitychange),window.removeEventListener("components-context",h(this,Pr,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,Nr,"f")&&t!==n&&Oi.observedAttributes.includes(e)){h(this,Rr,"m",Fr).call(this);const o=null===t;h(this,Mr,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,ar()),{[dr(e)]:n,stepId:i,executionId:s}})),h(this,Ar,"f").update({isDebug:this.debug})}}}Nr=new WeakMap,Mr=new WeakMap,Ar=new WeakMap,Dr=new WeakMap,Tr=new WeakMap,Pr=new WeakMap,_r=new WeakMap,Gr=new WeakMap,Xr=new WeakMap,Rr=new WeakSet,Wr=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(jr.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},Lr=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},Ur=function(){const e=this.shadowRoot.host,t=document.createElement("form");e.parentElement.appendChild(t),t.appendChild(e)},Fr=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client"];if(Oi.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[dr(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')},Vr=function(){const{stepId:e,executionId:t}=sr();h(this,Mr,"f").update({stepId:e,executionId:t})},qr=function(){document.hidden||setTimeout((()=>{h(this,Mr,"f").update({deferredRedirect:!1})}),300)},Br=function(e,t){this.sdk=ro(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},Oi.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})}}))}))},zr=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,Rr,"m",Br).call(this,t,o)}h(this,_r,"f").call(this,e)}))},Kr=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,Gr,"f").call(this)).isMissingConfig&&(yield h(this,Rr,"m",Hr).call(this))}))},Hr=function(){return u(this,void 0,void 0,(function*(){const e=rr(this.projectId,Ro,"v2-alpha");try{return yield or(e,"json"),!0}catch(e){return!1}}))},Jr=function(){return u(this,void 0,void 0,(function*(){const e=rr(this.projectId,"theme.json");try{const{body:t}=yield or(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},Zr=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,Gr,"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)))}))},Yr=function(){return u(this,void 0,void 0,(function*(){yield h(this,Rr,"m",Qr).call(this),yield h(this,Rr,"m",ti).call(this)}))},Qr=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield h(this,Xr,"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 Oi.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)}))},ei=function(e){p(this,Dr,Object.assign(Object.assign({},e.detail),h(this,Dr,"f")),"f")},ti=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Oi.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},ni=function(){var e;null===(e=h(this,Tr,"f"))||void 0===e||e.remove(),p(this,Tr,null,"f")},oi=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,Tr,document.createElement("descope-debugger"),"f"),Object.assign(h(this,Tr,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return gE})),document.body.appendChild(h(this,Tr,"f"))):h(this,Rr,"m",ni).call(this)}))},ri=function(e,t){var n;e&&this.debug&&(null===(n=h(this,Tr,"f"))||void 0===n||n.updateData({title:e,description:t}))},ii=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=Qo.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()}}},si=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,Gr,"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")}))},ai=function(){return u(this,void 0,void 0,(function*(){Oi.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Oi.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,Rr,"m",si).call(this),i=t(n(Mo,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Ao,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},Oi.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.11.14"}};class Si extends Oi{static set sdkConfigOverrides(e){Oi.sdkConfigOverrides=e}constructor(){const e=new br;super(e.update.bind(e)),di.add(this),this.stepState=new br({},{updateOnlyOnChange:!1}),ci.set(this,void 0),li.set(this,null),ui.set(this,((e,t,n,o,r)=>{n===Jo&&p(this,ci,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,Yo,o,r,{});h(this,pi,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,ui,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),hi.set(this,(()=>{clearTimeout(h(this,ci,"f")),p(this,ci,null,"f")})),pi.set(this,(e=>{var t,n,o,r,i,s,a,d,c;if(!(null==e?void 0:e.ok)){h(this,di,"m",xi).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)&&Io&&localStorage.setItem(Fo,JSON.stringify(e))}(f),void h(this,di,"m",xi).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!==Jo?(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})})),fi.set(this,cr((()=>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)}}))))),wi.set(this,pr(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,di,"m",vi).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,di,"m",bi).call(this,e);const r=yield h(this,di,"m",yi).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,pi,"f").call(this,l),h(this,di,"m",$i).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,li,"f"))||void 0===e||e.abort(),p(this,li,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n,o=navigator.language;o&&"zh-TW"!==o&&(o=o.split("-")[0]);const r=(e||o||"").toLowerCase();return(yield this.getTargetLocales()).includes(r)&&(n=`${t}-${r}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield or(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 or(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 _,W;const L=(()=>{const e=localStorage.getItem(Ir);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Ir,e.toString()),e}return Number(e)})(),U=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 An(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Nn),F.conditions?({startScreenId:_,conditionInteractionId:W}=((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=Or[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:U,code:b,token:y,abTestingKey:L},F.conditions)):F.condition?({startScreenId:_,conditionInteractionId:W}=((e,t)=>{var n;const o=null===(n=Or[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:U,code:b,token:y,abTestingKey:L})):_=F.startScreenId,!lr(_,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:Sr(U),abTestingKey:L}),W,"",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,pi,"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,Zo,F.version,V.componentsVersion,{token:y,exchangeCode:b,exchangeError:$});return h(this,pi,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(m&&window.open(m,"_blank"),"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||"",ur)}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===Xo||"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,li,"f"))||void 0===r||r.abort(),p(this,li,null,"f");try{e=l===Xo?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,Zo,F.version,V.componentsVersion,{transactionId:w,response:e,failure:t});h(this,pi,"f").call(this,n)}if(h(this,ui,"f").call(this,c,d,l,F.version,V.componentsVersion),!u&&!_)return void this.loggerWrapper.warn("No screen was found to show");const B=_||u,z=yield this.getHtmlFilenameWithLocale(I,B),K={direction:ir(d,t.stepId),screenState:Object.assign(Object.assign({},f),{form:Object.assign(Object.assign({},this.formConfigValues),null==f?void 0:f.form),lastAuth:{loginId:U,name:this.sdk.getLastUserDisplayName()||U}}),htmlUrl:rr(i,`${B}.html`),htmlLocaleUrl:z&&rr(i,z),samlIdpUsername:R,oidcLoginHint:P},H=Sr(U);lr(_,S,j,R,T,P)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,Object.assign({tenant:a,redirectAuth:q,oidcIdpStateId:S,samlIdpStateId:j,samlIdpUsername:R,ssoAppId:T,oidcLoginHint:P,lastAuth:H,preview:this.preview,abTestingKey:L,client:this.client},v&&{redirectUrl:v}),W,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 Oi.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}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const l=c.content.cloneNode(!0),p=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield h(this,di,"m",mi).call(this,l,a):l.querySelectorAll(`descope-button[${Go}="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(`[${Go}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),kr(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),kr(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").forEach((e=>{e.textContent=Er(e.textContent,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=Er(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{$r.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(l,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:f}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(l,f);const g=()=>u(this,void 0,void 0,(function*(){var e,n;yield p;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,Cr(r,"descope-totp-image",i),((e,t)=>{Cr(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(l),setTimeout((()=>((e,t)=>{wr(e,null==t?void 0:t.inputs),wr(e,null==t?void 0:t.form)})(this.rootElement,d)));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),h(this,di,"m",ki).call(this,a),s&&h(this,di,"m",xi).call(this,"ready",{}),h(this,di,"m",xi).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Go}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(Yo,e.version,t.componentsVersion,{});h(this,pi,"f").call(this,n)}}));s?h(this,di,"m",Ci).call(this,g,s):g()}))}}ci=new WeakMap,li=new WeakMap,ui=new WeakMap,hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,wi=new WeakMap,di=new WeakSet,gi=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)}))}},mi=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,li,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield xr())){const{options:e,transactionId:n}=(yield h(this,fi,"f").call(this))||{};if(e&&n){h(this,di,"m",gi).call(this,o),p(this,li,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,li,"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,pi,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},vi=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).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)}))},yi=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Uo}])`));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})),{})}))},bi=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},$i=function(e={}){var t,n;const o=hr(e,["externalId","email","phone"]),r=hr(e,["newPassword","password"]);if(o&&r)try{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)}},Ei=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,wi,"f").call(this,t,e)}))}))},ki=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,wi,"f").call(this,t,e)}})),h(this,di,"m",Ei).call(this,e)},Ci=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===er.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")},xi=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",Si);var Ii=Object.freeze({__proto__:null,default:Si});function ji(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Ri=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Ni=(...e)=>e.join("/").replace(/\/+/g,"/"),Mi=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Ai=e=>{let t,n;return(...o)=>(t&&Mi(t,o)||(t=o,n=e(...o)),n)},Di=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])||""}`}),""),Ti=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},Pi=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 _i,Wi,Li,Ui,Fi,Vi;function qi(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(!qi(i,s))return!1}else if(i!==s)return!1}return!0}class Bi{constructor(e={},{updateOnlyOnChange:t=!0}={}){_i.set(this,void 0),Wi.set(this,{}),Li.set(this,0),Ui.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,_i,"f")):e,n=Object.assign(Object.assign({},h(this,_i,"f")),t);if(!h(this,Ui,"f")||!qi(h(this,_i,"f"),n)){const e=h(this,_i,"f");p(this,_i,n,"f"),Object.freeze(h(this,_i,"f")),setTimeout((()=>{Object.values(h(this,Wi,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,_i,e,"f"),p(this,Ui,t,"f")}get current(){return Object.assign({},h(this,_i,"f"))}subscribe(e){return p(this,Li,h(this,Li,"f")+1,"f"),h(this,Wi,"f")[h(this,Li,"f")]=e,h(this,Li,"f").toString()}unsubscribe(e){const t=!!h(this,Wi,"f")[e];return t&&delete h(this,Wi,"f")[e],t}unsubscribeAll(){return p(this,Wi,{},"f"),!0}}_i=new WeakMap,Wi=new WeakMap,Li=new WeakMap,Ui=new WeakMap;class zi{constructor(e,t){Fi.set(this,void 0),this.nodeName="",p(this,Fi,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,Fi,"f"))}get ele(){var e,t;const n="function"==typeof h(this,Fi,"f")?h(this,Fi,"f").call(this):h(this,Fi,"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)}}Fi=new WeakMap;const Ki=/^descope-grid-([^-]+)-column$/,Hi={text:class extends zi{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 zi{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 Gi extends zi{constructor(){super(...arguments),this.nodeName="descope-grid",Vi.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=Ki.exec(t.localName))||void 0===n?void 0:n[1],r=Hi[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);Mi(o,this.ele.columns)||(this.ele.columns=o,null===(n=h(this,Vi,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){p(this,Vi,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}Vi=new WeakMap;class Ji extends zi{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 Xi;class Zi extends zi{constructor(){super(...arguments),Xi.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,Xi,"f")&&(null===(e=this.ele)||void 0===e||e.append(h(this,Xi,"f").content.cloneNode(!0)))}setContent(e){p(this,Xi,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Xi=new WeakMap;class Yi extends zi{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 Qi extends zi{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 es extends zi{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 ts extends zi{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 ns extends zi{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 os extends zi{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 rs extends zi{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 is extends zi{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 ss extends zi{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 as(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 ds=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),cs=()=>Math.random().toString(36).substring(7).split("").join("."),ls={INIT:`@@redux/INIT${cs()}`,REPLACE:`@@redux/REPLACE${cs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${cs()}`};function us(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 hs(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 ps(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=hs(e)),t}function fs(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?as(2):`Expected the root reducer to be a function. Instead, received: '${ps(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?as(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?as(1):`Expected the enhancer to be a function. Instead, received: '${ps(n)}'`);return n(fs)(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?as(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?as(4):`Expected the listener to be a function. Instead, received: '${ps(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?as(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?as(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(!us(e))throw new Error("production"===process.env.NODE_ENV?as(7):`Actions must be plain objects. Instead, the actual type was: '${ps(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?as(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?as(17):`Action "type" property must be a string. Instead, the actual type was: '${ps(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?as(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?as(10):`Expected the nextReducer to be a function. Instead, received: '${ps(e)}`);o=e,h({type:ls.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?as(11):`Expected the observer to be an object. Instead, received: '${ps(t)}'`);function n(){const e=t;e.next&&e.next(l())}n();return{unsubscribe:e(n)}},[ds](){return this}}}h({type:ls.INIT});const g={dispatch:h,subscribe:u,getState:l,replaceReducer:p,[ds]:f};return g}function gs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function ms(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]&&gs(`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:ls.INIT}))throw new Error("production"===process.env.NODE_ENV?as(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:ls.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?as(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${ls.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===ls.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(!us(e))return`The ${i} has unexpected type of "${ps(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===ls.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&&gs(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?as(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 vs(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ys(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?as(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=vs(...a)(r.dispatch),{...r,dispatch:i}}}function bs(e){return us(e)&&"type"in e&&"string"==typeof e.type}var $s=Symbol.for("immer-nothing"),ws=Symbol.for("immer-draftable"),Es=Symbol.for("immer-state"),ks="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 Cs(e,...t){if("production"!==process.env.NODE_ENV){const n=ks[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 xs=Object.getPrototypeOf;function Os(e){return!!e&&!!e[Es]}function Ss(e){return!!e&&(js(e)||Array.isArray(e)||!!e[ws]||!!e.constructor?.[ws]||Ds(e)||Ts(e))}var Is=Object.prototype.constructor.toString();function js(e){if(!e||"object"!=typeof e)return!1;const t=xs(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)===Is}function Rs(e,t){0===Ns(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function Ns(e){const t=e[Es];return t?t.type_:Array.isArray(e)?1:Ds(e)?2:Ts(e)?3:0}function Ms(e,t){return 2===Ns(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function As(e,t,n){const o=Ns(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Ds(e){return e instanceof Map}function Ts(e){return e instanceof Set}function Ps(e){return e.copy_||e.base_}function _s(e,t){if(Ds(e))return new Map(e);if(Ts(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&js(e)){if(!xs(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Es];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(xs(e),n)}function Ws(e,t=!1){return Us(e)||Os(e)||!Ss(e)||(Ns(e)>1&&(e.set=e.add=e.clear=e.delete=Ls),Object.freeze(e),t&&Rs(e,((e,t)=>Ws(t,!0)))),e}function Ls(){Cs(2)}function Us(e){return Object.isFrozen(e)}var Fs,Vs={};function qs(e){const t=Vs[e];return t||Cs(0,e),t}function Bs(){return Fs}function zs(e,t){t&&(qs("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ks(e){Hs(e),e.drafts_.forEach(Js),e.drafts_=null}function Hs(e){e===Fs&&(Fs=e.parent_)}function Gs(e){return Fs={drafts_:[],parent_:Fs,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Js(e){const t=e[Es];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Xs(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Es].modified_&&(Ks(t),Cs(4)),Ss(e)&&(e=Zs(t,e),t.parent_||Qs(t,e)),t.patches_&&qs("Patches").generateReplacementPatches_(n[Es].base_,e,t.patches_,t.inversePatches_)):e=Zs(t,n,[]),Ks(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$s?e:void 0}function Zs(e,t,n){if(Us(t))return t;const o=t[Es];if(!o)return Rs(t,((r,i)=>Ys(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Qs(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),Rs(r,((r,s)=>Ys(e,o,t,r,s,n,i))),Qs(e,t,!1),n&&e.patches_&&qs("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Ys(e,t,n,o,r,i,s){if("production"!==process.env.NODE_ENV&&r===n&&Cs(5),Os(r)){const s=Zs(e,r,i&&t&&3!==t.type_&&!Ms(t.assigned_,o)?i.concat(o):void 0);if(As(n,o,s),!Os(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(Ss(r)&&!Us(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Zs(e,r),t&&t.scope_.parent_||Qs(e,r)}}function Qs(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ws(t,n)}var ea={get(e,t){if(t===Es)return e;const n=Ps(e);if(!Ms(n,t))return function(e,t,n){const o=oa(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_||!Ss(o)?o:o===na(e.base_,t)?(ia(e),e.copy_[t]=sa(o,e)):o},has:(e,t)=>t in Ps(e),ownKeys:e=>Reflect.ownKeys(Ps(e)),set(e,t,n){const o=oa(Ps(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=na(Ps(e),t),r=o?.[Es];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||Ms(e.base_,t)))return!0;ia(e),ra(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!==na(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ia(e),ra(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ps(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){Cs(11)},getPrototypeOf:e=>xs(e.base_),setPrototypeOf(){Cs(12)}},ta={};function na(e,t){const n=e[Es];return(n?Ps(n):e)[t]}function oa(e,t){if(!(t in e))return;let n=xs(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=xs(n)}}function ra(e){e.modified_||(e.modified_=!0,e.parent_&&ra(e.parent_))}function ia(e){e.copy_||(e.copy_=_s(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Rs(ea,((e,t)=>{ta[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ta.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Cs(13),ta.set.call(this,e,t,void 0)},ta.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Cs(14),ea.set.call(this,e[0],t,n,e[0])};function sa(e,t){const n=Ds(e)?qs("MapSet").proxyMap_(e,t):Ts(e)?qs("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Bs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=ea;n&&(r=[o],i=ta);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:Bs()).drafts_.push(n),n}function aa(e){return Os(e)||Cs(10,e),da(e)}function da(e){if(!Ss(e)||Us(e))return e;const t=e[Es];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_s(e,t.scope_.immer_.useStrictShallowCopy_)}else n=_s(e,!0);return Rs(n,((e,t)=>{As(n,e,da(t))})),t&&(t.finalized_=!1),n}var ca=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&&Cs(6),void 0!==n&&"function"!=typeof n&&Cs(7),Ss(e)){const r=Gs(this),i=sa(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Ks(r):Hs(r)}return zs(r,n),Xs(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===$s&&(o=void 0),this.autoFreeze_&&Ws(o,!0),n){const t=[],r=[];qs("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}Cs(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){Ss(e)||Cs(8),Os(e)&&(e=aa(e));const t=Gs(this),n=sa(e,void 0);return n[Es].isManual_=!0,Hs(t),n}finishDraft(e,t){const n=e&&e[Es];n&&n.isManual_||Cs(9);const{scope_:o}=n;return zs(o,t),Xs(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=qs("Patches").applyPatches_;return Os(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},la=ca.produce;ca.produceWithPatches.bind(ca),ca.setAutoFreeze.bind(ca),ca.setUseStrictShallowCopy.bind(ca),ca.applyPatches.bind(ca),ca.createDraft.bind(ca),ca.finishDraft.bind(ca);var ua=(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})}}},ha=(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})}},pa={inputStabilityCheck:"once",identityFunctionCheck:"once"};var fa=e=>Array.isArray(e)?e:[e];function ga(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 ma(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var va=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...pa,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:ua},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:ha}}},ya="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function ba(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 ya(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 $a(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=ba,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=fa(c),f=fa(u),g=ga(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const y=l((function(){r++;const e=ma(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=va(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=ma(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 wa=$a(ba),Ea=Object.assign(((e,t=wa)=>{!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:()=>Ea});function ka(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var Ca=ka(),xa=ka;((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Oa="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},Sa=e=>e&&"function"==typeof e.match;function Ia(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?pd(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=>bs(t)&&t.type===e,n}function ja(e){return"function"==typeof e&&"type"in e&&Sa(e)}function Ra(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 Na=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 Ma(e){return Ss(e)?la(e,(()=>{})):e}function Aa(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?pd(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Da(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Ta(e,t,n){const o=Pa(e,t,n);return{detectMutations:()=>_a(e,t,o,n)}}function Pa(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]=Pa(e,t,n[r],s))}}return i}function _a(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=_a(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Wa(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function La(e,t="",n=Wa,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=La(c,a,n,o,r,i),s))return s}return i&&Ua(e)&&i.add(e),!1}function Ua(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Ua(t))return!1;return!0}function Fa(e){return"boolean"==typeof e}var Va=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Na;if(t&&(Fa(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Fa(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=Da,ignoredPaths:r,warnAfter:i=32}=e;const s=Ta.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Ra(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(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={};Fa(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Wa,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(!bs(u))return c(u);const h=c(u),p=Ra(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=La(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=La(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={};Fa(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ja}=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},qa=e=>t=>{setTimeout(t,e)},Ba="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:qa(10),za=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Na(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?Ba:"callback"===e.type?e.queueNotification:qa(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},Ka="production"===process.env.NODE_ENV;function Ha(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?pd(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(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?pd(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Ga=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Ja(...e){return t=>e.some((e=>((e,t)=>Sa(e)?e.match(t):e(t))(e,t)))}var Xa=["name","message","stack","code"],Za=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ya=class{constructor(e,t){this.payload=e,this.meta=t}_type},Qa=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Xa)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},ed=(()=>{function e(e,t,n){const o=Ia(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Ia(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Ia(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Qa)(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):Ga(),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 Za(e,t),fulfillWithValue:(e,t)=>new Ya(e,t)})).then((t=>{if(t instanceof Za)throw t;return t instanceof Ya?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Za?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(td)})}}),{pending:r,rejected:i,fulfilled:o,settled:Ja(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function td(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var nd=Symbol.for("rtk-slice-createasyncthunk");function od(e,t){return`${e}/${t}`}function rd({creators:e}={}){const t=e?.asyncThunk?.[nd];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(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?Ha(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?pd(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]=Ha(t);if(function(e){return"function"==typeof e}(e))n=()=>Ma(e());else{const t=Ma(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?pd(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:od(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?pd(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?Ia(e,s):Ia(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?pd(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||ad,pending:a||ad,rejected:d||ad,settled:c||ad})}(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?pd(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Aa(l,n,{insert:()=>new WeakMap});return Aa(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=id(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 id(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?pd(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var sd=rd();function ad(){}var dd="listenerMiddleware",cd=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Ia(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?pd(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?pd(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},ld=Object.assign((e=>{const{type:t,predicate:n,effect:o}=cd(e);return{id:Ga(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?pd(22):"Unsubscribe not initialized")}}}),{withTypes:()=>ld}),ud=Object.assign(Ia(`${dd}/add`),{withTypes:()=>ud});Ia(`${dd}/removeAll`);var hd=Object.assign(Ia(`${dd}/remove`),{withTypes:()=>hd});function pd(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 fd=["error","warn","info","debug"],gd=Pi((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 fd.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})),md="undefined"!=typeof localStorage,vd=md&&localStorage.getItem("base.content.url")||"https://static.descope.com/pages",yd=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,bd=Pi((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})),$d=Pi((e=>{var t,n;const o=ji(gd,bd)(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})),wd=e=>t=>{var n,o,r;const i=ji(gd,bd,$d)(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};wd.missingAttrValidator=yd;const Ed=Pi((e=>{const t=ji(wd({"project-id":yd}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}}));const kd=Pi((e=>{const t=ji(gd,Ed)(e);return class extends t{async fetchStaticResource(e,t){const n=function(e,t,n="v2-beta"){const o=new URL(vd);return o.pathname=Ni(o.pathname,e,n,t),o.toString()}(this.projectId,e),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())}}}})),Cd=Pi((e=>{var t,n,o;const r=ji(kd)(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})),xd=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(bd,gd)(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 oc})),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})),Od="load-descope-ui",Sd="base.ui.components.url",Id=md&&localStorage.getItem(Sd)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",jd=md&&localStorage.getItem(Sd)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Rd=e=>{const t=document.createElement("script");return t.id=e,t},Nd=(e,t)=>e.replace("<version>",t),Md=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(gd,Cd)(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=Rd("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=Nd(jd,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#${Od}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Rd(Od);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Nd(Id,await h(this,t,"m",r).call(this))}return document.getElementById(Od)},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})),Ad="content-root",Dd="root",Td=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Dd}, #${Ad} {\n height: 100%;\n }\n #${Dd} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Dd}">\n <div id="${Ad}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Ad),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Dd)}})),Pd="descope-modal",_d=Pi((e=>{var t,n;const o=ji(bd,Td,Md)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Pd);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([Pd]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Wd="descope-notification",Ld=Pi((e=>{var t,n;const o=ji(bd,Td,Md)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Wd);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([Wd])}},t=new WeakMap,n})),Ud=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Fd=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(wd({theme:Ud}),kd,bd,Md,Cd,Td,$d)(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(Sd)))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(Sd),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})),Vd=e=>Pi((t=>{const n=sd(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(gd)(t)){constructor(...e){super(...e);const t=function(e){const t=Va(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?pd(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!Ka&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?pd(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Ka&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?pd(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Ka&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?pd(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Oa({trace:!Ka,..."object"==typeof r&&r}));const l=ys(...d),u=za(l);if(!Ka&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?pd(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Ka&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?pd(6):"`enhancers` callback must return an array");if(!Ka&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?pd(7):"each enhancer provided to configureStore must be a function");return Ka||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{td(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()))))}}})),qd=Pi((e=>class extends(gd(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()}})),Bd=(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 zd,Kd,Hd,Gd,Jd,Xd,Zd,Yd,Qd,ec;const tc=document.createElement("template");tc.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 nc extends HTMLElement{constructor(){var e;super(),zd.add(this),Kd.set(this,new Bi({messages:[]})),Hd.set(this,void 0),Gd.set(this,void 0),Jd.set(this,void 0),Xd.set(this,{resize:h(this,zd,"m",ec).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(tc.content.cloneNode(!0)),p(this,Hd,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Gd,h(this,Hd,"f").querySelector(".content"),"f"),p(this,Jd,h(this,Hd,"f").querySelector(".header"),"f")}updateData(e){h(this,Kd,"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]=Bd(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,Hd,"f"),h(this,Jd,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Xd,"f").resize),(e=h(this,Hd,"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,Hd,"f").onresize=h(this,zd,"m",Qd).bind(this),h(this,Kd,"f").subscribe(h(this,zd,"m",Zd).bind(this))}disconnectedCallback(){h(this,Kd,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Xd,"f").resize)}}Kd=new WeakMap,Hd=new WeakMap,Gd=new WeakMap,Jd=new WeakMap,Xd=new WeakMap,zd=new WeakSet,Zd=function(e){h(this,zd,"m",Yd).call(this,e),h(this,zd,"m",Qd).call(this)},Yd=function(e){h(this,Gd,"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("")},Qd=function(){h(this,Gd,"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)}))},ec=function(){const[e,t]=Bd(h(this,Hd,"f"),Number.parseInt(h(this,Hd,"f").style.left,10),Number.parseInt(h(this,Hd,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Hd,"f").style.top=`${t}px`,h(this,Hd,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",nc);var oc=Object.freeze({__proto__:null}),rc={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 ic(e,t){var n=Array.prototype.slice.call(t);return n.push(rc),e.apply(this,n)}function sc(e){return sc="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},sc(e)}function ac(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 dc(e,t){if(t&&("object"===sc(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return cc(e)}function cc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lc(e){var t="function"==typeof Map?new Map:void 0;return lc=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 uc(e,arguments,fc(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),pc(o,e)},lc(e)}function uc(e,t,n){return uc=hc()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&pc(r,n.prototype),r},uc.apply(null,arguments)}function hc(){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 pc(e,t){return pc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},pc(e,t)}function fc(e){return fc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},fc(e)}var gc=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&&pc(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=hc(),function(){var e,o=fc(t);if(n){var r=fc(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return dc(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(cc(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&ac(o.prototype,r),i&&ac(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(lc(Error)),mc="0-90-9٠-٩۰-۹",vc="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function yc(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 bc={}.constructor;function $c(e){return null!=e&&e.constructor===bc}function wc(e){return wc="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},wc(e)}function Ec(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kc(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 Cc(e,t,n){return t&&kc(e.prototype,t),n&&kc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var xc=" ext. ",Oc=/^\d+$/,Sc=function(){function e(t){Ec(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!$c(e)||!$c(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($c(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Ac(e)+": "+e,"."))}(t),this.metadata=t,Tc.call(this,t)}return Cc(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&&Oc.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new Ic(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new Ic(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}(),Ic=function(){function e(t,n){Ec(this,e),this.globalMetadataObject=n,this.metadata=t,Tc.call(this,n.metadata)}return Cc(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 jc(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()&&Mc(this.types(),e))return new Nc(Mc(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?xc:this.metadata[13]||xc}}]),e}(),jc=function(){function e(t,n){Ec(this,e),this._format=t,this.metadata=n}return Cc(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()||Rc.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Rc=/^\(?\$1\)?$/,Nc=function(){function e(t,n){Ec(this,e),this.type=t,this.metadata=n}return Cc(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 Mc(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 Ac=function(e){return wc(e)};function Dc(e,t){if((t=new Sc(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Tc(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===yc(t,"1.2.0")?this.v2=!0:-1===yc(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Pc=function(e){return"([".concat(mc,"]{1,").concat(e,"})")};function _c(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",o="#?",r="[ \\t]*";return";ext="+Pc("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+Pc("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+Pc("9")+o)+"|"+("[- ]+"+Pc("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+Pc("15")+o)+"|"+(r+"(?:,)+"+n+Pc("9")+o)}var Wc="["+mc+"]{2}",Lc="[++]{0,1}(?:["+vc+"]*["+mc+"]){3,}["+vc+mc+"]*",Uc=new RegExp("^[++]{0,1}(?:["+vc+"]*["+mc+"]){1,2}$","i"),Fc=Lc+"(?:"+_c()+")?",Vc=new RegExp("^"+Wc+"$|^"+Fc+"$","i");var qc=new RegExp("(?:"+_c()+")$","i");var Bc={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 zc(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 Kc(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 Kc(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 Kc(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 Hc(e){for(var t,n="",o=zc(e.split(""));!(t=o()).done;){n+=Gc(t.value,n)||""}return n}function Gc(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return Bc[e]}(e)}function Jc(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 Xc(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 Xc(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 Xc(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 Zc(e,t){return Yc(e,void 0,t)}function Yc(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 Yc(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=Jc(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 Qc(e,t){return"IS_POSSIBLE"===Zc(e,t)}function el(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function tl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nl(e,t)}(e))||t&&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 nl(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 ol=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function rl(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Sc(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(el(o,n.nationalNumberPattern())){if(il(o,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?il(o,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,i=tl(ol);!(r=i()).done;){var s=r.value;if(il(o,s,n))return s}}}}function il(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&el(e,t.pattern()))}function sl(e,t,n){var o=new Sc(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new Sc(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var al=/(\$\d)/;function dl(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(al,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(vc,"]+"),"g")," ").trim()}(i):i}var cl=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function ll(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 ul(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 ul(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 ul(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 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 pl(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){fl(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}function fl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var gl={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function ml(e,t,n,o){if(n=n?pl(pl({},gl),n):gl,o=new Sc(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?yl(r=vl(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=vl(s,null,"INTERNATIONAL",o,n),yl(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=Dc(o,r.metadata);if(i===n){var s=vl(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new Sc(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():cl.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(vl(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return yl(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function vl(e,t,n,o,r){var i=function(e,t){for(var n,o=ll(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(el(t,r.pattern()))return r}}(o.formats(),e);return i?dl(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function yl(e,t,n,o){return t?o(e,t,n):e}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 $l(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){wl(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 wl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function El(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 kl=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 Sc(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]:sl(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Sc(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 Qc(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 Sc(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==rl(e,t,n.metadata):el(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Sc(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return rl(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return ml(this,e,t?$l($l({},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&&El(t.prototype,n),o&&El(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var Cl=new RegExp("(["+mc+"])");function xl(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(el(e,n.nationalNumberPattern())&&!el(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Zc(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:o}}function Ol(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new Sc(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(Cl);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?Dc(t,o):n;if(0===e.indexOf(r)){(o=new Sc(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=xl(i,o).nationalNumber,a=xl(e,o).nationalNumber;if(!el(a,o.nationalNumberPattern())&&el(s,o.nationalNumberPattern())||"TOO_LONG"===Zc(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 Sc(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 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 Il(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 Il(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 Il(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 jl(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 Sc(r);for(var i,s=[],a=Sl(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(rl({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 Rl="(["+mc+"]|[\\-\\.\\(\\)]?)",Nl=new RegExp("^\\+"+Rl+"*["+mc+"]"+Rl+"*$","g"),Ml=new RegExp("^("+("["+mc+"]+((\\-)*["+mc+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+mc+"])*")+"\\.?$","g"),Al="tel:",Dl=";phone-context=";function Tl(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Dl);if(t<0)return null;var n=t+Dl.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&&(Nl.test(e)||Ml.test(e))}(r))throw new gc("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(Al);i=s>=0?s+Al.length:0;var a=e.indexOf(Dl);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var Pl=new RegExp("[++"+mc+"]"),_l=new RegExp("[^"+mc+"#]+$");function Wl(e,t,n){if(t=t||{},n=new Sc(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new gc("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=Tl(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new gc("TOO_LONG");return}if(!1===t)return e;var o=e.search(Pl);if(o<0)return;return e.slice(o).replace(_l,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&Vc.test(e)}(o))return function(e){return Uc.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(qc);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(qc),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 gc("TOO_SHORT");throw new gc("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=Ol(Hc(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||Dc(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var c=xl(Hc(d),o),l=c.nationalNumber,u=c.carrierCode,h=jl(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 gc("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new gc("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new gc("TOO_LONG");return{}}if(t.v2){var p=new kl(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)&&el(c,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:l,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!Qc(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 Ll(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 Ul(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ll(Object(n),!0).forEach((function(t){Fl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ll(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bl(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 zl(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 zl(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 zl(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 Kl(e){var t,n,o,r=Bl(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(!$c(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?Vl(Object(n),!0).forEach((function(t){ql(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}({defaultCountry:s},n));return{text:t,options:n,metadata:o}}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){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hl(Object(n),!0).forEach((function(t){Jl(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}function Jl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xl(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=Gl(Gl({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Wl(e,Ul(Ul({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof gc))throw e}}function Zl(){var e=Kl(arguments),t=e.text,n=e.options,o=e.metadata;return Xl(t,n,o)}const Yl={enabled:"active",disabled:"disabled",invited:"invited"},Ql=e=>e.tenantRoles.data,eu=e=>e.selectedUsersLoginIds,tu=e=>e.notifications,nu=e=>e.customAttributes.data,ou=wa((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{status:Yl[e.status]||e.status,roles:e.roleNames}))))),ru=wa(eu,ou,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),iu=wa(ru,(e=>e.map((e=>e.userId)))),su=wa(ru,(e=>e.map((e=>e.status)))),au=wa(ru,(e=>e.every((e=>e.editable)))),du=wa(eu,(e=>!!e.length)),cu=wa(eu,(e=>1===e.length)),lu=wa(eu,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),uu=wa(cu,su,((e,t)=>e&&t.every((e=>e===Yl.enabled)))),hu=wa(su,(e=>e.every((e=>e===Yl.disabled)))),pu=wa(ru,(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`})),fu=wa(cu,hu,au,((e,t,n)=>e&&t&&n)),gu=wa(cu,uu,au,((e,t,n)=>e&&t&&n)),mu=wa(cu,au,((e,t)=>e&&t)),vu=wa(cu,au,((e,t)=>e&&t)),yu=wa(cu,au,((e,t)=>e&&t)),bu=wa(du,au,((e,t)=>e&&t)),$u=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},wu=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}}),Eu=({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)})}}),ku=ed("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Cu=$u(ku)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},wu((e=>e.createUser)),Eu({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>`}})),xu={action:ku,reducer:Cu},Ou=ed("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Su=$u(Ou)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},wu((e=>e.deleteUser)),Eu({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Iu={action:Ou,reducer:Su},ju=ed("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Ru=$u(ju)(wu((e=>e.setTempUserPassword)),Eu({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>`}})),Nu={action:ju,reducer:Ru},Mu=ed("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Au=$u(Mu)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},wu((e=>e.customAttributes))),Du={action:Mu,reducer:Au},Tu=ed("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),Pu=$u(Tu)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},wu((e=>e.usersList))),_u={action:Tu,reducer:Pu},Wu=ed("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Lu=$u(Wu)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},wu((e=>e.tenantRoles))),Uu={action:Wu,reducer:Lu},Fu=ed("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Vu=$u(Fu)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Mi(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},wu((e=>e.updateUser)),Eu({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>`}})),qu={action:Fu,reducer:Vu},Bu=ed("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),zu=$u(Bu)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return Mi(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)}},wu((e=>e.enableUser)),Eu({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>`}})),Ku={action:Bu,reducer:zu},Hu=ed("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Gu=$u(Hu)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return Mi(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)}},wu((e=>e.disableUser)),Eu({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>`}})),Ju={action:Hu,reducer:Gu},Xu=ed("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Zu={action:Xu,reducer:$u(Xu)(wu((e=>e.removePasskey)),Eu({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>`}}))},Yu={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:[]},Qu="/v1/mgmt/user/search",eh="/v1/mgmt/user/delete/batch",th="/v1/mgmt/user/create",nh="/v1/mgmt/user/update",oh="/v1/mgmt/user/update/status",rh="/v1/mgmt/user/password/set/temporary",ih="/v1/mgmt/user/passkeys/delete",sh="/v1/mgmt/user/customattributes",ah="/v1/mgmt/role/all",dh=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)})),ch=({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(Qu,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:c,sort:l},{queryParams:{tenant:t}});return yield dh(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(eh,{userIds:o},{queryParams:{tenant:t}});return yield dh(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(th,{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 dh(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(nh,{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 dh(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(oh,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield dh(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(oh,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield dh(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(ih,{loginId:o},{queryParams:{tenant:t}});return yield dh(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(rh,{loginId:o},{queryParams:{tenant:t}});return yield dh(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(sh,{queryParams:{tenant:t}});return yield dh(o),(yield o.json()).data}))}),lh=({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(ah,{queryParams:{tenant:t}});return yield dh(o),o.json()}))}),uh=Pi((e=>{var t,n,o,r;const i=ji(Ed,$d,gd,wd({tenant:wd.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}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=ro(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.55"}}));return{user:ch({httpClient:r.httpClient,tenant:t,mock:n}),tenant:lh({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),hh=Pi((e=>{const t=ji(Vd({name:"widget",initialState:Yu,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{xu.reducer(e),qu.reducer(e),Ku.reducer(e),Ju.reducer(e),Iu.reducer(e),_u.reducer(e),Nu.reducer(e),Zu.reducer(e),Du.reducer(e),Uu.reducer(e)},asyncActions:{searchUsers:_u.action,createUser:xu.action,updateUser:qu.action,enableUser:Ku.action,disableUser:Ju.action,deleteUsers:Iu.action,removePasskey:Zu.action,getCustomAttributes:Du.action,getTenantRoles:Uu.action,setTempUserPassword:Nu.action}}),bd,gd,uh)(e);return class extends t{constructor(...e){super(...e),this.state=Yu,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),ph=Pi((e=>{const t=ji(kd,wd({"widget-id":wd.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}))}}})),fh=Pi((e=>{var t,n,o;return o=class extends(ji(gd,bd,Md,Td,ph,hh)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),gh=Pi((e=>{var t,n,o,r,i,s;return s=class extends(ji(hh,_d,qd,gd,fh)(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(Ql(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(Ri(yield this.fetchWidgetPage("create-user-modal.html")));new Ji((()=>{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 Ji((()=>{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*(){this.validateForm(this.createUserModal.ele)&&(this.actions.createUser(Object.assign(Object.assign({},this.getFormData(this.createUserModal.ele)),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele))})))),p(this,n,new Yi((()=>{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=nu(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})),mh=Pi((e=>{var t,n,o;return o=class extends(ji(gd,gh,fh)(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 Ji(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})),vh=Pi((e=>{var t,n,o;return o=class extends(ji(hh,_d,gd,fh)(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(Ri(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=iu(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new ts(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=pu(this.state);o.text=`Delete ${e}?`}}))},o})),yh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh,vh)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),bu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ji(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})),bh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(hh,_d,gd,qd,fh)(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 Ji((()=>{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 Ji((()=>{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=lu(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(Ri(yield this.fetchWidgetPage("disable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=pu(this.state);r.text=`Disable ${e}?`}))}))},i})),$h=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh,bh,qd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),gu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Ji(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})),wh=["customAttributes"],Eh=e=>{if(!e)return e;const t=function(){return ic(Zl,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},kh=Pi((e=>{var t,n,o,r,i,s,a,d,c,f;return f=class extends(ji(hh,_d,gd,qd,fh)(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(Ql(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=ru(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:Eh(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},(r=n.customAttributes,"customAttributes.",Object.fromEntries(Object.entries(r||{}).map((([e,t])=>[`customAttributes.${e}`,t])))));var r;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 Ji((()=>{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 Ji((()=>{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]},(e=>Object.entries(e).reduce(((e,[t,n])=>{const[o,...r]=t.split(".");return wh.includes(o)?(e[o]||(e[o]={}),e[o][r.join(".")]=n,e):Object.assign(e,{[t]:n})}),{}))(n))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=nu(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(Ri(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 ns(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),p(this,o,new Yi((()=>{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})),Ch=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh,kh,qd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),mu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ji(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})),xh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(hh,_d,gd,qd,fh)(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 Ji((()=>{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 Ji((()=>{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=lu(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(Ri(yield this.fetchWidgetPage("enable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=pu(this.state);r.text=`Activate ${e}?`}))}))},i})),Oh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh,xh,qd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),fu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Ji(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})),Sh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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})),Ih={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},jh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(gd,hh,Ld,bd)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((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),tu)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Ih[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})),Rh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(hh,_d,gd,qd,fh)(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 Ji((()=>{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 Ji((()=>{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=lu(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(Ri(yield this.fetchWidgetPage("remove-passkey-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=pu(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),Nh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh,Rh,qd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),vu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Ji(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})),Mh=Pi((e=>{var t,n,o,r,i,s,a,d;return d=class extends(ji(hh,gd,fh)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((e=>{this.usersTable.data=e}))),i.set(this,Ti(((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,Ai((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,ou(this.state)),h(this,s,"f").call(this,nu(this.state)),this.subscribe(h(this,s,"f").bind(this),nu),this.subscribe(h(this,r,"f").bind(this),ou)}))}},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 Gi(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})),Ah=Pi((e=>{var t,n,o;return o=class extends(ji(hh,_d,gd,qd,fh)(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(Ri(yield this.fetchWidgetPage("generated-password-modal.html")));new Ji((()=>{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})),Dh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(hh,_d,gd,qd,fh,Ah)(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 Ji((()=>{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 Ji((()=>{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=lu(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(Ri(yield this.fetchWidgetPage("reset-password-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=pu(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),Th=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,fh,hh,Dh,qd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),yu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Ji(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})),Ph=Pi((e=>class extends(ji(xd,Fd,Mh,mh,yh,Ch,Oh,$h,Th,Nh,Sh,jh)(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)}))}})),_h=ji((e=>class extends(Ph(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",_h);var Wh=Object.freeze({__proto__:null,default:_h});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Lh="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},Uh=e=>e&&"function"==typeof e.match;function Fh(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Op(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=>bs(t)&&t.type===e,n}function Vh(e){return"function"==typeof e&&"type"in e&&Uh(e)}function qh(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 Bh=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 Ss(e)?la(e,(()=>{})):e}function Kh(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?Op(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Hh(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Gh(e,t,n){const o=Jh(e,t,n);return{detectMutations:()=>Xh(e,t,o,n)}}function Jh(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]=Jh(e,t,n[r],s))}}return i}function Xh(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=Xh(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Zh(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function Yh(e,t="",n=Zh,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=Yh(c,a,n,o,r,i),s))return s}return i&&Qh(e)&&i.add(e),!1}function Qh(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Qh(t))return!1;return!0}function ep(e){return"boolean"==typeof e}var tp=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Bh;if(t&&(ep(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};ep(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=Hh,ignoredPaths:r,warnAfter:i=32}=e;const s=Gh.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=qh(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Op(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?Op(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={};ep(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Zh,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(!bs(u))return c(u);const h=c(u),p=qh(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Yh(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=Yh(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={};ep(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Vh}=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},np=e=>t=>{setTimeout(t,e)},op="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:np(10),rp=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Bh(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?op:"callback"===e.type?e.queueNotification:np(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},ip="production"===process.env.NODE_ENV;function sp(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?Op(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Op(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?Op(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Op(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?Op(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?Op(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var ap=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function dp(...e){return t=>e.some((e=>((e,t)=>Uh(e)?e.match(t):e(t))(e,t)))}var cp=["name","message","stack","code"],lp=class{constructor(e,t){this.payload=e,this.meta=t}_type},up=class{constructor(e,t){this.payload=e,this.meta=t}_type},hp=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of cp)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},pp=(()=>{function e(e,t,n){const o=Fh(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Fh(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Fh(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||hp)(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):ap(),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 lp(e,t),fulfillWithValue:(e,t)=>new up(e,t)})).then((t=>{if(t instanceof lp)throw t;return t instanceof up?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof lp?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(fp)})}}),{pending:r,rejected:i,fulfilled:o,settled:dp(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function fp(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var gp=Symbol.for("rtk-slice-createasyncthunk");function mp(e,t){return`${e}/${t}`}function vp({creators:e}={}){const t=e?.asyncThunk?.[gp];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Op(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?Op(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Op(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?Op(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?sp(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?Op(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]=sp(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?Op(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:mp(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?Op(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?Fh(e,s):Fh(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Op(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||$p,pending:a||$p,rejected:d||$p,settled:c||$p})}(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?Op(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Kh(l,n,{insert:()=>new WeakMap});return Kh(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=yp(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 yp(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?Op(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var bp=vp();function $p(){}var wp="listenerMiddleware",Ep=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Fh(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?Op(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?Op(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},kp=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Ep(e);return{id:ap(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Op(22):"Unsubscribe not initialized")}}}),{withTypes:()=>kp}),Cp=Object.assign(Fh(`${wp}/add`),{withTypes:()=>Cp});Fh(`${wp}/removeAll`);var xp=Object.assign(Fh(`${wp}/remove`),{withTypes:()=>xp});function Op(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 Sp=["error","warn","info","debug"],Ip=Pi((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 Sp.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})),jp="undefined"!=typeof localStorage,Rp=jp&&localStorage.getItem("base.content.url")||"https://static.descope.com/pages",Np=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Mp=Pi((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})),Ap=Pi((e=>{var t,n;const o=ji(Ip,Mp)(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})),Dp=e=>t=>{var n,o,r;const i=ji(Ip,Mp,Ap)(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};Dp.missingAttrValidator=Np;const Tp=Pi((e=>{const t=ji(Dp({"project-id":Np}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}}));const Pp=Pi((e=>{const t=ji(Ip,Tp)(e);return class extends t{async fetchStaticResource(e,t){const n=function(e,t,n="v2-beta"){const o=new URL(Rp);return o.pathname=Ni(o.pathname,e,n,t),o.toString()}(this.projectId,e),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())}}}})),_p=Pi((e=>{var t,n,o;const r=ji(Pp)(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})),Wp=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(Mp,Ip)(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 vf})),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})),Lp="load-descope-ui",Up="base.ui.components.url",Fp=jp&&localStorage.getItem(Up)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Vp=jp&&localStorage.getItem(Up)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",qp=e=>{const t=document.createElement("script");return t.id=e,t},Bp=(e,t)=>e.replace("<version>",t),zp=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(Ip,_p)(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=qp("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=Bp(Vp,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#${Lp}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=qp(Lp);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Bp(Fp,await h(this,t,"m",r).call(this))}return document.getElementById(Lp)},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})),Kp="content-root",Hp="root",Gp=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Hp}, #${Kp} {\n height: 100%;\n }\n #${Hp} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Hp}">\n <div id="${Kp}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Kp),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Hp)}})),Jp="descope-modal",Xp=Pi((e=>{var t,n;const o=ji(Mp,Gp,zp)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Jp);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([Jp]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Zp="descope-notification",Yp=Pi((e=>{var t,n;const o=ji(Mp,Gp,zp)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Zp);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([Zp])}},t=new WeakMap,n})),Qp=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',ef=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(Dp({theme:Qp}),Pp,Mp,zp,_p,Gp,Ap)(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(Up)))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(Up),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})),tf=e=>Pi((t=>{const n=bp(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(Ip)(t)){constructor(...e){super(...e);const t=function(e){const t=tp(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?Op(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!ip&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Op(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!ip&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Op(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!ip&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Op(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Lh({trace:!ip,..."object"==typeof r&&r}));const l=ys(...d),u=rp(l);if(!ip&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Op(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!ip&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Op(6):"`enhancers` callback must return an array");if(!ip&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Op(7):"each enhancer provided to configureStore must be a function");return ip||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{fp(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()))))}}})),nf=Pi((e=>class extends(Ip(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()}})),of=(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 rf,sf,af,df,cf,lf,uf,hf,pf,ff;const gf=document.createElement("template");gf.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 mf extends HTMLElement{constructor(){var e;super(),rf.add(this),sf.set(this,new Bi({messages:[]})),af.set(this,void 0),df.set(this,void 0),cf.set(this,void 0),lf.set(this,{resize:h(this,rf,"m",ff).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(gf.content.cloneNode(!0)),p(this,af,this.shadowRoot.querySelector(".debugger"),"f"),p(this,df,h(this,af,"f").querySelector(".content"),"f"),p(this,cf,h(this,af,"f").querySelector(".header"),"f")}updateData(e){h(this,sf,"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]=of(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,af,"f"),h(this,cf,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,lf,"f").resize),(e=h(this,af,"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,af,"f").onresize=h(this,rf,"m",pf).bind(this),h(this,sf,"f").subscribe(h(this,rf,"m",uf).bind(this))}disconnectedCallback(){h(this,sf,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,lf,"f").resize)}}sf=new WeakMap,af=new WeakMap,df=new WeakMap,cf=new WeakMap,lf=new WeakMap,rf=new WeakSet,uf=function(e){h(this,rf,"m",hf).call(this,e),h(this,rf,"m",pf).call(this)},hf=function(e){h(this,df,"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("")},pf=function(){h(this,df,"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)}))},ff=function(){const[e,t]=of(h(this,af,"f"),Number.parseInt(h(this,af,"f").style.left,10),Number.parseInt(h(this,af,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,af,"f").style.top=`${t}px`,h(this,af,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",mf);var vf=Object.freeze({__proto__:null});const yf=e=>e.selectedRolesIds,bf=e=>e.notifications,$f=e=>e.tenantPermissions.data||[],wf=wa((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"})})))),Ef=wa(yf,wf,((e,t)=>t.filter((t=>e.includes(t.name))))),kf=wa(yf,(e=>!!e.length)),Cf=wa(yf,(e=>1===e.length)),xf=wa(Ef,(e=>1===e.length?e[0].name:`${e.length} roles`)),Of=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)}))}))},Sf=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}}),If=({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)})}}),jf=pp("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),Rf=Of(jf)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},Sf((e=>e.createRole)),If({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>`}})),Nf={action:jf,reducer:Rf},Mf=pp("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Af=Of(Mf)({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=[]}},Sf((e=>e.deleteRole)),If({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete role${["","s"]}`})),Df={action:Mf,reducer:Af},Tf=pp("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),Pf=Of(Tf)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},Sf((e=>e.rolesList))),_f={action:Tf,reducer:Pf},Wf=pp("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),Lf=Of(Wf)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},Sf((e=>e.updateRole)),If({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>`}})),Uf={action:Wf,reducer:Lf},Ff=pp("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),Vf={action:Ff,reducer:Of(Ff)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},Sf((e=>e.tenantPermissions)))},qf={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:[]},Bf="/v1/mgmt/role/search",zf="/v1/mgmt/role/delete/batch",Kf="/v1/mgmt/role/create",Hf="/v1/mgmt/role/update",Gf="/v1/mgmt/permission/all",Jf=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)})),Xf=({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(Bf,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Jf(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(zf,{roleNames:o},{queryParams:{tenant:t}});return yield Jf(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(Kf,{name:o,description:r,permissionNames:i,tenantId:t},{queryParams:{tenant:t}});return yield Jf(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(Hf,{name:o,newName:r,description:i,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Jf(a);const d=yield a.json();return d.oldName=o,d}))}),Zf=({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(Gf,{queryParams:{tenant:t}});return yield Jf(o),o.json()}))}),Yf=Pi((e=>{var t,n,o,r;const i=ji(Tp,Ap,Ip,Dp({tenant:Dp.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}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=ro(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.53"}}));return{role:Xf({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Zf({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Qf=Pi((e=>{const t=ji(tf({name:"widget",initialState:qf,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Nf.reducer(e),Uf.reducer(e),Df.reducer(e),_f.reducer(e),Vf.reducer(e)},asyncActions:{searchRoles:_f.action,createRole:Nf.action,updateRole:Uf.action,deleteRoles:Df.action,getTenantPermissions:Vf.action}}),Mp,Ip,Yf)(e);return class extends t{constructor(...e){super(...e),this.state=qf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),eg=Pi((e=>{const t=ji(Pp,Dp({"widget-id":Dp.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}))}}})),tg=Pi((e=>{var t,n,o;return o=class extends(ji(Ip,Mp,zp,Gp,eg,Qf)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),ng=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Qf,Xp,nf,Ip,tg)(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=$f(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(Ri(yield this.fetchWidgetPage("create-role-modal.html")));new Ji((()=>{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 Ji((()=>{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 Yi((()=>{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})),og=Pi((e=>{var t,n,o;return o=class extends(ji(Ip,ng,tg)(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 Ji(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})),rg=Pi((e=>{var t,n,o;return o=class extends(ji(Qf,Xp,Ip,tg)(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(Ri(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=Ef(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new ts(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=xf(this.state);o.text=`Delete ${e}?`}}))},o})),ig=Pi((e=>{var t,n,o,r;return r=class extends(ji(Ip,tg,Qf,rg)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),kf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ji(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})),sg=Pi((e=>{var t,n,o,r,i,s,a,d;return d=class extends(ji(Qf,Xp,Ip,nf,tg)(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=$f(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=Ef(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 Ji((()=>{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 Ji((()=>{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=Ef(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(Ri(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 Yi((()=>{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})),ag=Pi((e=>{var t,n,o,r;return r=class extends(ji(Ip,tg,Qf,sg,nf)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Cf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ji(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})),dg=Pi((e=>{var t,n,o,r;return r=class extends(ji(Ip,tg,Qf)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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})),cg={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},lg=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Ip,Qf,Yp,Mp)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((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),bf)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=cg[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})),ug=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Qf,Ip,tg)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((e=>{this.rolesTable.data=e}))),r.set(this,Ti(((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,wf(this.state)),this.subscribe(h(this,o,"f").bind(this),wf)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Gi(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})),hg=Pi((e=>class extends(ji(Wp,ef,ug,og,ig,ag,dg,lg)(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)}))}})),pg=ji((e=>class extends(hg(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",pg);var fg=Object.freeze({__proto__:null,default:pg});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var gg="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},mg=e=>e&&"function"==typeof e.match;function vg(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?nm(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=>bs(t)&&t.type===e,n}function yg(e){return"function"==typeof e&&"type"in e&&mg(e)}function bg(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 wg(e){return Ss(e)?la(e,(()=>{})):e}function Eg(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?nm(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function kg(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Cg(e,t,n){const o=xg(e,t,n);return{detectMutations:()=>Og(e,t,o,n)}}function xg(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]=xg(e,t,n[r],s))}}return i}function Og(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=Og(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Sg(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function Ig(e,t="",n=Sg,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=Ig(c,a,n,o,r,i),s))return s}return i&&jg(e)&&i.add(e),!1}function jg(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!jg(t))return!1;return!0}function Rg(e){return"boolean"==typeof e}var Ng=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new $g;if(t&&(Rg(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Rg(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=kg,ignoredPaths:r,warnAfter:i=32}=e;const s=Cg.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=bg(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?nm(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?nm(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={};Rg(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Sg,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(!bs(u))return c(u);const h=c(u),p=bg(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Ig(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=Ig(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={};Rg(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=yg}=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},Mg=e=>t=>{setTimeout(t,e)},Ag="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Mg(10),Dg=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?Ag:"callback"===e.type?e.queueNotification:Mg(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},Tg="production"===process.env.NODE_ENV;function Pg(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?nm(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?nm(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?nm(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?nm(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?nm(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?nm(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var _g=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Wg(...e){return t=>e.some((e=>((e,t)=>mg(e)?e.match(t):e(t))(e,t)))}var Lg=["name","message","stack","code"],Ug=class{constructor(e,t){this.payload=e,this.meta=t}_type},Fg=class{constructor(e,t){this.payload=e,this.meta=t}_type},Vg=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Lg)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},qg=(()=>{function e(e,t,n){const o=vg(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=vg(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=vg(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Vg)(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):_g(),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 Ug(e,t),fulfillWithValue:(e,t)=>new Fg(e,t)})).then((t=>{if(t instanceof Ug)throw t;return t instanceof Fg?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Ug?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(Bg)})}}),{pending:r,rejected:i,fulfilled:o,settled:Wg(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Bg(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var zg=Symbol.for("rtk-slice-createasyncthunk");function Kg(e,t){return`${e}/${t}`}function Hg({creators:e}={}){const t=e?.asyncThunk?.[zg];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?nm(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?nm(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?nm(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?nm(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?Pg(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?nm(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]=Pg(t);if(function(e){return"function"==typeof e}(e))n=()=>wg(e());else{const t=wg(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?nm(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:Kg(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?nm(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?vg(e,s):vg(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?nm(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||Xg,pending:a||Xg,rejected:d||Xg,settled:c||Xg})}(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?nm(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Eg(l,n,{insert:()=>new WeakMap});return Eg(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Gg(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 Gg(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?nm(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Jg=Hg();function Xg(){}var Zg="listenerMiddleware",Yg=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=vg(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?nm(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?nm(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Qg=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Yg(e);return{id:_g(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?nm(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Qg}),em=Object.assign(vg(`${Zg}/add`),{withTypes:()=>em});vg(`${Zg}/removeAll`);var tm=Object.assign(vg(`${Zg}/remove`),{withTypes:()=>tm});function nm(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 om=["error","warn","info","debug"],rm=Pi((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 om.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})),im="undefined"!=typeof localStorage,sm=im&&localStorage.getItem("base.content.url")||"https://static.descope.com/pages",am=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,dm=Pi((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})),cm=Pi((e=>{var t,n;const o=ji(rm,dm)(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})),lm=e=>t=>{var n,o,r;const i=ji(rm,dm,cm)(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};lm.missingAttrValidator=am;const um=Pi((e=>{const t=ji(lm({"project-id":am}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}}));const hm=Pi((e=>{const t=ji(rm,um)(e);return class extends t{async fetchStaticResource(e,t){const n=function(e,t,n="v2-beta"){const o=new URL(sm);return o.pathname=Ni(o.pathname,e,n,t),o.toString()}(this.projectId,e),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())}}}})),pm=Pi((e=>{var t,n,o;const r=ji(hm)(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})),fm=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(dm,rm)(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 Km})),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})),gm="load-descope-ui",mm="base.ui.components.url",vm=im&&localStorage.getItem(mm)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ym=im&&localStorage.getItem(mm)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",bm=e=>{const t=document.createElement("script");return t.id=e,t},$m=(e,t)=>e.replace("<version>",t),wm=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(rm,pm)(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=bm("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=$m(ym,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#${gm}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=bm(gm);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=$m(vm,await h(this,t,"m",r).call(this))}return document.getElementById(gm)},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})),Em="content-root",km="root",Cm=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${km}, #${Em} {\n height: 100%;\n }\n #${km} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${km}">\n <div id="${Em}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Em),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(km)}})),xm="descope-modal",Om=Pi((e=>{var t,n;const o=ji(dm,Cm,wm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(xm);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([xm]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Sm="descope-notification",Im=Pi((e=>{var t,n;const o=ji(dm,Cm,wm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Sm);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([Sm])}},t=new WeakMap,n})),jm=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Rm=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(lm({theme:jm}),hm,dm,wm,pm,Cm,cm)(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(mm)))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(mm),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})),Nm=e=>Pi((t=>{const n=Jg(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(rm)(t)){constructor(...e){super(...e);const t=function(e){const t=Ng(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?nm(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!Tg&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?nm(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Tg&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?nm(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Tg&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?nm(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=gg({trace:!Tg,..."object"==typeof r&&r}));const l=ys(...d),u=Dg(l);if(!Tg&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?nm(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Tg&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?nm(6):"`enhancers` callback must return an array");if(!Tg&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?nm(7):"each enhancer provided to configureStore must be a function");return Tg||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{Bg(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()))))}}})),Mm=Pi((e=>class extends(rm(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()}})),Am=(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 Dm,Tm,Pm,_m,Wm,Lm,Um,Fm,Vm,qm;const Bm=document.createElement("template");Bm.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 zm extends HTMLElement{constructor(){var e;super(),Dm.add(this),Tm.set(this,new Bi({messages:[]})),Pm.set(this,void 0),_m.set(this,void 0),Wm.set(this,void 0),Lm.set(this,{resize:h(this,Dm,"m",qm).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Bm.content.cloneNode(!0)),p(this,Pm,this.shadowRoot.querySelector(".debugger"),"f"),p(this,_m,h(this,Pm,"f").querySelector(".content"),"f"),p(this,Wm,h(this,Pm,"f").querySelector(".header"),"f")}updateData(e){h(this,Tm,"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]=Am(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,Pm,"f"),h(this,Wm,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Lm,"f").resize),(e=h(this,Pm,"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,Pm,"f").onresize=h(this,Dm,"m",Vm).bind(this),h(this,Tm,"f").subscribe(h(this,Dm,"m",Um).bind(this))}disconnectedCallback(){h(this,Tm,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Lm,"f").resize)}}Tm=new WeakMap,Pm=new WeakMap,_m=new WeakMap,Wm=new WeakMap,Lm=new WeakMap,Dm=new WeakSet,Um=function(e){h(this,Dm,"m",Fm).call(this,e),h(this,Dm,"m",Vm).call(this)},Fm=function(e){h(this,_m,"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("")},Vm=function(){h(this,_m,"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)}))},qm=function(){const[e,t]=Am(h(this,Pm,"f"),Number.parseInt(h(this,Pm,"f").style.left,10),Number.parseInt(h(this,Pm,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Pm,"f").style.top=`${t}px`,h(this,Pm,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",zm);var Km=Object.freeze({__proto__:null});const Hm=e=>e.selectedAccessKeysIds,Gm=e=>e.notifications,Jm=wa((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}))))),Xm=wa(Hm,Jm,((e,t)=>t.filter((t=>e.includes(t.id))))),Zm=wa(Hm,(e=>!!e.length)),Ym=wa(Xm,(e=>e.every((e=>e.editable)))),Qm=wa(Ym,Zm,((e,t)=>e&&t));wa(Hm,(e=>1===e.length));const ev=wa(Xm,(e=>1===e.length?e[0].name:`${e.length} access keys`)),tv=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)}))}))},nv=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}}),ov=({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)})}}),rv=qg("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),iv=tv(rv)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},nv((e=>e.createAccessKey)),ov({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>`}})),sv={action:rv,reducer:iv},av=qg("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),dv=tv(av)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},nv((e=>e.deleteAccessKey)),ov({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),cv={action:av,reducer:dv},lv=qg("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),uv=tv(lv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},nv((e=>e.accessKeysList))),hv={action:lv,reducer:uv},pv=qg("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),fv=tv(pv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},nv((e=>e.activateAccessKey)),ov({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),gv={action:pv,reducer:fv},mv=qg("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),vv=tv(mv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},nv((e=>e.deactivateAccessKey)),ov({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),yv={action:mv,reducer:vv},bv=qg("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),$v={action:bv,reducer:tv(bv)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},nv((e=>e.tenantRoles)))},wv={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:[]},Ev="/v1/mgmt/accesskey/search",kv="/v1/mgmt/accesskey/delete/batch",Cv="/v1/mgmt/accesskey/create",xv="/v1/mgmt/accesskey/deactivate/batch",Ov="/v1/mgmt/accesskey/activate/batch",Sv="/v1/mgmt/role/all",Iv=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)})),jv=({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(Ev,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Iv(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(kv,{ids:o},{queryParams:{tenant:t}});return yield Iv(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(Cv,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield Iv(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(Ov,{ids:o},{queryParams:{tenant:t}});return yield Iv(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(xv,{ids:o},{queryParams:{tenant:t}});return yield Iv(r),yield r.json()}))}),Rv=({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(Sv,{queryParams:{tenant:t}});return yield Iv(o),o.json()}))}),Nv=Pi((e=>{var t,n,o,r;const i=ji(um,cm,rm,lm({tenant:lm.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}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=ro(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.55"}}));return{accesskey:jv({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Rv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Mv=Pi((e=>{const t=ji(Nm({name:"widget",initialState:wv,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{sv.reducer(e),cv.reducer(e),hv.reducer(e),gv.reducer(e),yv.reducer(e),$v.reducer(e)},asyncActions:{searchAccessKeys:hv.action,createAccessKey:sv.action,activateAccessKeys:gv.action,deactivateAccessKeys:yv.action,deleteAccessKeys:cv.action,getTenantRoles:$v.action}}),dm,rm,Nv)(e);return class extends t{constructor(...e){super(...e),this.state=wv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Av=Pi((e=>{const t=ji(hm,lm({"widget-id":lm.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}))}}})),Dv=Pi((e=>{var t,n,o;return o=class extends(ji(rm,dm,wm,Cm,Av,Mv)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Tv=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Mv,rm,Dv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((e=>{this.accessKeysTable.data=e}))),r.set(this,Ti(((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,Jm(this.state)),this.subscribe(h(this,o,"f").bind(this),Jm)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Gi(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})),Pv=Pi((e=>{var t,n,o;return o=class extends(ji(Mv,Om,rm,Dv)(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(Ri(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=Xm(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new ts(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=ev(this.state);o.text=`Activate ${e}?`}}))},o})),_v=Pi((e=>{var t,n,o,r;return r=class extends(ji(rm,Dv,Mv,Pv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Qm)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Ji(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})),Wv=Pi((e=>{var t,n,o;return o=class extends(ji(Mv,Om,Mm,rm,Dv)(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(Ri(yield this.fetchWidgetPage("created-access-key-modal.html")));new Ji((()=>{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})),Lv=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Mv,Om,Mm,rm,Dv,Wv)(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(Ri(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Ji((()=>{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 Ji((()=>{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 Yi((()=>{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})),Uv=Pi((e=>{var t,n,o;return o=class extends(ji(rm,Lv,Dv)(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 Ji(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})),Fv=Pi((e=>{var t,n,o;return o=class extends(ji(Mv,Om,rm,Dv)(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(Ri(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=Xm(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new ts(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=ev(this.state);o.text=`Deactivate ${e}?`}}))},o})),Vv=Pi((e=>{var t,n,o,r;return r=class extends(ji(rm,Dv,Mv,Fv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Qm)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Ji(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})),qv=Pi((e=>{var t,n,o;return o=class extends(ji(Mv,Om,rm,Dv)(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(Ri(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=Xm(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new ts(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=ev(this.state);o.text=`Delete ${e}?`}}))},o})),Bv=Pi((e=>{var t,n,o,r;return r=class extends(ji(rm,Dv,Mv,qv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Qm)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ji(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})),zv=Pi((e=>{var t,n,o,r;return r=class extends(ji(rm,Dv,Mv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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})),Kv={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},Hv=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(rm,Mv,Im,dm)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((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),Gm)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Kv[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})),Gv=Pi((e=>class extends(ji(fm,Rm,Tv,Uv,Bv,zv,_v,Vv,Hv)(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)}))}})),Jv=ji((e=>class extends(Gv(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Jv);var Xv=Object.freeze({__proto__:null,default:Jv});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Zv="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},Yv=e=>e&&"function"==typeof e.match;function Qv(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Wy(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=>bs(t)&&t.type===e,n}function ey(e){return"function"==typeof e&&"type"in e&&Yv(e)}function ty(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 ny=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 oy(e){return Ss(e)?la(e,(()=>{})):e}function ry(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?Wy(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function iy(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function sy(e,t,n){const o=ay(e,t,n);return{detectMutations:()=>dy(e,t,o,n)}}function ay(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]=ay(e,t,n[r],s))}}return i}function dy(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=dy(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function cy(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function ly(e,t="",n=cy,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=ly(c,a,n,o,r,i),s))return s}return i&&uy(e)&&i.add(e),!1}function uy(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!uy(t))return!1;return!0}function hy(e){return"boolean"==typeof e}var py=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new ny;if(t&&(hy(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};hy(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=iy,ignoredPaths:r,warnAfter:i=32}=e;const s=sy.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=ty(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Wy(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?Wy(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={};hy(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=cy,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(!bs(u))return c(u);const h=c(u),p=ty(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=ly(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=ly(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={};hy(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ey}=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},fy=e=>t=>{setTimeout(t,e)},gy="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:fy(10),my=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new ny(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?gy:"callback"===e.type?e.queueNotification:fy(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},vy="production"===process.env.NODE_ENV;function yy(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?Wy(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Wy(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?Wy(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Wy(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?Wy(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?Wy(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var by=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function $y(...e){return t=>e.some((e=>((e,t)=>Yv(e)?e.match(t):e(t))(e,t)))}var wy=["name","message","stack","code"],Ey=class{constructor(e,t){this.payload=e,this.meta=t}_type},ky=class{constructor(e,t){this.payload=e,this.meta=t}_type},Cy=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of wy)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},xy=(()=>{function e(e,t,n){const o=Qv(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Qv(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Qv(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Cy)(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):by(),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 Ey(e,t),fulfillWithValue:(e,t)=>new ky(e,t)})).then((t=>{if(t instanceof Ey)throw t;return t instanceof ky?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Ey?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(Oy)})}}),{pending:r,rejected:i,fulfilled:o,settled:$y(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Oy(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Sy=Symbol.for("rtk-slice-createasyncthunk");function Iy(e,t){return`${e}/${t}`}function jy({creators:e}={}){const t=e?.asyncThunk?.[Sy];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Wy(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?Wy(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Wy(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?Wy(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?yy(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?Wy(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]=yy(t);if(function(e){return"function"==typeof e}(e))n=()=>oy(e());else{const t=oy(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?Wy(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:Iy(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?Wy(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?Qv(e,s):Qv(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Wy(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||My,pending:a||My,rejected:d||My,settled:c||My})}(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?Wy(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=ry(l,n,{insert:()=>new WeakMap});return ry(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Ry(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 Ry(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?Wy(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Ny=jy();function My(){}var Ay="listenerMiddleware",Dy=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Qv(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?Wy(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?Wy(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Ty=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Dy(e);return{id:by(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Wy(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Ty}),Py=Object.assign(Qv(`${Ay}/add`),{withTypes:()=>Py});Qv(`${Ay}/removeAll`);var _y=Object.assign(Qv(`${Ay}/remove`),{withTypes:()=>_y});function Wy(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 Ly=["error","warn","info","debug"],Uy=Pi((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 Ly.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})),Fy="undefined"!=typeof localStorage,Vy=Fy&&localStorage.getItem("base.content.url")||"https://static.descope.com/pages",qy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,By=Pi((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})),zy=Pi((e=>{var t,n;const o=ji(Uy,By)(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})),Ky=e=>t=>{var n,o,r;const i=ji(Uy,By,zy)(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};Ky.missingAttrValidator=qy;const Hy=Pi((e=>{const t=ji(Ky({"project-id":qy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}}));const Gy=Pi((e=>{const t=ji(Uy,Hy)(e);return class extends t{async fetchStaticResource(e,t){const n=function(e,t,n="v2-beta"){const o=new URL(Vy);return o.pathname=Ni(o.pathname,e,n,t),o.toString()}(this.projectId,e),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())}}}})),Jy=Pi((e=>{var t,n,o;const r=ji(Gy)(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})),Xy=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(By,Uy)(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 xb})),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})),Zy="load-descope-ui",Yy="base.ui.components.url",Qy=Fy&&localStorage.getItem(Yy)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",eb=Fy&&localStorage.getItem(Yy)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",tb=e=>{const t=document.createElement("script");return t.id=e,t},nb=(e,t)=>e.replace("<version>",t),ob=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(Uy,Jy)(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=tb("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=nb(eb,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#${Zy}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=tb(Zy);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=nb(Qy,await h(this,t,"m",r).call(this))}return document.getElementById(Zy)},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})),rb="content-root",ib="root",sb=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${ib}, #${rb} {\n height: 100%;\n }\n #${ib} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${ib}">\n <div id="${rb}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(rb),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(ib)}})),ab="descope-modal";Pi((e=>{var t,n;const o=ji(By,sb,ob)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(ab);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([ab]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const db="descope-notification";Pi((e=>{var t,n;const o=ji(By,sb,ob)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(db);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([db])}},t=new WeakMap,n}));const cb=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',lb=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(Ky({theme:cb}),Gy,By,ob,Jy,sb,zy)(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(Yy)))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(Yy),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})),ub=e=>Pi((t=>{const n=Ny(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(Uy)(t)){constructor(...e){super(...e);const t=function(e){const t=py(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?Wy(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!vy&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Wy(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!vy&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Wy(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!vy&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Wy(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Zv({trace:!vy,..."object"==typeof r&&r}));const l=ys(...d),u=my(l);if(!vy&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Wy(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!vy&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Wy(6):"`enhancers` callback must return an array");if(!vy&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Wy(7):"each enhancer provided to configureStore must be a function");return vy||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{Oy(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()))))}}}));Pi((e=>class extends(Uy(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 hb=(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 pb,fb,gb,mb,vb,yb,bb,$b,wb,Eb;const kb=document.createElement("template");kb.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 Cb extends HTMLElement{constructor(){var e;super(),pb.add(this),fb.set(this,new Bi({messages:[]})),gb.set(this,void 0),mb.set(this,void 0),vb.set(this,void 0),yb.set(this,{resize:h(this,pb,"m",Eb).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(kb.content.cloneNode(!0)),p(this,gb,this.shadowRoot.querySelector(".debugger"),"f"),p(this,mb,h(this,gb,"f").querySelector(".content"),"f"),p(this,vb,h(this,gb,"f").querySelector(".header"),"f")}updateData(e){h(this,fb,"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]=hb(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,gb,"f"),h(this,vb,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,yb,"f").resize),(e=h(this,gb,"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,gb,"f").onresize=h(this,pb,"m",wb).bind(this),h(this,fb,"f").subscribe(h(this,pb,"m",bb).bind(this))}disconnectedCallback(){h(this,fb,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,yb,"f").resize)}}fb=new WeakMap,gb=new WeakMap,mb=new WeakMap,vb=new WeakMap,yb=new WeakMap,pb=new WeakSet,bb=function(e){h(this,pb,"m",$b).call(this,e),h(this,pb,"m",wb).call(this)},$b=function(e){h(this,mb,"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("")},wb=function(){h(this,mb,"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)}))},Eb=function(){const[e,t]=hb(h(this,gb,"f"),Number.parseInt(h(this,gb,"f").style.left,10),Number.parseInt(h(this,gb,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,gb,"f").style.top=`${t}px`,h(this,gb,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Cb);var xb=Object.freeze({__proto__:null});const Ob=e=>e.selectedAuditId,Sb=wa((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"})))));wa(Ob,Sb,((e,t)=>t.find((t=>e===t.id)))),wa(Ob,(e=>!!e));const Ib=xy("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),jb=(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)}))}))})(Ib)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Rb=e=>e.auditList,{onFulfilled:e=>{Rb(e).loading=!1},onPending:e=>{Rb(e).loading=!0,Rb(e).error=null},onRejected:(e,t)=>{Rb(e).loading=!1,Rb(e).error=t.error}}));var Rb;const Nb={action:Ib,reducer:jb},Mb={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Ab="/v1/mgmt/audit/search",Db=({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(Ab,{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}))}),Tb=Pi((e=>{var t,n,o,r;const i=ji(Hy,zy,Uy,Ky({tenant:Ky.missingAttrValidator}))(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}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=ro(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.18"}}));return{audit:Db({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Pb=Pi((e=>{const t=ji(ub({name:"widget",initialState:Mb,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Nb.reducer(e)},asyncActions:{searchAudit:Nb.action}}),By,Uy,Tb)(e);return class extends t{constructor(...e){super(...e),this.state=Mb,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),_b=Pi((e=>{const t=ji(Gy,Ky({"widget-id":Ky.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}))}}})),Wb=Pi((e=>{var t,n,o;return o=class extends(ji(Uy,By,ob,sb,_b,Pb)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Lb=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Uy,Wb,Pb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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 Qi(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})),Ub=Pi((e=>{var t,n,o,r;return r=class extends(ji(Pb,Uy,Wb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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,Sb(this.state)),this.subscribe(h(this,o,"f").bind(this),Sb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Gi(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})),Fb=Pi((e=>class extends(ji(Xy,lb,Ub,Lb)(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)}))}})),Vb=ji((e=>class extends(Fb(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Vb);var qb=Object.freeze({__proto__:null,default:Vb});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Bb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},zb=e=>e&&"function"==typeof e.match;function Kb(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?N$(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=>bs(t)&&t.type===e,n}function Hb(e){return"function"==typeof e&&"type"in e&&zb(e)}function Gb(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 Jb=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 Xb(e){return Ss(e)?la(e,(()=>{})):e}function Zb(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?N$(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Yb(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Qb(e,t,n){const o=e$(e,t,n);return{detectMutations:()=>t$(e,t,o,n)}}function e$(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]=e$(e,t,n[r],s))}}return i}function t$(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=t$(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function n$(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function o$(e,t="",n=n$,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=o$(c,a,n,o,r,i),s))return s}return i&&r$(e)&&i.add(e),!1}function r$(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!r$(t))return!1;return!0}function i$(e){return"boolean"==typeof e}var s$=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Jb;if(t&&(i$(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};i$(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=Yb,ignoredPaths:r,warnAfter:i=32}=e;const s=Qb.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Gb(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?N$(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?N$(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={};i$(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=n$,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(!bs(u))return c(u);const h=c(u),p=Gb(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=o$(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=o$(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={};i$(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Hb}=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},a$=e=>t=>{setTimeout(t,e)},d$="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:a$(10),c$=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Jb(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?d$:"callback"===e.type?e.queueNotification:a$(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},l$="production"===process.env.NODE_ENV;function u$(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?N$(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?N$(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?N$(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?N$(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?N$(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?N$(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var h$=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function p$(...e){return t=>e.some((e=>((e,t)=>zb(e)?e.match(t):e(t))(e,t)))}var f$=["name","message","stack","code"],g$=class{constructor(e,t){this.payload=e,this.meta=t}_type},m$=class{constructor(e,t){this.payload=e,this.meta=t}_type},v$=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of f$)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},y$=(()=>{function e(e,t,n){const o=Kb(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Kb(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Kb(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||v$)(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):h$(),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 g$(e,t),fulfillWithValue:(e,t)=>new m$(e,t)})).then((t=>{if(t instanceof g$)throw t;return t instanceof m$?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof g$?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(b$)})}}),{pending:r,rejected:i,fulfilled:o,settled:p$(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function b$(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var $$=Symbol.for("rtk-slice-createasyncthunk");function w$(e,t){return`${e}/${t}`}function E$({creators:e}={}){const t=e?.asyncThunk?.[$$];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?N$(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?N$(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?N$(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?N$(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?u$(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?N$(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]=u$(t);if(function(e){return"function"==typeof e}(e))n=()=>Xb(e());else{const t=Xb(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?N$(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:w$(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?N$(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?Kb(e,s):Kb(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?N$(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||x$,pending:a||x$,rejected:d||x$,settled:c||x$})}(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?N$(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Zb(l,n,{insert:()=>new WeakMap});return Zb(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=k$(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 k$(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?N$(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var C$=E$();function x$(){}var O$="listenerMiddleware",S$=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Kb(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?N$(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?N$(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},I$=Object.assign((e=>{const{type:t,predicate:n,effect:o}=S$(e);return{id:h$(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?N$(22):"Unsubscribe not initialized")}}}),{withTypes:()=>I$}),j$=Object.assign(Kb(`${O$}/add`),{withTypes:()=>j$});Kb(`${O$}/removeAll`);var R$=Object.assign(Kb(`${O$}/remove`),{withTypes:()=>R$});function N$(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 M$=["error","warn","info","debug"],A$=Pi((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 M$.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,T$=D$&&localStorage.getItem("base.content.url")||"https://static.descope.com/pages",P$=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,_$=Pi((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})),W$=Pi((e=>{var t,n;const o=ji(A$,_$)(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})),L$=e=>t=>{var n,o,r;const i=ji(A$,_$,W$)(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};L$.missingAttrValidator=P$;const U$=Pi((e=>{const t=ji(L$({"project-id":P$}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}}));const F$=Pi((e=>{const t=ji(A$,U$)(e);return class extends t{async fetchStaticResource(e,t){const n=function(e,t,n="v2-beta"){const o=new URL(T$);return o.pathname=Ni(o.pathname,e,n,t),o.toString()}(this.projectId,e),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())}}}})),V$=Pi((e=>{var t,n,o;const r=ji(F$)(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$=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(_$,A$)(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 bw})),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})),B$="load-descope-ui",z$="base.ui.components.url",K$=D$&&localStorage.getItem(z$)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",H$=D$&&localStorage.getItem(z$)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",G$=e=>{const t=document.createElement("script");return t.id=e,t},J$=(e,t)=>e.replace("<version>",t),X$=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(A$,V$)(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=G$("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=J$(H$,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#${B$}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=G$(B$);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=J$(K$,await h(this,t,"m",r).call(this))}return document.getElementById(B$)},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})),Z$="content-root",Y$="root",Q$=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Y$}, #${Z$} {\n height: 100%;\n }\n #${Y$} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Y$}">\n <div id="${Z$}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Z$),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Y$)}})),ew="descope-modal",tw=Pi((e=>{var t,n;const o=ji(_$,Q$,X$)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(ew);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([ew]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),nw="descope-notification";Pi((e=>{var t,n;const o=ji(_$,Q$,X$)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(nw);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([nw])}},t=new WeakMap,n}));const ow=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',rw=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(L$({theme:ow}),F$,_$,X$,V$,Q$,W$)(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(z$)))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(z$),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})),iw=e=>Pi((t=>{const n=C$(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(A$)(t)){constructor(...e){super(...e);const t=function(e){const t=s$(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?N$(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!l$&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?N$(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!l$&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?N$(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!l$&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?N$(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Bb({trace:!l$,..."object"==typeof r&&r}));const l=ys(...d),u=c$(l);if(!l$&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?N$(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!l$&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?N$(6):"`enhancers` callback must return an array");if(!l$&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?N$(7):"each enhancer provided to configureStore must be a function");return l$||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{b$(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()))))}}}));Pi((e=>class extends(A$(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 sw=(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 aw,dw,cw,lw,uw,hw,pw,fw,gw,mw;const vw=document.createElement("template");vw.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 yw extends HTMLElement{constructor(){var e;super(),aw.add(this),dw.set(this,new Bi({messages:[]})),cw.set(this,void 0),lw.set(this,void 0),uw.set(this,void 0),hw.set(this,{resize:h(this,aw,"m",mw).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(vw.content.cloneNode(!0)),p(this,cw,this.shadowRoot.querySelector(".debugger"),"f"),p(this,lw,h(this,cw,"f").querySelector(".content"),"f"),p(this,uw,h(this,cw,"f").querySelector(".header"),"f")}updateData(e){h(this,dw,"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]=sw(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,cw,"f"),h(this,uw,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,hw,"f").resize),(e=h(this,cw,"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,cw,"f").onresize=h(this,aw,"m",gw).bind(this),h(this,dw,"f").subscribe(h(this,aw,"m",pw).bind(this))}disconnectedCallback(){h(this,dw,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,hw,"f").resize)}}dw=new WeakMap,cw=new WeakMap,lw=new WeakMap,uw=new WeakMap,hw=new WeakMap,aw=new WeakSet,pw=function(e){h(this,aw,"m",fw).call(this,e),h(this,aw,"m",gw).call(this)},fw=function(e){h(this,lw,"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("")},gw=function(){h(this,lw,"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)}))},mw=function(){const[e,t]=sw(h(this,cw,"f"),Number.parseInt(h(this,cw,"f").style.left,10),Number.parseInt(h(this,cw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,cw,"f").style.top=`${t}px`,h(this,cw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",yw);var bw=Object.freeze({__proto__:null});const $w=e=>e.me.data,ww=wa($w,(e=>e.picture)),Ew=wa($w,(e=>e.email)),kw=wa($w,(e=>e.verifiedEmail)),Cw=wa($w,(e=>e.name)),xw=wa($w,(e=>e.phone)),Ow=wa($w,(e=>e.verifiedPhone)),Sw=wa($w,(e=>e.webauthn));wa($w,(e=>e.password));const Iw=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)}))}))},jw=y$("users/me",((e,{extra:{api:t}})=>t.user.me())),Rw=Iw(jw)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(Nw=e=>e.me,{onFulfilled:e=>{Nw(e).loading=!1},onPending:e=>{Nw(e).loading=!0,Nw(e).error=null},onRejected:(e,t)=>{Nw(e).loading=!1,Nw(e).error=t.error}}));var Nw;const Mw={action:jw,reducer:Rw},Aw=y$("users/logout",((e,{extra:{api:t}})=>t.user.logout())),Dw={action:Aw,reducer:Iw(Aw)({})},Tw={me:{loading:!1,error:null,data:{}}},Pw="/v1/auth/me",_w=({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(Pw);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()}))}),Ww=Pi((e=>{var t,n,o,r;const i=ji(U$,W$,A$)(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}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=ro(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.20"}}));return{user:Object.assign(Object.assign({},_w({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})),Lw=Pi((e=>{const t=ji(iw({name:"widget",initialState:Tw,reducers:{},extraReducers:e=>{Mw.reducer(e),Dw.reducer(e)},asyncActions:{getMe:Mw.action,logout:Dw.action}}),_$,A$,Ww)(e);return class extends t{constructor(...e){super(...e),this.state=Tw,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Uw=Pi((e=>{const t=ji(F$,L$({"widget-id":L$.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}))}}})),Fw=Pi((e=>{var t,n,o;return o=class extends(ji(A$,_$,X$,Q$,Uw,Lw)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Vw=(e={})=>{const t=Ri("<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 qw(e){return new URLSearchParams(window.location.search).get(e)}const Bw=Pi((e=>{var t,n,o,r,i,s,a,d,c;return c=class extends(ji(Lw,A$,Fw,tw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,Ai((e=>{this.avatar.image=e}))),d.set(this,Ai((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,ww(this.state)),h(this,d,"f").call(this,Cw(this.state)),this.subscribe(h(this,a,"f").bind(this),ww),this.subscribe(h(this,d,"f").bind(this),Cw)}))}},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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new os((()=>{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})),zw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,f,g,m;return m=class extends(ji(Lw,A$,Fw,tw)(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,Ai((e=>{this.emailUserAttr.value=e}))),g.set(this,Ai((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,Ew(this.state)),h(this,g,"f").call(this,kw(this.state)),this.subscribe(h(this,f,"f").bind(this),Ew),this.subscribe(h(this,g,"f").bind(this),kw)}))}},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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl})),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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.emailUserAttr=new rs((()=>{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})),Kw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,f,g;return g=class extends(ji(Lw,A$,Fw,tw)(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,Ai((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,Cw(this.state)),this.subscribe(h(this,f,"f").bind(this),Cw)}))}},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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl})),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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.nameUserAttr=new rs((()=>{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})),Hw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,f,g,m;return m=class extends(ji(Lw,A$,Fw,tw)(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,Ai((e=>{this.phoneUserAttr.value=e}))),g.set(this,Ai((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,xw(this.state)),h(this,g,"f").call(this,Ow(this.state)),this.subscribe(h(this,f,"f").bind(this),xw),this.subscribe(h(this,g,"f").bind(this),Ow)}))}},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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl})),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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.phoneUserAttr=new rs((()=>{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})),Gw=Pi((e=>{var t,n,o,r,i,s,a,d;return d=class extends(ji(Lw,A$,Fw,tw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,Ai((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,Sw(this.state)),this.subscribe(h(this,a,"f").bind(this),Sw)}))}},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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new is((()=>{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})),Jw=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(Lw,A$,Fw,tw)(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 ss((()=>{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(Vw({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new is((()=>{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})),Xw=Pi((e=>{var t,n,o;return o=class extends(ji(Lw,A$,Fw,tw)(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 Ji((()=>{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})),Zw="widget-flow",Yw=Pi((e=>{var t,n,o;return o=class extends(ji(_$,tw,Lw,A$)(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=qw(Zw);r&&(function(e){if(window.history.replaceState&&qw(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())}}(Zw),h(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Vw({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl}));const n=new ss((()=>{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})),Qw=Pi((e=>class extends(ji(q$,rw,Yw,zw,Bw,Kw,Hw,Gw,Jw,Xw)(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)}))}})),eE=ji((e=>class extends(Qw(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),Si.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.20"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",eE);var tE=Object.freeze({__proto__:null,default:eE});const nE=(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 oE,rE,iE,sE,aE,dE,cE,lE,uE,hE;const pE=document.createElement("template");pE.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 fE extends HTMLElement{constructor(){super(),oE.add(this),rE.set(this,new br({messages:[]})),iE.set(this,void 0),sE.set(this,void 0),aE.set(this,void 0),dE.set(this,{resize:h(this,oE,"m",hE).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(pE.content.cloneNode(!0)),p(this,iE,this.shadowRoot.querySelector(".debugger"),"f"),p(this,sE,h(this,iE,"f").querySelector(".content"),"f"),p(this,aE,h(this,iE,"f").querySelector(".header"),"f")}updateData(e){h(this,rE,"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]=nE(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,iE,"f"),h(this,aE,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,dE,"f").resize),(e=h(this,iE,"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,iE,"f").onresize=h(this,oE,"m",uE).bind(this),h(this,rE,"f").subscribe(h(this,oE,"m",cE).bind(this))}disconnectedCallback(){h(this,rE,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,dE,"f").resize)}}rE=new WeakMap,iE=new WeakMap,sE=new WeakMap,aE=new WeakMap,dE=new WeakMap,oE=new WeakSet,cE=function(e){h(this,oE,"m",lE).call(this,e),h(this,oE,"m",uE).call(this)},lE=function(e){h(this,sE,"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("")},uE=function(){h(this,sE,"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)}))},hE=function(){const[e,t]=nE(h(this,iE,"f"),Number.parseInt(h(this,iE,"f").style.left,10),Number.parseInt(h(this,iE,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,iE,"f").style.top=`${t}px`,h(this,iE,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",fE);var gE=Object.freeze({__proto__:null,default:fE});e.AccessKeyManagement=$o,e.AuditManagement=Eo,e.AuthProvider=({projectId:e,baseUrl:n="",sessionTokenViaCookie:s=!1,persistTokens:d=!0,storeLastAuthenticatedUser:c=!0,children:l})=>{const[u,h]=t.useState(),[p,f]=t.useState(),[g,m]=t.useState(!1),[v,y]=t.useState(!1),b=(({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,storeLastAuthenticatedUser:i})=>t.useMemo((()=>{if(e)return so({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:a,persistTokens:o,storeLastAuthenticatedUser:i,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:d,sessionTokenViaCookie:s,storeLastAuthenticatedUser:c});t.useEffect((()=>{if(b){const e=b.onSessionTokenChange(f),t=b.onUserChange(h);return()=>{e(),t()}}}),[b]);const $=t.useRef(!1),w=t.useCallback((()=>{$.current||($.current=!0,y(!0),i(null==b?void 0:b.refresh)().then((()=>{y(!1)})))}),[b]),E=t.useCallback((()=>{m(!0),i(b.me)().then((()=>{m(!1)}))}),[b]),k=t.useMemo((()=>({fetchUser:E,user:u,isUserLoading:g,fetchSession:w,session:p,isSessionLoading:v,isSessionFetched:$.current,projectId:e,baseUrl:n,storeLastAuthenticatedUser:c,setUser:h,setSession:f,sdk:b})),[E,u,g,w,p,v,$.current,e,n,h,f,b]);return o.default.createElement(r.Provider,{value:k},l)},e.Descope=fo,e.RoleManagement=yo,e.SignInFlow=e=>o.default.createElement(fo,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>o.default.createElement(fo,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>o.default.createElement(fo,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=mo,e.UserProfile=Co,e.baseHeaders=a,e.getJwtPermissions=uo,e.getJwtRoles=ho,e.getRefreshToken=lo,e.getSessionToken=co,e.isRefreshTokenExpired=(e=lo())=>null==io?void 0:io.isJwtExpired(e),e.isSessionTokenExpired=(e=co())=>null==io?void 0:io.isJwtExpired(e),e.refresh=(e=lo())=>null==io?void 0:io.refresh(e),e.useDescope=()=>{const{sdk:e}=xo();return t.useMemo((()=>e||new Proxy(ao(),So)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:o,isSessionFetched:r}=xo(),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}=xo(),[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.29"},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",_="v1/auth/oauth/native/start",U="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=(...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}),{})),ye=e=>void 0===e?void 0:JSON.stringify(e),be=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},$e=({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:ve(be(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.17.1"},(null==n?void 0:n.baseHeaders)||{},u),method:p,body:ye(l)};null!==i&&(g.credentials=i||"include");const m=await a((({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})({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}};var we=429;function Ee(e,t,n){var o;let r=ke(e);t&&(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 ke(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return v(e)}function Ce(e){const{exp:t}=ke(e);return(new Date).getTime()/1e3>t}function xe(e){let t=ke(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Oe(e,t){return Ee(e,t,"permissions")}function Se(e,t){return Ee(e,t,"roles")}const Ie=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function je(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===we&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Re=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Ne=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Me=e=>t=>e.test(t),Ae=Me(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),De=Me(/^\+[1-9]{1}[0-9]{3,14}$/),Te=Re(Ae,'"{val}" is not a valid email'),Pe=Re(De,'"{val}" is not a valid phone number'),_e=Re((1,e=>e.length>=1),"Minimum length is 1");const Ue=Re((e=>"string"==typeof e),"Input is not a string"),We=Re((e=>void 0===e),"Input is defined"),Le=(Fe=[Ue(),We()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=Fe.filter((e=>e(t)));return!(n.length<Fe.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var Fe;const Ve=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Ne(...e).validate(n[t]))),t(...n)),qe=e=>[Ue(`"${e}" must be a string`)],Be=e=>[Ue(`"${e}" must be a string`),_e(`"${e}" must not be empty`)],ze=e=>[Ue(`"${e}" must be a string`),Te()],Ke=e=>[Ue(`"${e}" must be a string`),Pe()],He=Ve(Be("accessKey")),Ge=e=>({exchange:He(((t,n)=>je(e.post(y,{loginOptions:n},{token:t}))))}),Je=(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),Xe=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||fe,fe)});var Ze,Ye;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Ze||(Ze={})),function(e){e.email="email"}(Ye||(Ye={}));const Qe=Object.assign(Object.assign({},Ze),Ye);var et;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(et||(et={}));const tt=Be("loginId"),nt=Ve(Be("token")),ot=Ve(tt),rt=Ve(Be("pendingRef")),it=Ve(tt,ze("email")),st=e=>({verify:nt((t=>je(e.post(j,{token:t})))),signIn:ot(((t,n,o,r)=>je(e.post(Ie(R,Qe.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:ot(((t,n,o)=>je(e.post(Ie(D,Qe.email),{loginId:t,URI:n,loginOptions:o})))),signUp:ot(((t,n,o,r)=>je(e.post(Ie(N,Qe.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:rt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Xe(n);let s;const a=setInterval((async()=>{const n=await e.post(M,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(je(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:it(((t,n,o,r,i)=>je(e.post(A.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),at=Ve(Be("flowId")),dt=Ve(Be("executionId"),Be("stepId"),Be("interactionId")),ct=e=>({start:at(((t,n,o,r,i,s,a)=>je(e.post(le,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:dt(((t,n,o,r,i,s)=>je(e.post(ue,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),lt=Be("loginId"),ut=Ve(Be("token")),ht=Ve(lt),pt=Ve(lt,Ke("phone")),ft=Ve(lt,ze("email")),gt=Object.keys(Qe).filter((e=>e!==Ze.voice)),mt=e=>({verify:ut((t=>je(e.post(C,{token:t})))),signIn:gt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ht(((t,o,r,i)=>je(e.post(Ie(x,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:gt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ht(((t,o,r,i)=>je(e.post(Ie(O,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:gt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ht(((t,o,r)=>je(e.post(Ie(I,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:ft(((t,n,o,r,i)=>je(e.post(S.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Ze).filter((e=>e!==Ze.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pt(((t,o,r,i,s)=>je(e.post(Ie(S.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var vt;!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"}(vt||(vt={}));const yt=Ve(Be("code")),bt=e=>({start:Object.assign(((t,n,o,r)=>je(e.post(T,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(vt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>je(e.post(T,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:yt((t=>je(e.post(P,{code:t})))),startNative:(t,n)=>je(e.post(_,{provider:t,loginOptions:n})),finishNative:(t,n,o,r,i)=>je(e.post(U,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),$t=Be("loginId"),wt=Ve($t,Be("code")),Et=Ve($t),kt=Ve($t,Ke("phone")),Ct=Ve($t,ze("email")),xt=e=>({verify:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:wt(((t,o)=>je(e.post(Ie(b,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o,r)=>je(e.post(Ie($,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o,r)=>je(e.post(Ie(w,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(Qe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Et(((t,o)=>je(e.post(Ie(k,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:Ct(((t,n,o,r)=>je(e.post(E.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Ze).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:kt(((t,o,r,i)=>je(e.post(Ie(E.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Ot=Ve(Be("tenant")),St=Ve(Be("code")),It=e=>({start:Ot(((t,n,o,r)=>je(e.post(W,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:St((t=>je(e.post(L,{code:t}))))}),jt=Be("loginId"),Rt=Ve(jt,Be("code")),Nt=Ve(jt),Mt=Ve(jt),At=e=>({signUp:Nt(((t,n)=>je(e.post(V,{loginId:t,user:n})))),verify:Rt(((t,n,o,r)=>je(e.post(F,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Mt(((t,n)=>je(e.post(q,{loginId:t},{token:n}))))}),Dt=Be("loginId"),Tt=Be("newPassword"),Pt=Ve(Dt,Be("password")),_t=Ve(Dt),Ut=Ve(Dt,Tt),Wt=Ve(Dt,Be("oldPassword"),Tt),Lt=e=>({signUp:Pt(((t,n,o,r)=>je(e.post(Y,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Pt(((t,n,o)=>je(e.post(Q,{loginId:t,password:n,loginOptions:o})))),sendReset:_t(((t,n,o)=>je(e.post(ee,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Ut(((t,n,o)=>je(e.post(te,{loginId:t,newPassword:n},{token:o})))),replace:Wt(((t,n,o)=>je(e.post(ne,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>je(e.get(oe))}),Ft=qe("loginId"),Vt=Be("loginId"),qt=Be("origin"),Bt=Ve(Vt,qt,Be("name")),zt=Ve(Vt,qt),Kt=Ve(Ft,qt),Ht=Ve(Vt,qt,Be("token")),Gt=Ve(Be("transactionId"),Be("response")),Jt=e=>({signUp:{start:Bt(((t,n,o)=>je(e.post(G.start,{user:{loginId:t,name:o},origin:n})))),finish:Gt(((t,n)=>je(e.post(G.finish,{transactionId:t,response:n}))))},signIn:{start:Kt(((t,n,o,r)=>je(e.post(J.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Gt(((t,n)=>je(e.post(J.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:zt(((t,n)=>je(e.post(X.start,{loginId:t,origin:n}))))},update:{start:Ht(((t,n,o)=>je(e.post(Z.start,{loginId:t,origin:n},{token:o})))),finish:Gt(((t,n)=>je(e.post(Z.finish,{transactionId:t,response:n}))))}}),Xt=qe("loginId"),Zt=Ve(Xt),Yt=Ve(Be("pendingRef")),Qt=e=>({signUpOrIn:Zt(((t,n)=>je(e.post(K,{loginId:t,loginOptions:n})))),signUp:Zt(((t,n,o)=>je(e.post(z,{loginId:t,user:n,loginOptions:o})))),signIn:Zt(((t,n,o)=>je(e.post(B,{loginId:t,loginOptions:n},{token:o})))),waitForSession:Yt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=Xe(n);let s;const a=setInterval((async()=>{const n=await e.post(H,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(je(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),en=Ve(Be("token")),tn=Ve([Le('"token" must be string or undefined')]);var nn,on=Ve([("projectId",nn=Be("projectId"),Re(((e,t)=>n=>Ne(...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",nn))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=$e({baseUrl:n||pe,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Ge(a),otp:xt(a),magicLink:mt(a),enchantedLink:st(a),oauth:bt(a),saml:It(a),totp:At(a),notp:Qt(a),webauthn:Jt(a),password:Lt(a),flow:ct(a),refresh:tn((e=>je(a.post(re,{},{token:e})))),selectTenant:Ve([Ue("tenantId")],[Le('"token" must be string or undefined')])(((e,t)=>je(a.post(ie,{tenant:e},{token:t})))),logout:tn((e=>je(a.post(se,{},{token:e})))),logoutAll:tn((e=>je(a.post(ae,{},{token:e})))),me:tn((e=>je(a.get(de,{token:e})))),history:tn((e=>je(a.get(ce,{token:e})))),isJwtExpired:en(Ce),getTenants:en(xe),getJwtPermissions:en(Oe),getJwtRoles:en(Se),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}}))})),rn=Object.assign(on,{DeliveryMethods:Qe});var sn={default:"endpoint"},an="Blocked by CSP",dn="The endpoint parameter is not a valid URL",cn="Failed to load the JS script of the agent",ln="9319";function un(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===an||s===dn)n.exclude(),i=0;else if(s===ln)n.exclude();else if(s===cn){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 hn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",pn=hn;function fn(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:hn,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.4"):e}))}(String(e),t)}))}(s,r);return un(e,gn)})).catch((function(e){throw u(),function(e){return e instanceof Error&&e.message===ln?new Error(cn):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 gn(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(an)}();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(dn);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(cn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(mn)}function mn(){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(ln);return n}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yn={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:"/"})}()}(yn);var bn=vn(yn.exports);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},wn=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||{}},En=async e=>{const t=await wn(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},kn="undefined"!=typeof localStorage,Cn=(e,t)=>kn&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),xn=e=>kn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),On=e=>kn&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),Sn=(...e)=>{console.debug(...e)},In="undefined"!=typeof window,jn=Math.pow(2,31)-1,Rn=In&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Nn="fp",Mn=(e=!1)=>{const t=localStorage.getItem(Nn);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},An=async(e,t=Rn)=>{try{if(Mn())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=fn({apiKey:e,endpoint:[o.toString(),sn],scriptUrlPattern:[i,pn]}),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(Nn,JSON.stringify(t))})(c)}catch(e){console.warn("Could not load fingerprint",e)}},Dn=e=>{const t=Mn(!0);return t&&e.body&&(e.body.fpData=t),e},Tn="dls_last_user_login_id",Pn="dls_last_user_display_name",_n=()=>xn(Tn),Un=()=>xn(Pn),Wn=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=_n(),i=Un();return r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},Ln=e=>async(...t)=>{const n=await e(...t);return On(Tn),On(Pn),n};function Fn(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const Vn="DS",qn="DSR";function Bn(e=""){return xn(`${e}${qn}`)||""}function zn(e=""){On(`${e}${qn}`),On(`${e}${Vn}`),bn.remove(Vn)}async function Kn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Yn(n.publicKey.challenge),n.publicKey.user.id=Yn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Yn(e.id)})),n}(e);return n=await navigator.credentials.create(t),JSON.stringify({id:n.id,rawId:Qn(n.rawId),type:n.type,response:{attestationObject:Qn(n.response.attestationObject),clientDataJSON:Qn(n.response.clientDataJSON)}});var n}async function Hn(e){const t=Xn(e);return Zn(await navigator.credentials.get(t))}async function Gn(e,t){const n=Xn(e);return n.signal=t.signal,n.mediation="conditional",Zn(await navigator.credentials.get(n))}async function Jn(e=!1){if(!In)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=Yn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Yn(e.id)})),n}function Zn(e){return JSON.stringify({id:e.id,rawId:Qn(e.rawId),type:e.type,response:{authenticatorData:Qn(e.response.authenticatorData),clientDataJSON:Qn(e.response.clientDataJSON),signature:Qn(e.response.signature),userHandle:e.response.userHandle?Qn(e.response.userHandle):void 0}})}function Yn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Qn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var eo,to=(eo=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 Kn(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 Hn(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 Kn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Hn(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 Kn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:Kn,get:Hn,isSupported:Jn,conditional:Gn}}),(...e)=>{const t=eo(...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 no=e=>({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())}))}))}});var oo=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Jn(),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 ro=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 In?(n&&o&&An(n).catch((()=>null)),e($n(r,{beforeRequest:Dn}))):(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;In&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>s&&(Sn("Expiration time passed, refreshing session"),d.refresh(a))}));const d=e($n(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:o}=await wn(t);if(401===(null==t?void 0:t.status))Sn("Received 401, canceling all timers"),r();else if(o){s=(e=>{const t=e.split(".");try{if(3===t.length){const e=JSON.parse(window.atob(t[1]));if(e.exp)return new Date(1e3*e.exp)}}catch(e){}return null})(o),a=n;let e=((c=s)?c.getTime()-(new Date).getTime():0)-2e4;e>jn&&(Sn(`Timeout is too large (${e}ms), setting it to ${jn}ms`),e=jn),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(n)}),e)}var c}}));return Je(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.11.4"},t.baseHeaders)}))),(e=>t=>{const n=Fn(),o=Fn(),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 En(t);e&&o.pub(e);const{sessionJwt:r}=await wn(t);r&&n.pub(r)}}})),i=Je(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:_n,getLastUserDisplayName:Un});const r=e($n(o,{afterRequest:async(e,t)=>{var n;const o=await En(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=>{Cn(Tn,e)})(r),(e=>{Cn(Pn,e)})(i))}}));let i=Je(r,["flow.start"],Wn);return i=Je(i,["logout","logoutAll"],Ln),Object.assign(i,{getLastUserLoginId:_n,getLastUserDisplayName:Un})}),(e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,storagePrefix:r}=t,i=l(t,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!n||!In)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||Bn(a)})),afterRequest:async(e,t)=>{const n=/^\/v\d+\/mgmt\//.test(e.path);401===(null==t?void 0:t.status)?n||zn(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&&Cn(`${n}${qn}`,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);bn.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}(Vn,r,i):Cn(`${n}${Vn}`,r))})(await wn(t),o,r)}}));var a;const d=Je(s,["logout","logoutAll"],(e=>t=>async(...n)=>{const o=await t(...n);return zn(e),o})(r));return Object.assign(d,{getRefreshToken:()=>Bn(r),getSessionToken:()=>function(e=""){return bn.get(Vn)||xn(`${e}${Vn}`)||""}(r)})}))(((...e)=>{const t=rn(...e);return Object.assign(Object.assign({},t),{flow:oo(t),webauthn:to(t),fedcm:no(t)})}));let io;const so=e=>{const t=ro(Object.assign({persistTokens:d,autoRefresh:d},e));return io=t,t},ao=()=>so({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});io=ao();const co=()=>d?null==io?void 0:io.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),lo=()=>d?null==io?void 0:io.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),uo=s(((e=co(),t)=>null==io?void 0:io.getJwtPermissions(e,t))),ho=s(((e=co(),t)=>null==io?void 0:io.getJwtRoles(e,t)));const po=t.lazy((async()=>((await Promise.resolve().then((function(){return Ii}))).default.sdkConfigOverrides={baseHeaders:a,persistTokens:!1,hooks:{get beforeRequest(){return io.httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:({projectId:e,flowId:t,baseUrl:n,innerRef:r,tenant:i,theme:s,locale:a,debug:d,redirectUrl:c,client:l,form:u,autoFocus:h})=>o.default.createElement("descope-wc",{"project-id":e,"flow-id":t,"base-url":n,ref:r,tenant:i,theme:s,locale:a,debug:d,client:l,form:u,"redirect-url":c,"auto-focus":h})}))),fo=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,errorTransformer:v},y)=>{const[b,$]=t.useState(null);t.useImperativeHandle(y,(()=>b));const{projectId:w,baseUrl:E,storeLastAuthenticatedUser:k,sdk:C}=o.default.useContext(r),x=t.useCallback((async e=>{await C.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),n&&n(e)}),[n]);t.useEffect((()=>{const e=b;return null==e||e.addEventListener("success",x),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",x)}}),[b,i,x]),t.useEffect((()=>{const e=b;return null==e||e.addEventListener("success",x),()=>{null==e||e.removeEventListener("success",x)}}),[b,x]),t.useEffect((()=>{const e=b;return i&&(null==e||e.addEventListener("error",i)),()=>{i&&(null==e||e.removeEventListener("error",i))}}),[b,i]),t.useEffect((()=>{const e=b;return s&&(null==e||e.addEventListener("ready",s)),()=>{s&&(null==e||e.removeEventListener("error",s))}}),[b,s]),t.useEffect((()=>{b&&(b.errorTransformer=v)}),[b,v]),t.useEffect((()=>{b&&a&&(b.logger=a)}),[b,a]);const{form:O,client:S}=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(po,{projectId:w,flowId:e,baseUrl:E,innerRef:$,tenant:d,theme:c,locale:l,debug:u,form:O,client:S,telemetryKey:f,redirectUrl:g,autoFocus:m,storeLastAuthenticatedUser:k})))})),go=t.lazy((async()=>(await Promise.resolve().then((function(){return Lh})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-user-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),mo=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}=o.default.useContext(r);return t.useEffect((()=>{c&&e&&(c.logger=e)}),[c,e]),o.default.createElement(t.Suspense,{fallback:null},o.default.createElement(go,{projectId:u,widgetId:a,baseUrl:h,innerRef:l,tenant:n,theme:i,debug:s}))})),vo=t.lazy((async()=>(await Promise.resolve().then((function(){return vg})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-role-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),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}=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,innerRef:l,tenant:n,theme:i,debug:s}))})),bo=t.lazy((async()=>(await Promise.resolve().then((function(){return ey})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-access-key-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),$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}=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,innerRef:l,tenant:n,theme:i,debug:s}))})),wo=t.lazy((async()=>(await Promise.resolve().then((function(){return Gb})),{default:({projectId:e,baseUrl:t,innerRef:n,tenant:r,widgetId:i,theme:s,debug:a})=>o.default.createElement("descope-audit-management-widget",{"project-id":e,"widget-id":i,"base-url":t,theme:s,tenant:r,debug:a,ref:n})}))),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}=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,innerRef:l,tenant:n,theme:i,debug:s}))})),ko=t.lazy((async()=>(await Promise.resolve().then((function(){return aE})),{default:({projectId:e,baseUrl:t,innerRef:n,widgetId:r,theme:i,debug:s})=>o.default.createElement("descope-user-profile-widget",{"project-id":e,"widget-id":r,"base-url":t,theme:i,debug:s,ref:n})}))),Co=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}=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(ko,{projectId:u,widgetId:s,baseUrl:h,innerRef:l,theme:n,debug:i}))}));var xo=()=>{const e=t.useContext(r);if(!e)throw Error("You can only use this hook in the context of <AuthProvider />");return e};const Oo=e=>`You can only use this ${e} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,So={get(e,t){if("object"==typeof e[t]&&null!==e[t])return new Proxy(e[t],So);if("function"==typeof e[t])return()=>{throw Error(Oo("function"))};throw Error(Oo("attribute"))}},Io="undefined"!=typeof localStorage,jo=Io&&localStorage.getItem("base.content.url")||"",Ro="config.json",No="base.ui.components.url",Mo=Io&&localStorage.getItem(No)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Ao=Io&&localStorage.getItem(No)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Do="descope-login-flow",To="code",Po="ra-challenge",_o="ra-callback",Uo="ra-backup-callback",Wo="ra-initiator",Lo="data-exclude-field",Fo="dls_last_auth",Vo="state_id",qo="saml_idp_state_id",Bo="saml_idp_username",zo="descope_idp_initiated",Ko="sso_app_id",Ho="oidc_login_hint",Go="data-type",Jo="poll",Xo="webauthnCreate",Zo="submit",Yo="polling",Qo=["descope-multi-select-combo-box","descope-text-area"];var er;function tr(e){return new URLSearchParams(window.location.search).get(e)}function nr(e){if(window.history.replaceState&&tr(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 or(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 rr({projectId:e,filename:t,assetsFolder:n="v2-beta",baseUrl:o="https://static.descope.com/pages"}){const r=new URL(jo||o);return r.pathname=((...e)=>e.join("/").replace(/\/+/g,"/"))(r.pathname,e,n,t),r.toString()}function ir(e,t){if(!t)return;const n=+e,o=+t;return Number.isNaN(n)||Number.isNaN(o)?void 0:n>o?er.forward:n<o?er.backward:void 0}!function(e){e.backward="backward",e.forward="forward"}(er||(er={}));const sr=()=>{const[e="",t=""]=(tr(Do)||"").split("_");return{executionId:e,stepId:t}};function ar(){nr(Do)}const dr=e=>e.replace(/-./g,(e=>e[1].toUpperCase())),cr=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}},lr=(e,t,n,o,r,i)=>e&&!t&&e&&!n&&!o&&e&&!r&&e&&!i,ur=e=>null==e?void 0:e.submit(),hr=(e,t)=>{const n=t.find((t=>e[t]));return n?e[n]:null},pr=(e,t=100)=>{let n;return function(...o){n||e.apply(this,o),clearTimeout(n),n=setTimeout((()=>{n=null}),t)}};var fr,gr,mr,vr;function yr(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(!yr(i,s))return!1}else if(i!==s)return!1}return!0}class br{constructor(e={},{updateOnlyOnChange:t=!0}={}){fr.set(this,void 0),gr.set(this,{}),mr.set(this,0),vr.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,fr,"f")):e,n=Object.assign(Object.assign({},h(this,fr,"f")),t);if(!h(this,vr,"f")||!yr(h(this,fr,"f"),n)){const e=h(this,fr,"f");p(this,fr,n,"f"),Object.freeze(h(this,fr,"f")),setTimeout((()=>{Object.values(h(this,gr,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,fr,e,"f"),p(this,vr,t,"f")}get current(){return Object.assign({},h(this,fr,"f"))}subscribe(e){return p(this,mr,h(this,mr,"f")+1,"f"),h(this,gr,"f")[h(this,mr,"f")]=e,h(this,mr,"f").toString()}unsubscribe(e){const t=!!h(this,gr,"f")[e];return t&&delete h(this,gr,"f")[e],t}unsubscribeAll(){return p(this,gr,{},"f"),!0}}fr=new WeakMap,gr=new WeakMap,mr=new WeakMap,vr=new WeakMap;const $r=["disabled"],wr=(e,t)=>{Object.entries(t||{}).forEach((([t,n])=>{Array.from(e.querySelectorAll(`*[name="${t}"]:not([${Lo}])`)).forEach((e=>{e.value=n}))}))},Er=(e,t)=>e.replace(/{{(.+?)}}/g,((e,n)=>{return o=t,n.split(".").reduce(((e,t)=>(null==e?void 0:e[t])||""),o);var o})),kr=(e,t,n)=>{e.querySelectorAll(`[${Go}="${t}"]`).forEach((e=>{e.setAttribute("href",n)}))},Cr=(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})`))},xr=cr((()=>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}})))),Or={"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 Sr(e){const t={};if(e)try{Object.assign(t,JSON.parse(localStorage.getItem(Fo)))}catch(e){}return t}const Ir="dls_ab_testing_id",jr=document.createElement("template");var Rr,Nr,Mr,Ar,Dr,Tr,Pr,_r,Ur,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;jr.innerHTML='\n\t<style>\n\t\t:host {\n all: initial;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n display: inline-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\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 Oi 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"]}constructor(e){super(),Rr.add(this),this.logger=console,Nr.set(this,!1),this.loggerWrapper={error:(e,t="")=>{this.logger.error(e,t,new Error),h(this,Rr,"m",ri).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)}},Mr.set(this,new br({deferredRedirect:!1})),Ar.set(this,new br),Dr.set(this,{}),this.getComponentsContext=()=>h(this,Dr,"f"),this.nextRequestStatus=new br({isLoading:!1}),Tr.set(this,void 0),Pr.set(this,{popstate:h(this,Rr,"m",Vr).bind(this),visibilitychange:h(this,Rr,"m",qr).bind(this),componentsContext:h(this,Rr,"m",ei).bind(this)}),_r.set(this,void 0),Gr.set(this,cr((()=>u(this,void 0,void 0,(function*(){const e=rr({projectId:this.projectId,filename:Ro,baseUrl:this.baseUrl});try{const{body:t,headers:n}=yield or(e,"json");return{projectConfig:t,executionContext:{geo:n["x-geo"]}}}catch(e){return{isMissingConfig:!0}}}))))),Xr.set(this,void 0),p(this,_r,e,"f"),h(this,Rr,"m",Ur).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 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 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.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,Gr,"f").call(this);return e}))}getProjectConfig(){return u(this,void 0,void 0,(function*(){const{projectConfig:e}=yield h(this,Gr,"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,Ar,"f").subscribe(h(this,Rr,"m",oi).bind(this)),h(this,Ar,"f").update({isDebug:this.debug}),h(this,Rr,"m",Wr).call(this))return void h(this,Rr,"m",Lr).call(this);if(h(this,Rr,"m",Fr).call(this),p(this,Xr,h(this,Rr,"m",Jr).call(this),"f"),yield h(this,Rr,"m",Kr).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,Gr,"f").call(this)).isMissingConfig)return void this.loggerWrapper.error("Cannot get config file","Make sure that your projectId & flowId are correct");h(this,Rr,"m",Zr).call(this),yield h(this,Rr,"m",ai).call(this),yield h(this,Rr,"m",Yr).call(this),h(this,Rr,"m",ii).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}=sr();(e||t)&&ar();const n=tr("t")||void 0;n&&nr("t");const o=tr(To)||void 0;o&&nr(To);const r=tr("err")||void 0;r&&nr("err");const{redirectAuthCodeChallenge:i,redirectAuthCallbackUrl:s,redirectAuthBackupCallbackUri:a,redirectAuthInitiator:d}={redirectAuthCodeChallenge:tr(Po),redirectAuthCallbackUrl:tr(_o),redirectAuthBackupCallbackUri:tr(Uo),redirectAuthInitiator:tr(Wo)};(i||s||a||d)&&(nr(Po),nr(_o),nr(Uo),nr(Wo));const c=tr(Vo);c&&nr(Vo);const l=tr(qo);l&&nr(qo);const u=tr(Bo);l&&nr(Bo);const h=tr(zo);h&&nr(zo);const p=tr(Ko);p&&nr(Ko);const f=tr(Ho);return f&&nr(Ho),{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,Pr,"f").popstate),window.addEventListener("components-context",h(this,Pr,"f").componentsContext),window.addEventListener("visibilitychange",h(this,Pr,"f").visibilitychange),h(this,Mr,"f").subscribe(h(this,Rr,"m",zr).bind(this)),h(this,Mr,"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,Nr,!0,"f")}}))}disconnectedCallback(){h(this,Mr,"f").unsubscribeAll(),h(this,Ar,"f").unsubscribeAll(),h(this,Rr,"m",ni).call(this),window.removeEventListener("popstate",h(this,Pr,"f").popstate),window.removeEventListener("visibilitychange",h(this,Pr,"f").visibilitychange),window.removeEventListener("components-context",h(this,Pr,"f").componentsContext)}attributeChangedCallback(e,t,n){if(this.shadowRoot.isConnected&&h(this,Nr,"f")&&t!==n&&Oi.observedAttributes.includes(e)){h(this,Rr,"m",Fr).call(this);const o=null===t;h(this,Mr,"f").update((({stepId:t,executionId:r})=>{let i=t,s=r;return o||(s=null,i=null,ar()),{[dr(e)]:n,stepId:i,executionId:s}})),h(this,Ar,"f").update({isDebug:this.debug})}}}Nr=new WeakMap,Mr=new WeakMap,Ar=new WeakMap,Dr=new WeakMap,Tr=new WeakMap,Pr=new WeakMap,_r=new WeakMap,Gr=new WeakMap,Xr=new WeakMap,Rr=new WeakSet,Ur=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(jr.content.cloneNode(!0)),this.rootElement=this.shadowRoot.querySelector("#wc-root")},Wr=function(){return!this.shadowRoot.host.closest("form")&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)},Lr=function(){const e=this.shadowRoot.host,t=document.createElement("form");t.style.width="100%",e.parentElement.appendChild(t),t.appendChild(e)},Fr=function(){const e=["base-url","tenant","theme","locale","debug","redirect-url","auto-focus","store-last-authenticated-user","preview","storage-prefix","form","client"];if(Oi.observedAttributes.forEach((t=>{if(!e.includes(t)&&!this[dr(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')},Vr=function(){const{stepId:e,executionId:t}=sr();h(this,Mr,"f").update({stepId:e,executionId:t})},qr=function(){document.hidden||setTimeout((()=>{h(this,Mr,"f").update({deferredRedirect:!1})}),300)},Br=function(e,t){this.sdk=ro(Object.assign(Object.assign({persistTokens:!0,preview:this.preview,storagePrefix:this.storagePrefix,storeLastAuthenticatedUser:this.storeLastAuthenticatedUser},Oi.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})}}))}))},zr=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,Rr,"m",Br).call(this,t,o)}h(this,_r,"f").call(this,e)}))},Kr=function(){return u(this,void 0,void 0,(function*(){return(yield h(this,Gr,"f").call(this)).isMissingConfig&&(yield h(this,Rr,"m",Hr).call(this))}))},Hr=function(){return u(this,void 0,void 0,(function*(){const e=rr({projectId:this.projectId,filename:Ro,assetsFolder:"v2-alpha",baseUrl:this.baseUrl});try{return yield or(e,"json"),!0}catch(e){return!1}}))},Jr=function(){return u(this,void 0,void 0,(function*(){const e=rr({projectId:this.projectId,filename:"theme.json",baseUrl:this.baseUrl});try{const{body:t}=yield or(e,"json");return t}catch(e){return void this.loggerWrapper.error("Cannot fetch theme file","make sure that your projectId & flowId are correct")}}))},Zr=function(){var e,t;return u(this,void 0,void 0,(function*(){const{projectConfig:n}=yield h(this,Gr,"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)))}))},Yr=function(){return u(this,void 0,void 0,(function*(){yield h(this,Rr,"m",Qr).call(this),yield h(this,Rr,"m",ti).call(this)}))},Qr=function(){var e,t,n,o;return u(this,void 0,void 0,(function*(){const r=document.createElement("style"),i=yield h(this,Xr,"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 Oi.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)}))},ei=function(e){p(this,Dr,Object.assign(Object.assign({},h(this,Dr,"f")),e.detail),"f")},ti=function(){return u(this,void 0,void 0,(function*(){this.rootElement.setAttribute("data-theme",this.theme);const e=yield Oi.descopeUI;(null==e?void 0:e.componentsThemeManager)&&(e.componentsThemeManager.currentThemeName=this.theme)}))},ni=function(){var e;null===(e=h(this,Tr,"f"))||void 0===e||e.remove(),p(this,Tr,null,"f")},oi=function({isDebug:e}){return u(this,void 0,void 0,(function*(){e?(p(this,Tr,document.createElement("descope-debugger"),"f"),Object.assign(h(this,Tr,"f").style,{position:"fixed",top:"0",right:"0",height:"100vh",width:"100vw",pointerEvents:"none",zIndex:99999}),yield Promise.resolve().then((function(){return wE})),document.body.appendChild(h(this,Tr,"f"))):h(this,Rr,"m",ni).call(this)}))},ri=function(e,t){var n;e&&this.debug&&(null===(n=h(this,Tr,"f"))||void 0===n||n.updateData({title:e,description:t}))},ii=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=Qo.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()}}},si=function(){var e,t;return u(this,void 0,void 0,(function*(){return(null===(t=null===(e=yield h(this,Gr,"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")}))},ai=function(){return u(this,void 0,void 0,(function*(){Oi.descopeUI?this.loggerWrapper.debug("DescopeUI is already loading, probably multiple flows are running on the same page"):Oi.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,Rr,"m",si).call(this),i=t(n(Mo,r));o(i,(()=>{i.remove(),this.loggerWrapper.info("Trying to load DescopeUI from a fallback URL");const s=t(n(Ao,r));o(s,(()=>{e(void 0)})),document.body.append(s)})),document.body.append(i)}))})()}))}))},Oi.sdkConfigOverrides={baseHeaders:{"x-descope-sdk-name":"web-component","x-descope-sdk-version":"3.12.0"}};class Si extends Oi{static set sdkConfigOverrides(e){Oi.sdkConfigOverrides=e}constructor(){const e=new br;super(e.update.bind(e)),di.add(this),this.stepState=new br({},{updateOnlyOnChange:!1}),ci.set(this,void 0),li.set(this,null),ui.set(this,((e,t,n,o,r)=>{n===Jo&&p(this,ci,setTimeout((()=>u(this,void 0,void 0,(function*(){var n;const i=yield this.sdk.flow.next(e,t,Yo,o,r,{});h(this,pi,"f").call(this,i);const{action:s}=null!==(n=null==i?void 0:i.data)&&void 0!==n?n:{};h(this,ui,"f").call(this,e,t,s,o,r)}))),2e3),"f")})),hi.set(this,(()=>{clearTimeout(h(this,ci,"f")),p(this,ci,null,"f")})),pi.set(this,(e=>{var t,n,o,r,i,s,a,d,c;if(!(null==e?void 0:e.ok)){h(this,di,"m",xi).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)&&Io&&localStorage.setItem(Fo,JSON.stringify(e))}(f),void h(this,di,"m",xi).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!==Jo?(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})})),fi.set(this,cr((()=>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)}}))))),wi.set(this,pr(((e,t)=>u(this,void 0,void 0,(function*(){if("true"===e.getAttribute("formnovalidate")||h(this,di,"m",vi).call(this)){const o=null==e?void 0:e.getAttribute("id");h(this,di,"m",bi).call(this,e);const r=yield h(this,di,"m",yi).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,pi,"f").call(this,l),h(this,di,"m",$i).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,li,"f"))||void 0===e||e.abort(),p(this,li,null,"f")}getHtmlFilenameWithLocale(e,t){return u(this,void 0,void 0,(function*(){let n,o=navigator.language;o&&"zh-TW"!==o&&(o=o.split("-")[0]);const r=(e||o||"").toLowerCase();return(yield this.getTargetLocales()).includes(r)&&(n=`${t}-${r}.html`),n}))}getPageContent(e,t){return u(this,void 0,void 0,(function*(){if(t)try{const{body:e}=yield or(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 or(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(Ir);if(!e){const e=Math.floor(100*Math.random()+1);return localStorage.setItem(Ir,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 An(F.fingerprintKey,this.baseUrl):localStorage.removeItem(Nn),F.conditions?({startScreenId:_,conditionInteractionId:U}=((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=Or[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:_,conditionInteractionId:U}=((e,t)=>{var n;const o=null===(n=Or[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})):_=F.startScreenId,!lr(_,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:Sr(L),abTestingKey:W}),U,"",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,pi,"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,Zo,F.version,V.componentsVersion,{token:y,exchangeCode:b,exchangeError:$});return h(this,pi,"f").call(this,e),void this.flowState.update({token:void 0,code:void 0,exchangeError:void 0})}if(m&&window.open(m,"_blank"),"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||"",ur)}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===Xo||"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,li,"f"))||void 0===r||r.abort(),p(this,li,null,"f");try{e=l===Xo?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,Zo,F.version,V.componentsVersion,{transactionId:w,response:e,failure:t});h(this,pi,"f").call(this,n)}if(h(this,ui,"f").call(this,c,d,l,F.version,V.componentsVersion),!u&&!_)return void this.loggerWrapper.warn("No screen was found to show");const B=_||u,z=yield this.getHtmlFilenameWithLocale(I,B),K={direction:ir(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:rr({projectId:i,filename:`${B}.html`,baseUrl:this.baseUrl}),htmlLocaleUrl:z&&rr({projectId:i,filename:z,baseUrl:this.baseUrl}),samlIdpUsername:R,oidcLoginHint:P},H=Sr(L);lr(_,S,j,R,T,P)?K.next=(e,t,n,o)=>this.sdk.flow.start(s,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}),U,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 Oi.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}=e,c=document.createElement("template");c.innerHTML=yield this.getPageContent(r,i);const l=c.content.cloneNode(!0),p=this.loadDescopeUiComponents(c.content);this.sdk.webauthn.helpers.isSupported()?yield h(this,di,"m",mi).call(this,l,a):l.querySelectorAll(`descope-button[${Go}="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(`[${Go}="${t}"]`).forEach((e=>{e.textContent=n,e.classList[n?"remove":"add"]("hide")}))})(e,"error-message",d),kr(e,"totp-link",null===(s=null==t?void 0:t.totp)||void 0===s?void 0:s.provisionUrl),kr(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").forEach((e=>{e.textContent=Er(e.textContent,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=Er(e.value,t)}))}))})(e,t),((e,t)=>{Object.entries(t).forEach((([t,n])=>{e.querySelectorAll(`[name="${t}"]`).forEach((e=>{Object.entries(n).forEach((([t,n])=>{$r.includes(t)&&e.setAttribute(t,n)}))}))}))})(e,o)})(l,d,d.componentsConfig,this.formConfig,this.errorTransformer,this.loggerWrapper);const{geo:f}=yield this.getExecutionContext();((e,t)=>{Array.from(e.querySelectorAll('descope-phone-field[default-code="autoDetect"]')).forEach((e=>{e.setAttribute("default-code",t)}))})(l,f);const g=()=>u(this,void 0,void 0,(function*(){var e,n;yield p;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,Cr(r,"descope-totp-image",i),((e,t)=>{Cr(e,"descope-notp-image",t)})(o,null===(n=null==d?void 0:d.notp)||void 0===n?void 0:n.image),this.rootElement.replaceChildren(l),setTimeout((()=>((e,t)=>{wr(e,null==t?void 0:t.inputs),wr(e,null==t?void 0:t.form)})(this.rootElement,d)));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),h(this,di,"m",ki).call(this,a),s&&h(this,di,"m",xi).call(this,"ready",{}),h(this,di,"m",xi).call(this,"page-updated",{}),this.rootElement.querySelector(`[${Go}="polling"]`)){const e=yield this.getFlowConfig(),t=yield this.getProjectConfig(),n=yield a(Yo,e.version,t.componentsVersion,{});h(this,pi,"f").call(this,n)}}));s?h(this,di,"m",Ci).call(this,g,s):g()}))}}ci=new WeakMap,li=new WeakMap,ui=new WeakMap,hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,wi=new WeakMap,di=new WeakSet,gi=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)}))}},mi=function(e,t){var n;return u(this,void 0,void 0,(function*(){null===(n=h(this,li,"f"))||void 0===n||n.abort();const o=e.querySelector('*[autocomplete="webauthn"]');if(o&&(yield xr())){const{options:e,transactionId:n}=(yield h(this,fi,"f").call(this))||{};if(e&&n){h(this,di,"m",gi).call(this,o),p(this,li,new AbortController,"f");const r=yield this.getFlowConfig(),i=yield this.getProjectConfig();this.sdk.webauthn.helpers.conditional(e,h(this,li,"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,pi,"f").call(this,s)})))).catch((e=>{"AbortError"!==e.name&&this.loggerWrapper.error("Conditional login failed",e.message)}))}}}))},vi=function(){return Array.from(this.shadowRoot.querySelectorAll("*[name]")).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)}))},yi=function(){return u(this,void 0,void 0,(function*(){const e=Array.from(this.shadowRoot.querySelectorAll(`*[name]:not([${Lo}])`));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})),{})}))},bi=function(e){const t=this.nextRequestStatus.subscribe((({isLoading:n})=>{n?e.setAttribute("loading","true"):(this.nextRequestStatus.unsubscribe(t),e.removeAttribute("loading"))}))},$i=function(e={}){var t,n;const o=hr(e,["externalId","email","phone"]),r=hr(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)}},Ei=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,wi,"f").call(this,t,e)}))}))},ki=function(e){this.rootElement.querySelectorAll("descope-button:not([data-exclude-next])").forEach((t=>{t.onclick=()=>{h(this,wi,"f").call(this,t,e)}})),h(this,di,"m",Ei).call(this,e)},Ci=function(e,t){this.rootElement.addEventListener("transitionend",(()=>{this.rootElement.classList.remove("fade-out"),e()}),{once:!0});const n=t===er.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")},xi=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",Si);var Ii=Object.freeze({__proto__:null,default:Si});function ji(...e){return t=>e.reduce(((e,t)=>t(e)),t)}const Ri=e=>{const t=document.createElement("template");return t.innerHTML=e,t},Ni=(...e)=>e.join("/").replace(/\/+/g,"/"),Mi=(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),Ai=e=>{let t,n;return(...o)=>(t&&Mi(t,o)||(t=o,n=e(...o)),n)},Di=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])||""}`}),""),Ti=(e,t=500)=>{let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}},Pi=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 _i,Ui,Wi,Li,Fi,Vi;function qi(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(!qi(i,s))return!1}else if(i!==s)return!1}return!0}class Bi{constructor(e={},{updateOnlyOnChange:t=!0}={}){_i.set(this,void 0),Ui.set(this,{}),Wi.set(this,0),Li.set(this,!1),this.update=e=>{const t="function"==typeof e?e(h(this,_i,"f")):e,n=Object.assign(Object.assign({},h(this,_i,"f")),t);if(!h(this,Li,"f")||!qi(h(this,_i,"f"),n)){const e=h(this,_i,"f");p(this,_i,n,"f"),Object.freeze(h(this,_i,"f")),setTimeout((()=>{Object.values(h(this,Ui,"f")).forEach((t=>t(n,e,((e,t)=>n=>e[n]!==t[n])(n,e))))}),0)}},p(this,_i,e,"f"),p(this,Li,t,"f")}get current(){return Object.assign({},h(this,_i,"f"))}subscribe(e){return p(this,Wi,h(this,Wi,"f")+1,"f"),h(this,Ui,"f")[h(this,Wi,"f")]=e,h(this,Wi,"f").toString()}unsubscribe(e){const t=!!h(this,Ui,"f")[e];return t&&delete h(this,Ui,"f")[e],t}unsubscribeAll(){return p(this,Ui,{},"f"),!0}}_i=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,Li=new WeakMap;class zi{constructor(e,t){Fi.set(this,void 0),this.nodeName="",p(this,Fi,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,Fi,"f"))}get ele(){var e,t;const n="function"==typeof h(this,Fi,"f")?h(this,Fi,"f").call(this):h(this,Fi,"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)}}Fi=new WeakMap;const Ki=/^descope-grid-([^-]+)-column$/,Hi={text:class extends zi{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 zi{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 Gi extends zi{constructor(){super(...arguments),this.nodeName="descope-grid",Vi.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=Ki.exec(t.localName))||void 0===n?void 0:n[1],r=Hi[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);Mi(o,this.ele.columns)||(this.ele.columns=o,null===(n=h(this,Vi,"f"))||void 0===n||n.call(this,o))}onColumnsChange(e){p(this,Vi,e,"f")}set renderColumn(e){this.ele.renderColumn=e}}Vi=new WeakMap;class Ji extends zi{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 Xi;class Zi extends zi{constructor(){super(...arguments),Xi.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,Xi,"f")&&(null===(e=this.ele)||void 0===e||e.append(h(this,Xi,"f").content.cloneNode(!0)))}setContent(e){p(this,Xi,e,"f"),this.reset()}remove(){var e;null===(e=this.ele)||void 0===e||e.remove()}}Xi=new WeakMap;class Yi extends zi{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 Qi extends zi{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 es extends zi{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 ts extends zi{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 ns extends zi{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 os extends zi{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 rs extends zi{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 is extends zi{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 ss extends zi{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 as(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 ds=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),cs=()=>Math.random().toString(36).substring(7).split("").join("."),ls={INIT:`@@redux/INIT${cs()}`,REPLACE:`@@redux/REPLACE${cs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${cs()}`};function us(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 hs(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 ps(e){let t=typeof e;return"production"!==process.env.NODE_ENV&&(t=hs(e)),t}function fs(e,t,n){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?as(2):`Expected the root reducer to be a function. Instead, received: '${ps(e)}'`);if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?as(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?as(1):`Expected the enhancer to be a function. Instead, received: '${ps(n)}'`);return n(fs)(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?as(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?as(4):`Expected the listener to be a function. Instead, received: '${ps(e)}'`);if(d)throw new Error("production"===process.env.NODE_ENV?as(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?as(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(!us(e))throw new Error("production"===process.env.NODE_ENV?as(7):`Actions must be plain objects. Instead, the actual type was: '${ps(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?as(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?as(17):`Action "type" property must be a string. Instead, the actual type was: '${ps(e.type)}'. Value was: '${e.type}' (stringified)`);if(d)throw new Error("production"===process.env.NODE_ENV?as(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?as(10):`Expected the nextReducer to be a function. Instead, received: '${ps(e)}`);o=e,h({type:ls.REPLACE})}function f(){const e=u;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error("production"===process.env.NODE_ENV?as(11):`Expected the observer to be an object. Instead, received: '${ps(t)}'`);function n(){const e=t;e.next&&e.next(l())}n();return{unsubscribe:e(n)}},[ds](){return this}}}h({type:ls.INIT});const g={dispatch:h,subscribe:u,getState:l,replaceReducer:p,[ds]:f};return g}function gs(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}function ms(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]&&gs(`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:ls.INIT}))throw new Error("production"===process.env.NODE_ENV?as(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:ls.PROBE_UNKNOWN_ACTION()}))throw new Error("production"===process.env.NODE_ENV?as(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${ls.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===ls.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(!us(e))return`The ${i} has unexpected type of "${ps(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===ls.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&&gs(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?as(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 vs(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}function ys(...e){return t=>(n,o)=>{const r=t(n,o);let i=()=>{throw new Error("production"===process.env.NODE_ENV?as(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=vs(...a)(r.dispatch),{...r,dispatch:i}}}function bs(e){return us(e)&&"type"in e&&"string"==typeof e.type}var $s=Symbol.for("immer-nothing"),ws=Symbol.for("immer-draftable"),Es=Symbol.for("immer-state"),ks="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 Cs(e,...t){if("production"!==process.env.NODE_ENV){const n=ks[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 xs=Object.getPrototypeOf;function Os(e){return!!e&&!!e[Es]}function Ss(e){return!!e&&(js(e)||Array.isArray(e)||!!e[ws]||!!e.constructor?.[ws]||Ds(e)||Ts(e))}var Is=Object.prototype.constructor.toString();function js(e){if(!e||"object"!=typeof e)return!1;const t=xs(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)===Is}function Rs(e,t){0===Ns(e)?Object.entries(e).forEach((([n,o])=>{t(n,o,e)})):e.forEach(((n,o)=>t(o,n,e)))}function Ns(e){const t=e[Es];return t?t.type_:Array.isArray(e)?1:Ds(e)?2:Ts(e)?3:0}function Ms(e,t){return 2===Ns(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function As(e,t,n){const o=Ns(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Ds(e){return e instanceof Map}function Ts(e){return e instanceof Set}function Ps(e){return e.copy_||e.base_}function _s(e,t){if(Ds(e))return new Map(e);if(Ts(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&js(e)){if(!xs(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Es];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(xs(e),n)}function Us(e,t=!1){return Ls(e)||Os(e)||!Ss(e)||(Ns(e)>1&&(e.set=e.add=e.clear=e.delete=Ws),Object.freeze(e),t&&Rs(e,((e,t)=>Us(t,!0)))),e}function Ws(){Cs(2)}function Ls(e){return Object.isFrozen(e)}var Fs,Vs={};function qs(e){const t=Vs[e];return t||Cs(0,e),t}function Bs(){return Fs}function zs(e,t){t&&(qs("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ks(e){Hs(e),e.drafts_.forEach(Js),e.drafts_=null}function Hs(e){e===Fs&&(Fs=e.parent_)}function Gs(e){return Fs={drafts_:[],parent_:Fs,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Js(e){const t=e[Es];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Xs(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Es].modified_&&(Ks(t),Cs(4)),Ss(e)&&(e=Zs(t,e),t.parent_||Qs(t,e)),t.patches_&&qs("Patches").generateReplacementPatches_(n[Es].base_,e,t.patches_,t.inversePatches_)):e=Zs(t,n,[]),Ks(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$s?e:void 0}function Zs(e,t,n){if(Ls(t))return t;const o=t[Es];if(!o)return Rs(t,((r,i)=>Ys(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Qs(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),Rs(r,((r,s)=>Ys(e,o,t,r,s,n,i))),Qs(e,t,!1),n&&e.patches_&&qs("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Ys(e,t,n,o,r,i,s){if("production"!==process.env.NODE_ENV&&r===n&&Cs(5),Os(r)){const s=Zs(e,r,i&&t&&3!==t.type_&&!Ms(t.assigned_,o)?i.concat(o):void 0);if(As(n,o,s),!Os(s))return;e.canAutoFreeze_=!1}else s&&n.add(r);if(Ss(r)&&!Ls(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Zs(e,r),t&&t.scope_.parent_||Qs(e,r)}}function Qs(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Us(t,n)}var ea={get(e,t){if(t===Es)return e;const n=Ps(e);if(!Ms(n,t))return function(e,t,n){const o=oa(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_||!Ss(o)?o:o===na(e.base_,t)?(ia(e),e.copy_[t]=sa(o,e)):o},has:(e,t)=>t in Ps(e),ownKeys:e=>Reflect.ownKeys(Ps(e)),set(e,t,n){const o=oa(Ps(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=na(Ps(e),t),r=o?.[Es];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||Ms(e.base_,t)))return!0;ia(e),ra(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!==na(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ia(e),ra(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ps(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){Cs(11)},getPrototypeOf:e=>xs(e.base_),setPrototypeOf(){Cs(12)}},ta={};function na(e,t){const n=e[Es];return(n?Ps(n):e)[t]}function oa(e,t){if(!(t in e))return;let n=xs(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=xs(n)}}function ra(e){e.modified_||(e.modified_=!0,e.parent_&&ra(e.parent_))}function ia(e){e.copy_||(e.copy_=_s(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Rs(ea,((e,t)=>{ta[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ta.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Cs(13),ta.set.call(this,e,t,void 0)},ta.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Cs(14),ea.set.call(this,e[0],t,n,e[0])};function sa(e,t){const n=Ds(e)?qs("MapSet").proxyMap_(e,t):Ts(e)?qs("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Bs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=ea;n&&(r=[o],i=ta);const{revoke:s,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=s,a}(e,t);return(t?t.scope_:Bs()).drafts_.push(n),n}function aa(e){return Os(e)||Cs(10,e),da(e)}function da(e){if(!Ss(e)||Ls(e))return e;const t=e[Es];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_s(e,t.scope_.immer_.useStrictShallowCopy_)}else n=_s(e,!0);return Rs(n,((e,t)=>{As(n,e,da(t))})),t&&(t.finalized_=!1),n}var ca=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&&Cs(6),void 0!==n&&"function"!=typeof n&&Cs(7),Ss(e)){const r=Gs(this),i=sa(e,void 0);let s=!0;try{o=t(i),s=!1}finally{s?Ks(r):Hs(r)}return zs(r,n),Xs(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===$s&&(o=void 0),this.autoFreeze_&&Us(o,!0),n){const t=[],r=[];qs("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}Cs(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){Ss(e)||Cs(8),Os(e)&&(e=aa(e));const t=Gs(this),n=sa(e,void 0);return n[Es].isManual_=!0,Hs(t),n}finishDraft(e,t){const n=e&&e[Es];n&&n.isManual_||Cs(9);const{scope_:o}=n;return zs(o,t),Xs(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=qs("Patches").applyPatches_;return Os(e)?o(e,t):this.produce(e,(e=>o(e,t)))}},la=ca.produce;ca.produceWithPatches.bind(ca),ca.setAutoFreeze.bind(ca),ca.setUseStrictShallowCopy.bind(ca),ca.applyPatches.bind(ca),ca.createDraft.bind(ca),ca.finishDraft.bind(ca);var ua=(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})}}},ha=(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})}},pa={inputStabilityCheck:"once",identityFunctionCheck:"once"};var fa=e=>Array.isArray(e)?e:[e];function ga(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 ma(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}var va=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...pa,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:ua},inputStabilityCheck:{shouldRun:"always"===o||"once"===o&&e,run:ha}}},ya="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function ba(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 ya(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 $a(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=ba,argsMemoizeOptions:u=[],devModeChecks:h={}}=a,p=fa(c),f=fa(u),g=ga(e),m=d((function(){return o++,s.apply(null,arguments)}),...p);let v=!0;const y=l((function(){r++;const e=ma(g,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:o}=va(v,h);if(n.shouldRun&&n.run(s,e,t),o.shouldRun){const t=ma(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 wa=$a(ba),Ea=Object.assign(((e,t=wa)=>{!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:()=>Ea});function ka(e){return({dispatch:t,getState:n})=>o=>r=>"function"==typeof r?r(t,n,e):o(r)}var Ca=ka(),xa=ka;((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Oa="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},Sa=e=>e&&"function"==typeof e.match;function Ia(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?pd(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=>bs(t)&&t.type===e,n}function ja(e){return"function"==typeof e&&"type"in e&&Sa(e)}function Ra(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 Na=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 Ma(e){return Ss(e)?la(e,(()=>{})):e}function Aa(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?pd(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Da(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Ta(e,t,n){const o=Pa(e,t,n);return{detectMutations:()=>_a(e,t,o,n)}}function Pa(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]=Pa(e,t,n[r],s))}}return i}function _a(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=_a(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Ua(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function Wa(e,t="",n=Ua,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=Wa(c,a,n,o,r,i),s))return s}return i&&La(e)&&i.add(e),!1}function La(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!La(t))return!1;return!0}function Fa(e){return"boolean"==typeof e}var Va=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Na;if(t&&(Fa(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Fa(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=Da,ignoredPaths:r,warnAfter:i=32}=e;const s=Ta.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Ra(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(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={};Fa(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Ua,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(!bs(u))return c(u);const h=c(u),p=Ra(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Wa(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=Wa(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={};Fa(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ja}=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},qa=e=>t=>{setTimeout(t,e)},Ba="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:qa(10),za=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Na(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?Ba:"callback"===e.type?e.queueNotification:qa(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},Ka="production"===process.env.NODE_ENV;function Ha(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?pd(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(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?pd(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Ga=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Ja(...e){return t=>e.some((e=>((e,t)=>Sa(e)?e.match(t):e(t))(e,t)))}var Xa=["name","message","stack","code"],Za=class{constructor(e,t){this.payload=e,this.meta=t}_type},Ya=class{constructor(e,t){this.payload=e,this.meta=t}_type},Qa=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Xa)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},ed=(()=>{function e(e,t,n){const o=Ia(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Ia(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Ia(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Qa)(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):Ga(),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 Za(e,t),fulfillWithValue:(e,t)=>new Ya(e,t)})).then((t=>{if(t instanceof Za)throw t;return t instanceof Ya?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Za?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(td)})}}),{pending:r,rejected:i,fulfilled:o,settled:Ja(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function td(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var nd=Symbol.for("rtk-slice-createasyncthunk");function od(e,t){return`${e}/${t}`}function rd({creators:e}={}){const t=e?.asyncThunk?.[nd];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?pd(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?pd(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?Ha(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?pd(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]=Ha(t);if(function(e){return"function"==typeof e}(e))n=()=>Ma(e());else{const t=Ma(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?pd(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:od(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?pd(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?Ia(e,s):Ia(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?pd(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||ad,pending:a||ad,rejected:d||ad,settled:c||ad})}(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?pd(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Aa(l,n,{insert:()=>new WeakMap});return Aa(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=id(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 id(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?pd(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var sd=rd();function ad(){}var dd="listenerMiddleware",cd=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Ia(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?pd(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?pd(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},ld=Object.assign((e=>{const{type:t,predicate:n,effect:o}=cd(e);return{id:Ga(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?pd(22):"Unsubscribe not initialized")}}}),{withTypes:()=>ld}),ud=Object.assign(Ia(`${dd}/add`),{withTypes:()=>ud});Ia(`${dd}/removeAll`);var hd=Object.assign(Ia(`${dd}/remove`),{withTypes:()=>hd});function pd(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 fd=["error","warn","info","debug"],gd=Pi((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 fd.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})),md="undefined"!=typeof localStorage,vd=md&&localStorage.getItem("base.content.url")||"",yd=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,bd=Pi((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})),$d=Pi((e=>{var t,n;const o=ji(gd,bd)(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})),wd=e=>t=>{var n,o,r;const i=ji(gd,bd,$d)(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};wd.missingAttrValidator=yd;const Ed=Pi((e=>{const t=ji(wd({"project-id":yd}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),kd=Pi((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Cd=Pi((e=>{const t=ji(gd,Ed,kd)(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(vd||o||"https://static.descope.com/pages");return r.pathname=Ni(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseUrl}),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())}}}})),xd=Pi((e=>{var t,n,o;const r=ji(Cd)(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})),Od=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(bd,gd)(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 rc})),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})),Sd="load-descope-ui",Id="base.ui.components.url",jd=md&&localStorage.getItem(Id)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Rd=md&&localStorage.getItem(Id)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Nd=e=>{const t=document.createElement("script");return t.id=e,t},Md=(e,t)=>e.replace("<version>",t),Ad=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(gd,xd)(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=Nd("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=Md(Rd,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#${Sd}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Nd(Sd);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Md(jd,await h(this,t,"m",r).call(this))}return document.getElementById(Sd)},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})),Dd="content-root",Td="root",Pd=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Td}, #${Dd} {\n height: 100%;\n }\n #${Td} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Td}">\n <div id="${Dd}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Dd),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Td)}})),_d="descope-modal",Ud=Pi((e=>{var t,n;const o=ji(bd,Pd,Ad)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(_d);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([_d]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Wd="descope-notification",Ld=Pi((e=>{var t,n;const o=ji(bd,Pd,Ad)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Wd);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([Wd])}},t=new WeakMap,n})),Fd=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Vd=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(wd({theme:Fd}),Cd,bd,Ad,xd,Pd,$d)(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(Id)))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(Id),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})),qd=e=>Pi((t=>{const n=sd(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(gd)(t)){constructor(...e){super(...e);const t=function(e){const t=Va(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?pd(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!Ka&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?pd(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Ka&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?pd(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Ka&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?pd(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Oa({trace:!Ka,..."object"==typeof r&&r}));const l=ys(...d),u=za(l);if(!Ka&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?pd(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Ka&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?pd(6):"`enhancers` callback must return an array");if(!Ka&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?pd(7):"each enhancer provided to configureStore must be a function");return Ka||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{td(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()))))}}})),Bd=Pi((e=>class extends(gd(e)){validateForm(e){return this.getFormInputs(e).every((e=>{var t,n;return null===(t=e.reportValidity)||void 0===t||t.call(e),null===(n=e.checkValidity)||void 0===n?void 0:n.call(e)}))}getFormInputs(e){return e?Array.from(e.querySelectorAll("[name]")):(this.logger.debug("cannot get form inputs, no root element was received"),[])}getFormData(e){return this.getFormInputs(e).reduce(((e,t)=>Object.assign(e,{[t.getAttribute("name")]:t.value})),{})}setFormData(e,t){this.getFormInputs(e).forEach((e=>{t.hasOwnProperty(e.getAttribute("name"))&&(e.value=t[e.getAttribute("name")])}))}resetFormData(e){this.getFormInputs(e).forEach((e=>{e.value="",e.checked=!1}))}getFormFieldNames(e){return this.getFormInputs(e).map((e=>e.name))}disableFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.setAttribute("disabled","true")}removeFormField(e,t){var n;null===(n=this.getFormInputs(e).find((e=>e.name===t)))||void 0===n||n.remove()}})),zd=(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 Kd,Hd,Gd,Jd,Xd,Zd,Yd,Qd,ec,tc;const nc=document.createElement("template");nc.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 oc extends HTMLElement{constructor(){var e;super(),Kd.add(this),Hd.set(this,new Bi({messages:[]})),Gd.set(this,void 0),Jd.set(this,void 0),Xd.set(this,void 0),Zd.set(this,{resize:h(this,Kd,"m",tc).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(nc.content.cloneNode(!0)),p(this,Gd,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Jd,h(this,Gd,"f").querySelector(".content"),"f"),p(this,Xd,h(this,Gd,"f").querySelector(".header"),"f")}updateData(e){h(this,Hd,"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]=zd(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,Gd,"f"),h(this,Xd,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,Zd,"f").resize),(e=h(this,Gd,"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,Gd,"f").onresize=h(this,Kd,"m",ec).bind(this),h(this,Hd,"f").subscribe(h(this,Kd,"m",Yd).bind(this))}disconnectedCallback(){h(this,Hd,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,Zd,"f").resize)}}Hd=new WeakMap,Gd=new WeakMap,Jd=new WeakMap,Xd=new WeakMap,Zd=new WeakMap,Kd=new WeakSet,Yd=function(e){h(this,Kd,"m",Qd).call(this,e),h(this,Kd,"m",ec).call(this)},Qd=function(e){h(this,Jd,"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("")},ec=function(){h(this,Jd,"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)}))},tc=function(){const[e,t]=zd(h(this,Gd,"f"),Number.parseInt(h(this,Gd,"f").style.left,10),Number.parseInt(h(this,Gd,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Gd,"f").style.top=`${t}px`,h(this,Gd,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",oc);var rc=Object.freeze({__proto__:null}),ic={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 sc(e,t){var n=Array.prototype.slice.call(t);return n.push(ic),e.apply(this,n)}function ac(e){return ac="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},ac(e)}function dc(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 cc(e,t){if(t&&("object"===ac(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return lc(e)}function lc(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uc(e){var t="function"==typeof Map?new Map:void 0;return uc=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 hc(e,arguments,gc(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),fc(o,e)},uc(e)}function hc(e,t,n){return hc=pc()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&fc(r,n.prototype),r},hc.apply(null,arguments)}function pc(){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 fc(e,t){return fc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},fc(e,t)}function gc(e){return gc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},gc(e)}var mc=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&&fc(e,t)}(a,e);var t,n,o,r,i,s=(t=a,n=pc(),function(){var e,o=gc(t);if(n){var r=gc(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return cc(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(lc(t),a.prototype),t.name=t.constructor.name,t}return o=a,r&&dc(o.prototype,r),i&&dc(o,i),Object.defineProperty(o,"prototype",{writable:!1}),o}(uc(Error)),vc="0-90-9٠-٩۰-۹",yc="".concat("-‐-―−ー-").concat("//").concat("..").concat(" ").concat("()()[]\\[\\]").concat("~⁓∼~");function bc(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 $c={}.constructor;function wc(e){return null!=e&&e.constructor===$c}function Ec(e){return Ec="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},Ec(e)}function kc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cc(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 xc(e,t,n){return t&&Cc(e.prototype,t),n&&Cc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Oc=" ext. ",Sc=/^\d+$/,Ic=function(){function e(t){kc(this,e),function(e){if(!e)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!wc(e)||!wc(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(wc(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Dc(e)+": "+e,"."))}(t),this.metadata=t,Pc.call(this,t)}return xc(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&&Sc.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw new Error("Unknown country: ".concat(e));this.numberingPlan=new jc(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw new Error("Unknown calling code: ".concat(t));this.numberingPlan=new jc(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}(),jc=function(){function e(t,n){kc(this,e),this.globalMetadataObject=n,this.metadata=t,Pc.call(this,n.metadata)}return xc(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 Rc(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()&&Ac(this.types(),e))return new Mc(Ac(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?Oc:this.metadata[13]||Oc}}]),e}(),Rc=function(){function e(t,n){kc(this,e),this._format=t,this.metadata=n}return xc(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()||Nc.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Nc=/^\(?\$1\)?$/,Mc=function(){function e(t,n){kc(this,e),this.type=t,this.metadata=n}return xc(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 Ac(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 Dc=function(e){return Ec(e)};function Tc(e,t){if((t=new Ic(t)).hasCountry(e))return t.country(e).countryCallingCode();throw new Error("Unknown country: ".concat(e))}function Pc(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===bc(t,"1.2.0")?this.v2=!0:-1===bc(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var _c=function(e){return"([".concat(vc,"]{1,").concat(e,"})")};function Uc(e){var t="[ \\t,]*",n="[:\\..]?[ \\t,-]*",o="#?",r="[ \\t]*";return";ext="+_c("20")+"|"+(t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+n+_c("20")+o)+"|"+(t+"(?:[xx##~~]|int|int)"+n+_c("9")+o)+"|"+("[- ]+"+_c("6")+"#")+"|"+(r+"(?:,{2}|;)"+n+_c("15")+o)+"|"+(r+"(?:,)+"+n+_c("9")+o)}var Wc="["+vc+"]{2}",Lc="[++]{0,1}(?:["+yc+"]*["+vc+"]){3,}["+yc+vc+"]*",Fc=new RegExp("^[++]{0,1}(?:["+yc+"]*["+vc+"]){1,2}$","i"),Vc=Lc+"(?:"+Uc()+")?",qc=new RegExp("^"+Wc+"$|^"+Vc+"$","i");var Bc=new RegExp("(?:"+Uc()+")$","i");var zc={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 Kc(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 Hc(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 Hc(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 Hc(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 Gc(e){for(var t,n="",o=Kc(e.split(""));!(t=o()).done;){n+=Jc(t.value,n)||""}return n}function Jc(e,t,n){return"+"===e?t?void("function"==typeof n&&n("end")):"+":function(e){return zc[e]}(e)}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,t){return Qc(e,void 0,t)}function Qc(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 Qc(e,"MOBILE",n);var i=n.type("MOBILE");i&&(r=function(e,t){for(var n,o=e.slice(),r=Xc(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 el(e,t){return"IS_POSSIBLE"===Yc(e,t)}function tl(e,t){return e=e||"",new RegExp("^(?:"+t+")$").test(e)}function nl(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 ol(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 ol(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 ol(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 rl=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function il(e,t,n){if(t=t||{},e.country||e.countryCallingCode){(n=new Ic(n)).selectNumberingPlan(e.country,e.countryCallingCode);var o=t.v2?e.nationalNumber:e.phone;if(tl(o,n.nationalNumberPattern())){if(sl(o,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?sl(o,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var r,i=nl(rl);!(r=i()).done;){var s=r.value;if(sl(o,s,n))return s}}}}function sl(e,t,n){return!(!(t=n.type(t))||!t.pattern())&&(!(t.possibleLengths()&&t.possibleLengths().indexOf(e.length)<0)&&tl(e,t.pattern()))}function al(e,t,n){var o=new Ic(n).getCountryCodesForCallingCode(e);return o?o.filter((function(e){return function(e,t,n){var o=new Ic(n);if(o.selectNumberingPlan(t),o.numberingPlan.possibleLengths().indexOf(e.length)>=0)return!0;return!1}(t,e,n)})):[]}var dl=/(\$\d)/;function cl(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(dl,t.nationalPrefixFormattingRule()):t.format());return o?function(e){return e.replace(new RegExp("[".concat(yc,"]+"),"g")," ").trim()}(i):i}var ll=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function ul(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 hl(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 hl(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 hl(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 pl(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 fl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pl(Object(n),!0).forEach((function(t){gl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}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}var ml={formatExtension:function(e,t,n){return"".concat(e).concat(n.ext()).concat(t)}};function vl(e,t,n,o){if(n=n?fl(fl({},ml),n):ml,o=new Ic(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?bl(r=yl(s,e.carrierCode,"NATIONAL",o,n),e.ext,o,n.formatExtension):"";case"INTERNATIONAL":return s?(r=yl(s,null,"INTERNATIONAL",o,n),bl(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=Tc(o,r.metadata);if(i===n){var s=yl(e,t,"NATIONAL",r);return"1"===n?n+" "+s:s}var a=function(e,t,n){var o=new Ic(n);return o.selectNumberingPlan(e,t),o.defaultIDDPrefix()?o.defaultIDDPrefix():ll.test(o.IDDPrefix())?o.IDDPrefix():void 0}(o,void 0,r.metadata);if(a)return"".concat(a," ").concat(n," ").concat(yl(e,null,"INTERNATIONAL",r))}(s,e.carrierCode,i,n.fromCountry,o);return bl(a,e.ext,o,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}function yl(e,t,n,o,r){var i=function(e,t){for(var n,o=ul(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(tl(t,r.pattern()))return r}}(o.formats(),e);return i?cl(e,i,{useInternationalFormat:"INTERNATIONAL"===n,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!r||!1!==r.nationalPrefix,carrierCode:t,metadata:o}):e}function bl(e,t,n,o){return t?o(e,t,n):e}function $l(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 wl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$l(Object(n),!0).forEach((function(t){El(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function El(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kl(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 Cl=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 Ic(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]:al(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return function(e,t,n){if(void 0===t&&(t={}),n=new Ic(n),t.v2){if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!n.hasCountry(e.country))throw new Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(e.countryCallingCode)}}if(n.possibleLengths())return el(e.phone||e.nationalNumber,n);if(e.countryCallingCode&&n.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return function(e,t,n){return t=t||{},(n=new Ic(n)).selectNumberingPlan(e.country,e.countryCallingCode),n.hasTypes()?void 0!==il(e,t,n.metadata):tl(t.v2?e.nationalNumber:e.phone,n.nationalNumberPattern())}(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){return new Ic(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return il(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return vl(this,e,t?wl(wl({},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&&kl(t.prototype,n),o&&kl(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();var xl=new RegExp("(["+vc+"])");function Ol(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(tl(e,n.nationalNumberPattern())&&!tl(t,n.nationalNumberPattern()))return!1;return!0}(e,r,t))return{nationalNumber:e};if(t.possibleLengths()&&!function(e,t){switch(Yc(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(r,t))return{nationalNumber:e}}return{nationalNumber:r,carrierCode:o}}function Sl(e,t,n,o){if(!e)return{};var r;if("+"!==e[0]){var i=function(e,t,n,o){if(t){var r=new Ic(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(xl);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?Tc(t,o):n;if(0===e.indexOf(r)){(o=new Ic(o)).selectNumberingPlan(t,n);var i=e.slice(r.length),s=Ol(i,o).nationalNumber,a=Ol(e,o).nationalNumber;if(!tl(a,o.nationalNumberPattern())&&tl(s,o.nationalNumberPattern())||"TOO_LONG"===Yc(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 Ic(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 Il(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 jl(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 jl(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 jl(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 Rl(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 Ic(r);for(var i,s=[],a=Il(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(il({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 Nl="(["+vc+"]|[\\-\\.\\(\\)]?)",Ml=new RegExp("^\\+"+Nl+"*["+vc+"]"+Nl+"*$","g"),Al=new RegExp("^("+("["+vc+"]+((\\-)*["+vc+"])*")+"\\.)*"+("[a-zA-Z]+((\\-)*["+vc+"])*")+"\\.?$","g"),Dl="tel:",Tl=";phone-context=";function Pl(e,t){var n,o=t.extractFormattedPhoneNumber,r=function(e){var t=e.indexOf(Tl);if(t<0)return null;var n=t+Tl.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&&(Ml.test(e)||Al.test(e))}(r))throw new mc("NOT_A_NUMBER");if(null===r)n=o(e)||"";else{n="","+"===r.charAt(0)&&(n+=r);var i,s=e.indexOf(Dl);i=s>=0?s+Dl.length:0;var a=e.indexOf(Tl);n+=e.substring(i,a)}var d=n.indexOf(";isub=");if(d>0&&(n=n.substring(0,d)),""!==n)return n}var _l=new RegExp("[++"+vc+"]"),Ul=new RegExp("[^"+vc+"#]+$");function Wl(e,t,n){if(t=t||{},n=new Ic(n),t.defaultCountry&&!n.hasCountry(t.defaultCountry)){if(t.v2)throw new mc("INVALID_COUNTRY");throw new Error("Unknown country: ".concat(t.defaultCountry))}var o=function(e,t,n){var o=Pl(e,{extractFormattedPhoneNumber:function(e){return function(e,t,n){if(!e)return;if(e.length>250){if(n)throw new mc("TOO_LONG");return}if(!1===t)return e;var o=e.search(_l);if(o<0)return;return e.slice(o).replace(Ul,"")}(e,n,t)}});if(!o)return{};if(!function(e){return e.length>=2&&qc.test(e)}(o))return function(e){return Fc.test(e)}(o)?{error:"TOO_SHORT"}:{};var r=function(e){var t=e.search(Bc);if(t<0)return{};for(var n=e.slice(0,t),o=e.match(Bc),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 mc("TOO_SHORT");throw new mc("NOT_A_NUMBER")}return{}}var a=function(e,t,n,o){var r,i=Sl(Gc(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||Tc(t,o.metadata)}if(!d)return{countryCallingCodeSource:s,countryCallingCode:a};var c=Ol(Gc(d),o),l=c.nationalNumber,u=c.carrierCode,h=Rl(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 mc("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new mc("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new mc("TOO_LONG");return{}}if(t.v2){var p=new Cl(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)&&tl(c,n.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:l,carrierCode:h,valid:f,possible:!!f||!(!0!==t.extended||!n.possibleLengths()||!el(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 Ll(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 Fl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ll(Object(n),!0).forEach((function(t){Vl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ll(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ql(e,t){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 Bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zl(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 Kl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kl(e,t)}(e,t)||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 Kl(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 Hl(e){var t,n,o,r=zl(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(!wc(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?ql(Object(n),!0).forEach((function(t){Bl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({defaultCountry:s},n));return{text:t,options:n,metadata:o}}function Gl(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 Jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gl(Object(n),!0).forEach((function(t){Xl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zl(e,t,n){t&&t.defaultCountry&&!function(e,t){return t.countries.hasOwnProperty(e)}(t.defaultCountry,n)&&(t=Jl(Jl({},t),{},{defaultCountry:void 0}));try{return function(e,t,n){return Wl(e,Fl(Fl({},t),{},{v2:!0}),n)}(e,t,n)}catch(e){if(!(e instanceof mc))throw e}}function Yl(){var e=Hl(arguments),t=e.text,n=e.options,o=e.metadata;return Zl(t,n,o)}const Ql=(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)}),{}),eu=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,n])=>[`${t}.${e}`,n]))),tu={enabled:"active",disabled:"disabled",invited:"invited"},nu=e=>e.tenantRoles.data,ou=e=>e.selectedUsersLoginIds,ru=e=>e.notifications,iu=e=>e.customAttributes.data,su=wa((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),eu(null==e?void 0:e.customAttributes,"customAttributes")),{status:tu[e.status]||e.status,roles:e.roleNames}))))),au=wa(ou,su,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),du=wa(au,(e=>e.map((e=>e.userId)))),cu=wa(au,(e=>e.map((e=>e.status)))),lu=wa(au,(e=>e.every((e=>e.editable)))),uu=wa(ou,(e=>!!e.length)),hu=wa(ou,(e=>1===e.length)),pu=wa(ou,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),fu=wa(hu,cu,((e,t)=>e&&t.every((e=>e===tu.enabled)))),gu=wa(cu,(e=>e.every((e=>e===tu.disabled)))),mu=wa(au,(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`})),vu=wa(hu,gu,lu,((e,t,n)=>e&&t&&n)),yu=wa(hu,fu,lu,((e,t,n)=>e&&t&&n)),bu=wa(hu,lu,((e,t)=>e&&t)),$u=wa(hu,lu,((e,t)=>e&&t)),wu=wa(hu,lu,((e,t)=>e&&t)),Eu=wa(uu,lu,((e,t)=>e&&t)),ku=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)}))}))},Cu=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}}),xu=({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)})}}),Ou=ed("users/create",((e,{extra:{api:t}})=>t.user.create(e))),Su=ku(Ou)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},Cu((e=>e.createUser)),xu({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>`}})),Iu={action:Ou,reducer:Su},ju=ed("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),Ru=ku(ju)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},Cu((e=>e.deleteUser)),xu({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete user${["","s"]}`})),Nu={action:ju,reducer:Ru},Mu=ed("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),Au=ku(Mu)(Cu((e=>e.setTempUserPassword)),xu({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>`}})),Du={action:Mu,reducer:Au},Tu=ed("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),Pu=ku(Tu)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},Cu((e=>e.customAttributes))),_u={action:Tu,reducer:Pu},Uu=ed("users/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.user.search(Object.assign(Object.assign({},o),e))})),Wu=ku(Uu)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},Cu((e=>e.usersList))),Lu={action:Uu,reducer:Wu},Fu=ed("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Vu=ku(Fu)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},Cu((e=>e.tenantRoles))),qu={action:Fu,reducer:Vu},Bu=ed("users/update",((e,{extra:{api:t}})=>t.user.update(e))),zu=ku(Bu)({onFulfilled:(e,t)=>{const n=e.usersList.data.findIndex((e=>Mi(e.loginIds,t.payload.loginIds)));-1!==n&&(e.usersList.data[n]=t.payload)}},Cu((e=>e.updateUser)),xu({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>`}})),Ku={action:Bu,reducer:zu},Hu=ed("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Gu=ku(Hu)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return Mi(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)}},Cu((e=>e.enableUser)),xu({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>`}})),Ju={action:Hu,reducer:Gu},Xu=ed("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Zu=ku(Xu)({onFulfilled:(e,t)=>{var n;const o=e.usersList.data.findIndex((e=>{var n;return Mi(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)}},Cu((e=>e.disableUser)),xu({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>`}})),Yu={action:Xu,reducer:Zu},Qu=ed("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),eh={action:Qu,reducer:ku(Qu)(Cu((e=>e.removePasskey)),xu({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>`}}))},th={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:[]},nh="/v1/mgmt/user/search",oh="/v1/mgmt/user/delete/batch",rh="/v1/mgmt/user/create",ih="/v1/mgmt/user/update",sh="/v1/mgmt/user/update/status",ah="/v1/mgmt/user/password/set/temporary",dh="/v1/mgmt/user/passkeys/delete",ch="/v1/mgmt/user/customattributes",lh="/v1/mgmt/role/all",uh=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)})),hh=({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(nh,{limit:r,page:o,withTestUser:!1,customAttributes:i,statuses:s,emails:a,phones:d,text:c,sort:l},{queryParams:{tenant:t}});return yield uh(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(oh,{userIds:o},{queryParams:{tenant:t}});return yield uh(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(rh,{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 uh(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(ih,{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 uh(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(sh,{loginId:o,status:"enabled"},{queryParams:{tenant:t}});return yield uh(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(sh,{loginId:o,status:"disabled"},{queryParams:{tenant:t}});return yield uh(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(dh,{loginId:o},{queryParams:{tenant:t}});return yield uh(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(ah,{loginId:o},{queryParams:{tenant:t}});return yield uh(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(ch,{queryParams:{tenant:t}});return yield uh(o),(yield o.json()).data}))}),ph=({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(lh,{queryParams:{tenant:t}});return yield uh(o),o.json()}))}),fh=Pi((e=>{var t,n,o,r;const i=ji(Ed,$d,gd,kd,wd({tenant:wd.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=ro(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.68"}}));return{user:hh({httpClient:r.httpClient,tenant:t,mock:n}),tenant:ph({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),gh=Pi((e=>{const t=ji(qd({name:"widget",initialState:th,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Iu.reducer(e),Ku.reducer(e),Ju.reducer(e),Yu.reducer(e),Nu.reducer(e),Lu.reducer(e),Du.reducer(e),eh.reducer(e),_u.reducer(e),qu.reducer(e)},asyncActions:{searchUsers:Lu.action,createUser:Iu.action,updateUser:Ku.action,enableUser:Ju.action,disableUser:Yu.action,deleteUsers:Nu.action,removePasskey:eh.action,getCustomAttributes:_u.action,getTenantRoles:qu.action,setTempUserPassword:Du.action}}),bd,gd,fh)(e);return class extends t{constructor(...e){super(...e),this.state=th,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),mh=Pi((e=>{const t=ji(Cd,wd({"widget-id":wd.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}))}}})),vh=Pi((e=>{var t,n,o;return o=class extends(ji(gd,bd,Ad,Pd,mh,gh)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),yh=Pi((e=>{var t,n,o,r,i,s;return s=class extends(ji(gh,Ud,Bd,gd,vh)(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(nu(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(Ri(yield this.fetchWidgetPage("create-user-modal.html")));new Ji((()=>{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 Ji((()=>{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({},Ql(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),p(this,n,new Yi((()=>{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=iu(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})),bh=Pi((e=>{var t,n,o;return o=class extends(ji(gd,yh,vh)(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 Ji(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})),$h=Pi((e=>{var t,n,o;return o=class extends(ji(gh,Ud,gd,vh)(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(Ri(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=du(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const o=new ts(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=mu(this.state);o.text=`Delete ${e}?`}}))},o})),wh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh,$h)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Eu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ji(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})),Eh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(gh,Ud,gd,Bd,vh)(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 Ji((()=>{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 Ji((()=>{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=pu(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(Ri(yield this.fetchWidgetPage("disable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=mu(this.state);r.text=`Disable ${e}?`}))}))},i})),kh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh,Eh,Bd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),yu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.disableButton=new Ji(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})),Ch=e=>{if(!e)return e;const t=function(){return sc(Yl,arguments)}(e),n=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(n,"$1-$2")},xh=Pi((e=>{var t,n,o,r,i,s,a,d,c,f;return f=class extends(ji(gh,Ud,gd,Bd,vh)(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(nu(this.state).map((({name:e})=>({value:e,label:e}))))})))),d.set(this,(()=>{var e,t;const n=null===(e=au(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:Ch(null==n?void 0:n.phone),roles:null==n?void 0:n.roles},eu(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 Ji((()=>{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 Ji((()=>{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]},Ql(n,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},a=function(){const e=iu(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(Ri(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 ns(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),p(this,o,new Yi((()=>{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})),Oh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh,xh,Bd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),bu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ji(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})),Sh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(gh,Ud,gd,Bd,vh)(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 Ji((()=>{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 Ji((()=>{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=pu(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(Ri(yield this.fetchWidgetPage("enable-user-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=mu(this.state);r.text=`Activate ${e}?`}))}))},i})),Ih=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh,Sh,Bd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),vu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.enableButton=new Ji(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})),jh=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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})),Rh={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},Nh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(gd,gh,Ld,bd)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((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),ru)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Rh[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})),Mh=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(gh,Ud,gd,Bd,vh)(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 Ji((()=>{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 Ji((()=>{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=pu(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(Ri(yield this.fetchWidgetPage("remove-passkey-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=mu(this.state);r.text=`Remove passkey for ${e}?`}))}))},i})),Ah=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh,Mh,Bd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),$u)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.removePasskeyButton=new Ji(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})),Dh=Pi((e=>{var t,n,o,r,i,s,a,d;return d=class extends(ji(gh,gd,vh)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((e=>{this.usersTable.data=e}))),i.set(this,Ti(((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,Ai((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,su(this.state)),h(this,s,"f").call(this,iu(this.state)),this.subscribe(h(this,s,"f").bind(this),iu),this.subscribe(h(this,r,"f").bind(this),su)}))}},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 Gi(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})),Th=Pi((e=>{var t,n,o;return o=class extends(ji(gh,Ud,gd,Bd,vh)(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(Ri(yield this.fetchWidgetPage("generated-password-modal.html")));new Ji((()=>{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})),Ph=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(gh,Ud,gd,Bd,vh,Th)(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 Ji((()=>{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 Ji((()=>{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=pu(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(Ri(yield this.fetchWidgetPage("reset-password-modal.html"))),h(this,t,"m",n).call(this),h(this,t,"m",o).call(this);const r=new ts(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>u(this,void 0,void 0,(function*(){const e=mu(this.state);r.text=`This will generate a new temporary password for ${e}?`}))}))},i})),_h=Pi((e=>{var t,n,o,r;return r=class extends(ji(gd,vh,gh,Ph,Bd)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),wu)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.resetPasswordButton=new Ji(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})),Uh=Pi((e=>class extends(ji(Od,Vd,Dh,bh,wh,Oh,Ih,kh,_h,Ah,jh,Nh)(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)}))}})),Wh=ji((e=>class extends(Uh(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Wh);var Lh=Object.freeze({__proto__:null,default:Wh});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Fh="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},Vh=e=>e&&"function"==typeof e.match;function qh(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Ip(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=>bs(t)&&t.type===e,n}function Bh(e){return"function"==typeof e&&"type"in e&&Vh(e)}function zh(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 Kh=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 Hh(e){return Ss(e)?la(e,(()=>{})):e}function Gh(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?Ip(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Jh(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Xh(e,t,n){const o=Zh(e,t,n);return{detectMutations:()=>Yh(e,t,o,n)}}function Zh(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]=Zh(e,t,n[r],s))}}return i}function Yh(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=Yh(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Qh(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function ep(e,t="",n=Qh,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=ep(c,a,n,o,r,i),s))return s}return i&&tp(e)&&i.add(e),!1}function tp(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!tp(t))return!1;return!0}function np(e){return"boolean"==typeof e}var op=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new Kh;if(t&&(np(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};np(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=Jh,ignoredPaths:r,warnAfter:i=32}=e;const s=Xh.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=zh(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Ip(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?Ip(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={};np(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Qh,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(!bs(u))return c(u);const h=c(u),p=zh(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=ep(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=ep(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={};np(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Bh}=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},rp=e=>t=>{setTimeout(t,e)},ip="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:rp(10),sp=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new Kh(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?ip:"callback"===e.type?e.queueNotification:rp(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},ap="production"===process.env.NODE_ENV;function dp(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?Ip(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Ip(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?Ip(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Ip(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?Ip(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?Ip(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var cp=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function lp(...e){return t=>e.some((e=>((e,t)=>Vh(e)?e.match(t):e(t))(e,t)))}var up=["name","message","stack","code"],hp=class{constructor(e,t){this.payload=e,this.meta=t}_type},pp=class{constructor(e,t){this.payload=e,this.meta=t}_type},fp=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of up)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},gp=(()=>{function e(e,t,n){const o=qh(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=qh(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=qh(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||fp)(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):cp(),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 hp(e,t),fulfillWithValue:(e,t)=>new pp(e,t)})).then((t=>{if(t instanceof hp)throw t;return t instanceof pp?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof hp?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(mp)})}}),{pending:r,rejected:i,fulfilled:o,settled:lp(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function mp(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var vp=Symbol.for("rtk-slice-createasyncthunk");function yp(e,t){return`${e}/${t}`}function bp({creators:e}={}){const t=e?.asyncThunk?.[vp];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Ip(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?Ip(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Ip(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?Ip(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?dp(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?Ip(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]=dp(t);if(function(e){return"function"==typeof e}(e))n=()=>Hh(e());else{const t=Hh(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?Ip(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:yp(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?Ip(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?qh(e,s):qh(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Ip(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||Ep,pending:a||Ep,rejected:d||Ep,settled:c||Ep})}(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?Ip(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=Gh(l,n,{insert:()=>new WeakMap});return Gh(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=$p(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 $p(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?Ip(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var wp=bp();function Ep(){}var kp="listenerMiddleware",Cp=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=qh(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?Ip(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?Ip(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},xp=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Cp(e);return{id:cp(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Ip(22):"Unsubscribe not initialized")}}}),{withTypes:()=>xp}),Op=Object.assign(qh(`${kp}/add`),{withTypes:()=>Op});qh(`${kp}/removeAll`);var Sp=Object.assign(qh(`${kp}/remove`),{withTypes:()=>Sp});function Ip(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 jp=["error","warn","info","debug"],Rp=Pi((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 jp.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})),Np="undefined"!=typeof localStorage,Mp=Np&&localStorage.getItem("base.content.url")||"",Ap=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Dp=Pi((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})),Tp=Pi((e=>{var t,n;const o=ji(Rp,Dp)(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})),Pp=e=>t=>{var n,o,r;const i=ji(Rp,Dp,Tp)(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};Pp.missingAttrValidator=Ap;const _p=Pi((e=>{const t=ji(Pp({"project-id":Ap}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Up=Pi((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Wp=Pi((e=>{const t=ji(Rp,_p,Up)(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(Mp||o||"https://static.descope.com/pages");return r.pathname=Ni(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseUrl}),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())}}}})),Lp=Pi((e=>{var t,n,o;const r=ji(Wp)(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})),Fp=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(Dp,Rp)(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 $f})),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})),Vp="load-descope-ui",qp="base.ui.components.url",Bp=Np&&localStorage.getItem(qp)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",zp=Np&&localStorage.getItem(qp)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Kp=e=>{const t=document.createElement("script");return t.id=e,t},Hp=(e,t)=>e.replace("<version>",t),Gp=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(Rp,Lp)(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=Kp("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=Hp(zp,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#${Vp}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=Kp(Vp);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Hp(Bp,await h(this,t,"m",r).call(this))}return document.getElementById(Vp)},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})),Jp="content-root",Xp="root",Zp=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Xp}, #${Jp} {\n height: 100%;\n }\n #${Xp} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Xp}">\n <div id="${Jp}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Jp),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Xp)}})),Yp="descope-modal",Qp=Pi((e=>{var t,n;const o=ji(Dp,Zp,Gp)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(Yp);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([Yp]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),ef="descope-notification",tf=Pi((e=>{var t,n;const o=ji(Dp,Zp,Gp)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(ef);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([ef])}},t=new WeakMap,n})),nf=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',of=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(Pp({theme:nf}),Wp,Dp,Gp,Lp,Zp,Tp)(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(qp)))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(qp),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})),rf=e=>Pi((t=>{const n=wp(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(Rp)(t)){constructor(...e){super(...e);const t=function(e){const t=op(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?Ip(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!ap&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Ip(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!ap&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Ip(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!ap&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ip(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Fh({trace:!ap,..."object"==typeof r&&r}));const l=ys(...d),u=sp(l);if(!ap&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Ip(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!ap&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Ip(6):"`enhancers` callback must return an array");if(!ap&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Ip(7):"each enhancer provided to configureStore must be a function");return ap||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{mp(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()))))}}})),sf=Pi((e=>class extends(Rp(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()}})),af=(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 df,cf,lf,uf,hf,pf,ff,gf,mf,vf;const yf=document.createElement("template");yf.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 bf extends HTMLElement{constructor(){var e;super(),df.add(this),cf.set(this,new Bi({messages:[]})),lf.set(this,void 0),uf.set(this,void 0),hf.set(this,void 0),pf.set(this,{resize:h(this,df,"m",vf).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(yf.content.cloneNode(!0)),p(this,lf,this.shadowRoot.querySelector(".debugger"),"f"),p(this,uf,h(this,lf,"f").querySelector(".content"),"f"),p(this,hf,h(this,lf,"f").querySelector(".header"),"f")}updateData(e){h(this,cf,"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]=af(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,lf,"f"),h(this,hf,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,pf,"f").resize),(e=h(this,lf,"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,lf,"f").onresize=h(this,df,"m",mf).bind(this),h(this,cf,"f").subscribe(h(this,df,"m",ff).bind(this))}disconnectedCallback(){h(this,cf,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,pf,"f").resize)}}cf=new WeakMap,lf=new WeakMap,uf=new WeakMap,hf=new WeakMap,pf=new WeakMap,df=new WeakSet,ff=function(e){h(this,df,"m",gf).call(this,e),h(this,df,"m",mf).call(this)},gf=function(e){h(this,uf,"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("")},mf=function(){h(this,uf,"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)}))},vf=function(){const[e,t]=af(h(this,lf,"f"),Number.parseInt(h(this,lf,"f").style.left,10),Number.parseInt(h(this,lf,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,lf,"f").style.top=`${t}px`,h(this,lf,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",bf);var $f=Object.freeze({__proto__:null});const wf=e=>e.selectedRolesIds,Ef=e=>e.notifications,kf=e=>e.tenantPermissions.data||[],Cf=wa((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"})})))),xf=wa(wf,Cf,((e,t)=>t.filter((t=>e.includes(t.name))))),Of=wa(wf,(e=>!!e.length)),Sf=wa(wf,(e=>1===e.length)),If=wa(xf,(e=>1===e.length?e[0].name:`${e.length} roles`)),jf=e=>(...t)=>n=>{n.addCase(e.pending,((e,n)=>{t.forEach((({onPending:t})=>{null==t||t(e,n)}))})),n.addCase(e.fulfilled,((e,n)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,n)}))})),n.addCase(e.rejected,((e,n)=>{t.forEach((({onRejected:t})=>{null==t||t(e,n)}))}))},Rf=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,n)=>{e(t).loading=!1,e(t).error=n.error}}),Nf=({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)})}}),Mf=gp("roles/create",((e,{extra:{api:t}})=>t.role.create(e))),Af=jf(Mf)({onFulfilled:(e,t)=>{e.rolesList.data.unshift(t.payload)}},Rf((e=>e.createRole)),Nf({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>`}})),Df={action:Mf,reducer:Af},Tf=gp("roles/delete",((e,{extra:{api:t}})=>t.role.deleteBatch(e))),Pf=jf(Tf)({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=[]}},Rf((e=>e.deleteRole)),Nf({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["R","r"]}ole${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete role${["","s"]}`})),_f={action:Tf,reducer:Pf},Uf=gp("roles/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.role.search(Object.assign(Object.assign({},o),e))})),Wf=jf(Uf)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.rolesList.data=t.payload}},Rf((e=>e.rolesList))),Lf={action:Uf,reducer:Wf},Ff=gp("roles/update",((e,{extra:{api:t}})=>t.role.update(e))),Vf=jf(Ff)({onFulfilled:(e,t)=>{const n=e.rolesList.data.findIndex((e=>e.name===t.payload.oldName));-1!==n&&(e.rolesList.data[n]=t.payload)}},Rf((e=>e.updateRole)),Nf({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>`}})),qf={action:Ff,reducer:Vf},Bf=gp("tenant/getTenantPermissions",((e,{extra:{api:t}})=>t.tenant.getTenantPermissions())),zf={action:Bf,reducer:jf(Bf)({onFulfilled:(e,t)=>{e.tenantPermissions.data=t.payload.permissions}},Rf((e=>e.tenantPermissions)))},Kf={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:[]},Hf="/v1/mgmt/role/search",Gf="/v1/mgmt/role/delete/batch",Jf="/v1/mgmt/role/create",Xf="/v1/mgmt/role/update",Zf="/v1/mgmt/permission/all",Yf=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)})),Qf=({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(Hf,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Yf(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(Gf,{roleNames:o},{queryParams:{tenant:t}});return yield Yf(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(Jf,{name:o,description:r,permissionNames:i,tenantId:t},{queryParams:{tenant:t}});return yield Yf(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(Xf,{name:o,newName:r,description:i,permissionNames:s,tenantId:t},{queryParams:{tenant:t}});yield Yf(a);const d=yield a.json();return d.oldName=o,d}))}),eg=({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(Zf,{queryParams:{tenant:t}});return yield Yf(o),o.json()}))}),tg=Pi((e=>{var t,n,o,r;const i=ji(_p,Tp,Rp,Up,Pp({tenant:Pp.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=ro(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.66"}}));return{role:Qf({httpClient:r.httpClient,tenant:t,mock:n}),tenant:eg({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),ng=Pi((e=>{const t=ji(rf({name:"widget",initialState:Kf,reducers:{setSelectedRolesIds:(e,{payload:t})=>{e.selectedRolesIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{Df.reducer(e),qf.reducer(e),_f.reducer(e),Lf.reducer(e),zf.reducer(e)},asyncActions:{searchRoles:Lf.action,createRole:Df.action,updateRole:qf.action,deleteRoles:_f.action,getTenantPermissions:zf.action}}),Dp,Rp,tg)(e);return class extends t{constructor(...e){super(...e),this.state=Kf,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),og=Pi((e=>{const t=ji(Wp,Pp({"widget-id":Pp.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}))}}})),rg=Pi((e=>{var t,n,o;return o=class extends(ji(Rp,Dp,Gp,Zp,og,ng)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),ig=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(ng,Qp,sf,Rp,rg)(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=kf(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(Ri(yield this.fetchWidgetPage("create-role-modal.html")));new Ji((()=>{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 Ji((()=>{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 Yi((()=>{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})),sg=Pi((e=>{var t,n,o;return o=class extends(ji(Rp,ig,rg)(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 Ji(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})),ag=Pi((e=>{var t,n,o;return o=class extends(ji(ng,Qp,Rp,rg)(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(Ri(yield this.fetchWidgetPage("delete-roles-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=xf(this.state);this.actions.deleteRoles(null==e?void 0:e.map((e=>e.name))),this.deleteRolesModal.close()}));const o=new ts(null===(e=this.deleteRolesModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteRolesModal.beforeOpen=()=>{const e=If(this.state);o.text=`Delete ${e}?`}}))},o})),dg=Pi((e=>{var t,n,o,r;return r=class extends(ji(Rp,rg,ng,ag)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Of)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ji(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})),cg=Pi((e=>{var t,n,o,r,i,s,a,d;return d=class extends(ji(ng,Qp,Rp,sf,rg)(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=kf(this.state))||void 0===e?void 0:e.map((({name:e})=>({value:e,label:e}))))})))),s.set(this,(()=>{var e;const t=null===(e=xf(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 Ji((()=>{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 Ji((()=>{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=xf(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(Ri(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 Yi((()=>{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})),lg=Pi((e=>{var t,n,o,r;return r=class extends(ji(Rp,rg,ng,cg,sf)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),Sf)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.editButton=new Ji(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})),ug=Pi((e=>{var t,n,o,r;return r=class extends(ji(Rp,rg,ng)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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})),hg={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},pg=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Rp,ng,tf,Dp)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((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),Ef)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=hg[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})),fg=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(ng,Rp,rg)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((e=>{this.rolesTable.data=e}))),r.set(this,Ti(((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,Cf(this.state)),this.subscribe(h(this,o,"f").bind(this),Cf)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.rolesTable=new Gi(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})),gg=Pi((e=>class extends(ji(Fp,of,fg,sg,dg,lg,ug,pg)(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)}))}})),mg=ji((e=>class extends(gg(e)){}))(HTMLElement);customElements.define("descope-role-management-widget",mg);var vg=Object.freeze({__proto__:null,default:mg});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var yg="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},bg=e=>e&&"function"==typeof e.match;function $g(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?im(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=>bs(t)&&t.type===e,n}function wg(e){return"function"==typeof e&&"type"in e&&bg(e)}function Eg(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 kg=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 Cg(e){return Ss(e)?la(e,(()=>{})):e}function xg(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?im(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function Og(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function Sg(e,t,n){const o=Ig(e,t,n);return{detectMutations:()=>jg(e,t,o,n)}}function Ig(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]=Ig(e,t,n[r],s))}}return i}function jg(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=jg(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function Rg(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function Ng(e,t="",n=Rg,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=Ng(c,a,n,o,r,i),s))return s}return i&&Mg(e)&&i.add(e),!1}function Mg(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!Mg(t))return!1;return!0}function Ag(e){return"boolean"==typeof e}var Dg=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new kg;if(t&&(Ag(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};Ag(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=Og,ignoredPaths:r,warnAfter:i=32}=e;const s=Sg.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Eg(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?im(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?im(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={};Ag(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=Rg,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(!bs(u))return c(u);const h=c(u),p=Eg(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=Ng(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=Ng(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={};Ag(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=wg}=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},Tg=e=>t=>{setTimeout(t,e)},Pg="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Tg(10),_g=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new kg(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?Pg:"callback"===e.type?e.queueNotification:Tg(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},Ug="production"===process.env.NODE_ENV;function Wg(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?im(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?im(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?im(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?im(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?im(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?im(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var Lg=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Fg(...e){return t=>e.some((e=>((e,t)=>bg(e)?e.match(t):e(t))(e,t)))}var Vg=["name","message","stack","code"],qg=class{constructor(e,t){this.payload=e,this.meta=t}_type},Bg=class{constructor(e,t){this.payload=e,this.meta=t}_type},zg=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of Vg)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},Kg=(()=>{function e(e,t,n){const o=$g(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=$g(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=$g(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||zg)(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):Lg(),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 qg(e,t),fulfillWithValue:(e,t)=>new Bg(e,t)})).then((t=>{if(t instanceof qg)throw t;return t instanceof Bg?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof qg?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(Hg)})}}),{pending:r,rejected:i,fulfilled:o,settled:Fg(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Hg(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Gg=Symbol.for("rtk-slice-createasyncthunk");function Jg(e,t){return`${e}/${t}`}function Xg({creators:e}={}){const t=e?.asyncThunk?.[Gg];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?im(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?im(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?im(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?im(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?Wg(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?im(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]=Wg(t);if(function(e){return"function"==typeof e}(e))n=()=>Cg(e());else{const t=Cg(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?im(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:Jg(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?im(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?$g(e,s):$g(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?im(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||Qg,pending:a||Qg,rejected:d||Qg,settled:c||Qg})}(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?im(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=xg(l,n,{insert:()=>new WeakMap});return xg(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Zg(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 Zg(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?im(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Yg=Xg();function Qg(){}var em="listenerMiddleware",tm=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=$g(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?im(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?im(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},nm=Object.assign((e=>{const{type:t,predicate:n,effect:o}=tm(e);return{id:Lg(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?im(22):"Unsubscribe not initialized")}}}),{withTypes:()=>nm}),om=Object.assign($g(`${em}/add`),{withTypes:()=>om});$g(`${em}/removeAll`);var rm=Object.assign($g(`${em}/remove`),{withTypes:()=>rm});function im(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 sm=["error","warn","info","debug"],am=Pi((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 sm.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})),dm="undefined"!=typeof localStorage,cm=dm&&localStorage.getItem("base.content.url")||"",lm=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,um=Pi((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})),hm=Pi((e=>{var t,n;const o=ji(am,um)(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})),pm=e=>t=>{var n,o,r;const i=ji(am,um,hm)(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};pm.missingAttrValidator=lm;const fm=Pi((e=>{const t=ji(pm({"project-id":lm}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),gm=Pi((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const mm=Pi((e=>{const t=ji(am,fm,gm)(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(cm||o||"https://static.descope.com/pages");return r.pathname=Ni(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseUrl}),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())}}}})),vm=Pi((e=>{var t,n,o;const r=ji(mm)(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})),ym=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(um,am)(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 Xm})),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})),bm="load-descope-ui",$m="base.ui.components.url",wm=dm&&localStorage.getItem($m)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Em=dm&&localStorage.getItem($m)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",km=e=>{const t=document.createElement("script");return t.id=e,t},Cm=(e,t)=>e.replace("<version>",t),xm=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(am,vm)(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=km("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=Cm(Em,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#${bm}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=km(bm);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=Cm(wm,await h(this,t,"m",r).call(this))}return document.getElementById(bm)},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})),Om="content-root",Sm="root",Im=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${Sm}, #${Om} {\n height: 100%;\n }\n #${Sm} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${Sm}">\n <div id="${Om}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(Om),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(Sm)}})),jm="descope-modal",Rm=Pi((e=>{var t,n;const o=ji(um,Im,xm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(jm);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([jm]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),Nm="descope-notification",Mm=Pi((e=>{var t,n;const o=ji(um,Im,xm)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(Nm);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([Nm])}},t=new WeakMap,n})),Am=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',Dm=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(pm({theme:Am}),mm,um,xm,vm,Im,hm)(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($m)))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($m),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})),Tm=e=>Pi((t=>{const n=Yg(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(am)(t)){constructor(...e){super(...e);const t=function(e){const t=Dg(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?im(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!Ug&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?im(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!Ug&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?im(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!Ug&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?im(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=yg({trace:!Ug,..."object"==typeof r&&r}));const l=ys(...d),u=_g(l);if(!Ug&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?im(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!Ug&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?im(6):"`enhancers` callback must return an array");if(!Ug&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?im(7):"each enhancer provided to configureStore must be a function");return Ug||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{Hg(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()))))}}})),Pm=Pi((e=>class extends(am(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()}})),_m=(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 Um,Wm,Lm,Fm,Vm,qm,Bm,zm,Km,Hm;const Gm=document.createElement("template");Gm.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 Jm extends HTMLElement{constructor(){var e;super(),Um.add(this),Wm.set(this,new Bi({messages:[]})),Lm.set(this,void 0),Fm.set(this,void 0),Vm.set(this,void 0),qm.set(this,{resize:h(this,Um,"m",Hm).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Gm.content.cloneNode(!0)),p(this,Lm,this.shadowRoot.querySelector(".debugger"),"f"),p(this,Fm,h(this,Lm,"f").querySelector(".content"),"f"),p(this,Vm,h(this,Lm,"f").querySelector(".header"),"f")}updateData(e){h(this,Wm,"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]=_m(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,Lm,"f"),h(this,Vm,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,qm,"f").resize),(e=h(this,Lm,"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,Lm,"f").onresize=h(this,Um,"m",Km).bind(this),h(this,Wm,"f").subscribe(h(this,Um,"m",Bm).bind(this))}disconnectedCallback(){h(this,Wm,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,qm,"f").resize)}}Wm=new WeakMap,Lm=new WeakMap,Fm=new WeakMap,Vm=new WeakMap,qm=new WeakMap,Um=new WeakSet,Bm=function(e){h(this,Um,"m",zm).call(this,e),h(this,Um,"m",Km).call(this)},zm=function(e){h(this,Fm,"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("")},Km=function(){h(this,Fm,"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)}))},Hm=function(){const[e,t]=_m(h(this,Lm,"f"),Number.parseInt(h(this,Lm,"f").style.left,10),Number.parseInt(h(this,Lm,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,Lm,"f").style.top=`${t}px`,h(this,Lm,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Jm);var Xm=Object.freeze({__proto__:null});const Zm=e=>e.selectedAccessKeysIds,Ym=e=>e.notifications,Qm=wa((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}))))),ev=wa(Zm,Qm,((e,t)=>t.filter((t=>e.includes(t.id))))),tv=wa(Zm,(e=>!!e.length)),nv=wa(ev,(e=>e.every((e=>e.editable)))),ov=wa(nv,tv,((e,t)=>e&&t));wa(Zm,(e=>1===e.length));const rv=wa(ev,(e=>1===e.length?e[0].name:`${e.length} access keys`)),iv=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)}))}))},sv=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}}),av=({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)})}}),dv=Kg("accessKeys/create",((e,{extra:{api:t}})=>t.accesskey.create(e))),cv=iv(dv)({onFulfilled:(e,t)=>{e.accessKeysList.data.unshift(t.payload.key)}},sv((e=>e.createAccessKey)),av({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>`}})),lv={action:dv,reducer:cv},uv=Kg("accessKeys/delete",((e,{extra:{api:t}})=>t.accesskey.deleteBatch(e))),hv=iv(uv)({onFulfilled:(e,t)=>{e.accessKeysList.data=e.accessKeysList.data.filter((e=>!t.meta.arg.includes(e.id))),e.selectedAccessKeysIds=[]}},sv((e=>e.deleteAccessKey)),av({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deleted successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to delete access key${["","s"]}`})),pv={action:uv,reducer:hv},fv=Kg("accessKeys/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.accesskey.search(Object.assign(Object.assign({},o),e))})),gv=iv(fv)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.accessKeysList.data=t.payload}},sv((e=>e.accessKeysList))),mv={action:fv,reducer:gv},vv=Kg("accessKeys/activate",((e,{extra:{api:t}})=>t.accesskey.activate(e))),yv=iv(vv)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="active")}))}},sv((e=>e.activateAccessKey)),av({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} activated successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to activate access key${["","s"]}`})),bv={action:vv,reducer:yv},$v=Kg("accessKeys/deactivate",((e,{extra:{api:t}})=>t.accesskey.deactivate(e))),wv=iv($v)({onFulfilled:(e,t)=>{e.accessKeysList.data.forEach((e=>{t.meta.arg.includes(e.id)&&(e.status="inactive")}))}},sv((e=>e.deactivateAccessKey)),av({getSuccessMsg:e=>Di(e.meta.arg.length)`${["",e.meta.arg.length]} ${["A","a"]}ccess key${["","s"]} deactivated successfully`,getErrorMsg:e=>Di(e.meta.arg.length)`Failed to deactivate access key${["","s"]}`})),Ev={action:$v,reducer:wv},kv=Kg("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Cv={action:kv,reducer:iv(kv)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},sv((e=>e.tenantRoles)))},xv={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:[]},Ov="/v1/mgmt/accesskey/search",Sv="/v1/mgmt/accesskey/delete/batch",Iv="/v1/mgmt/accesskey/create",jv="/v1/mgmt/accesskey/deactivate/batch",Rv="/v1/mgmt/accesskey/activate/batch",Nv="/v1/mgmt/role/all",Mv=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)})),Av=({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(Ov,{limit:r,page:o,text:i,sort:s},{queryParams:{tenant:t}});return yield Mv(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(Sv,{ids:o},{queryParams:{tenant:t}});return yield Mv(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(Iv,{name:o,expireTime:d,roleNames:i,userId:s},{queryParams:{tenant:t}});return yield Mv(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(Rv,{ids:o},{queryParams:{tenant:t}});return yield Mv(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(jv,{ids:o},{queryParams:{tenant:t}});return yield Mv(r),yield r.json()}))}),Dv=({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(Nv,{queryParams:{tenant:t}});return yield Mv(o),o.json()}))}),Tv=Pi((e=>{var t,n,o,r;const i=ji(fm,hm,am,gm,pm({tenant:pm.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=ro(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.68"}}));return{accesskey:Av({httpClient:r.httpClient,tenant:t,mock:n}),tenant:Dv({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Pv=Pi((e=>{const t=ji(Tm({name:"widget",initialState:xv,reducers:{setSelectedAccessKeysIds:(e,{payload:t})=>{e.selectedAccessKeysIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{lv.reducer(e),pv.reducer(e),mv.reducer(e),bv.reducer(e),Ev.reducer(e),Cv.reducer(e)},asyncActions:{searchAccessKeys:mv.action,createAccessKey:lv.action,activateAccessKeys:bv.action,deactivateAccessKeys:Ev.action,deleteAccessKeys:pv.action,getTenantRoles:Cv.action}}),um,am,Tv)(e);return class extends t{constructor(...e){super(...e),this.state=xv,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),_v=Pi((e=>{const t=ji(mm,pm({"widget-id":pm.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}))}}})),Uv=Pi((e=>{var t,n,o;return o=class extends(ji(am,um,xm,Im,_v,Pv)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Wv=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Pv,am,Uv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((e=>{this.accessKeysTable.data=e}))),r.set(this,Ti(((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,Qm(this.state)),this.subscribe(h(this,o,"f").bind(this),Qm)}))}},o=new WeakMap,r=new WeakMap,t=new WeakSet,n=function(){var e;this.accessKeysTable=new Gi(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})),Lv=Pi((e=>{var t,n,o;return o=class extends(ji(Pv,Rm,am,Uv)(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(Ri(yield this.fetchWidgetPage("activate-access-keys-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=ev(this.state);this.actions.activateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.activateAccessKeysModal.close()}));const o=new ts(null===(e=this.activateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.activateAccessKeysModal.beforeOpen=()=>{const e=rv(this.state);o.text=`Activate ${e}?`}}))},o})),Fv=Pi((e=>{var t,n,o,r;return r=class extends(ji(am,Uv,Pv,Lv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),ov)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.activateButton=new Ji(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})),Vv=Pi((e=>{var t,n,o;return o=class extends(ji(Pv,Rm,Pm,am,Uv)(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(Ri(yield this.fetchWidgetPage("created-access-key-modal.html")));new Ji((()=>{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})),qv=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(Pv,Rm,Pm,am,Uv,Vv)(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(Ri(yield this.fetchWidgetPage("create-access-key-modal.html")));const o=new Ji((()=>{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 Ji((()=>{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 Yi((()=>{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})),Bv=Pi((e=>{var t,n,o;return o=class extends(ji(am,qv,Uv)(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 Ji(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})),zv=Pi((e=>{var t,n,o;return o=class extends(ji(Pv,Rm,am,Uv)(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(Ri(yield this.fetchWidgetPage("deactivate-access-keys-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=ev(this.state);this.actions.deactivateAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deactivateAccessKeysModal.close()}));const o=new ts(null===(e=this.deactivateAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deactivateAccessKeysModal.beforeOpen=()=>{const e=rv(this.state);o.text=`Deactivate ${e}?`}}))},o})),Kv=Pi((e=>{var t,n,o,r;return r=class extends(ji(am,Uv,Pv,zv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),ov)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deactivateButton=new Ji(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})),Hv=Pi((e=>{var t,n,o;return o=class extends(ji(Pv,Rm,am,Uv)(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(Ri(yield this.fetchWidgetPage("delete-access-keys-modal.html")));const t=new Ji((()=>{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 Ji((()=>{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=ev(this.state);this.actions.deleteAccessKeys(null==e?void 0:e.map((e=>e.id))),this.deleteAccessKeysModal.close()}));const o=new ts(null===(e=this.deleteAccessKeysModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteAccessKeysModal.beforeOpen=()=>{const e=rv(this.state);o.text=`Delete ${e}?`}}))},o})),Gv=Pi((e=>{var t,n,o,r;return r=class extends(ji(am,Uv,Pv,Hv)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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),ov)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.deleteButton=new Ji(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})),Jv=Pi((e=>{var t,n,o,r;return r=class extends(ji(am,Uv,Pv)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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})),Xv={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},Zv=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(am,Pv,Mm,um)(e)){constructor(){super(...arguments),t.add(this),r.set(this,Ai((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),Ym)}))}},r=new WeakMap,t=new WeakSet,n=function({type:e,msg:t}){const n=Xv[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})),Yv=Pi((e=>class extends(ji(ym,Dm,Wv,Bv,Gv,Jv,Fv,Kv,Zv)(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)}))}})),Qv=ji((e=>class extends(Yv(e)){}))(HTMLElement);customElements.define("descope-access-key-management-widget",Qv);var ey=Object.freeze({__proto__:null,default:Qv});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var ty="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},ny=e=>e&&"function"==typeof e.match;function oy(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?Vy(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=>bs(t)&&t.type===e,n}function ry(e){return"function"==typeof e&&"type"in e&&ny(e)}function iy(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 sy=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 ay(e){return Ss(e)?la(e,(()=>{})):e}function dy(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?Vy(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function cy(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function ly(e,t,n){const o=uy(e,t,n);return{detectMutations:()=>hy(e,t,o,n)}}function uy(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]=uy(e,t,n[r],s))}}return i}function hy(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=hy(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function py(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function fy(e,t="",n=py,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=fy(c,a,n,o,r,i),s))return s}return i&&gy(e)&&i.add(e),!1}function gy(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!gy(t))return!1;return!0}function my(e){return"boolean"==typeof e}var vy=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new sy;if(t&&(my(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};my(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=cy,ignoredPaths:r,warnAfter:i=32}=e;const s=ly.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=iy(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?Vy(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?Vy(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={};my(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=py,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(!bs(u))return c(u);const h=c(u),p=iy(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=fy(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=fy(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={};my(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=ry}=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},yy=e=>t=>{setTimeout(t,e)},by="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:yy(10),$y=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new sy(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?by:"callback"===e.type?e.queueNotification:yy(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},wy="production"===process.env.NODE_ENV;function Ey(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?Vy(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?Vy(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?Vy(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?Vy(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?Vy(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?Vy(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var ky=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function Cy(...e){return t=>e.some((e=>((e,t)=>ny(e)?e.match(t):e(t))(e,t)))}var xy=["name","message","stack","code"],Oy=class{constructor(e,t){this.payload=e,this.meta=t}_type},Sy=class{constructor(e,t){this.payload=e,this.meta=t}_type},Iy=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of xy)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},jy=(()=>{function e(e,t,n){const o=oy(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=oy(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=oy(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||Iy)(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):ky(),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 Oy(e,t),fulfillWithValue:(e,t)=>new Sy(e,t)})).then((t=>{if(t instanceof Oy)throw t;return t instanceof Sy?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof Oy?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(Ry)})}}),{pending:r,rejected:i,fulfilled:o,settled:Cy(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function Ry(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Ny=Symbol.for("rtk-slice-createasyncthunk");function My(e,t){return`${e}/${t}`}function Ay({creators:e}={}){const t=e?.asyncThunk?.[Ny];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?Vy(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?Vy(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?Vy(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?Vy(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?Ey(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?Vy(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]=Ey(t);if(function(e){return"function"==typeof e}(e))n=()=>ay(e());else{const t=ay(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?Vy(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:My(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?Vy(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?oy(e,s):oy(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?Vy(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||Py,pending:a||Py,rejected:d||Py,settled:c||Py})}(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?Vy(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=dy(l,n,{insert:()=>new WeakMap});return dy(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=Dy(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 Dy(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?Vy(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var Ty=Ay();function Py(){}var _y="listenerMiddleware",Uy=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=oy(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?Vy(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?Vy(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},Wy=Object.assign((e=>{const{type:t,predicate:n,effect:o}=Uy(e);return{id:ky(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?Vy(22):"Unsubscribe not initialized")}}}),{withTypes:()=>Wy}),Ly=Object.assign(oy(`${_y}/add`),{withTypes:()=>Ly});oy(`${_y}/removeAll`);var Fy=Object.assign(oy(`${_y}/remove`),{withTypes:()=>Fy});function Vy(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 qy=["error","warn","info","debug"],By=Pi((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 qy.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,Ky=zy&&localStorage.getItem("base.content.url")||"",Hy=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,Gy=Pi((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})),Jy=Pi((e=>{var t,n;const o=ji(By,Gy)(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})),Xy=e=>t=>{var n,o,r;const i=ji(By,Gy,Jy)(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};Xy.missingAttrValidator=Hy;const Zy=Pi((e=>{const t=ji(Xy({"project-id":Hy}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),Yy=Pi((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const Qy=Pi((e=>{const t=ji(By,Zy,Yy)(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(Ky||o||"https://static.descope.com/pages");return r.pathname=Ni(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseUrl}),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())}}}})),eb=Pi((e=>{var t,n,o;const r=ji(Qy)(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})),tb=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(Gy,By)(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 Rb})),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})),nb="load-descope-ui",ob="base.ui.components.url",rb=zy&&localStorage.getItem(ob)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ib=zy&&localStorage.getItem(ob)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",sb=e=>{const t=document.createElement("script");return t.id=e,t},ab=(e,t)=>e.replace("<version>",t),db=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(By,eb)(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=sb("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=ab(ib,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#${nb}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=sb(nb);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=ab(rb,await h(this,t,"m",r).call(this))}return document.getElementById(nb)},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})),cb="content-root",lb="root",ub=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${lb}, #${cb} {\n height: 100%;\n }\n #${lb} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${lb}">\n <div id="${cb}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(cb),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(lb)}})),hb="descope-modal";Pi((e=>{var t,n;const o=ji(Gy,ub,db)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(hb);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([hb]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n}));const pb="descope-notification";Pi((e=>{var t,n;const o=ji(Gy,ub,db)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(pb);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([pb])}},t=new WeakMap,n}));const fb=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',gb=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(Xy({theme:fb}),Qy,Gy,db,eb,ub,Jy)(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(ob)))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(ob),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})),mb=e=>Pi((t=>{const n=Ty(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(By)(t)){constructor(...e){super(...e);const t=function(e){const t=vy(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?Vy(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!wy&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?Vy(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!wy&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?Vy(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!wy&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Vy(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=ty({trace:!wy,..."object"==typeof r&&r}));const l=ys(...d),u=$y(l);if(!wy&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?Vy(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!wy&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?Vy(6):"`enhancers` callback must return an array");if(!wy&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?Vy(7):"each enhancer provided to configureStore must be a function");return wy||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{Ry(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()))))}}}));Pi((e=>class extends(By(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 vb=(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 yb,bb,$b,wb,Eb,kb,Cb,xb,Ob,Sb;const Ib=document.createElement("template");Ib.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 jb extends HTMLElement{constructor(){var e;super(),yb.add(this),bb.set(this,new Bi({messages:[]})),$b.set(this,void 0),wb.set(this,void 0),Eb.set(this,void 0),kb.set(this,{resize:h(this,yb,"m",Sb).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(Ib.content.cloneNode(!0)),p(this,$b,this.shadowRoot.querySelector(".debugger"),"f"),p(this,wb,h(this,$b,"f").querySelector(".content"),"f"),p(this,Eb,h(this,$b,"f").querySelector(".header"),"f")}updateData(e){h(this,bb,"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]=vb(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,$b,"f"),h(this,Eb,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,kb,"f").resize),(e=h(this,$b,"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,$b,"f").onresize=h(this,yb,"m",Ob).bind(this),h(this,bb,"f").subscribe(h(this,yb,"m",Cb).bind(this))}disconnectedCallback(){h(this,bb,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,kb,"f").resize)}}bb=new WeakMap,$b=new WeakMap,wb=new WeakMap,Eb=new WeakMap,kb=new WeakMap,yb=new WeakSet,Cb=function(e){h(this,yb,"m",xb).call(this,e),h(this,yb,"m",Ob).call(this)},xb=function(e){h(this,wb,"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("")},Ob=function(){h(this,wb,"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)}))},Sb=function(){const[e,t]=vb(h(this,$b,"f"),Number.parseInt(h(this,$b,"f").style.left,10),Number.parseInt(h(this,$b,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,$b,"f").style.top=`${t}px`,h(this,$b,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",jb);var Rb=Object.freeze({__proto__:null});const Nb=e=>e.selectedAuditId,Mb=wa((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"})))));wa(Nb,Mb,((e,t)=>t.find((t=>e===t.id)))),wa(Nb,(e=>!!e));const Ab=jy("audit/search",((e,{extra:{api:t},getState:n})=>{const o=n().searchParams;return t.audit.search(Object.assign(Object.assign({},o),e))})),Db=(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)}))}))})(Ab)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.auditList.data=t.payload}},(Tb=e=>e.auditList,{onFulfilled:e=>{Tb(e).loading=!1},onPending:e=>{Tb(e).loading=!0,Tb(e).error=null},onRejected:(e,t)=>{Tb(e).loading=!1,Tb(e).error=t.error}}));var Tb;const Pb={action:Ab,reducer:Db},_b={auditList:{data:[],loading:!1,error:null},searchParams:{text:"",sort:[]},selectedAuditId:""},Ub="/v1/mgmt/audit/search",Wb=({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(Ub,{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}))}),Lb=Pi((e=>{var t,n,o,r;const i=ji(Zy,Jy,By,Yy,Xy({tenant:Xy.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=ro(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.31"}}));return{audit:Wb({httpClient:r.httpClient,tenant:t,mock:n})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),Fb=Pi((e=>{const t=ji(mb({name:"widget",initialState:_b,reducers:{setSelectedAuditId:(e,{payload:t})=>{e.selectedAuditId=t}},extraReducers:e=>{Pb.reducer(e)},asyncActions:{searchAudit:Pb.action}}),Gy,By,Lb)(e);return class extends t{constructor(...e){super(...e),this.state=_b,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Vb=Pi((e=>{const t=ji(Qy,Xy({"widget-id":Xy.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}))}}})),qb=Pi((e=>{var t,n,o;return o=class extends(ji(By,Gy,db,ub,Vb,Fb)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Bb=Pi((e=>{var t,n,o,r,i;return i=class extends(ji(By,qb,Fb)(e)){constructor(){super(...arguments),t.add(this),n.set(this,Ti((()=>{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 ns(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 Qi(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})),zb=Pi((e=>{var t,n,o,r;return r=class extends(ji(Fb,By,qb)(e)){constructor(){super(...arguments),t.add(this),o.set(this,Ai((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,Mb(this.state)),this.subscribe(h(this,o,"f").bind(this),Mb)}))}},o=new WeakMap,t=new WeakSet,n=function(){var e;this.auditTable=new Gi(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})),Kb=Pi((e=>class extends(ji(tb,gb,zb,Bb)(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)}))}})),Hb=ji((e=>class extends(Kb(e)){}))(HTMLElement);customElements.define("descope-audit-management-widget",Hb);var Gb=Object.freeze({__proto__:null,default:Hb});((...e)=>{const t=$a(...e),n=Object.assign(((...e)=>{const n=t(...e),o=(e,...t)=>n(Os(e)?aa(e):e,...t);return Object.assign(o,n),o}),{withTypes:()=>n})})(ba);var Jb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?vs:vs.apply(null,arguments)},Xb=e=>e&&"function"==typeof e.match;function Zb(e,t){function n(...n){if(t){let o=t(...n);if(!o)throw new Error("production"===process.env.NODE_ENV?P$(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=>bs(t)&&t.type===e,n}function Yb(e){return"function"==typeof e&&"type"in e&&Xb(e)}function Qb(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 e$=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 t$(e){return Ss(e)?la(e,(()=>{})):e}function n$(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?P$(10):"No insert provided for key not already in map");const o=n.insert(t,e);return e.set(t,o),o}function o$(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function r$(e,t,n){const o=i$(e,t,n);return{detectMutations:()=>s$(e,t,o,n)}}function i$(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]=i$(e,t,n[r],s))}}return i}function s$(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=s$(e,t,n.children[r],o[r],a,s);if(d.wasMutated)return d}return{wasMutated:!1}}function a$(e){const t=typeof e;return null==e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||us(e)}function d$(e,t="",n=a$,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=d$(c,a,n,o,r,i),s))return s}return i&&c$(e)&&i.add(e),!1}function c$(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if("object"==typeof t&&null!==t&&!c$(t))return!1;return!0}function l$(e){return"boolean"==typeof e}var u$=()=>function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:r=!0}=e??{};let i=new e$;if(t&&(l$(t)?i.push(Ca):i.push(xa(t.extraArgument))),"production"!==process.env.NODE_ENV){if(n){let e={};l$(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=o$,ignoredPaths:r,warnAfter:i=32}=e;const s=r$.bind(null,o,r);return({getState:e})=>{let n,o=e(),r=s(o);return a=>d=>{const c=Qb(i,"ImmutableStateInvariantMiddleware");c.measureTime((()=>{if(o=e(),n=r.detectMutations(),r=s(o),n.wasMutated)throw new Error("production"===process.env.NODE_ENV?P$(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?P$(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={};l$(o)||(e=o),i.push(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);{const{isSerializable:t=a$,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(!bs(u))return c(u);const h=c(u),p=Qb(s,"SerializableStateInvariantMiddleware");return d||o.length&&-1!==o.indexOf(u.type)||p.measureTime((()=>{const e=d$(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=d$(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={};l$(r)||(e=r),i.unshift(function(e={}){if("production"===process.env.NODE_ENV)return()=>e=>t=>e(t);const{isActionCreator:t=Yb}=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},h$=e=>t=>{setTimeout(t,e)},p$="undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:h$(10),f$=e=>function(t){const{autoBatch:n=!0}=t??{};let o=new e$(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?p$:"callback"===e.type?e.queueNotification:h$(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},g$="production"===process.env.NODE_ENV;function m$(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?P$(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error("production"===process.env.NODE_ENV?P$(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?P$(28):"`builder.addCase` cannot be called with an empty action type");if(s in t)throw new Error("production"===process.env.NODE_ENV?P$(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?P$(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?P$(31):"`builder.addDefaultCase` can only be called once");return o=e,r}};return e(r),[t,n,o]}var v$=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t};function y$(...e){return t=>e.some((e=>((e,t)=>Xb(e)?e.match(t):e(t))(e,t)))}var b$=["name","message","stack","code"],$$=class{constructor(e,t){this.payload=e,this.meta=t}_type},w$=class{constructor(e,t){this.payload=e,this.meta=t}_type},E$=e=>{if("object"==typeof e&&null!==e){const t={};for(const n of b$)"string"==typeof e[n]&&(t[n]=e[n]);return t}return{message:String(e)}},k$=(()=>{function e(e,t,n){const o=Zb(e+"/fulfilled",((e,t,n,o)=>({payload:e,meta:{...o||{},arg:n,requestId:t,requestStatus:"fulfilled"}}))),r=Zb(e+"/pending",((e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:"pending"}}))),i=Zb(e+"/rejected",((e,t,o,r,i)=>({payload:r,error:(n&&n.serializeError||E$)(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):v$(),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 $$(e,t),fulfillWithValue:(e,t)=>new w$(e,t)})).then((t=>{if(t instanceof $$)throw t;return t instanceof w$?o(t.payload,c,e,t.meta):o(t,c,e)}))])}catch(t){f=t instanceof $$?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(C$)})}}),{pending:r,rejected:i,fulfilled:o,settled:y$(i,o),typePrefix:e})}return e.withTypes=()=>e,e})();function C$(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var x$=Symbol.for("rtk-slice-createasyncthunk");function O$(e,t){return`${e}/${t}`}function S$({creators:e}={}){const t=e?.asyncThunk?.[x$];return function(e){const{name:n,reducerPath:o=n}=e;if(!n)throw new Error("production"===process.env.NODE_ENV?P$(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?P$(12):"`context.addCase` cannot be called with an empty action type");if(n in s.sliceCaseReducersByType)throw new Error("production"===process.env.NODE_ENV?P$(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?P$(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?m$(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?P$(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]=m$(t);if(function(e){return"function"==typeof e}(e))n=()=>t$(e());else{const t=t$(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(Os(e)){const o=n(e,t);return void 0===o?e:o}if(Ss(e))return la(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?P$(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:O$(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?P$(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?Zb(e,s):Zb(e))}(s,i,a):function({type:e,reducerName:t},n,o,r){if(!r)throw new Error("production"===process.env.NODE_ENV?P$(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||R$,pending:a||R$,rejected:d||R$,settled:c||R$})}(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?P$(15):"selectSlice returned undefined for an uninjected slice reducer");return o}function r(t=c){const o=n$(l,n,{insert:()=>new WeakMap});return n$(o,t,{insert:()=>{const o={};for(const[r,i]of Object.entries(e.selectors??{}))o[r]=I$(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 I$(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?P$(16):"selectState returned undefined for an uninjected slice reducer");return e(s,...i)}return r.unwrapped=e,r}var j$=S$();function R$(){}var N$="listenerMiddleware",M$=e=>{let{type:t,actionCreator:n,matcher:o,predicate:r,effect:i}=e;if(t)r=Zb(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?P$(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?P$(32):`${t} is not a function`)})(i,"options.listener"),{predicate:r,type:t,effect:i}},A$=Object.assign((e=>{const{type:t,predicate:n,effect:o}=M$(e);return{id:v$(),effect:o,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error("production"===process.env.NODE_ENV?P$(22):"Unsubscribe not initialized")}}}),{withTypes:()=>A$}),D$=Object.assign(Zb(`${N$}/add`),{withTypes:()=>D$});Zb(`${N$}/removeAll`);var T$=Object.assign(Zb(`${N$}/remove`),{withTypes:()=>T$});function P$(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 _$=["error","warn","info","debug"],U$=Pi((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 _$.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})),W$="undefined"!=typeof localStorage,L$=W$&&localStorage.getItem("base.content.url")||"",F$=(e,t)=>!t&&`${e} cannot be empty, please make sure to set this attribute`,V$=Pi((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})),q$=Pi((e=>{var t,n;const o=ji(U$,V$)(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})),B$=e=>t=>{var n,o,r;const i=ji(U$,V$,q$)(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};B$.missingAttrValidator=F$;const z$=Pi((e=>{const t=ji(B$({"project-id":F$}))(e);return class extends t{get projectId(){return this.getAttribute("project-id")}}})),K$=Pi((e=>class extends e{get baseUrl(){return this.getAttribute("base-url")}}));const H$=Pi((e=>{const t=ji(U$,z$,K$)(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(L$||o||"https://static.descope.com/pages");return r.pathname=Ni(r.pathname,e,n,t),r.toString()}({projectId:this.projectId,filename:e,baseUrl:this.baseUrl}),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())}}}})),G$=Pi((e=>{var t,n,o;const r=ji(H$)(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})),J$=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(V$,U$)(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 xw})),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})),X$="load-descope-ui",Z$="base.ui.components.url",Y$=W$&&localStorage.getItem(Z$)||"https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js",Q$=W$&&localStorage.getItem(Z$)||"https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js",ew=e=>{const t=document.createElement("script");return t.id=e,t},tw=(e,t)=>e.replace("<version>",t),nw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,u,f;const g=ji(U$,G$)(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=ew("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=tw(Q$,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#${X$}`))this.logger.debug("DescopeUI loading script already exists",this);else{this.logger.debug("DescopeUI loading script does not exist, creating it",this);const e=ew(X$);document.body.append(e),h(this,t,"m",i).call(this,e),h(this,t,"m",a).call(this,e),e.src=tw(Y$,await h(this,t,"m",r).call(this))}return document.getElementById(X$)},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})),ow="content-root",rw="root",iw=Pi((e=>class extends e{constructor(...e){var t,n;super(...e),this.attachShadow({mode:"open"}).innerHTML=`\n\n <style>\n #${rw}, #${ow} {\n height: 100%;\n }\n #${rw} {\n position: relative;\n height: fit-content;\n }\n </style>\n <div id="${rw}">\n <div id="${ow}"></div>\n </div>\n `,this.contentRootElement=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById(ow),this.rootElement=null===(n=this.shadowRoot)||void 0===n?void 0:n.getElementById(rw)}})),sw="descope-modal",aw=Pi((e=>{var t,n;const o=ji(V$,iw,nw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends Zi{setContent(t){e(t),super.setContent(t)}}})())}createModal(e){const n=((e={})=>{const t=document.createElement(sw);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([sw]),await(null===(e=super.init)||void 0===e?void 0:e.call(this))}},t=new WeakMap,n})),dw="descope-notification";Pi((e=>{var t,n;const o=ji(V$,iw,nw)(e);return n=class extends o{constructor(){super(...arguments),t.set(this,(()=>{const e=this.loadDescopeUiComponents.bind(this);return class extends es{setContent(t){const n="string"==typeof t?Ri(t):t;e(n),super.setContent(n)}}})())}createNotification(e){const n=((e={})=>{const t=document.createElement(dw);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([dw])}},t=new WeakMap,n}));const cw=(e,t)=>!!t&&"light"!==t&&"dark"!==t&&'Supported theme values are "light", "dark", or leave empty for using the OS theme',lw=Pi((e=>{var t,n,o,r,i,s,a,d,c;const l=ji(B$({theme:cw}),H$,V$,nw,G$,iw,q$)(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(Z$)))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(Z$),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})),uw=e=>Pi((t=>{const n=j$(e),o=Object.assign(Object.assign({},n.actions),e.asyncActions);return class extends(ji(U$)(t)){constructor(...e){super(...e);const t=function(e){const t=u$(),{reducer:n,middleware:o,devTools:r=!0,preloadedState:i,enhancers:s}=e||{};let a,d;if("function"==typeof n)a=n;else{if(!us(n))throw new Error("production"===process.env.NODE_ENV?P$(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");a=ms(n)}if(!g$&&o&&"function"!=typeof o)throw new Error("production"===process.env.NODE_ENV?P$(2):"`middleware` field must be a callback");if("function"==typeof o){if(d=o(t),!g$&&!Array.isArray(d))throw new Error("production"===process.env.NODE_ENV?P$(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(!g$&&d.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?P$(4):"each middleware provided to configureStore must be a function");let c=vs;r&&(c=Jb({trace:!g$,..."object"==typeof r&&r}));const l=ys(...d),u=f$(l);if(!g$&&s&&"function"!=typeof s)throw new Error("production"===process.env.NODE_ENV?P$(5):"`enhancers` field must be a callback");let h="function"==typeof s?s(u):u();if(!g$&&!Array.isArray(h))throw new Error("production"===process.env.NODE_ENV?P$(6):"`enhancers` callback must return an array");if(!g$&&h.some((e=>"function"!=typeof e)))throw new Error("production"===process.env.NODE_ENV?P$(7):"each enhancer provided to configureStore must be a function");return g$||!d.length||h.includes(l)||console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`"),fs(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{C$(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()))))}}}));Pi((e=>class extends(U$(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 hw=(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 pw,fw,gw,mw,vw,yw,bw,$w,ww,Ew;const kw=document.createElement("template");kw.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 Cw extends HTMLElement{constructor(){var e;super(),pw.add(this),fw.set(this,new Bi({messages:[]})),gw.set(this,void 0),mw.set(this,void 0),vw.set(this,void 0),yw.set(this,{resize:h(this,pw,"m",Ew).bind(this)}),this.attachShadow({mode:"open"}),null===(e=this.shadowRoot)||void 0===e||e.appendChild(kw.content.cloneNode(!0)),p(this,gw,this.shadowRoot.querySelector(".debugger"),"f"),p(this,mw,h(this,gw,"f").querySelector(".content"),"f"),p(this,vw,h(this,gw,"f").querySelector(".header"),"f")}updateData(e){h(this,fw,"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]=hw(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,gw,"f"),h(this,vw,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,yw,"f").resize),(e=h(this,gw,"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,gw,"f").onresize=h(this,pw,"m",ww).bind(this),h(this,fw,"f").subscribe(h(this,pw,"m",bw).bind(this))}disconnectedCallback(){h(this,fw,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,yw,"f").resize)}}fw=new WeakMap,gw=new WeakMap,mw=new WeakMap,vw=new WeakMap,yw=new WeakMap,pw=new WeakSet,bw=function(e){h(this,pw,"m",$w).call(this,e),h(this,pw,"m",ww).call(this)},$w=function(e){h(this,mw,"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("")},ww=function(){h(this,mw,"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)}))},Ew=function(){const[e,t]=hw(h(this,gw,"f"),Number.parseInt(h(this,gw,"f").style.left,10),Number.parseInt(h(this,gw,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,gw,"f").style.top=`${t}px`,h(this,gw,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",Cw);var xw=Object.freeze({__proto__:null});const Ow=e=>e.me.data,Sw=wa(Ow,(e=>e.picture)),Iw=wa(Ow,(e=>e.email)),jw=wa(Ow,(e=>e.verifiedEmail)),Rw=wa(Ow,(e=>e.name)),Nw=wa(Ow,(e=>e.phone)),Mw=wa(Ow,(e=>e.verifiedPhone)),Aw=wa(Ow,(e=>e.webauthn));wa(Ow,(e=>e.password));const Dw=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)}))}))},Tw=k$("users/me",((e,{extra:{api:t}})=>t.user.me())),Pw=Dw(Tw)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(_w=e=>e.me,{onFulfilled:e=>{_w(e).loading=!1},onPending:e=>{_w(e).loading=!0,_w(e).error=null},onRejected:(e,t)=>{_w(e).loading=!1,_w(e).error=t.error}}));var _w;const Uw={action:Tw,reducer:Pw},Ww=k$("users/logout",((e,{extra:{api:t}})=>t.user.logout())),Lw={action:Ww,reducer:Dw(Ww)({})},Fw={me:{loading:!1,error:null,data:{}}},Vw="/v1/auth/me",qw=({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(Vw);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()}))}),Bw=Pi((e=>{var t,n,o,r;const i=ji(z$,q$,U$)(e);return r=class extends i{constructor(){super(...arguments),t.add(this),n.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}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=ro(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.34"}}));return{user:Object.assign(Object.assign({},qw({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})),zw=Pi((e=>{const t=ji(uw({name:"widget",initialState:Fw,reducers:{},extraReducers:e=>{Uw.reducer(e),Lw.reducer(e)},asyncActions:{getMe:Uw.action,logout:Lw.action}}),V$,U$,Bw)(e);return class extends t{constructor(...e){super(...e),this.state=Fw,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Kw=Pi((e=>{const t=ji(H$,B$({"widget-id":B$.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}))}}})),Hw=Pi((e=>{var t,n,o;return o=class extends(ji(U$,V$,nw,iw,Kw,zw)(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=Ri(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},o})),Gw=(e={})=>{const t=Ri("<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 Jw(e){return new URLSearchParams(window.location.search).get(e)}const Xw=Pi((e=>{var t,n,o,r,i,s,a,d,c;return c=class extends(ji(zw,U$,Hw,aw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,Ai((e=>{this.avatar.image=e}))),d.set(this,Ai((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,Sw(this.state)),h(this,d,"f").call(this,Rw(this.state)),this.subscribe(h(this,a,"f").bind(this),Sw),this.subscribe(h(this,d,"f").bind(this),Rw)}))}},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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.avatar=new os((()=>{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})),Zw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,f,g,m;return m=class extends(ji(zw,U$,Hw,aw)(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,Ai((e=>{this.emailUserAttr.value=e}))),g.set(this,Ai((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,Iw(this.state)),h(this,g,"f").call(this,jw(this.state)),this.subscribe(h(this,f,"f").bind(this),Iw),this.subscribe(h(this,g,"f").bind(this),jw)}))}},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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl})),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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.emailUserAttr=new rs((()=>{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})),Yw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,f,g;return g=class extends(ji(zw,U$,Hw,aw)(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,Ai((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,Rw(this.state)),this.subscribe(h(this,f,"f").bind(this),Rw)}))}},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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl})),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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.nameUserAttr=new rs((()=>{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})),Qw=Pi((e=>{var t,n,o,r,i,s,a,d,c,l,f,g,m;return m=class extends(ji(zw,U$,Hw,aw)(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,Ai((e=>{this.phoneUserAttr.value=e}))),g.set(this,Ai((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,Nw(this.state)),h(this,g,"f").call(this,Mw(this.state)),this.subscribe(h(this,f,"f").bind(this),Nw),this.subscribe(h(this,g,"f").bind(this),Mw)}))}},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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl})),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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl})),h(this,i,"f").onSuccess((()=>{h(this,r,"f").close(),this.actions.getMe()}))},l=function(){this.phoneUserAttr=new rs((()=>{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})),eE=Pi((e=>{var t,n,o,r,i,s,a,d;return d=class extends(ji(zw,U$,Hw,aw)(e)){constructor(){super(...arguments),t.add(this),n.set(this,void 0),o.set(this,void 0),a.set(this,Ai((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,Aw(this.state)),this.subscribe(h(this,a,"f").bind(this),Aw)}))}},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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close(),this.actions.getMe()}))},s=function(){this.passkeyUserAuthMethod=new is((()=>{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})),tE=Pi((e=>{var t,n,o,r,i,s,a;return a=class extends(ji(zw,U$,Hw,aw)(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 ss((()=>{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(Gw({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl})),h(this,o,"f").onSuccess((()=>{h(this,n,"f").close()}))},s=function(){this.passwordUserAuthMethod=new is((()=>{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})),nE=Pi((e=>{var t,n,o;return o=class extends(ji(zw,U$,Hw,aw)(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 Ji((()=>{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})),oE="widget-flow",rE=Pi((e=>{var t,n,o;return o=class extends(ji(V$,aw,zw,U$)(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=Jw(oE);r&&(function(e){if(window.history.replaceState&&Jw(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())}}(oE),h(this,t,"m",n).call(this,r))}))}},t=new WeakSet,n=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(Gw({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl}));const n=new ss((()=>{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})),iE=Pi((e=>class extends(ji(J$,lw,rE,Zw,Xw,Yw,Qw,eE,tE,nE)(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)}))}})),sE=ji((e=>class extends(iE(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),Si.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.34"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",sE);var aE=Object.freeze({__proto__:null,default:sE});const dE=(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 cE,lE,uE,hE,pE,fE,gE,mE,vE,yE;const bE=document.createElement("template");bE.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 $E extends HTMLElement{constructor(){super(),cE.add(this),lE.set(this,new br({messages:[]})),uE.set(this,void 0),hE.set(this,void 0),pE.set(this,void 0),fE.set(this,{resize:h(this,cE,"m",yE).bind(this)}),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(bE.content.cloneNode(!0)),p(this,uE,this.shadowRoot.querySelector(".debugger"),"f"),p(this,hE,h(this,uE,"f").querySelector(".content"),"f"),p(this,pE,h(this,uE,"f").querySelector(".header"),"f")}updateData(e){h(this,lE,"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]=dE(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,uE,"f"),h(this,pE,"f"),{top:"all",bottom:100,left:100,right:100}),window.addEventListener("resize",h(this,fE,"f").resize),(e=h(this,uE,"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,uE,"f").onresize=h(this,cE,"m",vE).bind(this),h(this,lE,"f").subscribe(h(this,cE,"m",gE).bind(this))}disconnectedCallback(){h(this,lE,"f").unsubscribeAll(),window.removeEventListener("resize",h(this,fE,"f").resize)}}lE=new WeakMap,uE=new WeakMap,hE=new WeakMap,pE=new WeakMap,fE=new WeakMap,cE=new WeakSet,gE=function(e){h(this,cE,"m",mE).call(this,e),h(this,cE,"m",vE).call(this)},mE=function(e){h(this,hE,"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("")},vE=function(){h(this,hE,"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)}))},yE=function(){const[e,t]=dE(h(this,uE,"f"),Number.parseInt(h(this,uE,"f").style.left,10),Number.parseInt(h(this,uE,"f").style.top,10),{top:"all",bottom:100,left:100,right:100});h(this,uE,"f").style.top=`${t}px`,h(this,uE,"f").style.left=`${e}px`},customElements.get("descope-debugger")||customElements.define("descope-debugger",$E);var wE=Object.freeze({__proto__:null,default:$E});e.AccessKeyManagement=$o,e.AuditManagement=Eo,e.AuthProvider=({projectId:e,baseUrl:n="",sessionTokenViaCookie:s=!1,persistTokens:d=!0,storeLastAuthenticatedUser:c=!0,children:l})=>{const[u,h]=t.useState(),[p,f]=t.useState(),[g,m]=t.useState(!1),[v,y]=t.useState(!1),b=(({projectId:e,baseUrl:n,persistTokens:o,sessionTokenViaCookie:r,storeLastAuthenticatedUser:i})=>t.useMemo((()=>{if(e)return so({projectId:e,baseUrl:n,sessionTokenViaCookie:r,baseHeaders:a,persistTokens:o,storeLastAuthenticatedUser:i,autoRefresh:!0})}),[e,n,r]))({projectId:e,baseUrl:n,persistTokens:d,sessionTokenViaCookie:s,storeLastAuthenticatedUser:c});t.useEffect((()=>{if(b){const e=b.onSessionTokenChange(f),t=b.onUserChange(h);return()=>{e(),t()}}}),[b]);const $=t.useRef(!1),w=t.useCallback((()=>{$.current||($.current=!0,y(!0),i(null==b?void 0:b.refresh)().then((()=>{y(!1)})))}),[b]),E=t.useCallback((()=>{m(!0),i(b.me)().then((()=>{m(!1)}))}),[b]),k=t.useMemo((()=>({fetchUser:E,user:u,isUserLoading:g,fetchSession:w,session:p,isSessionLoading:v,isSessionFetched:$.current,projectId:e,baseUrl:n,storeLastAuthenticatedUser:c,setUser:h,setSession:f,sdk:b})),[E,u,g,w,p,v,$.current,e,n,h,f,b]);return o.default.createElement(r.Provider,{value:k},l)},e.Descope=fo,e.RoleManagement=yo,e.SignInFlow=e=>o.default.createElement(fo,Object.assign({},e,{flowId:"sign-in"})),e.SignUpFlow=e=>o.default.createElement(fo,Object.assign({},e,{flowId:"sign-up"})),e.SignUpOrInFlow=e=>o.default.createElement(fo,Object.assign({},e,{flowId:"sign-up-or-in"})),e.UserManagement=mo,e.UserProfile=Co,e.baseHeaders=a,e.getJwtPermissions=uo,e.getJwtRoles=ho,e.getRefreshToken=lo,e.getSessionToken=co,e.isRefreshTokenExpired=(e=lo())=>null==io?void 0:io.isJwtExpired(e),e.isSessionTokenExpired=(e=co())=>null==io?void 0:io.isJwtExpired(e),e.refresh=(e=lo())=>null==io?void 0:io.refresh(e),e.useDescope=()=>{const{sdk:e}=xo();return t.useMemo((()=>e||new Proxy(ao(),So)),[e])},e.useSession=()=>{const{session:e,isSessionLoading:n,fetchSession:o,isSessionFetched:r}=xo(),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}=xo(),[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
|