@azure/msal-browser 3.0.0-alpha.1 → 3.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +213 -213
- package/dist/app/IPublicClientApplication.d.ts +45 -45
- package/dist/app/IPublicClientApplication.js +96 -96
- package/dist/app/PublicClientApplication.d.ts +244 -244
- package/dist/app/PublicClientApplication.js +307 -307
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +63 -63
- package/dist/broker/nativeBroker/NativeMessageHandler.js +255 -255
- package/dist/broker/nativeBroker/NativeRequest.d.ts +43 -43
- package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
- package/dist/cache/AsyncMemoryStorage.d.ts +51 -51
- package/dist/cache/AsyncMemoryStorage.js +132 -132
- package/dist/cache/BrowserCacheManager.d.ts +377 -377
- package/dist/cache/BrowserCacheManager.js +1276 -1276
- package/dist/cache/BrowserStorage.d.ts +11 -11
- package/dist/cache/BrowserStorage.js +35 -35
- package/dist/cache/CryptoKeyStore.d.ts +17 -17
- package/dist/cache/CryptoKeyStore.js +41 -41
- package/dist/cache/DatabaseStorage.d.ts +56 -56
- package/dist/cache/DatabaseStorage.js +190 -190
- package/dist/cache/IAsyncMemoryStorage.d.ts +27 -27
- package/dist/cache/ITokenCache.d.ts +10 -10
- package/dist/cache/IWindowStorage.d.ts +27 -27
- package/dist/cache/MemoryStorage.d.ts +11 -11
- package/dist/cache/MemoryStorage.js +31 -31
- package/dist/cache/TokenCache.d.ts +76 -76
- package/dist/cache/TokenCache.js +225 -225
- package/dist/config/Configuration.d.ts +203 -203
- package/dist/config/Configuration.js +101 -101
- package/dist/controllers/ControllerFactory.d.ts +9 -9
- package/dist/controllers/ControllerFactory.js +37 -37
- package/dist/controllers/IController.d.ts +66 -66
- package/dist/controllers/StandardController.d.ts +413 -413
- package/dist/controllers/StandardController.js +1272 -1272
- package/dist/crypto/BrowserCrypto.d.ts +61 -61
- package/dist/crypto/BrowserCrypto.js +131 -131
- package/dist/crypto/CryptoOps.d.ts +73 -73
- package/dist/crypto/CryptoOps.js +150 -150
- package/dist/crypto/GuidGenerator.d.ts +12 -12
- package/dist/crypto/GuidGenerator.js +96 -96
- package/dist/crypto/ISubtleCrypto.d.ts +9 -9
- package/dist/crypto/ModernBrowserCrypto.d.ts +9 -9
- package/dist/crypto/ModernBrowserCrypto.js +24 -24
- package/dist/crypto/MsBrowserCrypto.d.ts +9 -9
- package/dist/crypto/MsBrowserCrypto.js +79 -79
- package/dist/crypto/MsrBrowserCrypto.d.ts +17 -17
- package/dist/crypto/MsrBrowserCrypto.js +28 -28
- package/dist/crypto/PkceGenerator.d.ts +24 -24
- package/dist/crypto/PkceGenerator.js +58 -58
- package/dist/crypto/SignedHttpRequest.d.ts +30 -30
- package/dist/crypto/SignedHttpRequest.js +39 -39
- package/dist/encode/Base64Decode.d.ts +22 -22
- package/dist/encode/Base64Decode.js +73 -73
- package/dist/encode/Base64Encode.d.ts +31 -31
- package/dist/encode/Base64Encode.js +79 -79
- package/dist/error/BrowserAuthError.d.ts +382 -382
- package/dist/error/BrowserAuthError.js +483 -483
- package/dist/error/BrowserConfigurationAuthError.d.ts +70 -70
- package/dist/error/BrowserConfigurationAuthError.js +96 -96
- package/dist/error/NativeAuthError.d.ts +56 -56
- package/dist/error/NativeAuthError.js +88 -88
- package/dist/event/EventHandler.d.ts +41 -41
- package/dist/event/EventHandler.js +119 -119
- package/dist/event/EventMessage.d.ts +25 -25
- package/dist/event/EventMessage.js +67 -67
- package/dist/event/EventType.d.ts +26 -26
- package/dist/event/EventType.js +31 -31
- package/dist/index.d.ts +35 -35
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +52 -52
- package/dist/interaction_client/BaseInteractionClient.js +138 -138
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +10 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts +148 -148
- package/dist/interaction_client/NativeInteractionClient.js +516 -516
- package/dist/interaction_client/PopupClient.d.ts +111 -111
- package/dist/interaction_client/PopupClient.js +476 -476
- package/dist/interaction_client/RedirectClient.d.ts +48 -48
- package/dist/interaction_client/RedirectClient.js +290 -290
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -22
- package/dist/interaction_client/SilentAuthCodeClient.js +62 -62
- package/dist/interaction_client/SilentCacheClient.d.ts +21 -21
- package/dist/interaction_client/SilentCacheClient.js +67 -67
- package/dist/interaction_client/SilentIframeClient.d.ts +31 -31
- package/dist/interaction_client/SilentIframeClient.js +127 -127
- package/dist/interaction_client/SilentRefreshClient.d.ts +19 -19
- package/dist/interaction_client/SilentRefreshClient.js +62 -62
- package/dist/interaction_client/StandardInteractionClient.d.ts +59 -59
- package/dist/interaction_client/StandardInteractionClient.js +259 -259
- package/dist/interaction_handler/InteractionHandler.d.ts +39 -39
- package/dist/interaction_handler/InteractionHandler.js +127 -127
- package/dist/interaction_handler/RedirectHandler.d.ts +24 -24
- package/dist/interaction_handler/RedirectHandler.js +118 -118
- package/dist/interaction_handler/SilentHandler.d.ts +47 -47
- package/dist/interaction_handler/SilentHandler.js +162 -162
- package/dist/internals.d.ts +23 -23
- package/dist/internals.js +4 -4
- package/dist/navigation/INavigationClient.d.ts +16 -16
- package/dist/navigation/NavigationClient.d.ts +22 -22
- package/dist/navigation/NavigationClient.js +40 -40
- package/dist/navigation/NavigationOptions.d.ts +12 -12
- package/dist/network/FetchClient.d.ts +26 -26
- package/dist/network/FetchClient.js +99 -99
- package/dist/network/XhrClient.d.ts +40 -40
- package/dist/network/XhrClient.js +117 -117
- package/dist/operatingcontext/BaseOperatingContext.d.ts +40 -40
- package/dist/operatingcontext/BaseOperatingContext.js +44 -44
- package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/StandardOperatingContext.js +43 -43
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/TeamsAppOperatingContext.js +42 -42
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.js +4 -4
- package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
- package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
- package/dist/request/EndSessionPopupRequest.d.ts +18 -18
- package/dist/request/EndSessionRequest.d.ts +15 -15
- package/dist/request/PopupRequest.d.ts +32 -32
- package/dist/request/PopupWindowAttributes.d.ts +15 -15
- package/dist/request/RedirectRequest.d.ts +33 -33
- package/dist/request/SilentRequest.d.ts +30 -30
- package/dist/request/SsoSilentRequest.d.ts +26 -26
- package/dist/telemetry/BrowserPerformanceClient.d.ts +38 -38
- package/dist/telemetry/BrowserPerformanceClient.js +124 -124
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
- package/dist/telemetry/BrowserPerformanceMeasurement.js +92 -92
- package/dist/utils/BrowserConstants.d.ts +166 -166
- package/dist/utils/BrowserConstants.js +214 -214
- package/dist/utils/BrowserProtocolUtils.d.ts +18 -18
- package/dist/utils/BrowserProtocolUtils.js +34 -34
- package/dist/utils/BrowserStringUtils.d.ts +26 -26
- package/dist/utils/BrowserStringUtils.js +149 -149
- package/dist/utils/BrowserUtils.d.ts +65 -65
- package/dist/utils/BrowserUtils.js +138 -138
- package/dist/utils/MathUtils.d.ts +11 -11
- package/dist/utils/MathUtils.js +21 -21
- package/lib/msal-browser.cjs.js +18383 -0
- package/lib/msal-browser.cjs.js.map +1 -0
- package/lib/msal-browser.js +18389 -0
- package/lib/msal-browser.js.map +1 -0
- package/lib/msal-browser.min.js +74 -0
- package/package.json +97 -95
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*! @azure/msal-browser v3.0.0-alpha.2 2023-05-17 */
|
|
2
|
+
"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).msal={})}(this,(function(e){
|
|
3
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
4
|
+
const t={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",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:"",NOT_APPLICABLE:"N/A",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",REGIONAL_AUTH_NON_MSI_QUERY_STRING:"allowestsrnonmsi=true",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},r=[t.OPENID_SCOPE,t.PROFILE_SCOPE,t.OFFLINE_ACCESS_SCOPE],o=[...r,t.EMAIL_SCOPE];var n,i,s,a,c;!function(e){e.CONTENT_TYPE="Content-Type",e.RETRY_AFTER="Retry-After",e.CCS_HEADER="X-AnchorMailbox",e.WWWAuthenticate="WWW-Authenticate",e.AuthenticationInfo="Authentication-Info",e.X_MS_REQUEST_ID="x-ms-request-id",e.X_MS_HTTP_VERSION="x-ms-httpver"}(n||(n={})),function(e){e.ID_TOKEN="idtoken",e.CLIENT_INFO="client.info",e.ADAL_ID_TOKEN="adal.idtoken",e.ERROR="error",e.ERROR_DESC="error.description",e.ACTIVE_ACCOUNT="active-account",e.ACTIVE_ACCOUNT_FILTERS="active-account-filters"}(i||(i={})),function(e){e.COMMON="common",e.ORGANIZATIONS="organizations",e.CONSUMERS="consumers"}(s||(s={})),function(e){e.CLIENT_ID="client_id",e.REDIRECT_URI="redirect_uri",e.RESPONSE_TYPE="response_type",e.RESPONSE_MODE="response_mode",e.GRANT_TYPE="grant_type",e.CLAIMS="claims",e.SCOPE="scope",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ACCESS_TOKEN="access_token",e.ID_TOKEN="id_token",e.REFRESH_TOKEN="refresh_token",e.EXPIRES_IN="expires_in",e.STATE="state",e.NONCE="nonce",e.PROMPT="prompt",e.SESSION_STATE="session_state",e.CLIENT_INFO="client_info",e.CODE="code",e.CODE_CHALLENGE="code_challenge",e.CODE_CHALLENGE_METHOD="code_challenge_method",e.CODE_VERIFIER="code_verifier",e.CLIENT_REQUEST_ID="client-request-id",e.X_CLIENT_SKU="x-client-SKU",e.X_CLIENT_VER="x-client-VER",e.X_CLIENT_OS="x-client-OS",e.X_CLIENT_CPU="x-client-CPU",e.X_CLIENT_CURR_TELEM="x-client-current-telemetry",e.X_CLIENT_LAST_TELEM="x-client-last-telemetry",e.X_MS_LIB_CAPABILITY="x-ms-lib-capability",e.X_APP_NAME="x-app-name",e.X_APP_VER="x-app-ver",e.POST_LOGOUT_URI="post_logout_redirect_uri",e.ID_TOKEN_HINT="id_token_hint",e.DEVICE_CODE="device_code",e.CLIENT_SECRET="client_secret",e.CLIENT_ASSERTION="client_assertion",e.CLIENT_ASSERTION_TYPE="client_assertion_type",e.TOKEN_TYPE="token_type",e.REQ_CNF="req_cnf",e.OBO_ASSERTION="assertion",e.REQUESTED_TOKEN_USE="requested_token_use",e.ON_BEHALF_OF="on_behalf_of",e.FOCI="foci",e.CCS_HEADER="X-AnchorMailbox",e.RETURN_SPA_CODE="return_spa_code",e.NATIVE_BROKER="nativebroker",e.LOGOUT_HINT="logout_hint"}(a||(a={})),function(e){e.ACCESS_TOKEN="access_token",e.XMS_CC="xms_cc"}(c||(c={}));const d={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"};var l;!function(e){e.ACCOUNT="account",e.SID="sid",e.LOGIN_HINT="login_hint",e.ID_TOKEN="id_token",e.DOMAIN_HINT="domain_hint",e.ORGANIZATIONS="organizations",e.CONSUMERS="consumers",e.ACCOUNT_ID="accountIdentifier",e.HOMEACCOUNT_ID="homeAccountIdentifier"}(l||(l={}));const h={PLAIN:"plain",S256:"S256"};var u,p,g,m,f,C;!function(e){e.QUERY="query",e.FRAGMENT="fragment",e.FORM_POST="form_post"}(u||(u={})),function(e){e.IMPLICIT_GRANT="implicit",e.AUTHORIZATION_CODE_GRANT="authorization_code",e.CLIENT_CREDENTIALS_GRANT="client_credentials",e.RESOURCE_OWNER_PASSWORD_GRANT="password",e.REFRESH_TOKEN_GRANT="refresh_token",e.DEVICE_CODE_GRANT="device_code",e.JWT_BEARER="urn:ietf:params:oauth:grant-type:jwt-bearer"}(p||(p={})),function(e){e.MSSTS_ACCOUNT_TYPE="MSSTS",e.ADFS_ACCOUNT_TYPE="ADFS",e.MSAV1_ACCOUNT_TYPE="MSA",e.GENERIC_ACCOUNT_TYPE="Generic"}(g||(g={})),function(e){e.CACHE_KEY_SEPARATOR="-",e.CLIENT_INFO_SEPARATOR="."}(m||(m={})),function(e){e.ID_TOKEN="IdToken",e.ACCESS_TOKEN="AccessToken",e.ACCESS_TOKEN_WITH_AUTH_SCHEME="AccessToken_With_AuthScheme",e.REFRESH_TOKEN="RefreshToken"}(f||(f={})),function(e){e[e.ADFS=1001]="ADFS",e[e.MSA=1002]="MSA",e[e.MSSTS=1003]="MSSTS",e[e.GENERIC=1004]="GENERIC",e[e.ACCESS_TOKEN=2001]="ACCESS_TOKEN",e[e.REFRESH_TOKEN=2002]="REFRESH_TOKEN",e[e.ID_TOKEN=2003]="ID_TOKEN",e[e.APP_METADATA=3001]="APP_METADATA",e[e.UNDEFINED=9999]="UNDEFINED"}(C||(C={}));const y="appmetadata",E="1",T="authority-metadata",v=86400;var I;!function(e){e.CONFIG="config",e.CACHE="cache",e.NETWORK="network",e.HARDCODED_VALUES="hardcoded_values"}(I||(I={}));const _={SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"};var w;e.AuthenticationScheme=void 0,(w=e.AuthenticationScheme||(e.AuthenticationScheme={})).BEARER="Bearer",w.POP="pop",w.SSH="ssh-cert";const S=60,A=3600,k="throttling",R="retry-after, h429",b="invalid_grant",P="client_mismatch";var N,M,O,q,U,L;!function(e){e.username="username",e.password="password"}(N||(N={})),function(e){e[e.httpSuccess=200]="httpSuccess",e[e.httpBadRequest=400]="httpBadRequest"}(M||(M={})),function(e){e.FAILED_AUTO_DETECTION="1",e.INTERNAL_CACHE="2",e.ENVIRONMENT_VARIABLE="3",e.IMDS="4"}(O||(O={})),function(e){e.CONFIGURED_MATCHES_DETECTED="1",e.CONFIGURED_NO_AUTO_DETECTION="2",e.CONFIGURED_NOT_DETECTED="3",e.AUTO_DETECTION_REQUESTED_SUCCESSFUL="4",e.AUTO_DETECTION_REQUESTED_FAILED="5"}(q||(q={})),function(e){e.NO_CACHE_HIT="0",e.FORCE_REFRESH="1",e.NO_CACHED_ACCESS_TOKEN="2",e.CACHED_ACCESS_TOKEN_EXPIRED="3",e.REFRESH_CACHED_ACCESS_TOKEN="4"}(U||(U={})),function(e){e.Jwt="JWT",e.Jwk="JWK",e.Pop="pop"}(L||(L={}));
|
|
5
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
6
|
+
const H={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."},postRequestFailed:{code:"post_request_failed",desc:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."}};class D extends Error{constructor(e,r,o){super(r?`${e}: ${r}`:e),Object.setPrototypeOf(this,D.prototype),this.errorCode=e||t.EMPTY_STRING,this.errorMessage=r||t.EMPTY_STRING,this.subError=o||t.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}static createUnexpectedError(e){return new D(H.unexpectedError.code,`${H.unexpectedError.desc}: ${e}`)}static createPostRequestFailed(e){return new D(H.postRequestFailed.code,`${H.postRequestFailed.desc}: ${e}`)}}
|
|
7
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */const K={createNewGuid:()=>{throw D.createUnexpectedError("Crypto interface - createNewGuid() has not been implemented")},base64Decode:()=>{throw D.createUnexpectedError("Crypto interface - base64Decode() has not been implemented")},base64Encode:()=>{throw D.createUnexpectedError("Crypto interface - base64Encode() has not been implemented")},async generatePkceCodes(){throw D.createUnexpectedError("Crypto interface - generatePkceCodes() has not been implemented")},async getPublicKeyThumbprint(){throw D.createUnexpectedError("Crypto interface - getPublicKeyThumbprint() has not been implemented")},async removeTokenBindingKey(){throw D.createUnexpectedError("Crypto interface - removeTokenBindingKey() has not been implemented")},async clearKeystore(){throw D.createUnexpectedError("Crypto interface - clearKeystore() has not been implemented")},async signJwt(){throw D.createUnexpectedError("Crypto interface - signJwt() has not been implemented")},async hashString(){throw D.createUnexpectedError("Crypto interface - hashString() has not been implemented")}},F={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"},authTimeNotFoundError:{code:"auth_time_not_found",desc:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information."},maxAgeTranspiredError:{code:"max_age_transpired",desc:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication."},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."},DeviceCodeUnknownError:{code:"device_code_unknown_error",desc:"Device code stopped polling for unknown reasons."},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:"Server response does not contain an authorization code to proceed"},noAzureRegionDetected:{code:"no_azure_region_detected",desc:"No azure region was detected and no fallback was made available"},accessTokenEntityNullError:{code:"access_token_entity_null",desc:"Access token entity is null, please check logs and cache to ensure a valid access token is present."},bindingKeyNotRemovedError:{code:"binding_key_not_removed",desc:"Could not remove the credential's binding key from storage."},logoutNotSupported:{code:"end_session_endpoint_not_supported",desc:"Provided authority does not support logout."},keyIdMissing:{code:"key_id_missing",desc:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key."},noNetworkConnectivity:{code:"no_network_connectivity",desc:"No network connectivity. Check your internet connection."},userCanceledError:{code:"user_canceled",desc:"User canceled the flow."},missingTenantIdError:{code:"missing_tenant_id_error",desc:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow."}};
|
|
8
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class x extends D{constructor(e,t){super(e,t),this.name="ClientAuthError",Object.setPrototypeOf(this,x.prototype)}static createClientInfoDecodingError(e){return new x(F.clientInfoDecodingError.code,`${F.clientInfoDecodingError.desc} Failed with error: ${e}`)}static createClientInfoEmptyError(){return new x(F.clientInfoEmptyError.code,`${F.clientInfoEmptyError.desc}`)}static createTokenParsingError(e){return new x(F.tokenParsingError.code,`${F.tokenParsingError.desc} Failed with error: ${e}`)}static createTokenNullOrEmptyError(e){return new x(F.nullOrEmptyToken.code,`${F.nullOrEmptyToken.desc} Raw Token Value: ${e}`)}static createEndpointDiscoveryIncompleteError(e){return new x(F.endpointResolutionError.code,`${F.endpointResolutionError.desc} Detail: ${e}`)}static createNetworkError(e,t){return new x(F.networkError.code,`${F.networkError.desc} | Fetch client threw: ${t} | Attempted to reach: ${e.split("?")[0]}`)}static createUnableToGetOpenidConfigError(e){return new x(F.unableToGetOpenidConfigError.code,`${F.unableToGetOpenidConfigError.desc} Attempted to retrieve endpoints from: ${e}`)}static createHashNotDeserializedError(e){return new x(F.hashNotDeserialized.code,`${F.hashNotDeserialized.desc} Given Object: ${e}`)}static createInvalidStateError(e,t){return new x(F.invalidStateError.code,`${F.invalidStateError.desc} Invalid State: ${e}, Root Err: ${t}`)}static createStateMismatchError(){return new x(F.stateMismatchError.code,F.stateMismatchError.desc)}static createStateNotFoundError(e){return new x(F.stateNotFoundError.code,`${F.stateNotFoundError.desc}: ${e}`)}static createNonceMismatchError(){return new x(F.nonceMismatchError.code,F.nonceMismatchError.desc)}static createAuthTimeNotFoundError(){return new x(F.authTimeNotFoundError.code,F.authTimeNotFoundError.desc)}static createMaxAgeTranspiredError(){return new x(F.maxAgeTranspiredError.code,F.maxAgeTranspiredError.desc)}static createNonceNotFoundError(e){return new x(F.nonceNotFoundError.code,`${F.nonceNotFoundError.desc}: ${e}`)}static createMultipleMatchingTokensInCacheError(){return new x(F.multipleMatchingTokens.code,`${F.multipleMatchingTokens.desc}.`)}static createMultipleMatchingAccountsInCacheError(){return new x(F.multipleMatchingAccounts.code,F.multipleMatchingAccounts.desc)}static createMultipleMatchingAppMetadataInCacheError(){return new x(F.multipleMatchingAppMetadata.code,F.multipleMatchingAppMetadata.desc)}static createTokenRequestCannotBeMadeError(){return new x(F.tokenRequestCannotBeMade.code,F.tokenRequestCannotBeMade.desc)}static createAppendEmptyScopeToSetError(e){return new x(F.appendEmptyScopeError.code,`${F.appendEmptyScopeError.desc} Given Scope: ${e}`)}static createRemoveEmptyScopeFromSetError(e){return new x(F.removeEmptyScopeError.code,`${F.removeEmptyScopeError.desc} Given Scope: ${e}`)}static createAppendScopeSetError(e){return new x(F.appendScopeSetError.code,`${F.appendScopeSetError.desc} Detail Error: ${e}`)}static createEmptyInputScopeSetError(){return new x(F.emptyInputScopeSetError.code,`${F.emptyInputScopeSetError.desc}`)}static createDeviceCodeCancelledError(){return new x(F.DeviceCodePollingCancelled.code,`${F.DeviceCodePollingCancelled.desc}`)}static createDeviceCodeExpiredError(){return new x(F.DeviceCodeExpired.code,`${F.DeviceCodeExpired.desc}`)}static createDeviceCodeUnknownError(){return new x(F.DeviceCodeUnknownError.code,`${F.DeviceCodeUnknownError.desc}`)}static createNoAccountInSilentRequestError(){return new x(F.NoAccountInSilentRequest.code,`${F.NoAccountInSilentRequest.desc}`)}static createNullOrUndefinedCacheRecord(){return new x(F.invalidCacheRecord.code,F.invalidCacheRecord.desc)}static createInvalidCacheEnvironmentError(){return new x(F.invalidCacheEnvironment.code,F.invalidCacheEnvironment.desc)}static createNoAccountFoundError(){return new x(F.noAccountFound.code,F.noAccountFound.desc)}static createCachePluginError(){return new x(F.CachePluginError.code,`${F.CachePluginError.desc}`)}static createNoCryptoObjectError(e){return new x(F.noCryptoObj.code,`${F.noCryptoObj.desc}${e}`)}static createInvalidCacheTypeError(){return new x(F.invalidCacheType.code,`${F.invalidCacheType.desc}`)}static createUnexpectedAccountTypeError(){return new x(F.unexpectedAccountType.code,`${F.unexpectedAccountType.desc}`)}static createUnexpectedCredentialTypeError(){return new x(F.unexpectedCredentialType.code,`${F.unexpectedCredentialType.desc}`)}static createInvalidAssertionError(){return new x(F.invalidAssertion.code,`${F.invalidAssertion.desc}`)}static createInvalidCredentialError(){return new x(F.invalidClientCredential.code,`${F.invalidClientCredential.desc}`)}static createRefreshRequiredError(){return new x(F.tokenRefreshRequired.code,F.tokenRefreshRequired.desc)}static createUserTimeoutReachedError(){return new x(F.userTimeoutReached.code,F.userTimeoutReached.desc)}static createTokenClaimsRequiredError(){return new x(F.tokenClaimsRequired.code,F.tokenClaimsRequired.desc)}static createNoAuthCodeInServerResponseError(){return new x(F.noAuthorizationCodeFromServer.code,F.noAuthorizationCodeFromServer.desc)}static createBindingKeyNotRemovedError(){return new x(F.bindingKeyNotRemovedError.code,F.bindingKeyNotRemovedError.desc)}static createLogoutNotSupportedError(){return new x(F.logoutNotSupported.code,F.logoutNotSupported.desc)}static createKeyIdMissingError(){return new x(F.keyIdMissing.code,F.keyIdMissing.desc)}static createNoNetworkConnectivityError(){return new x(F.noNetworkConnectivity.code,F.noNetworkConnectivity.desc)}static createUserCanceledError(){return new x(F.userCanceledError.code,F.userCanceledError.desc)}static createMissingTenantIdError(){return new D(F.missingTenantIdError.code,F.missingTenantIdError.desc)}}
|
|
9
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class B{static decodeAuthToken(e){if(B.isEmpty(e))throw x.createTokenNullOrEmptyError(e);const t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);if(!t||t.length<4)throw x.createTokenParsingError(`Given token is malformed: ${JSON.stringify(e)}`);return{header:t[1],JWSPayload:t[2],JWSSig:t[3]}}static isEmpty(e){return void 0===e||!e||0===e.length}static isEmptyObj(e){if(e&&!B.isEmpty(e))try{const t=JSON.parse(e);return 0===Object.keys(t).length}catch(e){}return!0}static startsWith(e,t){return 0===e.indexOf(t)}static endsWith(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length}static queryStringToObject(e){const t={},r=e.split("&"),o=e=>decodeURIComponent(e.replace(/\+/g," "));return r.forEach((e=>{if(e.trim()){const[r,n]=e.split(/=(.+)/g,2);r&&n&&(t[o(r)]=o(n))}})),t}static trimArrayEntries(e){return e.map((e=>e.trim()))}static removeEmptyStringsFromArray(e){return e.filter((e=>!B.isEmpty(e)))}static jsonParseHelper(e){try{return JSON.parse(e)}catch(e){return null}}static matchPattern(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)}}
|
|
10
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */var G;e.LogLevel=void 0,(G=e.LogLevel||(e.LogLevel={}))[G.Error=0]="Error",G[G.Warning=1]="Warning",G[G.Info=2]="Info",G[G.Verbose=3]="Verbose",G[G.Trace=4]="Trace";class ${constructor(r,o,n){this.level=e.LogLevel.Info;const i=r||$.createDefaultLoggerOptions();this.localCallback=i.loggerCallback||(()=>{}),this.piiLoggingEnabled=i.piiLoggingEnabled||!1,this.level="number"==typeof i.logLevel?i.logLevel:e.LogLevel.Info,this.correlationId=i.correlationId||t.EMPTY_STRING,this.packageName=o||t.EMPTY_STRING,this.packageVersion=n||t.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:e.LogLevel.Info}}clone(e,t,r){return new $({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,t)}logMessage(t,r){if(r.logLevel>this.level||!this.piiLoggingEnabled&&r.containsPii)return;const o=(new Date).toUTCString();let n;n=B.isEmpty(r.correlationId)?B.isEmpty(this.correlationId)?`[${o}]`:`[${o}] : [${this.correlationId}]`:`[${o}] : [${r.correlationId}]`;const i=`${n} : ${this.packageName}@${this.packageVersion} : ${e.LogLevel[r.logLevel]} - ${t}`;this.executeCallback(r.logLevel,i,r.containsPii||!1)}executeCallback(e,t,r){this.localCallback&&this.localCallback(e,t,r)}error(r,o){this.logMessage(r,{logLevel:e.LogLevel.Error,containsPii:!1,correlationId:o||t.EMPTY_STRING})}errorPii(r,o){this.logMessage(r,{logLevel:e.LogLevel.Error,containsPii:!0,correlationId:o||t.EMPTY_STRING})}warning(r,o){this.logMessage(r,{logLevel:e.LogLevel.Warning,containsPii:!1,correlationId:o||t.EMPTY_STRING})}warningPii(r,o){this.logMessage(r,{logLevel:e.LogLevel.Warning,containsPii:!0,correlationId:o||t.EMPTY_STRING})}info(r,o){this.logMessage(r,{logLevel:e.LogLevel.Info,containsPii:!1,correlationId:o||t.EMPTY_STRING})}infoPii(r,o){this.logMessage(r,{logLevel:e.LogLevel.Info,containsPii:!0,correlationId:o||t.EMPTY_STRING})}verbose(r,o){this.logMessage(r,{logLevel:e.LogLevel.Verbose,containsPii:!1,correlationId:o||t.EMPTY_STRING})}verbosePii(r,o){this.logMessage(r,{logLevel:e.LogLevel.Verbose,containsPii:!0,correlationId:o||t.EMPTY_STRING})}trace(r,o){this.logMessage(r,{logLevel:e.LogLevel.Trace,containsPii:!1,correlationId:o||t.EMPTY_STRING})}tracePii(r,o){this.logMessage(r,{logLevel:e.LogLevel.Trace,containsPii:!0,correlationId:o||t.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}
|
|
11
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */const z="@azure/msal-common",Q="14.0.0-alpha.2";var Y;
|
|
12
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
13
|
+
e.AzureCloudInstance=void 0,(Y=e.AzureCloudInstance||(e.AzureCloudInstance={}))[Y.None=0]="None",Y.AzurePublic="https://login.microsoftonline.com",Y.AzurePpe="https://login.windows-ppe.net",Y.AzureChina="https://login.chinacloudapi.cn",Y.AzureGermany="https://login.microsoftonline.de",Y.AzureUsGovernment="https://login.microsoftonline.us";
|
|
14
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
15
|
+
const j={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', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest"},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 stringified JSON object containing tenant_discovery_endpoint and metadata fields"},invalidAuthorityMetadata:{code:"invalid_authority_metadata",desc:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_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."},invalidAzureCloudInstance:{code:"invalid_azure_cloud_instance",desc:"Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"},missingSshJwk:{code:"missing_ssh_jwk",desc:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."},missingSshKid:{code:"missing_ssh_kid",desc:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme."},missingNonceAuthenticationHeader:{code:"missing_nonce_authentication_header",desc:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce."},invalidAuthenticationHeader:{code:"invalid_authentication_header",desc:"Invalid authentication header provided"}};class W extends x{constructor(e,t){super(e,t),this.name="ClientConfigurationError",Object.setPrototypeOf(this,W.prototype)}static createRedirectUriEmptyError(){return new W(j.redirectUriNotSet.code,j.redirectUriNotSet.desc)}static createPostLogoutRedirectUriEmptyError(){return new W(j.postLogoutUriNotSet.code,j.postLogoutUriNotSet.desc)}static createClaimsRequestParsingError(e){return new W(j.claimsRequestParsingError.code,`${j.claimsRequestParsingError.desc} Given value: ${e}`)}static createInsecureAuthorityUriError(e){return new W(j.authorityUriInsecure.code,`${j.authorityUriInsecure.desc} Given URI: ${e}`)}static createUrlParseError(e){return new W(j.urlParseError.code,`${j.urlParseError.desc} Given Error: ${e}`)}static createUrlEmptyError(){return new W(j.urlEmptyError.code,j.urlEmptyError.desc)}static createEmptyScopesArrayError(){return new W(j.emptyScopesError.code,`${j.emptyScopesError.desc}`)}static createClientIdSingleScopeError(e){return new W(j.clientIdSingleScopeError.code,`${j.clientIdSingleScopeError.desc} Given Scopes: ${e}`)}static createInvalidPromptError(e){return new W(j.invalidPrompt.code,`${j.invalidPrompt.desc} Given value: ${e}`)}static createInvalidClaimsRequestError(){return new W(j.invalidClaimsRequest.code,j.invalidClaimsRequest.desc)}static createEmptyLogoutRequestError(){return new W(j.logoutRequestEmptyError.code,j.logoutRequestEmptyError.desc)}static createEmptyTokenRequestError(){return new W(j.tokenRequestEmptyError.code,j.tokenRequestEmptyError.desc)}static createInvalidCodeChallengeMethodError(){return new W(j.invalidCodeChallengeMethod.code,j.invalidCodeChallengeMethod.desc)}static createInvalidCodeChallengeParamsError(){return new W(j.invalidCodeChallengeParams.code,j.invalidCodeChallengeParams.desc)}static createInvalidCloudDiscoveryMetadataError(){return new W(j.invalidCloudDiscoveryMetadata.code,j.invalidCloudDiscoveryMetadata.desc)}static createInvalidAuthorityMetadataError(){return new W(j.invalidAuthorityMetadata.code,j.invalidAuthorityMetadata.desc)}static createUntrustedAuthorityError(){return new W(j.untrustedAuthority.code,j.untrustedAuthority.desc)}static createInvalidAzureCloudInstanceError(){return new W(j.invalidAzureCloudInstance.code,j.invalidAzureCloudInstance.desc)}static createMissingSshJwkError(){return new W(j.missingSshJwk.code,j.missingSshJwk.desc)}static createMissingSshKidError(){return new W(j.missingSshKid.code,j.missingSshKid.desc)}static createMissingNonceAuthenticationHeadersError(){return new W(j.missingNonceAuthenticationHeader.code,j.missingNonceAuthenticationHeader.desc)}static createInvalidAuthenticationHeaderError(e,t){return new W(j.invalidAuthenticationHeader.code,`${j.invalidAuthenticationHeader.desc}. Invalid header: ${e}. Details: ${t}`)}}
|
|
16
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class V{constructor(e){const t=e?B.trimArrayEntries([...e]):[],r=t?B.removeEmptyStringsFromArray(t):[];this.validateInputScopes(r),this.scopes=new Set,r.forEach((e=>this.scopes.add(e)))}static fromString(e){const r=(e||t.EMPTY_STRING).split(" ");return new V(r)}static createSearchScopes(e){const r=new V(e);return r.containsOnlyOIDCScopes()?r.removeScope(t.OFFLINE_ACCESS_SCOPE):r.removeOIDCScopes(),r}validateInputScopes(e){if(!e||e.length<1)throw W.createEmptyScopesArrayError()}containsScope(e){const t=this.printScopesLowerCase().split(" "),r=new V(t);return!B.isEmpty(e)&&r.scopes.has(e.toLowerCase())}containsScopeSet(e){return!(!e||e.scopes.size<=0)&&(this.scopes.size>=e.scopes.size&&e.asArray().every((e=>this.containsScope(e))))}containsOnlyOIDCScopes(){let e=0;return o.forEach((t=>{this.containsScope(t)&&(e+=1)})),this.scopes.size===e}appendScope(e){B.isEmpty(e)||this.scopes.add(e.trim())}appendScopes(e){try{e.forEach((e=>this.appendScope(e)))}catch(e){throw x.createAppendScopeSetError(e)}}removeScope(e){if(B.isEmpty(e))throw x.createRemoveEmptyScopeFromSetError(e);this.scopes.delete(e.trim())}removeOIDCScopes(){o.forEach((e=>{this.scopes.delete(e)}))}unionScopeSets(e){if(!e)throw x.createEmptyInputScopeSetError();const t=new Set;return e.scopes.forEach((e=>t.add(e.toLowerCase()))),this.scopes.forEach((e=>t.add(e.toLowerCase()))),t}intersectingScopeSets(e){if(!e)throw x.createEmptyInputScopeSetError();e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const t=this.unionScopeSets(e),r=e.getScopeCount(),o=this.getScopeCount();return t.size<o+r}getScopeCount(){return this.scopes.size}asArray(){const e=[];return this.scopes.forEach((t=>e.push(t))),e}printScopes(){if(this.scopes){return this.asArray().join(" ")}return t.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}
|
|
17
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */function J(e,t){if(B.isEmpty(e))throw x.createClientInfoEmptyError();try{const r=t.base64Decode(e);return JSON.parse(r)}catch(e){throw x.createClientInfoDecodingError(e.message)}}function X(e){if(B.isEmpty(e))throw x.createClientInfoDecodingError("Home account ID was empty.");const r=e.split(m.CLIENT_INFO_SEPARATOR,2);return{uid:r[0],utid:r.length<2?t.EMPTY_STRING:r[1]}}
|
|
18
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */var Z;!function(e){e[e.Default=0]="Default",e[e.Adfs=1]="Adfs",e[e.Dsts=2]="Dsts",e[e.Ciam=3]="Ciam"}(Z||(Z={}));
|
|
19
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
20
|
+
class ee{generateAccountId(){return[this.homeAccountId,this.environment].join(m.CACHE_KEY_SEPARATOR).toLowerCase()}generateAccountKey(){return ee.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})}generateType(){switch(this.authorityType){case g.ADFS_ACCOUNT_TYPE:return C.ADFS;case g.MSAV1_ACCOUNT_TYPE:return C.MSA;case g.MSSTS_ACCOUNT_TYPE:return C.MSSTS;case g.GENERIC_ACCOUNT_TYPE:return C.GENERIC;default:throw x.createUnexpectedAccountTypeError()}}getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,idTokenClaims:this.idTokenClaims,nativeAccountId:this.nativeAccountId}}static generateAccountCacheKey(e){return[e.homeAccountId,e.environment||t.EMPTY_STRING,e.tenantId||t.EMPTY_STRING].join(m.CACHE_KEY_SEPARATOR).toLowerCase()}static createAccount(e,r,o,n,i,s,a,c){const d=new ee;d.authorityType=g.MSSTS_ACCOUNT_TYPE,d.clientInfo=e,d.homeAccountId=r,d.nativeAccountId=c;const l=a||n&&n.getPreferredCache();if(!l)throw x.createInvalidCacheEnvironmentError();if(d.environment=l,d.realm=o?.claims?.tid||t.EMPTY_STRING,o){d.idTokenClaims=o.claims,d.localAccountId=o?.claims?.oid||o?.claims?.sub||t.EMPTY_STRING;const e=o?.claims?.preferred_username,r=o?.claims?.emails?o.claims.emails[0]:null;d.username=e||r||t.EMPTY_STRING,d.name=o?.claims?.name}return d.cloudGraphHostName=i,d.msGraphHost=s,d}static createGenericAccount(e,r,o,n,i,s){const a=new ee;a.authorityType=o&&o.authorityType===Z.Adfs?g.ADFS_ACCOUNT_TYPE:g.GENERIC_ACCOUNT_TYPE,a.homeAccountId=e,a.realm=t.EMPTY_STRING;const c=s||o&&o.getPreferredCache();if(!c)throw x.createInvalidCacheEnvironmentError();return r&&(a.localAccountId=r?.claims?.oid||r?.claims?.sub||t.EMPTY_STRING,a.username=r?.claims?.upn||t.EMPTY_STRING,a.name=r?.claims?.name||t.EMPTY_STRING,a.idTokenClaims=r?.claims),a.environment=c,a.cloudGraphHostName=n,a.msGraphHost=i,a}static generateHomeAccountId(e,r,o,n,i){const s=i?.claims?.sub?i.claims.sub:t.EMPTY_STRING;if(r===Z.Adfs||r===Z.Dsts)return s;if(e)try{const t=J(e,n);if(!B.isEmpty(t.uid)&&!B.isEmpty(t.utid))return`${t.uid}${m.CLIENT_INFO_SEPARATOR}${t.utid}`}catch(e){}return o.verbose("No client info in response"),s}static isAccountEntity(e){return!!e&&(e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"))}static accountInfoIsEqual(e,t,r){if(!e||!t)return!1;let o=!0;if(r){const r=e.idTokenClaims||{},n=t.idTokenClaims||{};o=r.iat===n.iat&&r.nonce===n.nonce}return e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&o}}
|
|
21
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class te{constructor(e,t){if(B.isEmpty(e))throw x.createTokenNullOrEmptyError(e);this.rawToken=e,this.claims=te.extractTokenClaims(e,t)}static extractTokenClaims(e,t){const r=B.decodeAuthToken(e);try{const e=r.JWSPayload,o=t.base64Decode(e);return JSON.parse(o)}catch(e){throw x.createTokenParsingError(e)}}static checkMaxAge(e,t){if(0===t||Date.now()-3e5>e+t)throw x.createMaxAgeTranspiredError()}}
|
|
22
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class re{constructor(e,t,r){this.clientId=e,this.cryptoImpl=t,this.commonLogger=r.clone(z,Q)}getAllAccounts(){const e=this.getAccountKeys();if(e.length<1)return[];const t=e.reduce(((e,t)=>{const r=this.getAccount(t);return r?(e.push(r),e):e}),[]);if(t.length<1)return[];return t.map((e=>this.getAccountInfoFromEntity(e)))}getAccountInfoFilteredBy(e){const t=this.getAccountsFilteredBy(e);return t.length>0?this.getAccountInfoFromEntity(t[0]):null}getAccountInfoFromEntity(e){const t=e.getAccountInfo(),r=this.getIdToken(t);return r&&(t.idToken=r.secret,t.idTokenClaims=new te(r.secret,this.cryptoImpl).claims),t}async saveCacheRecord(e){if(!e)throw x.createNullOrUndefinedCacheRecord();e.account&&this.setAccount(e.account),e.idToken&&this.setIdTokenCredential(e.idToken),e.accessToken&&await this.saveAccessToken(e.accessToken),e.refreshToken&&this.setRefreshTokenCredential(e.refreshToken),e.appMetadata&&this.setAppMetadata(e.appMetadata)}async saveAccessToken(e){const t={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},r=this.getTokenKeys(),o=V.fromString(e.target),n=[];r.accessToken.forEach((e=>{if(!this.accessTokenKeyMatchesFilter(e,t,!1))return;const r=this.getAccessTokenCredential(e);if(r&&this.credentialMatchesFilter(r,t)){V.fromString(r.target).intersectingScopeSets(o)&&n.push(this.removeAccessToken(e))}})),await Promise.all(n),this.setAccessTokenCredential(e)}getAccountsFilteredBy(e){const t=this.getAccountKeys(),r=[];return t.forEach((t=>{if(!this.isAccountKey(t,e.homeAccountId,e.realm))return;const o=this.getAccount(t);o&&(e.homeAccountId&&!this.matchHomeAccountId(o,e.homeAccountId)||e.localAccountId&&!this.matchLocalAccountId(o,e.localAccountId)||e.username&&!this.matchUsername(o,e.username)||e.environment&&!this.matchEnvironment(o,e.environment)||e.realm&&!this.matchRealm(o,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(o,e.nativeAccountId)||r.push(o))})),r}isAccountKey(e,t,r){return!(e.split(m.CACHE_KEY_SEPARATOR).length<3)&&(!(t&&!e.toLowerCase().includes(t.toLowerCase()))&&!(r&&!e.toLowerCase().includes(r.toLowerCase())))}isCredentialKey(e){if(e.split(m.CACHE_KEY_SEPARATOR).length<6)return!1;const t=e.toLowerCase();if(-1===t.indexOf(f.ID_TOKEN.toLowerCase())&&-1===t.indexOf(f.ACCESS_TOKEN.toLowerCase())&&-1===t.indexOf(f.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())&&-1===t.indexOf(f.REFRESH_TOKEN.toLowerCase()))return!1;if(t.indexOf(f.REFRESH_TOKEN.toLowerCase())>-1){const e=`${f.REFRESH_TOKEN}${m.CACHE_KEY_SEPARATOR}${this.clientId}${m.CACHE_KEY_SEPARATOR}`,r=`${f.REFRESH_TOKEN}${m.CACHE_KEY_SEPARATOR}${E}${m.CACHE_KEY_SEPARATOR}`;if(-1===t.indexOf(e.toLowerCase())&&-1===t.indexOf(r.toLowerCase()))return!1}else if(-1===t.indexOf(this.clientId.toLowerCase()))return!1;return!0}credentialMatchesFilter(t,r){if(r.clientId&&!this.matchClientId(t,r.clientId))return!1;if(r.userAssertionHash&&!this.matchUserAssertionHash(t,r.userAssertionHash))return!1;if("string"==typeof r.homeAccountId&&!this.matchHomeAccountId(t,r.homeAccountId))return!1;if(r.environment&&!this.matchEnvironment(t,r.environment))return!1;if(r.realm&&!this.matchRealm(t,r.realm))return!1;if(r.credentialType&&!this.matchCredentialType(t,r.credentialType))return!1;if(r.familyId&&!this.matchFamilyId(t,r.familyId))return!1;if(r.target&&!this.matchTarget(t,r.target))return!1;if((r.requestedClaimsHash||t.requestedClaimsHash)&&t.requestedClaimsHash!==r.requestedClaimsHash)return!1;if(t.credentialType===f.ACCESS_TOKEN_WITH_AUTH_SCHEME){if(r.tokenType&&!this.matchTokenType(t,r.tokenType))return!1;if(r.tokenType===e.AuthenticationScheme.SSH&&r.keyId&&!this.matchKeyId(t,r.keyId))return!1}return!0}getAppMetadataFilteredBy(e){return this.getAppMetadataFilteredByInternal(e.environment,e.clientId)}getAppMetadataFilteredByInternal(e,t){const r=this.getKeys(),o={};return r.forEach((r=>{if(!this.isAppMetadata(r))return;const n=this.getAppMetadata(r);n&&(e&&!this.matchEnvironment(n,e)||t&&!this.matchClientId(n,t)||(o[r]=n))})),o}getAuthorityMetadataByAlias(e){const t=this.getAuthorityMetadataKeys();let r=null;return t.forEach((t=>{if(!this.isAuthorityMetadata(t)||-1===t.indexOf(this.clientId))return;const o=this.getAuthorityMetadata(t);o&&-1!==o.aliases.indexOf(e)&&(r=o)})),r}async removeAllAccounts(){const e=this.getAccountKeys(),t=[];e.forEach((e=>{t.push(this.removeAccount(e))})),await Promise.all(t)}async removeAccount(e){const t=this.getAccount(e);t&&(await this.removeAccountContext(t),this.removeItem(e))}async removeAccountContext(e){const t=this.getTokenKeys(),r=e.generateAccountId(),o=[];t.idToken.forEach((e=>{0===e.indexOf(r)&&this.removeIdToken(e)})),t.accessToken.forEach((e=>{0===e.indexOf(r)&&o.push(this.removeAccessToken(e))})),t.refreshToken.forEach((e=>{0===e.indexOf(r)&&this.removeRefreshToken(e)})),await Promise.all(o)}async removeAccessToken(t){const r=this.getAccessTokenCredential(t);if(r){if(r.credentialType.toLowerCase()===f.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()&&r.tokenType===e.AuthenticationScheme.POP){const e=r.keyId;if(e)try{await this.cryptoImpl.removeTokenBindingKey(e)}catch(e){throw x.createBindingKeyNotRemovedError()}}return this.removeItem(t)}}removeAppMetadata(){return this.getKeys().forEach((e=>{this.isAppMetadata(e)&&this.removeItem(e)})),!0}readCacheRecord(e,t,r){const o=this.getTokenKeys(),n=this.readAccountFromCache(e),i=this.getIdToken(e,o),s=this.getAccessToken(e,t,o),a=this.getRefreshToken(e,!1,o),c=this.readAppMetadataFromCache(r);return n&&i&&(n.idTokenClaims=new te(i.secret,this.cryptoImpl).claims),{account:n,idToken:i,accessToken:s,refreshToken:a,appMetadata:c}}readAccountFromCache(e){const t=ee.generateAccountCacheKey(e);return this.getAccount(t)}getIdToken(e,t){this.commonLogger.trace("CacheManager - getIdToken called");const r={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:f.ID_TOKEN,clientId:this.clientId,realm:e.tenantId},o=this.getIdTokensByFilter(r,t),n=o.length;if(n<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(n>1)throw x.createMultipleMatchingTokensInCacheError();return this.commonLogger.info("CacheManager:getIdToken - Returning id token"),o[0]}getIdTokensByFilter(e,t){const r=t&&t.idToken||this.getTokenKeys().idToken,o=[];return r.forEach((t=>{if(!this.idTokenKeyMatchesFilter(t,{clientId:this.clientId,...e}))return;const r=this.getIdTokenCredential(t);r&&this.credentialMatchesFilter(r,e)&&o.push(r)})),o}idTokenKeyMatchesFilter(e,t){const r=e.toLowerCase();return(!t.clientId||-1!==r.indexOf(t.clientId.toLowerCase()))&&(!t.homeAccountId||-1!==r.indexOf(t.homeAccountId.toLowerCase()))}removeIdToken(e){this.removeItem(e)}removeRefreshToken(e){this.removeItem(e)}getAccessToken(t,r,o){this.commonLogger.trace("CacheManager - getAccessToken called");const n=V.createSearchScopes(r.scopes),i=r.authenticationScheme||e.AuthenticationScheme.BEARER,s=i&&i.toLowerCase()!==e.AuthenticationScheme.BEARER.toLowerCase()?f.ACCESS_TOKEN_WITH_AUTH_SCHEME:f.ACCESS_TOKEN,a={homeAccountId:t.homeAccountId,environment:t.environment,credentialType:s,clientId:this.clientId,realm:t.tenantId,target:n,tokenType:i,keyId:r.sshKid,requestedClaimsHash:r.requestedClaimsHash},c=o&&o.accessToken||this.getTokenKeys().accessToken,d=[];c.forEach((e=>{if(this.accessTokenKeyMatchesFilter(e,a,!0)){const t=this.getAccessTokenCredential(e);t&&this.credentialMatchesFilter(t,a)&&d.push(t)}}));const l=d.length;if(l<1)return this.commonLogger.info("CacheManager:getAccessToken - No token found"),null;if(l>1)throw x.createMultipleMatchingTokensInCacheError();return this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),d[0]}accessTokenKeyMatchesFilter(e,t,r){const o=e.toLowerCase();if(t.clientId&&-1===o.indexOf(t.clientId.toLowerCase()))return!1;if(t.homeAccountId&&-1===o.indexOf(t.homeAccountId.toLowerCase()))return!1;if(t.realm&&-1===o.indexOf(t.realm.toLowerCase()))return!1;if(t.requestedClaimsHash&&-1===o.indexOf(t.requestedClaimsHash.toLowerCase()))return!1;if(t.target){const e=t.target.asArray();for(let t=0;t<e.length;t++){if(r&&!o.includes(e[t].toLowerCase()))return!1;if(!r&&o.includes(e[t].toLowerCase()))return!0}}return!0}getAccessTokensByFilter(e){const t=this.getTokenKeys(),r=[];return t.accessToken.forEach((t=>{if(!this.accessTokenKeyMatchesFilter(t,e,!0))return;const o=this.getAccessTokenCredential(t);o&&this.credentialMatchesFilter(o,e)&&r.push(o)})),r}getRefreshToken(e,t,r){this.commonLogger.trace("CacheManager - getRefreshToken called");const o=t?E:void 0,n={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:f.REFRESH_TOKEN,clientId:this.clientId,familyId:o},i=r&&r.refreshToken||this.getTokenKeys().refreshToken,s=[];i.forEach((e=>{if(this.refreshTokenKeyMatchesFilter(e,n)){const t=this.getRefreshTokenCredential(e);t&&this.credentialMatchesFilter(t,n)&&s.push(t)}}));return s.length<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),s[0])}refreshTokenKeyMatchesFilter(e,t){const r=e.toLowerCase();return(!t.familyId||-1!==r.indexOf(t.familyId.toLowerCase()))&&(!(!t.familyId&&t.clientId&&-1===r.indexOf(t.clientId.toLowerCase()))&&(!t.homeAccountId||-1!==r.indexOf(t.homeAccountId.toLowerCase())))}readAppMetadataFromCache(e){const t={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(t),o=Object.keys(r).map((e=>r[e])),n=o.length;if(n<1)return null;if(n>1)throw x.createMultipleMatchingAppMetadataInCacheError();return o[0]}isAppMetadataFOCI(e){const t=this.readAppMetadataFromCache(e);return!(!t||t.familyId!==E)}matchHomeAccountId(e,t){return!("string"!=typeof e.homeAccountId||t!==e.homeAccountId)}matchLocalAccountId(e,t){return!("string"!=typeof e.localAccountId||t!==e.localAccountId)}matchUsername(e,t){return!("string"!=typeof e.username||t.toLowerCase()!==e.username.toLowerCase())}matchUserAssertionHash(e,t){return!(!e.userAssertionHash||t!==e.userAssertionHash)}matchEnvironment(e,t){const r=this.getAuthorityMetadataByAlias(t);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,t){return!(!e.clientId||t!==e.clientId)}matchFamilyId(e,t){return!(!e.familyId||t!==e.familyId)}matchRealm(e,t){return!(!e.realm||t!==e.realm)}matchNativeAccountId(e,t){return!(!e.nativeAccountId||t!==e.nativeAccountId)}matchTarget(e,t){if(e.credentialType!==f.ACCESS_TOKEN&&e.credentialType!==f.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target)return!1;return V.fromString(e.target).containsScopeSet(t)}matchTokenType(e,t){return!(!e.tokenType||e.tokenType!==t)}matchKeyId(e,t){return!(!e.keyId||e.keyId!==t)}isAppMetadata(e){return-1!==e.indexOf(y)}isAuthorityMetadata(e){return-1!==e.indexOf(T)}generateAuthorityMetadataCacheKey(e){return`${T}-${this.clientId}-${e}`}static toObject(e,t){for(const r in t)e[r]=t[r];return e}}class oe extends re{setAccount(){throw D.createUnexpectedError("Storage interface - setAccount() has not been implemented for the cacheStorage interface.")}getAccount(){throw D.createUnexpectedError("Storage interface - getAccount() has not been implemented for the cacheStorage interface.")}setIdTokenCredential(){throw D.createUnexpectedError("Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.")}getIdTokenCredential(){throw D.createUnexpectedError("Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.")}setAccessTokenCredential(){throw D.createUnexpectedError("Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.")}getAccessTokenCredential(){throw D.createUnexpectedError("Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.")}setRefreshTokenCredential(){throw D.createUnexpectedError("Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.")}getRefreshTokenCredential(){throw D.createUnexpectedError("Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.")}setAppMetadata(){throw D.createUnexpectedError("Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.")}getAppMetadata(){throw D.createUnexpectedError("Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.")}setServerTelemetry(){throw D.createUnexpectedError("Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.")}getServerTelemetry(){throw D.createUnexpectedError("Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.")}setAuthorityMetadata(){throw D.createUnexpectedError("Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.")}getAuthorityMetadata(){throw D.createUnexpectedError("Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.")}getAuthorityMetadataKeys(){throw D.createUnexpectedError("Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.")}setThrottlingCache(){throw D.createUnexpectedError("Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.")}getThrottlingCache(){throw D.createUnexpectedError("Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.")}removeItem(){throw D.createUnexpectedError("Storage interface - removeItem() has not been implemented for the cacheStorage interface.")}containsKey(){throw D.createUnexpectedError("Storage interface - containsKey() has not been implemented for the cacheStorage interface.")}getKeys(){throw D.createUnexpectedError("Storage interface - getKeys() has not been implemented for the cacheStorage interface.")}getAccountKeys(){throw D.createUnexpectedError("Storage interface - getAccountKeys() has not been implemented for the cacheStorage interface.")}getTokenKeys(){throw D.createUnexpectedError("Storage interface - getTokenKeys() has not been implemented for the cacheStorage interface.")}async clear(){throw D.createUnexpectedError("Storage interface - clear() has not been implemented for the cacheStorage interface.")}updateCredentialCacheKey(){throw D.createUnexpectedError("Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.")}}
|
|
23
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */const ne={tokenRenewalOffsetSeconds:300,preventCorsPreflight:!1},ie={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:e.LogLevel.Info,correlationId:t.EMPTY_STRING},se={async sendGetRequestAsync(){throw D.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented")},async sendPostRequestAsync(){throw D.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented")}},ae={sku:t.SKU,version:Q,cpu:t.EMPTY_STRING,os:t.EMPTY_STRING},ce={clientSecret:t.EMPTY_STRING,clientAssertion:void 0},de={azureCloudInstance:e.AzureCloudInstance.None,tenant:`${t.DEFAULT_COMMON_TENANT}`},le={application:{appName:"",appVersion:""}};
|
|
24
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
25
|
+
class he extends D{constructor(e,t,r){super(e,t,r),this.name="ServerError",Object.setPrototypeOf(this,he.prototype)}}
|
|
26
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class ue{static generateThrottlingStorageKey(e){return`${k}.${JSON.stringify(e)}`}static preProcess(e,r){const o=ue.generateThrottlingStorageKey(r),n=e.getThrottlingCache(o);if(n){if(n.throttleTime<Date.now())return void e.removeItem(o);throw new he(n.errorCodes?.join(" ")||t.EMPTY_STRING,n.errorMessage,n.subError)}}static postProcess(e,t,r){if(ue.checkResponseStatus(r)||ue.checkResponseForRetryAfter(r)){const o={throttleTime:ue.calculateThrottleTime(parseInt(r.headers[n.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};e.setThrottlingCache(ue.generateThrottlingStorageKey(t),o)}}static checkResponseStatus(e){return 429===e.status||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return!!e.headers&&(e.headers.hasOwnProperty(n.RETRY_AFTER)&&(e.status<200||e.status>=300))}static calculateThrottleTime(e){const t=e<=0?0:e,r=Date.now()/1e3;return Math.floor(1e3*Math.min(r+(t||S),r+A))}static removeThrottle(e,t,r,o){const n={clientId:t,authority:r.authority,scopes:r.scopes,homeAccountIdentifier:o,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},i=this.generateThrottlingStorageKey(n);e.removeItem(i)}}
|
|
27
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class pe{constructor(e,t){this.networkClient=e,this.cacheManager=t}async sendPostRequest(e,t,r){let o;ue.preProcess(this.cacheManager,e);try{o=await this.networkClient.sendPostRequestAsync(t,r)}catch(e){throw e instanceof D?e:x.createNetworkError(t,e)}return ue.postProcess(this.cacheManager,e,o),o}}
|
|
28
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */var ge;!function(e){e.HOME_ACCOUNT_ID="home_account_id",e.UPN="UPN"}(ge||(ge={}));
|
|
29
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
30
|
+
class me{static validateRedirectUri(e){if(B.isEmpty(e))throw W.createRedirectUriEmptyError()}static validatePrompt(e){const t=[];for(const e in d)t.push(d[e]);if(t.indexOf(e)<0)throw W.createInvalidPromptError(e)}static validateClaims(e){try{JSON.parse(e)}catch(e){throw W.createInvalidClaimsRequestError()}}static validateCodeChallengeParams(e,t){if(B.isEmpty(e)||B.isEmpty(t))throw W.createInvalidCodeChallengeParamsError();this.validateCodeChallengeMethod(t)}static validateCodeChallengeMethod(e){if([h.PLAIN,h.S256].indexOf(e)<0)throw W.createInvalidCodeChallengeMethodError()}static sanitizeEQParams(e,t){return e?(t.forEach(((t,r)=>{e[r]&&delete e[r]})),Object.fromEntries(Object.entries(e).filter((([e,t])=>""!==t)))):{}}}
|
|
31
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class fe{constructor(){this.parameters=new Map}addResponseTypeCode(){this.parameters.set(a.RESPONSE_TYPE,encodeURIComponent(t.CODE_RESPONSE_TYPE))}addResponseTypeForTokenAndIdToken(){this.parameters.set(a.RESPONSE_TYPE,encodeURIComponent(`${t.TOKEN_RESPONSE_TYPE} ${t.ID_TOKEN_RESPONSE_TYPE}`))}addResponseMode(e){this.parameters.set(a.RESPONSE_MODE,encodeURIComponent(e||u.QUERY))}addNativeBroker(){this.parameters.set(a.NATIVE_BROKER,encodeURIComponent("1"))}addScopes(e,t=!0){const o=t?[...e||[],...r]:e||[],n=new V(o);this.parameters.set(a.SCOPE,encodeURIComponent(n.printScopes()))}addClientId(e){this.parameters.set(a.CLIENT_ID,encodeURIComponent(e))}addRedirectUri(e){me.validateRedirectUri(e),this.parameters.set(a.REDIRECT_URI,encodeURIComponent(e))}addPostLogoutRedirectUri(e){me.validateRedirectUri(e),this.parameters.set(a.POST_LOGOUT_URI,encodeURIComponent(e))}addIdTokenHint(e){this.parameters.set(a.ID_TOKEN_HINT,encodeURIComponent(e))}addDomainHint(e){this.parameters.set(l.DOMAIN_HINT,encodeURIComponent(e))}addLoginHint(e){this.parameters.set(l.LOGIN_HINT,encodeURIComponent(e))}addCcsUpn(e){this.parameters.set(n.CCS_HEADER,encodeURIComponent(`UPN:${e}`))}addCcsOid(e){this.parameters.set(n.CCS_HEADER,encodeURIComponent(`Oid:${e.uid}@${e.utid}`))}addSid(e){this.parameters.set(l.SID,encodeURIComponent(e))}addClaims(e,t){const r=this.addClientCapabilitiesToClaims(e,t);me.validateClaims(r),this.parameters.set(a.CLAIMS,encodeURIComponent(r))}addCorrelationId(e){this.parameters.set(a.CLIENT_REQUEST_ID,encodeURIComponent(e))}addLibraryInfo(e){this.parameters.set(a.X_CLIENT_SKU,e.sku),this.parameters.set(a.X_CLIENT_VER,e.version),e.os&&this.parameters.set(a.X_CLIENT_OS,e.os),e.cpu&&this.parameters.set(a.X_CLIENT_CPU,e.cpu)}addApplicationTelemetry(e){e?.appName&&this.parameters.set(a.X_APP_NAME,e.appName),e?.appVersion&&this.parameters.set(a.X_APP_VER,e.appVersion)}addPrompt(e){me.validatePrompt(e),this.parameters.set(`${a.PROMPT}`,encodeURIComponent(e))}addState(e){B.isEmpty(e)||this.parameters.set(a.STATE,encodeURIComponent(e))}addNonce(e){this.parameters.set(a.NONCE,encodeURIComponent(e))}addCodeChallengeParams(e,t){if(me.validateCodeChallengeParams(e,t),!e||!t)throw W.createInvalidCodeChallengeParamsError();this.parameters.set(a.CODE_CHALLENGE,encodeURIComponent(e)),this.parameters.set(a.CODE_CHALLENGE_METHOD,encodeURIComponent(t))}addAuthorizationCode(e){this.parameters.set(a.CODE,encodeURIComponent(e))}addDeviceCode(e){this.parameters.set(a.DEVICE_CODE,encodeURIComponent(e))}addRefreshToken(e){this.parameters.set(a.REFRESH_TOKEN,encodeURIComponent(e))}addCodeVerifier(e){this.parameters.set(a.CODE_VERIFIER,encodeURIComponent(e))}addClientSecret(e){this.parameters.set(a.CLIENT_SECRET,encodeURIComponent(e))}addClientAssertion(e){B.isEmpty(e)||this.parameters.set(a.CLIENT_ASSERTION,encodeURIComponent(e))}addClientAssertionType(e){B.isEmpty(e)||this.parameters.set(a.CLIENT_ASSERTION_TYPE,encodeURIComponent(e))}addOboAssertion(e){this.parameters.set(a.OBO_ASSERTION,encodeURIComponent(e))}addRequestTokenUse(e){this.parameters.set(a.REQUESTED_TOKEN_USE,encodeURIComponent(e))}addGrantType(e){this.parameters.set(a.GRANT_TYPE,encodeURIComponent(e))}addClientInfo(){this.parameters.set("client_info","1")}addExtraQueryParameters(e){const t=me.sanitizeEQParams(e,this.parameters);Object.keys(t).forEach((t=>{this.parameters.set(t,e[t])}))}addClientCapabilitiesToClaims(e,t){let r;if(e)try{r=JSON.parse(e)}catch(e){throw W.createInvalidClaimsRequestError()}else r={};return t&&t.length>0&&(r.hasOwnProperty(c.ACCESS_TOKEN)||(r[c.ACCESS_TOKEN]={}),r[c.ACCESS_TOKEN][c.XMS_CC]={values:t}),JSON.stringify(r)}addUsername(e){this.parameters.set(N.username,encodeURIComponent(e))}addPassword(e){this.parameters.set(N.password,encodeURIComponent(e))}addPopToken(t){B.isEmpty(t)||(this.parameters.set(a.TOKEN_TYPE,e.AuthenticationScheme.POP),this.parameters.set(a.REQ_CNF,encodeURIComponent(t)))}addSshJwk(t){B.isEmpty(t)||(this.parameters.set(a.TOKEN_TYPE,e.AuthenticationScheme.SSH),this.parameters.set(a.REQ_CNF,encodeURIComponent(t)))}addServerTelemetry(e){this.parameters.set(a.X_CLIENT_CURR_TELEM,e.generateCurrentRequestHeaderValue()),this.parameters.set(a.X_CLIENT_LAST_TELEM,e.generateLastRequestHeaderValue())}addThrottling(){this.parameters.set(a.X_MS_LIB_CAPABILITY,R)}addLogoutHint(e){this.parameters.set(a.LOGOUT_HINT,encodeURIComponent(e))}createQueryString(){const e=new Array;return this.parameters.forEach(((t,r)=>{e.push(`${r}=${t}`)})),e.join("&")}}
|
|
32
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Ce{constructor(e,t){this.config=function({authOptions:e,systemOptions:t,loggerOptions:r,storageInterface:o,networkInterface:n,cryptoInterface:i,clientCredentials:s,libraryInfo:a,telemetry:c,serverTelemetryManager:d,persistencePlugin:l,serializableCache:h}){const u={...ie,...r};return{authOptions:(p=e,{clientCapabilities:[],azureCloudOptions:de,skipAuthorityMetadataCache:!1,...p}),systemOptions:{...ne,...t},loggerOptions:u,storageInterface:o||new oe(e.clientId,K,new $(u)),networkInterface:n||se,cryptoInterface:i||K,clientCredentials:s||ce,libraryInfo:{...ae,...a},telemetry:{...le,...c},serverTelemetryManager:d||null,persistencePlugin:l||null,serializableCache:h||null};var p}(e),this.logger=new $(this.config.loggerOptions,z,Q),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.networkManager=new pe(this.networkClient,this.cacheManager),this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const r={};if(r[n.CONTENT_TYPE]=t.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case ge.HOME_ACCOUNT_ID:try{const t=X(e.credential);r[n.CCS_HEADER]=`Oid:${t.uid}@${t.utid}`}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case ge.UPN:r[n.CCS_HEADER]=`UPN: ${e.credential}`}return r}async executePostToTokenEndpoint(e,t,r,o){const n=await this.networkManager.sendPostRequest(o,e,{body:t,headers:r});return this.config.serverTelemetryManager&&n.status<500&&429!==n.status&&this.config.serverTelemetryManager.clearTelemetryCache(),n}updateAuthority(e){if(!e.discoveryComplete())throw x.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");this.authority=e}createTokenQueryParameters(e){const t=new fe;return e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.createQueryString()}}
|
|
33
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class ye{generateAccountId(){return ye.generateAccountIdForCacheKey(this.homeAccountId,this.environment)}generateCredentialId(){return ye.generateCredentialIdForCacheKey(this.credentialType,this.clientId,this.realm,this.familyId)}generateTarget(){return ye.generateTargetForCacheKey(this.target)}generateCredentialKey(){return ye.generateCredentialCacheKey(this.homeAccountId,this.environment,this.credentialType,this.clientId,this.realm,this.target,this.familyId,this.tokenType,this.requestedClaimsHash)}generateType(){switch(this.credentialType){case f.ID_TOKEN:return C.ID_TOKEN;case f.ACCESS_TOKEN:case f.ACCESS_TOKEN_WITH_AUTH_SCHEME:return C.ACCESS_TOKEN;case f.REFRESH_TOKEN:return C.REFRESH_TOKEN;default:throw x.createUnexpectedCredentialTypeError()}}static generateCredentialCacheKey(e,t,r,o,n,i,s,a,c){return[this.generateAccountIdForCacheKey(e,t),this.generateCredentialIdForCacheKey(r,o,n,s),this.generateTargetForCacheKey(i),this.generateClaimsHashForCacheKey(c),this.generateSchemeForCacheKey(a)].join(m.CACHE_KEY_SEPARATOR).toLowerCase()}static generateAccountIdForCacheKey(e,t){return[e,t].join(m.CACHE_KEY_SEPARATOR).toLowerCase()}static generateCredentialIdForCacheKey(e,r,o,n){return[e,e===f.REFRESH_TOKEN&&n||r,o||t.EMPTY_STRING].join(m.CACHE_KEY_SEPARATOR).toLowerCase()}static generateTargetForCacheKey(e){return(e||t.EMPTY_STRING).toLowerCase()}static generateClaimsHashForCacheKey(e){return(e||t.EMPTY_STRING).toLowerCase()}static generateSchemeForCacheKey(r){return r&&r.toLowerCase()!==e.AuthenticationScheme.BEARER.toLowerCase()?r.toLowerCase():t.EMPTY_STRING}}
|
|
34
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Ee extends ye{static createIdTokenEntity(e,t,r,o,n){const i=new Ee;return i.credentialType=f.ID_TOKEN,i.homeAccountId=e,i.environment=t,i.clientId=o,i.secret=r,i.realm=n,i}static isIdTokenEntity(e){return!!e&&(e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.credentialType===f.ID_TOKEN)}}
|
|
35
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Te{static nowSeconds(){return Math.round((new Date).getTime()/1e3)}static isTokenExpired(e,t){const r=Number(e)||0;return Te.nowSeconds()+t>r}static wasClockTurnedBack(e){return Number(e)>Te.nowSeconds()}static delay(e,t){return new Promise((r=>setTimeout((()=>r(t)),e)))}}
|
|
36
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class ve extends ye{static createAccessTokenEntity(t,r,o,n,i,s,a,c,d,l,h,u,p,g,m){const C=new ve;C.homeAccountId=t,C.credentialType=f.ACCESS_TOKEN,C.secret=o;const y=Te.nowSeconds();if(C.cachedAt=y.toString(),C.expiresOn=a.toString(),C.extendedExpiresOn=c.toString(),l&&(C.refreshOn=l.toString()),C.environment=r,C.clientId=n,C.realm=i,C.target=s,C.userAssertionHash=u,C.tokenType=B.isEmpty(h)?e.AuthenticationScheme.BEARER:h,g&&(C.requestedClaims=g,C.requestedClaimsHash=m),C.tokenType?.toLowerCase()!==e.AuthenticationScheme.BEARER.toLowerCase())switch(C.credentialType=f.ACCESS_TOKEN_WITH_AUTH_SCHEME,C.tokenType){case e.AuthenticationScheme.POP:const t=te.extractTokenClaims(o,d);if(!t?.cnf?.kid)throw x.createTokenClaimsRequiredError();C.keyId=t.cnf.kid;break;case e.AuthenticationScheme.SSH:C.keyId=p}return C}static isAccessTokenEntity(e){return!!e&&(e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.hasOwnProperty("target")&&(e.credentialType===f.ACCESS_TOKEN||e.credentialType===f.ACCESS_TOKEN_WITH_AUTH_SCHEME))}}
|
|
37
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Ie extends ye{static createRefreshTokenEntity(e,t,r,o,n,i){const s=new Ie;return s.clientId=o,s.credentialType=f.REFRESH_TOKEN,s.environment=t,s.homeAccountId=e,s.secret=r,s.userAssertionHash=i,n&&(s.familyId=n),s}static isRefreshTokenEntity(e){return!!e&&(e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")&&e.credentialType===f.REFRESH_TOKEN)}}
|
|
38
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */const _e=["interaction_required","consent_required","login_required"],we=["message_only","additional_action","basic_action","user_password_expired","consent_required"],Se={noTokensFoundError:{code:"no_tokens_found",desc:"No refresh token found in the cache. Please sign-in."},native_account_unavailable:{code:"native_account_unavailable",desc:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API."}};class Ae extends D{constructor(e,r,o,n,i,s,a){super(e,r,o),Object.setPrototypeOf(this,Ae.prototype),this.timestamp=n||t.EMPTY_STRING,this.traceId=i||t.EMPTY_STRING,this.correlationId=s||t.EMPTY_STRING,this.claims=a||t.EMPTY_STRING,this.name="InteractionRequiredAuthError"}static isInteractionRequiredError(e,t,r){const o=!!e&&_e.indexOf(e)>-1,n=!!r&&we.indexOf(r)>-1,i=!!t&&_e.some((e=>t.indexOf(e)>-1));return o||i||n}static createNoTokensFoundError(){return new Ae(Se.noTokensFoundError.code,Se.noTokensFoundError.desc)}static createNativeAccountUnavailableError(){return new Ae(Se.native_account_unavailable.code,Se.native_account_unavailable.desc)}}
|
|
39
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class ke{constructor(e,t,r,o,n){this.account=e||null,this.idToken=t||null,this.accessToken=r||null,this.refreshToken=o||null,this.appMetadata=n||null}}
|
|
40
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Re{static setRequestState(e,r,o){const n=Re.generateLibraryState(e,o);return B.isEmpty(r)?n:`${n}${t.RESOURCE_DELIM}${r}`}static generateLibraryState(e,t){if(!e)throw x.createNoCryptoObjectError("generateLibraryState");const r={id:e.createNewGuid()};t&&(r.meta=t);const o=JSON.stringify(r);return e.base64Encode(o)}static parseRequestState(e,r){if(!e)throw x.createNoCryptoObjectError("parseRequestState");if(B.isEmpty(r))throw x.createInvalidStateError(r,"Null, undefined or empty state");try{const o=r.split(t.RESOURCE_DELIM),n=o[0],i=o.length>1?o.slice(1).join(t.RESOURCE_DELIM):t.EMPTY_STRING,s=e.base64Decode(n),a=JSON.parse(s);return{userRequestState:B.isEmpty(i)?t.EMPTY_STRING:i,libraryState:a}}catch(e){throw x.createInvalidStateError(r,e)}}}
|
|
41
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class be{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,B.isEmpty(this._urlString))throw W.createUrlEmptyError();B.isEmpty(this.getHash())&&(this._urlString=be.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let t=e.toLowerCase();return B.endsWith(t,"?")?t=t.slice(0,-1):B.endsWith(t,"?/")&&(t=t.slice(0,-2)),B.endsWith(t,"/")||(t+="/"),t}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch(e){throw W.createUrlParseError(e)}if(!e.HostNameAndPort||!e.PathSegments)throw W.createUrlParseError(`Given url string: ${this.urlString}`);if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw W.createInsecureAuthorityUriError(this.urlString)}static appendQueryString(e,t){return B.isEmpty(t)?e:e.indexOf("?")<0?`${e}?${t}`:`${e}&${t}`}static removeHashFromUrl(e){return be.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const t=this.getUrlComponents(),r=t.PathSegments;return!e||0===r.length||r[0]!==s.COMMON&&r[0]!==s.ORGANIZATIONS||(r[0]=e),be.constructAuthorityUriFromObject(t)}getHash(){return be.parseHash(this.urlString)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(e);if(!t)throw W.createUrlParseError(`Given url string: ${this.urlString}`);const r={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]};let o=r.AbsolutePath.split("/");return o=o.filter((e=>e&&e.length>0)),r.PathSegments=o,!B.isEmpty(r.QueryString)&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const t=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(t);if(!r)throw W.createUrlParseError(`Given url string: ${e}`);return r[2]}static getAbsoluteUrl(e,r){if(e[0]===t.FORWARD_SLASH){const t=new be(r).getUrlComponents();return t.Protocol+"//"+t.HostNameAndPort+e}return e}static parseHash(e){const r=e.indexOf("#"),o=e.indexOf("#/");return o>-1?e.substring(o+2):r>-1?e.substring(r+1):t.EMPTY_STRING}static parseQueryString(e){const r=e.indexOf("?"),o=e.indexOf("/?");return o>-1?e.substring(o+2):r>-1?e.substring(r+1):t.EMPTY_STRING}static constructAuthorityUriFromObject(e){return new be(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static getDeserializedHash(e){if(B.isEmpty(e))return{};const t=be.parseHash(e),r=B.queryStringToObject(B.isEmpty(t)?e:t);if(!r)throw x.createHashNotDeserializedError(JSON.stringify(r));return r}static getDeserializedQueryString(e){if(B.isEmpty(e))return{};const t=be.parseQueryString(e),r=B.queryStringToObject(B.isEmpty(t)?e:t);if(!r)throw x.createHashNotDeserializedError(JSON.stringify(r));return r}static hashContainsKnownProperties(e){if(B.isEmpty(e)||e.indexOf("=")<0)return!1;const t=be.getDeserializedHash(e);return!!(t.code||t.error_description||t.error||t.state)}}
|
|
42
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */var Pe,Ne;e.PerformanceEvents=void 0,(Pe=e.PerformanceEvents||(e.PerformanceEvents={})).AcquireTokenByCode="acquireTokenByCode",Pe.AcquireTokenByRefreshToken="acquireTokenByRefreshToken",Pe.AcquireTokenSilent="acquireTokenSilent",Pe.AcquireTokenSilentAsync="acquireTokenSilentAsync",Pe.AcquireTokenPopup="acquireTokenPopup",Pe.CryptoOptsGetPublicKeyThumbprint="cryptoOptsGetPublicKeyThumbprint",Pe.CryptoOptsSignJwt="cryptoOptsSignJwt",Pe.SilentCacheClientAcquireToken="silentCacheClientAcquireToken",Pe.SilentIframeClientAcquireToken="silentIframeClientAcquireToken",Pe.SilentRefreshClientAcquireToken="silentRefreshClientAcquireToken",Pe.SsoSilent="ssoSilent",Pe.StandardInteractionClientGetDiscoveredAuthority="standardInteractionClientGetDiscoveredAuthority",Pe.FetchAccountIdWithNativeBroker="fetchAccountIdWithNativeBroker",Pe.NativeInteractionClientAcquireToken="nativeInteractionClientAcquireToken",Pe.BaseClientCreateTokenRequestHeaders="baseClientCreateTokenRequestHeaders",Pe.BrokerHandhshake="brokerHandshake",Pe.AcquireTokenByRefreshTokenInBroker="acquireTokenByRefreshTokenInBroker",Pe.AcquireTokenByBroker="acquireTokenByBroker",Pe.RefreshTokenClientExecuteTokenRequest="refreshTokenClientExecuteTokenRequest",Pe.RefreshTokenClientAcquireToken="refreshTokenClientAcquireToken",Pe.RefreshTokenClientAcquireTokenWithCachedRefreshToken="refreshTokenClientAcquireTokenWithCachedRefreshToken",Pe.RefreshTokenClientAcquireTokenByRefreshToken="refreshTokenClientAcquireTokenByRefreshToken",Pe.RefreshTokenClientCreateTokenRequestBody="refreshTokenClientCreateTokenRequestBody",Pe.AcquireTokenFromCache="acquireTokenFromCache",Pe.AcquireTokenBySilentIframe="acquireTokenBySilentIframe",Pe.InitializeBaseRequest="initializeBaseRequest",Pe.InitializeSilentRequest="initializeSilentRequest",Pe.InitializeClientApplication="initializeClientApplication",Pe.SilentIframeClientTokenHelper="silentIframeClientTokenHelper",Pe.SilentHandlerInitiateAuthRequest="silentHandlerInitiateAuthRequest",Pe.SilentHandlerMonitorIframeForHash="silentHandlerMonitorIframeForHash",Pe.SilentHandlerLoadFrame="silentHandlerLoadFrame",Pe.StandardInteractionClientCreateAuthCodeClient="standardInteractionClientCreateAuthCodeClient",Pe.StandardInteractionClientGetClientConfiguration="standardInteractionClientGetClientConfiguration",Pe.StandardInteractionClientInitializeAuthorizationRequest="standardInteractionClientInitializeAuthorizationRequest",Pe.StandardInteractionClientInitializeAuthorizationCodeRequest="standardInteractionClientInitializeAuthorizationCodeRequest",Pe.GetAuthCodeUrl="getAuthCodeUrl",Pe.HandleCodeResponseFromServer="handleCodeResponseFromServer",Pe.HandleCodeResponseFromHash="handleCodeResponseFromHash",Pe.UpdateTokenEndpointAuthority="updateTokenEndpointAuthority",Pe.AuthClientAcquireToken="authClientAcquireToken",Pe.AuthClientExecuteTokenRequest="authClientExecuteTokenRequest",Pe.AuthClientCreateTokenRequestBody="authClientCreateTokenRequestBody",Pe.AuthClientCreateQueryString="authClientCreateQueryString",Pe.PopTokenGenerateCnf="popTokenGenerateCnf",Pe.PopTokenGenerateKid="popTokenGenerateKid",Pe.HandleServerTokenResponse="handleServerTokenResponse",Pe.AuthorityFactoryCreateDiscoveredInstance="authorityFactoryCreateDiscoveredInstance",Pe.AuthorityResolveEndpointsAsync="authorityResolveEndpointsAsync",Pe.AuthorityGetCloudDiscoveryMetadataFromNetwork="authorityGetCloudDiscoveryMetadataFromNetwork",Pe.AuthorityUpdateCloudDiscoveryMetadata="authorityUpdateCloudDiscoveryMetadata",Pe.AuthorityGetEndpointMetadataFromNetwork="authorityGetEndpointMetadataFromNetwork",Pe.AuthorityUpdateEndpointMetadata="authorityUpdateEndpointMetadata",Pe.AuthorityUpdateMetadataWithRegionalInformation="authorityUpdateMetadataWithRegionalInformation",Pe.RegionDiscoveryDetectRegion="regionDiscoveryDetectRegion",Pe.RegionDiscoveryGetRegionFromIMDS="regionDiscoveryGetRegionFromIMDS",Pe.RegionDiscoveryGetCurrentVersion="regionDiscoveryGetCurrentVersion",Pe.AcquireTokenByCodeAsync="acquireTokenByCodeAsync",Pe.GetEndpointMetadataFromNetwork="getEndpointMetadataFromNetwork",Pe.GetCloudDiscoveryMetadataFromNetworkMeasurement="getCloudDiscoveryMetadataFromNetworkMeasurement",Pe.HandleRedirectPromiseMeasurement="handleRedirectPromiseMeasurement",Pe.UpdateCloudDiscoveryMetadataMeasurement="updateCloudDiscoveryMetadataMeasurement",Pe.UsernamePasswordClientAcquireToken="usernamePasswordClientAcquireToken",Pe.NativeMessageHandlerHandshake="nativeMessageHandlerHandshake",function(e){e[e.NotStarted=0]="NotStarted",e[e.InProgress=1]="InProgress",e[e.Completed=2]="Completed"}(Ne||(Ne={}));const Me=new Set(["accessTokenSize","durationMs","idTokenSize","matsSilentStatus","matsHttpStatus","refreshTokenSize","queuedTimeMs","startTimeMs","status"]);
|
|
43
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */var Oe;!function(e){e.SW="sw",e.UHW="uhw"}(Oe||(Oe={}));class qe{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.PopTokenGenerateCnf,t.correlationId),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.PopTokenGenerateKid,t.correlationId);const r=await this.generateKid(t),o=this.cryptoUtils.base64Encode(JSON.stringify(r));return{kid:r.kid,reqCnfString:o,reqCnfHash:await this.cryptoUtils.hashString(o)}}async generateKid(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.PopTokenGenerateKid,t.correlationId);return{kid:await this.cryptoUtils.getPublicKeyThumbprint(t),xms_ksl:Oe.SW}}async signPopToken(e,t,r){return this.signPayload(e,t,r)}async signPayload(e,t,r,o){const{resourceRequestMethod:n,resourceRequestUri:i,shrClaims:s,shrNonce:a}=r,c=i?new be(i):void 0,d=c?.getUrlComponents();return await this.cryptoUtils.signJwt({at:e,ts:Te.nowSeconds(),m:n?.toUpperCase(),u:d?.HostNameAndPort,nonce:a||this.cryptoUtils.createNewGuid(),p:d?.AbsolutePath,q:d?.QueryString?[[],d.QueryString]:void 0,client_claims:s||void 0,...o},t,r.correlationId)}}
|
|
44
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Ue{generateAppMetadataKey(){return Ue.generateAppMetadataCacheKey(this.environment,this.clientId)}static generateAppMetadataCacheKey(e,t){return[y,e,t].join(m.CACHE_KEY_SEPARATOR).toLowerCase()}static createAppMetadataEntity(e,t,r){const o=new Ue;return o.clientId=e,o.environment=t,r&&(o.familyId=r),o}static isAppMetadataEntity(e,t){return!!t&&(0===e.indexOf(y)&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("environment"))}}
|
|
45
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Le{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}
|
|
46
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class He{constructor(e,t,r,o,n,i,s){this.clientId=e,this.cacheStorage=t,this.cryptoObj=r,this.logger=o,this.serializableCache=n,this.persistencePlugin=i,this.performanceClient=s}validateServerAuthorizationCodeResponse(e,r,o){if(!e.state||!r)throw e.state?x.createStateNotFoundError("Cached State"):x.createStateNotFoundError("Server State");if(decodeURIComponent(e.state)!==decodeURIComponent(r))throw x.createStateMismatchError();if(e.error||e.error_description||e.suberror){if(Ae.isInteractionRequiredError(e.error,e.error_description,e.suberror))throw new Ae(e.error||t.EMPTY_STRING,e.error_description,e.suberror,e.timestamp||t.EMPTY_STRING,e.trace_id||t.EMPTY_STRING,e.correlation_id||t.EMPTY_STRING,e.claims||t.EMPTY_STRING);throw new he(e.error||t.EMPTY_STRING,e.error_description,e.suberror)}e.client_info&&J(e.client_info,o)}validateTokenResponse(e){if(e.error||e.error_description||e.suberror){if(Ae.isInteractionRequiredError(e.error,e.error_description,e.suberror))throw new Ae(e.error,e.error_description,e.suberror,e.timestamp||t.EMPTY_STRING,e.trace_id||t.EMPTY_STRING,e.correlation_id||t.EMPTY_STRING,e.claims||t.EMPTY_STRING);const r=`${e.error_codes} - [${e.timestamp}]: ${e.error_description} - Correlation ID: ${e.correlation_id} - Trace ID: ${e.trace_id}`;throw new he(e.error,r,e.suberror)}}async handleServerTokenResponse(r,o,n,i,s,a,c,d,l){let h,u;if(this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.HandleServerTokenResponse,r.correlation_id),r.id_token){if(h=new te(r.id_token||t.EMPTY_STRING,this.cryptoObj),s&&!B.isEmpty(s.nonce)&&h.claims.nonce!==s.nonce)throw x.createNonceMismatchError();if(i.maxAge||0===i.maxAge){const e=h.claims.auth_time;if(!e)throw x.createAuthTimeNotFoundError();te.checkMaxAge(e,i.maxAge)}}this.homeAccountIdentifier=ee.generateHomeAccountId(r.client_info||t.EMPTY_STRING,o.authorityType,this.logger,this.cryptoObj,h),s&&s.state&&(u=Re.parseRequestState(this.cryptoObj,s.state)),r.key_id=r.key_id||i.sshKid||void 0;const p=this.generateCacheRecord(r,o,n,i,h,a,s);let g;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),g=new Le(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(g)),c&&!d&&p.account){const e=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(e))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),He.generateAuthenticationResult(this.cryptoObj,o,p,!1,i,h,u,void 0,l)}await this.cacheStorage.saveCacheRecord(p)}finally{this.persistencePlugin&&this.serializableCache&&g&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(g))}return He.generateAuthenticationResult(this.cryptoObj,o,p,!1,i,h,u,r,l)}generateCacheRecord(e,r,o,n,i,s,a){const c=r.getPreferredCache();if(B.isEmpty(c))throw x.createInvalidCacheEnvironmentError();let d,l;!B.isEmpty(e.id_token)&&i&&(d=Ee.createIdTokenEntity(this.homeAccountIdentifier,c,e.id_token||t.EMPTY_STRING,this.clientId,i.claims.tid||t.EMPTY_STRING),l=this.generateAccountEntity(e,i,r,a));let h=null;if(!B.isEmpty(e.access_token)){const a=e.scope?V.fromString(e.scope):new V(n.scopes||[]),d=("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0,l=("string"==typeof e.ext_expires_in?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,u=("string"==typeof e.refresh_in?parseInt(e.refresh_in,10):e.refresh_in)||void 0,p=o+d,g=p+l,m=u&&u>0?o+u:void 0;h=ve.createAccessTokenEntity(this.homeAccountIdentifier,c,e.access_token||t.EMPTY_STRING,this.clientId,i?i.claims.tid||t.EMPTY_STRING:r.tenant,a.printScopes(),p,g,this.cryptoObj,m,e.token_type,s,e.key_id,n.claims,n.requestedClaimsHash)}let u=null;B.isEmpty(e.refresh_token)||(u=Ie.createRefreshTokenEntity(this.homeAccountIdentifier,c,e.refresh_token||t.EMPTY_STRING,this.clientId,e.foci,s));let p=null;return B.isEmpty(e.foci)||(p=Ue.createAppMetadataEntity(this.clientId,c,e.foci)),new ke(l,d,h,u,p)}generateAccountEntity(e,r,o,n){const i=o.authorityType,s=n?n.cloud_graph_host_name:t.EMPTY_STRING,a=n?n.msgraph_host:t.EMPTY_STRING;if(i===Z.Adfs)return this.logger.verbose("Authority type is ADFS, creating ADFS account"),ee.createGenericAccount(this.homeAccountIdentifier,r,o,s,a);if(B.isEmpty(e.client_info)&&"AAD"===o.protocolMode)throw x.createClientInfoEmptyError();return e.client_info?ee.createAccount(e.client_info,this.homeAccountIdentifier,r,o,s,a):ee.createGenericAccount(this.homeAccountIdentifier,r,o,s,a)}static async generateAuthenticationResult(r,o,n,i,s,a,c,d,l){let h,u=t.EMPTY_STRING,p=[],g=null,m=t.EMPTY_STRING;if(n.accessToken){if(n.accessToken.tokenType===e.AuthenticationScheme.POP){const e=new qe(r),{secret:t,keyId:o}=n.accessToken;if(!o)throw x.createKeyIdMissingError();u=await e.signPopToken(t,o,s)}else u=n.accessToken.secret;p=V.fromString(n.accessToken.target).asArray(),g=new Date(1e3*Number(n.accessToken.expiresOn)),h=new Date(1e3*Number(n.accessToken.extendedExpiresOn))}n.appMetadata&&(m=n.appMetadata.familyId===E?E:t.EMPTY_STRING);const f=a?.claims.oid||a?.claims.sub||t.EMPTY_STRING,C=a?.claims.tid||t.EMPTY_STRING;return d?.spa_accountid&&n.account&&(n.account.nativeAccountId=d?.spa_accountid),{authority:o.canonicalAuthority,uniqueId:f,tenantId:C,scopes:p,account:n.account?n.account.getAccountInfo():null,idToken:a?a.rawToken:t.EMPTY_STRING,idTokenClaims:a?a.claims:{},accessToken:u,fromCache:i,expiresOn:g,correlationId:s.correlationId,requestId:l||t.EMPTY_STRING,extExpiresOn:h,familyId:m,tokenType:n.accessToken?.tokenType||t.EMPTY_STRING,state:c?c.userRequestState:t.EMPTY_STRING,cloudGraphHostName:n.account?.cloudGraphHostName||t.EMPTY_STRING,msGraphHost:n.account?.msGraphHost||t.EMPTY_STRING,code:d?.spa_code,fromNativeBroker:!1}}}
|
|
47
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class De extends Ce{constructor(e,t){super(e,t),this.includeRedirectUri=!0}async getAuthCodeUrl(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.GetAuthCodeUrl,t.correlationId),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthClientCreateQueryString,t.correlationId);const r=await this.createAuthCodeUrlQueryString(t);return be.appendQueryString(this.authority.authorizationEndpoint,r)}async acquireToken(t,r){if(!t||!t.code)throw x.createTokenRequestCannotBeMadeError();this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthClientAcquireToken,t.correlationId);const o=this.performanceClient?.startMeasurement("AuthCodeClientAcquireToken",t.correlationId);this.logger.info("in acquireToken call in auth-code client");const i=Te.nowSeconds();this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthClientExecuteTokenRequest,t.correlationId);const s=await this.executeTokenRequest(this.authority,t),a=s.headers?.[n.X_MS_REQUEST_ID],c=s.headers?.[n.X_MS_HTTP_VERSION];c&&o?.addStaticFields({httpVerAuthority:c});const d=new He(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return d.validateTokenResponse(s.body),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.HandleServerTokenResponse,t.correlationId),d.handleServerTokenResponse(s.body,this.authority,i,t,r,void 0,void 0,void 0,a).then((e=>(o?.endMeasurement({success:!0}),e))).catch((e=>{throw this.logger.verbose("Error in fetching token in ACC",t.correlationId),o?.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}))}handleFragmentResponse(e,t){const r=new He(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null),o=new be(e),n=be.getDeserializedHash(o.getHash());if(r.validateServerAuthorizationCodeResponse(n,t,this.cryptoUtils),!n.code)throw x.createNoAuthCodeInServerResponseError();return{...n,code:n.code}}getLogoutUri(e){if(!e)throw W.createEmptyLogoutRequestError();const t=this.createLogoutUrlQueryString(e);return be.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(t,r){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthClientExecuteTokenRequest,r.correlationId),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthClientCreateTokenRequestBody,r.correlationId);const o=this.createTokenQueryParameters(r),n=be.appendQueryString(t.tokenEndpoint,o),i=await this.createTokenRequestBody(r);let s;if(r.clientInfo)try{const e=J(r.clientInfo,this.cryptoUtils);s={credential:`${e.uid}${m.CLIENT_INFO_SEPARATOR}${e.utid}`,type:ge.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}const a=this.createTokenRequestHeaders(s||r.ccsCredential),c={clientId:this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:r.scopes,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid};return this.executePostToTokenEndpoint(n,i,a,c)}async createTokenRequestBody(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthClientCreateTokenRequestBody,t.correlationId);const r=new fe;if(r.addClientId(this.config.authOptions.clientId),this.includeRedirectUri?r.addRedirectUri(t.redirectUri):me.validateRedirectUri(t.redirectUri),r.addScopes(t.scopes),r.addAuthorizationCode(t.code),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&r.addServerTelemetry(this.serverTelemetryManager),t.codeVerifier&&r.addCodeVerifier(t.codeVerifier),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const e=this.config.clientCredentials.clientAssertion;r.addClientAssertion(e.assertion),r.addClientAssertionType(e.assertionType)}if(r.addGrantType(p.AUTHORIZATION_CODE_GRANT),r.addClientInfo(),t.authenticationScheme===e.AuthenticationScheme.POP){const o=new qe(this.cryptoUtils,this.performanceClient);this.performanceClient?.setPreQueueTime(e.PerformanceEvents.PopTokenGenerateCnf,t.correlationId);const n=await o.generateCnf(t);r.addPopToken(n.reqCnfString)}else if(t.authenticationScheme===e.AuthenticationScheme.SSH){if(!t.sshJwk)throw W.createMissingSshJwkError();r.addSshJwk(t.sshJwk)}const o=t.correlationId||this.config.cryptoInterface.createNewGuid();let n;if(r.addCorrelationId(o),(!B.isEmptyObj(t.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(t.claims,this.config.authOptions.clientCapabilities),t.clientInfo)try{const e=J(t.clientInfo,this.cryptoUtils);n={credential:`${e.uid}${m.CLIENT_INFO_SEPARATOR}${e.utid}`,type:ge.HOME_ACCOUNT_ID}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}else n=t.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case ge.HOME_ACCOUNT_ID:try{const e=X(n.credential);r.addCcsOid(e)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case ge.UPN:r.addCcsUpn(n.credential)}return t.tokenBodyParameters&&r.addExtraQueryParameters(t.tokenBodyParameters),!t.enableSpaAuthorizationCode||t.tokenBodyParameters&&t.tokenBodyParameters[a.RETURN_SPA_CODE]||r.addExtraQueryParameters({[a.RETURN_SPA_CODE]:"1"}),r.createQueryString()}async createAuthCodeUrlQueryString(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthClientCreateQueryString,t.correlationId);const r=new fe;r.addClientId(this.config.authOptions.clientId);const o=[...t.scopes||[],...t.extraScopesToConsent||[]];r.addScopes(o),r.addRedirectUri(t.redirectUri);const n=t.correlationId||this.config.cryptoInterface.createNewGuid();if(r.addCorrelationId(n),r.addResponseMode(t.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),t.codeChallenge&&t.codeChallengeMethod&&r.addCodeChallengeParams(t.codeChallenge,t.codeChallengeMethod),t.prompt&&r.addPrompt(t.prompt),t.domainHint&&r.addDomainHint(t.domainHint),t.prompt!==d.SELECT_ACCOUNT)if(t.sid&&t.prompt===d.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(t.sid);else if(t.account){const e=this.extractAccountSid(t.account),o=this.extractLoginHint(t.account);if(o){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(o);try{const e=X(t.account.homeAccountId);r.addCcsOid(e)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e&&t.prompt===d.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(e);try{const e=X(t.account.homeAccountId);r.addCcsOid(e)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(t.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(t.loginHint),r.addCcsUpn(t.loginHint);else if(t.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(t.account.username);try{const e=X(t.account.homeAccountId);r.addCcsOid(e)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else t.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(t.loginHint),r.addCcsUpn(t.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(t.nonce&&r.addNonce(t.nonce),t.state&&r.addState(t.state),(!B.isEmpty(t.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(t.claims,this.config.authOptions.clientCapabilities),t.extraQueryParameters&&r.addExtraQueryParameters(t.extraQueryParameters),t.nativeBroker&&(r.addNativeBroker(),t.authenticationScheme===e.AuthenticationScheme.POP)){const e=new qe(this.cryptoUtils),o=await e.generateCnf(t);r.addPopToken(o.reqCnfHash)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new fe;return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters),t.createQueryString()}extractAccountSid(e){return e.idTokenClaims?.sid||null}extractLoginHint(e){return e.idTokenClaims?.login_hint||null}}
|
|
48
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Ke extends Ce{constructor(e,t){super(e,t)}async acquireToken(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RefreshTokenClientAcquireToken,t.correlationId);const r=this.performanceClient?.startMeasurement(e.PerformanceEvents.RefreshTokenClientAcquireToken,t.correlationId);this.logger.verbose("RefreshTokenClientAcquireToken called",t.correlationId);const o=Te.nowSeconds();this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientExecuteTokenRequest,t.correlationId);const i=await this.executeTokenRequest(t,this.authority),s=i.headers?.[n.X_MS_HTTP_VERSION];r?.addStaticFields({refreshTokenSize:i.body.refresh_token?.length||0}),s&&r?.addStaticFields({httpVerToken:s});const a=i.headers?.[n.X_MS_REQUEST_ID],c=new He(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return c.validateTokenResponse(i.body),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.HandleServerTokenResponse,t.correlationId),c.handleServerTokenResponse(i.body,this.authority,o,t,void 0,void 0,!0,t.forceCache,a).then((e=>(r?.endMeasurement({success:!0}),e))).catch((e=>{throw this.logger.verbose("Error in fetching refresh token",t.correlationId),r?.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}))}async acquireTokenByRefreshToken(t){if(!t)throw W.createEmptyTokenRequestError();if(this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken,t.correlationId),!t.account)throw x.createNoAccountInSilentRequestError();if(this.cacheManager.isAppMetadataFOCI(t.account.environment))try{return this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,t.correlationId),this.acquireTokenWithCachedRefreshToken(t,!0)}catch(r){const o=r instanceof Ae&&r.errorCode===Se.noTokensFoundError.code,n=r instanceof he&&r.errorCode===b&&r.subError===P;if(o||n)return this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,t.correlationId),this.acquireTokenWithCachedRefreshToken(t,!1);throw r}return this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,t.correlationId),this.acquireTokenWithCachedRefreshToken(t,!1)}async acquireTokenWithCachedRefreshToken(t,r){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,t.correlationId);const o=this.performanceClient?.startMeasurement(e.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,t.correlationId);this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called",t.correlationId);const n=this.cacheManager.getRefreshToken(t.account,r);if(!n)throw o?.discardMeasurement(),Ae.createNoTokensFoundError();o?.endMeasurement({success:!0});const i={...t,refreshToken:n.secret,authenticationScheme:t.authenticationScheme||e.AuthenticationScheme.BEARER,ccsCredential:{credential:t.account.homeAccountId,type:ge.HOME_ACCOUNT_ID}};return this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientAcquireToken,t.correlationId),this.acquireToken(i)}async executeTokenRequest(t,r){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RefreshTokenClientExecuteTokenRequest,t.correlationId);const o=this.performanceClient?.startMeasurement(e.PerformanceEvents.RefreshTokenClientExecuteTokenRequest,t.correlationId);this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody,t.correlationId);const n=this.createTokenQueryParameters(t),i=be.appendQueryString(r.tokenEndpoint,n),s=await this.createTokenRequestBody(t),a=this.createTokenRequestHeaders(t.ccsCredential),c={clientId:this.config.authOptions.clientId,authority:r.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return this.executePostToTokenEndpoint(i,s,a,c).then((e=>(o?.endMeasurement({success:!0}),e))).catch((e=>{throw o?.endMeasurement({success:!1}),e}))}async createTokenRequestBody(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody,t.correlationId);const r=t.correlationId,o=this.performanceClient?.startMeasurement(e.PerformanceEvents.BaseClientCreateTokenRequestHeaders,r),n=new fe;if(n.addClientId(this.config.authOptions.clientId),n.addScopes(t.scopes),n.addGrantType(p.REFRESH_TOKEN_GRANT),n.addClientInfo(),n.addLibraryInfo(this.config.libraryInfo),n.addApplicationTelemetry(this.config.telemetry.application),n.addThrottling(),this.serverTelemetryManager&&n.addServerTelemetry(this.serverTelemetryManager),n.addCorrelationId(r),n.addRefreshToken(t.refreshToken),this.config.clientCredentials.clientSecret&&n.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const e=this.config.clientCredentials.clientAssertion;n.addClientAssertion(e.assertion),n.addClientAssertionType(e.assertionType)}if(t.authenticationScheme===e.AuthenticationScheme.POP){const r=new qe(this.cryptoUtils,this.performanceClient);this.performanceClient?.setPreQueueTime(e.PerformanceEvents.PopTokenGenerateCnf,t.correlationId);const o=await r.generateCnf(t);n.addPopToken(o.reqCnfString)}else if(t.authenticationScheme===e.AuthenticationScheme.SSH){if(!t.sshJwk)throw o?.endMeasurement({success:!1}),W.createMissingSshJwkError();n.addSshJwk(t.sshJwk)}if((!B.isEmptyObj(t.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(t.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&t.ccsCredential)switch(t.ccsCredential.type){case ge.HOME_ACCOUNT_ID:try{const e=X(t.ccsCredential.credential);n.addCcsOid(e)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case ge.UPN:n.addCcsUpn(t.ccsCredential.credential)}return o?.endMeasurement({success:!0}),n.createQueryString()}}
|
|
49
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Fe extends Ce{constructor(e,t){super(e,t)}async acquireToken(e){try{return await this.acquireCachedToken(e)}catch(t){if(t instanceof x&&t.errorCode===F.tokenRefreshRequired.code){return new Ke(this.config,this.performanceClient).acquireTokenByRefreshToken(e)}throw t}}async acquireCachedToken(e){if(!e)throw W.createEmptyTokenRequestError();if(e.forceRefresh)throw this.serverTelemetryManager?.setCacheOutcome(U.FORCE_REFRESH),this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true."),x.createRefreshRequiredError();if(!e.account)throw x.createNoAccountInSilentRequestError();const t=e.authority||this.authority.getPreferredCache(),r=this.cacheManager.readCacheRecord(e.account,e,t);if(!r.accessToken)throw this.serverTelemetryManager?.setCacheOutcome(U.NO_CACHED_ACCESS_TOKEN),this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties."),x.createRefreshRequiredError();if(Te.wasClockTurnedBack(r.accessToken.cachedAt)||Te.isTokenExpired(r.accessToken.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.serverTelemetryManager?.setCacheOutcome(U.CACHED_ACCESS_TOKEN_EXPIRED),this.logger.info(`SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`),x.createRefreshRequiredError();if(r.accessToken.refreshOn&&Te.isTokenExpired(r.accessToken.refreshOn,0))throw this.serverTelemetryManager?.setCacheOutcome(U.REFRESH_CACHED_ACCESS_TOKEN),this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'."),x.createRefreshRequiredError();return this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),await this.generateResultFromCacheRecord(r,e)}async generateResultFromCacheRecord(e,t){let r;if(e.idToken&&(r=new te(e.idToken.secret,this.config.cryptoInterface)),t.maxAge||0===t.maxAge){const e=r?.claims.auth_time;if(!e)throw x.createAuthTimeNotFoundError();te.checkMaxAge(e,t.maxAge)}return await He.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}
|
|
50
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
51
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
52
|
+
const xe={"https://login.microsoftonline.com/common/":{token_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/common/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/common/":{token_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/common/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/common/":{token_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/common/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/common/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/common/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"},"https://login.microsoftonline.com/consumers/":{token_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/consumers/":{token_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/consumers/":{token_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/consumers/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/consumers/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/consumers/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"},"https://login.microsoftonline.com/organizations/":{token_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.com/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.com/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.com/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.com",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pas.windows.net"},"https://login.chinacloudapi.cn/organizations/":{token_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",authorization_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.chinacloudapi.cn/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"partner.microsoftonline.cn",cloud_graph_host_name:"graph.chinacloudapi.cn",msgraph_host:"microsoftgraph.chinacloudapi.cn",rbac_url:"https://pas.chinacloudapi.cn"},"https://login.microsoftonline.us/organizations/":{token_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/token",token_endpoint_auth_methods_supported:["client_secret_post","private_key_jwt","client_secret_basic"],jwks_uri:"https://login.microsoftonline.us/organizations/discovery/v2.0/keys",response_modes_supported:["query","fragment","form_post"],subject_types_supported:["pairwise"],id_token_signing_alg_values_supported:["RS256"],response_types_supported:["code","id_token","code id_token","id_token token"],scopes_supported:["openid","profile","email","offline_access"],issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",request_uri_parameter_supported:!1,userinfo_endpoint:"https://graph.microsoft.com/oidc/userinfo",authorization_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize",device_authorization_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode",http_logout_supported:!0,frontchannel_logout_supported:!0,end_session_endpoint:"https://login.microsoftonline.us/organizations/oauth2/v2.0/logout",claims_supported:["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],kerberos_endpoint:"https://login.microsoftonline.us/organizations/kerberos",tenant_region_scope:null,cloud_instance_name:"microsoftonline.us",cloud_graph_host_name:"graph.windows.net",msgraph_host:"graph.microsoft.com",rbac_url:"https://pasff.usgovcloudapi.net"}},Be={"https://login.microsoftonline.com/common/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/common/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/common/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.com/consumers/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/consumers/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/consumers/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.com/organizations/":{tenant_discovery_endpoint:"https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.chinacloudapi.cn/organizations/":{tenant_discovery_endpoint:"https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},"https://login.microsoftonline.us/organizations/":{tenant_discovery_endpoint:"https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration","api-version":"1.1",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}};var Ge;
|
|
53
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
54
|
+
e.ProtocolMode=void 0,(Ge=e.ProtocolMode||(e.ProtocolMode={})).AAD="AAD",Ge.OIDC="OIDC";
|
|
55
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
56
|
+
class $e{constructor(){this.expiresAt=Te.nowSeconds()+v}updateCloudDiscoveryMetadata(e,t){this.aliases=e.aliases,this.preferred_cache=e.preferred_cache,this.preferred_network=e.preferred_network,this.aliasesFromNetwork=t}updateEndpointMetadata(e,t){this.authorization_endpoint=e.authorization_endpoint,this.token_endpoint=e.token_endpoint,this.end_session_endpoint=e.end_session_endpoint,this.issuer=e.issuer,this.endpointsFromNetwork=t,this.jwks_uri=e.jwks_uri}updateCanonicalAuthority(e){this.canonical_authority=e}resetExpiresAt(){this.expiresAt=Te.nowSeconds()+v}isExpired(){return this.expiresAt<=Te.nowSeconds()}static isAuthorityMetadataEntity(e,t){return!!t&&(0===e.indexOf(T)&&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("issuer")&&t.hasOwnProperty("aliasesFromNetwork")&&t.hasOwnProperty("endpointsFromNetwork")&&t.hasOwnProperty("expiresAt")&&t.hasOwnProperty("jwks_uri"))}}
|
|
57
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
58
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
59
|
+
class ze{constructor(e,t,r){this.networkInterface=e,this.performanceClient=t,this.correlationId=r}async detectRegion(r,o){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RegionDiscoveryDetectRegion,this.correlationId);let n=r;if(n)o.region_source=O.ENVIRONMENT_VARIABLE;else{const r=ze.IMDS_OPTIONS;try{this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS,this.correlationId);const i=await this.getRegionFromIMDS(t.IMDS_VERSION,r);if(i.status===M.httpSuccess&&(n=i.body,o.region_source=O.IMDS),i.status===M.httpBadRequest){this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RegionDiscoveryGetCurrentVersion,this.correlationId);const t=await this.getCurrentVersion(r);if(!t)return o.region_source=O.FAILED_AUTO_DETECTION,null;this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS,this.correlationId);const i=await this.getRegionFromIMDS(t,r);i.status===M.httpSuccess&&(n=i.body,o.region_source=O.IMDS)}}catch(e){return o.region_source=O.FAILED_AUTO_DETECTION,null}}return n||(o.region_source=O.FAILED_AUTO_DETECTION),n||null}async getRegionFromIMDS(r,o){return this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${t.IMDS_ENDPOINT}?api-version=${r}&format=text`,o,t.IMDS_TIMEOUT)}async getCurrentVersion(r){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const e=await this.networkInterface.sendGetRequestAsync(`${t.IMDS_ENDPOINT}?format=json`,r);return e.status===M.httpBadRequest&&e.body&&e.body["newest-versions"]&&e.body["newest-versions"].length>0?e.body["newest-versions"][0]:null}catch(e){return null}}}ze.IMDS_OPTIONS={headers:{Metadata:"true"}};
|
|
60
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
61
|
+
class Qe{constructor(e,t,r,o,n,i,s){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=r,this.authorityOptions=o,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=n,this.performanceClient=i,this.correlationId=s,this.regionDiscovery=new ze(t,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(t.CIAM_AUTH_URL))return Z.Ciam;const r=e.PathSegments;if(r.length)switch(r[0].toLowerCase()){case t.ADFS:return Z.Adfs;case t.DSTS:return Z.Dsts}return Z.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new be(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw x.createLogoutNotSupportedError();return this.replacePath(this.metadata.end_session_endpoint)}throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}canReplaceTenant(t){return 1===t.PathSegments.length&&!Qe.reservedTenantDomains.has(t.PathSegments[0])&&this.getAuthorityType(t)===Z.Default&&this.protocolMode===e.ProtocolMode.AAD}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let t=e;const r=new be(this.metadata.canonical_authority).getUrlComponents(),o=r.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach(((e,n)=>{let i=o[n];if(0===n&&this.canReplaceTenant(r)){const e=new be(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];i!==e&&(this.logger.verbose(`Replacing tenant domain name ${i} with id ${e}`),i=e)}e!==i&&(t=t.replace(`/${i}/`,`/${e}/`))})),this.replaceTenant(t)}get defaultOpenIdConfigurationEndpoint(){return this.authorityType===Z.Adfs||this.protocolMode===e.ProtocolMode.OIDC?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthorityResolveEndpointsAsync,this.correlationId);let t=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);t||(t=new $e,t.updateCanonicalAuthority(this.canonicalAuthority)),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const r=await this.updateCloudDiscoveryMetadata(t);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,t.preferred_network),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthorityUpdateEndpointMetadata,this.correlationId);const o=await this.updateEndpointMetadata(t);r!==I.CACHE&&o!==I.CACHE&&(t.resetExpiresAt(),t.updateCanonicalAuthority(this.canonicalAuthority));const n=this.cacheManager.generateAuthorityMetadataCacheKey(t.preferred_cache);this.cacheManager.setAuthorityMetadata(n,t),this.metadata=t}async updateEndpointMetadata(t){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthorityUpdateEndpointMetadata,this.correlationId);let r=this.getEndpointMetadataFromConfig();if(r)return t.updateEndpointMetadata(r,!1),I.CONFIG;if(this.isAuthoritySameType(t)&&t.endpointsFromNetwork&&!t.isExpired())return I.CACHE;if(this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork,this.correlationId),r=await this.getEndpointMetadataFromNetwork(),r)return this.authorityOptions.azureRegionConfiguration?.azureRegion&&(this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),r=await this.updateMetadataWithRegionalInformation(r)),t.updateEndpointMetadata(r,!0),I.NETWORK;let o=this.getEndpointMetadataFromHardcodedValues();if(o&&!this.authorityOptions.skipAuthorityMetadataCache)return this.authorityOptions.azureRegionConfiguration?.azureRegion&&(this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),o=await this.updateMetadataWithRegionalInformation(o)),t.updateEndpointMetadata(o,!1),I.HARDCODED_VALUES;throw x.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint)}isAuthoritySameType(e){return new be(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch(e){throw W.createInvalidAuthorityMetadataError()}return null}async getEndpointMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const t=this.performanceClient?.startMeasurement(e.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork,this.correlationId),r={},o=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${o}`);try{const e=await this.networkInterface.sendGetRequestAsync(o,r),n=function(e){return e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("jwks_uri")}(e.body);return n?(t?.endMeasurement({success:!0}),e.body):(t?.endMeasurement({success:!1,errorCode:"invalid_response"}),this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(e){return t?.endMeasurement({success:!1,errorCode:"request_failure"}),this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${e}`),null}}getEndpointMetadataFromHardcodedValues(){return this.canonicalAuthority in xe?xe[this.canonicalAuthority]:null}async updateMetadataWithRegionalInformation(r){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.RegionDiscoveryDetectRegion,this.correlationId);const o=await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration?.environmentRegion,this.regionDiscoveryMetadata),n=this.authorityOptions.azureRegionConfiguration?.azureRegion===t.AZURE_REGION_AUTO_DISCOVER_FLAG?o:this.authorityOptions.azureRegionConfiguration?.azureRegion;return this.authorityOptions.azureRegionConfiguration?.azureRegion===t.AZURE_REGION_AUTO_DISCOVER_FLAG?this.regionDiscoveryMetadata.region_outcome=o?q.AUTO_DETECTION_REQUESTED_SUCCESSFUL:q.AUTO_DETECTION_REQUESTED_FAILED:this.regionDiscoveryMetadata.region_outcome=o?this.authorityOptions.azureRegionConfiguration?.azureRegion===o?q.CONFIGURED_MATCHES_DETECTED:q.CONFIGURED_NOT_DETECTED:q.CONFIGURED_NO_AUTO_DETECTION,n?(this.regionDiscoveryMetadata.region_used=n,Qe.replaceWithRegionalInformation(r,n)):r}async updateCloudDiscoveryMetadata(r){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId),this.logger.verbose("Attempting to get cloud discovery metadata in the config"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||t.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||t.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${r.canonical_authority||t.NOT_APPLICABLE}`);let o=this.getCloudDiscoveryMetadataFromConfig();if(o)return this.logger.verbose("Found cloud discovery metadata in the config."),r.updateCloudDiscoveryMetadata(o,!1),I.CONFIG;this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.");const n=r.isExpired();if(this.isAuthoritySameType(r)&&r.aliasesFromNetwork&&!n)return this.logger.verbose("Found metadata in the cache."),I.CACHE;if(n&&this.logger.verbose("The metadata entity is expired."),this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network."),this.performanceClient?.setPreQueueTime(e.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId),o=await this.getCloudDiscoveryMetadataFromNetwork(),o)return this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()"),r.updateCloudDiscoveryMetadata(o,!0),I.NETWORK;this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.");const i=this.getCloudDiscoveryMetadataFromHarcodedValues();if(i&&!this.options.skipAuthorityMetadataCache)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),r.updateCloudDiscoveryMetadata(i,!1),I.HARDCODED_VALUES;throw this.logger.error("Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error."),W.createUntrustedAuthorityError()}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Z.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Qe.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),t=Qe.getCloudDiscoveryMetadataFromNetworkResponse(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),t)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),t;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch(e){throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),W.createInvalidCloudDiscoveryMetadataError()}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Qe.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(e.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const r=`${t.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,o={};let n=null;try{const e=await this.networkInterface.sendGetRequestAsync(r,o);let i,s;if(function(e){return e.hasOwnProperty("tenant_discovery_endpoint")&&e.hasOwnProperty("metadata")}
|
|
62
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */(e.body))i=e.body,s=i.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${i.tenant_discovery_endpoint}`);else{if(!function(e){return e.hasOwnProperty("error")&&e.hasOwnProperty("error_description")}(e.body))return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${e.status}`),i=e.body,i.error===t.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${i.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${i.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),s=[]}this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),n=Qe.getCloudDiscoveryMetadataFromNetworkResponse(s,this.hostnameAndPort)}catch(e){if(e instanceof D)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.\nError: ${e.errorCode}\nError Description: ${e.errorMessage}`);else{const t=e;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: ${t.name}\nError Description: ${t.message}`)}return null}return n||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),n=Qe.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),n}getCloudDiscoveryMetadataFromHarcodedValues(){return this.canonicalAuthority in Be?Be[this.canonicalAuthority]:null}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter((e=>be.getDomainFromUrl(e).toLowerCase()===this.hostnameAndPort)).length>0}static generateAuthority(r,o){let n;if(o&&o.azureCloudInstance!==e.AzureCloudInstance.None){const e=o.tenant?o.tenant:t.DEFAULT_COMMON_TENANT;n=`${o.azureCloudInstance}/${e}/`}return n||r}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}static getCloudDiscoveryMetadataFromNetworkResponse(e,t){for(let r=0;r<e.length;r++){const o=e[r];if(o.aliases.indexOf(t)>-1)return o}return null}getPreferredCache(){if(this.discoveryComplete())return this.metadata.preferred_cache;throw x.createEndpointDiscoveryIncompleteError("Discovery incomplete.")}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}static isPublicCloudAuthority(e){return t.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,r,o){const n=new be(e);n.validateAsUri();const i=n.getUrlComponents();let s=`${r}.${i.HostNameAndPort}`;this.isPublicCloudAuthority(i.HostNameAndPort)&&(s=`${r}.${t.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const a=be.constructAuthorityUriFromObject({...n.getUrlComponents(),HostNameAndPort:s}).urlString;return o?`${a}?${o}`:a}static replaceWithRegionalInformation(e,r){return e.authorization_endpoint=Qe.buildRegionalAuthorityString(e.authorization_endpoint,r),e.token_endpoint=Qe.buildRegionalAuthorityString(e.token_endpoint,r,t.REGIONAL_AUTH_NON_MSI_QUERY_STRING),e.end_session_endpoint&&(e.end_session_endpoint=Qe.buildRegionalAuthorityString(e.end_session_endpoint,r)),e}static transformCIAMAuthority(e){let r=e.endsWith(t.FORWARD_SLASH)?e:`${e}${t.FORWARD_SLASH}`;const o=new be(e).getUrlComponents();if(0===o.PathSegments.length&&o.HostNameAndPort.endsWith(t.CIAM_AUTH_URL)){r=`${r}${o.HostNameAndPort.split(".")[0]}${t.AAD_TENANT_DOMAIN_SUFFIX}`}return r}}Qe.reservedTenantDomains=new Set(["{tenant}","{tenantid}",s.COMMON,s.CONSUMERS,s.ORGANIZATIONS]);
|
|
63
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
64
|
+
class Ye{static async createDiscoveredInstance(t,r,o,n,i,s,a){s?.addQueueMeasurement(e.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,a);const c=Qe.transformCIAMAuthority(t),d=Ye.createInstance(c,r,o,n,i,s,a);try{return s?.setPreQueueTime(e.PerformanceEvents.AuthorityResolveEndpointsAsync,a),await d.resolveEndpointsAsync(),d}catch(e){throw x.createEndpointDiscoveryIncompleteError(e)}}static createInstance(e,t,r,o,n,i,s){if(B.isEmpty(e))throw W.createUrlEmptyError();return new Qe(e,t,r,o,n,i,s)}}
|
|
65
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class je{constructor(){this.failedRequests=[],this.errors=[],this.cacheHits=0}static isServerTelemetryEntity(e,t){const r=0===e.indexOf(_.CACHE_KEY);let o=!0;return t&&(o=t.hasOwnProperty("failedRequests")&&t.hasOwnProperty("errors")&&t.hasOwnProperty("cacheHits")),r&&o}}
|
|
66
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class We{static isThrottlingEntity(e,t){let r=!1;e&&(r=0===e.indexOf(k));let o=!0;return t&&(o=t.hasOwnProperty("throttleTime")),r&&o}}
|
|
67
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */const Ve={sendGetRequestAsync:()=>Promise.reject(D.createUnexpectedError("Network interface - sendGetRequestAsync() has not been implemented for the Network interface.")),sendPostRequestAsync:()=>Promise.reject(D.createUnexpectedError("Network interface - sendPostRequestAsync() has not been implemented for the Network interface."))},Je={code:"missing_kid_error",desc:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided."},Xe={code:"missing_alg_error",desc:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};
|
|
68
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class Ze extends D{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,Ze.prototype)}static createMissingKidError(){return new Ze(Je.code,Je.desc)}static createMissingAlgError(){return new Ze(Xe.code,Xe.desc)}}
|
|
69
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class et{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw Ze.createMissingKidError();if(!e.alg)throw Ze.createMissingAlgError();const t=new et({typ:e.typ||L.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}
|
|
70
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
71
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
|
|
72
|
+
class tt{constructor(e,r){this.cacheOutcome=U.NO_CACHE_HIT,this.cacheManager=r,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||t.EMPTY_STRING,this.wrapperVer=e.wrapperVer||t.EMPTY_STRING,this.telemetryCacheKey=_.CACHE_KEY+m.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${_.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer].join(_.VALUE_SEPARATOR),r=[e,this.getRegionDiscoveryFields()].join(_.VALUE_SEPARATOR);return[_.SCHEMA_VERSION,r,t].join(_.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=tt.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(_.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(_.VALUE_SEPARATOR),n=e.errors.length,i=[n,t<n?_.OVERFLOW_TRUE:_.OVERFLOW_FALSE].join(_.VALUE_SEPARATOR);return[_.SCHEMA_VERSION,e.cacheHits,r,o,i].join(_.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=_.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof D?B.isEmpty(e.subError)?B.isEmpty(e.errorCode)?t.errors.push(e.toString()):t.errors.push(e.errorCode):t.errors.push(e.subError):t.errors.push(e.toString()):t.errors.push(_.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e=new je;return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=tt.maxErrorsToSend(e);if(t===e.errors.length)this.cacheManager.removeItem(this.telemetryCacheKey);else{const r=new je;r.failedRequests=e.failedRequests.slice(2*t),r.errors=e.errors.slice(t),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,r)}}static maxErrorsToSend(e){let r,o=0,n=0;const i=e.errors.length;for(r=0;r<i;r++){const i=e.failedRequests[2*r]||t.EMPTY_STRING,s=e.failedRequests[2*r+1]||t.EMPTY_STRING,a=e.errors[r]||t.EMPTY_STRING;if(n+=i.toString().length+s.toString().length+a.length+3,!(n<_.MAX_LAST_HEADER_BYTES))break;o+=1}return o}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||t.EMPTY_STRING),e.push(this.regionSource||t.EMPTY_STRING),e.push(this.regionOutcome||t.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}}
|
|
73
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class rt{constructor(e,t,r,o,n,i){this.authority=t,this.libraryName=o,this.libraryVersion=n,this.applicationTelemetry=i,this.clientId=e,this.logger=r,this.callbacks=new Map,this.eventsByCorrelationId=new Map,this.queueMeasurements=new Map,this.preQueueTimeByCorrelationId=new Map}startPerformanceMeasurement(e,t){return{}}getIntFields(){return Me}getPreQueueTime(e,t){const r=this.preQueueTimeByCorrelationId.get(t);if(r){if(r.name===e)return r.time;this.logger.trace(`PerformanceClient.getPreQueueTime: no pre-queue time found for ${e}, unable to add queue measurement`)}else this.logger.trace(`PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: ${t}, unable to add queue measurement`)}calculateQueuedTime(e,t){return e<1?(this.logger.trace(`PerformanceClient: preQueueTime should be a positive integer and not ${e}`),0):t<1?(this.logger.trace(`PerformanceClient: currentTime should be a positive integer and not ${t}`),0):t<e?(this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved"),0):t-e}addQueueMeasurement(e,t,r,o){if(!t)return void this.logger.trace(`PerformanceClient.addQueueMeasurement: correlationId not provided for ${e}, cannot add queue measurement`);if(0===r)this.logger.trace(`PerformanceClient.addQueueMeasurement: queue time provided for ${e} is ${r}`);else if(!r)return void this.logger.trace(`PerformanceClient.addQueueMeasurement: no queue time provided for ${e}`);const n={eventName:e,queueTime:r,manuallyCompleted:o},i=this.queueMeasurements.get(t);if(i)i.push(n),this.queueMeasurements.set(t,i);else{this.logger.trace(`PerformanceClient.addQueueMeasurement: adding correlationId ${t} to queue measurements`);const e=[n];this.queueMeasurements.set(t,e)}this.preQueueTimeByCorrelationId.delete(t)}startMeasurement(e,t){const r=t||this.generateId();t||this.logger.info(`PerformanceClient: No correlation id provided for ${e}, generating`,r),this.logger.trace(`PerformanceClient: Performance measurement started for ${e}`,r);const o=this.startPerformanceMeasurement(e,r);o.startMeasurement();const n={eventId:this.generateId(),status:Ne.InProgress,authority:this.authority,libraryName:this.libraryName,libraryVersion:this.libraryVersion,clientId:this.clientId,name:e,startTimeMs:Date.now(),correlationId:r,appName:this.applicationTelemetry?.appName,appVersion:this.applicationTelemetry?.appVersion};return this.cacheEventByCorrelationId(n),{endMeasurement:e=>this.endMeasurement({...n,...e},o),discardMeasurement:()=>this.discardMeasurements(n.correlationId),addStaticFields:e=>this.addStaticFields(e,n.correlationId),increment:e=>this.increment(e,n.correlationId),measurement:o,event:n}}endMeasurement(e,t){const r=this.eventsByCorrelationId.get(e.correlationId);if(!r)return this.logger.trace(`PerformanceClient: Measurement not found for ${e.eventId}`,e.correlationId),null;const o=e.eventId===r.eventId;let n={totalQueueTime:0,totalQueueCount:0,manuallyCompletedCount:0};o?(n=this.getQueueInfo(e.correlationId),this.discardCache(r.correlationId)):r.incompleteSubMeasurements?.delete(e.eventId),t?.endMeasurement();const i=t?.flushMeasurement();if(!i)return this.logger.trace("PerformanceClient: Performance measurement not taken",r.correlationId),null;if(this.logger.trace(`PerformanceClient: Performance measurement ended for ${e.name}: ${i} ms`,e.correlationId),!o)return r[e.name+"DurationMs"]=Math.floor(i),{...r};let s={...r,...e},a=0;return s.incompleteSubMeasurements?.forEach((t=>{this.logger.trace(`PerformanceClient: Incomplete submeasurement ${t.name} found for ${e.name}`,s.correlationId),a++})),s.incompleteSubMeasurements=void 0,s={...s,durationMs:Math.round(i),queuedTimeMs:n.totalQueueTime,queuedCount:n.totalQueueCount,queuedManuallyCompletedCount:n.manuallyCompletedCount,status:Ne.Completed,incompleteSubsCount:a},this.truncateIntegralFields(s,this.getIntFields()),this.emitEvents([s],e.correlationId),s}addStaticFields(e,t){this.logger.trace("PerformanceClient: Updating static fields");const r=this.eventsByCorrelationId.get(t);r?this.eventsByCorrelationId.set(t,{...r,...e}):this.logger.trace("PerformanceClient: Event not found for",t)}increment(e,t){this.logger.trace("PerformanceClient: Updating counters");const r=this.eventsByCorrelationId.get(t);if(r)for(const t in e)r.hasOwnProperty(t)||(r[t]=0),r[t]+=e[t];else this.logger.trace("PerformanceClient: Event not found for",t)}cacheEventByCorrelationId(e){const t=this.eventsByCorrelationId.get(e.correlationId);t?(this.logger.trace(`PerformanceClient: Performance measurement for ${e.name} added/updated`,e.correlationId),t.incompleteSubMeasurements=t.incompleteSubMeasurements||new Map,t.incompleteSubMeasurements.set(e.eventId,{name:e.name,startTimeMs:e.startTimeMs})):(this.logger.trace(`PerformanceClient: Performance measurement for ${e.name} started`,e.correlationId),this.eventsByCorrelationId.set(e.correlationId,{...e}))}getQueueInfo(e){const t=this.queueMeasurements.get(e);t||this.logger.trace(`PerformanceClient: no queue measurements found for for correlationId: ${e}`);let r=0,o=0,n=0;return t?.forEach((e=>{r+=e.queueTime,o++,n+=e.manuallyCompleted?1:0})),{totalQueueTime:r,totalQueueCount:o,manuallyCompletedCount:n}}discardMeasurements(e){this.logger.trace("PerformanceClient: Performance measurements discarded",e),this.eventsByCorrelationId.delete(e)}discardCache(e){this.discardMeasurements(e),this.logger.trace("PerformanceClient: QueueMeasurements discarded",e),this.queueMeasurements.delete(e),this.logger.trace("PerformanceClient: Pre-queue times discarded",e),this.preQueueTimeByCorrelationId.delete(e)}addPerformanceCallback(e){const t=this.generateId();return this.callbacks.set(t,e),this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${t}`),t}removePerformanceCallback(e){const t=this.callbacks.delete(e);return t?this.logger.verbose(`PerformanceClient: Performance callback ${e} removed.`):this.logger.verbose(`PerformanceClient: Performance callback ${e} not removed.`),t}emitEvents(e,t){this.logger.verbose("PerformanceClient: Emitting performance events",t),this.callbacks.forEach(((r,o)=>{this.logger.trace(`PerformanceClient: Emitting event to callback ${o}`,t),r.apply(null,[e])}))}truncateIntegralFields(e,t){t.forEach((t=>{t in e&&"number"==typeof e[t]&&(e[t]=Math.floor(e[t]))}))}}
|
|
74
|
+
/*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */class ot{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class nt extends rt{generateId(){return"callback-id"}startPerformanceMeasurement(){return new ot}calculateQueuedTime(e,t){return 0}addQueueMeasurement(e,t,r){}setPreQueueTime(e,t){}}const it={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. For more visit: aka.ms/msaljs/browser-errors."},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. For more visit: aka.ms/msaljs/browser-errors."},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. For more visit: aka.ms/msaljs/browser-errors."},monitorIframeTimeoutError:{code:"monitor_window_timeout",desc:"Token acquisition in iframe failed due to timeout. For more visit: aka.ms/msaljs/browser-errors."},redirectInIframeError:{code:"redirect_in_iframe",desc:"Redirects are not supported for iframed or brokered applications. 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."},silentLogoutUnsupportedError:{code:"silent_logout_unsupported",desc:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead."},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' or 'no_session'."},noTokenRequestCacheError:{code:"no_token_request_cache_error",desc:"No token request 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."},unableToLoadTokenError:{code:"unable_to_load_token",desc:"Error loading token to cache."},signingKeyNotFoundInStorage:{code:"crypto_key_not_found",desc:"Cryptographic Key or Keypair not found in browser storage."},authCodeRequired:{code:"auth_code_required",desc:"An authorization code must be provided (as the `code` property on the request) to this flow."},authCodeOrNativeAccountRequired:{code:"auth_code_or_nativeAccountId_required",desc:"An authorization code or nativeAccountId must be provided to this flow."},spaCodeAndNativeAccountPresent:{code:"spa_code_and_nativeAccountId_present",desc:"Request cannot contain both spa code and native account id."},databaseUnavailable:{code:"database_unavailable",desc:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."},unableToAcquireTokenFromNativePlatform:{code:"unable_to_acquire_token_from_native_platform",desc:"Unable to acquire token from native platform. For a list of possible reasons visit aka.ms/msaljs/browser-errors."},nativeHandshakeTimeout:{code:"native_handshake_timeout",desc:"Timed out while attempting to establish connection to browser extension"},nativeExtensionNotInstalled:{code:"native_extension_not_installed",desc:"Native extension is not installed. If you think this is a mistake call the initialize function."},nativeConnectionNotEstablished:{code:"native_connection_not_established",desc:"Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). For more please visit aka.ms/msaljs/browser-errors."},nativeBrokerCalledBeforeInitialize:{code:"native_broker_called_before_initialize",desc:"You must call and await the initialize function before attempting to call any other MSAL API when native brokering is enabled. For more please visit aka.ms/msaljs/browser-errors."},nativePromptNotSupported:{code:"native_prompt_not_supported",desc:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow."}};class st extends D{constructor(e,t){super(e,t),Object.setPrototypeOf(this,st.prototype),this.name="BrowserAuthError"}static createPkceNotGeneratedError(e){return new st(it.pkceNotGenerated.code,`${it.pkceNotGenerated.desc} Detail:${e}`)}static createCryptoNotAvailableError(e){return new st(it.cryptoDoesNotExist.code,`${it.cryptoDoesNotExist.desc} Detail:${e}`)}static createHttpMethodNotImplementedError(e){return new st(it.httpMethodNotImplementedError.code,`${it.httpMethodNotImplementedError.desc} Given Method: ${e}`)}static createEmptyNavigationUriError(){return new st(it.emptyNavigateUriError.code,it.emptyNavigateUriError.desc)}static createEmptyHashError(){return new st(it.hashEmptyError.code,`${it.hashEmptyError.desc}`)}static createHashDoesNotContainStateError(){return new st(it.hashDoesNotContainStateError.code,it.hashDoesNotContainStateError.desc)}static createHashDoesNotContainKnownPropertiesError(){return new st(it.hashDoesNotContainKnownPropertiesError.code,it.hashDoesNotContainKnownPropertiesError.desc)}static createUnableToParseStateError(){return new st(it.unableToParseStateError.code,it.unableToParseStateError.desc)}static createStateInteractionTypeMismatchError(){return new st(it.stateInteractionTypeMismatchError.code,it.stateInteractionTypeMismatchError.desc)}static createInteractionInProgressError(){return new st(it.interactionInProgress.code,it.interactionInProgress.desc)}static createPopupWindowError(e){let t=it.popupWindowError.desc;return t=B.isEmpty(e)?t:`${t} Details: ${e}`,new st(it.popupWindowError.code,t)}static createEmptyWindowCreatedError(){return new st(it.emptyWindowError.code,it.emptyWindowError.desc)}static createUserCancelledError(){return new st(it.userCancelledError.code,it.userCancelledError.desc)}static createMonitorPopupTimeoutError(){return new st(it.monitorPopupTimeoutError.code,it.monitorPopupTimeoutError.desc)}static createMonitorIframeTimeoutError(){return new st(it.monitorIframeTimeoutError.code,it.monitorIframeTimeoutError.desc)}static createRedirectInIframeError(e){return new st(it.redirectInIframeError.code,`${it.redirectInIframeError.desc} (window.parent !== window) => ${e}`)}static createBlockReloadInHiddenIframeError(){return new st(it.blockTokenRequestsInHiddenIframeError.code,it.blockTokenRequestsInHiddenIframeError.desc)}static createBlockAcquireTokenInPopupsError(){return new st(it.blockAcquireTokenInPopupsError.code,it.blockAcquireTokenInPopupsError.desc)}static createIframeClosedPrematurelyError(){return new st(it.iframeClosedPrematurelyError.code,it.iframeClosedPrematurelyError.desc)}static createSilentLogoutUnsupportedError(){return new st(it.silentLogoutUnsupportedError.code,it.silentLogoutUnsupportedError.desc)}static createNoAccountError(){return new st(it.noAccountError.code,it.noAccountError.desc)}static createSilentPromptValueError(e){return new st(it.silentPromptValueError.code,`${it.silentPromptValueError.desc} Given value: ${e}`)}static createUnableToParseTokenRequestCacheError(){return new st(it.unableToParseTokenRequestCacheError.code,it.unableToParseTokenRequestCacheError.desc)}static createNoTokenRequestCacheError(){return new st(it.noTokenRequestCacheError.code,it.noTokenRequestCacheError.desc)}static createAuthRequestNotSetError(){return new st(it.authRequestNotSet.code,it.authRequestNotSet.desc)}static createNoCachedAuthorityError(){return new st(it.noCachedAuthorityError.code,it.noCachedAuthorityError.desc)}static createInvalidCacheTypeError(){return new st(it.invalidCacheType.code,`${it.invalidCacheType.desc}`)}static createNonBrowserEnvironmentError(){return new st(it.notInBrowserEnvironment.code,it.notInBrowserEnvironment.desc)}static createDatabaseNotOpenError(){return new st(it.databaseNotOpen.code,it.databaseNotOpen.desc)}static createNoNetworkConnectivityError(){return new st(it.noNetworkConnectivity.code,it.noNetworkConnectivity.desc)}static createPostRequestFailedError(e,t){return new st(it.postRequestFailed.code,`${it.postRequestFailed.desc} | Network client threw: ${e} | Attempted to reach: ${t.split("?")[0]}`)}static createGetRequestFailedError(e,t){return new st(it.getRequestFailed.code,`${it.getRequestFailed.desc} | Network client threw: ${e} | Attempted to reach: ${t.split("?")[0]}`)}static createFailedToParseNetworkResponseError(e){return new st(it.failedToParseNetworkResponse.code,`${it.failedToParseNetworkResponse.desc} | Attempted to reach: ${e.split("?")[0]}`)}static createUnableToLoadTokenError(e){return new st(it.unableToLoadTokenError.code,`${it.unableToLoadTokenError.desc} | ${e}`)}static createSigningKeyNotFoundInStorageError(e){return new st(it.signingKeyNotFoundInStorage.code,`${it.signingKeyNotFoundInStorage.desc} | No match found for KeyId: ${e}`)}static createAuthCodeRequiredError(){return new st(it.authCodeRequired.code,it.authCodeRequired.desc)}static createAuthCodeOrNativeAccountIdRequiredError(){return new st(it.authCodeOrNativeAccountRequired.code,it.authCodeOrNativeAccountRequired.desc)}static createSpaCodeAndNativeAccountIdPresentError(){return new st(it.spaCodeAndNativeAccountPresent.code,it.spaCodeAndNativeAccountPresent.desc)}static createDatabaseUnavailableError(){return new st(it.databaseUnavailable.code,it.databaseUnavailable.desc)}static createUnableToAcquireTokenFromNativePlatformError(){return new st(it.unableToAcquireTokenFromNativePlatform.code,it.unableToAcquireTokenFromNativePlatform.desc)}static createNativeHandshakeTimeoutError(){return new st(it.nativeHandshakeTimeout.code,it.nativeHandshakeTimeout.desc)}static createNativeExtensionNotInstalledError(){return new st(it.nativeExtensionNotInstalled.code,it.nativeExtensionNotInstalled.desc)}static createNativeConnectionNotEstablishedError(){return new st(it.nativeConnectionNotEstablished.code,it.nativeConnectionNotEstablished.desc)}static createNativeBrokerCalledBeforeInitialize(){return new st(it.nativeBrokerCalledBeforeInitialize.code,it.nativeBrokerCalledBeforeInitialize.desc)}static createNativePromptParameterNotSupportedError(){return new st(it.nativePromptNotSupported.code,it.nativePromptNotSupported.desc)}}const at={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ct="53ee284d-920a-4b59-9d30-a60315b26836",dt="ppnbnpeolgkicgegkbkbjmhlideopiji",lt="MATS";var ht,ut,pt,gt,mt,ft,Ct,yt,Et;!function(e){e.HandshakeRequest="Handshake",e.HandshakeResponse="HandshakeResponse",e.GetToken="GetToken",e.Response="Response"}(ht||(ht={})),e.BrowserCacheLocation=void 0,(ut=e.BrowserCacheLocation||(e.BrowserCacheLocation={})).LocalStorage="localStorage",ut.SessionStorage="sessionStorage",ut.MemoryStorage="memoryStorage",function(e){e.GET="GET",e.POST="POST"}(pt||(pt={})),function(e){e.AUTHORITY="authority",e.ACQUIRE_TOKEN_ACCOUNT="acquireToken.account",e.SESSION_STATE="session.state",e.REQUEST_STATE="request.state",e.NONCE_IDTOKEN="nonce.id_token",e.ORIGIN_URI="request.origin",e.RENEW_STATUS="token.renew.status",e.URL_HASH="urlHash",e.REQUEST_PARAMS="request.params",e.SCOPES="scopes",e.INTERACTION_STATUS_KEY="interaction.status",e.CCS_CREDENTIAL="ccs.credential",e.CORRELATION_ID="request.correlationId",e.NATIVE_REQUEST="request.native",e.REDIRECT_CONTEXT="request.redirect.context"}(gt||(gt={})),function(e){e.ACCOUNT_KEYS="msal.account.keys",e.TOKEN_KEYS="msal.token.keys"}(mt||(mt={})),function(e){e.WRAPPER_SKU="wrapper.sku",e.WRAPPER_VER="wrapper.version"}(ft||(ft={})),e.ApiId=void 0,(Ct=e.ApiId||(e.ApiId={}))[Ct.acquireTokenRedirect=861]="acquireTokenRedirect",Ct[Ct.acquireTokenPopup=862]="acquireTokenPopup",Ct[Ct.ssoSilent=863]="ssoSilent",Ct[Ct.acquireTokenSilent_authCode=864]="acquireTokenSilent_authCode",Ct[Ct.handleRedirectPromise=865]="handleRedirectPromise",Ct[Ct.acquireTokenByCode=866]="acquireTokenByCode",Ct[Ct.acquireTokenSilent_silentFlow=61]="acquireTokenSilent_silentFlow",Ct[Ct.logout=961]="logout",Ct[Ct.logoutPopup=962]="logoutPopup",e.InteractionType=void 0,(yt=e.InteractionType||(e.InteractionType={})).Redirect="redirect",yt.Popup="popup",yt.Silent="silent",yt.None="none",e.InteractionStatus=void 0,(Et=e.InteractionStatus||(e.InteractionStatus={})).Startup="startup",Et.Login="login",Et.Logout="logout",Et.AcquireToken="acquireToken",Et.SsoSilent="ssoSilent",Et.HandleRedirect="handleRedirect",Et.None="none";const Tt={scopes:r},vt="jwk";var It;e.WrapperSKU=void 0,(It=e.WrapperSKU||(e.WrapperSKU={})).React="@azure/msal-react",It.Angular="@azure/msal-angular";const _t="msal.db",wt=`${_t}.keys`;var St;e.CacheLookupPolicy=void 0,(St=e.CacheLookupPolicy||(e.CacheLookupPolicy={}))[St.Default=0]="Default",St[St.AccessToken=1]="AccessToken",St[St.AccessTokenAndRefreshToken=2]="AccessTokenAndRefreshToken",St[St.RefreshToken=3]="RefreshToken",St[St.RefreshTokenAndNetwork=4]="RefreshTokenAndNetwork",St[St.Skip=5]="Skip";const At={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."},entropyNotProvided:{code:"entropy_not_provided",desc:"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option."}};class kt extends D{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,kt.prototype)}static createRedirectUriEmptyError(){return new kt(At.redirectUriNotSet.code,At.redirectUriNotSet.desc)}static createPostLogoutRedirectUriEmptyError(){return new kt(At.postLogoutUriNotSet.code,At.postLogoutUriNotSet.desc)}static createStorageNotSupportedError(e){return new kt(At.storageNotSupportedError.code,`${At.storageNotSupportedError.desc} Given Location: ${e}`)}static createRedirectCallbacksNotSetError(){return new kt(At.noRedirectCallbacksSet.code,At.noRedirectCallbacksSet.desc)}static createStubPcaInstanceCalledError(){return new kt(At.stubPcaInstanceCalled.code,At.stubPcaInstanceCalled.desc)}static createInMemoryRedirectUnavailableError(){return new kt(At.inMemRedirectUnavailable.code,At.inMemRedirectUnavailable.desc)}static createEntropyNotProvided(){return new kt(At.entropyNotProvided.code,At.entropyNotProvided.desc)}}class Rt{constructor(e){this.validateWindowStorage(e),this.windowStorage=window[e]}validateWindowStorage(t){if(t!==e.BrowserCacheLocation.LocalStorage&&t!==e.BrowserCacheLocation.SessionStorage)throw kt.createStorageNotSupportedError(t);if(!!!window[t])throw kt.createStorageNotSupportedError(t)}getItem(e){return this.windowStorage.getItem(e)}setItem(e,t){this.windowStorage.setItem(e,t)}removeItem(e){this.windowStorage.removeItem(e)}getKeys(){return Object.keys(this.windowStorage)}containsKey(e){return this.windowStorage.hasOwnProperty(e)}}class bt{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach(((t,r)=>{e.push(r)})),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}class Pt{static extractBrowserRequestState(e,t){if(B.isEmpty(t))return null;try{return Re.parseRequestState(e,t).libraryState.meta}catch(e){throw x.createInvalidStateError(t,e)}}static parseServerResponseFromHash(e){if(!e)return{};const t=new be(e);return be.getDeserializedHash(t.getHash())}}class Nt extends re{constructor(e,t,r,o){super(e,r,o),this.COOKIE_LIFE_MULTIPLIER=864e5,this.cacheConfig=t,this.logger=o,this.internalStorage=new bt,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupTemporaryCacheStorage(this.cacheConfig.temporaryCacheLocation,this.cacheConfig.cacheLocation),t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps())}setupBrowserStorage(t){switch(t){case e.BrowserCacheLocation.LocalStorage:case e.BrowserCacheLocation.SessionStorage:try{return new Rt(t)}catch(e){this.logger.verbose(e);break}case e.BrowserCacheLocation.MemoryStorage:}return this.cacheConfig.cacheLocation=e.BrowserCacheLocation.MemoryStorage,new bt}setupTemporaryCacheStorage(t,r){switch(r){case e.BrowserCacheLocation.LocalStorage:case e.BrowserCacheLocation.SessionStorage:try{return new Rt(t||e.BrowserCacheLocation.SessionStorage)}catch(e){return this.logger.verbose(e),this.internalStorage}case e.BrowserCacheLocation.MemoryStorage:default:return this.internalStorage}}migrateCacheEntries(){const e=`${t.CACHE_PREFIX}.${i.ID_TOKEN}`,r=`${t.CACHE_PREFIX}.${i.CLIENT_INFO}`,o=`${t.CACHE_PREFIX}.${i.ERROR}`,n=`${t.CACHE_PREFIX}.${i.ERROR_DESC}`,s=[this.browserStorage.getItem(e),this.browserStorage.getItem(r),this.browserStorage.getItem(o),this.browserStorage.getItem(n)];[i.ID_TOKEN,i.CLIENT_INFO,i.ERROR,i.ERROR_DESC].forEach(((e,t)=>this.migrateCacheEntry(e,s[t])))}migrateCacheEntry(e,t){t&&this.setTemporaryCache(e,t,!0)}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(mt.ACCOUNT_KEYS),t=this.getItem(`${mt.TOKEN_KEYS}.${this.clientId}`);if(e&&t)return void this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");this.browserStorage.getKeys().forEach((e=>{if(this.isCredentialKey(e)){const t=this.getItem(e);if(t){const r=this.validateAndParseJson(t);if(r&&r.hasOwnProperty("credentialType"))switch(r.credentialType){case f.ID_TOKEN:if(Ee.isIdTokenEntity(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${e} found, saving key to token key map`);const t=re.toObject(new Ee,r),o=this.updateCredentialCacheKey(e,t);return void this.addTokenKey(o,f.ID_TOKEN)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${e}`);break;case f.ACCESS_TOKEN:case f.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(ve.isAccessTokenEntity(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${e} found, saving key to token key map`);const t=re.toObject(new ve,r),o=this.updateCredentialCacheKey(e,t);return void this.addTokenKey(o,f.ACCESS_TOKEN)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${e}`);break;case f.REFRESH_TOKEN:if(Ie.isRefreshTokenEntity(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${e} found, saving key to token key map`);const t=re.toObject(new Ie,r),o=this.updateCredentialCacheKey(e,t);return void this.addTokenKey(o,f.REFRESH_TOKEN)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${e}`)}}}if(this.isAccountKey(e)){const t=this.getItem(e);if(t){const r=this.validateAndParseJson(t);r&&ee.isAccountEntity(r)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${e} found, saving key to account key map`),this.addAccountKeyToMap(e))}}}))}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e){this.logger.trace("BrowserCacheManager.getAccount called");const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return r&&ee.isAccountEntity(r)?re.toObject(new ee,r):(this.removeAccountKeyFromMap(e),null)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(mt.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();-1===t.indexOf(e)?(t.push(e),this.setItem(mt.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(mt.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,f.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,f.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,f.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${mt.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case f.ID_TOKEN:-1===r.idToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case f.ACCESS_TOKEN:-1===r.accessToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case f.REFRESH_TOKEN:-1===r.refreshToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),x.createUnexpectedCredentialTypeError()}this.setItem(`${mt.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case f.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case f.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const n=r.accessToken.indexOf(e);n>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(n,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case f.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const i=r.refreshToken.indexOf(e);i>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(i,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),x.createUnexpectedCredentialTypeError()}this.setItem(`${mt.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,f.ID_TOKEN),null;const r=this.validateAndParseJson(t);return r&&Ee.isIdTokenEntity(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),re.toObject(new Ee,r)):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,f.ID_TOKEN),null)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,f.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,f.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return r&&ve.isAccessTokenEntity(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),re.toObject(new ve,r)):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,f.ACCESS_TOKEN),null)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,f.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,f.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return r&&Ie.isRefreshTokenEntity(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),re.toObject(new Ie,r)):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,f.REFRESH_TOKEN),null)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=e.generateCredentialKey();this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,f.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&Ue.isAppMetadataEntity(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),re.toObject(new Ue,r)):(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=e.generateAppMetadataKey();this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&je.isServerTelemetryEntity(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),re.toObject(new je,r)):(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&$e.isAuthorityMetadataEntity(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),re.toObject(new $e,r)):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter((e=>this.isAuthorityMetadata(e)))}setWrapperMetadata(e,t){this.internalStorage.setItem(ft.WRAPPER_SKU,e),this.internalStorage.setItem(ft.WRAPPER_VER,t)}getWrapperMetadata(){return[this.internalStorage.getItem(ft.WRAPPER_SKU)||t.EMPTY_STRING,this.internalStorage.getItem(ft.WRAPPER_VER)||t.EMPTY_STRING]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(i.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const e=this.generateCacheKey(i.ACTIVE_ACCOUNT),t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const r=this.getAccountInfoByFilter({localAccountId:t})[0]||null;return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(r),r):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoByFilter({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId})[0]||null):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(i.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(i.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getAccountInfoByFilter(e){const t=this.getAllAccounts();return this.logger.trace(`BrowserCacheManager.getAccountInfoByFilter: total ${t.length} accounts found`),t.filter((t=>(!e.username||e.username.toLowerCase()===t.username.toLowerCase())&&((!e.homeAccountId||e.homeAccountId===t.homeAccountId)&&((!e.localAccountId||e.localAccountId===t.localAccountId)&&((!e.tenantId||e.tenantId===t.tenantId)&&(!e.environment||e.environment===t.environment))))))}getAccountInfoByHints(e,t){const r=this.getAllAccounts().filter((r=>{if(t){const e=r.idTokenClaims&&r.idTokenClaims.sid;return t===e}return!!e&&e===r.username}));if(1===r.length)return r[0];if(r.length>1)throw x.createMultipleMatchingAccountsInCacheError();return null}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&We.isThrottlingEntity(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),re.toObject(new We,r)):(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(t,r){const o=r?this.generateCacheKey(t):t;if(this.cacheConfig.storeAuthStateInCookie){const e=this.getItemCookie(o);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),e}const n=this.temporaryCacheStorage.getItem(o);if(!n){if(this.cacheConfig.cacheLocation===e.BrowserCacheLocation.LocalStorage){const e=this.browserStorage.getItem(o);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),e}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),n}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.setItemCookie(o,t))}removeItem(e){this.browserStorage.removeItem(e),this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.clearItemCookie(e))}containsKey(e){return this.browserStorage.containsKey(e)||this.temporaryCacheStorage.containsKey(e)}getKeys(){return[...this.browserStorage.getKeys(),...this.temporaryCacheStorage.getKeys()]}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.getKeys().forEach((e=>{!this.browserStorage.containsKey(e)&&!this.temporaryCacheStorage.containsKey(e)||-1===e.indexOf(t.CACHE_PREFIX)&&-1===e.indexOf(this.clientId)||this.removeItem(e)})),this.internalStorage.clear()}setItemCookie(e,t,r){let o=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){o+=`expires=${this.getCookieExpirationTime(r)};`}this.cacheConfig.secureCookies&&(o+="Secure;"),document.cookie=o}getItemCookie(e){const r=`${encodeURIComponent(e)}=`,o=document.cookie.split(";");for(let e=0;e<o.length;e++){let t=o[e];for(;" "===t.charAt(0);)t=t.substring(1);if(0===t.indexOf(r))return decodeURIComponent(t.substring(r.length,t.length))}return t.EMPTY_STRING}clearMsalCookies(){const e=`${t.CACHE_PREFIX}.${this.clientId}`;document.cookie.split(";").forEach((t=>{for(;" "===t.charAt(0);)t=t.substring(1);if(0===t.indexOf(e)){const e=t.split("=")[0];this.clearItemCookie(e)}}))}clearItemCookie(e){this.setItemCookie(e,t.EMPTY_STRING,-1)}getCookieExpirationTime(e){const t=new Date;return new Date(t.getTime()+e*this.COOKIE_LIFE_MULTIPLIER).toUTCString()}getCache(){return this.browserStorage}setCache(){}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):B.startsWith(e,t.CACHE_PREFIX)||B.startsWith(e,i.ADAL_ID_TOKEN)?e:`${t.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=Re.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${gt.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=Re.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${gt.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=Re.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${gt.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,n){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const i=this.generateStateKey(e);this.setTemporaryCache(i,e,!1);const s=this.generateNonceKey(e);this.setTemporaryCache(s,t,!1);const a=this.generateAuthorityKey(e);if(this.setTemporaryCache(a,r,!1),n){const e={credential:n.homeAccountId,type:ge.HOME_ACCOUNT_ID};this.setTemporaryCache(gt.CCS_CREDENTIAL,JSON.stringify(e),!0)}else if(!B.isEmpty(o)){const e={credential:o,type:ge.UPN};this.setTemporaryCache(gt.CCS_CREDENTIAL,JSON.stringify(e),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),B.isEmpty(e)||this.getKeys().forEach((t=>{-1!==t.indexOf(e)&&this.removeItem(t)})),e&&(this.removeItem(this.generateStateKey(e)),this.removeItem(this.generateNonceKey(e)),this.removeItem(this.generateAuthorityKey(e))),this.removeItem(this.generateCacheKey(gt.REQUEST_PARAMS)),this.removeItem(this.generateCacheKey(gt.ORIGIN_URI)),this.removeItem(this.generateCacheKey(gt.URL_HASH)),this.removeItem(this.generateCacheKey(gt.CORRELATION_ID)),this.removeItem(this.generateCacheKey(gt.CCS_CREDENTIAL)),this.removeItem(this.generateCacheKey(gt.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const r=this.generateStateKey(e),o=this.temporaryCacheStorage.getItem(r);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${o}`),this.resetRequestCache(o||t.EMPTY_STRING)}this.clearMsalCookies()}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.getKeys().forEach((t=>{if(-1===t.indexOf(gt.REQUEST_STATE))return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=Pt.extractBrowserRequestState(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))})),this.clearMsalCookies(),this.setInteractionInProgress(!1)}cacheCodeRequest(e,t){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const r=t.base64Encode(JSON.stringify(e));this.setTemporaryCache(gt.REQUEST_PARAMS,r,!0)}getCachedRequest(e,t){this.logger.trace("BrowserCacheManager.getCachedRequest called");const r=this.getTemporaryCache(gt.REQUEST_PARAMS,!0);if(!r)throw st.createNoTokenRequestCacheError();const o=this.validateAndParseJson(t.base64Decode(r));if(!o)throw st.createUnableToParseTokenRequestCacheError();if(this.removeItem(this.generateCacheKey(gt.REQUEST_PARAMS)),B.isEmpty(o.authority)){const t=this.generateAuthorityKey(e),r=this.getTemporaryCache(t);if(!r)throw st.createNoCachedAuthorityError();o.authority=r}return o}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(gt.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${t.CACHE_PREFIX}.${gt.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const r=`${t.CACHE_PREFIX}.${gt.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw st.createInteractionInProgressError();this.setTemporaryCache(r,this.clientId,!1)}else e||this.getInteractionInProgress()!==this.clientId||this.removeItem(r)}getLegacyLoginHint(){const e=this.getTemporaryCache(i.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(i.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(i.ID_TOKEN,!0);t&&(this.removeItem(this.generateCacheKey(i.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const e=new te(r,this.cryptoImpl);if(e.claims&&e.claims.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),e.claims.preferred_username;if(e.claims&&e.claims.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),e.claims.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=t.generateCredentialKey();if(e!==r){const o=this.getItem(e);if(o)return this.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}getRedirectRequestContext(){return this.getTemporaryCache(gt.REDIRECT_CONTEXT,!0)}setRedirectRequestContext(e){this.setTemporaryCache(gt.REDIRECT_CONTEXT,e,!0)}}const Mt="@azure/msal-browser",Ot="3.0.0-alpha.2";class qt{async sendGetRequestAsync(e,t){let r;try{r=await fetch(e,{method:pt.GET,headers:this.getFetchHeaders(t)})}catch(t){throw window.navigator.onLine?st.createGetRequestFailedError(t,e):st.createNoNetworkConnectivityError()}try{return{headers:this.getHeaderDict(r.headers),body:await r.json(),status:r.status}}catch(t){throw st.createFailedToParseNetworkResponseError(e)}}async sendPostRequestAsync(e,r){const o=r&&r.body||t.EMPTY_STRING;let n;try{n=await fetch(e,{method:pt.POST,headers:this.getFetchHeaders(r),body:o})}catch(t){throw window.navigator.onLine?st.createPostRequestFailedError(t,e):st.createNoNetworkConnectivityError()}try{return{headers:this.getHeaderDict(n.headers),body:await n.json(),status:n.status}}catch(t){throw st.createFailedToParseNetworkResponseError(e)}}getFetchHeaders(e){const t=new Headers;if(!e||!e.headers)return t;const r=e.headers;return Object.keys(r).forEach((e=>{t.append(e,r[e])})),t}getHeaderDict(e){const t={};return e.forEach(((e,r)=>{t[r]=e})),t}}class Ut{async sendGetRequestAsync(e,t){return this.sendRequestAsync(e,pt.GET,t)}async sendPostRequestAsync(e,t){return this.sendRequestAsync(e,pt.POST,t)}sendRequestAsync(e,t,r){return new Promise(((o,n)=>{const i=new XMLHttpRequest;if(i.open(t,e,!0),this.setXhrHeaders(i,r),i.onload=()=>{(i.status<200||i.status>=300)&&(t===pt.POST?n(st.createPostRequestFailedError(`Failed with status ${i.status}`,e)):n(st.createGetRequestFailedError(`Failed with status ${i.status}`,e)));try{const e=JSON.parse(i.responseText),t={headers:this.getHeaderDict(i),body:e,status:i.status};o(t)}catch(t){n(st.createFailedToParseNetworkResponseError(e))}},i.onerror=()=>{window.navigator.onLine?t===pt.POST?n(st.createPostRequestFailedError(`Failed with status ${i.status}`,e)):n(st.createGetRequestFailedError(`Failed with status ${i.status}`,e)):n(st.createNoNetworkConnectivityError())},t===pt.POST&&r&&r.body)i.send(r.body);else{if(t!==pt.GET)throw st.createHttpMethodNotImplementedError(t);i.send()}}))}setXhrHeaders(e,t){if(t&&t.headers){const r=t.headers;Object.keys(r).forEach((t=>{e.setRequestHeader(t,r[t])}))}}getHeaderDict(e){const t=e.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};return t.forEach((e=>{const t=e.split(": "),o=t.shift(),n=t.join(": ");o&&n&&(r[o]=n)})),r}}class Lt{static clearHash(e){e.location.hash=t.EMPTY_STRING,"function"==typeof e.history.replaceState&&e.history.replaceState(null,t.EMPTY_STRING,`${e.location.origin}${e.location.pathname}${e.location.search}`)}static replaceHash(e){const r=e.split("#");r.shift(),window.location.hash=r.length>0?r.join("#"):t.EMPTY_STRING}static isInIframe(){return window.parent!==window}static isInPopup(){return"undefined"!=typeof window&&!!window.opener&&window.opener!==window&&"string"==typeof window.name&&0===window.name.indexOf(`${at.POPUP_NAME_PREFIX}.`)}static getCurrentUri(){return window.location.href.split("?")[0].split("#")[0]}static getHomepage(){const e=new be(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}static getBrowserNetworkClient(){return window.fetch&&window.Headers?new qt:new Ut}static blockReloadInHiddenIframes(){if(be.hashContainsKnownProperties(window.location.hash)&&Lt.isInIframe())throw st.createBlockReloadInHiddenIframeError()}static blockRedirectInIframe(t,r){const o=Lt.isInIframe();if(t===e.InteractionType.Redirect&&o&&!r)throw st.createRedirectInIframeError(o)}static blockAcquireTokenInPopups(){if(Lt.isInPopup())throw st.createBlockAcquireTokenInPopupsError()}static blockNonBrowserEnvironment(e){if(!e)throw st.createNonBrowserEnvironmentError()}static blockNativeBrokerCalledBeforeInitialized(e,t){if(e&&!t)throw st.createNativeBrokerCalledBeforeInitialize()}static detectIEOrEdge(){const e=window.navigator.userAgent,t=e.indexOf("MSIE "),r=e.indexOf("Trident/"),o=e.indexOf("Edge/");return t>0||r>0||o>0}}class Ht{constructor(e,t,r,o,n,i,s,a,c){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=n,this.navigationClient=i,this.nativeMessageHandler=a,this.correlationId=c||this.browserCrypto.createNewGuid(),this.logger=o.clone(at.MSAL_SKU,Ot,this.correlationId),this.performanceClient=s}async clearCacheOnLogout(e){if(e){ee.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(ee.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch(e){this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch(e){this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}async initializeBaseRequest(t){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.InitializeBaseRequest,t.correlationId),this.logger.verbose("Initializing BaseAuthRequest");const r=t.authority||this.config.auth.authority,o=[...t&&t.scopes||[]],n={...t,correlationId:this.correlationId,authority:r,scopes:o};if(n.authenticationScheme){if(n.authenticationScheme===e.AuthenticationScheme.SSH){if(!t.sshJwk)throw W.createMissingSshJwkError();if(!t.sshKid)throw W.createMissingSshKidError()}this.logger.verbose(`Authentication Scheme set to "${n.authenticationScheme}" as configured in Auth request`)}else n.authenticationScheme=e.AuthenticationScheme.BEARER,this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');return t.claims&&!B.isEmpty(t.claims)&&(n.requestedClaimsHash=await this.browserCrypto.hashString(t.claims)),n}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri||Lt.getCurrentUri();return be.getAbsoluteUrl(t,Lt.getCurrentUri())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new tt(r,this.browserStorage)}async getDiscoveredAuthority(e){this.logger.verbose("getDiscoveredAuthority called");const t={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata};return e?(this.logger.verbose("Creating discovered authority with request authority"),await Ye.createDiscoveredInstance(e,this.config.system.networkClient,this.browserStorage,t,this.logger)):(this.logger.verbose("Creating discovered authority with configured authority"),await Ye.createDiscoveredInstance(this.config.auth.authority,this.config.system.networkClient,this.browserStorage,t,this.logger))}}class Dt extends Ht{async initializeAuthorizationCodeRequest(r){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,r.correlationId),this.logger.verbose("initializeAuthorizationRequest called",r.correlationId);const o=await this.browserCrypto.generatePkceCodes(),n={...r,redirectUri:r.redirectUri,code:t.EMPTY_STRING,codeVerifier:o.verifier};return r.codeChallenge=o.challenge,r.codeChallengeMethod=t.S256_CODE_CHALLENGE_METHOD,n}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e?.correlationId);const t={correlationId:this.correlationId||this.browserCrypto.createNewGuid(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return e&&null===e.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId):e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=be.getAbsoluteUrl(e.postLogoutRedirectUri,Lt.getCurrentUri())):null===this.config.auth.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=be.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Lt.getCurrentUri())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=be.getAbsoluteUrl(Lt.getCurrentUri(),Lt.getCurrentUri())),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(t,r,o){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,this.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientGetClientConfiguration,this.correlationId);const n=await this.getClientConfiguration(t,r,o);return new De(n,this.performanceClient)}async getClientConfiguration(r,o,n){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.StandardInteractionClientGetClientConfiguration,this.correlationId),this.logger.verbose("getClientConfiguration called",this.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i=await this.getDiscoveredAuthority(o,n),s=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:i,clientCapabilities:this.config.auth.clientCapabilities},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:s.loggerCallback,piiLoggingEnabled:s.piiLoggingEnabled,logLevel:s.logLevel,correlationId:this.correlationId},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:r,libraryInfo:{sku:at.MSAL_SKU,version:Ot,cpu:t.EMPTY_STRING,os:t.EMPTY_STRING},telemetry:this.config.telemetry}}validateAndExtractStateFromHash(e,t,r){if(this.logger.verbose("validateAndExtractStateFromHash called",r),!e.state)throw st.createHashDoesNotContainStateError();const o=Pt.extractBrowserRequestState(this.browserCrypto,e.state);if(!o)throw st.createUnableToParseStateError();if(o.interactionType!==t)throw st.createStateInteractionTypeMismatchError();return this.logger.verbose("Returning state from hash",r),e.state}async getDiscoveredAuthority(t,r){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),this.logger.verbose("getDiscoveredAuthority called",this.correlationId);const o=this.performanceClient?.startMeasurement(e.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),n={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},i=t||this.config.auth.authority,s=Qe.generateAuthority(i,r||this.config.auth.azureCloudOptions);return this.logger.verbose("Creating discovered authority with configured authority",this.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,this.correlationId),await Ye.createDiscoveredInstance(s,this.config.system.networkClient,this.browserStorage,n,this.logger,this.performanceClient,this.correlationId).then((e=>(o.endMeasurement({success:!0}),e))).catch((e=>{throw o.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}))}async initializeAuthorizationRequest(r,o){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId),this.logger.verbose("initializeAuthorizationRequest called",this.correlationId);const n=this.getRedirectUri(r.redirectUri),i={interactionType:o},s=Re.setRequestState(this.browserCrypto,r&&r.state||t.EMPTY_STRING,i);this.performanceClient.setPreQueueTime(e.PerformanceEvents.InitializeBaseRequest,this.correlationId);const a={...await this.initializeBaseRequest(r),redirectUri:n,state:s,nonce:r.nonce||this.browserCrypto.createNewGuid(),responseMode:u.FRAGMENT},c=r.account||this.browserStorage.getActiveAccount();if(c&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${c.homeAccountId}`,this.correlationId),a.account=c),B.isEmpty(a.loginHint)&&!c){const e=this.browserStorage.getLegacyLoginHint();e&&(a.loginHint=e)}return a}}class Kt{constructor(e,t,r,o,n){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=n}async handleCodeResponseFromHash(t,r,o,n){if(this.performanceClient.addQueueMeasurement(e.PerformanceEvents.HandleCodeResponseFromHash,this.authCodeRequest.correlationId),this.logger.verbose("InteractionHandler.handleCodeResponse called"),B.isEmpty(t))throw st.createEmptyHashError();const i=this.browserStorage.generateStateKey(r),s=this.browserStorage.getTemporaryCache(i);if(!s)throw x.createStateNotFoundError("Cached State");let a;try{a=this.authModule.handleFragmentResponse(t,s)}catch(e){throw e instanceof he&&e.subError===it.userCancelledError.code?st.createUserCancelledError():e}return this.performanceClient.setPreQueueTime(e.PerformanceEvents.HandleCodeResponseFromServer,this.authCodeRequest.correlationId),this.handleCodeResponseFromServer(a,r,o,n)}async handleCodeResponseFromServer(t,r,o,n,i=!0){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.HandleCodeResponseFromServer,this.authCodeRequest.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called");const s=this.browserStorage.generateStateKey(r),a=this.browserStorage.getTemporaryCache(s);if(!a)throw x.createStateNotFoundError("Cached State");const c=this.browserStorage.generateNonceKey(a),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=t.code,t.cloud_instance_host_name&&(this.performanceClient.setPreQueueTime(e.PerformanceEvents.UpdateTokenEndpointAuthority,this.authCodeRequest.correlationId),await this.updateTokenEndpointAuthority(t.cloud_instance_host_name,o,n)),i&&(t.nonce=d||void 0),t.state=a,t.client_info)this.authCodeRequest.clientInfo=t.client_info;else{const e=this.checkCcsCredentials();e&&(this.authCodeRequest.ccsCredential=e)}this.performanceClient.setPreQueueTime(e.PerformanceEvents.AuthClientAcquireToken,this.authCodeRequest.correlationId);const l=await this.authModule.acquireToken(this.authCodeRequest,t);return this.browserStorage.cleanRequestByState(r),l}async updateTokenEndpointAuthority(t,r,o){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.UpdateTokenEndpointAuthority,this.authCodeRequest.correlationId);const n=`https://${t}/${r.tenant}/`,i=await Ye.createDiscoveredInstance(n,o,this.browserStorage,r.options,this.logger,this.performanceClient,this.authCodeRequest.correlationId);this.authModule.updateAuthority(i)}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(gt.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch(t){this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}class Ft extends Kt{constructor(e,t,r,o,n,i){super(e,t,r,o,i),this.browserCrypto=n}async initiateAuthRequest(t,r){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),B.isEmpty(t))throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),st.createEmptyNavigationUriError();{r.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(gt.ORIGIN_URI,r.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(gt.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest,this.browserCrypto),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${t}`);const o={apiId:e.ApiId.acquireTokenRedirect,timeout:r.redirectTimeout,noHistory:!1};if("function"==typeof r.onRedirectNavigate){this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback");return!1!==r.onRedirectNavigate(t)?(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),void await r.navigationClient.navigateExternal(t,o)):void this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation")}return this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),void await r.navigationClient.navigateExternal(t,o)}}async handleCodeResponseFromHash(e,t,r,o){if(this.logger.verbose("RedirectHandler.handleCodeResponse called"),B.isEmpty(e))throw st.createEmptyHashError();this.browserStorage.setInteractionInProgress(!1);const n=this.browserStorage.generateStateKey(t),i=this.browserStorage.getTemporaryCache(n);if(!i)throw x.createStateNotFoundError("Cached State");let s;try{s=this.authModule.handleFragmentResponse(e,i)}catch(e){throw e instanceof he&&e.subError===it.userCancelledError.code?st.createUserCancelledError():e}const a=this.browserStorage.generateNonceKey(i),c=this.browserStorage.getTemporaryCache(a);if(this.authCodeRequest.code=s.code,s.cloud_instance_host_name&&await this.updateTokenEndpointAuthority(s.cloud_instance_host_name,r,o),s.nonce=c||void 0,s.state=i,s.client_info)this.authCodeRequest.clientInfo=s.client_info;else{const e=this.checkCcsCredentials();e&&(this.authCodeRequest.ccsCredential=e)}const d=await this.authModule.acquireToken(this.authCodeRequest,s);return this.browserStorage.cleanRequestByState(t),d}}var xt,Bt;e.EventType=void 0,(xt=e.EventType||(e.EventType={})).INITIALIZE_START="msal:initializeStart",xt.INITIALIZE_END="msal:initializeEnd",xt.ACCOUNT_ADDED="msal:accountAdded",xt.ACCOUNT_REMOVED="msal:accountRemoved",xt.LOGIN_START="msal:loginStart",xt.LOGIN_SUCCESS="msal:loginSuccess",xt.LOGIN_FAILURE="msal:loginFailure",xt.ACQUIRE_TOKEN_START="msal:acquireTokenStart",xt.ACQUIRE_TOKEN_SUCCESS="msal:acquireTokenSuccess",xt.ACQUIRE_TOKEN_FAILURE="msal:acquireTokenFailure",xt.ACQUIRE_TOKEN_NETWORK_START="msal:acquireTokenFromNetworkStart",xt.SSO_SILENT_START="msal:ssoSilentStart",xt.SSO_SILENT_SUCCESS="msal:ssoSilentSuccess",xt.SSO_SILENT_FAILURE="msal:ssoSilentFailure",xt.ACQUIRE_TOKEN_BY_CODE_START="msal:acquireTokenByCodeStart",xt.ACQUIRE_TOKEN_BY_CODE_SUCCESS="msal:acquireTokenByCodeSuccess",xt.ACQUIRE_TOKEN_BY_CODE_FAILURE="msal:acquireTokenByCodeFailure",xt.HANDLE_REDIRECT_START="msal:handleRedirectStart",xt.HANDLE_REDIRECT_END="msal:handleRedirectEnd",xt.POPUP_OPENED="msal:popupOpened",xt.LOGOUT_START="msal:logoutStart",xt.LOGOUT_SUCCESS="msal:logoutSuccess",xt.LOGOUT_FAILURE="msal:logoutFailure",xt.LOGOUT_END="msal:logoutEnd",function(e){e.USER_INTERACTION_REQUIRED="USER_INTERACTION_REQUIRED",e.USER_CANCEL="USER_CANCEL",e.NO_NETWORK="NO_NETWORK",e.TRANSIENT_ERROR="TRANSIENT_ERROR",e.PERSISTENT_ERROR="PERSISTENT_ERROR",e.DISABLED="DISABLED",e.ACCOUNT_UNAVAILABLE="ACCOUNT_UNAVAILABLE"}(Bt||(Bt={}));const Gt={code:"ContentError"},$t={code:"user_switch",desc:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."},zt={code:"tokens_not_found_in_internal_memory_cache",desc:"Tokens not cached in MSAL JS internal memory, please make the WAM request"};class Qt extends D{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Qt.prototype),this.name="NativeAuthError",this.ext=r}isFatal(){return!(!this.ext||!this.ext.status||this.ext.status!==Bt.PERSISTENT_ERROR&&this.ext.status!==Bt.DISABLED)||this.errorCode===Gt.code}static createError(e,t,r){if(r&&r.status)switch(r.status){case Bt.ACCOUNT_UNAVAILABLE:return Ae.createNativeAccountUnavailableError();case Bt.USER_INTERACTION_REQUIRED:return new Ae(e,t);case Bt.USER_CANCEL:return st.createUserCancelledError();case Bt.NO_NETWORK:return st.createNoNetworkConnectivityError()}return new Qt(e,t,r)}static createUserSwitchError(){return new Qt($t.code,$t.desc)}static createTokensNotFoundInCacheError(){return new Qt(zt.code,zt.desc)}}class Yt extends Dt{async acquireToken(t){const r=this.performanceClient.startMeasurement(e.PerformanceEvents.SilentCacheClientAcquireToken,t.correlationId),o=this.initializeServerTelemetryManager(e.ApiId.acquireTokenSilent_silentFlow),n=await this.createSilentFlowClient(o,t.authority,t.azureCloudOptions);this.logger.verbose("Silent auth client created");try{const e=await n.acquireCachedToken(t);return r.endMeasurement({success:!0,fromCache:!0}),e}catch(e){throw e instanceof st&&e.errorCode===it.signingKeyNotFoundInStorage.code&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),r.endMeasurement({errorCode:e instanceof D&&e.errorCode||void 0,subErrorCode:e instanceof D&&e.subError||void 0,success:!1}),e}}logout(){return Promise.reject(st.createSilentLogoutUnsupportedError())}async createSilentFlowClient(t,r,o){this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientGetClientConfiguration,this.correlationId);const n=await this.getClientConfiguration(t,r,o);return new Fe(n,this.performanceClient)}async initializeSilentRequest(t,r){return this.performanceClient.addQueueMeasurement(e.PerformanceEvents.InitializeSilentRequest,this.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.InitializeBaseRequest,this.correlationId),{...t,...await this.initializeBaseRequest(t),account:r,forceRefresh:t.forceRefresh||!1}}}class jt extends Ht{constructor(e,t,r,o,n,i,s,a,c,d,l,h){super(e,t,r,o,n,i,a,c,h),this.apiId=s,this.accountId=d,this.nativeMessageHandler=c,this.nativeStorageManager=l,this.silentCacheClient=new Yt(e,this.nativeStorageManager,r,o,n,i,a,c,h)}async acquireToken(t){this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(e.PerformanceEvents.NativeInteractionClientAcquireToken,t.correlationId),o=Te.nowSeconds(),n=await this.initializeNativeRequest(t);try{const e=await this.acquireTokensFromCache(this.accountId,n);return r.endMeasurement({success:!0,isNativeBroker:!1,fromCache:!0}),e}catch(e){this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const i={method:ht.GetToken,request:n},s=await this.nativeMessageHandler.sendMessage(i),a=this.validateNativeResponse(s);return this.handleNativeResponse(a,n,o).then((e=>(r.endMeasurement({success:!0,isNativeBroker:!0,requestId:e.requestId}),e))).catch((e=>{throw r.endMeasurement({success:!1,errorCode:e.errorCode,subErrorCode:e.subError,isNativeBroker:!0}),e}))}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:V.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),x.createNoAccountFoundError();const r=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:e});if(!r)throw x.createNoAccountFoundError();try{const e=this.createSilentCacheRequest(t,r);return await this.silentCacheClient.acquireToken(e)}catch(e){throw e}}async acquireTokenRedirect(t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const r=await this.initializeNativeRequest(t),o={method:ht.GetToken,request:r};try{const e=await this.nativeMessageHandler.sendMessage(o);this.validateNativeResponse(e)}catch(e){if(e instanceof Qt&&e.isFatal())throw e}this.browserStorage.setTemporaryCache(gt.NATIVE_REQUEST,JSON.stringify(r),!0);const n={apiId:e.ApiId.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(t.redirectUri);await this.navigationClient.navigateExternal(i,n)}async handleRedirectPromise(){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const e=this.browserStorage.getCachedNativeRequest();if(!e)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),null;const{prompt:t,...r}=e;t&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(gt.NATIVE_REQUEST));const o={method:ht.GetToken,request:r},n=Te.nowSeconds();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const e=await this.nativeMessageHandler.sendMessage(o);this.validateNativeResponse(e);const t=this.handleNativeResponse(e,r,n);return this.browserStorage.setInteractionInProgress(!1),t}catch(e){throw this.browserStorage.setInteractionInProgress(!1),e}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){if(this.logger.trace("NativeInteractionClient - handleNativeResponse called."),e.account.id!==t.accountId)throw Qt.createUserSwitchError();const o=await this.getDiscoveredAuthority(t.authority),n=o.getPreferredCache(),i=this.createIdTokenObj(e),s=this.createHomeAccountIdentifier(e,i),a=this.createAccountEntity(e,s,i,n),c=await this.generateAuthenticationResult(e,t,i,a,o.canonicalAuthority,r);return this.cacheAccount(a),this.cacheNativeTokens(e,t,s,i,c.accessToken,c.tenantId,r),c}createIdTokenObj(e){return new te(e.id_token||t.EMPTY_STRING,this.browserCrypto)}createHomeAccountIdentifier(e,r){return ee.generateHomeAccountId(e.client_info||t.EMPTY_STRING,Z.Default,this.logger,this.browserCrypto,r)}createAccountEntity(e,t,r,o){return ee.createAccount(e.client_info,t,r,void 0,void 0,void 0,o,e.account.id)}generateScopes(e,t){return e.scope?V.fromString(e.scope):V.fromString(t.scope)}async generatePopAccessToken(t,r){if(r.tokenType===e.AuthenticationScheme.POP){if(t.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),t.shr;const e=new qe(this.browserCrypto),o={resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,shrNonce:r.shrNonce};if(!r.keyId)throw x.createKeyIdMissingError();return await e.signPopToken(t.access_token,r.keyId,o)}return t.access_token}async generateAuthenticationResult(r,o,n,i,s,a){const c=this.addTelemetryFromNativeResponse(r),d=r.scope?V.fromString(r.scope):V.fromString(o.scope),l=r.account.properties||{},h=l.UID||n.claims.oid||n.claims.sub||t.EMPTY_STRING,u=l.TenantId||n.claims.tid||t.EMPTY_STRING,p=await this.generatePopAccessToken(r,o),g=o.tokenType===e.AuthenticationScheme.POP?e.AuthenticationScheme.POP:e.AuthenticationScheme.BEARER;return{authority:s,uniqueId:h,tenantId:u,scopes:d.asArray(),account:i.getAccountInfo(),idToken:r.id_token,idTokenClaims:n.claims,accessToken:p,fromCache:!!c&&this.isResponseFromCache(c),expiresOn:new Date(1e3*Number(a+r.expires_in)),tokenType:g,correlationId:this.correlationId,state:r.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch((e=>{this.logger.error(`Error occurred while removing account context from browser storage. ${e}`)}))}cacheNativeTokens(r,o,n,i,s,a,c){const d=Ee.createIdTokenEntity(n,o.authority,r.id_token||t.EMPTY_STRING,o.clientId,i.claims.tid||t.EMPTY_STRING);this.nativeStorageManager.setIdTokenCredential(d);const l=c+(o.tokenType===e.AuthenticationScheme.POP?t.SHR_NONCE_VALIDITY:("string"==typeof r.expires_in?parseInt(r.expires_in,10):r.expires_in)||0),h=this.generateScopes(r,o),u=ve.createAccessTokenEntity(n,o.authority,s,o.clientId,a,h.printScopes(),l,0,this.browserCrypto);this.nativeStorageManager.setAccessTokenCredential(u)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addStaticFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw Qt.createUnexpectedError("Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch(e){this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return void 0===e.is_cached?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(t){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const o=t.authority||this.config.auth.authority,n=new be(o);n.validateAsUri();const{scopes:i,...s}=t,a=new V(i||[]);a.appendScopes(r);const c={...s,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:a.printScopes(),redirectUri:this.getRedirectUri(t.redirectUri),prompt:(()=>{switch(this.apiId){case e.ApiId.ssoSilent:case e.ApiId.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),d.NONE}if(t.prompt)switch(t.prompt){case d.NONE:case d.CONSENT:case d.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),t.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${t.prompt} is not compatible with native flow`),st.createNativePromptParameterNotSupportedError()}else this.logger.trace("initializeNativeRequest: prompt was not provided")})(),correlationId:this.correlationId,tokenType:t.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...t.extraQueryParameters,...t.tokenQueryParameters,telemetry:lt},extendedExpiryToken:!1};if(t.authenticationScheme===e.AuthenticationScheme.POP){const e={resourceRequestUri:t.resourceRequestUri,resourceRequestMethod:t.resourceRequestMethod,shrClaims:t.shrClaims,shrNonce:t.shrNonce},r=new qe(this.browserCrypto),o=await r.generateCnf(e);c.reqCnf=o.reqCnfHash,c.keyId=o.kid}return c}}class Wt{constructor(t,r,o,n,i){this.logger=t,this.handshakeTimeoutMs=r,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=o,this.handshakeEvent=o.startMeasurement(e.PerformanceEvents.NativeMessageHandlerHandshake),this.crypto=n}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ct,extensionId:this.extensionId,responseId:this.crypto.createNewGuid(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise(((e,r)=>{this.resolvers.set(t.responseId,{resolve:e,reject:r})}))}static async createProvider(e,t,r,o){e.trace("NativeMessageHandler - createProvider called.");try{const n=new Wt(e,t,r,o,dt);return await n.sendHandshakeRequest(),n}catch(n){const i=new Wt(e,t,r,o);return await i.sendHandshakeRequest(),i}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ct,extensionId:this.extensionId,responseId:this.crypto.createNewGuid(),body:{method:ht.HandshakeRequest}};return this.handshakeEvent.addStaticFields({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=e=>{this.onChannelMessage(e)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise(((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:r}),this.timeoutId=window.setTimeout((()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.endMeasurement({extensionHandshakeTimedOut:!0,success:!1}),r(st.createNativeHandshakeTimeoutError()),this.handshakeResolvers.delete(e.responseId)}),this.handshakeTimeoutMs)}))}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(t.channel&&t.channel===ct&&(!t.extensionId||t.extensionId===this.extensionId)&&t.body.method===ht.HandshakeRequest){const e=this.handshakeResolvers.get(t.responseId);if(!e)return void this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.endMeasurement({success:!1,extensionInstalled:!1}),e.reject(st.createNativeExtensionNotInstalledError())}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const e=t.body.method;if(e===ht.Response){if(!r)return;const e=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(e)}`),"Success"!==e.status)r.reject(Qt.createError(e.code,e.description,e.ext));else{if(!e.result)throw D.createUnexpectedError("Event does not contain result.");e.result.code&&e.result.description?r.reject(Qt.createError(e.result.code,e.result.description,e.result.ext)):r.resolve(e.result)}this.resolvers.delete(t.responseId)}else if(e===ht.HandshakeResponse){if(!o)return void this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.endMeasurement({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(t){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${t}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(t):o&&o.reject(t)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(t,r,o,n){if(r.trace("isNativeAvailable called"),!t.system.allowNativeBroker)return r.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!o)return r.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(n)switch(n){case e.AuthenticationScheme.BEARER:case e.AuthenticationScheme.POP:return r.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return r.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}class Vt extends Dt{constructor(e,t,r,o,n,i,s,a,c,d){super(e,t,r,o,n,i,s,c,d),this.nativeStorage=a}async acquireToken(r){this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,r.correlationId);const o=await this.initializeAuthorizationRequest(r,e.InteractionType.Redirect);this.browserStorage.updateCacheEntries(o.state,o.nonce,o.authority,o.loginHint||t.EMPTY_STRING,o.account||null);const n=this.initializeServerTelemetryManager(e.ApiId.acquireTokenRedirect),i=e=>{e.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(o.state))};try{this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,r.correlationId);const t=await this.initializeAuthorizationCodeRequest(o);this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,r.correlationId);const s=await this.createAuthCodeClient(n,o.authority,o.azureCloudOptions);this.logger.verbose("Auth code client created");const a=new Ft(s,this.browserStorage,t,this.logger,this.browserCrypto,this.performanceClient),c=await s.getAuthCodeUrl({...o,nativeBroker:Wt.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme)}),d=this.getRedirectStartPage(r.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${d}`),window.addEventListener("pageshow",i),await a.initiateAuthRequest(c,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:d,onRedirectNavigate:r.onRedirectNavigate})}catch(e){throw e instanceof D&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),window.removeEventListener("pageshow",i),this.browserStorage.cleanRequestByState(o.state),e}}async handleRedirectPromise(r){const o=this.initializeServerTelemetryManager(e.ApiId.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const n=this.getRedirectResponseHash(r||window.location.hash);if(!n)return this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(e.InteractionType.Redirect),null;let i;try{const t=be.getDeserializedHash(n);i=this.validateAndExtractStateFromHash(t,e.InteractionType.Redirect),this.logger.verbose("State extracted from hash")}catch(t){return this.logger.info(`handleRedirectPromise was unable to extract state due to: ${t}`),this.browserStorage.cleanRequestByInteractionType(e.InteractionType.Redirect),null}const s=this.browserStorage.getTemporaryCache(gt.ORIGIN_URI,!0)||t.EMPTY_STRING,a=be.removeHashFromUrl(s);if(a===be.removeHashFromUrl(window.location.href)&&this.config.auth.navigateToLoginRequestUrl){this.logger.verbose("Current page is loginRequestUrl, handling hash");const e=await this.handleHash(n,i,o);return s.indexOf("#")>-1&&Lt.replaceHash(s),e}if(!this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash"),this.handleHash(n,i,o);if(!Lt.isInIframe()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(gt.URL_HASH,n,!0);const t={apiId:e.ApiId.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let r=!0;if(s&&"null"!==s)this.logger.verbose(`Navigating to loginRequestUrl: ${s}`),r=await this.navigationClient.navigateInternal(s,t);else{const e=Lt.getHomepage();this.browserStorage.setTemporaryCache(gt.ORIGIN_URI,e,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),r=await this.navigationClient.navigateInternal(e,t)}if(!r)return this.handleHash(n,i,o)}return null}catch(t){throw t instanceof D&&(t.setCorrelationId(this.correlationId),o.cacheFailedRequest(t)),this.browserStorage.cleanRequestByInteractionType(e.InteractionType.Redirect),t}}getRedirectResponseHash(e){this.logger.verbose("getRedirectResponseHash called");if(be.hashContainsKnownProperties(e))return Lt.clearHash(window),this.logger.verbose("Hash contains known properties, returning response hash"),e;const t=this.browserStorage.getTemporaryCache(gt.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(gt.URL_HASH)),this.logger.verbose("Hash does not contain known properties, returning cached hash"),t}async handleHash(t,r,o){const n=this.browserStorage.getCachedRequest(r,this.browserCrypto);this.logger.verbose("handleHash called, retrieved cached request");const i=be.getDeserializedHash(t);if(i.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw st.createNativeConnectionNotEstablishedError();const t=new jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,e.ApiId.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,i.accountId,this.browserStorage,n.correlationId),{userRequestState:o}=Re.parseRequestState(this.browserCrypto,r);return t.acquireToken({...n,state:o,prompt:void 0}).finally((()=>{this.browserStorage.cleanRequestByState(r)}))}const s=this.browserStorage.getCachedAuthority(r);if(!s)throw st.createNoCachedAuthorityError();this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,n.correlationId);const a=await this.createAuthCodeClient(o,s);this.logger.verbose("Auth code client created"),ue.removeThrottle(this.browserStorage,this.config.auth.clientId,n);const c=new Ft(a,this.browserStorage,n,this.logger,this.browserCrypto,this.performanceClient);return await c.handleCodeResponseFromHash(t,r,a.authority,this.networkClient)}async logout(t){this.logger.verbose("logoutRedirect called");const r=this.initializeLogoutRequest(t),o=this.initializeServerTelemetryManager(e.ApiId.logout);try{this.eventHandler.emitEvent(e.EventType.LOGOUT_START,e.InteractionType.Redirect,t),await this.clearCacheOnLogout(r.account);const n={apiId:e.ApiId.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1};this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,r.correlationId);const i=await this.createAuthCodeClient(o,t&&t.authority);this.logger.verbose("Auth code client created");const s=i.getLogoutUri(r);if(this.eventHandler.emitEvent(e.EventType.LOGOUT_SUCCESS,e.InteractionType.Redirect,r),!t||"function"!=typeof t.onRedirectNavigate)return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),void await this.navigationClient.navigateExternal(s,n);if(!1!==t.onRedirectNavigate(s))return this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),void await this.navigationClient.navigateExternal(s,n);this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation")}catch(t){throw t instanceof D&&(t.setCorrelationId(this.correlationId),o.cacheFailedRequest(t)),this.eventHandler.emitEvent(e.EventType.LOGOUT_FAILURE,e.InteractionType.Redirect,null,t),this.eventHandler.emitEvent(e.EventType.LOGOUT_END,e.InteractionType.Redirect),t}this.eventHandler.emitEvent(e.EventType.LOGOUT_END,e.InteractionType.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return be.getAbsoluteUrl(t,Lt.getCurrentUri())}}class Jt extends Dt{constructor(e,t,r,o,n,i,s,a,c,d){super(e,t,r,o,n,i,s,c,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=a}acquireToken(e){try{const t=this.generatePopupName(e.scopes||r,e.authority||this.config.auth.authority),o=e.popupWindowAttributes||{};if(this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,t,o);{this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");const r=this.openSizedPopup("about:blank",t,o);return this.acquireTokenPopupAsync(e,t,o,r)}}catch(e){return Promise.reject(e)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r=this.generateLogoutPopupName(t),o=e&&e.authority,n=e&&e.mainWindowRedirectUri,i=e?.popupWindowAttributes||{};if(this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,i,o,void 0,n);{this.logger.verbose("asyncPopup set to false, opening popup");const e=this.openSizedPopup("about:blank",r,i);return this.logoutPopupAsync(t,r,i,o,e,n)}}catch(e){return Promise.reject(e)}}async acquireTokenPopupAsync(r,o,n,i){this.logger.verbose("acquireTokenPopupAsync called");const s=this.initializeServerTelemetryManager(e.ApiId.acquireTokenPopup);this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,r.correlationId);const a=await this.initializeAuthorizationRequest(r,e.InteractionType.Popup);this.browserStorage.updateCacheEntries(a.state,a.nonce,a.authority,a.loginHint||t.EMPTY_STRING,a.account||null);try{this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,r.correlationId);const t=await this.initializeAuthorizationCodeRequest(a);this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,r.correlationId);const c=await this.createAuthCodeClient(s,a.authority,a.azureCloudOptions);this.logger.verbose("Auth code client created");const d=Wt.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme);let l;d&&(l=this.performanceClient.startMeasurement(e.PerformanceEvents.FetchAccountIdWithNativeBroker,r.correlationId));const h=await c.getAuthCodeUrl({...a,nativeBroker:d}),u=new Kt(c,this.browserStorage,t,this.logger,this.performanceClient),p={popup:i,popupName:o,popupWindowAttributes:n},g=this.initiateAuthRequest(h,p);this.eventHandler.emitEvent(e.EventType.POPUP_OPENED,e.InteractionType.Popup,{popupWindow:g},null);const m=await this.monitorPopupForHash(g),f=be.getDeserializedHash(m),C=this.validateAndExtractStateFromHash(f,e.InteractionType.Popup,a.correlationId);if(ue.removeThrottle(this.browserStorage,this.config.auth.clientId,t),f.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),l&&l.endMeasurement({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw st.createNativeConnectionNotEstablishedError();const t=new jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,e.ApiId.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,f.accountId,this.nativeStorage,a.correlationId),{userRequestState:r}=Re.parseRequestState(this.browserCrypto,C);return t.acquireToken({...a,state:r,prompt:void 0}).finally((()=>{this.browserStorage.cleanRequestByState(C)}))}return await u.handleCodeResponseFromHash(m,C,c.authority,this.networkClient)}catch(e){throw i&&i.close(),e instanceof D&&(e.setCorrelationId(this.correlationId),s.cacheFailedRequest(e)),this.browserStorage.cleanRequestByState(a.state),e}}async logoutPopupAsync(t,r,o,n,i,s){this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(e.EventType.LOGOUT_START,e.InteractionType.Popup,t);const a=this.initializeServerTelemetryManager(e.ApiId.logoutPopup);try{await this.clearCacheOnLogout(t.account),this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,t.correlationId);const c=await this.createAuthCodeClient(a,n);this.logger.verbose("Auth code client created");const d=c.getLogoutUri(t);this.eventHandler.emitEvent(e.EventType.LOGOUT_SUCCESS,e.InteractionType.Popup,t);const l=this.openPopup(d,{popupName:r,popupWindowAttributes:o,popup:i});if(this.eventHandler.emitEvent(e.EventType.POPUP_OPENED,e.InteractionType.Popup,{popupWindow:l},null),await this.waitForLogoutPopup(l),s){const t={apiId:e.ApiId.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},r=be.getAbsoluteUrl(s,Lt.getCurrentUri());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${r}`),this.navigationClient.navigateInternal(r,t)}else this.logger.verbose("No main window navigation requested")}catch(t){throw i&&i.close(),t instanceof D&&(t.setCorrelationId(this.correlationId),a.cacheFailedRequest(t)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(e.EventType.LOGOUT_FAILURE,e.InteractionType.Popup,null,t),this.eventHandler.emitEvent(e.EventType.LOGOUT_END,e.InteractionType.Popup),t}this.eventHandler.emitEvent(e.EventType.LOGOUT_END,e.InteractionType.Popup)}initiateAuthRequest(e,t){if(B.isEmpty(e))throw this.logger.error("Navigate url is empty"),st.createEmptyNavigationUriError();return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t)}monitorPopupForHash(e){return new Promise(((r,o)=>{const n=this.config.system.windowHashTimeout/this.config.system.pollIntervalMilliseconds;let i=0;this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const s=setInterval((()=>{if(e.closed)return this.logger.error("PopupHandler.monitorPopupForHash - window closed"),this.cleanPopup(),clearInterval(s),void o(st.createUserCancelledError());let a=t.EMPTY_STRING,c=t.EMPTY_STRING;try{a=e.location.href,c=e.location.hash}catch(e){}B.isEmpty(a)||"about:blank"===a||(this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),i++,c?(this.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url"),clearInterval(s),this.cleanPopup(e),be.hashContainsKnownProperties(c)?(this.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning."),r(c)):(this.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely."),this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${c}`),o(st.createHashDoesNotContainKnownPropertiesError()))):i>n&&(this.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"),clearInterval(s),o(st.createMonitorPopupTimeoutError())))}),this.config.system.pollIntervalMilliseconds)}))}waitForLogoutPopup(e){return new Promise((r=>{this.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");const o=setInterval((()=>{e.closed&&(this.logger.error("PopupHandler.waitForLogoutPopup - window closed"),this.cleanPopup(),clearInterval(o),r());let n=t.EMPTY_STRING;try{n=e.location.href}catch(e){}B.isEmpty(n)||"about:blank"===n||(this.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing."),clearInterval(o),this.cleanPopup(e),r())}),this.config.system.pollIntervalMilliseconds)}))}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):void 0===t.popup&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t.popupName,t.popupWindowAttributes)),!r)throw st.createEmptyWindowCreatedError();return r.focus&&r.focus(),this.currentWindow=r,window.addEventListener("beforeunload",this.unloadWindow),r}catch(e){throw this.logger.error("error opening popup "+e.message),this.browserStorage.setInteractionInProgress(!1),st.createPopupWindowError(e.toString())}}openSizedPopup(e,t,r){const o=window.screenLeft?window.screenLeft:window.screenX,n=window.screenTop?window.screenTop:window.screenY,i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,s=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let a=r.popupSize?.width,c=r.popupSize?.height,d=r.popupPosition?.top,l=r.popupPosition?.left;return(!a||a<0||a>i)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),a=at.POPUP_WIDTH),(!c||c<0||c>s)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),c=at.POPUP_HEIGHT),(!d||d<0||d>s)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),d=Math.max(0,s/2-at.POPUP_HEIGHT/2+n)),(!l||l<0||l>i)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),l=Math.max(0,i/2-at.POPUP_WIDTH/2+o)),window.open(e,t,`width=${a}, height=${c}, top=${d}, left=${l}, scrollbars=yes`)}unloadWindow(t){this.browserStorage.cleanRequestByInteractionType(e.InteractionType.Popup),this.currentWindow&&this.currentWindow.close(),t.preventDefault()}cleanPopup(e){e&&e.close(),window.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${at.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${at.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}class Xt{navigateInternal(e,t){return Xt.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Xt.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise((e=>{setTimeout((()=>{e(!0)}),t.timeout)}))}}const Zt=6e3;class er extends Kt{constructor(e,t,r,o,n,i){super(e,t,r,o,i),this.navigateFrameWait=n.navigateFrameWait,this.pollIntervalMilliseconds=n.pollIntervalMilliseconds}async initiateAuthRequest(t){if(this.performanceClient.addQueueMeasurement(e.PerformanceEvents.SilentHandlerInitiateAuthRequest,this.authCodeRequest.correlationId),B.isEmpty(t))throw this.logger.info("Navigate url is empty"),st.createEmptyNavigationUriError();return this.navigateFrameWait?(this.performanceClient.setPreQueueTime(e.PerformanceEvents.SilentHandlerLoadFrame,this.authCodeRequest.correlationId),await this.loadFrame(t)):this.loadFrameSync(t)}monitorIframeForHash(r,o){return this.performanceClient.addQueueMeasurement(e.PerformanceEvents.SilentHandlerMonitorIframeForHash,this.authCodeRequest.correlationId),new Promise(((e,n)=>{o<Zt&&this.logger.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${o}ms) than the default (${Zt}ms). This may result in timeouts.`);const i=window.performance.now()+o,s=setInterval((()=>{if(window.performance.now()>i)return this.removeHiddenIframe(r),clearInterval(s),void n(st.createMonitorIframeTimeoutError());let o=t.EMPTY_STRING;const a=r.contentWindow;try{o=a?a.location.href:t.EMPTY_STRING}catch(e){}if(B.isEmpty(o)||"about:blank"===o)return;const c=a?a.location.hash:t.EMPTY_STRING;return c?be.hashContainsKnownProperties(c)?(this.removeHiddenIframe(r),clearInterval(s),void e(c)):(this.logger.error("SilentHandler:monitorIFrameForHash - a hash is present in the iframe but it does not contain known properties. It's likely that the hash has been replaced by code running on the redirectUri page."),this.logger.errorPii(`SilentHandler:monitorIFrameForHash - the url detected in the iframe is: ${o}`),this.removeHiddenIframe(r),clearInterval(s),void n(st.createHashDoesNotContainKnownPropertiesError())):(this.logger.error("SilentHandler:monitorIFrameForHash - the request has returned to the redirectUri but a hash is not present in the iframe. It's likely that the hash has been removed or the page has been redirected by code running on the redirectUri page."),this.logger.errorPii(`SilentHandler:monitorIFrameForHash - the url detected in the iframe is: ${o}`),this.removeHiddenIframe(r),clearInterval(s),void n(st.createEmptyHashError()))}),this.pollIntervalMilliseconds)}))}loadFrame(t){return this.performanceClient.addQueueMeasurement(e.PerformanceEvents.SilentHandlerLoadFrame,this.authCodeRequest.correlationId),new Promise(((e,r)=>{const o=this.createHiddenIframe();setTimeout((()=>{o?(o.src=t,e(o)):r("Unable to load iframe")}),this.navigateFrameWait)}))}loadFrameSync(e){const t=this.createHiddenIframe();return t.src=e,t}createHiddenIframe(){const e=document.createElement("iframe");return e.style.visibility="hidden",e.style.position="absolute",e.style.width=e.style.height="0",e.style.border="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.getElementsByTagName("body")[0].appendChild(e),e}removeHiddenIframe(e){document.body===e.parentNode&&document.body.removeChild(e)}}class tr extends Dt{constructor(e,t,r,o,n,i,s,a,c,d,l){super(e,t,r,o,n,i,a,d,l),this.apiId=s,this.nativeStorage=c}async acquireToken(r){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.SilentIframeClientAcquireToken,r.correlationId),this.logger.verbose("acquireTokenByIframe called");const o=this.performanceClient.startMeasurement(e.PerformanceEvents.SilentIframeClientAcquireToken,r.correlationId);if(B.isEmpty(r.loginHint)&&B.isEmpty(r.sid)&&(!r.account||B.isEmpty(r.account.username))&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request."),r.prompt&&r.prompt!==d.NONE&&r.prompt!==d.NO_SESSION)throw o.endMeasurement({success:!1}),st.createSilentPromptValueError(r.prompt);this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,r.correlationId);const n=await this.initializeAuthorizationRequest({...r,prompt:r.prompt||d.NONE},e.InteractionType.Silent);this.browserStorage.updateCacheEntries(n.state,n.nonce,n.authority,n.loginHint||t.EMPTY_STRING,n.account||null);const i=this.initializeServerTelemetryManager(this.apiId);try{this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,r.correlationId);const t=await this.createAuthCodeClient(i,n.authority,n.azureCloudOptions);return this.logger.verbose("Auth code client created"),this.performanceClient.setPreQueueTime(e.PerformanceEvents.SilentIframeClientTokenHelper,r.correlationId),await this.silentTokenHelper(t,n).then((e=>(o.endMeasurement({success:!0,fromCache:!1,requestId:e.requestId}),e)))}catch(e){throw e instanceof D&&(e.setCorrelationId(this.correlationId),i.cacheFailedRequest(e)),this.browserStorage.cleanRequestByState(n.state),o.endMeasurement({errorCode:e instanceof D&&e.errorCode||void 0,subErrorCode:e instanceof D&&e.subError||void 0,success:!1}),e}}logout(){return Promise.reject(st.createSilentLogoutUnsupportedError())}async silentTokenHelper(t,r){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.SilentIframeClientTokenHelper,r.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,r.correlationId);const o=await this.initializeAuthorizationCodeRequest(r);this.performanceClient.setPreQueueTime(e.PerformanceEvents.GetAuthCodeUrl,r.correlationId);const n=await t.getAuthCodeUrl({...r,nativeBroker:Wt.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme)}),i=new er(t,this.browserStorage,o,this.logger,this.config.system,this.performanceClient);this.performanceClient.setPreQueueTime(e.PerformanceEvents.SilentHandlerInitiateAuthRequest,r.correlationId);const s=await i.initiateAuthRequest(n);this.performanceClient.setPreQueueTime(e.PerformanceEvents.SilentHandlerMonitorIframeForHash,r.correlationId);const a=await i.monitorIframeForHash(s,this.config.system.iframeHashTimeout),c=be.getDeserializedHash(a),l=this.validateAndExtractStateFromHash(c,e.InteractionType.Silent,o.correlationId);if(c.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw st.createNativeConnectionNotEstablishedError();const e=new jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,c.accountId,this.browserStorage,this.correlationId),{userRequestState:t}=Re.parseRequestState(this.browserCrypto,l);return e.acquireToken({...r,state:t,prompt:r.prompt||d.NONE}).finally((()=>{this.browserStorage.cleanRequestByState(l)}))}return this.performanceClient.setPreQueueTime(e.PerformanceEvents.HandleCodeResponseFromHash,r.correlationId),i.handleCodeResponseFromHash(a,l,t.authority,this.networkClient)}}class rr extends Dt{async acquireToken(t){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.SilentRefreshClientAcquireToken,t.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.InitializeBaseRequest,t.correlationId);const r={...t,...await this.initializeBaseRequest(t)},o=this.performanceClient.startMeasurement(e.PerformanceEvents.SilentRefreshClientAcquireToken,r.correlationId),n=this.initializeServerTelemetryManager(e.ApiId.acquireTokenSilent_silentFlow),i=await this.createRefreshTokenClient(n,r.authority,r.azureCloudOptions);return this.logger.verbose("Refresh token client created"),this.performanceClient.setPreQueueTime(e.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken,t.correlationId),i.acquireTokenByRefreshToken(r).then((e=>(o.endMeasurement({success:!0,fromCache:e.fromCache,requestId:e.requestId}),e))).catch((e=>{throw e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e),o.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}))}logout(){return Promise.reject(st.createSilentLogoutUnsupportedError())}async createRefreshTokenClient(t,r,o){this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientGetClientConfiguration,this.correlationId);const n=await this.getClientConfiguration(t,r,o);return new Ke(n,this.performanceClient)}}class or{constructor(e,t){this.eventCallbacks=new Map,this.logger=e,this.browserCrypto=t,this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}addEventCallback(e){if("undefined"!=typeof window){const t=this.browserCrypto.createNewGuid();return this.eventCallbacks.set(t,e),this.logger.verbose(`Event callback registered with id: ${t}`),t}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}enableAccountStorageEvents(){"undefined"!=typeof window&&(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){"undefined"!=typeof window&&(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}emitEvent(e,t,r,o){if("undefined"!=typeof window){const n={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.logger.info(`Emitting event: ${e}`),this.eventCallbacks.forEach(((t,r)=>{this.logger.verbose(`Emitting event to callback ${r}: ${e}`),t.apply(null,[n])}))}}handleAccountCacheChange(t){try{const r=t.newValue||t.oldValue;if(!r)return;const o=JSON.parse(r);if("object"!=typeof o||!ee.isAccountEntity(o))return;const n=re.toObject(new ee,o).getAccountInfo();!t.oldValue&&t.newValue?(this.logger.info("Account was added to cache in a different window"),this.emitEvent(e.EventType.ACCOUNT_ADDED,void 0,n)):!t.newValue&&t.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.emitEvent(e.EventType.ACCOUNT_REMOVED,void 0,n))}catch(t){return}}}class nr{static decimalToHex(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return t}}class ir{constructor(e){this.cryptoObj=e}generateGuid(){try{const e=new Uint8Array(16);return this.cryptoObj.getRandomValues(e),e[6]|=64,e[6]&=79,e[8]|=128,e[8]&=191,nr.decimalToHex(e[0])+nr.decimalToHex(e[1])+nr.decimalToHex(e[2])+nr.decimalToHex(e[3])+"-"+nr.decimalToHex(e[4])+nr.decimalToHex(e[5])+"-"+nr.decimalToHex(e[6])+nr.decimalToHex(e[7])+"-"+nr.decimalToHex(e[8])+nr.decimalToHex(e[9])+"-"+nr.decimalToHex(e[10])+nr.decimalToHex(e[11])+nr.decimalToHex(e[12])+nr.decimalToHex(e[13])+nr.decimalToHex(e[14])+nr.decimalToHex(e[15])}catch(e){const r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef";let n=0,i=t.EMPTY_STRING;for(let e=0;e<36;e++)"-"!==r[e]&&"4"!==r[e]&&(n=16*Math.random()|0),"x"===r[e]?i+=o[n]:"y"===r[e]?(n&=3,n|=8,i+=o[n]):i+=r[e];return i}}isGuid(e){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(e)}}class sr{static stringToUtf8Arr(e){let t,r=0;const o=e.length;for(let n=0;n<o;n++)t=e.charCodeAt(n),r+=t<128?1:t<2048?2:t<65536?3:t<2097152?4:t<67108864?5:6;const n=new Uint8Array(r);for(let o=0,i=0;o<r;i++)t=e.charCodeAt(i),t<128?n[o++]=t:t<2048?(n[o++]=192+(t>>>6),n[o++]=128+(63&t)):t<65536?(n[o++]=224+(t>>>12),n[o++]=128+(t>>>6&63),n[o++]=128+(63&t)):t<2097152?(n[o++]=240+(t>>>18),n[o++]=128+(t>>>12&63),n[o++]=128+(t>>>6&63),n[o++]=128+(63&t)):t<67108864?(n[o++]=248+(t>>>24),n[o++]=128+(t>>>18&63),n[o++]=128+(t>>>12&63),n[o++]=128+(t>>>6&63),n[o++]=128+(63&t)):(n[o++]=252+(t>>>30),n[o++]=128+(t>>>24&63),n[o++]=128+(t>>>18&63),n[o++]=128+(t>>>12&63),n[o++]=128+(t>>>6&63),n[o++]=128+(63&t));return n}static stringToArrayBuffer(e){const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return t}static utf8ArrToString(e){let r=t.EMPTY_STRING;for(let t,o=e.length,n=0;n<o;n++)t=e[n],r+=String.fromCharCode(t>251&&t<254&&n+5<o?1073741824*(t-252)+(e[++n]-128<<24)+(e[++n]-128<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:t>247&&t<252&&n+4<o?(t-248<<24)+(e[++n]-128<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:t>239&&t<248&&n+3<o?(t-240<<18)+(e[++n]-128<<12)+(e[++n]-128<<6)+e[++n]-128:t>223&&t<240&&n+2<o?(t-224<<12)+(e[++n]-128<<6)+e[++n]-128:t>191&&t<224&&n+1<o?(t-192<<6)+e[++n]-128:t);return r}static getSortedObjectString(e){return JSON.stringify(e,Object.keys(e).sort())}}class ar{urlEncode(e){return encodeURIComponent(this.encode(e).replace(/=/g,t.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_"))}urlEncodeArr(e){return this.base64EncArr(e).replace(/=/g,t.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_")}encode(e){const t=sr.stringToUtf8Arr(e);return this.base64EncArr(t)}base64EncArr(e){const r=(3-e.length%3)%3;let o=t.EMPTY_STRING;for(let t,r=e.length,n=0,i=0;i<r;i++)t=i%3,n|=e[i]<<(16>>>t&24),2!==t&&e.length-i!=1||(o+=String.fromCharCode(this.uint6ToB64(n>>>18&63),this.uint6ToB64(n>>>12&63),this.uint6ToB64(n>>>6&63),this.uint6ToB64(63&n)),n=0);return 0===r?o:o.substring(0,o.length-r)+(1===r?"=":"==")}uint6ToB64(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}}class cr{decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string")}const r=this.base64DecToArr(t);return sr.utf8ArrToString(r)}base64DecToArr(e,r){const o=e.replace(/[^A-Za-z0-9\+\/]/g,t.EMPTY_STRING),n=o.length,i=r?Math.ceil((3*n+1>>>2)/r)*r:3*n+1>>>2,s=new Uint8Array(i);for(let e,t,r=0,a=0,c=0;c<n;c++)if(t=3&c,r|=this.b64ToUint6(o.charCodeAt(c))<<18-6*t,3===t||n-c==1){for(e=0;e<3&&a<i;e++,a++)s[a]=r>>>(16>>>e&24)&255;r=0}return s}b64ToUint6(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:43===e?62:47===e?63:0}}class dr{constructor(e){this.base64Encode=new ar,this.cryptoObj=e}async generateCodes(){const e=this.generateCodeVerifier();return{verifier:e,challenge:await this.generateCodeChallengeFromVerifier(e)}}generateCodeVerifier(){try{const e=new Uint8Array(32);this.cryptoObj.getRandomValues(e);return this.base64Encode.urlEncodeArr(e)}catch(e){throw st.createPkceNotGeneratedError(e)}}async generateCodeChallengeFromVerifier(e){try{const t=await this.cryptoObj.sha256Digest(e);return this.base64Encode.urlEncodeArr(new Uint8Array(t))}catch(e){throw st.createPkceNotGeneratedError(e)}}}class lr{getRandomValues(e){return window.crypto.getRandomValues(e)}async generateKey(e,t,r){return window.crypto.subtle.generateKey(e,t,r)}async exportKey(e){return window.crypto.subtle.exportKey(vt,e)}async importKey(e,t,r,o){return window.crypto.subtle.importKey(vt,e,t,r,o)}async sign(e,t,r){return window.crypto.subtle.sign(e,t,r)}async digest(e,t){return window.crypto.subtle.digest(e,t)}}class hr{initPrng(e){return window.msrCrypto.initPrng([...e])}getRandomValues(e){return window.msrCrypto.getRandomValues(e)}async generateKey(e,t,r){return window.msrCrypto.subtle.generateKey(e,t,r)}async exportKey(e){return window.msrCrypto.subtle.exportKey(vt,e)}async importKey(e,t,r,o){return window.msrCrypto.subtle.importKey(vt,e,t,r,o)}async sign(e,t,r){return window.msrCrypto.subtle.sign(e,t,r)}async digest(e,t){return window.msrCrypto.subtle.digest(e,t)}}class ur{getRandomValues(e){return window.msCrypto.getRandomValues(e)}async generateKey(e,t,r){return new Promise(((o,n)=>{const i=window.msCrypto.subtle.generateKey(e,t,r);i.addEventListener("complete",(e=>{o(e.target.result)})),i.addEventListener("error",(e=>{n(e)}))}))}async exportKey(e){return new Promise(((r,o)=>{const n=window.msCrypto.subtle.exportKey(vt,e);n.addEventListener("complete",(e=>{const n=e.target.result,i=sr.utf8ArrToString(new Uint8Array(n)).replace(/\r/g,t.EMPTY_STRING).replace(/\n/g,t.EMPTY_STRING).replace(/\t/g,t.EMPTY_STRING).split(" ").join(t.EMPTY_STRING).replace("\0",t.EMPTY_STRING);try{r(JSON.parse(i))}catch(e){o(e)}})),n.addEventListener("error",(e=>{o(e)}))}))}async importKey(e,t,r,o){const n=sr.getSortedObjectString(e),i=sr.stringToArrayBuffer(n);return new Promise(((e,n)=>{const s=window.msCrypto.subtle.importKey(vt,i,t,r,o);s.addEventListener("complete",(t=>{e(t.target.result)})),s.addEventListener("error",(e=>{n(e)}))}))}async sign(e,t,r){return new Promise(((o,n)=>{const i=window.msCrypto.subtle.sign(e,t,r);i.addEventListener("complete",(e=>{o(e.target.result)})),i.addEventListener("error",(e=>{n(e)}))}))}async digest(e,t){return new Promise(((r,o)=>{const n=window.msCrypto.subtle.digest(e,t.buffer);n.addEventListener("complete",(e=>{r(e.target.result)})),n.addEventListener("error",(e=>{o(e)}))}))}}const pr="SHA-256",gr=new Uint8Array([1,0,1]);class mr{constructor(e,t){if(this.logger=e,this.cryptoOptions=t,this.hasBrowserCrypto())this.logger.verbose("BrowserCrypto: modern crypto interface available"),this.subtleCrypto=new lr;else if(this.hasIECrypto())this.logger.verbose("BrowserCrypto: MS crypto interface available"),this.subtleCrypto=new ur;else{if(!this.hasMsrCrypto()||!this.cryptoOptions?.useMsrCrypto)throw this.hasMsrCrypto()&&this.logger.info("BrowserCrypto: MSR Crypto interface available but system.cryptoOptions.useMsrCrypto not enabled"),this.logger.error("BrowserCrypto: No crypto interfaces available."),st.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");this.logger.verbose("BrowserCrypto: MSR crypto interface available"),this.subtleCrypto=new hr}if(this.subtleCrypto.initPrng){if(this.logger.verbose("BrowserCrypto: Interface requires entropy"),!this.cryptoOptions?.entropy)throw this.logger.error("BrowserCrypto: Interface requires entropy but none provided."),kt.createEntropyNotProvided();this.logger.verbose("BrowserCrypto: Entropy provided"),this.subtleCrypto.initPrng(this.cryptoOptions.entropy)}this.keygenAlgorithmOptions={name:"RSASSA-PKCS1-v1_5",hash:pr,modulusLength:2048,publicExponent:gr}}hasIECrypto(){return"msCrypto"in window}hasBrowserCrypto(){return"crypto"in window}hasMsrCrypto(){return"msrCrypto"in window}async sha256Digest(e){const t=sr.stringToUtf8Arr(e);return this.subtleCrypto.digest({name:pr},t)}getRandomValues(e){return this.subtleCrypto.getRandomValues(e)}async generateKeyPair(e,t){return this.subtleCrypto.generateKey(this.keygenAlgorithmOptions,e,t)}async exportJwk(e){return this.subtleCrypto.exportKey(e)}async importJwk(e,t,r){return this.subtleCrypto.importKey(e,this.keygenAlgorithmOptions,t,r)}async sign(e,t){return this.subtleCrypto.sign(this.keygenAlgorithmOptions,e,t)}}class fr{constructor(){this.dbName=_t,this.version=1,this.tableName=wt,this.dbOpen=!1}async open(){return new Promise(((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",(e=>{e.target.result.createObjectStore(this.tableName)})),r.addEventListener("success",(t=>{const r=t;this.db=r.target.result,this.dbOpen=!0,e()})),r.addEventListener("error",(()=>t(st.createDatabaseUnavailableError())))}))}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return await this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise(((t,r)=>{if(!this.db)return r(st.createDatabaseNotOpenError());const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);o.addEventListener("success",(e=>{const r=e;this.closeConnection(),t(r.target.result)})),o.addEventListener("error",(e=>{this.closeConnection(),r(e)}))}))}async setItem(e,t){return await this.validateDbIsOpen(),new Promise(((r,o)=>{if(!this.db)return o(st.createDatabaseNotOpenError());const n=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);n.addEventListener("success",(()=>{this.closeConnection(),r()})),n.addEventListener("error",(e=>{this.closeConnection(),o(e)}))}))}async removeItem(e){return await this.validateDbIsOpen(),new Promise(((t,r)=>{if(!this.db)return r(st.createDatabaseNotOpenError());const o=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);o.addEventListener("success",(()=>{this.closeConnection(),t()})),o.addEventListener("error",(e=>{this.closeConnection(),r(e)}))}))}async getKeys(){return await this.validateDbIsOpen(),new Promise(((e,t)=>{if(!this.db)return t(st.createDatabaseNotOpenError());const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();r.addEventListener("success",(t=>{const r=t;this.closeConnection(),e(r.target.result)})),r.addEventListener("error",(e=>{this.closeConnection(),t(e)}))}))}async containsKey(e){return await this.validateDbIsOpen(),new Promise(((t,r)=>{if(!this.db)return r(st.createDatabaseNotOpenError());const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);o.addEventListener("success",(e=>{const r=e;this.closeConnection(),t(1===r.target.result)})),o.addEventListener("error",(e=>{this.closeConnection(),r(e)}))}))}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise(((e,t)=>{const r=window.indexedDB.deleteDatabase(_t);r.addEventListener("success",(()=>e(!0))),r.addEventListener("blocked",(()=>e(!0))),r.addEventListener("error",(()=>t(!1)))}))}}class Cr{constructor(e,t){this.inMemoryCache=new bt,this.indexedDBCache=new fr,this.logger=e,this.storeName=t}handleDatabaseAccessError(e){if(!(e instanceof st&&e.errorCode===it.databaseUnavailable.code))throw e;this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.")}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(e){this.handleDatabaseAccessError(e)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(e){this.handleDatabaseAccessError(e)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(e){this.handleDatabaseAccessError(e)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(0===e.length)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(e){this.handleDatabaseAccessError(e)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(e){this.handleDatabaseAccessError(e)}return t}clearInMemory(){this.logger.verbose(`Deleting in-memory keystore ${this.storeName}`),this.inMemoryCache.clear(),this.logger.verbose(`In-memory keystore ${this.storeName} deleted`)}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}var yr;!function(e){e.asymmetricKeys="asymmetricKeys",e.symmetricKeys="symmetricKeys"}(yr||(yr={}));class Er{constructor(e){this.logger=e,this.asymmetricKeys=new Cr(this.logger,yr.asymmetricKeys),this.symmetricKeys=new Cr(this.logger,yr.symmetricKeys)}async clear(){this.asymmetricKeys.clearInMemory(),this.symmetricKeys.clearInMemory();try{return await this.asymmetricKeys.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}}class Tr{constructor(e,t,r){this.logger=e,this.browserCrypto=new mr(this.logger,r),this.b64Encode=new ar,this.b64Decode=new cr,this.guidGenerator=new ir(this.browserCrypto),this.pkceGenerator=new dr(this.browserCrypto),this.cache=new Er(this.logger),this.performanceClient=t}createNewGuid(){return this.guidGenerator.generateGuid()}base64Encode(e){return this.b64Encode.encode(e)}base64Decode(e){return this.b64Decode.decode(e)}async generatePkceCodes(){return this.pkceGenerator.generateCodes()}async getPublicKeyThumbprint(t){const r=this.performanceClient?.startMeasurement(e.PerformanceEvents.CryptoOptsGetPublicKeyThumbprint,t.correlationId),o=await this.browserCrypto.generateKeyPair(Tr.EXTRACTABLE,Tr.POP_KEY_USAGES),n=await this.browserCrypto.exportJwk(o.publicKey),i={e:n.e,kty:n.kty,n:n.n},s=sr.getSortedObjectString(i),a=await this.hashString(s),c=await this.browserCrypto.exportJwk(o.privateKey),d=await this.browserCrypto.importJwk(c,!1,["sign"]);return await this.cache.asymmetricKeys.setItem(a,{privateKey:d,publicKey:o.publicKey,requestMethod:t.resourceRequestMethod,requestUri:t.resourceRequestUri}),r&&r.endMeasurement({success:!0}),a}async removeTokenBindingKey(e){await this.cache.asymmetricKeys.removeItem(e);return!await this.cache.asymmetricKeys.containsKey(e)}async clearKeystore(){return await this.cache.clear()}async signJwt(t,r,o){const n=this.performanceClient?.startMeasurement(e.PerformanceEvents.CryptoOptsSignJwt,o),i=await this.cache.asymmetricKeys.getItem(r);if(!i)throw st.createSigningKeyNotFoundInStorageError(r);const s=await this.browserCrypto.exportJwk(i.publicKey),a=sr.getSortedObjectString(s),c=this.b64Encode.urlEncode(JSON.stringify({kid:r})),d=et.getShrHeaderString({kid:c,alg:s.alg}),l=this.b64Encode.urlEncode(d);t.cnf={jwk:JSON.parse(a)};const h=`${l}.${this.b64Encode.urlEncode(JSON.stringify(t))}`,u=sr.stringToArrayBuffer(h),p=await this.browserCrypto.sign(i.privateKey,u),g=`${h}.${this.b64Encode.urlEncodeArr(new Uint8Array(p))}`;return n&&n.endMeasurement({success:!0}),g}async hashString(e){const t=await this.browserCrypto.sha256Digest(e),r=new Uint8Array(t);return this.b64Encode.urlEncodeArr(r)}}Tr.POP_KEY_USAGES=["sign","verify"],Tr.EXTRACTABLE=!0;class vr{constructor(e,t){this.correlationId=t,this.measureName=vr.makeMeasureName(e,t),this.startMark=vr.makeStartMark(e,t),this.endMark=vr.makeEndMark(e,t)}static makeMeasureName(e,t){return`msal.measure.${e}.${t}`}static makeStartMark(e,t){return`msal.start.${e}.${t}`}static makeEndMark(e,t){return`msal.end.${e}.${t}`}static supportsBrowserPerformance(){return"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.mark&&"function"==typeof window.performance.measure&&"function"==typeof window.performance.clearMarks&&"function"==typeof window.performance.clearMeasures&&"function"==typeof window.performance.getEntriesByName}static flushMeasurements(e,t){if(vr.supportsBrowserPerformance())try{t.forEach((t=>{const r=vr.makeMeasureName(t.name,e);window.performance.getEntriesByName(r,"measure").length>0&&(window.performance.clearMeasures(r),window.performance.clearMarks(vr.makeStartMark(r,e)),window.performance.clearMarks(vr.makeEndMark(r,e)))}))}catch(e){}}startMeasurement(){if(vr.supportsBrowserPerformance())try{window.performance.mark(this.startMark)}catch(e){}}endMeasurement(){if(vr.supportsBrowserPerformance())try{window.performance.mark(this.endMark),window.performance.measure(this.measureName,this.startMark,this.endMark)}catch(e){}}flushMeasurement(){if(vr.supportsBrowserPerformance())try{const e=window.performance.getEntriesByName(this.measureName,"measure");if(e.length>0){const t=e[0].duration;return window.performance.clearMeasures(this.measureName),window.performance.clearMarks(this.startMark),window.performance.clearMarks(this.endMark),t}}catch(e){}return null}}class Ir extends rt{constructor(e,t,r,o,n,i,s){super(e,t,r,o,n,i),this.browserCrypto=new mr(this.logger,s),this.guidGenerator=new ir(this.browserCrypto)}startPerformanceMeasurement(e,t){return new vr(e,t)}generateId(){return this.guidGenerator.generateGuid()}getPageVisibility(){return document.visibilityState?.toString()||null}deleteIncompleteSubMeasurements(e){const t=this.eventsByCorrelationId.get(e.event.correlationId),r=t&&t.eventId===e.event.eventId,o=[];r&&t?.incompleteSubMeasurements&&t.incompleteSubMeasurements.forEach((e=>{o.push({...e})})),o.length>0&&vr.flushMeasurements(e.event.correlationId,o)}supportsBrowserPerformanceNow(){return"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.now}startMeasurement(e,t){const r=this.getPageVisibility(),o=super.startMeasurement(e,t);return{...o,endMeasurement:e=>{const t=o.endMeasurement({startPageVisibility:r,endPageVisibility:this.getPageVisibility(),...e});return this.deleteIncompleteSubMeasurements(o),t},discardMeasurement:()=>{o.discardMeasurement(),this.deleteIncompleteSubMeasurements(o),o.measurement.flushMeasurement()}}}setPreQueueTime(e,t){if(!this.supportsBrowserPerformanceNow())return void this.logger.trace(`BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for ${e}`);if(!t)return void this.logger.trace(`BrowserPerformanceClient: correlationId for ${e} not provided, unable to set telemetry queue time`);const r=this.preQueueTimeByCorrelationId.get(t);r&&(this.logger.trace(`BrowserPerformanceClient: Incomplete pre-queue ${r.name} found`,t),this.addQueueMeasurement(r.name,t,void 0,!0)),this.preQueueTimeByCorrelationId.set(t,{name:e,time:window.performance.now()})}addQueueMeasurement(e,t,r,o){if(!this.supportsBrowserPerformanceNow())return void this.logger.trace(`BrowserPerformanceClient: window performance API not available, unable to add queue measurement for ${e}`);if(!t)return void this.logger.trace(`BrowserPerformanceClient: correlationId for ${e} not provided, unable to add queue measurement`);const n=super.getPreQueueTime(e,t);if(!n)return;const i=window.performance.now(),s=r||super.calculateQueuedTime(n,i);return super.addQueueMeasurement(e,t,s,o)}}var _r=Object.freeze({__proto__:null,BrowserCacheManager:Nt,BrowserConstants:at,BrowserPerformanceClient:Ir,BrowserPerformanceMeasurement:vr,CryptoOps:Tr,EventHandler:or,NativeAuthError:Qt,NativeInteractionClient:jt,NativeMessageHandler:Wt,PopupClient:Jt,RedirectClient:Vt,RedirectHandler:Ft,SilentCacheClient:Yt,SilentIframeClient:tr,SilentRefreshClient:rr,StandardInteractionClient:Dt,get TemporaryCacheKeys(){return gt}});class wr{constructor(r){this.browserEnvironment="undefined"!=typeof window,this.config=function({auth:r,cache:o,system:n,telemetry:i},s){const a={clientId:t.EMPTY_STRING,authority:`${t.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:t.EMPTY_STRING,authorityMetadata:t.EMPTY_STRING,redirectUri:t.EMPTY_STRING,postLogoutRedirectUri:t.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:e.ProtocolMode.AAD,azureCloudOptions:{azureCloudInstance:e.AzureCloudInstance.None,tenant:t.EMPTY_STRING},skipAuthorityMetadataCache:!1},c={cacheLocation:e.BrowserCacheLocation.SessionStorage,temporaryCacheLocation:e.BrowserCacheLocation.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!(!o||o.cacheLocation!==e.BrowserCacheLocation.LocalStorage)},d={loggerCallback:()=>{},logLevel:e.LogLevel.Info,piiLoggingEnabled:!1},l={...ne,loggerOptions:d,networkClient:s?Lt.getBrowserNetworkClient():Ve,navigationClient:new Xt,loadFrameTimeout:0,windowHashTimeout:n?.loadFrameTimeout||6e4,iframeHashTimeout:n?.loadFrameTimeout||Zt,navigateFrameWait:s&&Lt.detectIEOrEdge()?500:0,redirectNavigationTimeout:3e4,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!0,nativeBrokerHandshakeTimeout:n?.nativeBrokerHandshakeTimeout||2e3,pollIntervalMilliseconds:at.DEFAULT_POLL_INTERVAL_MS,cryptoOptions:{useMsrCrypto:!1,entropy:void 0}},h={...n,loggerOptions:n?.loggerOptions||d},u={application:{appName:t.EMPTY_STRING,appVersion:t.EMPTY_STRING}};return{auth:{...a,...r},cache:{...c,...o},system:{...l,...h},telemetry:{...u,...i}}}(r,this.browserEnvironment),this.logger=new $(this.config.system.loggerOptions,Mt,Ot),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}class Sr extends wr{getModuleName(){return Sr.MODULE_NAME}getId(){return Sr.ID}async initialize(){return!1}}Sr.MODULE_NAME="",Sr.ID="TeamsAppOperatingContext";class Ar extends wr{getModuleName(){return Ar.MODULE_NAME}getId(){return Ar.ID}async initialize(){return this.available="undefined"!=typeof window,this.available}}Ar.MODULE_NAME="",Ar.ID="StandardOperatingContext";class kr{constructor(e){this.config=e;const t={loggerCallback:void 0,piiLoggingEnabled:!1,logLevel:void 0,correlationId:void 0};this.logger=new $(t,Mt,Ot)}async createController(){const e=new Ar(this.config),t=new Sr(this.config),r=[e.initialize(),t.initialize()];return Promise.all(r).then((async()=>{if(t.isAvailable()){const t=await Promise.resolve().then((function(){return Mr}));return await t.StandardController.createController(e)}if(e.isAvailable()){const t=await Promise.resolve().then((function(){return Mr}));return await t.StandardController.createController(e)}throw new Error("No controller found.")}))}}class Rr{constructor(e,t,r,o){this.isBrowserEnvironment="undefined"!=typeof window,this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(this.logger.info("TokenCache - loadExternalTokens called"),!t.id_token)throw st.createUnableToLoadTokenError("Please ensure server response includes id token.");const o=new te(t.id_token,this.cryptoObj);let n,i;if(e.account){const i=this.loadAccount(o,e.account.environment,void 0,void 0,e.account.homeAccountId);n=new ke(i,this.loadIdToken(o,i.homeAccountId,e.account.environment,e.account.tenantId),this.loadAccessToken(e,t,i.homeAccountId,e.account.environment,e.account.tenantId,r),this.loadRefreshToken(e,t,i.homeAccountId,e.account.environment))}else{if(!e.authority)throw st.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");{const s=Qe.generateAuthority(e.authority,e.azureCloudOptions),a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache};if(i=new Qe(s,this.config.system.networkClient,this.storage,a,this.logger),r.clientInfo){this.logger.trace("TokenCache - homeAccountId from options");const s=this.loadAccount(o,i.hostnameAndPort,r.clientInfo,i.authorityType);n=new ke(s,this.loadIdToken(o,s.homeAccountId,i.hostnameAndPort,i.tenant),this.loadAccessToken(e,t,s.homeAccountId,i.hostnameAndPort,i.tenant,r),this.loadRefreshToken(e,t,s.homeAccountId,i.hostnameAndPort))}else{if(!t.client_info)throw st.createUnableToLoadTokenError("Please provide clientInfo in the response or options.");{this.logger.trace("TokenCache - homeAccountId from response");const s=this.loadAccount(o,i.hostnameAndPort,t.client_info,i.authorityType);n=new ke(s,this.loadIdToken(o,s.homeAccountId,i.hostnameAndPort,i.tenant),this.loadAccessToken(e,t,s.homeAccountId,i.hostnameAndPort,i.tenant,r),this.loadRefreshToken(e,t,s.homeAccountId,i.hostnameAndPort))}}}}return this.generateAuthenticationResult(e,o,n,i)}loadAccount(e,t,r,o,n){let i;if(n?i=n:void 0!==o&&r&&(i=ee.generateHomeAccountId(r,o,this.logger,this.cryptoObj,e)),!i)throw st.createUnableToLoadTokenError("Unexpected missing homeAccountId");const s=r?ee.createAccount(r,i,e,void 0,void 0,void 0,t):ee.createGenericAccount(i,e,void 0,void 0,void 0,t);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading account"),this.storage.setAccount(s),s;throw st.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")}loadIdToken(e,t,r,o){const n=Ee.createIdTokenEntity(t,r,e.rawToken,this.config.auth.clientId,o);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading id token"),this.storage.setIdTokenCredential(n),n;throw st.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")}loadAccessToken(e,t,r,o,n,i){if(!t.access_token)return this.logger.verbose("TokenCache - No access token provided for caching"),null;if(!t.expires_in)throw st.createUnableToLoadTokenError("Please ensure server response includes expires_in value.");if(!i.extendedExpiresOn)throw st.createUnableToLoadTokenError("Please provide an extendedExpiresOn value in the options.");const s=new V(e.scopes).printScopes(),a=i.expiresOn||t.expires_in+(new Date).getTime()/1e3,c=i.extendedExpiresOn,d=ve.createAccessTokenEntity(r,o,t.access_token,this.config.auth.clientId,n,s,a,c,this.cryptoObj);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading access token"),this.storage.setAccessTokenCredential(d),d;throw st.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")}loadRefreshToken(e,t,r,o){if(!t.refresh_token)return this.logger.verbose("TokenCache - No refresh token provided for caching"),null;const n=Ie.createRefreshTokenEntity(r,o,t.refresh_token,this.config.auth.clientId);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading refresh token"),this.storage.setRefreshTokenCredential(n),n;throw st.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")}generateAuthenticationResult(e,r,o,n){let i,s=t.EMPTY_STRING,a=[],c=null;o?.accessToken&&(s=o.accessToken.secret,a=V.fromString(o.accessToken.target).asArray(),c=new Date(1e3*Number(o.accessToken.expiresOn)),i=new Date(1e3*Number(o.accessToken.extendedExpiresOn)));const d=r?.claims.oid||r?.claims.sub||t.EMPTY_STRING,l=r?.claims.tid||t.EMPTY_STRING;return{authority:n?n.canonicalAuthority:t.EMPTY_STRING,uniqueId:d,tenantId:l,scopes:a,account:o?.account?o.account.getAccountInfo():null,idToken:r?r.rawToken:t.EMPTY_STRING,idTokenClaims:r?r.claims:{},accessToken:s,fromCache:!0,expiresOn:c,correlationId:e.correlationId||t.EMPTY_STRING,requestId:t.EMPTY_STRING,extExpiresOn:i,familyId:t.EMPTY_STRING,tokenType:o?.accessToken?.tokenType||t.EMPTY_STRING,state:t.EMPTY_STRING,cloudGraphHostName:o?.account?.cloudGraphHostName||t.EMPTY_STRING,msGraphHost:o?.account?.msGraphHost||t.EMPTY_STRING,code:void 0,fromNativeBroker:!1}}}class br extends De{constructor(e){super(e),this.includeRedirectUri=!1}}class Pr extends Dt{constructor(e,t,r,o,n,i,s,a,c,d){super(e,t,r,o,n,i,a,c,d),this.apiId=s}async acquireToken(r){if(this.logger.trace("SilentAuthCodeClient.acquireToken called"),!r.code)throw st.createAuthCodeRequiredError();this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,r.correlationId);const o=await this.initializeAuthorizationRequest(r,e.InteractionType.Silent);this.browserStorage.updateCacheEntries(o.state,o.nonce,o.authority,o.loginHint||t.EMPTY_STRING,o.account||null);const n=this.initializeServerTelemetryManager(this.apiId);try{const t={...o,code:r.code};this.performanceClient.setPreQueueTime(e.PerformanceEvents.StandardInteractionClientGetClientConfiguration,r.correlationId);const i=await this.getClientConfiguration(n,o.authority),s=new br(i);this.logger.verbose("Auth code client created");return new er(s,this.browserStorage,t,this.logger,this.config.system,this.performanceClient).handleCodeResponseFromServer({code:r.code,msgraph_host:r.msGraphHost,cloud_graph_host_name:r.cloudGraphHostName,cloud_instance_host_name:r.cloudInstanceHostName},o.state,s.authority,this.networkClient,!1)}catch(e){throw e instanceof D&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),this.browserStorage.cleanRequestByState(o.state),e}}logout(){return Promise.reject(st.createSilentLogoutUnsupportedError())}}class Nr{constructor(t){this.atsAsyncMeasurement=void 0,this.operatingContext=t,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=t.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.isBrowserEnvironment?new Ir(this.config.auth.clientId,this.config.auth.authority,this.logger,Mt,Ot,this.config.telemetry.application,this.config.system.cryptoOptions):new nt(this.config.auth.clientId,this.config.auth.authority,this.logger,Mt,Ot,this.config.telemetry.application),this.browserCrypto=this.isBrowserEnvironment?new Tr(this.logger,this.performanceClient,this.config.system.cryptoOptions):K,this.eventHandler=new or(this.logger,this.browserCrypto),this.browserStorage=this.isBrowserEnvironment?new Nt(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger):((t,r)=>{const o={cacheLocation:e.BrowserCacheLocation.MemoryStorage,temporaryCacheLocation:e.BrowserCacheLocation.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1};return new Nt(t,o,K,r)})(this.config.auth.clientId,this.logger);const r={cacheLocation:e.BrowserCacheLocation.MemoryStorage,temporaryCacheLocation:e.BrowserCacheLocation.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1};this.nativeInternalStorage=new Nt(this.config.auth.clientId,r,this.browserCrypto,this.logger),this.tokenCache=new Rr(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e){const t=new Nr(e);return t.initialize(),t}trackPageVisibility(){this.atsAsyncMeasurement&&(this.logger.info("Perf: Visibility change detected"),this.atsAsyncMeasurement.increment({visibilityChangeCount:1}))}async initialize(){if(this.logger.trace("initialize called"),this.initialized)return void this.logger.info("initialize has already been called, exiting early.");const t=this.config.system.allowNativeBroker,r=this.performanceClient.startMeasurement(e.PerformanceEvents.InitializeClientApplication);if(this.eventHandler.emitEvent(e.EventType.INITIALIZE_START),t)try{this.nativeExtensionProvider=await Wt.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient,this.browserCrypto)}catch(e){this.logger.verbose(e)}this.initialized=!0,this.eventHandler.emitEvent(e.EventType.INITIALIZE_END),r.endMeasurement({allowNativeBroker:t,success:!0})}async handleRedirectPromise(r){this.logger.verbose("handleRedirectPromise called"),Lt.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized);const o=this.getAllAccounts();if(this.isBrowserEnvironment){const n=r||t.EMPTY_STRING;let i=this.redirectResponse.get(n);if(void 0===i){this.eventHandler.emitEvent(e.EventType.HANDLE_REDIRECT_START,e.InteractionType.Redirect),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");const s=this.browserStorage.getCachedNativeRequest();let a;if(s&&Wt.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!r){this.logger.trace("handleRedirectPromise - acquiring token from native platform");a=new jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,e.ApiId.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,s.accountId,this.nativeInternalStorage,s.correlationId).handleRedirectPromise()}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const e=this.browserStorage.getTemporaryCache(gt.CORRELATION_ID,!0)||t.EMPTY_STRING;a=this.createRedirectClient(e).handleRedirectPromise(r)}i=a.then((t=>{if(t){o.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(e.EventType.LOGIN_SUCCESS,e.InteractionType.Redirect,t),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_SUCCESS,e.InteractionType.Redirect,t),this.logger.verbose("handleRedirectResponse returned result, acquire token success"))}return this.eventHandler.emitEvent(e.EventType.HANDLE_REDIRECT_END,e.InteractionType.Redirect),t})).catch((t=>{throw o.length>0?this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_FAILURE,e.InteractionType.Redirect,null,t):this.eventHandler.emitEvent(e.EventType.LOGIN_FAILURE,e.InteractionType.Redirect,null,t),this.eventHandler.emitEvent(e.EventType.HANDLE_REDIRECT_END,e.InteractionType.Redirect),t})),this.redirectResponse.set(n,i)}else this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call");return i}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async acquireTokenRedirect(t){const r=this.getRequestCorrelationId(t);this.logger.verbose("acquireTokenRedirect called",r),this.preflightBrowserEnvironmentCheck(e.InteractionType.Redirect);const o=this.getAllAccounts().length>0;let n;if(o?this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_START,e.InteractionType.Redirect,t):this.eventHandler.emitEvent(e.EventType.LOGIN_START,e.InteractionType.Redirect,t),this.nativeExtensionProvider&&this.canUseNative(t)){n=new jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,e.ApiId.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(t),this.nativeInternalStorage,t.correlationId).acquireTokenRedirect(t).catch((e=>{if(e instanceof Qt&&e.isFatal()){this.nativeExtensionProvider=void 0;return this.createRedirectClient(t.correlationId).acquireToken(t)}if(e instanceof Ae){this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");return this.createRedirectClient(t.correlationId).acquireToken(t)}throw this.browserStorage.setInteractionInProgress(!1),e}))}else{n=this.createRedirectClient(t.correlationId).acquireToken(t)}return n.catch((t=>{throw o?this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_FAILURE,e.InteractionType.Redirect,null,t):this.eventHandler.emitEvent(e.EventType.LOGIN_FAILURE,e.InteractionType.Redirect,null,t),t}))}acquireTokenPopup(t){const r=this.getRequestCorrelationId(t),o=this.performanceClient.startMeasurement(e.PerformanceEvents.AcquireTokenPopup,r);try{this.logger.verbose("acquireTokenPopup called",r),this.preflightBrowserEnvironmentCheck(e.InteractionType.Popup)}catch(e){return Promise.reject(e)}const n=this.getAllAccounts();let i;if(n.length>0?this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_START,e.InteractionType.Popup,t):this.eventHandler.emitEvent(e.EventType.LOGIN_START,e.InteractionType.Popup,t),this.canUseNative(t))i=this.acquireTokenNative(t,e.ApiId.acquireTokenPopup).then((e=>(this.browserStorage.setInteractionInProgress(!1),o.endMeasurement({success:!0,isNativeBroker:!0,requestId:e.requestId}),e))).catch((e=>{if(e instanceof Qt&&e.isFatal()){this.nativeExtensionProvider=void 0;return this.createPopupClient(t.correlationId).acquireToken(t)}if(e instanceof Ae){this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");return this.createPopupClient(t.correlationId).acquireToken(t)}throw this.browserStorage.setInteractionInProgress(!1),e}));else{i=this.createPopupClient(t.correlationId).acquireToken(t)}return i.then((t=>(n.length<this.getAllAccounts().length?this.eventHandler.emitEvent(e.EventType.LOGIN_SUCCESS,e.InteractionType.Popup,t):this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_SUCCESS,e.InteractionType.Popup,t),o.addStaticFields({accessTokenSize:t.accessToken.length,idTokenSize:t.idToken.length}),o.endMeasurement({success:!0,requestId:t.requestId}),t))).catch((t=>(n.length>0?this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_FAILURE,e.InteractionType.Popup,null,t):this.eventHandler.emitEvent(e.EventType.LOGIN_FAILURE,e.InteractionType.Popup,null,t),o.endMeasurement({errorCode:t.errorCode,subErrorCode:t.subError,success:!1}),Promise.reject(t))))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(t){const r=this.getRequestCorrelationId(t),o={...t,prompt:t.prompt,correlationId:r};let n;if(this.preflightBrowserEnvironmentCheck(e.InteractionType.Silent),this.ssoSilentMeasurement=this.performanceClient.startMeasurement(e.PerformanceEvents.SsoSilent,r),this.ssoSilentMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",r),this.eventHandler.emitEvent(e.EventType.SSO_SILENT_START,e.InteractionType.Silent,o),this.canUseNative(o))n=this.acquireTokenNative(o,e.ApiId.ssoSilent).catch((e=>{if(e instanceof Qt&&e.isFatal()){this.nativeExtensionProvider=void 0;return this.createSilentIframeClient(o.correlationId).acquireToken(o)}throw e}));else{n=this.createSilentIframeClient(o.correlationId).acquireToken(o)}return n.then((t=>(this.eventHandler.emitEvent(e.EventType.SSO_SILENT_SUCCESS,e.InteractionType.Silent,t),this.ssoSilentMeasurement?.addStaticFields({accessTokenSize:t.accessToken.length,idTokenSize:t.idToken.length}),this.ssoSilentMeasurement?.endMeasurement({success:!0,isNativeBroker:t.fromNativeBroker,requestId:t.requestId}),t))).catch((t=>{throw this.eventHandler.emitEvent(e.EventType.SSO_SILENT_FAILURE,e.InteractionType.Silent,null,t),this.ssoSilentMeasurement?.endMeasurement({errorCode:t.errorCode,subErrorCode:t.subError,success:!1}),t})).finally((()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)}))}async acquireTokenByCode(t){const r=this.getRequestCorrelationId(t);this.preflightBrowserEnvironmentCheck(e.InteractionType.Silent),this.logger.trace("acquireTokenByCode called",r),this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_BY_CODE_START,e.InteractionType.Silent,t);const o=this.performanceClient.startMeasurement(e.PerformanceEvents.AcquireTokenByCode,t.correlationId);try{if(t.code&&t.nativeAccountId)throw st.createSpaCodeAndNativeAccountIdPresentError();if(t.code){const n=t.code;let i=this.hybridAuthCodeResponses.get(n);return i?(this.logger.verbose("Existing acquireTokenByCode request found",t.correlationId),o.discardMeasurement()):(this.logger.verbose("Initiating new acquireTokenByCode request",r),i=this.acquireTokenByCodeAsync({...t,correlationId:r}).then((t=>(this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS,e.InteractionType.Silent,t),this.hybridAuthCodeResponses.delete(n),o.addStaticFields({accessTokenSize:t.accessToken.length,idTokenSize:t.idToken.length}),o.endMeasurement({success:!0,isNativeBroker:t.fromNativeBroker,requestId:t.requestId}),t))).catch((t=>{throw this.hybridAuthCodeResponses.delete(n),this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE,e.InteractionType.Silent,null,t),o.endMeasurement({errorCode:t.errorCode,subErrorCode:t.subError,success:!1}),t})),this.hybridAuthCodeResponses.set(n,i)),i}if(t.nativeAccountId){if(this.canUseNative(t,t.nativeAccountId))return this.acquireTokenNative(t,e.ApiId.acquireTokenByCode,t.nativeAccountId).catch((e=>{throw e instanceof Qt&&e.isFatal()&&(this.nativeExtensionProvider=void 0),e}));throw st.createUnableToAcquireTokenFromNativePlatformError()}throw st.createAuthCodeOrNativeAccountIdRequiredError()}catch(t){throw this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE,e.InteractionType.Silent,null,t),o.endMeasurement({errorCode:t instanceof D&&t.errorCode||void 0,subErrorCode:t instanceof D&&t.subError||void 0,success:!1}),t}}async acquireTokenByCodeAsync(t){this.logger.trace("acquireTokenByCodeAsync called",t.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(e.PerformanceEvents.AcquireTokenByCodeAsync,t.correlationId),this.acquireTokenByCodeAsyncMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement);const r=this.createSilentAuthCodeClient(t.correlationId);return await r.acquireToken(t).then((e=>(this.acquireTokenByCodeAsyncMeasurement?.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,requestId:e.requestId}),e))).catch((e=>{throw this.acquireTokenByCodeAsyncMeasurement?.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e})).finally((()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)}))}async acquireTokenFromCache(t,r,o){switch(this.performanceClient.addQueueMeasurement(e.PerformanceEvents.AcquireTokenFromCache,r.correlationId),o.cacheLookupPolicy){case e.CacheLookupPolicy.Default:case e.CacheLookupPolicy.AccessToken:case e.CacheLookupPolicy.AccessTokenAndRefreshToken:return t.acquireToken(r);default:throw x.createRefreshRequiredError()}}async acquireTokenByRefreshToken(t,r){switch(this.performanceClient.addQueueMeasurement(e.PerformanceEvents.AcquireTokenByRefreshToken,t.correlationId),r.cacheLookupPolicy){case e.CacheLookupPolicy.Default:case e.CacheLookupPolicy.AccessTokenAndRefreshToken:case e.CacheLookupPolicy.RefreshToken:case e.CacheLookupPolicy.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(t.correlationId);return this.performanceClient.setPreQueueTime(e.PerformanceEvents.SilentRefreshClientAcquireToken,t.correlationId),r.acquireToken(t);default:throw x.createRefreshRequiredError()}}async acquireTokenBySilentIframe(t){this.performanceClient.addQueueMeasurement(e.PerformanceEvents.AcquireTokenBySilentIframe,t.correlationId);const r=this.createSilentIframeClient(t.correlationId);return this.performanceClient.setPreQueueTime(e.PerformanceEvents.SilentIframeClientAcquireToken,t.correlationId),r.acquireToken(t)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(t){const r=this.getRequestCorrelationId(t);this.preflightBrowserEnvironmentCheck(e.InteractionType.Redirect);return this.createRedirectClient(r).logout(t)}logoutPopup(t){try{const r=this.getRequestCorrelationId(t);this.preflightBrowserEnvironmentCheck(e.InteractionType.Popup);return this.createPopupClient(r).logout(t)}catch(e){return Promise.reject(e)}}getAllAccounts(){return this.logger.verbose("getAllAccounts called"),this.isBrowserEnvironment?this.browserStorage.getAllAccounts():[]}getAccountByUsername(e){if(this.logger.trace("getAccountByUsername called"),!e)return this.logger.warning("getAccountByUsername: No username provided"),null;const t=this.browserStorage.getAccountInfoFilteredBy({username:e});return t?(this.logger.verbose("getAccountByUsername: Account matching username found, returning"),this.logger.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${e}`),t):(this.logger.verbose("getAccountByUsername: No matching account found, returning null"),null)}getAccountByHomeId(e){if(this.logger.trace("getAccountByHomeId called"),!e)return this.logger.warning("getAccountByHomeId: No homeAccountId provided"),null;const t=this.browserStorage.getAccountInfoFilteredBy({homeAccountId:e});return t?(this.logger.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),this.logger.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${e}`),t):(this.logger.verbose("getAccountByHomeId: No matching account found, returning null"),null)}getAccountByLocalId(e){if(this.logger.trace("getAccountByLocalId called"),!e)return this.logger.warning("getAccountByLocalId: No localAccountId provided"),null;const t=this.browserStorage.getAccountInfoFilteredBy({localAccountId:e});return t?(this.logger.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),this.logger.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${e}`),t):(this.logger.verbose("getAccountByLocalId: No matching account found, returning null"),null)}setActiveAccount(e){this.browserStorage.setActiveAccount(e)}getActiveAccount(){return this.browserStorage.getActiveAccount()}preflightBrowserEnvironmentCheck(t,r=!0){if(this.logger.verbose("preflightBrowserEnvironmentCheck started"),Lt.blockNonBrowserEnvironment(this.isBrowserEnvironment),Lt.blockRedirectInIframe(t,this.config.system.allowRedirectInIframe),Lt.blockReloadInHiddenIframes(),Lt.blockAcquireTokenInPopups(),Lt.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),t===e.InteractionType.Redirect&&this.config.cache.cacheLocation===e.BrowserCacheLocation.MemoryStorage&&!this.config.cache.storeAuthStateInCookie)throw kt.createInMemoryRedirectUnavailableError();t!==e.InteractionType.Redirect&&t!==e.InteractionType.Popup||this.preflightInteractiveRequest(r)}preflightInteractiveRequest(e){this.logger.verbose("preflightInteractiveRequest called, validating app environment"),Lt.blockReloadInHiddenIframes(),e&&this.browserStorage.setInteractionInProgress(!0)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw st.createNativeConnectionNotEstablishedError();return new jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Wt.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case d.NONE:case d.CONSENT:case d.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!(!t&&!this.getNativeAccountId(e))||(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1)}getNativeAccountId(e){const t=e.account||this.browserStorage.getAccountInfoByHints(e.loginHint,e.sid)||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new Jt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new Vt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(t){return new tr(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,e.ApiId.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,t)}createSilentCacheClient(e){return new Yt(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new rr(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(t){return new Pr(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,e.ApiId.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,t)}addEventCallback(e){return this.eventHandler.addEventCallback(e)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){this.eventHandler.enableAccountStorageEvents()}disableAccountStorageEvents(){this.eventHandler.disableAccountStorageEvents()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}getBrowserStorage(){return this.browserStorage}getNativeInternalStorage(){return this.nativeInternalStorage}getBrowserCrypto(){return this.browserCrypto}isBrowserEnv(){return this.isBrowserEnvironment}getNativeExtensionProvider(){return this.nativeExtensionProvider}setNativeExtensionProvider(e){this.nativeExtensionProvider=e}getEventHandler(){return this.eventHandler}getNavigationClient(){return this.navigationClient}getRedirectResponse(){return this.redirectResponse}getRequestCorrelationId(e){return e?.correlationId?e.correlationId:this.isBrowserEnvironment?this.browserCrypto.createNewGuid():t.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||Tt})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||Tt})}async acquireTokenSilent(r){const o=this.getRequestCorrelationId(r),n=this.performanceClient.startMeasurement(e.PerformanceEvents.AcquireTokenSilent,o);n.addStaticFields({cacheLookupPolicy:r.cacheLookupPolicy}),this.preflightBrowserEnvironmentCheck(e.InteractionType.Silent),this.logger.verbose("acquireTokenSilent called",o);const i=r.account||this.getActiveAccount();if(!i)throw st.createNoAccountError();const s={clientId:this.config.auth.clientId,authority:r.authority||t.EMPTY_STRING,scopes:r.scopes,homeAccountIdentifier:i.homeAccountId,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},a=JSON.stringify(s),c=this.activeSilentTokenRequests.get(a);if(void 0===c){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",o),this.performanceClient.setPreQueueTime(e.PerformanceEvents.AcquireTokenSilentAsync,o);const t=this.acquireTokenSilentAsync({...r,correlationId:o},i).then((e=>(this.activeSilentTokenRequests.delete(a),n.addStaticFields({accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length}),n.endMeasurement({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker,cacheLookupPolicy:r.cacheLookupPolicy,requestId:e.requestId}),e))).catch((e=>{throw this.activeSilentTokenRequests.delete(a),n.endMeasurement({errorCode:e.errorCode,subErrorCode:e.subError,success:!1}),e}));return this.activeSilentTokenRequests.set(a,t),t}return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",o),n.discardMeasurement(),c}async acquireTokenSilentAsync(t,r){let o;if(this.performanceClient.addQueueMeasurement(e.PerformanceEvents.AcquireTokenSilentAsync,t.correlationId),this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_START,e.InteractionType.Silent,t),this.atsAsyncMeasurement=this.performanceClient.startMeasurement(e.PerformanceEvents.AcquireTokenSilentAsync,t.correlationId),this.atsAsyncMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibility),Wt.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,t.authenticationScheme)&&r.nativeAccountId){this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");const n={...t,account:r};o=this.acquireTokenNative(n,e.ApiId.acquireTokenSilent_silentFlow).catch((async e=>{if(e instanceof Qt&&e.isFatal()){this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0;return this.createSilentIframeClient(t.correlationId).acquireToken(t)}throw e}))}else{this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");const n=this.createSilentCacheClient(t.correlationId);this.performanceClient.setPreQueueTime(e.PerformanceEvents.InitializeSilentRequest,t.correlationId);const i=await n.initializeSilentRequest(t,r),s={...t,cacheLookupPolicy:t.cacheLookupPolicy||e.CacheLookupPolicy.Default};this.performanceClient.setPreQueueTime(e.PerformanceEvents.AcquireTokenFromCache,i.correlationId),o=this.acquireTokenFromCache(n,i,s).catch((r=>{if(s.cacheLookupPolicy===e.CacheLookupPolicy.AccessToken)throw r;return Lt.blockReloadInHiddenIframes(),this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_NETWORK_START,e.InteractionType.Silent,i),this.performanceClient.setPreQueueTime(e.PerformanceEvents.AcquireTokenByRefreshToken,i.correlationId),this.acquireTokenByRefreshToken(i,s).catch((r=>{const o=r instanceof he,n=r instanceof Ae,a=r.errorCode===at.INVALID_GRANT_ERROR;if((!o||!a||n||s.cacheLookupPolicy===e.CacheLookupPolicy.AccessTokenAndRefreshToken||s.cacheLookupPolicy===e.CacheLookupPolicy.RefreshToken)&&s.cacheLookupPolicy!==e.CacheLookupPolicy.Skip)throw r;return this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",t.correlationId),this.performanceClient.setPreQueueTime(e.PerformanceEvents.AcquireTokenBySilentIframe,i.correlationId),this.acquireTokenBySilentIframe(i)}))}))}return o.then((t=>(this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_SUCCESS,e.InteractionType.Silent,t),this.atsAsyncMeasurement?.endMeasurement({success:!0,fromCache:t.fromCache,isNativeBroker:t.fromNativeBroker,requestId:t.requestId}),t))).catch((t=>{throw this.eventHandler.emitEvent(e.EventType.ACQUIRE_TOKEN_FAILURE,e.InteractionType.Silent,null,t),this.atsAsyncMeasurement?.endMeasurement({errorCode:t.errorCode,subErrorCode:t.subError,success:!1}),t})).finally((()=>{document.removeEventListener("visibilitychange",this.trackPageVisibility)}))}}var Mr=Object.freeze({__proto__:null,StandardController:Nr});class Or{static async createPublicClientApplication(e){const t=new kr(e),r=await t.createController();return new Or(e,r)}constructor(e,t){if(t)this.controller=t;else{const t=new Ar(e);this.controller=new Nr(t)}}async initialize(){return this.controller.initialize()}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e){return this.controller.addEventCallback(e)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(){return this.controller.getAllAccounts()}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}}const qr={initialize:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),acquireTokenPopup:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),acquireTokenRedirect:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),acquireTokenSilent:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),acquireTokenByCode:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),getAllAccounts:()=>[],getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),loginPopup:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),loginRedirect:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),logout:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),logoutRedirect:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),logoutPopup:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),ssoSilent:()=>Promise.reject(kt.createStubPcaInstanceCalledError()),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw kt.createStubPcaInstanceCalledError()},getLogger:()=>{throw kt.createStubPcaInstanceCalledError()},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw kt.createStubPcaInstanceCalledError()}};e.AccountEntity=ee,e.AuthError=D,e.AuthErrorMessage=H,e.AuthenticationHeaderParser=class{constructor(e){this.headers=e}getShrNonce(){const e=this.headers[n.AuthenticationInfo];if(e){const t=this.parseChallenges(e);if(t.nextnonce)return t.nextnonce;throw W.createInvalidAuthenticationHeaderError(n.AuthenticationInfo,"nextnonce challenge is missing.")}const t=this.headers[n.WWWAuthenticate];if(t){const e=this.parseChallenges(t);if(e.nonce)return e.nonce;throw W.createInvalidAuthenticationHeaderError(n.WWWAuthenticate,"nonce challenge is missing.")}throw W.createMissingNonceAuthenticationHeadersError()}parseChallenges(e){const r=e.indexOf(" "),o=e.substr(r+1).split(","),n={};return o.forEach((e=>{const[r,o]=e.split("=");n[r]=unescape(o.replace(/['"]+/g,t.EMPTY_STRING))})),n}},e.BrowserAuthError=st,e.BrowserAuthErrorMessage=it,e.BrowserConfigurationAuthError=kt,e.BrowserConfigurationAuthErrorMessage=At,e.BrowserUtils=Lt,e.ClientAuthError=x,e.ClientAuthErrorMessage=F,e.ClientConfigurationError=W,e.ClientConfigurationErrorMessage=j,e.DEFAULT_IFRAME_TIMEOUT_MS=Zt,e.EventMessageUtils=class{static getInteractionStatusFromEvent(t,r){switch(t.eventType){case e.EventType.LOGIN_START:return e.InteractionStatus.Login;case e.EventType.SSO_SILENT_START:return e.InteractionStatus.SsoSilent;case e.EventType.ACQUIRE_TOKEN_START:if(t.interactionType===e.InteractionType.Redirect||t.interactionType===e.InteractionType.Popup)return e.InteractionStatus.AcquireToken;break;case e.EventType.HANDLE_REDIRECT_START:return e.InteractionStatus.HandleRedirect;case e.EventType.LOGOUT_START:return e.InteractionStatus.Logout;case e.EventType.SSO_SILENT_SUCCESS:case e.EventType.SSO_SILENT_FAILURE:if(r&&r!==e.InteractionStatus.SsoSilent)break;return e.InteractionStatus.None;case e.EventType.LOGOUT_END:if(r&&r!==e.InteractionStatus.Logout)break;return e.InteractionStatus.None;case e.EventType.HANDLE_REDIRECT_END:if(r&&r!==e.InteractionStatus.HandleRedirect)break;return e.InteractionStatus.None;case e.EventType.LOGIN_SUCCESS:case e.EventType.LOGIN_FAILURE:case e.EventType.ACQUIRE_TOKEN_SUCCESS:case e.EventType.ACQUIRE_TOKEN_FAILURE:if(t.interactionType===e.InteractionType.Redirect||t.interactionType===e.InteractionType.Popup){if(r&&r!==e.InteractionStatus.Login&&r!==e.InteractionStatus.AcquireToken)break;return e.InteractionStatus.None}}return null}},e.InteractionRequiredAuthError=Ae,e.InteractionRequiredAuthErrorMessage=Se,e.Logger=$,e.NavigationClient=Xt,e.OIDC_DEFAULT_SCOPES=r,e.PublicClientApplication=Or,e.ServerError=he,e.SignedHttpRequest=class{constructor(e,t){const r=t&&t.loggerOptions||{};this.logger=new $(r,Mt,Ot),this.cryptoOps=new Tr(this.logger),this.popTokenGenerator=new qe(this.cryptoOps),this.shrParameters=e}async generatePublicKeyThumbprint(){const{kid:e}=await this.popTokenGenerator.generateKid(this.shrParameters);return e}async signRequest(e,t,r){return this.popTokenGenerator.signPayload(e,t,this.shrParameters,r)}async removeKeys(e){return await this.cryptoOps.removeTokenBindingKey(e)}},e.StringUtils=B,e.UrlString=be,e.internals=_r,e.stubbedPublicClientApplication=qr,e.version=Ot}));
|