@equinor/fusion-framework-cli 1.2.4 → 1.2.5
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.
|
@@ -12,7 +12,7 @@ Error generating stack: `+o.message+`
|
|
|
12
12
|
Error: `+s.errorCode+`
|
|
13
13
|
Error Description: `+s.errorMessage):(c=s,this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.
|
|
14
14
|
Error: `+c.name+`
|
|
15
|
-
Error Description: `+c.message)),[2,null];case 4: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=t.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),[2,n]}})})},t.prototype.getCloudDiscoveryMetadataFromHarcodedValues=function(){return this.canonicalAuthority in im?im[this.canonicalAuthority]:null},t.prototype.isInKnownAuthorities=function(){var e=this,r=this.authorityOptions.knownAuthorities.filter(function(n){return ge.getDomainFromUrl(n).toLowerCase()===e.hostnameAndPort});return r.length>0},t.generateAuthority=function(e,r){var n;if(r&&r.azureCloudInstance!==dc.None){var i=r.tenant?r.tenant:_.DEFAULT_COMMON_TENANT;n=r.azureCloudInstance+"/"+i+"/"}return n||e},t.createCloudDiscoveryMetadataFromHost=function(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}},t.getCloudDiscoveryMetadataFromNetworkResponse=function(e,r){for(var n=0;n<e.length;n++){var i=e[n];if(i.aliases.indexOf(r)>-1)return i}return null},t.prototype.getPreferredCache=function(){if(this.discoveryComplete())return this.metadata.preferred_cache;throw j.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},t.prototype.isAlias=function(e){return this.metadata.aliases.indexOf(e)>-1},t.isPublicCloudAuthority=function(e){return _.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0},t.buildRegionalAuthorityString=function(e,r,n){var i=new ge(e);i.validateAsUri();var o=i.getUrlComponents(),a=r+"."+o.HostNameAndPort;this.isPublicCloudAuthority(o.HostNameAndPort)&&(a=r+"."+_.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX);var s=ge.constructAuthorityUriFromObject(Me(Me({},i.getUrlComponents()),{HostNameAndPort:a})).urlString;return n?s+"?"+n:s},t.replaceWithRegionalInformation=function(e,r){return e.authorization_endpoint=t.buildRegionalAuthorityString(e.authorization_endpoint,r),e.token_endpoint=t.buildRegionalAuthorityString(e.token_endpoint,r,_.REGIONAL_AUTH_NON_MSI_QUERY_STRING),e.end_session_endpoint&&(e.end_session_endpoint=t.buildRegionalAuthorityString(e.end_session_endpoint,r)),e},t}();var Bd=function(){function t(){}return t.createDiscoveredInstance=function(e,r,n,i,o,a){return J(this,void 0,void 0,function(){var s,c;return Z(this,function(l){switch(l.label){case 0:s=t.createInstance(e,r,n,i,o,a),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,s.resolveEndpointsAsync()];case 2:return l.sent(),[2,s];case 3:throw c=l.sent(),j.createEndpointDiscoveryIncompleteError(c);case 4:return[2]}})})},t.createInstance=function(e,r,n,i,o,a){if(V.isEmpty(e))throw Ne.createUrlEmptyError();return new jd(e,r,n,i,o,a)},t}();var qd=function(){function t(){this.failedRequests=[],this.errors=[],this.cacheHits=0}return t.isServerTelemetryEntity=function(e,r){var n=e.indexOf(wt.CACHE_KEY)===0,i=!0;return r&&(i=r.hasOwnProperty("failedRequests")&&r.hasOwnProperty("errors")&&r.hasOwnProperty("cacheHits")),n&&i},t}();var om=function(){function t(){}return t.isThrottlingEntity=function(e,r){var n=!1;e&&(n=e.indexOf(Us.THROTTLING_PREFIX)===0);var i=!0;return r&&(i=r.hasOwnProperty("throttleTime")),n&&i},t}();var g_={sendGetRequestAsync:function(){var t="Network interface - sendGetRequestAsync() has not been implemented for the Network interface.";return Promise.reject(W.createUnexpectedError(t))},sendPostRequestAsync:function(){var t="Network interface - sendPostRequestAsync() has not been implemented for the Network interface.";return Promise.reject(W.createUnexpectedError(t))}};var fl={missingKidError:{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."},missingAlgError:{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."}},am=function(t){br(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.name="JoseHeaderError",Object.setPrototypeOf(i,e.prototype),i}return e.createMissingKidError=function(){return new e(fl.missingKidError.code,fl.missingKidError.desc)},e.createMissingAlgError=function(){return new e(fl.missingAlgError.code,fl.missingAlgError.desc)},e}(W);var y_=function(){function t(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}return t.getShrHeaderString=function(e){if(!e.kid)throw am.createMissingKidError();if(!e.alg)throw am.createMissingAlgError();var r=new t({typ:e.typ||a2.Jwt,kid:e.kid,alg:e.alg});return JSON.stringify(r)},t}();var __=function(){function t(e,r){this.cacheOutcome=lo.NO_CACHE_HIT,this.cacheManager=r,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||_.EMPTY_STRING,this.wrapperVer=e.wrapperVer||_.EMPTY_STRING,this.telemetryCacheKey=wt.CACHE_KEY+Tr.CACHE_KEY_SEPARATOR+e.clientId}return t.prototype.generateCurrentRequestHeaderValue=function(){var e=""+this.apiId+wt.VALUE_SEPARATOR+this.cacheOutcome,r=[this.wrapperSKU,this.wrapperVer].join(wt.VALUE_SEPARATOR),n=this.getRegionDiscoveryFields(),i=[e,n].join(wt.VALUE_SEPARATOR);return[wt.SCHEMA_VERSION,i,r].join(wt.CATEGORY_SEPARATOR)},t.prototype.generateLastRequestHeaderValue=function(){var e=this.getLastRequests(),r=t.maxErrorsToSend(e),n=e.failedRequests.slice(0,2*r).join(wt.VALUE_SEPARATOR),i=e.errors.slice(0,r).join(wt.VALUE_SEPARATOR),o=e.errors.length,a=r<o?wt.OVERFLOW_TRUE:wt.OVERFLOW_FALSE,s=[o,a].join(wt.VALUE_SEPARATOR);return[wt.SCHEMA_VERSION,e.cacheHits,n,i,s].join(wt.CATEGORY_SEPARATOR)},t.prototype.cacheFailedRequest=function(e){var r=this.getLastRequests();r.errors.length>=wt.MAX_CACHED_ERRORS&&(r.failedRequests.shift(),r.failedRequests.shift(),r.errors.shift()),r.failedRequests.push(this.apiId,this.correlationId),V.isEmpty(e.subError)?V.isEmpty(e.errorCode)?!!e&&e.toString()?r.errors.push(e.toString()):r.errors.push(wt.UNKNOWN_ERROR):r.errors.push(e.errorCode):r.errors.push(e.subError),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,r)},t.prototype.incrementCacheHits=function(){var e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits},t.prototype.getLastRequests=function(){var e=new qd,r=this.cacheManager.getServerTelemetry(this.telemetryCacheKey);return r||e},t.prototype.clearTelemetryCache=function(){var e=this.getLastRequests(),r=t.maxErrorsToSend(e),n=e.errors.length;if(r===n)this.cacheManager.removeItem(this.telemetryCacheKey);else{var i=new qd;i.failedRequests=e.failedRequests.slice(r*2),i.errors=e.errors.slice(r),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i)}},t.maxErrorsToSend=function(e){var r,n=0,i=0,o=e.errors.length;for(r=0;r<o;r++){var a=e.failedRequests[2*r]||_.EMPTY_STRING,s=e.failedRequests[2*r+1]||_.EMPTY_STRING,c=e.errors[r]||_.EMPTY_STRING;if(i+=a.toString().length+s.toString().length+c.length+3,i<wt.MAX_LAST_HEADER_BYTES)n+=1;else break}return n},t.prototype.getRegionDiscoveryFields=function(){var e=[];return e.push(this.regionUsed||_.EMPTY_STRING),e.push(this.regionSource||_.EMPTY_STRING),e.push(this.regionOutcome||_.EMPTY_STRING),e.join(",")},t.prototype.updateRegionDiscoveryMetadata=function(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome},t.prototype.setCacheOutcome=function(e){this.cacheOutcome=e},t}();var o3=function(){function t(e,r,n,i,o,a){this.authority=r,this.libraryName=i,this.libraryVersion=o,this.applicationTelemetry=a,this.clientId=e,this.logger=n,this.callbacks=new Map,this.eventsByCorrelationId=new Map,this.staticFieldsByCorrelationId=new Map,this.measurementsById=new Map}return t.prototype.startMeasurement=function(e,r){var n=this,i,o,a=r||this.generateId();r||this.logger.info("PerformanceClient: No correlation id provided for "+e+", generating",a),this.logger.trace("PerformanceClient: Performance measurement started for "+e,a);var s=this.startPerformanceMeasuremeant(e,a);s.startMeasurement();var c={eventId:this.generateId(),status:da.InProgress,authority:this.authority,libraryName:this.libraryName,libraryVersion:this.libraryVersion,clientId:this.clientId,name:e,startTimeMs:Date.now(),correlationId:a};this.cacheEventByCorrelationId(c);var l={appName:(i=this.applicationTelemetry)===null||i===void 0?void 0:i.appName,appVersion:(o=this.applicationTelemetry)===null||o===void 0?void 0:o.appVersion};return this.addStaticFields(l,a),this.cacheMeasurement(c,s),{endMeasurement:function(d){var h=n.endMeasurement(Me(Me({},c),d));return h&&n.cacheEventByCorrelationId(h),h},flushMeasurement:function(){return n.flushMeasurements(c.name,c.correlationId)},discardMeasurement:function(){return n.discardMeasurements(c.correlationId)},addStaticFields:function(d){return n.addStaticFields(d,c.correlationId)},measurement:s,event:c}},t.prototype.endMeasurement=function(e){var r=this.measurementsById.get(e.eventId);if(r){this.measurementsById.delete(e.eventId),r.endMeasurement();var n=r.flushMeasurement();if(n!==null){this.logger.trace("PerformanceClient: Performance measurement ended for "+e.name+": "+n+" ms",e.correlationId);var i=Me(Me({durationMs:Math.round(n)},e),{status:da.Completed});return i}else this.logger.trace("PerformanceClient: Performance measurement not taken",e.correlationId)}else this.logger.trace("PerformanceClient: Measurement not found for "+e.eventId,e.correlationId);return null},t.prototype.addStaticFields=function(e,r){var n=this.staticFieldsByCorrelationId.get(r);n?(this.logger.trace("PerformanceClient: Updating static fields"),this.staticFieldsByCorrelationId.set(r,Me(Me({},n),e))):(this.logger.trace("PerformanceClient: Adding static fields"),this.staticFieldsByCorrelationId.set(r,e))},t.prototype.cacheEventByCorrelationId=function(e){var r=this.eventsByCorrelationId.get(e.correlationId);r?(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" added/updated",e.correlationId),r.set(e.eventId,e)):(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" started",e.correlationId),this.eventsByCorrelationId.set(e.correlationId,new Map().set(e.eventId,e)))},t.prototype.cacheMeasurement=function(e,r){this.measurementsById.set(e.eventId,r)},t.prototype.flushMeasurements=function(e,r){var n=this;this.logger.trace("PerformanceClient: Performance measurements flushed for "+e,r);var i=this.eventsByCorrelationId.get(r);if(i){this.discardMeasurements(r);var o=[];i.forEach(function(u){if(u.name!==e&&u.status!==da.Completed){n.logger.trace("PerformanceClient: Incomplete submeasurement "+u.name+" found for "+e,r);var f=n.endMeasurement(u);f&&o.push(f)}o.push(u)});var a=o.sort(function(u,f){return u.startTimeMs-f.startTimeMs}),s=a.filter(function(u){return u.name===e&&u.status===da.Completed});if(s.length>0){s.length>1&&this.logger.verbose("PerformanceClient: Multiple distinct top-level performance events found, using the first",r);var c=s[0];this.logger.verbose("PerformanceClient: Measurement found for "+e,r);var l=a.reduce(function(u,f){if(f.name!==e){n.logger.trace("PerformanceClient: Complete submeasurement found for "+f.name,r);var v=f.name+"DurationMs";u[v]?n.logger.verbose("PerformanceClient: Submeasurement for "+e+" already exists for "+f.name+", ignoring",r):u[v]=f.durationMs}return u},c),d=this.staticFieldsByCorrelationId.get(r),h=Me(Me({},l),d);this.emitEvents([h],l.correlationId)}else this.logger.verbose("PerformanceClient: No completed top-level measurements found for "+e,r)}else this.logger.verbose("PerformanceClient: No measurements found",r)},t.prototype.discardMeasurements=function(e){this.logger.trace("PerformanceClient: Performance measurements discarded",e),this.eventsByCorrelationId.delete(e)},t.prototype.addPerformanceCallback=function(e){var r=this.generateId();return this.callbacks.set(r,e),this.logger.verbose("PerformanceClient: Performance callback registered with id: "+r),r},t.prototype.removePerformanceCallback=function(e){var r=this.callbacks.delete(e);return r?this.logger.verbose("PerformanceClient: Performance callback "+e+" removed."):this.logger.verbose("PerformanceClient: Performance callback "+e+" not removed."),r},t.prototype.emitEvents=function(e,r){var n=this;this.logger.verbose("PerformanceClient: Emitting performance events",r),this.callbacks.forEach(function(i,o){n.logger.trace("PerformanceClient: Emitting event to callback "+o,r),i.apply(null,[e])})},t}();var b_=function(){function t(){}return t.prototype.startMeasurement=function(){},t.prototype.endMeasurement=function(){},t.prototype.flushMeasurement=function(){return null},t}(),w_=function(t){br(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.generateId=function(){return"callback-id"},e.prototype.startPerformanceMeasuremeant=function(){return new b_},e}(o3);var M={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."},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."}},D=function(t){It(e,t);function e(r,n){var i=t.call(this,r,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="BrowserAuthError",i}return e.createPkceNotGeneratedError=function(r){return new e(M.pkceNotGenerated.code,M.pkceNotGenerated.desc+" Detail:"+r)},e.createCryptoNotAvailableError=function(r){return new e(M.cryptoDoesNotExist.code,M.cryptoDoesNotExist.desc+" Detail:"+r)},e.createHttpMethodNotImplementedError=function(r){return new e(M.httpMethodNotImplementedError.code,M.httpMethodNotImplementedError.desc+" Given Method: "+r)},e.createEmptyNavigationUriError=function(){return new e(M.emptyNavigateUriError.code,M.emptyNavigateUriError.desc)},e.createEmptyHashError=function(r){return new e(M.hashEmptyError.code,M.hashEmptyError.desc+" Given Url: "+r)},e.createHashDoesNotContainStateError=function(){return new e(M.hashDoesNotContainStateError.code,M.hashDoesNotContainStateError.desc)},e.createHashDoesNotContainKnownPropertiesError=function(){return new e(M.hashDoesNotContainKnownPropertiesError.code,M.hashDoesNotContainKnownPropertiesError.desc)},e.createUnableToParseStateError=function(){return new e(M.unableToParseStateError.code,M.unableToParseStateError.desc)},e.createStateInteractionTypeMismatchError=function(){return new e(M.stateInteractionTypeMismatchError.code,M.stateInteractionTypeMismatchError.desc)},e.createInteractionInProgressError=function(){return new e(M.interactionInProgress.code,M.interactionInProgress.desc)},e.createPopupWindowError=function(r){var n=M.popupWindowError.desc;return n=V.isEmpty(r)?n:n+" Details: "+r,new e(M.popupWindowError.code,n)},e.createEmptyWindowCreatedError=function(){return new e(M.emptyWindowError.code,M.emptyWindowError.desc)},e.createUserCancelledError=function(){return new e(M.userCancelledError.code,M.userCancelledError.desc)},e.createMonitorPopupTimeoutError=function(){return new e(M.monitorPopupTimeoutError.code,M.monitorPopupTimeoutError.desc)},e.createMonitorIframeTimeoutError=function(){return new e(M.monitorIframeTimeoutError.code,M.monitorIframeTimeoutError.desc)},e.createRedirectInIframeError=function(r){return new e(M.redirectInIframeError.code,M.redirectInIframeError.desc+" (window.parent !== window) => "+r)},e.createBlockReloadInHiddenIframeError=function(){return new e(M.blockTokenRequestsInHiddenIframeError.code,M.blockTokenRequestsInHiddenIframeError.desc)},e.createBlockAcquireTokenInPopupsError=function(){return new e(M.blockAcquireTokenInPopupsError.code,M.blockAcquireTokenInPopupsError.desc)},e.createIframeClosedPrematurelyError=function(){return new e(M.iframeClosedPrematurelyError.code,M.iframeClosedPrematurelyError.desc)},e.createSilentLogoutUnsupportedError=function(){return new e(M.silentLogoutUnsupportedError.code,M.silentLogoutUnsupportedError.desc)},e.createNoAccountError=function(){return new e(M.noAccountError.code,M.noAccountError.desc)},e.createSilentPromptValueError=function(r){return new e(M.silentPromptValueError.code,M.silentPromptValueError.desc+" Given value: "+r)},e.createUnableToParseTokenRequestCacheError=function(){return new e(M.unableToParseTokenRequestCacheError.code,M.unableToParseTokenRequestCacheError.desc)},e.createNoTokenRequestCacheError=function(){return new e(M.noTokenRequestCacheError.code,M.noTokenRequestCacheError.desc)},e.createAuthRequestNotSetError=function(){return new e(M.authRequestNotSet.code,M.authRequestNotSet.desc)},e.createNoCachedAuthorityError=function(){return new e(M.noCachedAuthorityError.code,M.noCachedAuthorityError.desc)},e.createInvalidCacheTypeError=function(){return new e(M.invalidCacheType.code,""+M.invalidCacheType.desc)},e.createNonBrowserEnvironmentError=function(){return new e(M.notInBrowserEnvironment.code,M.notInBrowserEnvironment.desc)},e.createDatabaseNotOpenError=function(){return new e(M.databaseNotOpen.code,M.databaseNotOpen.desc)},e.createNoNetworkConnectivityError=function(){return new e(M.noNetworkConnectivity.code,M.noNetworkConnectivity.desc)},e.createPostRequestFailedError=function(r,n){return new e(M.postRequestFailed.code,M.postRequestFailed.desc+" | Network client threw: "+r+" | Attempted to reach: "+n.split("?")[0])},e.createGetRequestFailedError=function(r,n){return new e(M.getRequestFailed.code,M.getRequestFailed.desc+" | Network client threw: "+r+" | Attempted to reach: "+n.split("?")[0])},e.createFailedToParseNetworkResponseError=function(r){return new e(M.failedToParseNetworkResponse.code,M.failedToParseNetworkResponse.desc+" | Attempted to reach: "+r.split("?")[0])},e.createUnableToLoadTokenError=function(r){return new e(M.unableToLoadTokenError.code,M.unableToLoadTokenError.desc+" | "+r)},e.createSigningKeyNotFoundInStorageError=function(r){return new e(M.signingKeyNotFoundInStorage.code,M.signingKeyNotFoundInStorage.desc+" | No match found for KeyId: "+r)},e.createAuthCodeRequiredError=function(){return new e(M.authCodeRequired.code,M.authCodeRequired.desc)},e.createAuthCodeOrNativeAccountIdRequiredError=function(){return new e(M.authCodeOrNativeAccountRequired.code,M.authCodeOrNativeAccountRequired.desc)},e.createDatabaseUnavailableError=function(){return new e(M.databaseUnavailable.code,M.databaseUnavailable.desc)},e.createUnableToAcquireTokenFromNativePlatformError=function(){return new e(M.unableToAcquireTokenFromNativePlatform.code,M.unableToAcquireTokenFromNativePlatform.desc)},e.createNativeHandshakeTimeoutError=function(){return new e(M.nativeHandshakeTimeout.code,M.nativeHandshakeTimeout.desc)},e.createNativeExtensionNotInstalledError=function(){return new e(M.nativeExtensionNotInstalled.code,M.nativeExtensionNotInstalled.desc)},e.createNativeConnectionNotEstablishedError=function(){return new e(M.nativeConnectionNotEstablished.code,M.nativeConnectionNotEstablished.desc)},e.createNativeBrokerCalledBeforeInitialize=function(){return new e(M.nativeBrokerCalledBeforeInitialize.code,M.nativeBrokerCalledBeforeInitialize.desc)},e.createNativePromptParameterNotSupportedError=function(){return new e(M.nativePromptNotSupported.code,M.nativePromptNotSupported.desc)},e}(W);var nn={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"},ys={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},Kn;(function(t){t.HandshakeRequest="Handshake",t.HandshakeResponse="HandshakeResponse",t.GetToken="GetToken",t.Response="Response"})(Kn||(Kn={}));var $t;(function(t){t.LocalStorage="localStorage",t.SessionStorage="sessionStorage",t.MemoryStorage="memoryStorage"})($t||($t={}));var bn;(function(t){t.GET="GET",t.POST="POST"})(bn||(bn={}));var pe;(function(t){t.AUTHORITY="authority",t.ACQUIRE_TOKEN_ACCOUNT="acquireToken.account",t.SESSION_STATE="session.state",t.REQUEST_STATE="request.state",t.NONCE_IDTOKEN="nonce.id_token",t.ORIGIN_URI="request.origin",t.RENEW_STATUS="token.renew.status",t.URL_HASH="urlHash",t.REQUEST_PARAMS="request.params",t.SCOPES="scopes",t.INTERACTION_STATUS_KEY="interaction.status",t.CCS_CREDENTIAL="ccs.credential",t.CORRELATION_ID="request.correlationId",t.NATIVE_REQUEST="request.native",t.REDIRECT_CONTEXT="request.redirect.context"})(pe||(pe={}));var ha;(function(t){t.WRAPPER_SKU="wrapper.sku",t.WRAPPER_VER="wrapper.version"})(ha||(ha={}));var Pe;(function(t){t[t.acquireTokenRedirect=861]="acquireTokenRedirect",t[t.acquireTokenPopup=862]="acquireTokenPopup",t[t.ssoSilent=863]="ssoSilent",t[t.acquireTokenSilent_authCode=864]="acquireTokenSilent_authCode",t[t.handleRedirectPromise=865]="handleRedirectPromise",t[t.acquireTokenByCode=866]="acquireTokenByCode",t[t.acquireTokenSilent_silentFlow=61]="acquireTokenSilent_silentFlow",t[t.logout=961]="logout",t[t.logoutPopup=962]="logoutPopup"})(Pe||(Pe={}));var G;(function(t){t.Redirect="redirect",t.Popup="popup",t.Silent="silent",t.None="none"})(G||(G={}));var sm;(function(t){t.Startup="startup",t.Login="login",t.Logout="logout",t.AcquireToken="acquireToken",t.SsoSilent="ssoSilent",t.HandleRedirect="handleRedirect",t.None="none"})(sm||(sm={}));var cm={scopes:Ac},Ra="jwk",lm;(function(t){t.React="@azure/msal-react",t.Angular="@azure/msal-angular"})(lm||(lm={}));var d2="msal.db",x_=1,E_=d2+".keys",fr;(function(t){t[t.Default=0]="Default",t[t.AccessToken=1]="AccessToken",t[t.AccessTokenAndRefreshToken=2]="AccessTokenAndRefreshToken",t[t.RefreshToken=3]="RefreshToken",t[t.RefreshTokenAndNetwork=4]="RefreshTokenAndNetwork",t[t.Skip=5]="Skip"})(fr||(fr={}));var hr={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."}},Gd=function(t){It(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.name="BrowserConfigurationAuthError",Object.setPrototypeOf(i,e.prototype),i}return e.createRedirectUriEmptyError=function(){return new e(hr.redirectUriNotSet.code,hr.redirectUriNotSet.desc)},e.createPostLogoutRedirectUriEmptyError=function(){return new e(hr.postLogoutUriNotSet.code,hr.postLogoutUriNotSet.desc)},e.createStorageNotSupportedError=function(r){return new e(hr.storageNotSupportedError.code,hr.storageNotSupportedError.desc+" Given Location: "+r)},e.createRedirectCallbacksNotSetError=function(){return new e(hr.noRedirectCallbacksSet.code,hr.noRedirectCallbacksSet.desc)},e.createStubPcaInstanceCalledError=function(){return new e(hr.stubPcaInstanceCalled.code,hr.stubPcaInstanceCalled.desc)},e.createInMemoryRedirectUnavailableError=function(){return new e(hr.inMemRedirectUnavailable.code,hr.inMemRedirectUnavailable.desc)},e.createEntropyNotProvided=function(){return new e(hr.entropyNotProvided.code,hr.entropyNotProvided.desc)},e}(W);var dm=function(){function t(e){this.validateWindowStorage(e),this.windowStorage=window[e]}return t.prototype.validateWindowStorage=function(e){if(e!==$t.LocalStorage&&e!==$t.SessionStorage)throw Gd.createStorageNotSupportedError(e);var r=!!window[e];if(!r)throw Gd.createStorageNotSupportedError(e)},t.prototype.getItem=function(e){return this.windowStorage.getItem(e)},t.prototype.setItem=function(e,r){this.windowStorage.setItem(e,r)},t.prototype.removeItem=function(e){this.windowStorage.removeItem(e)},t.prototype.getKeys=function(){return Object.keys(this.windowStorage)},t.prototype.containsKey=function(e){return this.windowStorage.hasOwnProperty(e)},t}();var h2=function(){function t(){this.cache=new Map}return t.prototype.getItem=function(e){return this.cache.get(e)||null},t.prototype.setItem=function(e,r){this.cache.set(e,r)},t.prototype.removeItem=function(e){this.cache.delete(e)},t.prototype.getKeys=function(){var e=[];return this.cache.forEach(function(r,n){e.push(n)}),e},t.prototype.containsKey=function(e){return this.cache.has(e)},t.prototype.clear=function(){this.cache.clear()},t}();var a3=function(){function t(){}return t.extractBrowserRequestState=function(e,r){if(V.isEmpty(r))return null;try{var n=Qn.parseRequestState(e,r);return n.libraryState.meta}catch(i){throw j.createInvalidStateError(r,i)}},t.parseServerResponseFromHash=function(e){if(!e)return{};var r=new ge(e);return ge.getDeserializedHash(r.getHash())},t}();var u2=function(t){It(e,t);function e(r,n,i,o){var a=t.call(this,r,i)||this;return a.COOKIE_LIFE_MULTIPLIER=24*60*60*1e3,a.cacheConfig=n,a.logger=o,a.internalStorage=new h2,a.browserStorage=a.setupBrowserStorage(a.cacheConfig.cacheLocation),a.temporaryCacheStorage=a.setupTemporaryCacheStorage(a.cacheConfig.cacheLocation),a.migrateCacheEntries(),a}return e.prototype.setupBrowserStorage=function(r){switch(r){case $t.LocalStorage:case $t.SessionStorage:try{return new dm(r)}catch(n){this.logger.verbose(n);break}}return this.cacheConfig.cacheLocation=$t.MemoryStorage,new h2},e.prototype.setupTemporaryCacheStorage=function(r){switch(r){case $t.LocalStorage:case $t.SessionStorage:try{return new dm($t.SessionStorage)}catch(n){return this.logger.verbose(n),this.internalStorage}case $t.MemoryStorage:default:return this.internalStorage}},e.prototype.migrateCacheEntries=function(){var r=this,n=_.CACHE_PREFIX+"."+dt.ID_TOKEN,i=_.CACHE_PREFIX+"."+dt.CLIENT_INFO,o=_.CACHE_PREFIX+"."+dt.ERROR,a=_.CACHE_PREFIX+"."+dt.ERROR_DESC,s=this.browserStorage.getItem(n),c=this.browserStorage.getItem(i),l=this.browserStorage.getItem(o),d=this.browserStorage.getItem(a),h=[s,c,l,d],u=[dt.ID_TOKEN,dt.CLIENT_INFO,dt.ERROR,dt.ERROR_DESC];u.forEach(function(f,v){return r.migrateCacheEntry(f,h[v])})},e.prototype.migrateCacheEntry=function(r,n){n&&this.setTemporaryCache(r,n,!0)},e.prototype.validateAndParseJson=function(r){try{var n=JSON.parse(r);return n&&typeof n=="object"?n:null}catch{return null}},e.prototype.getItem=function(r){return this.browserStorage.getItem(r)},e.prototype.setItem=function(r,n){this.browserStorage.setItem(r,n)},e.prototype.getAccount=function(r){var n=this.getItem(r);if(!n)return null;var i=this.validateAndParseJson(n);return!i||!kt.isAccountEntity(i)?null:Zr.toObject(new kt,i)},e.prototype.setAccount=function(r){this.logger.trace("BrowserCacheManager.setAccount called");var n=r.generateAccountKey();this.setItem(n,JSON.stringify(r))},e.prototype.getIdTokenCredential=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!uc.isIdTokenEntity(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),Zr.toObject(new uc,i))},e.prototype.setIdTokenCredential=function(r){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");var n=r.generateCredentialKey();this.setItem(n,JSON.stringify(r))},e.prototype.getAccessTokenCredential=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!fc.isAccessTokenEntity(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),Zr.toObject(new fc,i))},e.prototype.setAccessTokenCredential=function(r){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");var n=r.generateCredentialKey();this.setItem(n,JSON.stringify(r))},e.prototype.getRefreshTokenCredential=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!Fd.isRefreshTokenEntity(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),Zr.toObject(new Fd,i))},e.prototype.setRefreshTokenCredential=function(r){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");var n=r.generateCredentialKey();this.setItem(n,JSON.stringify(r))},e.prototype.getAppMetadata=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!c2.isAppMetadataEntity(r,i)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),Zr.toObject(new c2,i))},e.prototype.setAppMetadata=function(r){this.logger.trace("BrowserCacheManager.setAppMetadata called");var n=r.generateAppMetadataKey();this.setItem(n,JSON.stringify(r))},e.prototype.getServerTelemetry=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!qd.isServerTelemetryEntity(r,i)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),Zr.toObject(new qd,i))},e.prototype.setServerTelemetry=function(r,n){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(r,JSON.stringify(n))},e.prototype.getAuthorityMetadata=function(r){var n=this.internalStorage.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;var i=this.validateAndParseJson(n);return i&&l2.isAuthorityMetadataEntity(r,i)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),Zr.toObject(new l2,i)):null},e.prototype.getAuthorityMetadataKeys=function(){var r=this,n=this.internalStorage.getKeys();return n.filter(function(i){return r.isAuthorityMetadata(i)})},e.prototype.setWrapperMetadata=function(r,n){this.internalStorage.setItem(ha.WRAPPER_SKU,r),this.internalStorage.setItem(ha.WRAPPER_VER,n)},e.prototype.getWrapperMetadata=function(){var r=this.internalStorage.getItem(ha.WRAPPER_SKU)||_.EMPTY_STRING,n=this.internalStorage.getItem(ha.WRAPPER_VER)||_.EMPTY_STRING;return[r,n]},e.prototype.setAuthorityMetadata=function(r,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(r,JSON.stringify(n))},e.prototype.getActiveAccount=function(){var r=this.generateCacheKey(dt.ACTIVE_ACCOUNT_FILTERS),n=this.getItem(r);if(!n){this.logger.trace("No active account filters cache schema found, looking for legacy schema");var i=this.generateCacheKey(dt.ACTIVE_ACCOUNT),o=this.getItem(i);if(!o)return this.logger.trace("No active account found"),null;var a=this.getAccountInfoByFilter({localAccountId:o})[0]||null;return a?(this.logger.trace("Legacy active account cache schema found"),this.logger.trace("Adding active account filters cache schema"),this.setActiveAccount(a),a):null}var s=this.validateAndParseJson(n);return s?(this.logger.trace("Active account filters schema found"),this.getAccountInfoByFilter({homeAccountId:s.homeAccountId,localAccountId:s.localAccountId})[0]||null):(this.logger.trace("No active account found"),null)},e.prototype.setActiveAccount=function(r){var n=this.generateCacheKey(dt.ACTIVE_ACCOUNT_FILTERS),i=this.generateCacheKey(dt.ACTIVE_ACCOUNT);if(r){this.logger.verbose("setActiveAccount: Active account set");var o={homeAccountId:r.homeAccountId,localAccountId:r.localAccountId};this.browserStorage.setItem(n,JSON.stringify(o)),this.browserStorage.setItem(i,r.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(n),this.browserStorage.removeItem(i)},e.prototype.getAccountInfoByFilter=function(r){var n=this.getAllAccounts();return n.filter(function(i){return!(r.username&&r.username.toLowerCase()!==i.username.toLowerCase()||r.homeAccountId&&r.homeAccountId!==i.homeAccountId||r.localAccountId&&r.localAccountId!==i.localAccountId||r.tenantId&&r.tenantId!==i.tenantId||r.environment&&r.environment!==i.environment)})},e.prototype.getAccountInfoByHints=function(r,n){var i=this.getAllAccounts().filter(function(o){if(n){var a=o.idTokenClaims&&o.idTokenClaims.sid;return n===a}return r?r===o.username:!1});if(i.length===1)return i[0];if(i.length>1)throw j.createMultipleMatchingAccountsInCacheError();return null},e.prototype.getThrottlingCache=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!om.isThrottlingEntity(r,i)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),Zr.toObject(new om,i))},e.prototype.setThrottlingCache=function(r,n){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(r,JSON.stringify(n))},e.prototype.getTemporaryCache=function(r,n){var i=n?this.generateCacheKey(r):r;if(this.cacheConfig.storeAuthStateInCookie){var o=this.getItemCookie(i);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}var a=this.temporaryCacheStorage.getItem(i);if(!a){if(this.cacheConfig.cacheLocation===$t.LocalStorage){var s=this.browserStorage.getItem(i);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),s}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),a},e.prototype.setTemporaryCache=function(r,n,i){var o=i?this.generateCacheKey(r):r;this.temporaryCacheStorage.setItem(o,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.setItemCookie(o,n))},e.prototype.removeItem=function(r){return this.browserStorage.removeItem(r),this.temporaryCacheStorage.removeItem(r),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.clearItemCookie(r)),!0},e.prototype.containsKey=function(r){return this.browserStorage.containsKey(r)||this.temporaryCacheStorage.containsKey(r)},e.prototype.getKeys=function(){return Xf(this.browserStorage.getKeys(),this.temporaryCacheStorage.getKeys())},e.prototype.clear=function(){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.removeAllAccounts()];case 1:return n.sent(),this.removeAppMetadata(),this.getKeys().forEach(function(i){(r.browserStorage.containsKey(i)||r.temporaryCacheStorage.containsKey(i))&&(i.indexOf(_.CACHE_PREFIX)!==-1||i.indexOf(r.clientId)!==-1)&&r.removeItem(i)}),this.internalStorage.clear(),[2]}})})},e.prototype.setItemCookie=function(r,n,i){var o=encodeURIComponent(r)+"="+encodeURIComponent(n)+";path=/;SameSite=Lax;";if(i){var a=this.getCookieExpirationTime(i);o+="expires="+a+";"}this.cacheConfig.secureCookies&&(o+="Secure;"),document.cookie=o},e.prototype.getItemCookie=function(r){for(var n=encodeURIComponent(r)+"=",i=document.cookie.split(";"),o=0;o<i.length;o++){for(var a=i[o];a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(n)===0)return decodeURIComponent(a.substring(n.length,a.length))}return _.EMPTY_STRING},e.prototype.clearMsalCookies=function(){var r=this,n=_.CACHE_PREFIX+"."+this.clientId,i=document.cookie.split(";");i.forEach(function(o){for(;o.charAt(0)===" ";)o=o.substring(1);if(o.indexOf(n)===0){var a=o.split("=")[0];r.clearItemCookie(a)}})},e.prototype.clearItemCookie=function(r){this.setItemCookie(r,_.EMPTY_STRING,-1)},e.prototype.getCookieExpirationTime=function(r){var n=new Date,i=new Date(n.getTime()+r*this.COOKIE_LIFE_MULTIPLIER);return i.toUTCString()},e.prototype.getCache=function(){return this.browserStorage},e.prototype.setCache=function(){},e.prototype.generateCacheKey=function(r){var n=this.validateAndParseJson(r);return n?JSON.stringify(r):V.startsWith(r,_.CACHE_PREFIX)||V.startsWith(r,dt.ADAL_ID_TOKEN)?r:_.CACHE_PREFIX+"."+this.clientId+"."+r},e.prototype.generateAuthorityKey=function(r){var n=Qn.parseRequestState(this.cryptoImpl,r).libraryState.id;return this.generateCacheKey(pe.AUTHORITY+"."+n)},e.prototype.generateNonceKey=function(r){var n=Qn.parseRequestState(this.cryptoImpl,r).libraryState.id;return this.generateCacheKey(pe.NONCE_IDTOKEN+"."+n)},e.prototype.generateStateKey=function(r){var n=Qn.parseRequestState(this.cryptoImpl,r).libraryState.id;return this.generateCacheKey(pe.REQUEST_STATE+"."+n)},e.prototype.getCachedAuthority=function(r){var n=this.generateStateKey(r),i=this.getTemporaryCache(n);if(!i)return null;var o=this.generateAuthorityKey(i);return this.getTemporaryCache(o)},e.prototype.updateCacheEntries=function(r,n,i,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");var s=this.generateStateKey(r);this.setTemporaryCache(s,r,!1);var c=this.generateNonceKey(r);this.setTemporaryCache(c,n,!1);var l=this.generateAuthorityKey(r);if(this.setTemporaryCache(l,i,!1),a){var d={credential:a.homeAccountId,type:kr.HOME_ACCOUNT_ID};this.setTemporaryCache(pe.CCS_CREDENTIAL,JSON.stringify(d),!0)}else if(!V.isEmpty(o)){var d={credential:o,type:kr.UPN};this.setTemporaryCache(pe.CCS_CREDENTIAL,JSON.stringify(d),!0)}},e.prototype.resetRequestCache=function(r){var n=this;this.logger.trace("BrowserCacheManager.resetRequestCache called"),V.isEmpty(r)||this.getKeys().forEach(function(i){i.indexOf(r)!==-1&&n.removeItem(i)}),r&&(this.removeItem(this.generateStateKey(r)),this.removeItem(this.generateNonceKey(r)),this.removeItem(this.generateAuthorityKey(r))),this.removeItem(this.generateCacheKey(pe.REQUEST_PARAMS)),this.removeItem(this.generateCacheKey(pe.ORIGIN_URI)),this.removeItem(this.generateCacheKey(pe.URL_HASH)),this.removeItem(this.generateCacheKey(pe.CORRELATION_ID)),this.removeItem(this.generateCacheKey(pe.CCS_CREDENTIAL)),this.removeItem(this.generateCacheKey(pe.NATIVE_REQUEST)),this.setInteractionInProgress(!1)},e.prototype.cleanRequestByState=function(r){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),r){var n=this.generateStateKey(r),i=this.temporaryCacheStorage.getItem(n);this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: "+i),this.resetRequestCache(i||_.EMPTY_STRING)}this.clearMsalCookies()},e.prototype.cleanRequestByInteractionType=function(r){var n=this;this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.getKeys().forEach(function(i){if(i.indexOf(pe.REQUEST_STATE)!==-1){var o=n.temporaryCacheStorage.getItem(i);if(!!o){var a=a3.extractBrowserRequestState(n.cryptoImpl,o);a&&a.interactionType===r&&(n.logger.infoPii("BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: "+o),n.resetRequestCache(o))}}}),this.clearMsalCookies(),this.setInteractionInProgress(!1)},e.prototype.cacheCodeRequest=function(r,n){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");var i=n.base64Encode(JSON.stringify(r));this.setTemporaryCache(pe.REQUEST_PARAMS,i,!0)},e.prototype.getCachedRequest=function(r,n){this.logger.trace("BrowserCacheManager.getCachedRequest called");var i=this.getTemporaryCache(pe.REQUEST_PARAMS,!0);if(!i)throw D.createNoTokenRequestCacheError();var o=this.validateAndParseJson(n.base64Decode(i));if(!o)throw D.createUnableToParseTokenRequestCacheError();if(this.removeItem(this.generateCacheKey(pe.REQUEST_PARAMS)),V.isEmpty(o.authority)){var a=this.generateAuthorityKey(r),s=this.getTemporaryCache(a);if(!s)throw D.createNoCachedAuthorityError();o.authority=s}return o},e.prototype.getCachedNativeRequest=function(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");var r=this.getTemporaryCache(pe.NATIVE_REQUEST,!0);if(!r)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;var n=this.validateAndParseJson(r);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)},e.prototype.isInteractionInProgress=function(r){var n=this.getInteractionInProgress();return r?n===this.clientId:!!n},e.prototype.getInteractionInProgress=function(){var r=_.CACHE_PREFIX+"."+pe.INTERACTION_STATUS_KEY;return this.getTemporaryCache(r,!1)},e.prototype.setInteractionInProgress=function(r){var n=_.CACHE_PREFIX+"."+pe.INTERACTION_STATUS_KEY;if(r){if(this.getInteractionInProgress())throw D.createInteractionInProgressError();this.setTemporaryCache(n,this.clientId,!1)}else!r&&this.getInteractionInProgress()===this.clientId&&this.removeItem(n)},e.prototype.getLegacyLoginHint=function(){var r=this.getTemporaryCache(dt.ADAL_ID_TOKEN);r&&(this.browserStorage.removeItem(dt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));var n=this.getTemporaryCache(dt.ID_TOKEN,!0);n&&(this.removeItem(this.generateCacheKey(dt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));var i=n||r;if(i){var o=new In(i,this.cryptoImpl);if(o.claims&&o.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"),o.claims.preferred_username;if(o.claims&&o.claims.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.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},e.prototype.updateCredentialCacheKey=function(r,n){var i=n.generateCredentialKey();if(r!==i){var o=this.getItem(r);if(o)return this.removeItem(r),this.setItem(i,o),this.logger.verbose("Updated an outdated "+n.credentialType+" cache key"),i;this.logger.error("Attempted to update an outdated "+n.credentialType+" cache key but no item matching the outdated key was found in storage")}return r},e.prototype.getRedirectRequestContext=function(){return this.getTemporaryCache(pe.REDIRECT_CONTEXT,!0)},e.prototype.setRedirectRequestContext=function(r){this.setTemporaryCache(pe.REDIRECT_CONTEXT,r,!0)},e}(Zr),C_=function(t,e){var r={cacheLocation:$t.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1};return new u2(t,r,Dd,e)};var _h="@azure/msal-browser",$s="2.32.1";var z_=function(){function t(){}return t.prototype.sendGetRequestAsync=function(e,r){return S(this,void 0,void 0,function(){var n,i,o;return k(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,fetch(e,{method:bn.GET,headers:this.getFetchHeaders(r)})];case 1:return n=a.sent(),[3,3];case 2:throw i=a.sent(),window.navigator.onLine?D.createGetRequestFailedError(i,e):D.createNoNetworkConnectivityError();case 3:return a.trys.push([3,5,,6]),o={headers:this.getHeaderDict(n.headers)},[4,n.json()];case 4:return[2,(o.body=a.sent(),o.status=n.status,o)];case 5:throw a.sent(),D.createFailedToParseNetworkResponseError(e);case 6:return[2]}})})},t.prototype.sendPostRequestAsync=function(e,r){return S(this,void 0,void 0,function(){var n,i,o,a;return k(this,function(s){switch(s.label){case 0:n=r&&r.body||_.EMPTY_STRING,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,fetch(e,{method:bn.POST,headers:this.getFetchHeaders(r),body:n})];case 2:return i=s.sent(),[3,4];case 3:throw o=s.sent(),window.navigator.onLine?D.createPostRequestFailedError(o,e):D.createNoNetworkConnectivityError();case 4:return s.trys.push([4,6,,7]),a={headers:this.getHeaderDict(i.headers)},[4,i.json()];case 5:return[2,(a.body=s.sent(),a.status=i.status,a)];case 6:throw s.sent(),D.createFailedToParseNetworkResponseError(e);case 7:return[2]}})})},t.prototype.getFetchHeaders=function(e){var r=new Headers;if(!(e&&e.headers))return r;var n=e.headers;return Object.keys(n).forEach(function(i){r.append(i,n[i])}),r},t.prototype.getHeaderDict=function(e){var r={};return e.forEach(function(n,i){r[i]=n}),r},t}();var S_=function(){function t(){}return t.prototype.sendGetRequestAsync=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.sendRequestAsync(e,bn.GET,r)]})})},t.prototype.sendPostRequestAsync=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.sendRequestAsync(e,bn.POST,r)]})})},t.prototype.sendRequestAsync=function(e,r,n){var i=this;return new Promise(function(o,a){var s=new XMLHttpRequest;if(s.open(r,e,!0),i.setXhrHeaders(s,n),s.onload=function(){(s.status<200||s.status>=300)&&(r===bn.POST?a(D.createPostRequestFailedError("Failed with status "+s.status,e)):a(D.createGetRequestFailedError("Failed with status "+s.status,e)));try{var c=JSON.parse(s.responseText),l={headers:i.getHeaderDict(s),body:c,status:s.status};o(l)}catch{a(D.createFailedToParseNetworkResponseError(e))}},s.onerror=function(){window.navigator.onLine?r===bn.POST?a(D.createPostRequestFailedError("Failed with status "+s.status,e)):a(D.createGetRequestFailedError("Failed with status "+s.status,e)):a(D.createNoNetworkConnectivityError())},r===bn.POST&&n&&n.body)s.send(n.body);else if(r===bn.GET)s.send();else throw D.createHttpMethodNotImplementedError(r)})},t.prototype.setXhrHeaders=function(e,r){if(r&&r.headers){var n=r.headers;Object.keys(n).forEach(function(i){e.setRequestHeader(i,n[i])})}},t.prototype.getHeaderDict=function(e){var r=e.getAllResponseHeaders(),n=r.trim().split(/[\r\n]+/),i={};return n.forEach(function(o){var a=o.split(": "),s=a.shift(),c=a.join(": ");s&&c&&(i[s]=c)}),i},t}();var Je=function(){function t(){}return t.clearHash=function(e){e.location.hash=_.EMPTY_STRING,typeof e.history.replaceState=="function"&&e.history.replaceState(null,_.EMPTY_STRING,""+e.location.origin+e.location.pathname+e.location.search)},t.replaceHash=function(e){var r=e.split("#");r.shift(),window.location.hash=r.length>0?r.join("#"):_.EMPTY_STRING},t.isInIframe=function(){return window.parent!==window},t.isInPopup=function(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(nn.POPUP_NAME_PREFIX+".")===0},t.getCurrentUri=function(){return window.location.href.split("?")[0].split("#")[0]},t.getHomepage=function(){var e=new ge(window.location.href),r=e.getUrlComponents();return r.Protocol+"//"+r.HostNameAndPort+"/"},t.getBrowserNetworkClient=function(){return window.fetch&&window.Headers?new z_:new S_},t.blockReloadInHiddenIframes=function(){var e=ge.hashContainsKnownProperties(window.location.hash);if(e&&t.isInIframe())throw D.createBlockReloadInHiddenIframeError()},t.blockRedirectInIframe=function(e,r){var n=t.isInIframe();if(e===G.Redirect&&n&&!r)throw D.createRedirectInIframeError(n)},t.blockAcquireTokenInPopups=function(){if(t.isInPopup())throw D.createBlockAcquireTokenInPopupsError()},t.blockNonBrowserEnvironment=function(e){if(!e)throw D.createNonBrowserEnvironmentError()},t.blockNativeBrokerCalledBeforeInitialized=function(e,r){if(e&&!r)throw D.createNativeBrokerCalledBeforeInitialize()},t.detectIEOrEdge=function(){var e=window.navigator.userAgent,r=e.indexOf("MSIE "),n=e.indexOf("Trident/"),i=e.indexOf("Edge/"),o=r>0||n>0,a=i>0;return o||a},t}();var s3=function(){function t(e,r,n,i,o,a,s,c,l){this.config=e,this.browserStorage=r,this.browserCrypto=n,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=a,this.nativeMessageHandler=c,this.correlationId=l||this.browserCrypto.createNewGuid(),this.logger=i.clone(nn.MSAL_SKU,$s,this.correlationId),this.performanceClient=s}return t.prototype.clearCacheOnLogout=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){switch(r.label){case 0:if(!e)return[3,5];kt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null)),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.browserStorage.removeAccount(kt.generateAccountCacheKey(e))];case 2:return r.sent(),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request."),[3,4];case 3:return r.sent(),this.logger.error("Account provided in logout request was not found. Local cache unchanged."),[3,4];case 4:return[3,9];case 5:return r.trys.push([5,8,,9]),this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),[4,this.browserStorage.clear()];case 6:return r.sent(),[4,this.browserCrypto.clearKeystore()];case 7:return r.sent(),[3,9];case 8:return r.sent(),this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged."),[3,9];case 9:return[2]}})})},t.prototype.initializeBaseRequest=function(e){return S(this,void 0,void 0,function(){var r,n,i,o;return k(this,function(a){switch(a.label){case 0:if(this.logger.verbose("Initializing BaseAuthRequest"),r=e.authority||this.config.auth.authority,n=Xf(e&&e.scopes||[]),i=K(K({},e),{correlationId:this.correlationId,authority:r,scopes:n}),!i.authenticationScheme)i.authenticationScheme=Ee.BEARER,this.logger.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(i.authenticationScheme===Ee.SSH){if(!e.sshJwk)throw Ne.createMissingSshJwkError();if(!e.sshKid)throw Ne.createMissingSshKidError()}this.logger.verbose('Authentication Scheme set to "'+i.authenticationScheme+'" as configured in Auth request')}return e.claims&&!V.isEmpty(e.claims)?(o=i,[4,this.browserCrypto.hashString(e.claims)]):[3,2];case 1:o.requestedClaimsHash=a.sent(),a.label=2;case 2:return[2,i]}})})},t.prototype.getRedirectUri=function(e){this.logger.verbose("getRedirectUri called");var r=e||this.config.auth.redirectUri||Je.getCurrentUri();return ge.getAbsoluteUrl(r,Je.getCurrentUri())},t.prototype.initializeServerTelemetryManager=function(e,r){this.logger.verbose("initializeServerTelemetryManager called");var n={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:r||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new __(n,this.browserStorage)},t.prototype.getDiscoveredAuthority=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:return this.logger.verbose("getDiscoveredAuthority called"),r={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},e?(this.logger.verbose("Creating discovered authority with request authority"),[4,Bd.createDiscoveredInstance(e,this.config.system.networkClient,this.browserStorage,r,this.logger)]):[3,2];case 1:return[2,n.sent()];case 2:return this.logger.verbose("Creating discovered authority with configured authority"),[4,Bd.createDiscoveredInstance(this.config.auth.authority,this.config.system.networkClient,this.browserStorage,r,this.logger)];case 3:return[2,n.sent()]}})})},t}();var $a=function(t){It(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initializeAuthorizationCodeRequest=function(r){return S(this,void 0,void 0,function(){var n,i;return k(this,function(o){switch(o.label){case 0:return this.logger.verbose("initializeAuthorizationRequest called",r.correlationId),[4,this.browserCrypto.generatePkceCodes()];case 1:return n=o.sent(),i=K(K({},r),{redirectUri:r.redirectUri,code:_.EMPTY_STRING,codeVerifier:n.verifier}),r.codeChallenge=n.challenge,r.codeChallengeMethod=_.S256_CODE_CHALLENGE_METHOD,[2,i]}})})},e.prototype.initializeLogoutRequest=function(r){this.logger.verbose("initializeLogoutRequest called",r==null?void 0:r.correlationId);var n=K({correlationId:this.correlationId||this.browserCrypto.createNewGuid()},r);if(r)if(r.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(r.account){var i=this.getLogoutHintFromIdTokenClaims(r.account);i&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=i)}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!r||r.postLogoutRedirectUri!==null?r&&r.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=ge.getAbsoluteUrl(r.postLogoutRedirectUri,Je.getCurrentUri())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=ge.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Je.getCurrentUri())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=ge.getAbsoluteUrl(Je.getCurrentUri(),Je.getCurrentUri())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n},e.prototype.getLogoutHintFromIdTokenClaims=function(r){var n=r.idTokenClaims;if(n){if(n.login_hint)return n.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},e.prototype.createAuthCodeClient=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,this.getClientConfiguration(r,n,i)];case 1:return o=a.sent(),[2,new r3(o)]}})})},e.prototype.getClientConfiguration=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return this.logger.verbose("getClientConfiguration called",this.correlationId),[4,this.getDiscoveredAuthority(n,i)];case 1:return o=a.sent(),[2,{authOptions:{clientId:this.config.auth.clientId,authority:o,clientCapabilities:this.config.auth.clientCapabilities},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:this.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:this.config.system.loggerOptions.piiLoggingEnabled,logLevel:this.config.system.loggerOptions.logLevel,correlationId:this.correlationId},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:r,libraryInfo:{sku:nn.MSAL_SKU,version:$s,cpu:_.EMPTY_STRING,os:_.EMPTY_STRING},telemetry:this.config.telemetry}]}})})},e.prototype.validateAndExtractStateFromHash=function(r,n,i){if(this.logger.verbose("validateAndExtractStateFromHash called",i),!r.state)throw D.createHashDoesNotContainStateError();var o=a3.extractBrowserRequestState(this.browserCrypto,r.state);if(!o)throw D.createUnableToParseStateError();if(o.interactionType!==n)throw D.createStateInteractionTypeMismatchError();return this.logger.verbose("Returning state from hash",i),r.state},e.prototype.getDiscoveredAuthority=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s;return k(this,function(c){switch(c.label){case 0:return this.logger.verbose("getDiscoveredAuthority called",this.correlationId),i=this.performanceClient.startMeasurement(pt.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),o={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},a=r||this.config.auth.authority,s=jd.generateAuthority(a,n||this.config.auth.azureCloudOptions),this.logger.verbose("Creating discovered authority with configured authority",this.correlationId),[4,Bd.createDiscoveredInstance(s,this.config.system.networkClient,this.browserStorage,o,this.logger).then(function(l){return i.endMeasurement({success:!0}),l}).catch(function(l){throw i.endMeasurement({errorCode:l.errorCode,subErrorCode:l.subError,success:!1}),l})];case 1:return[2,c.sent()]}})})},e.prototype.initializeAuthorizationRequest=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c,l,d;return k(this,function(h){switch(h.label){case 0:return this.logger.verbose("initializeAuthorizationRequest called",this.correlationId),i=this.getRedirectUri(r.redirectUri),o={interactionType:n},a=Qn.setRequestState(this.browserCrypto,r&&r.state||_.EMPTY_STRING,o),c=[{}],[4,this.initializeBaseRequest(r)];case 1:return s=K.apply(void 0,[K.apply(void 0,c.concat([h.sent()])),{redirectUri:i,state:a,nonce:r.nonce||this.browserCrypto.createNewGuid(),responseMode:Rd.FRAGMENT}]),l=r.account||this.browserStorage.getActiveAccount(),l&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii("Setting validated request account: "+l.homeAccountId,this.correlationId),s.account=l),V.isEmpty(s.loginHint)&&!l&&(d=this.browserStorage.getLegacyLoginHint(),d&&(s.loginHint=d)),[2,s]}})})},e}(s3);var e0=function(){function t(e,r,n,i){this.authModule=e,this.browserStorage=r,this.authCodeRequest=n,this.logger=i}return t.prototype.handleCodeResponseFromHash=function(e,r,n,i){return S(this,void 0,void 0,function(){var o,a,s;return k(this,function(c){if(this.logger.verbose("InteractionHandler.handleCodeResponse called"),V.isEmpty(e))throw D.createEmptyHashError(e);if(o=this.browserStorage.generateStateKey(r),a=this.browserStorage.getTemporaryCache(o),!a)throw j.createStateNotFoundError("Cached State");try{s=this.authModule.handleFragmentResponse(e,a)}catch(l){throw l instanceof ko&&l.subError===M.userCancelledError.code?D.createUserCancelledError():l}return[2,this.handleCodeResponseFromServer(s,r,n,i)]})})},t.prototype.handleCodeResponseFromServer=function(e,r,n,i,o){return o===void 0&&(o=!0),S(this,void 0,void 0,function(){var a,s,c,l,d,h;return k(this,function(u){switch(u.label){case 0:if(this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),a=this.browserStorage.generateStateKey(r),s=this.browserStorage.getTemporaryCache(a),!s)throw j.createStateNotFoundError("Cached State");return c=this.browserStorage.generateNonceKey(s),l=this.browserStorage.getTemporaryCache(c),this.authCodeRequest.code=e.code,e.cloud_instance_host_name?[4,this.updateTokenEndpointAuthority(e.cloud_instance_host_name,n,i)]:[3,2];case 1:u.sent(),u.label=2;case 2:return o&&(e.nonce=l||void 0),e.state=s,e.client_info?this.authCodeRequest.clientInfo=e.client_info:(d=this.checkCcsCredentials(),d&&(this.authCodeRequest.ccsCredential=d)),[4,this.authModule.acquireToken(this.authCodeRequest,e)];case 3:return h=u.sent(),this.browserStorage.cleanRequestByState(r),[2,h]}})})},t.prototype.updateTokenEndpointAuthority=function(e,r,n){return S(this,void 0,void 0,function(){var i,o;return k(this,function(a){switch(a.label){case 0:return i="https://"+e+"/"+r.tenant+"/",[4,Bd.createDiscoveredInstance(i,n,this.browserStorage,r.options,this.logger)];case 1:return o=a.sent(),this.authModule.updateAuthority(o),[2]}})})},t.prototype.checkCcsCredentials=function(){var e=this.browserStorage.getTemporaryCache(pe.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii("Cache credential could not be parsed: "+e)}return null},t}();var hm=function(t){It(e,t);function e(r,n,i,o,a){var s=t.call(this,r,n,i,o)||this;return s.browserCrypto=a,s}return e.prototype.initiateAuthRequest=function(r,n){return S(this,void 0,void 0,function(){var i,o;return k(this,function(a){switch(a.label){case 0:return this.logger.verbose("RedirectHandler.initiateAuthRequest called"),V.isEmpty(r)?[3,7]:(n.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(pe.ORIGIN_URI,n.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(pe.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest,this.browserCrypto),this.logger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: "+r),i={apiId:Pe.acquireTokenRedirect,timeout:n.redirectTimeout,noHistory:!1},typeof n.onRedirectNavigate!="function"?[3,4]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),o=n.onRedirectNavigate(r),o===!1?[3,2]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),[4,n.navigationClient.navigateExternal(r,i)])));case 1:return a.sent(),[2];case 2:return this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation"),[2];case 3:return[3,6];case 4:return this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),[4,n.navigationClient.navigateExternal(r,i)];case 5:return a.sent(),[2];case 6:return[3,8];case 7:throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),D.createEmptyNavigationUriError();case 8:return[2]}})})},e.prototype.handleCodeResponseFromHash=function(r,n,i,o){return S(this,void 0,void 0,function(){var a,s,c,l,d,h,u;return k(this,function(f){switch(f.label){case 0:if(this.logger.verbose("RedirectHandler.handleCodeResponse called"),V.isEmpty(r))throw D.createEmptyHashError(r);if(this.browserStorage.setInteractionInProgress(!1),a=this.browserStorage.generateStateKey(n),s=this.browserStorage.getTemporaryCache(a),!s)throw j.createStateNotFoundError("Cached State");try{c=this.authModule.handleFragmentResponse(r,s)}catch(v){throw v instanceof ko&&v.subError===M.userCancelledError.code?D.createUserCancelledError():v}return l=this.browserStorage.generateNonceKey(s),d=this.browserStorage.getTemporaryCache(l),this.authCodeRequest.code=c.code,c.cloud_instance_host_name?[4,this.updateTokenEndpointAuthority(c.cloud_instance_host_name,i,o)]:[3,2];case 1:f.sent(),f.label=2;case 2:return c.nonce=d||void 0,c.state=s,c.client_info?this.authCodeRequest.clientInfo=c.client_info:(h=this.checkCcsCredentials(),h&&(this.authCodeRequest.ccsCredential=h)),[4,this.authModule.acquireToken(this.authCodeRequest,c)];case 3:return u=f.sent(),this.browserStorage.cleanRequestByState(n),[2,u]}})})},e}(e0);var X;(function(t){t.INITIALIZE_START="msal:initializeStart",t.INITIALIZE_END="msal:initializeEnd",t.ACCOUNT_ADDED="msal:accountAdded",t.ACCOUNT_REMOVED="msal:accountRemoved",t.LOGIN_START="msal:loginStart",t.LOGIN_SUCCESS="msal:loginSuccess",t.LOGIN_FAILURE="msal:loginFailure",t.ACQUIRE_TOKEN_START="msal:acquireTokenStart",t.ACQUIRE_TOKEN_SUCCESS="msal:acquireTokenSuccess",t.ACQUIRE_TOKEN_FAILURE="msal:acquireTokenFailure",t.ACQUIRE_TOKEN_NETWORK_START="msal:acquireTokenFromNetworkStart",t.SSO_SILENT_START="msal:ssoSilentStart",t.SSO_SILENT_SUCCESS="msal:ssoSilentSuccess",t.SSO_SILENT_FAILURE="msal:ssoSilentFailure",t.ACQUIRE_TOKEN_BY_CODE_START="msal:acquireTokenByCodeStart",t.ACQUIRE_TOKEN_BY_CODE_SUCCESS="msal:acquireTokenByCodeSuccess",t.ACQUIRE_TOKEN_BY_CODE_FAILURE="msal:acquireTokenByCodeFailure",t.HANDLE_REDIRECT_START="msal:handleRedirectStart",t.HANDLE_REDIRECT_END="msal:handleRedirectEnd",t.POPUP_OPENED="msal:popupOpened",t.LOGOUT_START="msal:logoutStart",t.LOGOUT_SUCCESS="msal:logoutSuccess",t.LOGOUT_FAILURE="msal:logoutFailure",t.LOGOUT_END="msal:logoutEnd"})(X||(X={}));var yi;(function(t){t.USER_INTERACTION_REQUIRED="USER_INTERACTION_REQUIRED",t.USER_CANCEL="USER_CANCEL",t.NO_NETWORK="NO_NETWORK",t.TRANSIENT_ERROR="TRANSIENT_ERROR",t.PERSISTENT_ERROR="PERSISTENT_ERROR",t.DISABLED="DISABLED",t.ACCOUNT_UNAVAILABLE="ACCOUNT_UNAVAILABLE"})(yi||(yi={}));var os={extensionError:{code:"ContentError"},userSwitch:{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."},tokensNotFoundInCache:{code:"tokens_not_found_in_internal_memory_cache",desc:"Tokens not cached in MSAL JS internal memory, please make the WAM request"}},En=function(t){It(e,t);function e(r,n,i){var o=t.call(this,r,n)||this;return Object.setPrototypeOf(o,e.prototype),o.name="NativeAuthError",o.ext=i,o}return e.prototype.isFatal=function(){if(this.ext&&this.ext.status&&(this.ext.status===yi.PERSISTENT_ERROR||this.ext.status===yi.DISABLED))return!0;switch(this.errorCode){case os.extensionError.code:return!0;default:return!1}},e.createError=function(r,n,i){if(i&&i.status)switch(i.status){case yi.ACCOUNT_UNAVAILABLE:return sn.createNativeAccountUnavailableError();case yi.USER_INTERACTION_REQUIRED:return new sn(r,n);case yi.USER_CANCEL:return D.createUserCancelledError();case yi.NO_NETWORK:return D.createNoNetworkConnectivityError()}return new e(r,n,i)},e.createUserSwitchError=function(){return new e(os.userSwitch.code,os.userSwitch.desc)},e.createTokensNotFoundInCacheError=function(){return new e(os.tokensNotFoundInCache.code,os.tokensNotFoundInCache.desc)},e}(W);var c3=function(t){It(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s;return k(this,function(c){switch(c.label){case 0:return n=this.performanceClient.startMeasurement(pt.SilentCacheClientAcquireToken,r.correlationId),i=this.initializeServerTelemetryManager(Pe.acquireTokenSilent_silentFlow),[4,this.createSilentFlowClient(i,r.authority,r.azureCloudOptions)];case 1:o=c.sent(),this.logger.verbose("Silent auth client created"),c.label=2;case 2:return c.trys.push([2,4,,5]),[4,o.acquireCachedToken(r)];case 3:return a=c.sent(),n.endMeasurement({success:!0,fromCache:!0}),[2,a];case 4:throw s=c.sent(),s instanceof D&&s.errorCode===M.signingKeyNotFoundInStorage.code&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),n.endMeasurement({errorCode:s instanceof W&&s.errorCode||void 0,subErrorCode:s instanceof W&&s.subError||void 0,success:!1}),s;case 5:return[2]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e.prototype.createSilentFlowClient=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,this.getClientConfiguration(r,n,i)];case 1:return o=a.sent(),[2,new u_(o,this.performanceClient)]}})})},e.prototype.initializeSilentRequest=function(r,n){return S(this,void 0,void 0,function(){var i;return k(this,function(o){switch(o.label){case 0:return i=[K({},r)],[4,this.initializeBaseRequest(r)];case 1:return[2,K.apply(void 0,[K.apply(void 0,i.concat([o.sent()])),{account:n,forceRefresh:r.forceRefresh||!1}])]}})})},e}($a);var xa=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h,u,f){var v=t.call(this,r,n,i,o,a,s,l,d,f)||this;return v.apiId=c,v.accountId=h,v.nativeMessageHandler=d,v.nativeStorageManager=u,v.silentCacheClient=new c3(r,v.nativeStorageManager,i,o,a,s,l,d,f),v}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0:return this.logger.trace("NativeInteractionClient - acquireToken called."),n=this.performanceClient.startMeasurement(pt.NativeInteractionClientAcquireToken,r.correlationId),i=Br.nowSeconds(),[4,this.initializeNativeRequest(r)];case 1:o=d.sent(),d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.acquireTokensFromCache(this.accountId,o)];case 3:return a=d.sent(),n.endMeasurement({success:!0,isNativeBroker:!1,fromCache:!0}),[2,a];case 4:return d.sent(),this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call"),[3,5];case 5:return s={method:Kn.GetToken,request:o},[4,this.nativeMessageHandler.sendMessage(s)];case 6:return c=d.sent(),l=this.validateNativeResponse(c),[2,this.handleNativeResponse(l,o,i).then(function(h){return n.endMeasurement({success:!0,isNativeBroker:!0,requestId:h.requestId}),h}).catch(function(h){throw n.endMeasurement({success:!1,errorCode:h.errorCode,subErrorCode:h.subError,isNativeBroker:!0}),h})]}})})},e.prototype.createSilentCacheRequest=function(r,n){return{authority:r.authority,correlationId:this.correlationId,scopes:rr.fromString(r.scope).asArray(),account:n,forceRefresh:!1}},e.prototype.acquireTokensFromCache=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c;return k(this,function(l){switch(l.label){case 0:if(i=this.browserStorage.readAccountFromCacheWithNativeAccountId(r),!i)throw j.createNoAccountFoundError();o=i.getAccountInfo(),l.label=1;case 1:return l.trys.push([1,3,,4]),a=this.createSilentCacheRequest(n,o),[4,this.silentCacheClient.acquireToken(a)];case 2:return s=l.sent(),[2,s];case 3:throw c=l.sent(),c;case 4:return[2]}})})},e.prototype.acquireTokenRedirect=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c;return k(this,function(l){switch(l.label){case 0:return this.logger.trace("NativeInteractionClient - acquireTokenRedirect called."),[4,this.initializeNativeRequest(r)];case 1:n=l.sent(),i={method:Kn.GetToken,request:n},l.label=2;case 2:return l.trys.push([2,4,,5]),[4,this.nativeMessageHandler.sendMessage(i)];case 3:return o=l.sent(),this.validateNativeResponse(o),[3,5];case 4:if(a=l.sent(),a instanceof En&&a.isFatal())throw a;return[3,5];case 5:return this.browserStorage.setTemporaryCache(pe.NATIVE_REQUEST,JSON.stringify(n),!0),s={apiId:Pe.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},c=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(r.redirectUri),[4,this.navigationClient.navigateExternal(c,s)];case 6:return l.sent(),[2]}})})},e.prototype.handleRedirectPromise=function(){return S(this,void 0,void 0,function(){var r,n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0: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."),[2,null];if(r=this.browserStorage.getCachedNativeRequest(),!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),[2,null];n=r.prompt,i=Jp(r,["prompt"]),n&&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(pe.NATIVE_REQUEST)),o={method:Kn.GetToken,request:i},a=Br.nowSeconds(),d.label=1;case 1:return d.trys.push([1,3,,4]),this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker."),[4,this.nativeMessageHandler.sendMessage(o)];case 2:return s=d.sent(),this.validateNativeResponse(s),c=this.handleNativeResponse(s,i,a),this.browserStorage.setInteractionInProgress(!1),[2,c];case 3:throw l=d.sent(),this.browserStorage.setInteractionInProgress(!1),l;case 4:return[2]}})})},e.prototype.logout=function(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")},e.prototype.handleNativeResponse=function(r,n,i){return S(this,void 0,void 0,function(){var o,a,s,c,l,d,h,u,f,v,g,x,m,p,y,w,T,O,F,N,be=this;return k(this,function(Y){switch(Y.label){case 0:if(this.logger.trace("NativeInteractionClient - handleNativeResponse called."),o=this.getMATSFromResponse(r),this.performanceClient.addStaticFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:o?o.broker_version:void 0,matsAccountJoinOnStart:o?o.account_join_on_start:void 0,matsAccountJoinOnEnd:o?o.account_join_on_end:void 0,matsDeviceJoin:o?o.device_join:void 0,matsPromptBehavior:o?o.prompt_behavior:void 0,matsApiErrorCode:o?o.api_error_code:void 0,matsUiVisible:o?o.ui_visible:void 0,matsSilentCode:o?o.silent_code:void 0,matsSilentBiSubCode:o?o.silent_bi_sub_code:void 0,matsSilentMessage:o?o.silent_message:void 0,matsSilentStatus:o?o.silent_status:void 0,matsHttpStatus:o?o.http_status:void 0,matsHttpEventCount:o?o.http_event_count:void 0},this.correlationId),r.account.id!==n.accountId)throw En.createUserSwitchError();return a=new In(r.id_token||_.EMPTY_STRING,this.browserCrypto),[4,this.getDiscoveredAuthority(n.authority)];case 1:switch(s=Y.sent(),c=s.getPreferredCache(),l=kt.generateHomeAccountId(r.client_info||_.EMPTY_STRING,Fr.Default,this.logger,this.browserCrypto,a),d=kt.createAccount(r.client_info,l,a,void 0,void 0,void 0,c,r.account.id),this.browserStorage.setAccount(d),h=r.scope?rr.fromString(r.scope):rr.fromString(n.scope),u=r.account.properties||{},f=u.UID||a.claims.oid||a.claims.sub||_.EMPTY_STRING,v=u.TenantId||a.claims.tid||_.EMPTY_STRING,x=Ee.BEARER,m=n.tokenType,m){case Ee.POP:return[3,2]}return[3,4];case 2:if(x=Ee.POP,r.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),g=r.shr,[3,5];if(p=new Pa(this.browserCrypto),y={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce},!n.keyId)throw j.createKeyIdMissingError();return[4,p.signPopToken(r.access_token,n.keyId,y)];case 3:return g=Y.sent(),[3,5];case 4:g=r.access_token,Y.label=5;case 5:return w={authority:s.canonicalAuthority,uniqueId:f,tenantId:v,scopes:h.asArray(),account:d.getAccountInfo(),idToken:r.id_token,idTokenClaims:a.claims,accessToken:g,fromCache:o?this.isResponseFromCache(o):!1,expiresOn:new Date(Number(i+r.expires_in)*1e3),tokenType:x,correlationId:this.correlationId,state:r.state,fromNativeBroker:!0},T=uc.createIdTokenEntity(l,n.authority,r.id_token||_.EMPTY_STRING,n.clientId,a.claims.tid||_.EMPTY_STRING),this.nativeStorageManager.setIdTokenCredential(T),O=x===Ee.POP?_.SHR_NONCE_VALIDITY:(typeof r.expires_in=="string"?parseInt(r.expires_in,10):r.expires_in)||0,F=i+O,N=fc.createAccessTokenEntity(l,n.authority,g,n.clientId,v,h.printScopes(),F,0,this.browserCrypto),this.nativeStorageManager.setAccessTokenCredential(N),this.browserStorage.removeAccountContext(d).catch(function(Jt){be.logger.error("Error occurred while removing account context from browser storage. "+Jt)}),[2,w]}})})},e.prototype.validateNativeResponse=function(r){if(r.hasOwnProperty("access_token")&&r.hasOwnProperty("id_token")&&r.hasOwnProperty("client_info")&&r.hasOwnProperty("account")&&r.hasOwnProperty("scope")&&r.hasOwnProperty("expires_in"))return r;throw En.createUnexpectedError("Response missing expected properties.")},e.prototype.getMATSFromResponse=function(r){if(r.properties.MATS)try{return JSON.parse(r.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null},e.prototype.isResponseFromCache=function(r){return typeof r.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!r.is_cached},e.prototype.initializeNativeRequest=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d,h,u,f=this;return k(this,function(v){switch(v.label){case 0:return this.logger.trace("NativeInteractionClient - initializeNativeRequest called"),n=r.authority||this.config.auth.authority,i=new ge(n),i.validateAsUri(),o=r.scopes,a=Jp(r,["scopes"]),s=new rr(o||[]),s.appendScopes(Ac),c=function(){switch(f.apiId){case Pe.ssoSilent:case Pe.acquireTokenSilent_silentFlow:return f.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Bt.NONE}if(!r.prompt){f.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(r.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:return f.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),r.prompt;default:throw f.logger.trace("initializeNativeRequest: prompt = "+r.prompt+" is not compatible with native flow"),D.createNativePromptParameterNotSupportedError()}},l=K(K({},a),{accountId:this.accountId,clientId:this.config.auth.clientId,authority:i.urlString,scope:s.printScopes(),redirectUri:this.getRedirectUri(r.redirectUri),prompt:c(),correlationId:this.correlationId,tokenType:r.authenticationScheme,windowTitleSubstring:document.title,extraParameters:K(K(K({},r.extraQueryParameters),r.tokenQueryParameters),{telemetry:ys.MATS_TELEMETRY}),extendedExpiryToken:!1}),r.authenticationScheme!==Ee.POP?[3,2]:(d={resourceRequestUri:r.resourceRequestUri,resourceRequestMethod:r.resourceRequestMethod,shrClaims:r.shrClaims,shrNonce:r.shrNonce},h=new Pa(this.browserCrypto),[4,h.generateCnf(d)]);case 1:u=v.sent(),l.reqCnf=u.reqCnfHash,l.keyId=u.kid,v.label=2;case 2:return[2,l]}})})},e}(s3);var vo=function(){function t(e,r,n){this.logger=e,this.handshakeTimeoutMs=r,this.extensionId=n,this.resolvers=new Map,this.handshakeResolvers=new Map,this.responseId=0,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this)}return t.prototype.sendMessage=function(e){return S(this,void 0,void 0,function(){var r,n=this;return k(this,function(i){return this.logger.trace("NativeMessageHandler - sendMessage called."),r={channel:ys.CHANNEL_ID,extensionId:this.extensionId,responseId:this.responseId++,body:e},this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii("NativeMessageHandler - Sending request to browser extension: "+JSON.stringify(r)),this.messageChannel.port1.postMessage(r),[2,new Promise(function(o,a){n.resolvers.set(r.responseId,{resolve:o,reject:a})})]})})},t.createProvider=function(e,r){return S(this,void 0,void 0,function(){var n,i;return k(this,function(o){switch(o.label){case 0:e.trace("NativeMessageHandler - createProvider called."),o.label=1;case 1:return o.trys.push([1,3,,5]),n=new t(e,r,ys.PREFERRED_EXTENSION_ID),[4,n.sendHandshakeRequest()];case 2:return o.sent(),[2,n];case 3:return o.sent(),i=new t(e,r),[4,i.sendHandshakeRequest()];case 4:return o.sent(),[2,i];case 5:return[2]}})})},t.prototype.sendHandshakeRequest=function(){return S(this,void 0,void 0,function(){var e,r=this;return k(this,function(n){return this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1),e={channel:ys.CHANNEL_ID,extensionId:this.extensionId,responseId:this.responseId++,body:{method:Kn.HandshakeRequest}},this.messageChannel.port1.onmessage=function(i){r.onChannelMessage(i)},window.postMessage(e,window.origin,[this.messageChannel.port2]),[2,new Promise(function(i,o){r.handshakeResolvers.set(e.responseId,{resolve:i,reject:o}),r.timeoutId=window.setTimeout(function(){window.removeEventListener("message",r.windowListener,!1),r.messageChannel.port1.close(),r.messageChannel.port2.close(),o(D.createNativeHandshakeTimeoutError()),r.handshakeResolvers.delete(e.responseId)},r.handshakeTimeoutMs)})]})})},t.prototype.onWindowMessage=function(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source===window){var r=e.data;if(!(!r.channel||r.channel!==ys.CHANNEL_ID)&&!(r.extensionId&&r.extensionId!==this.extensionId)&&r.body.method===Kn.HandshakeRequest){this.logger.verbose(r.extensionId?"Extension with id: "+r.extensionId+" not installed":"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1);var n=this.handshakeResolvers.get(r.responseId);n&&n.reject(D.createNativeExtensionNotInstalledError())}}},t.prototype.onChannelMessage=function(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");var r=e.data,n=this.resolvers.get(r.responseId),i=this.handshakeResolvers.get(r.responseId);try{var o=r.body.method;if(o===Kn.Response){if(!n)return;var a=r.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii("NativeMessageHandler - Received response from browser extension: "+JSON.stringify(a)),a.status!=="Success")n.reject(En.createError(a.code,a.description,a.ext));else if(a.result)a.result.code&&a.result.description?n.reject(En.createError(a.result.code,a.result.description,a.result.ext)):n.resolve(a.result);else throw W.createUnexpectedError("Event does not contain result.");this.resolvers.delete(r.responseId)}else if(o===Kn.HandshakeResponse){if(!i)return;clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=r.extensionId,this.extensionVersion=r.body.version,this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: "+this.extensionId),i.resolve(),this.handshakeResolvers.delete(r.responseId)}}catch(s){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii("Error parsing response from WAM Extension: "+s.toString()),this.logger.errorPii("Unable to parse "+e),n?n.reject(s):i&&i.reject(s)}},t.prototype.getExtensionId=function(){return this.extensionId},t.prototype.getExtensionVersion=function(){return this.extensionVersion},t.isNativeAvailable=function(e,r,n,i){if(r.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return r.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!n)return r.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(i)switch(i){case Ee.BEARER:case Ee.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},t}();var k_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h){var u=t.call(this,r,n,i,o,a,s,c,d,h)||this;return u.nativeStorage=l,u}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d,h,u=this;return k(this,function(f){switch(f.label){case 0:return[4,this.initializeAuthorizationRequest(r,G.Redirect)];case 1:n=f.sent(),this.browserStorage.updateCacheEntries(n.state,n.nonce,n.authority,n.loginHint||_.EMPTY_STRING,n.account||null),i=this.initializeServerTelemetryManager(Pe.acquireTokenRedirect),o=function(v){v.persisted&&(u.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),u.browserStorage.cleanRequestByState(n.state))},f.label=2;case 2:return f.trys.push([2,7,,8]),[4,this.initializeAuthorizationCodeRequest(n)];case 3:return a=f.sent(),[4,this.createAuthCodeClient(i,n.authority,n.azureCloudOptions)];case 4:return s=f.sent(),this.logger.verbose("Auth code client created"),c=new hm(s,this.browserStorage,a,this.logger,this.browserCrypto),[4,s.getAuthCodeUrl(K(K({},n),{nativeBroker:vo.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme)}))];case 5:return l=f.sent(),d=this.getRedirectStartPage(r.redirectStartPage),this.logger.verbosePii("Redirect start page: "+d),window.addEventListener("pageshow",o),[4,c.initiateAuthRequest(l,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:d,onRedirectNavigate:r.onRedirectNavigate})];case 6:return[2,f.sent()];case 7:throw h=f.sent(),h instanceof W&&h.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",o),i.cacheFailedRequest(h),this.browserStorage.cleanRequestByState(n.state),h;case 8:return[2]}})})},e.prototype.handleRedirectPromise=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d,h,u,f,v;return k(this,function(g){switch(g.label){case 0:n=this.initializeServerTelemetryManager(Pe.handleRedirectPromise),g.label=1;case 1:if(g.trys.push([1,10,,11]),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(i=this.getRedirectResponseHash(r||window.location.hash),!i)return this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(G.Redirect),[2,null];o=void 0;try{a=ge.getDeserializedHash(i),o=this.validateAndExtractStateFromHash(a,G.Redirect),this.logger.verbose("State extracted from hash")}catch(x){return this.logger.info("handleRedirectPromise was unable to extract state due to: "+x),this.browserStorage.cleanRequestByInteractionType(G.Redirect),[2,null]}return s=this.browserStorage.getTemporaryCache(pe.ORIGIN_URI,!0)||_.EMPTY_STRING,c=ge.removeHashFromUrl(s),l=ge.removeHashFromUrl(window.location.href),c===l&&this.config.auth.navigateToLoginRequestUrl?(this.logger.verbose("Current page is loginRequestUrl, handling hash"),[4,this.handleHash(i,o,n)]):[3,3];case 2:return d=g.sent(),s.indexOf("#")>-1&&Je.replaceHash(s),[2,d];case 3:return this.config.auth.navigateToLoginRequestUrl?[3,4]:(this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash"),[2,this.handleHash(i,o,n)]);case 4:return!Je.isInIframe()||this.config.system.allowRedirectInIframe?(this.browserStorage.setTemporaryCache(pe.URL_HASH,i,!0),h={apiId:Pe.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0},u=!0,!s||s==="null"?(f=Je.getHomepage(),this.browserStorage.setTemporaryCache(pe.ORIGIN_URI,f,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),[4,this.navigationClient.navigateInternal(f,h)]):[3,6]):[3,9];case 5:return u=g.sent(),[3,8];case 6:return this.logger.verbose("Navigating to loginRequestUrl: "+s),[4,this.navigationClient.navigateInternal(s,h)];case 7:u=g.sent(),g.label=8;case 8:if(!u)return[2,this.handleHash(i,o,n)];g.label=9;case 9:return[2,null];case 10:throw v=g.sent(),v instanceof W&&v.setCorrelationId(this.correlationId),n.cacheFailedRequest(v),this.browserStorage.cleanRequestByInteractionType(G.Redirect),v;case 11:return[2]}})})},e.prototype.getRedirectResponseHash=function(r){this.logger.verbose("getRedirectResponseHash called");var n=ge.hashContainsKnownProperties(r);if(n)return Je.clearHash(window),this.logger.verbose("Hash contains known properties, returning response hash"),r;var i=this.browserStorage.getTemporaryCache(pe.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(pe.URL_HASH)),this.logger.verbose("Hash does not contain known properties, returning cached hash"),i},e.prototype.handleHash=function(r,n,i){return S(this,void 0,void 0,function(){var o,a,s,c,l,d,h,u=this;return k(this,function(f){switch(f.label){case 0:if(o=this.browserStorage.getCachedRequest(n,this.browserCrypto),this.logger.verbose("handleHash called, retrieved cached request"),a=ge.getDeserializedHash(r),a.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw D.createNativeConnectionNotEstablishedError();return s=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,a.accountId,this.browserStorage,o.correlationId),c=Qn.parseRequestState(this.browserCrypto,n).userRequestState,[2,s.acquireToken(K(K({},o),{state:c,prompt:void 0})).finally(function(){u.browserStorage.cleanRequestByState(n)})]}if(l=this.browserStorage.getCachedAuthority(n),!l)throw D.createNoCachedAuthorityError();return[4,this.createAuthCodeClient(i,l)];case 1:return d=f.sent(),this.logger.verbose("Auth code client created"),Vd.removeThrottle(this.browserStorage,this.config.auth.clientId,o),h=new hm(d,this.browserStorage,o,this.logger,this.browserCrypto),[4,h.handleCodeResponseFromHash(r,n,d.authority,this.networkClient)];case 2:return[2,f.sent()]}})})},e.prototype.logout=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0:this.logger.verbose("logoutRedirect called"),n=this.initializeLogoutRequest(r),i=this.initializeServerTelemetryManager(Pe.logout),d.label=1;case 1:return d.trys.push([1,10,,11]),this.eventHandler.emitEvent(X.LOGOUT_START,G.Redirect,r),[4,this.clearCacheOnLogout(n.account)];case 2:return d.sent(),o={apiId:Pe.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},[4,this.createAuthCodeClient(i,r&&r.authority)];case 3:return a=d.sent(),this.logger.verbose("Auth code client created"),s=a.getLogoutUri(n),this.eventHandler.emitEvent(X.LOGOUT_SUCCESS,G.Redirect,n),r&&typeof r.onRedirectNavigate=="function"?(c=r.onRedirectNavigate(s),c===!1?[3,5]:(this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(s,o)])):[3,7];case 4:return d.sent(),[2];case 5:this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation"),d.label=6;case 6:return[3,9];case 7:return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(s,o)];case 8:return d.sent(),[2];case 9:return[3,11];case 10:throw l=d.sent(),l instanceof W&&l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l),this.eventHandler.emitEvent(X.LOGOUT_FAILURE,G.Redirect,null,l),this.eventHandler.emitEvent(X.LOGOUT_END,G.Redirect),l;case 11:return this.eventHandler.emitEvent(X.LOGOUT_END,G.Redirect),[2]}})})},e.prototype.getRedirectStartPage=function(r){var n=r||window.location.href;return ge.getAbsoluteUrl(n,Je.getCurrentUri())},e}($a);var A_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h){var u=t.call(this,r,n,i,o,a,s,c,d,h)||this;return u.unloadWindow=u.unloadWindow.bind(u),u.nativeStorage=l,u}return e.prototype.acquireToken=function(r){try{var n=this.generatePopupName(r.scopes||Ac,r.authority||this.config.auth.authority),i=r.popupWindowAttributes||{};if(this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(r,n,i);this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");var o=this.openSizedPopup("about:blank",n,i);return this.acquireTokenPopupAsync(r,n,i,o)}catch(a){return Promise.reject(a)}},e.prototype.logout=function(r){try{this.logger.verbose("logoutPopup called");var n=this.initializeLogoutRequest(r),i=this.generateLogoutPopupName(n),o=r&&r.authority,a=r&&r.mainWindowRedirectUri,s=(r==null?void 0:r.popupWindowAttributes)||{};if(this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,i,s,o,void 0,a);this.logger.verbose("asyncPopup set to false, opening popup");var c=this.openSizedPopup("about:blank",i,s);return this.logoutPopupAsync(n,i,s,o,c,a)}catch(l){return Promise.reject(l)}},e.prototype.acquireTokenPopupAsync=function(r,n,i,o){return S(this,void 0,void 0,function(){var a,s,c,l,d,h,u,f,v,g,x,m,p,y,w,T,O,F=this;return k(this,function(N){switch(N.label){case 0:return this.logger.verbose("acquireTokenPopupAsync called"),a=this.initializeServerTelemetryManager(Pe.acquireTokenPopup),[4,this.initializeAuthorizationRequest(r,G.Popup)];case 1:s=N.sent(),this.browserStorage.updateCacheEntries(s.state,s.nonce,s.authority,s.loginHint||_.EMPTY_STRING,s.account||null),N.label=2;case 2:return N.trys.push([2,8,,9]),[4,this.initializeAuthorizationCodeRequest(s)];case 3:return c=N.sent(),[4,this.createAuthCodeClient(a,s.authority,s.azureCloudOptions)];case 4:return l=N.sent(),this.logger.verbose("Auth code client created"),d=vo.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme),h=void 0,d&&(h=this.performanceClient.startMeasurement(pt.FetchAccountIdWithNativeBroker,r.correlationId)),[4,l.getAuthCodeUrl(K(K({},s),{nativeBroker:d}))];case 5:return u=N.sent(),f=new e0(l,this.browserStorage,c,this.logger),v={popup:o,popupName:n,popupWindowAttributes:i},g=this.initiateAuthRequest(u,v),this.eventHandler.emitEvent(X.POPUP_OPENED,G.Popup,{popupWindow:g},null),[4,this.monitorPopupForHash(g)];case 6:if(x=N.sent(),m=ge.getDeserializedHash(x),p=this.validateAndExtractStateFromHash(m,G.Popup,s.correlationId),Vd.removeThrottle(this.browserStorage,this.config.auth.clientId,c),m.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),h&&h.endMeasurement({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw D.createNativeConnectionNotEstablishedError();return y=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,m.accountId,this.nativeStorage,s.correlationId),w=Qn.parseRequestState(this.browserCrypto,p).userRequestState,[2,y.acquireToken(K(K({},s),{state:w,prompt:void 0})).finally(function(){F.browserStorage.cleanRequestByState(p)})]}return[4,f.handleCodeResponseFromHash(x,p,l.authority,this.networkClient)];case 7:return T=N.sent(),[2,T];case 8:throw O=N.sent(),o&&o.close(),O instanceof W&&O.setCorrelationId(this.correlationId),a.cacheFailedRequest(O),this.browserStorage.cleanRequestByState(s.state),O;case 9:return[2]}})})},e.prototype.logoutPopupAsync=function(r,n,i,o,a,s){return S(this,void 0,void 0,function(){var c,l,d,h,u,f,v;return k(this,function(g){switch(g.label){case 0:this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(X.LOGOUT_START,G.Popup,r),c=this.initializeServerTelemetryManager(Pe.logoutPopup),g.label=1;case 1:return g.trys.push([1,5,,6]),[4,this.clearCacheOnLogout(r.account)];case 2:return g.sent(),[4,this.createAuthCodeClient(c,o)];case 3:return l=g.sent(),this.logger.verbose("Auth code client created"),d=l.getLogoutUri(r),this.eventHandler.emitEvent(X.LOGOUT_SUCCESS,G.Popup,r),h=this.openPopup(d,{popupName:n,popupWindowAttributes:i,popup:a}),this.eventHandler.emitEvent(X.POPUP_OPENED,G.Popup,{popupWindow:h},null),[4,this.waitForLogoutPopup(h)];case 4:return g.sent(),s?(u={apiId:Pe.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},f=ge.getAbsoluteUrl(s,Je.getCurrentUri()),this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii("Redirecting main window to: "+f),this.navigationClient.navigateInternal(f,u)):this.logger.verbose("No main window navigation requested"),[3,6];case 5:throw v=g.sent(),a&&a.close(),v instanceof W&&v.setCorrelationId(this.correlationId),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(X.LOGOUT_FAILURE,G.Popup,null,v),this.eventHandler.emitEvent(X.LOGOUT_END,G.Popup),c.cacheFailedRequest(v),v;case 6:return this.eventHandler.emitEvent(X.LOGOUT_END,G.Popup),[2]}})})},e.prototype.initiateAuthRequest=function(r,n){if(V.isEmpty(r))throw this.logger.error("Navigate url is empty"),D.createEmptyNavigationUriError();return this.logger.infoPii("Navigate to: "+r),this.openPopup(r,n)},e.prototype.monitorPopupForHash=function(r){var n=this;return new Promise(function(i,o){var a=n.config.system.windowHashTimeout/n.config.system.pollIntervalMilliseconds,s=0;n.logger.verbose("PopupHandler.monitorPopupForHash - polling started");var c=setInterval(function(){if(r.closed){n.logger.error("PopupHandler.monitorPopupForHash - window closed"),n.cleanPopup(),clearInterval(c),o(D.createUserCancelledError());return}var l=_.EMPTY_STRING,d=_.EMPTY_STRING;try{l=r.location.href,d=r.location.hash}catch{}V.isEmpty(l)||l==="about:blank"||(n.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),s++,d?(n.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url"),clearInterval(c),n.cleanPopup(r),ge.hashContainsKnownProperties(d)?(n.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning."),i(d)):(n.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."),n.logger.errorPii("PopupHandler.monitorPopupForHash - hash found: "+d),o(D.createHashDoesNotContainKnownPropertiesError()))):s>a&&(n.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"),clearInterval(c),o(D.createMonitorPopupTimeoutError())))},n.config.system.pollIntervalMilliseconds)})},e.prototype.waitForLogoutPopup=function(r){var n=this;return new Promise(function(i){n.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");var o=setInterval(function(){r.closed&&(n.logger.error("PopupHandler.waitForLogoutPopup - window closed"),n.cleanPopup(),clearInterval(o),i());var a=_.EMPTY_STRING;try{a=r.location.href}catch{}V.isEmpty(a)||a==="about:blank"||(n.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing."),clearInterval(o),n.cleanPopup(r),i())},n.config.system.pollIntervalMilliseconds)})},e.prototype.openPopup=function(r,n){try{var i=void 0;if(n.popup?(i=n.popup,this.logger.verbosePii("Navigating popup window to: "+r),i.location.assign(r)):typeof n.popup>"u"&&(this.logger.verbosePii("Opening popup window to: "+r),i=this.openSizedPopup(r,n.popupName,n.popupWindowAttributes)),!i)throw D.createEmptyWindowCreatedError();return i.focus&&i.focus(),this.currentWindow=i,window.addEventListener("beforeunload",this.unloadWindow),i}catch(o){throw this.logger.error("error opening popup "+o.message),this.browserStorage.setInteractionInProgress(!1),D.createPopupWindowError(o.toString())}},e.prototype.openSizedPopup=function(r,n,i){var o,a,s,c,l=window.screenLeft?window.screenLeft:window.screenX,d=window.screenTop?window.screenTop:window.screenY,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,u=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,f=(o=i.popupSize)===null||o===void 0?void 0:o.width,v=(a=i.popupSize)===null||a===void 0?void 0:a.height,g=(s=i.popupPosition)===null||s===void 0?void 0:s.top,x=(c=i.popupPosition)===null||c===void 0?void 0:c.left;return(!f||f<0||f>h)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),f=nn.POPUP_WIDTH),(!v||v<0||v>u)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),v=nn.POPUP_HEIGHT),(!g||g<0||g>u)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),g=Math.max(0,u/2-nn.POPUP_HEIGHT/2+d)),(!x||x<0||x>h)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),x=Math.max(0,h/2-nn.POPUP_WIDTH/2+l)),window.open(r,n,"width="+f+", height="+v+", top="+g+", left="+x+", scrollbars=yes")},e.prototype.unloadWindow=function(r){this.browserStorage.cleanRequestByInteractionType(G.Popup),this.currentWindow&&this.currentWindow.close(),r.preventDefault()},e.prototype.cleanPopup=function(r){r&&r.close(),window.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)},e.prototype.generatePopupName=function(r,n){return nn.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+r.join("-")+"."+n+"."+this.correlationId},e.prototype.generateLogoutPopupName=function(r){var n=r.account&&r.account.homeAccountId;return nn.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+n+"."+this.correlationId},e}($a);var T_=function(){function t(){}return t.prototype.navigateInternal=function(e,r){return t.defaultNavigateWindow(e,r)},t.prototype.navigateExternal=function(e,r){return t.defaultNavigateWindow(e,r)},t.defaultNavigateWindow=function(e,r){return r.noHistory?window.location.replace(e):window.location.assign(e),new Promise(function(n){setTimeout(function(){n(!0)},r.timeout)})},t}();var I_=6e4,f2=6e3,M_=3e4,P_=2e3;function R_(t,e){var r=t.auth,n=t.cache,i=t.system,o=t.telemetry,a={clientId:_.EMPTY_STRING,authority:""+_.DEFAULT_AUTHORITY,knownAuthorities:[],cloudDiscoveryMetadata:_.EMPTY_STRING,authorityMetadata:_.EMPTY_STRING,redirectUri:_.EMPTY_STRING,postLogoutRedirectUri:_.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:$d.AAD,azureCloudOptions:{azureCloudInstance:dc.None,tenant:_.EMPTY_STRING},skipAuthorityMetadataCache:!1},s={cacheLocation:$t.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1},c={loggerCallback:function(){},logLevel:tt.Info,piiLoggingEnabled:!1},l=K(K({},t3),{loggerOptions:c,networkClient:e?Je.getBrowserNetworkClient():g_,navigationClient:new T_,loadFrameTimeout:0,windowHashTimeout:(i==null?void 0:i.loadFrameTimeout)||I_,iframeHashTimeout:(i==null?void 0:i.loadFrameTimeout)||f2,navigateFrameWait:e&&Je.detectIEOrEdge()?500:0,redirectNavigationTimeout:M_,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(i==null?void 0:i.nativeBrokerHandshakeTimeout)||P_,pollIntervalMilliseconds:nn.DEFAULT_POLL_INTERVAL_MS,cryptoOptions:{useMsrCrypto:!1,entropy:void 0}}),d={application:{appName:_.EMPTY_STRING,appVersion:_.EMPTY_STRING}},h={auth:K(K({},a),r),cache:K(K({},s),n),system:K(K({},l),i),telemetry:K(K({},d),o)};return h}var l3=function(t){It(e,t);function e(r,n,i,o,a){var s=t.call(this,r,n,i,o)||this;return s.navigateFrameWait=a.navigateFrameWait,s.pollIntervalMilliseconds=a.pollIntervalMilliseconds,s}return e.prototype.initiateAuthRequest=function(r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){switch(i.label){case 0:if(V.isEmpty(r))throw this.logger.info("Navigate url is empty"),D.createEmptyNavigationUriError();return this.navigateFrameWait?[4,this.loadFrame(r)]:[3,2];case 1:return n=i.sent(),[3,3];case 2:n=this.loadFrameSync(r),i.label=3;case 3:return[2,n]}})})},e.prototype.monitorIframeForHash=function(r,n){var i=this;return new Promise(function(o,a){n<f2&&i.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower ("+n+"ms) than the default ("+f2+"ms). This may result in timeouts.");var s=window.performance.now(),c=s+n,l=setInterval(function(){if(window.performance.now()>c){i.removeHiddenIframe(r),clearInterval(l),a(D.createMonitorIframeTimeoutError());return}var d=_.EMPTY_STRING,h=r.contentWindow;try{d=h?h.location.href:_.EMPTY_STRING}catch{}if(!V.isEmpty(d)){var u=h?h.location.hash:_.EMPTY_STRING;if(ge.hashContainsKnownProperties(u)){i.removeHiddenIframe(r),clearInterval(l),o(u);return}}},i.pollIntervalMilliseconds)})},e.prototype.loadFrame=function(r){var n=this;return new Promise(function(i,o){var a=n.createHiddenIframe();setTimeout(function(){if(!a){o("Unable to load iframe");return}a.src=r,i(a)},n.navigateFrameWait)})},e.prototype.loadFrameSync=function(r){var n=this.createHiddenIframe();return n.src=r,n},e.prototype.createHiddenIframe=function(){var r=document.createElement("iframe");return r.style.visibility="hidden",r.style.position="absolute",r.style.width=r.style.height="0",r.style.border="0",r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.getElementsByTagName("body")[0].appendChild(r),r},e.prototype.removeHiddenIframe=function(r){document.body===r.parentNode&&document.body.removeChild(r)},e}(e0);var H_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h,u){var f=t.call(this,r,n,i,o,a,s,l,h,u)||this;return f.apiId=c,f.nativeStorage=d,f}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s;return k(this,function(c){switch(c.label){case 0:if(this.logger.verbose("acquireTokenByIframe called"),n=this.performanceClient.startMeasurement(pt.SilentIframeClientAcquireToken,r.correlationId),V.isEmpty(r.loginHint)&&V.isEmpty(r.sid)&&(!r.account||V.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!==Bt.NONE&&r.prompt!==Bt.NO_SESSION)throw n.endMeasurement({success:!1}),D.createSilentPromptValueError(r.prompt);return[4,this.initializeAuthorizationRequest(K(K({},r),{prompt:r.prompt||Bt.NONE}),G.Silent)];case 1:i=c.sent(),this.browserStorage.updateCacheEntries(i.state,i.nonce,i.authority,i.loginHint||_.EMPTY_STRING,i.account||null),o=this.initializeServerTelemetryManager(this.apiId),c.label=2;case 2:return c.trys.push([2,5,,6]),[4,this.createAuthCodeClient(o,i.authority,i.azureCloudOptions)];case 3:return a=c.sent(),this.logger.verbose("Auth code client created"),[4,this.silentTokenHelper(a,i).then(function(l){return n.endMeasurement({success:!0,fromCache:!1,requestId:l.requestId}),l})];case 4:return[2,c.sent()];case 5:throw s=c.sent(),s instanceof W&&s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s),this.browserStorage.cleanRequestByState(i.state),n.endMeasurement({errorCode:s instanceof W&&s.errorCode||void 0,subErrorCode:s instanceof W&&s.subError||void 0,success:!1}),s;case 6:return[2]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e.prototype.silentTokenHelper=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c,l,d,h,u,f=this;return k(this,function(v){switch(v.label){case 0:return[4,this.initializeAuthorizationCodeRequest(n)];case 1:return i=v.sent(),[4,r.getAuthCodeUrl(K(K({},n),{nativeBroker:vo.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,n.authenticationScheme)}))];case 2:return o=v.sent(),a=new l3(r,this.browserStorage,i,this.logger,this.config.system),[4,a.initiateAuthRequest(o)];case 3:return s=v.sent(),[4,a.monitorIframeForHash(s,this.config.system.iframeHashTimeout)];case 4:if(c=v.sent(),l=ge.getDeserializedHash(c),d=this.validateAndExtractStateFromHash(l,G.Silent,i.correlationId),l.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw D.createNativeConnectionNotEstablishedError();return h=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,l.accountId,this.browserStorage,this.correlationId),u=Qn.parseRequestState(this.browserCrypto,d).userRequestState,[2,h.acquireToken(K(K({},n),{state:u,prompt:n.prompt||Bt.NONE})).finally(function(){f.browserStorage.cleanRequestByState(d)})]}return[2,a.handleCodeResponseFromHash(c,d,r.authority,this.networkClient)]}})})},e}($a);var L_=function(t){It(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c=this;return k(this,function(l){switch(l.label){case 0:return i=[K({},r)],[4,this.initializeBaseRequest(r)];case 1:return n=K.apply(void 0,i.concat([l.sent()])),o=this.performanceClient.startMeasurement(pt.SilentRefreshClientAcquireToken,n.correlationId),a=this.initializeServerTelemetryManager(Pe.acquireTokenSilent_silentFlow),[4,this.createRefreshTokenClient(a,n.authority,n.azureCloudOptions)];case 2:return s=l.sent(),this.logger.verbose("Refresh token client created"),[2,s.acquireTokenByRefreshToken(n).then(function(d){return o.endMeasurement({success:!0,fromCache:d.fromCache,requestId:d.requestId}),d}).catch(function(d){throw d instanceof W&&d.setCorrelationId(c.correlationId),a.cacheFailedRequest(d),o.endMeasurement({errorCode:d.errorCode,subErrorCode:d.subError,success:!1}),d})]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e.prototype.createRefreshTokenClient=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,this.getClientConfiguration(r,n,i)];case 1:return o=a.sent(),[2,new n3(o,this.performanceClient)]}})})},e}($a);var O_=function(){function t(e,r){this.eventCallbacks=new Map,this.logger=e,this.browserCrypto=r,this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}return t.prototype.addEventCallback=function(e){if(typeof window<"u"){var r=this.browserCrypto.createNewGuid();return this.eventCallbacks.set(r,e),this.logger.verbose("Event callback registered with id: "+r),r}return null},t.prototype.removeEventCallback=function(e){this.eventCallbacks.delete(e),this.logger.verbose("Event callback "+e+" removed.")},t.prototype.enableAccountStorageEvents=function(){typeof window>"u"||(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)))},t.prototype.disableAccountStorageEvents=function(){typeof window>"u"||(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."))},t.prototype.emitEvent=function(e,r,n,i){var o=this;if(typeof window<"u"){var a={eventType:e,interactionType:r||null,payload:n||null,error:i||null,timestamp:Date.now()};this.logger.info("Emitting event: "+e),this.eventCallbacks.forEach(function(s,c){o.logger.verbose("Emitting event to callback "+c+": "+e),s.apply(null,[a])})}},t.prototype.handleAccountCacheChange=function(e){try{var r=e.newValue||e.oldValue;if(!r)return;var n=JSON.parse(r);if(typeof n!="object"||!kt.isAccountEntity(n))return;var i=Zr.toObject(new kt,n),o=i.getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.emitEvent(X.ACCOUNT_ADDED,void 0,o)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.emitEvent(X.ACCOUNT_REMOVED,void 0,o))}catch{return}},t}();var Ft=function(){function t(){}return t.decimalToHex=function(e){for(var r=e.toString(16);r.length<2;)r="0"+r;return r},t}();var d3=function(){function t(e){this.cryptoObj=e}return t.prototype.generateGuid=function(){try{var e=new Uint8Array(16);return this.cryptoObj.getRandomValues(e),e[6]|=64,e[6]&=79,e[8]|=128,e[8]&=191,Ft.decimalToHex(e[0])+Ft.decimalToHex(e[1])+Ft.decimalToHex(e[2])+Ft.decimalToHex(e[3])+"-"+Ft.decimalToHex(e[4])+Ft.decimalToHex(e[5])+"-"+Ft.decimalToHex(e[6])+Ft.decimalToHex(e[7])+"-"+Ft.decimalToHex(e[8])+Ft.decimalToHex(e[9])+"-"+Ft.decimalToHex(e[10])+Ft.decimalToHex(e[11])+Ft.decimalToHex(e[12])+Ft.decimalToHex(e[13])+Ft.decimalToHex(e[14])+Ft.decimalToHex(e[15])}catch{for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",i=0,o=_.EMPTY_STRING,a=0;a<36;a++)r[a]!=="-"&&r[a]!=="4"&&(i=Math.random()*16|0),r[a]==="x"?o+=n[i]:r[a]==="y"?(i&=3,i|=8,o+=n[i]):o+=r[a];return o}},t.prototype.isGuid=function(e){var r=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;return r.test(e)},t}();var Xn=function(){function t(){}return t.stringToUtf8Arr=function(e){for(var r,n=0,i=e.length,o=0;o<i;o++)r=e.charCodeAt(o),n+=r<128?1:r<2048?2:r<65536?3:r<2097152?4:r<67108864?5:6;for(var a=new Uint8Array(n),s=0,c=0;s<n;c++)r=e.charCodeAt(c),r<128?a[s++]=r:r<2048?(a[s++]=192+(r>>>6),a[s++]=128+(r&63)):r<65536?(a[s++]=224+(r>>>12),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63)):r<2097152?(a[s++]=240+(r>>>18),a[s++]=128+(r>>>12&63),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63)):r<67108864?(a[s++]=248+(r>>>24),a[s++]=128+(r>>>18&63),a[s++]=128+(r>>>12&63),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63)):(a[s++]=252+(r>>>30),a[s++]=128+(r>>>24&63),a[s++]=128+(r>>>18&63),a[s++]=128+(r>>>12&63),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63));return a},t.stringToArrayBuffer=function(e){for(var r=new ArrayBuffer(e.length),n=new Uint8Array(r),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return r},t.utf8ArrToString=function(e){for(var r=_.EMPTY_STRING,n=void 0,i=e.length,o=0;o<i;o++)n=e[o],r+=String.fromCharCode(n>251&&n<254&&o+5<i?(n-252)*1073741824+(e[++o]-128<<24)+(e[++o]-128<<18)+(e[++o]-128<<12)+(e[++o]-128<<6)+e[++o]-128:n>247&&n<252&&o+4<i?(n-248<<24)+(e[++o]-128<<18)+(e[++o]-128<<12)+(e[++o]-128<<6)+e[++o]-128:n>239&&n<248&&o+3<i?(n-240<<18)+(e[++o]-128<<12)+(e[++o]-128<<6)+e[++o]-128:n>223&&n<240&&o+2<i?(n-224<<12)+(e[++o]-128<<6)+e[++o]-128:n>191&&n<224&&o+1<i?(n-192<<6)+e[++o]-128:n);return r},t.getSortedObjectString=function(e){return JSON.stringify(e,Object.keys(e).sort())},t}();var h3=function(){function t(){}return t.prototype.urlEncode=function(e){return encodeURIComponent(this.encode(e).replace(/=/g,_.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_"))},t.prototype.urlEncodeArr=function(e){return this.base64EncArr(e).replace(/=/g,_.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_")},t.prototype.encode=function(e){var r=Xn.stringToUtf8Arr(e);return this.base64EncArr(r)},t.prototype.base64EncArr=function(e){for(var r=(3-e.length%3)%3,n=_.EMPTY_STRING,i=void 0,o=e.length,a=0,s=0;s<o;s++)i=s%3,a|=e[s]<<(16>>>i&24),(i===2||e.length-s===1)&&(n+=String.fromCharCode(this.uint6ToB64(a>>>18&63),this.uint6ToB64(a>>>12&63),this.uint6ToB64(a>>>6&63),this.uint6ToB64(a&63)),a=0);return r===0?n:n.substring(0,n.length-r)+(r===1?"=":"==")},t.prototype.uint6ToB64=function(e){return e<26?e+65:e<52?e+71:e<62?e-4:e===62?43:e===63?47:65},t}();var D_=function(){function t(){}return t.prototype.decode=function(e){var r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw new Error("Invalid base64 string")}var n=this.base64DecToArr(r);return Xn.utf8ArrToString(n)},t.prototype.base64DecToArr=function(e,r){for(var n=e.replace(/[^A-Za-z0-9\+\/]/g,_.EMPTY_STRING),i=n.length,o=r?Math.ceil((i*3+1>>>2)/r)*r:i*3+1>>>2,a=new Uint8Array(o),s=void 0,c=void 0,l=0,d=0,h=0;h<i;h++)if(c=h&3,l|=this.b64ToUint6(n.charCodeAt(h))<<18-6*c,c===3||i-h===1){for(s=0;s<3&&d<o;s++,d++)a[d]=l>>>(16>>>s&24)&255;l=0}return a},t.prototype.b64ToUint6=function(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0},t}();var N_=32,V_=function(){function t(e){this.base64Encode=new h3,this.cryptoObj=e}return t.prototype.generateCodes=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:return e=this.generateCodeVerifier(),[4,this.generateCodeChallengeFromVerifier(e)];case 1:return r=n.sent(),[2,{verifier:e,challenge:r}]}})})},t.prototype.generateCodeVerifier=function(){try{var e=new Uint8Array(N_);this.cryptoObj.getRandomValues(e);var r=this.base64Encode.urlEncodeArr(e);return r}catch(n){throw D.createPkceNotGeneratedError(n)}},t.prototype.generateCodeChallengeFromVerifier=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.cryptoObj.sha256Digest(e)];case 1:return r=i.sent(),[2,this.base64Encode.urlEncodeArr(new Uint8Array(r))];case 2:throw n=i.sent(),D.createPkceNotGeneratedError(n);case 3:return[2]}})})},t}();var F_=function(){function t(){}return t.prototype.getRandomValues=function(e){return window.crypto.getRandomValues(e)},t.prototype.generateKey=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.crypto.subtle.generateKey(e,r,n)]})})},t.prototype.exportKey=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,window.crypto.subtle.exportKey(Ra,e)]})})},t.prototype.importKey=function(e,r,n,i){return S(this,void 0,void 0,function(){return k(this,function(o){return[2,window.crypto.subtle.importKey(Ra,e,r,n,i)]})})},t.prototype.sign=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.crypto.subtle.sign(e,r,n)]})})},t.prototype.digest=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,window.crypto.subtle.digest(e,r)]})})},t}();var U_=function(){function t(){}return t.prototype.initPrng=function(e){return window.msrCrypto.initPrng(Xf(e))},t.prototype.getRandomValues=function(e){return window.msrCrypto.getRandomValues(e)},t.prototype.generateKey=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.msrCrypto.subtle.generateKey(e,r,n)]})})},t.prototype.exportKey=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,window.msrCrypto.subtle.exportKey(Ra,e)]})})},t.prototype.importKey=function(e,r,n,i){return S(this,void 0,void 0,function(){return k(this,function(o){return[2,window.msrCrypto.subtle.importKey(Ra,e,r,n,i)]})})},t.prototype.sign=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.msrCrypto.subtle.sign(e,r,n)]})})},t.prototype.digest=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,window.msrCrypto.subtle.digest(e,r)]})})},t}();var $_=function(){function t(){}return t.prototype.getRandomValues=function(e){return window.msCrypto.getRandomValues(e)},t.prototype.generateKey=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,new Promise(function(o,a){var s=window.msCrypto.subtle.generateKey(e,r,n);s.addEventListener("complete",function(c){o(c.target.result)}),s.addEventListener("error",function(c){a(c)})})]})})},t.prototype.exportKey=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,new Promise(function(n,i){var o=window.msCrypto.subtle.exportKey(Ra,e);o.addEventListener("complete",function(a){var s=a.target.result,c=Xn.utf8ArrToString(new Uint8Array(s)).replace(/\r/g,_.EMPTY_STRING).replace(/\n/g,_.EMPTY_STRING).replace(/\t/g,_.EMPTY_STRING).split(" ").join(_.EMPTY_STRING).replace("\0",_.EMPTY_STRING);try{n(JSON.parse(c))}catch(l){i(l)}}),o.addEventListener("error",function(a){i(a)})})]})})},t.prototype.importKey=function(e,r,n,i){return S(this,void 0,void 0,function(){var o,a;return k(this,function(s){return o=Xn.getSortedObjectString(e),a=Xn.stringToArrayBuffer(o),[2,new Promise(function(c,l){var d=window.msCrypto.subtle.importKey(Ra,a,r,n,i);d.addEventListener("complete",function(h){c(h.target.result)}),d.addEventListener("error",function(h){l(h)})})]})})},t.prototype.sign=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,new Promise(function(o,a){var s=window.msCrypto.subtle.sign(e,r,n);s.addEventListener("complete",function(c){o(c.target.result)}),s.addEventListener("error",function(c){a(c)})})]})})},t.prototype.digest=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,new Promise(function(i,o){var a=window.msCrypto.subtle.digest(e,r.buffer);a.addEventListener("complete",function(s){i(s.target.result)}),a.addEventListener("error",function(s){o(s)})})]})})},t}();var j_="RSASSA-PKCS1-v1_5",um="SHA-256",B_=2048,q_=new Uint8Array([1,0,1]),u3=function(){function t(e,r){var n,i;if(this.logger=e,this.cryptoOptions=r,this.hasBrowserCrypto())this.logger.verbose("BrowserCrypto: modern crypto interface available"),this.subtleCrypto=new F_;else if(this.hasIECrypto())this.logger.verbose("BrowserCrypto: MS crypto interface available"),this.subtleCrypto=new $_;else if(this.hasMsrCrypto()&&((n=this.cryptoOptions)===null||n===void 0?void 0:n.useMsrCrypto))this.logger.verbose("BrowserCrypto: MSR crypto interface available"),this.subtleCrypto=new U_;else 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."),D.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");if(this.subtleCrypto.initPrng){if(this.logger.verbose("BrowserCrypto: Interface requires entropy"),!(!((i=this.cryptoOptions)===null||i===void 0)&&i.entropy))throw this.logger.error("BrowserCrypto: Interface requires entropy but none provided."),Gd.createEntropyNotProvided();this.logger.verbose("BrowserCrypto: Entropy provided"),this.subtleCrypto.initPrng(this.cryptoOptions.entropy)}this.keygenAlgorithmOptions={name:j_,hash:um,modulusLength:B_,publicExponent:q_}}return t.prototype.hasIECrypto=function(){return"msCrypto"in window},t.prototype.hasBrowserCrypto=function(){return"crypto"in window},t.prototype.hasMsrCrypto=function(){return"msrCrypto"in window},t.prototype.sha256Digest=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){return r=Xn.stringToUtf8Arr(e),[2,this.subtleCrypto.digest({name:um},r)]})})},t.prototype.getRandomValues=function(e){return this.subtleCrypto.getRandomValues(e)},t.prototype.generateKeyPair=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.subtleCrypto.generateKey(this.keygenAlgorithmOptions,e,r)]})})},t.prototype.exportJwk=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,this.subtleCrypto.exportKey(e)]})})},t.prototype.importJwk=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,this.subtleCrypto.importKey(e,this.keygenAlgorithmOptions,r,n)]})})},t.prototype.sign=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.subtleCrypto.sign(this.keygenAlgorithmOptions,e,r)]})})},t}();var G_=function(){function t(){this.dbName=d2,this.version=x_,this.tableName=E_,this.dbOpen=!1}return t.prototype.open=function(){return S(this,void 0,void 0,function(){var e=this;return k(this,function(r){return[2,new Promise(function(n,i){var o=window.indexedDB.open(e.dbName,e.version);o.addEventListener("upgradeneeded",function(a){var s=a;s.target.result.createObjectStore(e.tableName)}),o.addEventListener("success",function(a){var s=a;e.db=s.target.result,e.dbOpen=!0,n()}),o.addEventListener("error",function(){return i(D.createDatabaseUnavailableError())})})]})})},t.prototype.closeConnection=function(){var e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)},t.prototype.validateDbIsOpen=function(){return S(this,void 0,void 0,function(){return k(this,function(e){switch(e.label){case 0:return this.dbOpen?[3,2]:[4,this.open()];case 1:return[2,e.sent()];case 2:return[2]}})})},t.prototype.getItem=function(e){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.validateDbIsOpen()];case 1:return n.sent(),[2,new Promise(function(i,o){if(!r.db)return o(D.createDatabaseNotOpenError());var a=r.db.transaction([r.tableName],"readonly"),s=a.objectStore(r.tableName),c=s.get(e);c.addEventListener("success",function(l){var d=l;r.closeConnection(),i(d.target.result)}),c.addEventListener("error",function(l){r.closeConnection(),o(l)})})]}})})},t.prototype.setItem=function(e,r){return S(this,void 0,void 0,function(){var n=this;return k(this,function(i){switch(i.label){case 0:return[4,this.validateDbIsOpen()];case 1:return i.sent(),[2,new Promise(function(o,a){if(!n.db)return a(D.createDatabaseNotOpenError());var s=n.db.transaction([n.tableName],"readwrite"),c=s.objectStore(n.tableName),l=c.put(r,e);l.addEventListener("success",function(){n.closeConnection(),o()}),l.addEventListener("error",function(d){n.closeConnection(),a(d)})})]}})})},t.prototype.removeItem=function(e){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.validateDbIsOpen()];case 1:return n.sent(),[2,new Promise(function(i,o){if(!r.db)return o(D.createDatabaseNotOpenError());var a=r.db.transaction([r.tableName],"readwrite"),s=a.objectStore(r.tableName),c=s.delete(e);c.addEventListener("success",function(){r.closeConnection(),i()}),c.addEventListener("error",function(l){r.closeConnection(),o(l)})})]}})})},t.prototype.getKeys=function(){return S(this,void 0,void 0,function(){var e=this;return k(this,function(r){switch(r.label){case 0:return[4,this.validateDbIsOpen()];case 1:return r.sent(),[2,new Promise(function(n,i){if(!e.db)return i(D.createDatabaseNotOpenError());var o=e.db.transaction([e.tableName],"readonly"),a=o.objectStore(e.tableName),s=a.getAllKeys();s.addEventListener("success",function(c){var l=c;e.closeConnection(),n(l.target.result)}),s.addEventListener("error",function(c){e.closeConnection(),i(c)})})]}})})},t.prototype.containsKey=function(e){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.validateDbIsOpen()];case 1:return n.sent(),[2,new Promise(function(i,o){if(!r.db)return o(D.createDatabaseNotOpenError());var a=r.db.transaction([r.tableName],"readonly"),s=a.objectStore(r.tableName),c=s.count(e);c.addEventListener("success",function(l){var d=l;r.closeConnection(),i(d.target.result===1)}),c.addEventListener("error",function(l){r.closeConnection(),o(l)})})]}})})},t.prototype.deleteDatabase=function(){return S(this,void 0,void 0,function(){return k(this,function(e){return this.db&&this.dbOpen&&this.closeConnection(),[2,new Promise(function(r,n){var i=window.indexedDB.deleteDatabase(d2);i.addEventListener("success",function(){return r(!0)}),i.addEventListener("blocked",function(){return r(!0)}),i.addEventListener("error",function(){return n(!1)})})]})})},t}();var fm=function(){function t(e,r){this.inMemoryCache=new h2,this.indexedDBCache=new G_,this.logger=e,this.storeName=r}return t.prototype.handleDatabaseAccessError=function(e){if(e instanceof D&&e.errorCode===M.databaseUnavailable.code)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e},t.prototype.getItem=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:if(r=this.inMemoryCache.getItem(e),r)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.getItem(e)];case 2:return[2,i.sent()];case 3:return n=i.sent(),this.handleDatabaseAccessError(n),[3,4];case 4:return[2,r]}})})},t.prototype.setItem=function(e,r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){switch(i.label){case 0:this.inMemoryCache.setItem(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.indexedDBCache.setItem(e,r)];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),this.handleDatabaseAccessError(n),[3,4];case 4:return[2]}})})},t.prototype.removeItem=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:this.inMemoryCache.removeItem(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.indexedDBCache.removeItem(e)];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),this.handleDatabaseAccessError(r),[3,4];case 4:return[2]}})})},t.prototype.getKeys=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:if(e=this.inMemoryCache.getKeys(),e.length!==0)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),this.logger.verbose("In-memory cache is empty, now querying persistent storage."),[4,this.indexedDBCache.getKeys()];case 2:return[2,n.sent()];case 3:return r=n.sent(),this.handleDatabaseAccessError(r),[3,4];case 4:return[2,e]}})})},t.prototype.containsKey=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:if(r=this.inMemoryCache.containsKey(e),r)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.containsKey(e)];case 2:return[2,i.sent()];case 3:return n=i.sent(),this.handleDatabaseAccessError(n),[3,4];case 4:return[2,r]}})})},t.prototype.clearInMemory=function(){this.logger.verbose("Deleting in-memory keystore "+this.storeName),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore "+this.storeName+" deleted")},t.prototype.clearPersistent=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.logger.verbose("Deleting persistent keystore"),[4,this.indexedDBCache.deleteDatabase()];case 1:return e=n.sent(),e&&this.logger.verbose("Persistent keystore deleted"),[2,e];case 2:return r=n.sent(),this.handleDatabaseAccessError(r),[2,!1];case 3:return[2]}})})},t}();var Kd;(function(t){t.asymmetricKeys="asymmetricKeys",t.symmetricKeys="symmetricKeys"})(Kd||(Kd={}));var K_=function(){function t(e){this.logger=e,this.asymmetricKeys=new fm(this.logger,Kd.asymmetricKeys),this.symmetricKeys=new fm(this.logger,Kd.symmetricKeys)}return t.prototype.clear=function(){return S(this,void 0,void 0,function(){var e;return k(this,function(r){switch(r.label){case 0:this.asymmetricKeys.clearInMemory(),this.symmetricKeys.clearInMemory(),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.asymmetricKeys.clearPersistent()];case 2:return r.sent(),[2,!0];case 3:return e=r.sent(),e instanceof Error?this.logger.error("Clearing keystore failed with error: "+e.message):this.logger.error("Clearing keystore failed with unknown error"),[2,!1];case 4:return[2]}})})},t}();var W_=function(){function t(e,r,n){this.logger=e,this.browserCrypto=new u3(this.logger,n),this.b64Encode=new h3,this.b64Decode=new D_,this.guidGenerator=new d3(this.browserCrypto),this.pkceGenerator=new V_(this.browserCrypto),this.cache=new K_(this.logger),this.performanceClient=r}return t.prototype.createNewGuid=function(){return this.guidGenerator.generateGuid()},t.prototype.base64Encode=function(e){return this.b64Encode.encode(e)},t.prototype.base64Decode=function(e){return this.b64Decode.decode(e)},t.prototype.generatePkceCodes=function(){return S(this,void 0,void 0,function(){return k(this,function(e){return[2,this.pkceGenerator.generateCodes()]})})},t.prototype.getPublicKeyThumbprint=function(e){var r;return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d;return k(this,function(h){switch(h.label){case 0:return n=(r=this.performanceClient)===null||r===void 0?void 0:r.startMeasurement(pt.CryptoOptsGetPublicKeyThumbprint,e.correlationId),[4,this.browserCrypto.generateKeyPair(t.EXTRACTABLE,t.POP_KEY_USAGES)];case 1:return i=h.sent(),[4,this.browserCrypto.exportJwk(i.publicKey)];case 2:return o=h.sent(),a={e:o.e,kty:o.kty,n:o.n},s=Xn.getSortedObjectString(a),[4,this.hashString(s)];case 3:return c=h.sent(),[4,this.browserCrypto.exportJwk(i.privateKey)];case 4:return l=h.sent(),[4,this.browserCrypto.importJwk(l,!1,["sign"])];case 5:return d=h.sent(),[4,this.cache.asymmetricKeys.setItem(c,{privateKey:d,publicKey:i.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri})];case 6:return h.sent(),n&&n.endMeasurement({success:!0}),[2,c]}})})},t.prototype.removeTokenBindingKey=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:return[4,this.cache.asymmetricKeys.removeItem(e)];case 1:return n.sent(),[4,this.cache.asymmetricKeys.containsKey(e)];case 2:return r=n.sent(),[2,!r]}})})},t.prototype.clearKeystore=function(){return S(this,void 0,void 0,function(){return k(this,function(e){switch(e.label){case 0:return[4,this.cache.clear()];case 1:return[2,e.sent()]}})})},t.prototype.signJwt=function(e,r,n){var i;return S(this,void 0,void 0,function(){var o,a,s,c,l,d,h,u,f,v,g,x,m;return k(this,function(p){switch(p.label){case 0:return o=(i=this.performanceClient)===null||i===void 0?void 0:i.startMeasurement(pt.CryptoOptsSignJwt,n),[4,this.cache.asymmetricKeys.getItem(r)];case 1:if(a=p.sent(),!a)throw D.createSigningKeyNotFoundInStorageError(r);return[4,this.browserCrypto.exportJwk(a.publicKey)];case 2:return s=p.sent(),c=Xn.getSortedObjectString(s),l=this.b64Encode.urlEncode(JSON.stringify({kid:r})),d=y_.getShrHeaderString({kid:l,alg:s.alg}),h=this.b64Encode.urlEncode(d),e.cnf={jwk:JSON.parse(c)},u=this.b64Encode.urlEncode(JSON.stringify(e)),f=h+"."+u,v=Xn.stringToArrayBuffer(f),[4,this.browserCrypto.sign(a.privateKey,v)];case 3:return g=p.sent(),x=this.b64Encode.urlEncodeArr(new Uint8Array(g)),m=f+"."+x,o&&o.endMeasurement({success:!0}),[2,m]}})})},t.prototype.hashString=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:return[4,this.browserCrypto.sha256Digest(e)];case 1:return r=i.sent(),n=new Uint8Array(r),[2,this.b64Encode.urlEncodeArr(n)]}})})},t.POP_KEY_USAGES=["sign","verify"],t.EXTRACTABLE=!0,t}();var Y_=function(){function t(e,r,n,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=r,this.logger=n,this.cryptoObj=i}return t.prototype.loadExternalTokens=function(e,r,n){if(this.logger.info("TokenCache - loadExternalTokens called"),!r.id_token)throw D.createUnableToLoadTokenError("Please ensure server response includes id token.");var i=new In(r.id_token,this.cryptoObj),o,a;if(e.account){var s=this.loadAccount(i,e.account.environment,void 0,void 0,e.account.homeAccountId);o=new Ul(s,this.loadIdToken(i,s.homeAccountId,e.account.environment,e.account.tenantId),this.loadAccessToken(e,r,s.homeAccountId,e.account.environment,e.account.tenantId,n),this.loadRefreshToken(e,r,s.homeAccountId,e.account.environment))}else if(e.authority){var c=jd.generateAuthority(e.authority,e.azureCloudOptions),l={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(a=new jd(c,this.config.system.networkClient,this.storage,l,this.logger),n.clientInfo){this.logger.trace("TokenCache - homeAccountId from options");var s=this.loadAccount(i,a.hostnameAndPort,n.clientInfo,a.authorityType);o=new Ul(s,this.loadIdToken(i,s.homeAccountId,a.hostnameAndPort,a.tenant),this.loadAccessToken(e,r,s.homeAccountId,a.hostnameAndPort,a.tenant,n),this.loadRefreshToken(e,r,s.homeAccountId,a.hostnameAndPort))}else if(r.client_info){this.logger.trace("TokenCache - homeAccountId from response");var s=this.loadAccount(i,a.hostnameAndPort,r.client_info,a.authorityType);o=new Ul(s,this.loadIdToken(i,s.homeAccountId,a.hostnameAndPort,a.tenant),this.loadAccessToken(e,r,s.homeAccountId,a.hostnameAndPort,a.tenant,n),this.loadRefreshToken(e,r,s.homeAccountId,a.hostnameAndPort))}else throw D.createUnableToLoadTokenError("Please provide clientInfo in the response or options.")}else throw D.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");return this.generateAuthenticationResult(e,i,o,a)},t.prototype.loadAccount=function(e,r,n,i,o){var a;if(o?a=o:i!==void 0&&n&&(a=kt.generateHomeAccountId(n,i,this.logger,this.cryptoObj,e)),!a)throw D.createUnableToLoadTokenError("Unexpected missing homeAccountId");var s=n?kt.createAccount(n,a,e,void 0,void 0,void 0,r):kt.createGenericAccount(a,e,void 0,void 0,void 0,r);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading account"),this.storage.setAccount(s),s;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.loadIdToken=function(e,r,n,i){var o=uc.createIdTokenEntity(r,n,e.rawToken,this.config.auth.clientId,i);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading id token"),this.storage.setIdTokenCredential(o),o;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.loadAccessToken=function(e,r,n,i,o,a){if(!r.access_token)return this.logger.verbose("TokenCache - No access token provided for caching"),null;if(!r.expires_in)throw D.createUnableToLoadTokenError("Please ensure server response includes expires_in value.");if(!a.extendedExpiresOn)throw D.createUnableToLoadTokenError("Please provide an extendedExpiresOn value in the options.");var s=new rr(e.scopes).printScopes(),c=a.expiresOn||r.expires_in+new Date().getTime()/1e3,l=a.extendedExpiresOn,d=fc.createAccessTokenEntity(n,i,r.access_token,this.config.auth.clientId,o,s,c,l,this.cryptoObj);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading access token"),this.storage.setAccessTokenCredential(d),d;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.loadRefreshToken=function(e,r,n,i){if(!r.refresh_token)return this.logger.verbose("TokenCache - No refresh token provided for caching"),null;var o=Fd.createRefreshTokenEntity(n,i,r.refresh_token,this.config.auth.clientId);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading refresh token"),this.storage.setRefreshTokenCredential(o),o;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.generateAuthenticationResult=function(e,r,n,i){var o,a,s,c=_.EMPTY_STRING,l=[],d=null,h;n!=null&&n.accessToken&&(c=n.accessToken.secret,l=rr.fromString(n.accessToken.target).asArray(),d=new Date(Number(n.accessToken.expiresOn)*1e3),h=new Date(Number(n.accessToken.extendedExpiresOn)*1e3));var u=(r==null?void 0:r.claims.oid)||(r==null?void 0:r.claims.sub)||_.EMPTY_STRING,f=(r==null?void 0:r.claims.tid)||_.EMPTY_STRING;return{authority:i?i.canonicalAuthority:_.EMPTY_STRING,uniqueId:u,tenantId:f,scopes:l,account:n!=null&&n.account?n.account.getAccountInfo():null,idToken:r?r.rawToken:_.EMPTY_STRING,idTokenClaims:r?r.claims:{},accessToken:c,fromCache:!0,expiresOn:d,correlationId:e.correlationId||_.EMPTY_STRING,requestId:_.EMPTY_STRING,extExpiresOn:h,familyId:_.EMPTY_STRING,tokenType:((o=n==null?void 0:n.accessToken)===null||o===void 0?void 0:o.tokenType)||_.EMPTY_STRING,state:_.EMPTY_STRING,cloudGraphHostName:((a=n==null?void 0:n.account)===null||a===void 0?void 0:a.cloudGraphHostName)||_.EMPTY_STRING,msGraphHost:((s=n==null?void 0:n.account)===null||s===void 0?void 0:s.msGraphHost)||_.EMPTY_STRING,code:void 0,fromNativeBroker:!1}},t}();var Q_=function(t){It(e,t);function e(r){var n=t.call(this,r)||this;return n.includeRedirectUri=!1,n}return e}(r3);var X_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h){var u=t.call(this,r,n,i,o,a,s,l,d,h)||this;return u.apiId=c,u}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0:if(this.logger.trace("SilentAuthCodeClient.acquireToken called"),!r.code)throw D.createAuthCodeRequiredError();return[4,this.initializeAuthorizationRequest(r,G.Silent)];case 1:n=d.sent(),this.browserStorage.updateCacheEntries(n.state,n.nonce,n.authority,n.loginHint||_.EMPTY_STRING,n.account||null),i=this.initializeServerTelemetryManager(this.apiId),d.label=2;case 2:return d.trys.push([2,4,,5]),o=K(K({},n),{code:r.code}),[4,this.getClientConfiguration(i,n.authority)];case 3:return a=d.sent(),s=new Q_(a),this.logger.verbose("Auth code client created"),c=new l3(s,this.browserStorage,o,this.logger,this.config.system),[2,c.handleCodeResponseFromServer({code:r.code,msgraph_host:r.msGraphHost,cloud_graph_host_name:r.cloudGraphHostName,cloud_instance_host_name:r.cloudInstanceHostName},n.state,s.authority,this.networkClient,!1)];case 4:throw l=d.sent(),l instanceof W&&l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l),this.browserStorage.cleanRequestByState(n.state),l;case 5:return[2]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e}($a);var J_=function(){function t(e,r){this.correlationId=r,this.measureName="msal.measure."+e+"."+this.correlationId,this.startMark="msal.start."+e+"."+this.correlationId,this.endMark="msal.end."+e+"."+this.correlationId}return t.supportsBrowserPerformance=function(){return typeof window<"u"&&typeof window.performance<"u"&&typeof window.performance.mark=="function"&&typeof window.performance.measure=="function"&&typeof window.performance.clearMarks=="function"&&typeof window.performance.clearMeasures=="function"&&typeof window.performance.getEntriesByName=="function"},t.prototype.startMeasurement=function(){if(t.supportsBrowserPerformance())try{window.performance.mark(this.startMark)}catch{}},t.prototype.endMeasurement=function(){if(t.supportsBrowserPerformance())try{window.performance.mark(this.endMark),window.performance.measure(this.measureName,this.startMark,this.endMark)}catch{}},t.prototype.flushMeasurement=function(){if(t.supportsBrowserPerformance())try{var e=window.performance.getEntriesByName(this.measureName,"measure");if(e.length>0){var r=e[0].duration;return window.performance.clearMeasures(this.measureName),window.performance.clearMarks(this.startMark),window.performance.clearMarks(this.endMark),r}}catch{}return null},t}();var Z_=function(t){It(e,t);function e(r,n,i,o,a,s,c){var l=t.call(this,r,n,i,o,a,s)||this;return l.browserCrypto=new u3(l.logger,c),l.guidGenerator=new d3(l.browserCrypto),l}return e.prototype.startPerformanceMeasuremeant=function(r,n){return new J_(r,n)},e.prototype.generateId=function(){return this.guidGenerator.generateGuid()},e.prototype.getPageVisibility=function(){var r;return((r=document.visibilityState)===null||r===void 0?void 0:r.toString())||null},e.prototype.startMeasurement=function(r,n){var i=this,o=this.getPageVisibility(),a=t.prototype.startMeasurement.call(this,r,n);return K(K({},a),{endMeasurement:function(s){return a.endMeasurement(K({startPageVisibility:o,endPageVisibility:i.getPageVisibility()},s))}})},e}(o3);var eb=function(){function t(e){this.isBrowserEnvironment=typeof window<"u",this.config=R_(e,this.isBrowserEnvironment),this.initialized=!1,this.logger=new Jf(this.config.system.loggerOptions,_h,$s),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 Z_(this.config.auth.clientId,this.config.auth.authority,this.logger,_h,$s,this.config.telemetry.application,this.config.system.cryptoOptions):new w_(this.config.auth.clientId,this.config.auth.authority,this.logger,_h,$s,this.config.telemetry.application),this.browserCrypto=this.isBrowserEnvironment?new W_(this.logger,this.performanceClient,this.config.system.cryptoOptions):Dd,this.eventHandler=new O_(this.logger,this.browserCrypto),this.browserStorage=this.isBrowserEnvironment?new u2(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger):C_(this.config.auth.clientId,this.logger);var r={cacheLocation:$t.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1};this.nativeInternalStorage=new u2(this.config.auth.clientId,r,this.browserCrypto,this.logger),this.tokenCache=new Y_(this.config,this.browserStorage,this.logger,this.browserCrypto)}return t.prototype.initialize=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:if(this.logger.trace("initialize called"),this.initialized)return this.logger.info("initialize has already been called, exiting early."),[2];if(this.eventHandler.emitEvent(X.INITIALIZE_START),!this.config.system.allowNativeBroker)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),e=this,[4,vo.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout)];case 2:return e.nativeExtensionProvider=n.sent(),[3,4];case 3:return r=n.sent(),this.logger.verbose(r),[3,4];case 4:return this.initialized=!0,this.eventHandler.emitEvent(X.INITIALIZE_END),[2]}})})},t.prototype.handleRedirectPromise=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s,c,l,d=this;return k(this,function(h){return this.logger.verbose("handleRedirectPromise called"),Je.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),r=this.getAllAccounts(),this.isBrowserEnvironment?(n=e||_.EMPTY_STRING,i=this.redirectResponse.get(n),typeof i>"u"?(this.eventHandler.emitEvent(X.HANDLE_REDIRECT_START,G.Redirect),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise"),o=this.browserStorage.getCachedNativeRequest(),a=void 0,o&&vo.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e?(this.logger.trace("handleRedirectPromise - acquiring token from native platform"),s=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,o.accountId,this.nativeInternalStorage,o.correlationId),a=s.handleRedirectPromise()):(this.logger.trace("handleRedirectPromise - acquiring token from web flow"),c=this.browserStorage.getTemporaryCache(pe.CORRELATION_ID,!0)||_.EMPTY_STRING,l=this.createRedirectClient(c),a=l.handleRedirectPromise(e)),i=a.then(function(u){if(u){var f=r.length<d.getAllAccounts().length;f?(d.eventHandler.emitEvent(X.LOGIN_SUCCESS,G.Redirect,u),d.logger.verbose("handleRedirectResponse returned result, login success")):(d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_SUCCESS,G.Redirect,u),d.logger.verbose("handleRedirectResponse returned result, acquire token success"))}return d.eventHandler.emitEvent(X.HANDLE_REDIRECT_END,G.Redirect),u}).catch(function(u){throw r.length>0?d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Redirect,null,u):d.eventHandler.emitEvent(X.LOGIN_FAILURE,G.Redirect,null,u),d.eventHandler.emitEvent(X.HANDLE_REDIRECT_END,G.Redirect),u}),this.redirectResponse.set(n,i)):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),[2,i]):(this.logger.verbose("handleRedirectPromise returns null, not browser environment"),[2,null])})})},t.prototype.acquireTokenRedirect=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s=this;return k(this,function(c){return r=this.getRequestCorrelationId(e),this.logger.verbose("acquireTokenRedirect called",r),this.preflightBrowserEnvironmentCheck(G.Redirect),n=this.getAllAccounts().length>0,n?this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_START,G.Redirect,e):this.eventHandler.emitEvent(X.LOGIN_START,G.Redirect,e),this.nativeExtensionProvider&&this.canUseNative(e)?(o=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId),i=o.acquireTokenRedirect(e).catch(function(l){if(l instanceof En&&l.isFatal()){s.nativeExtensionProvider=void 0;var d=s.createRedirectClient(e.correlationId);return d.acquireToken(e)}else if(l instanceof sn){s.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");var d=s.createRedirectClient(e.correlationId);return d.acquireToken(e)}throw s.browserStorage.setInteractionInProgress(!1),l})):(a=this.createRedirectClient(e.correlationId),i=a.acquireToken(e)),[2,i.catch(function(l){throw n?s.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Redirect,null,l):s.eventHandler.emitEvent(X.LOGIN_FAILURE,G.Redirect,null,l),l})]})})},t.prototype.acquireTokenPopup=function(e){var r=this,n=this.getRequestCorrelationId(e),i=this.performanceClient.startMeasurement(pt.AcquireTokenPopup,n);try{this.logger.verbose("acquireTokenPopup called",n),this.preflightBrowserEnvironmentCheck(G.Popup)}catch(c){return Promise.reject(c)}var o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_START,G.Popup,e):this.eventHandler.emitEvent(X.LOGIN_START,G.Popup,e);var a;if(this.canUseNative(e))a=this.acquireTokenNative(e,Pe.acquireTokenPopup).then(function(c){return r.browserStorage.setInteractionInProgress(!1),i.endMeasurement({success:!0,isNativeBroker:!0,requestId:c.requestId}),i.flushMeasurement(),c}).catch(function(c){if(c instanceof En&&c.isFatal()){r.nativeExtensionProvider=void 0;var l=r.createPopupClient(e.correlationId);return l.acquireToken(e)}else if(c instanceof sn){r.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");var l=r.createPopupClient(e.correlationId);return l.acquireToken(e)}throw r.browserStorage.setInteractionInProgress(!1),c});else{var s=this.createPopupClient(e.correlationId);a=s.acquireToken(e)}return a.then(function(c){var l=o.length<r.getAllAccounts().length;return l?r.eventHandler.emitEvent(X.LOGIN_SUCCESS,G.Popup,c):r.eventHandler.emitEvent(X.ACQUIRE_TOKEN_SUCCESS,G.Popup,c),i.addStaticFields({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),i.endMeasurement({success:!0,requestId:c.requestId}),i.flushMeasurement(),c}).catch(function(c){return o.length>0?r.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Popup,null,c):r.eventHandler.emitEvent(X.LOGIN_FAILURE,G.Popup,null,c),i.endMeasurement({errorCode:c.errorCode,subErrorCode:c.subError,success:!1}),i.flushMeasurement(),Promise.reject(c)})},t.prototype.ssoSilent=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s=this;return k(this,function(c){return r=this.getRequestCorrelationId(e),n=K(K({},e),{prompt:e.prompt,correlationId:r}),this.preflightBrowserEnvironmentCheck(G.Silent),i=this.performanceClient.startMeasurement(pt.SsoSilent,r),this.logger.verbose("ssoSilent called",r),this.eventHandler.emitEvent(X.SSO_SILENT_START,G.Silent,n),this.canUseNative(n)?o=this.acquireTokenNative(n,Pe.ssoSilent).catch(function(l){if(l instanceof En&&l.isFatal()){s.nativeExtensionProvider=void 0;var d=s.createSilentIframeClient(n.correlationId);return d.acquireToken(n)}throw l}):(a=this.createSilentIframeClient(n.correlationId),o=a.acquireToken(n)),[2,o.then(function(l){return s.eventHandler.emitEvent(X.SSO_SILENT_SUCCESS,G.Silent,l),i.addStaticFields({accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length}),i.endMeasurement({success:!0,isNativeBroker:l.fromNativeBroker,requestId:l.requestId}),i.flushMeasurement(),l}).catch(function(l){throw s.eventHandler.emitEvent(X.SSO_SILENT_FAILURE,G.Silent,null,l),i.endMeasurement({errorCode:l.errorCode,subErrorCode:l.subError,success:!1}),i.flushMeasurement(),l})]})})},t.prototype.acquireTokenByCode=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a=this;return k(this,function(s){r=this.getRequestCorrelationId(e),this.preflightBrowserEnvironmentCheck(G.Silent),this.logger.trace("acquireTokenByCode called",r),this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_START,G.Silent,e),n=this.performanceClient.startMeasurement(pt.AcquireTokenByCode,e.correlationId);try{if(e.code)return i=e.code,o=this.hybridAuthCodeResponses.get(i),o?(this.logger.verbose("Existing acquireTokenByCode request found",e.correlationId),n.endMeasurement({success:!0}),n.discardMeasurement()):(this.logger.verbose("Initiating new acquireTokenByCode request",r),o=this.acquireTokenByCodeAsync(K(K({},e),{correlationId:r})).then(function(c){return a.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_SUCCESS,G.Silent,c),a.hybridAuthCodeResponses.delete(i),n.addStaticFields({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),n.endMeasurement({success:!0,isNativeBroker:c.fromNativeBroker,requestId:c.requestId}),n.flushMeasurement(),c}).catch(function(c){throw a.hybridAuthCodeResponses.delete(i),a.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_FAILURE,G.Silent,null,c),n.endMeasurement({errorCode:c.errorCode,subErrorCode:c.subError,success:!1}),n.flushMeasurement(),c}),this.hybridAuthCodeResponses.set(i,o)),[2,o];if(e.nativeAccountId){if(this.canUseNative(e,e.nativeAccountId))return[2,this.acquireTokenNative(e,Pe.acquireTokenByCode,e.nativeAccountId).catch(function(c){throw c instanceof En&&c.isFatal()&&(a.nativeExtensionProvider=void 0),c})];throw D.createUnableToAcquireTokenFromNativePlatformError()}else throw D.createAuthCodeOrNativeAccountIdRequiredError()}catch(c){throw this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_FAILURE,G.Silent,null,c),n.endMeasurement({errorCode:c instanceof W&&c.errorCode||void 0,subErrorCode:c instanceof W&&c.subError||void 0,success:!1}),c}return[2]})})},t.prototype.acquireTokenByCodeAsync=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),r=this.createSilentAuthCodeClient(e.correlationId),[4,r.acquireToken(e)];case 1:return n=i.sent(),[2,n]}})})},t.prototype.acquireTokenFromCache=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){switch(n.cacheLookupPolicy){case fr.Default:case fr.AccessToken:case fr.AccessTokenAndRefreshToken:return[2,e.acquireToken(r)];default:throw j.createRefreshRequiredError()}return[2]})})},t.prototype.acquireTokenByRefreshToken=function(e,r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){switch(r.cacheLookupPolicy){case fr.Default:case fr.AccessTokenAndRefreshToken:case fr.RefreshToken:case fr.RefreshTokenAndNetwork:return n=this.createSilentRefreshClient(e.correlationId),[2,n.acquireToken(e)];default:throw j.createRefreshRequiredError()}return[2]})})},t.prototype.acquireTokenBySilentIframe=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){return r=this.createSilentIframeClient(e.correlationId),[2,r.acquireToken(e)]})})},t.prototype.logout=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){return r=this.getRequestCorrelationId(e),this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",r),[2,this.logoutRedirect(K({correlationId:r},e))]})})},t.prototype.logoutRedirect=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){return r=this.getRequestCorrelationId(e),this.preflightBrowserEnvironmentCheck(G.Redirect),n=this.createRedirectClient(r),[2,n.logout(e)]})})},t.prototype.logoutPopup=function(e){try{var r=this.getRequestCorrelationId(e);this.preflightBrowserEnvironmentCheck(G.Popup);var n=this.createPopupClient(r);return n.logout(e)}catch(i){return Promise.reject(i)}},t.prototype.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.isBrowserEnvironment?this.browserStorage.getAllAccounts():[]},t.prototype.getAccountByUsername=function(e){var r=this.getAllAccounts();return!V.isEmpty(e)&&r&&r.length?(this.logger.verbose("Account matching username found, returning"),this.logger.verbosePii("Returning signed-in accounts matching username: "+e),r.filter(function(n){return n.username.toLowerCase()===e.toLowerCase()})[0]||null):(this.logger.verbose("getAccountByUsername: No matching account found, returning null"),null)},t.prototype.getAccountByHomeId=function(e){var r=this.getAllAccounts();return!V.isEmpty(e)&&r&&r.length?(this.logger.verbose("Account matching homeAccountId found, returning"),this.logger.verbosePii("Returning signed-in accounts matching homeAccountId: "+e),r.filter(function(n){return n.homeAccountId===e})[0]||null):(this.logger.verbose("getAccountByHomeId: No matching account found, returning null"),null)},t.prototype.getAccountByLocalId=function(e){var r=this.getAllAccounts();return!V.isEmpty(e)&&r&&r.length?(this.logger.verbose("Account matching localAccountId found, returning"),this.logger.verbosePii("Returning signed-in accounts matching localAccountId: "+e),r.filter(function(n){return n.localAccountId===e})[0]||null):(this.logger.verbose("getAccountByLocalId: No matching account found, returning null"),null)},t.prototype.setActiveAccount=function(e){this.browserStorage.setActiveAccount(e)},t.prototype.getActiveAccount=function(){return this.browserStorage.getActiveAccount()},t.prototype.preflightBrowserEnvironmentCheck=function(e,r){if(r===void 0&&(r=!0),this.logger.verbose("preflightBrowserEnvironmentCheck started"),Je.blockNonBrowserEnvironment(this.isBrowserEnvironment),Je.blockRedirectInIframe(e,this.config.system.allowRedirectInIframe),Je.blockReloadInHiddenIframes(),Je.blockAcquireTokenInPopups(),Je.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),e===G.Redirect&&this.config.cache.cacheLocation===$t.MemoryStorage&&!this.config.cache.storeAuthStateInCookie)throw Gd.createInMemoryRedirectUnavailableError();(e===G.Redirect||e===G.Popup)&&this.preflightInteractiveRequest(r)},t.prototype.preflightInteractiveRequest=function(e){this.logger.verbose("preflightInteractiveRequest called, validating app environment"),Je.blockReloadInHiddenIframes(),e&&this.browserStorage.setInteractionInProgress(!0)},t.prototype.acquireTokenNative=function(e,r,n){return S(this,void 0,void 0,function(){var i;return k(this,function(o){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw D.createNativeConnectionNotEstablishedError();return i=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,r,this.performanceClient,this.nativeExtensionProvider,n||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId),[2,i.acquireToken(e)]})})},t.prototype.canUseNative=function(e,r){if(this.logger.trace("canUseNative called"),!vo.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 Bt.NONE:case Bt.CONSENT:case Bt.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!r&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0},t.prototype.getNativeAccountId=function(e){var r=e.account||this.browserStorage.getAccountInfoByHints(e.loginHint,e.sid)||this.getActiveAccount();return r&&r.nativeAccountId||""},t.prototype.createPopupClient=function(e){return new A_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},t.prototype.createRedirectClient=function(e){return new k_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},t.prototype.createSilentIframeClient=function(e){return new H_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},t.prototype.createSilentCacheClient=function(e){return new c3(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},t.prototype.createSilentRefreshClient=function(e){return new L_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},t.prototype.createSilentAuthCodeClient=function(e){return new X_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)},t.prototype.addEventCallback=function(e){return this.eventHandler.addEventCallback(e)},t.prototype.removeEventCallback=function(e){this.eventHandler.removeEventCallback(e)},t.prototype.addPerformanceCallback=function(e){return this.performanceClient.addPerformanceCallback(e)},t.prototype.removePerformanceCallback=function(e){return this.performanceClient.removePerformanceCallback(e)},t.prototype.enableAccountStorageEvents=function(){this.eventHandler.enableAccountStorageEvents()},t.prototype.disableAccountStorageEvents=function(){this.eventHandler.disableAccountStorageEvents()},t.prototype.getTokenCache=function(){return this.tokenCache},t.prototype.getLogger=function(){return this.logger},t.prototype.setLogger=function(e){this.logger=e},t.prototype.initializeWrapperLibrary=function(e,r){this.browserStorage.setWrapperMetadata(e,r)},t.prototype.setNavigationClient=function(e){this.navigationClient=e},t.prototype.getConfiguration=function(){return this.config},t.prototype.getRequestCorrelationId=function(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?this.browserCrypto.createNewGuid():_.EMPTY_STRING},t}();var tb=function(t){It(e,t);function e(r){var n=t.call(this,r)||this;return n.activeSilentTokenRequests=new Map,n}return e.prototype.loginRedirect=function(r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){return n=this.getRequestCorrelationId(r),this.logger.verbose("loginRedirect called",n),[2,this.acquireTokenRedirect(K({correlationId:n},r||cm))]})})},e.prototype.loginPopup=function(r){var n=this.getRequestCorrelationId(r);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup(K({correlationId:n},r||cm))},e.prototype.acquireTokenSilent=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d=this;return k(this,function(h){if(n=this.getRequestCorrelationId(r),i=this.performanceClient.startMeasurement(pt.AcquireTokenSilent,n),i.addStaticFields({cacheLookupPolicy:r.cacheLookupPolicy}),this.preflightBrowserEnvironmentCheck(G.Silent),this.logger.verbose("acquireTokenSilent called",n),o=r.account||this.getActiveAccount(),!o)throw D.createNoAccountError();return a={clientId:this.config.auth.clientId,authority:r.authority||_.EMPTY_STRING,scopes:r.scopes,homeAccountIdentifier:o.homeAccountId,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},s=JSON.stringify(a),c=this.activeSilentTokenRequests.get(s),typeof c>"u"?(this.logger.verbose("acquireTokenSilent called for the first time, storing active request",n),l=this.acquireTokenSilentAsync(K(K({},r),{correlationId:n}),o).then(function(u){return d.activeSilentTokenRequests.delete(s),i.addStaticFields({accessTokenSize:u.accessToken.length,idTokenSize:u.idToken.length}),i.endMeasurement({success:!0,fromCache:u.fromCache,isNativeBroker:u.fromNativeBroker,requestId:u.requestId}),i.flushMeasurement(),u}).catch(function(u){throw d.activeSilentTokenRequests.delete(s),i.endMeasurement({errorCode:u.errorCode,subErrorCode:u.subError,success:!1}),i.flushMeasurement(),u}),this.activeSilentTokenRequests.set(s,l),[2,l]):(this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",n),i.endMeasurement({success:!0}),i.discardMeasurement(),[2,c])})})},e.prototype.acquireTokenSilentAsync=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c,l,d=this;return k(this,function(h){switch(h.label){case 0:return this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_START,G.Silent,r),i=this.performanceClient.startMeasurement(pt.AcquireTokenSilentAsync,r.correlationId),vo.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,r.authenticationScheme)&&n.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),a=K(K({},r),{account:n}),o=this.acquireTokenNative(a,Pe.acquireTokenSilent_silentFlow).catch(function(u){return S(d,void 0,void 0,function(){var f;return k(this,function(v){if(u instanceof En&&u.isFatal())return this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,f=this.createSilentIframeClient(r.correlationId),[2,f.acquireToken(r)];throw u})})}),[3,3]):[3,1];case 1:return this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),s=this.createSilentCacheClient(r.correlationId),[4,s.initializeSilentRequest(r,n)];case 2:c=h.sent(),l=K(K({},r),{cacheLookupPolicy:r.cacheLookupPolicy||fr.Default}),o=this.acquireTokenFromCache(s,c,l).catch(function(u){if(l.cacheLookupPolicy===fr.AccessToken)throw u;return Je.blockReloadInHiddenIframes(),d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_NETWORK_START,G.Silent,c),d.acquireTokenByRefreshToken(c,l).catch(function(f){var v=f instanceof ko,g=f instanceof sn,x=f.errorCode===nn.INVALID_GRANT_ERROR;if((!v||!x||g||l.cacheLookupPolicy===fr.AccessTokenAndRefreshToken||l.cacheLookupPolicy===fr.RefreshToken)&&l.cacheLookupPolicy!==fr.Skip)throw f;return d.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",r.correlationId),d.acquireTokenBySilentIframe(c)})}),h.label=3;case 3:return[2,o.then(function(u){return d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_SUCCESS,G.Silent,u),i.endMeasurement({success:!0,fromCache:u.fromCache,isNativeBroker:u.fromNativeBroker,requestId:u.requestId}),u}).catch(function(u){throw d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Silent,null,u),i.endMeasurement({errorCode:u.errorCode,subErrorCode:u.subError,success:!1}),u})]}})})},e}(eb);const pm="redirect";var mm=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class rb extends tb{get account(){return this.getAllAccounts().find(n=>{var i;return((i=n.idTokenClaims)===null||i===void 0?void 0:i.aud)===this.clientId})}get hasValidClaims(){var e;const r=(e=this.account)===null||e===void 0?void 0:e.idTokenClaims;if(r){const n=Math.ceil(Date.now()/1e3);return r.exp>n}return!1}get clientId(){var e;return(e=this.config.auth)===null||e===void 0?void 0:e.clientId}get requestOrigin(){return this.browserStorage.getTemporaryCache("request.origin",!0)}constructor(e,r){super(r),this.tenantId=e}login(e,r=pm,n=!0){var i;return mm(this,void 0,void 0,function*(){const o=(e==null?void 0:e.loginHint)||((i=this.account)===null||i===void 0?void 0:i.username),a=(e==null?void 0:e.scopes)||[],s=Object.assign(Object.assign({},e),{loginHint:o,scopes:a});if(o&&n){this.logger.verbose("Attempting to login in silently");try{return yield this.ssoSilent(s)}catch{this.logger.verbose("Silent login attempt failed")}}switch(this.logger.verbose(`Attempting to login in by [${r}]`),r){case"popup":return this.loginPopup(s);case"redirect":return this.loginRedirect(s)}})}acquireToken(e={scopes:[]},r=pm,n=!0){return mm(this,void 0,void 0,function*(){const i=yield this.account;if(n&&i){this.logger.verbose("Attempting to acquire token in silently");try{return yield this.acquireTokenSilent(Object.assign({account:i},e))}catch{this.logger.info("Expected to navigate away from the current page but timeout occurred.")}}switch(this.logger.verbose(`Attempting to acquire token by [${r}]`),r){case"popup":return this.acquireTokenPopup(e);case"redirect":return this.acquireTokenRedirect(e)}})}}const nb=(t,e=window.location.origin)=>{t=t.match(/^http[s]?/)?t:e+t;const{origin:r,pathname:n}=new URL(t);return r+n.replace(/([^:]\/)\/+/g,"$1")},ib=(t,e,r,n,i)=>{const o=Object.assign({clientId:e,redirectUri:nb(r||""),navigateToLoginRequestUrl:!1,authority:`https://login.microsoftonline.com/${t}`},n==null?void 0:n.auth),a=Object.assign({cacheLocation:"localStorage"},n==null?void 0:n.cache),s=n==null?void 0:n.system;return new(i||rb)(t,{auth:o,cache:a,system:s})};class f3 extends Jf{constructor(e){super({logLevel:e,loggerCallback:(...r)=>this.loggerCallback(...r)}),this.getLogType=r=>{switch(r){case tt.Error:return"error";case tt.Warning:return"warn";case tt.Info:return"info";case tt.Verbose:default:return"debug"}}}loggerCallback(e,r,n){console[this.getLogType(e)]("%c FUSION::MSAL %c %s","border: 1px solid;","border: none;",r)}}var bh=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const ob="default";class ab{get defaultClient(){return this.getClient(ob)}get defaultAccount(){return this.defaultClient.account}get defaultConfig(){return this._config.defaultConfig}constructor(e){this._config=e,this._clients={}}getClient(e){return this._clients[e]||(this._clients[e]=this.createClient(e)),this._clients[e]}createClient(e){const r=e?this._config.getClientConfig(e):this._config.defaultConfig;if(!r)throw Error("Could not find any config");const n=ib(r.tenantId,r.clientId,r.redirectUri,r.config);return n.setLogger(new f3(0)),n}handleRedirect(){return bh(this,void 0,void 0,function*(){const{redirectUri:e}=this.defaultConfig||{};if(window.location.pathname===e){const r=this.defaultClient,n=r.getLogger(),{requestOrigin:i}=r;yield r.handleRedirectPromise(),i===e?(n.warning(`detected callback loop from url ${e}, redirecting to root`),window.location.replace("/")):window.location.replace(i||"/")}return null})}acquireToken(e){return this.defaultClient.acquireToken(e)}acquireAccessToken(e){return bh(this,void 0,void 0,function*(){const r=yield this.acquireToken(e);return r?r.accessToken:void 0})}login(){return bh(this,void 0,void 0,function*(){yield this.defaultClient.login()})}}var sb=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const p3={name:"auth",configure:t=>{var e;const r=new Yy;return!((e=t==null?void 0:t.auth)===null||e===void 0)&&e.defaultConfig&&r.configureDefault(t.auth.defaultConfig),r},initialize:({config:t})=>sb(void 0,void 0,void 0,function*(){const e=new ab(t);return t.requiresAuth&&(yield e.handleRedirect(),e.defaultAccount||(yield e.login())),e})},cb=(t,e)=>({module:p3,configure:r=>{r.configureDefault(t),(e==null?void 0:e.requiresAuth)!==void 0&&(r.requiresAuth=e==null?void 0:e.requiresAuth);const{clients:n}=e??{};n&&Object.entries(n).forEach(([i,o])=>r.configureClient(i,o))}});var m3=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const lb=t=>{var e;return{id:t.id,isChildType:t.isChildType,parentTypeIds:(e=t.parentTypeIds)!==null&&e!==void 0?e:[]}},v3=t=>{var e,r,n,i;return{id:t.id,externalId:(e=t.externalId)!==null&&e!==void 0?e:void 0,isActive:t.isActive,isDeleted:t.isDeleted,created:new Date(t.created),source:(r=t.source)!==null&&r!==void 0?r:void 0,title:(n=t.title)!==null&&n!==void 0?n:void 0,type:lb(t.type),value:(i=t.value)!==null&&i!==void 0?i:{}}},db=t=>m3(void 0,void 0,void 0,function*(){const e=yield t.json();return v3(e)}),hb=t=>m3(void 0,void 0,void 0,function*(){return(yield t.json()).map(v3)});var ub=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fb=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},$l;class pb{constructor(e,r={}){this.config=r,$l.set(this,void 0),ub(this,$l,e,"f")}requireInstance(e){return fb(this,$l,"f").requireInstance(e)}setContextType(e){this.config.contextType=e}setContextFilter(e){this.config.contextFilter=e}setContextParameterFn(e){this.config.contextParameterFn=e}setContextClient(e,r=1*60*1e3){this.config.client={get:typeof e.get=="function"?{key:({id:n})=>n,client:{fn:e.get},expire:r}:e.get,query:typeof e.query=="function"?{key:n=>JSON.stringify(n),client:{fn:e.query},expire:r}:e.query}}}$l=new WeakMap;var pl=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},vm=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},jl;class mb{constructor(){this.defaultExpireTime=1*60*1e3,jl.set(this,[])}addConfigBuilder(e){vm(this,jl,"f").push(e)}_getServiceProvider(e){var r;return pl(this,void 0,void 0,function*(){if(e.hasModule("services"))return e.requireInstance("services");{const n=(r=e.ref)===null||r===void 0?void 0:r.services;if(n)return n;throw Error("no service services provider configures [ServicesModule]")}})}createConfig(e){var r;return pl(this,void 0,void 0,function*(){const n=yield vm(this,jl,"f").reduce((i,o)=>pl(this,void 0,void 0,function*(){const a=new pb(e,yield i);return yield Promise.resolve(o(a)),Object.assign(i,a.config)}),Promise.resolve({}));return(r=n.client)!==null&&r!==void 0||(n.client=yield(()=>pl(this,void 0,void 0,function*(){const o=yield(yield this._getServiceProvider(e)).createContextClient("json$");return{get:{client:{fn:a=>o.get("v1",a,{selector:db})},key:({id:a})=>a,expire:this.defaultExpireTime},query:{client:{fn:a=>o.query("v1",{query:a},{selector:hb})},key:a=>JSON.stringify(a),expire:this.defaultExpireTime}}}))()),n})}}jl=new WeakMap;var gm;(function(t){t.IDLE="idle",t.ACTIVE="active",t.FAILED="failed",t.CANCELED="canceled"})(gm||(gm={}));const vb=t=>e=>e.pipe(qn(t)),gb=t=>t.pipe(Ge(e=>e.value));var ml,yb=new Uint8Array(16);function _b(){if(!ml&&(ml=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ml))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ml(yb)}const bb=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function g3(t){return typeof t=="string"&&bb.test(t)}var xt=[];for(var wh=0;wh<256;++wh)xt.push((wh+256).toString(16).substr(1));function y3(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(xt[t[e+0]]+xt[t[e+1]]+xt[t[e+2]]+xt[t[e+3]]+"-"+xt[t[e+4]]+xt[t[e+5]]+"-"+xt[t[e+6]]+xt[t[e+7]]+"-"+xt[t[e+8]]+xt[t[e+9]]+"-"+xt[t[e+10]]+xt[t[e+11]]+xt[t[e+12]]+xt[t[e+13]]+xt[t[e+14]]+xt[t[e+15]]).toLowerCase();if(!g3(r))throw TypeError("Stringified UUID is invalid");return r}function wb(t){if(!g3(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function xb(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}var Eb="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Cb="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function zb(t,e,r){function n(i,o,a,s){if(typeof i=="string"&&(i=xb(i)),typeof o=="string"&&(o=wb(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var c=new Uint8Array(16+i.length);if(c.set(o),c.set(i,o.length),c=r(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,a){s=s||0;for(var l=0;l<16;++l)a[s+l]=c[l];return a}return y3(c)}try{n.name=t}catch{}return n.DNS=Eb,n.URL=Cb,n}function _3(t,e,r){t=t||{};var n=t.random||(t.rng||_b)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return y3(n)}function Sb(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function xh(t,e){return t<<e|t>>>32-e}function kb(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var i=0;i<n.length;++i)t.push(n.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),c=0;c<a;++c){for(var l=new Uint32Array(16),d=0;d<16;++d)l[d]=t[c*64+d*4]<<24|t[c*64+d*4+1]<<16|t[c*64+d*4+2]<<8|t[c*64+d*4+3];s[c]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var h=0;h<a;++h){for(var u=new Uint32Array(80),f=0;f<16;++f)u[f]=s[h][f];for(var v=16;v<80;++v)u[v]=xh(u[v-3]^u[v-8]^u[v-14]^u[v-16],1);for(var g=r[0],x=r[1],m=r[2],p=r[3],y=r[4],w=0;w<80;++w){var T=Math.floor(w/20),O=xh(g,5)+Sb(T,x,m,p)+y+e[T]+u[w]>>>0;y=p,p=m,m=xh(x,30)>>>0,x=g,g=O}r[0]=r[0]+g>>>0,r[1]=r[1]+x>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+p>>>0,r[4]=r[4]+y>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Ab=zb("v5",80,kb);const Tb=Ab;class p2 extends Error{constructor(e,r){super(r.message,{cause:r.cause}),this.type=e,this.request=r.request}}const b3=(...t)=>Wt(e=>t.includes(e.type));var Ut=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ib=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},yn,Xr;class t0 extends He{get action$(){return Ut(this,yn,"f").asObservable()}get value(){return Ut(this,Xr,"f").value}get closed(){return Ut(this,Xr,"f").closed||Ut(this,yn,"f").closed}constructor(e,r){super(i=>Ut(this,Xr,"f").subscribe(i)),yn.set(this,new Yn),Xr.set(this,void 0);const n="getInitialState"in e?e.getInitialState():r;Ib(this,Xr,new x1(n),"f"),Ut(this,yn,"f").pipe(Wg(e,n),Kg()).subscribe(Ut(this,Xr,"f")),this.reset=()=>Ut(this,Xr,"f").next(n)}next(e){Ut(this,yn,"f").next(e)}addEffect(e,r){const n=typeof e=="string"?this.action$.pipe(b3(e)):this.action$,i=r||e;return n.pipe(So(o=>or(new Promise((a,s)=>{try{a(i(o,this.value))}catch(c){s(c)}})).pipe(Kr(a=>(console.warn("unhandled effect",a),Oi)))),Wt(o=>!!o),Md(Id)).subscribe(Ut(this,yn,"f"))}addEpic(e){return this.addFlow(e)}addFlow(e){const r=e(this.action$,this);if(!r)throw new TypeError(`addEpic: one of the provided effects "${e.name||"<anonymous>"}" does not return a stream. Double check you're not missing a return statement!`);return r.pipe(Kr(n=>(console.trace("unhandled exception, epic closed!",n),Oi)),Md(Id)).subscribe(Ut(this,yn,"f"))}unsubscribe(){Ut(this,yn,"f").unsubscribe(),Ut(this,Xr,"f").unsubscribe()}complete(){Ut(this,yn,"f").complete(),Ut(this,Xr,"f").complete()}asObservable(){return Ut(this,Xr,"f").asObservable()}}yn=new WeakMap,Xr=new WeakMap;function St(t,e){function r(...n){if(e){const i=e(...n);if(!i)throw new Error("prepareAction did not return an object");return Object.assign(Object.assign({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:n[0]}}return r.toString=()=>`${t}`,r.type=t,r.match=n=>n.type===t,r}const Bl="::",r0=t=>new RegExp(`${Bl}\\${t}$`),ym=t=>t.type.replace(r0("\\w+$"),"");function Eh(t,e,r,n){const i=St([t,"request"].join(Bl),e);return r&&Object.assign(i,{success:St([t,"success"].join(Bl),r)}),n&&Object.assign(i,{failure:St([t,"failure"].join(Bl),n)}),i}const Mb=t=>!!t.type.match(/::request$/),Pb=t=>!!t.type.match(r0("success")),Rb=t=>!!t.type.match(r0("failure")),Hb=t=>Pb(t)||Rb(t);function zr(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map(function(i){return"'"+i+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Ni(t){return!!t&&!!t[_e]}function un(t){var e;return!!t&&(function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var i=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===Bb}(t)||Array.isArray(t)||!!t[Sm]||!!(!((e=t.constructor)===null||e===void 0)&&e[Sm])||n0(t)||i0(t))}function _m(t){return Ni(t)||zr(23,t),t[_e].t}function Ha(t,e,r){r===void 0&&(r=!1),ja(t)===0?(r?Object.keys:l0)(t).forEach(function(n){r&&typeof n=="symbol"||e(n,t[n],t)}):t.forEach(function(n,i){return e(i,n,t)})}function ja(t){var e=t[_e];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:n0(t)?2:i0(t)?3:0}function m2(t,e){return ja(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Lb(t,e){return ja(t)===2?t.get(e):t[e]}function w3(t,e,r){var n=ja(t);n===2?t.set(e,r):n===3?(t.delete(e),t.add(r)):t[e]=r}function Ob(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function n0(t){return $b&&t instanceof Map}function i0(t){return jb&&t instanceof Set}function gt(t){return t.o||t.t}function o0(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=qb(t);delete e[_e];for(var r=l0(e),n=0;n<r.length;n++){var i=r[n],o=e[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(e[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),e)}function a0(t,e){return e===void 0&&(e=!1),s0(t)||Ni(t)||!un(t)||(ja(t)>1&&(t.set=t.add=t.clear=t.delete=Db),Object.freeze(t),e&&Ha(t,function(r,n){return a0(n,!0)},!0)),t}function Db(){zr(2)}function s0(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function An(t){var e=g2[t];return e||zr(18,t),e}function Nb(t,e){g2[t]||(g2[t]=e)}function Wd(){return mc}function Ch(t,e){e&&(An("Patches"),t.u=[],t.s=[],t.v=e)}function Yd(t){v2(t),t.p.forEach(Vb),t.p=null}function v2(t){t===mc&&(mc=t.l)}function bm(t){return mc={p:[],l:mc,h:t,m:!0,_:0}}function Vb(t){var e=t[_e];e.i===0||e.i===1?e.j():e.O=!0}function zh(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.g||An("ES5").S(e,t,n),n?(r[_e].P&&(Yd(e),zr(4)),un(t)&&(t=Qd(e,t),e.l||Xd(e,t)),e.u&&An("Patches").M(r[_e].t,t,e.u,e.s)):t=Qd(e,r,[]),Yd(e),e.u&&e.v(e.u,e.s),t!==x3?t:void 0}function Qd(t,e,r){if(s0(e))return e;var n=e[_e];if(!n)return Ha(e,function(o,a){return wm(t,n,e,o,a,r)},!0),e;if(n.A!==t)return e;if(!n.P)return Xd(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=n.i===4||n.i===5?n.o=o0(n.k):n.o;Ha(n.i===3?new Set(i):i,function(o,a){return wm(t,n,i,o,a,r)}),Xd(t,i,!1),r&&t.u&&An("Patches").R(n,r,t.u,t.s)}return n.o}function wm(t,e,r,n,i,o){if(Ni(i)){var a=Qd(t,i,o&&e&&e.i!==3&&!m2(e.D,n)?o.concat(n):void 0);if(w3(r,n,a),!Ni(a))return;t.m=!1}if(un(i)&&!s0(i)){if(!t.h.F&&t._<1)return;Qd(t,i),e&&e.A.l||Xd(t,i)}}function Xd(t,e,r){r===void 0&&(r=!1),t.h.F&&t.m&&a0(e,r)}function Sh(t,e){var r=t[_e];return(r?gt(r):t)[e]}function xm(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function $n(t){t.P||(t.P=!0,t.l&&$n(t.l))}function kh(t){t.o||(t.o=o0(t.t))}function pc(t,e,r){var n=n0(e)?An("MapSet").N(e,r):i0(e)?An("MapSet").T(e,r):t.g?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Wd(),P:!1,I:!1,D:{},l:o,t:i,k:null,o:null,j:null,C:!1},c=s,l=y2;a&&(c=[s],l=_s);var d=Proxy.revocable(c,l),h=d.revoke,u=d.proxy;return s.k=u,s.j=h,u}(e,r):An("ES5").J(e,r);return(r?r.A:Wd()).p.push(n),n}function Fb(t){return Ni(t)||zr(22,t),function e(r){if(!un(r))return r;var n,i=r[_e],o=ja(r);if(i){if(!i.P&&(i.i<4||!An("ES5").K(i)))return i.t;i.I=!0,n=Em(r,o),i.I=!1}else n=Em(r,o);return Ha(n,function(a,s){i&&Lb(i.t,a)===s||w3(n,a,e(s))}),o===3?new Set(n):n}(t)}function Em(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return o0(t)}function Ub(){function t(s,c){function l(){this.constructor=s}i(s,c),s.prototype=(l.prototype=c.prototype,new l)}function e(s){s.o||(s.D=new Map,s.o=new Map(s.t))}function r(s){s.o||(s.o=new Set,s.t.forEach(function(c){if(un(c)){var l=pc(s.A.h,c,s);s.p.set(c,l),s.o.add(l)}else s.o.add(c)}))}function n(s){s.O&&zr(3,JSON.stringify(gt(s)))}var i=function(s,c){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,d){l.__proto__=d}||function(l,d){for(var h in d)d.hasOwnProperty(h)&&(l[h]=d[h])})(s,c)},o=function(){function s(l,d){return this[_e]={i:2,l:d,A:d?d.A:Wd(),P:!1,I:!1,o:void 0,D:void 0,t:l,k:this,C:!1,O:!1},this}t(s,Map);var c=s.prototype;return Object.defineProperty(c,"size",{get:function(){return gt(this[_e]).size}}),c.has=function(l){return gt(this[_e]).has(l)},c.set=function(l,d){var h=this[_e];return n(h),gt(h).has(l)&>(h).get(l)===d||(e(h),$n(h),h.D.set(l,!0),h.o.set(l,d),h.D.set(l,!0)),this},c.delete=function(l){if(!this.has(l))return!1;var d=this[_e];return n(d),e(d),$n(d),d.t.has(l)?d.D.set(l,!1):d.D.delete(l),d.o.delete(l),!0},c.clear=function(){var l=this[_e];n(l),gt(l).size&&(e(l),$n(l),l.D=new Map,Ha(l.t,function(d){l.D.set(d,!1)}),l.o.clear())},c.forEach=function(l,d){var h=this;gt(this[_e]).forEach(function(u,f){l.call(d,h.get(f),f,h)})},c.get=function(l){var d=this[_e];n(d);var h=gt(d).get(l);if(d.I||!un(h)||h!==d.t.get(l))return h;var u=pc(d.A.h,h,d);return e(d),d.o.set(l,u),u},c.keys=function(){return gt(this[_e]).keys()},c.values=function(){var l,d=this,h=this.keys();return(l={})[vl]=function(){return d.values()},l.next=function(){var u=h.next();return u.done?u:{done:!1,value:d.get(u.value)}},l},c.entries=function(){var l,d=this,h=this.keys();return(l={})[vl]=function(){return d.entries()},l.next=function(){var u=h.next();if(u.done)return u;var f=d.get(u.value);return{done:!1,value:[u.value,f]}},l},c[vl]=function(){return this.entries()},s}(),a=function(){function s(l,d){return this[_e]={i:3,l:d,A:d?d.A:Wd(),P:!1,I:!1,o:void 0,t:l,k:this,p:new Map,O:!1,C:!1},this}t(s,Set);var c=s.prototype;return Object.defineProperty(c,"size",{get:function(){return gt(this[_e]).size}}),c.has=function(l){var d=this[_e];return n(d),d.o?!!d.o.has(l)||!(!d.p.has(l)||!d.o.has(d.p.get(l))):d.t.has(l)},c.add=function(l){var d=this[_e];return n(d),this.has(l)||(r(d),$n(d),d.o.add(l)),this},c.delete=function(l){if(!this.has(l))return!1;var d=this[_e];return n(d),r(d),$n(d),d.o.delete(l)||!!d.p.has(l)&&d.o.delete(d.p.get(l))},c.clear=function(){var l=this[_e];n(l),gt(l).size&&(r(l),$n(l),l.o.clear())},c.values=function(){var l=this[_e];return n(l),r(l),l.o.values()},c.entries=function(){var l=this[_e];return n(l),r(l),l.o.entries()},c.keys=function(){return this.values()},c[vl]=function(){return this.values()},c.forEach=function(l,d){for(var h=this.values(),u=h.next();!u.done;)l.call(d,u.value,u.value,this),u=h.next()},s}();Nb("MapSet",{N:function(s,c){return new o(s,c)},T:function(s,c){return new a(s,c)}})}var Cm,mc,c0=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",$b=typeof Map<"u",jb=typeof Set<"u",zm=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",x3=c0?Symbol.for("immer-nothing"):((Cm={})["immer-nothing"]=!0,Cm),Sm=c0?Symbol.for("immer-draftable"):"__$immer_draftable",_e=c0?Symbol.for("immer-state"):"__$immer_state",vl=typeof Symbol<"u"&&Symbol.iterator||"@@iterator",Bb=""+Object.prototype.constructor,l0=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,qb=Object.getOwnPropertyDescriptors||function(t){var e={};return l0(t).forEach(function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)}),e},g2={},y2={get:function(t,e){if(e===_e)return t;var r=gt(t);if(!m2(r,e))return function(i,o,a){var s,c=xm(o,a);return c?"value"in c?c.value:(s=c.get)===null||s===void 0?void 0:s.call(i.k):void 0}(t,r,e);var n=r[e];return t.I||!un(n)?n:n===Sh(t.t,e)?(kh(t),t.o[e]=pc(t.A.h,n,t)):n},has:function(t,e){return e in gt(t)},ownKeys:function(t){return Reflect.ownKeys(gt(t))},set:function(t,e,r){var n=xm(gt(t),e);if(n!=null&&n.set)return n.set.call(t.k,r),!0;if(!t.P){var i=Sh(gt(t),e),o=i==null?void 0:i[_e];if(o&&o.t===r)return t.o[e]=r,t.D[e]=!1,!0;if(Ob(r,i)&&(r!==void 0||m2(t.t,e)))return!0;kh(t),$n(t)}return t.o[e]===r&&typeof r!="number"&&(r!==void 0||e in t.o)||(t.o[e]=r,t.D[e]=!0,!0)},deleteProperty:function(t,e){return Sh(t.t,e)!==void 0||e in t.t?(t.D[e]=!1,kh(t),$n(t)):delete t.D[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=gt(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.i!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty:function(){zr(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){zr(12)}},_s={};Ha(y2,function(t,e){_s[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),_s.deleteProperty=function(t,e){return _s.set.call(this,t,e,void 0)},_s.set=function(t,e,r){return y2.set.call(this,t[0],e,r,t[0])};var Gb=function(){function t(r){var n=this;this.g=zm,this.F=!0,this.produce=function(i,o,a){if(typeof i=="function"&&typeof o!="function"){var s=o;o=i;var c=n;return function(g){var x=this;g===void 0&&(g=s);for(var m=arguments.length,p=Array(m>1?m-1:0),y=1;y<m;y++)p[y-1]=arguments[y];return c.produce(g,function(w){var T;return(T=o).call.apply(T,[x,w].concat(p))})}}var l;if(typeof o!="function"&&zr(6),a!==void 0&&typeof a!="function"&&zr(7),un(i)){var d=bm(n),h=pc(n,i,void 0),u=!0;try{l=o(h),u=!1}finally{u?Yd(d):v2(d)}return typeof Promise<"u"&&l instanceof Promise?l.then(function(g){return Ch(d,a),zh(g,d)},function(g){throw Yd(d),g}):(Ch(d,a),zh(l,d))}if(!i||typeof i!="object"){if((l=o(i))===void 0&&(l=i),l===x3&&(l=void 0),n.F&&a0(l,!0),a){var f=[],v=[];An("Patches").M(i,l,f,v),a(f,v)}return l}zr(21,i)},this.produceWithPatches=function(i,o){if(typeof i=="function")return function(l){for(var d=arguments.length,h=Array(d>1?d-1:0),u=1;u<d;u++)h[u-1]=arguments[u];return n.produceWithPatches(l,function(f){return i.apply(void 0,[f].concat(h))})};var a,s,c=n.produce(i,o,function(l,d){a=l,s=d});return typeof Promise<"u"&&c instanceof Promise?c.then(function(l){return[l,a,s]}):[c,a,s]},typeof(r==null?void 0:r.useProxies)=="boolean"&&this.setUseProxies(r.useProxies),typeof(r==null?void 0:r.autoFreeze)=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var e=t.prototype;return e.createDraft=function(r){un(r)||zr(8),Ni(r)&&(r=Fb(r));var n=bm(this),i=pc(this,r,void 0);return i[_e].C=!0,v2(n),i},e.finishDraft=function(r,n){var i=r&&r[_e],o=i.A;return Ch(o,n),zh(void 0,o)},e.setAutoFreeze=function(r){this.F=r},e.setUseProxies=function(r){r&&!zm&&zr(20),this.g=r},e.applyPatches=function(r,n){var i;for(i=n.length-1;i>=0;i--){var o=n[i];if(o.path.length===0&&o.op==="replace"){r=o.value;break}}i>-1&&(n=n.slice(i+1));var a=An("Patches").$;return Ni(r)?a(r,n):this.produce(r,function(s){return a(s,n)})},t}(),Mr=new Gb,E3=Mr.produce;Mr.produceWithPatches.bind(Mr);Mr.setAutoFreeze.bind(Mr);Mr.setUseProxies.bind(Mr);Mr.applyPatches.bind(Mr);Mr.createDraft.bind(Mr);Mr.finishDraft.bind(Mr);function km(t){return un(t)?E3(t,()=>{}):t}function Kb(t){return typeof t=="function"}function d0(t,e){const[r,n,i]=Wb(e);let o;if(Kb(t))o=()=>km(t());else{const s=km(t);o=()=>s}function a(s=o(),c){let l=[r[c.type],...n.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return l.filter(d=>!!d).length===0&&(l=[i]),l.reduce((d,h)=>{if(h)if(Ni(d)){const f=h(d,c);return f===void 0?d:f}else{if(un(d))return E3(d,u=>h(u,c));{const u=h(d,c);if(u===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return u}}return d},s)}return a.getInitialState=o,a}function Wb(t){const e={},r=[];let n;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(s in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[s]=a,i},addMatcher(o,a){return r.push({matcher:o,reducer:a}),i},addDefaultCase(o){return n=o,i}};return t(i),[e,r,n]}const Yb=()=>({request:St("client/request",(e,r)=>{var n,i,o,a;return r??(r={}),(n=r.transaction)!==null&&n!==void 0||(r.transaction=_3()),(i=r.created)!==null&&i!==void 0||(r.created=Date.now()),(o=r.controller)!==null&&o!==void 0||(r.controller=new AbortController),(a=r.task)!==null&&a!==void 0||(r.task=new Tg),{payload:e,meta:r}}),retry:St("client/retry",e=>({payload:e})),success:St("client/success",(e,r)=>({payload:e,meta:r})),cancel:St("client/cancel",e=>({payload:e})),failure:St("client/failure",(e,r)=>({payload:e,meta:r})),error:St("client/error",(e,r)=>({payload:e,meta:r}))}),ot=Yb(),C3=t=>e=>e.pipe(Wt(ot.request.match),So(r=>{const{meta:{controller:n,transaction:i}}=r;return new He(o=>{if(n.signal.aborted)return o.next(ot.cancel({transaction:i,reason:`request [${i}] was aborted!`})),o.complete();o.add(e.pipe(Wt(ot.cancel.match)).subscribe(a=>{a.payload.transaction===i&&(n.signal.aborted||n.abort(),o.complete())})),o.add(Ju(n.signal,"abort").subscribe(()=>{o.next(ot.cancel({transaction:i,reason:`request [${i}] was aborted!`})),o.complete()})),o.add(or(t(r)).subscribe({next:a=>o.next(a),error:a=>o.next(ot.error(a,{request:r})),complete:()=>o.complete()}))})})),Qb=t=>(t=Object.assign({},{count:0,delay:0},t),(e,r)=>e.pipe(C3(n=>e.pipe(Wt(ot.failure.match),Wt(i=>i.meta.request===n),Qg(r),qn(([i,o])=>{var a,s;const{transaction:c}=n.meta,l=o[c];if(!l)return Oi;const d=(s=(a=l.retry)===null||a===void 0?void 0:a.length)!==null&&s!==void 0?s:0,h=Object.assign({},t,n.meta.retry);if(d>=h.count)throw h.count?Error("maximum retries executed!",{cause:i.payload}):i.payload;return(typeof h.delay=="function"?or(h.delay(i.payload.cause)).pipe(Kr(f=>{throw Error("failed to resolve delay",{cause:f})})):_y(h.delay)).pipe(Ge(()=>ot.retry(n)))}))))),Xb=t=>e=>e.pipe(C3(r=>or(t(r.payload,r.meta.controller.signal)).pipe(Ge(n=>ot.success(n,{request:r})),Kr(n=>Di(ot.failure(Error(`failed to execute request for transaction ${r.meta.transaction}`,{cause:n}),{request:r})))))),Jb=t=>t.pipe(Wt(ot.retry.match),Ge(e=>e.payload)),z3=()=>Wt(t=>t.status==="complete"),Zb=(t={})=>d0(t,e=>e.addCase(ot.request,(r,n)=>{const{transaction:i,task:o,ref:a,created:s}=n.meta;r[i]={transaction:i,task:o,ref:a,created:s}}).addCase(ot.success,(r,n)=>{const{request:i}=n.meta,{transaction:o,ref:a}=i.meta,s=r[o];if(s){const c={status:"complete",transaction:o,ref:a,value:n.payload,args:i.payload,created:s.created,completed:Date.now()};s.task.next(c),s.task.complete()}delete r[o]}).addCase(ot.retry,(r,n)=>{var i;const{transaction:o}=n.payload.meta,a=r[o];a&&((i=a.retry)!==null&&i!==void 0||(a.retry=[]),a.retry.push(Date.now()))}).addCase(ot.cancel,(r,n)=>{const{transaction:i,reason:o}=n.payload;if(r[i]){const a=Object.assign({},_m(r[i]));a.task.error(new p2("abort",{request:a,message:o??"request was canceled"})),delete r[i]}}).addCase(ot.failure,(r,n)=>{var i;const{payload:o,meta:a}=n,{transaction:s}=a.request.meta,c=r[s];c&&((i=c.errors)!==null&&i!==void 0||(c.errors=[]),c.errors.push(o))}).addCase(ot.error,(r,n)=>{const{payload:i,meta:o}=n,{transaction:a}=o.request.meta;if(r[a]){const s=Object.assign({},_m(r[a]));s.task.error(new p2("error",{request:s,message:`failed to process task [${a}]`,cause:i.cause})),delete r[a]}}));var ew=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},et=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Am=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},it,to;class Tm extends He{get closed(){return et(this,it,"f").closed}get state$(){return et(this,it,"f")}get action$(){return et(this,it,"f").action$}get success$(){return this.action$.pipe(Wt(ot.success.match),Ge(({payload:e})=>e))}get error$(){return this.action$.pipe(b3("client/error"),Qg(et(this,it,"f")),Ge(([e,r])=>{const{payload:n,meta:i}=e,{transaction:o}=i.request.meta,a=r[e.meta.request.meta.transaction];return new p2("error",{request:a,message:`failed to process task [${o}]`,cause:n})}))}constructor(e,r){super(o=>et(this,it,"f").subscribe(o)),it.set(this,void 0),to.set(this,void 0);const n={};Am(this,it,new t0(Zb(n)),"f"),Am(this,to,new fn(()=>et(this,it,"f").complete()),"f"),et(this,to,"f").add(et(this,it,"f").addFlow(Xb(e))),et(this,to,"f").add(et(this,it,"f").addFlow(Jb));const i=Object.assign({count:0,delay:0},r==null?void 0:r.retry);et(this,to,"f").add(et(this,it,"f").addFlow(Qb(i)))}next(e,r){const n=ot.request(e,r);return et(this,it,"f").next(n),n.meta}nextAsync(e,r){return ew(this,void 0,void 0,function*(){return an(this.next(e,r).task.pipe(z3()))})}getTaskByTransaction(e){const r=et(this,it,"f").value[e];return r&&r.task}getTaskByRef(e){const r=Object.values(et(this,it,"f").value).find(n=>n.ref===e);return r&&r.task}cancel(e,r){if(e&&et(this,it,"f").value[e])r??(r=`[${e}]: transaction canceled`),et(this,it,"f").next(ot.cancel({transaction:e,reason:r}));else for(const n of Object.keys(et(this,it,"f").value))this.cancel(n,`[${e}]: all transactions canceled`)}on(e,r){return et(this,it,"f").addEffect(ot[e].type,n=>{r(n,this)})}complete(){et(this,to,"f").unsubscribe()}asObservable(){return et(this,it,"f").asObservable()}}it=new WeakMap,to=new WeakMap;function tw(){return{set:St("cache/set",(t,e)=>({payload:{key:t,entry:e}})),remove:St("cache/remove",t=>({payload:t})),invalidate:St("cache/invalidate",t=>({payload:t})),trim:St("cache/trim",t=>({payload:t}))}}const Do=tw(),rw=(t,e)=>{var r,n;return((r=e.updated)!==null&&r!==void 0?r:0)-((n=t.updated)!==null&&n!==void 0?n:0)};function nw(t,e={}){return d0(e,r=>r.addCase(t.set,(n,i)=>{var o;const{key:a,entry:s}=i.payload,c=n[a];c?(c.updated=Date.now(),(o=c.updates)!==null&&o!==void 0||(c.updates=0),c.updates++):n[a]=Object.assign(Object.assign({},s),{created:Date.now()})}).addCase(t.remove,(n,i)=>{delete n[i.payload]}).addCase(t.invalidate,(n,i)=>{const o=n[i.payload];o&&delete o.updated}).addCase(t.trim,(n,i)=>{var o,a;const{payload:s}=i,c=(o=s.sort)!==null&&o!==void 0?o:rw,l=Object.keys(n),d=Object.entries(n).filter(([h,u])=>!s.validate||s.validate(u)).sort((h,u)=>c(h[1],u[1])).slice(0,(a=s.size)!==null&&a!==void 0?a:Number.MAX_SAFE_INTEGER).map(([h])=>h);if(l.length!==d.length)for(const h of l){const u=d.indexOf(h);u!==-1?d.splice(u,1):delete n[h]}}))}var gn=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},iw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Er;class Im{get state$(){return gn(this,Er,"f").asObservable()}constructor(e){Er.set(this,void 0);const{trimming:r,initial:n}=e;iw(this,Er,new t0(nw(Do,n)),"f"),r&&gn(this,Er,"f").addEffect("cache/set",()=>gn(this,Er,"f").next(Do.trim(r)))}setItem(...e){gn(this,Er,"f").next(Do.set(...e))}getItem(e){return gn(this,Er,"f").value[e]}removeItem(e){gn(this,Er,"f").next(Do.remove(e))}invalidate(e){gn(this,Er,"f").next(Do.invalidate(e))}trim(e){gn(this,Er,"f").next(Do.trim(e))}reset(){gn(this,Er,"f").reset()}complete(){gn(this,Er,"f").complete()}}Er=new WeakMap;var Le=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},No=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ow=globalThis&&globalThis.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},ro,Jr,ui,Bo,qo,ql,_2;const aw=(t=0)=>e=>{var r;return((r=e.updated)!==null&&r!==void 0?r:0)+t>Date.now()};class on{get client(){return Le(this,Jr,"f")}get cache(){return Le(this,ui,"f")}constructor(e){var r,n;ro.set(this,new fn),Jr.set(this,void 0),ui.set(this,void 0),Bo.set(this,new Yn),qo.set(this,void 0),ql.set(this,void 0),_2.set(this,_3()),No(this,qo,o=>Tb(e.key(o),Le(this,_2,"f")),"f"),No(this,ql,(r=e==null?void 0:e.validate)!==null&&r!==void 0?r:aw(e==null?void 0:e.expire),"f"),e.client instanceof Tm?No(this,Jr,e.client,"f"):(No(this,Jr,new Tm(e.client.fn,e.client.options),"f"),Le(this,ro,"f").add(()=>Le(this,Jr,"f").complete())),e.cache instanceof Im?No(this,ui,e.cache,"f"):(No(this,ui,new Im(e.cache||{}),"f"),Le(this,ro,"f").add(()=>Le(this,ui,"f").complete()));const i=(n=e.queueOperator)!==null&&n!==void 0?n:vb;Le(this,ro,"f").add(()=>Le(this,Bo,"f").complete()),Le(this,ro,"f").add(Le(this,Bo,"f").pipe(i(({args:o,options:a})=>new He(s=>{const{task:c,transaction:l}=Le(this,Jr,"f").next(o,a);s.add(c.pipe(Kr(()=>Oi)).subscribe(s)),s.add(()=>{setTimeout(()=>Le(this,Jr,"f").cancel(l))})})),z3(),Yg(()=>!Le(this,Jr,"f").closed)).subscribe(o=>{const{args:a,value:s,transaction:c,ref:l}=o,d=l??Le(this,qo,"f").call(this,a);Le(this,ui,"f").setItem(d,{value:s,args:a,transaction:c})}))}next(e,r){Le(this,Bo,"f").next({args:e,options:r})}query(e,r){var n;const i=Le(this,qo,"f").call(this,e);return(n=Le(this,Jr,"f").getTaskByRef(i))!==null&&n!==void 0?n:this._createTask(i,e,r)}queryAsync(e,r){const n=r||{},{awaitResolve:i}=n,o=ow(n,["awaitResolve"]);return(i?po:an)(this._query(e,o))}complete(){Le(this,ro,"f").unsubscribe()}_query(e,r){var n;const i=Le(this,qo,"f").call(this,e);return(n=Le(this,Jr,"f").getTaskByRef(i))!==null&&n!==void 0?n:this._createTask(i,e,r)}_createTask(e,r,n){var i;const o=new Tg,a=Le(this,ui,"f").getItem(e);if(a){const{value:l,args:d,created:h,updated:u,updates:f,transaction:v}=a,g={status:"cache",value:l,args:d,created:h,updated:u,updates:f,transaction:v};o.next(g)}const s=((i=n==null?void 0:n.cache)===null||i===void 0?void 0:i.validate)||Le(this,ql,"f");return a&&s(a,r)?o.complete():Le(this,Bo,"f").next({args:r,options:{ref:e,task:o}}),o.asObservable()}}ro=new WeakMap,Jr=new WeakMap,ui=new WeakMap,Bo=new WeakMap,qo=new WeakMap,ql=new WeakMap,_2=new WeakMap;on.extractQueryValue=gb;var li=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Mm=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},bs,Dn;class sw extends He{get currentContext(){return li(this,Dn,"f").value}get currentContext$(){return li(this,Dn,"f").asObservable()}get client(){return li(this,bs,"f")}constructor(e){super(r=>li(this,Dn,"f").subscribe(r)),bs.set(this,void 0),Dn.set(this,void 0),Mm(this,bs,new on(e),"f"),Mm(this,Dn,new x1(void 0),"f")}setCurrentContext(e){typeof e=="string"?this.resolveContext(e).pipe(Kr(()=>Oi)).subscribe(r=>li(this,Dn,"f").next(r)):e!==li(this,Dn,"f").value&&li(this,Dn,"f").next(e)}resolveContext(e){return li(this,bs,"f").query({id:e}).pipe(Ge(r=>r.value))}}bs=new WeakMap,Dn=new WeakMap;var bt=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Vo=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Nn,Gl,ws,Go,Kl,xs,Wl;class cw{get contextClient(){return bt(this,Nn,"f")}get queryClient(){return bt(this,Gl,"f")}queryContext(e){const r=this.queryClient.query(bt(this,Wl,"f").call(this,{search:e,type:bt(this,Kl,"f")})).pipe(Ge(n=>n.value));return bt(this,xs,"f")?r.pipe(Ge(bt(this,xs,"f"))):r}queryContextAsync(e){return po(this.queryContext(e))}get currentContext$(){return bt(this,Nn,"f").currentContext$}get currentContext(){return bt(this,Nn,"f").currentContext}set currentContext(e){bt(this,ws,"f")?bt(this,ws,"f").dispatchEvent("onCurrentContextChange",{source:this,canBubble:!0,cancelable:!0,detail:{context:e}}).then(r=>{r.canceled||bt(this,Nn,"f").setCurrentContext(e)}):bt(this,Nn,"f").setCurrentContext(e)}constructor(e){var r;Nn.set(this,void 0),Gl.set(this,void 0),ws.set(this,void 0),Go.set(this,new fn),Kl.set(this,void 0),xs.set(this,void 0),Wl.set(this,void 0);const{config:n,event:i,parentContext:o}=e;Vo(this,Kl,n.contextType,"f"),Vo(this,xs,n.contextFilter,"f"),Vo(this,Nn,new sw(n.client.get),"f"),Vo(this,Gl,new on(n.client.query),"f"),Vo(this,Wl,(r=n.contextParameterFn)!==null&&r!==void 0?r:a=>({search:a.search,filter:{type:a.type}}),"f"),i&&(Vo(this,ws,i,"f"),bt(this,Go,"f").add(bt(this,Nn,"f").currentContext$.pipe(Zu()).subscribe(([a,s])=>{i.dispatchEvent("onCurrentContextChanged",{source:this,canBubble:!0,detail:{previous:a,next:s}})})),bt(this,Go,"f").add(i.addEventListener("onCurrentContextChanged",a=>{a.source!==this&&(this.currentContext=a.detail.next)}))),o&&bt(this,Go,"f").add(o.contextClient.currentContext$.subscribe(a=>this.currentContext=a))}dispose(){bt(this,Go,"f").unsubscribe()}}Nn=new WeakMap,Gl=new WeakMap,ws=new WeakMap,Go=new WeakMap,Kl=new WeakMap,xs=new WeakMap,Wl=new WeakMap;var lw=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const dw="context",hw={name:dw,configure:()=>new mb,initialize:t=>lw(void 0,void 0,void 0,function*(){var e;const r=yield t.config.createConfig(t),n=t.hasModule("event")?yield t.requireInstance("event"):void 0,i=(e=t.ref)===null||e===void 0?void 0:e.context;return new cw({config:r,event:n,parentContext:i})}),dispose:t=>{t.instance.dispose()}};var uw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fw=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Yl;class pw{constructor(e,r={}){this.config=r,Yl.set(this,void 0),uw(this,Yl,e,"f")}requireInstance(e){return fw(this,Yl,"f").requireInstance(e)}setAppClient(e,r=1*60*1e3){this.config.client={getAppManifest:typeof e.getAppManifest=="function"?{key:({appKey:n})=>n,client:{fn:e.getAppManifest},expire:r}:e.getAppManifest,getAppManifests:typeof e.getAppManifests=="function"?{key:()=>"app_manifests",client:{fn:e.getAppManifests},expire:r}:e.getAppManifests,getAppConfig:typeof e.getAppConfig=="function"?{key:n=>JSON.stringify(n),client:{fn:e.getAppConfig},expire:r}:e.getAppConfig}}}Yl=new WeakMap;const mw=()=>({setManifest:St("set_manifest",t=>({payload:t,meta:{created:Date.now()}})),fetchManifest:Eh("fetch_manifest",t=>({payload:t}),t=>({payload:t}),t=>({payload:t})),setConfig:St("set_config",t=>({payload:t})),fetchConfig:Eh("fetch_config",t=>({payload:t}),t=>({payload:t}),t=>({payload:t})),setModule:St("set_module",t=>({payload:t})),importApp:Eh("import_app",t=>({payload:t}),t=>({payload:t}),t=>({payload:t})),setInstance:St("set_instance",t=>({payload:t}))}),ct=mw();Ub();const vw=t=>d0(Object.assign(Object.assign({},t),{status:new Set}),e=>e.addCase(ct.setManifest,(r,n)=>{r.manifest=n.payload}).addCase(ct.setConfig,(r,n)=>{r.config=n.payload}).addCase(ct.setModule,(r,n)=>{r.modules=n.payload}).addCase(ct.setInstance,(r,n)=>{r.instance=n.payload}).addMatcher(Mb,(r,n)=>{r.status.add(ym(n))}).addMatcher(Hb,(r,n)=>{r.status.delete(ym(n))})),gw="modulepreload",yw=function(t){return"/"+t},Pm={},S3=function(e,r,n){if(!r||r.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(r.map(o=>{if(o=yw(o),o in Pm)return;Pm[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!n)for(let d=i.length-1;d>=0;d--){const h=i[d];if(h.href===o&&(!a||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const l=document.createElement("link");if(l.rel=a?"stylesheet":gw,a||(l.as="script",l.crossOrigin=""),l.href=o,document.head.appendChild(l),a)return new Promise((d,h)=>{l.addEventListener("load",d),l.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())},_w=t=>e=>e.pipe(Wt(ct.fetchManifest.match),qn(({payload:r})=>{const n=or(t.getAppManifest(r)).pipe(Wt(i=>!!i),Ge(ct.setManifest));return Gg(n,n.pipe(Yf(),Ge(({payload:i})=>ct.fetchManifest.success(i)))).pipe(Kr(i=>Di(ct.fetchManifest.failure(i))))})),bw=t=>e=>e.pipe(Wt(ct.fetchConfig.match),qn(({payload:r})=>{const n=or(t.getAppConfig(r)).pipe(Ge(ct.setConfig));return Gg(n,n.pipe(Yf(),Ge(({payload:i})=>ct.fetchConfig.success(i)))).pipe(Kr(i=>Di(ct.fetchConfig.failure(i))))})),ww=()=>t=>t.pipe(Wt(ct.importApp.match),qn(({payload:e})=>or(S3(()=>import(e),[])).pipe(Ge(ct.importApp.success),Kr(r=>Di(ct.importApp.failure(r)))))),xw=(t,e)=>{const r=vw(t),n=new t0(r);return n.addFlow(_w(e)),n.addFlow(bw(e)),n.addFlow(ww()),n};var Ew=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},xe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Cw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ve;function ua(){return Wt(t=>t!=null)}class Rm{get manifest$(){return xe(this,ve,"f").pipe(Ge(({manifest:e})=>e),ua())}get config$(){return xe(this,ve,"f").pipe(Ge(({config:e})=>e),ua())}get modules$(){return xe(this,ve,"f").pipe(Ge(({modules:e})=>e),ua())}get instance$(){return xe(this,ve,"f").pipe(Ge(({instance:e})=>e),ua())}get appKey(){return xe(this,ve,"f").value.appKey}get manifest(){return an(this.manifest$)}get config(){return an(this.config$)}get instance(){return xe(this,ve,"f").value.instance}constructor(e,r){ve.set(this,void 0),Cw(this,ve,xw(e,r.provider),"f");const{appKey:n}=e,i=new fn;r.event&&i.add(r.event.addEventListener("onAppModulesLoaded",o=>{o.detail.appKey===n&&xe(this,ve,"f").next(ct.setInstance(o.detail.modules))})),this.dispose=()=>{xe(this,ve,"f").value.instance&&xe(this,ve,"f").value.instance.dispose(),i.unsubscribe(),xe(this,ve,"f").complete()}}initialize(){return dy([this.getManifest(),this.getAppModule(),this.getConfig()])}loadConfig(){xe(this,ve,"f").next(ct.fetchConfig(this.appKey))}loadManifest(){xe(this,ve,"f").next(ct.fetchManifest(this.appKey))}loadAppModule(e=!0){return Ew(this,void 0,void 0,function*(){const r=yield this.getManifestAsync(e);xe(this,ve,"f").next(ct.importApp(r.entry))})}getConfig(e=!1){return new He(r=>{if(xe(this,ve,"f").value.config&&(r.next(xe(this,ve,"f").value.config),!e))return r.complete();r.add(xe(this,ve,"f").addEffect("set_config",({payload:n})=>{r.next(n)})),r.add(xe(this,ve,"f").addEffect("fetch_config::success",({payload:n})=>{r.next(n),r.complete()})),r.add(xe(this,ve,"f").addEffect("fetch_config::failure",({payload:n})=>{r.error(Error("failed to load application config",{cause:n}))})),this.loadConfig()})}getConfigAsync(e=!0){return(e?an:po)(this.getConfig(!e))}getManifest(e=!1){return new He(r=>{if(xe(this,ve,"f").value.manifest&&(r.next(xe(this,ve,"f").value.manifest),!e))return r.complete();r.add(xe(this,ve,"f").addEffect("set_manifest",({payload:n})=>{r.next(n)})),r.add(xe(this,ve,"f").addEffect("fetch_manifest::success",({payload:n})=>{r.next(n),r.complete()})),r.add(xe(this,ve,"f").addEffect("fetch_manifest::failure",({payload:n})=>{r.error(Error("failed to load application manifest",{cause:n}))})),this.loadManifest()})}getManifestAsync(e=!0){return(e?an:po)(this.getManifest(!e))}getAppModule(e=!1){return new He(r=>{if(xe(this,ve,"f").value.modules&&(r.next(xe(this,ve,"f").value.modules),!e))return r.complete();r.add(xe(this,ve,"f").addEffect("set_module",({payload:n})=>{r.next(n)})),r.add(xe(this,ve,"f").addEffect("import_app::success",({payload:n})=>{r.next(n),r.complete()})),r.add(xe(this,ve,"f").addEffect("import_app::failure",({payload:n})=>{r.error(Error("failed to load application modules from script",{cause:n}))})),r.add(this.getManifest().subscribe(n=>Di(xe(this,ve,"f").next(ct.importApp(n.entry)))))})}getAppModuleAsync(e=!0){return(e?an:po)(this.getAppModule(!e))}}ve=new WeakMap;class Pi extends Error{static fromHttpResponse(e,r){switch(e.status){case 401:return new Pi("unauthorized","failed to load application manifest, request not authorized",r);case 404:return new Pi("not_found","application manifest not found",r)}return new Pi("unknown",`failed to load application manifest, status code ${e.status}`,r)}constructor(e,r,n){super(r,n),this.type=e}}class go extends Error{static fromHttpResponse(e,r){switch(e.status){case 401:return new go("unauthorized","failed to load application config, request not authorized",r);case 404:return new go("not_found","application config not found",r)}return new go("unknown",`failed to load application config, status code ${e.status}`,r)}constructor(e,r,n){super(r,n),this.type=e}}var Zt=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},gl=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Es,Cs,no,fi,Ql;class zw{static compareAppManifest(e,r){return JSON.stringify(e)===JSON.stringify(r)}get current(){return Zt(this,no,"f").value}get current$(){return Zt(this,no,"f").pipe(ua(),Ey("appKey"))}constructor(e){Es.set(this,void 0),Cs.set(this,void 0),no.set(this,void 0),fi.set(this,new fn),Ql.set(this,void 0);const{event:r,config:n}=e;gl(this,Ql,r,"f"),gl(this,no,new x1(void 0),"f"),this.appClient=new on(n.client.getAppManifest),gl(this,Es,new on(n.client.getAppManifests),"f"),gl(this,Cs,new on(n.client.getAppConfig),"f"),Zt(this,fi,"f").add(()=>this.appClient.complete()),Zt(this,fi,"f").add(()=>Zt(this,Es,"f").complete()),Zt(this,fi,"f").add(()=>Zt(this,Cs,"f").complete()),Zt(this,fi,"f").add(this.current$.pipe(Zu(),Yg(()=>!!r)).subscribe(([i,o])=>{r==null||r.dispatchEvent("onCurrentAppChanged",{source:this,detail:{previous:i,next:o}})})),Zt(this,fi,"f").add(Zt(this,no,"f").pipe(Zu(),Ge(([i])=>i),ua()).subscribe(i=>i.dispose()))}getAppManifest(e){return on.extractQueryValue(this.appClient.query({appKey:e}).pipe(Kr(r=>{const{cause:n}=r;throw n instanceof Pi?n:n instanceof r2?Pi.fromHttpResponse(n.response,{cause:n}):new Pi("unknown","failed to load manifest",{cause:n})})))}getAllAppManifests(){return on.extractQueryValue(Zt(this,Es,"f").query())}getAppConfig(e,r){return on.extractQueryValue(Zt(this,Cs,"f").query({appKey:e,tag:r}).pipe(Kr(n=>{const{cause:i}=n;throw i instanceof go?i:i instanceof r2?go.fromHttpResponse(i.response,{cause:i}):new go("unknown","failed to load config",{cause:i})})))}setCurrentApp(e){const r=typeof e=="string"?this.createApp({appKey:e}):Rm;Zt(this,no,"f").next(r)}createApp(e){return new Rm(e,{provider:this,event:Zt(this,Ql,"f")})}dispose(){Zt(this,fi,"f").unsubscribe()}}Es=new WeakMap,Cs=new WeakMap,no=new WeakMap,fi=new WeakMap,Ql=new WeakMap;var Sw=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const b2="app",kw={name:b2,configure:()=>new Aw,initialize:t=>Sw(void 0,void 0,void 0,function*(){const e=yield t.config.createConfig(t),r=yield t.requireInstance("event").catch(()=>{});return new zw({config:e,event:r})}),dispose:t=>{t.instance.dispose()}};var yl=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},Hm=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Xl;class Aw{constructor(){this.defaultExpireTime=1*60*1e3,Xl.set(this,[])}addConfigBuilder(e){Hm(this,Xl,"f").push(e)}_createHttpClient(e){return yl(this,void 0,void 0,function*(){const r=yield e.requireInstance("http");if(r.hasClient(b2))return r.createClient(b2);{const n=yield e.requireInstance("serviceDiscovery");try{return yield n.createClient("app")}catch{return yield n.createClient("portal")}}})}createConfig(e){var r;return yl(this,void 0,void 0,function*(){const n=yield Hm(this,Xl,"f").reduce((i,o)=>yl(this,void 0,void 0,function*(){const a=new pw(e,yield i);return yield Promise.resolve(o(a)),Object.assign(i,a.config)}),Promise.resolve({}));return(r=n.client)!==null&&r!==void 0||(n.client=yield(()=>yl(this,void 0,void 0,function*(){const i=yield this._createHttpClient(e);return{getAppManifest:{client:{fn:({appKey:o})=>i.json$(`/api/apps/${o}`)},key:({appKey:o})=>o,expire:this.defaultExpireTime},getAppManifests:{client:{fn:()=>i.json$("/api/apps")},key:o=>JSON.stringify(o),expire:this.defaultExpireTime},getAppConfig:{client:{fn:({appKey:o,tag:a})=>i.json$(`/api/apps/${o}/config${a?`?tag=${a}`:""}`)},key:o=>JSON.stringify(o),expire:this.defaultExpireTime}}}))()),n})}}Xl=new WeakMap;var Lm=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class Tw{constructor(e){this.clientKey=e.clientKey,this.endpoint=e.endpoint,this.clientCtor=e.clientCtor}createHttpClientClient(e){return Lm(this,void 0,void 0,function*(){if(!this.clientKey)throw Error("no http client for service discovery is provided!");return e.createClient(this.clientKey)})}createClient(e){return Lm(this,void 0,void 0,function*(){if(!this.endpoint)throw Error("no endpoint defined!");return new this.clientCtor({http:e,endpoint:this.endpoint})})}}var Ah=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class Iw{constructor(e,r){this._client=e,this._http=r}get environment(){return this._client.environment}resolveService(e){return Ah(this,void 0,void 0,function*(){return this._client.resolveService(e)})}createClient(e,r){return Ah(this,void 0,void 0,function*(){const n=yield this.resolveService(e);if(!n)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient(Object.assign(Object.assign({},r),{baseUri:n.uri,defaultScopes:n.defaultScopes}))})}configureClient(e,r){return Ah(this,void 0,void 0,function*(){const{key:n,alias:i}=typeof e=="string"?{key:e,alias:e}:e,{uri:o,defaultScopes:a}=yield this.resolveService(n);r.addConfig(Zg(i,{baseUri:o,defaultScopes:a}))})}}var Om=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},Mw=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Pw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Jl;class Rw{get environment(){return an(on.extractQueryValue(Mw(this,Jl,"f").query(void 0,{cache:{suppressInvalid:!0}})))}constructor({http:e,endpoint:r}){Jl.set(this,void 0),this.http=e,this.endpoint=r,Pw(this,Jl,new on({client:{fn:()=>e.fetch$(r,{selector:this.selector.bind(this)}).pipe(e2(n=>console.log("🔥",n)))},key:()=>"services",expire:5*60*1e3}),"f")}selector(e){return Om(this,void 0,void 0,function*(){const r=yield e.json(),n=r.services.reduce((i,o)=>Object.assign(i,{[o.key]:{clientId:r.clientId,uri:o.uri,defaultScopes:[r.clientId+"/.default"]}}),{});return Object.assign(Object.assign({},r),{services:n})})}resolveService(e){return Om(this,void 0,void 0,function*(){try{const{services:r}=yield this.environment;return r[e]}catch(r){throw console.error(r),r}})}}Jl=new WeakMap;const Hw="serviceDiscovery";var Lw=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const Ow={name:Hw,configure:()=>new Tw({clientCtor:Rw,clientKey:"service_discovery",endpoint:"/_discovery/environments/current"}),initialize:({config:t,requireInstance:e})=>Lw(void 0,void 0,void 0,function*(){const r=yield e("http"),n=yield t.createHttpClientClient(r),i=yield t.createClient(n);return new Iw(i,r)})};class Dw{}class k3 extends Error{constructor(e,r){super(`unsupported version ${e}`,{cause:r}),this.version=e}}const Nw=(t,e)=>{var r;const n=(r=Jn[t])!==null&&r!==void 0?r:t;switch(n){case Jn.v2:throw new k3(t);case Jn.v1:default:{const{id:i}=e,o=new URLSearchParams;return o.append("api-version",n),`/contexts/${i}/?${String(o)}`}}},Vw=(t,e,r)=>[Nw(t,e),r],Fw=(t,e,r="json")=>(n,i)=>t[r](...Vw(e,n,i));var Uw=["eq","ne","gt","ge","lt","le"],_l=["and","or","not"],$w=["any","all"],jw=["startswith","endswith","contains"],Bw=["expand","levels","select","skip","top","count","orderby","filter"],Dm=/\((.*)\)/,Nm=/(?!indexof)\((\w+)\)/,Vm;(function(t){t.sum="sum",t.min="min",t.max="max",t.average="average",t.countdistinct="countdistinct"})(Vm||(Vm={}));var Ln="";function qw(t){var e=t===void 0?{}:t,r=e.select,n=e.search,i=e.skiptoken,o=e.format,a=e.top,s=e.skip,c=e.filter,l=e.transform,d=e.orderBy,h=e.key,u=e.count,f=e.expand,v=e.action,g=e.func,x="",m=[],p={};if(h!=null&&(x+="(".concat(Cn(h,m),")")),(c||typeof u=="object")&&(p.$filter=vc(typeof u=="object"?u:c,m)),l&&(p.$apply=A3(l)),f&&(p.$expand=Zl(f)),d&&(p.$orderby=h0(d)),u&&(typeof u=="boolean"?p.$count=!0:x+="/$count"),typeof a=="number"&&(p.$top=a),typeof s=="number"&&(p.$skip=s),v&&(x+="/".concat(v)),g){if(typeof g=="string")x+="/".concat(g);else if(typeof g=="object"){var y=Object.keys(g)[0],w=Cn(g[y],m);x+="/".concat(y),w!==""&&(x+="(".concat(w,")"))}}return m.length>0&&Object.assign(p,m.reduce(function(T,O){var F;return Object.assign(T,(F={},F["@".concat(O.name)]=Cn(O.value),F))},{})),Qw(x,lt({$select:r,$search:n,$skiptoken:i,$format:o},p))}function Th(t,e,r){return r===void 0&&(r=[]),"".concat(t," eq ").concat(Cn(e,r))}function vc(t,e,r){return t===void 0&&(t={}),e===void 0&&(e=[]),r===void 0&&(r=""),(Array.isArray(t)?t:[t]).reduce(function(o,a){if(a){var s=n(a,e,r);s&&o.push(s)}return o},[]).join(" and ");function n(o,a,s){o===void 0&&(o={}),a===void 0&&(a=[]),s===void 0&&(s="");var c="";if(typeof o=="string")c=o;else if(o&&typeof o=="object"){var l=Object.keys(o).reduce(function(d,h){var u=o[h];if(u===void 0)return d;var f="";if(s?h===Ln?f=s:Nm.test(h)?f=h.replace(Nm,function(p,y){return y.trim()===Ln?"(".concat(s,")"):"(".concat(s,"/").concat(y.trim(),")")}):Dm.test(h)?f=h.replace(Dm,function(p,y){return y.trim()===Ln?"(".concat(s,")"):"(".concat(s,"/").concat(y.trim(),")")}):f="".concat(s,"/").concat(h):f=h,h===Ln&&Array.isArray(u))return d.concat(u.map(function(p){return Th(f,p)}));if(["number","string","boolean"].indexOf(typeof u)!==-1||u instanceof Date||u===null)d.push(Th(f,u,a));else if(Array.isArray(u)){var v=h,g=u.map(function(p){return vc(p,a,s)}).filter(function(p){return p}).map(function(p){return _l.indexOf(v)!==-1?"(".concat(p,")"):p});g.length&&(_l.indexOf(v)!==-1?g.length&&(v==="not"?d.push(Fm(g)):d.push("(".concat(g.join(" ".concat(v," ")),")"))):d.push(g.join(" ".concat(v," "))))}else if(_l.indexOf(f)!==-1){var x=f,g=Object.keys(u).map(function(y){var w;return n((w={},w[y]=u[y],w))});g.length&&(x==="not"?d.push(Fm(g)):d.push("(".concat(g.join(" ".concat(x," ")),")")))}else if(typeof u=="object")if("type"in u)d.push(Th(f,u,a));else{var m=Object.keys(u);m.forEach(function(p){if(u[p]!==void 0)if(Uw.indexOf(p)!==-1)d.push("".concat(f," ").concat(p," ").concat(Cn(u[p],a)));else if(_l.indexOf(p)!==-1)Array.isArray(u[p])?d.push(u[p].map(function(O){return"("+n(O,a,f)+")"}).join(" ".concat(p," "))):d.push("("+n(u[p],a,f)+")");else if($w.indexOf(p)!==-1){var y=i(h.toLowerCase(),u[p],p,f);y&&d.push(y)}else if(p==="has")d.push("".concat(f," ").concat(p," ").concat(Cn(u[p],a)));else if(p==="in"){var w=Array.isArray(u[p])?u[p]:u[p].value.map(function(O){return{type:u[p].type,value:O}});d.push(f+" in ("+w.map(function(O){return Cn(O,a)}).join(",")+")")}else if(jw.indexOf(p)!==-1)d.push("".concat(p,"(").concat(f,",").concat(Cn(u[p],a),")"));else{var T=n(u,a,f);T&&d.push(T)}})}else throw new Error("Unexpected value type: ".concat(u));return d},[]);c=l.join(" and ")}return c}function i(o,a,s,c){var l="";if(typeof a=="string"||a instanceof String)l=Gw(o,a,s,c);else if(a){var d=Array.isArray(a)?a.reduce(function(u,f){return f.hasOwnProperty(Ln)?(u.hasOwnProperty(Ln)||(u[Ln]=[]),u[Ln].push(f[Ln]),u):lt(lt({},u),f)},{}):a,h=n(d,e,o);l="".concat(c,"/").concat(s,"(").concat(h?"".concat(o,":").concat(h):"",")")}return l}}function Gw(t,e,r,n){var i="",o=r=="all"?"ne":"eq";return i="".concat(n,"/").concat(r,"(").concat(t,": ").concat(t," ").concat(o," '").concat(e,"')"),i}function Kw(t){return t=t.replace(/%/g,"%25"),t=t.replace(/\+/g,"%2B"),t=t.replace(/\//g,"%2F"),t=t.replace(/\?/g,"%3F"),t=t.replace(/#/g,"%23"),t=t.replace(/&/g,"%26"),t=t.replace(/'/g,"''"),t}function Cn(t,e){if(typeof t=="string")return"'".concat(Kw(t),"'");if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return"[".concat(t.map(function(r){return Cn(r)}).join(","),"]");if(t===null)return t;if(typeof t=="object")switch(t.type){case"raw":case"guid":return t.value;case"duration":return"duration'".concat(t.value,"'");case"binary":return"binary'".concat(t.value,"'");case"alias":return Array.isArray(e)&&e.push(t),"@".concat(t.name);case"json":return escape(JSON.stringify(t.value));case"decimal":return"".concat(t.value,"M");default:return Object.entries(t).filter(function(r){var n=r[1];return n!==void 0}).map(function(r){var n=r[0],i=r[1];return"".concat(n,"=").concat(Cn(i,e))}).join(",")}return t}function Zl(t){if(typeof t=="number")return t;if(typeof t=="string")return t.indexOf("/")===-1?t:t.split("/").reverse().reduce(function(r,n,i,o){return i===0?"$expand=".concat(n):i===o.length-1?"".concat(n,"(").concat(r,")"):"$expand=".concat(n,"(").concat(r,")")},"");if(Array.isArray(t))return"".concat(t.map(function(r){return Zl(r)}).join(","));if(typeof t=="object"){var e=Object.keys(t);return e.some(function(r){return Bw.indexOf(r.toLowerCase())!==-1})?e.map(function(r){var n;switch(r){case"filter":n=vc(t[r]);break;case"orderBy":n=h0(t[r]);break;case"levels":case"count":case"skip":case"top":n="".concat(t[r]);break;default:n=Zl(t[r])}return"$".concat(r.toLowerCase(),"=").concat(n)}).join(";"):e.map(function(r){var n=Zl(t[r]);return n?"".concat(r,"(").concat(n,")"):r}).join(",")}return""}function A3(t){var e=Array.isArray(t)?t:[t],r=e.reduce(function(n,i){var o=i.aggregate,a=i.filter,s=i.groupBy,c=Cg(i,["aggregate","filter","groupBy"]),l=Object.keys(c);if(l.length)throw new Error("Unsupported transform(s): ".concat(l));if(o&&n.push("aggregate(".concat(Ww(o),")")),a){var d=vc(a);d&&n.push("filter(".concat(vc(d),")"))}return s&&n.push("groupby(".concat(Yw(s),")")),n},[]);return r.join("/")||void 0}function Ww(t){var e=Array.isArray(t)?t:[t];return e.map(function(r){return typeof r=="string"?r:Object.keys(r).map(function(n){var i=r[n];if(!i.with)throw new Error("'with' property required for '".concat(n,"'"));if(!i.as)throw new Error("'as' property required for '".concat(n,"'"));return"".concat(n," with ").concat(i.with," as ").concat(i.as)})}).join(",")}function Yw(t){if(!t.properties)throw new Error("'properties' property required for groupBy");var e="(".concat(t.properties.join(","),")");return t.transform&&(e+=",".concat(A3(t.transform))),e}function h0(t,e){return e===void 0&&(e=""),Array.isArray(t)?t.map(function(r){return Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r}).map(function(r){return"".concat(e).concat(String(r))}).join(","):typeof t=="object"?Object.entries(t).map(function(r){var n=r[0],i=r[1];return h0(i,"".concat(n,"/"))}).map(function(r){return"".concat(e).concat(r)}).join(","):"".concat(e).concat(String(t))}function Qw(t,e){var r=Object.getOwnPropertyNames(e).filter(function(n){return e[n]!==void 0&&e[n]!==""}).map(function(n){return"".concat(n,"=").concat(e[n])});return r.length?"".concat(t,"?").concat(r.join("&")):t}function Fm(t){return"not(".concat(t.join(" and "),")")}const Xw=t=>Object.keys(t).reduce((e,r)=>{var n;switch(r){case"type":return!((n=t[r])===null||n===void 0)&&n.length?Object.assign(Object.assign({},e),{[r]:{in:t[r]}}):e;default:return Object.assign(Object.assign({},e),{[r]:t[r]})}},{}),Jw=t=>Object.keys(t).reduce((e,r)=>{switch(r){case"filter":return Object.assign(Object.assign({},e),{[r]:Xw(t.filter)});default:return Object.assign(Object.assign({},e),{[r]:t[r]})}},{}),Zw=t=>typeof t=="string"?t:qw(Jw(t)),ex=(t,e)=>{var r;const n=(r=Jn[t])!==null&&r!==void 0?r:t;switch(n){case Jn.v2:throw new k3(t);case Jn.v1:default:{const{query:i,includeDeleted:o}=e,a=new URLSearchParams(Zw(i));return a.append("api-version",n),o&&a.append("includeDeleted","true"),`/contexts/?${String(a)}`}}},tx=(t,e,r)=>[ex(t,e),r],rx=(t,e,r="json")=>(n,i)=>t[r](...tx(e,n,i));class nx{get Version(){return Jn}constructor(e,r){this._client=e,this._method=r}get(e,...r){return Fw(this._client,e,this._method)(...r)}query(e,...r){return rx(this._client,e,this._method)(...r)}}var Jn;(function(t){t.v1="1.0",t.v2="2.0"})(Jn||(Jn={}));const ix=(t,e)=>{switch(t){case"v1":{const{id:r}=e,n=new URLSearchParams;return n.append("api-version","1.0"),`/bookmarks/${r}/?${String(n)}`}default:{const{id:r}=e,n=new URLSearchParams;return n.append("api-version",t),`/bookmarks/${r}/?${String(n)}`}}},ox=(t,e,r)=>{const n=ix(t,e),i=Object.assign({},{method:"Delete"},r);return[n,i]},ax=(t,e,r="json")=>(n,i)=>t[r](...ox(e,n,i)),sx=ax,cx=(t,e)=>{switch(t){case"v1":{const{id:r}=e,n=new URLSearchParams;return n.append("api-version","1.0"),`/bookmarks/${r}/?${String(n)}`}default:{const{id:r}=e,n=new URLSearchParams;return n.append("api-version",t),`/bookmarks/${r}/?${String(n)}`}}},lx=(t,e,r)=>[cx(t,e),r],dx=(t,e,r="json")=>(n,i)=>t[r](...lx(e,n,i)),hx=dx,ux=(t,e)=>{switch(t){case"v1":{const r=new URLSearchParams;return r.append("api-version","1.0"),`/bookmarks?${String(r)}`}default:{const r=new URLSearchParams;return r.append("api-version",t),`/bookmarks?${String(r)}`}}},fx=(t,e,r)=>{const n=ux(t),i=new Headers;i.append("content-type","application/json");const o=Object.assign({},{method:"post",body:JSON.stringify(e),headers:i},r);return[n,o]},px=(t,e,r="json")=>(n,i)=>t[r](...fx(e,n,i)),mx=px;class vx{constructor(e,r){this._client=e,this._method=r}get(e,...r){return hx(this._client,e,this._method)(...r)}post(e,...r){return mx(this._client,e,this._method)(...r)}delete(e,...r){return sx(this._client,e,this._method)(...r)}}const gx=vx;var Um=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class yx{constructor({createClient:e}){this._createClientFn=e}createBookmarksClient(e){return Um(this,void 0,void 0,function*(){const r=yield this._createClientFn("bookmarks");return new gx(r,e)})}createContextClient(e){return Um(this,void 0,void 0,function*(){const r=yield this._createClientFn("context");return new nx(r,e)})}}var T3=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const _x="services",bx=(t,e)=>r=>T3(void 0,void 0,void 0,function*(){if(t.hasClient(r))return t.createClient(r);if(e)return e.createClient(r);throw Error(`failed to create http client for service ${r}`)}),wx={name:_x,configure:()=>new Dw,initialize:({ref:t,config:e,requireInstance:r,hasModule:n})=>T3(void 0,void 0,void 0,function*(){if(!e.createClient){const i=yield r("http"),o=n("serviceDiscovery")?yield r("serviceDiscovery"):t==null?void 0:t.serviceDiscovery;e.createClient=bx(i,o)}if(!e.createClient)throw Error("missing configuration for creating API client");return new yx(e)})},xx=wx;class Ex extends Iy{constructor(){super([Dy,p3,Qf,Ow,xx,kw,hw]),this.logger=new Eg("FrameworkConfigurator")}configureHttp(...e){this.addConfig(Wy(...e))}configureHttpClient(...e){this.addConfig(Zg(...e))}configureMsal(...e){this.addConfig(cb(...e))}configureServiceDiscovery(e){this.configureHttpClient("service_discovery",e.client)}}var Cx=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const zx=(t,e)=>Cx(void 0,void 0,void 0,function*(){const r=yield t.initialize(e),n={modules:r};return window.Fusion=n,r.event.dispatchEvent("onFrameworkLoaded",{detail:n}),n}),I3=A.exports.createContext(null),Sx=I3.Provider;var kx=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const Ax=t=>A.exports.lazy(()=>kx(void 0,void 0,void 0,function*(){const e=new Ex;yield t(e);const r=yield zx(e);return{default:({children:n})=>Q(Sx,Object.assign({value:r},{children:n}))}})),u0=()=>{let t=A.exports.useContext(I3);return t||console.warn("could not locate fusion in context!"),t??(t=window.Fusion),t||console.error("Could not load framework, might not be initiated?"),t},Tx=t=>{const e=A.exports.useMemo(()=>Ax(t.configure),[t.configure]);return Q(A.exports.Suspense,Object.assign({fallback:t.fallback},{children:Q(e,{children:t.children})}))};function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ce.apply(this,arguments)}function w2(t){return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w2(t)}function Ih(t){return t&&w2(t)==="object"&&t.constructor===Object}function M3(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{clone:!0},n=r.clone?Ce({},t):t;return Ih(t)&&Ih(e)&&Object.keys(e).forEach(function(i){i!=="__proto__"&&(Ih(e[i])&&i in t?n[i]=M3(t[i],e[i],r):n[i]=e[i])}),n}var Ix=typeof Symbol=="function"&&Symbol.for;const P3=Ix?Symbol.for("mui.nested"):"__THEME_NESTED__";var Mx=["checked","disabled","error","focused","focusVisible","required","expanded","selected"];function Px(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.disableGlobal,r=e===void 0?!1:e,n=t.productionPrefix,i=n===void 0?"jss":n,o=t.seed,a=o===void 0?"":o,s=a===""?"":"".concat(a,"-"),c=0,l=function(){return c+=1,c};return function(d,h){var u=h.options.name;if(u&&u.indexOf("Mui")===0&&!h.options.link&&!r){if(Mx.indexOf(d.key)!==-1)return"Mui-".concat(d.key);var f="".concat(s).concat(u,"-").concat(d.key);return!h.options.theme[P3]||a!==""?f:"".concat(f,"-").concat(l())}return"".concat(s).concat(i).concat(l())}}var $m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tc=(typeof window>"u"?"undefined":$m(window))==="object"&&(typeof document>"u"?"undefined":$m(document))==="object"&&document.nodeType===9;function jm(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function R3(t,e,r){return e&&jm(t.prototype,e),r&&jm(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function x2(t,e){return x2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},x2(t,e)}function H3(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,x2(t,e)}function Bm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function L3(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}var Rx={}.constructor;function E2(t){if(t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(E2);if(t.constructor!==Rx)return t;var e={};for(var r in t)e[r]=E2(t[r]);return e}function f0(t,e,r){t===void 0&&(t="unnamed");var n=r.jss,i=E2(e),o=n.plugins.onCreateRule(t,i,r);return o||(t[0],null)}var qm=function(e,r){for(var n="",i=0;i<e.length&&e[i]!=="!important";i++)n&&(n+=r),n+=e[i];return n},yo=function(e){if(!Array.isArray(e))return e;var r="";if(Array.isArray(e[0]))for(var n=0;n<e.length&&e[n]!=="!important";n++)r&&(r+=", "),r+=qm(e[n]," ");else r=qm(e,", ");return e[e.length-1]==="!important"&&(r+=" !important"),r};function Ba(t){return t&&t.format===!1?{linebreak:"",space:""}:{linebreak:`
|
|
15
|
+
Error Description: `+c.message)),[2,null];case 4: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=t.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),[2,n]}})})},t.prototype.getCloudDiscoveryMetadataFromHarcodedValues=function(){return this.canonicalAuthority in im?im[this.canonicalAuthority]:null},t.prototype.isInKnownAuthorities=function(){var e=this,r=this.authorityOptions.knownAuthorities.filter(function(n){return ge.getDomainFromUrl(n).toLowerCase()===e.hostnameAndPort});return r.length>0},t.generateAuthority=function(e,r){var n;if(r&&r.azureCloudInstance!==dc.None){var i=r.tenant?r.tenant:_.DEFAULT_COMMON_TENANT;n=r.azureCloudInstance+"/"+i+"/"}return n||e},t.createCloudDiscoveryMetadataFromHost=function(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}},t.getCloudDiscoveryMetadataFromNetworkResponse=function(e,r){for(var n=0;n<e.length;n++){var i=e[n];if(i.aliases.indexOf(r)>-1)return i}return null},t.prototype.getPreferredCache=function(){if(this.discoveryComplete())return this.metadata.preferred_cache;throw j.createEndpointDiscoveryIncompleteError("Discovery incomplete.")},t.prototype.isAlias=function(e){return this.metadata.aliases.indexOf(e)>-1},t.isPublicCloudAuthority=function(e){return _.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0},t.buildRegionalAuthorityString=function(e,r,n){var i=new ge(e);i.validateAsUri();var o=i.getUrlComponents(),a=r+"."+o.HostNameAndPort;this.isPublicCloudAuthority(o.HostNameAndPort)&&(a=r+"."+_.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX);var s=ge.constructAuthorityUriFromObject(Me(Me({},i.getUrlComponents()),{HostNameAndPort:a})).urlString;return n?s+"?"+n:s},t.replaceWithRegionalInformation=function(e,r){return e.authorization_endpoint=t.buildRegionalAuthorityString(e.authorization_endpoint,r),e.token_endpoint=t.buildRegionalAuthorityString(e.token_endpoint,r,_.REGIONAL_AUTH_NON_MSI_QUERY_STRING),e.end_session_endpoint&&(e.end_session_endpoint=t.buildRegionalAuthorityString(e.end_session_endpoint,r)),e},t}();var Bd=function(){function t(){}return t.createDiscoveredInstance=function(e,r,n,i,o,a){return J(this,void 0,void 0,function(){var s,c;return Z(this,function(l){switch(l.label){case 0:s=t.createInstance(e,r,n,i,o,a),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,s.resolveEndpointsAsync()];case 2:return l.sent(),[2,s];case 3:throw c=l.sent(),j.createEndpointDiscoveryIncompleteError(c);case 4:return[2]}})})},t.createInstance=function(e,r,n,i,o,a){if(V.isEmpty(e))throw Ne.createUrlEmptyError();return new jd(e,r,n,i,o,a)},t}();var qd=function(){function t(){this.failedRequests=[],this.errors=[],this.cacheHits=0}return t.isServerTelemetryEntity=function(e,r){var n=e.indexOf(wt.CACHE_KEY)===0,i=!0;return r&&(i=r.hasOwnProperty("failedRequests")&&r.hasOwnProperty("errors")&&r.hasOwnProperty("cacheHits")),n&&i},t}();var om=function(){function t(){}return t.isThrottlingEntity=function(e,r){var n=!1;e&&(n=e.indexOf(Us.THROTTLING_PREFIX)===0);var i=!0;return r&&(i=r.hasOwnProperty("throttleTime")),n&&i},t}();var g_={sendGetRequestAsync:function(){var t="Network interface - sendGetRequestAsync() has not been implemented for the Network interface.";return Promise.reject(W.createUnexpectedError(t))},sendPostRequestAsync:function(){var t="Network interface - sendPostRequestAsync() has not been implemented for the Network interface.";return Promise.reject(W.createUnexpectedError(t))}};var fl={missingKidError:{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."},missingAlgError:{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."}},am=function(t){br(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.name="JoseHeaderError",Object.setPrototypeOf(i,e.prototype),i}return e.createMissingKidError=function(){return new e(fl.missingKidError.code,fl.missingKidError.desc)},e.createMissingAlgError=function(){return new e(fl.missingAlgError.code,fl.missingAlgError.desc)},e}(W);var y_=function(){function t(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}return t.getShrHeaderString=function(e){if(!e.kid)throw am.createMissingKidError();if(!e.alg)throw am.createMissingAlgError();var r=new t({typ:e.typ||a2.Jwt,kid:e.kid,alg:e.alg});return JSON.stringify(r)},t}();var __=function(){function t(e,r){this.cacheOutcome=lo.NO_CACHE_HIT,this.cacheManager=r,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||_.EMPTY_STRING,this.wrapperVer=e.wrapperVer||_.EMPTY_STRING,this.telemetryCacheKey=wt.CACHE_KEY+Tr.CACHE_KEY_SEPARATOR+e.clientId}return t.prototype.generateCurrentRequestHeaderValue=function(){var e=""+this.apiId+wt.VALUE_SEPARATOR+this.cacheOutcome,r=[this.wrapperSKU,this.wrapperVer].join(wt.VALUE_SEPARATOR),n=this.getRegionDiscoveryFields(),i=[e,n].join(wt.VALUE_SEPARATOR);return[wt.SCHEMA_VERSION,i,r].join(wt.CATEGORY_SEPARATOR)},t.prototype.generateLastRequestHeaderValue=function(){var e=this.getLastRequests(),r=t.maxErrorsToSend(e),n=e.failedRequests.slice(0,2*r).join(wt.VALUE_SEPARATOR),i=e.errors.slice(0,r).join(wt.VALUE_SEPARATOR),o=e.errors.length,a=r<o?wt.OVERFLOW_TRUE:wt.OVERFLOW_FALSE,s=[o,a].join(wt.VALUE_SEPARATOR);return[wt.SCHEMA_VERSION,e.cacheHits,n,i,s].join(wt.CATEGORY_SEPARATOR)},t.prototype.cacheFailedRequest=function(e){var r=this.getLastRequests();r.errors.length>=wt.MAX_CACHED_ERRORS&&(r.failedRequests.shift(),r.failedRequests.shift(),r.errors.shift()),r.failedRequests.push(this.apiId,this.correlationId),V.isEmpty(e.subError)?V.isEmpty(e.errorCode)?!!e&&e.toString()?r.errors.push(e.toString()):r.errors.push(wt.UNKNOWN_ERROR):r.errors.push(e.errorCode):r.errors.push(e.subError),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,r)},t.prototype.incrementCacheHits=function(){var e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits},t.prototype.getLastRequests=function(){var e=new qd,r=this.cacheManager.getServerTelemetry(this.telemetryCacheKey);return r||e},t.prototype.clearTelemetryCache=function(){var e=this.getLastRequests(),r=t.maxErrorsToSend(e),n=e.errors.length;if(r===n)this.cacheManager.removeItem(this.telemetryCacheKey);else{var i=new qd;i.failedRequests=e.failedRequests.slice(r*2),i.errors=e.errors.slice(r),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i)}},t.maxErrorsToSend=function(e){var r,n=0,i=0,o=e.errors.length;for(r=0;r<o;r++){var a=e.failedRequests[2*r]||_.EMPTY_STRING,s=e.failedRequests[2*r+1]||_.EMPTY_STRING,c=e.errors[r]||_.EMPTY_STRING;if(i+=a.toString().length+s.toString().length+c.length+3,i<wt.MAX_LAST_HEADER_BYTES)n+=1;else break}return n},t.prototype.getRegionDiscoveryFields=function(){var e=[];return e.push(this.regionUsed||_.EMPTY_STRING),e.push(this.regionSource||_.EMPTY_STRING),e.push(this.regionOutcome||_.EMPTY_STRING),e.join(",")},t.prototype.updateRegionDiscoveryMetadata=function(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome},t.prototype.setCacheOutcome=function(e){this.cacheOutcome=e},t}();var o3=function(){function t(e,r,n,i,o,a){this.authority=r,this.libraryName=i,this.libraryVersion=o,this.applicationTelemetry=a,this.clientId=e,this.logger=n,this.callbacks=new Map,this.eventsByCorrelationId=new Map,this.staticFieldsByCorrelationId=new Map,this.measurementsById=new Map}return t.prototype.startMeasurement=function(e,r){var n=this,i,o,a=r||this.generateId();r||this.logger.info("PerformanceClient: No correlation id provided for "+e+", generating",a),this.logger.trace("PerformanceClient: Performance measurement started for "+e,a);var s=this.startPerformanceMeasuremeant(e,a);s.startMeasurement();var c={eventId:this.generateId(),status:da.InProgress,authority:this.authority,libraryName:this.libraryName,libraryVersion:this.libraryVersion,clientId:this.clientId,name:e,startTimeMs:Date.now(),correlationId:a};this.cacheEventByCorrelationId(c);var l={appName:(i=this.applicationTelemetry)===null||i===void 0?void 0:i.appName,appVersion:(o=this.applicationTelemetry)===null||o===void 0?void 0:o.appVersion};return this.addStaticFields(l,a),this.cacheMeasurement(c,s),{endMeasurement:function(d){var h=n.endMeasurement(Me(Me({},c),d));return h&&n.cacheEventByCorrelationId(h),h},flushMeasurement:function(){return n.flushMeasurements(c.name,c.correlationId)},discardMeasurement:function(){return n.discardMeasurements(c.correlationId)},addStaticFields:function(d){return n.addStaticFields(d,c.correlationId)},measurement:s,event:c}},t.prototype.endMeasurement=function(e){var r=this.measurementsById.get(e.eventId);if(r){this.measurementsById.delete(e.eventId),r.endMeasurement();var n=r.flushMeasurement();if(n!==null){this.logger.trace("PerformanceClient: Performance measurement ended for "+e.name+": "+n+" ms",e.correlationId);var i=Me(Me({durationMs:Math.round(n)},e),{status:da.Completed});return i}else this.logger.trace("PerformanceClient: Performance measurement not taken",e.correlationId)}else this.logger.trace("PerformanceClient: Measurement not found for "+e.eventId,e.correlationId);return null},t.prototype.addStaticFields=function(e,r){var n=this.staticFieldsByCorrelationId.get(r);n?(this.logger.trace("PerformanceClient: Updating static fields"),this.staticFieldsByCorrelationId.set(r,Me(Me({},n),e))):(this.logger.trace("PerformanceClient: Adding static fields"),this.staticFieldsByCorrelationId.set(r,e))},t.prototype.cacheEventByCorrelationId=function(e){var r=this.eventsByCorrelationId.get(e.correlationId);r?(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" added/updated",e.correlationId),r.set(e.eventId,e)):(this.logger.trace("PerformanceClient: Performance measurement for "+e.name+" started",e.correlationId),this.eventsByCorrelationId.set(e.correlationId,new Map().set(e.eventId,e)))},t.prototype.cacheMeasurement=function(e,r){this.measurementsById.set(e.eventId,r)},t.prototype.flushMeasurements=function(e,r){var n=this;this.logger.trace("PerformanceClient: Performance measurements flushed for "+e,r);var i=this.eventsByCorrelationId.get(r);if(i){this.discardMeasurements(r);var o=[];i.forEach(function(u){if(u.name!==e&&u.status!==da.Completed){n.logger.trace("PerformanceClient: Incomplete submeasurement "+u.name+" found for "+e,r);var f=n.endMeasurement(u);f&&o.push(f)}o.push(u)});var a=o.sort(function(u,f){return u.startTimeMs-f.startTimeMs}),s=a.filter(function(u){return u.name===e&&u.status===da.Completed});if(s.length>0){s.length>1&&this.logger.verbose("PerformanceClient: Multiple distinct top-level performance events found, using the first",r);var c=s[0];this.logger.verbose("PerformanceClient: Measurement found for "+e,r);var l=a.reduce(function(u,f){if(f.name!==e){n.logger.trace("PerformanceClient: Complete submeasurement found for "+f.name,r);var v=f.name+"DurationMs";u[v]?n.logger.verbose("PerformanceClient: Submeasurement for "+e+" already exists for "+f.name+", ignoring",r):u[v]=f.durationMs}return u},c),d=this.staticFieldsByCorrelationId.get(r),h=Me(Me({},l),d);this.emitEvents([h],l.correlationId)}else this.logger.verbose("PerformanceClient: No completed top-level measurements found for "+e,r)}else this.logger.verbose("PerformanceClient: No measurements found",r)},t.prototype.discardMeasurements=function(e){this.logger.trace("PerformanceClient: Performance measurements discarded",e),this.eventsByCorrelationId.delete(e)},t.prototype.addPerformanceCallback=function(e){var r=this.generateId();return this.callbacks.set(r,e),this.logger.verbose("PerformanceClient: Performance callback registered with id: "+r),r},t.prototype.removePerformanceCallback=function(e){var r=this.callbacks.delete(e);return r?this.logger.verbose("PerformanceClient: Performance callback "+e+" removed."):this.logger.verbose("PerformanceClient: Performance callback "+e+" not removed."),r},t.prototype.emitEvents=function(e,r){var n=this;this.logger.verbose("PerformanceClient: Emitting performance events",r),this.callbacks.forEach(function(i,o){n.logger.trace("PerformanceClient: Emitting event to callback "+o,r),i.apply(null,[e])})},t}();var b_=function(){function t(){}return t.prototype.startMeasurement=function(){},t.prototype.endMeasurement=function(){},t.prototype.flushMeasurement=function(){return null},t}(),w_=function(t){br(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.generateId=function(){return"callback-id"},e.prototype.startPerformanceMeasuremeant=function(){return new b_},e}(o3);var M={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."},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."}},D=function(t){It(e,t);function e(r,n){var i=t.call(this,r,n)||this;return Object.setPrototypeOf(i,e.prototype),i.name="BrowserAuthError",i}return e.createPkceNotGeneratedError=function(r){return new e(M.pkceNotGenerated.code,M.pkceNotGenerated.desc+" Detail:"+r)},e.createCryptoNotAvailableError=function(r){return new e(M.cryptoDoesNotExist.code,M.cryptoDoesNotExist.desc+" Detail:"+r)},e.createHttpMethodNotImplementedError=function(r){return new e(M.httpMethodNotImplementedError.code,M.httpMethodNotImplementedError.desc+" Given Method: "+r)},e.createEmptyNavigationUriError=function(){return new e(M.emptyNavigateUriError.code,M.emptyNavigateUriError.desc)},e.createEmptyHashError=function(r){return new e(M.hashEmptyError.code,M.hashEmptyError.desc+" Given Url: "+r)},e.createHashDoesNotContainStateError=function(){return new e(M.hashDoesNotContainStateError.code,M.hashDoesNotContainStateError.desc)},e.createHashDoesNotContainKnownPropertiesError=function(){return new e(M.hashDoesNotContainKnownPropertiesError.code,M.hashDoesNotContainKnownPropertiesError.desc)},e.createUnableToParseStateError=function(){return new e(M.unableToParseStateError.code,M.unableToParseStateError.desc)},e.createStateInteractionTypeMismatchError=function(){return new e(M.stateInteractionTypeMismatchError.code,M.stateInteractionTypeMismatchError.desc)},e.createInteractionInProgressError=function(){return new e(M.interactionInProgress.code,M.interactionInProgress.desc)},e.createPopupWindowError=function(r){var n=M.popupWindowError.desc;return n=V.isEmpty(r)?n:n+" Details: "+r,new e(M.popupWindowError.code,n)},e.createEmptyWindowCreatedError=function(){return new e(M.emptyWindowError.code,M.emptyWindowError.desc)},e.createUserCancelledError=function(){return new e(M.userCancelledError.code,M.userCancelledError.desc)},e.createMonitorPopupTimeoutError=function(){return new e(M.monitorPopupTimeoutError.code,M.monitorPopupTimeoutError.desc)},e.createMonitorIframeTimeoutError=function(){return new e(M.monitorIframeTimeoutError.code,M.monitorIframeTimeoutError.desc)},e.createRedirectInIframeError=function(r){return new e(M.redirectInIframeError.code,M.redirectInIframeError.desc+" (window.parent !== window) => "+r)},e.createBlockReloadInHiddenIframeError=function(){return new e(M.blockTokenRequestsInHiddenIframeError.code,M.blockTokenRequestsInHiddenIframeError.desc)},e.createBlockAcquireTokenInPopupsError=function(){return new e(M.blockAcquireTokenInPopupsError.code,M.blockAcquireTokenInPopupsError.desc)},e.createIframeClosedPrematurelyError=function(){return new e(M.iframeClosedPrematurelyError.code,M.iframeClosedPrematurelyError.desc)},e.createSilentLogoutUnsupportedError=function(){return new e(M.silentLogoutUnsupportedError.code,M.silentLogoutUnsupportedError.desc)},e.createNoAccountError=function(){return new e(M.noAccountError.code,M.noAccountError.desc)},e.createSilentPromptValueError=function(r){return new e(M.silentPromptValueError.code,M.silentPromptValueError.desc+" Given value: "+r)},e.createUnableToParseTokenRequestCacheError=function(){return new e(M.unableToParseTokenRequestCacheError.code,M.unableToParseTokenRequestCacheError.desc)},e.createNoTokenRequestCacheError=function(){return new e(M.noTokenRequestCacheError.code,M.noTokenRequestCacheError.desc)},e.createAuthRequestNotSetError=function(){return new e(M.authRequestNotSet.code,M.authRequestNotSet.desc)},e.createNoCachedAuthorityError=function(){return new e(M.noCachedAuthorityError.code,M.noCachedAuthorityError.desc)},e.createInvalidCacheTypeError=function(){return new e(M.invalidCacheType.code,""+M.invalidCacheType.desc)},e.createNonBrowserEnvironmentError=function(){return new e(M.notInBrowserEnvironment.code,M.notInBrowserEnvironment.desc)},e.createDatabaseNotOpenError=function(){return new e(M.databaseNotOpen.code,M.databaseNotOpen.desc)},e.createNoNetworkConnectivityError=function(){return new e(M.noNetworkConnectivity.code,M.noNetworkConnectivity.desc)},e.createPostRequestFailedError=function(r,n){return new e(M.postRequestFailed.code,M.postRequestFailed.desc+" | Network client threw: "+r+" | Attempted to reach: "+n.split("?")[0])},e.createGetRequestFailedError=function(r,n){return new e(M.getRequestFailed.code,M.getRequestFailed.desc+" | Network client threw: "+r+" | Attempted to reach: "+n.split("?")[0])},e.createFailedToParseNetworkResponseError=function(r){return new e(M.failedToParseNetworkResponse.code,M.failedToParseNetworkResponse.desc+" | Attempted to reach: "+r.split("?")[0])},e.createUnableToLoadTokenError=function(r){return new e(M.unableToLoadTokenError.code,M.unableToLoadTokenError.desc+" | "+r)},e.createSigningKeyNotFoundInStorageError=function(r){return new e(M.signingKeyNotFoundInStorage.code,M.signingKeyNotFoundInStorage.desc+" | No match found for KeyId: "+r)},e.createAuthCodeRequiredError=function(){return new e(M.authCodeRequired.code,M.authCodeRequired.desc)},e.createAuthCodeOrNativeAccountIdRequiredError=function(){return new e(M.authCodeOrNativeAccountRequired.code,M.authCodeOrNativeAccountRequired.desc)},e.createDatabaseUnavailableError=function(){return new e(M.databaseUnavailable.code,M.databaseUnavailable.desc)},e.createUnableToAcquireTokenFromNativePlatformError=function(){return new e(M.unableToAcquireTokenFromNativePlatform.code,M.unableToAcquireTokenFromNativePlatform.desc)},e.createNativeHandshakeTimeoutError=function(){return new e(M.nativeHandshakeTimeout.code,M.nativeHandshakeTimeout.desc)},e.createNativeExtensionNotInstalledError=function(){return new e(M.nativeExtensionNotInstalled.code,M.nativeExtensionNotInstalled.desc)},e.createNativeConnectionNotEstablishedError=function(){return new e(M.nativeConnectionNotEstablished.code,M.nativeConnectionNotEstablished.desc)},e.createNativeBrokerCalledBeforeInitialize=function(){return new e(M.nativeBrokerCalledBeforeInitialize.code,M.nativeBrokerCalledBeforeInitialize.desc)},e.createNativePromptParameterNotSupportedError=function(){return new e(M.nativePromptNotSupported.code,M.nativePromptNotSupported.desc)},e}(W);var nn={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"},ys={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},Kn;(function(t){t.HandshakeRequest="Handshake",t.HandshakeResponse="HandshakeResponse",t.GetToken="GetToken",t.Response="Response"})(Kn||(Kn={}));var $t;(function(t){t.LocalStorage="localStorage",t.SessionStorage="sessionStorage",t.MemoryStorage="memoryStorage"})($t||($t={}));var bn;(function(t){t.GET="GET",t.POST="POST"})(bn||(bn={}));var pe;(function(t){t.AUTHORITY="authority",t.ACQUIRE_TOKEN_ACCOUNT="acquireToken.account",t.SESSION_STATE="session.state",t.REQUEST_STATE="request.state",t.NONCE_IDTOKEN="nonce.id_token",t.ORIGIN_URI="request.origin",t.RENEW_STATUS="token.renew.status",t.URL_HASH="urlHash",t.REQUEST_PARAMS="request.params",t.SCOPES="scopes",t.INTERACTION_STATUS_KEY="interaction.status",t.CCS_CREDENTIAL="ccs.credential",t.CORRELATION_ID="request.correlationId",t.NATIVE_REQUEST="request.native",t.REDIRECT_CONTEXT="request.redirect.context"})(pe||(pe={}));var ha;(function(t){t.WRAPPER_SKU="wrapper.sku",t.WRAPPER_VER="wrapper.version"})(ha||(ha={}));var Pe;(function(t){t[t.acquireTokenRedirect=861]="acquireTokenRedirect",t[t.acquireTokenPopup=862]="acquireTokenPopup",t[t.ssoSilent=863]="ssoSilent",t[t.acquireTokenSilent_authCode=864]="acquireTokenSilent_authCode",t[t.handleRedirectPromise=865]="handleRedirectPromise",t[t.acquireTokenByCode=866]="acquireTokenByCode",t[t.acquireTokenSilent_silentFlow=61]="acquireTokenSilent_silentFlow",t[t.logout=961]="logout",t[t.logoutPopup=962]="logoutPopup"})(Pe||(Pe={}));var G;(function(t){t.Redirect="redirect",t.Popup="popup",t.Silent="silent",t.None="none"})(G||(G={}));var sm;(function(t){t.Startup="startup",t.Login="login",t.Logout="logout",t.AcquireToken="acquireToken",t.SsoSilent="ssoSilent",t.HandleRedirect="handleRedirect",t.None="none"})(sm||(sm={}));var cm={scopes:Ac},Ra="jwk",lm;(function(t){t.React="@azure/msal-react",t.Angular="@azure/msal-angular"})(lm||(lm={}));var d2="msal.db",x_=1,E_=d2+".keys",fr;(function(t){t[t.Default=0]="Default",t[t.AccessToken=1]="AccessToken",t[t.AccessTokenAndRefreshToken=2]="AccessTokenAndRefreshToken",t[t.RefreshToken=3]="RefreshToken",t[t.RefreshTokenAndNetwork=4]="RefreshTokenAndNetwork",t[t.Skip=5]="Skip"})(fr||(fr={}));var hr={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."}},Gd=function(t){It(e,t);function e(r,n){var i=t.call(this,r,n)||this;return i.name="BrowserConfigurationAuthError",Object.setPrototypeOf(i,e.prototype),i}return e.createRedirectUriEmptyError=function(){return new e(hr.redirectUriNotSet.code,hr.redirectUriNotSet.desc)},e.createPostLogoutRedirectUriEmptyError=function(){return new e(hr.postLogoutUriNotSet.code,hr.postLogoutUriNotSet.desc)},e.createStorageNotSupportedError=function(r){return new e(hr.storageNotSupportedError.code,hr.storageNotSupportedError.desc+" Given Location: "+r)},e.createRedirectCallbacksNotSetError=function(){return new e(hr.noRedirectCallbacksSet.code,hr.noRedirectCallbacksSet.desc)},e.createStubPcaInstanceCalledError=function(){return new e(hr.stubPcaInstanceCalled.code,hr.stubPcaInstanceCalled.desc)},e.createInMemoryRedirectUnavailableError=function(){return new e(hr.inMemRedirectUnavailable.code,hr.inMemRedirectUnavailable.desc)},e.createEntropyNotProvided=function(){return new e(hr.entropyNotProvided.code,hr.entropyNotProvided.desc)},e}(W);var dm=function(){function t(e){this.validateWindowStorage(e),this.windowStorage=window[e]}return t.prototype.validateWindowStorage=function(e){if(e!==$t.LocalStorage&&e!==$t.SessionStorage)throw Gd.createStorageNotSupportedError(e);var r=!!window[e];if(!r)throw Gd.createStorageNotSupportedError(e)},t.prototype.getItem=function(e){return this.windowStorage.getItem(e)},t.prototype.setItem=function(e,r){this.windowStorage.setItem(e,r)},t.prototype.removeItem=function(e){this.windowStorage.removeItem(e)},t.prototype.getKeys=function(){return Object.keys(this.windowStorage)},t.prototype.containsKey=function(e){return this.windowStorage.hasOwnProperty(e)},t}();var h2=function(){function t(){this.cache=new Map}return t.prototype.getItem=function(e){return this.cache.get(e)||null},t.prototype.setItem=function(e,r){this.cache.set(e,r)},t.prototype.removeItem=function(e){this.cache.delete(e)},t.prototype.getKeys=function(){var e=[];return this.cache.forEach(function(r,n){e.push(n)}),e},t.prototype.containsKey=function(e){return this.cache.has(e)},t.prototype.clear=function(){this.cache.clear()},t}();var a3=function(){function t(){}return t.extractBrowserRequestState=function(e,r){if(V.isEmpty(r))return null;try{var n=Qn.parseRequestState(e,r);return n.libraryState.meta}catch(i){throw j.createInvalidStateError(r,i)}},t.parseServerResponseFromHash=function(e){if(!e)return{};var r=new ge(e);return ge.getDeserializedHash(r.getHash())},t}();var u2=function(t){It(e,t);function e(r,n,i,o){var a=t.call(this,r,i)||this;return a.COOKIE_LIFE_MULTIPLIER=24*60*60*1e3,a.cacheConfig=n,a.logger=o,a.internalStorage=new h2,a.browserStorage=a.setupBrowserStorage(a.cacheConfig.cacheLocation),a.temporaryCacheStorage=a.setupTemporaryCacheStorage(a.cacheConfig.cacheLocation),a.migrateCacheEntries(),a}return e.prototype.setupBrowserStorage=function(r){switch(r){case $t.LocalStorage:case $t.SessionStorage:try{return new dm(r)}catch(n){this.logger.verbose(n);break}}return this.cacheConfig.cacheLocation=$t.MemoryStorage,new h2},e.prototype.setupTemporaryCacheStorage=function(r){switch(r){case $t.LocalStorage:case $t.SessionStorage:try{return new dm($t.SessionStorage)}catch(n){return this.logger.verbose(n),this.internalStorage}case $t.MemoryStorage:default:return this.internalStorage}},e.prototype.migrateCacheEntries=function(){var r=this,n=_.CACHE_PREFIX+"."+dt.ID_TOKEN,i=_.CACHE_PREFIX+"."+dt.CLIENT_INFO,o=_.CACHE_PREFIX+"."+dt.ERROR,a=_.CACHE_PREFIX+"."+dt.ERROR_DESC,s=this.browserStorage.getItem(n),c=this.browserStorage.getItem(i),l=this.browserStorage.getItem(o),d=this.browserStorage.getItem(a),h=[s,c,l,d],u=[dt.ID_TOKEN,dt.CLIENT_INFO,dt.ERROR,dt.ERROR_DESC];u.forEach(function(f,v){return r.migrateCacheEntry(f,h[v])})},e.prototype.migrateCacheEntry=function(r,n){n&&this.setTemporaryCache(r,n,!0)},e.prototype.validateAndParseJson=function(r){try{var n=JSON.parse(r);return n&&typeof n=="object"?n:null}catch{return null}},e.prototype.getItem=function(r){return this.browserStorage.getItem(r)},e.prototype.setItem=function(r,n){this.browserStorage.setItem(r,n)},e.prototype.getAccount=function(r){var n=this.getItem(r);if(!n)return null;var i=this.validateAndParseJson(n);return!i||!kt.isAccountEntity(i)?null:Zr.toObject(new kt,i)},e.prototype.setAccount=function(r){this.logger.trace("BrowserCacheManager.setAccount called");var n=r.generateAccountKey();this.setItem(n,JSON.stringify(r))},e.prototype.getIdTokenCredential=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!uc.isIdTokenEntity(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),Zr.toObject(new uc,i))},e.prototype.setIdTokenCredential=function(r){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");var n=r.generateCredentialKey();this.setItem(n,JSON.stringify(r))},e.prototype.getAccessTokenCredential=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!fc.isAccessTokenEntity(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),Zr.toObject(new fc,i))},e.prototype.setAccessTokenCredential=function(r){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");var n=r.generateCredentialKey();this.setItem(n,JSON.stringify(r))},e.prototype.getRefreshTokenCredential=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!Fd.isRefreshTokenEntity(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),Zr.toObject(new Fd,i))},e.prototype.setRefreshTokenCredential=function(r){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");var n=r.generateCredentialKey();this.setItem(n,JSON.stringify(r))},e.prototype.getAppMetadata=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!c2.isAppMetadataEntity(r,i)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),Zr.toObject(new c2,i))},e.prototype.setAppMetadata=function(r){this.logger.trace("BrowserCacheManager.setAppMetadata called");var n=r.generateAppMetadataKey();this.setItem(n,JSON.stringify(r))},e.prototype.getServerTelemetry=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!qd.isServerTelemetryEntity(r,i)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),Zr.toObject(new qd,i))},e.prototype.setServerTelemetry=function(r,n){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(r,JSON.stringify(n))},e.prototype.getAuthorityMetadata=function(r){var n=this.internalStorage.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;var i=this.validateAndParseJson(n);return i&&l2.isAuthorityMetadataEntity(r,i)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),Zr.toObject(new l2,i)):null},e.prototype.getAuthorityMetadataKeys=function(){var r=this,n=this.internalStorage.getKeys();return n.filter(function(i){return r.isAuthorityMetadata(i)})},e.prototype.setWrapperMetadata=function(r,n){this.internalStorage.setItem(ha.WRAPPER_SKU,r),this.internalStorage.setItem(ha.WRAPPER_VER,n)},e.prototype.getWrapperMetadata=function(){var r=this.internalStorage.getItem(ha.WRAPPER_SKU)||_.EMPTY_STRING,n=this.internalStorage.getItem(ha.WRAPPER_VER)||_.EMPTY_STRING;return[r,n]},e.prototype.setAuthorityMetadata=function(r,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(r,JSON.stringify(n))},e.prototype.getActiveAccount=function(){var r=this.generateCacheKey(dt.ACTIVE_ACCOUNT_FILTERS),n=this.getItem(r);if(!n){this.logger.trace("No active account filters cache schema found, looking for legacy schema");var i=this.generateCacheKey(dt.ACTIVE_ACCOUNT),o=this.getItem(i);if(!o)return this.logger.trace("No active account found"),null;var a=this.getAccountInfoByFilter({localAccountId:o})[0]||null;return a?(this.logger.trace("Legacy active account cache schema found"),this.logger.trace("Adding active account filters cache schema"),this.setActiveAccount(a),a):null}var s=this.validateAndParseJson(n);return s?(this.logger.trace("Active account filters schema found"),this.getAccountInfoByFilter({homeAccountId:s.homeAccountId,localAccountId:s.localAccountId})[0]||null):(this.logger.trace("No active account found"),null)},e.prototype.setActiveAccount=function(r){var n=this.generateCacheKey(dt.ACTIVE_ACCOUNT_FILTERS),i=this.generateCacheKey(dt.ACTIVE_ACCOUNT);if(r){this.logger.verbose("setActiveAccount: Active account set");var o={homeAccountId:r.homeAccountId,localAccountId:r.localAccountId};this.browserStorage.setItem(n,JSON.stringify(o)),this.browserStorage.setItem(i,r.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(n),this.browserStorage.removeItem(i)},e.prototype.getAccountInfoByFilter=function(r){var n=this.getAllAccounts();return n.filter(function(i){return!(r.username&&r.username.toLowerCase()!==i.username.toLowerCase()||r.homeAccountId&&r.homeAccountId!==i.homeAccountId||r.localAccountId&&r.localAccountId!==i.localAccountId||r.tenantId&&r.tenantId!==i.tenantId||r.environment&&r.environment!==i.environment)})},e.prototype.getAccountInfoByHints=function(r,n){var i=this.getAllAccounts().filter(function(o){if(n){var a=o.idTokenClaims&&o.idTokenClaims.sid;return n===a}return r?r===o.username:!1});if(i.length===1)return i[0];if(i.length>1)throw j.createMultipleMatchingAccountsInCacheError();return null},e.prototype.getThrottlingCache=function(r){var n=this.getItem(r);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;var i=this.validateAndParseJson(n);return!i||!om.isThrottlingEntity(r,i)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),Zr.toObject(new om,i))},e.prototype.setThrottlingCache=function(r,n){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(r,JSON.stringify(n))},e.prototype.getTemporaryCache=function(r,n){var i=n?this.generateCacheKey(r):r;if(this.cacheConfig.storeAuthStateInCookie){var o=this.getItemCookie(i);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}var a=this.temporaryCacheStorage.getItem(i);if(!a){if(this.cacheConfig.cacheLocation===$t.LocalStorage){var s=this.browserStorage.getItem(i);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),s}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),a},e.prototype.setTemporaryCache=function(r,n,i){var o=i?this.generateCacheKey(r):r;this.temporaryCacheStorage.setItem(o,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.setItemCookie(o,n))},e.prototype.removeItem=function(r){return this.browserStorage.removeItem(r),this.temporaryCacheStorage.removeItem(r),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.clearItemCookie(r)),!0},e.prototype.containsKey=function(r){return this.browserStorage.containsKey(r)||this.temporaryCacheStorage.containsKey(r)},e.prototype.getKeys=function(){return Xf(this.browserStorage.getKeys(),this.temporaryCacheStorage.getKeys())},e.prototype.clear=function(){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.removeAllAccounts()];case 1:return n.sent(),this.removeAppMetadata(),this.getKeys().forEach(function(i){(r.browserStorage.containsKey(i)||r.temporaryCacheStorage.containsKey(i))&&(i.indexOf(_.CACHE_PREFIX)!==-1||i.indexOf(r.clientId)!==-1)&&r.removeItem(i)}),this.internalStorage.clear(),[2]}})})},e.prototype.setItemCookie=function(r,n,i){var o=encodeURIComponent(r)+"="+encodeURIComponent(n)+";path=/;SameSite=Lax;";if(i){var a=this.getCookieExpirationTime(i);o+="expires="+a+";"}this.cacheConfig.secureCookies&&(o+="Secure;"),document.cookie=o},e.prototype.getItemCookie=function(r){for(var n=encodeURIComponent(r)+"=",i=document.cookie.split(";"),o=0;o<i.length;o++){for(var a=i[o];a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(n)===0)return decodeURIComponent(a.substring(n.length,a.length))}return _.EMPTY_STRING},e.prototype.clearMsalCookies=function(){var r=this,n=_.CACHE_PREFIX+"."+this.clientId,i=document.cookie.split(";");i.forEach(function(o){for(;o.charAt(0)===" ";)o=o.substring(1);if(o.indexOf(n)===0){var a=o.split("=")[0];r.clearItemCookie(a)}})},e.prototype.clearItemCookie=function(r){this.setItemCookie(r,_.EMPTY_STRING,-1)},e.prototype.getCookieExpirationTime=function(r){var n=new Date,i=new Date(n.getTime()+r*this.COOKIE_LIFE_MULTIPLIER);return i.toUTCString()},e.prototype.getCache=function(){return this.browserStorage},e.prototype.setCache=function(){},e.prototype.generateCacheKey=function(r){var n=this.validateAndParseJson(r);return n?JSON.stringify(r):V.startsWith(r,_.CACHE_PREFIX)||V.startsWith(r,dt.ADAL_ID_TOKEN)?r:_.CACHE_PREFIX+"."+this.clientId+"."+r},e.prototype.generateAuthorityKey=function(r){var n=Qn.parseRequestState(this.cryptoImpl,r).libraryState.id;return this.generateCacheKey(pe.AUTHORITY+"."+n)},e.prototype.generateNonceKey=function(r){var n=Qn.parseRequestState(this.cryptoImpl,r).libraryState.id;return this.generateCacheKey(pe.NONCE_IDTOKEN+"."+n)},e.prototype.generateStateKey=function(r){var n=Qn.parseRequestState(this.cryptoImpl,r).libraryState.id;return this.generateCacheKey(pe.REQUEST_STATE+"."+n)},e.prototype.getCachedAuthority=function(r){var n=this.generateStateKey(r),i=this.getTemporaryCache(n);if(!i)return null;var o=this.generateAuthorityKey(i);return this.getTemporaryCache(o)},e.prototype.updateCacheEntries=function(r,n,i,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");var s=this.generateStateKey(r);this.setTemporaryCache(s,r,!1);var c=this.generateNonceKey(r);this.setTemporaryCache(c,n,!1);var l=this.generateAuthorityKey(r);if(this.setTemporaryCache(l,i,!1),a){var d={credential:a.homeAccountId,type:kr.HOME_ACCOUNT_ID};this.setTemporaryCache(pe.CCS_CREDENTIAL,JSON.stringify(d),!0)}else if(!V.isEmpty(o)){var d={credential:o,type:kr.UPN};this.setTemporaryCache(pe.CCS_CREDENTIAL,JSON.stringify(d),!0)}},e.prototype.resetRequestCache=function(r){var n=this;this.logger.trace("BrowserCacheManager.resetRequestCache called"),V.isEmpty(r)||this.getKeys().forEach(function(i){i.indexOf(r)!==-1&&n.removeItem(i)}),r&&(this.removeItem(this.generateStateKey(r)),this.removeItem(this.generateNonceKey(r)),this.removeItem(this.generateAuthorityKey(r))),this.removeItem(this.generateCacheKey(pe.REQUEST_PARAMS)),this.removeItem(this.generateCacheKey(pe.ORIGIN_URI)),this.removeItem(this.generateCacheKey(pe.URL_HASH)),this.removeItem(this.generateCacheKey(pe.CORRELATION_ID)),this.removeItem(this.generateCacheKey(pe.CCS_CREDENTIAL)),this.removeItem(this.generateCacheKey(pe.NATIVE_REQUEST)),this.setInteractionInProgress(!1)},e.prototype.cleanRequestByState=function(r){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),r){var n=this.generateStateKey(r),i=this.temporaryCacheStorage.getItem(n);this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: "+i),this.resetRequestCache(i||_.EMPTY_STRING)}this.clearMsalCookies()},e.prototype.cleanRequestByInteractionType=function(r){var n=this;this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.getKeys().forEach(function(i){if(i.indexOf(pe.REQUEST_STATE)!==-1){var o=n.temporaryCacheStorage.getItem(i);if(!!o){var a=a3.extractBrowserRequestState(n.cryptoImpl,o);a&&a.interactionType===r&&(n.logger.infoPii("BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: "+o),n.resetRequestCache(o))}}}),this.clearMsalCookies(),this.setInteractionInProgress(!1)},e.prototype.cacheCodeRequest=function(r,n){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");var i=n.base64Encode(JSON.stringify(r));this.setTemporaryCache(pe.REQUEST_PARAMS,i,!0)},e.prototype.getCachedRequest=function(r,n){this.logger.trace("BrowserCacheManager.getCachedRequest called");var i=this.getTemporaryCache(pe.REQUEST_PARAMS,!0);if(!i)throw D.createNoTokenRequestCacheError();var o=this.validateAndParseJson(n.base64Decode(i));if(!o)throw D.createUnableToParseTokenRequestCacheError();if(this.removeItem(this.generateCacheKey(pe.REQUEST_PARAMS)),V.isEmpty(o.authority)){var a=this.generateAuthorityKey(r),s=this.getTemporaryCache(a);if(!s)throw D.createNoCachedAuthorityError();o.authority=s}return o},e.prototype.getCachedNativeRequest=function(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");var r=this.getTemporaryCache(pe.NATIVE_REQUEST,!0);if(!r)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;var n=this.validateAndParseJson(r);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)},e.prototype.isInteractionInProgress=function(r){var n=this.getInteractionInProgress();return r?n===this.clientId:!!n},e.prototype.getInteractionInProgress=function(){var r=_.CACHE_PREFIX+"."+pe.INTERACTION_STATUS_KEY;return this.getTemporaryCache(r,!1)},e.prototype.setInteractionInProgress=function(r){var n=_.CACHE_PREFIX+"."+pe.INTERACTION_STATUS_KEY;if(r){if(this.getInteractionInProgress())throw D.createInteractionInProgressError();this.setTemporaryCache(n,this.clientId,!1)}else!r&&this.getInteractionInProgress()===this.clientId&&this.removeItem(n)},e.prototype.getLegacyLoginHint=function(){var r=this.getTemporaryCache(dt.ADAL_ID_TOKEN);r&&(this.browserStorage.removeItem(dt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));var n=this.getTemporaryCache(dt.ID_TOKEN,!0);n&&(this.removeItem(this.generateCacheKey(dt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));var i=n||r;if(i){var o=new In(i,this.cryptoImpl);if(o.claims&&o.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"),o.claims.preferred_username;if(o.claims&&o.claims.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.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},e.prototype.updateCredentialCacheKey=function(r,n){var i=n.generateCredentialKey();if(r!==i){var o=this.getItem(r);if(o)return this.removeItem(r),this.setItem(i,o),this.logger.verbose("Updated an outdated "+n.credentialType+" cache key"),i;this.logger.error("Attempted to update an outdated "+n.credentialType+" cache key but no item matching the outdated key was found in storage")}return r},e.prototype.getRedirectRequestContext=function(){return this.getTemporaryCache(pe.REDIRECT_CONTEXT,!0)},e.prototype.setRedirectRequestContext=function(r){this.setTemporaryCache(pe.REDIRECT_CONTEXT,r,!0)},e}(Zr),C_=function(t,e){var r={cacheLocation:$t.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1};return new u2(t,r,Dd,e)};var _h="@azure/msal-browser",$s="2.32.1";var z_=function(){function t(){}return t.prototype.sendGetRequestAsync=function(e,r){return S(this,void 0,void 0,function(){var n,i,o;return k(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,fetch(e,{method:bn.GET,headers:this.getFetchHeaders(r)})];case 1:return n=a.sent(),[3,3];case 2:throw i=a.sent(),window.navigator.onLine?D.createGetRequestFailedError(i,e):D.createNoNetworkConnectivityError();case 3:return a.trys.push([3,5,,6]),o={headers:this.getHeaderDict(n.headers)},[4,n.json()];case 4:return[2,(o.body=a.sent(),o.status=n.status,o)];case 5:throw a.sent(),D.createFailedToParseNetworkResponseError(e);case 6:return[2]}})})},t.prototype.sendPostRequestAsync=function(e,r){return S(this,void 0,void 0,function(){var n,i,o,a;return k(this,function(s){switch(s.label){case 0:n=r&&r.body||_.EMPTY_STRING,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,fetch(e,{method:bn.POST,headers:this.getFetchHeaders(r),body:n})];case 2:return i=s.sent(),[3,4];case 3:throw o=s.sent(),window.navigator.onLine?D.createPostRequestFailedError(o,e):D.createNoNetworkConnectivityError();case 4:return s.trys.push([4,6,,7]),a={headers:this.getHeaderDict(i.headers)},[4,i.json()];case 5:return[2,(a.body=s.sent(),a.status=i.status,a)];case 6:throw s.sent(),D.createFailedToParseNetworkResponseError(e);case 7:return[2]}})})},t.prototype.getFetchHeaders=function(e){var r=new Headers;if(!(e&&e.headers))return r;var n=e.headers;return Object.keys(n).forEach(function(i){r.append(i,n[i])}),r},t.prototype.getHeaderDict=function(e){var r={};return e.forEach(function(n,i){r[i]=n}),r},t}();var S_=function(){function t(){}return t.prototype.sendGetRequestAsync=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.sendRequestAsync(e,bn.GET,r)]})})},t.prototype.sendPostRequestAsync=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.sendRequestAsync(e,bn.POST,r)]})})},t.prototype.sendRequestAsync=function(e,r,n){var i=this;return new Promise(function(o,a){var s=new XMLHttpRequest;if(s.open(r,e,!0),i.setXhrHeaders(s,n),s.onload=function(){(s.status<200||s.status>=300)&&(r===bn.POST?a(D.createPostRequestFailedError("Failed with status "+s.status,e)):a(D.createGetRequestFailedError("Failed with status "+s.status,e)));try{var c=JSON.parse(s.responseText),l={headers:i.getHeaderDict(s),body:c,status:s.status};o(l)}catch{a(D.createFailedToParseNetworkResponseError(e))}},s.onerror=function(){window.navigator.onLine?r===bn.POST?a(D.createPostRequestFailedError("Failed with status "+s.status,e)):a(D.createGetRequestFailedError("Failed with status "+s.status,e)):a(D.createNoNetworkConnectivityError())},r===bn.POST&&n&&n.body)s.send(n.body);else if(r===bn.GET)s.send();else throw D.createHttpMethodNotImplementedError(r)})},t.prototype.setXhrHeaders=function(e,r){if(r&&r.headers){var n=r.headers;Object.keys(n).forEach(function(i){e.setRequestHeader(i,n[i])})}},t.prototype.getHeaderDict=function(e){var r=e.getAllResponseHeaders(),n=r.trim().split(/[\r\n]+/),i={};return n.forEach(function(o){var a=o.split(": "),s=a.shift(),c=a.join(": ");s&&c&&(i[s]=c)}),i},t}();var Je=function(){function t(){}return t.clearHash=function(e){e.location.hash=_.EMPTY_STRING,typeof e.history.replaceState=="function"&&e.history.replaceState(null,_.EMPTY_STRING,""+e.location.origin+e.location.pathname+e.location.search)},t.replaceHash=function(e){var r=e.split("#");r.shift(),window.location.hash=r.length>0?r.join("#"):_.EMPTY_STRING},t.isInIframe=function(){return window.parent!==window},t.isInPopup=function(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(nn.POPUP_NAME_PREFIX+".")===0},t.getCurrentUri=function(){return window.location.href.split("?")[0].split("#")[0]},t.getHomepage=function(){var e=new ge(window.location.href),r=e.getUrlComponents();return r.Protocol+"//"+r.HostNameAndPort+"/"},t.getBrowserNetworkClient=function(){return window.fetch&&window.Headers?new z_:new S_},t.blockReloadInHiddenIframes=function(){var e=ge.hashContainsKnownProperties(window.location.hash);if(e&&t.isInIframe())throw D.createBlockReloadInHiddenIframeError()},t.blockRedirectInIframe=function(e,r){var n=t.isInIframe();if(e===G.Redirect&&n&&!r)throw D.createRedirectInIframeError(n)},t.blockAcquireTokenInPopups=function(){if(t.isInPopup())throw D.createBlockAcquireTokenInPopupsError()},t.blockNonBrowserEnvironment=function(e){if(!e)throw D.createNonBrowserEnvironmentError()},t.blockNativeBrokerCalledBeforeInitialized=function(e,r){if(e&&!r)throw D.createNativeBrokerCalledBeforeInitialize()},t.detectIEOrEdge=function(){var e=window.navigator.userAgent,r=e.indexOf("MSIE "),n=e.indexOf("Trident/"),i=e.indexOf("Edge/"),o=r>0||n>0,a=i>0;return o||a},t}();var s3=function(){function t(e,r,n,i,o,a,s,c,l){this.config=e,this.browserStorage=r,this.browserCrypto=n,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=a,this.nativeMessageHandler=c,this.correlationId=l||this.browserCrypto.createNewGuid(),this.logger=i.clone(nn.MSAL_SKU,$s,this.correlationId),this.performanceClient=s}return t.prototype.clearCacheOnLogout=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){switch(r.label){case 0:if(!e)return[3,5];kt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null)),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.browserStorage.removeAccount(kt.generateAccountCacheKey(e))];case 2:return r.sent(),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request."),[3,4];case 3:return r.sent(),this.logger.error("Account provided in logout request was not found. Local cache unchanged."),[3,4];case 4:return[3,9];case 5:return r.trys.push([5,8,,9]),this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),[4,this.browserStorage.clear()];case 6:return r.sent(),[4,this.browserCrypto.clearKeystore()];case 7:return r.sent(),[3,9];case 8:return r.sent(),this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged."),[3,9];case 9:return[2]}})})},t.prototype.initializeBaseRequest=function(e){return S(this,void 0,void 0,function(){var r,n,i,o;return k(this,function(a){switch(a.label){case 0:if(this.logger.verbose("Initializing BaseAuthRequest"),r=e.authority||this.config.auth.authority,n=Xf(e&&e.scopes||[]),i=K(K({},e),{correlationId:this.correlationId,authority:r,scopes:n}),!i.authenticationScheme)i.authenticationScheme=Ee.BEARER,this.logger.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(i.authenticationScheme===Ee.SSH){if(!e.sshJwk)throw Ne.createMissingSshJwkError();if(!e.sshKid)throw Ne.createMissingSshKidError()}this.logger.verbose('Authentication Scheme set to "'+i.authenticationScheme+'" as configured in Auth request')}return e.claims&&!V.isEmpty(e.claims)?(o=i,[4,this.browserCrypto.hashString(e.claims)]):[3,2];case 1:o.requestedClaimsHash=a.sent(),a.label=2;case 2:return[2,i]}})})},t.prototype.getRedirectUri=function(e){this.logger.verbose("getRedirectUri called");var r=e||this.config.auth.redirectUri||Je.getCurrentUri();return ge.getAbsoluteUrl(r,Je.getCurrentUri())},t.prototype.initializeServerTelemetryManager=function(e,r){this.logger.verbose("initializeServerTelemetryManager called");var n={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:r||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new __(n,this.browserStorage)},t.prototype.getDiscoveredAuthority=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:return this.logger.verbose("getDiscoveredAuthority called"),r={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata},e?(this.logger.verbose("Creating discovered authority with request authority"),[4,Bd.createDiscoveredInstance(e,this.config.system.networkClient,this.browserStorage,r,this.logger)]):[3,2];case 1:return[2,n.sent()];case 2:return this.logger.verbose("Creating discovered authority with configured authority"),[4,Bd.createDiscoveredInstance(this.config.auth.authority,this.config.system.networkClient,this.browserStorage,r,this.logger)];case 3:return[2,n.sent()]}})})},t}();var $a=function(t){It(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initializeAuthorizationCodeRequest=function(r){return S(this,void 0,void 0,function(){var n,i;return k(this,function(o){switch(o.label){case 0:return this.logger.verbose("initializeAuthorizationRequest called",r.correlationId),[4,this.browserCrypto.generatePkceCodes()];case 1:return n=o.sent(),i=K(K({},r),{redirectUri:r.redirectUri,code:_.EMPTY_STRING,codeVerifier:n.verifier}),r.codeChallenge=n.challenge,r.codeChallengeMethod=_.S256_CODE_CHALLENGE_METHOD,[2,i]}})})},e.prototype.initializeLogoutRequest=function(r){this.logger.verbose("initializeLogoutRequest called",r==null?void 0:r.correlationId);var n=K({correlationId:this.correlationId||this.browserCrypto.createNewGuid()},r);if(r)if(r.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(r.account){var i=this.getLogoutHintFromIdTokenClaims(r.account);i&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=i)}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!r||r.postLogoutRedirectUri!==null?r&&r.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=ge.getAbsoluteUrl(r.postLogoutRedirectUri,Je.getCurrentUri())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=ge.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Je.getCurrentUri())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=ge.getAbsoluteUrl(Je.getCurrentUri(),Je.getCurrentUri())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n},e.prototype.getLogoutHintFromIdTokenClaims=function(r){var n=r.idTokenClaims;if(n){if(n.login_hint)return n.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},e.prototype.createAuthCodeClient=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,this.getClientConfiguration(r,n,i)];case 1:return o=a.sent(),[2,new r3(o)]}})})},e.prototype.getClientConfiguration=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return this.logger.verbose("getClientConfiguration called",this.correlationId),[4,this.getDiscoveredAuthority(n,i)];case 1:return o=a.sent(),[2,{authOptions:{clientId:this.config.auth.clientId,authority:o,clientCapabilities:this.config.auth.clientCapabilities},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:this.config.system.loggerOptions.loggerCallback,piiLoggingEnabled:this.config.system.loggerOptions.piiLoggingEnabled,logLevel:this.config.system.loggerOptions.logLevel,correlationId:this.correlationId},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:r,libraryInfo:{sku:nn.MSAL_SKU,version:$s,cpu:_.EMPTY_STRING,os:_.EMPTY_STRING},telemetry:this.config.telemetry}]}})})},e.prototype.validateAndExtractStateFromHash=function(r,n,i){if(this.logger.verbose("validateAndExtractStateFromHash called",i),!r.state)throw D.createHashDoesNotContainStateError();var o=a3.extractBrowserRequestState(this.browserCrypto,r.state);if(!o)throw D.createUnableToParseStateError();if(o.interactionType!==n)throw D.createStateInteractionTypeMismatchError();return this.logger.verbose("Returning state from hash",i),r.state},e.prototype.getDiscoveredAuthority=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s;return k(this,function(c){switch(c.label){case 0:return this.logger.verbose("getDiscoveredAuthority called",this.correlationId),i=this.performanceClient.startMeasurement(pt.StandardInteractionClientGetDiscoveredAuthority,this.correlationId),o={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},a=r||this.config.auth.authority,s=jd.generateAuthority(a,n||this.config.auth.azureCloudOptions),this.logger.verbose("Creating discovered authority with configured authority",this.correlationId),[4,Bd.createDiscoveredInstance(s,this.config.system.networkClient,this.browserStorage,o,this.logger).then(function(l){return i.endMeasurement({success:!0}),l}).catch(function(l){throw i.endMeasurement({errorCode:l.errorCode,subErrorCode:l.subError,success:!1}),l})];case 1:return[2,c.sent()]}})})},e.prototype.initializeAuthorizationRequest=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c,l,d;return k(this,function(h){switch(h.label){case 0:return this.logger.verbose("initializeAuthorizationRequest called",this.correlationId),i=this.getRedirectUri(r.redirectUri),o={interactionType:n},a=Qn.setRequestState(this.browserCrypto,r&&r.state||_.EMPTY_STRING,o),c=[{}],[4,this.initializeBaseRequest(r)];case 1:return s=K.apply(void 0,[K.apply(void 0,c.concat([h.sent()])),{redirectUri:i,state:a,nonce:r.nonce||this.browserCrypto.createNewGuid(),responseMode:Rd.FRAGMENT}]),l=r.account||this.browserStorage.getActiveAccount(),l&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii("Setting validated request account: "+l.homeAccountId,this.correlationId),s.account=l),V.isEmpty(s.loginHint)&&!l&&(d=this.browserStorage.getLegacyLoginHint(),d&&(s.loginHint=d)),[2,s]}})})},e}(s3);var e0=function(){function t(e,r,n,i){this.authModule=e,this.browserStorage=r,this.authCodeRequest=n,this.logger=i}return t.prototype.handleCodeResponseFromHash=function(e,r,n,i){return S(this,void 0,void 0,function(){var o,a,s;return k(this,function(c){if(this.logger.verbose("InteractionHandler.handleCodeResponse called"),V.isEmpty(e))throw D.createEmptyHashError(e);if(o=this.browserStorage.generateStateKey(r),a=this.browserStorage.getTemporaryCache(o),!a)throw j.createStateNotFoundError("Cached State");try{s=this.authModule.handleFragmentResponse(e,a)}catch(l){throw l instanceof ko&&l.subError===M.userCancelledError.code?D.createUserCancelledError():l}return[2,this.handleCodeResponseFromServer(s,r,n,i)]})})},t.prototype.handleCodeResponseFromServer=function(e,r,n,i,o){return o===void 0&&(o=!0),S(this,void 0,void 0,function(){var a,s,c,l,d,h;return k(this,function(u){switch(u.label){case 0:if(this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),a=this.browserStorage.generateStateKey(r),s=this.browserStorage.getTemporaryCache(a),!s)throw j.createStateNotFoundError("Cached State");return c=this.browserStorage.generateNonceKey(s),l=this.browserStorage.getTemporaryCache(c),this.authCodeRequest.code=e.code,e.cloud_instance_host_name?[4,this.updateTokenEndpointAuthority(e.cloud_instance_host_name,n,i)]:[3,2];case 1:u.sent(),u.label=2;case 2:return o&&(e.nonce=l||void 0),e.state=s,e.client_info?this.authCodeRequest.clientInfo=e.client_info:(d=this.checkCcsCredentials(),d&&(this.authCodeRequest.ccsCredential=d)),[4,this.authModule.acquireToken(this.authCodeRequest,e)];case 3:return h=u.sent(),this.browserStorage.cleanRequestByState(r),[2,h]}})})},t.prototype.updateTokenEndpointAuthority=function(e,r,n){return S(this,void 0,void 0,function(){var i,o;return k(this,function(a){switch(a.label){case 0:return i="https://"+e+"/"+r.tenant+"/",[4,Bd.createDiscoveredInstance(i,n,this.browserStorage,r.options,this.logger)];case 1:return o=a.sent(),this.authModule.updateAuthority(o),[2]}})})},t.prototype.checkCcsCredentials=function(){var e=this.browserStorage.getTemporaryCache(pe.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii("Cache credential could not be parsed: "+e)}return null},t}();var hm=function(t){It(e,t);function e(r,n,i,o,a){var s=t.call(this,r,n,i,o)||this;return s.browserCrypto=a,s}return e.prototype.initiateAuthRequest=function(r,n){return S(this,void 0,void 0,function(){var i,o;return k(this,function(a){switch(a.label){case 0:return this.logger.verbose("RedirectHandler.initiateAuthRequest called"),V.isEmpty(r)?[3,7]:(n.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(pe.ORIGIN_URI,n.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(pe.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest,this.browserCrypto),this.logger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: "+r),i={apiId:Pe.acquireTokenRedirect,timeout:n.redirectTimeout,noHistory:!1},typeof n.onRedirectNavigate!="function"?[3,4]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),o=n.onRedirectNavigate(r),o===!1?[3,2]:(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),[4,n.navigationClient.navigateExternal(r,i)])));case 1:return a.sent(),[2];case 2:return this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation"),[2];case 3:return[3,6];case 4:return this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),[4,n.navigationClient.navigateExternal(r,i)];case 5:return a.sent(),[2];case 6:return[3,8];case 7:throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),D.createEmptyNavigationUriError();case 8:return[2]}})})},e.prototype.handleCodeResponseFromHash=function(r,n,i,o){return S(this,void 0,void 0,function(){var a,s,c,l,d,h,u;return k(this,function(f){switch(f.label){case 0:if(this.logger.verbose("RedirectHandler.handleCodeResponse called"),V.isEmpty(r))throw D.createEmptyHashError(r);if(this.browserStorage.setInteractionInProgress(!1),a=this.browserStorage.generateStateKey(n),s=this.browserStorage.getTemporaryCache(a),!s)throw j.createStateNotFoundError("Cached State");try{c=this.authModule.handleFragmentResponse(r,s)}catch(v){throw v instanceof ko&&v.subError===M.userCancelledError.code?D.createUserCancelledError():v}return l=this.browserStorage.generateNonceKey(s),d=this.browserStorage.getTemporaryCache(l),this.authCodeRequest.code=c.code,c.cloud_instance_host_name?[4,this.updateTokenEndpointAuthority(c.cloud_instance_host_name,i,o)]:[3,2];case 1:f.sent(),f.label=2;case 2:return c.nonce=d||void 0,c.state=s,c.client_info?this.authCodeRequest.clientInfo=c.client_info:(h=this.checkCcsCredentials(),h&&(this.authCodeRequest.ccsCredential=h)),[4,this.authModule.acquireToken(this.authCodeRequest,c)];case 3:return u=f.sent(),this.browserStorage.cleanRequestByState(n),[2,u]}})})},e}(e0);var X;(function(t){t.INITIALIZE_START="msal:initializeStart",t.INITIALIZE_END="msal:initializeEnd",t.ACCOUNT_ADDED="msal:accountAdded",t.ACCOUNT_REMOVED="msal:accountRemoved",t.LOGIN_START="msal:loginStart",t.LOGIN_SUCCESS="msal:loginSuccess",t.LOGIN_FAILURE="msal:loginFailure",t.ACQUIRE_TOKEN_START="msal:acquireTokenStart",t.ACQUIRE_TOKEN_SUCCESS="msal:acquireTokenSuccess",t.ACQUIRE_TOKEN_FAILURE="msal:acquireTokenFailure",t.ACQUIRE_TOKEN_NETWORK_START="msal:acquireTokenFromNetworkStart",t.SSO_SILENT_START="msal:ssoSilentStart",t.SSO_SILENT_SUCCESS="msal:ssoSilentSuccess",t.SSO_SILENT_FAILURE="msal:ssoSilentFailure",t.ACQUIRE_TOKEN_BY_CODE_START="msal:acquireTokenByCodeStart",t.ACQUIRE_TOKEN_BY_CODE_SUCCESS="msal:acquireTokenByCodeSuccess",t.ACQUIRE_TOKEN_BY_CODE_FAILURE="msal:acquireTokenByCodeFailure",t.HANDLE_REDIRECT_START="msal:handleRedirectStart",t.HANDLE_REDIRECT_END="msal:handleRedirectEnd",t.POPUP_OPENED="msal:popupOpened",t.LOGOUT_START="msal:logoutStart",t.LOGOUT_SUCCESS="msal:logoutSuccess",t.LOGOUT_FAILURE="msal:logoutFailure",t.LOGOUT_END="msal:logoutEnd"})(X||(X={}));var yi;(function(t){t.USER_INTERACTION_REQUIRED="USER_INTERACTION_REQUIRED",t.USER_CANCEL="USER_CANCEL",t.NO_NETWORK="NO_NETWORK",t.TRANSIENT_ERROR="TRANSIENT_ERROR",t.PERSISTENT_ERROR="PERSISTENT_ERROR",t.DISABLED="DISABLED",t.ACCOUNT_UNAVAILABLE="ACCOUNT_UNAVAILABLE"})(yi||(yi={}));var os={extensionError:{code:"ContentError"},userSwitch:{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."},tokensNotFoundInCache:{code:"tokens_not_found_in_internal_memory_cache",desc:"Tokens not cached in MSAL JS internal memory, please make the WAM request"}},En=function(t){It(e,t);function e(r,n,i){var o=t.call(this,r,n)||this;return Object.setPrototypeOf(o,e.prototype),o.name="NativeAuthError",o.ext=i,o}return e.prototype.isFatal=function(){if(this.ext&&this.ext.status&&(this.ext.status===yi.PERSISTENT_ERROR||this.ext.status===yi.DISABLED))return!0;switch(this.errorCode){case os.extensionError.code:return!0;default:return!1}},e.createError=function(r,n,i){if(i&&i.status)switch(i.status){case yi.ACCOUNT_UNAVAILABLE:return sn.createNativeAccountUnavailableError();case yi.USER_INTERACTION_REQUIRED:return new sn(r,n);case yi.USER_CANCEL:return D.createUserCancelledError();case yi.NO_NETWORK:return D.createNoNetworkConnectivityError()}return new e(r,n,i)},e.createUserSwitchError=function(){return new e(os.userSwitch.code,os.userSwitch.desc)},e.createTokensNotFoundInCacheError=function(){return new e(os.tokensNotFoundInCache.code,os.tokensNotFoundInCache.desc)},e}(W);var c3=function(t){It(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s;return k(this,function(c){switch(c.label){case 0:return n=this.performanceClient.startMeasurement(pt.SilentCacheClientAcquireToken,r.correlationId),i=this.initializeServerTelemetryManager(Pe.acquireTokenSilent_silentFlow),[4,this.createSilentFlowClient(i,r.authority,r.azureCloudOptions)];case 1:o=c.sent(),this.logger.verbose("Silent auth client created"),c.label=2;case 2:return c.trys.push([2,4,,5]),[4,o.acquireCachedToken(r)];case 3:return a=c.sent(),n.endMeasurement({success:!0,fromCache:!0}),[2,a];case 4:throw s=c.sent(),s instanceof D&&s.errorCode===M.signingKeyNotFoundInStorage.code&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),n.endMeasurement({errorCode:s instanceof W&&s.errorCode||void 0,subErrorCode:s instanceof W&&s.subError||void 0,success:!1}),s;case 5:return[2]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e.prototype.createSilentFlowClient=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,this.getClientConfiguration(r,n,i)];case 1:return o=a.sent(),[2,new u_(o,this.performanceClient)]}})})},e.prototype.initializeSilentRequest=function(r,n){return S(this,void 0,void 0,function(){var i;return k(this,function(o){switch(o.label){case 0:return i=[K({},r)],[4,this.initializeBaseRequest(r)];case 1:return[2,K.apply(void 0,[K.apply(void 0,i.concat([o.sent()])),{account:n,forceRefresh:r.forceRefresh||!1}])]}})})},e}($a);var xa=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h,u,f){var v=t.call(this,r,n,i,o,a,s,l,d,f)||this;return v.apiId=c,v.accountId=h,v.nativeMessageHandler=d,v.nativeStorageManager=u,v.silentCacheClient=new c3(r,v.nativeStorageManager,i,o,a,s,l,d,f),v}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0:return this.logger.trace("NativeInteractionClient - acquireToken called."),n=this.performanceClient.startMeasurement(pt.NativeInteractionClientAcquireToken,r.correlationId),i=Br.nowSeconds(),[4,this.initializeNativeRequest(r)];case 1:o=d.sent(),d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.acquireTokensFromCache(this.accountId,o)];case 3:return a=d.sent(),n.endMeasurement({success:!0,isNativeBroker:!1,fromCache:!0}),[2,a];case 4:return d.sent(),this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call"),[3,5];case 5:return s={method:Kn.GetToken,request:o},[4,this.nativeMessageHandler.sendMessage(s)];case 6:return c=d.sent(),l=this.validateNativeResponse(c),[2,this.handleNativeResponse(l,o,i).then(function(h){return n.endMeasurement({success:!0,isNativeBroker:!0,requestId:h.requestId}),h}).catch(function(h){throw n.endMeasurement({success:!1,errorCode:h.errorCode,subErrorCode:h.subError,isNativeBroker:!0}),h})]}})})},e.prototype.createSilentCacheRequest=function(r,n){return{authority:r.authority,correlationId:this.correlationId,scopes:rr.fromString(r.scope).asArray(),account:n,forceRefresh:!1}},e.prototype.acquireTokensFromCache=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c;return k(this,function(l){switch(l.label){case 0:if(i=this.browserStorage.readAccountFromCacheWithNativeAccountId(r),!i)throw j.createNoAccountFoundError();o=i.getAccountInfo(),l.label=1;case 1:return l.trys.push([1,3,,4]),a=this.createSilentCacheRequest(n,o),[4,this.silentCacheClient.acquireToken(a)];case 2:return s=l.sent(),[2,s];case 3:throw c=l.sent(),c;case 4:return[2]}})})},e.prototype.acquireTokenRedirect=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c;return k(this,function(l){switch(l.label){case 0:return this.logger.trace("NativeInteractionClient - acquireTokenRedirect called."),[4,this.initializeNativeRequest(r)];case 1:n=l.sent(),i={method:Kn.GetToken,request:n},l.label=2;case 2:return l.trys.push([2,4,,5]),[4,this.nativeMessageHandler.sendMessage(i)];case 3:return o=l.sent(),this.validateNativeResponse(o),[3,5];case 4:if(a=l.sent(),a instanceof En&&a.isFatal())throw a;return[3,5];case 5:return this.browserStorage.setTemporaryCache(pe.NATIVE_REQUEST,JSON.stringify(n),!0),s={apiId:Pe.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},c=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(r.redirectUri),[4,this.navigationClient.navigateExternal(c,s)];case 6:return l.sent(),[2]}})})},e.prototype.handleRedirectPromise=function(){return S(this,void 0,void 0,function(){var r,n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0: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."),[2,null];if(r=this.browserStorage.getCachedNativeRequest(),!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),[2,null];n=r.prompt,i=Jp(r,["prompt"]),n&&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(pe.NATIVE_REQUEST)),o={method:Kn.GetToken,request:i},a=Br.nowSeconds(),d.label=1;case 1:return d.trys.push([1,3,,4]),this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker."),[4,this.nativeMessageHandler.sendMessage(o)];case 2:return s=d.sent(),this.validateNativeResponse(s),c=this.handleNativeResponse(s,i,a),this.browserStorage.setInteractionInProgress(!1),[2,c];case 3:throw l=d.sent(),this.browserStorage.setInteractionInProgress(!1),l;case 4:return[2]}})})},e.prototype.logout=function(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")},e.prototype.handleNativeResponse=function(r,n,i){return S(this,void 0,void 0,function(){var o,a,s,c,l,d,h,u,f,v,g,x,m,p,y,w,T,O,F,N,be=this;return k(this,function(Y){switch(Y.label){case 0:if(this.logger.trace("NativeInteractionClient - handleNativeResponse called."),o=this.getMATSFromResponse(r),this.performanceClient.addStaticFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:o?o.broker_version:void 0,matsAccountJoinOnStart:o?o.account_join_on_start:void 0,matsAccountJoinOnEnd:o?o.account_join_on_end:void 0,matsDeviceJoin:o?o.device_join:void 0,matsPromptBehavior:o?o.prompt_behavior:void 0,matsApiErrorCode:o?o.api_error_code:void 0,matsUiVisible:o?o.ui_visible:void 0,matsSilentCode:o?o.silent_code:void 0,matsSilentBiSubCode:o?o.silent_bi_sub_code:void 0,matsSilentMessage:o?o.silent_message:void 0,matsSilentStatus:o?o.silent_status:void 0,matsHttpStatus:o?o.http_status:void 0,matsHttpEventCount:o?o.http_event_count:void 0},this.correlationId),r.account.id!==n.accountId)throw En.createUserSwitchError();return a=new In(r.id_token||_.EMPTY_STRING,this.browserCrypto),[4,this.getDiscoveredAuthority(n.authority)];case 1:switch(s=Y.sent(),c=s.getPreferredCache(),l=kt.generateHomeAccountId(r.client_info||_.EMPTY_STRING,Fr.Default,this.logger,this.browserCrypto,a),d=kt.createAccount(r.client_info,l,a,void 0,void 0,void 0,c,r.account.id),this.browserStorage.setAccount(d),h=r.scope?rr.fromString(r.scope):rr.fromString(n.scope),u=r.account.properties||{},f=u.UID||a.claims.oid||a.claims.sub||_.EMPTY_STRING,v=u.TenantId||a.claims.tid||_.EMPTY_STRING,x=Ee.BEARER,m=n.tokenType,m){case Ee.POP:return[3,2]}return[3,4];case 2:if(x=Ee.POP,r.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),g=r.shr,[3,5];if(p=new Pa(this.browserCrypto),y={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce},!n.keyId)throw j.createKeyIdMissingError();return[4,p.signPopToken(r.access_token,n.keyId,y)];case 3:return g=Y.sent(),[3,5];case 4:g=r.access_token,Y.label=5;case 5:return w={authority:s.canonicalAuthority,uniqueId:f,tenantId:v,scopes:h.asArray(),account:d.getAccountInfo(),idToken:r.id_token,idTokenClaims:a.claims,accessToken:g,fromCache:o?this.isResponseFromCache(o):!1,expiresOn:new Date(Number(i+r.expires_in)*1e3),tokenType:x,correlationId:this.correlationId,state:r.state,fromNativeBroker:!0},T=uc.createIdTokenEntity(l,n.authority,r.id_token||_.EMPTY_STRING,n.clientId,a.claims.tid||_.EMPTY_STRING),this.nativeStorageManager.setIdTokenCredential(T),O=x===Ee.POP?_.SHR_NONCE_VALIDITY:(typeof r.expires_in=="string"?parseInt(r.expires_in,10):r.expires_in)||0,F=i+O,N=fc.createAccessTokenEntity(l,n.authority,g,n.clientId,v,h.printScopes(),F,0,this.browserCrypto),this.nativeStorageManager.setAccessTokenCredential(N),this.browserStorage.removeAccountContext(d).catch(function(Jt){be.logger.error("Error occurred while removing account context from browser storage. "+Jt)}),[2,w]}})})},e.prototype.validateNativeResponse=function(r){if(r.hasOwnProperty("access_token")&&r.hasOwnProperty("id_token")&&r.hasOwnProperty("client_info")&&r.hasOwnProperty("account")&&r.hasOwnProperty("scope")&&r.hasOwnProperty("expires_in"))return r;throw En.createUnexpectedError("Response missing expected properties.")},e.prototype.getMATSFromResponse=function(r){if(r.properties.MATS)try{return JSON.parse(r.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null},e.prototype.isResponseFromCache=function(r){return typeof r.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!r.is_cached},e.prototype.initializeNativeRequest=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d,h,u,f=this;return k(this,function(v){switch(v.label){case 0:return this.logger.trace("NativeInteractionClient - initializeNativeRequest called"),n=r.authority||this.config.auth.authority,i=new ge(n),i.validateAsUri(),o=r.scopes,a=Jp(r,["scopes"]),s=new rr(o||[]),s.appendScopes(Ac),c=function(){switch(f.apiId){case Pe.ssoSilent:case Pe.acquireTokenSilent_silentFlow:return f.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Bt.NONE}if(!r.prompt){f.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(r.prompt){case Bt.NONE:case Bt.CONSENT:case Bt.LOGIN:return f.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),r.prompt;default:throw f.logger.trace("initializeNativeRequest: prompt = "+r.prompt+" is not compatible with native flow"),D.createNativePromptParameterNotSupportedError()}},l=K(K({},a),{accountId:this.accountId,clientId:this.config.auth.clientId,authority:i.urlString,scope:s.printScopes(),redirectUri:this.getRedirectUri(r.redirectUri),prompt:c(),correlationId:this.correlationId,tokenType:r.authenticationScheme,windowTitleSubstring:document.title,extraParameters:K(K(K({},r.extraQueryParameters),r.tokenQueryParameters),{telemetry:ys.MATS_TELEMETRY}),extendedExpiryToken:!1}),r.authenticationScheme!==Ee.POP?[3,2]:(d={resourceRequestUri:r.resourceRequestUri,resourceRequestMethod:r.resourceRequestMethod,shrClaims:r.shrClaims,shrNonce:r.shrNonce},h=new Pa(this.browserCrypto),[4,h.generateCnf(d)]);case 1:u=v.sent(),l.reqCnf=u.reqCnfHash,l.keyId=u.kid,v.label=2;case 2:return[2,l]}})})},e}(s3);var vo=function(){function t(e,r,n){this.logger=e,this.handshakeTimeoutMs=r,this.extensionId=n,this.resolvers=new Map,this.handshakeResolvers=new Map,this.responseId=0,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this)}return t.prototype.sendMessage=function(e){return S(this,void 0,void 0,function(){var r,n=this;return k(this,function(i){return this.logger.trace("NativeMessageHandler - sendMessage called."),r={channel:ys.CHANNEL_ID,extensionId:this.extensionId,responseId:this.responseId++,body:e},this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii("NativeMessageHandler - Sending request to browser extension: "+JSON.stringify(r)),this.messageChannel.port1.postMessage(r),[2,new Promise(function(o,a){n.resolvers.set(r.responseId,{resolve:o,reject:a})})]})})},t.createProvider=function(e,r){return S(this,void 0,void 0,function(){var n,i;return k(this,function(o){switch(o.label){case 0:e.trace("NativeMessageHandler - createProvider called."),o.label=1;case 1:return o.trys.push([1,3,,5]),n=new t(e,r,ys.PREFERRED_EXTENSION_ID),[4,n.sendHandshakeRequest()];case 2:return o.sent(),[2,n];case 3:return o.sent(),i=new t(e,r),[4,i.sendHandshakeRequest()];case 4:return o.sent(),[2,i];case 5:return[2]}})})},t.prototype.sendHandshakeRequest=function(){return S(this,void 0,void 0,function(){var e,r=this;return k(this,function(n){return this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1),e={channel:ys.CHANNEL_ID,extensionId:this.extensionId,responseId:this.responseId++,body:{method:Kn.HandshakeRequest}},this.messageChannel.port1.onmessage=function(i){r.onChannelMessage(i)},window.postMessage(e,window.origin,[this.messageChannel.port2]),[2,new Promise(function(i,o){r.handshakeResolvers.set(e.responseId,{resolve:i,reject:o}),r.timeoutId=window.setTimeout(function(){window.removeEventListener("message",r.windowListener,!1),r.messageChannel.port1.close(),r.messageChannel.port2.close(),o(D.createNativeHandshakeTimeoutError()),r.handshakeResolvers.delete(e.responseId)},r.handshakeTimeoutMs)})]})})},t.prototype.onWindowMessage=function(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source===window){var r=e.data;if(!(!r.channel||r.channel!==ys.CHANNEL_ID)&&!(r.extensionId&&r.extensionId!==this.extensionId)&&r.body.method===Kn.HandshakeRequest){this.logger.verbose(r.extensionId?"Extension with id: "+r.extensionId+" not installed":"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1);var n=this.handshakeResolvers.get(r.responseId);n&&n.reject(D.createNativeExtensionNotInstalledError())}}},t.prototype.onChannelMessage=function(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");var r=e.data,n=this.resolvers.get(r.responseId),i=this.handshakeResolvers.get(r.responseId);try{var o=r.body.method;if(o===Kn.Response){if(!n)return;var a=r.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii("NativeMessageHandler - Received response from browser extension: "+JSON.stringify(a)),a.status!=="Success")n.reject(En.createError(a.code,a.description,a.ext));else if(a.result)a.result.code&&a.result.description?n.reject(En.createError(a.result.code,a.result.description,a.result.ext)):n.resolve(a.result);else throw W.createUnexpectedError("Event does not contain result.");this.resolvers.delete(r.responseId)}else if(o===Kn.HandshakeResponse){if(!i)return;clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=r.extensionId,this.extensionVersion=r.body.version,this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: "+this.extensionId),i.resolve(),this.handshakeResolvers.delete(r.responseId)}}catch(s){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii("Error parsing response from WAM Extension: "+s.toString()),this.logger.errorPii("Unable to parse "+e),n?n.reject(s):i&&i.reject(s)}},t.prototype.getExtensionId=function(){return this.extensionId},t.prototype.getExtensionVersion=function(){return this.extensionVersion},t.isNativeAvailable=function(e,r,n,i){if(r.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return r.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!n)return r.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(i)switch(i){case Ee.BEARER:case Ee.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},t}();var k_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h){var u=t.call(this,r,n,i,o,a,s,c,d,h)||this;return u.nativeStorage=l,u}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d,h,u=this;return k(this,function(f){switch(f.label){case 0:return[4,this.initializeAuthorizationRequest(r,G.Redirect)];case 1:n=f.sent(),this.browserStorage.updateCacheEntries(n.state,n.nonce,n.authority,n.loginHint||_.EMPTY_STRING,n.account||null),i=this.initializeServerTelemetryManager(Pe.acquireTokenRedirect),o=function(v){v.persisted&&(u.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),u.browserStorage.cleanRequestByState(n.state))},f.label=2;case 2:return f.trys.push([2,7,,8]),[4,this.initializeAuthorizationCodeRequest(n)];case 3:return a=f.sent(),[4,this.createAuthCodeClient(i,n.authority,n.azureCloudOptions)];case 4:return s=f.sent(),this.logger.verbose("Auth code client created"),c=new hm(s,this.browserStorage,a,this.logger,this.browserCrypto),[4,s.getAuthCodeUrl(K(K({},n),{nativeBroker:vo.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme)}))];case 5:return l=f.sent(),d=this.getRedirectStartPage(r.redirectStartPage),this.logger.verbosePii("Redirect start page: "+d),window.addEventListener("pageshow",o),[4,c.initiateAuthRequest(l,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:d,onRedirectNavigate:r.onRedirectNavigate})];case 6:return[2,f.sent()];case 7:throw h=f.sent(),h instanceof W&&h.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",o),i.cacheFailedRequest(h),this.browserStorage.cleanRequestByState(n.state),h;case 8:return[2]}})})},e.prototype.handleRedirectPromise=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d,h,u,f,v;return k(this,function(g){switch(g.label){case 0:n=this.initializeServerTelemetryManager(Pe.handleRedirectPromise),g.label=1;case 1:if(g.trys.push([1,10,,11]),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),[2,null];if(i=this.getRedirectResponseHash(r||window.location.hash),!i)return this.logger.info("handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(G.Redirect),[2,null];o=void 0;try{a=ge.getDeserializedHash(i),o=this.validateAndExtractStateFromHash(a,G.Redirect),this.logger.verbose("State extracted from hash")}catch(x){return this.logger.info("handleRedirectPromise was unable to extract state due to: "+x),this.browserStorage.cleanRequestByInteractionType(G.Redirect),[2,null]}return s=this.browserStorage.getTemporaryCache(pe.ORIGIN_URI,!0)||_.EMPTY_STRING,c=ge.removeHashFromUrl(s),l=ge.removeHashFromUrl(window.location.href),c===l&&this.config.auth.navigateToLoginRequestUrl?(this.logger.verbose("Current page is loginRequestUrl, handling hash"),[4,this.handleHash(i,o,n)]):[3,3];case 2:return d=g.sent(),s.indexOf("#")>-1&&Je.replaceHash(s),[2,d];case 3:return this.config.auth.navigateToLoginRequestUrl?[3,4]:(this.logger.verbose("NavigateToLoginRequestUrl set to false, handling hash"),[2,this.handleHash(i,o,n)]);case 4:return!Je.isInIframe()||this.config.system.allowRedirectInIframe?(this.browserStorage.setTemporaryCache(pe.URL_HASH,i,!0),h={apiId:Pe.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0},u=!0,!s||s==="null"?(f=Je.getHomepage(),this.browserStorage.setTemporaryCache(pe.ORIGIN_URI,f,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),[4,this.navigationClient.navigateInternal(f,h)]):[3,6]):[3,9];case 5:return u=g.sent(),[3,8];case 6:return this.logger.verbose("Navigating to loginRequestUrl: "+s),[4,this.navigationClient.navigateInternal(s,h)];case 7:u=g.sent(),g.label=8;case 8:if(!u)return[2,this.handleHash(i,o,n)];g.label=9;case 9:return[2,null];case 10:throw v=g.sent(),v instanceof W&&v.setCorrelationId(this.correlationId),n.cacheFailedRequest(v),this.browserStorage.cleanRequestByInteractionType(G.Redirect),v;case 11:return[2]}})})},e.prototype.getRedirectResponseHash=function(r){this.logger.verbose("getRedirectResponseHash called");var n=ge.hashContainsKnownProperties(r);if(n)return Je.clearHash(window),this.logger.verbose("Hash contains known properties, returning response hash"),r;var i=this.browserStorage.getTemporaryCache(pe.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(pe.URL_HASH)),this.logger.verbose("Hash does not contain known properties, returning cached hash"),i},e.prototype.handleHash=function(r,n,i){return S(this,void 0,void 0,function(){var o,a,s,c,l,d,h,u=this;return k(this,function(f){switch(f.label){case 0:if(o=this.browserStorage.getCachedRequest(n,this.browserCrypto),this.logger.verbose("handleHash called, retrieved cached request"),a=ge.getDeserializedHash(r),a.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw D.createNativeConnectionNotEstablishedError();return s=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,a.accountId,this.browserStorage,o.correlationId),c=Qn.parseRequestState(this.browserCrypto,n).userRequestState,[2,s.acquireToken(K(K({},o),{state:c,prompt:void 0})).finally(function(){u.browserStorage.cleanRequestByState(n)})]}if(l=this.browserStorage.getCachedAuthority(n),!l)throw D.createNoCachedAuthorityError();return[4,this.createAuthCodeClient(i,l)];case 1:return d=f.sent(),this.logger.verbose("Auth code client created"),Vd.removeThrottle(this.browserStorage,this.config.auth.clientId,o),h=new hm(d,this.browserStorage,o,this.logger,this.browserCrypto),[4,h.handleCodeResponseFromHash(r,n,d.authority,this.networkClient)];case 2:return[2,f.sent()]}})})},e.prototype.logout=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0:this.logger.verbose("logoutRedirect called"),n=this.initializeLogoutRequest(r),i=this.initializeServerTelemetryManager(Pe.logout),d.label=1;case 1:return d.trys.push([1,10,,11]),this.eventHandler.emitEvent(X.LOGOUT_START,G.Redirect,r),[4,this.clearCacheOnLogout(n.account)];case 2:return d.sent(),o={apiId:Pe.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},[4,this.createAuthCodeClient(i,r&&r.authority)];case 3:return a=d.sent(),this.logger.verbose("Auth code client created"),s=a.getLogoutUri(n),this.eventHandler.emitEvent(X.LOGOUT_SUCCESS,G.Redirect,n),r&&typeof r.onRedirectNavigate=="function"?(c=r.onRedirectNavigate(s),c===!1?[3,5]:(this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(s,o)])):[3,7];case 4:return d.sent(),[2];case 5:this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation"),d.label=6;case 6:return[3,9];case 7:return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),[4,this.navigationClient.navigateExternal(s,o)];case 8:return d.sent(),[2];case 9:return[3,11];case 10:throw l=d.sent(),l instanceof W&&l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l),this.eventHandler.emitEvent(X.LOGOUT_FAILURE,G.Redirect,null,l),this.eventHandler.emitEvent(X.LOGOUT_END,G.Redirect),l;case 11:return this.eventHandler.emitEvent(X.LOGOUT_END,G.Redirect),[2]}})})},e.prototype.getRedirectStartPage=function(r){var n=r||window.location.href;return ge.getAbsoluteUrl(n,Je.getCurrentUri())},e}($a);var A_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h){var u=t.call(this,r,n,i,o,a,s,c,d,h)||this;return u.unloadWindow=u.unloadWindow.bind(u),u.nativeStorage=l,u}return e.prototype.acquireToken=function(r){try{var n=this.generatePopupName(r.scopes||Ac,r.authority||this.config.auth.authority),i=r.popupWindowAttributes||{};if(this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(r,n,i);this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");var o=this.openSizedPopup("about:blank",n,i);return this.acquireTokenPopupAsync(r,n,i,o)}catch(a){return Promise.reject(a)}},e.prototype.logout=function(r){try{this.logger.verbose("logoutPopup called");var n=this.initializeLogoutRequest(r),i=this.generateLogoutPopupName(n),o=r&&r.authority,a=r&&r.mainWindowRedirectUri,s=(r==null?void 0:r.popupWindowAttributes)||{};if(this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,i,s,o,void 0,a);this.logger.verbose("asyncPopup set to false, opening popup");var c=this.openSizedPopup("about:blank",i,s);return this.logoutPopupAsync(n,i,s,o,c,a)}catch(l){return Promise.reject(l)}},e.prototype.acquireTokenPopupAsync=function(r,n,i,o){return S(this,void 0,void 0,function(){var a,s,c,l,d,h,u,f,v,g,x,m,p,y,w,T,O,F=this;return k(this,function(N){switch(N.label){case 0:return this.logger.verbose("acquireTokenPopupAsync called"),a=this.initializeServerTelemetryManager(Pe.acquireTokenPopup),[4,this.initializeAuthorizationRequest(r,G.Popup)];case 1:s=N.sent(),this.browserStorage.updateCacheEntries(s.state,s.nonce,s.authority,s.loginHint||_.EMPTY_STRING,s.account||null),N.label=2;case 2:return N.trys.push([2,8,,9]),[4,this.initializeAuthorizationCodeRequest(s)];case 3:return c=N.sent(),[4,this.createAuthCodeClient(a,s.authority,s.azureCloudOptions)];case 4:return l=N.sent(),this.logger.verbose("Auth code client created"),d=vo.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,r.authenticationScheme),h=void 0,d&&(h=this.performanceClient.startMeasurement(pt.FetchAccountIdWithNativeBroker,r.correlationId)),[4,l.getAuthCodeUrl(K(K({},s),{nativeBroker:d}))];case 5:return u=N.sent(),f=new e0(l,this.browserStorage,c,this.logger),v={popup:o,popupName:n,popupWindowAttributes:i},g=this.initiateAuthRequest(u,v),this.eventHandler.emitEvent(X.POPUP_OPENED,G.Popup,{popupWindow:g},null),[4,this.monitorPopupForHash(g)];case 6:if(x=N.sent(),m=ge.getDeserializedHash(x),p=this.validateAndExtractStateFromHash(m,G.Popup,s.correlationId),Vd.removeThrottle(this.browserStorage,this.config.auth.clientId,c),m.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),h&&h.endMeasurement({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw D.createNativeConnectionNotEstablishedError();return y=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,m.accountId,this.nativeStorage,s.correlationId),w=Qn.parseRequestState(this.browserCrypto,p).userRequestState,[2,y.acquireToken(K(K({},s),{state:w,prompt:void 0})).finally(function(){F.browserStorage.cleanRequestByState(p)})]}return[4,f.handleCodeResponseFromHash(x,p,l.authority,this.networkClient)];case 7:return T=N.sent(),[2,T];case 8:throw O=N.sent(),o&&o.close(),O instanceof W&&O.setCorrelationId(this.correlationId),a.cacheFailedRequest(O),this.browserStorage.cleanRequestByState(s.state),O;case 9:return[2]}})})},e.prototype.logoutPopupAsync=function(r,n,i,o,a,s){return S(this,void 0,void 0,function(){var c,l,d,h,u,f,v;return k(this,function(g){switch(g.label){case 0:this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(X.LOGOUT_START,G.Popup,r),c=this.initializeServerTelemetryManager(Pe.logoutPopup),g.label=1;case 1:return g.trys.push([1,5,,6]),[4,this.clearCacheOnLogout(r.account)];case 2:return g.sent(),[4,this.createAuthCodeClient(c,o)];case 3:return l=g.sent(),this.logger.verbose("Auth code client created"),d=l.getLogoutUri(r),this.eventHandler.emitEvent(X.LOGOUT_SUCCESS,G.Popup,r),h=this.openPopup(d,{popupName:n,popupWindowAttributes:i,popup:a}),this.eventHandler.emitEvent(X.POPUP_OPENED,G.Popup,{popupWindow:h},null),[4,this.waitForLogoutPopup(h)];case 4:return g.sent(),s?(u={apiId:Pe.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},f=ge.getAbsoluteUrl(s,Je.getCurrentUri()),this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii("Redirecting main window to: "+f),this.navigationClient.navigateInternal(f,u)):this.logger.verbose("No main window navigation requested"),[3,6];case 5:throw v=g.sent(),a&&a.close(),v instanceof W&&v.setCorrelationId(this.correlationId),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(X.LOGOUT_FAILURE,G.Popup,null,v),this.eventHandler.emitEvent(X.LOGOUT_END,G.Popup),c.cacheFailedRequest(v),v;case 6:return this.eventHandler.emitEvent(X.LOGOUT_END,G.Popup),[2]}})})},e.prototype.initiateAuthRequest=function(r,n){if(V.isEmpty(r))throw this.logger.error("Navigate url is empty"),D.createEmptyNavigationUriError();return this.logger.infoPii("Navigate to: "+r),this.openPopup(r,n)},e.prototype.monitorPopupForHash=function(r){var n=this;return new Promise(function(i,o){var a=n.config.system.windowHashTimeout/n.config.system.pollIntervalMilliseconds,s=0;n.logger.verbose("PopupHandler.monitorPopupForHash - polling started");var c=setInterval(function(){if(r.closed){n.logger.error("PopupHandler.monitorPopupForHash - window closed"),n.cleanPopup(),clearInterval(c),o(D.createUserCancelledError());return}var l=_.EMPTY_STRING,d=_.EMPTY_STRING;try{l=r.location.href,d=r.location.hash}catch{}V.isEmpty(l)||l==="about:blank"||(n.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),s++,d?(n.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url"),clearInterval(c),n.cleanPopup(r),ge.hashContainsKnownProperties(d)?(n.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning."),i(d)):(n.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."),n.logger.errorPii("PopupHandler.monitorPopupForHash - hash found: "+d),o(D.createHashDoesNotContainKnownPropertiesError()))):s>a&&(n.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"),clearInterval(c),o(D.createMonitorPopupTimeoutError())))},n.config.system.pollIntervalMilliseconds)})},e.prototype.waitForLogoutPopup=function(r){var n=this;return new Promise(function(i){n.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");var o=setInterval(function(){r.closed&&(n.logger.error("PopupHandler.waitForLogoutPopup - window closed"),n.cleanPopup(),clearInterval(o),i());var a=_.EMPTY_STRING;try{a=r.location.href}catch{}V.isEmpty(a)||a==="about:blank"||(n.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing."),clearInterval(o),n.cleanPopup(r),i())},n.config.system.pollIntervalMilliseconds)})},e.prototype.openPopup=function(r,n){try{var i=void 0;if(n.popup?(i=n.popup,this.logger.verbosePii("Navigating popup window to: "+r),i.location.assign(r)):typeof n.popup>"u"&&(this.logger.verbosePii("Opening popup window to: "+r),i=this.openSizedPopup(r,n.popupName,n.popupWindowAttributes)),!i)throw D.createEmptyWindowCreatedError();return i.focus&&i.focus(),this.currentWindow=i,window.addEventListener("beforeunload",this.unloadWindow),i}catch(o){throw this.logger.error("error opening popup "+o.message),this.browserStorage.setInteractionInProgress(!1),D.createPopupWindowError(o.toString())}},e.prototype.openSizedPopup=function(r,n,i){var o,a,s,c,l=window.screenLeft?window.screenLeft:window.screenX,d=window.screenTop?window.screenTop:window.screenY,h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,u=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,f=(o=i.popupSize)===null||o===void 0?void 0:o.width,v=(a=i.popupSize)===null||a===void 0?void 0:a.height,g=(s=i.popupPosition)===null||s===void 0?void 0:s.top,x=(c=i.popupPosition)===null||c===void 0?void 0:c.left;return(!f||f<0||f>h)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),f=nn.POPUP_WIDTH),(!v||v<0||v>u)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),v=nn.POPUP_HEIGHT),(!g||g<0||g>u)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),g=Math.max(0,u/2-nn.POPUP_HEIGHT/2+d)),(!x||x<0||x>h)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),x=Math.max(0,h/2-nn.POPUP_WIDTH/2+l)),window.open(r,n,"width="+f+", height="+v+", top="+g+", left="+x+", scrollbars=yes")},e.prototype.unloadWindow=function(r){this.browserStorage.cleanRequestByInteractionType(G.Popup),this.currentWindow&&this.currentWindow.close(),r.preventDefault()},e.prototype.cleanPopup=function(r){r&&r.close(),window.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)},e.prototype.generatePopupName=function(r,n){return nn.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+r.join("-")+"."+n+"."+this.correlationId},e.prototype.generateLogoutPopupName=function(r){var n=r.account&&r.account.homeAccountId;return nn.POPUP_NAME_PREFIX+"."+this.config.auth.clientId+"."+n+"."+this.correlationId},e}($a);var T_=function(){function t(){}return t.prototype.navigateInternal=function(e,r){return t.defaultNavigateWindow(e,r)},t.prototype.navigateExternal=function(e,r){return t.defaultNavigateWindow(e,r)},t.defaultNavigateWindow=function(e,r){return r.noHistory?window.location.replace(e):window.location.assign(e),new Promise(function(n){setTimeout(function(){n(!0)},r.timeout)})},t}();var I_=6e4,f2=6e3,M_=3e4,P_=2e3;function R_(t,e){var r=t.auth,n=t.cache,i=t.system,o=t.telemetry,a={clientId:_.EMPTY_STRING,authority:""+_.DEFAULT_AUTHORITY,knownAuthorities:[],cloudDiscoveryMetadata:_.EMPTY_STRING,authorityMetadata:_.EMPTY_STRING,redirectUri:_.EMPTY_STRING,postLogoutRedirectUri:_.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:$d.AAD,azureCloudOptions:{azureCloudInstance:dc.None,tenant:_.EMPTY_STRING},skipAuthorityMetadataCache:!1},s={cacheLocation:$t.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1},c={loggerCallback:function(){},logLevel:tt.Info,piiLoggingEnabled:!1},l=K(K({},t3),{loggerOptions:c,networkClient:e?Je.getBrowserNetworkClient():g_,navigationClient:new T_,loadFrameTimeout:0,windowHashTimeout:(i==null?void 0:i.loadFrameTimeout)||I_,iframeHashTimeout:(i==null?void 0:i.loadFrameTimeout)||f2,navigateFrameWait:e&&Je.detectIEOrEdge()?500:0,redirectNavigationTimeout:M_,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(i==null?void 0:i.nativeBrokerHandshakeTimeout)||P_,pollIntervalMilliseconds:nn.DEFAULT_POLL_INTERVAL_MS,cryptoOptions:{useMsrCrypto:!1,entropy:void 0}}),d={application:{appName:_.EMPTY_STRING,appVersion:_.EMPTY_STRING}},h={auth:K(K({},a),r),cache:K(K({},s),n),system:K(K({},l),i),telemetry:K(K({},d),o)};return h}var l3=function(t){It(e,t);function e(r,n,i,o,a){var s=t.call(this,r,n,i,o)||this;return s.navigateFrameWait=a.navigateFrameWait,s.pollIntervalMilliseconds=a.pollIntervalMilliseconds,s}return e.prototype.initiateAuthRequest=function(r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){switch(i.label){case 0:if(V.isEmpty(r))throw this.logger.info("Navigate url is empty"),D.createEmptyNavigationUriError();return this.navigateFrameWait?[4,this.loadFrame(r)]:[3,2];case 1:return n=i.sent(),[3,3];case 2:n=this.loadFrameSync(r),i.label=3;case 3:return[2,n]}})})},e.prototype.monitorIframeForHash=function(r,n){var i=this;return new Promise(function(o,a){n<f2&&i.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower ("+n+"ms) than the default ("+f2+"ms). This may result in timeouts.");var s=window.performance.now(),c=s+n,l=setInterval(function(){if(window.performance.now()>c){i.removeHiddenIframe(r),clearInterval(l),a(D.createMonitorIframeTimeoutError());return}var d=_.EMPTY_STRING,h=r.contentWindow;try{d=h?h.location.href:_.EMPTY_STRING}catch{}if(!V.isEmpty(d)){var u=h?h.location.hash:_.EMPTY_STRING;if(ge.hashContainsKnownProperties(u)){i.removeHiddenIframe(r),clearInterval(l),o(u);return}}},i.pollIntervalMilliseconds)})},e.prototype.loadFrame=function(r){var n=this;return new Promise(function(i,o){var a=n.createHiddenIframe();setTimeout(function(){if(!a){o("Unable to load iframe");return}a.src=r,i(a)},n.navigateFrameWait)})},e.prototype.loadFrameSync=function(r){var n=this.createHiddenIframe();return n.src=r,n},e.prototype.createHiddenIframe=function(){var r=document.createElement("iframe");return r.style.visibility="hidden",r.style.position="absolute",r.style.width=r.style.height="0",r.style.border="0",r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.getElementsByTagName("body")[0].appendChild(r),r},e.prototype.removeHiddenIframe=function(r){document.body===r.parentNode&&document.body.removeChild(r)},e}(e0);var H_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h,u){var f=t.call(this,r,n,i,o,a,s,l,h,u)||this;return f.apiId=c,f.nativeStorage=d,f}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s;return k(this,function(c){switch(c.label){case 0:if(this.logger.verbose("acquireTokenByIframe called"),n=this.performanceClient.startMeasurement(pt.SilentIframeClientAcquireToken,r.correlationId),V.isEmpty(r.loginHint)&&V.isEmpty(r.sid)&&(!r.account||V.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!==Bt.NONE&&r.prompt!==Bt.NO_SESSION)throw n.endMeasurement({success:!1}),D.createSilentPromptValueError(r.prompt);return[4,this.initializeAuthorizationRequest(K(K({},r),{prompt:r.prompt||Bt.NONE}),G.Silent)];case 1:i=c.sent(),this.browserStorage.updateCacheEntries(i.state,i.nonce,i.authority,i.loginHint||_.EMPTY_STRING,i.account||null),o=this.initializeServerTelemetryManager(this.apiId),c.label=2;case 2:return c.trys.push([2,5,,6]),[4,this.createAuthCodeClient(o,i.authority,i.azureCloudOptions)];case 3:return a=c.sent(),this.logger.verbose("Auth code client created"),[4,this.silentTokenHelper(a,i).then(function(l){return n.endMeasurement({success:!0,fromCache:!1,requestId:l.requestId}),l})];case 4:return[2,c.sent()];case 5:throw s=c.sent(),s instanceof W&&s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s),this.browserStorage.cleanRequestByState(i.state),n.endMeasurement({errorCode:s instanceof W&&s.errorCode||void 0,subErrorCode:s instanceof W&&s.subError||void 0,success:!1}),s;case 6:return[2]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e.prototype.silentTokenHelper=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c,l,d,h,u,f=this;return k(this,function(v){switch(v.label){case 0:return[4,this.initializeAuthorizationCodeRequest(n)];case 1:return i=v.sent(),[4,r.getAuthCodeUrl(K(K({},n),{nativeBroker:vo.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,n.authenticationScheme)}))];case 2:return o=v.sent(),a=new l3(r,this.browserStorage,i,this.logger,this.config.system),[4,a.initiateAuthRequest(o)];case 3:return s=v.sent(),[4,a.monitorIframeForHash(s,this.config.system.iframeHashTimeout)];case 4:if(c=v.sent(),l=ge.getDeserializedHash(c),d=this.validateAndExtractStateFromHash(l,G.Silent,i.correlationId),l.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw D.createNativeConnectionNotEstablishedError();return h=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,l.accountId,this.browserStorage,this.correlationId),u=Qn.parseRequestState(this.browserCrypto,d).userRequestState,[2,h.acquireToken(K(K({},n),{state:u,prompt:n.prompt||Bt.NONE})).finally(function(){f.browserStorage.cleanRequestByState(d)})]}return[2,a.handleCodeResponseFromHash(c,d,r.authority,this.networkClient)]}})})},e}($a);var L_=function(t){It(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c=this;return k(this,function(l){switch(l.label){case 0:return i=[K({},r)],[4,this.initializeBaseRequest(r)];case 1:return n=K.apply(void 0,i.concat([l.sent()])),o=this.performanceClient.startMeasurement(pt.SilentRefreshClientAcquireToken,n.correlationId),a=this.initializeServerTelemetryManager(Pe.acquireTokenSilent_silentFlow),[4,this.createRefreshTokenClient(a,n.authority,n.azureCloudOptions)];case 2:return s=l.sent(),this.logger.verbose("Refresh token client created"),[2,s.acquireTokenByRefreshToken(n).then(function(d){return o.endMeasurement({success:!0,fromCache:d.fromCache,requestId:d.requestId}),d}).catch(function(d){throw d instanceof W&&d.setCorrelationId(c.correlationId),a.cacheFailedRequest(d),o.endMeasurement({errorCode:d.errorCode,subErrorCode:d.subError,success:!1}),d})]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e.prototype.createRefreshTokenClient=function(r,n,i){return S(this,void 0,void 0,function(){var o;return k(this,function(a){switch(a.label){case 0:return[4,this.getClientConfiguration(r,n,i)];case 1:return o=a.sent(),[2,new n3(o,this.performanceClient)]}})})},e}($a);var O_=function(){function t(e,r){this.eventCallbacks=new Map,this.logger=e,this.browserCrypto=r,this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}return t.prototype.addEventCallback=function(e){if(typeof window<"u"){var r=this.browserCrypto.createNewGuid();return this.eventCallbacks.set(r,e),this.logger.verbose("Event callback registered with id: "+r),r}return null},t.prototype.removeEventCallback=function(e){this.eventCallbacks.delete(e),this.logger.verbose("Event callback "+e+" removed.")},t.prototype.enableAccountStorageEvents=function(){typeof window>"u"||(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)))},t.prototype.disableAccountStorageEvents=function(){typeof window>"u"||(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."))},t.prototype.emitEvent=function(e,r,n,i){var o=this;if(typeof window<"u"){var a={eventType:e,interactionType:r||null,payload:n||null,error:i||null,timestamp:Date.now()};this.logger.info("Emitting event: "+e),this.eventCallbacks.forEach(function(s,c){o.logger.verbose("Emitting event to callback "+c+": "+e),s.apply(null,[a])})}},t.prototype.handleAccountCacheChange=function(e){try{var r=e.newValue||e.oldValue;if(!r)return;var n=JSON.parse(r);if(typeof n!="object"||!kt.isAccountEntity(n))return;var i=Zr.toObject(new kt,n),o=i.getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.emitEvent(X.ACCOUNT_ADDED,void 0,o)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.emitEvent(X.ACCOUNT_REMOVED,void 0,o))}catch{return}},t}();var Ft=function(){function t(){}return t.decimalToHex=function(e){for(var r=e.toString(16);r.length<2;)r="0"+r;return r},t}();var d3=function(){function t(e){this.cryptoObj=e}return t.prototype.generateGuid=function(){try{var e=new Uint8Array(16);return this.cryptoObj.getRandomValues(e),e[6]|=64,e[6]&=79,e[8]|=128,e[8]&=191,Ft.decimalToHex(e[0])+Ft.decimalToHex(e[1])+Ft.decimalToHex(e[2])+Ft.decimalToHex(e[3])+"-"+Ft.decimalToHex(e[4])+Ft.decimalToHex(e[5])+"-"+Ft.decimalToHex(e[6])+Ft.decimalToHex(e[7])+"-"+Ft.decimalToHex(e[8])+Ft.decimalToHex(e[9])+"-"+Ft.decimalToHex(e[10])+Ft.decimalToHex(e[11])+Ft.decimalToHex(e[12])+Ft.decimalToHex(e[13])+Ft.decimalToHex(e[14])+Ft.decimalToHex(e[15])}catch{for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",i=0,o=_.EMPTY_STRING,a=0;a<36;a++)r[a]!=="-"&&r[a]!=="4"&&(i=Math.random()*16|0),r[a]==="x"?o+=n[i]:r[a]==="y"?(i&=3,i|=8,o+=n[i]):o+=r[a];return o}},t.prototype.isGuid=function(e){var r=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;return r.test(e)},t}();var Xn=function(){function t(){}return t.stringToUtf8Arr=function(e){for(var r,n=0,i=e.length,o=0;o<i;o++)r=e.charCodeAt(o),n+=r<128?1:r<2048?2:r<65536?3:r<2097152?4:r<67108864?5:6;for(var a=new Uint8Array(n),s=0,c=0;s<n;c++)r=e.charCodeAt(c),r<128?a[s++]=r:r<2048?(a[s++]=192+(r>>>6),a[s++]=128+(r&63)):r<65536?(a[s++]=224+(r>>>12),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63)):r<2097152?(a[s++]=240+(r>>>18),a[s++]=128+(r>>>12&63),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63)):r<67108864?(a[s++]=248+(r>>>24),a[s++]=128+(r>>>18&63),a[s++]=128+(r>>>12&63),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63)):(a[s++]=252+(r>>>30),a[s++]=128+(r>>>24&63),a[s++]=128+(r>>>18&63),a[s++]=128+(r>>>12&63),a[s++]=128+(r>>>6&63),a[s++]=128+(r&63));return a},t.stringToArrayBuffer=function(e){for(var r=new ArrayBuffer(e.length),n=new Uint8Array(r),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return r},t.utf8ArrToString=function(e){for(var r=_.EMPTY_STRING,n=void 0,i=e.length,o=0;o<i;o++)n=e[o],r+=String.fromCharCode(n>251&&n<254&&o+5<i?(n-252)*1073741824+(e[++o]-128<<24)+(e[++o]-128<<18)+(e[++o]-128<<12)+(e[++o]-128<<6)+e[++o]-128:n>247&&n<252&&o+4<i?(n-248<<24)+(e[++o]-128<<18)+(e[++o]-128<<12)+(e[++o]-128<<6)+e[++o]-128:n>239&&n<248&&o+3<i?(n-240<<18)+(e[++o]-128<<12)+(e[++o]-128<<6)+e[++o]-128:n>223&&n<240&&o+2<i?(n-224<<12)+(e[++o]-128<<6)+e[++o]-128:n>191&&n<224&&o+1<i?(n-192<<6)+e[++o]-128:n);return r},t.getSortedObjectString=function(e){return JSON.stringify(e,Object.keys(e).sort())},t}();var h3=function(){function t(){}return t.prototype.urlEncode=function(e){return encodeURIComponent(this.encode(e).replace(/=/g,_.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_"))},t.prototype.urlEncodeArr=function(e){return this.base64EncArr(e).replace(/=/g,_.EMPTY_STRING).replace(/\+/g,"-").replace(/\//g,"_")},t.prototype.encode=function(e){var r=Xn.stringToUtf8Arr(e);return this.base64EncArr(r)},t.prototype.base64EncArr=function(e){for(var r=(3-e.length%3)%3,n=_.EMPTY_STRING,i=void 0,o=e.length,a=0,s=0;s<o;s++)i=s%3,a|=e[s]<<(16>>>i&24),(i===2||e.length-s===1)&&(n+=String.fromCharCode(this.uint6ToB64(a>>>18&63),this.uint6ToB64(a>>>12&63),this.uint6ToB64(a>>>6&63),this.uint6ToB64(a&63)),a=0);return r===0?n:n.substring(0,n.length-r)+(r===1?"=":"==")},t.prototype.uint6ToB64=function(e){return e<26?e+65:e<52?e+71:e<62?e-4:e===62?43:e===63?47:65},t}();var D_=function(){function t(){}return t.prototype.decode=function(e){var r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw new Error("Invalid base64 string")}var n=this.base64DecToArr(r);return Xn.utf8ArrToString(n)},t.prototype.base64DecToArr=function(e,r){for(var n=e.replace(/[^A-Za-z0-9\+\/]/g,_.EMPTY_STRING),i=n.length,o=r?Math.ceil((i*3+1>>>2)/r)*r:i*3+1>>>2,a=new Uint8Array(o),s=void 0,c=void 0,l=0,d=0,h=0;h<i;h++)if(c=h&3,l|=this.b64ToUint6(n.charCodeAt(h))<<18-6*c,c===3||i-h===1){for(s=0;s<3&&d<o;s++,d++)a[d]=l>>>(16>>>s&24)&255;l=0}return a},t.prototype.b64ToUint6=function(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0},t}();var N_=32,V_=function(){function t(e){this.base64Encode=new h3,this.cryptoObj=e}return t.prototype.generateCodes=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:return e=this.generateCodeVerifier(),[4,this.generateCodeChallengeFromVerifier(e)];case 1:return r=n.sent(),[2,{verifier:e,challenge:r}]}})})},t.prototype.generateCodeVerifier=function(){try{var e=new Uint8Array(N_);this.cryptoObj.getRandomValues(e);var r=this.base64Encode.urlEncodeArr(e);return r}catch(n){throw D.createPkceNotGeneratedError(n)}},t.prototype.generateCodeChallengeFromVerifier=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.cryptoObj.sha256Digest(e)];case 1:return r=i.sent(),[2,this.base64Encode.urlEncodeArr(new Uint8Array(r))];case 2:throw n=i.sent(),D.createPkceNotGeneratedError(n);case 3:return[2]}})})},t}();var F_=function(){function t(){}return t.prototype.getRandomValues=function(e){return window.crypto.getRandomValues(e)},t.prototype.generateKey=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.crypto.subtle.generateKey(e,r,n)]})})},t.prototype.exportKey=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,window.crypto.subtle.exportKey(Ra,e)]})})},t.prototype.importKey=function(e,r,n,i){return S(this,void 0,void 0,function(){return k(this,function(o){return[2,window.crypto.subtle.importKey(Ra,e,r,n,i)]})})},t.prototype.sign=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.crypto.subtle.sign(e,r,n)]})})},t.prototype.digest=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,window.crypto.subtle.digest(e,r)]})})},t}();var U_=function(){function t(){}return t.prototype.initPrng=function(e){return window.msrCrypto.initPrng(Xf(e))},t.prototype.getRandomValues=function(e){return window.msrCrypto.getRandomValues(e)},t.prototype.generateKey=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.msrCrypto.subtle.generateKey(e,r,n)]})})},t.prototype.exportKey=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,window.msrCrypto.subtle.exportKey(Ra,e)]})})},t.prototype.importKey=function(e,r,n,i){return S(this,void 0,void 0,function(){return k(this,function(o){return[2,window.msrCrypto.subtle.importKey(Ra,e,r,n,i)]})})},t.prototype.sign=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,window.msrCrypto.subtle.sign(e,r,n)]})})},t.prototype.digest=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,window.msrCrypto.subtle.digest(e,r)]})})},t}();var $_=function(){function t(){}return t.prototype.getRandomValues=function(e){return window.msCrypto.getRandomValues(e)},t.prototype.generateKey=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,new Promise(function(o,a){var s=window.msCrypto.subtle.generateKey(e,r,n);s.addEventListener("complete",function(c){o(c.target.result)}),s.addEventListener("error",function(c){a(c)})})]})})},t.prototype.exportKey=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,new Promise(function(n,i){var o=window.msCrypto.subtle.exportKey(Ra,e);o.addEventListener("complete",function(a){var s=a.target.result,c=Xn.utf8ArrToString(new Uint8Array(s)).replace(/\r/g,_.EMPTY_STRING).replace(/\n/g,_.EMPTY_STRING).replace(/\t/g,_.EMPTY_STRING).split(" ").join(_.EMPTY_STRING).replace("\0",_.EMPTY_STRING);try{n(JSON.parse(c))}catch(l){i(l)}}),o.addEventListener("error",function(a){i(a)})})]})})},t.prototype.importKey=function(e,r,n,i){return S(this,void 0,void 0,function(){var o,a;return k(this,function(s){return o=Xn.getSortedObjectString(e),a=Xn.stringToArrayBuffer(o),[2,new Promise(function(c,l){var d=window.msCrypto.subtle.importKey(Ra,a,r,n,i);d.addEventListener("complete",function(h){c(h.target.result)}),d.addEventListener("error",function(h){l(h)})})]})})},t.prototype.sign=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,new Promise(function(o,a){var s=window.msCrypto.subtle.sign(e,r,n);s.addEventListener("complete",function(c){o(c.target.result)}),s.addEventListener("error",function(c){a(c)})})]})})},t.prototype.digest=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,new Promise(function(i,o){var a=window.msCrypto.subtle.digest(e,r.buffer);a.addEventListener("complete",function(s){i(s.target.result)}),a.addEventListener("error",function(s){o(s)})})]})})},t}();var j_="RSASSA-PKCS1-v1_5",um="SHA-256",B_=2048,q_=new Uint8Array([1,0,1]),u3=function(){function t(e,r){var n,i;if(this.logger=e,this.cryptoOptions=r,this.hasBrowserCrypto())this.logger.verbose("BrowserCrypto: modern crypto interface available"),this.subtleCrypto=new F_;else if(this.hasIECrypto())this.logger.verbose("BrowserCrypto: MS crypto interface available"),this.subtleCrypto=new $_;else if(this.hasMsrCrypto()&&((n=this.cryptoOptions)===null||n===void 0?void 0:n.useMsrCrypto))this.logger.verbose("BrowserCrypto: MSR crypto interface available"),this.subtleCrypto=new U_;else 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."),D.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");if(this.subtleCrypto.initPrng){if(this.logger.verbose("BrowserCrypto: Interface requires entropy"),!(!((i=this.cryptoOptions)===null||i===void 0)&&i.entropy))throw this.logger.error("BrowserCrypto: Interface requires entropy but none provided."),Gd.createEntropyNotProvided();this.logger.verbose("BrowserCrypto: Entropy provided"),this.subtleCrypto.initPrng(this.cryptoOptions.entropy)}this.keygenAlgorithmOptions={name:j_,hash:um,modulusLength:B_,publicExponent:q_}}return t.prototype.hasIECrypto=function(){return"msCrypto"in window},t.prototype.hasBrowserCrypto=function(){return"crypto"in window},t.prototype.hasMsrCrypto=function(){return"msrCrypto"in window},t.prototype.sha256Digest=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){return r=Xn.stringToUtf8Arr(e),[2,this.subtleCrypto.digest({name:um},r)]})})},t.prototype.getRandomValues=function(e){return this.subtleCrypto.getRandomValues(e)},t.prototype.generateKeyPair=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.subtleCrypto.generateKey(this.keygenAlgorithmOptions,e,r)]})})},t.prototype.exportJwk=function(e){return S(this,void 0,void 0,function(){return k(this,function(r){return[2,this.subtleCrypto.exportKey(e)]})})},t.prototype.importJwk=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){return[2,this.subtleCrypto.importKey(e,this.keygenAlgorithmOptions,r,n)]})})},t.prototype.sign=function(e,r){return S(this,void 0,void 0,function(){return k(this,function(n){return[2,this.subtleCrypto.sign(this.keygenAlgorithmOptions,e,r)]})})},t}();var G_=function(){function t(){this.dbName=d2,this.version=x_,this.tableName=E_,this.dbOpen=!1}return t.prototype.open=function(){return S(this,void 0,void 0,function(){var e=this;return k(this,function(r){return[2,new Promise(function(n,i){var o=window.indexedDB.open(e.dbName,e.version);o.addEventListener("upgradeneeded",function(a){var s=a;s.target.result.createObjectStore(e.tableName)}),o.addEventListener("success",function(a){var s=a;e.db=s.target.result,e.dbOpen=!0,n()}),o.addEventListener("error",function(){return i(D.createDatabaseUnavailableError())})})]})})},t.prototype.closeConnection=function(){var e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)},t.prototype.validateDbIsOpen=function(){return S(this,void 0,void 0,function(){return k(this,function(e){switch(e.label){case 0:return this.dbOpen?[3,2]:[4,this.open()];case 1:return[2,e.sent()];case 2:return[2]}})})},t.prototype.getItem=function(e){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.validateDbIsOpen()];case 1:return n.sent(),[2,new Promise(function(i,o){if(!r.db)return o(D.createDatabaseNotOpenError());var a=r.db.transaction([r.tableName],"readonly"),s=a.objectStore(r.tableName),c=s.get(e);c.addEventListener("success",function(l){var d=l;r.closeConnection(),i(d.target.result)}),c.addEventListener("error",function(l){r.closeConnection(),o(l)})})]}})})},t.prototype.setItem=function(e,r){return S(this,void 0,void 0,function(){var n=this;return k(this,function(i){switch(i.label){case 0:return[4,this.validateDbIsOpen()];case 1:return i.sent(),[2,new Promise(function(o,a){if(!n.db)return a(D.createDatabaseNotOpenError());var s=n.db.transaction([n.tableName],"readwrite"),c=s.objectStore(n.tableName),l=c.put(r,e);l.addEventListener("success",function(){n.closeConnection(),o()}),l.addEventListener("error",function(d){n.closeConnection(),a(d)})})]}})})},t.prototype.removeItem=function(e){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.validateDbIsOpen()];case 1:return n.sent(),[2,new Promise(function(i,o){if(!r.db)return o(D.createDatabaseNotOpenError());var a=r.db.transaction([r.tableName],"readwrite"),s=a.objectStore(r.tableName),c=s.delete(e);c.addEventListener("success",function(){r.closeConnection(),i()}),c.addEventListener("error",function(l){r.closeConnection(),o(l)})})]}})})},t.prototype.getKeys=function(){return S(this,void 0,void 0,function(){var e=this;return k(this,function(r){switch(r.label){case 0:return[4,this.validateDbIsOpen()];case 1:return r.sent(),[2,new Promise(function(n,i){if(!e.db)return i(D.createDatabaseNotOpenError());var o=e.db.transaction([e.tableName],"readonly"),a=o.objectStore(e.tableName),s=a.getAllKeys();s.addEventListener("success",function(c){var l=c;e.closeConnection(),n(l.target.result)}),s.addEventListener("error",function(c){e.closeConnection(),i(c)})})]}})})},t.prototype.containsKey=function(e){return S(this,void 0,void 0,function(){var r=this;return k(this,function(n){switch(n.label){case 0:return[4,this.validateDbIsOpen()];case 1:return n.sent(),[2,new Promise(function(i,o){if(!r.db)return o(D.createDatabaseNotOpenError());var a=r.db.transaction([r.tableName],"readonly"),s=a.objectStore(r.tableName),c=s.count(e);c.addEventListener("success",function(l){var d=l;r.closeConnection(),i(d.target.result===1)}),c.addEventListener("error",function(l){r.closeConnection(),o(l)})})]}})})},t.prototype.deleteDatabase=function(){return S(this,void 0,void 0,function(){return k(this,function(e){return this.db&&this.dbOpen&&this.closeConnection(),[2,new Promise(function(r,n){var i=window.indexedDB.deleteDatabase(d2);i.addEventListener("success",function(){return r(!0)}),i.addEventListener("blocked",function(){return r(!0)}),i.addEventListener("error",function(){return n(!1)})})]})})},t}();var fm=function(){function t(e,r){this.inMemoryCache=new h2,this.indexedDBCache=new G_,this.logger=e,this.storeName=r}return t.prototype.handleDatabaseAccessError=function(e){if(e instanceof D&&e.errorCode===M.databaseUnavailable.code)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e},t.prototype.getItem=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:if(r=this.inMemoryCache.getItem(e),r)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.getItem(e)];case 2:return[2,i.sent()];case 3:return n=i.sent(),this.handleDatabaseAccessError(n),[3,4];case 4:return[2,r]}})})},t.prototype.setItem=function(e,r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){switch(i.label){case 0:this.inMemoryCache.setItem(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.indexedDBCache.setItem(e,r)];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),this.handleDatabaseAccessError(n),[3,4];case 4:return[2]}})})},t.prototype.removeItem=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:this.inMemoryCache.removeItem(e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.indexedDBCache.removeItem(e)];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),this.handleDatabaseAccessError(r),[3,4];case 4:return[2]}})})},t.prototype.getKeys=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:if(e=this.inMemoryCache.getKeys(),e.length!==0)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),this.logger.verbose("In-memory cache is empty, now querying persistent storage."),[4,this.indexedDBCache.getKeys()];case 2:return[2,n.sent()];case 3:return r=n.sent(),this.handleDatabaseAccessError(r),[3,4];case 4:return[2,e]}})})},t.prototype.containsKey=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:if(r=this.inMemoryCache.containsKey(e),r)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),[4,this.indexedDBCache.containsKey(e)];case 2:return[2,i.sent()];case 3:return n=i.sent(),this.handleDatabaseAccessError(n),[3,4];case 4:return[2,r]}})})},t.prototype.clearInMemory=function(){this.logger.verbose("Deleting in-memory keystore "+this.storeName),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore "+this.storeName+" deleted")},t.prototype.clearPersistent=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.logger.verbose("Deleting persistent keystore"),[4,this.indexedDBCache.deleteDatabase()];case 1:return e=n.sent(),e&&this.logger.verbose("Persistent keystore deleted"),[2,e];case 2:return r=n.sent(),this.handleDatabaseAccessError(r),[2,!1];case 3:return[2]}})})},t}();var Kd;(function(t){t.asymmetricKeys="asymmetricKeys",t.symmetricKeys="symmetricKeys"})(Kd||(Kd={}));var K_=function(){function t(e){this.logger=e,this.asymmetricKeys=new fm(this.logger,Kd.asymmetricKeys),this.symmetricKeys=new fm(this.logger,Kd.symmetricKeys)}return t.prototype.clear=function(){return S(this,void 0,void 0,function(){var e;return k(this,function(r){switch(r.label){case 0:this.asymmetricKeys.clearInMemory(),this.symmetricKeys.clearInMemory(),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.asymmetricKeys.clearPersistent()];case 2:return r.sent(),[2,!0];case 3:return e=r.sent(),e instanceof Error?this.logger.error("Clearing keystore failed with error: "+e.message):this.logger.error("Clearing keystore failed with unknown error"),[2,!1];case 4:return[2]}})})},t}();var W_=function(){function t(e,r,n){this.logger=e,this.browserCrypto=new u3(this.logger,n),this.b64Encode=new h3,this.b64Decode=new D_,this.guidGenerator=new d3(this.browserCrypto),this.pkceGenerator=new V_(this.browserCrypto),this.cache=new K_(this.logger),this.performanceClient=r}return t.prototype.createNewGuid=function(){return this.guidGenerator.generateGuid()},t.prototype.base64Encode=function(e){return this.b64Encode.encode(e)},t.prototype.base64Decode=function(e){return this.b64Decode.decode(e)},t.prototype.generatePkceCodes=function(){return S(this,void 0,void 0,function(){return k(this,function(e){return[2,this.pkceGenerator.generateCodes()]})})},t.prototype.getPublicKeyThumbprint=function(e){var r;return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d;return k(this,function(h){switch(h.label){case 0:return n=(r=this.performanceClient)===null||r===void 0?void 0:r.startMeasurement(pt.CryptoOptsGetPublicKeyThumbprint,e.correlationId),[4,this.browserCrypto.generateKeyPair(t.EXTRACTABLE,t.POP_KEY_USAGES)];case 1:return i=h.sent(),[4,this.browserCrypto.exportJwk(i.publicKey)];case 2:return o=h.sent(),a={e:o.e,kty:o.kty,n:o.n},s=Xn.getSortedObjectString(a),[4,this.hashString(s)];case 3:return c=h.sent(),[4,this.browserCrypto.exportJwk(i.privateKey)];case 4:return l=h.sent(),[4,this.browserCrypto.importJwk(l,!1,["sign"])];case 5:return d=h.sent(),[4,this.cache.asymmetricKeys.setItem(c,{privateKey:d,publicKey:i.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri})];case 6:return h.sent(),n&&n.endMeasurement({success:!0}),[2,c]}})})},t.prototype.removeTokenBindingKey=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:return[4,this.cache.asymmetricKeys.removeItem(e)];case 1:return n.sent(),[4,this.cache.asymmetricKeys.containsKey(e)];case 2:return r=n.sent(),[2,!r]}})})},t.prototype.clearKeystore=function(){return S(this,void 0,void 0,function(){return k(this,function(e){switch(e.label){case 0:return[4,this.cache.clear()];case 1:return[2,e.sent()]}})})},t.prototype.signJwt=function(e,r,n){var i;return S(this,void 0,void 0,function(){var o,a,s,c,l,d,h,u,f,v,g,x,m;return k(this,function(p){switch(p.label){case 0:return o=(i=this.performanceClient)===null||i===void 0?void 0:i.startMeasurement(pt.CryptoOptsSignJwt,n),[4,this.cache.asymmetricKeys.getItem(r)];case 1:if(a=p.sent(),!a)throw D.createSigningKeyNotFoundInStorageError(r);return[4,this.browserCrypto.exportJwk(a.publicKey)];case 2:return s=p.sent(),c=Xn.getSortedObjectString(s),l=this.b64Encode.urlEncode(JSON.stringify({kid:r})),d=y_.getShrHeaderString({kid:l,alg:s.alg}),h=this.b64Encode.urlEncode(d),e.cnf={jwk:JSON.parse(c)},u=this.b64Encode.urlEncode(JSON.stringify(e)),f=h+"."+u,v=Xn.stringToArrayBuffer(f),[4,this.browserCrypto.sign(a.privateKey,v)];case 3:return g=p.sent(),x=this.b64Encode.urlEncodeArr(new Uint8Array(g)),m=f+"."+x,o&&o.endMeasurement({success:!0}),[2,m]}})})},t.prototype.hashString=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:return[4,this.browserCrypto.sha256Digest(e)];case 1:return r=i.sent(),n=new Uint8Array(r),[2,this.b64Encode.urlEncodeArr(n)]}})})},t.POP_KEY_USAGES=["sign","verify"],t.EXTRACTABLE=!0,t}();var Y_=function(){function t(e,r,n,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=r,this.logger=n,this.cryptoObj=i}return t.prototype.loadExternalTokens=function(e,r,n){if(this.logger.info("TokenCache - loadExternalTokens called"),!r.id_token)throw D.createUnableToLoadTokenError("Please ensure server response includes id token.");var i=new In(r.id_token,this.cryptoObj),o,a;if(e.account){var s=this.loadAccount(i,e.account.environment,void 0,void 0,e.account.homeAccountId);o=new Ul(s,this.loadIdToken(i,s.homeAccountId,e.account.environment,e.account.tenantId),this.loadAccessToken(e,r,s.homeAccountId,e.account.environment,e.account.tenantId,n),this.loadRefreshToken(e,r,s.homeAccountId,e.account.environment))}else if(e.authority){var c=jd.generateAuthority(e.authority,e.azureCloudOptions),l={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(a=new jd(c,this.config.system.networkClient,this.storage,l,this.logger),n.clientInfo){this.logger.trace("TokenCache - homeAccountId from options");var s=this.loadAccount(i,a.hostnameAndPort,n.clientInfo,a.authorityType);o=new Ul(s,this.loadIdToken(i,s.homeAccountId,a.hostnameAndPort,a.tenant),this.loadAccessToken(e,r,s.homeAccountId,a.hostnameAndPort,a.tenant,n),this.loadRefreshToken(e,r,s.homeAccountId,a.hostnameAndPort))}else if(r.client_info){this.logger.trace("TokenCache - homeAccountId from response");var s=this.loadAccount(i,a.hostnameAndPort,r.client_info,a.authorityType);o=new Ul(s,this.loadIdToken(i,s.homeAccountId,a.hostnameAndPort,a.tenant),this.loadAccessToken(e,r,s.homeAccountId,a.hostnameAndPort,a.tenant,n),this.loadRefreshToken(e,r,s.homeAccountId,a.hostnameAndPort))}else throw D.createUnableToLoadTokenError("Please provide clientInfo in the response or options.")}else throw D.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");return this.generateAuthenticationResult(e,i,o,a)},t.prototype.loadAccount=function(e,r,n,i,o){var a;if(o?a=o:i!==void 0&&n&&(a=kt.generateHomeAccountId(n,i,this.logger,this.cryptoObj,e)),!a)throw D.createUnableToLoadTokenError("Unexpected missing homeAccountId");var s=n?kt.createAccount(n,a,e,void 0,void 0,void 0,r):kt.createGenericAccount(a,e,void 0,void 0,void 0,r);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading account"),this.storage.setAccount(s),s;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.loadIdToken=function(e,r,n,i){var o=uc.createIdTokenEntity(r,n,e.rawToken,this.config.auth.clientId,i);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading id token"),this.storage.setIdTokenCredential(o),o;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.loadAccessToken=function(e,r,n,i,o,a){if(!r.access_token)return this.logger.verbose("TokenCache - No access token provided for caching"),null;if(!r.expires_in)throw D.createUnableToLoadTokenError("Please ensure server response includes expires_in value.");if(!a.extendedExpiresOn)throw D.createUnableToLoadTokenError("Please provide an extendedExpiresOn value in the options.");var s=new rr(e.scopes).printScopes(),c=a.expiresOn||r.expires_in+new Date().getTime()/1e3,l=a.extendedExpiresOn,d=fc.createAccessTokenEntity(n,i,r.access_token,this.config.auth.clientId,o,s,c,l,this.cryptoObj);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading access token"),this.storage.setAccessTokenCredential(d),d;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.loadRefreshToken=function(e,r,n,i){if(!r.refresh_token)return this.logger.verbose("TokenCache - No refresh token provided for caching"),null;var o=Fd.createRefreshTokenEntity(n,i,r.refresh_token,this.config.auth.clientId);if(this.isBrowserEnvironment)return this.logger.verbose("TokenCache - loading refresh token"),this.storage.setRefreshTokenCredential(o),o;throw D.createUnableToLoadTokenError("loadExternalTokens is designed to work in browser environments only.")},t.prototype.generateAuthenticationResult=function(e,r,n,i){var o,a,s,c=_.EMPTY_STRING,l=[],d=null,h;n!=null&&n.accessToken&&(c=n.accessToken.secret,l=rr.fromString(n.accessToken.target).asArray(),d=new Date(Number(n.accessToken.expiresOn)*1e3),h=new Date(Number(n.accessToken.extendedExpiresOn)*1e3));var u=(r==null?void 0:r.claims.oid)||(r==null?void 0:r.claims.sub)||_.EMPTY_STRING,f=(r==null?void 0:r.claims.tid)||_.EMPTY_STRING;return{authority:i?i.canonicalAuthority:_.EMPTY_STRING,uniqueId:u,tenantId:f,scopes:l,account:n!=null&&n.account?n.account.getAccountInfo():null,idToken:r?r.rawToken:_.EMPTY_STRING,idTokenClaims:r?r.claims:{},accessToken:c,fromCache:!0,expiresOn:d,correlationId:e.correlationId||_.EMPTY_STRING,requestId:_.EMPTY_STRING,extExpiresOn:h,familyId:_.EMPTY_STRING,tokenType:((o=n==null?void 0:n.accessToken)===null||o===void 0?void 0:o.tokenType)||_.EMPTY_STRING,state:_.EMPTY_STRING,cloudGraphHostName:((a=n==null?void 0:n.account)===null||a===void 0?void 0:a.cloudGraphHostName)||_.EMPTY_STRING,msGraphHost:((s=n==null?void 0:n.account)===null||s===void 0?void 0:s.msGraphHost)||_.EMPTY_STRING,code:void 0,fromNativeBroker:!1}},t}();var Q_=function(t){It(e,t);function e(r){var n=t.call(this,r)||this;return n.includeRedirectUri=!1,n}return e}(r3);var X_=function(t){It(e,t);function e(r,n,i,o,a,s,c,l,d,h){var u=t.call(this,r,n,i,o,a,s,l,d,h)||this;return u.apiId=c,u}return e.prototype.acquireToken=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l;return k(this,function(d){switch(d.label){case 0:if(this.logger.trace("SilentAuthCodeClient.acquireToken called"),!r.code)throw D.createAuthCodeRequiredError();return[4,this.initializeAuthorizationRequest(r,G.Silent)];case 1:n=d.sent(),this.browserStorage.updateCacheEntries(n.state,n.nonce,n.authority,n.loginHint||_.EMPTY_STRING,n.account||null),i=this.initializeServerTelemetryManager(this.apiId),d.label=2;case 2:return d.trys.push([2,4,,5]),o=K(K({},n),{code:r.code}),[4,this.getClientConfiguration(i,n.authority)];case 3:return a=d.sent(),s=new Q_(a),this.logger.verbose("Auth code client created"),c=new l3(s,this.browserStorage,o,this.logger,this.config.system),[2,c.handleCodeResponseFromServer({code:r.code,msgraph_host:r.msGraphHost,cloud_graph_host_name:r.cloudGraphHostName,cloud_instance_host_name:r.cloudInstanceHostName},n.state,s.authority,this.networkClient,!1)];case 4:throw l=d.sent(),l instanceof W&&l.setCorrelationId(this.correlationId),i.cacheFailedRequest(l),this.browserStorage.cleanRequestByState(n.state),l;case 5:return[2]}})})},e.prototype.logout=function(){return Promise.reject(D.createSilentLogoutUnsupportedError())},e}($a);var J_=function(){function t(e,r){this.correlationId=r,this.measureName="msal.measure."+e+"."+this.correlationId,this.startMark="msal.start."+e+"."+this.correlationId,this.endMark="msal.end."+e+"."+this.correlationId}return t.supportsBrowserPerformance=function(){return typeof window<"u"&&typeof window.performance<"u"&&typeof window.performance.mark=="function"&&typeof window.performance.measure=="function"&&typeof window.performance.clearMarks=="function"&&typeof window.performance.clearMeasures=="function"&&typeof window.performance.getEntriesByName=="function"},t.prototype.startMeasurement=function(){if(t.supportsBrowserPerformance())try{window.performance.mark(this.startMark)}catch{}},t.prototype.endMeasurement=function(){if(t.supportsBrowserPerformance())try{window.performance.mark(this.endMark),window.performance.measure(this.measureName,this.startMark,this.endMark)}catch{}},t.prototype.flushMeasurement=function(){if(t.supportsBrowserPerformance())try{var e=window.performance.getEntriesByName(this.measureName,"measure");if(e.length>0){var r=e[0].duration;return window.performance.clearMeasures(this.measureName),window.performance.clearMarks(this.startMark),window.performance.clearMarks(this.endMark),r}}catch{}return null},t}();var Z_=function(t){It(e,t);function e(r,n,i,o,a,s,c){var l=t.call(this,r,n,i,o,a,s)||this;return l.browserCrypto=new u3(l.logger,c),l.guidGenerator=new d3(l.browserCrypto),l}return e.prototype.startPerformanceMeasuremeant=function(r,n){return new J_(r,n)},e.prototype.generateId=function(){return this.guidGenerator.generateGuid()},e.prototype.getPageVisibility=function(){var r;return((r=document.visibilityState)===null||r===void 0?void 0:r.toString())||null},e.prototype.startMeasurement=function(r,n){var i=this,o=this.getPageVisibility(),a=t.prototype.startMeasurement.call(this,r,n);return K(K({},a),{endMeasurement:function(s){return a.endMeasurement(K({startPageVisibility:o,endPageVisibility:i.getPageVisibility()},s))}})},e}(o3);var eb=function(){function t(e){this.isBrowserEnvironment=typeof window<"u",this.config=R_(e,this.isBrowserEnvironment),this.initialized=!1,this.logger=new Jf(this.config.system.loggerOptions,_h,$s),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 Z_(this.config.auth.clientId,this.config.auth.authority,this.logger,_h,$s,this.config.telemetry.application,this.config.system.cryptoOptions):new w_(this.config.auth.clientId,this.config.auth.authority,this.logger,_h,$s,this.config.telemetry.application),this.browserCrypto=this.isBrowserEnvironment?new W_(this.logger,this.performanceClient,this.config.system.cryptoOptions):Dd,this.eventHandler=new O_(this.logger,this.browserCrypto),this.browserStorage=this.isBrowserEnvironment?new u2(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger):C_(this.config.auth.clientId,this.logger);var r={cacheLocation:$t.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1};this.nativeInternalStorage=new u2(this.config.auth.clientId,r,this.browserCrypto,this.logger),this.tokenCache=new Y_(this.config,this.browserStorage,this.logger,this.browserCrypto)}return t.prototype.initialize=function(){return S(this,void 0,void 0,function(){var e,r;return k(this,function(n){switch(n.label){case 0:if(this.logger.trace("initialize called"),this.initialized)return this.logger.info("initialize has already been called, exiting early."),[2];if(this.eventHandler.emitEvent(X.INITIALIZE_START),!this.config.system.allowNativeBroker)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),e=this,[4,vo.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout)];case 2:return e.nativeExtensionProvider=n.sent(),[3,4];case 3:return r=n.sent(),this.logger.verbose(r),[3,4];case 4:return this.initialized=!0,this.eventHandler.emitEvent(X.INITIALIZE_END),[2]}})})},t.prototype.handleRedirectPromise=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s,c,l,d=this;return k(this,function(h){return this.logger.verbose("handleRedirectPromise called"),Je.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),r=this.getAllAccounts(),this.isBrowserEnvironment?(n=e||_.EMPTY_STRING,i=this.redirectResponse.get(n),typeof i>"u"?(this.eventHandler.emitEvent(X.HANDLE_REDIRECT_START,G.Redirect),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise"),o=this.browserStorage.getCachedNativeRequest(),a=void 0,o&&vo.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e?(this.logger.trace("handleRedirectPromise - acquiring token from native platform"),s=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,o.accountId,this.nativeInternalStorage,o.correlationId),a=s.handleRedirectPromise()):(this.logger.trace("handleRedirectPromise - acquiring token from web flow"),c=this.browserStorage.getTemporaryCache(pe.CORRELATION_ID,!0)||_.EMPTY_STRING,l=this.createRedirectClient(c),a=l.handleRedirectPromise(e)),i=a.then(function(u){if(u){var f=r.length<d.getAllAccounts().length;f?(d.eventHandler.emitEvent(X.LOGIN_SUCCESS,G.Redirect,u),d.logger.verbose("handleRedirectResponse returned result, login success")):(d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_SUCCESS,G.Redirect,u),d.logger.verbose("handleRedirectResponse returned result, acquire token success"))}return d.eventHandler.emitEvent(X.HANDLE_REDIRECT_END,G.Redirect),u}).catch(function(u){throw r.length>0?d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Redirect,null,u):d.eventHandler.emitEvent(X.LOGIN_FAILURE,G.Redirect,null,u),d.eventHandler.emitEvent(X.HANDLE_REDIRECT_END,G.Redirect),u}),this.redirectResponse.set(n,i)):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),[2,i]):(this.logger.verbose("handleRedirectPromise returns null, not browser environment"),[2,null])})})},t.prototype.acquireTokenRedirect=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s=this;return k(this,function(c){return r=this.getRequestCorrelationId(e),this.logger.verbose("acquireTokenRedirect called",r),this.preflightBrowserEnvironmentCheck(G.Redirect),n=this.getAllAccounts().length>0,n?this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_START,G.Redirect,e):this.eventHandler.emitEvent(X.LOGIN_START,G.Redirect,e),this.nativeExtensionProvider&&this.canUseNative(e)?(o=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId),i=o.acquireTokenRedirect(e).catch(function(l){if(l instanceof En&&l.isFatal()){s.nativeExtensionProvider=void 0;var d=s.createRedirectClient(e.correlationId);return d.acquireToken(e)}else if(l instanceof sn){s.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");var d=s.createRedirectClient(e.correlationId);return d.acquireToken(e)}throw s.browserStorage.setInteractionInProgress(!1),l})):(a=this.createRedirectClient(e.correlationId),i=a.acquireToken(e)),[2,i.catch(function(l){throw n?s.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Redirect,null,l):s.eventHandler.emitEvent(X.LOGIN_FAILURE,G.Redirect,null,l),l})]})})},t.prototype.acquireTokenPopup=function(e){var r=this,n=this.getRequestCorrelationId(e),i=this.performanceClient.startMeasurement(pt.AcquireTokenPopup,n);try{this.logger.verbose("acquireTokenPopup called",n),this.preflightBrowserEnvironmentCheck(G.Popup)}catch(c){return Promise.reject(c)}var o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_START,G.Popup,e):this.eventHandler.emitEvent(X.LOGIN_START,G.Popup,e);var a;if(this.canUseNative(e))a=this.acquireTokenNative(e,Pe.acquireTokenPopup).then(function(c){return r.browserStorage.setInteractionInProgress(!1),i.endMeasurement({success:!0,isNativeBroker:!0,requestId:c.requestId}),i.flushMeasurement(),c}).catch(function(c){if(c instanceof En&&c.isFatal()){r.nativeExtensionProvider=void 0;var l=r.createPopupClient(e.correlationId);return l.acquireToken(e)}else if(c instanceof sn){r.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");var l=r.createPopupClient(e.correlationId);return l.acquireToken(e)}throw r.browserStorage.setInteractionInProgress(!1),c});else{var s=this.createPopupClient(e.correlationId);a=s.acquireToken(e)}return a.then(function(c){var l=o.length<r.getAllAccounts().length;return l?r.eventHandler.emitEvent(X.LOGIN_SUCCESS,G.Popup,c):r.eventHandler.emitEvent(X.ACQUIRE_TOKEN_SUCCESS,G.Popup,c),i.addStaticFields({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),i.endMeasurement({success:!0,requestId:c.requestId}),i.flushMeasurement(),c}).catch(function(c){return o.length>0?r.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Popup,null,c):r.eventHandler.emitEvent(X.LOGIN_FAILURE,G.Popup,null,c),i.endMeasurement({errorCode:c.errorCode,subErrorCode:c.subError,success:!1}),i.flushMeasurement(),Promise.reject(c)})},t.prototype.ssoSilent=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s=this;return k(this,function(c){return r=this.getRequestCorrelationId(e),n=K(K({},e),{prompt:e.prompt,correlationId:r}),this.preflightBrowserEnvironmentCheck(G.Silent),i=this.performanceClient.startMeasurement(pt.SsoSilent,r),this.logger.verbose("ssoSilent called",r),this.eventHandler.emitEvent(X.SSO_SILENT_START,G.Silent,n),this.canUseNative(n)?o=this.acquireTokenNative(n,Pe.ssoSilent).catch(function(l){if(l instanceof En&&l.isFatal()){s.nativeExtensionProvider=void 0;var d=s.createSilentIframeClient(n.correlationId);return d.acquireToken(n)}throw l}):(a=this.createSilentIframeClient(n.correlationId),o=a.acquireToken(n)),[2,o.then(function(l){return s.eventHandler.emitEvent(X.SSO_SILENT_SUCCESS,G.Silent,l),i.addStaticFields({accessTokenSize:l.accessToken.length,idTokenSize:l.idToken.length}),i.endMeasurement({success:!0,isNativeBroker:l.fromNativeBroker,requestId:l.requestId}),i.flushMeasurement(),l}).catch(function(l){throw s.eventHandler.emitEvent(X.SSO_SILENT_FAILURE,G.Silent,null,l),i.endMeasurement({errorCode:l.errorCode,subErrorCode:l.subError,success:!1}),i.flushMeasurement(),l})]})})},t.prototype.acquireTokenByCode=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a=this;return k(this,function(s){r=this.getRequestCorrelationId(e),this.preflightBrowserEnvironmentCheck(G.Silent),this.logger.trace("acquireTokenByCode called",r),this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_START,G.Silent,e),n=this.performanceClient.startMeasurement(pt.AcquireTokenByCode,e.correlationId);try{if(e.code)return i=e.code,o=this.hybridAuthCodeResponses.get(i),o?(this.logger.verbose("Existing acquireTokenByCode request found",e.correlationId),n.endMeasurement({success:!0}),n.discardMeasurement()):(this.logger.verbose("Initiating new acquireTokenByCode request",r),o=this.acquireTokenByCodeAsync(K(K({},e),{correlationId:r})).then(function(c){return a.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_SUCCESS,G.Silent,c),a.hybridAuthCodeResponses.delete(i),n.addStaticFields({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),n.endMeasurement({success:!0,isNativeBroker:c.fromNativeBroker,requestId:c.requestId}),n.flushMeasurement(),c}).catch(function(c){throw a.hybridAuthCodeResponses.delete(i),a.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_FAILURE,G.Silent,null,c),n.endMeasurement({errorCode:c.errorCode,subErrorCode:c.subError,success:!1}),n.flushMeasurement(),c}),this.hybridAuthCodeResponses.set(i,o)),[2,o];if(e.nativeAccountId){if(this.canUseNative(e,e.nativeAccountId))return[2,this.acquireTokenNative(e,Pe.acquireTokenByCode,e.nativeAccountId).catch(function(c){throw c instanceof En&&c.isFatal()&&(a.nativeExtensionProvider=void 0),c})];throw D.createUnableToAcquireTokenFromNativePlatformError()}else throw D.createAuthCodeOrNativeAccountIdRequiredError()}catch(c){throw this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_BY_CODE_FAILURE,G.Silent,null,c),n.endMeasurement({errorCode:c instanceof W&&c.errorCode||void 0,subErrorCode:c instanceof W&&c.subError||void 0,success:!1}),c}return[2]})})},t.prototype.acquireTokenByCodeAsync=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){switch(i.label){case 0:return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),r=this.createSilentAuthCodeClient(e.correlationId),[4,r.acquireToken(e)];case 1:return n=i.sent(),[2,n]}})})},t.prototype.acquireTokenFromCache=function(e,r,n){return S(this,void 0,void 0,function(){return k(this,function(i){switch(n.cacheLookupPolicy){case fr.Default:case fr.AccessToken:case fr.AccessTokenAndRefreshToken:return[2,e.acquireToken(r)];default:throw j.createRefreshRequiredError()}return[2]})})},t.prototype.acquireTokenByRefreshToken=function(e,r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){switch(r.cacheLookupPolicy){case fr.Default:case fr.AccessTokenAndRefreshToken:case fr.RefreshToken:case fr.RefreshTokenAndNetwork:return n=this.createSilentRefreshClient(e.correlationId),[2,n.acquireToken(e)];default:throw j.createRefreshRequiredError()}return[2]})})},t.prototype.acquireTokenBySilentIframe=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){return r=this.createSilentIframeClient(e.correlationId),[2,r.acquireToken(e)]})})},t.prototype.logout=function(e){return S(this,void 0,void 0,function(){var r;return k(this,function(n){return r=this.getRequestCorrelationId(e),this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",r),[2,this.logoutRedirect(K({correlationId:r},e))]})})},t.prototype.logoutRedirect=function(e){return S(this,void 0,void 0,function(){var r,n;return k(this,function(i){return r=this.getRequestCorrelationId(e),this.preflightBrowserEnvironmentCheck(G.Redirect),n=this.createRedirectClient(r),[2,n.logout(e)]})})},t.prototype.logoutPopup=function(e){try{var r=this.getRequestCorrelationId(e);this.preflightBrowserEnvironmentCheck(G.Popup);var n=this.createPopupClient(r);return n.logout(e)}catch(i){return Promise.reject(i)}},t.prototype.getAllAccounts=function(){return this.logger.verbose("getAllAccounts called"),this.isBrowserEnvironment?this.browserStorage.getAllAccounts():[]},t.prototype.getAccountByUsername=function(e){var r=this.getAllAccounts();return!V.isEmpty(e)&&r&&r.length?(this.logger.verbose("Account matching username found, returning"),this.logger.verbosePii("Returning signed-in accounts matching username: "+e),r.filter(function(n){return n.username.toLowerCase()===e.toLowerCase()})[0]||null):(this.logger.verbose("getAccountByUsername: No matching account found, returning null"),null)},t.prototype.getAccountByHomeId=function(e){var r=this.getAllAccounts();return!V.isEmpty(e)&&r&&r.length?(this.logger.verbose("Account matching homeAccountId found, returning"),this.logger.verbosePii("Returning signed-in accounts matching homeAccountId: "+e),r.filter(function(n){return n.homeAccountId===e})[0]||null):(this.logger.verbose("getAccountByHomeId: No matching account found, returning null"),null)},t.prototype.getAccountByLocalId=function(e){var r=this.getAllAccounts();return!V.isEmpty(e)&&r&&r.length?(this.logger.verbose("Account matching localAccountId found, returning"),this.logger.verbosePii("Returning signed-in accounts matching localAccountId: "+e),r.filter(function(n){return n.localAccountId===e})[0]||null):(this.logger.verbose("getAccountByLocalId: No matching account found, returning null"),null)},t.prototype.setActiveAccount=function(e){this.browserStorage.setActiveAccount(e)},t.prototype.getActiveAccount=function(){return this.browserStorage.getActiveAccount()},t.prototype.preflightBrowserEnvironmentCheck=function(e,r){if(r===void 0&&(r=!0),this.logger.verbose("preflightBrowserEnvironmentCheck started"),Je.blockNonBrowserEnvironment(this.isBrowserEnvironment),Je.blockRedirectInIframe(e,this.config.system.allowRedirectInIframe),Je.blockReloadInHiddenIframes(),Je.blockAcquireTokenInPopups(),Je.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker,this.initialized),e===G.Redirect&&this.config.cache.cacheLocation===$t.MemoryStorage&&!this.config.cache.storeAuthStateInCookie)throw Gd.createInMemoryRedirectUnavailableError();(e===G.Redirect||e===G.Popup)&&this.preflightInteractiveRequest(r)},t.prototype.preflightInteractiveRequest=function(e){this.logger.verbose("preflightInteractiveRequest called, validating app environment"),Je.blockReloadInHiddenIframes(),e&&this.browserStorage.setInteractionInProgress(!0)},t.prototype.acquireTokenNative=function(e,r,n){return S(this,void 0,void 0,function(){var i;return k(this,function(o){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw D.createNativeConnectionNotEstablishedError();return i=new xa(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,r,this.performanceClient,this.nativeExtensionProvider,n||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId),[2,i.acquireToken(e)]})})},t.prototype.canUseNative=function(e,r){if(this.logger.trace("canUseNative called"),!vo.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 Bt.NONE:case Bt.CONSENT:case Bt.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!r&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0},t.prototype.getNativeAccountId=function(e){var r=e.account||this.browserStorage.getAccountInfoByHints(e.loginHint,e.sid)||this.getActiveAccount();return r&&r.nativeAccountId||""},t.prototype.createPopupClient=function(e){return new A_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},t.prototype.createRedirectClient=function(e){return new k_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},t.prototype.createSilentIframeClient=function(e){return new H_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)},t.prototype.createSilentCacheClient=function(e){return new c3(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},t.prototype.createSilentRefreshClient=function(e){return new L_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)},t.prototype.createSilentAuthCodeClient=function(e){return new X_(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Pe.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)},t.prototype.addEventCallback=function(e){return this.eventHandler.addEventCallback(e)},t.prototype.removeEventCallback=function(e){this.eventHandler.removeEventCallback(e)},t.prototype.addPerformanceCallback=function(e){return this.performanceClient.addPerformanceCallback(e)},t.prototype.removePerformanceCallback=function(e){return this.performanceClient.removePerformanceCallback(e)},t.prototype.enableAccountStorageEvents=function(){this.eventHandler.enableAccountStorageEvents()},t.prototype.disableAccountStorageEvents=function(){this.eventHandler.disableAccountStorageEvents()},t.prototype.getTokenCache=function(){return this.tokenCache},t.prototype.getLogger=function(){return this.logger},t.prototype.setLogger=function(e){this.logger=e},t.prototype.initializeWrapperLibrary=function(e,r){this.browserStorage.setWrapperMetadata(e,r)},t.prototype.setNavigationClient=function(e){this.navigationClient=e},t.prototype.getConfiguration=function(){return this.config},t.prototype.getRequestCorrelationId=function(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?this.browserCrypto.createNewGuid():_.EMPTY_STRING},t}();var tb=function(t){It(e,t);function e(r){var n=t.call(this,r)||this;return n.activeSilentTokenRequests=new Map,n}return e.prototype.loginRedirect=function(r){return S(this,void 0,void 0,function(){var n;return k(this,function(i){return n=this.getRequestCorrelationId(r),this.logger.verbose("loginRedirect called",n),[2,this.acquireTokenRedirect(K({correlationId:n},r||cm))]})})},e.prototype.loginPopup=function(r){var n=this.getRequestCorrelationId(r);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup(K({correlationId:n},r||cm))},e.prototype.acquireTokenSilent=function(r){return S(this,void 0,void 0,function(){var n,i,o,a,s,c,l,d=this;return k(this,function(h){if(n=this.getRequestCorrelationId(r),i=this.performanceClient.startMeasurement(pt.AcquireTokenSilent,n),i.addStaticFields({cacheLookupPolicy:r.cacheLookupPolicy}),this.preflightBrowserEnvironmentCheck(G.Silent),this.logger.verbose("acquireTokenSilent called",n),o=r.account||this.getActiveAccount(),!o)throw D.createNoAccountError();return a={clientId:this.config.auth.clientId,authority:r.authority||_.EMPTY_STRING,scopes:r.scopes,homeAccountIdentifier:o.homeAccountId,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},s=JSON.stringify(a),c=this.activeSilentTokenRequests.get(s),typeof c>"u"?(this.logger.verbose("acquireTokenSilent called for the first time, storing active request",n),l=this.acquireTokenSilentAsync(K(K({},r),{correlationId:n}),o).then(function(u){return d.activeSilentTokenRequests.delete(s),i.addStaticFields({accessTokenSize:u.accessToken.length,idTokenSize:u.idToken.length}),i.endMeasurement({success:!0,fromCache:u.fromCache,isNativeBroker:u.fromNativeBroker,requestId:u.requestId}),i.flushMeasurement(),u}).catch(function(u){throw d.activeSilentTokenRequests.delete(s),i.endMeasurement({errorCode:u.errorCode,subErrorCode:u.subError,success:!1}),i.flushMeasurement(),u}),this.activeSilentTokenRequests.set(s,l),[2,l]):(this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",n),i.endMeasurement({success:!0}),i.discardMeasurement(),[2,c])})})},e.prototype.acquireTokenSilentAsync=function(r,n){return S(this,void 0,void 0,function(){var i,o,a,s,c,l,d=this;return k(this,function(h){switch(h.label){case 0:return this.eventHandler.emitEvent(X.ACQUIRE_TOKEN_START,G.Silent,r),i=this.performanceClient.startMeasurement(pt.AcquireTokenSilentAsync,r.correlationId),vo.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,r.authenticationScheme)&&n.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),a=K(K({},r),{account:n}),o=this.acquireTokenNative(a,Pe.acquireTokenSilent_silentFlow).catch(function(u){return S(d,void 0,void 0,function(){var f;return k(this,function(v){if(u instanceof En&&u.isFatal())return this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,f=this.createSilentIframeClient(r.correlationId),[2,f.acquireToken(r)];throw u})})}),[3,3]):[3,1];case 1:return this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),s=this.createSilentCacheClient(r.correlationId),[4,s.initializeSilentRequest(r,n)];case 2:c=h.sent(),l=K(K({},r),{cacheLookupPolicy:r.cacheLookupPolicy||fr.Default}),o=this.acquireTokenFromCache(s,c,l).catch(function(u){if(l.cacheLookupPolicy===fr.AccessToken)throw u;return Je.blockReloadInHiddenIframes(),d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_NETWORK_START,G.Silent,c),d.acquireTokenByRefreshToken(c,l).catch(function(f){var v=f instanceof ko,g=f instanceof sn,x=f.errorCode===nn.INVALID_GRANT_ERROR;if((!v||!x||g||l.cacheLookupPolicy===fr.AccessTokenAndRefreshToken||l.cacheLookupPolicy===fr.RefreshToken)&&l.cacheLookupPolicy!==fr.Skip)throw f;return d.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",r.correlationId),d.acquireTokenBySilentIframe(c)})}),h.label=3;case 3:return[2,o.then(function(u){return d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_SUCCESS,G.Silent,u),i.endMeasurement({success:!0,fromCache:u.fromCache,isNativeBroker:u.fromNativeBroker,requestId:u.requestId}),u}).catch(function(u){throw d.eventHandler.emitEvent(X.ACQUIRE_TOKEN_FAILURE,G.Silent,null,u),i.endMeasurement({errorCode:u.errorCode,subErrorCode:u.subError,success:!1}),u})]}})})},e}(eb);const pm="redirect";var mm=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class rb extends tb{get account(){return this.getAllAccounts().find(n=>{var i;return((i=n.idTokenClaims)===null||i===void 0?void 0:i.aud)===this.clientId})}get hasValidClaims(){var e;const r=(e=this.account)===null||e===void 0?void 0:e.idTokenClaims;if(r){const n=Math.ceil(Date.now()/1e3);return r.exp>n}return!1}get clientId(){var e;return(e=this.config.auth)===null||e===void 0?void 0:e.clientId}get requestOrigin(){return this.browserStorage.getTemporaryCache("request.origin",!0)}constructor(e,r){super(r),this.tenantId=e}login(e,r=pm,n=!0){var i;return mm(this,void 0,void 0,function*(){const o=(e==null?void 0:e.loginHint)||((i=this.account)===null||i===void 0?void 0:i.username),a=(e==null?void 0:e.scopes)||[],s=Object.assign(Object.assign({},e),{loginHint:o,scopes:a});if(o&&n){this.logger.verbose("Attempting to login in silently");try{return yield this.ssoSilent(s)}catch{this.logger.verbose("Silent login attempt failed")}}switch(this.logger.verbose(`Attempting to login in by [${r}]`),r){case"popup":return this.loginPopup(s);case"redirect":return this.loginRedirect(s)}})}acquireToken(e={scopes:[]},r=pm,n=!0){return mm(this,void 0,void 0,function*(){const i=yield this.account;if(n&&i){this.logger.verbose("Attempting to acquire token in silently");try{return yield this.acquireTokenSilent(Object.assign({account:i},e))}catch{this.logger.info("Expected to navigate away from the current page but timeout occurred.")}}switch(this.logger.verbose(`Attempting to acquire token by [${r}]`),r){case"popup":return this.acquireTokenPopup(e);case"redirect":return this.acquireTokenRedirect(e)}})}}const nb=(t,e=window.location.origin)=>{t=t.match(/^http[s]?/)?t:e+t;const{origin:r,pathname:n}=new URL(t);return r+n.replace(/([^:]\/)\/+/g,"$1")},ib=(t,e,r,n,i)=>{const o=Object.assign({clientId:e,redirectUri:nb(r||""),navigateToLoginRequestUrl:!1,authority:`https://login.microsoftonline.com/${t}`},n==null?void 0:n.auth),a=Object.assign({cacheLocation:"localStorage"},n==null?void 0:n.cache),s=n==null?void 0:n.system;return new(i||rb)(t,{auth:o,cache:a,system:s})};class f3 extends Jf{constructor(e){super({logLevel:e,loggerCallback:(...r)=>this.loggerCallback(...r)}),this.getLogType=r=>{switch(r){case tt.Error:return"error";case tt.Warning:return"warn";case tt.Info:return"info";case tt.Verbose:default:return"debug"}}}loggerCallback(e,r,n){console[this.getLogType(e)]("%c FUSION::MSAL %c %s","border: 1px solid;","border: none;",r)}}var bh=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const ob="default";class ab{get defaultClient(){return this.getClient(ob)}get defaultAccount(){return this.defaultClient.account}get defaultConfig(){return this._config.defaultConfig}constructor(e){this._config=e,this._clients={}}getClient(e){return this._clients[e]||(this._clients[e]=this.createClient(e)),this._clients[e]}createClient(e){const r=e?this._config.getClientConfig(e):this._config.defaultConfig;if(!r)throw Error("Could not find any config");const n=ib(r.tenantId,r.clientId,r.redirectUri,r.config);return n.setLogger(new f3(0)),n}handleRedirect(){return bh(this,void 0,void 0,function*(){const{redirectUri:e}=this.defaultConfig||{};if(window.location.pathname===e){const r=this.defaultClient,n=r.getLogger(),{requestOrigin:i}=r;yield r.handleRedirectPromise(),i===e?(n.warning(`detected callback loop from url ${e}, redirecting to root`),window.location.replace("/")):window.location.replace(i||"/")}return null})}acquireToken(e){return this.defaultClient.acquireToken(e)}acquireAccessToken(e){return bh(this,void 0,void 0,function*(){const r=yield this.acquireToken(e);return r?r.accessToken:void 0})}login(){return bh(this,void 0,void 0,function*(){yield this.defaultClient.login()})}}var sb=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const p3={name:"auth",configure:t=>{var e;const r=new Yy;return!((e=t==null?void 0:t.auth)===null||e===void 0)&&e.defaultConfig&&r.configureDefault(t.auth.defaultConfig),r},initialize:({config:t})=>sb(void 0,void 0,void 0,function*(){const e=new ab(t);return t.requiresAuth&&(yield e.handleRedirect(),e.defaultAccount||(yield e.login())),e})},cb=(t,e)=>({module:p3,configure:r=>{r.configureDefault(t),(e==null?void 0:e.requiresAuth)!==void 0&&(r.requiresAuth=e==null?void 0:e.requiresAuth);const{clients:n}=e??{};n&&Object.entries(n).forEach(([i,o])=>r.configureClient(i,o))}});var m3=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const lb=t=>{var e;return{id:t.id,isChildType:t.isChildType,parentTypeIds:(e=t.parentTypeIds)!==null&&e!==void 0?e:[]}},v3=t=>{var e,r,n,i;return{id:t.id,externalId:(e=t.externalId)!==null&&e!==void 0?e:void 0,isActive:t.isActive,isDeleted:t.isDeleted,created:new Date(t.created),source:(r=t.source)!==null&&r!==void 0?r:void 0,title:(n=t.title)!==null&&n!==void 0?n:void 0,type:lb(t.type),value:(i=t.value)!==null&&i!==void 0?i:{}}},db=t=>m3(void 0,void 0,void 0,function*(){const e=yield t.json();return v3(e)}),hb=t=>m3(void 0,void 0,void 0,function*(){return(yield t.json()).map(v3)});var ub=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fb=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},$l;class pb{constructor(e,r={}){this.config=r,$l.set(this,void 0),ub(this,$l,e,"f")}requireInstance(e){return fb(this,$l,"f").requireInstance(e)}setContextType(e){this.config.contextType=e}setContextFilter(e){this.config.contextFilter=e}setContextParameterFn(e){this.config.contextParameterFn=e}setContextClient(e,r=1*60*1e3){this.config.client={get:typeof e.get=="function"?{key:({id:n})=>n,client:{fn:e.get},expire:r}:e.get,query:typeof e.query=="function"?{key:n=>JSON.stringify(n),client:{fn:e.query},expire:r}:e.query}}}$l=new WeakMap;var pl=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},vm=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},jl;class mb{constructor(){this.defaultExpireTime=1*60*1e3,jl.set(this,[])}addConfigBuilder(e){vm(this,jl,"f").push(e)}_getServiceProvider(e){var r;return pl(this,void 0,void 0,function*(){if(e.hasModule("services"))return e.requireInstance("services");{const n=(r=e.ref)===null||r===void 0?void 0:r.services;if(n)return n;throw Error("no service services provider configures [ServicesModule]")}})}createConfig(e){var r;return pl(this,void 0,void 0,function*(){const n=yield vm(this,jl,"f").reduce((i,o)=>pl(this,void 0,void 0,function*(){const a=new pb(e,yield i);return yield Promise.resolve(o(a)),Object.assign(i,a.config)}),Promise.resolve({}));return(r=n.client)!==null&&r!==void 0||(n.client=yield(()=>pl(this,void 0,void 0,function*(){const o=yield(yield this._getServiceProvider(e)).createContextClient("json$");return{get:{client:{fn:a=>o.get("v1",a,{selector:db})},key:({id:a})=>a,expire:this.defaultExpireTime},query:{client:{fn:a=>o.query("v1",{query:a},{selector:hb})},key:a=>JSON.stringify(a),expire:this.defaultExpireTime}}}))()),n})}}jl=new WeakMap;var gm;(function(t){t.IDLE="idle",t.ACTIVE="active",t.FAILED="failed",t.CANCELED="canceled"})(gm||(gm={}));const vb=t=>e=>e.pipe(qn(t)),gb=t=>t.pipe(Ge(e=>e.value));var ml,yb=new Uint8Array(16);function _b(){if(!ml&&(ml=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ml))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ml(yb)}const bb=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function g3(t){return typeof t=="string"&&bb.test(t)}var xt=[];for(var wh=0;wh<256;++wh)xt.push((wh+256).toString(16).substr(1));function y3(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(xt[t[e+0]]+xt[t[e+1]]+xt[t[e+2]]+xt[t[e+3]]+"-"+xt[t[e+4]]+xt[t[e+5]]+"-"+xt[t[e+6]]+xt[t[e+7]]+"-"+xt[t[e+8]]+xt[t[e+9]]+"-"+xt[t[e+10]]+xt[t[e+11]]+xt[t[e+12]]+xt[t[e+13]]+xt[t[e+14]]+xt[t[e+15]]).toLowerCase();if(!g3(r))throw TypeError("Stringified UUID is invalid");return r}function wb(t){if(!g3(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function xb(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}var Eb="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Cb="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function zb(t,e,r){function n(i,o,a,s){if(typeof i=="string"&&(i=xb(i)),typeof o=="string"&&(o=wb(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var c=new Uint8Array(16+i.length);if(c.set(o),c.set(i,o.length),c=r(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,a){s=s||0;for(var l=0;l<16;++l)a[s+l]=c[l];return a}return y3(c)}try{n.name=t}catch{}return n.DNS=Eb,n.URL=Cb,n}function _3(t,e,r){t=t||{};var n=t.random||(t.rng||_b)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return y3(n)}function Sb(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function xh(t,e){return t<<e|t>>>32-e}function kb(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var i=0;i<n.length;++i)t.push(n.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),c=0;c<a;++c){for(var l=new Uint32Array(16),d=0;d<16;++d)l[d]=t[c*64+d*4]<<24|t[c*64+d*4+1]<<16|t[c*64+d*4+2]<<8|t[c*64+d*4+3];s[c]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var h=0;h<a;++h){for(var u=new Uint32Array(80),f=0;f<16;++f)u[f]=s[h][f];for(var v=16;v<80;++v)u[v]=xh(u[v-3]^u[v-8]^u[v-14]^u[v-16],1);for(var g=r[0],x=r[1],m=r[2],p=r[3],y=r[4],w=0;w<80;++w){var T=Math.floor(w/20),O=xh(g,5)+Sb(T,x,m,p)+y+e[T]+u[w]>>>0;y=p,p=m,m=xh(x,30)>>>0,x=g,g=O}r[0]=r[0]+g>>>0,r[1]=r[1]+x>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+p>>>0,r[4]=r[4]+y>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Ab=zb("v5",80,kb);const Tb=Ab;class p2 extends Error{constructor(e,r){super(r.message,{cause:r.cause}),this.type=e,this.request=r.request}}const b3=(...t)=>Wt(e=>t.includes(e.type));var Ut=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ib=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},yn,Xr;class t0 extends He{get action$(){return Ut(this,yn,"f").asObservable()}get value(){return Ut(this,Xr,"f").value}get closed(){return Ut(this,Xr,"f").closed||Ut(this,yn,"f").closed}constructor(e,r){super(i=>Ut(this,Xr,"f").subscribe(i)),yn.set(this,new Yn),Xr.set(this,void 0);const n="getInitialState"in e?e.getInitialState():r;Ib(this,Xr,new x1(n),"f"),Ut(this,yn,"f").pipe(Wg(e,n),Kg()).subscribe(Ut(this,Xr,"f")),this.reset=()=>Ut(this,Xr,"f").next(n)}next(e){Ut(this,yn,"f").next(e)}addEffect(e,r){const n=typeof e=="string"?this.action$.pipe(b3(e)):this.action$,i=r||e;return n.pipe(So(o=>or(new Promise((a,s)=>{try{a(i(o,this.value))}catch(c){s(c)}})).pipe(Kr(a=>(console.warn("unhandled effect",a),Oi)))),Wt(o=>!!o),Md(Id)).subscribe(Ut(this,yn,"f"))}addEpic(e){return this.addFlow(e)}addFlow(e){const r=e(this.action$,this);if(!r)throw new TypeError(`addEpic: one of the provided effects "${e.name||"<anonymous>"}" does not return a stream. Double check you're not missing a return statement!`);return r.pipe(Kr(n=>(console.trace("unhandled exception, epic closed!",n),Oi)),Md(Id)).subscribe(Ut(this,yn,"f"))}unsubscribe(){Ut(this,yn,"f").unsubscribe(),Ut(this,Xr,"f").unsubscribe()}complete(){Ut(this,yn,"f").complete(),Ut(this,Xr,"f").complete()}asObservable(){return Ut(this,Xr,"f").asObservable()}}yn=new WeakMap,Xr=new WeakMap;function St(t,e){function r(...n){if(e){const i=e(...n);if(!i)throw new Error("prepareAction did not return an object");return Object.assign(Object.assign({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:n[0]}}return r.toString=()=>`${t}`,r.type=t,r.match=n=>n.type===t,r}const Bl="::",r0=t=>new RegExp(`${Bl}\\${t}$`),ym=t=>t.type.replace(r0("\\w+$"),"");function Eh(t,e,r,n){const i=St([t,"request"].join(Bl),e);return r&&Object.assign(i,{success:St([t,"success"].join(Bl),r)}),n&&Object.assign(i,{failure:St([t,"failure"].join(Bl),n)}),i}const Mb=t=>!!t.type.match(/::request$/),Pb=t=>!!t.type.match(r0("success")),Rb=t=>!!t.type.match(r0("failure")),Hb=t=>Pb(t)||Rb(t);function zr(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map(function(i){return"'"+i+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Ni(t){return!!t&&!!t[_e]}function un(t){var e;return!!t&&(function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var i=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===Bb}(t)||Array.isArray(t)||!!t[Sm]||!!(!((e=t.constructor)===null||e===void 0)&&e[Sm])||n0(t)||i0(t))}function _m(t){return Ni(t)||zr(23,t),t[_e].t}function Ha(t,e,r){r===void 0&&(r=!1),ja(t)===0?(r?Object.keys:l0)(t).forEach(function(n){r&&typeof n=="symbol"||e(n,t[n],t)}):t.forEach(function(n,i){return e(i,n,t)})}function ja(t){var e=t[_e];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:n0(t)?2:i0(t)?3:0}function m2(t,e){return ja(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Lb(t,e){return ja(t)===2?t.get(e):t[e]}function w3(t,e,r){var n=ja(t);n===2?t.set(e,r):n===3?(t.delete(e),t.add(r)):t[e]=r}function Ob(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function n0(t){return $b&&t instanceof Map}function i0(t){return jb&&t instanceof Set}function gt(t){return t.o||t.t}function o0(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=qb(t);delete e[_e];for(var r=l0(e),n=0;n<r.length;n++){var i=r[n],o=e[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(e[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),e)}function a0(t,e){return e===void 0&&(e=!1),s0(t)||Ni(t)||!un(t)||(ja(t)>1&&(t.set=t.add=t.clear=t.delete=Db),Object.freeze(t),e&&Ha(t,function(r,n){return a0(n,!0)},!0)),t}function Db(){zr(2)}function s0(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function An(t){var e=g2[t];return e||zr(18,t),e}function Nb(t,e){g2[t]||(g2[t]=e)}function Wd(){return mc}function Ch(t,e){e&&(An("Patches"),t.u=[],t.s=[],t.v=e)}function Yd(t){v2(t),t.p.forEach(Vb),t.p=null}function v2(t){t===mc&&(mc=t.l)}function bm(t){return mc={p:[],l:mc,h:t,m:!0,_:0}}function Vb(t){var e=t[_e];e.i===0||e.i===1?e.j():e.O=!0}function zh(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.g||An("ES5").S(e,t,n),n?(r[_e].P&&(Yd(e),zr(4)),un(t)&&(t=Qd(e,t),e.l||Xd(e,t)),e.u&&An("Patches").M(r[_e].t,t,e.u,e.s)):t=Qd(e,r,[]),Yd(e),e.u&&e.v(e.u,e.s),t!==x3?t:void 0}function Qd(t,e,r){if(s0(e))return e;var n=e[_e];if(!n)return Ha(e,function(o,a){return wm(t,n,e,o,a,r)},!0),e;if(n.A!==t)return e;if(!n.P)return Xd(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=n.i===4||n.i===5?n.o=o0(n.k):n.o;Ha(n.i===3?new Set(i):i,function(o,a){return wm(t,n,i,o,a,r)}),Xd(t,i,!1),r&&t.u&&An("Patches").R(n,r,t.u,t.s)}return n.o}function wm(t,e,r,n,i,o){if(Ni(i)){var a=Qd(t,i,o&&e&&e.i!==3&&!m2(e.D,n)?o.concat(n):void 0);if(w3(r,n,a),!Ni(a))return;t.m=!1}if(un(i)&&!s0(i)){if(!t.h.F&&t._<1)return;Qd(t,i),e&&e.A.l||Xd(t,i)}}function Xd(t,e,r){r===void 0&&(r=!1),t.h.F&&t.m&&a0(e,r)}function Sh(t,e){var r=t[_e];return(r?gt(r):t)[e]}function xm(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function $n(t){t.P||(t.P=!0,t.l&&$n(t.l))}function kh(t){t.o||(t.o=o0(t.t))}function pc(t,e,r){var n=n0(e)?An("MapSet").N(e,r):i0(e)?An("MapSet").T(e,r):t.g?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Wd(),P:!1,I:!1,D:{},l:o,t:i,k:null,o:null,j:null,C:!1},c=s,l=y2;a&&(c=[s],l=_s);var d=Proxy.revocable(c,l),h=d.revoke,u=d.proxy;return s.k=u,s.j=h,u}(e,r):An("ES5").J(e,r);return(r?r.A:Wd()).p.push(n),n}function Fb(t){return Ni(t)||zr(22,t),function e(r){if(!un(r))return r;var n,i=r[_e],o=ja(r);if(i){if(!i.P&&(i.i<4||!An("ES5").K(i)))return i.t;i.I=!0,n=Em(r,o),i.I=!1}else n=Em(r,o);return Ha(n,function(a,s){i&&Lb(i.t,a)===s||w3(n,a,e(s))}),o===3?new Set(n):n}(t)}function Em(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return o0(t)}function Ub(){function t(s,c){function l(){this.constructor=s}i(s,c),s.prototype=(l.prototype=c.prototype,new l)}function e(s){s.o||(s.D=new Map,s.o=new Map(s.t))}function r(s){s.o||(s.o=new Set,s.t.forEach(function(c){if(un(c)){var l=pc(s.A.h,c,s);s.p.set(c,l),s.o.add(l)}else s.o.add(c)}))}function n(s){s.O&&zr(3,JSON.stringify(gt(s)))}var i=function(s,c){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,d){l.__proto__=d}||function(l,d){for(var h in d)d.hasOwnProperty(h)&&(l[h]=d[h])})(s,c)},o=function(){function s(l,d){return this[_e]={i:2,l:d,A:d?d.A:Wd(),P:!1,I:!1,o:void 0,D:void 0,t:l,k:this,C:!1,O:!1},this}t(s,Map);var c=s.prototype;return Object.defineProperty(c,"size",{get:function(){return gt(this[_e]).size}}),c.has=function(l){return gt(this[_e]).has(l)},c.set=function(l,d){var h=this[_e];return n(h),gt(h).has(l)&>(h).get(l)===d||(e(h),$n(h),h.D.set(l,!0),h.o.set(l,d),h.D.set(l,!0)),this},c.delete=function(l){if(!this.has(l))return!1;var d=this[_e];return n(d),e(d),$n(d),d.t.has(l)?d.D.set(l,!1):d.D.delete(l),d.o.delete(l),!0},c.clear=function(){var l=this[_e];n(l),gt(l).size&&(e(l),$n(l),l.D=new Map,Ha(l.t,function(d){l.D.set(d,!1)}),l.o.clear())},c.forEach=function(l,d){var h=this;gt(this[_e]).forEach(function(u,f){l.call(d,h.get(f),f,h)})},c.get=function(l){var d=this[_e];n(d);var h=gt(d).get(l);if(d.I||!un(h)||h!==d.t.get(l))return h;var u=pc(d.A.h,h,d);return e(d),d.o.set(l,u),u},c.keys=function(){return gt(this[_e]).keys()},c.values=function(){var l,d=this,h=this.keys();return(l={})[vl]=function(){return d.values()},l.next=function(){var u=h.next();return u.done?u:{done:!1,value:d.get(u.value)}},l},c.entries=function(){var l,d=this,h=this.keys();return(l={})[vl]=function(){return d.entries()},l.next=function(){var u=h.next();if(u.done)return u;var f=d.get(u.value);return{done:!1,value:[u.value,f]}},l},c[vl]=function(){return this.entries()},s}(),a=function(){function s(l,d){return this[_e]={i:3,l:d,A:d?d.A:Wd(),P:!1,I:!1,o:void 0,t:l,k:this,p:new Map,O:!1,C:!1},this}t(s,Set);var c=s.prototype;return Object.defineProperty(c,"size",{get:function(){return gt(this[_e]).size}}),c.has=function(l){var d=this[_e];return n(d),d.o?!!d.o.has(l)||!(!d.p.has(l)||!d.o.has(d.p.get(l))):d.t.has(l)},c.add=function(l){var d=this[_e];return n(d),this.has(l)||(r(d),$n(d),d.o.add(l)),this},c.delete=function(l){if(!this.has(l))return!1;var d=this[_e];return n(d),r(d),$n(d),d.o.delete(l)||!!d.p.has(l)&&d.o.delete(d.p.get(l))},c.clear=function(){var l=this[_e];n(l),gt(l).size&&(r(l),$n(l),l.o.clear())},c.values=function(){var l=this[_e];return n(l),r(l),l.o.values()},c.entries=function(){var l=this[_e];return n(l),r(l),l.o.entries()},c.keys=function(){return this.values()},c[vl]=function(){return this.values()},c.forEach=function(l,d){for(var h=this.values(),u=h.next();!u.done;)l.call(d,u.value,u.value,this),u=h.next()},s}();Nb("MapSet",{N:function(s,c){return new o(s,c)},T:function(s,c){return new a(s,c)}})}var Cm,mc,c0=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",$b=typeof Map<"u",jb=typeof Set<"u",zm=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",x3=c0?Symbol.for("immer-nothing"):((Cm={})["immer-nothing"]=!0,Cm),Sm=c0?Symbol.for("immer-draftable"):"__$immer_draftable",_e=c0?Symbol.for("immer-state"):"__$immer_state",vl=typeof Symbol<"u"&&Symbol.iterator||"@@iterator",Bb=""+Object.prototype.constructor,l0=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,qb=Object.getOwnPropertyDescriptors||function(t){var e={};return l0(t).forEach(function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)}),e},g2={},y2={get:function(t,e){if(e===_e)return t;var r=gt(t);if(!m2(r,e))return function(i,o,a){var s,c=xm(o,a);return c?"value"in c?c.value:(s=c.get)===null||s===void 0?void 0:s.call(i.k):void 0}(t,r,e);var n=r[e];return t.I||!un(n)?n:n===Sh(t.t,e)?(kh(t),t.o[e]=pc(t.A.h,n,t)):n},has:function(t,e){return e in gt(t)},ownKeys:function(t){return Reflect.ownKeys(gt(t))},set:function(t,e,r){var n=xm(gt(t),e);if(n!=null&&n.set)return n.set.call(t.k,r),!0;if(!t.P){var i=Sh(gt(t),e),o=i==null?void 0:i[_e];if(o&&o.t===r)return t.o[e]=r,t.D[e]=!1,!0;if(Ob(r,i)&&(r!==void 0||m2(t.t,e)))return!0;kh(t),$n(t)}return t.o[e]===r&&typeof r!="number"&&(r!==void 0||e in t.o)||(t.o[e]=r,t.D[e]=!0,!0)},deleteProperty:function(t,e){return Sh(t.t,e)!==void 0||e in t.t?(t.D[e]=!1,kh(t),$n(t)):delete t.D[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=gt(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.i!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty:function(){zr(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){zr(12)}},_s={};Ha(y2,function(t,e){_s[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),_s.deleteProperty=function(t,e){return _s.set.call(this,t,e,void 0)},_s.set=function(t,e,r){return y2.set.call(this,t[0],e,r,t[0])};var Gb=function(){function t(r){var n=this;this.g=zm,this.F=!0,this.produce=function(i,o,a){if(typeof i=="function"&&typeof o!="function"){var s=o;o=i;var c=n;return function(g){var x=this;g===void 0&&(g=s);for(var m=arguments.length,p=Array(m>1?m-1:0),y=1;y<m;y++)p[y-1]=arguments[y];return c.produce(g,function(w){var T;return(T=o).call.apply(T,[x,w].concat(p))})}}var l;if(typeof o!="function"&&zr(6),a!==void 0&&typeof a!="function"&&zr(7),un(i)){var d=bm(n),h=pc(n,i,void 0),u=!0;try{l=o(h),u=!1}finally{u?Yd(d):v2(d)}return typeof Promise<"u"&&l instanceof Promise?l.then(function(g){return Ch(d,a),zh(g,d)},function(g){throw Yd(d),g}):(Ch(d,a),zh(l,d))}if(!i||typeof i!="object"){if((l=o(i))===void 0&&(l=i),l===x3&&(l=void 0),n.F&&a0(l,!0),a){var f=[],v=[];An("Patches").M(i,l,f,v),a(f,v)}return l}zr(21,i)},this.produceWithPatches=function(i,o){if(typeof i=="function")return function(l){for(var d=arguments.length,h=Array(d>1?d-1:0),u=1;u<d;u++)h[u-1]=arguments[u];return n.produceWithPatches(l,function(f){return i.apply(void 0,[f].concat(h))})};var a,s,c=n.produce(i,o,function(l,d){a=l,s=d});return typeof Promise<"u"&&c instanceof Promise?c.then(function(l){return[l,a,s]}):[c,a,s]},typeof(r==null?void 0:r.useProxies)=="boolean"&&this.setUseProxies(r.useProxies),typeof(r==null?void 0:r.autoFreeze)=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var e=t.prototype;return e.createDraft=function(r){un(r)||zr(8),Ni(r)&&(r=Fb(r));var n=bm(this),i=pc(this,r,void 0);return i[_e].C=!0,v2(n),i},e.finishDraft=function(r,n){var i=r&&r[_e],o=i.A;return Ch(o,n),zh(void 0,o)},e.setAutoFreeze=function(r){this.F=r},e.setUseProxies=function(r){r&&!zm&&zr(20),this.g=r},e.applyPatches=function(r,n){var i;for(i=n.length-1;i>=0;i--){var o=n[i];if(o.path.length===0&&o.op==="replace"){r=o.value;break}}i>-1&&(n=n.slice(i+1));var a=An("Patches").$;return Ni(r)?a(r,n):this.produce(r,function(s){return a(s,n)})},t}(),Mr=new Gb,E3=Mr.produce;Mr.produceWithPatches.bind(Mr);Mr.setAutoFreeze.bind(Mr);Mr.setUseProxies.bind(Mr);Mr.applyPatches.bind(Mr);Mr.createDraft.bind(Mr);Mr.finishDraft.bind(Mr);function km(t){return un(t)?E3(t,()=>{}):t}function Kb(t){return typeof t=="function"}function d0(t,e){const[r,n,i]=Wb(e);let o;if(Kb(t))o=()=>km(t());else{const s=km(t);o=()=>s}function a(s=o(),c){let l=[r[c.type],...n.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return l.filter(d=>!!d).length===0&&(l=[i]),l.reduce((d,h)=>{if(h)if(Ni(d)){const f=h(d,c);return f===void 0?d:f}else{if(un(d))return E3(d,u=>h(u,c));{const u=h(d,c);if(u===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return u}}return d},s)}return a.getInitialState=o,a}function Wb(t){const e={},r=[];let n;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(s in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[s]=a,i},addMatcher(o,a){return r.push({matcher:o,reducer:a}),i},addDefaultCase(o){return n=o,i}};return t(i),[e,r,n]}const Yb=()=>({request:St("client/request",(e,r)=>{var n,i,o,a;return r??(r={}),(n=r.transaction)!==null&&n!==void 0||(r.transaction=_3()),(i=r.created)!==null&&i!==void 0||(r.created=Date.now()),(o=r.controller)!==null&&o!==void 0||(r.controller=new AbortController),(a=r.task)!==null&&a!==void 0||(r.task=new Tg),{payload:e,meta:r}}),retry:St("client/retry",e=>({payload:e})),success:St("client/success",(e,r)=>({payload:e,meta:r})),cancel:St("client/cancel",e=>({payload:e})),failure:St("client/failure",(e,r)=>({payload:e,meta:r})),error:St("client/error",(e,r)=>({payload:e,meta:r}))}),ot=Yb(),C3=t=>e=>e.pipe(Wt(ot.request.match),So(r=>{const{meta:{controller:n,transaction:i}}=r;return new He(o=>{if(n.signal.aborted)return o.next(ot.cancel({transaction:i,reason:`request [${i}] was aborted!`})),o.complete();o.add(e.pipe(Wt(ot.cancel.match)).subscribe(a=>{a.payload.transaction===i&&(n.signal.aborted||n.abort(),o.complete())})),o.add(Ju(n.signal,"abort").subscribe(()=>{o.next(ot.cancel({transaction:i,reason:`request [${i}] was aborted!`})),o.complete()})),o.add(or(t(r)).subscribe({next:a=>o.next(a),error:a=>o.next(ot.error(a,{request:r})),complete:()=>o.complete()}))})})),Qb=t=>(t=Object.assign({},{count:0,delay:0},t),(e,r)=>e.pipe(C3(n=>e.pipe(Wt(ot.failure.match),Wt(i=>i.meta.request===n),Qg(r),qn(([i,o])=>{var a,s;const{transaction:c}=n.meta,l=o[c];if(!l)return Oi;const d=(s=(a=l.retry)===null||a===void 0?void 0:a.length)!==null&&s!==void 0?s:0,h=Object.assign({},t,n.meta.retry);if(d>=h.count)throw h.count?Error("maximum retries executed!",{cause:i.payload}):i.payload;return(typeof h.delay=="function"?or(h.delay(i.payload.cause)).pipe(Kr(f=>{throw Error("failed to resolve delay",{cause:f})})):_y(h.delay)).pipe(Ge(()=>ot.retry(n)))}))))),Xb=t=>e=>e.pipe(C3(r=>or(t(r.payload,r.meta.controller.signal)).pipe(Ge(n=>ot.success(n,{request:r})),Kr(n=>Di(ot.failure(Error(`failed to execute request for transaction ${r.meta.transaction}`,{cause:n}),{request:r})))))),Jb=t=>t.pipe(Wt(ot.retry.match),Ge(e=>e.payload)),z3=()=>Wt(t=>t.status==="complete"),Zb=(t={})=>d0(t,e=>e.addCase(ot.request,(r,n)=>{const{transaction:i,task:o,ref:a,created:s}=n.meta;r[i]={transaction:i,task:o,ref:a,created:s}}).addCase(ot.success,(r,n)=>{const{request:i}=n.meta,{transaction:o,ref:a}=i.meta,s=r[o];if(s){const c={status:"complete",transaction:o,ref:a,value:n.payload,args:i.payload,created:s.created,completed:Date.now()};s.task.next(c),s.task.complete()}delete r[o]}).addCase(ot.retry,(r,n)=>{var i;const{transaction:o}=n.payload.meta,a=r[o];a&&((i=a.retry)!==null&&i!==void 0||(a.retry=[]),a.retry.push(Date.now()))}).addCase(ot.cancel,(r,n)=>{const{transaction:i,reason:o}=n.payload;if(r[i]){const a=Object.assign({},_m(r[i]));a.task.error(new p2("abort",{request:a,message:o??"request was canceled"})),delete r[i]}}).addCase(ot.failure,(r,n)=>{var i;const{payload:o,meta:a}=n,{transaction:s}=a.request.meta,c=r[s];c&&((i=c.errors)!==null&&i!==void 0||(c.errors=[]),c.errors.push(o))}).addCase(ot.error,(r,n)=>{const{payload:i,meta:o}=n,{transaction:a}=o.request.meta;if(r[a]){const s=Object.assign({},_m(r[a]));s.task.error(new p2("error",{request:s,message:`failed to process task [${a}]`,cause:i.cause})),delete r[a]}}));var ew=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},et=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Am=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},it,to;class Tm extends He{get closed(){return et(this,it,"f").closed}get state$(){return et(this,it,"f")}get action$(){return et(this,it,"f").action$}get success$(){return this.action$.pipe(Wt(ot.success.match),Ge(({payload:e})=>e))}get error$(){return this.action$.pipe(b3("client/error"),Qg(et(this,it,"f")),Ge(([e,r])=>{const{payload:n,meta:i}=e,{transaction:o}=i.request.meta,a=r[e.meta.request.meta.transaction];return new p2("error",{request:a,message:`failed to process task [${o}]`,cause:n})}))}constructor(e,r){super(o=>et(this,it,"f").subscribe(o)),it.set(this,void 0),to.set(this,void 0);const n={};Am(this,it,new t0(Zb(n)),"f"),Am(this,to,new fn(()=>et(this,it,"f").complete()),"f"),et(this,to,"f").add(et(this,it,"f").addFlow(Xb(e))),et(this,to,"f").add(et(this,it,"f").addFlow(Jb));const i=Object.assign({count:0,delay:0},r==null?void 0:r.retry);et(this,to,"f").add(et(this,it,"f").addFlow(Qb(i)))}next(e,r){const n=ot.request(e,r);return et(this,it,"f").next(n),n.meta}nextAsync(e,r){return ew(this,void 0,void 0,function*(){return an(this.next(e,r).task.pipe(z3()))})}getTaskByTransaction(e){const r=et(this,it,"f").value[e];return r&&r.task}getTaskByRef(e){const r=Object.values(et(this,it,"f").value).find(n=>n.ref===e);return r&&r.task}cancel(e,r){if(e&&et(this,it,"f").value[e])r??(r=`[${e}]: transaction canceled`),et(this,it,"f").next(ot.cancel({transaction:e,reason:r}));else for(const n of Object.keys(et(this,it,"f").value))this.cancel(n,`[${e}]: all transactions canceled`)}on(e,r){return et(this,it,"f").addEffect(ot[e].type,n=>{r(n,this)})}complete(){et(this,to,"f").unsubscribe()}asObservable(){return et(this,it,"f").asObservable()}}it=new WeakMap,to=new WeakMap;function tw(){return{set:St("cache/set",(t,e)=>({payload:{key:t,entry:e}})),remove:St("cache/remove",t=>({payload:t})),invalidate:St("cache/invalidate",t=>({payload:t})),trim:St("cache/trim",t=>({payload:t}))}}const Do=tw(),rw=(t,e)=>{var r,n;return((r=e.updated)!==null&&r!==void 0?r:0)-((n=t.updated)!==null&&n!==void 0?n:0)};function nw(t,e={}){return d0(e,r=>r.addCase(t.set,(n,i)=>{var o;const{key:a,entry:s}=i.payload,c=n[a];c?(c.updated=Date.now(),(o=c.updates)!==null&&o!==void 0||(c.updates=0),c.updates++):n[a]=Object.assign(Object.assign({},s),{created:Date.now()})}).addCase(t.remove,(n,i)=>{delete n[i.payload]}).addCase(t.invalidate,(n,i)=>{const o=n[i.payload];o&&delete o.updated}).addCase(t.trim,(n,i)=>{var o,a;const{payload:s}=i,c=(o=s.sort)!==null&&o!==void 0?o:rw,l=Object.keys(n),d=Object.entries(n).filter(([h,u])=>!s.validate||s.validate(u)).sort((h,u)=>c(h[1],u[1])).slice(0,(a=s.size)!==null&&a!==void 0?a:Number.MAX_SAFE_INTEGER).map(([h])=>h);if(l.length!==d.length)for(const h of l){const u=d.indexOf(h);u!==-1?d.splice(u,1):delete n[h]}}))}var gn=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},iw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Er;class Im{get state$(){return gn(this,Er,"f").asObservable()}constructor(e){Er.set(this,void 0);const{trimming:r,initial:n}=e;iw(this,Er,new t0(nw(Do,n)),"f"),r&&gn(this,Er,"f").addEffect("cache/set",()=>gn(this,Er,"f").next(Do.trim(r)))}setItem(...e){gn(this,Er,"f").next(Do.set(...e))}getItem(e){return gn(this,Er,"f").value[e]}removeItem(e){gn(this,Er,"f").next(Do.remove(e))}invalidate(e){gn(this,Er,"f").next(Do.invalidate(e))}trim(e){gn(this,Er,"f").next(Do.trim(e))}reset(){gn(this,Er,"f").reset()}complete(){gn(this,Er,"f").complete()}}Er=new WeakMap;var Le=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},No=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ow=globalThis&&globalThis.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r},ro,Jr,ui,Bo,qo,ql,_2;const aw=(t=0)=>e=>{var r;return((r=e.updated)!==null&&r!==void 0?r:0)+t>Date.now()};class on{get client(){return Le(this,Jr,"f")}get cache(){return Le(this,ui,"f")}constructor(e){var r,n;ro.set(this,new fn),Jr.set(this,void 0),ui.set(this,void 0),Bo.set(this,new Yn),qo.set(this,void 0),ql.set(this,void 0),_2.set(this,_3()),No(this,qo,o=>Tb(e.key(o),Le(this,_2,"f")),"f"),No(this,ql,(r=e==null?void 0:e.validate)!==null&&r!==void 0?r:aw(e==null?void 0:e.expire),"f"),e.client instanceof Tm?No(this,Jr,e.client,"f"):(No(this,Jr,new Tm(e.client.fn,e.client.options),"f"),Le(this,ro,"f").add(()=>Le(this,Jr,"f").complete())),e.cache instanceof Im?No(this,ui,e.cache,"f"):(No(this,ui,new Im(e.cache||{}),"f"),Le(this,ro,"f").add(()=>Le(this,ui,"f").complete()));const i=(n=e.queueOperator)!==null&&n!==void 0?n:vb;Le(this,ro,"f").add(()=>Le(this,Bo,"f").complete()),Le(this,ro,"f").add(Le(this,Bo,"f").pipe(i(({args:o,options:a})=>new He(s=>{const{task:c,transaction:l}=Le(this,Jr,"f").next(o,a);s.add(c.pipe(Kr(()=>Oi)).subscribe(s)),s.add(()=>{setTimeout(()=>Le(this,Jr,"f").cancel(l))})})),z3(),Yg(()=>!Le(this,Jr,"f").closed)).subscribe(o=>{const{args:a,value:s,transaction:c,ref:l}=o,d=l??Le(this,qo,"f").call(this,a);Le(this,ui,"f").setItem(d,{value:s,args:a,transaction:c})}))}next(e,r){Le(this,Bo,"f").next({args:e,options:r})}query(e,r){var n;const i=Le(this,qo,"f").call(this,e);return(n=Le(this,Jr,"f").getTaskByRef(i))!==null&&n!==void 0?n:this._createTask(i,e,r)}queryAsync(e,r){const n=r||{},{awaitResolve:i}=n,o=ow(n,["awaitResolve"]);return(i?po:an)(this._query(e,o))}complete(){Le(this,ro,"f").unsubscribe()}_query(e,r){var n;const i=Le(this,qo,"f").call(this,e);return(n=Le(this,Jr,"f").getTaskByRef(i))!==null&&n!==void 0?n:this._createTask(i,e,r)}_createTask(e,r,n){var i;const o=new Tg,a=Le(this,ui,"f").getItem(e);if(a){const{value:l,args:d,created:h,updated:u,updates:f,transaction:v}=a,g={status:"cache",value:l,args:d,created:h,updated:u,updates:f,transaction:v};o.next(g)}const s=((i=n==null?void 0:n.cache)===null||i===void 0?void 0:i.validate)||Le(this,ql,"f");return a&&s(a,r)?o.complete():Le(this,Bo,"f").next({args:r,options:{ref:e,task:o}}),o.asObservable()}}ro=new WeakMap,Jr=new WeakMap,ui=new WeakMap,Bo=new WeakMap,qo=new WeakMap,ql=new WeakMap,_2=new WeakMap;on.extractQueryValue=gb;var li=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Mm=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},bs,Dn;class sw extends He{get currentContext(){return li(this,Dn,"f").value}get currentContext$(){return li(this,Dn,"f").asObservable()}get client(){return li(this,bs,"f")}constructor(e){super(r=>li(this,Dn,"f").subscribe(r)),bs.set(this,void 0),Dn.set(this,void 0),Mm(this,bs,new on(e),"f"),Mm(this,Dn,new x1(void 0),"f")}setCurrentContext(e){typeof e=="string"?this.resolveContext(e).pipe(Kr(()=>Oi)).subscribe(r=>li(this,Dn,"f").next(r)):e!==li(this,Dn,"f").value&&li(this,Dn,"f").next(e)}resolveContext(e){return li(this,bs,"f").query({id:e}).pipe(Ge(r=>r.value))}}bs=new WeakMap,Dn=new WeakMap;var bt=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Vo=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Nn,Gl,ws,Go,Kl,xs,Wl;class cw{get contextClient(){return bt(this,Nn,"f")}get queryClient(){return bt(this,Gl,"f")}get currentContext$(){return bt(this,Nn,"f").currentContext$}get currentContext(){return bt(this,Nn,"f").currentContext}set currentContext(e){bt(this,ws,"f")?bt(this,ws,"f").dispatchEvent("onCurrentContextChange",{source:this,canBubble:!0,cancelable:!0,detail:{context:e}}).then(r=>{r.canceled||bt(this,Nn,"f").setCurrentContext(e)}):bt(this,Nn,"f").setCurrentContext(e)}constructor(e){var r;Nn.set(this,void 0),Gl.set(this,void 0),ws.set(this,void 0),Go.set(this,new fn),Kl.set(this,void 0),xs.set(this,void 0),Wl.set(this,void 0);const{config:n,event:i,parentContext:o}=e;Vo(this,Kl,n.contextType,"f"),Vo(this,xs,n.contextFilter,"f"),Vo(this,Nn,new sw(n.client.get),"f"),Vo(this,Gl,new on(n.client.query),"f"),Vo(this,Wl,(r=n.contextParameterFn)!==null&&r!==void 0?r:a=>({search:a.search,filter:{type:a.type}}),"f"),i&&(Vo(this,ws,i,"f"),bt(this,Go,"f").add(bt(this,Nn,"f").currentContext$.pipe(Zu()).subscribe(([a,s])=>{i.dispatchEvent("onCurrentContextChanged",{source:this,canBubble:!0,detail:{previous:a,next:s}})})),bt(this,Go,"f").add(i.addEventListener("onCurrentContextChanged",a=>{a.source!==this&&(this.currentContext=a.detail.next)}))),o&&bt(this,Go,"f").add(o.contextClient.currentContext$.subscribe(a=>this.currentContext=a))}queryContext(e){const r=this.queryClient.query(bt(this,Wl,"f").call(this,{search:e,type:bt(this,Kl,"f")})).pipe(Ge(n=>n.value));return bt(this,xs,"f")?r.pipe(Ge(bt(this,xs,"f"))):r}queryContextAsync(e){return po(this.queryContext(e))}clearCurrentContext(){this.currentContext=void 0}dispose(){bt(this,Go,"f").unsubscribe()}}Nn=new WeakMap,Gl=new WeakMap,ws=new WeakMap,Go=new WeakMap,Kl=new WeakMap,xs=new WeakMap,Wl=new WeakMap;var lw=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const dw="context",hw={name:dw,configure:()=>new mb,initialize:t=>lw(void 0,void 0,void 0,function*(){var e;const r=yield t.config.createConfig(t),n=t.hasModule("event")?yield t.requireInstance("event"):void 0,i=(e=t.ref)===null||e===void 0?void 0:e.context;return new cw({config:r,event:n,parentContext:i})}),dispose:t=>{t.instance.dispose()}};var uw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fw=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Yl;class pw{constructor(e,r={}){this.config=r,Yl.set(this,void 0),uw(this,Yl,e,"f")}requireInstance(e){return fw(this,Yl,"f").requireInstance(e)}setAppClient(e,r=1*60*1e3){this.config.client={getAppManifest:typeof e.getAppManifest=="function"?{key:({appKey:n})=>n,client:{fn:e.getAppManifest},expire:r}:e.getAppManifest,getAppManifests:typeof e.getAppManifests=="function"?{key:()=>"app_manifests",client:{fn:e.getAppManifests},expire:r}:e.getAppManifests,getAppConfig:typeof e.getAppConfig=="function"?{key:n=>JSON.stringify(n),client:{fn:e.getAppConfig},expire:r}:e.getAppConfig}}}Yl=new WeakMap;const mw=()=>({setManifest:St("set_manifest",t=>({payload:t,meta:{created:Date.now()}})),fetchManifest:Eh("fetch_manifest",t=>({payload:t}),t=>({payload:t}),t=>({payload:t})),setConfig:St("set_config",t=>({payload:t})),fetchConfig:Eh("fetch_config",t=>({payload:t}),t=>({payload:t}),t=>({payload:t})),setModule:St("set_module",t=>({payload:t})),importApp:Eh("import_app",t=>({payload:t}),t=>({payload:t}),t=>({payload:t})),setInstance:St("set_instance",t=>({payload:t}))}),ct=mw();Ub();const vw=t=>d0(Object.assign(Object.assign({},t),{status:new Set}),e=>e.addCase(ct.setManifest,(r,n)=>{r.manifest=n.payload}).addCase(ct.setConfig,(r,n)=>{r.config=n.payload}).addCase(ct.setModule,(r,n)=>{r.modules=n.payload}).addCase(ct.setInstance,(r,n)=>{r.instance=n.payload}).addMatcher(Mb,(r,n)=>{r.status.add(ym(n))}).addMatcher(Hb,(r,n)=>{r.status.delete(ym(n))})),gw="modulepreload",yw=function(t){return"/"+t},Pm={},S3=function(e,r,n){if(!r||r.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(r.map(o=>{if(o=yw(o),o in Pm)return;Pm[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!n)for(let d=i.length-1;d>=0;d--){const h=i[d];if(h.href===o&&(!a||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const l=document.createElement("link");if(l.rel=a?"stylesheet":gw,a||(l.as="script",l.crossOrigin=""),l.href=o,document.head.appendChild(l),a)return new Promise((d,h)=>{l.addEventListener("load",d),l.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())},_w=t=>e=>e.pipe(Wt(ct.fetchManifest.match),qn(({payload:r})=>{const n=or(t.getAppManifest(r)).pipe(Wt(i=>!!i),Ge(ct.setManifest));return Gg(n,n.pipe(Yf(),Ge(({payload:i})=>ct.fetchManifest.success(i)))).pipe(Kr(i=>Di(ct.fetchManifest.failure(i))))})),bw=t=>e=>e.pipe(Wt(ct.fetchConfig.match),qn(({payload:r})=>{const n=or(t.getAppConfig(r)).pipe(Ge(ct.setConfig));return Gg(n,n.pipe(Yf(),Ge(({payload:i})=>ct.fetchConfig.success(i)))).pipe(Kr(i=>Di(ct.fetchConfig.failure(i))))})),ww=()=>t=>t.pipe(Wt(ct.importApp.match),qn(({payload:e})=>or(S3(()=>import(e),[])).pipe(Ge(ct.importApp.success),Kr(r=>Di(ct.importApp.failure(r)))))),xw=(t,e)=>{const r=vw(t),n=new t0(r);return n.addFlow(_w(e)),n.addFlow(bw(e)),n.addFlow(ww()),n};var Ew=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},xe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Cw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ve;function ua(){return Wt(t=>t!=null)}class Rm{get manifest$(){return xe(this,ve,"f").pipe(Ge(({manifest:e})=>e),ua())}get config$(){return xe(this,ve,"f").pipe(Ge(({config:e})=>e),ua())}get modules$(){return xe(this,ve,"f").pipe(Ge(({modules:e})=>e),ua())}get instance$(){return xe(this,ve,"f").pipe(Ge(({instance:e})=>e),ua())}get appKey(){return xe(this,ve,"f").value.appKey}get manifest(){return an(this.manifest$)}get config(){return an(this.config$)}get instance(){return xe(this,ve,"f").value.instance}constructor(e,r){ve.set(this,void 0),Cw(this,ve,xw(e,r.provider),"f");const{appKey:n}=e,i=new fn;r.event&&i.add(r.event.addEventListener("onAppModulesLoaded",o=>{o.detail.appKey===n&&xe(this,ve,"f").next(ct.setInstance(o.detail.modules))})),this.dispose=()=>{xe(this,ve,"f").value.instance&&xe(this,ve,"f").value.instance.dispose(),i.unsubscribe(),xe(this,ve,"f").complete()}}initialize(){return dy([this.getManifest(),this.getAppModule(),this.getConfig()])}loadConfig(){xe(this,ve,"f").next(ct.fetchConfig(this.appKey))}loadManifest(){xe(this,ve,"f").next(ct.fetchManifest(this.appKey))}loadAppModule(e=!0){return Ew(this,void 0,void 0,function*(){const r=yield this.getManifestAsync(e);xe(this,ve,"f").next(ct.importApp(r.entry))})}getConfig(e=!1){return new He(r=>{if(xe(this,ve,"f").value.config&&(r.next(xe(this,ve,"f").value.config),!e))return r.complete();r.add(xe(this,ve,"f").addEffect("set_config",({payload:n})=>{r.next(n)})),r.add(xe(this,ve,"f").addEffect("fetch_config::success",({payload:n})=>{r.next(n),r.complete()})),r.add(xe(this,ve,"f").addEffect("fetch_config::failure",({payload:n})=>{r.error(Error("failed to load application config",{cause:n}))})),this.loadConfig()})}getConfigAsync(e=!0){return(e?an:po)(this.getConfig(!e))}getManifest(e=!1){return new He(r=>{if(xe(this,ve,"f").value.manifest&&(r.next(xe(this,ve,"f").value.manifest),!e))return r.complete();r.add(xe(this,ve,"f").addEffect("set_manifest",({payload:n})=>{r.next(n)})),r.add(xe(this,ve,"f").addEffect("fetch_manifest::success",({payload:n})=>{r.next(n),r.complete()})),r.add(xe(this,ve,"f").addEffect("fetch_manifest::failure",({payload:n})=>{r.error(Error("failed to load application manifest",{cause:n}))})),this.loadManifest()})}getManifestAsync(e=!0){return(e?an:po)(this.getManifest(!e))}getAppModule(e=!1){return new He(r=>{if(xe(this,ve,"f").value.modules&&(r.next(xe(this,ve,"f").value.modules),!e))return r.complete();r.add(xe(this,ve,"f").addEffect("set_module",({payload:n})=>{r.next(n)})),r.add(xe(this,ve,"f").addEffect("import_app::success",({payload:n})=>{r.next(n),r.complete()})),r.add(xe(this,ve,"f").addEffect("import_app::failure",({payload:n})=>{r.error(Error("failed to load application modules from script",{cause:n}))})),r.add(this.getManifest().subscribe(n=>Di(xe(this,ve,"f").next(ct.importApp(n.entry)))))})}getAppModuleAsync(e=!0){return(e?an:po)(this.getAppModule(!e))}}ve=new WeakMap;class Pi extends Error{static fromHttpResponse(e,r){switch(e.status){case 401:return new Pi("unauthorized","failed to load application manifest, request not authorized",r);case 404:return new Pi("not_found","application manifest not found",r)}return new Pi("unknown",`failed to load application manifest, status code ${e.status}`,r)}constructor(e,r,n){super(r,n),this.type=e}}class go extends Error{static fromHttpResponse(e,r){switch(e.status){case 401:return new go("unauthorized","failed to load application config, request not authorized",r);case 404:return new go("not_found","application config not found",r)}return new go("unknown",`failed to load application config, status code ${e.status}`,r)}constructor(e,r,n){super(r,n),this.type=e}}var Zt=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},gl=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Es,Cs,no,fi,Ql;class zw{static compareAppManifest(e,r){return JSON.stringify(e)===JSON.stringify(r)}get current(){return Zt(this,no,"f").value}get current$(){return Zt(this,no,"f").pipe(ua(),Ey("appKey"))}constructor(e){Es.set(this,void 0),Cs.set(this,void 0),no.set(this,void 0),fi.set(this,new fn),Ql.set(this,void 0);const{event:r,config:n}=e;gl(this,Ql,r,"f"),gl(this,no,new x1(void 0),"f"),this.appClient=new on(n.client.getAppManifest),gl(this,Es,new on(n.client.getAppManifests),"f"),gl(this,Cs,new on(n.client.getAppConfig),"f"),Zt(this,fi,"f").add(()=>this.appClient.complete()),Zt(this,fi,"f").add(()=>Zt(this,Es,"f").complete()),Zt(this,fi,"f").add(()=>Zt(this,Cs,"f").complete()),Zt(this,fi,"f").add(this.current$.pipe(Zu(),Yg(()=>!!r)).subscribe(([i,o])=>{r==null||r.dispatchEvent("onCurrentAppChanged",{source:this,detail:{previous:i,next:o}})})),Zt(this,fi,"f").add(Zt(this,no,"f").pipe(Zu(),Ge(([i])=>i),ua()).subscribe(i=>i.dispose()))}getAppManifest(e){return on.extractQueryValue(this.appClient.query({appKey:e}).pipe(Kr(r=>{const{cause:n}=r;throw n instanceof Pi?n:n instanceof r2?Pi.fromHttpResponse(n.response,{cause:n}):new Pi("unknown","failed to load manifest",{cause:n})})))}getAllAppManifests(){return on.extractQueryValue(Zt(this,Es,"f").query())}getAppConfig(e,r){return on.extractQueryValue(Zt(this,Cs,"f").query({appKey:e,tag:r}).pipe(Kr(n=>{const{cause:i}=n;throw i instanceof go?i:i instanceof r2?go.fromHttpResponse(i.response,{cause:i}):new go("unknown","failed to load config",{cause:i})})))}setCurrentApp(e){const r=typeof e=="string"?this.createApp({appKey:e}):Rm;Zt(this,no,"f").next(r)}createApp(e){return new Rm(e,{provider:this,event:Zt(this,Ql,"f")})}dispose(){Zt(this,fi,"f").unsubscribe()}}Es=new WeakMap,Cs=new WeakMap,no=new WeakMap,fi=new WeakMap,Ql=new WeakMap;var Sw=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const b2="app",kw={name:b2,configure:()=>new Aw,initialize:t=>Sw(void 0,void 0,void 0,function*(){const e=yield t.config.createConfig(t),r=yield t.requireInstance("event").catch(()=>{});return new zw({config:e,event:r})}),dispose:t=>{t.instance.dispose()}};var yl=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},Hm=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Xl;class Aw{constructor(){this.defaultExpireTime=1*60*1e3,Xl.set(this,[])}addConfigBuilder(e){Hm(this,Xl,"f").push(e)}_createHttpClient(e){return yl(this,void 0,void 0,function*(){const r=yield e.requireInstance("http");if(r.hasClient(b2))return r.createClient(b2);{const n=yield e.requireInstance("serviceDiscovery");try{return yield n.createClient("app")}catch{return yield n.createClient("portal")}}})}createConfig(e){var r;return yl(this,void 0,void 0,function*(){const n=yield Hm(this,Xl,"f").reduce((i,o)=>yl(this,void 0,void 0,function*(){const a=new pw(e,yield i);return yield Promise.resolve(o(a)),Object.assign(i,a.config)}),Promise.resolve({}));return(r=n.client)!==null&&r!==void 0||(n.client=yield(()=>yl(this,void 0,void 0,function*(){const i=yield this._createHttpClient(e);return{getAppManifest:{client:{fn:({appKey:o})=>i.json$(`/api/apps/${o}`)},key:({appKey:o})=>o,expire:this.defaultExpireTime},getAppManifests:{client:{fn:()=>i.json$("/api/apps")},key:o=>JSON.stringify(o),expire:this.defaultExpireTime},getAppConfig:{client:{fn:({appKey:o,tag:a})=>i.json$(`/api/apps/${o}/config${a?`?tag=${a}`:""}`)},key:o=>JSON.stringify(o),expire:this.defaultExpireTime}}}))()),n})}}Xl=new WeakMap;var Lm=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class Tw{constructor(e){this.clientKey=e.clientKey,this.endpoint=e.endpoint,this.clientCtor=e.clientCtor}createHttpClientClient(e){return Lm(this,void 0,void 0,function*(){if(!this.clientKey)throw Error("no http client for service discovery is provided!");return e.createClient(this.clientKey)})}createClient(e){return Lm(this,void 0,void 0,function*(){if(!this.endpoint)throw Error("no endpoint defined!");return new this.clientCtor({http:e,endpoint:this.endpoint})})}}var Ah=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class Iw{constructor(e,r){this._client=e,this._http=r}get environment(){return this._client.environment}resolveService(e){return Ah(this,void 0,void 0,function*(){return this._client.resolveService(e)})}createClient(e,r){return Ah(this,void 0,void 0,function*(){const n=yield this.resolveService(e);if(!n)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient(Object.assign(Object.assign({},r),{baseUri:n.uri,defaultScopes:n.defaultScopes}))})}configureClient(e,r){return Ah(this,void 0,void 0,function*(){const{key:n,alias:i}=typeof e=="string"?{key:e,alias:e}:e,{uri:o,defaultScopes:a}=yield this.resolveService(n);r.addConfig(Zg(i,{baseUri:o,defaultScopes:a}))})}}var Om=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})},Mw=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Pw=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Jl;class Rw{get environment(){return an(on.extractQueryValue(Mw(this,Jl,"f").query(void 0,{cache:{suppressInvalid:!0}})))}constructor({http:e,endpoint:r}){Jl.set(this,void 0),this.http=e,this.endpoint=r,Pw(this,Jl,new on({client:{fn:()=>e.fetch$(r,{selector:this.selector.bind(this)}).pipe(e2(n=>console.log("🔥",n)))},key:()=>"services",expire:5*60*1e3}),"f")}selector(e){return Om(this,void 0,void 0,function*(){const r=yield e.json(),n=r.services.reduce((i,o)=>Object.assign(i,{[o.key]:{clientId:r.clientId,uri:o.uri,defaultScopes:[r.clientId+"/.default"]}}),{});return Object.assign(Object.assign({},r),{services:n})})}resolveService(e){return Om(this,void 0,void 0,function*(){try{const{services:r}=yield this.environment;return r[e]}catch(r){throw console.error(r),r}})}}Jl=new WeakMap;const Hw="serviceDiscovery";var Lw=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const Ow={name:Hw,configure:()=>new Tw({clientCtor:Rw,clientKey:"service_discovery",endpoint:"/_discovery/environments/current"}),initialize:({config:t,requireInstance:e})=>Lw(void 0,void 0,void 0,function*(){const r=yield e("http"),n=yield t.createHttpClientClient(r),i=yield t.createClient(n);return new Iw(i,r)})};class Dw{}class k3 extends Error{constructor(e,r){super(`unsupported version ${e}`,{cause:r}),this.version=e}}const Nw=(t,e)=>{var r;const n=(r=Jn[t])!==null&&r!==void 0?r:t;switch(n){case Jn.v2:throw new k3(t);case Jn.v1:default:{const{id:i}=e,o=new URLSearchParams;return o.append("api-version",n),`/contexts/${i}/?${String(o)}`}}},Vw=(t,e,r)=>[Nw(t,e),r],Fw=(t,e,r="json")=>(n,i)=>t[r](...Vw(e,n,i));var Uw=["eq","ne","gt","ge","lt","le"],_l=["and","or","not"],$w=["any","all"],jw=["startswith","endswith","contains"],Bw=["expand","levels","select","skip","top","count","orderby","filter"],Dm=/\((.*)\)/,Nm=/(?!indexof)\((\w+)\)/,Vm;(function(t){t.sum="sum",t.min="min",t.max="max",t.average="average",t.countdistinct="countdistinct"})(Vm||(Vm={}));var Ln="";function qw(t){var e=t===void 0?{}:t,r=e.select,n=e.search,i=e.skiptoken,o=e.format,a=e.top,s=e.skip,c=e.filter,l=e.transform,d=e.orderBy,h=e.key,u=e.count,f=e.expand,v=e.action,g=e.func,x="",m=[],p={};if(h!=null&&(x+="(".concat(Cn(h,m),")")),(c||typeof u=="object")&&(p.$filter=vc(typeof u=="object"?u:c,m)),l&&(p.$apply=A3(l)),f&&(p.$expand=Zl(f)),d&&(p.$orderby=h0(d)),u&&(typeof u=="boolean"?p.$count=!0:x+="/$count"),typeof a=="number"&&(p.$top=a),typeof s=="number"&&(p.$skip=s),v&&(x+="/".concat(v)),g){if(typeof g=="string")x+="/".concat(g);else if(typeof g=="object"){var y=Object.keys(g)[0],w=Cn(g[y],m);x+="/".concat(y),w!==""&&(x+="(".concat(w,")"))}}return m.length>0&&Object.assign(p,m.reduce(function(T,O){var F;return Object.assign(T,(F={},F["@".concat(O.name)]=Cn(O.value),F))},{})),Qw(x,lt({$select:r,$search:n,$skiptoken:i,$format:o},p))}function Th(t,e,r){return r===void 0&&(r=[]),"".concat(t," eq ").concat(Cn(e,r))}function vc(t,e,r){return t===void 0&&(t={}),e===void 0&&(e=[]),r===void 0&&(r=""),(Array.isArray(t)?t:[t]).reduce(function(o,a){if(a){var s=n(a,e,r);s&&o.push(s)}return o},[]).join(" and ");function n(o,a,s){o===void 0&&(o={}),a===void 0&&(a=[]),s===void 0&&(s="");var c="";if(typeof o=="string")c=o;else if(o&&typeof o=="object"){var l=Object.keys(o).reduce(function(d,h){var u=o[h];if(u===void 0)return d;var f="";if(s?h===Ln?f=s:Nm.test(h)?f=h.replace(Nm,function(p,y){return y.trim()===Ln?"(".concat(s,")"):"(".concat(s,"/").concat(y.trim(),")")}):Dm.test(h)?f=h.replace(Dm,function(p,y){return y.trim()===Ln?"(".concat(s,")"):"(".concat(s,"/").concat(y.trim(),")")}):f="".concat(s,"/").concat(h):f=h,h===Ln&&Array.isArray(u))return d.concat(u.map(function(p){return Th(f,p)}));if(["number","string","boolean"].indexOf(typeof u)!==-1||u instanceof Date||u===null)d.push(Th(f,u,a));else if(Array.isArray(u)){var v=h,g=u.map(function(p){return vc(p,a,s)}).filter(function(p){return p}).map(function(p){return _l.indexOf(v)!==-1?"(".concat(p,")"):p});g.length&&(_l.indexOf(v)!==-1?g.length&&(v==="not"?d.push(Fm(g)):d.push("(".concat(g.join(" ".concat(v," ")),")"))):d.push(g.join(" ".concat(v," "))))}else if(_l.indexOf(f)!==-1){var x=f,g=Object.keys(u).map(function(y){var w;return n((w={},w[y]=u[y],w))});g.length&&(x==="not"?d.push(Fm(g)):d.push("(".concat(g.join(" ".concat(x," ")),")")))}else if(typeof u=="object")if("type"in u)d.push(Th(f,u,a));else{var m=Object.keys(u);m.forEach(function(p){if(u[p]!==void 0)if(Uw.indexOf(p)!==-1)d.push("".concat(f," ").concat(p," ").concat(Cn(u[p],a)));else if(_l.indexOf(p)!==-1)Array.isArray(u[p])?d.push(u[p].map(function(O){return"("+n(O,a,f)+")"}).join(" ".concat(p," "))):d.push("("+n(u[p],a,f)+")");else if($w.indexOf(p)!==-1){var y=i(h.toLowerCase(),u[p],p,f);y&&d.push(y)}else if(p==="has")d.push("".concat(f," ").concat(p," ").concat(Cn(u[p],a)));else if(p==="in"){var w=Array.isArray(u[p])?u[p]:u[p].value.map(function(O){return{type:u[p].type,value:O}});d.push(f+" in ("+w.map(function(O){return Cn(O,a)}).join(",")+")")}else if(jw.indexOf(p)!==-1)d.push("".concat(p,"(").concat(f,",").concat(Cn(u[p],a),")"));else{var T=n(u,a,f);T&&d.push(T)}})}else throw new Error("Unexpected value type: ".concat(u));return d},[]);c=l.join(" and ")}return c}function i(o,a,s,c){var l="";if(typeof a=="string"||a instanceof String)l=Gw(o,a,s,c);else if(a){var d=Array.isArray(a)?a.reduce(function(u,f){return f.hasOwnProperty(Ln)?(u.hasOwnProperty(Ln)||(u[Ln]=[]),u[Ln].push(f[Ln]),u):lt(lt({},u),f)},{}):a,h=n(d,e,o);l="".concat(c,"/").concat(s,"(").concat(h?"".concat(o,":").concat(h):"",")")}return l}}function Gw(t,e,r,n){var i="",o=r=="all"?"ne":"eq";return i="".concat(n,"/").concat(r,"(").concat(t,": ").concat(t," ").concat(o," '").concat(e,"')"),i}function Kw(t){return t=t.replace(/%/g,"%25"),t=t.replace(/\+/g,"%2B"),t=t.replace(/\//g,"%2F"),t=t.replace(/\?/g,"%3F"),t=t.replace(/#/g,"%23"),t=t.replace(/&/g,"%26"),t=t.replace(/'/g,"''"),t}function Cn(t,e){if(typeof t=="string")return"'".concat(Kw(t),"'");if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return"[".concat(t.map(function(r){return Cn(r)}).join(","),"]");if(t===null)return t;if(typeof t=="object")switch(t.type){case"raw":case"guid":return t.value;case"duration":return"duration'".concat(t.value,"'");case"binary":return"binary'".concat(t.value,"'");case"alias":return Array.isArray(e)&&e.push(t),"@".concat(t.name);case"json":return escape(JSON.stringify(t.value));case"decimal":return"".concat(t.value,"M");default:return Object.entries(t).filter(function(r){var n=r[1];return n!==void 0}).map(function(r){var n=r[0],i=r[1];return"".concat(n,"=").concat(Cn(i,e))}).join(",")}return t}function Zl(t){if(typeof t=="number")return t;if(typeof t=="string")return t.indexOf("/")===-1?t:t.split("/").reverse().reduce(function(r,n,i,o){return i===0?"$expand=".concat(n):i===o.length-1?"".concat(n,"(").concat(r,")"):"$expand=".concat(n,"(").concat(r,")")},"");if(Array.isArray(t))return"".concat(t.map(function(r){return Zl(r)}).join(","));if(typeof t=="object"){var e=Object.keys(t);return e.some(function(r){return Bw.indexOf(r.toLowerCase())!==-1})?e.map(function(r){var n;switch(r){case"filter":n=vc(t[r]);break;case"orderBy":n=h0(t[r]);break;case"levels":case"count":case"skip":case"top":n="".concat(t[r]);break;default:n=Zl(t[r])}return"$".concat(r.toLowerCase(),"=").concat(n)}).join(";"):e.map(function(r){var n=Zl(t[r]);return n?"".concat(r,"(").concat(n,")"):r}).join(",")}return""}function A3(t){var e=Array.isArray(t)?t:[t],r=e.reduce(function(n,i){var o=i.aggregate,a=i.filter,s=i.groupBy,c=Cg(i,["aggregate","filter","groupBy"]),l=Object.keys(c);if(l.length)throw new Error("Unsupported transform(s): ".concat(l));if(o&&n.push("aggregate(".concat(Ww(o),")")),a){var d=vc(a);d&&n.push("filter(".concat(vc(d),")"))}return s&&n.push("groupby(".concat(Yw(s),")")),n},[]);return r.join("/")||void 0}function Ww(t){var e=Array.isArray(t)?t:[t];return e.map(function(r){return typeof r=="string"?r:Object.keys(r).map(function(n){var i=r[n];if(!i.with)throw new Error("'with' property required for '".concat(n,"'"));if(!i.as)throw new Error("'as' property required for '".concat(n,"'"));return"".concat(n," with ").concat(i.with," as ").concat(i.as)})}).join(",")}function Yw(t){if(!t.properties)throw new Error("'properties' property required for groupBy");var e="(".concat(t.properties.join(","),")");return t.transform&&(e+=",".concat(A3(t.transform))),e}function h0(t,e){return e===void 0&&(e=""),Array.isArray(t)?t.map(function(r){return Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r}).map(function(r){return"".concat(e).concat(String(r))}).join(","):typeof t=="object"?Object.entries(t).map(function(r){var n=r[0],i=r[1];return h0(i,"".concat(n,"/"))}).map(function(r){return"".concat(e).concat(r)}).join(","):"".concat(e).concat(String(t))}function Qw(t,e){var r=Object.getOwnPropertyNames(e).filter(function(n){return e[n]!==void 0&&e[n]!==""}).map(function(n){return"".concat(n,"=").concat(e[n])});return r.length?"".concat(t,"?").concat(r.join("&")):t}function Fm(t){return"not(".concat(t.join(" and "),")")}const Xw=t=>Object.keys(t).reduce((e,r)=>{var n;switch(r){case"type":return!((n=t[r])===null||n===void 0)&&n.length?Object.assign(Object.assign({},e),{[r]:{in:t[r]}}):e;default:return Object.assign(Object.assign({},e),{[r]:t[r]})}},{}),Jw=t=>Object.keys(t).reduce((e,r)=>{switch(r){case"filter":return Object.assign(Object.assign({},e),{[r]:Xw(t.filter)});default:return Object.assign(Object.assign({},e),{[r]:t[r]})}},{}),Zw=t=>typeof t=="string"?t:qw(Jw(t)),ex=(t,e)=>{var r;const n=(r=Jn[t])!==null&&r!==void 0?r:t;switch(n){case Jn.v2:throw new k3(t);case Jn.v1:default:{const{query:i,includeDeleted:o}=e,a=new URLSearchParams(Zw(i));return a.append("api-version",n),o&&a.append("includeDeleted","true"),`/contexts/?${String(a)}`}}},tx=(t,e,r)=>[ex(t,e),r],rx=(t,e,r="json")=>(n,i)=>t[r](...tx(e,n,i));class nx{get Version(){return Jn}constructor(e,r){this._client=e,this._method=r}get(e,...r){return Fw(this._client,e,this._method)(...r)}query(e,...r){return rx(this._client,e,this._method)(...r)}}var Jn;(function(t){t.v1="1.0",t.v2="2.0"})(Jn||(Jn={}));const ix=(t,e)=>{switch(t){case"v1":{const{id:r}=e,n=new URLSearchParams;return n.append("api-version","1.0"),`/bookmarks/${r}/?${String(n)}`}default:{const{id:r}=e,n=new URLSearchParams;return n.append("api-version",t),`/bookmarks/${r}/?${String(n)}`}}},ox=(t,e,r)=>{const n=ix(t,e),i=Object.assign({},{method:"Delete"},r);return[n,i]},ax=(t,e,r="json")=>(n,i)=>t[r](...ox(e,n,i)),sx=ax,cx=(t,e)=>{switch(t){case"v1":{const{id:r}=e,n=new URLSearchParams;return n.append("api-version","1.0"),`/bookmarks/${r}/?${String(n)}`}default:{const{id:r}=e,n=new URLSearchParams;return n.append("api-version",t),`/bookmarks/${r}/?${String(n)}`}}},lx=(t,e,r)=>[cx(t,e),r],dx=(t,e,r="json")=>(n,i)=>t[r](...lx(e,n,i)),hx=dx,ux=(t,e)=>{switch(t){case"v1":{const r=new URLSearchParams;return r.append("api-version","1.0"),`/bookmarks?${String(r)}`}default:{const r=new URLSearchParams;return r.append("api-version",t),`/bookmarks?${String(r)}`}}},fx=(t,e,r)=>{const n=ux(t),i=new Headers;i.append("content-type","application/json");const o=Object.assign({},{method:"post",body:JSON.stringify(e),headers:i},r);return[n,o]},px=(t,e,r="json")=>(n,i)=>t[r](...fx(e,n,i)),mx=px;class vx{constructor(e,r){this._client=e,this._method=r}get(e,...r){return hx(this._client,e,this._method)(...r)}post(e,...r){return mx(this._client,e,this._method)(...r)}delete(e,...r){return sx(this._client,e,this._method)(...r)}}const gx=vx;var Um=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};class yx{constructor({createClient:e}){this._createClientFn=e}createBookmarksClient(e){return Um(this,void 0,void 0,function*(){const r=yield this._createClientFn("bookmarks");return new gx(r,e)})}createContextClient(e){return Um(this,void 0,void 0,function*(){const r=yield this._createClientFn("context");return new nx(r,e)})}}var T3=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const _x="services",bx=(t,e)=>r=>T3(void 0,void 0,void 0,function*(){if(t.hasClient(r))return t.createClient(r);if(e)return e.createClient(r);throw Error(`failed to create http client for service ${r}`)}),wx={name:_x,configure:()=>new Dw,initialize:({ref:t,config:e,requireInstance:r,hasModule:n})=>T3(void 0,void 0,void 0,function*(){if(!e.createClient){const i=yield r("http"),o=n("serviceDiscovery")?yield r("serviceDiscovery"):t==null?void 0:t.serviceDiscovery;e.createClient=bx(i,o)}if(!e.createClient)throw Error("missing configuration for creating API client");return new yx(e)})},xx=wx;class Ex extends Iy{constructor(){super([Dy,p3,Qf,Ow,xx,kw,hw]),this.logger=new Eg("FrameworkConfigurator")}configureHttp(...e){this.addConfig(Wy(...e))}configureHttpClient(...e){this.addConfig(Zg(...e))}configureMsal(...e){this.addConfig(cb(...e))}configureServiceDiscovery(e){this.configureHttpClient("service_discovery",e.client)}}var Cx=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const zx=(t,e)=>Cx(void 0,void 0,void 0,function*(){const r=yield t.initialize(e),n={modules:r};return window.Fusion=n,r.event.dispatchEvent("onFrameworkLoaded",{detail:n}),n}),I3=A.exports.createContext(null),Sx=I3.Provider;var kx=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d))}catch(h){a(h)}}function c(d){try{l(n.throw(d))}catch(h){a(h)}}function l(d){d.done?o(d.value):i(d.value).then(s,c)}l((n=n.apply(t,e||[])).next())})};const Ax=t=>A.exports.lazy(()=>kx(void 0,void 0,void 0,function*(){const e=new Ex;yield t(e);const r=yield zx(e);return{default:({children:n})=>Q(Sx,Object.assign({value:r},{children:n}))}})),u0=()=>{let t=A.exports.useContext(I3);return t||console.warn("could not locate fusion in context!"),t??(t=window.Fusion),t||console.error("Could not load framework, might not be initiated?"),t},Tx=t=>{const e=A.exports.useMemo(()=>Ax(t.configure),[t.configure]);return Q(A.exports.Suspense,Object.assign({fallback:t.fallback},{children:Q(e,{children:t.children})}))};function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ce.apply(this,arguments)}function w2(t){return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w2(t)}function Ih(t){return t&&w2(t)==="object"&&t.constructor===Object}function M3(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{clone:!0},n=r.clone?Ce({},t):t;return Ih(t)&&Ih(e)&&Object.keys(e).forEach(function(i){i!=="__proto__"&&(Ih(e[i])&&i in t?n[i]=M3(t[i],e[i],r):n[i]=e[i])}),n}var Ix=typeof Symbol=="function"&&Symbol.for;const P3=Ix?Symbol.for("mui.nested"):"__THEME_NESTED__";var Mx=["checked","disabled","error","focused","focusVisible","required","expanded","selected"];function Px(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.disableGlobal,r=e===void 0?!1:e,n=t.productionPrefix,i=n===void 0?"jss":n,o=t.seed,a=o===void 0?"":o,s=a===""?"":"".concat(a,"-"),c=0,l=function(){return c+=1,c};return function(d,h){var u=h.options.name;if(u&&u.indexOf("Mui")===0&&!h.options.link&&!r){if(Mx.indexOf(d.key)!==-1)return"Mui-".concat(d.key);var f="".concat(s).concat(u,"-").concat(d.key);return!h.options.theme[P3]||a!==""?f:"".concat(f,"-").concat(l())}return"".concat(s).concat(i).concat(l())}}var $m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tc=(typeof window>"u"?"undefined":$m(window))==="object"&&(typeof document>"u"?"undefined":$m(document))==="object"&&document.nodeType===9;function jm(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function R3(t,e,r){return e&&jm(t.prototype,e),r&&jm(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function x2(t,e){return x2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},x2(t,e)}function H3(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,x2(t,e)}function Bm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function L3(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}var Rx={}.constructor;function E2(t){if(t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(E2);if(t.constructor!==Rx)return t;var e={};for(var r in t)e[r]=E2(t[r]);return e}function f0(t,e,r){t===void 0&&(t="unnamed");var n=r.jss,i=E2(e),o=n.plugins.onCreateRule(t,i,r);return o||(t[0],null)}var qm=function(e,r){for(var n="",i=0;i<e.length&&e[i]!=="!important";i++)n&&(n+=r),n+=e[i];return n},yo=function(e){if(!Array.isArray(e))return e;var r="";if(Array.isArray(e[0]))for(var n=0;n<e.length&&e[n]!=="!important";n++)r&&(r+=", "),r+=qm(e[n]," ");else r=qm(e,", ");return e[e.length-1]==="!important"&&(r+=" !important"),r};function Ba(t){return t&&t.format===!1?{linebreak:"",space:""}:{linebreak:`
|
|
16
16
|
`,space:" "}}function as(t,e){for(var r="",n=0;n<e;n++)r+=" ";return r+t}function gc(t,e,r){r===void 0&&(r={});var n="";if(!e)return n;var i=r,o=i.indent,a=o===void 0?0:o,s=e.fallbacks;r.format===!1&&(a=-1/0);var c=Ba(r),l=c.linebreak,d=c.space;if(t&&a++,s)if(Array.isArray(s))for(var h=0;h<s.length;h++){var u=s[h];for(var f in u){var v=u[f];v!=null&&(n&&(n+=l),n+=as(f+":"+d+yo(v)+";",a))}}else for(var g in s){var x=s[g];x!=null&&(n&&(n+=l),n+=as(g+":"+d+yo(x)+";",a))}for(var m in e){var p=e[m];p!=null&&m!=="fallbacks"&&(n&&(n+=l),n+=as(m+":"+d+yo(p)+";",a))}return!n&&!r.allowEmpty||!t?n:(a--,n&&(n=""+l+n+l),as(""+t+d+"{"+n,a)+as("}",a))}var Hx=/([[\].#*$><+~=|^:(),"'`\s])/g,Gm=typeof CSS<"u"&&CSS.escape,p0=function(t){return Gm?Gm(t):t.replace(Hx,"\\$1")},O3=function(){function t(r,n,i){this.type="style",this.isProcessed=!1;var o=i.sheet,a=i.Renderer;this.key=r,this.options=i,this.style=n,o?this.renderer=o.renderer:a&&(this.renderer=new a)}var e=t.prototype;return e.prop=function(n,i,o){if(i===void 0)return this.style[n];var a=o?o.force:!1;if(!a&&this.style[n]===i)return this;var s=i;(!o||o.process!==!1)&&(s=this.options.jss.plugins.onChangeValue(i,n,this));var c=s==null||s===!1,l=n in this.style;if(c&&!l&&!a)return this;var d=c&&l;if(d?delete this.style[n]:this.style[n]=s,this.renderable&&this.renderer)return d?this.renderer.removeProperty(this.renderable,n):this.renderer.setProperty(this.renderable,n,s),this;var h=this.options.sheet;return h&&h.attached,this},t}(),C2=function(t){H3(e,t);function e(n,i,o){var a;a=t.call(this,n,i,o)||this;var s=o.selector,c=o.scoped,l=o.sheet,d=o.generateId;return s?a.selectorText=s:c!==!1&&(a.id=d(Bm(Bm(a)),l),a.selectorText="."+p0(a.id)),a}var r=e.prototype;return r.applyTo=function(i){var o=this.renderer;if(o){var a=this.toJSON();for(var s in a)o.setProperty(i,s,a[s])}return this},r.toJSON=function(){var i={};for(var o in this.style){var a=this.style[o];typeof a!="object"?i[o]=a:Array.isArray(a)&&(i[o]=yo(a))}return i},r.toString=function(i){var o=this.options.sheet,a=o?o.options.link:!1,s=a?Ce({},i,{allowEmpty:!0}):i;return gc(this.selectorText,this.style,s)},R3(e,[{key:"selector",set:function(i){if(i!==this.selectorText){this.selectorText=i;var o=this.renderer,a=this.renderable;if(!(!a||!o)){var s=o.setSelector(a,i);s||o.replaceRule(a,this)}}},get:function(){return this.selectorText}}]),e}(O3),Lx={onCreateRule:function(e,r,n){return e[0]==="@"||n.parent&&n.parent.type==="keyframes"?null:new C2(e,r,n)}},Mh={indent:1,children:!0},Ox=/@([\w-]+)/,Dx=function(){function t(r,n,i){this.type="conditional",this.isProcessed=!1,this.key=r;var o=r.match(Ox);this.at=o?o[1]:"unknown",this.query=i.name||"@"+this.at,this.options=i,this.rules=new z1(Ce({},i,{parent:this}));for(var a in n)this.rules.add(a,n[a]);this.rules.process()}var e=t.prototype;return e.getRule=function(n){return this.rules.get(n)},e.indexOf=function(n){return this.rules.indexOf(n)},e.addRule=function(n,i,o){var a=this.rules.add(n,i,o);return a?(this.options.jss.plugins.onProcessRule(a),a):null},e.replaceRule=function(n,i,o){var a=this.rules.replace(n,i,o);return a&&this.options.jss.plugins.onProcessRule(a),a},e.toString=function(n){n===void 0&&(n=Mh);var i=Ba(n),o=i.linebreak;if(n.indent==null&&(n.indent=Mh.indent),n.children==null&&(n.children=Mh.children),n.children===!1)return this.query+" {}";var a=this.rules.toString(n);return a?this.query+" {"+o+a+o+"}":""},t}(),Nx=/@media|@supports\s+/,Vx={onCreateRule:function(e,r,n){return Nx.test(e)?new Dx(e,r,n):null}},Ph={indent:1,children:!0},Fx=/@keyframes\s+([\w-]+)/,z2=function(){function t(r,n,i){this.type="keyframes",this.at="@keyframes",this.isProcessed=!1;var o=r.match(Fx);o&&o[1]?this.name=o[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=i;var a=i.scoped,s=i.sheet,c=i.generateId;this.id=a===!1?this.name:p0(c(this,s)),this.rules=new z1(Ce({},i,{parent:this}));for(var l in n)this.rules.add(l,n[l],Ce({},i,{parent:this}));this.rules.process()}var e=t.prototype;return e.toString=function(n){n===void 0&&(n=Ph);var i=Ba(n),o=i.linebreak;if(n.indent==null&&(n.indent=Ph.indent),n.children==null&&(n.children=Ph.children),n.children===!1)return this.at+" "+this.id+" {}";var a=this.rules.toString(n);return a&&(a=""+o+a+o),this.at+" "+this.id+" {"+a+"}"},t}(),Ux=/@keyframes\s+/,$x=/\$([\w-]+)/g,S2=function(e,r){return typeof e=="string"?e.replace($x,function(n,i){return i in r?r[i]:n}):e},Km=function(e,r,n){var i=e[r],o=S2(i,n);o!==i&&(e[r]=o)},jx={onCreateRule:function(e,r,n){return typeof e=="string"&&Ux.test(e)?new z2(e,r,n):null},onProcessStyle:function(e,r,n){return r.type!=="style"||!n||("animation-name"in e&&Km(e,"animation-name",n.keyframes),"animation"in e&&Km(e,"animation",n.keyframes)),e},onChangeValue:function(e,r,n){var i=n.options.sheet;if(!i)return e;switch(r){case"animation":return S2(e,i.keyframes);case"animation-name":return S2(e,i.keyframes);default:return e}}},Bx=function(t){H3(e,t);function e(){return t.apply(this,arguments)||this}var r=e.prototype;return r.toString=function(i){var o=this.options.sheet,a=o?o.options.link:!1,s=a?Ce({},i,{allowEmpty:!0}):i;return gc(this.key,this.style,s)},e}(O3),qx={onCreateRule:function(e,r,n){return n.parent&&n.parent.type==="keyframes"?new Bx(e,r,n):null}},Gx=function(){function t(r,n,i){this.type="font-face",this.at="@font-face",this.isProcessed=!1,this.key=r,this.style=n,this.options=i}var e=t.prototype;return e.toString=function(n){var i=Ba(n),o=i.linebreak;if(Array.isArray(this.style)){for(var a="",s=0;s<this.style.length;s++)a+=gc(this.at,this.style[s]),this.style[s+1]&&(a+=o);return a}return gc(this.at,this.style,n)},t}(),Kx=/@font-face/,Wx={onCreateRule:function(e,r,n){return Kx.test(e)?new Gx(e,r,n):null}},Yx=function(){function t(r,n,i){this.type="viewport",this.at="@viewport",this.isProcessed=!1,this.key=r,this.style=n,this.options=i}var e=t.prototype;return e.toString=function(n){return gc(this.key,this.style,n)},t}(),Qx={onCreateRule:function(e,r,n){return e==="@viewport"||e==="@-ms-viewport"?new Yx(e,r,n):null}},Xx=function(){function t(r,n,i){this.type="simple",this.isProcessed=!1,this.key=r,this.value=n,this.options=i}var e=t.prototype;return e.toString=function(n){if(Array.isArray(this.value)){for(var i="",o=0;o<this.value.length;o++)i+=this.key+" "+this.value[o]+";",this.value[o+1]&&(i+=`
|
|
17
17
|
`);return i}return this.key+" "+this.value+";"},t}(),Jx={"@charset":!0,"@import":!0,"@namespace":!0},Zx={onCreateRule:function(e,r,n){return e in Jx?new Xx(e,r,n):null}},Wm=[Lx,Vx,jx,qx,Wx,Qx,Zx],eE={process:!0},Ym={force:!0,process:!0},z1=function(){function t(r){this.map={},this.raw={},this.index=[],this.counter=0,this.options=r,this.classes=r.classes,this.keyframes=r.keyframes}var e=t.prototype;return e.add=function(n,i,o){var a=this.options,s=a.parent,c=a.sheet,l=a.jss,d=a.Renderer,h=a.generateId,u=a.scoped,f=Ce({classes:this.classes,parent:s,sheet:c,jss:l,Renderer:d,generateId:h,scoped:u,name:n,keyframes:this.keyframes,selector:void 0},o),v=n;n in this.raw&&(v=n+"-d"+this.counter++),this.raw[v]=i,v in this.classes&&(f.selector="."+p0(this.classes[v]));var g=f0(v,i,f);if(!g)return null;this.register(g);var x=f.index===void 0?this.index.length:f.index;return this.index.splice(x,0,g),g},e.replace=function(n,i,o){var a=this.get(n),s=this.index.indexOf(a);a&&this.remove(a);var c=o;return s!==-1&&(c=Ce({},o,{index:s})),this.add(n,i,c)},e.get=function(n){return this.map[n]},e.remove=function(n){this.unregister(n),delete this.raw[n.key],this.index.splice(this.index.indexOf(n),1)},e.indexOf=function(n){return this.index.indexOf(n)},e.process=function(){var n=this.options.jss.plugins;this.index.slice(0).forEach(n.onProcessRule,n)},e.register=function(n){this.map[n.key]=n,n instanceof C2?(this.map[n.selector]=n,n.id&&(this.classes[n.key]=n.id)):n instanceof z2&&this.keyframes&&(this.keyframes[n.name]=n.id)},e.unregister=function(n){delete this.map[n.key],n instanceof C2?(delete this.map[n.selector],delete this.classes[n.key]):n instanceof z2&&delete this.keyframes[n.name]},e.update=function(){var n,i,o;if(typeof(arguments.length<=0?void 0:arguments[0])=="string"?(n=arguments.length<=0?void 0:arguments[0],i=arguments.length<=1?void 0:arguments[1],o=arguments.length<=2?void 0:arguments[2]):(i=arguments.length<=0?void 0:arguments[0],o=arguments.length<=1?void 0:arguments[1],n=null),n)this.updateOne(this.get(n),i,o);else for(var a=0;a<this.index.length;a++)this.updateOne(this.index[a],i,o)},e.updateOne=function(n,i,o){o===void 0&&(o=eE);var a=this.options,s=a.jss.plugins,c=a.sheet;if(n.rules instanceof t){n.rules.update(i,o);return}var l=n.style;if(s.onUpdate(i,n,c,o),o.process&&l&&l!==n.style){s.onProcessStyle(n.style,n,c);for(var d in n.style){var h=n.style[d],u=l[d];h!==u&&n.prop(d,h,Ym)}for(var f in l){var v=n.style[f],g=l[f];v==null&&v!==g&&n.prop(f,null,Ym)}}},e.toString=function(n){for(var i="",o=this.options.sheet,a=o?o.options.link:!1,s=Ba(n),c=s.linebreak,l=0;l<this.index.length;l++){var d=this.index[l],h=d.toString(n);!h&&!a||(i&&(i+=c),i+=h)}return i},t}(),D3=function(){function t(r,n){this.attached=!1,this.deployed=!1,this.classes={},this.keyframes={},this.options=Ce({},n,{sheet:this,parent:this,classes:this.classes,keyframes:this.keyframes}),n.Renderer&&(this.renderer=new n.Renderer(this)),this.rules=new z1(this.options);for(var i in r)this.rules.add(i,r[i]);this.rules.process()}var e=t.prototype;return e.attach=function(){return this.attached?this:(this.renderer&&this.renderer.attach(),this.attached=!0,this.deployed||this.deploy(),this)},e.detach=function(){return this.attached?(this.renderer&&this.renderer.detach(),this.attached=!1,this):this},e.addRule=function(n,i,o){var a=this.queue;this.attached&&!a&&(this.queue=[]);var s=this.rules.add(n,i,o);return s?(this.options.jss.plugins.onProcessRule(s),this.attached?(this.deployed&&(a?a.push(s):(this.insertRule(s),this.queue&&(this.queue.forEach(this.insertRule,this),this.queue=void 0))),s):(this.deployed=!1,s)):null},e.replaceRule=function(n,i,o){var a=this.rules.get(n);if(!a)return this.addRule(n,i,o);var s=this.rules.replace(n,i,o);return s&&this.options.jss.plugins.onProcessRule(s),this.attached?(this.deployed&&this.renderer&&(s?a.renderable&&this.renderer.replaceRule(a.renderable,s):this.renderer.deleteRule(a)),s):(this.deployed=!1,s)},e.insertRule=function(n){this.renderer&&this.renderer.insertRule(n)},e.addRules=function(n,i){var o=[];for(var a in n){var s=this.addRule(a,n[a],i);s&&o.push(s)}return o},e.getRule=function(n){return this.rules.get(n)},e.deleteRule=function(n){var i=typeof n=="object"?n:this.rules.get(n);return!i||this.attached&&!i.renderable?!1:(this.rules.remove(i),this.attached&&i.renderable&&this.renderer?this.renderer.deleteRule(i.renderable):!0)},e.indexOf=function(n){return this.rules.indexOf(n)},e.deploy=function(){return this.renderer&&this.renderer.deploy(),this.deployed=!0,this},e.update=function(){var n;return(n=this.rules).update.apply(n,arguments),this},e.updateOne=function(n,i,o){return this.rules.updateOne(n,i,o),this},e.toString=function(n){return this.rules.toString(n)},t}(),tE=function(){function t(){this.plugins={internal:[],external:[]},this.registry={}}var e=t.prototype;return e.onCreateRule=function(n,i,o){for(var a=0;a<this.registry.onCreateRule.length;a++){var s=this.registry.onCreateRule[a](n,i,o);if(s)return s}return null},e.onProcessRule=function(n){if(!n.isProcessed){for(var i=n.options.sheet,o=0;o<this.registry.onProcessRule.length;o++)this.registry.onProcessRule[o](n,i);n.style&&this.onProcessStyle(n.style,n,i),n.isProcessed=!0}},e.onProcessStyle=function(n,i,o){for(var a=0;a<this.registry.onProcessStyle.length;a++)i.style=this.registry.onProcessStyle[a](i.style,i,o)},e.onProcessSheet=function(n){for(var i=0;i<this.registry.onProcessSheet.length;i++)this.registry.onProcessSheet[i](n)},e.onUpdate=function(n,i,o,a){for(var s=0;s<this.registry.onUpdate.length;s++)this.registry.onUpdate[s](n,i,o,a)},e.onChangeValue=function(n,i,o){for(var a=n,s=0;s<this.registry.onChangeValue.length;s++)a=this.registry.onChangeValue[s](a,i,o);return a},e.use=function(n,i){i===void 0&&(i={queue:"external"});var o=this.plugins[i.queue];o.indexOf(n)===-1&&(o.push(n),this.registry=[].concat(this.plugins.external,this.plugins.internal).reduce(function(a,s){for(var c in s)c in a&&a[c].push(s[c]);return a},{onCreateRule:[],onProcessRule:[],onProcessStyle:[],onProcessSheet:[],onChangeValue:[],onUpdate:[]}))},t}(),rE=function(){function t(){this.registry=[]}var e=t.prototype;return e.add=function(n){var i=this.registry,o=n.options.index;if(i.indexOf(n)===-1){if(i.length===0||o>=this.index){i.push(n);return}for(var a=0;a<i.length;a++)if(i[a].options.index>o){i.splice(a,0,n);return}}},e.reset=function(){this.registry=[]},e.remove=function(n){var i=this.registry.indexOf(n);this.registry.splice(i,1)},e.toString=function(n){for(var i=n===void 0?{}:n,o=i.attached,a=L3(i,["attached"]),s=Ba(a),c=s.linebreak,l="",d=0;d<this.registry.length;d++){var h=this.registry[d];o!=null&&h.attached!==o||(l&&(l+=c),l+=h.toString(a))}return l},R3(t,[{key:"index",get:function(){return this.registry.length===0?0:this.registry[this.registry.length-1].options.index}}]),t}(),js=new rE,k2=typeof globalThis<"u"?globalThis:typeof window<"u"&&window.Math===Math?window:typeof self<"u"&&self.Math===Math?self:Function("return this")(),A2="2f1acc6c3a606b082e5eef5e54414ffb";k2[A2]==null&&(k2[A2]=0);var Qm=k2[A2]++,Xm=function(e){e===void 0&&(e={});var r=0,n=function(o,a){r+=1;var s="",c="";return a&&(a.options.classNamePrefix&&(c=a.options.classNamePrefix),a.options.jss.id!=null&&(s=String(a.options.jss.id))),e.minify?""+(c||"c")+Qm+s+r:c+o.key+"-"+Qm+(s?"-"+s:"")+"-"+r};return n},N3=function(e){var r;return function(){return r||(r=e()),r}},nE=function(e,r){try{return e.attributeStyleMap?e.attributeStyleMap.get(r):e.style.getPropertyValue(r)}catch{return""}},iE=function(e,r,n){try{var i=n;if(Array.isArray(n)&&(i=yo(n)),e.attributeStyleMap)e.attributeStyleMap.set(r,i);else{var o=i?i.indexOf("!important"):-1,a=o>-1?i.substr(0,o-1):i;e.style.setProperty(r,a,o>-1?"important":"")}}catch{return!1}return!0},oE=function(e,r){try{e.attributeStyleMap?e.attributeStyleMap.delete(r):e.style.removeProperty(r)}catch{}},aE=function(e,r){return e.selectorText=r,e.selectorText===r},V3=N3(function(){return document.querySelector("head")});function sE(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(n.attached&&n.options.index>e.index&&n.options.insertionPoint===e.insertionPoint)return n}return null}function cE(t,e){for(var r=t.length-1;r>=0;r--){var n=t[r];if(n.attached&&n.options.insertionPoint===e.insertionPoint)return n}return null}function lE(t){for(var e=V3(),r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(n.nodeType===8&&n.nodeValue.trim()===t)return n}return null}function dE(t){var e=js.registry;if(e.length>0){var r=sE(e,t);if(r&&r.renderer)return{parent:r.renderer.element.parentNode,node:r.renderer.element};if(r=cE(e,t),r&&r.renderer)return{parent:r.renderer.element.parentNode,node:r.renderer.element.nextSibling}}var n=t.insertionPoint;if(n&&typeof n=="string"){var i=lE(n);if(i)return{parent:i.parentNode,node:i.nextSibling}}return!1}function hE(t,e){var r=e.insertionPoint,n=dE(e);if(n!==!1&&n.parent){n.parent.insertBefore(t,n.node);return}if(r&&typeof r.nodeType=="number"){var i=r,o=i.parentNode;o&&o.insertBefore(t,i.nextSibling);return}V3().appendChild(t)}var uE=N3(function(){var t=document.querySelector('meta[property="csp-nonce"]');return t?t.getAttribute("content"):null}),Jm=function(e,r,n){try{"insertRule"in e?e.insertRule(r,n):"appendRule"in e&&e.appendRule(r)}catch{return!1}return e.cssRules[n]},Zm=function(e,r){var n=e.cssRules.length;return r===void 0||r>n?n:r},fE=function(){var e=document.createElement("style");return e.textContent=`
|
|
18
18
|
`,e},pE=function(){function t(r){this.getPropertyValue=nE,this.setProperty=iE,this.removeProperty=oE,this.setSelector=aE,this.hasInsertedRules=!1,this.cssRules=[],r&&js.add(r),this.sheet=r;var n=this.sheet?this.sheet.options:{},i=n.media,o=n.meta,a=n.element;this.element=a||fE(),this.element.setAttribute("data-jss",""),i&&this.element.setAttribute("media",i),o&&this.element.setAttribute("data-meta",o);var s=uE();s&&this.element.setAttribute("nonce",s)}var e=t.prototype;return e.attach=function(){if(!(this.element.parentNode||!this.sheet)){hE(this.element,this.sheet.options);var n=Boolean(this.sheet&&this.sheet.deployed);this.hasInsertedRules&&n&&(this.hasInsertedRules=!1,this.deploy())}},e.detach=function(){if(!!this.sheet){var n=this.element.parentNode;n&&n.removeChild(this.element),this.sheet.options.link&&(this.cssRules=[],this.element.textContent=`
|