"use strict";(function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(n=n||self,t(n.msal={}))})(this,function(n){function ii(n,t){function i(){this.constructor=n}fr(n,t);n.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}function e(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})}function o(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e}function gu(n,t){var i=typeof Symbol=="function"&&n[Symbol.iterator],r,u,f,e;if(!i)return n;r=i.call(n);f=[];try{while((t===void 0||t-->0)&&!(u=r.next()).done)f.push(u.value)}catch(o){e={error:o}}finally{try{u&&!u.done&&(i=r["return"])&&i.call(r)}finally{if(e)throw e.error;}}return f}function uu(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(gu(arguments[t]));return n}function nt(n,t){function i(){this.constructor=n}er(n,t);n.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}function h(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})}function c(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e}function bi(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u}function ou(n,t){if(i.isEmpty(n))throw f.createClientInfoEmptyError();try{var r=t.base64Decode(n);return JSON.parse(r)}catch(u){throw f.createClientInfoDecodingError(u);}}function hf(n){var t=n.authOptions,i=n.systemOptions,r=n.loggerOptions,u=n.storageInterface,f=n.networkInterface,e=n.cryptoInterface,o=n.clientCredentials,s=n.libraryInfo,h=n.serverTelemetryManager,c=n.persistencePlugin,l=n.serializableCache;return{authOptions:cf(t),systemOptions:et(et({},su),i),loggerOptions:et(et({},ff),r),storageInterface:u||new uf(t.clientId,tr),networkInterface:f||ef,cryptoInterface:e||tr,clientCredentials:o||sf,libraryInfo:et(et({},of),s),serverTelemetryManager:h||null,persistencePlugin:c||null,serializableCache:l||null}}function cf(n){return et({clientCapabilities:[]},n)}function bf(n){return n.hasOwnProperty("authorization_endpoint")&&n.hasOwnProperty("token_endpoint")&&n.hasOwnProperty("end_session_endpoint")&&n.hasOwnProperty("issuer")}function kf(n){return n.hasOwnProperty("tenant_discovery_endpoint")&&n.hasOwnProperty("metadata")}function pe(t,i){var f=t.auth,e=t.cache,r=t.system,o={clientId:"",authority:""+u.DEFAULT_AUTHORITY,knownAuthorities:[],cloudDiscoveryMetadata:"",authorityMetadata:"",redirectUri:"",postLogoutRedirectUri:"",navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:n.ProtocolMode.AAD},s={cacheLocation:n.BrowserCacheLocation.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1},h={loggerCallback:function(){},logLevel:n.LogLevel.Info,piiLoggingEnabled:!1},c=w(w({},su),{loggerOptions:h,networkClient:i?d.getBrowserNetworkClient():gf,navigationClient:new bu,loadFrameTimeout:0,windowHashTimeout:r&&r.loadFrameTimeout||ve,iframeHashTimeout:r&&r.loadFrameTimeout||iu,navigateFrameWait:i&&d.detectIEOrEdge()?500:0,redirectNavigationTimeout:ye,asyncPopups:!1,allowRedirectInIframe:!1});return{auth:w(w({},o),f),cache:w(w({},s),e),system:w(w({},c),r)}}var fr=function(n,t){return fr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},fr(n,t)},w=function(){return w=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},w.apply(this,arguments)},er=function(n,t){return er=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},er(n,t)},et=function(){return et=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},et.apply(this,arguments)},u={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",ADFS:"adfs",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",FORWARD_SLASH:"/"},or=[u.OPENID_SCOPE,u.PROFILE_SCOPE,u.OFFLINE_ACCESS_SCOPE],fu=bi(or,[u.EMAIL_SCOPE]),bt,ot,ki,a,ei,lt,ri,nf,sr,di,gt,kt,at,l,ui,dt,tt,pi,cr,nr,ni,rr,wt,p,gr,li;(function(n){n.CONTENT_TYPE="Content-Type";n.X_CLIENT_CURR_TELEM="x-client-current-telemetry";n.X_CLIENT_LAST_TELEM="x-client-last-telemetry";n.RETRY_AFTER="Retry-After";n.X_MS_LIB_CAPABILITY="x-ms-lib-capability";n.X_MS_LIB_CAPABILITY_VALUE="retry-after, h429"})(bt||(bt={})),function(n){n.ID_TOKEN="idtoken";n.CLIENT_INFO="client.info";n.ADAL_ID_TOKEN="adal.idtoken";n.ERROR="error";n.ERROR_DESC="error.description"}(ot||(ot={})),function(n){n.COMMON="common";n.ORGANIZATIONS="organizations";n.CONSUMERS="consumers"}(ki||(ki={})),function(n){n.CLIENT_ID="client_id";n.REDIRECT_URI="redirect_uri";n.RESPONSE_TYPE="response_type";n.RESPONSE_MODE="response_mode";n.GRANT_TYPE="grant_type";n.CLAIMS="claims";n.SCOPE="scope";n.ERROR="error";n.ERROR_DESCRIPTION="error_description";n.ACCESS_TOKEN="access_token";n.ID_TOKEN="id_token";n.REFRESH_TOKEN="refresh_token";n.EXPIRES_IN="expires_in";n.STATE="state";n.NONCE="nonce";n.PROMPT="prompt";n.SESSION_STATE="session_state";n.CLIENT_INFO="client_info";n.CODE="code";n.CODE_CHALLENGE="code_challenge";n.CODE_CHALLENGE_METHOD="code_challenge_method";n.CODE_VERIFIER="code_verifier";n.CLIENT_REQUEST_ID="client-request-id";n.X_CLIENT_SKU="x-client-SKU";n.X_CLIENT_VER="x-client-VER";n.X_CLIENT_OS="x-client-OS";n.X_CLIENT_CPU="x-client-CPU";n.POST_LOGOUT_URI="post_logout_redirect_uri";n.ID_TOKEN_HINT="id_token_hint";n.DEVICE_CODE="device_code";n.CLIENT_SECRET="client_secret";n.CLIENT_ASSERTION="client_assertion";n.CLIENT_ASSERTION_TYPE="client_assertion_type";n.TOKEN_TYPE="token_type";n.REQ_CNF="req_cnf";n.OBO_ASSERTION="assertion";n.REQUESTED_TOKEN_USE="requested_token_use";n.ON_BEHALF_OF="on_behalf_of";n.FOCI="foci"}(a||(a={})),function(n){n.ACCESS_TOKEN="access_token";n.XMS_CC="xms_cc"}(ei||(ei={}));lt={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},function(n){n.ACCOUNT="account";n.SID="sid";n.LOGIN_HINT="login_hint";n.ID_TOKEN="id_token";n.DOMAIN_HINT="domain_hint";n.ORGANIZATIONS="organizations";n.CONSUMERS="consumers";n.ACCOUNT_ID="accountIdentifier";n.HOMEACCOUNT_ID="homeAccountIdentifier"}(ri||(ri={}));nf=[ri.SID,ri.LOGIN_HINT];sr={PLAIN:"plain",S256:"S256"},function(n){n.QUERY="query";n.FRAGMENT="fragment";n.FORM_POST="form_post"}(di||(di={})),function(n){n.IMPLICIT_GRANT="implicit";n.AUTHORIZATION_CODE_GRANT="authorization_code";n.CLIENT_CREDENTIALS_GRANT="client_credentials";n.RESOURCE_OWNER_PASSWORD_GRANT="password";n.REFRESH_TOKEN_GRANT="refresh_token";n.DEVICE_CODE_GRANT="device_code";n.JWT_BEARER="urn:ietf:params:oauth:grant-type:jwt-bearer"}(gt||(gt={})),function(n){n.MSSTS_ACCOUNT_TYPE="MSSTS";n.ADFS_ACCOUNT_TYPE="ADFS";n.MSAV1_ACCOUNT_TYPE="MSA";n.GENERIC_ACCOUNT_TYPE="Generic"}(kt||(kt={})),function(n){n.CACHE_KEY_SEPARATOR="-";n.CLIENT_INFO_SEPARATOR="."}(at||(at={})),function(n){n.ID_TOKEN="IdToken";n.ACCESS_TOKEN="AccessToken";n.ACCESS_TOKEN_WITH_AUTH_SCHEME="AccessToken_With_AuthScheme";n.REFRESH_TOKEN="RefreshToken"}(l||(l={})),function(n){n.ACCOUNT="Account";n.CREDENTIAL="Credential";n.ID_TOKEN="IdToken";n.ACCESS_TOKEN="AccessToken";n.REFRESH_TOKEN="RefreshToken";n.APP_METADATA="AppMetadata";n.TEMPORARY="TempCache";n.TELEMETRY="Telemetry";n.UNDEFINED="Undefined";n.THROTTLING="Throttling"}(ui||(ui={})),function(n){n[n.ADFS=1001]="ADFS";n[n.MSA=1002]="MSA";n[n.MSSTS=1003]="MSSTS";n[n.GENERIC=1004]="GENERIC";n[n.ACCESS_TOKEN=2001]="ACCESS_TOKEN";n[n.REFRESH_TOKEN=2002]="REFRESH_TOKEN";n[n.ID_TOKEN=2003]="ID_TOKEN";n[n.APP_METADATA=3001]="APP_METADATA";n[n.UNDEFINED=9999]="UNDEFINED"}(dt||(dt={}));var hr="appmetadata",tf="client_info",gi="1",yi={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:86400},vt;(function(n){n.CONFIG="config";n.CACHE="cache";n.NETWORK="network"})(vt||(vt={}));tt={SCHEMA_VERSION:2,MAX_HEADER_BYTES:4e3,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},function(n){n.POP="pop";n.BEARER="Bearer"}(n.AuthenticationScheme||(n.AuthenticationScheme={}));pi={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling"};cr={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},function(n){n.username="username";n.password="password"}(nr||(nr={}));var lr={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."}},v=function(n){function t(i,r,f){var e=this,o=r?i+": "+r:i;return e=n.call(this,o)||this,Object.setPrototypeOf(e,t.prototype),e.errorCode=i||u.EMPTY_STRING,e.errorMessage=r||"",e.subError=f||"",e.name="AuthError",e}return nt(t,n),t.createUnexpectedError=function(n){return new t(lr.unexpectedError.code,lr.unexpectedError.desc+": "+n)},t}(Error),tr={createNewGuid:function(){throw v.createUnexpectedError("Crypto interface - createNewGuid() has not been implemented");},base64Decode:function(){throw v.createUnexpectedError("Crypto interface - base64Decode() has not been implemented");},base64Encode:function(){throw v.createUnexpectedError("Crypto interface - base64Encode() has not been implemented");},generatePkceCodes:function(){return h(this,void 0,void 0,function(){var n;return c(this,function(){n="Crypto interface - generatePkceCodes() has not been implemented";throw v.createUnexpectedError(n);})})},getPublicKeyThumbprint:function(){return h(this,void 0,void 0,function(){var n;return c(this,function(){n="Crypto interface - getPublicKeyThumbprint() has not been implemented";throw v.createUnexpectedError(n);})})},signJwt:function(){return h(this,void 0,void 0,function(){var n;return c(this,function(){n="Crypto interface - signJwt() has not been implemented";throw v.createUnexpectedError(n);})})}},t={clientInfoDecodingError:{code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},clientInfoEmptyError:{code:"client_info_empty_error",desc:"The client info was empty. Please review the trace to determine the root cause."},tokenParsingError:{code:"token_parsing_error",desc:"Token cannot be parsed. Please review stack trace to determine root cause."},nullOrEmptyToken:{code:"null_or_empty_token",desc:"The token is null or empty. Please review the trace to determine the root cause."},endpointResolutionError:{code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},networkError:{code:"network_error",desc:"Network request failed. Please check network trace to determine root cause."},unableToGetOpenidConfigError:{code:"openid_config_error",desc:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints."},hashNotDeserialized:{code:"hash_not_deserialized",desc:"The hash parameters could not be deserialized. Please review the trace to determine the root cause."},blankGuidGenerated:{code:"blank_guid_generated",desc:"The guid generated was blank. Please review the trace to determine the root cause."},invalidStateError:{code:"invalid_state",desc:"State was not the expected format. Please check the logs to determine whether the request was sent using ProtocolUtils.setRequestState()."},stateMismatchError:{code:"state_mismatch",desc:"State mismatch error. Please check your network. Continued requests may cause cache overflow."},stateNotFoundError:{code:"state_not_found",desc:"State not found"},nonceMismatchError:{code:"nonce_mismatch",desc:"Nonce mismatch error. This may be caused by a race condition in concurrent requests."},nonceNotFoundError:{code:"nonce_not_found",desc:"nonce not found"},noTokensFoundError:{code:"no_tokens_found",desc:"No tokens were found for the given scopes, and no authorization code was passed to acquireToken. You must retrieve an authorization code before making a call to acquireToken()."},multipleMatchingTokens:{code:"multiple_matching_tokens",desc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account."},multipleMatchingAccounts:{code:"multiple_matching_accounts",desc:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account"},multipleMatchingAppMetadata:{code:"multiple_matching_appMetadata",desc:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata"},tokenRequestCannotBeMade:{code:"request_cannot_be_made",desc:"Token request cannot be made without authorization code or refresh token."},appendEmptyScopeError:{code:"cannot_append_empty_scope",desc:"Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info."},removeEmptyScopeError:{code:"cannot_remove_empty_scope",desc:"Cannot remove null or empty scope from ScopeSet. Please check the stack trace for more info."},appendScopeSetError:{code:"cannot_append_scopeset",desc:"Cannot append ScopeSet due to error."},emptyInputScopeSetError:{code:"empty_input_scopeset",desc:"Empty input ScopeSet cannot be processed."},DeviceCodePollingCancelled:{code:"device_code_polling_cancelled",desc:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true."},DeviceCodeExpired:{code:"device_code_expired",desc:"Device code is expired."},NoAccountInSilentRequest:{code:"no_account_in_silent_request",desc:"Please pass an account object, silent flow is not supported without account information"},invalidCacheRecord:{code:"invalid_cache_record",desc:"Cache record object was null or undefined."},invalidCacheEnvironment:{code:"invalid_cache_environment",desc:"Invalid environment when attempting to create cache entry"},noAccountFound:{code:"no_account_found",desc:"No account found in cache for given key."},CachePluginError:{code:"no cache plugin set on CacheManager",desc:"ICachePlugin needs to be set before using readFromStorage or writeFromStorage"},noCryptoObj:{code:"no_crypto_object",desc:"No crypto object detected. This is required for the following operation: "},invalidCacheType:{code:"invalid_cache_type",desc:"Invalid cache type"},unexpectedAccountType:{code:"unexpected_account_type",desc:"Unexpected account type."},unexpectedCredentialType:{code:"unexpected_credential_type",desc:"Unexpected credential type."},invalidAssertion:{code:"invalid_assertion",desc:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515"},invalidClientCredential:{code:"invalid_client_credential",desc:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential"},tokenRefreshRequired:{code:"token_refresh_required",desc:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired."},userTimeoutReached:{code:"user_timeout_reached",desc:"User defined timeout for device code polling reached"},tokenClaimsRequired:{code:"token_claims_cnf_required_for_signedjwt",desc:"Cannot generate a POP jwt if the token_claims are not populated"},noAuthorizationCodeFromServer:{code:"authorization_code_missing_from_server_response",desc:"Srver response does not contain an authorization code to proceed"}},f=function(n){function i(t,r){var u=n.call(this,t,r)||this;return u.name="ClientAuthError",Object.setPrototypeOf(u,i.prototype),u}return nt(i,n),i.createClientInfoDecodingError=function(n){return new i(t.clientInfoDecodingError.code,t.clientInfoDecodingError.desc+" Failed with error: "+n)},i.createClientInfoEmptyError=function(){return new i(t.clientInfoEmptyError.code,""+t.clientInfoEmptyError.desc)},i.createTokenParsingError=function(n){return new i(t.tokenParsingError.code,t.tokenParsingError.desc+" Failed with error: "+n)},i.createTokenNullOrEmptyError=function(n){return new i(t.nullOrEmptyToken.code,t.nullOrEmptyToken.desc+" Raw Token Value: "+n)},i.createEndpointDiscoveryIncompleteError=function(n){return new i(t.endpointResolutionError.code,t.endpointResolutionError.desc+" Detail: "+n)},i.createNetworkError=function(n,r){return new i(t.networkError.code,t.networkError.desc+" | Fetch client threw: "+r+" | Attempted to reach: "+n.split("?")[0])},i.createUnableToGetOpenidConfigError=function(n){return new i(t.unableToGetOpenidConfigError.code,t.unableToGetOpenidConfigError.desc+" Attempted to retrieve endpoints from: "+n)},i.createHashNotDeserializedError=function(n){return new i(t.hashNotDeserialized.code,t.hashNotDeserialized.desc+" Given Object: "+n)},i.createInvalidStateError=function(n,r){return new i(t.invalidStateError.code,t.invalidStateError.desc+" Invalid State: "+n+", Root Err: "+r)},i.createStateMismatchError=function(){return new i(t.stateMismatchError.code,t.stateMismatchError.desc)},i.createStateNotFoundError=function(n){return new i(t.stateNotFoundError.code,t.stateNotFoundError.desc+":  "+n)},i.createNonceMismatchError=function(){return new i(t.nonceMismatchError.code,t.nonceMismatchError.desc)},i.createNonceNotFoundError=function(n){return new i(t.nonceNotFoundError.code,t.nonceNotFoundError.desc+":  "+n)},i.createNoTokensFoundError=function(){return new i(t.noTokensFoundError.code,t.noTokensFoundError.desc)},i.createMultipleMatchingTokensInCacheError=function(){return new i(t.multipleMatchingTokens.code,t.multipleMatchingTokens.desc+".")},i.createMultipleMatchingAccountsInCacheError=function(){return new i(t.multipleMatchingAccounts.code,t.multipleMatchingAccounts.desc)},i.createMultipleMatchingAppMetadataInCacheError=function(){return new i(t.multipleMatchingAppMetadata.code,t.multipleMatchingAppMetadata.desc)},i.createTokenRequestCannotBeMadeError=function(){return new i(t.tokenRequestCannotBeMade.code,t.tokenRequestCannotBeMade.desc)},i.createAppendEmptyScopeToSetError=function(n){return new i(t.appendEmptyScopeError.code,t.appendEmptyScopeError.desc+" Given Scope: "+n)},i.createRemoveEmptyScopeFromSetError=function(n){return new i(t.removeEmptyScopeError.code,t.removeEmptyScopeError.desc+" Given Scope: "+n)},i.createAppendScopeSetError=function(n){return new i(t.appendScopeSetError.code,t.appendScopeSetError.desc+" Detail Error: "+n)},i.createEmptyInputScopeSetError=function(n){return new i(t.emptyInputScopeSetError.code,t.emptyInputScopeSetError.desc+" Given ScopeSet: "+n)},i.createDeviceCodeCancelledError=function(){return new i(t.DeviceCodePollingCancelled.code,""+t.DeviceCodePollingCancelled.desc)},i.createDeviceCodeExpiredError=function(){return new i(t.DeviceCodeExpired.code,""+t.DeviceCodeExpired.desc)},i.createNoAccountInSilentRequestError=function(){return new i(t.NoAccountInSilentRequest.code,""+t.NoAccountInSilentRequest.desc)},i.createNullOrUndefinedCacheRecord=function(){return new i(t.invalidCacheRecord.code,t.invalidCacheRecord.desc)},i.createInvalidCacheEnvironmentError=function(){return new i(t.invalidCacheEnvironment.code,t.invalidCacheEnvironment.desc)},i.createNoAccountFoundError=function(){return new i(t.noAccountFound.code,t.noAccountFound.desc)},i.createCachePluginError=function(){return new i(t.CachePluginError.code,""+t.CachePluginError.desc)},i.createNoCryptoObjectError=function(n){return new i(t.noCryptoObj.code,""+t.noCryptoObj.desc+n)},i.createInvalidCacheTypeError=function(){return new i(t.invalidCacheType.code,""+t.invalidCacheType.desc)},i.createUnexpectedAccountTypeError=function(){return new i(t.unexpectedAccountType.code,""+t.unexpectedAccountType.desc)},i.createUnexpectedCredentialTypeError=function(){return new i(t.unexpectedCredentialType.code,""+t.unexpectedCredentialType.desc)},i.createInvalidAssertionError=function(){return new i(t.invalidAssertion.code,""+t.invalidAssertion.desc)},i.createInvalidCredentialError=function(){return new i(t.invalidClientCredential.code,""+t.invalidClientCredential.desc)},i.createRefreshRequiredError=function(){return new i(t.tokenRefreshRequired.code,t.tokenRefreshRequired.desc)},i.createUserTimeoutReachedError=function(){return new i(t.userTimeoutReached.code,t.userTimeoutReached.desc)},i.createTokenClaimsRequiredError=function(){return new i(t.tokenClaimsRequired.code,t.tokenClaimsRequired.desc)},i.createNoAuthCodeInServerResponseError=function(){return new i(t.noAuthorizationCodeFromServer.code,t.noAuthorizationCodeFromServer.desc)},i}(v),i=function(){function n(){}return n.decodeAuthToken=function(t){var r,i;if(n.isEmpty(t))throw f.createTokenNullOrEmptyError(t);if(r=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,i=r.exec(t),!i||i.length<4)throw f.createTokenParsingError("Given token is malformed: "+JSON.stringify(t));return{header:i[1],JWSPayload:i[2],JWSSig:i[3]}},n.isEmpty=function(n){return typeof n=="undefined"||!n||0===n.length},n.startsWith=function(n,t){return n.indexOf(t)===0},n.endsWith=function(n,t){return n.length>=t.length&&n.lastIndexOf(t)===n.length-t.length},n.queryStringToObject=function(n){for(var f=/\+/g,i=/([^&=]+)=([^&]*)/g,r=function(n){return decodeURIComponent(decodeURIComponent(n.replace(f," ")))},u={},t=i.exec(n);t;)u[r(t[1])]=r(t[2]),t=i.exec(n);return u},n.trimArrayEntries=function(n){return n.map(function(n){return n.trim()})},n.removeEmptyStringsFromArray=function(t){return t.filter(function(t){return!n.isEmpty(t)})},n.jsonParseHelper=function(n){try{return JSON.parse(n)}catch(t){return null}},n.matchPattern=function(n,t){var i=new RegExp(n.replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?"));return i.test(t)},n}();(function(n){n[n.Error=0]="Error";n[n.Warning=1]="Warning";n[n.Info=2]="Info";n[n.Verbose=3]="Verbose"})(n.LogLevel||(n.LogLevel={}));var ar=function(){function t(t,i,r){this.level=n.LogLevel.Info;var f=function(){};this.localCallback=t.loggerCallback||f;this.piiLoggingEnabled=t.piiLoggingEnabled||!1;this.level=t.logLevel||n.LogLevel.Info;this.packageName=i||u.EMPTY_STRING;this.packageVersion=r||u.EMPTY_STRING}return t.prototype.clone=function(n,i){return new t({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level},n,i)},t.prototype.logMessage=function(t,r){if(!(r.logLevel>this.level)&&(this.piiLoggingEnabled||!r.containsPii)){var u=(new Date).toUTCString(),f=i.isEmpty(this.correlationId)?"["+u+"] : ":"["+u+"] : ["+this.correlationId+"]",e=f+" : "+this.packageName+"@"+this.packageVersion+" : "+n.LogLevel[r.logLevel]+" - "+t;this.executeCallback(r.logLevel,e,r.containsPii||!1)}},t.prototype.executeCallback=function(n,t,i){this.localCallback&&this.localCallback(n,t,i)},t.prototype.error=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Error,containsPii:!1,correlationId:i||""})},t.prototype.errorPii=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Error,containsPii:!0,correlationId:i||""})},t.prototype.warning=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Warning,containsPii:!1,correlationId:i||""})},t.prototype.warningPii=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Warning,containsPii:!0,correlationId:i||""})},t.prototype.info=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Info,containsPii:!1,correlationId:i||""})},t.prototype.infoPii=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Info,containsPii:!0,correlationId:i||""})},t.prototype.verbose=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Verbose,containsPii:!1,correlationId:i||""})},t.prototype.verbosePii=function(t,i){this.logMessage(t,{logLevel:n.LogLevel.Verbose,containsPii:!0,correlationId:i||""})},t.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled||!1},t}(),rf="@azure/msal-common",eu="4.2.0",wi=function(){function n(){}return n.prototype.generateAccountId=function(){return n.generateAccountIdForCacheKey(this.homeAccountId,this.environment)},n.prototype.generateCredentialId=function(){return n.generateCredentialIdForCacheKey(this.credentialType,this.clientId,this.realm,this.familyId)},n.prototype.generateTarget=function(){return n.generateTargetForCacheKey(this.target)},n.prototype.generateCredentialKey=function(){return n.generateCredentialCacheKey(this.homeAccountId,this.environment,this.credentialType,this.clientId,this.realm,this.target,this.familyId)},n.prototype.generateType=function(){switch(this.credentialType){case l.ID_TOKEN:return dt.ID_TOKEN;case l.ACCESS_TOKEN:return dt.ACCESS_TOKEN;case l.REFRESH_TOKEN:return dt.REFRESH_TOKEN;default:throw f.createUnexpectedCredentialTypeError();}},n.getCredentialType=function(n){return n.indexOf(l.ACCESS_TOKEN.toLowerCase())!==-1?n.indexOf(l.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())!==-1?l.ACCESS_TOKEN_WITH_AUTH_SCHEME:l.ACCESS_TOKEN:n.indexOf(l.ID_TOKEN.toLowerCase())!==-1?l.ID_TOKEN:n.indexOf(l.REFRESH_TOKEN.toLowerCase())!==-1?l.REFRESH_TOKEN:u.NOT_DEFINED},n.generateCredentialCacheKey=function(n,t,i,r,u,f,e){var o=[this.generateAccountIdForCacheKey(n,t),this.generateCredentialIdForCacheKey(i,r,u,e),this.generateTargetForCacheKey(f),];return o.join(at.CACHE_KEY_SEPARATOR).toLowerCase()},n.generateAccountIdForCacheKey=function(n,t){var i=[n,t];return i.join(at.CACHE_KEY_SEPARATOR).toLowerCase()},n.generateCredentialIdForCacheKey=function(n,t,i,r){var u=n===l.REFRESH_TOKEN?r||t:t,f=[n,u,i||"",];return f.join(at.CACHE_KEY_SEPARATOR).toLowerCase()},n.generateTargetForCacheKey=function(n){return(n||"").toLowerCase()},n}(),y={redirectUriNotSet:{code:"redirect_uri_empty",desc:"A redirect URI is required for all calls, and none has been set."},postLogoutUriNotSet:{code:"post_logout_uri_empty",desc:"A post logout redirect has not been set."},claimsRequestParsingError:{code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."},authorityUriInsecure:{code:"authority_uri_insecure",desc:"Authority URIs must use https.  Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options"},urlParseError:{code:"url_parse_error",desc:"URL could not be parsed into appropriate segments."},urlEmptyError:{code:"empty_url_error",desc:"URL was empty or null."},emptyScopesError:{code:"empty_input_scopes_error",desc:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token."},nonArrayScopesError:{code:"nonarray_input_scopes_error",desc:"Scopes cannot be passed as non-array."},clientIdSingleScopeError:{code:"clientid_input_scopes_error",desc:"Client ID can only be provided as a single scope."},invalidPrompt:{code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent' and 'none'.  Please see here for valid configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options"},invalidClaimsRequest:{code:"invalid_claims",desc:"Given claims parameter must be a stringified JSON object."},tokenRequestEmptyError:{code:"token_request_empty",desc:"Token request was empty and not found in cache."},logoutRequestEmptyError:{code:"logout_request_empty",desc:"The logout request was null or undefined."},invalidCodeChallengeMethod:{code:"invalid_code_challenge_method",desc:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".'},invalidCodeChallengeParams:{code:"pkce_params_missing",desc:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request"},invalidCloudDiscoveryMetadata:{code:"invalid_cloud_discovery_metadata",desc:"Invalid cloudDiscoveryMetadata provided. Must be a JSON object containing tenant_discovery_endpoint and metadata fields"},invalidAuthorityMetadata:{code:"invalid_authority_metadata",desc:"Invalid authorityMetadata provided. Must by a JSON object containing authorization_endpoint, token_endpoint, end_session_endpoint, issuer fields."},untrustedAuthority:{code:"untrusted_authority",desc:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."}},k=function(n){function t(i,r){var u=n.call(this,i,r)||this;return u.name="ClientConfigurationError",Object.setPrototypeOf(u,t.prototype),u}return nt(t,n),t.createRedirectUriEmptyError=function(){return new t(y.redirectUriNotSet.code,y.redirectUriNotSet.desc)},t.createPostLogoutRedirectUriEmptyError=function(){return new t(y.postLogoutUriNotSet.code,y.postLogoutUriNotSet.desc)},t.createClaimsRequestParsingError=function(n){return new t(y.claimsRequestParsingError.code,y.claimsRequestParsingError.desc+" Given value: "+n)},t.createInsecureAuthorityUriError=function(n){return new t(y.authorityUriInsecure.code,y.authorityUriInsecure.desc+" Given URI: "+n)},t.createUrlParseError=function(n){return new t(y.urlParseError.code,y.urlParseError.desc+" Given Error: "+n)},t.createUrlEmptyError=function(){return new t(y.urlEmptyError.code,y.urlEmptyError.desc)},t.createScopesNonArrayError=function(n){return new t(y.nonArrayScopesError.code,y.nonArrayScopesError.desc+" Given Scopes: "+n)},t.createEmptyScopesArrayError=function(n){return new t(y.emptyScopesError.code,y.emptyScopesError.desc+" Given Scopes: "+n)},t.createClientIdSingleScopeError=function(n){return new t(y.clientIdSingleScopeError.code,y.clientIdSingleScopeError.desc+" Given Scopes: "+n)},t.createInvalidPromptError=function(n){return new t(y.invalidPrompt.code,y.invalidPrompt.desc+" Given value: "+n)},t.createInvalidClaimsRequestError=function(){return new t(y.invalidClaimsRequest.code,y.invalidClaimsRequest.desc)},t.createEmptyLogoutRequestError=function(){return new t(y.logoutRequestEmptyError.code,y.logoutRequestEmptyError.desc)},t.createEmptyTokenRequestError=function(){return new t(y.tokenRequestEmptyError.code,y.tokenRequestEmptyError.desc)},t.createInvalidCodeChallengeMethodError=function(){return new t(y.invalidCodeChallengeMethod.code,y.invalidCodeChallengeMethod.desc)},t.createInvalidCodeChallengeParamsError=function(){return new t(y.invalidCodeChallengeParams.code,y.invalidCodeChallengeParams.desc)},t.createInvalidCloudDiscoveryMetadataError=function(){return new t(y.invalidCloudDiscoveryMetadata.code,y.invalidCloudDiscoveryMetadata.desc)},t.createInvalidAuthorityMetadataError=function(){return new t(y.invalidAuthorityMetadata.code,y.invalidAuthorityMetadata.desc)},t.createUntrustedAuthorityError=function(){return new t(y.untrustedAuthority.code,y.untrustedAuthority.desc)},t}(f),ht=function(){function n(n){var u=this,t=n?i.trimArrayEntries(bi(n)):[],r=t?i.removeEmptyStringsFromArray(t):[];this.validateInputScopes(r);this.scopes=new Set;r.forEach(function(n){return u.scopes.add(n)})}return n.fromString=function(t){t=t||"";var i=t.split(" ");return new n(i)},n.prototype.validateInputScopes=function(n){if(!n||n.length<1)throw k.createEmptyScopesArrayError(n);},n.prototype.containsScope=function(t){var r=this.printScopesLowerCase().split(" "),u=new n(r);return i.isEmpty(t)?!1:u.scopes.has(t.toLowerCase())},n.prototype.containsScopeSet=function(n){var t=this;return!n||n.scopes.size<=0?!1:this.scopes.size>=n.scopes.size&&n.asArray().every(function(n){return t.containsScope(n)})},n.prototype.containsOnlyOIDCScopes=function(){var t=this,n=0;return fu.forEach(function(i){t.containsScope(i)&&(n+=1)}),this.scopes.size===n},n.prototype.appendScope=function(n){i.isEmpty(n)||this.scopes.add(n.trim())},n.prototype.appendScopes=function(n){var t=this;try{n.forEach(function(n){return t.appendScope(n)})}catch(i){throw f.createAppendScopeSetError(i);}},n.prototype.removeScope=function(n){if(i.isEmpty(n))throw f.createRemoveEmptyScopeFromSetError(n);this.scopes.delete(n.trim())},n.prototype.removeOIDCScopes=function(){var n=this;fu.forEach(function(t){n.scopes.delete(t)})},n.prototype.unionScopeSets=function(n){if(!n)throw f.createEmptyInputScopeSetError(n);var t=new Set;return n.scopes.forEach(function(n){return t.add(n.toLowerCase())}),this.scopes.forEach(function(n){return t.add(n.toLowerCase())}),t},n.prototype.intersectingScopeSets=function(n){if(!n)throw f.createEmptyInputScopeSetError(n);n.containsOnlyOIDCScopes()||n.removeOIDCScopes();var t=this.unionScopeSets(n),i=n.getScopeCount(),r=this.getScopeCount(),u=t.size;return u<r+i},n.prototype.getScopeCount=function(){return this.scopes.size},n.prototype.asArray=function(){var n=[];return this.scopes.forEach(function(t){return n.push(t)}),n},n.prototype.printScopes=function(){if(this.scopes){var n=this.asArray();return n.join(" ")}return""},n.prototype.printScopesLowerCase=function(){return this.printScopes().toLowerCase()},n}();(function(n){n[n.Default=0]="Default";n[n.Adfs=1]="Adfs"})(ni||(ni={}));var st=function(){function n(){}return n.prototype.generateAccountId=function(){var n=[this.homeAccountId,this.environment];return n.join(at.CACHE_KEY_SEPARATOR).toLowerCase()},n.prototype.generateAccountKey=function(){return n.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})},n.prototype.generateType=function(){switch(this.authorityType){case kt.ADFS_ACCOUNT_TYPE:return dt.ADFS;case kt.MSAV1_ACCOUNT_TYPE:return dt.MSA;case kt.MSSTS_ACCOUNT_TYPE:return dt.MSSTS;case kt.GENERIC_ACCOUNT_TYPE:return dt.GENERIC;default:throw f.createUnexpectedAccountTypeError();}},n.prototype.getAccountInfo=function(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,idTokenClaims:this.idTokenClaims}},n.generateAccountCacheKey=function(n){var t=[n.homeAccountId,n.environment||"",n.tenantId||"",];return t.join(at.CACHE_KEY_SEPARATOR).toLowerCase()},n.createAccount=function(t,r,u,e,o,s,h){var l,a,v,y,p,w,c=new n,b;if(c.authorityType=kt.MSSTS_ACCOUNT_TYPE,c.clientInfo=t,c.homeAccountId=r,b=u.getPreferredCache(),i.isEmpty(b))throw f.createInvalidCacheEnvironmentError();return c.environment=b,c.realm=((l=e===null||e===void 0?void 0:e.claims)===null||l===void 0?void 0:l.tid)||"",c.oboAssertion=o,e&&(c.idTokenClaims=e.claims,c.localAccountId=((a=e===null||e===void 0?void 0:e.claims)===null||a===void 0?void 0:a.oid)||((v=e===null||e===void 0?void 0:e.claims)===null||v===void 0?void 0:v.sub)||"",c.username=((y=e===null||e===void 0?void 0:e.claims)===null||y===void 0?void 0:y.preferred_username)||(((p=e===null||e===void 0?void 0:e.claims)===null||p===void 0?void 0:p.emails)?e.claims.emails[0]:""),c.name=(w=e===null||e===void 0?void 0:e.claims)===null||w===void 0?void 0:w.name),c.cloudGraphHostName=s,c.msGraphHost=h,c},n.createGenericAccount=function(t,r,u,e,o,s){var c,l,a,v,h=new n,y;if(h.authorityType=t.authorityType===ni.Adfs?kt.ADFS_ACCOUNT_TYPE:kt.GENERIC_ACCOUNT_TYPE,h.homeAccountId=r,h.realm="",h.oboAssertion=e,y=t.getPreferredCache(),i.isEmpty(y))throw f.createInvalidCacheEnvironmentError();return u&&(h.localAccountId=((c=u===null||u===void 0?void 0:u.claims)===null||c===void 0?void 0:c.oid)||((l=u===null||u===void 0?void 0:u.claims)===null||l===void 0?void 0:l.sub)||"",h.username=((a=u===null||u===void 0?void 0:u.claims)===null||a===void 0?void 0:a.upn)||"",h.name=((v=u===null||u===void 0?void 0:u.claims)===null||v===void 0?void 0:v.name)||"",h.idTokenClaims=u===null||u===void 0?void 0:u.claims),h.environment=y,h.cloudGraphHostName=o,h.msGraphHost=s,h},n.generateHomeAccountId=function(n,t,r,f,e){var s,h=((s=e===null||e===void 0?void 0:e.claims)===null||s===void 0?void 0:s.sub)?e.claims.sub:u.EMPTY_STRING,o;return t===ni.Adfs?h:n&&(o=ou(n,f),!i.isEmpty(o.uid)&&!i.isEmpty(o.utid))?""+o.uid+at.CLIENT_INFO_SEPARATOR+o.utid:(r.verbose("No client info in response"),h)},n.isAccountEntity=function(n){return n?n.hasOwnProperty("homeAccountId")&&n.hasOwnProperty("environment")&&n.hasOwnProperty("realm")&&n.hasOwnProperty("localAccountId")&&n.hasOwnProperty("username")&&n.hasOwnProperty("authorityType"):!1},n.accountInfoIsEqual=function(n,t){return!n||!t?!1:n.homeAccountId===t.homeAccountId&&n.localAccountId===t.localAccountId&&n.username===t.username&&n.tenantId===t.tenantId&&n.environment===t.environment},n}(),ti=function(){function n(t,r){if(i.isEmpty(t))throw f.createTokenNullOrEmptyError(t);this.rawToken=t;this.claims=n.extractTokenClaims(t,r)}return n.extractTokenClaims=function(n,t){var e=i.decodeAuthToken(n),r,u;try{return r=e.JWSPayload,u=t.base64Decode(r),JSON.parse(u)}catch(o){throw f.createTokenParsingError(o);}},n}(),yt=function(){function t(n,t){this.clientId=n;this.cryptoImpl=t}return t.prototype.getAllAccounts=function(){var n=this,i=this.getAccountsFilteredBy(),r=Object.keys(i).map(function(n){return i[n]}),u=r.length;return u<1?[]:r.map(function(i){var f=t.toObject(new st,i),r=f.getAccountInfo(),u=n.readIdTokenFromCache(n.clientId,r);return u&&!r.idTokenClaims&&(r.idTokenClaims=new ti(u.secret,n.cryptoImpl).claims),r})},t.prototype.saveCacheRecord=function(n){if(!n)throw f.createNullOrUndefinedCacheRecord();!n.account||this.setAccount(n.account);!n.idToken||this.setIdTokenCredential(n.idToken);!n.accessToken||this.saveAccessToken(n.accessToken);!n.refreshToken||this.setRefreshTokenCredential(n.refreshToken);!n.appMetadata||this.setAppMetadata(n.appMetadata)},t.prototype.saveAccessToken=function(n){var r=this,t=this.getCredentialsFilteredBy({clientId:n.clientId,credentialType:n.credentialType,environment:n.environment,homeAccountId:n.homeAccountId,realm:n.realm}),u=ht.fromString(n.target),i=Object.keys(t.accessTokens).map(function(n){return t.accessTokens[n]});i&&i.forEach(function(n){var t=ht.fromString(n.target);t.intersectingScopeSets(u)&&r.removeCredential(n)});this.setAccessTokenCredential(n)},t.prototype.getAccountsFilteredBy=function(n){return this.getAccountsFilteredByInternal(n?n.homeAccountId:"",n?n.environment:"",n?n.realm:"")},t.prototype.getAccountsFilteredByInternal=function(n,t,i){var r=this,f=this.getKeys(),u={};return f.forEach(function(f){var e=r.getAccount(f);e&&(!n||r.matchHomeAccountId(e,n))&&(!t||r.matchEnvironment(e,t))&&(!i||r.matchRealm(e,i))&&(u[f]=e)}),u},t.prototype.getCredentialsFilteredBy=function(n){return this.getCredentialsFilteredByInternal(n.homeAccountId,n.environment,n.credentialType,n.clientId,n.familyId,n.realm,n.target,n.oboAssertion)},t.prototype.getCredentialsFilteredByInternal=function(n,t,i,r,f,e,o,s){var h=this,a=this.getKeys(),c={idTokens:{},accessTokens:{},refreshTokens:{}};return a.forEach(function(a){var y=wi.getCredentialType(a),v;if(y!==u.NOT_DEFINED&&(v=h.getSpecificCredential(a,y),v)&&(!s||h.matchOboAssertion(v,s))&&(!n||h.matchHomeAccountId(v,n))&&(!t||h.matchEnvironment(v,t))&&(!e||h.matchRealm(v,e))&&(!i||h.matchCredentialType(v,i))&&(!r||h.matchClientId(v,r))&&(!f||h.matchFamilyId(v,f))&&(!o||h.matchTarget(v,o)))switch(y){case l.ID_TOKEN:c.idTokens[a]=v;break;case l.ACCESS_TOKEN:case l.ACCESS_TOKEN_WITH_AUTH_SCHEME:c.accessTokens[a]=v;break;case l.REFRESH_TOKEN:c.refreshTokens[a]=v}}),c},t.prototype.getAppMetadataFilteredBy=function(n){return this.getAppMetadataFilteredByInternal(n.environment,n.clientId)},t.prototype.getAppMetadataFilteredByInternal=function(n,t){var i=this,u=this.getKeys(),r={};return u.forEach(function(u){if(i.isAppMetadata(u)){var f=i.getAppMetadata(u);f&&(!n||i.matchEnvironment(f,n))&&(!t||i.matchClientId(f,t))&&(r[u]=f)}}),r},t.prototype.getAuthorityMetadataByAlias=function(n){var t=this,r=this.getAuthorityMetadataKeys(),i=null;return r.forEach(function(r){if(t.isAuthorityMetadata(r)&&r.indexOf(t.clientId)!==-1){var u=t.getAuthorityMetadata(r);u&&u.aliases.indexOf(n)!==-1&&(i=u)}}),i},t.prototype.removeAllAccounts=function(){var n=this,t=this.getKeys();return t.forEach(function(t){var i=n.getAccount(t);i&&n.removeAccount(t)}),!0},t.prototype.removeAccount=function(n){var t=this.getAccount(n);if(!t)throw f.createNoAccountFoundError();return this.removeAccountContext(t)&&this.removeItem(n,ui.ACCOUNT)},t.prototype.removeAccountContext=function(n){var t=this,i=this.getKeys(),r=n.generateAccountId();return i.forEach(function(n){var f=wi.getCredentialType(n),i;f!==u.NOT_DEFINED&&(i=t.getSpecificCredential(n,f),!i||r!==i.generateAccountId()||t.removeCredential(i))}),!0},t.prototype.removeCredential=function(n){var t=n.generateCredentialKey();return this.removeItem(t,ui.CREDENTIAL)},t.prototype.removeAppMetadata=function(){var n=this,t=this.getKeys();return t.forEach(function(t){n.isAppMetadata(t)&&n.removeItem(t,ui.APP_METADATA)}),!0},t.prototype.readCacheRecord=function(n,t,i,r,u){var f=this.readAccountFromCache(n),e=this.readIdTokenFromCache(t,n),o=this.readAccessTokenFromCache(t,n,i,u),s=this.readRefreshTokenFromCache(t,n,!1),h=this.readAppMetadataFromCache(r,t);return f&&e&&(f.idTokenClaims=new ti(e.secret,this.cryptoImpl).claims),{account:f,idToken:e,accessToken:o,refreshToken:s,appMetadata:h}},t.prototype.readAccountFromCache=function(n){var t=st.generateAccountCacheKey(n);return this.getAccount(t)},t.prototype.readIdTokenFromCache=function(n,t){var e={homeAccountId:t.homeAccountId,environment:t.environment,credentialType:l.ID_TOKEN,clientId:n,realm:t.tenantId},i=this.getCredentialsFilteredBy(e),r=Object.keys(i.idTokens).map(function(n){return i.idTokens[n]}),u=r.length;if(u<1)return null;if(u>1)throw f.createMultipleMatchingTokensInCacheError();return r[0]},t.prototype.readAccessTokenFromCache=function(t,i,r,u){var h=u===n.AuthenticationScheme.POP?l.ACCESS_TOKEN_WITH_AUTH_SCHEME:l.ACCESS_TOKEN,c={homeAccountId:i.homeAccountId,environment:i.environment,credentialType:h,clientId:t,realm:i.tenantId,target:r.printScopesLowerCase()},e=this.getCredentialsFilteredBy(c),o=Object.keys(e.accessTokens).map(function(n){return e.accessTokens[n]}),s=o.length;if(s<1)return null;if(s>1)throw f.createMultipleMatchingTokensInCacheError();return o[0]},t.prototype.readRefreshTokenFromCache=function(n,t,i){var f=i?gi:undefined,e={homeAccountId:t.homeAccountId,environment:t.environment,credentialType:l.REFRESH_TOKEN,clientId:n,familyId:f},r=this.getCredentialsFilteredBy(e),u=Object.keys(r.refreshTokens).map(function(n){return r.refreshTokens[n]}),o=u.length;return o<1?null:u[0]},t.prototype.readAppMetadataFromCache=function(n,t){var e={environment:n,clientId:t},i=this.getAppMetadataFilteredBy(e),r=Object.keys(i).map(function(n){return i[n]}),u=r.length;if(u<1)return null;if(u>1)throw f.createMultipleMatchingAppMetadataInCacheError();return r[0]},t.prototype.isAppMetadataFOCI=function(n,t){var i=this.readAppMetadataFromCache(n,t);return!!(i&&i.familyId===gi)},t.prototype.matchHomeAccountId=function(n,t){return!!(n.homeAccountId&&t===n.homeAccountId)},t.prototype.matchOboAssertion=function(n,t){return!!(n.oboAssertion&&t===n.oboAssertion)},t.prototype.matchEnvironment=function(n,t){var i=this.getAuthorityMetadataByAlias(t);return i&&i.aliases.indexOf(n.environment)>-1?!0:!1},t.prototype.matchCredentialType=function(n,t){return n.credentialType&&t.toLowerCase()===n.credentialType.toLowerCase()},t.prototype.matchClientId=function(n,t){return!!(n.clientId&&t===n.clientId)},t.prototype.matchFamilyId=function(n,t){return!!(n.familyId&&t===n.familyId)},t.prototype.matchRealm=function(n,t){return!!(n.realm&&t===n.realm)},t.prototype.matchTarget=function(n,t){var f=n.credentialType!==l.ACCESS_TOKEN&&n.credentialType!==l.ACCESS_TOKEN_WITH_AUTH_SCHEME,r,i;return f||!n.target?!1:(r=ht.fromString(n.target),i=ht.fromString(t),i.containsOnlyOIDCScopes()?i.removeScope(u.OFFLINE_ACCESS_SCOPE):i.removeOIDCScopes(),r.containsScopeSet(i))},t.prototype.isAppMetadata=function(n){return n.indexOf(hr)!==-1},t.prototype.isAuthorityMetadata=function(n){return n.indexOf(yi.CACHE_KEY)!==-1},t.prototype.generateAuthorityMetadataCacheKey=function(n){return yi.CACHE_KEY+"-"+this.clientId+"-"+n},t.prototype.getSpecificCredential=function(n,t){switch(t){case l.ID_TOKEN:return this.getIdTokenCredential(n);case l.ACCESS_TOKEN:case l.ACCESS_TOKEN_WITH_AUTH_SCHEME:return this.getAccessTokenCredential(n);case l.REFRESH_TOKEN:return this.getRefreshTokenCredential(n);default:return null}},t.toObject=function(n,t){for(var i in t)n[i]=t[i];return n},t}(),uf=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return nt(t,n),t.prototype.setAccount=function(){throw v.createUnexpectedError("Storage interface - setAccount() has not been implemented for the cacheStorage interface.");},t.prototype.getAccount=function(){throw v.createUnexpectedError("Storage interface - getAccount() has not been implemented for the cacheStorage interface.");},t.prototype.setIdTokenCredential=function(){throw v.createUnexpectedError("Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.");},t.prototype.getIdTokenCredential=function(){throw v.createUnexpectedError("Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.");},t.prototype.setAccessTokenCredential=function(){throw v.createUnexpectedError("Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.");},t.prototype.getAccessTokenCredential=function(){throw v.createUnexpectedError("Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.");},t.prototype.setRefreshTokenCredential=function(){throw v.createUnexpectedError("Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.");},t.prototype.getRefreshTokenCredential=function(){throw v.createUnexpectedError("Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.");},t.prototype.setAppMetadata=function(){throw v.createUnexpectedError("Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.");},t.prototype.getAppMetadata=function(){throw v.createUnexpectedError("Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.");},t.prototype.setServerTelemetry=function(){throw v.createUnexpectedError("Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.");},t.prototype.getServerTelemetry=function(){throw v.createUnexpectedError("Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.");},t.prototype.setAuthorityMetadata=function(){throw v.createUnexpectedError("Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.");},t.prototype.getAuthorityMetadata=function(){throw v.createUnexpectedError("Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.");},t.prototype.getAuthorityMetadataKeys=function(){throw v.createUnexpectedError("Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.");},t.prototype.setThrottlingCache=function(){throw v.createUnexpectedError("Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.");},t.prototype.getThrottlingCache=function(){throw v.createUnexpectedError("Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.");},t.prototype.removeItem=function(){throw v.createUnexpectedError("Storage interface - removeItem() has not been implemented for the cacheStorage interface.");},t.prototype.containsKey=function(){throw v.createUnexpectedError("Storage interface - containsKey() has not been implemented for the cacheStorage interface.");},t.prototype.getKeys=function(){throw v.createUnexpectedError("Storage interface - getKeys() has not been implemented for the cacheStorage interface.");},t.prototype.clear=function(){throw v.createUnexpectedError("Storage interface - clear() has not been implemented for the cacheStorage interface.");},t}(yt),su={tokenRenewalOffsetSeconds:300},ff={loggerCallback:function(){},piiLoggingEnabled:!1,logLevel:n.LogLevel.Info},ef={sendGetRequestAsync:function(){return h(this,void 0,void 0,function(){var n;return c(this,function(){n="Network interface - sendGetRequestAsync() has not been implemented";throw v.createUnexpectedError(n);})})},sendPostRequestAsync:function(){return h(this,void 0,void 0,function(){var n;return c(this,function(){n="Network interface - sendPostRequestAsync() has not been implemented";throw v.createUnexpectedError(n);})})}},of={sku:u.SKU,version:eu,cpu:"",os:""},sf={clientSecret:"",clientAssertion:undefined};var oi=function(n){function t(i,r,u){var f=n.call(this,i,r,u)||this;return f.name="ServerError",Object.setPrototypeOf(f,t.prototype),f}return nt(t,n),t}(v),ir=function(){function n(){}return n.generateThrottlingStorageKey=function(n){return pi.THROTTLING_PREFIX+"."+JSON.stringify(n)},n.preProcess=function(t,i){var f,e=n.generateThrottlingStorageKey(i),r=t.getThrottlingCache(e);if(r){if(r.throttleTime<Date.now()){t.removeItem(e,ui.THROTTLING);return}throw new oi(((f=r.errorCodes)===null||f===void 0?void 0:f.join(" "))||u.EMPTY_STRING,r.errorMessage,r.subError);}},n.postProcess=function(t,i,r){if(n.checkResponseStatus(r)||n.checkResponseForRetryAfter(r)){var u={throttleTime:n.calculateThrottleTime(parseInt(r.headers[bt.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};t.setThrottlingCache(n.generateThrottlingStorageKey(i),u)}},n.checkResponseStatus=function(n){return n.status===429||n.status>=500&&n.status<600},n.checkResponseForRetryAfter=function(n){return n.headers?n.headers.hasOwnProperty(bt.RETRY_AFTER)&&(n.status<200||n.status>=300):!1},n.calculateThrottleTime=function(n){n<=0&&(n=0);var t=Date.now()/1e3;return Math.floor(Math.min(t+(n||pi.DEFAULT_THROTTLE_TIME_SECONDS),t+pi.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)},n.removeThrottle=function(n,t,i,r,u){var f={clientId:t,authority:i,scopes:r,homeAccountIdentifier:u},e=this.generateThrottlingStorageKey(f);return n.removeItem(e,ui.THROTTLING)},n}(),lf=function(){function n(n,t){this.networkClient=n;this.cacheManager=t}return n.prototype.sendPostRequest=function(n,t,i){return h(this,void 0,void 0,function(){var u,r;return c(this,function(e){switch(e.label){case 0:ir.preProcess(this.cacheManager,n);e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.networkClient.sendPostRequestAsync(t,i)];case 2:return u=e.sent(),[3,4];case 3:if(r=e.sent(),r instanceof v)throw r;else throw f.createNetworkError(t,r);case 4:return ir.postProcess(this.cacheManager,n,u),[2,u]}})})},n}(),fi=function(){function n(n){this.config=hf(n);this.logger=new ar(this.config.loggerOptions,rf,eu);this.cryptoUtils=this.config.cryptoInterface;this.cacheManager=this.config.storageInterface;this.networkClient=this.config.networkInterface;this.networkManager=new lf(this.networkClient,this.cacheManager);this.serverTelemetryManager=this.config.serverTelemetryManager;this.authority=this.config.authOptions.authority}return n.prototype.createDefaultTokenRequestHeaders=function(){var n=this.createDefaultLibraryHeaders();return n[bt.CONTENT_TYPE]=u.URL_FORM_CONTENT_TYPE,n[bt.X_MS_LIB_CAPABILITY]=bt.X_MS_LIB_CAPABILITY_VALUE,this.serverTelemetryManager&&(n[bt.X_CLIENT_CURR_TELEM]=this.serverTelemetryManager.generateCurrentRequestHeaderValue(),n[bt.X_CLIENT_LAST_TELEM]=this.serverTelemetryManager.generateLastRequestHeaderValue()),n},n.prototype.createDefaultLibraryHeaders=function(){var n={};return n[a.X_CLIENT_SKU]=this.config.libraryInfo.sku,n[a.X_CLIENT_VER]=this.config.libraryInfo.version,n[a.X_CLIENT_OS]=this.config.libraryInfo.os,n[a.X_CLIENT_CPU]=this.config.libraryInfo.cpu,n},n.prototype.executePostToTokenEndpoint=function(n,t,i,r){return h(this,void 0,void 0,function(){var u;return c(this,function(f){switch(f.label){case 0:return[4,this.networkManager.sendPostRequest(r,n,{body:t,headers:i})];case 1:return u=f.sent(),this.config.serverTelemetryManager&&u.status<500&&u.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),[2,u]}})})},n.prototype.updateAuthority=function(n){if(!n.discoveryComplete())throw f.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");this.authority=n},n}(),si=function(){function n(){}return n.validateRedirectUri=function(n){if(i.isEmpty(n))throw k.createRedirectUriEmptyError();},n.validatePrompt=function(n){if([lt.LOGIN,lt.SELECT_ACCOUNT,lt.CONSENT,lt.NONE].indexOf(n)<0)throw k.createInvalidPromptError(n);},n.validateClaims=function(n){try{JSON.parse(n)}catch(t){throw k.createInvalidClaimsRequestError();}},n.validateCodeChallengeParams=function(n,t){if(i.isEmpty(n)||i.isEmpty(t))throw k.createInvalidCodeChallengeParamsError();else this.validateCodeChallengeMethod(t)},n.validateCodeChallengeMethod=function(n){if([sr.PLAIN,sr.S256].indexOf(n)<0)throw k.createInvalidCodeChallengeMethodError();},n.sanitizeEQParams=function(n,t){return n?(t.forEach(function(t,i){n[i]&&delete n[i]}),n):{}},n}(),ct=function(){function t(){this.parameters=new Map}return t.prototype.addResponseTypeCode=function(){this.parameters.set(a.RESPONSE_TYPE,encodeURIComponent(u.CODE_RESPONSE_TYPE))},t.prototype.addResponseMode=function(n){this.parameters.set(a.RESPONSE_MODE,encodeURIComponent(n?n:di.QUERY))},t.prototype.addScopes=function(n,t){t===void 0&&(t=!0);var i=t?bi(n||[],or):n||[],r=new ht(i);this.parameters.set(a.SCOPE,encodeURIComponent(r.printScopes()))},t.prototype.addClientId=function(n){this.parameters.set(a.CLIENT_ID,encodeURIComponent(n))},t.prototype.addRedirectUri=function(n){si.validateRedirectUri(n);this.parameters.set(a.REDIRECT_URI,encodeURIComponent(n))},t.prototype.addPostLogoutRedirectUri=function(n){si.validateRedirectUri(n);this.parameters.set(a.POST_LOGOUT_URI,encodeURIComponent(n))},t.prototype.addIdTokenHint=function(n){this.parameters.set(a.ID_TOKEN_HINT,encodeURIComponent(n))},t.prototype.addDomainHint=function(n){this.parameters.set(ri.DOMAIN_HINT,encodeURIComponent(n))},t.prototype.addLoginHint=function(n){this.parameters.set(ri.LOGIN_HINT,encodeURIComponent(n))},t.prototype.addSid=function(n){this.parameters.set(ri.SID,encodeURIComponent(n))},t.prototype.addClaims=function(n,t){var i=this.addClientCapabilitiesToClaims(n,t);si.validateClaims(i);this.parameters.set(a.CLAIMS,encodeURIComponent(i))},t.prototype.addCorrelationId=function(n){this.parameters.set(a.CLIENT_REQUEST_ID,encodeURIComponent(n))},t.prototype.addLibraryInfo=function(n){this.parameters.set(a.X_CLIENT_SKU,n.sku);this.parameters.set(a.X_CLIENT_VER,n.version);this.parameters.set(a.X_CLIENT_OS,n.os);this.parameters.set(a.X_CLIENT_CPU,n.cpu)},t.prototype.addPrompt=function(n){si.validatePrompt(n);this.parameters.set(""+a.PROMPT,encodeURIComponent(n))},t.prototype.addState=function(n){i.isEmpty(n)||this.parameters.set(a.STATE,encodeURIComponent(n))},t.prototype.addNonce=function(n){this.parameters.set(a.NONCE,encodeURIComponent(n))},t.prototype.addCodeChallengeParams=function(n,t){if(si.validateCodeChallengeParams(n,t),n&&t)this.parameters.set(a.CODE_CHALLENGE,encodeURIComponent(n)),this.parameters.set(a.CODE_CHALLENGE_METHOD,encodeURIComponent(t));else throw k.createInvalidCodeChallengeParamsError();},t.prototype.addAuthorizationCode=function(n){this.parameters.set(a.CODE,encodeURIComponent(n))},t.prototype.addDeviceCode=function(n){this.parameters.set(a.DEVICE_CODE,encodeURIComponent(n))},t.prototype.addRefreshToken=function(n){this.parameters.set(a.REFRESH_TOKEN,encodeURIComponent(n))},t.prototype.addCodeVerifier=function(n){this.parameters.set(a.CODE_VERIFIER,encodeURIComponent(n))},t.prototype.addClientSecret=function(n){this.parameters.set(a.CLIENT_SECRET,encodeURIComponent(n))},t.prototype.addClientAssertion=function(n){this.parameters.set(a.CLIENT_ASSERTION,encodeURIComponent(n))},t.prototype.addClientAssertionType=function(n){this.parameters.set(a.CLIENT_ASSERTION_TYPE,encodeURIComponent(n))},t.prototype.addOboAssertion=function(n){this.parameters.set(a.OBO_ASSERTION,encodeURIComponent(n))},t.prototype.addRequestTokenUse=function(n){this.parameters.set(a.REQUESTED_TOKEN_USE,encodeURIComponent(n))},t.prototype.addGrantType=function(n){this.parameters.set(a.GRANT_TYPE,encodeURIComponent(n))},t.prototype.addClientInfo=function(){this.parameters.set(tf,"1")},t.prototype.addExtraQueryParameters=function(n){var t=this;si.sanitizeEQParams(n,this.parameters);Object.keys(n).forEach(function(i){t.parameters.set(i,n[i])})},t.prototype.addClientCapabilitiesToClaims=function(n,t){var i;if(n)try{i=JSON.parse(n)}catch(r){throw k.createInvalidClaimsRequestError();}else i={};return t&&t.length>0&&(i.hasOwnProperty(ei.ACCESS_TOKEN)||(i[ei.ACCESS_TOKEN]={}),i[ei.ACCESS_TOKEN][ei.XMS_CC]={values:t}),JSON.stringify(i)},t.prototype.addUsername=function(n){this.parameters.set(nr.username,n)},t.prototype.addPassword=function(n){this.parameters.set(nr.password,n)},t.prototype.addPopToken=function(t){i.isEmpty(t)||(this.parameters.set(a.TOKEN_TYPE,n.AuthenticationScheme.POP),this.parameters.set(a.REQ_CNF,encodeURIComponent(t)))},t.prototype.createQueryString=function(){var n=[];return this.parameters.forEach(function(t,i){n.push(i+"="+t)}),n.join("&")},t}(),vr=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return nt(t,n),t.createIdTokenEntity=function(n,i,r,u,f,e){var o=new t;return o.credentialType=l.ID_TOKEN,o.homeAccountId=n,o.environment=i,o.clientId=u,o.secret=r,o.realm=f,o.oboAssertion=e,o},t.isIdTokenEntity=function(n){return n?n.hasOwnProperty("homeAccountId")&&n.hasOwnProperty("environment")&&n.hasOwnProperty("credentialType")&&n.hasOwnProperty("realm")&&n.hasOwnProperty("clientId")&&n.hasOwnProperty("secret")&&n.credentialType===l.ID_TOKEN:!1},t}(wi),g=function(){function n(){}return n.nowSeconds=function(){return Math.round((new Date).getTime()/1e3)},n.isTokenExpired=function(t,i){var r=Number(t)||0,u=n.nowSeconds()+i;return u>r},n}(),yr=function(t){function r(){return t!==null&&t.apply(this,arguments)||this}return nt(r,t),r.createAccessTokenEntity=function(t,u,e,o,s,h,c,a,v,y,p,w){var d,b=new r,nt,k;if(b.homeAccountId=t,b.credentialType=l.ACCESS_TOKEN,b.secret=e,nt=g.nowSeconds(),b.cachedAt=nt.toString(),b.expiresOn=c.toString(),b.extendedExpiresOn=a.toString(),y&&(b.refreshOn=y.toString()),b.environment=u,b.clientId=o,b.realm=s,b.target=h,b.oboAssertion=w,b.tokenType=i.isEmpty(p)?n.AuthenticationScheme.BEARER:p,b.tokenType===n.AuthenticationScheme.POP){if(b.credentialType=l.ACCESS_TOKEN_WITH_AUTH_SCHEME,k=ti.extractTokenClaims(e,v),!((d=k===null||k===void 0?void 0:k.cnf)===null||d===void 0?void 0:d.kid))throw f.createTokenClaimsRequiredError();b.keyId=k.cnf.kid}return b},r.isAccessTokenEntity=function(n){return n?n.hasOwnProperty("homeAccountId")&&n.hasOwnProperty("environment")&&n.hasOwnProperty("credentialType")&&n.hasOwnProperty("realm")&&n.hasOwnProperty("clientId")&&n.hasOwnProperty("secret")&&n.hasOwnProperty("target")&&(n.credentialType===l.ACCESS_TOKEN||n.credentialType===l.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1},r}(wi),pr=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return nt(t,n),t.createRefreshTokenEntity=function(n,i,r,u,f,e){var o=new t;return o.clientId=u,o.credentialType=l.REFRESH_TOKEN,o.environment=i,o.homeAccountId=n,o.secret=r,o.oboAssertion=e,f&&(o.familyId=f),o},t.isRefreshTokenEntity=function(n){return n?n.hasOwnProperty("homeAccountId")&&n.hasOwnProperty("environment")&&n.hasOwnProperty("credentialType")&&n.hasOwnProperty("clientId")&&n.hasOwnProperty("secret")&&n.credentialType===l.REFRESH_TOKEN:!1},t}(wi),hu=["interaction_required","consent_required","login_required"],af=["message_only","additional_action","basic_action","user_password_expired","consent_required"],hi=function(n){function t(i,r,u){var f=n.call(this,i,r,u)||this;return f.name="InteractionRequiredAuthError",Object.setPrototypeOf(f,t.prototype),f}return nt(t,n),t.isInteractionRequiredError=function(n,t,i){var r=!!n&&hu.indexOf(n)>-1,u=!!i&&af.indexOf(i)>-1,f=!!t&&hu.some(function(n){return t.indexOf(n)>-1});return r||f||u},t}(oi),vf=function(){function n(n,t,i,r,u){this.account=n||null;this.idToken=t||null;this.accessToken=i||null;this.refreshToken=r||null;this.appMetadata=u||null}return n}(),ci=function(){function n(){}return n.setRequestState=function(t,r,f){var e=n.generateLibraryState(t,f);return i.isEmpty(r)?e:""+e+u.RESOURCE_DELIM+r},n.generateLibraryState=function(n,t){var i,r;if(!n)throw f.createNoCryptoObjectError("generateLibraryState");return i={id:n.createNewGuid()},t&&(i.meta=t),r=JSON.stringify(i),n.base64Encode(r)},n.parseRequestState=function(n,t){if(!n)throw f.createNoCryptoObjectError("parseRequestState");if(i.isEmpty(t))throw f.createInvalidStateError(t,"Null, undefined or empty state");try{var r=decodeURIComponent(t).split(u.RESOURCE_DELIM),o=r[0],e=r.length>1?r.slice(1).join(u.RESOURCE_DELIM):"",s=n.base64Decode(o),h=JSON.parse(s);return{userRequestState:i.isEmpty(e)?"":e,libraryState:h}}catch(c){throw f.createInvalidStateError(t,c);}},n}(),b=function(){function n(t){if(this._urlString=t,i.isEmpty(this._urlString))throw k.createUrlEmptyError();i.isEmpty(this.getHash())&&(this._urlString=n.canonicalizeUri(t))}return Object.defineProperty(n.prototype,"urlString",{get:function(){return this._urlString},enumerable:!0,configurable:!0}),n.canonicalizeUri=function(n){return n&&(n=n.toLowerCase(),i.endsWith(n,"?")?n=n.slice(0,-1):i.endsWith(n,"?/")&&(n=n.slice(0,-2)),i.endsWith(n,"/")||(n+="/")),n},n.prototype.validateAsUri=function(){var n;try{n=this.getUrlComponents()}catch(t){throw k.createUrlParseError(t);}if(!n.HostNameAndPort||!n.PathSegments)throw k.createUrlParseError("Given url string: "+this.urlString);if(!n.Protocol||n.Protocol.toLowerCase()!=="https:")throw k.createInsecureAuthorityUriError(this.urlString);},n.prototype.urlRemoveQueryStringParameter=function(n){var t=new RegExp("(\\&"+n+"=)[^&]+");return this._urlString=this.urlString.replace(t,""),t=new RegExp("("+n+"=)[^&]+&"),this._urlString=this.urlString.replace(t,""),t=new RegExp("("+n+"=)[^&]+"),this._urlString=this.urlString.replace(t,""),this.urlString},n.removeHashFromUrl=function(t){return n.canonicalizeUri(t.split("#")[0])},n.prototype.replaceTenantPath=function(t){var r=this.getUrlComponents(),i=r.PathSegments;return t&&i.length!==0&&(i[0]===ki.COMMON||i[0]===ki.ORGANIZATIONS)&&(i[0]=t),n.constructAuthorityUriFromObject(r)},n.prototype.getHash=function(){return n.parseHash(this.urlString)},n.prototype.getUrlComponents=function(){var u=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(u),n,r;if(!t)throw k.createUrlParseError("Given url string: "+this.urlString);return n={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]},r=n.AbsolutePath.split("/"),r=r.filter(function(n){return n&&n.length>0}),n.PathSegments=r,!i.isEmpty(n.QueryString)&&n.QueryString.endsWith("/")&&(n.QueryString=n.QueryString.substring(0,n.QueryString.length-1)),n},n.getDomainFromUrl=function(n){var i=RegExp("^([^:/?#]+://)?([^/?#]*)"),t=n.match(i);if(!t)throw k.createUrlParseError("Given url string: "+n);return t[2]},n.getAbsoluteUrl=function(t,i){if(t[0]===u.FORWARD_SLASH){var f=new n(i),r=f.getUrlComponents();return r.Protocol+"//"+r.HostNameAndPort+t}return t},n.parseHash=function(n){var t=n.indexOf("#"),i=n.indexOf("#/");return i>-1?n.substring(i+2):t>-1?n.substring(t+1):""},n.constructAuthorityUriFromObject=function(t){return new n(t.Protocol+"//"+t.HostNameAndPort+"/"+t.PathSegments.join("/"))},n.getDeserializedHash=function(t){if(i.isEmpty(t))return{};var u=n.parseHash(t),r=i.queryStringToObject(i.isEmpty(u)?t:u);if(!r)throw f.createHashNotDeserializedError(JSON.stringify(r));return r},n.hashContainsKnownProperties=function(t){if(i.isEmpty(t))return!1;var r=n.getDeserializedHash(t);return!!(r.code||r.error_description||r.error||r.state)},n}(),wr;(function(n){n.SW="sw";n.UHW="uhw"})(wr||(wr={}));var br=function(){function n(n){this.cryptoUtils=n}return n.prototype.generateCnf=function(n){return h(this,void 0,void 0,function(){var t,i;return c(this,function(r){switch(r.label){case 0:return[4,this.cryptoUtils.getPublicKeyThumbprint(n)];case 1:return t=r.sent(),i={kid:t,xms_ksl:wr.SW},[2,this.cryptoUtils.base64Encode(JSON.stringify(i))]}})})},n.prototype.signPopToken=function(n,t){var i;return h(this,void 0,void 0,function(){var u,e,s,h,o,r;return c(this,function(c){switch(c.label){case 0:if(u=ti.extractTokenClaims(n,this.cryptoUtils),e=t.resourceRequestMethod,s=t.resourceRequestUri,h=t.shrClaims,o=s?new b(s):undefined,r=o===null||o===void 0?void 0:o.getUrlComponents(),!((i=u===null||u===void 0?void 0:u.cnf)===null||i===void 0?void 0:i.kid))throw f.createTokenClaimsRequiredError();return[4,this.cryptoUtils.signJwt({at:n,ts:""+g.nowSeconds(),m:e===null||e===void 0?void 0:e.toUpperCase(),u:r===null||r===void 0?void 0:r.HostNameAndPort,nonce:this.cryptoUtils.createNewGuid(),p:r===null||r===void 0?void 0:r.AbsolutePath,q:(r===null||r===void 0?void 0:r.QueryString)?[[],r.QueryString]:undefined,client_claims:h||undefined},u.cnf.kid)];case 1:return[2,c.sent()]}})})},n}(),kr=function(){function n(){}return n.prototype.generateAppMetadataKey=function(){return n.generateAppMetadataCacheKey(this.environment,this.clientId)},n.generateAppMetadataCacheKey=function(n,t){var i=[hr,n,t,];return i.join(at.CACHE_KEY_SEPARATOR).toLowerCase()},n.createAppMetadataEntity=function(t,i,r){var u=new n;return u.clientId=t,u.environment=i,r&&(u.familyId=r),u},n.isAppMetadataEntity=function(n,t){return t?n.indexOf(hr)===0&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("environment"):!1},n}(),yf=function(){function n(n,t){this.cache=n;this.hasChanged=t}return Object.defineProperty(n.prototype,"cacheHasChanged",{get:function(){return this.hasChanged},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"tokenCache",{get:function(){return this.cache},enumerable:!0,configurable:!0}),n}(),pt=function(){function t(n,t,i,r,u,f){this.clientId=n;this.cacheStorage=t;this.cryptoObj=i;this.logger=r;this.serializableCache=u;this.persistencePlugin=f}return t.prototype.validateServerAuthorizationCodeResponse=function(n,t,i){if(!n.state||!t)throw n.state?f.createStateNotFoundError("Cached State"):f.createStateNotFoundError("Server State");if(decodeURIComponent(n.state)!==decodeURIComponent(t))throw f.createStateMismatchError();if(n.error||n.error_description||n.suberror){if(hi.isInteractionRequiredError(n.error,n.error_description,n.suberror))throw new hi(n.error||u.EMPTY_STRING,n.error_description,n.suberror);throw new oi(n.error||u.EMPTY_STRING,n.error_description,n.suberror);}n.client_info&&ou(n.client_info,i)},t.prototype.validateTokenResponse=function(n){if(n.error||n.error_description||n.suberror){if(hi.isInteractionRequiredError(n.error,n.error_description,n.suberror))throw new hi(n.error,n.error_description,n.suberror);var t=n.error_codes+" - ["+n.timestamp+"]: "+n.error_description+" - Correlation ID: "+n.correlation_id+" - Trace ID: "+n.trace_id;throw new oi(n.error,t);}},t.prototype.handleServerTokenResponse=function(n,r,e,o,s,l,a){return h(this,void 0,void 0,function(){var h,p,v,y,w,b;return c(this,function(c){switch(c.label){case 0:if(n.id_token&&(h=new ti(n.id_token||u.EMPTY_STRING,this.cryptoObj),s&&!i.isEmpty(s.nonce)&&h.claims.nonce!==s.nonce))throw f.createNonceMismatchError();this.homeAccountIdentifier=st.generateHomeAccountId(n.client_info||u.EMPTY_STRING,r.authorityType,this.logger,this.cryptoObj,h);!s||!s.state||(p=ci.parseRequestState(this.cryptoObj,s.state));v=this.generateCacheRecord(n,r,e,h,o.scopes,l,s);c.label=1;case 1:return(c.trys.push([1,,4,7]),!(this.persistencePlugin&&this.serializableCache))?[3,3]:(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),y=new yf(this.serializableCache,!0),[4,this.persistencePlugin.beforeCacheAccess(y)]);case 2:c.sent();c.label=3;case 3:return a&&v.account&&(w=v.account.generateAccountKey(),b=this.cacheStorage.getAccount(w),!b)?(this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),[2,t.generateAuthenticationResult(this.cryptoObj,r,v,!1,o,h,p)]):(this.cacheStorage.saveCacheRecord(v),[3,7]);case 4:return(this.persistencePlugin&&this.serializableCache&&y)?(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),[4,this.persistencePlugin.afterCacheAccess(y)]):[3,6];case 5:c.sent();c.label=6;case 6:return[7];case 7:return[2,t.generateAuthenticationResult(this.cryptoObj,r,v,!1,o,h,p)]}})})},t.prototype.generateCacheRecord=function(n,t,r,e,o,s,h){var c=t.getPreferredCache(),p,w,l,v,y;if(i.isEmpty(c))throw f.createInvalidCacheEnvironmentError();if(i.isEmpty(n.id_token)||!e||(p=vr.createIdTokenEntity(this.homeAccountIdentifier,c,n.id_token||u.EMPTY_STRING,this.clientId,e.claims.tid||u.EMPTY_STRING,s),w=this.generateAccountEntity(n,e,t,s,h)),l=null,!i.isEmpty(n.access_token)){var k=n.scope?ht.fromString(n.scope):new ht(o||[]),d=(typeof n.expires_in=="string"?parseInt(n.expires_in,10):n.expires_in)||0,g=(typeof n.ext_expires_in=="string"?parseInt(n.ext_expires_in,10):n.ext_expires_in)||0,a=(typeof n.refresh_in=="string"?parseInt(n.refresh_in,10):n.refresh_in)||undefined,b=r+d,nt=b+g,tt=a&&a>0?r+a:undefined;l=yr.createAccessTokenEntity(this.homeAccountIdentifier,c,n.access_token||u.EMPTY_STRING,this.clientId,e?e.claims.tid||u.EMPTY_STRING:t.tenant,k.printScopes(),b,nt,this.cryptoObj,tt,n.token_type,s)}return v=null,i.isEmpty(n.refresh_token)||(v=pr.createRefreshTokenEntity(this.homeAccountIdentifier,c,n.refresh_token||u.EMPTY_STRING,this.clientId,n.foci,s)),y=null,i.isEmpty(n.foci)||(y=kr.createAppMetadataEntity(this.clientId,c,n.foci)),new vf(w,p,l,v,y)},t.prototype.generateAccountEntity=function(n,t,r,u,e){var h=r.authorityType,o=e?e.cloud_graph_host_name:"",s=e?e.msgraph_host:"";if(h===ni.Adfs)return this.logger.verbose("Authority type is ADFS, creating ADFS account"),st.createGenericAccount(r,this.homeAccountIdentifier,t,u,o,s);if(i.isEmpty(n.client_info)&&r.protocolMode==="AAD")throw f.createClientInfoEmptyError();return n.client_info?st.createAccount(n.client_info,this.homeAccountIdentifier,r,t,u,o,s):st.createGenericAccount(r,this.homeAccountIdentifier,t,u,o,s)},t.generateAuthenticationResult=function(t,i,r,f,e,o,s){var l,a,v;return h(this,void 0,void 0,function(){var h,y,p,b,w,k,d,g;return c(this,function(c){switch(c.label){case 0:return(h="",y=[],p=null,w=u.EMPTY_STRING,!r.accessToken)?[3,4]:(r.accessToken.tokenType===n.AuthenticationScheme.POP)?(k=new br(t),[4,k.signPopToken(r.accessToken.secret,e)]):[3,2];case 1:return h=c.sent(),[3,3];case 2:h=r.accessToken.secret;c.label=3;case 3:y=ht.fromString(r.accessToken.target).asArray();p=new Date(Number(r.accessToken.expiresOn)*1e3);b=new Date(Number(r.accessToken.extendedExpiresOn)*1e3);c.label=4;case 4:return r.appMetadata&&(w=r.appMetadata.familyId===gi?gi:u.EMPTY_STRING),d=(o===null||o===void 0?void 0:o.claims.oid)||(o===null||o===void 0?void 0:o.claims.sub)||u.EMPTY_STRING,g=(o===null||o===void 0?void 0:o.claims.tid)||u.EMPTY_STRING,[2,{authority:i.canonicalAuthority,uniqueId:d,tenantId:g,scopes:y,account:r.account?r.account.getAccountInfo():null,idToken:o?o.rawToken:u.EMPTY_STRING,idTokenClaims:o?o.claims:{},accessToken:h,fromCache:f,expiresOn:p,extExpiresOn:b,familyId:w,tokenType:((l=r.accessToken)===null||l===void 0?void 0:l.tokenType)||u.EMPTY_STRING,state:s?s.userRequestState:u.EMPTY_STRING,cloudGraphHostName:((a=r.account)===null||a===void 0?void 0:a.cloudGraphHostName)||u.EMPTY_STRING,msGraphHost:((v=r.account)===null||v===void 0?void 0:v.msGraphHost)||u.EMPTY_STRING}]}})})},t}(),pf=function(t){function r(n){return t.call(this,n)||this}return nt(r,t),r.prototype.getAuthCodeUrl=function(n){return h(this,void 0,void 0,function(){var t;return c(this,function(){return t=this.createAuthCodeUrlQueryString(n),[2,this.authority.authorizationEndpoint+"?"+t]})})},r.prototype.acquireToken=function(n,t){return h(this,void 0,void 0,function(){var e,r,u;return c(this,function(o){switch(o.label){case 0:if(this.logger.info("in acquireToken call"),!n||i.isEmpty(n.code))throw f.createTokenRequestCannotBeMadeError();return e=g.nowSeconds(),[4,this.executeTokenRequest(this.authority,n)];case 1:return r=o.sent(),u=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin),u.validateTokenResponse(r.body),[4,u.handleServerTokenResponse(r.body,this.authority,e,n,t)];case 2:return[2,o.sent()]}})})},r.prototype.handleFragmentResponse=function(n,t){var r=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null),u=new b(n),i=b.getDeserializedHash(u.getHash());if(r.validateServerAuthorizationCodeResponse(i,t,this.cryptoUtils),!i.code)throw f.createNoAuthCodeInServerResponseError();return et(et({},i),{code:i.code})},r.prototype.getLogoutUri=function(n){if(!n)throw k.createEmptyLogoutRequestError();n.account?this.cacheManager.removeAccount(st.generateAccountCacheKey(n.account)):this.cacheManager.clear();var t=this.createLogoutUrlQueryString(n);return i.isEmpty(t)?this.authority.endSessionEndpoint:this.authority.endSessionEndpoint+"?"+t},r.prototype.executeTokenRequest=function(n,t){return h(this,void 0,void 0,function(){var u,f,r,e,o;return c(this,function(s){switch(s.label){case 0:return u={clientId:this.config.authOptions.clientId,authority:n.canonicalAuthority,scopes:t.scopes},[4,this.createTokenRequestBody(t)];case 1:return f=s.sent(),r=this.createTokenQueryParameters(t),e=this.createDefaultTokenRequestHeaders(),o=i.isEmpty(r)?n.tokenEndpoint:n.tokenEndpoint+"?"+r,[2,this.executePostToTokenEndpoint(o,f,e,u)]}})})},r.prototype.createTokenQueryParameters=function(n){var t=new ct;return n.tokenQueryParameters&&t.addExtraQueryParameters(n.tokenQueryParameters),t.createQueryString()},r.prototype.createTokenRequestBody=function(t){return h(this,void 0,void 0,function(){var r,u,f,e,o;return c(this,function(s){switch(s.label){case 0:return(r=new ct,r.addClientId(this.config.authOptions.clientId),r.addRedirectUri(t.redirectUri),r.addScopes(t.scopes),r.addAuthorizationCode(t.code),t.codeVerifier&&r.addCodeVerifier(t.codeVerifier),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(u=this.config.clientCredentials.clientAssertion,r.addClientAssertion(u.assertion),r.addClientAssertionType(u.assertionType)),r.addGrantType(gt.AUTHORIZATION_CODE_GRANT),r.addClientInfo(),!(t.authenticationScheme===n.AuthenticationScheme.POP))?[3,2]:(f=new br(this.cryptoUtils),[4,f.generateCnf(t)]);case 1:e=s.sent();r.addPopToken(e);s.label=2;case 2:return o=t.correlationId||this.config.cryptoInterface.createNewGuid(),r.addCorrelationId(o),(!i.isEmpty(t.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(t.claims,this.config.authOptions.clientCapabilities),[2,r.createQueryString()]}})})},r.prototype.createAuthCodeUrlQueryString=function(n){var t=new ct,u,f,r;return t.addClientId(this.config.authOptions.clientId),u=bi(n.scopes||[],n.extraScopesToConsent||[]),t.addScopes(u),t.addRedirectUri(n.redirectUri),f=n.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(f),t.addResponseMode(n.responseMode),t.addResponseTypeCode(),t.addLibraryInfo(this.config.libraryInfo),t.addClientInfo(),n.codeChallenge&&n.codeChallengeMethod&&t.addCodeChallengeParams(n.codeChallenge,n.codeChallengeMethod),n.prompt&&t.addPrompt(n.prompt),n.domainHint&&t.addDomainHint(n.domainHint),n.prompt!==lt.SELECT_ACCOUNT?n.sid&&n.prompt===lt.NONE?(this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),t.addSid(n.sid)):n.account?(r=this.extractAccountSid(n.account),r&&n.prompt===lt.NONE?(this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),t.addSid(r)):n.loginHint?(this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),t.addLoginHint(n.loginHint)):n.account.username&&(this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),t.addLoginHint(n.account.username))):n.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),t.addLoginHint(n.loginHint)):this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints"),n.nonce&&t.addNonce(n.nonce),n.state&&t.addState(n.state),(!i.isEmpty(n.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(n.claims,this.config.authOptions.clientCapabilities),n.extraQueryParameters&&t.addExtraQueryParameters(n.extraQueryParameters),t.createQueryString()},r.prototype.createLogoutUrlQueryString=function(n){var t=new ct;return n.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(n.postLogoutRedirectUri),n.correlationId&&t.addCorrelationId(n.correlationId),n.idTokenHint&&t.addIdTokenHint(n.idTokenHint),t.createQueryString()},r.prototype.extractAccountSid=function(n){if(n.idTokenClaims){var t=n.idTokenClaims;return t.sid||null}return null},r}(fi),io=function(n){function t(t){return n.call(this,t)||this}return nt(t,n),t.prototype.acquireToken=function(n){return h(this,void 0,void 0,function(){var t,u,i,r;return c(this,function(f){switch(f.label){case 0:return[4,this.getDeviceCode(n)];case 1:return t=f.sent(),n.deviceCodeCallback(t),u=g.nowSeconds(),[4,this.acquireTokenWithDeviceCode(n,t)];case 2:return i=f.sent(),r=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin),r.validateTokenResponse(i),[4,r.handleServerTokenResponse(i,this.authority,u,n)];case 3:return[2,f.sent()]}})})},t.prototype.getDeviceCode=function(n){return h(this,void 0,void 0,function(){var t,i,r;return c(this,function(){return t=this.createQueryString(n),i=this.createDefaultTokenRequestHeaders(),r={clientId:this.config.authOptions.clientId,authority:n.authority,scopes:n.scopes},[2,this.executePostRequestToDeviceCodeEndpoint(this.authority.deviceCodeEndpoint,t,i,r)]})})},t.prototype.executePostRequestToDeviceCodeEndpoint=function(n,t,i,r){return h(this,void 0,void 0,function(){var u,f,e,o,s,h,l;return c(this,function(c){switch(c.label){case 0:return[4,this.networkManager.sendPostRequest(r,n,{body:t,headers:i})];case 1:return u=c.sent().body,f=u.user_code,e=u.device_code,o=u.verification_uri,s=u.expires_in,h=u.interval,l=u.message,[2,{userCode:f,deviceCode:e,verificationUri:o,expiresIn:s,interval:h,message:l}]}})})},t.prototype.createQueryString=function(n){var t=new ct;return t.addScopes(n.scopes),t.addClientId(this.config.authOptions.clientId),(!i.isEmpty(n.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(n.claims,this.config.authOptions.clientCapabilities),t.createQueryString()},t.prototype.acquireTokenWithDeviceCode=function(n,t){return h(this,void 0,void 0,function(){var e,o,i,r,s,l=this;return c(this,function(){return e=this.createTokenRequestBody(n,t),o=this.createDefaultTokenRequestHeaders(),i=n.timeout?g.nowSeconds()+n.timeout:undefined,r=g.nowSeconds()+t.expiresIn,s=t.interval*1e3,[2,new Promise(function(t,a){var v=setInterval(function(){return h(l,void 0,void 0,function(){var h,s,l;return c(this,function(c){switch(c.label){case 0:return(c.trys.push([0,6,,7]),!n.cancel)?[3,1]:(this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true"),clearInterval(v),a(f.createDeviceCodeCancelledError()),[3,5]);case 1:return(i&&i<r&&g.nowSeconds()>i)?(this.logger.error("User defined timeout for device code polling reached. The timeout was set for "+i),clearInterval(v),a(f.createUserTimeoutReachedError()),[3,5]):[3,2];case 2:return(g.nowSeconds()>r)?(i&&this.logger.verbose("User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for "+i),this.logger.error("Device code expired. Expiration time of device code was "+r),clearInterval(v),a(f.createDeviceCodeExpiredError()),[3,5]):[3,3];case 3:return h={clientId:this.config.authOptions.clientId,authority:n.authority,scopes:n.scopes},[4,this.executePostToTokenEndpoint(this.authority.tokenEndpoint,e,o,h)];case 4:s=c.sent();s.body&&s.body.error===u.AUTHORIZATION_PENDING?this.logger.info(s.body.error_description||"no_error_description"):(clearInterval(v),t(s.body));c.label=5;case 5:return[3,7];case 6:return l=c.sent(),clearInterval(v),a(l),[3,7];case 7:return[2]}})})},s)})]})})},t.prototype.createTokenRequestBody=function(n,t){var r=new ct,u;return r.addScopes(n.scopes),r.addClientId(this.config.authOptions.clientId),r.addGrantType(gt.DEVICE_CODE_GRANT),r.addDeviceCode(t.deviceCode),u=n.correlationId||this.config.cryptoInterface.createNewGuid(),r.addCorrelationId(u),r.addClientInfo(),(!i.isEmpty(n.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(n.claims,this.config.authOptions.clientCapabilities),r.createQueryString()},t}(fi),cu=function(r){function u(n){return r.call(this,n)||this}return nt(u,r),u.prototype.acquireToken=function(n){return h(this,void 0,void 0,function(){var r,t,i;return c(this,function(u){switch(u.label){case 0:return r=g.nowSeconds(),[4,this.executeTokenRequest(n,this.authority)];case 1:return t=u.sent(),i=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin),i.validateTokenResponse(t.body),[2,i.handleServerTokenResponse(t.body,this.authority,r,n,undefined,undefined,!0)]}})})},u.prototype.acquireTokenByRefreshToken=function(n){return h(this,void 0,void 0,function(){var i,r,u;return c(this,function(){if(!n)throw k.createEmptyTokenRequestError();if(!n.account)throw f.createNoAccountInSilentRequestError();if(i=this.cacheManager.isAppMetadataFOCI(n.account.environment,this.config.authOptions.clientId),i)try{return[2,this.acquireTokenWithCachedRefreshToken(n,!0)]}catch(e){if(r=e instanceof f&&e.errorCode===t.noTokensFoundError.code,u=e instanceof oi&&e.errorCode===cr.INVALID_GRANT_ERROR&&e.subError===cr.CLIENT_MISMATCH_ERROR,r||u)return[2,this.acquireTokenWithCachedRefreshToken(n,!1)];throw e;}return[2,this.acquireTokenWithCachedRefreshToken(n,!1)]})})},u.prototype.acquireTokenWithCachedRefreshToken=function(t,i){return h(this,void 0,void 0,function(){var r,u;return c(this,function(){if(r=this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId,t.account,i),!r)throw f.createNoTokensFoundError();return u=et(et({},t),{refreshToken:r.secret,authenticationScheme:t.authenticationScheme||n.AuthenticationScheme.BEARER}),[2,this.acquireToken(u)]})})},u.prototype.executeTokenRequest=function(n,t){return h(this,void 0,void 0,function(){var u,r,f,e,o;return c(this,function(s){switch(s.label){case 0:return[4,this.createTokenRequestBody(n)];case 1:return u=s.sent(),r=this.createTokenQueryParameters(n),f=this.createDefaultTokenRequestHeaders(),e={clientId:this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:n.scopes},o=i.isEmpty(r)?t.tokenEndpoint:t.tokenEndpoint+"?"+r,[2,this.executePostToTokenEndpoint(o,u,f,e)]}})})},u.prototype.createTokenQueryParameters=function(n){var t=new ct;return n.tokenQueryParameters&&t.addExtraQueryParameters(n.tokenQueryParameters),t.createQueryString()},u.prototype.createTokenRequestBody=function(t){return h(this,void 0,void 0,function(){var r,f,u,e,o,s;return c(this,function(h){switch(h.label){case 0:return(r=new ct,r.addClientId(this.config.authOptions.clientId),r.addScopes(t.scopes),r.addGrantType(gt.REFRESH_TOKEN_GRANT),r.addClientInfo(),f=t.correlationId||this.config.cryptoInterface.createNewGuid(),r.addCorrelationId(f),r.addRefreshToken(t.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(u=this.config.clientCredentials.clientAssertion,r.addClientAssertion(u.assertion),r.addClientAssertionType(u.assertionType)),!(t.authenticationScheme===n.AuthenticationScheme.POP))?[3,2]:(e=new br(this.cryptoUtils),s=(o=r).addPopToken,[4,e.generateCnf(t)]);case 1:s.apply(o,[h.sent()]);h.label=2;case 2:return(!i.isEmpty(t.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(t.claims,this.config.authOptions.clientCapabilities),[2,r.createQueryString()]}})})},u}(fi),ro=function(n){function t(t){return n.call(this,t)||this}return nt(t,n),t.prototype.acquireToken=function(n){return h(this,void 0,void 0,function(){var t;return c(this,function(i){switch(i.label){case 0:return(this.scopeSet=new ht(n.scopes||[]),!n.skipCache)?[3,2]:[4,this.executeTokenRequest(n,this.authority)];case 1:return[2,i.sent()];case 2:return[4,this.getCachedAuthenticationResult(n)];case 3:return(t=i.sent(),!t)?[3,4]:[2,t];case 4:return[4,this.executeTokenRequest(n,this.authority)];case 5:return[2,i.sent()]}})})},t.prototype.getCachedAuthenticationResult=function(n){return h(this,void 0,void 0,function(){var t;return c(this,function(i){switch(i.label){case 0:return(t=this.readAccessTokenFromCache(),!t||g.isTokenExpired(t.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))?[2,null]:[4,pt.generateAuthenticationResult(this.cryptoUtils,this.authority,{account:null,idToken:null,accessToken:t,refreshToken:null,appMetadata:null},!0,n)];case 1:return[2,i.sent()]}})})},t.prototype.readAccessTokenFromCache=function(){var i={homeAccountId:"",environment:this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,credentialType:l.ACCESS_TOKEN,clientId:this.config.authOptions.clientId,realm:this.authority.tenant,target:this.scopeSet.printScopesLowerCase()},t=this.cacheManager.getCredentialsFilteredBy(i),n=Object.keys(t.accessTokens).map(function(n){return t.accessTokens[n]});if(n.length<1)return null;if(n.length>1)throw f.createMultipleMatchingTokensInCacheError();return n[0]},t.prototype.executeTokenRequest=function(n,t){return h(this,void 0,void 0,function(){var u,f,e,o,i,r,s;return c(this,function(h){switch(h.label){case 0:return u=this.createTokenRequestBody(n),f=this.createDefaultTokenRequestHeaders(),e={clientId:this.config.authOptions.clientId,authority:n.authority,scopes:n.scopes},o=g.nowSeconds(),[4,this.executePostToTokenEndpoint(t.tokenEndpoint,u,f,e)];case 1:return i=h.sent(),r=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin),r.validateTokenResponse(i.body),[4,r.handleServerTokenResponse(i.body,this.authority,o,n)];case 2:return s=h.sent(),[2,s]}})})},t.prototype.createTokenRequestBody=function(n){var t=new ct,u,r;return t.addClientId(this.config.authOptions.clientId),t.addScopes(n.scopes,!1),t.addGrantType(gt.CLIENT_CREDENTIALS_GRANT),u=n.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(u),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(r=this.config.clientCredentials.clientAssertion,t.addClientAssertion(r.assertion),t.addClientAssertionType(r.assertionType)),(!i.isEmpty(n.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(n.claims,this.config.authOptions.clientCapabilities),t.createQueryString()},t}(fi),uo=function(n){function t(t){return n.call(this,t)||this}return nt(t,n),t.prototype.acquireToken=function(n){return h(this,void 0,void 0,function(){var t;return c(this,function(i){switch(i.label){case 0:return(this.scopeSet=new ht(n.scopes||[]),!n.skipCache)?[3,2]:[4,this.executeTokenRequest(n,this.authority)];case 1:return[2,i.sent()];case 2:return[4,this.getCachedAuthenticationResult(n)];case 3:return(t=i.sent(),!t)?[3,4]:[2,t];case 4:return[4,this.executeTokenRequest(n,this.authority)];case 5:return[2,i.sent()]}})})},t.prototype.getCachedAuthenticationResult=function(n){return h(this,void 0,void 0,function(){var r,t,i,f,e,o;return c(this,function(s){switch(s.label){case 0:return(r=this.readAccessTokenFromCache(n),!r||g.isTokenExpired(r.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))?[2,null]:(t=this.readIdTokenFromCache(n),f=null,t&&(i=new ti(t.secret,this.config.cryptoInterface),e=i.claims.oid?i.claims.oid:i.claims.sub,o={homeAccountId:t.homeAccountId,environment:t.environment,tenantId:t.realm,username:u.EMPTY_STRING,localAccountId:e||""},f=this.readAccountFromCache(o)),[4,pt.generateAuthenticationResult(this.cryptoUtils,this.authority,{account:f,accessToken:r,idToken:t,refreshToken:null,appMetadata:null},!0,n,i)]);case 1:return[2,s.sent()]}})})},t.prototype.readAccessTokenFromCache=function(n){var u={environment:this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,credentialType:l.ACCESS_TOKEN,clientId:this.config.authOptions.clientId,realm:this.authority.tenant,target:this.scopeSet.printScopesLowerCase(),oboAssertion:n.oboAssertion},t=this.cacheManager.getCredentialsFilteredBy(u),i=Object.keys(t.accessTokens).map(function(n){return t.accessTokens[n]}),r=i.length;if(r<1)return null;if(r>1)throw f.createMultipleMatchingTokensInCacheError();return i[0]},t.prototype.readIdTokenFromCache=function(n){var r={environment:this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,credentialType:l.ID_TOKEN,clientId:this.config.authOptions.clientId,realm:this.authority.tenant,oboAssertion:n.oboAssertion},t=this.cacheManager.getCredentialsFilteredBy(r),i=Object.keys(t.idTokens).map(function(n){return t.idTokens[n]});return i.length<1?null:i[0]},t.prototype.readAccountFromCache=function(n){return this.cacheManager.readAccountFromCache(n)},t.prototype.executeTokenRequest=function(n,t){return h(this,void 0,void 0,function(){var u,f,e,o,i,r,s;return c(this,function(h){switch(h.label){case 0:return u=this.createTokenRequestBody(n),f=this.createDefaultTokenRequestHeaders(),e={clientId:this.config.authOptions.clientId,authority:n.authority,scopes:n.scopes},o=g.nowSeconds(),[4,this.executePostToTokenEndpoint(t.tokenEndpoint,u,f,e)];case 1:return i=h.sent(),r=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin),r.validateTokenResponse(i.body),[4,r.handleServerTokenResponse(i.body,this.authority,o,n)];case 2:return s=h.sent(),[2,s]}})})},t.prototype.createTokenRequestBody=function(n){var t=new ct,r,i;return t.addClientId(this.config.authOptions.clientId),t.addScopes(n.scopes),t.addGrantType(gt.JWT_BEARER),t.addClientInfo(),r=n.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(r),t.addRequestTokenUse(a.ON_BEHALF_OF),t.addOboAssertion(n.oboAssertion),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion&&(i=this.config.clientCredentials.clientAssertion,t.addClientAssertion(i.assertion),t.addClientAssertionType(i.assertionType)),t.createQueryString()},t}(fi),wf=function(i){function r(n){return i.call(this,n)||this}return nt(r,i),r.prototype.acquireToken=function(n){return h(this,void 0,void 0,function(){var i,r;return c(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,this.acquireCachedToken(n)];case 1:return[2,u.sent()];case 2:if(i=u.sent(),i instanceof f&&i.errorCode===t.tokenRefreshRequired.code)return r=new cu(this.config),[2,r.acquireTokenByRefreshToken(n)];throw i;case 3:return[2]}})})},r.prototype.acquireCachedToken=function(t){return h(this,void 0,void 0,function(){var r,u,e,i;return c(this,function(o){switch(o.label){case 0:if(!t)throw k.createEmptyTokenRequestError();if(!t.account)throw f.createNoAccountInSilentRequestError();if(r=new ht(t.scopes||[]),u=t.authority||this.authority.getPreferredCache(),e=t.authenticationScheme||n.AuthenticationScheme.BEARER,i=this.cacheManager.readCacheRecord(t.account,this.config.authOptions.clientId,r,u,e),t.forceRefresh||t.claims||!i.accessToken||g.isTokenExpired(i.accessToken.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds)||i.accessToken.refreshOn&&g.isTokenExpired(i.accessToken.refreshOn,0))throw f.createRefreshRequiredError();return this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[4,this.generateResultFromCacheRecord(i,t)];case 1:return[2,o.sent()]}})})},r.prototype.generateResultFromCacheRecord=function(n,t){return h(this,void 0,void 0,function(){var i;return c(this,function(r){switch(r.label){case 0:return n.idToken&&(i=new ti(n.idToken.secret,this.config.cryptoInterface)),[4,pt.generateAuthenticationResult(this.cryptoUtils,this.authority,n,!0,t,i)];case 1:return[2,r.sent()]}})})},r}(fi),fo=function(n){function t(t){return n.call(this,t)||this}return nt(t,n),t.prototype.acquireToken=function(n){return h(this,void 0,void 0,function(){var r,t,i,u;return c(this,function(f){switch(f.label){case 0:return this.logger.info("in acquireToken call"),r=g.nowSeconds(),[4,this.executeTokenRequest(this.authority,n)];case 1:return t=f.sent(),i=new pt(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin),i.validateTokenResponse(t.body),u=i.handleServerTokenResponse(t.body,this.authority,r,n),[2,u]}})})},t.prototype.executeTokenRequest=function(n,t){return h(this,void 0,void 0,function(){var i,r,u;return c(this,function(){return i={clientId:this.config.authOptions.clientId,authority:n.canonicalAuthority,scopes:t.scopes},r=this.createTokenRequestBody(t),u=this.createDefaultTokenRequestHeaders(),[2,this.executePostToTokenEndpoint(n.tokenEndpoint,r,u,i)]})})},t.prototype.createTokenRequestBody=function(n){var t=new ct,r;return t.addClientId(this.config.authOptions.clientId),t.addUsername(n.username),t.addPassword(n.password),t.addScopes(n.scopes),t.addGrantType(gt.RESOURCE_OWNER_PASSWORD_GRANT),t.addClientInfo(),r=n.correlationId||this.config.cryptoInterface.createNewGuid(),t.addCorrelationId(r),(!i.isEmpty(n.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(n.claims,this.config.authOptions.clientCapabilities),t.createQueryString()},t}(fi);(function(n){n.AAD="AAD";n.OIDC="OIDC"})(n.ProtocolMode||(n.ProtocolMode={}));rr=function(){function n(){this.expiresAt=g.nowSeconds()+yi.REFRESH_TIME_SECONDS}return n.prototype.updateCloudDiscoveryMetadata=function(n,t){this.aliases=n.aliases;this.preferred_cache=n.preferred_cache;this.preferred_network=n.preferred_network;this.aliasesFromNetwork=t},n.prototype.updateEndpointMetadata=function(n,t){this.authorization_endpoint=n.authorization_endpoint;this.token_endpoint=n.token_endpoint;this.end_session_endpoint=n.end_session_endpoint;this.issuer=n.issuer;this.endpointsFromNetwork=t},n.prototype.updateCanonicalAuthority=function(n){this.canonical_authority=n},n.prototype.resetExpiresAt=function(){this.expiresAt=g.nowSeconds()+yi.REFRESH_TIME_SECONDS},n.prototype.isExpired=function(){return this.expiresAt<=g.nowSeconds()},n.isAuthorityMetadataEntity=function(n,t){return t?n.indexOf(yi.CACHE_KEY)===0&&t.hasOwnProperty("aliases")&&t.hasOwnProperty("preferred_cache")&&t.hasOwnProperty("preferred_network")&&t.hasOwnProperty("canonical_authority")&&t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("end_session_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("aliasesFromNetwork")&&t.hasOwnProperty("endpointsFromNetwork")&&t.hasOwnProperty("expiresAt"):!1},n}();var df=function(){function t(n,t,i,r){this.canonicalAuthority=n;this._canonicalAuthority.validateAsUri();this.networkInterface=t;this.cacheManager=i;this.authorityOptions=r}return Object.defineProperty(t.prototype,"authorityType",{get:function(){var n=this.canonicalAuthorityUrlComponents.PathSegments;return n.length&&n[0].toLowerCase()===u.ADFS?ni.Adfs:ni.Default},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"protocolMode",{get:function(){return this.authorityOptions.protocolMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.authorityOptions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canonicalAuthority",{get:function(){return this._canonicalAuthority.urlString},set:function(n){this._canonicalAuthority=new b(n);this._canonicalAuthority.validateAsUri();this._canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canonicalAuthorityUrlComponents",{get:function(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hostnameAndPort",{get:function(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tenant",{get:function(){return this.canonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"authorizationEndpoint",{get:function(){if(this.discoveryComplete()){var n=this.replacePath(this.metadata.authorization_endpoint);return this.replaceTenant(n)}throw f.createEndpointDiscoveryIncompleteError("Discovery incomplete.");},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tokenEndpoint",{get:function(){if(this.discoveryComplete()){var n=this.replacePath(this.metadata.token_endpoint);return this.replaceTenant(n)}throw f.createEndpointDiscoveryIncompleteError("Discovery incomplete.");},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"deviceCodeEndpoint",{get:function(){if(this.discoveryComplete()){var n=this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));return this.replaceTenant(n)}throw f.createEndpointDiscoveryIncompleteError("Discovery incomplete.");},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"endSessionEndpoint",{get:function(){if(this.discoveryComplete()){var n=this.replacePath(this.metadata.end_session_endpoint);return this.replaceTenant(n)}throw f.createEndpointDiscoveryIncompleteError("Discovery incomplete.");},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selfSignedJwtAudience",{get:function(){if(this.discoveryComplete()){var n=this.replacePath(this.metadata.issuer);return this.replaceTenant(n)}throw f.createEndpointDiscoveryIncompleteError("Discovery incomplete.");},enumerable:!0,configurable:!0}),t.prototype.replaceTenant=function(n){return n.replace(/{tenant}|{tenantid}/g,this.tenant)},t.prototype.replacePath=function(n){var t=n,i=new b(this.metadata.canonical_authority),r=i.getUrlComponents().PathSegments,u=this.canonicalAuthorityUrlComponents.PathSegments;return u.forEach(function(n,i){var u=r[i];n!==u&&(t=t.replace("/"+u+"/","/"+n+"/"))}),t},Object.defineProperty(t.prototype,"defaultOpenIdConfigurationEndpoint",{get:function(){return this.authorityType===ni.Adfs||this.protocolMode===n.ProtocolMode.OIDC?this.canonicalAuthority+".well-known/openid-configuration":this.canonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!0,configurable:!0}),t.prototype.discoveryComplete=function(){return!!this.metadata},t.prototype.resolveEndpointsAsync=function(){return h(this,void 0,void 0,function(){var n,t,i,r;return c(this,function(u){switch(u.label){case 0:return n=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort),n||(n=new rr,n.updateCanonicalAuthority(this.canonicalAuthority)),[4,this.updateCloudDiscoveryMetadata(n)];case 1:return t=u.sent(),this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,n.preferred_network),[4,this.updateEndpointMetadata(n)];case 2:return i=u.sent(),t!==vt.CACHE&&i!==vt.CACHE&&(n.resetExpiresAt(),n.updateCanonicalAuthority(this.canonicalAuthority)),r=this.cacheManager.generateAuthorityMetadataCacheKey(n.preferred_cache),this.cacheManager.setAuthorityMetadata(r,n),this.metadata=n,[2]}})})},t.prototype.updateEndpointMetadata=function(n){return h(this,void 0,void 0,function(){var t;return c(this,function(i){switch(i.label){case 0:return(t=this.getEndpointMetadataFromConfig(),t)?(n.updateEndpointMetadata(t,!1),[2,vt.CONFIG]):this.isAuthoritySameType(n)&&n.endpointsFromNetwork&&!n.isExpired()?[2,vt.CACHE]:[4,this.getEndpointMetadataFromNetwork()];case 1:if(t=i.sent(),t)return n.updateEndpointMetadata(t,!0),[2,vt.NETWORK];throw f.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);}})})},t.prototype.isAuthoritySameType=function(n){var t=new b(n.canonical_authority),i=t.getUrlComponents().PathSegments;return i.length===this.canonicalAuthorityUrlComponents.PathSegments.length},t.prototype.getEndpointMetadataFromConfig=function(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch(n){throw k.createInvalidAuthorityMetadataError();}return null},t.prototype.getEndpointMetadataFromNetwork=function(){return h(this,void 0,void 0,function(){var n,t;return c(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint)];case 1:return n=i.sent(),[2,bf(n.body)?n.body:null];case 2:return t=i.sent(),[2,null];case 3:return[2]}})})},t.prototype.updateCloudDiscoveryMetadata=function(n){return h(this,void 0,void 0,function(){var t;return c(this,function(i){switch(i.label){case 0:return(t=this.getCloudDiscoveryMetadataFromConfig(),t)?(n.updateCloudDiscoveryMetadata(t,!1),[2,vt.CONFIG]):this.isAuthoritySameType(n)&&n.aliasesFromNetwork&&!n.isExpired()?[2,vt.CACHE]:[4,this.getCloudDiscoveryMetadataFromNetwork()];case 1:if(t=i.sent(),t)return n.updateCloudDiscoveryMetadata(t,!0),[2,vt.NETWORK];throw k.createUntrustedAuthorityError();}})})},t.prototype.getCloudDiscoveryMetadataFromConfig=function(){if(this.authorityOptions.cloudDiscoveryMetadata)try{var i=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=t.getCloudDiscoveryMetadataFromNetworkResponse(i.metadata,this.hostnameAndPort);if(n)return n}catch(r){throw k.createInvalidCloudDiscoveryMetadataError();}return this.isInKnownAuthorities()?t.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort):null},t.prototype.getCloudDiscoveryMetadataFromNetwork=function(){return h(this,void 0,void 0,function(){var r,n,i,f,e;return c(this,function(o){switch(o.label){case 0:r=""+u.AAD_INSTANCE_DISCOVERY_ENDPT+this.canonicalAuthority+"oauth2/v2.0/authorize";n=null;o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.networkInterface.sendGetRequestAsync(r)];case 2:return i=o.sent(),f=kf(i.body)?i.body.metadata:[],n=t.getCloudDiscoveryMetadataFromNetworkResponse(f,this.hostnameAndPort),[3,4];case 3:return e=o.sent(),[2,null];case 4:return n||(n=t.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),[2,n]}})})},t.prototype.isInKnownAuthorities=function(){var n=this,t=this.authorityOptions.knownAuthorities.filter(function(t){return b.getDomainFromUrl(t).toLowerCase()===n.hostnameAndPort});return t.length>0},t.createCloudDiscoveryMetadataFromHost=function(n){return{preferred_network:n,preferred_cache:n,aliases:[n]}},t.getCloudDiscoveryMetadataFromNetworkResponse=function(n,t){for(var r,i=0;i<n.length;i++)if(r=n[i],r.aliases.indexOf(t)>-1)return r;return null},t.prototype.getPreferredCache=function(){if(this.discoveryComplete())return this.metadata.preferred_cache;throw f.createEndpointDiscoveryIncompleteError("Discovery incomplete.");},t.prototype.isAlias=function(n){return this.metadata.aliases.indexOf(n)>-1},t}(),dr=function(){function n(){}return n.createDiscoveredInstance=function(t,i,r,u){return h(this,void 0,void 0,function(){var e,o;return c(this,function(s){switch(s.label){case 0:e=n.createInstance(t,i,r,u);s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e.resolveEndpointsAsync()];case 2:return s.sent(),[2,e];case 3:o=s.sent();throw f.createEndpointDiscoveryIncompleteError(o);case 4:return[2]}})})},n.createInstance=function(n,t,r,u){if(i.isEmpty(n))throw k.createUrlEmptyError();return new df(n,t,r,u)},n}(),ur=function(){function n(){this.failedRequests=[];this.errors=[];this.cacheHits=0}return n.isServerTelemetryEntity=function(n,t){var r=n.indexOf(tt.CACHE_KEY)===0,i=!0;return t&&(i=t.hasOwnProperty("failedRequests")&&t.hasOwnProperty("errors")&&t.hasOwnProperty("cacheHits")),r&&i},n}(),lu=function(){function n(){}return n.isThrottlingEntity=function(n,t){var r=!1,i;return n&&(r=n.indexOf(pi.THROTTLING_PREFIX)===0),i=!0,t&&(i=t.hasOwnProperty("throttleTime")),r&&i},n}(),gf={sendGetRequestAsync:function(){return Promise.reject(v.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented for the Network interface."))},sendPostRequestAsync:function(){return Promise.reject(v.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented for the Network interface."))}},ne=function(){function n(n,t){this.cacheManager=t;this.apiId=n.apiId;this.correlationId=n.correlationId;this.forceRefresh=n.forceRefresh||!1;this.wrapperSKU=n.wrapperSKU||u.EMPTY_STRING;this.wrapperVer=n.wrapperVer||u.EMPTY_STRING;this.telemetryCacheKey=tt.CACHE_KEY+at.CACHE_KEY_SEPARATOR+n.clientId}return n.prototype.generateCurrentRequestHeaderValue=function(){var n=this.forceRefresh?1:0,t=""+this.apiId+tt.VALUE_SEPARATOR+n,i=[this.wrapperSKU,this.wrapperVer].join(tt.VALUE_SEPARATOR);return[tt.SCHEMA_VERSION,t,i].join(tt.CATEGORY_SEPARATOR)},n.prototype.generateLastRequestHeaderValue=function(){var t=this.getLastRequests(),i=n.maxErrorsToSend(t),u=t.failedRequests.slice(0,2*i).join(tt.VALUE_SEPARATOR),f=t.errors.slice(0,i).join(tt.VALUE_SEPARATOR),r=t.errors.length,e=i<r?tt.OVERFLOW_TRUE:tt.OVERFLOW_FALSE,o=[r,e].join(tt.VALUE_SEPARATOR);return[tt.SCHEMA_VERSION,t.cacheHits,u,f,o].join(tt.CATEGORY_SEPARATOR)},n.prototype.cacheFailedRequest=function(n){var t=this.getLastRequests();t.failedRequests.push(this.apiId,this.correlationId);i.isEmpty(n.subError)?i.isEmpty(n.errorCode)?!!n&&n.toString()?t.errors.push(n.toString()):t.errors.push(tt.UNKNOWN_ERROR):t.errors.push(n.errorCode):t.errors.push(n.subError);this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t);return},n.prototype.incrementCacheHits=function(){var n=this.getLastRequests();return n.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n),n.cacheHits},n.prototype.getLastRequests=function(){var n=new ur,t=this.cacheManager.getServerTelemetry(this.telemetryCacheKey);return t||n},n.prototype.clearTelemetryCache=function(){var t=this.getLastRequests(),r=n.maxErrorsToSend(t),u=t.errors.length,i;r===u?this.cacheManager.removeItem(this.telemetryCacheKey):(i=new ur,i.failedRequests=t.failedRequests.slice(r*2),i.errors=t.errors.slice(r),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i))},n.maxErrorsToSend=function(n){for(var i=0,r=0,f=n.errors.length,t=0;t<f;t++){var e=n.failedRequests[2*t]||u.EMPTY_STRING,o=n.failedRequests[2*t+1]||u.EMPTY_STRING,s=n.errors[t]||u.EMPTY_STRING;if(r+=e.toString().length+o.toString().length+s.length+3,r<tt.MAX_HEADER_BYTES)i+=1;else break}return i},n}(),rt={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",POLL_INTERVAL_MS:50,MSAL_SKU:"msal.js.browser"};(function(n){n.LocalStorage="localStorage";n.SessionStorage="sessionStorage";n.MemoryStorage="memoryStorage"})(n.BrowserCacheLocation||(n.BrowserCacheLocation={})),function(n){n.GET="GET";n.POST="POST"}(wt||(wt={})),function(n){n.AUTHORITY="authority";n.ACQUIRE_TOKEN_ACCOUNT="acquireToken.account";n.SESSION_STATE="session.state";n.REQUEST_STATE="request.state";n.NONCE_IDTOKEN="nonce.id_token";n.ORIGIN_URI="request.origin";n.RENEW_STATUS="token.renew.status";n.URL_HASH="urlHash";n.REQUEST_PARAMS="request.params";n.SCOPES="scopes";n.INTERACTION_STATUS_KEY="interaction.status"}(p||(p={})),function(n){n[n.acquireTokenRedirect=861]="acquireTokenRedirect";n[n.acquireTokenPopup=862]="acquireTokenPopup";n[n.ssoSilent=863]="ssoSilent";n[n.acquireTokenSilent_authCode=864]="acquireTokenSilent_authCode";n[n.handleRedirectPromise=865]="handleRedirectPromise";n[n.acquireTokenSilent_silentFlow=61]="acquireTokenSilent_silentFlow";n[n.logout=961]="logout";n[n.logoutPopup=962]="logoutPopup"}(n.ApiId||(n.ApiId={})),function(n){n.Redirect="redirect";n.Popup="popup";n.Silent="silent"}(n.InteractionType||(n.InteractionType={})),function(n){n.Startup="startup";n.Login="login";n.Logout="logout";n.AcquireToken="acquireToken";n.SsoSilent="ssoSilent";n.HandleRedirect="handleRedirect";n.None="none"}(n.InteractionStatus||(n.InteractionStatus={}));gr={scopes:or};li="jwk",function(n){n.React="@azure/msal-react";n.Angular="@azure/msal-angular"}(n.WrapperSKU||(n.WrapperSKU={}));var it=function(){function n(){}return n.decimalToHex=function(n){for(var t=n.toString(16);t.length<2;)t="0"+t;return t},n}(),te=function(){function n(n){this.cryptoObj=n}return n.prototype.generateGuid=function(){var n,t;try{return n=new Uint8Array(16),this.cryptoObj.getRandomValues(n),n[6]|=64,n[6]&=79,n[8]|=128,n[8]&=191,it.decimalToHex(n[0])+it.decimalToHex(n[1])+it.decimalToHex(n[2])+it.decimalToHex(n[3])+"-"+it.decimalToHex(n[4])+it.decimalToHex(n[5])+"-"+it.decimalToHex(n[6])+it.decimalToHex(n[7])+"-"+it.decimalToHex(n[8])+it.decimalToHex(n[9])+"-"+it.decimalToHex(n[10])+it.decimalToHex(n[11])+it.decimalToHex(n[12])+it.decimalToHex(n[13])+it.decimalToHex(n[14])+it.decimalToHex(n[15])}catch(e){var i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",f="0123456789abcdef",r=0,u="";for(t=0;t<36;t++)i[t]!=="-"&&i[t]!=="4"&&(r=Math.random()*16|0),i[t]==="x"?u+=f[r]:i[t]==="y"?(r&=3,r|=8,u+=f[r]):u+=i[t];return u}},n.isGuid=function(n){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)},n}(),ai=function(){function n(){}return n.stringToUtf8Arr=function(n){for(var i,r,e,t,u=0,o=n.length,f=0;f<o;f++)t=n.charCodeAt(f),u+=t<128?1:t<2048?2:t<65536?3:t<2097152?4:t<67108864?5:6;for(i=new Uint8Array(u),r=0,e=0;r<u;e++)t=n.charCodeAt(e),t<128?i[r++]=t:t<2048?(i[r++]=192+(t>>>6),i[r++]=128+(t&63)):t<65536?(i[r++]=224+(t>>>12),i[r++]=128+(t>>>6&63),i[r++]=128+(t&63)):t<2097152?(i[r++]=240+(t>>>18),i[r++]=128+(t>>>12&63),i[r++]=128+(t>>>6&63),i[r++]=128+(t&63)):t<67108864?(i[r++]=248+(t>>>24),i[r++]=128+(t>>>18&63),i[r++]=128+(t>>>12&63),i[r++]=128+(t>>>6&63),i[r++]=128+(t&63)):(i[r++]=252+(t>>>30),i[r++]=128+(t>>>24&63),i[r++]=128+(t>>>18&63),i[r++]=128+(t>>>12&63),i[r++]=128+(t>>>6&63),i[r++]=128+(t&63));return i},n.stringToArrayBuffer=function(n){for(var i=new ArrayBuffer(n.length),r=new Uint8Array(i),t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return i},n.utf8ArrToString=function(n){for(var u="",i=void 0,r=n.length,t=0;t<r;t++)i=n[t],u+=String.fromCharCode(i>251&&i<254&&t+5<r?(i-252)*1073741824+(n[++t]-128<<24)+(n[++t]-128<<18)+(n[++t]-128<<12)+(n[++t]-128<<6)+n[++t]-128:i>247&&i<252&&t+4<r?(i-248<<24)+(n[++t]-128<<18)+(n[++t]-128<<12)+(n[++t]-128<<6)+n[++t]-128:i>239&&i<248&&t+3<r?(i-240<<18)+(n[++t]-128<<12)+(n[++t]-128<<6)+n[++t]-128:i>223&&i<240&&t+2<r?(i-224<<12)+(n[++t]-128<<6)+n[++t]-128:i>191&&i<224&&t+1<r?(i-192<<6)+n[++t]-128:i);return u},n}(),au=function(){function n(){}return n.prototype.urlEncode=function(n){return encodeURIComponent(this.encode(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))},n.prototype.urlEncodeArr=function(n){return this.base64EncArr(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},n.prototype.encode=function(n){var t=ai.stringToUtf8Arr(n);return this.base64EncArr(t)},n.prototype.base64EncArr=function(n){for(var u=(3-n.length%3)%3,r="",f=void 0,e=n.length,t=0,i=0;i<e;i++)f=i%3,t|=n[i]<<(16>>>f&24),(f===2||n.length-i==1)&&(r+=String.fromCharCode(this.uint6ToB64(t>>>18&63),this.uint6ToB64(t>>>12&63),this.uint6ToB64(t>>>6&63),this.uint6ToB64(t&63)),t=0);return u===0?r:r.substring(0,r.length-u)+(u===1?"=":"==")},n.prototype.uint6ToB64=function(n){return n<26?n+65:n<52?n+71:n<62?n-4:n===62?43:n===63?47:65},n}(),ie=function(){function n(){}return n.prototype.decode=function(n){var t=n.replace(/-/g,"+").replace(/_/g,"/"),i;switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string");}return i=this.base64DecToArr(t),ai.utf8ArrToString(i)},n.prototype.base64DecToArr=function(n,t){for(var s=n.replace(/[^A-Za-z0-9\+\/]/g,""),r=s.length,h=t?Math.ceil((r*3+1>>>2)/t)*t:r*3+1>>>2,c=new Uint8Array(h),u=void 0,f=void 0,e=0,o=0,i=0;i<r;i++)if(f=i&3,e|=this.b64ToUint6(s.charCodeAt(i))<<18-6*f,f===3||r-i==1){for(u=0;u<3&&o<h;u++,o++)c[o]=e>>>(16>>>u&24)&255;e=0}return c},n.prototype.b64ToUint6=function(n){return n>64&&n<91?n-65:n>96&&n<123?n-71:n>47&&n<58?n+4:n===43?62:n===47?63:0},n}(),r={pkceNotGenerated:{code:"pkce_not_created",desc:"The PKCE code challenge and verifier could not be generated."},cryptoDoesNotExist:{code:"crypto_nonexistent",desc:"The crypto object or function is not available."},httpMethodNotImplementedError:{code:"http_method_not_implemented",desc:"The HTTP method given has not been implemented in this library."},emptyNavigateUriError:{code:"empty_navigate_uri",desc:"Navigation URI is empty. Please check stack trace for more info."},hashEmptyError:{code:"hash_empty_error",desc:"Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash."},hashDoesNotContainStateError:{code:"no_state_in_hash",desc:"Hash does not contain state. Please verify that the request originated from msal."},hashDoesNotContainKnownPropertiesError:{code:"hash_does_not_contain_known_properties",desc:"Hash does not contain known properites. Please verify that your redirectUri is not changing the hash."},unableToParseStateError:{code:"unable_to_parse_state",desc:"Unable to parse state. Please verify that the request originated from msal."},stateInteractionTypeMismatchError:{code:"state_interaction_type_mismatch",desc:"Hash contains state but the interaction type does not match the caller."},interactionInProgress:{code:"interaction_in_progress",desc:"Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API.  For more visit: aka.ms/msaljs/browser-errors."},popUpWindowError:{code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},emptyWindowError:{code:"empty_window_error",desc:"window.open returned null or undefined window object."},userCancelledError:{code:"user_cancelled",desc:"User cancelled the flow."},monitorPopupTimeoutError:{code:"monitor_window_timeout",desc:"Token acquisition in popup failed due to timeout."},monitorIframeTimeoutError:{code:"monitor_window_timeout",desc:"Token acquisition in iframe failed due to timeout."},redirectInIframeError:{code:"redirect_in_iframe",desc:"Code flow is not supported inside an iframe. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs."},blockTokenRequestsInHiddenIframeError:{code:"block_iframe_reload",desc:"Request was blocked inside an iframe because MSAL detected an authentication response. For more visit: aka.ms/msaljs/browser-errors"},blockAcquireTokenInPopupsError:{code:"block_nested_popups",desc:"Request was blocked inside a popup because MSAL detected it was running in a popup."},iframeClosedPrematurelyError:{code:"iframe_closed_prematurely",desc:"The iframe being monitored was closed prematurely."},silentSSOInsufficientInfoError:{code:"silent_sso_error",desc:"Silent SSO could not be completed - insufficient information was provided. Please provide either a loginHint or sid."},noAccountError:{code:"no_account_error",desc:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request."},silentPromptValueError:{code:"silent_prompt_value_error",desc:"The value given for the prompt value is not valid for silent requests - must be set to 'none'."},noTokenRequestCacheError:{code:"no_token_request_cache_error",desc:"No token request in found in cache."},unableToParseTokenRequestCacheError:{code:"unable_to_parse_token_request_cache_error",desc:"The cached token request could not be parsed."},noCachedAuthorityError:{code:"no_cached_authority_error",desc:"No cached authority found."},authRequestNotSet:{code:"auth_request_not_set_error",desc:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler"},invalidCacheType:{code:"invalid_cache_type",desc:"Invalid cache type"},notInBrowserEnvironment:{code:"non_browser_environment",desc:"Login and token requests are not supported in non-browser environments."},databaseNotOpen:{code:"database_not_open",desc:"Database is not open!"},noNetworkConnectivity:{code:"no_network_connectivity",desc:"No network connectivity. Check your internet connection."},postRequestFailed:{code:"post_request_failed",desc:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'"},getRequestFailed:{code:"get_request_failed",desc:"Network request failed. Please check the network trace to determine root cause."},failedToParseNetworkResponse:{code:"failed_to_parse_response",desc:"Failed to parse network response. Check network trace."}},s=function(n){function t(i,r){var u=n.call(this,i,r)||this;return Object.setPrototypeOf(u,t.prototype),u.name="BrowserAuthError",u}return ii(t,n),t.createPkceNotGeneratedError=function(n){return new t(r.pkceNotGenerated.code,r.pkceNotGenerated.desc+" Detail:"+n)},t.createCryptoNotAvailableError=function(n){return new t(r.cryptoDoesNotExist.code,r.cryptoDoesNotExist.desc+" Detail:"+n)},t.createHttpMethodNotImplementedError=function(n){return new t(r.httpMethodNotImplementedError.code,r.httpMethodNotImplementedError.desc+" Given Method: "+n)},t.createEmptyNavigationUriError=function(){return new t(r.emptyNavigateUriError.code,r.emptyNavigateUriError.desc)},t.createEmptyHashError=function(n){return new t(r.hashEmptyError.code,r.hashEmptyError.desc+" Given Url: "+n)},t.createHashDoesNotContainStateError=function(){return new t(r.hashDoesNotContainStateError.code,r.hashDoesNotContainStateError.desc)},t.createHashDoesNotContainKnownPropertiesError=function(){return new t(r.hashDoesNotContainKnownPropertiesError.code,r.hashDoesNotContainKnownPropertiesError.desc)},t.createUnableToParseStateError=function(){return new t(r.unableToParseStateError.code,r.unableToParseStateError.desc)},t.createStateInteractionTypeMismatchError=function(){return new t(r.stateInteractionTypeMismatchError.code,r.stateInteractionTypeMismatchError.desc)},t.createInteractionInProgressError=function(){return new t(r.interactionInProgress.code,r.interactionInProgress.desc)},t.createPopupWindowError=function(n){var u=r.popUpWindowError.desc;return u=i.isEmpty(n)?u:u+" Details: "+n,new t(r.popUpWindowError.code,u)},t.createEmptyWindowCreatedError=function(){return new t(r.emptyWindowError.code,r.emptyWindowError.desc)},t.createUserCancelledError=function(){return new t(r.userCancelledError.code,r.userCancelledError.desc)},t.createMonitorPopupTimeoutError=function(){return new t(r.monitorPopupTimeoutError.code,r.monitorPopupTimeoutError.desc)},t.createMonitorIframeTimeoutError=function(){return new t(r.monitorIframeTimeoutError.code,r.monitorIframeTimeoutError.desc)},t.createRedirectInIframeError=function(n){return new t(r.redirectInIframeError.code,r.redirectInIframeError.desc+" (window.parent !== window) => "+n)},t.createBlockReloadInHiddenIframeError=function(){return new t(r.blockTokenRequestsInHiddenIframeError.code,r.blockTokenRequestsInHiddenIframeError.desc)},t.createBlockAcquireTokenInPopupsError=function(){return new t(r.blockAcquireTokenInPopupsError.code,r.blockAcquireTokenInPopupsError.desc)},t.createIframeClosedPrematurelyError=function(){return new t(r.iframeClosedPrematurelyError.code,r.iframeClosedPrematurelyError.desc)},t.createSilentSSOInsufficientInfoError=function(){return new t(r.silentSSOInsufficientInfoError.code,r.silentSSOInsufficientInfoError.desc)},t.createNoAccountError=function(){return new t(r.noAccountError.code,r.noAccountError.desc)},t.createSilentPromptValueError=function(n){return new t(r.silentPromptValueError.code,r.silentPromptValueError.desc+" Given value: "+n)},t.createUnableToParseTokenRequestCacheError=function(){return new t(r.unableToParseTokenRequestCacheError.code,r.unableToParseTokenRequestCacheError.desc)},t.createNoTokenRequestCacheError=function(){return new t(r.noTokenRequestCacheError.code,r.noTokenRequestCacheError.desc)},t.createAuthRequestNotSetError=function(){return new t(r.authRequestNotSet.code,r.authRequestNotSet.desc)},t.createNoCachedAuthorityError=function(){return new t(r.noCachedAuthorityError.code,r.noCachedAuthorityError.desc)},t.createInvalidCacheTypeError=function(){return new t(r.invalidCacheType.code,""+r.invalidCacheType.desc)},t.createNonBrowserEnvironmentError=function(){return new t(r.notInBrowserEnvironment.code,r.notInBrowserEnvironment.desc)},t.createDatabaseNotOpenError=function(){return new t(r.databaseNotOpen.code,r.databaseNotOpen.desc)},t.createNoNetworkConnectivityError=function(){return new t(r.noNetworkConnectivity.code,r.noNetworkConnectivity.desc)},t.createPostRequestFailedError=function(n,i){return new t(r.postRequestFailed.code,r.postRequestFailed.desc+" | Network client threw: "+n+" | Attempted to reach: "+i.split("?")[0])},t.createGetRequestFailedError=function(n,i){return new t(r.getRequestFailed.code,r.getRequestFailed.desc+" | Network client threw: "+n+" | Attempted to reach: "+i.split("?")[0])},t.createFailedToParseNetworkResponseError=function(n){return new t(r.failedToParseNetworkResponse.code,r.failedToParseNetworkResponse.desc+" | Attempted to reach: "+n.split("?")[0])},t}(v),re=32,ue=function(){function n(n){this.base64Encode=new au;this.cryptoObj=n}return n.prototype.generateCodes=function(){return e(this,void 0,void 0,function(){var n,t;return o(this,function(i){switch(i.label){case 0:return n=this.generateCodeVerifier(),[4,this.generateCodeChallengeFromVerifier(n)];case 1:return t=i.sent(),[2,{verifier:n,challenge:t}]}})})},n.prototype.generateCodeVerifier=function(){var n;try{return n=new Uint8Array(re),this.cryptoObj.getRandomValues(n),this.base64Encode.urlEncodeArr(n)}catch(t){throw s.createPkceNotGeneratedError(t);}},n.prototype.generateCodeChallengeFromVerifier=function(n){return e(this,void 0,void 0,function(){var t,i;return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.cryptoObj.sha256Digest(n)];case 1:return t=r.sent(),[2,this.base64Encode.urlEncodeArr(new Uint8Array(t))];case 2:i=r.sent();throw s.createPkceNotGeneratedError(i);case 3:return[2]}})})},n}(),fe="RSASSA-PKCS1-v1_5",nu="SHA-256",ee=2048,oe=new Uint8Array([1,0,1]),tu=function(){function n(){if(!this.hasCryptoAPI())throw s.createCryptoNotAvailableError("Browser crypto or msCrypto object not available.");this._keygenAlgorithmOptions={name:fe,hash:nu,modulusLength:ee,publicExponent:oe}}return n.prototype.sha256Digest=function(n){return e(this,void 0,void 0,function(){var t;return o(this,function(){return t=ai.stringToUtf8Arr(n),[2,this.hasIECrypto()?this.getMSCryptoDigest(nu,t):this.getSubtleCryptoDigest(nu,t)]})})},n.prototype.getRandomValues=function(n){var t=window.msCrypto||window.crypto;if(!t.getRandomValues)throw s.createCryptoNotAvailableError("getRandomValues does not exist.");t.getRandomValues(n)},n.prototype.generateKeyPair=function(n,t){return e(this,void 0,void 0,function(){return o(this,function(){return[2,this.hasIECrypto()?this.msCryptoGenerateKey(n,t):window.crypto.subtle.generateKey(this._keygenAlgorithmOptions,n,t)]})})},n.prototype.exportJwk=function(n){return e(this,void 0,void 0,function(){return o(this,function(){return[2,this.hasIECrypto()?this.msCryptoExportJwk(n):window.crypto.subtle.exportKey(li,n)]})})},n.prototype.importJwk=function(t,i,r){return e(this,void 0,void 0,function(){var u,f;return o(this,function(){return u=n.getJwkString(t),f=ai.stringToArrayBuffer(u),[2,this.hasIECrypto()?this.msCryptoImportKey(f,i,r):window.crypto.subtle.importKey(li,t,this._keygenAlgorithmOptions,i,r)]})})},n.prototype.sign=function(n,t){return e(this,void 0,void 0,function(){return o(this,function(){return[2,this.hasIECrypto()?this.msCryptoSign(n,t):window.crypto.subtle.sign(this._keygenAlgorithmOptions,n,t)]})})},n.prototype.hasCryptoAPI=function(){return this.hasIECrypto()||this.hasBrowserCrypto()},n.prototype.hasIECrypto=function(){return"msCrypto"in window},n.prototype.hasBrowserCrypto=function(){return"crypto"in window},n.prototype.getSubtleCryptoDigest=function(n,t){return e(this,void 0,void 0,function(){return o(this,function(){return[2,window.crypto.subtle.digest(n,t)]})})},n.prototype.getMSCryptoDigest=function(n,t){return e(this,void 0,void 0,function(){return o(this,function(){return[2,new Promise(function(i,r){var u=window.msCrypto.subtle.digest(n,t.buffer);u.addEventListener("complete",function(n){i(n.target.result)});u.addEventListener("error",function(n){r(n)})})]})})},n.prototype.msCryptoGenerateKey=function(n,t){return e(this,void 0,void 0,function(){var i=this;return o(this,function(){return[2,new Promise(function(r,u){var f=window.msCrypto.subtle.generateKey(i._keygenAlgorithmOptions,n,t);f.addEventListener("complete",function(n){r(n.target.result)});f.addEventListener("error",function(n){u(n)})})]})})},n.prototype.msCryptoExportJwk=function(n){return e(this,void 0,void 0,function(){return o(this,function(){return[2,new Promise(function(t,i){var r=window.msCrypto.subtle.exportKey(li,n);r.addEventListener("complete",function(n){var r=n.target.result,u=ai.utf8ArrToString(new Uint8Array(r)).replace(/\r/g,"").replace(/\n/g,"").replace(/\t/g,"").split(" ").join("").replace("\x00","");try{t(JSON.parse(u))}catch(n){i(n)}});r.addEventListener("error",function(n){i(n)})})]})})},n.prototype.msCryptoImportKey=function(n,t,i){return e(this,void 0,void 0,function(){var r=this;return o(this,function(){return[2,new Promise(function(u,f){var e=window.msCrypto.subtle.importKey(li,n,r._keygenAlgorithmOptions,t,i);e.addEventListener("complete",function(n){u(n.target.result)});e.addEventListener("error",function(n){f(n)})})]})})},n.prototype.msCryptoSign=function(n,t){return e(this,void 0,void 0,function(){var i=this;return o(this,function(){return[2,new Promise(function(r,u){var f=window.msCrypto.subtle.sign(i._keygenAlgorithmOptions,n,t);f.addEventListener("complete",function(n){r(n.target.result)});f.addEventListener("error",function(n){u(n)})})]})})},n.getJwkString=function(n){return JSON.stringify(n,Object.keys(n).sort())},n}(),se=function(){function n(n,t,i){this.dbName=n;this.tableName=t;this.version=i;this.dbOpen=!1}return n.prototype.open=function(){return e(this,void 0,void 0,function(){var n=this;return o(this,function(){return[2,new Promise(function(t,i){var r=window.indexedDB.open(n.dbName,n.version);r.addEventListener("upgradeneeded",function(t){var i=t;i.target.result.createObjectStore(n.tableName)});r.addEventListener("success",function(i){var r=i;n.db=r.target.result;n.dbOpen=!0;t()});r.addEventListener("error",function(n){return i(n)})})]})})},n.prototype.get=function(n){return e(this,void 0,void 0,function(){var t=this;return o(this,function(i){switch(i.label){case 0:return!this.dbOpen?[4,this.open()]:[3,2];case 1:i.sent();i.label=2;case 2:return[2,new Promise(function(i,r){if(!t.db)return r(s.createDatabaseNotOpenError());var f=t.db.transaction([t.tableName],"readonly"),e=f.objectStore(t.tableName),u=e.get(n);u.addEventListener("success",function(n){var t=n;i(t.target.result)});u.addEventListener("error",function(n){return r(n)})})]}})})},n.prototype.put=function(n,t){return e(this,void 0,void 0,function(){var i=this;return o(this,function(r){switch(r.label){case 0:return!this.dbOpen?[4,this.open()]:[3,2];case 1:r.sent();r.label=2;case 2:return[2,new Promise(function(r,u){if(!i.db)return u(s.createDatabaseNotOpenError());var e=i.db.transaction([i.tableName],"readwrite"),o=e.objectStore(i.tableName),f=o.put(t,n);f.addEventListener("success",function(n){var t=n;r(t.target.result)});f.addEventListener("error",function(n){return u(n)})})]}})})},n}(),he=function(){function n(){this.browserCrypto=new tu;this.b64Encode=new au;this.b64Decode=new ie;this.guidGenerator=new te(this.browserCrypto);this.pkceGenerator=new ue(this.browserCrypto);this.cache=new se(n.DB_NAME,n.TABLE_NAME,n.DB_VERSION)}return n.prototype.createNewGuid=function(){return this.guidGenerator.generateGuid()},n.prototype.base64Encode=function(n){return this.b64Encode.encode(n)},n.prototype.base64Decode=function(n){return this.b64Decode.decode(n)},n.prototype.generatePkceCodes=function(){return e(this,void 0,void 0,function(){return o(this,function(){return[2,this.pkceGenerator.generateCodes()]})})},n.prototype.getPublicKeyThumbprint=function(t){return e(this,void 0,void 0,function(){var i,r,f,e,s,u,h,c;return o(this,function(o){switch(o.label){case 0:return[4,this.browserCrypto.generateKeyPair(n.EXTRACTABLE,n.POP_KEY_USAGES)];case 1:return i=o.sent(),[4,this.browserCrypto.exportJwk(i.publicKey)];case 2:return r=o.sent(),f={e:r.e,kty:r.kty,n:r.n},e=tu.getJwkString(f),[4,this.browserCrypto.sha256Digest(e)];case 3:return s=o.sent(),u=this.b64Encode.urlEncodeArr(new Uint8Array(s)),[4,this.browserCrypto.exportJwk(i.privateKey)];case 4:return h=o.sent(),[4,this.browserCrypto.importJwk(h,!1,["sign"])];case 5:return c=o.sent(),this.cache.put(u,{privateKey:c,publicKey:i.publicKey,requestMethod:t.resourceRequestMethod,requestUri:t.resourceRequestUri}),[2,u]}})})},n.prototype.signJwt=function(n,t){return e(this,void 0,void 0,function(){var i,r,f,e,s,h,u,c,l,a;return o(this,function(o){switch(o.label){case 0:return[4,this.cache.get(t)];case 1:return i=o.sent(),[4,this.browserCrypto.exportJwk(i.publicKey)];case 2:return r=o.sent(),f=tu.getJwkString(r),e={alg:r.alg,type:li},s=this.b64Encode.urlEncode(JSON.stringify(e)),n.cnf={jwk:JSON.parse(f)},h=this.b64Encode.urlEncode(JSON.stringify(n)),u=s+"."+h,c=ai.stringToArrayBuffer(u),[4,this.browserCrypto.sign(i.privateKey,c)];case 3:return l=o.sent(),a=this.b64Encode.urlEncodeArr(new Uint8Array(l)),[2,u+"."+a]}})})},n.POP_KEY_USAGES=["sign","verify"],n.EXTRACTABLE=!0,n.DB_VERSION=1,n.DB_NAME="msal.db",n.TABLE_NAME=n.DB_NAME+".keys",n}(),ut={redirectUriNotSet:{code:"redirect_uri_empty",desc:"A redirect URI is required for all calls, and none has been set."},postLogoutUriNotSet:{code:"post_logout_uri_empty",desc:"A post logout redirect has not been set."},storageNotSupportedError:{code:"storage_not_supported",desc:"Given storage configuration option was not supported."},noRedirectCallbacksSet:{code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},invalidCallbackObject:{code:"invalid_callback_object",desc:"The object passed for the callback was invalid. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},stubPcaInstanceCalled:{code:"stubbed_public_client_application_called",desc:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors"},inMemRedirectUnavailable:{code:"in_mem_redirect_unavailable",desc:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."}},ft=function(n){function t(i,r){var u=n.call(this,i,r)||this;return u.name="BrowserConfigurationAuthError",Object.setPrototypeOf(u,t.prototype),u}return ii(t,n),t.createRedirectUriEmptyError=function(){return new t(ut.redirectUriNotSet.code,ut.redirectUriNotSet.desc)},t.createPostLogoutRedirectUriEmptyError=function(){return new t(ut.postLogoutUriNotSet.code,ut.postLogoutUriNotSet.desc)},t.createStorageNotSupportedError=function(n){return new t(ut.storageNotSupportedError.code,ut.storageNotSupportedError.desc+" Given Location: "+n)},t.createInvalidCallbackObjectError=function(n){return new t(ut.invalidCallbackObject.code,ut.invalidCallbackObject.desc+" Given value for callback function: "+n)},t.createRedirectCallbacksNotSetError=function(){return new t(ut.noRedirectCallbacksSet.code,ut.noRedirectCallbacksSet.desc)},t.createStubPcaInstanceCalledError=function(){return new t(ut.stubPcaInstanceCalled.code,ut.stubPcaInstanceCalled.desc)},t.createInMemoryRedirectUnavailableError=function(){return new t(ut.inMemRedirectUnavailable.code,ut.inMemRedirectUnavailable.desc)},t}(v),vu=function(){function t(n){this.validateWindowStorage(n);this.windowStorage=window[n]}return t.prototype.validateWindowStorage=function(t){if(t!==n.BrowserCacheLocation.LocalStorage&&t!==n.BrowserCacheLocation.SessionStorage)throw ft.createStorageNotSupportedError(t);var i=!!window[t];if(!i)throw ft.createStorageNotSupportedError(t);},t.prototype.getItem=function(n){return this.windowStorage.getItem(n)},t.prototype.setItem=function(n,t){this.windowStorage.setItem(n,t)},t.prototype.removeItem=function(n){this.windowStorage.removeItem(n)},t.prototype.getKeys=function(){return Object.keys(this.windowStorage)},t.prototype.containsKey=function(n){return this.windowStorage.hasOwnProperty(n)},t}(),yu=function(){function n(){this.cache=new Map}return n.prototype.getItem=function(n){return this.cache.get(n)||null},n.prototype.setItem=function(n,t){this.cache.set(n,t)},n.prototype.removeItem=function(n){this.cache.delete(n)},n.prototype.getKeys=function(){var n=[];return this.cache.forEach(function(t,i){n.push(i)}),n},n.prototype.containsKey=function(n){return this.cache.has(n)},n.prototype.clear=function(){this.cache.clear()},n}(),pu=function(){function n(){}return n.extractBrowserRequestState=function(n,t){if(i.isEmpty(t))return null;try{var r=ci.parseRequestState(n,t);return r.libraryState.meta}catch(u){throw f.createInvalidStateError(t,u);}},n.parseServerResponseFromHash=function(n){if(!n)return{};var t=new b(n);return b.getDeserializedHash(t.getHash())},n}(),wu=function(t){function r(n,i,r,u){var f=t.call(this,n,r)||this;return f.COOKIE_LIFE_MULTIPLIER=864e5,f.cacheConfig=i,f.logger=u,f.internalStorage=new yu,f.browserStorage=f.setupBrowserStorage(f.cacheConfig.cacheLocation),f.temporaryCacheStorage=f.setupTemporaryCacheStorage(f.cacheConfig.cacheLocation),f.migrateCacheEntries(),f}return ii(r,t),r.prototype.setupBrowserStorage=function(t){switch(t){case n.BrowserCacheLocation.LocalStorage:case n.BrowserCacheLocation.SessionStorage:try{return new vu(t)}catch(i){this.logger.verbose(i);break}}return this.cacheConfig.cacheLocation=n.BrowserCacheLocation.MemoryStorage,new yu},r.prototype.setupTemporaryCacheStorage=function(t){switch(t){case n.BrowserCacheLocation.LocalStorage:case n.BrowserCacheLocation.SessionStorage:try{return new vu(n.BrowserCacheLocation.SessionStorage)}catch(i){return this.logger.verbose(i),this.internalStorage}case n.BrowserCacheLocation.MemoryStorage:default:return this.internalStorage}},r.prototype.migrateCacheEntries=function(){var n=this,t=u.CACHE_PREFIX+"."+ot.ID_TOKEN,i=u.CACHE_PREFIX+"."+ot.CLIENT_INFO,r=u.CACHE_PREFIX+"."+ot.ERROR,f=u.CACHE_PREFIX+"."+ot.ERROR_DESC,e=this.browserStorage.getItem(t),o=this.browserStorage.getItem(i),s=this.browserStorage.getItem(r),h=this.browserStorage.getItem(f),c=[e,o,s,h],l=[ot.ID_TOKEN,ot.CLIENT_INFO,ot.ERROR,ot.ERROR_DESC];l.forEach(function(t,i){return n.migrateCacheEntry(t,c[i])})},r.prototype.migrateCacheEntry=function(n,t){t&&this.setTemporaryCache(n,t,!0)},r.prototype.validateAndParseJson=function(n){try{var t=JSON.parse(n);return t&&typeof t=="object"?t:null}catch(i){return null}},r.prototype.getItem=function(n){return this.browserStorage.getItem(n)},r.prototype.setItem=function(n,t){this.browserStorage.setItem(n,t)},r.prototype.getAccount=function(n){var i=this.getItem(n),t;return i?(t=this.validateAndParseJson(i),!t||!st.isAccountEntity(t))?null:yt.toObject(new st,t):null},r.prototype.setAccount=function(n){this.logger.verbose("BrowserCacheManager.setAccount called");var t=n.generateAccountKey();this.setItem(t,JSON.stringify(n))},r.prototype.getIdTokenCredential=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getIdTokenCredential called"),i=this.getItem(n),!i)?null:(t=this.validateAndParseJson(i),!t||!vr.isIdTokenEntity(t))?null:(this.logger.verbose("BrowserCacheManager.getIdTokenCredential: cache hit"),yt.toObject(new vr,t))},r.prototype.setIdTokenCredential=function(n){this.logger.verbose("BrowserCacheManager.setIdTokenCredential called");var t=n.generateCredentialKey();this.setItem(t,JSON.stringify(n))},r.prototype.getAccessTokenCredential=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getAccessTokenCredential called"),i=this.getItem(n),!i)?null:(t=this.validateAndParseJson(i),!t||!yr.isAccessTokenEntity(t))?null:(this.logger.verbose("BrowserCacheManager.getAccessTokenCredential: cache hit"),yt.toObject(new yr,t))},r.prototype.setAccessTokenCredential=function(n){this.logger.verbose("BrowserCacheManager.setAccessTokenCredential called");var t=n.generateCredentialKey();this.setItem(t,JSON.stringify(n))},r.prototype.getRefreshTokenCredential=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getRefreshTokenCredential called"),i=this.getItem(n),!i)?null:(t=this.validateAndParseJson(i),!t||!pr.isRefreshTokenEntity(t))?null:(this.logger.verbose("BrowserCacheManager.getRefreshTokenCredential: cache hit"),yt.toObject(new pr,t))},r.prototype.setRefreshTokenCredential=function(n){this.logger.verbose("BrowserCacheManager.setRefreshTokenCredential called");var t=n.generateCredentialKey();this.setItem(t,JSON.stringify(n))},r.prototype.getAppMetadata=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getAppMetadata called"),i=this.getItem(n),!i)?null:(t=this.validateAndParseJson(i),!t||!kr.isAppMetadataEntity(n,t))?null:(this.logger.verbose("BrowserCacheManager.getAppMetadata: cache hit"),yt.toObject(new kr,t))},r.prototype.setAppMetadata=function(n){this.logger.verbose("BrowserCacheManager.setAppMetadata called");var t=n.generateAppMetadataKey();this.setItem(t,JSON.stringify(n))},r.prototype.getServerTelemetry=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getServerTelemetry called"),i=this.getItem(n),!i)?null:(t=this.validateAndParseJson(i),!t||!ur.isServerTelemetryEntity(n,t))?null:(this.logger.verbose("BrowserCacheManager.getServerTelemetry: cache hit"),yt.toObject(new ur,t))},r.prototype.setServerTelemetry=function(n,t){this.logger.verbose("BrowserCacheManager.setServerTelemetry called");this.setItem(n,JSON.stringify(t))},r.prototype.getAuthorityMetadata=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getAuthorityMetadata called"),i=this.internalStorage.getItem(n),!i)?null:(t=this.validateAndParseJson(i),t&&rr.isAuthorityMetadataEntity(n,t))?(this.logger.verbose("BrowserCacheManager.getAuthorityMetadata: cache hit"),yt.toObject(new rr,t)):null},r.prototype.getAuthorityMetadataKeys=function(){var n=this,t=this.internalStorage.getKeys();return t.filter(function(t){return n.isAuthorityMetadata(t)})},r.prototype.setAuthorityMetadata=function(n,t){this.logger.verbose("BrowserCacheManager.setAuthorityMetadata called");this.internalStorage.setItem(n,JSON.stringify(t))},r.prototype.getThrottlingCache=function(n){var i,t;return(this.logger.verbose("BrowserCacheManager.getThrottlingCache called"),i=this.getItem(n),!i)?null:(t=this.validateAndParseJson(i),!t||!lu.isThrottlingEntity(n,t))?null:(this.logger.verbose("BrowserCacheManager.getThrottlingCache: cache hit"),yt.toObject(new lu,t))},r.prototype.setThrottlingCache=function(n,t){this.logger.verbose("BrowserCacheManager.setThrottlingCache called");this.setItem(n,JSON.stringify(t))},r.prototype.getTemporaryCache=function(n,t){var i,r,u;return(this.logger.verbose("BrowserCacheManager.getTemporaryCache called"),i=t?this.generateCacheKey(n):n,this.cacheConfig.storeAuthStateInCookie&&(this.logger.verbose("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),r=this.getItemCookie(i),r))?r:(u=this.temporaryCacheStorage.getItem(i),!u)?null:u},r.prototype.setTemporaryCache=function(n,t,i){var r=i?this.generateCacheKey(n):n;this.temporaryCacheStorage.setItem(r,t);this.cacheConfig.storeAuthStateInCookie&&(this.logger.verbose("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.setItemCookie(r,t))},r.prototype.removeItem=function(n){return this.browserStorage.removeItem(n),this.temporaryCacheStorage.removeItem(n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.verbose("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.clearItemCookie(n)),!0},r.prototype.containsKey=function(n){return this.browserStorage.containsKey(n)||this.temporaryCacheStorage.containsKey(n)},r.prototype.getKeys=function(){return uu(this.browserStorage.getKeys(),this.temporaryCacheStorage.getKeys())},r.prototype.clear=function(){var n=this;this.removeAllAccounts();this.removeAppMetadata();this.getKeys().forEach(function(t){(n.browserStorage.containsKey(t)||n.temporaryCacheStorage.containsKey(t))&&(t.indexOf(u.CACHE_PREFIX)!==-1||t.indexOf(n.clientId)!==-1)&&n.removeItem(t)});this.internalStorage.clear()},r.prototype.setItemCookie=function(n,t,i){var r=encodeURIComponent(n)+"="+encodeURIComponent(t)+";path=/;",u;i&&(u=this.getCookieExpirationTime(i),r+="expires="+u+";");this.cacheConfig.secureCookies&&(r+="Secure;");document.cookie=r},r.prototype.getItemCookie=function(n){for(var t,r=encodeURIComponent(n)+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)===" ";)t=t.substring(1);if(t.indexOf(r)===0)return decodeURIComponent(t.substring(r.length,t.length))}return""},r.prototype.clearMsalCookies=function(){var n=this,t=u.CACHE_PREFIX+"."+this.clientId,i=document.cookie.split(";");i.forEach(function(i){while(i.charAt(0)===" ")i=i.substring(1);if(i.indexOf(t)===0){var r=i.split("=")[0];n.clearItemCookie(r)}})},r.prototype.clearItemCookie=function(n){this.setItemCookie(n,"",-1)},r.prototype.getCookieExpirationTime=function(n){var t=new Date,i=new Date(t.getTime()+n*this.COOKIE_LIFE_MULTIPLIER);return i.toUTCString()},r.prototype.getCache=function(){return this.browserStorage},r.prototype.setCache=function(){},r.prototype.generateCacheKey=function(n){var t=this.validateAndParseJson(n);return t?JSON.stringify(n):i.startsWith(n,u.CACHE_PREFIX)||i.startsWith(n,ot.ADAL_ID_TOKEN)?n:u.CACHE_PREFIX+"."+this.clientId+"."+n},r.prototype.generateAuthorityKey=function(n){var t=ci.parseRequestState(this.cryptoImpl,n).libraryState.id;return this.generateCacheKey(p.AUTHORITY+"."+t)},r.prototype.generateNonceKey=function(n){var t=ci.parseRequestState(this.cryptoImpl,n).libraryState.id;return this.generateCacheKey(p.NONCE_IDTOKEN+"."+t)},r.prototype.generateStateKey=function(n){var t=ci.parseRequestState(this.cryptoImpl,n).libraryState.id;return this.generateCacheKey(p.REQUEST_STATE+"."+t)},r.prototype.getCachedAuthority=function(n){var r=this.generateStateKey(n),t=this.getTemporaryCache(r),i;return t?(i=this.generateAuthorityKey(t),this.getTemporaryCache(i)):null},r.prototype.updateCacheEntries=function(n,t,i){var r,u,f;this.logger.verbose("BrowserCacheManager.updateCacheEntries called");r=this.generateStateKey(n);this.setTemporaryCache(r,n,!1);u=this.generateNonceKey(n);this.setTemporaryCache(u,t,!1);f=this.generateAuthorityKey(n);this.setTemporaryCache(f,i,!1)},r.prototype.resetRequestCache=function(n){var t=this;this.logger.verbose("BrowserCacheManager.resetRequestCache called");i.isEmpty(n)||this.getKeys().forEach(function(i){i.indexOf(n)!==-1&&t.removeItem(i)});n&&(this.removeItem(this.generateStateKey(n)),this.removeItem(this.generateNonceKey(n)),this.removeItem(this.generateAuthorityKey(n)));this.removeItem(this.generateCacheKey(p.REQUEST_PARAMS));this.removeItem(this.generateCacheKey(p.ORIGIN_URI));this.removeItem(this.generateCacheKey(p.URL_HASH));this.removeItem(this.generateCacheKey(p.INTERACTION_STATUS_KEY))},r.prototype.cleanRequestByState=function(n){if(this.logger.verbose("BrowserCacheManager.cleanRequestByState called"),n){var i=this.generateStateKey(n),t=this.temporaryCacheStorage.getItem(i);this.logger.info("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: "+t);this.resetRequestCache(t||"")}this.clearMsalCookies()},r.prototype.cleanRequestByInteractionType=function(n){var t=this;this.logger.verbose("BrowserCacheManager.cleanRequestByInteractionType called");this.getKeys().forEach(function(i){var r,u;i.indexOf(p.REQUEST_STATE)!==-1&&(r=t.temporaryCacheStorage.getItem(i),r)&&(u=pu.extractBrowserRequestState(t.cryptoImpl,r),u&&u.interactionType===n&&(t.logger.info("BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: "+r),t.resetRequestCache(r)))});this.clearMsalCookies()},r.prototype.cacheCodeRequest=function(n,t){this.logger.verbose("BrowserCacheManager.cacheCodeRequest called");var i=t.base64Encode(JSON.stringify(n));this.setTemporaryCache(p.REQUEST_PARAMS,i,!0)},r.prototype.getCachedRequest=function(n,t){var u,r,e,f;if(this.logger.verbose("BrowserCacheManager.getCachedRequest called"),u=this.getTemporaryCache(p.REQUEST_PARAMS,!0),!u)throw s.createNoTokenRequestCacheError();if(r=this.validateAndParseJson(t.base64Decode(u)),!r)throw s.createUnableToParseTokenRequestCacheError();if(this.removeItem(this.generateCacheKey(p.REQUEST_PARAMS)),i.isEmpty(r.authority)){if(e=this.generateAuthorityKey(n),f=this.getTemporaryCache(e),!f)throw s.createNoCachedAuthorityError();r.authority=f}return r},r}(yt),ce=function(t,i){var r={cacheLocation:n.BrowserCacheLocation.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1};return new wu(t,r,tr,i)},le=function(){function n(){}return n.prototype.sendGetRequestAsync=function(n,t){return e(this,void 0,void 0,function(){var i,u,r,f;return o(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,fetch(n,{method:wt.GET,headers:this.getFetchHeaders(t)})];case 1:return i=e.sent(),[3,3];case 2:if(u=e.sent(),window.navigator.onLine)throw s.createGetRequestFailedError(u,n);else throw s.createNoNetworkConnectivityError();case 3:return e.trys.push([3,5,,6]),r={headers:this.getHeaderDict(i.headers)},[4,i.json()];case 4:return[2,(r.body=e.sent(),r.status=i.status,r)];case 5:f=e.sent();throw s.createFailedToParseNetworkResponseError(n);case 6:return[2]}})})},n.prototype.sendPostRequestAsync=function(n,t){return e(this,void 0,void 0,function(){var u,i,f,r,e;return o(this,function(o){switch(o.label){case 0:u=t&&t.body||"";o.label=1;case 1:return o.trys.push([1,3,,4]),[4,fetch(n,{method:wt.POST,headers:this.getFetchHeaders(t),body:u})];case 2:return i=o.sent(),[3,4];case 3:if(f=o.sent(),window.navigator.onLine)throw s.createPostRequestFailedError(f,n);else throw s.createNoNetworkConnectivityError();case 4:return o.trys.push([4,6,,7]),r={headers:this.getHeaderDict(i.headers)},[4,i.json()];case 5:return[2,(r.body=o.sent(),r.status=i.status,r)];case 6:e=o.sent();throw s.createFailedToParseNetworkResponseError(n);case 7:return[2]}})})},n.prototype.getFetchHeaders=function(n){var t=new Headers,i;return(n&&n.headers)?(i=n.headers,Object.keys(i).forEach(function(n){t.append(n,i[n])}),t):t},n.prototype.getHeaderDict=function(n){var t={};return n.forEach(function(n,i){t[i]=n}),t},n}(),ae=function(){function n(){}return n.prototype.sendGetRequestAsync=function(n,t){return e(this,void 0,void 0,function(){return o(this,function(){return[2,this.sendRequestAsync(n,wt.GET,t)]})})},n.prototype.sendPostRequestAsync=function(n,t){return e(this,void 0,void 0,function(){return o(this,function(){return[2,this.sendRequestAsync(n,wt.POST,t)]})})},n.prototype.sendRequestAsync=function(n,t,i){var r=this;return new Promise(function(u,f){var e=new XMLHttpRequest;if(e.open(t,n,!0),r.setXhrHeaders(e,i),e.onload=function(){(e.status<200||e.status>=300)&&(t===wt.POST?f(s.createPostRequestFailedError("Failed with status "+e.status,n)):f(s.createGetRequestFailedError("Failed with status "+e.status,n)));try{var i=JSON.parse(e.responseText),o={headers:r.getHeaderDict(e),body:i,status:e.status};u(o)}catch(h){f(s.createFailedToParseNetworkResponseError(n))}},e.onerror=function(){window.navigator.onLine?t===wt.POST?f(s.createPostRequestFailedError("Failed with status "+e.status,n)):f(s.createGetRequestFailedError("Failed with status "+e.status,n)):f(s.createNoNetworkConnectivityError())},t===wt.POST&&i&&i.body)e.send(i.body);else if(t===wt.GET)e.send();else throw s.createHttpMethodNotImplementedError(t);})},n.prototype.setXhrHeaders=function(n,t){if(t&&t.headers){var i=t.headers;Object.keys(i).forEach(function(t){n.setRequestHeader(t,i[t])})}},n.prototype.getHeaderDict=function(n){var i=n.getAllResponseHeaders(),r=i.trim().split(/[\r\n]+/),t={};return r.forEach(function(n){var i=n.split(": "),r=i.shift(),u=i.join(": ");r&&u&&(t[r]=u)}),t},n}(),d=function(){function t(){}return t.clearHash=function(){typeof history.replaceState=="function"?history.replaceState(null,u.EMPTY_STRING,""+window.location.pathname+window.location.search):window.location.hash=""},t.replaceHash=function(n){var t=n.split("#");t.shift();window.location.hash=t.length>0?t.join("#"):""},t.isInIframe=function(){return window.parent!==window},t.getCurrentUri=function(){return window.location.href.split("?")[0].split("#")[0]},t.getHomepage=function(){var t=new b(window.location.href),n=t.getUrlComponents();return n.Protocol+"//"+n.HostNameAndPort+"/"},t.getBrowserNetworkClient=function(){return window.fetch&&window.Headers?new le:new ae},t.blockReloadInHiddenIframes=function(){var n=b.hashContainsKnownProperties(window.location.hash);if(n&&t.isInIframe())throw s.createBlockReloadInHiddenIframeError();},t.blockRedirectInIframe=function(i,r){var u=t.isInIframe();if(i===n.InteractionType.Redirect&&u&&!r)throw s.createRedirectInIframeError(u);},t.blockAcquireTokenInPopups=function(){if(window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(rt.POPUP_NAME_PREFIX+".")===0)throw s.createBlockAcquireTokenInPopupsError();},t.blockNonBrowserEnvironment=function(n){if(!n)throw s.createNonBrowserEnvironmentError();},t.detectIEOrEdge=function(){var n=window.navigator.userAgent,t=n.indexOf("MSIE "),i=n.indexOf("Trident/"),r=n.indexOf("Edge/"),u=t>0||i>0,f=r>0;return u||f},t}(),bu=function(){function n(){}return n.prototype.navigateInternal=function(t,i){return n.defaultNavigateWindow(t,i)},n.prototype.navigateExternal=function(t,i){return n.defaultNavigateWindow(t,i)},n.defaultNavigateWindow=function(n,t){return t.noHistory?window.location.replace(n):window.location.assign(n),new Promise(function(n){setTimeout(function(){n(!0)},t.timeout)})},n}(),ve=6e4,iu=6e3,ye=3e4;var ru=function(){function n(n,t,i){this.authModule=n;this.browserStorage=t;this.authCodeRequest=i}return n.prototype.handleCodeResponse=function(n,t,r,u){return e(this,void 0,void 0,function(){var c,h,e,l,a,v;return o(this,function(o){switch(o.label){case 0:if(i.isEmpty(n))throw s.createEmptyHashError(n);if(c=this.browserStorage.generateStateKey(t),h=this.browserStorage.getTemporaryCache(c),!h)throw f.createStateNotFoundError("Cached State");return(e=this.authModule.handleFragmentResponse(n,h),l=this.browserStorage.generateNonceKey(h),a=this.browserStorage.getTemporaryCache(l),this.authCodeRequest.code=e.code,!e.cloud_instance_host_name)?[3,2]:[4,this.updateTokenEndpointAuthority(e.cloud_instance_host_name,r,u)];case 1:o.sent();o.label=2;case 2:return e.nonce=a||undefined,e.state=h,[4,this.authModule.acquireToken(this.authCodeRequest,e)];case 3:return v=o.sent(),this.browserStorage.cleanRequestByState(t),[2,v]}})})},n.prototype.updateTokenEndpointAuthority=function(n,t,i){return e(this,void 0,void 0,function(){var r,u;return o(this,function(f){switch(f.label){case 0:return r="https://"+n+"/"+t.tenant+"/",[4,dr.createDiscoveredInstance(r,i,this.browserStorage,t.options)];case 1:return u=f.sent(),this.authModule.updateAuthority(u),[2]}})})},n}(),ku=function(t){function r(n,i,r,u){var f=t.call(this,n,i,r)||this;return f.browserCrypto=u,f}return ii(r,t),r.prototype.initiateAuthRequest=function(t,r){return e(this,void 0,void 0,function(){var u,f;return o(this,function(e){switch(e.label){case 0:return(this.authModule.logger.verbose("RedirectHandler.initiateAuthRequest called"),!!i.isEmpty(t))?[3,7]:(r.redirectStartPage&&(this.authModule.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set to true, caching start page"),this.browserStorage.setTemporaryCache(p.ORIGIN_URI,r.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(p.INTERACTION_STATUS_KEY,rt.INTERACTION_IN_PROGRESS_VALUE,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest,this.browserCrypto),this.authModule.logger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to:"+t),u={apiId:n.ApiId.acquireTokenRedirect,timeout:r.redirectTimeout,noHistory:!1},!(typeof r.onRedirectNavigate=="function"))?[3,4]:(this.authModule.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),f=r.onRedirectNavigate(t),!(f!==!1))?[3,2]:(this.authModule.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),[4,r.navigationClient.navigateExternal(t,u)]);case 1:return e.sent(),[2];case 2:return this.authModule.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation"),[2];case 3:return[3,6];case 4:return this.authModule.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),[4,r.navigationClient.navigateExternal(t,u)];case 5:return e.sent(),[2];case 6:return[3,8];case 7:this.authModule.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty");throw s.createEmptyNavigationUriError();case 8:return[2]}})})},r.prototype.handleCodeResponse=function(n,t,r,u,h){return e(this,void 0,void 0,function(){var l,c,e,a,v,y;return o(this,function(o){switch(o.label){case 0:if(this.authModule.logger.verbose("RedirectHandler.handleCodeResponse called"),i.isEmpty(n))throw s.createEmptyHashError(n);if(this.browserStorage.removeItem(this.browserStorage.generateCacheKey(p.INTERACTION_STATUS_KEY)),l=this.browserStorage.generateStateKey(t),c=this.browserStorage.getTemporaryCache(l),!c)throw f.createStateNotFoundError("Cached State");return(e=this.authModule.handleFragmentResponse(n,c),a=this.browserStorage.generateNonceKey(c),v=this.browserStorage.getTemporaryCache(a),this.authCodeRequest.code=e.code,!e.cloud_instance_host_name)?[3,2]:[4,this.updateTokenEndpointAuthority(e.cloud_instance_host_name,r,u)];case 1:o.sent();o.label=2;case 2:return e.nonce=v||undefined,e.state=c,h&&ir.removeThrottle(this.browserStorage,h,this.authCodeRequest.authority,this.authCodeRequest.scopes),[4,this.authModule.acquireToken(this.authCodeRequest,e)];case 3:return y=o.sent(),this.browserStorage.cleanRequestByState(t),[2,y]}})})},r}(ru),vi=function(){function t(n,t){this.browserStorage=n;this.logger=t;this.unloadWindow=this.unloadWindow.bind(this)}return t.prototype.openPopup=function(n,i,r){try{var u=void 0;if(r?(u=r,this.logger.verbosePii("Navigating popup window to: "+n),u.location.assign(n)):typeof r=="undefined"&&(this.logger.verbosePii("Opening popup window to: "+n),u=t.openSizedPopup(n,i)),!u)throw s.createEmptyWindowCreatedError();return u.focus&&u.focus(),this.currentWindow=u,window.addEventListener("beforeunload",this.unloadWindow),u}catch(f){this.logger.error("error opening popup "+f.message);this.browserStorage.removeItem(this.browserStorage.generateCacheKey(p.INTERACTION_STATUS_KEY));throw s.createPopupWindowError(f.toString());}},t.openSizedPopup=function(n,t){var i=window.screenLeft?window.screenLeft:window.screenX,r=window.screenTop?window.screenTop:window.screenY,u=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,e=Math.max(0,u/2-rt.POPUP_WIDTH/2+i),o=Math.max(0,f/2-rt.POPUP_HEIGHT/2+r);return window.open(n,t,"width="+rt.POPUP_WIDTH+", height="+rt.POPUP_HEIGHT+", top="+o+", left="+e+", scrollbars=yes")},t.prototype.unloadWindow=function(t){this.browserStorage.cleanRequestByInteractionType(n.InteractionType.Popup);this.currentWindow&&this.currentWindow.close();t.preventDefault()},t.prototype.cleanPopup=function(n){n&&n.close();window.removeEventListener("beforeunload",this.unloadWindow);this.browserStorage.removeItem(this.browserStorage.generateCacheKey(p.INTERACTION_STATUS_KEY))},t.prototype.monitorPopupForSameOrigin=function(n){var t=this;return new Promise(function(r,f){var e=setInterval(function(){if(n.closed){t.cleanPopup();clearInterval(e);f(s.createUserCancelledError());return}var o=u.EMPTY_STRING;try{o=n.location.href}catch(h){}i.isEmpty(o)||o==="about:blank"||(clearInterval(e),r())},rt.POLL_INTERVAL_MS)})},t.generatePopupName=function(n,t){return rt.POPUP_NAME_PREFIX+"."+n+"."+t.scopes.join("-")+"."+t.authority+"."+t.correlationId},t.generateLogoutPopupName=function(n,t){var i=t.account&&t.account.homeAccountId;return rt.POPUP_NAME_PREFIX+"."+n+"."+i+"."+t.correlationId},t}(),we=function(n){function t(t,i,r){var u=n.call(this,t,i,r)||this;return u.popupUtils=new vi(i,t.logger),u}return ii(t,n),t.prototype.initiateAuthRequest=function(n,t){if(i.isEmpty(n)){this.authModule.logger.error("Navigate url is empty");throw s.createEmptyNavigationUriError();}else return this.browserStorage.setTemporaryCache(p.INTERACTION_STATUS_KEY,rt.INTERACTION_IN_PROGRESS_VALUE,!0),this.authModule.logger.infoPii("Navigate to:"+n),this.popupUtils.openPopup(n,t.popupName,t.popup)},t.prototype.monitorPopupForHash=function(n){var t=this;return this.popupUtils.monitorPopupForSameOrigin(n).then(function(){var i=n.location.hash;if(t.popupUtils.cleanPopup(n),!i)throw s.createEmptyHashError(n.location.href);if(b.hashContainsKnownProperties(i))return i;throw s.createHashDoesNotContainKnownPropertiesError();})},t}(ru),be=function(n){function t(t,i,r,u){var f=n.call(this,t,i,r)||this;return f.navigateFrameWait=u,f}return ii(t,n),t.prototype.initiateAuthRequest=function(n){return e(this,void 0,void 0,function(){var t;return o(this,function(r){switch(r.label){case 0:if(i.isEmpty(n)){this.authModule.logger.info("Navigate url is empty");throw s.createEmptyNavigationUriError();}return this.navigateFrameWait?[4,this.loadFrame(n)]:[3,2];case 1:return t=r.sent(),[3,3];case 2:t=this.loadFrameSync(n);r.label=3;case 3:return[2,t]}})})},t.prototype.monitorIframeForHash=function(n,t){var r=this;return new Promise(function(f,e){t<iu&&r.authModule.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower ("+t+"ms) than the default ("+iu+"ms). This may result in timeouts.");var h=window.performance.now(),c=h+t,o=setInterval(function(){var h,t,l;if(window.performance.now()>c){r.removeHiddenIframe(n);clearInterval(o);e(s.createMonitorIframeTimeoutError());return}h=u.EMPTY_STRING;t=n.contentWindow;try{h=t?t.location.href:u.EMPTY_STRING}catch(a){}if(!i.isEmpty(h)&&(l=t?t.location.hash:u.EMPTY_STRING,b.hashContainsKnownProperties(l))){r.removeHiddenIframe(n);clearInterval(o);f(l);return}},rt.POLL_INTERVAL_MS)})},t.prototype.loadFrame=function(n){var t=this;return new Promise(function(i,r){var u=t.createHiddenIframe();setTimeout(function(){if(!u){r("Unable to load iframe");return}u.src=n;i(u)},t.navigateFrameWait)})},t.prototype.loadFrameSync=function(n){var t=this.createHiddenIframe();return t.src=n,t},t.prototype.createHiddenIframe=function(){var n=document.createElement("iframe");return n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.getElementsByTagName("body")[0].appendChild(n),n},t.prototype.removeHiddenIframe=function(n){document.body===n.parentNode&&document.body.removeChild(n)},t}(ru),ke="@azure/msal-browser",du="2.14.0";(function(n){n.LOGIN_START="msal:loginStart";n.LOGIN_SUCCESS="msal:loginSuccess";n.LOGIN_FAILURE="msal:loginFailure";n.ACQUIRE_TOKEN_START="msal:acquireTokenStart";n.ACQUIRE_TOKEN_SUCCESS="msal:acquireTokenSuccess";n.ACQUIRE_TOKEN_FAILURE="msal:acquireTokenFailure";n.ACQUIRE_TOKEN_NETWORK_START="msal:acquireTokenFromNetworkStart";n.SSO_SILENT_START="msal:ssoSilentStart";n.SSO_SILENT_SUCCESS="msal:ssoSilentSuccess";n.SSO_SILENT_FAILURE="msal:ssoSilentFailure";n.HANDLE_REDIRECT_START="msal:handleRedirectStart";n.HANDLE_REDIRECT_END="msal:handleRedirectEnd";n.POPUP_OPENED="msal:popupOpened";n.LOGOUT_START="msal:logoutStart";n.LOGOUT_SUCCESS="msal:logoutSuccess";n.LOGOUT_FAILURE="msal:logoutFailure";n.LOGOUT_END="msal:logoutEnd"})(n.EventType||(n.EventType={}));var de=function(){function t(n){if(this.isBrowserEnvironment=typeof window!="undefined",this.config=pe(n,this.isBrowserEnvironment),this.activeLocalAccountId=null,this.eventCallbacks=new Map,this.logger=new ar(this.config.system.loggerOptions,ke,du),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,!this.isBrowserEnvironment){this.browserStorage=ce(this.config.auth.clientId,this.logger);this.browserCrypto=tr;return}this.browserCrypto=new he;this.browserStorage=new wu(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger)}return t.prototype.handleRedirectPromise=function(t){return e(this,void 0,void 0,function(){var f,e,r,i=this;return o(this,function(){return(this.emitEvent(n.EventType.HANDLE_REDIRECT_START,n.InteractionType.Redirect),this.logger.verbose("handleRedirectPromise called"),f=this.getAllAccounts(),this.isBrowserEnvironment)?(e=t||u.EMPTY_STRING,r=this.redirectResponse.get(e),typeof r=="undefined"?(this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise"),r=this.handleRedirectResponse(t).then(function(t){if(t){var r=f.length<i.getAllAccounts().length;r?(i.emitEvent(n.EventType.LOGIN_SUCCESS,n.InteractionType.Redirect,t),i.logger.verbose("handleRedirectResponse returned result, login success")):(i.emitEvent(n.EventType.ACQUIRE_TOKEN_SUCCESS,n.InteractionType.Redirect,t),i.logger.verbose("handleRedirectResponse returned result, acquire token success"))}return i.emitEvent(n.EventType.HANDLE_REDIRECT_END,n.InteractionType.Redirect),t}).catch(function(t){f.length>0?i.emitEvent(n.EventType.ACQUIRE_TOKEN_FAILURE,n.InteractionType.Redirect,null,t):i.emitEvent(n.EventType.LOGIN_FAILURE,n.InteractionType.Redirect,null,t);i.emitEvent(n.EventType.HANDLE_REDIRECT_END,n.InteractionType.Redirect);throw t;}),this.redirectResponse.set(e,r)):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),[2,r]):(this.logger.verbose("handleRedirectPromise returns null, not browser environment"),[2,null])})})},t.prototype.handleRedirectResponse=function(t){return e(this,void 0,void 0,function(){var r,u,i,h,c,l,e,f,s;return o(this,function(o){switch(o.label){case 0:if(!this.interactionInProgress())return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(r=this.getRedirectResponseHash(t||window.location.hash),!r)return this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(n.InteractionType.Redirect),[2,null];try{u=this.validateAndExtractStateFromHash(r,n.InteractionType.Redirect);d.clearHash();this.logger.verbose("State extracted from hash")}catch(a){return this.logger.info("handleRedirectPromise was unable to extract state due to: "+a),this.browserStorage.cleanRequestByInteractionType(n.InteractionType.Redirect),[2,null]}return(i=this.browserStorage.getTemporaryCache(p.ORIGIN_URI,!0)||"",h=b.removeHashFromUrl(i),c=b.removeHashFromUrl(window.location.href),!(h===c&&this.config.auth.navigateToLoginRequestUrl))?[3,2]:(this.logger.verbose("Current page is loginRequestUrl, handling hash"),[4,this.handleHash(r,u)]);case 1:return l=o.sent(),i.indexOf("#")>-1&&d.replaceHash(i),[2,l];case 2:return!this.config.auth.navigateToLoginRequestUrl?(this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash"),[2,this.handleHash(r,u)]):[3,3];case 3:return!d.isInIframe()?(this.browserStorage.setTemporaryCache(p.URL_HASH,r,!0),e={apiId:n.ApiId.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0},f=!0,!(!i||i==="null"))?[3,5]:(s=d.getHomepage(),this.browserStorage.setTemporaryCache(p.ORIGIN_URI,s,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),[4,this.navigationClient.navigateInternal(s,e)]):[3,8];case 4:return f=o.sent(),[3,7];case 5:return this.logger.verbose("Navigating to loginRequestUrl: "+i),[4,this.navigationClient.navigateInternal(i,e)];case 6:f=o.sent();o.label=7;case 7:if(!f)return[2,this.handleHash(r,u)];o.label=8;case 8:return[2,null]}})})},t.prototype.getRedirectResponseHash=function(n){this.logger.verbose("getRedirectResponseHash called");var t=b.hashContainsKnownProperties(n),i=this.browserStorage.getTemporaryCache(p.URL_HASH,!0);return(this.browserStorage.removeItem(this.browserStorage.generateCacheKey(p.URL_HASH)),t)?(this.logger.verbose("Hash contains known properties, returning response hash"),n):(this.logger.verbose("Hash does not contain known properties, returning cached hash"),i)},t.prototype.validateAndExtractStateFromHash=function(n,t){var i,r;if(this.logger.verbose("validateAndExtractStateFromHash called"),i=b.getDeserializedHash(n),!i.state)throw s.createHashDoesNotContainStateError();if(r=pu.extractBrowserRequestState(this.browserCrypto,i.state),!r)throw s.createUnableToParseStateError();if(r.interactionType!==t)throw s.createStateInteractionTypeMismatchError();return this.logger.verbose("Returning state from hash"),i.state},t.prototype.handleHash=function(t,i){return e(this,void 0,void 0,function(){var r,u,f,e,c,h;return o(this,function(o){switch(o.label){case 0:this.logger.verbose("handleHash called");r=this.browserStorage.getCachedRequest(i,this.browserCrypto);u=this.initializeServerTelemetryManager(n.ApiId.handleRedirectPromise,r.correlationId);o.label=1;case 1:if(o.trys.push([1,4,,5]),f=this.browserStorage.getCachedAuthority(i),!f)throw s.createNoCachedAuthorityError();return[4,this.createAuthCodeClient(u,f)];case 2:return e=o.sent(),c=new ku(e,this.browserStorage,r,this.browserCrypto),[4,c.handleCodeResponse(t,i,e.authority,this.networkClient,this.config.auth.clientId)];case 3:return[2,o.sent()];case 4:h=o.sent();u.cacheFailedRequest(h);this.browserStorage.cleanRequestByInteractionType(n.InteractionType.Redirect);throw h;case 5:return[2]}})})},t.prototype.acquireTokenRedirect=function(t){return e(this,void 0,void 0,function(){var u,i,f,s,e,h,c,l,r;return o(this,function(o){switch(o.label){case 0:this.preflightBrowserEnvironmentCheck(n.InteractionType.Redirect);this.logger.verbose("acquireTokenRedirect called");u=this.getAllAccounts().length>0;u?this.emitEvent(n.EventType.ACQUIRE_TOKEN_START,n.InteractionType.Redirect,t):this.emitEvent(n.EventType.LOGIN_START,n.InteractionType.Redirect,t);i=this.preflightInteractiveRequest(t,n.InteractionType.Redirect);f=this.initializeServerTelemetryManager(n.ApiId.acquireTokenRedirect,i.correlationId);o.label=1;case 1:return o.trys.push([1,5,,6]),[4,this.initializeAuthorizationCodeRequest(i)];case 2:return s=o.sent(),[4,this.createAuthCodeClient(f,i.authority)];case 3:return e=o.sent(),h=new ku(e,this.browserStorage,s,this.browserCrypto),[4,e.getAuthCodeUrl(i)];case 4:return c=o.sent(),l=this.getRedirectStartPage(t.redirectStartPage),[2,h.initiateAuthRequest(c,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:l,onRedirectNavigate:t.onRedirectNavigate})];case 5:r=o.sent();u?this.emitEvent(n.EventType.ACQUIRE_TOKEN_FAILURE,n.InteractionType.Redirect,null,r):this.emitEvent(n.EventType.LOGIN_FAILURE,n.InteractionType.Redirect,null,r);f.cacheFailedRequest(r);this.browserStorage.cleanRequestByState(i.state);throw r;case 6:return[2]}})})},t.prototype.acquireTokenPopup=function(t){var i,r,u;try{this.preflightBrowserEnvironmentCheck(n.InteractionType.Popup);this.logger.verbose("acquireTokenPopup called");i=this.preflightInteractiveRequest(t,n.InteractionType.Popup)}catch(f){return Promise.reject(f)}return r=vi.generatePopupName(this.config.auth.clientId,i),this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(i,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),u=vi.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(i,r,u))},t.prototype.acquireTokenPopupAsync=function(t,i,r){return e(this,void 0,void 0,function(){var f,l,e,s,y,h,p,a,v,w,c,b,u;return o(this,function(o){switch(o.label){case 0:this.logger.verbose("acquireTokenPopupAsync called");f=this.getAllAccounts();f.length>0?this.emitEvent(n.EventType.ACQUIRE_TOKEN_START,n.InteractionType.Popup,t):this.emitEvent(n.EventType.LOGIN_START,n.InteractionType.Popup,t);l=this.initializeServerTelemetryManager(n.ApiId.acquireTokenPopup,t.correlationId);o.label=1;case 1:return o.trys.push([1,7,,8]),[4,this.initializeAuthorizationCodeRequest(t)];case 2:return e=o.sent(),[4,this.createAuthCodeClient(l,t.authority)];case 3:return s=o.sent(),[4,s.getAuthCodeUrl(t)];case 4:return y=o.sent(),h=new we(s,this.browserStorage,e),p={popup:r,popupName:i},a=h.initiateAuthRequest(y,p),this.emitEvent(n.EventType.POPUP_OPENED,n.InteractionType.Popup,{popupWindow:a},null),[4,h.monitorPopupForHash(a)];case 5:return v=o.sent(),w=this.validateAndExtractStateFromHash(v,n.InteractionType.Popup),ir.removeThrottle(this.browserStorage,this.config.auth.clientId,e.authority,e.scopes),[4,h.handleCodeResponse(v,w,s.authority,this.networkClient)];case 6:return c=o.sent(),b=f.length<this.getAllAccounts().length,b?this.emitEvent(n.EventType.LOGIN_SUCCESS,n.InteractionType.Popup,c):this.emitEvent(n.EventType.ACQUIRE_TOKEN_SUCCESS,n.InteractionType.Popup,c),[2,c];case 7:u=o.sent();f.length>0?this.emitEvent(n.EventType.ACQUIRE_TOKEN_FAILURE,n.InteractionType.Popup,null,u):this.emitEvent(n.EventType.LOGIN_FAILURE,n.InteractionType.Popup,null,u);l.cacheFailedRequest(u);this.browserStorage.cleanRequestByState(t.state);throw u;case 8:return[2]}})})},t.prototype.ssoSilent=function(t){return e(this,void 0,void 0,function(){var i,r;return o(this,function(u){switch(u.label){case 0:this.preflightBrowserEnvironmentCheck(n.InteractionType.Silent);this.logger.verbose("ssoSilent called");this.emitEvent(n.EventType.SSO_SILENT_START,n.InteractionType.Silent,t);u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.acquireTokenByIframe(t,n.ApiId.ssoSilent)];case 2:return i=u.sent(),this.emitEvent(n.EventType.SSO_SILENT_SUCCESS,n.InteractionType.Silent,i),[2,i];case 3:r=u.sent();this.emitEvent(n.EventType.SSO_SILENT_FAILURE,n.InteractionType.Silent,null,r);throw r;case 4:return[2]}})})},t.prototype.acquireTokenByIframe=function(t,r){return e(this,void 0,void 0,function(){var u,f,c,e,l,h;return o(this,function(o){switch(o.label){case 0:if(this.logger.verbose("acquireTokenByIframe called"),i.isEmpty(t.loginHint)&&i.isEmpty(t.sid)&&(!t.account||i.isEmpty(t.account.username)))throw s.createSilentSSOInsufficientInfoError();if(t.prompt&&t.prompt!==lt.NONE)throw s.createSilentPromptValueError(t.prompt);u=this.initializeAuthorizationRequest(w(w({},t),{prompt:lt.NONE}),n.InteractionType.Silent);f=this.initializeServerTelemetryManager(r,u.correlationId);o.label=1;case 1:return o.trys.push([1,6,,7]),[4,this.initializeAuthorizationCodeRequest(u)];case 2:return c=o.sent(),[4,this.createAuthCodeClient(f,u.authority)];case 3:return e=o.sent(),[4,e.getAuthCodeUrl(u)];case 4:return l=o.sent(),[4,this.silentTokenHelper(l,c,e)];case 5:return[2,o.sent()];case 6:h=o.sent();f.cacheFailedRequest(h);this.browserStorage.cleanRequestByState(u.state);throw h;case 7:return[2]}})})},t.prototype.acquireTokenByRefreshToken=function(t){return e(this,void 0,void 0,function(){var r,u,f,i,e,s,h;return o(this,function(o){switch(o.label){case 0:this.emitEvent(n.EventType.ACQUIRE_TOKEN_NETWORK_START,n.InteractionType.Silent,t);d.blockReloadInHiddenIframes();r=w(w({},t),this.initializeBaseRequest(t));u=this.initializeServerTelemetryManager(n.ApiId.acquireTokenSilent_silentFlow,r.correlationId);o.label=1;case 1:return o.trys.push([1,4,,7]),[4,this.createRefreshTokenClient(u,r.authority)];case 2:return f=o.sent(),[4,f.acquireTokenByRefreshToken(r)];case 3:return[2,o.sent()];case 4:return(i=o.sent(),u.cacheFailedRequest(i),e=i instanceof oi,s=i instanceof hi,h=i.errorCode===rt.INVALID_GRANT_ERROR,!(e&&h&&!s))?[3,6]:(this.logger.verbose("Refresh token expired or invalid, attempting acquire token by iframe"),[4,this.acquireTokenByIframe(t,n.ApiId.acquireTokenSilent_authCode)]);case 5:return[2,o.sent()];case 6:throw i;case 7:return[2]}})})},t.prototype.silentTokenHelper=function(t,i,r){return e(this,void 0,void 0,function(){var u,e,f,s;return o(this,function(o){switch(o.label){case 0:return u=new be(r,this.browserStorage,i,this.config.system.navigateFrameWait),[4,u.initiateAuthRequest(t)];case 1:return e=o.sent(),[4,u.monitorIframeForHash(e,this.config.system.iframeHashTimeout)];case 2:return f=o.sent(),s=this.validateAndExtractStateFromHash(f,n.InteractionType.Silent),[2,u.handleCodeResponse(f,s,r.authority,this.networkClient)]}})})},t.prototype.logout=function(n){return e(this,void 0,void 0,function(){return o(this,function(){return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead."),[2,this.logoutRedirect(n)]})})},t.prototype.logoutRedirect=function(t){return e(this,void 0,void 0,function(){var i,f,s,r,e,h,u;return o(this,function(o){switch(o.label){case 0:this.preflightBrowserEnvironmentCheck(n.InteractionType.Redirect);this.logger.verbose("logoutRedirect called");i=this.initializeLogoutRequest(t);f=this.initializeServerTelemetryManager(n.ApiId.logout,i.correlationId);o.label=1;case 1:return o.trys.push([1,9,,10]),this.emitEvent(n.EventType.LOGOUT_START,n.InteractionType.Redirect,t),[4,this.createAuthCodeClient(f,t&&t.authority)];case 2:return(s=o.sent(),r=s.getLogoutUri(i),(!i.account||st.accountInfoIsEqual(i.account,this.getActiveAccount()))&&(this.logger.verbose("Setting active account to null"),this.setActiveAccount(null)),e={apiId:n.ApiId.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},this.emitEvent(n.EventType.LOGOUT_SUCCESS,n.InteractionType.Redirect,i),!(t&&typeof t.onRedirectNavigate=="function"))?[3,6]:(h=t.onRedirectNavigate(r),!(h!==!1))?[3,4]:(this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),[4,this.navigationClient.navigateExternal(r,e)]);case 3:return o.sent(),[2];case 4:this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");o.label=5;case 5:return[3,8];case 6:return[4,this.navigationClient.navigateExternal(r,e)];case 7:return o.sent(),[2];case 8:return[3,10];case 9:u=o.sent();f.cacheFailedRequest(u);this.emitEvent(n.EventType.LOGOUT_FAILURE,n.InteractionType.Redirect,null,u);throw u;case 10:return this.emitEvent(n.EventType.LOGOUT_END,n.InteractionType.Redirect),[2]}})})},t.prototype.logoutPopup=function(t){var i,r,u,f,e;try{this.preflightBrowserEnvironmentCheck(n.InteractionType.Popup);this.logger.verbose("logoutPopup called");i=this.initializeLogoutRequest(t)}catch(o){return Promise.reject(o)}return r=vi.generateLogoutPopupName(this.config.auth.clientId,i),this.config.system.asyncPopups?this.logger.verbose("asyncPopups set to true"):(this.logger.verbose("asyncPopup set to false, opening popup"),u=vi.openSizedPopup("about:blank",r)),f=t&&t.authority,e=t&&t.mainWindowRedirectUri,this.logoutPopupAsync(i,r,f,u,e)},t.prototype.logoutPopupAsync=function(t,i,r,u,f){return e(this,void 0,void 0,function(){var c,a,v,e,s,y,w,l,h;return o(this,function(o){switch(o.label){case 0:this.logger.verbose("logoutPopupAsync called");this.emitEvent(n.EventType.LOGOUT_START,n.InteractionType.Popup,t);c=this.initializeServerTelemetryManager(n.ApiId.logoutPopup,t.correlationId);o.label=1;case 1:return o.trys.push([1,7,,8]),this.browserStorage.setTemporaryCache(p.INTERACTION_STATUS_KEY,rt.INTERACTION_IN_PROGRESS_VALUE,!0),[4,this.createAuthCodeClient(c,r)];case 2:a=o.sent();v=a.getLogoutUri(t);(!t.account||st.accountInfoIsEqual(t.account,this.getActiveAccount()))&&(this.logger.verbose("Setting active account to null"),this.setActiveAccount(null));this.emitEvent(n.EventType.LOGOUT_SUCCESS,n.InteractionType.Popup,t);e=new vi(this.browserStorage,this.logger);s=e.openPopup(v,i,u);this.emitEvent(n.EventType.POPUP_OPENED,n.InteractionType.Popup,{popupWindow:s},null);o.label=3;case 3:return o.trys.push([3,5,,6]),[4,e.monitorPopupForSameOrigin(s)];case 4:return o.sent(),this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri"),[3,6];case 5:return y=o.sent(),this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: "+y),[3,6];case 6:return e.cleanPopup(s),f?(w={apiId:n.ApiId.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},l=b.getAbsoluteUrl(f,d.getCurrentUri()),this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii("Redirecing main window to: "+l),this.navigationClient.navigateInternal(l,w)):this.logger.verbose("No main window navigation requested"),[3,8];case 7:h=o.sent();this.browserStorage.removeItem(this.browserStorage.generateCacheKey(p.INTERACTION_STATUS_KEY));this.emitEvent(n.EventType.LOGOUT_FAILURE,n.InteractionType.Popup,null,h);c.cacheFailedRequest(h);throw h;case 8:return this.emitEvent(n.EventType.LOGOUT_END,n.InteractionType.Popup),[2]}})})},t.prototype.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.isBrowserEnvironment?this.browserStorage.getAllAccounts():[]},t.prototype.getAccountByUsername=function(n){var t=this.getAllAccounts();return!i.isEmpty(n)&&t&&t.length?(this.logger.verbose("Account matching username found, returning"),this.logger.verbosePii("Returning signed-in accounts matching username: "+n),t.filter(function(t){return t.username.toLowerCase()===n.toLowerCase()})[0]||null):(this.logger.verbose("getAccountByUsername: No matching account found, returning null"),null)},t.prototype.getAccountByHomeId=function(n){var t=this.getAllAccounts();return!i.isEmpty(n)&&t&&t.length?(this.logger.verbose("Account matching homeAccountId found, returning"),this.logger.verbosePii("Returning signed-in accounts matching homeAccountId: "+n),t.filter(function(t){return t.homeAccountId===n})[0]||null):(this.logger.verbose("getAccountByHomeId: No matching account found, returning null"),null)},t.prototype.getAccountByLocalId=function(n){var t=this.getAllAccounts();return!i.isEmpty(n)&&t&&t.length?(this.logger.verbose("Account matching localAccountId found, returning"),this.logger.verbosePii("Returning signed-in accounts matching localAccountId: "+n),t.filter(function(t){return t.localAccountId===n})[0]||null):(this.logger.verbose("getAccountByLocalId: No matching account found, returning null"),null)},t.prototype.setActiveAccount=function(n){n?(this.logger.verbose("setActiveAccount: Active account set"),this.activeLocalAccountId=n.localAccountId):(this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.activeLocalAccountId=null)},t.prototype.getActiveAccount=function(){return this.activeLocalAccountId?this.getAccountByLocalId(this.activeLocalAccountId):(this.logger.verbose("getActiveAccount: No active account"),null)},t.prototype.getRedirectUri=function(n){this.logger.verbose("getRedirectUri called");var t=n||this.config.auth.redirectUri||d.getCurrentUri();return b.getAbsoluteUrl(t,d.getCurrentUri())},t.prototype.getRedirectStartPage=function(n){this.logger.verbose("getRedirectStartPage called");var t=n||window.location.href;return b.getAbsoluteUrl(t,d.getCurrentUri())},t.prototype.getDiscoveredAuthority=function(n){return e(this,void 0,void 0,function(){var t;return o(this,function(i){switch(i.label){case 0:return(this.logger.verbose("getDiscoveredAuthority called"),t={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},!n)?[3,2]:(this.logger.verbose("Creating discovered authority with request authority"),[4,dr.createDiscoveredInstance(n,this.config.system.networkClient,this.browserStorage,t)]);case 1:return[2,i.sent()];case 2:return this.logger.verbose("Creating discovered authority with configured authority"),[4,dr.createDiscoveredInstance(this.config.auth.authority,this.config.system.networkClient,this.browserStorage,t)];case 3:return[2,i.sent()]}})})},t.prototype.interactionInProgress=function(){return this.browserStorage.getTemporaryCache(p.INTERACTION_STATUS_KEY,!0)===rt.INTERACTION_IN_PROGRESS_VALUE},t.prototype.createAuthCodeClient=function(n,t){return e(this,void 0,void 0,function(){var i;return o(this,function(r){switch(r.label){case 0:return this.logger.verbose("createAuthCodeClient called"),[4,this.getClientConfiguration(n,t)];case 1:return i=r.sent(),[2,new pf(i)]}})})},t.prototype.createSilentFlowClient=function(n,t){return e(this,void 0,void 0,function(){var i;return o(this,function(r){switch(r.label){case 0:return this.logger.verbose("createSilentFlowClient called"),[4,this.getClientConfiguration(n,t)];case 1:return i=r.sent(),[2,new wf(i)]}})})},t.prototype.createRefreshTokenClient=function(n,t){return e(this,void 0,void 0,function(){var i;return o(this,function(r){switch(r.label){case 0:return this.logger.verbose("createRefreshTokenClient called"),[4,this.getClientConfiguration(n,t)];case 1:return i=r.sent(),[2,new cu(i)]}})})},t.prototype.getClientConfiguration=function(n,t){return e(this,void 0,void 0,function(){var i;return o(this,function(r){switch(r.label){case 0:return this.logger.verbose("getClientConfiguration called"),[4,this.getDiscoveredAuthority(t)];case 1:return i=r.sent(),[2,{authOptions:{clientId:this.config.auth.clientId,authority:i,clientCapabilities:this.config.auth.clientCapabilities},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds},loggerOptions:{loggerCallback:this.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:this.config.system.loggerOptions.piiLoggingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:rt.MSAL_SKU,version:du,cpu:"",os:""}}]}})})},t.prototype.preflightInteractiveRequest=function(n,t){if(this.logger.verbose("preflightInteractiveRequest called, validating app environment"),d.blockReloadInHiddenIframes(),this.interactionInProgress())throw s.createInteractionInProgressError();return this.initializeAuthorizationRequest(n,t)},t.prototype.preflightBrowserEnvironmentCheck=function(t){if(this.logger.verbose("preflightBrowserEnvironmentCheck started"),d.blockNonBrowserEnvironment(this.isBrowserEnvironment),d.blockRedirectInIframe(t,this.config.system.allowRedirectInIframe),d.blockReloadInHiddenIframes(),d.blockAcquireTokenInPopups(),t===n.InteractionType.Redirect&&this.config.cache.cacheLocation===n.BrowserCacheLocation.MemoryStorage&&!this.config.cache.storeAuthStateInCookie)throw ft.createInMemoryRedirectUnavailableError();},t.prototype.initializeBaseRequest=function(t){this.logger.verbose("Initializing BaseAuthRequest");var i=t.authority||this.config.auth.authority,r=uu(t&&t.scopes||[]),u=t&&t.correlationId||this.browserCrypto.createNewGuid();return t.authenticationScheme?this.logger.verbose('Authentication Scheme set to "'+t.authenticationScheme+'" as configured in Auth request'):(t.authenticationScheme=n.AuthenticationScheme.BEARER,this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request')),w(w({},t),{correlationId:u,authority:i,scopes:r})},t.prototype.initializeServerTelemetryManager=function(n,t,i){this.logger.verbose("initializeServerTelemetryManager called");var r={clientId:this.config.auth.clientId,correlationId:t,apiId:n,forceRefresh:i||!1,wrapperSKU:this.wrapperSKU,wrapperVer:this.wrapperVer};return new ne(r,this.browserStorage)},t.prototype.initializeAuthorizationRequest=function(n,t){var e,u;this.logger.verbose("initializeAuthorizationRequest called");var o=this.getRedirectUri(n.redirectUri),s={interactionType:t},h=ci.setRequestState(this.browserCrypto,n&&n.state||"",s),r=w(w({},this.initializeBaseRequest(n)),{redirectUri:o,state:h,nonce:n.nonce||this.browserCrypto.createNewGuid(),responseMode:di.FRAGMENT}),f=n.account||this.getActiveAccount();return f&&(this.logger.verbose("Setting validated request account"),this.logger.verbosePii("Setting validated request account: "+f),r.account=f),i.isEmpty(r.loginHint)&&(e=this.browserStorage.getTemporaryCache(ot.ADAL_ID_TOKEN),e&&(u=new ti(e,this.browserCrypto),this.browserStorage.removeItem(ot.ADAL_ID_TOKEN),u.claims&&u.claims.upn&&(this.logger.verbose("No SSO params used and ADAL token retrieved, setting ADAL upn as loginHint"),r.loginHint=u.claims.upn))),this.browserStorage.updateCacheEntries(r.state,r.nonce,r.authority),r},t.prototype.initializeAuthorizationCodeRequest=function(n){return e(this,void 0,void 0,function(){var t,i;return o(this,function(r){switch(r.label){case 0:return[4,this.browserCrypto.generatePkceCodes()];case 1:return t=r.sent(),i=w(w({},n),{redirectUri:n.redirectUri,code:"",codeVerifier:t.verifier}),n.codeChallenge=t.challenge,n.codeChallengeMethod=u.S256_CODE_CHALLENGE_METHOD,[2,i]}})})},t.prototype.initializeLogoutRequest=function(n){if(this.logger.verbose("initializeLogoutRequest called"),this.interactionInProgress())throw s.createInteractionInProgressError();var t=w({correlationId:this.browserCrypto.createNewGuid()},n);return n&&n.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri passed as null, not settibng post logout redirect uri"):n&&n.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request"),t.postLogoutRedirectUri=b.getAbsoluteUrl(n.postLogoutRedirectUri,d.getCurrentUri())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect"):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri"),t.postLogoutRedirectUri=b.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,d.getCurrentUri())):(this.logger.verbose("Setting postLogoutRedirectUri to current page"),t.postLogoutRedirectUri=b.getAbsoluteUrl(d.getCurrentUri(),d.getCurrentUri())),t},t.prototype.emitEvent=function(n,t,i,r){var f=this,u;this.isBrowserEnvironment&&(u={eventType:n,interactionType:t||null,payload:i||null,error:r||null,timestamp:Date.now()},this.logger.info("Emitting event: "+n),this.eventCallbacks.forEach(function(t,i){f.logger.verbose("Emitting event to callback "+i+": "+n);t.apply(null,[u])}))},t.prototype.addEventCallback=function(n){if(this.isBrowserEnvironment){var t=this.browserCrypto.createNewGuid();return this.eventCallbacks.set(t,n),this.logger.verbose("Event callback registered with id: "+t),t}return null},t.prototype.removeEventCallback=function(n){this.eventCallbacks.delete(n);this.logger.verbose("Event callback "+n+" removed.")},t.prototype.getLogger=function(){return this.logger},t.prototype.setLogger=function(n){this.logger=n},t.prototype.initializeWrapperLibrary=function(n,t){this.wrapperSKU=n;this.wrapperVer=t},t.prototype.setNavigationClient=function(n){this.navigationClient=n},t}(),ge=function(t){function i(n){return t.call(this,n)||this}return ii(i,t),i.prototype.loginRedirect=function(n){return e(this,void 0,void 0,function(){return o(this,function(){return this.logger.verbose("loginRedirect called"),[2,this.acquireTokenRedirect(n||gr)]})})},i.prototype.loginPopup=function(n){return this.logger.verbose("loginPopup called"),this.acquireTokenPopup(n||gr)},i.prototype.acquireTokenSilent=function(t){return e(this,void 0,void 0,function(){var r,i,h,c,u,l,f,e;return o(this,function(o){switch(o.label){case 0:if(this.preflightBrowserEnvironmentCheck(n.InteractionType.Silent),this.logger.verbose("acquireTokenSilent called"),r=t.account||this.getActiveAccount(),!r)throw s.createNoAccountError();i=w(w(w({},t),this.initializeBaseRequest(t)),{account:r,forceRefresh:t.forceRefresh||!1});this.emitEvent(n.EventType.ACQUIRE_TOKEN_START,n.InteractionType.Silent,t);o.label=1;case 1:return o.trys.push([1,4,,9]),h=this.initializeServerTelemetryManager(n.ApiId.acquireTokenSilent_silentFlow,i.correlationId),[4,this.createSilentFlowClient(h,i.authority)];case 2:return c=o.sent(),[4,c.acquireCachedToken(i)];case 3:return u=o.sent(),this.emitEvent(n.EventType.ACQUIRE_TOKEN_SUCCESS,n.InteractionType.Silent,u),[2,u];case 4:l=o.sent();o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.acquireTokenByRefreshToken(i)];case 6:return f=o.sent(),this.emitEvent(n.EventType.ACQUIRE_TOKEN_SUCCESS,n.InteractionType.Silent,f),[2,f];case 7:e=o.sent();this.emitEvent(n.EventType.ACQUIRE_TOKEN_FAILURE,n.InteractionType.Silent,null,e);throw e;case 8:return[3,9];case 9:return[2]}})})},i}(de),no={acquireTokenPopup:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},acquireTokenRedirect:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},acquireTokenSilent:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},getAllAccounts:function(){return[]},getAccountByHomeId:function(){return null},getAccountByUsername:function(){return null},getAccountByLocalId:function(){return null},handleRedirectPromise:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},loginPopup:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},loginRedirect:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},logout:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},logoutRedirect:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},logoutPopup:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},ssoSilent:function(){return Promise.reject(ft.createStubPcaInstanceCalledError())},addEventCallback:function(){return null},removeEventCallback:function(){return},getLogger:function(){throw ft.createStubPcaInstanceCalledError();},setLogger:function(){return},setActiveAccount:function(){return},getActiveAccount:function(){return null},initializeWrapperLibrary:function(){return},setNavigationClient:function(){return}},to=function(){function t(){}return t.getInteractionStatusFromEvent=function(t){switch(t.eventType){case n.EventType.LOGIN_START:return n.InteractionStatus.Login;case n.EventType.SSO_SILENT_START:return n.InteractionStatus.SsoSilent;case n.EventType.ACQUIRE_TOKEN_START:if(t.interactionType===n.InteractionType.Redirect||t.interactionType===n.InteractionType.Popup)return n.InteractionStatus.AcquireToken;break;case n.EventType.HANDLE_REDIRECT_START:return n.InteractionStatus.HandleRedirect;case n.EventType.LOGOUT_START:return n.InteractionStatus.Logout;case n.EventType.LOGIN_SUCCESS:case n.EventType.SSO_SILENT_SUCCESS:case n.EventType.HANDLE_REDIRECT_END:case n.EventType.LOGIN_FAILURE:case n.EventType.SSO_SILENT_FAILURE:case n.EventType.LOGOUT_END:return n.InteractionStatus.None;case n.EventType.ACQUIRE_TOKEN_SUCCESS:case n.EventType.ACQUIRE_TOKEN_FAILURE:if(t.interactionType===n.InteractionType.Redirect||t.interactionType===n.InteractionType.Popup)return n.InteractionStatus.None}return null},t}();n.AccountEntity=st;n.AuthError=v;n.AuthErrorMessage=lr;n.BrowserAuthError=s;n.BrowserAuthErrorMessage=r;n.BrowserConfigurationAuthError=ft;n.BrowserConfigurationAuthErrorMessage=ut;n.BrowserUtils=d;n.EventMessageUtils=to;n.InteractionRequiredAuthError=hi;n.Logger=ar;n.NavigationClient=bu;n.PublicClientApplication=ge;n.StringUtils=i;n.UrlString=b;n.stubbedPublicClientApplication=no;Object.defineProperty(n,"__esModule",{value:!0})});window.jQuery&&$(function(){$("a[href~='/_logout']").click(function(){var n=window.safeGetAllAccountsFromMsal();window.myMSALObj&&n&&n.length>0&&(window.myMSALObj.logoutRedirect({onRedirectNavigate:function(){return!1}}),msalInstance.logoutRedirect({account:n[0],postLogoutRedirectUri:"https://devicepartner.microsoft.com"}))})})