chordia-ui 3.3.9 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- "use strict";const s=require("react/jsx-runtime"),g=require("react"),Ce=require("lucide-react");require("./colors.cjs.js");const Qn=g.createContext(void 0),Cn=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)},er=()=>typeof window<"u"&&!!window.descopeBridge,ot={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.27.1"},On=typeof window<"u";var rt=function(){return rt=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},rt.apply(this,arguments)};function q(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,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 tr(e,t,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(u){try{d(o.next(u))}catch(p){a(p)}}function l(u){try{d(o.throw(u))}catch(p){a(p)}}function d(u){u.done?i(u.value):r(u.value).then(c,l)}d((o=o.apply(e,t||[])).next())})}function nr(e,t,n){if(n||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}function or(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)}function rr(e,t,n,o,r){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n}class Me extends Error{}Me.prototype.name="InvalidTokenError";function ir(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function sr(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ir(t)}catch{return atob(t)}}function Jt(e,t){if(typeof e!="string")throw new Me("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Me(`Invalid token specified: missing part #${n+1}`);let r;try{r=sr(o)}catch(i){throw new Me(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(r)}catch(i){throw new Me(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var w={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const Gn="<region>",ar=`https://api.${Gn}descope.com`,An=1e3,Un=6e5,Zn="dct",En=()=>{const e={};return{headers(t){const n=typeof t.entries=="function"?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap(t=>e[t]?[`${t!=="Title"?`${t}: `:""}${e[t]}`]:[]).join(`
2
- `)}},lr=[503,521,522,524,530],Tn=[100,5e3,5e3],cr=e=>new Promise(t=>setTimeout(t,e)),Dn=e=>async(...t)=>{let n=await e(...t),o=0;for(;lr.includes(n.status)&&o<Tn.length;)await cr(Tn[o]),n=await e(...t),o++;o>0&&(n.retries=o);const r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n},dr=(e,t)=>{const n=t||fetch;return n||e==null||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(...o)=>{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((i=>En().title("Request").url(i[0]).method(i[1].method).headers(i[1].headers).body(i[1].body).build())(o));const r=await Dn(n)(...o);return e[r.ok?"log":"error"](await(async i=>{const a=await i.text();return En().title("Response").url(i.url.toString()).status(`${i.status} ${i.statusText}`).headers(i.headers).body(a).retries(i.retries).build()})(r)),r}:Dn(n)};let Ge;const ur=()=>{if(Ge)return Ge;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return Ge=`${t}-${n}`,Ge};var Se;(function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"})(Se||(Se={}));const Pn=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(Gn,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${e==null?void 0:e.replace(/^\//,"")}`:t;if(n){const a=Object.keys(n);a.forEach((c,l)=>{i=`${i}${l===0?"?":""}${c}=${encodeURIComponent(n[c])}${l===a.length-1?"":"&"}`})}return i},pr=(...e)=>new Headers(e.reduce((t,n)=>((o=>Array.isArray(o)?o:o instanceof Headers?Array.from(o.entries()):o?Object.entries(o):[])(n).forEach(([o,r])=>{t[o]=typeof r=="function"?r():r}),t),{})),gr={"Content-Type":"application/json"},hr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},fr=(e,t)=>{const n={"x-descope-sdk-session-id":ur(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.58.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},vr=e=>{try{e=JSON.parse(e)}catch{return!1}return typeof e=="object"&&e!==null};var mr=(e=>t=>{var n;return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:o=>{var r;const i=[].concat(((r=t.hooks)===null||r===void 0?void 0:r.beforeRequest)||[]);return i==null?void 0:i.reduce((a,c)=>c(a),o)},afterRequest:async(o,r)=>{var i;const a=[].concat(((i=t.hooks)===null||i===void 0?void 0:i.afterRequest)||[]);a.length!=0&&(await Promise.allSettled(a==null?void 0:a.map(c=>c(o,r==null?void 0:r.clone())))).forEach(c=>{var l;return c.status==="rejected"&&((l=t.logger)===null||l===void 0?void 0:l.error(c.reason))})},transformResponse:(n=t.hooks)===null||n===void 0?void 0:n.transformResponse}}))})(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:o,logger:r,hooks:i,cookiePolicy:a,fetch:c})=>{const l=e||ar,d=dr(r,c),u=async p=>{var v;const k=i!=null&&i.beforeRequest?i.beforeRequest(p):p,{path:h,body:y,headers:x,queryParams:U,method:A,token:R}=k,T=(z=>z===void 0?void 0:JSON.stringify(z))(y),m={headers:pr(hr(t,R),fr(t,o),(n==null?void 0:n.baseHeaders)||{},vr(T)?gr:{},x),method:A,body:T};a!==null&&(m.credentials=a||"include");const C=await d(Pn({path:h,baseUrl:l,queryParams:U,projectId:t}),m);if(i!=null&&i.afterRequest&&await i.afterRequest(p,C==null?void 0:C.clone()),i==null?void 0:i.transformResponse){const z=await C.json(),K=(((v=C.headers)===null||v===void 0?void 0:v.get("set-cookie"))||"").split(";").reduce((Z,B)=>{const[V,Y]=B.split("=");return Object.assign(Object.assign({},Z),{[V.trim()]:Y})},{}),G=Object.assign(Object.assign({},C),{json:()=>Promise.resolve(z),cookies:K});return G.clone=()=>G,i.transformResponse(G)}return C};return{get:(p,{headers:v,queryParams:k,token:h}={})=>u({path:p,headers:v,queryParams:k,body:void 0,method:Se.get,token:h}),post:(p,v,{headers:k,queryParams:h,token:y}={})=>u({path:p,headers:k,queryParams:h,body:v,method:Se.post,token:y}),patch:(p,v,{headers:k,queryParams:h,token:y}={})=>u({path:p,headers:k,queryParams:h,body:v,method:Se.patch,token:y}),put:(p,v,{headers:k,queryParams:h,token:y}={})=>u({path:p,headers:k,queryParams:h,body:v,method:Se.put,token:y}),delete:(p,{headers:v,queryParams:k,token:h}={})=>u({path:p,headers:v,queryParams:k,body:void 0,method:Se.delete,token:h}),hooks:i,buildUrl:(p,v)=>Pn({projectId:t,baseUrl:l,path:p,queryParams:v})}}),yr={TOO_MANY_REQUESTS:429};function _n(e,t,n){var o;let r=at(e);if(t){if(!(r!=null&&r.tenants)&&(r==null?void 0:r[Zn])===t)return(r==null?void 0:r[n])||[];r=(o=r==null?void 0:r.tenants)===null||o===void 0?void 0:o[t]}const i=r==null?void 0:r[n];return Array.isArray(i)?i:[]}function at(e){if(typeof e!="string"||!e)throw new Error("Invalid token provided");return Jt(e)}function xr(e){const{exp:t}=at(e);return new Date().getTime()/1e3>t}function wr(e){let t=at(e);const n=Object.keys(t==null?void 0:t.tenants);return Array.isArray(n)?n:[]}function br(e,t){return _n(e,t,"permissions")}function kr(e,t){return _n(e,t,"roles")}const se=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function b(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===yr.TOO_MANY_REQUESTS&&Object.assign(r.error,{retryAfter:Number.parseInt((n=o.headers)===null||n===void 0?void 0:n.get("retry-after"))||0})),r}function Ir(e){var t;return((t=at(e))===null||t===void 0?void 0:t[Zn])||""}const be=(e,t)=>(n=t)=>o=>!e(o)&&n.replace("{val}",o),eo=(e,t)=>(n=t)=>o=>{const r=e.filter(i=>i(o));return!(r.length<e.length)&&(n?n.replace("{val}",o):r.join(" OR "))},to=(...e)=>({validate:t=>(e.forEach(n=>{const o=n(t);if(o)throw new Error(o)}),!0)}),no=e=>t=>e.test(t),jr=no(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Sr=no(/^\+[1-9]{1}[0-9]{3,14}$/),Cr=(e,t)=>n=>to(...t).validate(((o,r,i)=>{const a=(Array.isArray(r)?r.join("."):String(r)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,(u,p,v)=>"."+v).split("."),c=a.length;let l=0,d=o===Object(o)?o:void 0;for(;d!=null&&l<c;)d=d[a[l++]];return l&&l===c&&d!==void 0?d:i})(n,e)),Or=be(jr,'"{val}" is not a valid email'),Ar=be(Sr,'"{val}" is not a valid phone number'),Ur=be((Rn=1,e=>e.length>=Rn),"Minimum length is 1");var Rn;const Re=be(e=>typeof e=="string","Input is not a string"),Er=be(e=>Array.isArray(e),"Input is not an array"),Tr=be(e=>typeof e=="boolean","Input is not a boolean"),Dr=be(e=>e===void 0,"Input is defined"),Dt=eo([Re(),Dr()],"Input is not a string or undefined"),Pr=eo([Er(),Tr()],"Input is not an array or boolean"),E=(...e)=>t=>(...n)=>(e.forEach((o,r)=>to(...o).validate(n[r])),t(...n)),oo=e=>[Re(`"${e}" must be a string`)],ro=e=>[Dt(`"${e}" must be string or undefined`)],N=e=>[Re(`"${e}" must be a string`),Ur(`"${e}" must not be empty`)],Mt=e=>[Re(`"${e}" must be a string`),Or()],io=e=>[Re(`"${e}" must be a string`),Ar()],Rr=E(N("accessKey")),Nr=e=>({exchange:Rr((t,n)=>b(e.post(w.accessKey.exchange,{loginOptions:n},{token:t})))}),Be=(e,t,n)=>(t.forEach(o=>{const r=o.split(".");let i=r.shift(),a=e;for(;r.length>0;){if(a=a[i],!i||!a)throw Error(`Invalid path "${o}", "${i}" is missing or has no value`);i=r.shift()}if(typeof a[i]!="function")throw Error(`"${o}" is not a function`);const c=a[i];a[i]=n(c)}),e),so=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||An,An),timeoutMs:Math.min(t||Un,Un)});var we,Pt;(function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"})(we||(we={})),function(e){e.email="email"}(Pt||(Pt={}));const he=Object.assign(Object.assign({},we),Pt);var Nn;(function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"})(Nn||(Nn={}));const ao=N("loginId"),Fr=E(N("token")),bt=E(ao),Lr=E(N("pendingRef")),zr=E(ao,Mt("email")),Br=e=>({verify:Fr(t=>b(e.post(w.enchantedLink.verify,{token:t}))),signIn:bt((t,n,o={},r)=>{var{providerId:i}=o,a=q(o,["providerId"]);return b(e.post(se(w.enchantedLink.signIn,he.email),{loginId:t,URI:n,loginOptions:a,providerId:i},{token:r}))}),signUpOrIn:bt((t,n,o={})=>{var{providerId:r}=o,i=q(o,["providerId"]);return b(e.post(se(w.enchantedLink.signUpOrIn,he.email),{loginId:t,URI:n,loginOptions:i,providerId:r}))}),signUp:bt((t,n,o,r={})=>{var{providerId:i}=r,a=q(r,["providerId"]);return b(e.post(se(w.enchantedLink.signUp,he.email),{loginId:t,URI:n,user:o,loginOptions:a,providerId:i}))}),waitForSession:Lr((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=so(n);let a;const c=setInterval(async()=>{const l=await e.post(w.enchantedLink.session,{pendingRef:t});l.ok&&(clearInterval(c),a&&clearTimeout(a),o(b(Promise.resolve(l))))},r);a=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)})),update:{email:zr((t,n,o,r,i)=>b(e.post(w.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))}}),qr=E(N("flowId")),Hr=E(N("executionId"),N("stepId"),N("interactionId")),Jr=e=>({start:qr((t,n,o,r,i,a,c,l=!1)=>b(e.post(w.flow.start,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,componentsVersion:i,flowVersions:a,input:c,isCustomScreen:l}))),next:Hr((t,n,o,r,i,a,c=!1)=>b(e.post(w.flow.next,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:a,isCustomScreen:c})))}),Wt=N("loginId"),Mr=E(N("token")),kt=E(Wt),Wr=E(Wt,io("phone")),Kr=E(Wt,Mt("email")),It=Object.keys(he).filter(e=>e!==we.voice&&e!==we.im),Vr=e=>({verify:Mr(t=>b(e.post(w.magicLink.verify,{token:t}))),signIn:It.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:kt((o,r,i={},a)=>{var{providerId:c}=i,l=q(i,["providerId"]);return b(e.post(se(w.magicLink.signIn,n),{loginId:o,URI:r,loginOptions:l,providerId:c},{token:a}))})}),{}),signUp:It.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:kt((o,r,i,a={})=>{var{providerId:c}=a,l=q(a,["providerId"]);return b(e.post(se(w.magicLink.signUp,n),{loginId:o,URI:r,user:i,loginOptions:l,providerId:c}))})}),{}),signUpOrIn:It.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:kt((o,r,i={})=>{var{providerId:a}=i,c=q(i,["providerId"]);return b(e.post(se(w.magicLink.signUpOrIn,n),{loginId:o,URI:r,loginOptions:c,providerId:a}))})}),{}),update:{email:Kr((t,n,o,r,i)=>b(e.post(w.magicLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))),phone:Object.keys(we).filter(t=>t!==we.voice).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Wr((o,r,i,a,c)=>b(e.post(se(w.magicLink.update.phone,n),Object.assign({loginId:o,phone:r,URI:i},c),{token:a})))}),{})}});var Rt;(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"})(Rt||(Rt={}));const $r=E(N("code")),Yr=e=>({start:Object.assign((t,n,o,r,i)=>b(e.post(w.oauth.start,o||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),i&&{loginHint:i}),token:r})),Object.keys(Rt).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:(o,r,i,a)=>b(e.post(w.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},o&&{redirectURL:o}),a&&{loginHint:a}),token:i}))}),{})),exchange:$r(t=>b(e.post(w.oauth.exchange,{code:t}))),startNative:(t,n,o)=>b(e.post(w.oauth.startNative,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>b(e.post(w.oauth.finishNative,{provider:t,stateId:n,user:o,code:r,idToken:i})),getOneTapClientId:t=>b(e.get(w.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,o,r)=>b(e.post(w.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r})),exchangeOneTapIDToken:(t,n,o,r)=>b(e.post(w.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r}))}),Xr=N("appId"),Qr=E(Xr),Gr=e=>({connect:Qr((t,n,o)=>{const r=n==null?void 0:n.tenantId,i=n==null?void 0:n.tenantLevel;return n==null||delete n.tenantId,n==null||delete n.tenantLevel,b(e.post(w.outbound.connect,{appId:t,tenantId:r,tenantLevel:i,options:n},{token:o}))})}),lt=N("loginId"),Zr=E(lt,N("code")),jt=E(lt),_r=E(lt,io("phone")),ei=E(lt,Mt("email")),ti=e=>({verify:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Zr((o,r)=>b(e.post(se(w.otp.verify,n),{code:r,loginId:o})))}),{}),signIn:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:jt((o,r={},i)=>{var{providerId:a}=r,c=q(r,["providerId"]);return b(e.post(se(w.otp.signIn,n),{loginId:o,loginOptions:c,providerId:a},{token:i}))})}),{}),signUp:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:jt((o,r,i={})=>{var{providerId:a}=i,c=q(i,["providerId"]);return b(e.post(se(w.otp.signUp,n),{loginId:o,user:r,loginOptions:c,providerId:a}))})}),{}),signUpOrIn:Object.keys(he).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:jt((o,r={})=>{var{providerId:i}=r,a=q(r,["providerId"]);return b(e.post(se(w.otp.signUpOrIn,n),{loginId:o,loginOptions:a,providerId:i}))})}),{}),update:{email:ei((t,n,o,r)=>b(e.post(w.otp.update.email,Object.assign({loginId:t,email:n},r),{token:o}))),phone:Object.keys(we).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:_r((o,r,i,a)=>b(e.post(se(w.otp.update.phone,n),Object.assign({loginId:o,phone:r},a),{token:i})))}),{})}}),ni=E(N("tenant")),oi=E(N("code")),ri=e=>({start:ni((t,n,o,r,i,a,c,l)=>b(e.post(w.saml.start,o||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i}),a&&{forceAuthn:"true"}),c&&{loginHint:c}),l&&{initiatedEmail:t})},r&&{token:r})))),exchange:oi(t=>b(e.post(w.saml.exchange,{code:t})))}),Kt=N("loginId"),ii=E(Kt,N("code")),si=E(Kt),ai=E(Kt),li=e=>({signUp:si((t,n)=>b(e.post(w.totp.signUp,{loginId:t,user:n}))),verify:ii((t,n,o,r)=>b(e.post(w.totp.verify,{loginId:t,code:n,loginOptions:o},{token:r}))),update:ai((t,n)=>b(e.post(w.totp.update,{loginId:t},{token:n})))}),ct=N("loginId"),lo=N("newPassword"),Fn=E(ct,N("password")),ci=E(ct),di=E(ct,lo),ui=E(ct,N("oldPassword"),lo),pi=e=>({signUp:Fn((t,n,o,r={})=>{var{providerId:i}=r,a=q(r,["providerId"]);return b(e.post(w.password.signUp,{loginId:t,password:n,user:o,loginOptions:a,providerId:i}))}),signIn:Fn((t,n,o={})=>{var{providerId:r}=o,i=q(o,["providerId"]);return b(e.post(w.password.signIn,{loginId:t,password:n,loginOptions:i,providerId:r}))}),sendReset:ci((t,n,o)=>b(e.post(w.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:o}))),update:di((t,n,o)=>b(e.post(w.password.update,{loginId:t,newPassword:n},{token:o}))),replace:ui((t,n,o)=>b(e.post(w.password.replace,{loginId:t,oldPassword:n,newPassword:o}))),policy:()=>b(e.get(w.password.policy))}),gi=oo("loginId"),Vt=N("loginId"),dt=N("origin"),hi=E(Vt,dt,N("name")),fi=E(Vt,dt),vi=E(gi,dt),mi=E(Vt,dt,ro("token")),St=E(N("transactionId"),N("response")),yi=e=>({signUp:{start:hi((t,n,o,r)=>b(e.post(w.webauthn.signUp.start,{user:{loginId:t,name:o},origin:n,passkeyOptions:r}))),finish:St((t,n)=>b(e.post(w.webauthn.signUp.finish,{transactionId:t,response:n})))},signIn:{start:vi((t,n,o,r,i)=>b(e.post(w.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:o,passkeyOptions:i},{token:r}))),finish:St((t,n)=>b(e.post(w.webauthn.signIn.finish,{transactionId:t,response:n})))},signUpOrIn:{start:fi((t,n,o)=>b(e.post(w.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:o})))},update:{start:mi((t,n,o,r)=>b(e.post(w.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:o}))),finish:St((t,n)=>b(e.post(w.webauthn.update.finish,{transactionId:t,response:n})))}}),xi=oo("loginId"),Ct=E(xi),wi=E(N("pendingRef")),bi=e=>({signUpOrIn:Ct((t,n={})=>{var{providerId:o}=n,r=q(n,["providerId"]);return b(e.post(w.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:o}))}),signUp:Ct((t,n,o={})=>{var{providerId:r}=o,i=q(o,["providerId"]);return b(e.post(w.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:i}))}),signIn:Ct((t,n={},o)=>{var{providerId:r}=n,i=q(n,["providerId"]);return b(e.post(w.notp.signIn,{loginId:t,loginOptions:i,providerId:r},{token:o}))}),waitForSession:wi((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=so(n);let a;const c=setInterval(async()=>{const l=await e.post(w.notp.session,{pendingRef:t});l.ok&&(clearInterval(c),a&&clearTimeout(a),o(b(Promise.resolve(l))))},r);a=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)}))}),qe=E(N("token")),He=E(ro("token"));var Ln,zn,ki=E([(Ln="projectId",zn=N("projectId"),be(Cr(Ln,zn))())])(e=>{const{projectId:t,logger:n,baseUrl:o,cookiePolicy:r,baseHeaders:i={},refreshCookieName:a,fetch:c}=e;return l=mr({baseUrl:o,projectId:t,logger:n,hooks:{get beforeRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.beforeRequest},get afterRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.afterRequest},get transformResponse(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:i},refreshCookieName:a,fetch:c}),{accessKey:Nr(l),otp:ti(l),magicLink:Vr(l),enchantedLink:Br(l),oauth:Yr(l),outbound:Gr(l),saml:ri(l),totp:li(l),notp:bi(l),webauthn:yi(l),password:pi(l),flow:Jr(l),refresh:He((d,u,p,v)=>{const k={};p&&(k.externalToken=p);const h=v?w.tryRefresh:w.refresh;return b(l.post(h,k,{token:d,queryParams:u}))}),selectTenant:E([Re("tenantId")],[Dt('"token" must be string or undefined')])((d,u)=>b(l.post(w.selectTenant,{tenant:d},{token:u}))),logout:He(d=>b(l.post(w.logout,{},{token:d}))),logoutAll:He(d=>b(l.post(w.logoutAll,{},{token:d}))),me:He(d=>b(l.get(w.me,{token:d}))),myTenants:E([Pr('"tenants" must a string array or a boolean')],[Dt('"token" must be string or undefined')])((d,u)=>{const p={};return typeof d=="boolean"?p.dct=d:p.ids=d,b(l.post(w.myTenants,p,{token:u}))}),history:He(d=>b(l.get(w.history,{token:d}))),isJwtExpired:qe(xr),getTenants:qe(wr),getJwtPermissions:qe(br),getJwtRoles:qe(kr),getCurrentTenant:qe(Ir),httpClient:l};var l}),Ii=Object.assign(ki,{DeliveryMethods:he});/*! js-cookie v3.0.5 | MIT */function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var ji={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)}};function Nt(e,t){function n(r,i,a){if(!(typeof document>"u")){a=Ze({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var l in a)a[l]&&(c+="; "+l,a[l]!==!0&&(c+="="+a[l].split(";")[0]));return document.cookie=r+"="+e.write(i,r)+c}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var i=document.cookie?document.cookie.split("; "):[],a={},c=0;c<i.length;c++){var l=i[c].split("="),d=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(a[u]=e.read(d,u),r===u)break}catch{}}return r?a[r]:a}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",Ze({},i,{expires:-1}))},withAttributes:function(r){return Nt(this.converter,Ze({},this.attributes,r))},withConverter:function(r){return Nt(Ze({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Pe=Nt(ji,{path:"/"});function Si(e,t){return function(n,o){return Object.prototype.hasOwnProperty.call(n,o)}(e,t)?e[t]:void 0}function Ci(e,t,n,o){var r,i=document,a="securitypolicyviolation",c=function(d){var u=new URL(e,location.href),p=d.blockedURI;p!==u.href&&p!==u.protocol.slice(0,-1)&&p!==u.origin||(r=d,l())};i.addEventListener(a,c);var l=function(){return i.removeEventListener(a,c)};return o==null||o.then(l,l),Promise.resolve().then(t).then(function(d){return l(),d},function(d){return new Promise(function(u){var p=new MessageChannel;p.port1.onmessage=function(){return u()},p.port2.postMessage(null)}).then(function(){if(l(),r)return n(r);throw d})})}var Oi={default:"endpoint"},co="Blocked by CSP",uo="The endpoint parameter is not a valid URL",Ai="API key required",Ui="3.11.6",$t="Failed to load the JS script of the agent",Yt="9319";function Ei(e,t){var n,o,r,i,a,c,l,d=[],u=(n=function(h){var y=nr([],h,!0);return{current:function(){return y[0]},postpone:function(){var x=y.shift();x!==void 0&&y.push(x)},exclude:function(){y.shift()}}}(e),i=100,a=3e3,c=0,o=function(){return Math.random()*Math.min(a,i*Math.pow(2,c++))},r=new Set,[n.current(),function(h,y){var x,U=y instanceof Error?y.message:"";if(U===co||U===uo)n.exclude(),x=0;else if(U===Yt)n.exclude();else if(U===$t){var A=Date.now()-h.getTime()<50,R=n.current();R&&A&&!r.has(R)&&(r.add(R),x=0),n.postpone()}else n.postpone();var T=n.current();return T===void 0?void 0:[T,x??h.getTime()+o()-Date.now()]}]),p=u[0],v=u[1];if(p===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var k=function(h){var y=new Date,x=function(A){return d.push({url:h,startedAt:y,finishedAt:new Date,error:A})},U=t(h);return U.then(function(){return x()},x),U.catch(function(A){if(l!=null||(l=A),d.length>=5)throw l;var R=v(y,A);if(!R)throw l;var T,m=R[0],C=R[1];return(T=C,new Promise(function(z){return setTimeout(z,T)})).then(function(){return k(m)})})};return k(p).then(function(h){return[h,d]})}var po="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Ti=po;function Di(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=o===void 0?n:o,i=q(e,["scriptUrlPattern","token","apiKey"]),a=(t=Si(e,"scriptUrlPattern"))!==null&&t!==void 0?t:po,c=function(){var u=[],p=function(){u.push({time:new Date,state:document.visibilityState})},v=function(k,h,y,x){return k.addEventListener(h,y,x),function(){return k.removeEventListener(h,y,x)}}(document,"visibilitychange",p);return p(),[u,v]}(),l=c[0],d=c[1];return Promise.resolve().then(function(){if(!r||typeof r!="string")throw new Error(Ai);var u=function(p,v){return(Array.isArray(p)?p:[p]).map(function(k){return function(h,y){var x=encodeURIComponent;return h.replace(/<[^<>]+>/g,function(U){return U==="<version>"?"3":U==="<apiKey>"?x(y):U==="<loaderVersion>"?x(Ui):U})}(String(k),v)})}(a,r);return Ei(u,Pi)}).catch(function(u){throw d(),function(p){return p instanceof Error&&p.message===Yt?new Error($t):p}(u)}).then(function(u){var p=u[0],v=u[1];return d(),p.load(rt(rt({},i),{ldi:{attempts:v,visibilityStates:l}}))})}function Pi(e){return Ci(e,function(){return function(t){return new Promise(function(n,o){if(function(c){if(URL.prototype)try{return new URL(c,location.href),!1}catch(l){if(l instanceof Error&&l.name==="TypeError")return!0;throw l}}(t))throw new Error(uo);var r=document.createElement("script"),i=function(){var c;return(c=r.parentNode)===null||c===void 0?void 0:c.removeChild(r)},a=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),n()},r.onerror=function(){i(),o(new Error($t))},r.async=!0,r.src=t,a.appendChild(r)})}(e)},function(){throw new Error(co)}).then(Ri)}function Ri(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(o,r){var i,a=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,o,r);a!=null&&a.configurable?delete o[r]:a&&!a.writable||(o[r]=void 0)}(e,t),typeof(n==null?void 0:n.load)!="function")throw new Error(Yt);return n}const go="3.2.0",ee=typeof window<"u",Ot=Math.pow(2,31)-1,Ni=`https://descopecdn.com/npm/oidc-client-ts@${go}/dist/browser/oidc-client-ts.min.js`,Fi=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${go}/dist/browser/oidc-client-ts.min.js`,Li=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let ue;const ho=e=>{try{return Jt(e).exp}catch{return null}},zi=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:ho(n)},Bi=e=>{const{expires_in:t,expires_at:n,access_token:o}=e;return n||(t?Math.floor(Date.now()/1e3)+t:o?ho(o):void 0)},fo=e=>{const{access_token:t,id_token:n,refresh_token:o,refresh_expire_in:r}=e,i=q(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||o,sessionExpiration:e.sessionExpiration||Bi(e),cookieExpiration:e.cookieExpiration||zi(e)},i)},Ue=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce((o,r)=>{var i;return o[r]=[].concat(((i=e.hooks)===null||i===void 0?void 0:i[r])||[]).concat((t==null?void 0:t[r])||[]),o},(n=e.hooks)!==null&&n!==void 0?n:e.hooks={}),e},_e=async e=>{if(!(e!=null&&e.ok))return{};const t=await(e==null?void 0:e.clone().json()),n=(t==null?void 0:t.authInfo)||t||{};return fo(n)},Ft=()=>ee&&!!window.descopeBridge,At=(e,t)=>{if(!((t==null?void 0:t.status)>=400&&(t==null?void 0:t.status)<500))return!1;const n=(e==null?void 0:e.path)||"";return Li.includes(n)},qi=ue!==void 0||ee&&window.localStorage!==void 0,de=(e,t)=>{var n,o;return(o=(n=ue||ee&&window.localStorage)===null||n===void 0?void 0:n.setItem)===null||o===void 0?void 0:o.call(n,e,t)},le=e=>{var t,n;return(n=(t=ue||ee&&window.localStorage)===null||t===void 0?void 0:t.getItem)===null||n===void 0?void 0:n.call(t,e)},oe=e=>{var t,n;return(n=(t=ue||ee&&window.localStorage)===null||t===void 0?void 0:t.removeItem)===null||n===void 0?void 0:n.call(t,e)},Hi=e=>{var t,n,o,r,i;return(i=(n=(t=ue==null?void 0:ue.key)===null||t===void 0?void 0:t.call(ue,e))!==null&&n!==void 0?n:ee&&((r=(o=window.localStorage)===null||o===void 0?void 0:o.key)===null||r===void 0?void 0:r.call(o,e)))!==null&&i!==void 0?i:null},J=(...e)=>{console.debug(...e)},et=(...e)=>{console.warn(...e)},Ji=(e,t)=>{let n;var o;return t>0?(n=1e3*t,J(`Using provided nextRefreshSeconds: ${t}s`)):n=((o=e)?o.getTime()-new Date().getTime():0)-2e4,n>Ot&&(J(`Timeout is too large (${n}ms), setting it to ${Ot}ms`),n=Ot),n},ut="DS",Ve="DSR",Xt="DSI",it="DSRCN";function Bn(e,t,n){if(t){const{cookieDomain:o,cookiePath:r,cookieSameSite:i,cookieExpiration:a,cookieSecure:c}=n,l=new Date(1e3*a),d=Lt(o);Pe.set(e,t,{path:r,domain:d?o:void 0,expires:l,sameSite:i,secure:c})}}function Lt(e){const t=window.location.hostname.split("."),n=e==null?void 0:e.split(".");return t.slice(-(n==null?void 0:n.length)).join(".")===e}const Qt=e=>(e==null?void 0:e.cookieName)||ut,st=e=>(e==null?void 0:e.cookieName)||Ve;function Te(e="",t){return Pe.get(st(t))||le(`${e}${Ve}`)||""}function qn(e="",t){return Pe.get(Qt(t))||le(`${e}${ut}`)||""}function vo(e=""){return le(`${e}${Xt}`)||""}function mo(e="",t,n,o){oe(`${e}${Ve}`),oe(`${e}${ut}`),oe(`${e}${Xt}`),oe(`${e}${it}`);const r=Qt(t);Pe.remove(r,o==null?void 0:o.session);const i=st(n);Pe.remove(i,o==null?void 0:o.refresh)}const Mi=(e,t,n)=>o=>{const r=Object.assign(o,{token:o.token||Te(e,t)});if(!n){const a=function(c=""){return le(`${c}${it}`)}(e);a&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":a}))}const i=function(a=""){return le(`${a}DTD`)||""}(e);return i&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":i})),r},Wi=ee&&(localStorage==null?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",Ki="vsid",Vi="vrid",Gt="fp",yo=(e=!1)=>{const t=le(Gt);if(!t)return null;const n=JSON.parse(t);return new Date().getTime()>n.expiry&&!e?null:n.value},xo=async(e,t=Wi)=>{try{if(yo())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>",a=Di({apiKey:e,endpoint:[o.toString(),Oi],scriptUrlPattern:[i,Ti]}),c=await a,{requestId:l}=await c.get({linkedId:n}),d=((u,p)=>({[Ki]:u,[Vi]:p}))(n,l);(u=>{const p={value:u,expiry:new Date().getTime()+864e5};de(Gt,JSON.stringify(p))})(d)}catch(n){console.warn("Could not load fingerprint",n)}},$i=()=>{oe(Gt)},Yi=e=>{const t=yo(!0);return t&&e.body&&(e.body.fpData=t),e},De="descopeFlowNonce",Hn="X-Descope-Flow-Nonce",Jn="/v1/flow/start",zt="/v1/flow/next",Bt=(e,t=De)=>`${t}${e}`,Xi=(e,t=De)=>{try{const n=Bt(e,t);oe(n)}catch(n){console.error("Error removing flow nonce:",n)}},wo=e=>{var t;return((t=/.*\|#\|(.*)/.exec(e))===null||t===void 0?void 0:t[1])||null},Mn=e=>{var t;return e.path===zt&&(!((t=e.body)===null||t===void 0)&&t.executionId)?wo(e.body.executionId):null},Zt="dls_last_user_login_id",_t="dls_last_user_display_name",Wn=e=>de(Zt,e),qt=()=>le(Zt),Ht=()=>le(_t),Qi=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=qt(),i=Ht();return r&&((n=o.lastAuth)!==null&&n!==void 0||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},Gi=e=>t=>async(...n)=>{const o=await t(...n);return e||(oe(Zt),oe(_t)),o};function tt(){const e=[];return{pub:t=>{e.forEach(n=>n(t))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const Zi=(e,t,n,o)=>r=>async(...i)=>{const a=await r(...i);return mo(e,t,n,o==null?void 0:o()),a};async function nt(e){const t=function(r){var i;const a=JSON.parse(r);return a.publicKey.challenge=Ke(a.publicKey.challenge),a.publicKey.user.id=Ke(a.publicKey.user.id),(i=a.publicKey.excludeCredentials)===null||i===void 0||i.forEach(c=>{c.id=Ke(c.id)}),a}(e);return o=await navigator.credentials.create(t),JSON.stringify({id:o.id,rawId:xe(o.rawId),type:o.type,response:{attestationObject:xe(o.response.attestationObject),clientDataJSON:xe(o.response.clientDataJSON)}});var o}async function Ut(e){const t=ko(e);return Io(await navigator.credentials.get(t))}async function _i(e,t){const n=ko(e);return n.signal=t.signal,n.mediation="conditional",Io(await navigator.credentials.get(n))}async function bo(e=!1){var t,n;if(!ee)return Promise.resolve(!1);if(Ft()){const r=(n=(t=window.descopeBridge)===null||t===void 0?void 0:t.hostInfo)===null||n===void 0?void 0:n.webauthn;if(typeof r=="boolean")return r}const o=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return o&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():o}function ko(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Ke(n.publicKey.challenge),(t=n.publicKey.allowCredentials)===null||t===void 0||t.forEach(o=>{o.id=Ke(o.id)}),n}function Io(e){return JSON.stringify({id:e.id,rawId:xe(e.rawId),type:e.type,response:{authenticatorData:xe(e.response.authenticatorData),clientDataJSON:xe(e.response.clientDataJSON),signature:xe(e.response.signature),userHandle:e.response.userHandle?xe(e.response.userHandle):void 0}})}function Ke(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),n=>n.charCodeAt(0)).buffer}function xe(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Kn,es=(Kn=e=>({async signUp(t,n,o){const r=await e.webauthn.signUp.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await nt(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)},async signIn(t,n){const o=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!o.ok)return o;const r=await Ut(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,r)},async signUpOrIn(t,n){var o;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(!((o=r.data)===null||o===void 0)&&o.create){const i=await nt(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)}{const i=await Ut(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)}},async update(t,n,o){const r=await e.webauthn.update.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await nt(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,i)},helpers:{create:nt,get:Ut,isSupported:bo,conditional:_i}}),(...e)=>{const t=Kn(...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 Vn={config:"/fedcm/config"},ts=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).substring(2)};async function $n(e,t){var n;try{await jo(e,t)}catch(o){(n=t==null?void 0:t.onFailed)===null||n===void 0||n.call(t,o)}}async function jo(e,t){var n,o;const r=await async function(i,a="google",c,l,d){const u=ts(),p=await async function(){return new Promise((h,y)=>{if(window.google)return void h(window.google.accounts.id);let x=document.getElementById("google-gsi-client-script");x||(x=document.createElement("script"),document.head.appendChild(x),x.async=!0,x.defer=!0,x.id="google-gsi-client-script",x.src="https://accounts.google.com/gsi/client"),x.onload=function(){window.google?h(window.google.accounts.id):y("Failed to load Google GSI client script - not loaded properly")},x.onerror=function(){y("Failed to load Google GSI client script - failed to load")}})}(),v=await i.oauth.getOneTapClientId(a);if(!v.ok)throw new Error("Failed to get OneTap client ID for provider "+a);const k=v.data.clientId;return new Promise(h=>{var y,x;const U=A=>{h({provider:a,nonce:u,credential:A==null?void 0:A.credential})};p.initialize(Object.assign(Object.assign({},c),{itp_support:(y=c==null?void 0:c.itp_support)===null||y===void 0||y,use_fedcm_for_prompt:(x=c==null?void 0:c.use_fedcm_for_prompt)===null||x===void 0||x,client_id:k,callback:U,nonce:u})),p.prompt(A=>{var R,T;if(d&&(A!=null&&A.isDismissedMoment())){const m=(R=A.getDismissedReason)===null||R===void 0?void 0:R.call(A);return d==null||d(m),void U()}if(l&&(A!=null&&A.isSkippedMoment())){const m=(T=A.getSkippedReason)===null||T===void 0?void 0:T.call(A);return l==null||l(m),void U()}})})}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(t!=null&&t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);(n=t==null?void 0:t.onCodeReceived)===null||n===void 0||n.call(t,i.data.code)}else{const i=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);(o=t==null?void 0:t.onAuthenticated)===null||o===void 0||o.call(t,i.data)}}var ns=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await bo(),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 os=()=>window.location.search.includes("code")&&window.location.search.includes("state");let Et;const So=(e,t)=>new Promise((n,o)=>{if(!e.length)return o(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const i=e.shift(),a=document.createElement("script");a.src=i,a.id=(c=>{let l=0;for(let d=0;d<c.length;d++)l=(l<<5)-l+c.charCodeAt(d),l|=0;return Math.abs(l).toString(16)})(i),a.onload=()=>{const c=t();if(c)return n(c);throw new Error("Could not get entry after loading script from URL")},a.addEventListener("error",()=>{So(e,t),a.setAttribute("data-error","true")}),document.body.appendChild(a)}),rs=async(e,t,n)=>{Et||(Et=(async()=>{try{return require("oidc-client-ts")}catch{return So([Ni,Fi],()=>window.oidc)}})());const{OidcClient:o,WebStorageStateStore:r}=await Et;if(!o)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const i=(n==null?void 0:n.redirectUri)||window.location.href;let a,c,l,d;if(n!=null&&n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");a=n.issuer,c=n.clientId,l=`${c}_user`,d="openid"}else n!=null&&n.applicationId?(a=e.httpClient.buildUrl(t),a=`${a}/${n.applicationId}`,c=t,l=`${c}_user`,d="openid email roles descope.custom_claims offline_access"):(a=e.httpClient.buildUrl(t),c=t,l=`${c}_user`,d="openid email roles descope.custom_claims offline_access");const u={authority:a,client_id:c,redirect_uri:i,response_type:"code",scope:(n==null?void 0:n.scope)||d,stateStore:new r({store:window.localStorage,prefix:c}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return n!=null&&n.redirectUri&&(u.redirect_uri=n.redirectUri),{client:new o(u),stateUserKey:l}},is=(e,t,n)=>{const o=async()=>{let i,a;return i&&a||({client:i,stateUserKey:a}=await rs(e,t,n)),{client:i,stateUserKey:a}},r=async(i="")=>{var a;const{client:c,stateUserKey:l}=await o(),d=await c.processSigninResponse(i||window.location.href);var u;return await((a=e.httpClient.hooks)===null||a===void 0?void 0:a.afterRequest({},new Response(JSON.stringify(d)))),de(l,JSON.stringify({id_token:(u=d).id_token,session_state:u.session_state,profile:u.profile})),(()=>{const p=new URL(window.location.href);p.searchParams.delete("code"),p.searchParams.delete("state"),window.history.replaceState({},document.title,p.toString())})(),d};return{loginWithRedirect:async(i={},a=!1)=>{const{client:c}=await o(),l=await c.createSigninRequest(i),{url:d}=l;return a||(window.location.href=d),{ok:!0,data:l}},finishLogin:r,finishLoginIfNeed:async(i="")=>{if(os())return await r(i)},refreshToken:async i=>{var a;const{client:c,stateUserKey:l}=await o(),d=(v=>{const k=le(v);return k?JSON.parse(k):null})(l);if(!d)throw new Error("User not found in storage to refresh token");let u=i;if(!u){const v={};e.httpClient.hooks.beforeRequest(v),u=v.token}const p=await c.useRefreshToken({state:{refresh_token:u,session_state:d.session_state,profile:d.profile}});return await((a=e.httpClient.hooks)===null||a===void 0?void 0:a.afterRequest({},new Response(JSON.stringify(p)))),p},logout:async(i,a=!1)=>{const{client:c,stateUserKey:l}=await o();i||(i={}),i.id_token_hint=i.id_token_hint||vo(),i.post_logout_redirect_uri=i.post_logout_redirect_uri||window.location.href;const d=await c.createSignoutRequest(i),{url:u}=d;return oe(l),a||window.location.replace(u),d}}},Co=function(...e){return t=>e.reduce((n,o)=>o(n),t)}(e=>t=>{var n;return n=t.customStorage,ue=n,e(t)},e=>t=>{var{fpKey:n,fpLoad:o}=t,r=q(t,["fpKey","fpLoad"]);return ee?(n&&o&&xo(n).catch(()=>null),e(Ue(r,{beforeRequest:Yi}))):e(r)},e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.47.0"},t.baseHeaders)})),e=>t=>{const n=tt(),o=tt(),r=tt(),i=tt(),a=e(Ue(t,{afterRequest:async(l,d)=>{if(At(l,d))J("Session invalidated, notifying subscribers with empty values"),o.pub(null),r.pub(null),n.pub(null),i.pub(null);else{const u=await(async h=>{const y=await _e(h);return(y==null?void 0:y.user)||(y!=null&&y.hasOwnProperty("userId")?y:void 0)})(d);u&&r.pub(u);const{sessionJwt:p,sessionExpiration:v,claims:k}=await _e(d);p&&o.pub(p),k&&i.pub(k),(v||p)&&n.pub(v||42)}}})),c=Be(a,["logout","logoutAll","oidc.logout"],l=>async(...d)=>{const u=await l(...d);return o.pub(null),r.pub(null),n.pub(null),i.pub(null),u});return Object.assign(c,{onSessionTokenChange:o.sub,onUserChange:r.sub,onClaimsChange:i.sub,onIsAuthenticatedChange:l=>n.sub(d=>{l(!!d)})})},e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:o=De}=t,r=q(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((i=De)=>{try{if(!qi)return;for(let d=0;d<(a=void 0,c=void 0,l=void 0,(l=(a=ue==null?void 0:ue.length)!==null&&a!==void 0?a:ee&&((c=window.localStorage)===null||c===void 0?void 0:c.length))!==null&&l!==void 0?l:0);d++){const u=Hi(d);if(u&&u.startsWith(i)){const p=le(u);if(p)try{JSON.parse(p).expiry<Date.now()&&oe(u)}catch{oe(u)}}}}catch(d){console.error("Error cleaning up expired nonces:",d)}var a,c,l})(o),e(Ue(r,{afterRequest:async(i,a)=>{if(i.path!==Jn&&i.path!==zt)return;const{nonce:c,executionId:l}=await(async(d,u)=>{try{const p=u.headers.get(Hn);let v=await u.clone().json().then(k=>(k==null?void 0:k.executionId)||null).catch(()=>null);return v||(v=Mn(d)),{nonce:p,executionId:wo(v)}}catch{return{nonce:null,executionId:null}}})(i,a);c&&l&&((d,u,p,v=De)=>{try{const k=Bt(d,v),h=p?172800:10800,y={value:u,expiry:Date.now()+1e3*h,isStart:p};de(k,JSON.stringify(y))}catch(k){console.error("Error setting flow nonce:",k)}})(l,c,i.path===Jn,o)},beforeRequest:i=>{if(i.path===zt){const a=Mn(i);if(a){const c=((l,d=De)=>{try{const u=Bt(l,d),p=le(u);if(!p)return null;const v=JSON.parse(p);return v.expiry<Date.now()?(Xi(l,d),null):v.value}catch(u){return console.error("Error getting flow nonce:",u),null}})(a,o);c&&(i.headers=i.headers||{},i.headers[Hn]=c)}}return i}}))):e(r)},e=>t=>{var{autoRefresh:n}=t,o=q(t,["autoRefresh"]);const r=!!n,i=typeof n=="object"&&(n==null?void 0:n.customActivityTracking);if(!r||Ft())return Object.assign(e(o),{markUserActive:()=>{et("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:c}=(()=>{const h=[];return{clearAllTimers:()=>{for(;h.length;)clearTimeout(h.pop())},setTimer:(y,x)=>{h.push(setTimeout(y,x))}}})();let l,d,u=null,p=!1,v=!1;i&&(J("Activity-based refresh enabled"),u=(()=>{let h=!0;return{hadActivity:()=>h,reset:()=>{h=!1},markActive:()=>{h=!0}}})()),ee&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&l&&new Date>l&&(J("Expiration time passed, refreshing session"),k.refresh(Te()||d))});const k=e(Ue(o,{afterRequest:async(h,y)=>{const{sessionJwt:x,refreshJwt:U,sessionExpiration:A,nextRefreshSeconds:R}=await _e(y);if(At(h,y))J("Session invalidated, canceling all timers"),a();else if(x||A){if(l=((C,z)=>{if(z)return new Date(1e3*z);J("Could not extract expiration time from session token, trying to decode the token");try{const K=Jt(C);if(K.exp)return new Date(1e3*K.exp)}catch{return null}})(x,A),!l)return void J("Could not extract expiration time from session token");d=U,p=R>0;const T=Ji(l,R);if(a(),T<=2e4)return void J("Session is too close to expiration, not setting refresh timer");const m=new Date(Date.now()+T).toLocaleTimeString("en-US",{hour12:!1});J(`Setting refresh timer for ${m}. (${T}ms)`),u&&(u.reset(),v=!1),c(()=>{if(ee&&document.visibilityState==="hidden")J("Skipping refresh due to timer - document is hidden");else{if(u&&p&&!u.hadActivity())return J("Skipping refresh due to timer - user is idle"),void(v=!0);J("Refreshing session due to timer"),k.refresh(Te()||U)}},T)}}}));return Object.assign(Be(k,["logout","logoutAll","oidc.logout"],h=>async(...y)=>{const x=await h(...y);return J("Clearing all timers"),a(),x}),{markUserActive:u?()=>{J("markUserActive() called"),p||J("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),v&&(J("User became active after skipped refresh, triggering refresh"),v=!1,a(),k.refresh(Te()||d))}:()=>{et("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})},e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=q(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:qt,getLastUserDisplayName:Ht});const i=e(Ue(r,{afterRequest:async(c,l)=>{var d;const{userInfo:u,lastAuth:p}=await(async h=>{if(!(h!=null&&h.ok))return{userInfo:void 0,lastAuth:void 0};const y=await(h==null?void 0:h.clone().json()),x=fo((y==null?void 0:y.authInfo)||y||{});return{userInfo:(x==null?void 0:x.user)||(x!=null&&x.hasOwnProperty("userId")?x:void 0),lastAuth:y.lastAuth}})(l),v=(d=u==null?void 0:u.loginIds)===null||d===void 0?void 0:d[0],k=u==null?void 0:u.name;v?(Wn(v),(h=>{de(_t,h)})(k)):p!=null&&p.loginId&&Wn(p.loginId)}}));let a=Be(i,["flow.start"],Qi);return a=Be(a,["logout","logoutAll"],Gi(o)),Object.assign(a,{getLastUserLoginId:qt,getLastUserDisplayName:Ht})},e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,refreshTokenViaCookie:r,storagePrefix:i,refreshCookieName:a}=t,c=q(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!n||!ee)return e(Object.assign({refreshCookieName:a},c));let l;const d=e(Ue(Object.assign({refreshCookieName:a},c),{beforeRequest:Mi(i,r,a),afterRequest:async(p,v)=>{if(At(p,v))J("Session invalidated, clearing persisted tokens"),mo(i,o,r,l);else{const k=await _e(v);k.cookieName?de(`${i||""}${it}`,k.cookieName):k.refreshJwt&&oe(`${i||""}${it}`);const h=((y={},x=!1,U="",A=!1)=>{var R,T,m,C;const{sessionJwt:z,refreshJwt:K,trustedDeviceJwt:G}=y;let Z;if(K)if(A){oe(`${U}${Ve}`);const B=A.sameSite||"Strict",V=(R=A.secure)===null||R===void 0||R,Y=(T=A.domain)!==null&&T!==void 0?T:y.cookieDomain,ce=st(A);V&&window.location.protocol!=="https:"&&et("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const L=Object.assign(Object.assign({},y),{cookieSameSite:B,cookieSecure:V,cookieDomain:Y});Bn(ce,K,L);const te=Lt(Y);Z=Object.assign(Object.assign({},Z),{refresh:{path:L.cookiePath,domain:te?Y:void 0}})}else{const B=st(A);Pe.remove(B),de(`${U}${Ve}`,K)}if(z)if(x){const B=x.sameSite||"Strict",V=(m=x.secure)===null||m===void 0||m,Y=(C=x.domain)!==null&&C!==void 0?C:y.cookieDomain,ce=Qt(x);V&&window.location.protocol!=="https:"&&et("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const L=Object.assign(Object.assign({},y),{cookieSameSite:B,cookieSecure:V,cookieDomain:Y});Bn(ce,z,L);const te=Lt(Y);Z=Object.assign(Object.assign({},Z),{session:{path:L.cookiePath,domain:te?Y:void 0}})}else de(`${U}${ut}`,z);return y.idToken&&de(`${U}${Xt}`,y.idToken),G&&de(`${U}DTD`,G),Z})(k,o,i,r);h&&(l=h)}}})),u=Be(d,["logout","logoutAll","oidc.logout"],Zi(i,o,r,()=>l));return Object.assign(u,{getRefreshToken:()=>Te(i,r),getSessionToken:()=>qn(i,o),getIdToken:()=>vo(i)})})(e=>{const t=Ii(e),n=is(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,a)=>{var c;if(Ft())return J(`Refresh called in native flow: ${new Error().stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(p){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:p.toString()}})}const l=qn(),d=Te();let u="";if(e.getExternalToken)try{u=await((c=e.getExternalToken)===null||c===void 0?void 0:c.call(e))}catch(p){J("Error getting external token while refreshing",p)}return t.refresh(i,{dcs:l?"t":"f",dcr:d?"t":"f"},u,a)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(a){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:a.toString()}})}return t.logout(i)},flow:ns(t),webauthn:es(t),fedcm:(o=t,r=e.projectId,{onetap:{requestExchangeCode(i){$n(o,i)},requestAuthentication(i){$n(o,i)}},async oneTap(i,a,c,l,d){await jo(o,{provider:i,oneTapConfig:a,loginOptions:c,onSkipped:l,onDismissed:d})},async launch(i){var a;const c={identity:{context:i||"signin",providers:[{configURL:o.httpClient.buildUrl(r+Vn.config),clientId:r}]}},l=await((a=navigator.credentials)===null||a===void 0?void 0:a.get(c));return o.refresh(l.token)},isSupported:()=>ee&&"IdentityCredential"in window,async isLoggedIn(i){var a;const c=o.httpClient.buildUrl(r+Vn.config);try{const l={identity:{context:i||"signin",providers:[{configURL:c,clientId:r}]}},d=await((a=navigator.credentials)===null||a===void 0?void 0:a.get(l));return!!d&&!!d.token}catch{return!1}}}),oidc:n});var o,r});let en;const Oo=e=>{const t=Co(Object.assign({persistTokens:On,autoRefresh:On},e));return en=t,t},ss=()=>Oo({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});en=ss();const as=()=>en;var ls=({projectId:e,baseUrl:t,persistTokens:n,autoRefresh:o,sessionTokenViaCookie:r,refreshTokenViaCookie:i,refreshCookieName:a,oidcConfig:c,storeLastAuthenticatedUser:l,keepLastAuthenticatedUserAfterLogout:d,getExternalToken:u,hooks:p,customStorage:v})=>g.useMemo(()=>{if(e)return Oo({projectId:e,baseUrl:t,sessionTokenViaCookie:r,refreshTokenViaCookie:i,baseHeaders:ot,persistTokens:n,autoRefresh:o,refreshCookieName:a,oidcConfig:c,storeLastAuthenticatedUser:l,keepLastAuthenticatedUserAfterLogout:d,hooks:p,getExternalToken:u,customStorage:v})},[e,t,JSON.stringify(r),JSON.stringify(i),u,v]);const cs=({projectId:e,baseUrl:t="",baseStaticUrl:n="",baseCdnUrl:o="",sessionTokenViaCookie:r=!1,refreshTokenViaCookie:i=!1,hooks:a,persistTokens:c=!0,autoRefresh:l=!0,oidcConfig:d,storeLastAuthenticatedUser:u=!0,keepLastAuthenticatedUserAfterLogout:p=!1,refreshCookieName:v="",getExternalToken:k,customStorage:h,children:y})=>{const[x,U]=g.useState(),[A,R]=g.useState(),[T,m]=g.useState(),[C,z]=g.useState(!1),[K,G]=g.useState(!1),[Z,B]=g.useState(!1),[V,Y]=g.useState(!!d),ce=g.useRef(!1),L=ls({projectId:e,baseUrl:t,persistTokens:c,autoRefresh:l,sessionTokenViaCookie:r,refreshTokenViaCookie:i,hooks:a,oidcConfig:d,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:v,getExternalToken:k,customStorage:h});g.useEffect(()=>{if(L){const Oe=L.onSessionTokenChange(R),re=L.onUserChange(U),D=L.onIsAuthenticatedChange(z),Ne=L.onClaimsChange(m);return()=>{Oe(),re(),D(),Ne()}}},[L]);const te=g.useRef(!1),pe=g.useRef(!1);g.useEffect(()=>{L&&d&&!ce.current&&(ce.current=!0,L.oidc.finishLoginIfNeed().finally(()=>{Y(!1),te.current=!0}))},[]);const W=g.useCallback(()=>{er()||te.current||(te.current=!0,B(!0),Cn(L==null?void 0:L.refresh)(void 0,!0).then(()=>{B(!1)}))},[L]),M=g.useCallback(()=>{pe.current||(pe.current=!0,G(!0),Cn(L.me)().then(()=>{G(!1)}))},[L]),ne=g.useMemo(()=>({fetchUser:M,user:x,isUserLoading:K,isUserFetched:pe.current,fetchSession:W,session:A,isAuthenticated:C,isSessionLoading:Z,isOidcLoading:V,isSessionFetched:te.current,projectId:e,baseUrl:t,baseStaticUrl:n,baseCdnUrl:o,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:v,customStorage:h,setUser:U,setSession:R,setIsAuthenticated:z,claims:T,sdk:L}),[M,x,K,pe.current,W,A,C,Z,V,te.current,e,t,n,o,p,v,h,U,R,z,T,L]);return g.createElement(Qn.Provider,{value:ne},y)};function ds(...e){return t=>e.reduce((n,o)=>o(n),t)}const us=(...e)=>e.join("/").replace(/\/+/g,"/"),Yn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),ps=e=>{const t=Symbol((n=>{const o=n.toString();let r=0;for(let i=0;i<o.length;i++)r=(r<<5)-r+o.charCodeAt(i),r&=r;return r.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}},gs=e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}},hs=e=>typeof e=="string"||e==null?e:JSON.stringify(e),fs=e=>g.forwardRef((t,n)=>{const{prop:o,attr:r,rest:i}=g.useMemo(()=>Object.entries(t).reduce((l,[d,u])=>{const{trimmedKey:p,category:v}=gs(d);return v==="prop"?l.prop.push([p,u]):v==="attr"?l.attr.push([Yn(p),hs(u)]):Object.assign(l.rest,{[Yn(p)]:u}),l},{attr:[],prop:[],rest:{}}),[t]),a=g.useRef(null),c=g.useCallback(l=>{a.current=l,l&&(o.forEach(([d,u])=>{a.current[d]=u}),r.forEach(([d,u])=>{u==null?l.removeAttribute(d):l.setAttribute(d,u)}))},[o,r,a]);return g.useImperativeHandle(n,()=>a.current),g.createElement(e,Object.assign({ref:c},i))}),vs=g.lazy(async()=>(((customElements==null?void 0:customElements.get("descope-wc"))||await Promise.resolve().then(()=>require("./index.cjs3.js")).then(e=>e.index).then(e=>e.default)).sdkConfigOverrides={baseHeaders:ot,persistTokens:!1,hooks:{get beforeRequest(){return as().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:fs(g.forwardRef((e,t)=>{var{"external-request-id":n}=e,o=q(e,["external-request-id"]);return g.useMemo(()=>{var r,i;r="x-external-rid",(i=n)?ot[r]=i:delete ot[r]},[n]),g.createElement("descope-wc",Object.assign({ref:t},o))}))})),ms=g.forwardRef(({flowId:e,onSuccess:t,onError:n,onReady:o,logger:r,tenant:i,theme:a,nonce:c,locale:l,debug:d,client:u,form:p,telemetryKey:v,redirectUrl:k,autoFocus:h,validateOnBlur:y,restartOnError:x,errorTransformer:U,styleId:A,onScreenUpdate:R,dismissScreenErrorOnInput:T,outboundAppId:m,outboundAppScopes:C,popupOrigin:z,children:K,externalRequestId:G},Z)=>{const[B,V]=g.useState(null);g.useImperativeHandle(Z,()=>B);const{projectId:Y,baseUrl:ce,baseStaticUrl:L,baseCdnUrl:te,storeLastAuthenticatedUser:pe,keepLastAuthenticatedUserAfterLogout:W,refreshCookieName:M,customStorage:ne,sdk:Oe}=g.useContext(Qn),re=g.useCallback(async D=>{await Oe.httpClient.hooks.afterRequest({},new Response(JSON.stringify(D.detail))),t&&t(D)},[t]);return g.useEffect(()=>{const D=B;return D==null||D.addEventListener("success",re),n&&(D==null||D.addEventListener("error",n)),o&&(D==null||D.addEventListener("ready",o)),()=>{n&&(D==null||D.removeEventListener("error",n)),o&&(D==null||D.removeEventListener("ready",o)),D==null||D.removeEventListener("success",re)}},[B,n,re]),g.useEffect(()=>{const D=B;return D==null||D.addEventListener("success",re),()=>{D==null||D.removeEventListener("success",re)}},[B,re]),g.useEffect(()=>{const D=B;return n&&(D==null||D.addEventListener("error",n)),()=>{n&&(D==null||D.removeEventListener("error",n))}},[B,n]),g.useEffect(()=>{const D=B;return o&&(D==null||D.addEventListener("ready",o)),()=>{o&&(D==null||D.removeEventListener("error",o))}},[B,o]),g.createElement("form",null,g.createElement(g.Suspense,{fallback:null},g.createElement(vs,{projectId:Y,flowId:e,baseUrl:ce,baseStaticUrl:L,baseCdnUrl:te,ref:V,telemetryKey:v,redirectUrl:k,autoFocus:h,styleId:A,validateOnBlur:y,restartOnError:x,keepLastAuthenticatedUserAfterLogout:W,tenant:i,externalRequestId:G,customStorage:ne,"theme.attr":a,"nonce.attr":c,"locale.attr":l,"form.attr":p,"client.attr":u,"debug.attr":d,"outbound-app-id.attr":m,"outbound-app-scopes.attr":C,"popup-origin.attr":z,"store-last-authenticated-user.attr":pe,"refreshCookieName.attr":M,"dismiss-screen-error-on-input.attr":T,"errorTransformer.prop":U,"logger.prop":r,"onScreenUpdate.prop":R,"customStorage.prop":ne},K)))}),ys="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK8AAAAwCAYAAABnoirjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAI6lJREFUeAHtfQd8FsX29pTdfXtCeoBQAsHQAkIiVZSioFKkCCooiCD2ggXUq4Kici8qol4VkHJB6YIKFyki5AoIIkFASuihpJGet26Zme9sCgYMmgT1u/dPzu8Xfcvu7OzMM+c85zmzLwjVWq3VWq3V2l9rGP3/Mdy9e3d67tw5Wv6BoigiMvIQT05GDN4KVGu19jv2l4G3ZcuWSl5enhzjcEgbt8yIEQF/ksAikjNu44gjgkmAEnHeSh0pjia3n4uOjtbCwsL0Q4cO6agWzLVWif3Z4MWNGze2HEqZEeHL9t2tMeNGLnh7mdIQhLGhM5aPBPYjAugUwmYhEnwuZIxIYcDQ98iSvD24btRnzRJGnQcvHUC1IK61CvangRdAaz2S8lGTouzC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M0v6h9r2efqf3BvavP/pDHSszHaHIOfzYdpJC7DSQ9ldTrzs9W7VkerBV4/w4edQBQ8MmWQv/ipKQH3fNOzetu6MZYSBC6cY0dwhI+DaCEMIGDwAu3pjIJZxrfLVnkT21cWdsoAlN+Xn8auNLjQPa/yC32PtvNGXyH+WgOLITlEdHNn8ShSX/6k6q19t9nf9gzUWYFJfvI4lcpF49B7P7EZdOnOGNHF/xw9rMhusanAmB1SSEzrBZladLNw4sXL1wc5AvXOkLJMAISIWIYxGulRmpW4/zj0+tNF4uT32woYTwCEol7gO96IR99xuXP+6G+HP48ZPPjVYzfHzbw8de2H8l1o1q7Ku0P/nHpuvb1yz4YQbn+BmiGHkOizyY2vWud+euPhsc7ApSbJ0AeCYZk7AdJRttl2ZbiMwLFxNyrS6gdspo4qLgkwPftQJppD8LLj1DuXWgo2hdtdaWz4PI7lOJ6GqaT+984/pOUWqpwVduf8TSq7PdviCk+mTMN5MbbQfr4TiFodoTPt2F7oJBrURFdFCR1gZJnVwBygixJDlMS1VRNBd3yBEgqB4hE92scb+5xTdbx3NS6PUDWHAMi5K1Q49nsdDif7T54yrG/4hdZau2/2/60R6lBXnH+56vXeuia9jgV7AYAaC5I68skhr9nVmlf227DMjIzETp48CABeQmB9FMiraQm/z1CMEsCl0UnqIvfCQWdGEjS9hCL9b1b73xyTUpKZpV1wFr7v21/9u8AlOiUO/fOi1GL3KMDXB+kYNrQxJ7KUB4kcidtUskzZ0Ll3IY5byRTEmU+CGcIkU2o9JXNZvlXl9seOhoZ2SpQ+/u7tVbR/mzwXriO+QN0klSsHNu5wpVfmJ2gM9QO+G0DpHErMXeZU2I+65Nuk8k+7HId6HP9U7npgYBe+++v1drl7K8C76VGgVZQqGJdtC3SarXydu2OG+ZTtKjWaq3Waq3Waq3W/svs/wHDkxYoFqn0jQAAAABJRU5ErkJggg==",We="var(--color-green)",S="var(--font-sans)",$={width:"100%",height:40,padding:"10px 14px",fontSize:16,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:"var(--color-text)",fontFamily:S,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},X=e=>{e.target.style.borderColor="var(--color-green)",e.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},Q=e=>{e.target.style.borderColor="var(--color-input-border)",e.target.style.boxShadow="none"},xs=[{value:"",label:"Select team size (optional)"},{value:"1-10",label:"1–10"},{value:"11-50",label:"11–50"},{value:"51-200",label:"51–200"},{value:"200+",label:"200+"}],ws=["Nextiva","Five9","Dialpad","RingCentral","NICE","Genesys","Talkdesk","Aircall","8x8","Vonage","Twilio","Other"],bs=["Teams","Zoom","Google Meet","Webex","Other"];function Ee({title:e,subtitle:t}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:600,fontSize:"36px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:e}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:t})]})}function me({onClick:e,disabled:t,children:n,type:o="button"}){const r=!t;return s.jsx("button",{type:o,onClick:e,disabled:t,style:{width:"100%",height:40,display:"flex",justifyContent:"center",alignItems:"center",padding:"10px",background:r?"var(--color-green)":"var(--color-green-disabled)",color:"white",border:"none",borderRadius:4,fontSize:16,fontWeight:600,lineHeight:"23px",fontFamily:S,cursor:r?"pointer":"not-allowed",transition:"background 0.15s",boxSizing:"border-box"},onMouseEnter:i=>{r&&(i.currentTarget.style.background="var(--color-green-hover)")},onMouseLeave:i=>{r&&(i.currentTarget.style.background=r?"var(--color-green)":"var(--color-green-disabled)")},children:n})}function H({label:e,gap:t=12,labelSize:n=16,labelStyle:o,children:r}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:t,width:"100%"},children:[s.jsx("label",{style:{fontSize:n,fontWeight:400,color:"var(--color-text)",fontFamily:S,lineHeight:"100%",...o},children:e}),r]})}function Tt({show:e,onToggle:t}){return s.jsx("button",{type:"button",tabIndex:-1,onClick:t,style:{position:"absolute",right:14,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--color-text-secondary)",display:"flex",alignItems:"center"},children:e?s.jsx(Ce.EyeOff,{size:16}):s.jsx(Ce.Eye,{size:16})})}function Je(){return s.jsx("hr",{style:{width:"100%",border:"none",borderTop:"1px solid var(--color-divider)",margin:0}})}function je({text:e,linkText:t,onClick:n}){return s.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:4,width:"100%"},children:[s.jsx("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:e}),s.jsx("button",{type:"button",onClick:n,style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"22px",color:We,cursor:"pointer",fontFamily:S,textDecoration:"underline"},children:t})]})}function ye({onTerms:e,onPrivacyPolicy:t,paddingTop:n}){return s.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",marginTop:"auto",paddingTop:n||40,flexShrink:0},children:s.jsxs("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S,textAlign:"center",whiteSpace:"nowrap"},children:["By continuing, you agree to our"," ",s.jsx("a",{href:"https://chordia.ai/legal/terms-of-use",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:S,textDecoration:"underline",textUnderlineOffset:2},children:"Terms"})," ","and"," ",s.jsx("a",{href:"https://chordia.ai/legal/privacy-notice",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:S,textDecoration:"underline",textUnderlineOffset:2},children:"Privacy Policy"}),"."]})})}function ks({projectId:e,onSuccess:t,onError:n}){return e?s.jsx(cs,{projectId:e,children:s.jsx(ms,{flowId:"sign-up-or-in-otp-or-social",onSuccess:t,onError:n})}):null}function Xn({options:e,value:t,onChange:n,otherValue:o,onOtherChange:r,placeholder:i,otherPlaceholder:a="Please specify",compact:c=!1}){const[l,d]=g.useState(!1),u=g.useRef(null);g.useEffect(()=>{const m=C=>{u.current&&!u.current.contains(C.target)&&d(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const p=m=>{t.includes(m)?(n(t.filter(C=>C!==m)),m==="Other"&&r("")):n([...t,m])},v=m=>{n(t.filter(C=>C!==m)),m==="Other"&&r("")},k="rgba(34, 197, 94, 0.14)",h=c?"6px 10px":"8px 12px",y=c?36:40,x=c?15:16,U=c?200:260,A=c?"6px 8px":"8px 10px",R=t.includes("Other"),T=()=>d(m=>!m);return s.jsx("div",{ref:u,style:{width:"100%"},children:s.jsxs("div",{style:{position:"relative",width:"100%"},children:[s.jsxs("div",{role:"combobox","aria-expanded":l,onClick:m=>{m.target instanceof HTMLInputElement||m.target instanceof HTMLElement&&m.target.closest("button")||T()},style:{width:"100%",minHeight:y,padding:h,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,textAlign:"left",fontSize:x,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:t.length?"var(--color-text)":"var(--color-text-secondary)",fontFamily:S,boxSizing:"border-box",cursor:"pointer"},children:[s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:6,minWidth:0,cursor:"text"},children:t.length===0?s.jsx("span",{style:{color:"var(--color-text-secondary)",cursor:"pointer"},onClick:m=>{m.stopPropagation(),T()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&T()},role:"button",tabIndex:0,children:i}):s.jsxs(s.Fragment,{children:[t.map(m=>s.jsxs("span",{onClick:C=>C.stopPropagation(),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:4,background:k,fontSize:13,fontWeight:500,color:"var(--color-text)",flexShrink:0},children:[m,s.jsx("span",{role:"button",tabIndex:0,onClick:C=>{C.stopPropagation(),v(m)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.stopPropagation(),v(m))},style:{cursor:"pointer",fontSize:14,lineHeight:1,opacity:.7},children:"×"})]},m)),R&&s.jsx("input",{type:"text",value:o,onChange:m=>r(m.target.value),placeholder:a,onMouseDown:m=>m.stopPropagation(),onClick:m=>m.stopPropagation(),onFocus:m=>{m.stopPropagation(),m.target.style.borderColor="var(--color-green)",m.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},onBlur:m=>{m.target.style.borderColor="#cfcece",m.target.style.boxShadow="none"},style:{flex:"1 1 120px",minWidth:80,maxWidth:"100%",minHeight:c?26:28,padding:"2px 8px",border:"1px solid #cfcece",borderRadius:4,outline:"none",background:"transparent",fontSize:x,fontFamily:S,color:"var(--color-text)",boxSizing:"border-box"}})]})}),s.jsx("button",{type:"button",tabIndex:-1,onClick:m=>{m.stopPropagation(),T()},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,border:"none",background:"none",cursor:"pointer",color:"var(--color-text-secondary)"},"aria-label":l?"Close options":"Open options",children:s.jsx(Ce.ChevronDown,{size:c?16:18,style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]}),l&&s.jsx("div",{style:{position:"absolute",left:0,right:0,top:"100%",marginTop:4,padding:c?6:8,maxHeight:U,overflowY:"auto",background:"white",border:"1px solid var(--color-input-border)",borderRadius:4,boxShadow:"0 8px 24px rgba(0,0,0,0.08)",zIndex:50,boxSizing:"border-box"},children:e.map(m=>s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:A,borderRadius:4,cursor:"pointer",fontSize:c?14:15,fontFamily:S,color:"var(--color-text)"},children:[s.jsx("input",{type:"checkbox",checked:t.includes(m),onChange:()=>p(m),style:{width:16,height:16,accentColor:"var(--color-green)"}}),m]},m))})]})})}function Is({onLogin:e,onForgotPassword:t,onOneTimeCode:n,onVerifyCode:o,onResendCode:r,onSignUp:i,onJoinWaitlist:a,onWaitlistSubmit:c,onResetPassword:l,onTerms:d,onPrivacyPolicy:u,onDescopeSuccess:p,onDescopeError:v,descopeProjectId:k,onGoToLogin:h,loading:y,error:x,codeError:U,defaultView:A="signin",signupMode:R="signup"}){var jn,Sn;const[T,m]=g.useState(""),[C,z]=g.useState(""),[K,G]=g.useState(!1),[Z,B]=g.useState(!1),[V,Y]=g.useState(!1),[ce,L]=g.useState(!1),[te,pe]=g.useState(null),[W,M]=g.useState(A),[ne,Oe]=g.useState(""),[re,D]=g.useState(""),[Ne,tn]=g.useState(""),[ge,$e]=g.useState(["","","","","",""]),Fe=g.useRef([]),[pt,Ao]=g.useState(""),[gt,Uo]=g.useState(""),[Le,Eo]=g.useState(""),[Ye,To]=g.useState(""),[ht,Do]=g.useState(""),[ft,Po]=g.useState(!1),[vt,Ro]=g.useState(!1),[nn,Ae]=g.useState(""),[mt,No]=g.useState(""),[on,rn]=g.useState(0),sn=3,[an,Fo]=g.useState(""),[ln,Lo]=g.useState(""),[cn,zo]=g.useState(""),[dn,Bo]=g.useState(""),[yt,qo]=g.useState(""),[un,Ho]=g.useState([]),[pn,Jo]=g.useState([]),[xt,Mo]=g.useState(""),[wt,Wo]=g.useState(""),[gn,fe]=g.useState(""),[hn,fn]=g.useState(!1),[Ko,Vo]=g.useState(!1),[$o,Yo]=g.useState(1267),[ze,Xo]=g.useState("");g.useEffect(()=>{const f=setInterval(()=>rn(j=>(j+1)%sn),4e3);return()=>clearInterval(f)},[]);const ke=g.useRef(null),Ie=g.useRef(null);g.useEffect(()=>{const f=ie=>{if(!ie)return!1;try{return ie.matches(":-webkit-autofill, :autofill")}catch{return!1}},j=()=>{const ie=ke.current,Qe=Ie.current;ie&&ie.value&&m(ie.value),Qe&&Qe.value&&z(Qe.value),G(f(ie)),B(f(Qe))},O=[100,300,600,1e3,2e3].map(ie=>setTimeout(j,ie)),F=ie=>{(ie.animationName==="onAutoFillStart"||ie.target.matches(":-webkit-autofill"))&&setTimeout(j,50)},P=ke.current,I=Ie.current;P==null||P.addEventListener("animationstart",F),I==null||I.addEventListener("animationstart",F);const _=()=>setTimeout(j,0),ae=()=>setTimeout(j,0);return P==null||P.addEventListener("input",_),I==null||I.addEventListener("input",_),P==null||P.addEventListener("change",ae),I==null||I.addEventListener("change",ae),()=>{O.forEach(clearTimeout),P==null||P.removeEventListener("animationstart",F),I==null||I.removeEventListener("animationstart",F),P==null||P.removeEventListener("input",_),I==null||I.removeEventListener("input",_),P==null||P.removeEventListener("change",ae),I==null||I.removeEventListener("change",ae)}},[]),g.useEffect(()=>{const f=F=>{if(!F)return!1;try{return F.matches(":-webkit-autofill, :autofill")}catch{return!1}},j=()=>{var I,_;const F=((I=ke.current)==null?void 0:I.value)||"",P=((_=Ie.current)==null?void 0:_.value)||"";F&&F!==T&&m(F),P&&P!==C&&z(P),G(f(ke.current)),B(f(Ie.current))},O=setInterval(j,250);return window.addEventListener("focus",j),document.addEventListener("visibilitychange",j),()=>{clearInterval(O),window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",j)}},[T,C]),g.useEffect(()=>{U&&W==="verifycode"&&($e(["","","","","",""]),M("getcodewithname"))},[U]);const vn=y??ce,ve=x??te,Qo=(T||((jn=ke.current)==null?void 0:jn.value)||"").trim(),Go=C||((Sn=Ie.current)==null?void 0:Sn.value)||"",mn=!!(!!(Qo||K)&&!!(Go||Z)&&!vn),Xe=W==="verifycode"||W==="getcodewithname"?ve:null,yn=f=>{f.target.style.borderColor=ve?"var(--color-text)":"var(--color-green)",f.target.style.boxShadow=ve?"none":"0 0 0 3px var(--color-green-ring)"},xn=f=>{f.target.style.borderColor=ve?"var(--color-text)":"var(--color-input-border)",f.target.style.boxShadow="none"},wn=(f,j)=>{var _;const O=(j||"").replace(/\D/g,"");if(!O)return;const F=[...ge];let P=f;for(let ae=0;ae<O.length&&f+ae<F.length;ae+=1)F[f+ae]=O[ae],P=f+ae;$e(F);const I=Math.min(P+1,F.length-1);(_=Fe.current[I])==null||_.focus()},bn=(f,j)=>{var I;const O=j.replace(/\D/g,"");if(O.length>1){wn(f,O);return}const F=O.slice(-1),P=[...ge];P[f]=F,$e(P),F&&f<5&&((I=Fe.current[f+1])==null||I.focus())},kn=(f,j)=>{var O;j.key==="Backspace"&&!ge[f]&&f>0&&((O=Fe.current[f-1])==null||O.focus())},In=(f,j)=>{var F;j.preventDefault();const O=((F=j.clipboardData)==null?void 0:F.getData("text"))||"";wn(f,O)},Zo=async f=>{var F,P;if(f.preventDefault(),!mn)return;const j=T||((F=ke.current)==null?void 0:F.value)||"",O=C||((P=Ie.current)==null?void 0:P.value)||"";if(!(!j||!O)){pe(null),L(!0);try{await(e==null?void 0:e(j,O))}catch(I){pe((I==null?void 0:I.message)||"Something went wrong. Please try again.")}finally{L(!1)}}},_o=async()=>{fe("");const f=an.trim(),j=ln.trim(),O=cn.trim();if(f.length<2){fe("Please enter your full name.");return}if(!j){fe("Please enter your work email.");return}if(O.length<2){fe("Please enter your company name (at least 2 characters).");return}const F=un.map(I=>I==="Other"&&xt.trim()?`Other: ${xt.trim()}`:I),P=pn.map(I=>I==="Other"&&wt.trim()?`Other: ${wt.trim()}`:I);fn(!0);try{const I=await(c==null?void 0:c({name:f,email:j,company_name:O,job_title:dn.trim()||void 0,team_size:yt||void 0,phone_systems:F,meeting_tools:P,source:"website"})),_=Number(I==null?void 0:I.position);Number.isFinite(_)&&_>0&&Yo(_),I!=null&&I.calendly_url&&Xo(String(I.calendly_url)),Vo(!0)}catch(I){fe((I==null?void 0:I.message)||"Unable to join waitlist right now. Please try again.")}finally{fn(!1)}};return s.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",overflow:"hidden",fontFamily:S,background:"white"},children:[s.jsxs("div",{style:{flex:"0 0 628px",width:628,minHeight:0,background:"var(--surface-dark)",display:"flex",flexDirection:"column",padding:"48px 0 40px 48px",position:"relative",overflow:"hidden"},children:[s.jsx("img",{src:ys,alt:"Chordia",style:{width:175,height:48,objectFit:"contain",marginBottom:100,flexShrink:0}}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:22},children:[s.jsx("h1",{style:{fontFamily:S,fontSize:"clamp(28px, 2.8vw, 28px)",fontWeight:800,color:"var(--color-text-inverse)",lineHeight:1.08,margin:0,letterSpacing:"-0.02em",paddingRight:48},children:"Three Solutions. One Platform."}),s.jsxs("div",{style:{position:"relative",width:412,height:320,overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)"},children:[s.jsx("div",{style:{display:"flex",gap:16,height:"100%",transform:`translateX(${-on*280}px)`,transition:"transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:[{Icon:Ce.CircleCheckBig,title:"Evaluation Quality Monitoring",info:"Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."},{Icon:Ce.ShieldCheck,title:"Compliance Monitoring",info:"Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."},{Icon:Ce.Radar,title:"Signal Intelligence",info:"Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."}].map(({Icon:f,title:j,info:O},F)=>s.jsxs("div",{style:{flexShrink:0,width:264,height:320,padding:32,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,borderRadius:16,border:"1px solid var(--surface-card-dark-border)",background:"var(--surface-card-dark)"},children:[s.jsx(f,{width:36,height:36,color:"var(--color-card-icon)",strokeWidth:2.5}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[s.jsx("span",{style:{fontFamily:S,fontSize:24,fontStyle:"normal",fontWeight:600,lineHeight:"28px",color:"var(--color-card-text)"},children:j}),s.jsx("span",{style:{fontFamily:S,fontSize:12,fontStyle:"normal",fontWeight:400,lineHeight:"normal",color:"rgba(255,255,255,0.65)"},children:O})]})]},F))}),s.jsx("div",{style:{position:"absolute",top:0,left:280,right:0,height:"100%",background:"linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",pointerEvents:"none"}})]}),s.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,height:4,marginTop:"auto",flexShrink:0},children:Array.from({length:sn}).map((f,j)=>s.jsx("button",{onClick:()=>rn(j),style:{width:80,height:4,borderRadius:6,border:"none",padding:0,cursor:"pointer",background:j===on?"rgba(255,255,255,0.7)":"rgba(255,255,255,0.25)",transition:"background 0.3s ease"}},j))})]})]}),s.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:W==="waitlist"?"20px 48px":"32px 72px",position:"relative",background:"white",overflowY:"auto",minHeight:0},children:s.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",maxWidth:W==="waitlist"?430:360,gap:W==="waitlist"?22:28},children:W==="waitlist"?s.jsx(s.Fragment,{children:Ko?s.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",gap:24},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:700,fontSize:"32px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:"Chordia"}),s.jsx("h3",{style:{fontFamily:S,fontWeight:700,fontSize:"32px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"You're on the list!"}),s.jsxs("p",{style:{fontFamily:S,fontWeight:700,fontSize:"56px",lineHeight:"68px",color:"var(--color-green)",margin:0},children:["#",$o.toLocaleString()]}),s.jsx("p",{style:{fontFamily:S,fontWeight:400,fontSize:18,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0,maxWidth:470},children:"We’re working hard to increase capacity and will notify you very quickly. Check your email for confirmation."}),s.jsxs("div",{style:{width:"100%",borderRadius:12,border:"1px solid var(--color-input-border)",background:"white",boxShadow:"0 1px 6px rgba(0,0,0,0.06)",padding:"24px 20px",boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",gap:14},children:[s.jsx("p",{style:{margin:0,fontFamily:S,fontSize:"24px",lineHeight:"40px",fontWeight:700,color:"var(--color-text)"},children:"Want to skip the line?"}),s.jsx("p",{style:{margin:0,fontFamily:S,fontSize:"18px",lineHeight:"24px",fontWeight:400,color:"var(--color-text-secondary)"},children:"Schedule a demo with our CEO and get immediate access."}),s.jsx("button",{type:"button",onClick:()=>{ze&&window.open(ze,"_blank","noopener,noreferrer")},style:{minWidth:220,height:48,padding:"0 20px",borderRadius:8,border:"2px solid #111111",background:"white",color:"var(--color-text)",fontFamily:S,fontSize:20,fontWeight:700,lineHeight:"28px",cursor:ze?"pointer":"default",opacity:ze?1:.65},disabled:!ze,children:"Schedule a Demo"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Join the Waitlist",subtitle:"Get early access to Chordia. We onboard new companies every week."}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:12},children:[s.jsx(H,{label:"Full Name",gap:8,children:s.jsx("input",{type:"text",value:an,onChange:f=>{Fo(f.target.value),fe("")},placeholder:"Your full name",autoFocus:!0,autoComplete:"name",style:$,onFocus:X,onBlur:Q})}),s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Work Email",gap:8,children:s.jsx("input",{type:"email",value:ln,onChange:f=>{Lo(f.target.value),fe("")},placeholder:"workemail@example.com",autoComplete:"email",style:$,onFocus:X,onBlur:Q})})}),s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Company Name",gap:8,children:s.jsx("input",{type:"text",value:cn,onChange:f=>{zo(f.target.value),fe("")},placeholder:"Your Company",autoComplete:"organization",style:$,onFocus:X,onBlur:Q})})})]}),s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Job Title",gap:8,children:s.jsx("input",{type:"text",value:dn,onChange:f=>Bo(f.target.value),placeholder:"Optional",autoComplete:"organization-title",style:$,onFocus:X,onBlur:Q})})}),s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(H,{label:"Team Size",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("select",{value:yt,onChange:f=>qo(f.target.value),style:{...$,appearance:"none",WebkitAppearance:"none",paddingRight:36,cursor:"pointer",fontSize:15,color:yt?"var(--color-text)":"var(--color-text-secondary)"},children:xs.map(f=>s.jsx("option",{value:f.value,children:f.label},f.value||"empty"))}),s.jsx(Ce.ChevronDown,{size:16,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--color-text-secondary)"}})]})})})]}),s.jsx(H,{label:"Phone systems",gap:8,children:s.jsx(Xn,{compact:!0,options:ws,value:un,onChange:Ho,otherValue:xt,onOtherChange:Mo,placeholder:"Select (optional)",otherPlaceholder:"Please specify your phone system"})}),s.jsx(H,{label:"Meeting tools",gap:8,children:s.jsx(Xn,{compact:!0,options:bs,value:pn,onChange:Jo,otherValue:wt,onOtherChange:Wo,placeholder:"Select (optional)",otherPlaceholder:"Please specify your meeting tool"})}),gn&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),gn]}),s.jsx(me,{type:"button",onClick:_o,disabled:hn,children:hn?"Joining...":"Join Waitlist"}),s.jsx(je,{text:"I am already a member",linkText:"Log In",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:16})]})]})}):W==="signup"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Sign Up",subtitle:"Please enter your basic details to continue"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx(H,{label:"First Name",gap:8,children:s.jsx("input",{type:"text",value:pt,onChange:f=>Ao(f.target.value),placeholder:"First name",autoFocus:!0,autoComplete:"given-name",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Last Name",gap:8,children:s.jsx("input",{type:"text",value:gt,onChange:f=>Uo(f.target.value),placeholder:"Last name",autoComplete:"family-name",style:$,onFocus:X,onBlur:Q})})]}),s.jsx(H,{label:"Email",gap:8,children:s.jsx("input",{type:"text",value:Le,onChange:f=>{Eo(f.target.value),Ae("")},placeholder:"workemail@example.com",autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Create Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:ft?"text":"password",value:Ye,onChange:f=>{To(f.target.value),Ae("")},placeholder:"Enter password",autoComplete:"new-password",style:{...$,padding:"10px 44px 10px 14px"},onFocus:X,onBlur:Q}),s.jsx(Tt,{show:ft,onToggle:()=>Po(!ft)})]})}),s.jsx(H,{label:"Confirm Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:vt?"text":"password",value:ht,onChange:f=>{Do(f.target.value),Ae("")},placeholder:"Enter password",autoComplete:"new-password",style:{...$,padding:"10px 44px 10px 14px"},onFocus:X,onBlur:Q}),s.jsx(Tt,{show:vt,onToggle:()=>Ro(!vt)})]})}),nn&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),nn]}),(()=>{const f=pt&&gt&&Le&&Ye&&ht;return s.jsx(me,{onClick:()=>{if(Ae(""),!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Le)){Ae("Please enter a valid email address.");return}if(Ye!==ht){Ae("Password and Confirm Password do not match!");return}i==null||i({firstName:pt,lastName:gt,email:Le,password:Ye}),M("verifyemail")},disabled:!f,children:"Create Account"})})(),s.jsx(je,{text:"I am already a member",linkText:"Sign In",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u})]})]}):W==="verifyemail"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Verify Email"}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:"Verify your email to continue the signup process."})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:24},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"We have sent a verification link to:"}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:600,lineHeight:"24px",color:"var(--color-text)",margin:0},children:Le||"youremail@workemail.com"})]}),s.jsx("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"Click on the link to complete the verification process. You might need to check your Spam folder"}),s.jsx(me,{onClick:()=>{M("signin"),h==null||h()},children:"Go To Login"})]}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]}):W==="verifycode"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:S,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Sign In with code"}),s.jsxs("p",{style:{fontFamily:S,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:["We have sent a one-time code to your email:"," ",s.jsx("span",{style:{color:"var(--color-text)"},children:Ne||"workemail@example.com"})," ",s.jsx("button",{type:"button",onClick:()=>M("getcode"),style:{background:"none",border:"none",padding:0,fontSize:18,fontWeight:400,color:We,cursor:"pointer",fontFamily:S,textDecoration:"underline"},children:"Change email"})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Enter one-time code",gap:12,children:s.jsx("div",{style:{display:"flex",gap:8},children:ge.map((f,j)=>s.jsx("input",{ref:O=>{Fe.current[j]=O},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:O=>bn(j,O.target.value),onKeyDown:O=>kn(j,O),onPaste:O=>In(j,O),autoFocus:j===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:S,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:We},onFocus:X,onBlur:Q},j))})}),s.jsx(me,{onClick:()=>o==null?void 0:o(Ne,ge.join("")),disabled:ge.some(f=>!f),children:"Verify Code"}),Xe&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Xe]}),s.jsx(Je,{}),s.jsx(je,{text:"Not received yet?",linkText:"Resend",onClick:()=>r==null?void 0:r(Ne)}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:24})]})]}):W==="getcode"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Get code",subtitle:"We'll send a one time pass-code to your email"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:ne,onChange:f=>Oe(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(me,{onClick:()=>{tn(ne),$e(["","","","","",""]),M("verifycode"),n==null||n(ne)},disabled:!ne,children:"Send One-time Code"}),s.jsx(Je,{}),s.jsx(je,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):W==="getcodewithname"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Complete your sign in",subtitle:"We’ve sent a one-time code to your email. Please enter the code and your full name to sign in"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:ne,onChange:f=>Oe(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Full Name",gap:12,children:s.jsx("input",{type:"text",value:re,onChange:f=>D(f.target.value),placeholder:"Enter your full name",autoComplete:"name",style:$,onFocus:X,onBlur:Q})}),s.jsx(H,{label:"Enter one-time code",gap:12,children:s.jsx("div",{style:{display:"flex",gap:8},children:ge.map((f,j)=>s.jsx("input",{ref:O=>{Fe.current[j]=O},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:O=>bn(j,O.target.value),onKeyDown:O=>kn(j,O),onPaste:O=>In(j,O),autoFocus:j===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:S,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:We},onFocus:X,onBlur:Q},j))})}),s.jsx(me,{onClick:()=>{tn(ne),n==null||n(ne,re,ge.join(""))},disabled:!ne||!re||ge.some(f=>!f),children:"Verify & Sign In"}),Xe&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Xe]}),s.jsx(Je,{}),s.jsx(je,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):W==="resetpassword"?s.jsxs(s.Fragment,{children:[s.jsx(Ee,{title:"Reset Password",subtitle:"We'll send an email to reset your password"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:mt,onChange:f=>No(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:$,onFocus:X,onBlur:Q})}),s.jsx(me,{onClick:()=>l==null?void 0:l(mt),disabled:!mt,children:"Send Reset Link"}),s.jsx(Je,{}),s.jsx(je,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),h==null||h()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:48},children:[s.jsx(Ee,{title:"Sign in",subtitle:"Enter your email & password to continue"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:8},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:16},children:[s.jsxs("form",{onSubmit:Zo,style:{width:"100%",display:"flex",flexDirection:"column",gap:16},children:[s.jsx(H,{label:"Email",gap:12,children:s.jsx("input",{ref:ke,type:"email",value:T,onChange:f=>m(f.target.value),placeholder:"workemail@example.com",required:!0,autoComplete:"email",style:{...$,border:`1px solid ${ve?"var(--color-text)":"var(--color-input-border)"}`},onFocus:yn,onBlur:xn})}),s.jsx(H,{label:"Password",gap:12,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{ref:Ie,type:V?"text":"password",value:C,onChange:f=>z(f.target.value),placeholder:"Enter password",required:!0,autoComplete:"current-password",style:{...$,padding:"10px 44px 10px 16px",border:`1px solid ${ve?"var(--color-text)":"var(--color-input-border)"}`},onFocus:yn,onBlur:xn}),s.jsx(Tt,{show:V,onToggle:()=>Y(!V)})]})}),s.jsx(me,{type:"submit",disabled:!mn,children:vn?"Signing in…":"Sign In"})]}),ve&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:S},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),ve]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[s.jsx("button",{type:"button",onClick:()=>{M("resetpassword"),t==null||t()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:400,lineHeight:"100%",color:"var(--color-text)",cursor:"pointer",fontFamily:S,textDecoration:"underline"},children:"Forgot Password?"}),s.jsx("button",{type:"button",onClick:()=>{M("getcode"),n==null||n()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"100%",color:We,cursor:"pointer",fontFamily:S,textDecoration:"underline solid",textUnderlineOffset:0,textDecorationSkipInk:"none"},children:"Sign in with one-time code"})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:2},children:[s.jsx(Je,{}),s.jsx(ks,{projectId:k,onSuccess:p,onError:v})]})]}),s.jsx(je,{text:R==="waitlist"?"Don't have an account yet?":"Not a member yet?",linkText:R==="waitlist"?"Join Waitlist":"Sign Up",onClick:()=>{if(R==="waitlist"){M("waitlist"),a==null||a();return}M("signup"),i==null||i()}}),s.jsx(ye,{onTerms:d,onPrivacyPolicy:u,paddingTop:16})]})]})})})]})}exports.Ee=Co;exports.LoginPage=Is;exports.X=xo;exports.Z=$i;exports.__awaiter=tr;exports.__classPrivateFieldGet=or;exports.__classPrivateFieldSet=rr;exports.__rest=q;exports.h=ps;exports.r=ds;exports.s=us;
1
+ "use strict";const s=require("react/jsx-runtime"),h=require("react"),le=require("lucide-react");require("./colors.cjs.js");const ro=h.createContext(void 0),En=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)},cr=()=>typeof window<"u"&&!!window.descopeBridge,it={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.27.1"},Tn=typeof window<"u";var st=function(){return st=Object.assign||function(t){for(var n,o=1,r=arguments.length;o<r;o++){n=arguments[o];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},st.apply(this,arguments)};function H(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,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 dr(e,t,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function c(u){try{d(o.next(u))}catch(p){a(p)}}function l(u){try{d(o.throw(u))}catch(p){a(p)}}function d(u){u.done?i(u.value):r(u.value).then(c,l)}d((o=o.apply(e,t||[])).next())})}function ur(e,t,n){if(n||arguments.length===2)for(var o=0,r=t.length,i;o<r;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}function pr(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)}function hr(e,t,n,o,r){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n}class Ke extends Error{}Ke.prototype.name="InvalidTokenError";function gr(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function fr(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return gr(t)}catch{return atob(t)}}function Vt(e,t){if(typeof e!="string")throw new Ke("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Ke(`Invalid token specified: missing part #${n+1}`);let r;try{r=fr(o)}catch(i){throw new Ke(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(r)}catch(i){throw new Ke(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var b={accessKey:{exchange:"/v1/auth/accesskey/exchange"},otp:{verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},magicLink:{verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},enchantedLink:{verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},oauth:{start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange",startNative:"v1/auth/oauth/native/start",finishNative:"v1/auth/oauth/native/finish",oneTap:{getOneTapClientId:"/v1/auth/onetap/clientid/{provider}",exchangeOneTapIDToken:"/v1/auth/onetap/idtoken/exchange",verifyOneTapIDToken:"/v1/auth/onetap/idtoken/verify"}},outbound:{connect:"/v1/outbound/oauth/connect"},saml:{start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},totp:{verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/auth/totp/update"},notp:{signIn:"/v1/auth/notp/whatsapp/signin",signUp:"/v1/auth/notp/whatsapp/signup",signUpOrIn:"/v1/auth/notp/whatsapp/signup-in",session:"/v1/auth/notp/pending-session"},webauthn:{signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},password:{signUp:"/v1/auth/password/signup",signIn:"/v1/auth/password/signin",sendReset:"/v1/auth/password/reset",update:"/v1/auth/password/update",replace:"/v1/auth/password/replace",policy:"/v1/auth/password/policy"},refresh:"/v1/auth/refresh",tryRefresh:"/v1/auth/try-refresh",selectTenant:"/v1/auth/tenant/select",logout:"/v1/auth/logout",logoutAll:"/v1/auth/logoutall",me:"/v1/auth/me",myTenants:"/v1/auth/me/tenants",history:"/v1/auth/me/history",flow:{start:"/v1/flow/start",next:"/v1/flow/next"}};const io="<region>",vr=`https://api.${io}descope.com`,Dn=1e3,Pn=6e5,so="dct",Rn=()=>{const e={};return{headers(t){const n=typeof t.entries=="function"?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},retries(t){return e.Retries=t,this},build:()=>Object.keys(e).flatMap(t=>e[t]?[`${t!=="Title"?`${t}: `:""}${e[t]}`]:[]).join(`
2
+ `)}},mr=[503,521,522,524,530],Fn=[100,5e3,5e3],xr=e=>new Promise(t=>setTimeout(t,e)),Nn=e=>async(...t)=>{let n=await e(...t),o=0;for(;mr.includes(n.status)&&o<Fn.length;)await xr(Fn[o]),n=await e(...t),o++;o>0&&(n.retries=o);const r=await n.text();return n.text=()=>Promise.resolve(r),n.json=()=>Promise.resolve(JSON.parse(r)),n.clone=()=>n,n},yr=(e,t)=>{const n=t||fetch;return n||e==null||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(...o)=>{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((i=>Rn().title("Request").url(i[0]).method(i[1].method).headers(i[1].headers).body(i[1].body).build())(o));const r=await Nn(n)(...o);return e[r.ok?"log":"error"](await(async i=>{const a=await i.text();return Rn().title("Response").url(i.url.toString()).status(`${i.status} ${i.statusText}`).headers(i.headers).body(a).retries(i.retries).build()})(r)),r}:Nn(n)};let _e;const wr=()=>{if(_e)return _e;const e=new Date,t=`${e.getUTCFullYear().toString()}-${(e.getUTCMonth()+1).toString().padStart(2,"0")}-${e.getUTCDate().toString().padStart(2,"0")}-${e.getUTCHours().toString().padStart(2,"0")}:${e.getUTCMinutes().toString().padStart(2,"0")}:${e.getUTCSeconds().toString().padStart(2,"0")}:${e.getUTCMilliseconds().toString()}`,n=Math.floor(1e3+9e3*Math.random());return _e=`${t}-${n}`,_e};var Oe;(function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT",e.patch="PATCH"})(Oe||(Oe={}));const zn=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(io,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${e==null?void 0:e.replace(/^\//,"")}`:t;if(n){const a=Object.keys(n);a.forEach((c,l)=>{i=`${i}${l===0?"?":""}${c}=${encodeURIComponent(n[c])}${l===a.length-1?"":"&"}`})}return i},br=(...e)=>new Headers(e.reduce((t,n)=>((o=>Array.isArray(o)?o:o instanceof Headers?Array.from(o.entries()):o?Object.entries(o):[])(n).forEach(([o,r])=>{t[o]=typeof r=="function"?r():r}),t),{})),kr={"Content-Type":"application/json"},jr=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Ir=(e,t)=>{const n={"x-descope-sdk-session-id":wr(),"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.58.0","x-descope-project-id":e};return t&&(n["x-descope-refresh-cookie-name"]=t),n},Sr=e=>{try{e=JSON.parse(e)}catch{return!1}return typeof e=="object"&&e!==null};var Cr=(e=>t=>{var n;return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:o=>{var r;const i=[].concat(((r=t.hooks)===null||r===void 0?void 0:r.beforeRequest)||[]);return i==null?void 0:i.reduce((a,c)=>c(a),o)},afterRequest:async(o,r)=>{var i;const a=[].concat(((i=t.hooks)===null||i===void 0?void 0:i.afterRequest)||[]);a.length!=0&&(await Promise.allSettled(a==null?void 0:a.map(c=>c(o,r==null?void 0:r.clone())))).forEach(c=>{var l;return c.status==="rejected"&&((l=t.logger)===null||l===void 0?void 0:l.error(c.reason))})},transformResponse:(n=t.hooks)===null||n===void 0?void 0:n.transformResponse}}))})(({baseUrl:e,projectId:t,baseConfig:n,refreshCookieName:o,logger:r,hooks:i,cookiePolicy:a,fetch:c})=>{const l=e||vr,d=yr(r,c),u=async p=>{var v;const w=i!=null&&i.beforeRequest?i.beforeRequest(p):p,{path:g,body:x,headers:y,queryParams:O,method:C,token:D}=w,E=(F=>F===void 0?void 0:JSON.stringify(F))(x),m={headers:br(jr(t,D),Ir(t,o),(n==null?void 0:n.baseHeaders)||{},Sr(E)?kr:{},y),method:C,body:E};a!==null&&(m.credentials=a||"include");const j=await d(zn({path:g,baseUrl:l,queryParams:O,projectId:t}),m);if(i!=null&&i.afterRequest&&await i.afterRequest(p,j==null?void 0:j.clone()),i==null?void 0:i.transformResponse){const F=await j.json(),J=(((v=j.headers)===null||v===void 0?void 0:v.get("set-cookie"))||"").split(";").reduce((_,B)=>{const[$,X]=B.split("=");return Object.assign(Object.assign({},_),{[$.trim()]:X})},{}),V=Object.assign(Object.assign({},j),{json:()=>Promise.resolve(F),cookies:J});return V.clone=()=>V,i.transformResponse(V)}return j};return{get:(p,{headers:v,queryParams:w,token:g}={})=>u({path:p,headers:v,queryParams:w,body:void 0,method:Oe.get,token:g}),post:(p,v,{headers:w,queryParams:g,token:x}={})=>u({path:p,headers:w,queryParams:g,body:v,method:Oe.post,token:x}),patch:(p,v,{headers:w,queryParams:g,token:x}={})=>u({path:p,headers:w,queryParams:g,body:v,method:Oe.patch,token:x}),put:(p,v,{headers:w,queryParams:g,token:x}={})=>u({path:p,headers:w,queryParams:g,body:v,method:Oe.put,token:x}),delete:(p,{headers:v,queryParams:w,token:g}={})=>u({path:p,headers:v,queryParams:w,body:void 0,method:Oe.delete,token:g}),hooks:i,buildUrl:(p,v)=>zn({projectId:t,baseUrl:l,path:p,queryParams:v})}}),Or={TOO_MANY_REQUESTS:429};function ao(e,t,n){var o;let r=ct(e);if(t){if(!(r!=null&&r.tenants)&&(r==null?void 0:r[so])===t)return(r==null?void 0:r[n])||[];r=(o=r==null?void 0:r.tenants)===null||o===void 0?void 0:o[t]}const i=r==null?void 0:r[n];return Array.isArray(i)?i:[]}function ct(e){if(typeof e!="string"||!e)throw new Error("Invalid token provided");return Vt(e)}function Ar(e){const{exp:t}=ct(e);return new Date().getTime()/1e3>t}function Ur(e){let t=ct(e);const n=Object.keys(t==null?void 0:t.tenants);return Array.isArray(n)?n:[]}function Er(e,t){return ao(e,t,"permissions")}function Tr(e,t){return ao(e,t,"roles")}const ae=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function k(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===Or.TOO_MANY_REQUESTS&&Object.assign(r.error,{retryAfter:Number.parseInt((n=o.headers)===null||n===void 0?void 0:n.get("retry-after"))||0})),r}function Dr(e){var t;return((t=ct(e))===null||t===void 0?void 0:t[so])||""}const je=(e,t)=>(n=t)=>o=>!e(o)&&n.replace("{val}",o),lo=(e,t)=>(n=t)=>o=>{const r=e.filter(i=>i(o));return!(r.length<e.length)&&(n?n.replace("{val}",o):r.join(" OR "))},co=(...e)=>({validate:t=>(e.forEach(n=>{const o=n(t);if(o)throw new Error(o)}),!0)}),uo=e=>t=>e.test(t),Pr=uo(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Rr=uo(/^\+[1-9]{1}[0-9]{3,14}$/),Fr=(e,t)=>n=>co(...t).validate(((o,r,i)=>{const a=(Array.isArray(r)?r.join("."):String(r)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,(u,p,v)=>"."+v).split("."),c=a.length;let l=0,d=o===Object(o)?o:void 0;for(;d!=null&&l<c;)d=d[a[l++]];return l&&l===c&&d!==void 0?d:i})(n,e)),Nr=je(Pr,'"{val}" is not a valid email'),zr=je(Rr,'"{val}" is not a valid phone number'),Lr=je((Ln=1,e=>e.length>=Ln),"Minimum length is 1");var Ln;const Fe=je(e=>typeof e=="string","Input is not a string"),Br=je(e=>Array.isArray(e),"Input is not an array"),Hr=je(e=>typeof e=="boolean","Input is not a boolean"),Wr=je(e=>e===void 0,"Input is defined"),Ft=lo([Fe(),Wr()],"Input is not a string or undefined"),qr=lo([Br(),Hr()],"Input is not an array or boolean"),T=(...e)=>t=>(...n)=>(e.forEach((o,r)=>co(...o).validate(n[r])),t(...n)),po=e=>[Fe(`"${e}" must be a string`)],ho=e=>[Ft(`"${e}" must be string or undefined`)],N=e=>[Fe(`"${e}" must be a string`),Lr(`"${e}" must not be empty`)],$t=e=>[Fe(`"${e}" must be a string`),Nr()],go=e=>[Fe(`"${e}" must be a string`),zr()],Mr=T(N("accessKey")),Jr=e=>({exchange:Mr((t,n)=>k(e.post(b.accessKey.exchange,{loginOptions:n},{token:t})))}),He=(e,t,n)=>(t.forEach(o=>{const r=o.split(".");let i=r.shift(),a=e;for(;r.length>0;){if(a=a[i],!i||!a)throw Error(`Invalid path "${o}", "${i}" is missing or has no value`);i=r.shift()}if(typeof a[i]!="function")throw Error(`"${o}" is not a function`);const c=a[i];a[i]=n(c)}),e),fo=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||Dn,Dn),timeoutMs:Math.min(t||Pn,Pn)});var ke,Nt;(function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp",e.im="im"})(ke||(ke={})),function(e){e.email="email"}(Nt||(Nt={}));const ve=Object.assign(Object.assign({},ke),Nt);var Bn;(function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"})(Bn||(Bn={}));const vo=N("loginId"),Kr=T(N("token")),jt=T(vo),Vr=T(N("pendingRef")),$r=T(vo,$t("email")),Yr=e=>({verify:Kr(t=>k(e.post(b.enchantedLink.verify,{token:t}))),signIn:jt((t,n,o={},r)=>{var{providerId:i}=o,a=H(o,["providerId"]);return k(e.post(ae(b.enchantedLink.signIn,ve.email),{loginId:t,URI:n,loginOptions:a,providerId:i},{token:r}))}),signUpOrIn:jt((t,n,o={})=>{var{providerId:r}=o,i=H(o,["providerId"]);return k(e.post(ae(b.enchantedLink.signUpOrIn,ve.email),{loginId:t,URI:n,loginOptions:i,providerId:r}))}),signUp:jt((t,n,o,r={})=>{var{providerId:i}=r,a=H(r,["providerId"]);return k(e.post(ae(b.enchantedLink.signUp,ve.email),{loginId:t,URI:n,user:o,loginOptions:a,providerId:i}))}),waitForSession:Vr((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=fo(n);let a;const c=setInterval(async()=>{const l=await e.post(b.enchantedLink.session,{pendingRef:t});l.ok&&(clearInterval(c),a&&clearTimeout(a),o(k(Promise.resolve(l))))},r);a=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)})),update:{email:$r((t,n,o,r,i)=>k(e.post(b.enchantedLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))}}),Xr=T(N("flowId")),Qr=T(N("executionId"),N("stepId"),N("interactionId")),Gr=e=>({start:Xr((t,n,o,r,i,a,c,l=!1)=>k(e.post(b.flow.start,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,componentsVersion:i,flowVersions:a,input:c,isCustomScreen:l}))),next:Qr((t,n,o,r,i,a,c=!1)=>k(e.post(b.flow.next,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:a,isCustomScreen:c})))}),Yt=N("loginId"),Zr=T(N("token")),It=T(Yt),_r=T(Yt,go("phone")),ei=T(Yt,$t("email")),St=Object.keys(ve).filter(e=>e!==ke.voice&&e!==ke.im),ti=e=>({verify:Zr(t=>k(e.post(b.magicLink.verify,{token:t}))),signIn:St.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:It((o,r,i={},a)=>{var{providerId:c}=i,l=H(i,["providerId"]);return k(e.post(ae(b.magicLink.signIn,n),{loginId:o,URI:r,loginOptions:l,providerId:c},{token:a}))})}),{}),signUp:St.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:It((o,r,i,a={})=>{var{providerId:c}=a,l=H(a,["providerId"]);return k(e.post(ae(b.magicLink.signUp,n),{loginId:o,URI:r,user:i,loginOptions:l,providerId:c}))})}),{}),signUpOrIn:St.reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:It((o,r,i={})=>{var{providerId:a}=i,c=H(i,["providerId"]);return k(e.post(ae(b.magicLink.signUpOrIn,n),{loginId:o,URI:r,loginOptions:c,providerId:a}))})}),{}),update:{email:ei((t,n,o,r,i)=>k(e.post(b.magicLink.update.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))),phone:Object.keys(ke).filter(t=>t!==ke.voice).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:_r((o,r,i,a,c)=>k(e.post(ae(b.magicLink.update.phone,n),Object.assign({loginId:o,phone:r,URI:i},c),{token:a})))}),{})}});var zt;(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"})(zt||(zt={}));const ni=T(N("code")),oi=e=>({start:Object.assign((t,n,o,r,i)=>k(e.post(b.oauth.start,o||{},{queryParams:Object.assign(Object.assign({provider:t},n&&{redirectURL:n}),i&&{loginHint:i}),token:r})),Object.keys(zt).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:(o,r,i,a)=>k(e.post(b.oauth.start,r||{},{queryParams:Object.assign(Object.assign({provider:n},o&&{redirectURL:o}),a&&{loginHint:a}),token:i}))}),{})),exchange:ni(t=>k(e.post(b.oauth.exchange,{code:t}))),startNative:(t,n,o)=>k(e.post(b.oauth.startNative,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>k(e.post(b.oauth.finishNative,{provider:t,stateId:n,user:o,code:r,idToken:i})),getOneTapClientId:t=>k(e.get(b.oauth.oneTap.getOneTapClientId.replace("{provider}",t))),verifyOneTapIDToken:(t,n,o,r)=>k(e.post(b.oauth.oneTap.verifyOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r})),exchangeOneTapIDToken:(t,n,o,r)=>k(e.post(b.oauth.oneTap.exchangeOneTapIDToken,{provider:t,idToken:n,nonce:o,loginOptions:r}))}),ri=N("appId"),ii=T(ri),si=e=>({connect:ii((t,n,o)=>{const r=n==null?void 0:n.tenantId,i=n==null?void 0:n.tenantLevel;return n==null||delete n.tenantId,n==null||delete n.tenantLevel,k(e.post(b.outbound.connect,{appId:t,tenantId:r,tenantLevel:i,options:n},{token:o}))})}),dt=N("loginId"),ai=T(dt,N("code")),Ct=T(dt),li=T(dt,go("phone")),ci=T(dt,$t("email")),di=e=>({verify:Object.keys(ve).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:ai((o,r)=>k(e.post(ae(b.otp.verify,n),{code:r,loginId:o})))}),{}),signIn:Object.keys(ve).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct((o,r={},i)=>{var{providerId:a}=r,c=H(r,["providerId"]);return k(e.post(ae(b.otp.signIn,n),{loginId:o,loginOptions:c,providerId:a},{token:i}))})}),{}),signUp:Object.keys(ve).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct((o,r,i={})=>{var{providerId:a}=i,c=H(i,["providerId"]);return k(e.post(ae(b.otp.signUp,n),{loginId:o,user:r,loginOptions:c,providerId:a}))})}),{}),signUpOrIn:Object.keys(ve).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:Ct((o,r={})=>{var{providerId:i}=r,a=H(r,["providerId"]);return k(e.post(ae(b.otp.signUpOrIn,n),{loginId:o,loginOptions:a,providerId:i}))})}),{}),update:{email:ci((t,n,o,r)=>k(e.post(b.otp.update.email,Object.assign({loginId:t,email:n},r),{token:o}))),phone:Object.keys(ke).reduce((t,n)=>Object.assign(Object.assign({},t),{[n]:li((o,r,i,a)=>k(e.post(ae(b.otp.update.phone,n),Object.assign({loginId:o,phone:r},a),{token:i})))}),{})}}),ui=T(N("tenant")),pi=T(N("code")),hi=e=>({start:ui((t,n,o,r,i,a,c,l)=>k(e.post(b.saml.start,o||{},Object.assign({queryParams:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({tenant:t},n&&{redirectURL:n}),i&&{ssoId:i}),a&&{forceAuthn:"true"}),c&&{loginHint:c}),l&&{initiatedEmail:t})},r&&{token:r})))),exchange:pi(t=>k(e.post(b.saml.exchange,{code:t})))}),Xt=N("loginId"),gi=T(Xt,N("code")),fi=T(Xt),vi=T(Xt),mi=e=>({signUp:fi((t,n)=>k(e.post(b.totp.signUp,{loginId:t,user:n}))),verify:gi((t,n,o,r)=>k(e.post(b.totp.verify,{loginId:t,code:n,loginOptions:o},{token:r}))),update:vi((t,n)=>k(e.post(b.totp.update,{loginId:t},{token:n})))}),ut=N("loginId"),mo=N("newPassword"),Hn=T(ut,N("password")),xi=T(ut),yi=T(ut,mo),wi=T(ut,N("oldPassword"),mo),bi=e=>({signUp:Hn((t,n,o,r={})=>{var{providerId:i}=r,a=H(r,["providerId"]);return k(e.post(b.password.signUp,{loginId:t,password:n,user:o,loginOptions:a,providerId:i}))}),signIn:Hn((t,n,o={})=>{var{providerId:r}=o,i=H(o,["providerId"]);return k(e.post(b.password.signIn,{loginId:t,password:n,loginOptions:i,providerId:r}))}),sendReset:xi((t,n,o)=>k(e.post(b.password.sendReset,{loginId:t,redirectUrl:n,templateOptions:o}))),update:yi((t,n,o)=>k(e.post(b.password.update,{loginId:t,newPassword:n},{token:o}))),replace:wi((t,n,o)=>k(e.post(b.password.replace,{loginId:t,oldPassword:n,newPassword:o}))),policy:()=>k(e.get(b.password.policy))}),ki=po("loginId"),Qt=N("loginId"),pt=N("origin"),ji=T(Qt,pt,N("name")),Ii=T(Qt,pt),Si=T(ki,pt),Ci=T(Qt,pt,ho("token")),Ot=T(N("transactionId"),N("response")),Oi=e=>({signUp:{start:ji((t,n,o,r)=>k(e.post(b.webauthn.signUp.start,{user:{loginId:t,name:o},origin:n,passkeyOptions:r}))),finish:Ot((t,n)=>k(e.post(b.webauthn.signUp.finish,{transactionId:t,response:n})))},signIn:{start:Si((t,n,o,r,i)=>k(e.post(b.webauthn.signIn.start,{loginId:t,origin:n,loginOptions:o,passkeyOptions:i},{token:r}))),finish:Ot((t,n)=>k(e.post(b.webauthn.signIn.finish,{transactionId:t,response:n})))},signUpOrIn:{start:Ii((t,n,o)=>k(e.post(b.webauthn.signUpOrIn.start,{loginId:t,origin:n,passkeyOptions:o})))},update:{start:Ci((t,n,o,r)=>k(e.post(b.webauthn.update.start,{loginId:t,origin:n,passkeyOptions:r},{token:o}))),finish:Ot((t,n)=>k(e.post(b.webauthn.update.finish,{transactionId:t,response:n})))}}),Ai=po("loginId"),At=T(Ai),Ui=T(N("pendingRef")),Ei=e=>({signUpOrIn:At((t,n={})=>{var{providerId:o}=n,r=H(n,["providerId"]);return k(e.post(b.notp.signUpOrIn,{loginId:t,loginOptions:r,providerId:o}))}),signUp:At((t,n,o={})=>{var{providerId:r}=o,i=H(o,["providerId"]);return k(e.post(b.notp.signUp,{loginId:t,user:n,providerId:r,loginOptions:i}))}),signIn:At((t,n={},o)=>{var{providerId:r}=n,i=H(n,["providerId"]);return k(e.post(b.notp.signIn,{loginId:t,loginOptions:i,providerId:r},{token:o}))}),waitForSession:Ui((t,n)=>new Promise(o=>{const{pollingIntervalMs:r,timeoutMs:i}=fo(n);let a;const c=setInterval(async()=>{const l=await e.post(b.notp.session,{pendingRef:t});l.ok&&(clearInterval(c),a&&clearTimeout(a),o(k(Promise.resolve(l))))},r);a=setTimeout(()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(c)},i)}))}),We=T(N("token")),qe=T(ho("token"));var Wn,qn,Ti=T([(Wn="projectId",qn=N("projectId"),je(Fr(Wn,qn))())])(e=>{const{projectId:t,logger:n,baseUrl:o,cookiePolicy:r,baseHeaders:i={},refreshCookieName:a,fetch:c}=e;return l=Cr({baseUrl:o,projectId:t,logger:n,hooks:{get beforeRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.beforeRequest},get afterRequest(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.afterRequest},get transformResponse(){var d;return(d=e.hooks)===null||d===void 0?void 0:d.transformResponse}},cookiePolicy:r,baseConfig:{baseHeaders:i},refreshCookieName:a,fetch:c}),{accessKey:Jr(l),otp:di(l),magicLink:ti(l),enchantedLink:Yr(l),oauth:oi(l),outbound:si(l),saml:hi(l),totp:mi(l),notp:Ei(l),webauthn:Oi(l),password:bi(l),flow:Gr(l),refresh:qe((d,u,p,v)=>{const w={};p&&(w.externalToken=p);const g=v?b.tryRefresh:b.refresh;return k(l.post(g,w,{token:d,queryParams:u}))}),selectTenant:T([Fe("tenantId")],[Ft('"token" must be string or undefined')])((d,u)=>k(l.post(b.selectTenant,{tenant:d},{token:u}))),logout:qe(d=>k(l.post(b.logout,{},{token:d}))),logoutAll:qe(d=>k(l.post(b.logoutAll,{},{token:d}))),me:qe(d=>k(l.get(b.me,{token:d}))),myTenants:T([qr('"tenants" must a string array or a boolean')],[Ft('"token" must be string or undefined')])((d,u)=>{const p={};return typeof d=="boolean"?p.dct=d:p.ids=d,k(l.post(b.myTenants,p,{token:u}))}),history:qe(d=>k(l.get(b.history,{token:d}))),isJwtExpired:We(Ar),getTenants:We(Ur),getJwtPermissions:We(Er),getJwtRoles:We(Tr),getCurrentTenant:We(Dr),httpClient:l};var l}),Di=Object.assign(Ti,{DeliveryMethods:ve});/*! js-cookie v3.0.5 | MIT */function et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var Pi={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)}};function Lt(e,t){function n(r,i,a){if(!(typeof document>"u")){a=et({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var l in a)a[l]&&(c+="; "+l,a[l]!==!0&&(c+="="+a[l].split(";")[0]));return document.cookie=r+"="+e.write(i,r)+c}}function o(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var i=document.cookie?document.cookie.split("; "):[],a={},c=0;c<i.length;c++){var l=i[c].split("="),d=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(a[u]=e.read(d,u),r===u)break}catch{}}return r?a[r]:a}}return Object.create({set:n,get:o,remove:function(r,i){n(r,"",et({},i,{expires:-1}))},withAttributes:function(r){return Lt(this.converter,et({},this.attributes,r))},withConverter:function(r){return Lt(et({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Re=Lt(Pi,{path:"/"});function Ri(e,t){return function(n,o){return Object.prototype.hasOwnProperty.call(n,o)}(e,t)?e[t]:void 0}function Fi(e,t,n,o){var r,i=document,a="securitypolicyviolation",c=function(d){var u=new URL(e,location.href),p=d.blockedURI;p!==u.href&&p!==u.protocol.slice(0,-1)&&p!==u.origin||(r=d,l())};i.addEventListener(a,c);var l=function(){return i.removeEventListener(a,c)};return o==null||o.then(l,l),Promise.resolve().then(t).then(function(d){return l(),d},function(d){return new Promise(function(u){var p=new MessageChannel;p.port1.onmessage=function(){return u()},p.port2.postMessage(null)}).then(function(){if(l(),r)return n(r);throw d})})}var Ni={default:"endpoint"},xo="Blocked by CSP",yo="The endpoint parameter is not a valid URL",zi="API key required",Li="3.11.6",Gt="Failed to load the JS script of the agent",Zt="9319";function Bi(e,t){var n,o,r,i,a,c,l,d=[],u=(n=function(g){var x=ur([],g,!0);return{current:function(){return x[0]},postpone:function(){var y=x.shift();y!==void 0&&x.push(y)},exclude:function(){x.shift()}}}(e),i=100,a=3e3,c=0,o=function(){return Math.random()*Math.min(a,i*Math.pow(2,c++))},r=new Set,[n.current(),function(g,x){var y,O=x instanceof Error?x.message:"";if(O===xo||O===yo)n.exclude(),y=0;else if(O===Zt)n.exclude();else if(O===Gt){var C=Date.now()-g.getTime()<50,D=n.current();D&&C&&!r.has(D)&&(r.add(D),y=0),n.postpone()}else n.postpone();var E=n.current();return E===void 0?void 0:[E,y??g.getTime()+o()-Date.now()]}]),p=u[0],v=u[1];if(p===void 0)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var w=function(g){var x=new Date,y=function(C){return d.push({url:g,startedAt:x,finishedAt:new Date,error:C})},O=t(g);return O.then(function(){return y()},y),O.catch(function(C){if(l!=null||(l=C),d.length>=5)throw l;var D=v(x,C);if(!D)throw l;var E,m=D[0],j=D[1];return(E=j,new Promise(function(F){return setTimeout(F,E)})).then(function(){return w(m)})})};return w(p).then(function(g){return[g,d]})}var wo="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Hi=wo;function Wi(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=o===void 0?n:o,i=H(e,["scriptUrlPattern","token","apiKey"]),a=(t=Ri(e,"scriptUrlPattern"))!==null&&t!==void 0?t:wo,c=function(){var u=[],p=function(){u.push({time:new Date,state:document.visibilityState})},v=function(w,g,x,y){return w.addEventListener(g,x,y),function(){return w.removeEventListener(g,x,y)}}(document,"visibilitychange",p);return p(),[u,v]}(),l=c[0],d=c[1];return Promise.resolve().then(function(){if(!r||typeof r!="string")throw new Error(zi);var u=function(p,v){return(Array.isArray(p)?p:[p]).map(function(w){return function(g,x){var y=encodeURIComponent;return g.replace(/<[^<>]+>/g,function(O){return O==="<version>"?"3":O==="<apiKey>"?y(x):O==="<loaderVersion>"?y(Li):O})}(String(w),v)})}(a,r);return Bi(u,qi)}).catch(function(u){throw d(),function(p){return p instanceof Error&&p.message===Zt?new Error(Gt):p}(u)}).then(function(u){var p=u[0],v=u[1];return d(),p.load(st(st({},i),{ldi:{attempts:v,visibilityStates:l}}))})}function qi(e){return Fi(e,function(){return function(t){return new Promise(function(n,o){if(function(c){if(URL.prototype)try{return new URL(c,location.href),!1}catch(l){if(l instanceof Error&&l.name==="TypeError")return!0;throw l}}(t))throw new Error(yo);var r=document.createElement("script"),i=function(){var c;return(c=r.parentNode)===null||c===void 0?void 0:c.removeChild(r)},a=document.head||document.getElementsByTagName("head")[0];r.onload=function(){i(),n()},r.onerror=function(){i(),o(new Error(Gt))},r.async=!0,r.src=t,a.appendChild(r)})}(e)},function(){throw new Error(xo)}).then(Mi)}function Mi(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(o,r){var i,a=(i=Object.getOwnPropertyDescriptor)===null||i===void 0?void 0:i.call(Object,o,r);a!=null&&a.configurable?delete o[r]:a&&!a.writable||(o[r]=void 0)}(e,t),typeof(n==null?void 0:n.load)!="function")throw new Error(Zt);return n}const bo="3.2.0",te=typeof window<"u",Ut=Math.pow(2,31)-1,Ji=`https://descopecdn.com/npm/oidc-client-ts@${bo}/dist/browser/oidc-client-ts.min.js`,Ki=`https://cdn.jsdelivr.net/npm/oidc-client-ts@${bo}/dist/browser/oidc-client-ts.min.js`,Vi=["/v1/auth/refresh","/v1/auth/try-refresh","/v1/auth/me","/v1/auth/me/tenants","/v1/auth/me/history"];let he;const ko=e=>{try{return Vt(e).exp}catch{return null}},$i=e=>{const{refresh_expire_in:t,refresh_token:n}=e;return t?Math.floor(Date.now()/1e3)+t:ko(n)},Yi=e=>{const{expires_in:t,expires_at:n,access_token:o}=e;return n||(t?Math.floor(Date.now()/1e3)+t:o?ko(o):void 0)},jo=e=>{const{access_token:t,id_token:n,refresh_token:o,refresh_expire_in:r}=e,i=H(e,["access_token","id_token","refresh_token","refresh_expire_in"]);return Object.assign({sessionJwt:e.sessionJwt||t,idToken:n,refreshJwt:e.refreshJwt||o,sessionExpiration:e.sessionExpiration||Yi(e),cookieExpiration:e.cookieExpiration||$i(e)},i)},Ee=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce((o,r)=>{var i;return o[r]=[].concat(((i=e.hooks)===null||i===void 0?void 0:i[r])||[]).concat((t==null?void 0:t[r])||[]),o},(n=e.hooks)!==null&&n!==void 0?n:e.hooks={}),e},tt=async e=>{if(!(e!=null&&e.ok))return{};const t=await(e==null?void 0:e.clone().json()),n=(t==null?void 0:t.authInfo)||t||{};return jo(n)},Bt=()=>te&&!!window.descopeBridge,Et=(e,t)=>{if(!((t==null?void 0:t.status)>=400&&(t==null?void 0:t.status)<500))return!1;const n=(e==null?void 0:e.path)||"";return Vi.includes(n)},Xi=he!==void 0||te&&window.localStorage!==void 0,pe=(e,t)=>{var n,o;return(o=(n=he||te&&window.localStorage)===null||n===void 0?void 0:n.setItem)===null||o===void 0?void 0:o.call(n,e,t)},de=e=>{var t,n;return(n=(t=he||te&&window.localStorage)===null||t===void 0?void 0:t.getItem)===null||n===void 0?void 0:n.call(t,e)},re=e=>{var t,n;return(n=(t=he||te&&window.localStorage)===null||t===void 0?void 0:t.removeItem)===null||n===void 0?void 0:n.call(t,e)},Qi=e=>{var t,n,o,r,i;return(i=(n=(t=he==null?void 0:he.key)===null||t===void 0?void 0:t.call(he,e))!==null&&n!==void 0?n:te&&((r=(o=window.localStorage)===null||o===void 0?void 0:o.key)===null||r===void 0?void 0:r.call(o,e)))!==null&&i!==void 0?i:null},q=(...e)=>{console.debug(...e)},nt=(...e)=>{console.warn(...e)},Gi=(e,t)=>{let n;var o;return t>0?(n=1e3*t,q(`Using provided nextRefreshSeconds: ${t}s`)):n=((o=e)?o.getTime()-new Date().getTime():0)-2e4,n>Ut&&(q(`Timeout is too large (${n}ms), setting it to ${Ut}ms`),n=Ut),n},ht="DS",Ye="DSR",_t="DSI",at="DSRCN";function Mn(e,t,n){if(t){const{cookieDomain:o,cookiePath:r,cookieSameSite:i,cookieExpiration:a,cookieSecure:c}=n,l=new Date(1e3*a),d=Ht(o);Re.set(e,t,{path:r,domain:d?o:void 0,expires:l,sameSite:i,secure:c})}}function Ht(e){const t=window.location.hostname.split("."),n=e==null?void 0:e.split(".");return t.slice(-(n==null?void 0:n.length)).join(".")===e}const en=e=>(e==null?void 0:e.cookieName)||ht,lt=e=>(e==null?void 0:e.cookieName)||Ye;function De(e="",t){return Re.get(lt(t))||de(`${e}${Ye}`)||""}function Jn(e="",t){return Re.get(en(t))||de(`${e}${ht}`)||""}function Io(e=""){return de(`${e}${_t}`)||""}function So(e="",t,n,o){re(`${e}${Ye}`),re(`${e}${ht}`),re(`${e}${_t}`),re(`${e}${at}`);const r=en(t);Re.remove(r,o==null?void 0:o.session);const i=lt(n);Re.remove(i,o==null?void 0:o.refresh)}const Zi=(e,t,n)=>o=>{const r=Object.assign(o,{token:o.token||De(e,t)});if(!n){const a=function(c=""){return de(`${c}${at}`)}(e);a&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-refresh-cookie-name":a}))}const i=function(a=""){return de(`${a}DTD`)||""}(e);return i&&(r.headers=Object.assign(Object.assign({},r.headers||{}),{"x-descope-trusted-device-token":i})),r},_i=te&&(localStorage==null?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",es="vsid",ts="vrid",tn="fp",Co=(e=!1)=>{const t=de(tn);if(!t)return null;const n=JSON.parse(t);return new Date().getTime()>n.expiry&&!e?null:n.value},Oo=async(e,t=_i)=>{try{if(Co())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>",a=Wi({apiKey:e,endpoint:[o.toString(),Ni],scriptUrlPattern:[i,Hi]}),c=await a,{requestId:l}=await c.get({linkedId:n}),d=((u,p)=>({[es]:u,[ts]:p}))(n,l);(u=>{const p={value:u,expiry:new Date().getTime()+864e5};pe(tn,JSON.stringify(p))})(d)}catch(n){console.warn("Could not load fingerprint",n)}},ns=()=>{re(tn)},os=e=>{const t=Co(!0);return t&&e.body&&(e.body.fpData=t),e},Pe="descopeFlowNonce",Kn="X-Descope-Flow-Nonce",Vn="/v1/flow/start",Wt="/v1/flow/next",qt=(e,t=Pe)=>`${t}${e}`,rs=(e,t=Pe)=>{try{const n=qt(e,t);re(n)}catch(n){console.error("Error removing flow nonce:",n)}},Ao=e=>{var t;return((t=/.*\|#\|(.*)/.exec(e))===null||t===void 0?void 0:t[1])||null},$n=e=>{var t;return e.path===Wt&&(!((t=e.body)===null||t===void 0)&&t.executionId)?Ao(e.body.executionId):null},nn="dls_last_user_login_id",on="dls_last_user_display_name",Yn=e=>pe(nn,e),Mt=()=>de(nn),Jt=()=>de(on),is=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=Mt(),i=Jt();return r&&((n=o.lastAuth)!==null&&n!==void 0||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i),await e(...t)},ss=e=>t=>async(...n)=>{const o=await t(...n);return e||(re(nn),re(on)),o};function ot(){const e=[];return{pub:t=>{e.forEach(n=>n(t))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const as=(e,t,n,o)=>r=>async(...i)=>{const a=await r(...i);return So(e,t,n,o==null?void 0:o()),a};async function rt(e){const t=function(r){var i;const a=JSON.parse(r);return a.publicKey.challenge=$e(a.publicKey.challenge),a.publicKey.user.id=$e(a.publicKey.user.id),(i=a.publicKey.excludeCredentials)===null||i===void 0||i.forEach(c=>{c.id=$e(c.id)}),a}(e);return o=await navigator.credentials.create(t),JSON.stringify({id:o.id,rawId:be(o.rawId),type:o.type,response:{attestationObject:be(o.response.attestationObject),clientDataJSON:be(o.response.clientDataJSON)}});var o}async function Tt(e){const t=Eo(e);return To(await navigator.credentials.get(t))}async function ls(e,t){const n=Eo(e);return n.signal=t.signal,n.mediation="conditional",To(await navigator.credentials.get(n))}async function Uo(e=!1){var t,n;if(!te)return Promise.resolve(!1);if(Bt()){const r=(n=(t=window.descopeBridge)===null||t===void 0?void 0:t.hostInfo)===null||n===void 0?void 0:n.webauthn;if(typeof r=="boolean")return r}const o=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return o&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():o}function Eo(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=$e(n.publicKey.challenge),(t=n.publicKey.allowCredentials)===null||t===void 0||t.forEach(o=>{o.id=$e(o.id)}),n}function To(e){return JSON.stringify({id:e.id,rawId:be(e.rawId),type:e.type,response:{authenticatorData:be(e.response.authenticatorData),clientDataJSON:be(e.response.clientDataJSON),signature:be(e.response.signature),userHandle:e.response.userHandle?be(e.response.userHandle):void 0}})}function $e(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),n=>n.charCodeAt(0)).buffer}function be(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Xn,cs=(Xn=e=>({async signUp(t,n,o){const r=await e.webauthn.signUp.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await rt(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)},async signIn(t,n){const o=await e.webauthn.signIn.start(t,window.location.origin,void 0,void 0,n);if(!o.ok)return o;const r=await Tt(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,r)},async signUpOrIn(t,n){var o;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin,n);if(!r.ok)return r;if(!((o=r.data)===null||o===void 0)&&o.create){const i=await rt(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,i)}{const i=await Tt(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,i)}},async update(t,n,o){const r=await e.webauthn.update.start(t,window.location.origin,n,o);if(!r.ok)return r;const i=await rt(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,i)},helpers:{create:rt,get:Tt,isSupported:Uo,conditional:ls}}),(...e)=>{const t=Xn(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const Qn={config:"/fedcm/config"},ds=()=>{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);return window.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).substring(2)};async function Gn(e,t){var n;try{await Do(e,t)}catch(o){(n=t==null?void 0:t.onFailed)===null||n===void 0||n.call(t,o)}}async function Do(e,t){var n,o;const r=await async function(i,a="google",c,l,d){const u=ds(),p=await async function(){return new Promise((g,x)=>{if(window.google)return void g(window.google.accounts.id);let y=document.getElementById("google-gsi-client-script");y||(y=document.createElement("script"),document.head.appendChild(y),y.async=!0,y.defer=!0,y.id="google-gsi-client-script",y.src="https://accounts.google.com/gsi/client"),y.onload=function(){window.google?g(window.google.accounts.id):x("Failed to load Google GSI client script - not loaded properly")},y.onerror=function(){x("Failed to load Google GSI client script - failed to load")}})}(),v=await i.oauth.getOneTapClientId(a);if(!v.ok)throw new Error("Failed to get OneTap client ID for provider "+a);const w=v.data.clientId;return new Promise(g=>{var x,y;const O=C=>{g({provider:a,nonce:u,credential:C==null?void 0:C.credential})};p.initialize(Object.assign(Object.assign({},c),{itp_support:(x=c==null?void 0:c.itp_support)===null||x===void 0||x,use_fedcm_for_prompt:(y=c==null?void 0:c.use_fedcm_for_prompt)===null||y===void 0||y,client_id:w,callback:O,nonce:u})),p.prompt(C=>{var D,E;if(d&&(C!=null&&C.isDismissedMoment())){const m=(D=C.getDismissedReason)===null||D===void 0?void 0:D.call(C);return d==null||d(m),void O()}if(l&&(C!=null&&C.isSkippedMoment())){const m=(E=C.getSkippedReason)===null||E===void 0?void 0:E.call(C);return l==null||l(m),void O()}})})}(e,t.provider,t.oneTapConfig,t.onSkipped,t.onDismissed);if(!r.credential)return null;if(t!=null&&t.onCodeReceived){const i=await e.oauth.verifyOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to verify OneTap client ID for provider "+r.provider);(n=t==null?void 0:t.onCodeReceived)===null||n===void 0||n.call(t,i.data.code)}else{const i=await e.oauth.exchangeOneTapIDToken(r.provider,r.credential,r.nonce,t==null?void 0:t.loginOptions);if(!i.ok||!i.data)throw new Error("Failed to exchange OneTap client ID for provider "+r.provider);(o=t==null?void 0:t.onAuthenticated)===null||o===void 0||o.call(t,i.data)}}var us=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Uo(),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 ps=()=>window.location.search.includes("code")&&window.location.search.includes("state");let Dt;const Po=(e,t)=>new Promise((n,o)=>{if(!e.length)return o(new Error("No URLs provided to loadScriptWithFallback"));const r=t();if(r)return n(r);const i=e.shift(),a=document.createElement("script");a.src=i,a.id=(c=>{let l=0;for(let d=0;d<c.length;d++)l=(l<<5)-l+c.charCodeAt(d),l|=0;return Math.abs(l).toString(16)})(i),a.onload=()=>{const c=t();if(c)return n(c);throw new Error("Could not get entry after loading script from URL")},a.addEventListener("error",()=>{Po(e,t),a.setAttribute("data-error","true")}),document.body.appendChild(a)}),hs=async(e,t,n)=>{Dt||(Dt=(async()=>{try{return require("oidc-client-ts")}catch{return Po([Ji,Ki],()=>window.oidc)}})());const{OidcClient:o,WebStorageStateStore:r}=await Dt;if(!o)throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");const i=(n==null?void 0:n.redirectUri)||window.location.href;let a,c,l,d;if(n!=null&&n.issuer){if(!n.clientId)throw new Error("clientId is required when providing a custom issuer/authority");a=n.issuer,c=n.clientId,l=`${c}_user`,d="openid"}else n!=null&&n.applicationId?(a=e.httpClient.buildUrl(t),a=`${a}/${n.applicationId}`,c=t,l=`${c}_user`,d="openid email roles descope.custom_claims offline_access"):(a=e.httpClient.buildUrl(t),c=t,l=`${c}_user`,d="openid email roles descope.custom_claims offline_access");const u={authority:a,client_id:c,redirect_uri:i,response_type:"code",scope:(n==null?void 0:n.scope)||d,stateStore:new r({store:window.localStorage,prefix:c}),loadUserInfo:!0,fetchRequestCredentials:"same-origin"};return n!=null&&n.redirectUri&&(u.redirect_uri=n.redirectUri),{client:new o(u),stateUserKey:l}},gs=(e,t,n)=>{const o=async()=>{let i,a;return i&&a||({client:i,stateUserKey:a}=await hs(e,t,n)),{client:i,stateUserKey:a}},r=async(i="")=>{var a;const{client:c,stateUserKey:l}=await o(),d=await c.processSigninResponse(i||window.location.href);var u;return await((a=e.httpClient.hooks)===null||a===void 0?void 0:a.afterRequest({},new Response(JSON.stringify(d)))),pe(l,JSON.stringify({id_token:(u=d).id_token,session_state:u.session_state,profile:u.profile})),(()=>{const p=new URL(window.location.href);p.searchParams.delete("code"),p.searchParams.delete("state"),window.history.replaceState({},document.title,p.toString())})(),d};return{loginWithRedirect:async(i={},a=!1)=>{const{client:c}=await o(),l=await c.createSigninRequest(i),{url:d}=l;return a||(window.location.href=d),{ok:!0,data:l}},finishLogin:r,finishLoginIfNeed:async(i="")=>{if(ps())return await r(i)},refreshToken:async i=>{var a;const{client:c,stateUserKey:l}=await o(),d=(v=>{const w=de(v);return w?JSON.parse(w):null})(l);if(!d)throw new Error("User not found in storage to refresh token");let u=i;if(!u){const v={};e.httpClient.hooks.beforeRequest(v),u=v.token}const p=await c.useRefreshToken({state:{refresh_token:u,session_state:d.session_state,profile:d.profile}});return await((a=e.httpClient.hooks)===null||a===void 0?void 0:a.afterRequest({},new Response(JSON.stringify(p)))),p},logout:async(i,a=!1)=>{const{client:c,stateUserKey:l}=await o();i||(i={}),i.id_token_hint=i.id_token_hint||Io(),i.post_logout_redirect_uri=i.post_logout_redirect_uri||window.location.href;const d=await c.createSignoutRequest(i),{url:u}=d;return re(l),a||window.location.replace(u),d}}},Ro=function(...e){return t=>e.reduce((n,o)=>o(n),t)}(e=>t=>{var n;return n=t.customStorage,he=n,e(t)},e=>t=>{var{fpKey:n,fpLoad:o}=t,r=H(t,["fpKey","fpLoad"]);return te?(n&&o&&Oo(n).catch(()=>null),e(Ee(r,{beforeRequest:os}))):e(r)},e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.47.0"},t.baseHeaders)})),e=>t=>{const n=ot(),o=ot(),r=ot(),i=ot(),a=e(Ee(t,{afterRequest:async(l,d)=>{if(Et(l,d))q("Session invalidated, notifying subscribers with empty values"),o.pub(null),r.pub(null),n.pub(null),i.pub(null);else{const u=await(async g=>{const x=await tt(g);return(x==null?void 0:x.user)||(x!=null&&x.hasOwnProperty("userId")?x:void 0)})(d);u&&r.pub(u);const{sessionJwt:p,sessionExpiration:v,claims:w}=await tt(d);p&&o.pub(p),w&&i.pub(w),(v||p)&&n.pub(v||42)}}})),c=He(a,["logout","logoutAll","oidc.logout"],l=>async(...d)=>{const u=await l(...d);return o.pub(null),r.pub(null),n.pub(null),i.pub(null),u});return Object.assign(c,{onSessionTokenChange:o.sub,onUserChange:r.sub,onClaimsChange:i.sub,onIsAuthenticatedChange:l=>n.sub(d=>{l(!!d)})})},e=>t=>{const{enableFlowNonce:n=!0,nonceStoragePrefix:o=Pe}=t,r=H(t,["enableFlowNonce","nonceStoragePrefix"]);return n?(((i=Pe)=>{try{if(!Xi)return;for(let d=0;d<(a=void 0,c=void 0,l=void 0,(l=(a=he==null?void 0:he.length)!==null&&a!==void 0?a:te&&((c=window.localStorage)===null||c===void 0?void 0:c.length))!==null&&l!==void 0?l:0);d++){const u=Qi(d);if(u&&u.startsWith(i)){const p=de(u);if(p)try{JSON.parse(p).expiry<Date.now()&&re(u)}catch{re(u)}}}}catch(d){console.error("Error cleaning up expired nonces:",d)}var a,c,l})(o),e(Ee(r,{afterRequest:async(i,a)=>{if(i.path!==Vn&&i.path!==Wt)return;const{nonce:c,executionId:l}=await(async(d,u)=>{try{const p=u.headers.get(Kn);let v=await u.clone().json().then(w=>(w==null?void 0:w.executionId)||null).catch(()=>null);return v||(v=$n(d)),{nonce:p,executionId:Ao(v)}}catch{return{nonce:null,executionId:null}}})(i,a);c&&l&&((d,u,p,v=Pe)=>{try{const w=qt(d,v),g=p?172800:10800,x={value:u,expiry:Date.now()+1e3*g,isStart:p};pe(w,JSON.stringify(x))}catch(w){console.error("Error setting flow nonce:",w)}})(l,c,i.path===Vn,o)},beforeRequest:i=>{if(i.path===Wt){const a=$n(i);if(a){const c=((l,d=Pe)=>{try{const u=qt(l,d),p=de(u);if(!p)return null;const v=JSON.parse(p);return v.expiry<Date.now()?(rs(l,d),null):v.value}catch(u){return console.error("Error getting flow nonce:",u),null}})(a,o);c&&(i.headers=i.headers||{},i.headers[Kn]=c)}}return i}}))):e(r)},e=>t=>{var{autoRefresh:n}=t,o=H(t,["autoRefresh"]);const r=!!n,i=typeof n=="object"&&(n==null?void 0:n.customActivityTracking);if(!r||Bt())return Object.assign(e(o),{markUserActive:()=>{nt("markUserActive() called but has no effect")}});const{clearAllTimers:a,setTimer:c}=(()=>{const g=[];return{clearAllTimers:()=>{for(;g.length;)clearTimeout(g.pop())},setTimer:(x,y)=>{g.push(setTimeout(x,y))}}})();let l,d,u=null,p=!1,v=!1;i&&(q("Activity-based refresh enabled"),u=(()=>{let g=!0;return{hadActivity:()=>g,reset:()=>{g=!1},markActive:()=>{g=!0}}})()),te&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&l&&new Date>l&&(q("Expiration time passed, refreshing session"),w.refresh(De()||d))});const w=e(Ee(o,{afterRequest:async(g,x)=>{const{sessionJwt:y,refreshJwt:O,sessionExpiration:C,nextRefreshSeconds:D}=await tt(x);if(Et(g,x))q("Session invalidated, canceling all timers"),a();else if(y||C){if(l=((j,F)=>{if(F)return new Date(1e3*F);q("Could not extract expiration time from session token, trying to decode the token");try{const J=Vt(j);if(J.exp)return new Date(1e3*J.exp)}catch{return null}})(y,C),!l)return void q("Could not extract expiration time from session token");d=O,p=D>0;const E=Gi(l,D);if(a(),E<=2e4)return void q("Session is too close to expiration, not setting refresh timer");const m=new Date(Date.now()+E).toLocaleTimeString("en-US",{hour12:!1});q(`Setting refresh timer for ${m}. (${E}ms)`),u&&(u.reset(),v=!1),c(()=>{if(te&&document.visibilityState==="hidden")q("Skipping refresh due to timer - document is hidden");else{if(u&&p&&!u.hadActivity())return q("Skipping refresh due to timer - user is idle"),void(v=!0);q("Refreshing session due to timer"),w.refresh(De()||O)}},E)}}}));return Object.assign(He(w,["logout","logoutAll","oidc.logout"],g=>async(...x)=>{const y=await g(...x);return q("Clearing all timers"),a(),y}),{markUserActive:u?()=>{q("markUserActive() called"),p||q("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"),u.markActive(),v&&(q("User became active after skipped refresh, triggering refresh"),v=!1,a(),w.refresh(De()||d))}:()=>{nt("markUserActive() called but customActivityTracking is not enabled — this call has no effect")}})},e=>t=>{var{storeLastAuthenticatedUser:n=!0,keepLastAuthenticatedUserAfterLogout:o=!1}=t,r=H(t,["storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout"]);if(!n)return Object.assign(e(r),{getLastUserLoginId:Mt,getLastUserDisplayName:Jt});const i=e(Ee(r,{afterRequest:async(c,l)=>{var d;const{userInfo:u,lastAuth:p}=await(async g=>{if(!(g!=null&&g.ok))return{userInfo:void 0,lastAuth:void 0};const x=await(g==null?void 0:g.clone().json()),y=jo((x==null?void 0:x.authInfo)||x||{});return{userInfo:(y==null?void 0:y.user)||(y!=null&&y.hasOwnProperty("userId")?y:void 0),lastAuth:x.lastAuth}})(l),v=(d=u==null?void 0:u.loginIds)===null||d===void 0?void 0:d[0],w=u==null?void 0:u.name;v?(Yn(v),(g=>{pe(on,g)})(w)):p!=null&&p.loginId&&Yn(p.loginId)}}));let a=He(i,["flow.start"],is);return a=He(a,["logout","logoutAll"],ss(o)),Object.assign(a,{getLastUserLoginId:Mt,getLastUserDisplayName:Jt})},e=>t=>{var{persistTokens:n,sessionTokenViaCookie:o,refreshTokenViaCookie:r,storagePrefix:i,refreshCookieName:a}=t,c=H(t,["persistTokens","sessionTokenViaCookie","refreshTokenViaCookie","storagePrefix","refreshCookieName"]);if(!n||!te)return e(Object.assign({refreshCookieName:a},c));let l;const d=e(Ee(Object.assign({refreshCookieName:a},c),{beforeRequest:Zi(i,r,a),afterRequest:async(p,v)=>{if(Et(p,v))q("Session invalidated, clearing persisted tokens"),So(i,o,r,l);else{const w=await tt(v);w.cookieName?pe(`${i||""}${at}`,w.cookieName):w.refreshJwt&&re(`${i||""}${at}`);const g=((x={},y=!1,O="",C=!1)=>{var D,E,m,j;const{sessionJwt:F,refreshJwt:J,trustedDeviceJwt:V}=x;let _;if(J)if(C){re(`${O}${Ye}`);const B=C.sameSite||"Strict",$=(D=C.secure)===null||D===void 0||D,X=(E=C.domain)!==null&&E!==void 0?E:x.cookieDomain,ue=lt(C);$&&window.location.protocol!=="https:"&&nt("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const L=Object.assign(Object.assign({},x),{cookieSameSite:B,cookieSecure:$,cookieDomain:X});Mn(ue,J,L);const ne=Ht(X);_=Object.assign(Object.assign({},_),{refresh:{path:L.cookiePath,domain:ne?X:void 0}})}else{const B=lt(C);Re.remove(B),pe(`${O}${Ye}`,J)}if(F)if(y){const B=y.sameSite||"Strict",$=(m=y.secure)===null||m===void 0||m,X=(j=y.domain)!==null&&j!==void 0?j:x.cookieDomain,ue=en(y);$&&window.location.protocol!=="https:"&&nt("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");const L=Object.assign(Object.assign({},x),{cookieSameSite:B,cookieSecure:$,cookieDomain:X});Mn(ue,F,L);const ne=Ht(X);_=Object.assign(Object.assign({},_),{session:{path:L.cookiePath,domain:ne?X:void 0}})}else pe(`${O}${ht}`,F);return x.idToken&&pe(`${O}${_t}`,x.idToken),V&&pe(`${O}DTD`,V),_})(w,o,i,r);g&&(l=g)}}})),u=He(d,["logout","logoutAll","oidc.logout"],as(i,o,r,()=>l));return Object.assign(u,{getRefreshToken:()=>De(i,r),getSessionToken:()=>Jn(i,o),getIdToken:()=>Io(i)})})(e=>{const t=Di(e),n=gs(t,e.projectId,e.oidcConfig);return Object.assign(Object.assign({},t),{refresh:async(i,a)=>{var c;if(Bt())return q(`Refresh called in native flow: ${new Error().stack}`),Promise.resolve({ok:!1,error:{errorCode:"J171000",errorDescription:"Refresh is not supported in native flows via the web SDK"}});if(e.oidcConfig)try{return await n.refreshToken(i),Promise.resolve({ok:!0})}catch(p){return Promise.resolve({ok:!1,error:{errorCode:"J161001",errorDescription:p.toString()}})}const l=Jn(),d=De();let u="";if(e.getExternalToken)try{u=await((c=e.getExternalToken)===null||c===void 0?void 0:c.call(e))}catch(p){q("Error getting external token while refreshing",p)}return t.refresh(i,{dcs:l?"t":"f",dcr:d?"t":"f"},u,a)},logout:async i=>{if(e.oidcConfig)try{return await n.logout({id_token_hint:i}),Promise.resolve({ok:!0})}catch(a){return Promise.resolve({ok:!1,error:{errorCode:"J161000",errorDescription:a.toString()}})}return t.logout(i)},flow:us(t),webauthn:cs(t),fedcm:(o=t,r=e.projectId,{onetap:{requestExchangeCode(i){Gn(o,i)},requestAuthentication(i){Gn(o,i)}},async oneTap(i,a,c,l,d){await Do(o,{provider:i,oneTapConfig:a,loginOptions:c,onSkipped:l,onDismissed:d})},async launch(i){var a;const c={identity:{context:i||"signin",providers:[{configURL:o.httpClient.buildUrl(r+Qn.config),clientId:r}]}},l=await((a=navigator.credentials)===null||a===void 0?void 0:a.get(c));return o.refresh(l.token)},isSupported:()=>te&&"IdentityCredential"in window,async isLoggedIn(i){var a;const c=o.httpClient.buildUrl(r+Qn.config);try{const l={identity:{context:i||"signin",providers:[{configURL:c,clientId:r}]}},d=await((a=navigator.credentials)===null||a===void 0?void 0:a.get(l));return!!d&&!!d.token}catch{return!1}}}),oidc:n});var o,r});let rn;const Fo=e=>{const t=Ro(Object.assign({persistTokens:Tn,autoRefresh:Tn},e));return rn=t,t},fs=()=>Fo({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});rn=fs();const vs=()=>rn;var ms=({projectId:e,baseUrl:t,persistTokens:n,autoRefresh:o,sessionTokenViaCookie:r,refreshTokenViaCookie:i,refreshCookieName:a,oidcConfig:c,storeLastAuthenticatedUser:l,keepLastAuthenticatedUserAfterLogout:d,getExternalToken:u,hooks:p,customStorage:v})=>h.useMemo(()=>{if(e)return Fo({projectId:e,baseUrl:t,sessionTokenViaCookie:r,refreshTokenViaCookie:i,baseHeaders:it,persistTokens:n,autoRefresh:o,refreshCookieName:a,oidcConfig:c,storeLastAuthenticatedUser:l,keepLastAuthenticatedUserAfterLogout:d,hooks:p,getExternalToken:u,customStorage:v})},[e,t,JSON.stringify(r),JSON.stringify(i),u,v]);const xs=({projectId:e,baseUrl:t="",baseStaticUrl:n="",baseCdnUrl:o="",sessionTokenViaCookie:r=!1,refreshTokenViaCookie:i=!1,hooks:a,persistTokens:c=!0,autoRefresh:l=!0,oidcConfig:d,storeLastAuthenticatedUser:u=!0,keepLastAuthenticatedUserAfterLogout:p=!1,refreshCookieName:v="",getExternalToken:w,customStorage:g,children:x})=>{const[y,O]=h.useState(),[C,D]=h.useState(),[E,m]=h.useState(),[j,F]=h.useState(!1),[J,V]=h.useState(!1),[_,B]=h.useState(!1),[$,X]=h.useState(!!d),ue=h.useRef(!1),L=ms({projectId:e,baseUrl:t,persistTokens:c,autoRefresh:l,sessionTokenViaCookie:r,refreshTokenViaCookie:i,hooks:a,oidcConfig:d,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:v,getExternalToken:w,customStorage:g});h.useEffect(()=>{if(L){const Ae=L.onSessionTokenChange(D),ie=L.onUserChange(O),P=L.onIsAuthenticatedChange(F),Ne=L.onClaimsChange(m);return()=>{Ae(),ie(),P(),Ne()}}},[L]);const ne=h.useRef(!1),ge=h.useRef(!1);h.useEffect(()=>{L&&d&&!ue.current&&(ue.current=!0,L.oidc.finishLoginIfNeed().finally(()=>{X(!1),ne.current=!0}))},[]);const K=h.useCallback(()=>{cr()||ne.current||(ne.current=!0,B(!0),En(L==null?void 0:L.refresh)(void 0,!0).then(()=>{B(!1)}))},[L]),M=h.useCallback(()=>{ge.current||(ge.current=!0,V(!0),En(L.me)().then(()=>{V(!1)}))},[L]),oe=h.useMemo(()=>({fetchUser:M,user:y,isUserLoading:J,isUserFetched:ge.current,fetchSession:K,session:C,isAuthenticated:j,isSessionLoading:_,isOidcLoading:$,isSessionFetched:ne.current,projectId:e,baseUrl:t,baseStaticUrl:n,baseCdnUrl:o,storeLastAuthenticatedUser:u,keepLastAuthenticatedUserAfterLogout:p,refreshCookieName:v,customStorage:g,setUser:O,setSession:D,setIsAuthenticated:F,claims:E,sdk:L}),[M,y,J,ge.current,K,C,j,_,$,ne.current,e,t,n,o,p,v,g,O,D,F,E,L]);return h.createElement(ro.Provider,{value:oe},x)};function ys(...e){return t=>e.reduce((n,o)=>o(n),t)}const ws=(...e)=>e.join("/").replace(/\/+/g,"/"),Zn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_.]+/g,"-").toLowerCase(),bs=e=>{const t=Symbol((n=>{const o=n.toString();let r=0;for(let i=0;i<o.length;i++)r=(r<<5)-r+o.charCodeAt(i),r&=r;return r.toString(16)})(e));return n=>{if(n[t])return n;const o=e(n);return o[t]=!0,o}},ks=e=>{const[,t,n]=/(.*)\.(prop|attr)$/.exec(e)||[,e,"rest"];return{trimmedKey:t,category:n}},js=e=>typeof e=="string"||e==null?e:JSON.stringify(e),Is=e=>h.forwardRef((t,n)=>{const{prop:o,attr:r,rest:i}=h.useMemo(()=>Object.entries(t).reduce((l,[d,u])=>{const{trimmedKey:p,category:v}=ks(d);return v==="prop"?l.prop.push([p,u]):v==="attr"?l.attr.push([Zn(p),js(u)]):Object.assign(l.rest,{[Zn(p)]:u}),l},{attr:[],prop:[],rest:{}}),[t]),a=h.useRef(null),c=h.useCallback(l=>{a.current=l,l&&(o.forEach(([d,u])=>{a.current[d]=u}),r.forEach(([d,u])=>{u==null?l.removeAttribute(d):l.setAttribute(d,u)}))},[o,r,a]);return h.useImperativeHandle(n,()=>a.current),h.createElement(e,Object.assign({ref:c},i))}),Ss=h.lazy(async()=>(((customElements==null?void 0:customElements.get("descope-wc"))||await Promise.resolve().then(()=>require("./index.cjs3.js")).then(e=>e.index).then(e=>e.default)).sdkConfigOverrides={baseHeaders:it,persistTokens:!1,hooks:{get beforeRequest(){return vs().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:Is(h.forwardRef((e,t)=>{var{"external-request-id":n}=e,o=H(e,["external-request-id"]);return h.useMemo(()=>{var r,i;r="x-external-rid",(i=n)?it[r]=i:delete it[r]},[n]),h.createElement("descope-wc",Object.assign({ref:t},o))}))})),Cs=h.forwardRef(({flowId:e,onSuccess:t,onError:n,onReady:o,logger:r,tenant:i,theme:a,nonce:c,locale:l,debug:d,client:u,form:p,telemetryKey:v,redirectUrl:w,autoFocus:g,validateOnBlur:x,restartOnError:y,errorTransformer:O,styleId:C,onScreenUpdate:D,dismissScreenErrorOnInput:E,outboundAppId:m,outboundAppScopes:j,popupOrigin:F,children:J,externalRequestId:V},_)=>{const[B,$]=h.useState(null);h.useImperativeHandle(_,()=>B);const{projectId:X,baseUrl:ue,baseStaticUrl:L,baseCdnUrl:ne,storeLastAuthenticatedUser:ge,keepLastAuthenticatedUserAfterLogout:K,refreshCookieName:M,customStorage:oe,sdk:Ae}=h.useContext(ro),ie=h.useCallback(async P=>{await Ae.httpClient.hooks.afterRequest({},new Response(JSON.stringify(P.detail))),t&&t(P)},[t]);return h.useEffect(()=>{const P=B;return P==null||P.addEventListener("success",ie),n&&(P==null||P.addEventListener("error",n)),o&&(P==null||P.addEventListener("ready",o)),()=>{n&&(P==null||P.removeEventListener("error",n)),o&&(P==null||P.removeEventListener("ready",o)),P==null||P.removeEventListener("success",ie)}},[B,n,ie]),h.useEffect(()=>{const P=B;return P==null||P.addEventListener("success",ie),()=>{P==null||P.removeEventListener("success",ie)}},[B,ie]),h.useEffect(()=>{const P=B;return n&&(P==null||P.addEventListener("error",n)),()=>{n&&(P==null||P.removeEventListener("error",n))}},[B,n]),h.useEffect(()=>{const P=B;return o&&(P==null||P.addEventListener("ready",o)),()=>{o&&(P==null||P.removeEventListener("error",o))}},[B,o]),h.createElement("form",null,h.createElement(h.Suspense,{fallback:null},h.createElement(Ss,{projectId:X,flowId:e,baseUrl:ue,baseStaticUrl:L,baseCdnUrl:ne,ref:$,telemetryKey:v,redirectUrl:w,autoFocus:g,styleId:C,validateOnBlur:x,restartOnError:y,keepLastAuthenticatedUserAfterLogout:K,tenant:i,externalRequestId:V,customStorage:oe,"theme.attr":a,"nonce.attr":c,"locale.attr":l,"form.attr":p,"client.attr":u,"debug.attr":d,"outbound-app-id.attr":m,"outbound-app-scopes.attr":j,"popup-origin.attr":F,"store-last-authenticated-user.attr":ge,"refreshCookieName.attr":M,"dismiss-screen-error-on-input.attr":E,"errorTransformer.prop":O,"logger.prop":r,"onScreenUpdate.prop":D,"customStorage.prop":oe},J)))}),No="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK8AAAAwCAYAAABnoirjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAI6lJREFUeAHtfQd8FsX29pTdfXtCeoBQAsHQAkIiVZSioFKkCCooiCD2ggXUq4Kici8qol4VkHJB6YIKFyki5AoIIkFASuihpJGet26Zme9sCgYMmgT1u/dPzu8Xfcvu7OzMM+c85zmzLwjVWq3VWq3V2l9rGP3/Mdy9e3d67tw5Wv6BoigiMvIQT05GDN4KVGu19jv2l4G3ZcuWSl5enhzjcEgbt8yIEQF/ksAikjNu44gjgkmAEnHeSh0pjia3n4uOjtbCwsL0Q4cO6agWzLVWif3Z4MWNGze2HEqZEeHL9t2tMeNGLnh7mdIQhLGhM5aPBPYjAugUwmYhEnwuZIxIYcDQ98iSvD24btRnzRJGnQcvHUC1IK61CvangRdAaz2S8lGTouzCR5Hgw+FKBoA0mXC8mzG+x65b9l7T90lvZtnxMZmZYsfB9TYbOn+tysR1MpUTAas3ApitHKNlIZFB7zVu/eCpzMxMH6q1WkN/AnjBNWKv59tI35nMN4VAdyGgApzhj2mOsvCnBnlcNiztKCJJ4GrbMYPHAjhtJedxFKAKPU0JTtEDYo/baaQk5XNGFdu9hJJHoKf1OSZfRkVEPYfDe2WgWi981dsfCt7ExER569pJid5CzzzBRBin6MWok3krNje2xEnU8ggWYgiA1TAMkUJl+iMV/Dghkk+DFI1ibgMAN2WcXUcpThSIWAlFX2oUfdjzdKNDORGZQxDlr2OENafDOjqh58Qfjh8/rqJau2rtDwNv584xtpXz3n5YRnyy4GwPfDT2IDKckkymQFLWnSOxXpLkD6+P2/cjbrCUzzk42UbySTMmI4cNKVjXda9XJsceixnlFeJDafNhR3uK2MOY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hdtdaWz4PI7lOJ6GqaT+984/pOUWqpwVduf8TSq7PdviCk+mTMN5MbbQfr4TiFodoTPt2F7oJBrURFdFCR1gZJnVwBygixJDlMS1VRNBd3yBEgqB4hE92scb+5xTdbx3NS6PUDWHAMi5K1Q49nsdDif7T54yrG/4hdZau2/2/60R6lBXnH+56vXeuia9jgV7AYAaC5I68skhr9nVmlf227DMjIzETp48CABeQmB9FMiraQm/z1CMEsCl0UnqIvfCQWdGEjS9hCL9b1b73xyTUpKZpV1wFr7v21/9u8AlOiUO/fOi1GL3KMDXB+kYNrQxJ7KUB4kcidtUskzZ0Ll3IY5byRTEmU+CGcIkU2o9JXNZvlXl9seOhoZ2SpQ+/u7tVbR/mzwXriO+QN0klSsHNu5wpVfmJ2gM9QO+G0DpHErMXeZU2I+65Nuk8k+7HId6HP9U7npgYBe+++v1drl7K8C76VGgVZQqGJdtC3SarXydu2OG+ZTtKjWaq3Waq3Waq3W/svs/wHDkxYoFqn0jQAAAABJRU5ErkJggg==",Ve="var(--color-green)",A="var(--font-sans)",Y={width:"100%",height:40,padding:"10px 14px",fontSize:16,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:"var(--color-text)",fontFamily:A,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},Q=e=>{e.target.style.borderColor="var(--color-green)",e.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},G=e=>{e.target.style.borderColor="var(--color-input-border)",e.target.style.boxShadow="none"},Os=[{value:"",label:"Select team size (optional)"},{value:"1-10",label:"1–10"},{value:"11-50",label:"11–50"},{value:"51-200",label:"51–200"},{value:"200+",label:"200+"}],As=["Nextiva","Five9","Dialpad","RingCentral","NICE","Genesys","Talkdesk","Aircall","8x8","Vonage","Twilio","Other"],Us=["Teams","Zoom","Google Meet","Webex","Other"];function Te({title:e,subtitle:t}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:A,fontWeight:600,fontSize:"36px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:e}),s.jsx("p",{style:{fontFamily:A,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:t})]})}function ye({onClick:e,disabled:t,children:n,type:o="button"}){const r=!t;return s.jsx("button",{type:o,onClick:e,disabled:t,style:{width:"100%",height:40,display:"flex",justifyContent:"center",alignItems:"center",padding:"10px",background:r?"var(--color-green)":"var(--color-green-disabled)",color:"white",border:"none",borderRadius:4,fontSize:16,fontWeight:600,lineHeight:"23px",fontFamily:A,cursor:r?"pointer":"not-allowed",transition:"background 0.15s",boxSizing:"border-box"},onMouseEnter:i=>{r&&(i.currentTarget.style.background="var(--color-green-hover)")},onMouseLeave:i=>{r&&(i.currentTarget.style.background=r?"var(--color-green)":"var(--color-green-disabled)")},children:n})}function W({label:e,gap:t=12,labelSize:n=16,labelStyle:o,children:r}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:t,width:"100%"},children:[s.jsx("label",{style:{fontSize:n,fontWeight:400,color:"var(--color-text)",fontFamily:A,lineHeight:"100%",...o},children:e}),r]})}function Pt({show:e,onToggle:t}){return s.jsx("button",{type:"button",tabIndex:-1,onClick:t,style:{position:"absolute",right:14,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--color-text-secondary)",display:"flex",alignItems:"center"},children:e?s.jsx(le.EyeOff,{size:16}):s.jsx(le.Eye,{size:16})})}function Me(){return s.jsx("hr",{style:{width:"100%",border:"none",borderTop:"1px solid var(--color-divider)",margin:0}})}function Ce({text:e,linkText:t,onClick:n}){return s.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:4,width:"100%"},children:[s.jsx("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A},children:e}),s.jsx("button",{type:"button",onClick:n,style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"22px",color:Ve,cursor:"pointer",fontFamily:A,textDecoration:"underline"},children:t})]})}function we({onTerms:e,onPrivacyPolicy:t,paddingTop:n}){return s.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",marginTop:"auto",paddingTop:n||40,flexShrink:0},children:s.jsxs("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A,textAlign:"center",whiteSpace:"nowrap"},children:["By continuing, you agree to our"," ",s.jsx("a",{href:"https://chordia.ai/legal/terms-of-use",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:A,textDecoration:"underline",textUnderlineOffset:2},children:"Terms"})," ","and"," ",s.jsx("a",{href:"https://chordia.ai/legal/privacy-notice",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:A,textDecoration:"underline",textUnderlineOffset:2},children:"Privacy Policy"}),"."]})})}function Es({projectId:e,onSuccess:t,onError:n}){return e?s.jsx(xs,{projectId:e,children:s.jsx(Cs,{flowId:"sign-up-or-in-otp-or-social",onSuccess:t,onError:n})}):null}function _n({options:e,value:t,onChange:n,otherValue:o,onOtherChange:r,placeholder:i,otherPlaceholder:a="Please specify",compact:c=!1}){const[l,d]=h.useState(!1),u=h.useRef(null);h.useEffect(()=>{const m=j=>{u.current&&!u.current.contains(j.target)&&d(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const p=m=>{t.includes(m)?(n(t.filter(j=>j!==m)),m==="Other"&&r("")):n([...t,m])},v=m=>{n(t.filter(j=>j!==m)),m==="Other"&&r("")},w="rgba(34, 197, 94, 0.14)",g=c?"6px 10px":"8px 12px",x=c?36:40,y=c?15:16,O=c?200:260,C=c?"6px 8px":"8px 10px",D=t.includes("Other"),E=()=>d(m=>!m);return s.jsx("div",{ref:u,style:{width:"100%"},children:s.jsxs("div",{style:{position:"relative",width:"100%"},children:[s.jsxs("div",{role:"combobox","aria-expanded":l,onClick:m=>{m.target instanceof HTMLInputElement||m.target instanceof HTMLElement&&m.target.closest("button")||E()},style:{width:"100%",minHeight:x,padding:g,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:8,textAlign:"left",fontSize:y,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:t.length?"var(--color-text)":"var(--color-text-secondary)",fontFamily:A,boxSizing:"border-box",cursor:"pointer"},children:[s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:6,minWidth:0,cursor:"text"},children:t.length===0?s.jsx("span",{style:{color:"var(--color-text-secondary)",cursor:"pointer"},onClick:m=>{m.stopPropagation(),E()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&E()},role:"button",tabIndex:0,children:i}):s.jsxs(s.Fragment,{children:[t.map(m=>s.jsxs("span",{onClick:j=>j.stopPropagation(),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:4,background:w,fontSize:13,fontWeight:500,color:"var(--color-text)",flexShrink:0},children:[m,s.jsx("span",{role:"button",tabIndex:0,onClick:j=>{j.stopPropagation(),v(m)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),v(m))},style:{cursor:"pointer",fontSize:14,lineHeight:1,opacity:.7},children:"×"})]},m)),D&&s.jsx("input",{type:"text",value:o,onChange:m=>r(m.target.value),placeholder:a,onMouseDown:m=>m.stopPropagation(),onClick:m=>m.stopPropagation(),onFocus:m=>{m.stopPropagation(),m.target.style.borderColor="var(--color-green)",m.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},onBlur:m=>{m.target.style.borderColor="#cfcece",m.target.style.boxShadow="none"},style:{flex:"1 1 120px",minWidth:80,maxWidth:"100%",minHeight:c?26:28,padding:"2px 8px",border:"1px solid #cfcece",borderRadius:4,outline:"none",background:"transparent",fontSize:y,fontFamily:A,color:"var(--color-text)",boxSizing:"border-box"}})]})}),s.jsx("button",{type:"button",tabIndex:-1,onClick:m=>{m.stopPropagation(),E()},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,border:"none",background:"none",cursor:"pointer",color:"var(--color-text-secondary)"},"aria-label":l?"Close options":"Open options",children:s.jsx(le.ChevronDown,{size:c?16:18,style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]}),l&&s.jsx("div",{style:{position:"absolute",left:0,right:0,top:"100%",marginTop:4,padding:c?6:8,maxHeight:O,overflowY:"auto",background:"white",border:"1px solid var(--color-input-border)",borderRadius:4,boxShadow:"0 8px 24px rgba(0,0,0,0.08)",zIndex:50,boxSizing:"border-box"},children:e.map(m=>s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:C,borderRadius:4,cursor:"pointer",fontSize:c?14:15,fontFamily:A,color:"var(--color-text)"},children:[s.jsx("input",{type:"checkbox",checked:t.includes(m),onChange:()=>p(m),style:{width:16,height:16,accentColor:"var(--color-green)"}}),m]},m))})]})})}function Ts({onLogin:e,onForgotPassword:t,onOneTimeCode:n,onVerifyCode:o,onResendCode:r,onSignUp:i,onJoinWaitlist:a,onWaitlistSubmit:c,onResetPassword:l,onTerms:d,onPrivacyPolicy:u,onDescopeSuccess:p,onDescopeError:v,descopeProjectId:w,onGoToLogin:g,loading:x,error:y,codeError:O,defaultView:C="signin",signupMode:D="signup"}){var An,Un;const[E,m]=h.useState(""),[j,F]=h.useState(""),[J,V]=h.useState(!1),[_,B]=h.useState(!1),[$,X]=h.useState(!1),[ue,L]=h.useState(!1),[ne,ge]=h.useState(null),[K,M]=h.useState(C),[oe,Ae]=h.useState(""),[ie,P]=h.useState(""),[Ne,sn]=h.useState(""),[fe,Xe]=h.useState(["","","","","",""]),ze=h.useRef([]),[gt,zo]=h.useState(""),[ft,Lo]=h.useState(""),[Le,Bo]=h.useState(""),[Qe,Ho]=h.useState(""),[vt,Wo]=h.useState(""),[mt,qo]=h.useState(!1),[xt,Mo]=h.useState(!1),[an,Ue]=h.useState(""),[yt,Jo]=h.useState(""),[ln,cn]=h.useState(0),dn=3,[un,Ko]=h.useState(""),[pn,Vo]=h.useState(""),[hn,$o]=h.useState(""),[gn,Yo]=h.useState(""),[wt,Xo]=h.useState(""),[fn,Qo]=h.useState([]),[vn,Go]=h.useState([]),[bt,Zo]=h.useState(""),[kt,_o]=h.useState(""),[mn,me]=h.useState(""),[xn,yn]=h.useState(!1),[er,tr]=h.useState(!1),[nr,or]=h.useState(1267),[Be,rr]=h.useState("");h.useEffect(()=>{const f=setInterval(()=>cn(S=>(S+1)%dn),4e3);return()=>clearInterval(f)},[]);const Ie=h.useRef(null),Se=h.useRef(null);h.useEffect(()=>{const f=se=>{if(!se)return!1;try{return se.matches(":-webkit-autofill, :autofill")}catch{return!1}},S=()=>{const se=Ie.current,Ze=Se.current;se&&se.value&&m(se.value),Ze&&Ze.value&&F(Ze.value),V(f(se)),B(f(Ze))},U=[100,300,600,1e3,2e3].map(se=>setTimeout(S,se)),z=se=>{(se.animationName==="onAutoFillStart"||se.target.matches(":-webkit-autofill"))&&setTimeout(S,50)},R=Ie.current,I=Se.current;R==null||R.addEventListener("animationstart",z),I==null||I.addEventListener("animationstart",z);const ee=()=>setTimeout(S,0),ce=()=>setTimeout(S,0);return R==null||R.addEventListener("input",ee),I==null||I.addEventListener("input",ee),R==null||R.addEventListener("change",ce),I==null||I.addEventListener("change",ce),()=>{U.forEach(clearTimeout),R==null||R.removeEventListener("animationstart",z),I==null||I.removeEventListener("animationstart",z),R==null||R.removeEventListener("input",ee),I==null||I.removeEventListener("input",ee),R==null||R.removeEventListener("change",ce),I==null||I.removeEventListener("change",ce)}},[]),h.useEffect(()=>{const f=z=>{if(!z)return!1;try{return z.matches(":-webkit-autofill, :autofill")}catch{return!1}},S=()=>{var I,ee;const z=((I=Ie.current)==null?void 0:I.value)||"",R=((ee=Se.current)==null?void 0:ee.value)||"";z&&z!==E&&m(z),R&&R!==j&&F(R),V(f(Ie.current)),B(f(Se.current))},U=setInterval(S,250);return window.addEventListener("focus",S),document.addEventListener("visibilitychange",S),()=>{clearInterval(U),window.removeEventListener("focus",S),document.removeEventListener("visibilitychange",S)}},[E,j]),h.useEffect(()=>{O&&K==="verifycode"&&(Xe(["","","","","",""]),M("getcodewithname"))},[O]);const wn=x??ue,xe=y??ne,ir=(E||((An=Ie.current)==null?void 0:An.value)||"").trim(),sr=j||((Un=Se.current)==null?void 0:Un.value)||"",bn=!!(!!(ir||J)&&!!(sr||_)&&!wn),Ge=K==="verifycode"||K==="getcodewithname"?xe:null,kn=f=>{f.target.style.borderColor=xe?"var(--color-text)":"var(--color-green)",f.target.style.boxShadow=xe?"none":"0 0 0 3px var(--color-green-ring)"},jn=f=>{f.target.style.borderColor=xe?"var(--color-text)":"var(--color-input-border)",f.target.style.boxShadow="none"},In=(f,S)=>{var ee;const U=(S||"").replace(/\D/g,"");if(!U)return;const z=[...fe];let R=f;for(let ce=0;ce<U.length&&f+ce<z.length;ce+=1)z[f+ce]=U[ce],R=f+ce;Xe(z);const I=Math.min(R+1,z.length-1);(ee=ze.current[I])==null||ee.focus()},Sn=(f,S)=>{var I;const U=S.replace(/\D/g,"");if(U.length>1){In(f,U);return}const z=U.slice(-1),R=[...fe];R[f]=z,Xe(R),z&&f<5&&((I=ze.current[f+1])==null||I.focus())},Cn=(f,S)=>{var U;S.key==="Backspace"&&!fe[f]&&f>0&&((U=ze.current[f-1])==null||U.focus())},On=(f,S)=>{var z;S.preventDefault();const U=((z=S.clipboardData)==null?void 0:z.getData("text"))||"";In(f,U)},ar=async f=>{var z,R;if(f.preventDefault(),!bn)return;const S=E||((z=Ie.current)==null?void 0:z.value)||"",U=j||((R=Se.current)==null?void 0:R.value)||"";if(!(!S||!U)){ge(null),L(!0);try{await(e==null?void 0:e(S,U))}catch(I){ge((I==null?void 0:I.message)||"Something went wrong. Please try again.")}finally{L(!1)}}},lr=async()=>{me("");const f=un.trim(),S=pn.trim(),U=hn.trim();if(f.length<2){me("Please enter your full name.");return}if(!S){me("Please enter your work email.");return}if(U.length<2){me("Please enter your company name (at least 2 characters).");return}const z=fn.map(I=>I==="Other"&&bt.trim()?`Other: ${bt.trim()}`:I),R=vn.map(I=>I==="Other"&&kt.trim()?`Other: ${kt.trim()}`:I);yn(!0);try{const I=await(c==null?void 0:c({name:f,email:S,company_name:U,job_title:gn.trim()||void 0,team_size:wt||void 0,phone_systems:z,meeting_tools:R,source:"website"})),ee=Number(I==null?void 0:I.position);Number.isFinite(ee)&&ee>0&&or(ee),I!=null&&I.calendly_url&&rr(String(I.calendly_url)),tr(!0)}catch(I){me((I==null?void 0:I.message)||"Unable to join waitlist right now. Please try again.")}finally{yn(!1)}};return s.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",overflow:"hidden",fontFamily:A,background:"white"},children:[s.jsxs("div",{style:{flex:"0 0 628px",width:628,minHeight:0,background:"var(--surface-dark)",display:"flex",flexDirection:"column",padding:"48px 0 40px 48px",position:"relative",overflow:"hidden"},children:[s.jsx("img",{src:No,alt:"Chordia",style:{width:175,height:48,objectFit:"contain",marginBottom:100,flexShrink:0}}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:22},children:[s.jsx("h1",{style:{fontFamily:A,fontSize:"clamp(28px, 2.8vw, 28px)",fontWeight:800,color:"var(--color-text-inverse)",lineHeight:1.08,margin:0,letterSpacing:"-0.02em",paddingRight:48},children:"Three Solutions. One Platform."}),s.jsxs("div",{style:{position:"relative",width:412,height:320,overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)"},children:[s.jsx("div",{style:{display:"flex",gap:16,height:"100%",transform:`translateX(${-ln*280}px)`,transition:"transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:[{Icon:le.CircleCheckBig,title:"Evaluation Quality Monitoring",info:"Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."},{Icon:le.ShieldCheck,title:"Compliance Monitoring",info:"Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."},{Icon:le.Radar,title:"Signal Intelligence",info:"Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."}].map(({Icon:f,title:S,info:U},z)=>s.jsxs("div",{style:{flexShrink:0,width:264,height:320,padding:32,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,borderRadius:16,border:"1px solid var(--surface-card-dark-border)",background:"var(--surface-card-dark)"},children:[s.jsx(f,{width:36,height:36,color:"var(--color-card-icon)",strokeWidth:2.5}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[s.jsx("span",{style:{fontFamily:A,fontSize:24,fontStyle:"normal",fontWeight:600,lineHeight:"28px",color:"var(--color-card-text)"},children:S}),s.jsx("span",{style:{fontFamily:A,fontSize:12,fontStyle:"normal",fontWeight:400,lineHeight:"normal",color:"rgba(255,255,255,0.65)"},children:U})]})]},z))}),s.jsx("div",{style:{position:"absolute",top:0,left:280,right:0,height:"100%",background:"linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",pointerEvents:"none"}})]}),s.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,height:4,marginTop:"auto",flexShrink:0},children:Array.from({length:dn}).map((f,S)=>s.jsx("button",{onClick:()=>cn(S),style:{width:80,height:4,borderRadius:6,border:"none",padding:0,cursor:"pointer",background:S===ln?"rgba(255,255,255,0.7)":"rgba(255,255,255,0.25)",transition:"background 0.3s ease"}},S))})]})]}),s.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:K==="waitlist"?"20px 48px":"32px 72px",position:"relative",background:"white",overflowY:"auto",minHeight:0},children:s.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",maxWidth:K==="waitlist"?430:360,gap:K==="waitlist"?22:28},children:K==="waitlist"?s.jsx(s.Fragment,{children:er?s.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",gap:24},children:[s.jsx("h2",{style:{fontFamily:A,fontWeight:700,fontSize:"32px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:"Chordia"}),s.jsx("h3",{style:{fontFamily:A,fontWeight:700,fontSize:"32px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"You're on the list!"}),s.jsxs("p",{style:{fontFamily:A,fontWeight:700,fontSize:"56px",lineHeight:"68px",color:"var(--color-green)",margin:0},children:["#",nr.toLocaleString()]}),s.jsx("p",{style:{fontFamily:A,fontWeight:400,fontSize:18,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0,maxWidth:470},children:"We’re working hard to increase capacity and will notify you very quickly. Check your email for confirmation."}),s.jsxs("div",{style:{width:"100%",borderRadius:12,border:"1px solid var(--color-input-border)",background:"white",boxShadow:"0 1px 6px rgba(0,0,0,0.06)",padding:"24px 20px",boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center",gap:14},children:[s.jsx("p",{style:{margin:0,fontFamily:A,fontSize:"24px",lineHeight:"40px",fontWeight:700,color:"var(--color-text)"},children:"Want to skip the line?"}),s.jsx("p",{style:{margin:0,fontFamily:A,fontSize:"18px",lineHeight:"24px",fontWeight:400,color:"var(--color-text-secondary)"},children:"Schedule a demo with our CEO and get immediate access."}),s.jsx("button",{type:"button",onClick:()=>{Be&&window.open(Be,"_blank","noopener,noreferrer")},style:{minWidth:220,height:48,padding:"0 20px",borderRadius:8,border:"2px solid #111111",background:"white",color:"var(--color-text)",fontFamily:A,fontSize:20,fontWeight:700,lineHeight:"28px",cursor:Be?"pointer":"default",opacity:Be?1:.65},disabled:!Be,children:"Schedule a Demo"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Te,{title:"Join the Waitlist",subtitle:"Get early access to Chordia. We onboard new companies every week."}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:12},children:[s.jsx(W,{label:"Full Name",gap:8,children:s.jsx("input",{type:"text",value:un,onChange:f=>{Ko(f.target.value),me("")},placeholder:"Your full name",autoFocus:!0,autoComplete:"name",style:Y,onFocus:Q,onBlur:G})}),s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(W,{label:"Work Email",gap:8,children:s.jsx("input",{type:"email",value:pn,onChange:f=>{Vo(f.target.value),me("")},placeholder:"workemail@example.com",autoComplete:"email",style:Y,onFocus:Q,onBlur:G})})}),s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(W,{label:"Company Name",gap:8,children:s.jsx("input",{type:"text",value:hn,onChange:f=>{$o(f.target.value),me("")},placeholder:"Your Company",autoComplete:"organization",style:Y,onFocus:Q,onBlur:G})})})]}),s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(W,{label:"Job Title",gap:8,children:s.jsx("input",{type:"text",value:gn,onChange:f=>Yo(f.target.value),placeholder:"Optional",autoComplete:"organization-title",style:Y,onFocus:Q,onBlur:G})})}),s.jsx("div",{style:{flex:1,minWidth:0},children:s.jsx(W,{label:"Team Size",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("select",{value:wt,onChange:f=>Xo(f.target.value),style:{...Y,appearance:"none",WebkitAppearance:"none",paddingRight:36,cursor:"pointer",fontSize:15,color:wt?"var(--color-text)":"var(--color-text-secondary)"},children:Os.map(f=>s.jsx("option",{value:f.value,children:f.label},f.value||"empty"))}),s.jsx(le.ChevronDown,{size:16,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--color-text-secondary)"}})]})})})]}),s.jsx(W,{label:"Phone systems",gap:8,children:s.jsx(_n,{compact:!0,options:As,value:fn,onChange:Qo,otherValue:bt,onOtherChange:Zo,placeholder:"Select (optional)",otherPlaceholder:"Please specify your phone system"})}),s.jsx(W,{label:"Meeting tools",gap:8,children:s.jsx(_n,{compact:!0,options:Us,value:vn,onChange:Go,otherValue:kt,onOtherChange:_o,placeholder:"Select (optional)",otherPlaceholder:"Please specify your meeting tool"})}),mn&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),mn]}),s.jsx(ye,{type:"button",onClick:lr,disabled:xn,children:xn?"Joining...":"Join Waitlist"}),s.jsx(Ce,{text:"I am already a member",linkText:"Log In",onClick:()=>{M("signin"),g==null||g()}}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:16})]})]})}):K==="signup"?s.jsxs(s.Fragment,{children:[s.jsx(Te,{title:"Sign Up",subtitle:"Please enter your basic details to continue"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx(W,{label:"First Name",gap:8,children:s.jsx("input",{type:"text",value:gt,onChange:f=>zo(f.target.value),placeholder:"First name",autoFocus:!0,autoComplete:"given-name",style:Y,onFocus:Q,onBlur:G})}),s.jsx(W,{label:"Last Name",gap:8,children:s.jsx("input",{type:"text",value:ft,onChange:f=>Lo(f.target.value),placeholder:"Last name",autoComplete:"family-name",style:Y,onFocus:Q,onBlur:G})})]}),s.jsx(W,{label:"Email",gap:8,children:s.jsx("input",{type:"text",value:Le,onChange:f=>{Bo(f.target.value),Ue("")},placeholder:"workemail@example.com",autoComplete:"email",style:Y,onFocus:Q,onBlur:G})}),s.jsx(W,{label:"Create Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:mt?"text":"password",value:Qe,onChange:f=>{Ho(f.target.value),Ue("")},placeholder:"Enter password",autoComplete:"new-password",style:{...Y,padding:"10px 44px 10px 14px"},onFocus:Q,onBlur:G}),s.jsx(Pt,{show:mt,onToggle:()=>qo(!mt)})]})}),s.jsx(W,{label:"Confirm Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:xt?"text":"password",value:vt,onChange:f=>{Wo(f.target.value),Ue("")},placeholder:"Enter password",autoComplete:"new-password",style:{...Y,padding:"10px 44px 10px 14px"},onFocus:Q,onBlur:G}),s.jsx(Pt,{show:xt,onToggle:()=>Mo(!xt)})]})}),an&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),an]}),(()=>{const f=gt&&ft&&Le&&Qe&&vt;return s.jsx(ye,{onClick:()=>{if(Ue(""),!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Le)){Ue("Please enter a valid email address.");return}if(Qe!==vt){Ue("Password and Confirm Password do not match!");return}i==null||i({firstName:gt,lastName:ft,email:Le,password:Qe}),M("verifyemail")},disabled:!f,children:"Create Account"})})(),s.jsx(Ce,{text:"I am already a member",linkText:"Sign In",onClick:()=>{M("signin"),g==null||g()}}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u})]})]}):K==="verifyemail"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[s.jsx("h2",{style:{fontFamily:A,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Verify Email"}),s.jsx("p",{style:{fontFamily:A,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:"Verify your email to continue the signup process."})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:24},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("p",{style:{fontFamily:A,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"We have sent a verification link to:"}),s.jsx("p",{style:{fontFamily:A,fontSize:18,fontWeight:600,lineHeight:"24px",color:"var(--color-text)",margin:0},children:Le||"youremail@workemail.com"})]}),s.jsx("p",{style:{fontFamily:A,fontSize:18,fontWeight:400,lineHeight:"24px",color:"var(--color-text-secondary)",margin:0},children:"Click on the link to complete the verification process. You might need to check your Spam folder"}),s.jsx(ye,{onClick:()=>{M("signin"),g==null||g()},children:"Go To Login"})]}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]}):K==="verifycode"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:A,fontWeight:600,fontSize:"36px",lineHeight:"52px",color:"var(--color-text)",margin:0},children:"Sign In with code"}),s.jsxs("p",{style:{fontFamily:A,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:["We have sent a one-time code to your email:"," ",s.jsx("span",{style:{color:"var(--color-text)"},children:Ne||"workemail@example.com"})," ",s.jsx("button",{type:"button",onClick:()=>M("getcode"),style:{background:"none",border:"none",padding:0,fontSize:18,fontWeight:400,color:Ve,cursor:"pointer",fontFamily:A,textDecoration:"underline"},children:"Change email"})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(W,{label:"Enter one-time code",gap:12,children:s.jsx("div",{style:{display:"flex",gap:8},children:fe.map((f,S)=>s.jsx("input",{ref:U=>{ze.current[S]=U},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:U=>Sn(S,U.target.value),onKeyDown:U=>Cn(S,U),onPaste:U=>On(S,U),autoFocus:S===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:A,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:Ve},onFocus:Q,onBlur:G},S))})}),s.jsx(ye,{onClick:()=>o==null?void 0:o(Ne,fe.join("")),disabled:fe.some(f=>!f),children:"Verify Code"}),Ge&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Ge]}),s.jsx(Me,{}),s.jsx(Ce,{text:"Not received yet?",linkText:"Resend",onClick:()=>r==null?void 0:r(Ne)}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:24})]})]}):K==="getcode"?s.jsxs(s.Fragment,{children:[s.jsx(Te,{title:"Get code",subtitle:"We'll send a one time pass-code to your email"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(W,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:oe,onChange:f=>Ae(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:Y,onFocus:Q,onBlur:G})}),s.jsx(ye,{onClick:()=>{sn(oe),Xe(["","","","","",""]),M("verifycode"),n==null||n(oe)},disabled:!oe,children:"Send One-time Code"}),s.jsx(Me,{}),s.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),g==null||g()}}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):K==="getcodewithname"?s.jsxs(s.Fragment,{children:[s.jsx(Te,{title:"Complete your sign in",subtitle:"We’ve sent a one-time code to your email. Please enter the code and your full name to sign in"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(W,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:oe,onChange:f=>Ae(f.target.value),placeholder:"workemail@example.com",autoComplete:"email",style:Y,onFocus:Q,onBlur:G})}),s.jsx(W,{label:"Full Name",gap:12,children:s.jsx("input",{type:"text",value:ie,onChange:f=>P(f.target.value),placeholder:"Enter your full name",autoComplete:"name",style:Y,onFocus:Q,onBlur:G})}),s.jsx(W,{label:"Enter one-time code",gap:12,children:s.jsx("div",{style:{display:"flex",gap:8},children:fe.map((f,S)=>s.jsx("input",{ref:U=>{ze.current[S]=U},type:"text",inputMode:"numeric",maxLength:1,value:f,onChange:U=>Sn(S,U.target.value),onKeyDown:U=>Cn(S,U),onPaste:U=>On(S,U),autoFocus:S===0,style:{flex:1,minWidth:0,height:40,textAlign:"center",fontSize:16,fontWeight:600,fontFamily:A,color:"var(--color-text)",border:"1px solid var(--color-input-border)",borderRadius:4,outline:"none",background:"white",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",caretColor:Ve},onFocus:Q,onBlur:G},S))})}),s.jsx(ye,{onClick:()=>{sn(oe),n==null||n(oe,ie,fe.join(""))},disabled:!oe||!ie||fe.some(f=>!f),children:"Verify & Sign In"}),Ge&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Ge]}),s.jsx(Me,{}),s.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),g==null||g()}}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):K==="resetpassword"?s.jsxs(s.Fragment,{children:[s.jsx(Te,{title:"Reset Password",subtitle:"We'll send an email to reset your password"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsx(W,{label:"Email",gap:12,children:s.jsx("input",{type:"email",value:yt,onChange:f=>Jo(f.target.value),placeholder:"workemail@example.com",autoFocus:!0,autoComplete:"email",style:Y,onFocus:Q,onBlur:G})}),s.jsx(ye,{onClick:()=>l==null?void 0:l(yt),disabled:!yt,children:"Send Reset Link"}),s.jsx(Me,{}),s.jsx(Ce,{text:"I have my password",linkText:"Back to Sign in",onClick:()=>{M("signin"),g==null||g()}}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:40})]})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:48},children:[s.jsx(Te,{title:"Sign in",subtitle:"Enter your email & password to continue"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:8},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",gap:16},children:[s.jsxs("form",{onSubmit:ar,style:{width:"100%",display:"flex",flexDirection:"column",gap:16},children:[s.jsx(W,{label:"Email",gap:12,children:s.jsx("input",{ref:Ie,type:"email",value:E,onChange:f=>m(f.target.value),placeholder:"workemail@example.com",required:!0,autoComplete:"email",style:{...Y,border:`1px solid ${xe?"var(--color-text)":"var(--color-input-border)"}`},onFocus:kn,onBlur:jn})}),s.jsx(W,{label:"Password",gap:12,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{ref:Se,type:$?"text":"password",value:j,onChange:f=>F(f.target.value),placeholder:"Enter password",required:!0,autoComplete:"current-password",style:{...Y,padding:"10px 44px 10px 16px",border:`1px solid ${xe?"var(--color-text)":"var(--color-input-border)"}`},onFocus:kn,onBlur:jn}),s.jsx(Pt,{show:$,onToggle:()=>X(!$)})]})}),s.jsx(ye,{type:"submit",disabled:!bn,children:wn?"Signing in…":"Sign In"})]}),xe&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:A},children:[s.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),xe]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"},children:[s.jsx("button",{type:"button",onClick:()=>{M("resetpassword"),t==null||t()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:400,lineHeight:"100%",color:"var(--color-text)",cursor:"pointer",fontFamily:A,textDecoration:"underline"},children:"Forgot Password?"}),s.jsx("button",{type:"button",onClick:()=>{M("getcode"),n==null||n()},style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"100%",color:Ve,cursor:"pointer",fontFamily:A,textDecoration:"underline solid",textUnderlineOffset:0,textDecorationSkipInk:"none"},children:"Sign in with one-time code"})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:2},children:[s.jsx(Me,{}),s.jsx(Es,{projectId:w,onSuccess:p,onError:v})]})]}),s.jsx(Ce,{text:D==="waitlist"?"Don't have an account yet?":"Not a member yet?",linkText:D==="waitlist"?"Join Waitlist":"Sign Up",onClick:()=>{if(D==="waitlist"){M("waitlist"),a==null||a();return}M("signup"),i==null||i()}}),s.jsx(we,{onTerms:d,onPrivacyPolicy:u,paddingTop:16})]})]})})})]})}const Z="var(--font-sans)",eo=3,Kt={width:"100%",height:40,padding:"10px 14px",fontSize:16,fontWeight:400,lineHeight:"23px",border:"1px solid var(--color-input-border)",borderRadius:4,background:"white",color:"var(--color-text)",fontFamily:Z,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},Rt={...Kt,background:"var(--color-input-disabled-bg, #f5f5f5)",color:"var(--color-text-secondary)",cursor:"not-allowed"},to=e=>{e.target.style.borderColor="var(--color-green)",e.target.style.boxShadow="0 0 0 3px var(--color-green-ring)"},no=e=>{e.target.style.borderColor="var(--color-input-border)",e.target.style.boxShadow="none"};function Je({label:e,gap:t=12,children:n}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:t,width:"100%"},children:[s.jsx("label",{style:{fontSize:16,fontWeight:400,color:"var(--color-text)",fontFamily:Z,lineHeight:"100%"},children:e}),n]})}function oo({show:e,onToggle:t}){return s.jsx("button",{type:"button",tabIndex:-1,onClick:t,style:{position:"absolute",right:14,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--color-text-secondary)",display:"flex",alignItems:"center"},children:e?s.jsx(le.EyeOff,{size:16}):s.jsx(le.Eye,{size:16})})}function Ds({onClick:e,disabled:t,children:n,type:o="button"}){const r=!t;return s.jsx("button",{type:o,onClick:e,disabled:t,style:{width:"100%",height:40,display:"flex",justifyContent:"center",alignItems:"center",padding:"10px",background:r?"var(--color-green)":"var(--color-green-disabled)",color:"white",border:"none",borderRadius:4,fontSize:16,fontWeight:600,lineHeight:"23px",fontFamily:Z,cursor:r?"pointer":"not-allowed",transition:"background 0.15s",boxSizing:"border-box"},onMouseEnter:i=>{r&&(i.currentTarget.style.background="var(--color-green-hover)")},onMouseLeave:i=>{r&&(i.currentTarget.style.background=r?"var(--color-green)":"var(--color-green-disabled)")},children:n})}function Ps(){return s.jsx("div",{style:{display:"flex",justifyContent:"center",width:"100%",marginTop:"auto",paddingTop:40,flexShrink:0},children:s.jsxs("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:Z,textAlign:"center",whiteSpace:"nowrap"},children:["By continuing, you agree to our"," ",s.jsx("a",{href:"https://chordia.ai/legal/terms-of-use",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:Z,textDecoration:"underline",textUnderlineOffset:2},children:"Terms"})," ","and"," ",s.jsx("a",{href:"https://chordia.ai/legal/privacy-notice",target:"_blank",rel:"noopener noreferrer",style:{fontSize:15,fontWeight:400,color:"var(--color-text)",fontFamily:Z,textDecoration:"underline",textUnderlineOffset:2},children:"Privacy Policy"}),"."]})})}function Rs({firstName:e="",lastName:t="",email:n="",onSubmit:o,onGoToLogin:r,loading:i=!1,error:a=null}){const[c,l]=h.useState(""),[d,u]=h.useState(""),[p,v]=h.useState(!1),[w,g]=h.useState(!1),[x,y]=h.useState(""),[O,C]=h.useState(0);h.useEffect(()=>{const j=setInterval(()=>C(F=>(F+1)%eo),4e3);return()=>clearInterval(j)},[]);const D=a||x,E=c&&d&&!i,m=()=>{if(y(""),c.length<8){y("Password must be at least 8 characters.");return}if(c!==d){y("Password and Confirm Password do not match!");return}o==null||o({firstName:e,lastName:t,email:n,password:c})};return s.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",overflow:"hidden",fontFamily:Z,background:"white"},children:[s.jsxs("div",{style:{flex:"0 0 628px",width:628,minHeight:0,background:"var(--surface-dark)",display:"flex",flexDirection:"column",padding:"48px 0 40px 48px",position:"relative",overflow:"hidden"},children:[s.jsx("img",{src:No,alt:"Chordia",style:{width:175,height:48,objectFit:"contain",marginBottom:100,flexShrink:0}}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:22},children:[s.jsx("h1",{style:{fontFamily:Z,fontSize:"clamp(28px, 2.8vw, 28px)",fontWeight:800,color:"var(--color-text-inverse)",lineHeight:1.08,margin:0,letterSpacing:"-0.02em",paddingRight:48},children:"Three Solutions. One Platform."}),s.jsxs("div",{style:{position:"relative",width:412,height:320,overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)"},children:[s.jsx("div",{style:{display:"flex",gap:16,height:"100%",transform:`translateX(${-O*280}px)`,transition:"transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"},children:[{Icon:le.CircleCheckBig,title:"Evaluation Quality Monitoring",info:"Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."},{Icon:le.ShieldCheck,title:"Compliance Monitoring",info:"Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."},{Icon:le.Radar,title:"Signal Intelligence",info:"Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."}].map(({Icon:j,title:F,info:J},V)=>s.jsxs("div",{style:{flexShrink:0,width:264,height:320,padding:32,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,borderRadius:16,border:"1px solid var(--surface-card-dark-border)",background:"var(--surface-card-dark)"},children:[s.jsx(j,{width:36,height:36,color:"var(--color-card-icon)",strokeWidth:2.5}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[s.jsx("span",{style:{fontFamily:Z,fontSize:24,fontStyle:"normal",fontWeight:600,lineHeight:"28px",color:"var(--color-card-text)"},children:F}),s.jsx("span",{style:{fontFamily:Z,fontSize:12,fontStyle:"normal",fontWeight:400,lineHeight:"normal",color:"rgba(255,255,255,0.65)"},children:J})]})]},V))}),s.jsx("div",{style:{position:"absolute",top:0,left:280,right:0,height:"100%",background:"linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",pointerEvents:"none"}})]}),s.jsx("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,height:4,marginTop:"auto",flexShrink:0},children:Array.from({length:eo}).map((j,F)=>s.jsx("button",{onClick:()=>C(F),style:{width:80,height:4,borderRadius:6,border:"none",padding:0,cursor:"pointer",background:F===O?"rgba(255,255,255,0.7)":"rgba(255,255,255,0.25)",transition:"background 0.3s ease"}},F))})]})]}),s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"48px 80px 40px",overflow:"auto",minWidth:0},children:s.jsxs("div",{style:{width:"100%",maxWidth:420,display:"flex",flexDirection:"column",alignItems:"stretch",gap:24,flex:1},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsx("h2",{style:{fontFamily:Z,fontWeight:600,fontSize:"36px",lineHeight:"44px",color:"var(--color-text)",margin:0},children:"Set Password"}),s.jsx("p",{style:{fontFamily:Z,fontSize:18,fontWeight:400,lineHeight:"26px",color:"var(--color-text-secondary)",margin:0},children:"Complete your account setup by creating a password"})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:16},children:[s.jsxs("div",{style:{display:"flex",gap:16,width:"100%"},children:[s.jsx(Je,{label:"First Name",gap:8,children:s.jsx("input",{type:"text",value:e,disabled:!0,style:Rt})}),s.jsx(Je,{label:"Last Name",gap:8,children:s.jsx("input",{type:"text",value:t,disabled:!0,style:Rt})})]}),s.jsx(Je,{label:"Email",gap:8,children:s.jsx("input",{type:"email",value:n,disabled:!0,style:Rt})}),s.jsx(Je,{label:"Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:p?"text":"password",value:c,onChange:j=>{l(j.target.value),y("")},placeholder:"At least 8 characters",autoComplete:"new-password",autoFocus:!0,style:{...Kt,padding:"10px 44px 10px 14px"},onFocus:to,onBlur:no}),s.jsx(oo,{show:p,onToggle:()=>v(!p)})]})}),s.jsx(Je,{label:"Confirm Password",gap:8,children:s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:w?"text":"password",value:d,onChange:j=>{u(j.target.value),y("")},placeholder:"At least 8 characters",autoComplete:"new-password",style:{...Kt,padding:"10px 44px 10px 14px"},onFocus:to,onBlur:no}),s.jsx(oo,{show:w,onToggle:()=>g(!w)})]})}),D&&s.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:8,gap:6,width:"100%",boxSizing:"border-box",background:"var(--color-error-bg)",borderRadius:5,fontSize:14,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:Z},children:[s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"var(--color-text)",style:{flexShrink:0},children:s.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),D]}),s.jsx(Ds,{onClick:m,disabled:!E,children:i?"Setting up...":"Set Password"}),s.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:4,width:"100%"},children:[s.jsx("span",{style:{fontSize:15,fontWeight:400,lineHeight:"22px",color:"var(--color-text)",fontFamily:Z},children:"Already have an account?"}),s.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",padding:0,fontSize:15,fontWeight:600,lineHeight:"22px",color:"var(--color-green)",cursor:"pointer",fontFamily:Z,textDecoration:"underline"},children:"Sign In"})]}),s.jsx(Ps,{})]})]})})]})}exports.Ee=Ro;exports.LoginPage=Ts;exports.SignUpPage=Rs;exports.X=Oo;exports.Z=ns;exports.__awaiter=dr;exports.__classPrivateFieldGet=pr;exports.__classPrivateFieldSet=hr;exports.__rest=H;exports.h=bs;exports.r=ys;exports.s=ws;
3
3
  //# sourceMappingURL=index.cjs2.js.map