PageSourceSearch

https://www.alectafastigheter.se/_next/static/chunks/b69466d8c50bac1a.js?dpl=dpl_AuRPhzGZm39vMBwRAxC5Y2AuxCoh

js alectafastigheter.se collected 2026-10-05 20:45:50 UTC 96,753 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,298833,e=>{"use strict";var t=e.i(793200);e.i(806331);var r=e.i(450261),s=e.i(796988);function i(){let{translate:e}=(0,r.useTranslations)();return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 pt-11 type-body-2 md:pt-6 xl:pt-20",children:[(0,t.jsx)("p",{className:"text-brand-01-contrast",children:e("Need help logging in")}),(0,t.jsx)(s.GlobalContactForm.Trigger,{className:"cursor-pointer type-body-2 text-brand-07-primary",children:e("Contact customer service")})]})}e.s(["AuthCustomerServiceHelp",()=>i])},153916,e=>{"use strict";var t=e.i(793200);e.i(840596);var r=e.i(659337);e.i(806331);var s=e.i(450261),i=e.i(698319);e.i(203553);var n=e.i(951974);class a extends Error{constructor(e,t,r,s,i){super(`${e}: ${t??""}`),this.error=e,this.errorDescription=t,this.correlationId=r,this.errorCodes=s,this.subError=i,Object.setPrototypeOf(this,a.prototype),this.errorCodes=s??[],this.subError=i??""}}class o extends a{constructor(e,t,r,s,i){super(e,t,i,s,r),Object.setPrototypeOf(this,o.prototype)}}class l extends a{constructor(e,t){super("unexpected_error",e instanceof Error?e.message:"string"==typeof e?e:"object"==typeof e&&null!==e?JSON.stringify(e):"An unexpected error occurred.",t),Object.setPrototypeOf(this,l.prototype)}}class c{constructor(e,t){this.state=e,this.data=t}static createErrorData(e){if(e instanceof a)return e;if(!(e instanceof n.AuthError))return new l(e);{let t=[];if("errorNo"in e)if("string"==typeof e.errorNo){let r=Number(e.errorNo);isNaN(r)||t.push(r)}else"number"==typeof e.errorNo&&t.push(e.errorNo);return new o(e.errorCode,e.errorMessage,e.subError,t,e.correlationId)}}}class h extends a{constructor(e,t){super("redirect",t||"Redirect Error, a fallback to the browser-delegated authentication is needed. Use loginPopup instead.",e),this.redirectReason=t,Object.setPrototypeOf(this,h.prototype)}}class u extends a{constructor(e,t,r,s,i,n,a,o,l){super(e,t,r,s,i),this.attributes=n,this.continuationToken=a,this.traceId=o,this.timestamp=l,Object.setPrototypeOf(this,u.prototype)}}class d extends a{constructor(e){super("no_cached_account_found","No account found in the cache",e),Object.setPrototypeOf(this,d.prototype)}}class g extends a{constructor(e,t){super("invalid_argument",`The argument '${e}' is invalid.`,t),Object.setPrototypeOf(this,g.prototype)}}let m="continuation_token_missing",p="invalid_response_body",w="unsupported_challenge_type",y="invalid_request",I="user_not_found",C="invalid_grant",f="attributes_required",P="password_change_failed",b="password_reset_timeout";class T{constructor(e){this.errorData=e}isUserNotFoundError(){return this.errorData.error===I}isUserInvalidError(){return this.errorData instanceof g&&this.errorData.errorDescription?.includes("username")||this.errorData instanceof u&&!!this.errorData.errorDescription?.includes("username parameter is empty or not valid")&&!!this.errorData.errorCodes?.includes(90100)}isUnsupportedChallengeTypeError(){return this.errorData.error===y&&(this.errorData.errorDescription?.includes("The challenge_type list parameter contains an unsupported challenge type")??!1)||this.errorData.error===w}isPasswordIncorrectError(){let e=this.errorData.error===C&&this.errorData instanceof u&&(this.errorData.errorCodes??[]).includes(50126),t=this.errorData instanceof g&&this.errorData.errorDescription?.includes("password")===!0;return e||t}isInvalidCodeError(){return this.errorData.error===C&&this.errorData instanceof u&&"invalid_oob_value"===this.errorData.subError||this.errorData instanceof g&&!0===(this.errorData.errorDescription?.includes("code")||this.errorData.errorDescription?.includes("challenge"))}isRedirectError(){return this.errorData instanceof h}isInvalidNewPasswordError(){let e=new Set(["password_banned","password_is_invali
1d","password_recently_used","password_too_long","password_too_short","password_too_weak"]);return this.errorData instanceof u&&this.errorData.error===C&&e.has(this.errorData.subError??"")}isUserAlreadyExistsError(){return this.errorData instanceof u&&"user_already_exists"===this.errorData.error}isAttributeRequiredError(){return this.errorData instanceof u&&this.errorData.error===f}isAttributeValidationFailedError(){return this.errorData instanceof u&&this.errorData.error===C&&"attribute_validation_failed"===this.errorData.subError||this.errorData instanceof g&&this.errorData.errorDescription?.includes("attributes")===!0}isNoCachedAccountFoundError(){return this.errorData instanceof d}isTokenExpiredError(){return this.errorData instanceof u&&"expired_token"===this.errorData.error}isPasswordResetRequiredError(){return this.errorData instanceof u&&this.errorData.error===y&&this.errorData.errorCodes?.includes(50142)===!0}isInvalidInputError(){return this.errorData instanceof u&&this.errorData.error===y&&this.errorData.errorCodes?.includes(901001)===!0}isVerificationContactBlockedError(){return this.errorData instanceof u&&"access_denied"===this.errorData.error&&"provider_blocked_by_rep"===this.errorData.subError}}class k extends T{isTokenExpired(){return this.isTokenExpiredError()}isRedirectRequired(){return this.isRedirectError()}}class _ extends T{isCurrentAccountNotFound(){return this.isNoCachedAccountFoundError()}}class v extends T{isUserNotSignedIn(){return this.isNoCachedAccountFoundError()}}class A extends T{isCurrentAccountNotFound(){return this.isNoCachedAccountFoundError()}}function x(e,t,r){if(null==t)throw new g(e,r)}function E(e,t,r){if(!t||""===t.trim())throw new g(e,r)}function S(e,t,r){try{let s=JSON.parse(t);if("object"!=typeof s||null===s||Array.isArray(s))throw new g(e,r)}catch(t){if(t instanceof SyntaxError)throw new g(e,r);throw t}}var R=e.i(364725),q=e.i(599641);let j="password",M="continuation_token",D={PASSWORD:"password",OOB:"oob",REDIRECT:"redirect",PREVERIFIED:"preverified"},U=[R.Constants.OPENID_SCOPE,R.Constants.PROFILE_SCOPE,R.Constants.OFFLINE_ACCESS_SCOPE],N=["x-client-","x-ms-","x-broker-","x-app-"],O={SKU:"msal.browser",VERSION:q.version,OS:"",CPU:""},L="succeeded",F="failed";class W{}class V extends W{constructor(e){E("correlationId",e.correlationId),super(),this.stateParameters=e}ensureCodeIsValid(e,t){if(-1!==t&&(!e||e.length!==t))throw this.stateParameters.logger.error("0jr92e",this.stateParameters.correlationId),new g("code",this.stateParameters.correlationId)}ensurePasswordIsNotEmpty(e){if(!e)throw this.stateParameters.logger.error("140ijv",this.stateParameters.correlationId),new g("password",this.stateParameters.correlationId)}}let z="SignInCodeRequiredState",$="SignInPasswordRequiredState",H="SignInCompletedState",B="SignInFailedState",K="SignUpCodeRequiredState",G="SignUpPasswordRequiredState",J="SignUpAttributesRequiredState",X="SignUpCompletedState",Q="SignUpFailedState",Y="ResetPasswordCodeRequiredState",Z="ResetPasswordPasswordRequiredState",ee="ResetPasswordCompletedState",et="ResetPasswordFailedState",er="GetAccountCompletedState",es="GetAccountFailedState",ei="GetAccessTokenCompletedState",en="GetAccessTokenFailedState",ea="SignOutCompletedState",eo="SignOutFailedState",el="MfaAwaitingState",ec="MfaVerificationRequiredState",eh="MfaCompletedState",eu="MfaFailedState",ed="AuthMethodRegistrationRequiredState",eg="AuthMethodVerificationRequiredState",em="AuthMethodRegistrationCompletedState",ep="AuthMethodRegistrationFailedState";class ew extends W{constructor(){super(...arguments),this.stateType=er}}class ey extends W{constructor(){super(...arguments),this.stateType=es}}class eI extends c{constructor(e){super(new ew,e)}static createWithError(e){let t=new eI;return t.error=new _(eI.createErrorData(e)),t.state=new ey,t}isCompleted(){return this.state.stateType===er}isFailed(){return this.state.stateType===es}}class eC extends k{isUserNotFound(){return this.errorData.error===I}isInvalidUsername(){return this.isUserInvalidError()}isPasswordIncorrect(){return this.isPasswordIncorrectError()}isPasswordResetRequired(){return this.isPasswordResetRequiredError()}isUnsupportedChallengeType(){return this.isUnsupportedChallengeTypeError()}}class ef extends k{isInvalidPassword(){return this.isPasswordIncorrectError()}}class eP extends k{isInvalidCode(){return this.isInvalidCodeError()}}class eb extends k{}class eT extends W{constructor(){super(...arguments),this.stateType=B}}class ek extends c{constructor(e,t){super(e,t)}static createWithError(e){let t=new ek(new eT);return t.error=new eC(ek.createErrorData(e)),t}isFailed(){return this.state.stateType===B}isCodeRequired(){return this.state.stateType===z}isPasswordRequired(){return this.state.stateType===$}isCompleted(){return this.state.stateType===H}isAuthMethodRegistrationRequired(){return this.state.stateType===ed}isMfaRequired(){return this.state.stateType===el}}class e_ extends k{isUserAlreadyExists(){return this.isUserAlreadyExistsError()}isInvalidUsername(){return this.isUserInvalidError()}isInvalidPassword(){return this.isInvalidNewPasswordError()}isMissingRequiredAttributes(){return this.isAttributeRequiredError()}isAttributesValidationFailed(){return this.isAttributeValidationFailedError()}isUnsupportedChallengeType(){return this.isUnsupportedChallengeTypeError()}}class ev extends k{isInvalidPassword(){return this.isPasswordIncorrectError()||this.isInvalidNewPasswordError()}}class eA extends k{isInvalidCode(){return this.isInvalidCodeError()}}class ex extends k{isMissingRequiredAttributes(){return this.isAttributeRequiredError()}isAttributesValidationFailed(){return this.isAttributeValidationFailedError()}}class eE extends k{}class eS extends W{constructor(){super(...arguments),this.stateType=Q}}class eR extends c{constructor(e){super(e)}static createWithError(e){let t=new eR(new eS);return t.error=new e_(eR.createErrorData(e)),t}isFailed(){return this.state.stateType===Q}isCodeRequired(){return this.state.stateType===K}isPasswordRequired(){return this.state.stateType===G}isAttributesRequired(){return this.state.stateType===J}}class eq extends a{constructor(e,t){super("method_not_implemented",`The method '${e}' is not implemented, please do not use.`,t),Object.setPrototypeOf(this,eq.prototype)}}var ej=e.i(116487),eM=e.i(690415);class eD extends ej.StandardInteractionClient{constructor(e,t,r,s,i,n,a,o,l){super(e,t,r,s,i,n,a,""),this.customAuthApiClient=o,this.customAuthAuthority=l,this.tokenResponseHandler=new eM.ResponseHandler(this.config.auth.clientId,this.browserStorage,this.browserCrypto,this.logger,this.performanceClient,null,null)}getChallengeTypes(e){let t=e??[];return t.some(e=>e.toLowerCase()===D.REDIRECT)||t.push(D.REDIRECT),t.join(" ")}getScopes(e){return e&&e.length>0?e:[R.Constants.OPENID_SCOPE,R.Constants.PROFILE_SCOPE,R.Constants.OFFLINE_ACCESS_SCOPE]}async handleTokenResponse(e,t,r,s){this.logger.verbose("04a00a",r);let i=Math.round(new Date().getTime()/1e3);return await this.tokenResponseHandler.handleServerTokenResponse(e,this.customAuthAuthority,i,{authority:this.customAuthAuthority.canonicalAuthority,correlationId:e.correlation_id??r,scopes:t},s)}acquireToken(e){throw new eq("SignInClient.acquireToken")}logout(e){throw new eq("SignInClient.logout")}}let eU="SignInCodeSendResult",eN="SignInPasswordRequiredResult",eO="SignInCompletedResult",eL="SignInJitRequiredResult",eF="SignInMfaRequiredResult",eW="SignInAfterSignUp",eV="SignInAfterPasswordReset";var ez=e.i(20058);class e$ extends eD{async start(e){let t=e.correlationId||this.correlationId,r=e.password?100002:100001,s=(0,ez.initializeServerTelemetryManager)(r,this.config.auth.clientId,t,this.browserStorage,this.logger);this.logger.verbose("1iuhun",t);let i={challenge_type:this.getChallengeTypes(e.challengeType),username:e.username,correlationId:t,telemetryManager:s},n=await this.customAuthApiClient.signInApi.initiate(i);this.logger.verbose("1qs4yd",n.correlation_id||t);let a={challenge_type:this.getChallengeTypes(e.challengeType),continuation_token:n.continuation_token??"",correlationId:n.correlation_id||t,telemetryManager:s};return this.performChallengeRequest(a)}async resendCode(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100005,this.config.auth.clientId,t,this.browserStorage,this.logger),s={challenge_type:this.getChallengeTypes(e.challengeType),continuation_token:e.continuationToken??"",correlationId:t,telemetryManager:r},i=await this.performChallengeRequest(s);if(i.type===eN)throw this.logger.error("0duqjg",i.correlationId||t),new u(w,"Unsupported challenge type 'password'.",i.correlationId||t);return i}async submitCode(e){let t=e.correlationId||this.correlationId;E("parameters.code",e.code,t);let r=(0,ez.initializeServerTelemetryManager)(100003,this.config.auth.clientId,t,this.browserStorage,this.logger),s=this.getScopes(e.scopes),i={continuation_token:e.continuationToken,oob:e.code,grant_type:"oob",scope:s.join(" "),correlationId:t,telemetryManager:r,...e.claims&&{claims:e.claims}};return this.performTokenRequest(()=>this.customAuthApiClient.signInApi.requestTokensWithOob(i),s,t,r,100003)}async submitPassword(e){let t=e.correlationId||this.correlationId;E("parameters.password",e.password,t);let r=(0,ez.initializeServerTelemetryManager)(100004,this.config.auth.clientId,t,this.browserStorage,this.logger),s=this.getScopes(e.scopes),i={continuation_token:e.continuationToken,password:e.password,scope:s.join(" "),correlationId:t,telemetryManager:r,...e.claims&&{claims:e.claims}};return this.performTokenRequest(()=>this.customAuthApiClient.signInApi.requestTokensWithPassword(i),s,t,r,100004)}async signInWithContinuationToken(e){let t=e.correlationId||this.correlationId,r=this.getPublicApiIdBySignInScenario(e.signInScenario,t),s=(0,ez.initializeServerTelemetryManager)(r,this.config.auth.clientId,t,this.browserStorage,this.logger),i=this.getScopes(e.scopes),n={continuation_token:e.continuationToken,username:e.username,correlationId:t,telemetryManager:s,scope:i.join(" "),...e.claims&&{claims:e.claims}};return this.performTokenRequest(()=>this.customAuthApiClient.signInApi.requestTokenWithContinuationToken(n),i,t,s,r)}async performTokenRequest(e,t,r,s,i){this.logger.verbose("14tes8",r);try{var n;let s=await e();this.logger.verbose("11zi01",s.correlation_id||r);let a=await this.handleTokenResponse(s,t,s.correlation_id||r,i);return n={correlationId:s.correlation_id||r,authenticationResult:a},{type:eO,...n}}catch(e){if(e instanceof u&&"registration_required"===e.subError)return this.handleJitRequiredError(e,s,e.correlationId||r);if(e instanceof u&&"mfa_required"===e.subError)return this.handleMfaRequiredError(e,s,e.correlationId||r);throw e}}async performChallengeRequest(e){this.logger.verbose("0fr9br",e.correlationId);let t=await this.customAuthApiClient.signInApi.requestChallenge(e);if(this.logger.verbose("083301",t.correlation_id||e.correlationId),t.challenge_type===D.OOB)return this.logger.verbose("0m6hva",t.correlation_id||e.correlationId),{type:eU,...{c
1orrelationId:t.correlation_id||e.correlationId,continuationToken:t.continuation_token??"",challengeChannel:t.challenge_channel??"",challengeTargetLabel:t.challenge_target_label??"",codeLength:t.code_length??-1,bindingMethod:t.binding_method??""}};if(t.challenge_type===D.PASSWORD)return this.logger.verbose("1xku2l",t.correlation_id||e.correlationId),{type:eN,...{correlationId:t.correlation_id||e.correlationId,continuationToken:t.continuation_token??""}};throw this.logger.error("1tkddq",t.correlation_id||e.correlationId),new u(w,`Unsupported challenge type '${t.challenge_type}'.`,t.correlation_id||e.correlationId)}getPublicApiIdBySignInScenario(e,t){switch(e){case eW:return 100006;case eV:return 100007;default:throw new l(`Unsupported sign-in scenario '${e}'.`,t)}}async handleJitRequiredError(e,t,r){this.logger.verbose("0msz8y",r);let s={continuation_token:e.continuationToken??"",correlationId:r,telemetryManager:t};this.logger.verbose("10zm99",r);let i=await this.customAuthApiClient.registerApi.introspect(s);return this.logger.verbose("1j7fgr",i.correlation_id||r),{type:eL,...{correlationId:i.correlation_id||r,continuationToken:i.continuation_token??"",authMethods:i.methods}}}async handleMfaRequiredError(e,t,r){this.logger.verbose("19uxoc",r);let s={continuation_token:e.continuationToken??"",correlationId:r,telemetryManager:t};this.logger.verbose("0pqpya",r);let i=await this.customAuthApiClient.signInApi.requestAuthMethods(s);return this.logger.verbose("1ysax9",i.correlation_id||r),{type:eF,...{correlationId:i.correlation_id||r,continuationToken:i.continuation_token??"",authMethods:i.methods}}}}class eH extends W{constructor(){super(...arguments),this.stateType=ea}}class eB extends W{constructor(){super(...arguments),this.stateType=eo}}class eK extends c{constructor(){super(new eH)}static createWithError(e){let t=new eK;return t.error=new v(eK.createErrorData(e)),t.state=new eB,t}isCompleted(){return this.state.stateType===ea}isFailed(){return this.state.stateType===eo}}class eG extends W{constructor(){super(...arguments),this.stateType=ei}}class eJ extends W{constructor(){super(...arguments),this.stateType=en}}class eX extends c{constructor(e){super(new eG,e)}static createWithError(e){let t=new eX;return t.error=new A(eX.createErrorData(e)),t.state=new eJ,t}isCompleted(){return this.state.stateType===ei}isFailed(){return this.state.stateType===en}}class eQ{constructor(e,t,r,s,i){this.account=e,this.config=t,this.cacheClient=r,this.logger=s,this.correlationId=i,E("correlationId",i),x("account",e,i)}async signOut(){try{let e=this.cacheClient.getCurrentAccount(this.correlationId);if(!e)throw new d(this.correlationId);return this.logger.verbose("17l5fh",this.correlationId),await this.cacheClient.logout({correlationId:this.correlationId,account:e}),this.logger.verbose("16o7ps",this.correlationId),new eK}catch(e){return this.logger.errorPii("19tou7",this.correlationId),eK.createWithError(e)}}getAccount(){return this.account}getIdToken(){return this.account.idToken}getClaims(){return this.account.idTokenClaims}async getAccessToken(e){try{x("accessTokenRetrievalInputs",e,this.correlationId),e.claims&&S("accessTokenRetrievalInputs.claims",e.claims,this.correlationId),this.logger.verbose("0jrcu2",this.correlationId);let t=this.cacheClient.getCurrentAccount(this.account.username);if(!t)throw new d(this.correlationId);this.logger.verbose("108lch",this.correlationId);let r=e.scopes&&e.scopes.length>0?e.scopes:[...U],s=this.createCommonSilentFlowRequest(t,e.forceRefresh,r,e.claims),i=await this.cacheClient.acquireToken(s);return this.logger.verbose("1w15hv",this.correlationId),new eX(i)}catch(e){return this.logger.error("0yfud8",this.correlationId),eX.createWithError(e)}}createCommonSilentFlowRequest(e,t=!1,r,s){return{...{authority:this.config.auth.authority,correlationId:this.correlationId,scopes:r||[],account:e,forceRefresh:t||!1,storeInCache:{idToken:!0,accessToken:!0,refreshToken:!0},...s&&{claims:s}},authenticationScheme:R.Constants.AuthenticationScheme.BEARER}}}class eY extends k{isUserNotFound(){return this.isUserNotFoundError()}isInvalidUsername(){return this.isUserInvalidError()}isUnsupportedChallengeType(){return this.isUnsupportedChallengeTypeError()}}class eZ extends k{isInvalidPassword(){return this.isInvalidNewPasswordError()||this.isPasswordIncorrectError()}isPasswordResetFailed(){return this.errorData instanceof u&&(this.errorData.error===b||this.errorData.error===P)}}class e0 extends k{isInvalidCode(){return this.isInvalidCodeError()}}class e1 extends k{}class e3 extends W{constructor(){super(...arguments),this.stateType=et}}class e2 extends c{constructor(e){super(e)}static createWithError(e){let t=new e2(new e3);return t.error=new eY(e2.createErrorData(e)),t}isFailed(){return this.state.stateType===et}isCodeRequired(){return this.state.stateType===Y}}var e4=e.i(456842);let e5="/oauth2/v2.0/token",e6="/signup/v1.0/continue";class e9 extends a{constructor(e,t,r){super(e,t,r),Object.setPrototypeOf(this,e9.prototype)}}function e8(e,t,r){let s=e.endsWith("/")?e:`${e}/`,i=new URL(t.startsWith("/")?t.slice(1):t,s);return r&&Object.entries(r).forEach(([e,t])=>{null!=t&&i.searchParams.set(e,String(t))}),i}class e7 extends e4.Authority{constructor(e,t,r,s,i,n,a){super(e7.transformCIAMAuthority(e),r,s,{protocolMode:t.system.protocolMode,OIDCOptions:t.auth.OIDCOptions,knownAuthorities:t.auth.knownAuthorities,cloudDiscoveryMetadata:t.auth.cloudDiscoveryMetadata,authorityMetadata:t.auth.authorityMetadata},i,"",n),this.customAuthProxyDomain=a;const o={aliases:[this.hostnameAndPort],preferred_cache:this.getPreferredCache(),preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:this.tokenEndpoint,end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:Number.MAX_SAFE_INTEGER,jwks_uri:""},l=this.cacheManager.generateAuthorityMetadataCacheKey(o.preferred_cache,this.correlationId);s.setAuthorityMetadata(l,o,this.correlationId)}getCustomAuthApiDomain(){return this.customAuthProxyDomain?this.customAuthProxyDomain:this.canonicalAuthority}getPreferredCache(){return this.canonicalAuthorityUrlComponents.HostNameAndPort}get tokenEndpoint(){return e8(this.getCustomAuthApiDomain(),e5).href}}let te="SignUpCompletedResult",tt="SignUpPasswordRequiredResult",tr="SignUpCodeRequiredResult",ts="SignUpAttributesRequiredResult";function ti(e){return{type:tt,...e}}function tn(e){return{type:tr,...e}}class ta extends eD{async start(e){let t=e.correlationId||this.correlationId,r=e.password?100021:100022,s=(0,ez.initializeServerTelemetryManager)(r,this.config.auth.clientId,t,this.browserStorage,this.logger),i={username:e.username,password:e.password,attributes:e.attributes,challenge_type:this.getChallengeTypes(e.challengeType),telemetryManager:s,correlationId:t};this.logger.verbose("1ufort",t);let n=await this.customAuthApiClient.signUpApi.start(i);this.logger.verbose("1mzh8i",n.correlation_id||t);let a={continuation_token:n.continuation_token??"",challenge_type:this.getChallengeTypes(e.challengeType),telemetryManager:s,correlationId:n.correlation_id||t};return this.performChallengeRequest(a)}async submitCode(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100023,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken,oob:e.code,telemetryManager:r,correlationId:t},i=await this.performContinueRequest("SignUpClient.submitCode",e,r,()=>this.customAuthApiClient.signUpApi.continueWithCode(s),t);
1if(i.type===tr)throw new u(w,"The challenge type 'oob' is invalid after submtting code for sign up.",i.correlationId||t);return i}async submitPassword(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100024,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken,password:e.password,telemetryManager:r,correlationId:t},i=await this.performContinueRequest("SignUpClient.submitPassword",e,r,()=>this.customAuthApiClient.signUpApi.continueWithPassword(s),t);if(i.type===tt)throw new u(w,"The challenge type 'password' is invalid after submtting password for sign up.",i.correlationId||t);return i}async submitAttributes(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100025,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken,attributes:e.attributes,telemetryManager:r,correlationId:t},i=await this.performContinueRequest("SignUpClient.submitAttributes",e,r,()=>this.customAuthApiClient.signUpApi.continueWithAttributes(s),t);if(i.type===ts)throw new u(f,"User attributes required",i.correlationId||t,[],"",i.requiredAttributes,i.continuationToken);return i}async resendCode(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100026,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken??"",challenge_type:this.getChallengeTypes(e.challengeType),telemetryManager:r,correlationId:t},i=await this.performChallengeRequest(s);if(i.type===tt)throw new u(w,"The challenge type 'password' is invalid after resending code for sign up.",i.correlationId||t);return i}async performChallengeRequest(e){this.logger.verbose("0wfw94",e.correlationId);let t=await this.customAuthApiClient.signUpApi.requestChallenge(e);if(this.logger.verbose("1izuav",t.correlation_id||e.correlationId),t.challenge_type===D.OOB)return this.logger.verbose("0ucygy",t.correlation_id||e.correlationId),tn({correlationId:t.correlation_id||e.correlationId,continuationToken:t.continuation_token??"",challengeChannel:t.challenge_channel??"",challengeTargetLabel:t.challenge_target_label??"",codeLength:t.code_length??-1,interval:t.interval??300,bindingMethod:t.binding_method??""});if(t.challenge_type===D.PASSWORD)return this.logger.verbose("11vq5l",t.correlation_id||e.correlationId),ti({correlationId:t.correlation_id||e.correlationId,continuationToken:t.continuation_token??""});throw this.logger.error("0wg2fe",t.correlation_id||e.correlationId),new u(w,`Unsupported challenge type '${t.challenge_type}'.`,t.correlation_id||e.correlationId)}async performContinueRequest(e,t,r,s,i){this.logger.verbose("0sw5ym",i);try{var n;let e=await s();return this.logger.verbose("0ib062",e.correlation_id||i),n={correlationId:e.correlation_id||i,continuationToken:e.continuation_token??""},{type:te,...n}}catch(e){if(e instanceof u)return this.handleContinueResponseError(e,e.correlationId||i,t,r);throw this.logger.errorPii("03rje8",i),new l(e,i)}}async handleContinueResponseError(e,t,r,s){if("credential_required"===e.error&&e.errorCodes&&e.errorCodes.includes(55103)){this.logger.verbose("164mmt",t);let i={continuation_token:this.readContinuationTokenFromResponeError(e,t),challenge_type:this.getChallengeTypes(r.challengeType),telemetryManager:s,correlationId:t},n=await this.performChallengeRequest(i);if(n.type===tt)return ti({correlationId:n.correlationId||t,continuationToken:n.continuationToken});if(n.type===tr)return tn({correlationId:n.correlationId||t,continuationToken:n.continuationToken,challengeChannel:n.challengeChannel,challengeTargetLabel:n.challengeTargetLabel,codeLength:n.codeLength,interval:n.interval,bindingMethod:n.bindingMethod});throw new u(w,"The challenge type is not supported.",t)}if(this.isAttributesRequiredError(e,t)){this.logger.verbose("13zvmd",t);let r=this.readContinuationTokenFromResponeError(e,t);return{type:ts,...{correlationId:t,continuationToken:r,requiredAttributes:e.attributes??[]}}}throw e}isAttributesRequiredError(e,t){if(e.error===f){if(!e.attributes||0===e.attributes.length)throw new u(p,"Attributes are required but required_attributes field is missing in the response body.",t);return!0}return!1}readContinuationTokenFromResponeError(e,t){if(!e.continuationToken)throw new u(m,"Continuation token is missing in the response body",t);return e.continuationToken}}class to{constructor(e,t,r,s,i,n,a,o,l){this.config=e,this.storageImpl=t,this.browserCrypto=r,this.logger=s,this.eventHandler=i,this.navigationClient=n,this.performanceClient=a,this.customAuthApiClient=o,this.customAuthAuthority=l}create(e){return new e(this.config,this.storageImpl,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.customAuthApiClient,this.customAuthAuthority)}}var tl=e.i(216890);class tc{constructor(e,t,r,s,i,n){this.clientId=t,this.httpClient=r,this.customAuthApiQueryParams=s,this.requestInterceptor=i,this.logger=n,this.baseRequestUrl=function(e){try{return new URL(e)}catch(t){throw new e9("invalid_url",`The URL "${e}
1" is invalid: ${t}`)}}(e.endsWith("/")?e:`${e}/`)}async request(e,t,r,s){let i,n=new URLSearchParams({client_id:this.clientId,...t}),a=this.getCommonHeaders(s,r),o=e8(this.baseRequestUrl.href,e,this.customAuthApiQueryParams),l=await this.getAdditionalHeaders(o,s),c={...a,...l};try{i=await this.httpClient.post(o,n,c)}catch(t){throw new u("http_request_failed",`Failed to perform '${e}' request: ${t}`,s)}return this.handleApiResponse(i,s)}ensureContinuationTokenIsValid(e,t){if(!e)throw new u(m,"Continuation token is missing in the response body",t)}readResponseCorrelationId(e,t){return e.headers.get("x-ms-request-id")||t}getCommonHeaders(e,t){return{"Content-Type":"application/x-www-form-urlencoded",[tl.AADServerParamKeys.X_CLIENT_SKU]:O.SKU,[tl.AADServerParamKeys.X_CLIENT_VER]:O.VERSION,[tl.AADServerParamKeys.X_CLIENT_OS]:O.OS,[tl.AADServerParamKeys.X_CLIENT_CPU]:O.CPU,[tl.AADServerParamKeys.X_CLIENT_CURR_TELEM]:t.generateCurrentRequestHeaderValue(),[tl.AADServerParamKeys.X_CLIENT_LAST_TELEM]:t.generateLastRequestHeaderValue(),[tl.AADServerParamKeys.CLIENT_REQUEST_ID]:e}}async handleApiResponse(e,t){if(!e)throw new u("empty_response","Response is empty",t);let r=this.readResponseCorrelationId(e,t),s=await e.json();if(e.ok){if("object"==typeof s&&s.challenge_type===D.REDIRECT)throw new h(r,s.redirect_reason);return{...s,correlation_id:r}}if(!s)throw new u(p,"Response error body is empty or invalid",r);let i=s.required_attributes&&s.required_attributes.length>0?s.required_attributes:s.invalid_attributes??[];throw new u(s.error,s.error_description,s.correlation_id,s.error_codes,s.suberror,i,s.continuation_token,s.trace_id,s.timestamp)}async getAdditionalHeaders(e,t){if(!this.requestInterceptor)return{};try{let r=await Promise.resolve(this.requestInterceptor.addAdditionalHeaderFields(e));return function(e,t,r){let s={};if(!e)return s;for(let[i,n]of Object.entries(e)){if(!i||null==n)continue;let e=i.trim();if(!e)continue;let a=e.toLowerCase();if(!a.startsWith("x-")){t?.warningPii("0vzpop",r??"");continue}if(N.find(e=>a.startsWith(e))){t?.warningPii("1m3lhk",r??"");continue}s[e]=n}return s}(r,this.logger,t)}catch(e){return this.logger?.warningPii("1ptwx4",t),{}}}}class th extends tc{constructor(e,t,r,s,i,n,a){super(e,t,r,i,n,a),this.capabilities=s}async start(e){let t=await this.request("/resetpassword/v1.0/start",{challenge_type:e.challenge_type,username:e.username,...this.capabilities&&{capabilities:this.capabilities}},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async requestChallenge(e){let t=await this.request("/resetpassword/v1.0/challenge",{challenge_type:e.challenge_type,continuation_token:e.continuation_token},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async continueWithCode(e){let t=await this.request("/resetpassword/v1.0/continue",{continuation_token:e.continuation_token,grant_type:"oob",oob:e.oob},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async submitNewPassword(e){let t=await this.request("/resetpassword/v1.0/submit",{continuation_token:e.continuation_token,new_password:e.new_password},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),0===t.poll_interval&&(t.poll_interval=2),t}async pollCompletion(e){let t=await this.request("/resetpassword/v1.0/poll_completion",{continuation_token:e.continuation_token},e.telemetryManager,e.correlationId);return this.ensurePollStatusIsValid(t.status,e.correlationId),t}ensurePollStatusIsValid(e,t){if(e!==F&&"in_progress"!==e&&e!==L&&"not_started"!==e)throw new u("invalid_poll_status",`The poll status '${e}' for password reset is invalid`,t)}}class tu extends tc{constructor(e,t,r,s,i,n,a){super(e,t,r,i,n,a),this.capabilities=s}async start(e){let t=await this.request("/signup/v1.0/start",{username:e.username,...e.password&&{password:e.password},...e.attributes&&{attributes:JSON.stringify(e.attributes)},challenge_type:e.challenge_type,...this.capabilities&&{capabilities:this.capabilities}},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async requestChallenge(e){let t=await this.request("/signup/v1.0/challenge",{continuation_token:e.continuation_token,challenge_type:e.challenge_type},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async continueWithCode(e){let t=await this.request(e6,{continuation_token:e.continuation_token,grant_type:"oob",oob:e.oob},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async continueWithPassword(e){let t=await this.request(e6,{continuation_token:e.continuation_token,grant_type:j,password:e.password},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async continueWithAttributes(e){let t=await this.request(e6,{continuation_token:e.continuation_token,grant_type:"attributes",attributes:JSON.stringify(e.attributes)},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}}class td extends tc{constructor(e,t,r,s,i,n,a){super(e,t,r,i,n,a),this.capabilities=s}async initiate(e){let t=await this.request("/oauth2/v2.0/initiate",{username:e.username,challenge_type:e.challenge_type,...this.capabilities&&{capabilities:this.capabilities}},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async requestChallenge(e){let t=await this.request("/oauth2/v2.0/challenge",{continuation_token:e.continuation_token,challenge_type:e.challenge_type,...e.id&&{id:e.id}},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async requestTokensWithPassword(e){return this.requestTokens({continuation_token:e.continuation_token,grant_type:j,scope:e.scope,password:e.password,...e.claims&&{claims:e.claims}},e.telemetryManager,e.correlationId)}async requestTokensWithOob(e){return this.requestTokens({continuation_token:e.continuation_token,scope:e.scope,oob:e.oob,grant_type:e.grant_type,...e.claims&&{claims:e.claims}},e.telemetryManager,e.correlationId)}async requestTokenWithContinuationToken(e){return this.requestTokens({continuation_token:e.continuation_token,scope:e.scope,grant_type:M,...e.claims&&{claims:e.claims},...e.username&&{username:e.username}},e.telemetryManager,e.correlationId)}async requestAuthMethods(e){let t=await this.request("/oauth2/v2.0/introspect",{continuation_token:e.continuation_token},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async requestTokens(e,t,r){e.client_info="1";let s=await this.request(e5,e,t,r);return td.ensureTokenResponseIsValid(s),s}static ensureTokenResponseIsValid(e){let t="",r="";if(e.access_token?e.id_token?e.refresh_token?!e.expires_in||e.expires_in<=0?(t="invalid_expires_in",r="Expires in is invali
1d in the response body"):"Bearer"!==e.token_type?(t="invalid_token_type",r=`Token type '${e.token_type}' is invalid in the response body`):e.client_info||(t="client_info_missing",r="Client info is missing in the response body"):(t="refresh_token_missing",r="Refresh token is missing in the response body"):(t="id_token_missing",r="Id token is missing in the response body"):(t="access_token_missing",r="Access token is missing in the response body"),t||r)throw new u(t,r,e.correlation_id)}}class tg extends tc{async introspect(e){let t=await this.request("/register/v1.0/introspect",{continuation_token:e.continuation_token},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async challenge(e){let t=await this.request("/register/v1.0/challenge",{continuation_token:e.continuation_token,challenge_type:e.challenge_type,challenge_target:e.challenge_target,...e.challenge_channel&&{challenge_channel:e.challenge_channel}},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}async continue(e){let t=await this.request("/register/v1.0/continue",{continuation_token:e.continuation_token,grant_type:e.grant_type,...e.oob&&{oob:e.oob}},e.telemetryManager,e.correlationId);return this.ensureContinuationTokenIsValid(t.continuation_token,e.correlationId),t}}class tm{constructor(e,t,r,s,i,n,a){this.signInApi=new td(e,t,r,s,i,n,a),this.signUpApi=new tu(e,t,r,s,i,n,a),this.resetPasswordApi=new th(e,t,r,s,i,n,a),this.registerApi=new tg(e,t,r,i,n,a)}}class tp extends a{constructor(e,t,r){super(e,t,r),Object.setPrototypeOf(this,tp.prototype)}}class tw{constructor(e){this.logger=e}async sendAsync(e,t){let r=t.headers,s=r?.[tl.AADServerParamKeys.CLIENT_REQUEST_ID]||"";try{this.logger.verbosePii("17dhbs",s),performance.now();let r=await fetch(e,t);return performance.now(),this.logger.verbosePii("1egykc",s),r}catch(e){if(this.logger.errorPii("0ye3lm",s),!window.navigator.onLine)throw new tp("no_network_connectivity",`No network connectivity: ${e}`,s);throw new tp("failed_send_request",`Failed to send request: ${e}`,s)}}async post(e,t,r={}){return this.sendAsync(e,{method:"POST",headers:r,body:t})}async get(e,t={}){return this.sendAsync(e,{method:"GET",headers:t})}}class ty extends eD{async start(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100041,this.config.auth.clientId,t,this.browserStorage,this.logger),s={challenge_type:this.getChallengeTypes(e.challengeType),username:e.username,correlationId:t,telemetryManager:r};this.logger.verbose("13zstj",t);let i=await this.customAuthApiClient.resetPasswordApi.start(s);this.logger.verbose("0wsodm",t);let n={continuation_token:i.continuation_token??"",challenge_type:this.getChallengeTypes(e.challengeType),correlationId:i.correlation_id||t,telemetryManager:r};return this.performChallengeRequest(n)}async submitCode(e){let t=e.correlationId||this.correlationId;E("parameters.code",e.code,t);let r=(0,ez.initializeServerTelemetryManager)(100042,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken,oob:e.code,correlationId:t,telemetryManager:r};this.logger.verbose("0rnsi3",t);let i=await this.customAuthApiClient.resetPasswordApi.continueWithCode(s);return this.logger.verbose("1w9r8y",i.correlation_id),{correlationId:i.correlation_id||t,continuationToken:i.continuation_token??""}}async resendCode(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100044,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken,challenge_type:this.getChallengeTypes(e.challengeType),correlationId:t,telemetryManager:r};return this.performChallengeRequest(s)}async submitNewPassword(e){let t=e.correlationId||this.correlationId;E("parameters.newPassword",e.newPassword,t);let r=(0,ez.initializeServerTelemetryManager)(100043,this.config.auth.clientId,t,this.browserStorage,this.logger),s={continuation_token:e.continuationToken,new_password:e.newPassword,correlationId:t,telemetryManager:r};this.logger.verbose("060415",t);let i=await this.customAuthApiClient.resetPasswordApi.submitNewPassword(s);return this.logger.verbose("0vmsxm",i.correlation_id||t),this.performPollCompletionRequest(i.continuation_token??"",i.poll_interval,i.correlation_id||t,r)}async performChallengeRequest(e){let t=e.correlationId;this.logger.verbose("0sjpbp",t);let r=await this.customAuthApiClient.resetPasswordApi.requestChallenge(e);if(this.logger.verbose("1l48o7",r.correlation_id||t),r.challenge_type===D.OOB)return this.logger.verbose("1oz986",r.correlation_id||t),{correlationId:r.correlation_id||t,continuationToken:r.continuation_token??"",challengeChannel:r.challenge_channel??"",challengeTargetLabel:r.challenge_target_label??"",codeLength:r.code_length??-1,bindingMethod:r.binding_method??""};throw this.logger.error("0emdih",r.correlation_id||t),new u(w,`Unsupported challenge type '${r.challenge_type}'.`,r.correlation_id||t)}async performPollCompletionRequest(e,t,r,s){let i=performance.now();for(;performance.now()-i<3e5;){let i={continuation_token:e,correlationId:r,telemetryManager:s};this.logger.verbose("1hadzp",r);let n=await this.customAuthApiClient.resetPasswordApi.pollCompletion(i);if(this.logger.verbose("0cghal",r),n.status===L)return{correlationId:n.correlation_id,continuationToken:n.continuation_token??""};if(n.status===F)throw new u(P,"Password is failed to be reset.",n.correlation_id);this.logger.verbose("0ykdlr",r),await this.delay(1e3*t)}throw this.logger.error("0v2tkb",r),new u(b,"Password reset flow has timed out.",r)}async delay(e){return new Promise(t=>setTimeout(t,e))}}let tI="JitVerificationRequiredResult",tC="JitCompletedResult";class tf extends eD{async challengeAuthMethod(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100081,this.config.auth.clientId,t,this.browserStorage,this.logger);this.logger.verbose("1kxcgm",t);let s={continuation_token:e.continuationToken,challenge_type:e.authMethod.challenge_type,challenge_target:e.verificationContact,challenge_channel:e.authMethod.challenge_channel,correlationId:t,telemetryManager:r},i=await this.customAuthApiClient.registerApi.challenge(s);if(this.logger.verbose("07vc8z",i.correlation_id||t),i.challenge_type===D.PREVERIFIED){this.logger.verbose("0tmt75",i.correlation_id||t);let r={correlationId:i.correlation_id||t,continuationToken:i.continuation_token,grantType:M,scopes:e.scopes,username:e.username,claims:e.claims};return await this.submitChallenge(r)}return{type:tI,...{correlationId:i.correlation_id||t,continuationToken:i.continuation_token,challengeChannel:i.challenge_channel,challengeTargetLabel:i.challenge_target,codeLength:i.code_length||-1}}}async submitChallenge(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100082,this.config.auth.clientId,t,this.browserStorage,this.logger);this.logger.verbose("1l3zg1",t);let s={continuation_token:e.continuationToken,grant_type:e.grantType,...e.challenge&&{oob:e.challenge},correlationId:t,telemetryManager:r},i=await this.customAuthApiClient.registerApi.continue(s);this.logger.verbose("10bc4x",e.correlationId);let n=this.getScopes(e.scopes),a={continuation_token:i.continuation_token,scope:n.join(" "),correlationId:i.correlation_id||t,telemetryManager:r,...e.claims&&{claims:e.claims}},o=await this.customAuthApiClient.signInApi.requestTokenWithContinuationToken(a),l=await this.handleTokenResponse(o,n,o.correlation_id||i.c
1orrelation_id||t,100082);return{type:tC,...{correlationId:i.correlation_id||t,authenticationResult:l}}}}class tP extends eD{async requestChallenge(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100101,this.config.auth.clientId,t,this.browserStorage,this.logger);this.logger.verbose("1cbc4t",t);let s={challenge_type:this.getChallengeTypes(e.challengeType),continuation_token:e.continuationToken,id:e.authMethodId,correlationId:t,telemetryManager:r},i=await this.customAuthApiClient.signInApi.requestChallenge(s);if(this.logger.verbose("0egw9i",t),i.challenge_type===D.OOB)return{type:"MfaVerificationRequiredResult",...{correlationId:i.correlation_id||t,continuationToken:i.continuation_token??"",challengeChannel:i.challenge_channel??"",challengeTargetLabel:i.challenge_target_label??"",codeLength:i.code_length??-1,bindingMethod:i.binding_method??""}};throw this.logger.error("1jifg6",i.correlation_id||t),new u(w,`Unsupported challenge type '${i.challenge_type}'.`,i.correlation_id||t)}async submitChallenge(e){let t=e.correlationId||this.correlationId;E("parameters.challenge",e.challenge,t);let r=(0,ez.initializeServerTelemetryManager)(100102,this.config.auth.clientId,t,this.browserStorage,this.logger),s=this.getScopes(e.scopes),i={continuation_token:e.continuationToken,oob:e.challenge,grant_type:"mfa_oob",scope:s.join(" "),correlationId:t,telemetryManager:r,...e.claims&&{claims:e.claims}};this.logger.verbose("1rkonv",t);let n=await this.customAuthApiClient.signInApi.requestTokensWithOob(i),a=await this.handleTokenResponse(n,s,n.correlation_id||t,100102);return{type:"MfaCompletedResult",...{correlationId:n.correlation_id||t,authenticationResult:a}}}}class tb extends a{constructor(e){super("user_already_signed_in","The user has already signed in.",e),Object.setPrototypeOf(this,tb.prototype)}}var tT=e.i(111318),tk=e.i(661857),t_=e.i(473558),tv=e.i(611581),tA=e.i(80706),tx=e.i(903474),tE=e.i(297025);class tS extends eD{async acquireToken(e){let t=e.correlationId||this.correlationId,r=(0,ez.initializeServerTelemetryManager)(100063,this.config.auth.clientId,t,this.browserStorage,this.logger,e.forceRefresh),s=this.getCustomAuthClientConfiguration(r,this.customAuthAuthority,t),i=new tT.SilentFlowClient(s,this.performanceClient);try{this.logger.verbose("1arlz4",t);let r=await i.acquireCachedToken(e);return this.logger.verbose("1dzrjc",t),r[0]}catch(r){if(r instanceof tk.ClientAuthError&&r.errorCode===t_.ClientAuthErrorCodes.tokenRefreshRequired){this.logger.verbose("05sqvp",t);let r=new tv.RefreshTokenClient(s,this.performanceClient);this.logger.verbose("0ogm3j",t);let i=await r.acquireTokenByRefreshToken(e,100063);return this.logger.verbose("0vydnd",t),i}throw r}}async logout(e){let t=this.initializeLogoutRequest(e),r=e?.correlationId||this.correlationId;this.logger.verbose("02fvrq",r),await (0,ez.clearCacheOnLogout)(this.browserStorage,this.browserCrypto,this.logger,r,t?.account),this.logger.verbose("12w2ul",r);let s=this.config.auth.postLogoutRedirectUri;if(s){let e=tA.UrlString.getAbsoluteUrl(s,(0,tE.getCurrentUri)());this.logger.verbose("1fgk77",r),await this.navigationClient.navigateExternal(e,{apiId:tx.ApiId.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1})}}getCurrentAccount(e){let t=null;this.logger.verbose("1ry0zt",e);let r=this.browserStorage.getAllAccounts({},e);return r.length>0&&(1!==r.length&&this.logger.warning("0rh9ou",e),t=r[0]),t?this.logger.verbose("1utnrc",e):this.logger.verbose("0w3jks",e),t}getCustomAuthClientConfiguration(e,t,r){let s=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:t,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:s.loggerCallback,piiLoggingEnabled:s.piiLoggingEnabled,logLevel:s.logLevel,correlationId:r},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:e,libraryInfo:{sku:O.SKU,version:O.VERSION,cpu:O.CPU,os:O.OS},telemetry:this.config.telemetry}}}class tR extends a{constructor(e){super("unsupported_env","The current environment is not browser",e),Object.setPrototypeOf(this,tR.prototype)}}class tq extends c{constructor(e){super(e)}static createWithError(e){let t=new tq(new eT);return t.error=new eb(tq.createErrorData(e)),t}isFailed(){return this.state.stateType===B}isCodeRequired(){return this.state.stateType===z}}class tj extends c{static createWithError(e){let t=new tj(new eT);return t.error=new eP(tj.createErrorData(e)),t}isFailed(){return this.state.stateType===B}isCompleted(){return this.state.stateType===H}isAuthMethodRegistrationRequired(){return this.state.stateType===ed}isMfaRequired(){return this.state.stateType===el}}class tM extends k{isInvalidInput(){return this.isInvalidInputError()}isVerificationContactBlocked(){return this.isVerificationContactBlockedError()}}
1class tD extends k{isIncorrectChallenge(){return this.isInvalidCodeError()}}class tU extends W{constructor(){super(...arguments),this.stateType=ep}}class tN extends c{static createWithError(e){let t=new tN(new tU);return t.error=new tM(tN.createErrorData(e)),t}isVerificationRequired(){return this.state.stateType===eg}isCompleted(){return this.state.stateType===em}isFailed(){return this.state.stateType===ep}}class tO extends c{static createWithError(e){let t=new tO(new tU);return t.error=new tD(tO.createErrorData(e)),t}isCompleted(){return this.state.stateType===em}isFailed(){return this.state.stateType===ep}}class tL extends W{constructor(){super(...arguments),this.stateType=em}}class tF extends V{async challengeAuthMethodInternal(e){try{this.stateParameters.logger.verbose("0vi650",this.stateParameters.correlationId);let t={correlationId:this.stateParameters.correlationId,continuationToken:this.stateParameters.continuationToken??"",authMethod:e.authMethodType,verificationContact:e.verificationContact,scopes:this.stateParameters.scopes??[],username:this.stateParameters.username,claims:this.stateParameters.claims},r=await this.stateParameters.jitClient.challengeAuthMethod(t);if(this.stateParameters.logger.verbose("1ipjwn",this.stateParameters.correlationId),r.type===tI)return this.stateParameters.logger.verbose("0puifv",this.stateParameters.correlationId),new tN(new tV({correlationId:r.correlationId,continuationToken:r.continuationToken,config:this.stateParameters.config,logger:this.stateParameters.logger,jitClient:this.stateParameters.jitClient,cacheClient:this.stateParameters.cacheClient,challengeChannel:r.challengeChannel,challengeTargetLabel:r.challengeTargetLabel,codeLength:r.codeLength,scopes:this.stateParameters.scopes??[],username:this.stateParameters.username,claims:this.stateParameters.claims}));if(r.type===tC){this.stateParameters.logger.verbose("01b21i",this.stateParameters.correlationId);let e=new eQ(r.authenticationResult.account,this.stateParameters.config,this.stateParameters.cacheClient,this.stateParameters.logger,this.stateParameters.correlationId);return new tN(new tL,e)}throw this.stateParameters.logger.error("16lk12",this.stateParameters.correlationId),new l("Unexpected result type from auth challenge method")}catch(e){return this.stateParameters.logger.errorPii("17im04",this.stateParameters.correlationId),tN.createWithError(e)}}}class tW extends tF{constructor(){super(...arguments),this.stateType=ed}getAuthMethods(){return this.stateParameters.authMethods}async challengeAuthMethod(e){return this.challengeAuthMethodInternal(e)}}class tV extends tF{constructor(){super(...arguments),this.stateType=eg}getCodeLength(){return this.stateParameters.codeLength}getChannel(){return this.stateParameters.challengeChannel}getSentTo(){return this.stateParameters.challengeTargetLabel}async submitChallenge(e){try{this.ensureCodeIsValid(e,this.getCodeLength()),this.stateParameters.logger.verbose("084cxu",this.stateParameters.correlationId);let t={correlationId:this.stateParameters.correlationId,continuationToken:this.stateParameters.continuationToken??"",scopes:this.stateParameters.scopes??[],grantType:"oob",challenge:e,username:this.stateParameters.username,claims:this.stateParameters.claims},r=await this.stateParameters.jitClient.submitChallenge(t);this.stateParameters.logger.verbose("0hi8xc",this.stateParameters.correlationId);let s=new eQ(r.authenticationResult.account,this.stateParameters.config,this.stateParameters.cacheClient,this.stateParameters.logger,this.stateParameters.correlationId);return new tO(new tL,s)}catch(e){return this.stateParameters.logger.errorPii("0njepo",this.stateParameters.correlationId),tO.createWithError(e)}}async challengeAuthMethod(e){return this.challengeAuthMethodInternal(e)}}class tz extends k{isInvalidInput(){return this.isInvalidInputError()}isVerificationContactBlocked(){return this.isVerificationContactBlockedError()}}class t$ extends k{isIncorrectChallenge(){return this.isInvalidCodeError()}}class tH extends W{constructor(){super(...arguments),this.stateType=eu}}class tB extends c{static createWithError(e){let t=new tB(new tH);return t.error=new t$(tB.createErrorData(e)),t}isCompleted(){return this.state.stateType===eh}isFailed(){return this.state.stateType===eu}}class tK extends c{static createWithError(e){let t=new tK(new tH);return t.error=new tz(tK.createErrorData(e)),t}isVerificationRequired(){return this.state.stateType===ec}isFailed(){return this.state.stateType===eu}}class tG extends W{constructor(){super(...arguments),this.stateType=eh}}class tJ extends V{async requestChallenge(e){try{E("authMethodId",e),this.stateParameters.logger.verbose("1cnvk7",this.stateParameters.correlationId);let t={correlationId:this.stateParameters.correlationId,continuationToken:this.stateParameters.continuationToken??"",challengeType:this.stateParameters.config.customAuth.challengeTypes??[],authMethodId:e},r=await this.stateParameters.mfaClient.requestChallenge(t);return this.stateParameters.logger.verbose("0rb7r9",this.stateParameters.correlationId),new tK(new tQ({correlationId:r.correlationId,continuationToken:r.continuationToken,config:this.stateParameters.config,logger:this.stateParameters.logger,mfaClient:this.stateParameters.mfaClient,cacheClient:this.stateParameters.cacheClient,challengeChannel:r.challengeChannel,challengeTargetLabel:r.challengeTargetLabel,codeLength:r.codeLength,selectedAuthMethodId:e,scopes:this.stateParameters.scopes??[]}))}catch(e){return this.stateParameters.logger.errorPii("0bt3wx",this.stateParameters.correlationId),tK.createWithError(e)}}}class tX extends tJ{constructor(){super(...arguments),this.stateType=el}getAuthMethods(){return this.stateParameters.authMethods}}class tQ extends tJ{constructor(){super(...arguments),this.stateType=ec}getCodeLength(){return this.stateParameters.codeLength}getChannel(){return this.stateParameters.challengeChannel}getSentTo(){return this.stateParameters.challengeTargetLabel}async submitChallenge(e){try{this.ensureCodeIsValid(e,this.getCodeLength()),this.stateParameters.logger.verbose("1pi02n",this.stateParameters.correlationId);let t={correlationId:this.stateParameters.correlationId,continuationToken:this.stateParameters.continuationToken??"",scopes:this.stateParameters.scopes??[],challenge:e},r=await this.stateParameters.mfaClient.submitChallenge(t);this.stateParameters.logger.verbose("0ddwwn",this.stateParameters.correlationId);let s=new eQ(r.authenticationResult.account,this.stateParameters.config,this.stateParameters.cacheClient,this.stateParameters.logger,this.stateParameters.correlationId);return new tB(new tG,s)}catch(e){return this.stateParameters.logger.errorPii("01ok2b",this.stateParameters.correlationId),tB.createWithError(e)}}}class tY extends W{constructor(){super(...arguments),this.stateType=H}}class tZ extends V{constructor(e){super(e),E("username",e.username,e.correlationId),E("continuationToken",e.continuationToken,e.correlationId)}handleSignInResult(e,t){let r=e.correlationId||this.stateParameters.correlationId;if(e.type===eO){this.stateParameters.logger.verbose("1wz8ns",r);let t=new eQ(e.authenticationResult.account,this.stateParameters.config,this.stateParameters.cacheClient,this.stateParameters.logger,r);return{state:new tY,accountInfo:t}}if(e.type===eL)return this.stateParameters.logger.verbose("0fiacy",r),{state:new tW({correlationId:r,continuationToken:e.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,jitClient:this.stateParameters.jitClient,cacheClient:this.stateParameters.cacheClient,authMethods:e.authMethods,username:this.stateParameters.username,scopes:t??[],claims:this.stateParameters.claims})};if(e.type===eF)return this.stateParameters.logger.verbose("0ql59l",r),{state:new tX({correlationId:r,continuationToken:e.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,mfaClient:this.stateParameters.mfaClient,cacheClient:this.stateParameters.cacheClient,scopes:t??[],authMethods:e.authMethods??[]})};{let t=Error(`Unexpected result type: ${e.type}`);return{state:new eT,error:t}}}}class t0 extends tZ{constructor(){super(...arguments),this.stateType=z}async submitCode(e){try{this.ensureCodeIsValid(e,this.stateParameters.codeLength);let t={clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],scopes:this.stateParameters.scopes??[],continuationToken:this.stateParameters.continuationToken??"",code:e,username:this.stateParameters.username,claims:this.stateParameters.claims};this.stateParameters.logger.verbose("0gosr6",this.stateParameters.correlationId);let r=await this.stateParameters.signInClient.submitCode(t);this.stateParameters.logger.verbose("14jm6w",this.stateParameters.correlationId);let s=this.handleSignInResult(r,this.stateParameters.scopes);if(s.error)return tj.createWithError(s.error);return new tj(s.state,s.accountInfo)}catch(e){return this.stateParameters.logger.errorPii("05uiw3",this.stateParameters.correlationId),tj.createWithError(e)}}async resendCode(){try{let e={clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],continuationToken:this.stateParameters.continuationToken??"",username:this.stateParameters.username};this.stateParameters.logger.verbose("0g09c3",this.stateParameters.correlationId);let t=await this.stateParameters.signInClient.resendCode(e);return this.stateParameters.logger.verbose("03fy3t",this.stateParameters.correlationId),new tq(new t0({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,codeLength:t.codeLength,scopes:this.stateParameters.scopes}))}catch(e){return tq.createWithError(e)}}getCodeLength(){return this.stateParameters.codeLength}getScopes(){return this.stateParameters.scopes}}class t1 extends c{static createWithError(e){let t=new t1(new eT);return t.error=new ef(t1.createErrorData(e)),t}isFailed(){return this.state.stateType===B}isCompleted(){return this.state.stateType===H}isAuthMethodRegistrationRequired(){return this.state.stateType===ed}isMfaRequired(){return this.state.stateType===el}}class t3 extends tZ{constructor(){super(...arguments),this.stateType=$}async submitPassword(e){try{this.ensurePasswordIsNotEmpty(e);let t={clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],scopes:this.stateParameters.scopes??[],continuationToken:this.stateParameters.continuationToken??"",password:e,username:this.stateParameters.username,claims:this.stateParameters.claims};this.stateParameters.logger.verbose("1dm2kj",this.stateParameters.correlationId);let r=await this.stateParameters.signInClient.submitPassword(t);this.stateParameters.logger.verbose("1e0esa",this.stateParameters.correlationId);let s=this.handleSignInResult(r,this.stateParameters.scopes);if(s.error)return t1.createWithError(s.error);return new t1(s.state,s.accountInfo)}catch(e){return this.stateParameters.logger.errorPii("0jy3yf",this.stateParameters.correlationId),t1.createWithError(e)}}getScopes(){return this.stateParameters.scopes}}class t2 extends c{constructor(e){super(e)}static createWithError(e){let t=new t2(new eS);return t.error=new eE(t2.createErrorData(e)),t}isFailed(){return this.state.stateType===Q}isCodeRequired(){return this.state.stateType===K}}class t4 extends c{constructor(e){super(e)}static createWithError(e){let t=new t4(new eS);return t.error=new eA(t4.createErrorData(e)),t}isFailed(){return this.state.stateType===Q}isPasswordRequired(){return this.state.stateType===G}isAttributesRequired(){return this.state.stateType===J}isCompleted(){return this.state.stateType===X}}class t5 extends V{constructor(e){super(e),E("username",e.username,e.correlationId),E("continuationToken",e.continuationToken,e.correlationId)}}class t6 extends c{constructor(e){super(e)}static createWithError(e){let t=new t6(new eS);return t.error=new ev(t6.createErrorData(e)),t}isFailed(){return this.state.stateType===Q}isAttributesRequired(){return this.state.stateType===J}isCompleted(){return this.state.stateType===X}}class t9 extends c{constructor(e){super(e)}static createWithError(e){let t=new t9(new eS);return t.error=new ex(t9.createErrorData(e)),t}isFailed(){return this.state.stateType===Q}isCompleted(){return this.state.stateType===X}}class t8 extends tZ{constructor(){super(...arguments),this.stateType="SignInContinuationState"}
1async signIn(e){try{e?.claims&&S("signInWithContinuationTokenInputs.claims",e.claims,this.stateParameters.correlationId);let t={clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],scopes:e?.scopes??[],continuationToken:this.stateParameters.continuationToken??"",username:this.stateParameters.username,signInScenario:this.stateParameters.signInScenario,claims:e?.claims};this.stateParameters.logger.verbose("1lhjo6",this.stateParameters.correlationId);let r=await this.stateParameters.signInClient.signInWithContinuationToken(t);this.stateParameters.logger.verbose("0su211",this.stateParameters.correlationId);let s=this.handleSignInResult(r,e?.scopes);if(s.error)return ek.createWithError(s.error);return new ek(s.state,s.accountInfo)}catch(e){return this.stateParameters.logger.errorPii("03tyr8",this.stateParameters.correlationId),ek.createWithError(e)}}}class t7 extends t8{constructor(){super(...arguments),this.stateType=X}}class re extends t5{constructor(){super(...arguments),this.stateType=J}async submitAttributes(e){if(!e||0===Object.keys(e).length)return this.stateParameters.logger.error("1jcv37",this.stateParameters.correlationId),Promise.resolve(t9.createWithError(new g("attributes",this.stateParameters.correlationId)));try{this.stateParameters.logger.verbose("0zl1ym",this.stateParameters.correlationId);let t=await this.stateParameters.signUpClient.submitAttributes({clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],continuationToken:this.stateParameters.continuationToken??"",attributes:e,username:this.stateParameters.username});if(this.stateParameters.logger.verbose("0i07tr",this.stateParameters.correlationId),t.type===te)return this.stateParameters.logger.verbose("0fw1nl",this.stateParameters.correlationId),new t9(new t7({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,signInScenario:eW}));return t9.createWithError(new l("Unknown sign-up result type.",this.stateParameters.correlationId))}catch(e){return this.stateParameters.logger.errorPii("1wde3l",this.stateParameters.correlationId),t9.createWithError(e)}}getRequiredAttributes(){return this.stateParameters.requiredAttributes}}class rt extends t5{constructor(){super(...arguments),this.stateType=G}async submitPassword(e){try{this.ensurePasswordIsNotEmpty(e),this.stateParameters.logger.verbose("1biha3",this.stateParameters.correlationId);let t=await this.stateParameters.signUpClient.submitPassword({clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],continuationToken:this.stateParameters.continuationToken??"",password:e,username:this.stateParameters.username});if(this.stateParameters.logger.verbose("06wmh7",this.stateParameters.correlationId),t.type===ts)return this.stateParameters.logger.verbose("0jd56g",this.stateParameters.correlationId),new t6(new re({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,signUpClient:this.stateParameters.signUpClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,requiredAttributes:t.requiredAttributes}));if(t.type===te)return this.stateParameters.logger.verbose("0fw1nl",this.stateParameters.correlationId),new t6(new t7({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,signInScenario:eW}));return t6.createWithError(new l("Unknown sign-up result type.",this.stateParameters.correlationId))}catch(e){return this.stateParameters.logger.errorPii("1adqe5",this.stateParameters.correlationId),t6.createWithError(e)}}}class rr extends t5{constructor(){super(...arguments),this.stateType=K}async submitCode(e){try{this.ensureCodeIsValid(e,this.stateParameters.codeLength),this.stateParameters.logger.verbose("1nedbh",this.stateParameters.correlationId);let t=await this.stateParameters.signUpClient.submitCode({clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],continuationToken:this.stateParameters.continuationToken??"",code:e,username:this.stateParameters.username});if(this.stateParameters.logger.verbose("0okwn9",this.stateParameters.correlationId),t.type===tt)return this.stateParameters.logger.verbose("098u8y",this.stateParameters.correlationId),new t4(new rt({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,signUpClient:this.stateParameters.signUpClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username}));if(t.type===ts)return this.stateParameters.logger.verbose("0jd56g",this.stateParameters.correlationId),new t4(new re({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,signUpClient:this.stateParameters.signUpClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,requiredAttributes:t.requiredAttributes}));if(t.type===te)return this.stateParameters.logger.verbose("0fw1nl",this.stateParameters.correlationId),new t4(new t7({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,signInScenario:eW}));return t4.createWithError(new l("Unknown sign-up result type.",this.stateParameters.correlationId))}catch(e){return this.stateParameters.logger.errorPii("1y64s9",this.stateParameters.correlationId),t4.createWithError(e)}}async resendCode(){try{this.stateParameters.logger.verbose("087lh9",this.stateParameters.correlationId);let e=await this.stateParameters.signUpClient.resendCode({clientId:this.stateParameters.config.auth.clientId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],username:this.stateParameters.username,correlationId:this.stateParameters.correlationId,continuationToken:this.stateParameters.continuationToken??""});return this.stateParameters.logger.verbose("0eub4o",this.stateParameters.correlationId),new t2(new rr({correlationId:e.correlationId,continuationToken:e.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,signInClient:this.stateParameters.signInClient,signUpClient:this.stateParameters.signUpClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,codeLength:e.codeLength,
1codeResendInterval:e.interval}))}catch(e){return this.stateParameters.logger.errorPii("04co5l",this.stateParameters.correlationId),t2.createWithError(e)}}getCodeLength(){return this.stateParameters.codeLength}getCodeResendInterval(){return this.stateParameters.codeResendInterval}}class rs extends c{constructor(e){super(e)}static createWithError(e){let t=new rs(new e3);return t.error=new e1(rs.createErrorData(e)),t}isFailed(){return this.state.stateType===et}isCodeRequired(){return this.state.stateType===Y}}class ri extends c{constructor(e){super(e)}static createWithError(e){let t=new ri(new e3);return t.error=new e0(ri.createErrorData(e)),t}isFailed(){return this.state.stateType===et}isPasswordRequired(){return this.state.stateType===Z}}class rn extends V{constructor(e){super(e),E("username",this.stateParameters.username,this.stateParameters.correlationId)}}class ra extends c{constructor(e){super(e)}static createWithError(e){let t=new ra(new e3);return t.error=new eZ(ra.createErrorData(e)),t}isFailed(){return this.state.stateType===et}isCompleted(){return this.state.stateType===ee}}class ro extends t8{constructor(){super(...arguments),this.stateType=ee}}class rl extends rn{constructor(){super(...arguments),this.stateType=Z}async submitNewPassword(e){try{this.ensurePasswordIsNotEmpty(e),this.stateParameters.logger.verbose("01ecin",this.stateParameters.correlationId);let t=await this.stateParameters.resetPasswordClient.submitNewPassword({clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],continuationToken:this.stateParameters.continuationToken??"",newPassword:e,username:this.stateParameters.username});return this.stateParameters.logger.verbose("1hgnje",this.stateParameters.correlationId),new ra(new ro({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,username:this.stateParameters.username,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,signInScenario:eV}))}catch(e){return this.stateParameters.logger.errorPii("0stjo2",this.stateParameters.correlationId),ra.createWithError(e)}}}class rc extends rn{constructor(){super(...arguments),this.stateType=Y}async submitCode(e){try{this.ensureCodeIsValid(e,this.stateParameters.codeLength),this.stateParameters.logger.verbose("0eno3c",this.stateParameters.correlationId);let t=await this.stateParameters.resetPasswordClient.submitCode({clientId:this.stateParameters.config.auth.clientId,correlationId:this.stateParameters.correlationId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],continuationToken:this.stateParameters.continuationToken??"",code:e,username:this.stateParameters.username});return this.stateParameters.logger.verbose("1pdlyx",this.stateParameters.correlationId),new ri(new rl({correlationId:t.correlationId,continuationToken:t.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,resetPasswordClient:this.stateParameters.resetPasswordClient,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username}))}catch(e){return this.stateParameters.logger.errorPii("1wtelk",this.stateParameters.correlationId),ri.createWithError(e)}}async resendCode(){try{this.stateParameters.logger.verbose("13fdb0",this.stateParameters.correlationId);let e=await this.stateParameters.resetPasswordClient.resendCode({clientId:this.stateParameters.config.auth.clientId,challengeType:this.stateParameters.config.customAuth.challengeTypes??[],username:this.stateParameters.username,correlationId:this.stateParameters.correlationId,continuationToken:this.stateParameters.continuationToken??""});return this.stateParameters.logger.verbose("01cakn",this.stateParameters.correlationId),new rs(new rc({correlationId:e.correlationId,continuationToken:e.continuationToken,logger:this.stateParameters.logger,config:this.stateParameters.config,resetPasswordCl
1ient:this.stateParameters.resetPasswordClient,signInClient:this.stateParameters.signInClient,cacheClient:this.stateParameters.cacheClient,jitClient:this.stateParameters.jitClient,mfaClient:this.stateParameters.mfaClient,username:this.stateParameters.username,codeLength:e.codeLength}))}catch(e){return this.stateParameters.logger.errorPii("1vyfic",this.stateParameters.correlationId),rs.createWithError(e)}}getCodeLength(){return this.stateParameters.codeLength}}var rh=e.i(673683);class ru extends rh.StandardController{constructor(e,t){if(super(e),!this.isBrowserEnvironment)throw this.logger.verbose("1f7i3q",""),new tR;this.logger=this.logger.clone(O.SKU,O.VERSION),this.customAuthConfig=e.getCustomAuthConfig(),this.authority=new e7(this.customAuthConfig.auth.authority,this.customAuthConfig,this.networkClient,this.browserStorage,this.logger,this.performanceClient,this.customAuthConfig.customAuth?.authApiProxyUrl);const r=new to(this.customAuthConfig,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,t??new tm(this.authority.getCustomAuthApiDomain(),this.customAuthConfig.auth.clientId,new tw(this.logger),this.customAuthConfig.customAuth?.capabilities?.join(" "),this.customAuthConfig.customAuth?.customAuthApiQueryParams,this.customAuthConfig.customAuth?.requestInterceptor,this.logger),this.authority);this.signInClient=r.create(e$),this.signUpClient=r.create(ta),this.resetPasswordClient=r.create(ty),this.jitClient=r.create(tf),this.mfaClient=r.create(tP),this.cacheClient=r.create(tS)}getCurrentAccount(e){let t=this.getCorrelationId(e);try{this.logger.verbose("0mb49j",t);let e=this.cacheClient.getCurrentAccount(t);if(e)return this.logger.verbose("1utnrc",t),new eI(new eQ(e,this.customAuthConfig,this.cacheClient,this.logger,t));throw new d(t)}catch(e){return this.logger.errorPii("0ar5hw",t),eI.createWithError(e)}}async signIn(e){let t=this.getCorrelationId(e);try{x("signInInputs",e,t),E("signInInputs.username",e.username,t),this.ensureUserNotSignedIn(t),e.claims&&S("signInInputs.claims",e.claims,t);let r={clientId:this.customAuthConfig.auth.clientId,correlationId:t,challengeType:this.customAuthConfig.customAuth.challengeTypes??[],username:e.username,password:e.password};this.logger.verbose("0mncjk",t);let s=await this.signInClient.start(r);if(this.logger.verbose("0b1x6k",t),s.type===eU)return this.logger.verbose("19jerh",t),new ek(new t0({correlationId:s.correlationId,continuationToken:s.continuationToken,logger:this.logger,config:this.customAuthConfig,signInClient:this.signInClient,cacheClient:this.cacheClient,jitClient:this.jitClient,mfaClient:this.mfaClient,username:e.username,codeLength:s.codeLength,scopes:e.scopes??[],claims:e.claims}));if(s.type===eN){if(this.logger.verbose("0457px",t),!e.password)return this.logger.verbose("09dgsg",t),new ek(new t3({correlationId:s.correlationId,continuationToken:s.continuationToken,logger:this.logger,config:this.customAuthConfig,signInClient:this.signInClient,cacheClient:this.cacheClient,jitClient:this.jitClient,mfaClient:this.mfaClient,username:e.username,scopes:e.scopes??[],claims:e.claims}));this.logger.verbose("1dm2kj",t);let r={clientId:this.customAuthConfig.auth.clientId,correlationId:t,challengeType:this.customAuthConfig.customAuth.challengeTypes??[],scopes:e.scopes??[],continuationToken:s.continuationToken,password:e.password,username:e.username,claims:e.claims},i=await this.signInClient.submitPassword(r);if(this.logger.verbose("09ajki",t),i.type===eO){let e=new eQ(i.authenticationResult.account,this.customAuthConfig,this.cacheClient,this.logger,t);return new ek(new tY,e)}if(i.type===eL)return this.logger.verbose("187c19",t),new ek(new tW({correlationId:t,continuationToken:i.continuationToken,logger:this.logger,config:this.customAuthConfig,jitClient:this.jitClient,cacheClient:this.cacheClient,authMethods:i.authMethods,username:e.username,scopes:e.scopes??[],claims:e.claims}));{if(i.type===eF)return this.logger.verbose("1t79dc",t),new ek(new tX({correlationId:t,continuationToken:i.continuationToken,logger:this.logger,config:this.customAuthConfig,mfaClient:this.mfaClient,cacheClient:this.cacheClient,scopes:e.scopes??[],authMethods:i.authMethods??[]}));let r=Error(`Unexpected result type: ${i.type}`);return ek.createWithError(r)}}throw this.logger.error("14awz5",t),new l("Unknow sign-in result type",t)}catch(e){return this.logger.errorPii("1te6co",t),ek.createWithError(e)}}async signUp(e){let t=this.getCorrelationId(e);
1try{x("signUpInputs",e,t),E("signUpInputs.username",e.username,t),this.ensureUserNotSignedIn(t),this.logger.verbose("1f4ezz",t);let r=await this.signUpClient.start({clientId:this.customAuthConfig.auth.clientId,correlationId:t,challengeType:this.customAuthConfig.customAuth.challengeTypes??[],username:e.username,password:e.password,attributes:e.attributes});if(this.logger.verbose("1pwgi0",t),r.type===tr)return this.logger.verbose("1hm6bi",t),new eR(new rr({correlationId:r.correlationId,continuationToken:r.continuationToken,logger:this.logger,config:this.customAuthConfig,signInClient:this.signInClient,signUpClient:this.signUpClient,cacheClient:this.cacheClient,jitClient:this.jitClient,mfaClient:this.mfaClient,username:e.username,codeLength:r.codeLength,codeResendInterval:r.interval}));if(r.type===tt)return this.logger.verbose("098u8y",t),new eR(new rt({correlationId:r.correlationId,continuationToken:r.continuationToken,logger:this.logger,config:this.customAuthConfig,signInClient:this.signInClient,signUpClient:this.signUpClient,cacheClient:this.cacheClient,jitClient:this.jitClient,mfaClient:this.mfaClient,username:e.username}));throw this.logger.error("12ceo3",t),new l("Unknown sign-up result type",t)}catch(e){return this.logger.errorPii("1ym5p8",t),eR.createWithError(e)}}async resetPassword(e){let t=this.getCorrelationId(e);try{x("resetPasswordInputs",e,t),E("resetPasswordInputs.username",e.username,t),this.ensureUserNotSignedIn(t),this.logger.verbose("1u9e3k",t);let r=await this.resetPasswordClient.start({clientId:this.customAuthConfig.auth.clientId,correlationId:t,challengeType:this.customAuthConfig.customAuth.challengeTypes??[],username:e.username});return this.logger.verbose("1axxe2",t),new e2(new rc({correlationId:r.correlationId,continuationToken:r.continuationToken,logger:this.logger,config:this.customAuthConfig,signInClient:this.signInClient,resetPasswordClient:this.resetPasswordClient,cacheClient:this.cacheClient,jitClient:this.jitClient,mfaClient:this.mfaClient,username:e.username,codeLength:r.codeLength}))}catch(e){return this.logger.errorPii("1s0wwh",t),e2.createWithError(e)}}getCorrelationId(e){return e?.correlationId||this.browserCrypto.createNewGuid()}ensureUserNotSignedIn(e){let t=this.getCurrentAccount({correlationId:e});if(t&&t.data)throw this.logger.error("1a17tw",e),new tb(e)}}var rd=e.i(887219);class rg extends rd.BaseOperatingContext{constructor(e){super(e),this.customAuthOptions=e.customAuth}getModuleName(){return rg.MODULE_NAME}getId(){return rg.ID}getCustomAuthConfig(){return{...this.getConfig(),customAuth:this.customAuthOptions}}async initialize(){return this.available="undefined"!=typeof window,this.available}}rg.MODULE_NAME="",rg.ID="CustomAuthOperatingContext";class rm extends a{constructor(e,t,r){super(e,t,r),Object.setPrototypeOf(this,rm.prototype)}}var rp=e.i(134194);class rw extends rp.PublicClientApplication{static async create(e){rw.validateConfig(e);let t=new ru(new rg(e));return await t.initialize(),new rw(e,t)}constructor(e,t){super(e,t),this.customAuthController=t}getCurrentAccount(e){return this.customAuthController.getCurrentAccount(e)}signIn(e){return this.customAuthController.signIn(e)}signUp(e){return this.customAuthController.signUp(e)}resetPassword(e){return this.customAuthController.resetPassword(e)}static validateConfig(e){if(!e)throw new rm("missing_configuration","The configuration is missing.");if(!e.auth?.authority)throw new rm("invalid_authority",`The authority URL '${e.auth?.authority}' is not set.`);let t=e.customAuth.challengeTypes;t&&t.length>0&&t.forEach(e=>{let t=e.toLowerCase();if(t!==D.PASSWORD&&t!==D.OOB&&t!==D.REDIRECT)throw new rm("invalid_challenge_type",`Challenge type ${e} in the configuration are not valid. Supported challenge types are ${Object.values(D)}`)})}}let ry=["openid","profile","offline_access","api://alecta-fastigheter-api/tenant.read"];class rI extends Error{code;originalError;constructor(e,t,r){super(t??e),this.name="PasswordResetError",this.code=e,this.originalError=r}}let rC=null;async function rf(){return rC??=rw.create({customAuth:{challengeTypes:["password","oob","redirect"],authApiProxyUrl:`${window.location.origin}/api/native-auth`},auth:{clientId:"51c8b7e3-23f6-40a6-b96a-3c3a245c77a1",authority:"https://afwebcustomers.ciamlogin.com/111076d4-2e30-46c1-ad70-0816815824ef",redirectUri:"/",postLogoutRedirectUri:"/"},cache:{cacheLocation:"sessionStorage"}})}function rP(e){return e?.errorData?.errorDescription??e?.errorDescription??e?.message}function rb(e){return e?.errorData?.error??e?.error}function rT(e){return e?.errorData?.subError??e?.subError}function rk(e){let t=rb(e),r=rP(e);return e?.isTokenExpired?.()===!0||"expired_token"===t||r?.includes("AADSTS552001")||r?.includes("continuation_token has expired")}async function r_(e){try{let r=await rf(),s=await r.resetPassword({username:e});if(s.isCodeRequired())return s.state;if(s.isFailed()){var t;let e;throw t=s.error,e=rP(t),rk(t)?new rI("session_expired",e,t):t?.isUserNotFound?.()?new rI("user_not_found",e,t):t?.isInvalidUsername?.()?new rI("invalid_username",e,t):t?.isUnsupportedChallengeType?.()?new rI("unsupported_challenge_type",e,t):e?.includes("AADSTS550022")||e?.includes("Confidential Client")?new rI("missing_configuration",e,t):new rI("unknown",e,t)}throw new rI("unknown","Unexpected reset-password start state")}catch(e){if(e instanceof rI)throw e;throw new rI("unknown",e.message,e)}}async function rv(e,t){let r=await e.submitCode(t);if(r.isPasswordRequired())return r.state;if(r.isFailed()){var s;throw rk(s=r.error)?new rI("session_expired",rP(s),s):s?.isInvalidCode?.()?new rI("invalid_code",rP(s),s):new rI("unknown",rP(s),s)}throw new rI("unknown","Unexpected reset-password code state")}async function rA(e,t,r={}){let s=await e.submitNewPassword(t);if(s.isCompleted()){let e;if(!r.autoSignIn)return{signedIn:!1};console.info("[password-reset] Password reset completed; attempting automatic sign-in");try{e=await s.state.signIn({scopes:ry})}catch(s){let e=rb(s),t=rT(s),r=rP(s);return console.warn("[password-reset] Automatic sign-in threw after password reset",{errorCode:e,subErrorCode:t,errorDescription:r}),{signedIn:!1,errorCode:t??e,errorDescription:r}}if(e.isFailed?.()){let t=rb(e.error),r=rT(e.error),s=rP(e.error);return console.warn("[password-reset] Automatic sign-in failed after password reset",{errorCode:t,subErrorCode:r,errorDescription:s}),{signedIn:!1,errorCode:r??t,errorDescription:s}}if(!e.isCompleted?.()){let t=e.state?.constructor?.name;return console.warn("[password-reset] Automatic sign-in requires additional interaction",{stateName:t}),{signedIn:!1,errorCode:t}}return console.info("[password-reset] Automatic sign-in completed"),{signedIn:!0}}if(s.isFailed()){var i;throw rk(i=s.error)?new rI("session_expired",rP(i),i):i?.isInvalidPassword?.()?new rI("invalid_password",rP(i),i):i?.isPasswordResetFailed?.()?new rI("password_reset_failed",rP(i),i):new rI("unknown",rP(i),i)}throw new rI("unknown","Unexpected reset-password password state")}var rx=e.i(298833),rE=e.i(593283);let rS="mb-4 text-center type-body-2 text-brand-01-primary";function rR({variant:e,email:n,autoSignIn:a=!1,onResetComplete:o,onAutoSignInSuccess:l}){let{combine:c,translate:h}=(0,s.useTranslations)(),[u,d]=(0,i.useState)(n?{kind:"starting",email:n}:{kind:"email_input"}),[g,m]=(0,i.useState)(""),[p,w]=(0,i.useState)(null),[y,I]=(0,i.useState)(""),[C,f]=(0,i.useState)(""),[P,b]=(0,i.useState)(""),T=(0,i.useRef)(!1),k="activation"===e,_=(0,i.useCallback)(e=>
1{switch(e){case"user_not_found":case"invalid_username":return k?h("Activation token invalid"):h("Password reset generic start error");case"unsupported_challenge_type":case"missing_configuration":return h("Activation configuration error");case"invalid_code":return h("Activation OTP invalid");case"invalid_password":return h("Activation password too weak");case"password_reset_failed":return h("Activation password reset failed");case"session_expired":return h("Activation session expired");default:return h("Activation generic error")}},[k,h]),v=(0,i.useCallback)(async t=>{let r=t.trim().toLowerCase();if(r){w(null),I(""),f(""),b(""),d({kind:"starting",email:r});try{let e=await r_(r);d({kind:"awaiting_otp",email:r,resetState:e,codeLength:e.getCodeLength()})}catch(t){if(console.error("Password reset start failed:",t),"forgot"===e&&t instanceof rI&&("user_not_found"===t.code||"invalid_username"===t.code))return void d({kind:"awaiting_otp",email:r,codeLength:6});if(t instanceof rI)return void d({kind:"terminal_error",message:_(t.code)});d({kind:"terminal_error",message:h("Activation generic error")})}}},[h,_,e]);(0,i.useEffect)(()=>{n&&!T.current&&(T.current=!0,v(n))},[v,n]);let A=async e=>{if(e.preventDefault(),"awaiting_otp"===u.kind){if(w(null),!u.resetState)return void w(h("Activation OTP invalid"));try{let e=await rv(u.resetState,y.trim());d({kind:"awaiting_password",email:u.email,resetState:e}),I("")}catch(e){if(console.error("OTP submit failed:",e),e instanceof rI){if("session_expired"===e.code)return void d({kind:"terminal_error",message:_(e.code),restartEmail:u.email});w(_(e.code))}else w(h("Activation generic error"))}}},x=async e=>{let t;if(e.preventDefault(),"awaiting_password"!==u.kind)return;if(w(null),C!==P)return void w(h("Passwords do not match"));let{email:r,resetState:s}=u;d({kind:"applying",email:r,resetState:s});try{t=await rA(s,C,{autoSignIn:a})}catch(e){if(console.error("Password submit failed:",e),e instanceof rI){if("session_expired"===e.code)return void d({kind:"terminal_error",message:_(e.code),restartEmail:r});d({kind:"awaiting_password",email:r,resetState:s,error:_(e.code)})}else d({kind:"awaiting_password",email:r,resetState:s,error:h("Activation generic error")});return}f(""),b("");try{await o?.()}catch(e){console.error("Password reset completion handler failed:",e),d({kind:"terminal_error",message:h("Activation generic error")});return}if(t.signedIn){d({kind:"success",email:r}),l?.();return}a&&!t.signedIn&&console.warn("[password-reset] Password was reset, but automatic sign-in did not complete",{errorCode:t.errorCode,errorDescription:t.errorDescription}),d({kind:"success",email:r,autoSignInFailed:a&&!t.signedIn})};return(0,t.jsxs)("section",{className:"flex flex-col items-center justify-center bg-brand-03-primary pt-11 text-brand-01-contrast md:pt-16 md:pb-24 xl:pt-24",children:[(0,t.jsx)(r.Heading,{className:"pb-6 type-headline-1-xs text-brand-01-contrast md:pb-7 md:type-headline-1-xl",level:1,children:k?h("Activate account title"):h("Forgot password title")}),(0,t.jsx)("p",{className:"px-12 pb-11 text-center type-introduction-xs text-brand-07-primary md:w-1/3 md:px-0 md:type-introduction-xl xl:w-1/5 xl:pb-20",children:k?h("Activate account description"):h("Forgot password description")}),(0,t.jsxs)("div",{className:"flex w-full max-w-96 flex-col items-center bg-brand-07-tertiary px-7 py-9 md:py-11",children:["email_input"===u.kind&&(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),v(g)},className:"flex w-full flex-col items-center",children:[(0,t.jsx)(r.Heading,{className:"pb-4 text-center type-headline-5-xs text-brand-03-primary md:type-headline-5-xl",level:2,children:h("Forgot password form title")}),(0,t.jsx)("p",{className:"pb-6 text-center type-body-2 text-brand-03-primary",children:h("Forgot password form description")}),(0,t.jsx)("label",{htmlFor:"password-reset-email",className:"sr-only",children:h("Email")}),(0,t.jsx)("input",{id:"password-reset-email",name:"email",type:"email",autoComplete:"email",required:!0,value:g,onChange:e=>m(e.target.value),placeholder:h("Email"),className:"bg-white mb-6 w-full border border-brand-03-primary/30 px-4 py-3 type-body-1 text-brand-03-primary"}),(0,t.jsx)("button",{type:"submit",className:"mb-4 btn-large-dark w-full bg-brand-01-primary text-brand-01-contrast",children:h("Password reset send code")})]}),"starting"===u.kind&&(0,t.jsx)("p",{className:"text-center type-body-2 text-brand-03-primary",children:k?h("Activation sending code"):h("Password reset sending code")}),"awaiting_otp"===u.kind&&(0,t.jsxs)("form",{onSubmit:A,className:"flex w-full flex-col items-center",children:[(0,t.jsx)(r.Heading,{className:"pb-4 text-center type-headline-5-xs text-brand-03-primary md:type-headline-5-xl",level:2,children:h("Activation enter code title")}),(0,t.jsx)("p",{className:"pb-6 text-center type-body-2 text-brand-03-primary",children:k?c(h("Activation enter code description"),{email:u.email}):h("Password reset enter code description")}),(0,t.jsx)("label",{htmlFor:"password-reset-otp",className:"sr-only",children:h("Verification code")}),(0,t.jsx)("input",{id:"password-reset-otp",name:"otp",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,minLength:u.codeLength??6,maxLength:u.codeLength??8,value:y,onChange:e=>I(e.target.value),className:"bg-white mb-6 w-full border border-brand-03-primary/30 px-4 py-3 text-center type-body-1 tracking-widest text-brand-03-primary"}),p&&(0,t.jsx)("p",{role:"alert",className:rS,children:p}),(0,t.jsx)("button",{type:"submit",className:"mb-4 btn-large-dark w-full bg-brand-01-primary text-brand-01-contrast",children:h("Continue")})]}),("awaiting_password"===u.kind||"applying"===u.kind)&&(0,t.jsxs)("form",{onSubmit:x,className:"flex w-full flex-col items-center",children:[(0,t.jsx)(r.Heading,{className:"pb-4 text-center type-headline-5-xs text-brand-03-primary md:type-headline-5-xl",level:2,children:h("Activation choose password title")}),(0,t.jsx)("p",{className:"pb-6 text-center type-body-2 text-brand-03-primary",children:h("Activation choose password description")}),(0,t.jsx)("label",{htmlFor:"password-reset-password",className:"sr-only",children:h("New password")}),(0,t.jsx)("input",{id:"password-reset-password",name:"password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:C,onChange:e=>f(e.target.value),placeholder:h("New password"),className:"bg-white mb-4 w-full border border-brand-03-primary/30 px-4 py-3 type-body-1 text-brand-03-primary"}),(0,t.jsx)("label",{htmlFor:"password-reset-password-confirm",className:"sr-only",children:h("Confirm password")}),(0,t.jsx)("input",{id:"password-reset-password-confirm",name:"passwordConfirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:P,onChange:e=>b(e.target.value),placeholder:h("Confirm password"),className:"bg-white mb-6 w-full border border-brand-03-primary/30 px-4 py-3 type-body-1 text-brand-03-primary"}),(p||("awaiting_password"===u.kind?u.error:null))&&(0,t.jsx)("p",{role:"alert",className:rS,children:p||("awaiting_password"===u.kind?u.error:null)}),(0,t.jsx)("button",{type:"submit",disabled:"applying"===u.kind,className:"mb-4 btn-large-dark w-full bg-brand-01-primary text-brand-01-contrast disabled:opacity-50",children:"applying"===u.kind?h("Activation applying"):h("Activation set password")})]}),"success"===u.kind&&(0,t.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,t.jsx)(r.Heading,{className:"pb-4 text-center type-headline-5-xs text-brand-03-primary md:type-headline-5-xl",level:2,children:k?h("Activation success title"):h("Password reset success title")}),(0,t.jsx)("p",{className:"pb-6 text-center type-body-2 text-brand-03-primary",children:k?u.autoSignInFailed?h("Activation auto login failed"):h("Activation success redirecting"):h("Password reset success description")}),(0,t.jsx)(rE.Link,{href:"/login",className:"mb-4 btn-large-dark w-full bg-brand-01-primary text-center text-brand-01-contrast",children:h("Go to login")})]}),"terminal_error"===u.kind&&(0,t.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,t.jsx)(r.Heading,{className:"pb-4 text-center type-headline-5-xs text-brand-03-primary md:type-headline-5-xl",level:2,children:h("Activation error title")}),(0,t.jsx)("p",{role:"alert",className:rS,children:u.message}),u.restartEmail&&(0,t.jsx)("button",{type:"button",onClick:()=>void v(u.restartEmail),className:"mb-4 btn-large-dark w-full bg-brand-01-primary text-brand-01-contrast",children:h("Activation restart flow")}),(0,t.jsx)(rE.Link,{href:"/login",className:"text-center type-body-2 text-brand-01-secondary underline",children:h("Go to login")})]})]}),(0,t.jsx)(rx.AuthCustomerServiceHelp,{})]})}e.s(["PasswordResetFlow",()=>rR],153916)},142154,e=>{"use strict";var t=e.i(793200);e.i(840596);var r=e.i(659337);e.i(806331);var s=e.i(450261),i=e.i(320417),n=e.i(698319);e.i(203553);let a="https://prod-api.afabapi.se";
1class o extends Error{reason;constructor(e,t){super(t??e),this.name="ActivationTokenError",this.reason=e}}async function l(e){let t;if(!e)throw new o("invalid","Missing token");try{t=await fetch(`${a}/api/activation/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})})}catch(e){throw new o("network",e.message)}if(400===t.status)throw new o("invalid","Token invalid, expired, or already completed");if(!t.ok)throw new o("network",`HTTP ${t.status}`);return await t.json()}async function c(e){let t;if(!e)throw new o("invalid","Missing token");try{t=await fetch(`${a}/api/activation/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})})}catch(e){throw new o("network",e.message)}if(400===t.status)throw new o("invalid","Token invalid, expired, or already completed");if(!t.ok)throw new o("network",`HTTP ${t.status}`)}var h=e.i(593283),u=e.i(298833),d=e.i(153916);function g(){let{translate:e}=(0,s.useTranslations)(),a=(0,i.useSearchParams)(),g=(0,i.useRouter)(),[m,p]=(0,n.useState)({kind:"validating"}),w=(0,n.useRef)(!1);return((0,n.useEffect)(()=>{if(w.current)return;w.current=!0;let t=a.get("token");t?(g.replace("/account/activate"),l(t).then(({email:e})=>{p({kind:"ready",email:e,token:t})}).catch(t=>{console.error("Activation token validation failed:",t),p({kind:"terminal_error",message:t instanceof o?e("Activation token invalid"):e("Activation generic error")})})):p({kind:"terminal_error",message:e("Activation link missing token")})},[g,a,e]),"ready"===m.kind)?(0,t.jsx)(d.PasswordResetFlow,{variant:"activation",email:m.email,autoSignIn:!0,onResetComplete:()=>c(m.token),onAutoSignInSuccess:()=>window.location.assign("/account")}):(0,t.jsxs)("section",{className:"flex flex-col items-center justify-center bg-brand-03-primary pt-11 text-brand-01-contrast md:pt-16 md:pb-24 xl:pt-24",children:[(0,t.jsx)(r.Heading,{className:"pb-6 type-headline-1-xs text-brand-01-contrast md:pb-7 md:type-headline-1-xl",level:1,children:e("Activate account title")}),(0,t.jsx)("p",{className:"px-12 pb-11 text-center type-introduction-xs text-brand-07-primary md:w-1/3 md:px-0 md:type-introduction-xl xl:w-1/5 xl:pb-20",children:e("Activate account description")}),(0,t.jsxs)("div",{className:"flex w-full max-w-96 flex-col items-center bg-brand-07-tertiary px-7 py-9 md:py-11",children:["validating"===m.kind&&(0,t.jsx)("p",{className:"text-center type-body-2 text-brand-03-primary",children:e("Activation validating")}),"terminal_error"===m.kind&&(0,t.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,t.jsx)(r.Heading,{className:"pb-4 text-center type-headline-5-xs text-brand-03-primary md:type-headline-5-xl",level:2,children:e("Activation error title")}),(0,t.jsx)("p",{role:"alert",className:"mb-6 text-center type-body-2 text-brand-01-primary",children:m.message}),(0,t.jsx)(h.Link,{href:"/login",className:"text-center type-body-2 text-brand-01-secondary underline",children:e("Go to login")})]})]}),(0,t.jsx)(u.AuthCustomerServiceHelp,{})]})}e.s(["Activate",()=>g],142154)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.